forked from rsdn/nemerle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·913 lines (785 loc) · 24.7 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
#! /bin/sh
#
# Copyright (c) 2003-2005 The University of Wroclaw.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the University may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
# NO EVENT SHALL THE UNIVERSITY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
############################################################
# VARIABLES
############################################################
# frequently changed stuff
nem_version=0.9
nem_revision=3.99
use_ngen=0
# this variable is used to return values from functions
result=
config_log="configure.log"
python=
install="install"
prefix="/usr/local"
bindir="$prefix/bin"
scrdir="$prefix/bin"
mandir="$prefix/man/man1"
libdir="$prefix/lib"
pkgconfig_dir=
dll_path=
nem_tmp_file=
mono_libdir=
time=
peverify=
quiet=@
bar=true
ignore_errors=no
netSDK=
netFRAMEWORK=
netVERSION="2.0"
generics=true
force_old=0
broken_swf=0
monopath=
antlr=
antlr_path=antlr
nant_path=nant
mono_gacutil=no
vsplugindir=vsplugin
wixpath=
############################################################
# FUNCTIONS
############################################################
abort () {
echo
echo
echo "*** $@ ***"
if test -f $config_log; then
echo "*** Check $config_log for details. ***"
fi
echo
if [ "$ignore_errors" = yes ] ; then
echo "*** Ignoring error. ***"
else
echo "Aborting..."
rm -f $config_mak
exit 1
fi
}
echo_check_for () {
echo "--------------- Checking for $@ ---------------" >> $config_log
echo -n "Checking for $@... "
}
echo_check_if () {
echo "--------------- Checking if $@ ----------------" >> $config_log
echo -n "Checking if $@... "
}
echo_result () {
echo "Result: $@" >> $config_log
echo "-----------------------------------------------" >> $config_log
echo >> $config_log
echo "$@"
}
# This function tries to execute command given as an argument and returns
# shell exit code. If the program doesn't exist in a path shell returns
# 127. If the program is not a valid executable shell returns 126.
# If the program lacks some arguments it usually returns 1, otherwise
# this function should return 0.
#
# E.g.
# try_execute cc --version
# if test $? = 0; then
# echo "found"
# else
# echo "not found"
# fi
try_execute () {
echo "Trying execute: $@" >> $config_log
"$@" >> $config_log 2>&1
ret=$?
echo "Execution status code: $ret." >> $config_log
return $ret;
}
nem_try_compile () {
echo "<<<<<<<<<<<<<<<" >> $config_log
cat "$nem_tmp_file" >> $config_log
echo ">>>>>>>>>>>>>>>" >> $config_log
old_mono_path=$MONO_PATH
MONO_PATH=boot
$engine $net_flags boot/ncc.exe -q -no-color -texe -out:out.exe "$@" "$nem_tmp_file_aux" >> $config_log 2>&1
MONO_PATH=$old_mono_path
if test -f out.exe; then
rm -f out.exe
echo_result "yes"
return 0
else
echo_result "no"
return 1
fi
}
# dash check
if (( 1 < 2 )) ; then
:
else
echo "It appears you are running not supported shell. Please use:"
echo " bash ./configure"
echo "or"
echo " ksh ./configure"
exit 1
fi
############################################################
# PARAMETERS SCAN
############################################################
for i in $@; do
if test "$i" = "--help" || test "$i" = "-help" || test "$i" = "-h"; then
if [ $use_ngen = 0 ] ; then
ngen_yes=
ngen_no="(default)"
else
ngen_yes="(default)"
ngen_no=
fi
cat << EOF
Usage: $0 [OPTIONS]...
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
Installation directories:
--prefix=DIR use this prefix for installing Nemerle [/usr/local]
--bindir=DIR use this prefix for installing executables
[PREFIX/bin]
--scrdir=DIR use this prefix for installing shell wrappers for CLI
binaries [PREFIX/bin]
--mandir=DIR use this prefix for installing manpages
[PREFIX/man/man1]
--libdir=DIR object code libraries [PREFIX/lib]
--pkgconfigdir=DIR specify directory where nemerle.pc is to be installed
[LIBDIR/pkgconfig]
Miscellaneous options:
--nemerle-flags=FLAGS pass these flags to nemerle compiler
--net-engine=ENGINE use this .NET engine
--net-version=[1.1|2.0] use tools from this .NET runtime version
--net-flags=FLAGS pass these flags to .NET engine
--install-path=PATH the path to a custom install program
--dll-path=PATH the path to dlls directory
--antlr-path=PATH/CMD command to execute AntLR [default: antlr]
--nant-path=PATH/CMD command to execute NAnt [default: nant]
--wix-path=PATH path to directory, where your Wix is installed
--vsplugin-dir=PATH relative path to directory containing Visual Studio plugin directory [default: vsplugin]
--force-old-mono use this switch to force using your version of
Mono .NET environment or if you don't use Mono
at all but have it installed
--mono-from=PATH use this path prefix when referencing tools from
mono, like /usr/local/bin/ [default empty]
--ignore-errors do not exit on errors
--disable-aot do not try to mono --aot/ngen the assemblies $ngen_no
--enable-aot try to mono --aot/ngen the assemblies $ngen_yes
Optional features:
--enable-debug adds --debug to net-flags and -debug to compiler flags
--enable-time enable compilation times statistics
--disable-quiet disable beautiful output
--disable-bar disable progress bar
EOF
exit 0
fi
done
for ac_option do
case "$ac_option" in
--prefix=*)
prefix=`echo $ac_option | cut -d '=' -f 2`
bindir="$prefix/bin"
mandir="$prefix/man/man1"
libdir="$prefix/lib"
scrdir="$bindir"
;;
--bindir=*)
bindir=`echo $ac_option | cut -d '=' -f 2`
;;
--scrdir=*)
scrdir=`echo $ac_option | cut -d '=' -f 2`
;;
--mandir=*)
mandir=`echo $ac_option | cut -d '=' -f 2`
;;
--libdir=*)
libdir=`echo $ac_option | cut -d '=' -f 2`
mono_libdir="$libdir"
;;
--pkgconfigdir=*)
pkgconfig_dir=`echo $ac_option | cut -d '=' -f 2`
;;
--nemerle-flags=*)
nem_flags=`echo $ac_option | cut -d '=' -f 2`
;;
--net-engine=*)
engine=`echo $ac_option | cut -d '=' -f 2`
;;
--net-flags=*)
net_flags=`echo $ac_option | cut -d '=' -f 2`
;;
--install-path=*)
install=`echo $ac_option | cut -d '=' -f 2 | sed 's/\/$//'`"/install"
;;
--dll-path=*)
dll_path=`echo $ac_option | cut -d '=' -f 2`
;;
--antlr-path=*)
antlr_path=`echo $ac_option | cut -d '=' -f 2`
;;
--nant-path=*)
nant_path=`echo $ac_option | cut -d '=' -f 2`
;;
--wix-path=*)
wixpath=`echo $ac_option | cut -d '=' -f 2`
;;
--vsplugin-dir=*)
vsplugindir=`echo $ac_option | cut -d '=' -f 2`
;;
--enable-debug)
csc_flags="$csc_flags -debug+"
net_flags="$net_flags --debug"
nem_flags="$nem_flags -debug -def:DEBUG"
;;
--force-old-mono)
force_old=1
;;
--enable-time)
time=time
;;
--disable-quiet)
quiet=
;;
--disable-aot)
use_ngen=0
;;
--disable-bar)
bar=false
;;
--enable-aot)
use_ngen=1
;;
--ignore-errors)
ignore_errors=yes
;;
--mono-from=*)
monopath=`echo $ac_option | cut -d '=' -f 2`"/"
engine="$monopath/mono"
;;
*)
echo "Unknown parameter: $ac_option"
echo "Try: ./configure --help"
exit 1
;;
esac
done
############################################################
# INITIALIZATION
############################################################
rm -f $config_log $config_mak
if [ "$pkgconfig_dir" = "" ] ; then
pkgconfig_dir="$libdir/pkgconfig"
fi
nem_tmp_file="`pwd`/config-tmp.n"
trap "rm -f $nem_tmp_file" EXIT
if [ "X`cygpath -wp ${nem_tmp_file} 2>/dev/null`" != "X" ] ; then
nem_tmp_file_aux="`cygpath -wp "${nem_tmp_file}"`"
else
nem_tmp_file_aux=${nem_tmp_file}
fi
############################################################
# TESTS
############################################################
# Step 1.
# Check if user has any nemerle compiler. Don't run it yet
# as we don't know how to do it yet.
if test -f boot/ncc.exe; then
true
elif test -f boot/ncc-boot.exe; then
mv boot/ncc-boot.exe boot/ncc.exe
else
echo "*** You need a working Nemerle compiler. ***"
echo "*** http://nemerle.org/download/ncc-boot.exe ***"
echo "*** Place it in boot/ncc.exe ***"
abort "Haven't found Nemerle compiler."
fi
# Step 2.
# Determine how to invoke .NET binaries.
if test -z "$engine"; then
echo_check_for ".NET environment"
if test -x boot/ncc.exe; then
true
else
chmod u+x boot/ncc.exe 2> /dev/null
fi
if test -x boot/true.exe; then
true
else
chmod u+x boot/true.exe 2> /dev/null
fi
if try_execute boot/true.exe; then
engine=none
echo_result "none required"
elif try_execute "${monopath}mono" boot/true.exe; then
engine="${monopath}mono"
echo_result "${monopath}mono"
fi
fi
if test -z "$engine"; then
abort "Haven't found any .NET environment on your system."
elif test "$engine" = none; then
engine=
net_flags=
fi
# Step 3.
# Require MONO >= 1.2.4
echo_check_if "we are using Mono < 1.2.4"
version=`"${monopath}mono" --version 2> /dev/null`
if test "$?" = 0; then
ver=`echo $version | sed 's/.*version \([0-9]*\.[0-9]*\(\.[0-9]*\)\?\).*/\1/g'`
m_major=`echo $ver | cut -d . -f 1`
m_minor=`echo $ver | cut -d . -f 2`
m_revision=`echo $ver | cut -d . -f 3`
if ((m_major < 1 ||
m_major == 1 && m_minor < 2 ||
m_major == 1 && m_minor == 2 && m_revision < 4)); then
echo_result "yes"
if test "$force_old" = 1; then
echo "Forcing Mono ${ver}... "
echo "Hope you know, what you are doing..."
else
echo "*** Mono $ver is unsupported. ***"
echo "*** If you still want to try running Nemerle ***"
echo "*** please use --force-old-mono switch. ***"
abort "Too old version of Mono."
fi
else
echo_result "no"
fi
else
echo_result "no"
fi
# Step 3a.
# Check if there is regtool.exe available in the system and configure paths
# to .NET SDK and Framework according to choosen version
echo_check_for "presence of regtool in the system"
try_execute regtool
if test $? -lt 126; then
echo_result "found"
echo_check_for ".NET SDK path"
try_execute regtool.exe get "/machine/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv${netVERSION}"
if test "$?" != 127 -a "$?" != 1; then
echo_result "found"
netSDK="`regtool.exe get "/machine/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv${netVERSION}"`Bin\\"
else
try_execute regtool.exe get "/machine/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder"
if test "$?" != 127 -a "$?" != 1; then
echo_result "found"
netSDK="`regtool.exe get "/machine/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder"`Bin\\"
else
echo_result "not found"
fi
fi
echo_check_for ".NET Framework path"
try_execute regtool.exe get "/machine/SOFTWARE/Microsoft/.NETFramework/InstallRoot"
if test "$?" != 127 -a "$?" != 1; then
echo_result "found"
netFRAMEWORK="`regtool.exe get "/machine/SOFTWARE/Microsoft/.NETFramework/InstallRoot"`"
netFRAMEWORK="`cygpath $netFRAMEWORK`"
netFRAMEWORK="`echo ${netFRAMEWORK}v${netVERSION}.* | head -n 1`""/"
else
echo_result "not found"
fi
else
echo_result "not found"
fi
# Step 4.
# Check how to invoke .NET disassembler
echo_check_for ".NET disassembler"
try_execute "`cygpath "${netSDK}ildasm.exe"`" -?
if test "$?" != 127 -a "$?" != 126; then
echo_result "ildasm"
dasm="\""`cygpath "${netSDK}ildasm.exe"`"\" -text"
else
try_execute "${monopath}monodis"
if test "$?" != 127 -a "$?" != 126; then
echo_result "${monopath}monodis"
dasm="${monopath}monodis"
else
try_execute "${netSDK}ildasm.exe" -text
if test "$?" != 127 -a "$?" != 126; then
echo "ildasm [PATH]"
dasm="ildasm.exe -text"
else
echo_result "not found"
echo "*** Please make sure that the .Net disassembler is ***"
echo "*** available somewhere in PATH. ***"
abort "Haven't found any disassembler on your system."
fi
fi
fi
# Step 5.
# Check how to invoke native image generator.
echo_check_for "native image generator"
if test "$use_ngen" = 0 ; then
echo_result disabled
ngen="true"
else
try_execute "${netFRAMEWORK}ngen.exe"
if test "$?" != 127 -a "$?" != 126; then
echo_result "ngen.exe"
ngen="${netFRAMEWORK}ngen.exe"
else
try_execute "${monopath}mono" --aot
if test "$?" != 127 -a "$?" != 126; then
echo_result "${monopath}mono --aot"
ngen="${monopath}mono --aot"
else
echo_result "not found"
echo "*** Please make sure that the native image generator is ***"
echo "*** available as a single executable file, somewhere in PATH. ***"
ngen="true"
use_ngen=0
fi
fi
fi
# Step 6.
# Try to compile an empty program with nemerle compiler to be sure,
# that it works.
echo_check_if "Nemerle compiler works"
cat > $nem_tmp_file << EOF
class M {
public static Main () : void {}
}
EOF
nem_try_compile
if test "$?" = 1; then
if test "$force_old" = 1; then
echo "*** You have requested to force old version of Mono. ***"
echo "*** Please don't submit bugs. ***"
fi
abort "Nemerle compiler seems to be broken."
fi
# Step 7.
# Check things for gacutil installation.
echo_check_for "gacutil"
try_execute "${monopath}${netFRAMEWORK}gacutil"
if test $? -lt 126; then
echo_result found
echo_check_if "we are using mono gacutil"
if "${monopath}${netFRAMEWORK}gacutil" --help 2>/dev/null | grep -q Mono ; then
echo_result yes
if [ "X$mono_libdir" = "X" -a "X$monopath" != "X" ] ; then
case $monopath in
*/bin | */bin/ )
mono_libdir=$(echo $monopath | sed -e 's/bin\/\?$/lib/')
;;
esac
fi
if [ "X$mono_libdir" = "X" ] ; then
echo_check_for "mono libdir"
if pkg-config --version >/dev/null 2>&1 ; then
mono_libdir=`pkg-config --variable=libdir mono 2>/dev/null`
if [ "X$mono_libdir" = "X" ] ; then
echo_result "no mono.pc, forcing /usr/lib"
mono_libdir=/usr/lib
else
if test -d $mono_libdir/mono/gac ; then
echo_result "$mono_libdir"
else
mono_libdir="`pkg-config --variable=prefix mono 2>/dev/null`/lib"
if test -d $mono_libdir/mono/gac ; then
echo_result "$mono_libdir"
else
mono_libdir=/usr/lib
echo_result "none is valid, forcing /usr/lib"
fi
fi
fi
else
echo_result "no pkg-config found, forcing /usr/lib"
mono_libdir=/usr/lib
fi
fi
gacutil_base="${monopath}gacutil -root \$(DESTDIR)$mono_libdir"
gacutil_command="$gacutil_base -package nemerle -i"
gacutil_uninstall_command="$gacutil_base -package nemerle -u"
if [ "$use_ngen" = "0" ] ; then
ngen_gac="true"
else
#ngen_gac="for f in \$(DESTDIR)$mono_libdir/mono/gac/Nemerle*/*/*.dll ; do mono --aot \$\$f ; done"
ngen_gac="true"
fi
mono_gacutil=yes
else
echo_result no
gacutil_command="${netFRAMEWORK}gacutil.exe -f -i"
gacutil_uninstall_command="${netFRAMEWORK}gacutil.exe -f -u"
ngen_gac="true"
fi
else
try_execute cygpath "${netSDK}"gacutil.exe
if test $? -lt 126; then
echo_result found
dasm="\""`cygpath "${netSDK}ildasm.exe"`"\" -text"
gacutil_command="\""`cygpath "${netSDK}gacutil.exe"`"\" -f -i"
gacutil_uninstall_command="\""`cygpath "${netSDK}gacutil.exe"`"\" -f -u"
ngen_gac="true"
else
echo_result "not found"
echo "*** ''make install'' won't work for you ***"
gacutil_command="echo 'gacutil has not been found, installation can not continue'; false"
fi
fi
# Step 8.
# Check if we have PEVerify.exe tool available
echo_check_for "PEVerify"
try_execute cygpath "${netSDK}"PEVerify.exe
if test $? -lt 126; then
echo_result found
peverify="\""`cygpath "${netSDK}PEVerify.exe"`"\""
else
echo_result "not found"
fi
# Step 9.
# Check if we have ilasm tool available
echo_check_for "ilasm2"
try_execute "${monopath}${netFRAMEWORK}ilasm2"
if test $? -lt 126; then
echo_result found
asm="${monopath}${netFRAMEWORK}ilasm2"
else
echo_result "not found"
echo_check_for "ilasm"
try_execute "${monopath}${netFRAMEWORK}ilasm"
if test $? -lt 126; then
echo_result found
asm="${monopath}${netFRAMEWORK}ilasm"
else
echo_result "not found"
fi
fi
# Step 10.
# Check if we have C# compiler available
echo_check_for "C# compiler"
cat > conftest.cs <<EOF
class M {
public static void foo<T>() { }
public static void Main () {}
}
EOF
if try_execute "${netFRAMEWORK}csc" conftest.cs ; then
echo_result "found, csc"
csc="${netFRAMEWORK}csc"
else
if try_execute "${monopath}gmcs" conftest.cs ; then
echo_result "found, gmcs"
csc="${monopath}gmcs"
else
echo_result "not found"
fi
fi
rm -f conftest.cs conftest.exe
# Step 11.
# Check for Python >= 2.3, and other programs required to build
# complete documentation.
echo_check_for "Python version"
for i in python2.3 python; do
str=`$i -V 2>&1`
if test "$?" -gt 0; then
continue
fi
ver=`echo $str | sed 's/.* \([0-9]\.[0-9]\).*/\1/g'`
case $ver in
2.[3456789] | [3456789].* )
echo_result "$ver, ok"
python=$i
;;
*)
echo_result "$ver, too_old"
;;
esac
break
done
if test -z $ver; then
echo_result "none"
fi
# Step 12.
# check for antlr for generating cs2n C# parser
echo_check_for "antlr >= 2.7.5"
# the debian antlr package uses a `runantlr' binary
antlrcommand=`which $antlr_path 2>/dev/null || which runantlr 2>/dev/null`
# and the debian antlr version also didn't match with this
# ver=`antlr 2>&1| head -1 | sed 's/.* \([0-9]*\.[0-9]\.[0-9]*\).*/\1/g'`
# this should be more general
ver=`"$antlrcommand" 2>&1 | grep -i version | sed 's/.*\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/g'`
case $ver in
2.7.[5-9])
antlr="$antlrcommand"
cp tools/cs2n/antlr/antlr.runtime-2.7.5.dll tools/cs2n/antlr/antlr.runtime.dll
echo_result "yes, 2.7.5+"
;;
*)
# also copy it for pregenerated parser!
cp tools/cs2n/antlr/antlr.runtime-2.7.5.dll tools/cs2n/antlr/antlr.runtime.dll
echo_result "not supported"
if find tools/cs2n/CSharpParser.cs -cnewer tools/cs2n/csharpgrammar.g 2> /dev/null | grep -q "" ; then
:
else
echo "*** You won't be able to build CS2N! ***"
fi
;;
esac
# Step 13.
echo_check_for "nant"
try_execute $nant_path
if test $? -lt 126; then
echo_result yes
nant=$nant_path
echo_check_for "nant plugin directory"
rm -f misc/nant.dir
try_execute $nant_path -buildfile:misc/print-dir.build
nant_dir=`cat misc/nant.dir 2>/dev/null`
rm -f misc/nant.dir
if test "$nant_dir" ; then
echo "found, $nant_dir"
else
echo_result "not found, plugin disabled"
nant=
fi
else
echo_result no
nant=
fi
try_nunit_version_2 () {
echo "Trying execute: $@" >> $config_log
eval ""$@" /help | grep 'Version: 2'" >> $config_log 2>&1
ret=$?
echo "Execution status code: $ret." >> $config_log
if test $ret -eq 0; then
nunit="$@"
fi
}
# Step 14.
echo_check_for "nunit-console for .NET 2.0"
try_nunit_version_2 nunit-console;
try_nunit_version_2 nunit-console2;
try_nunit_version_2 "${monopath}nunit-console";
try_nunit_version_2 "${monopath}nunit-console2";
if test "$nunit"; then
echo_result "found, $nunit"
if pkg-config --exists mono-nunit 2>/dev/null; then
nunit_lib="-pkg:mono-nunit"
else
np=`which nunit-console 2>/dev/null | sed 's/\(.*\)nunit-conso.*/\1nunit.framework.dll/'`; np=`cygpath -w "$np" 2>/dev/null`;
nunit_lib="-r:\"$np\""
fi
else
echo_result "not found, some tests will be disabled"
fi
# Step 15.
# Check if we have MSBuild available
echo_check_for "MSBuild"
try_execute "${netFRAMEWORK}MSBuild.exe"
if (($? < 126)); then
echo_result found
msbuild="${netFRAMEWORK}MSBuild.exe"
else
try_execute "${monopath}xbuild"
res=$?
if ((res < 126 && res != 2)); then
if ((m_major > 1 || m_major == 1 && m_minor >= 2 || m_major == 1 && m_minor == 1 && m_revision > 14)); then
echo_result found
msbuild="${monopath}xbuild"
else
echo_result "found, but mono is too old (at least 1.1.15 required), won't use it"
fi
else
echo_result "not found"
fi
fi
if test -d .svn; then
svn_revision=`svn info . | awk '/^Revision:/ { print $2 }'`
else
svn_revision=
fi
if test $bar = "true"; then
nem_flags="$nem_flags -bar+"
fi
case "$csc" in
*csc) nem_flags="$nem_flags -def:RUNTIME_MS";;
*gmcs) nem_flags="$nem_flags -def:RUNTIME_MONO";;
*cscc) nem_flags="$nem_flags -def:RUNTIME_PNET";;
*) ;;
esac
############################################################
# CONFIG GENERATION
############################################################
echo "Creating config.mak"
cat > config.mak <<EOF
# Generated by configure
Q = $quiet
PACKAGE = nemerle
VERSION = $nem_version
REVISION = $nem_revision
SVN_REV = $svn_revision
NET_ENGINE = $engine
NET_VERSION = $netVERSION
NET_FLAGS = $net_flags
DLL_PATH = $dll_path
NGEN = $ngen
DASM = $dasm
ASM = $asm
CSC = $csc
PEVERIFY = $peverify
TIME = $time
ANTLR = $antlr
MSBUILD = $msbuild
MONO_GACUTIL = $mono_gacutil
NANT = $nant
NANT_DIR = $nant_dir
VSPLUGINDIR = $vsplugindir
WIXPATH = $wixpath
NUNIT_CONSOLE = $nunit
NUNIT_LIB_FLAG = $nunit_lib
NEM_FLAGS = $nem_flags
PYTHON = $python
XSPP = $xspp
XSLT = $xsltproc
INSTALL = $install
prefix = $prefix
BINDIR = $bindir
SCRDIR = $scrdir
MANDIR = $mandir
LIBDIR = $libdir
PKGCONFIGDIR = $pkgconfig_dir
GACUTIL_COMMAND = $gacutil_command
GACUTIL_UNINSTALL_COMMAND = $gacutil_uninstall_command
NGEN_GAC = $ngen_gac
EOF
echo "Creating nemerle.pc"
cat > nemerle.pc <<EOF
prefix=${prefix}
exec_prefix=\${prefix}
libdir=${libdir}
Name: Nemerle
Description: Nemerle - a .NET object-functional language
Version: $nem_version.$nem_revision
Libs: -r:${mono_libdir}/mono/nemerle/Nemerle.dll -r:${mono_libdir}/mono/nemerle/Nemerle.Compiler.dll -r:${mono_libdir}/mono/nemerle/Nemerle.Macros.dll
EOF