-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathconfigure.ac
More file actions
1579 lines (1425 loc) · 50.6 KB
/
configure.ac
File metadata and controls
1579 lines (1425 loc) · 50.6 KB
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
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### Process this file with autoconf to produce a configure script.
AC_INIT([UHC],[1.1.7],[uhc-developers@lists.science.uu.nl, http://www.cs.uu.nl/wiki/UHC/WebHome])
### version of autoconf used (and required)
#AC_PREREQ([2.71])
### revision
AC_REVISION($Revision: 1.26 $)
### set MAKE flag in relevant makefiles
AC_PROG_MAKE_SET
# Checks for host/target
AC_CANONICAL_HOST
dnl ** canonicalize platform names
HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
# GHC_CONVERT_CPU(cpu, target_var)
# --------------------------------
# Converts cpu from gnu to ghc naming, and assigns the result to $target_var.
# Should you modify this list, you are invited to reflect the changes in
# `libraries/base/System/Info.hs`'s documentation.
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
aarch64*|arm64*)
$2="aarch64"
;;
alpha*)
$2="alpha"
;;
arm*)
$2="arm"
;;
hppa1.1*)
$2="hppa1_1"
;;
hppa*)
$2="hppa"
;;
i386|i486|i586|i686)
$2="i386"
;;
ia64)
$2="ia64"
;;
m68k*)
$2="m68k"
;;
mipseb*)
$2="mipseb"
;;
mipsel*)
$2="mipsel"
;;
mips*)
$2="mips"
;;
nios2)
$2="nios2"
;;
powerpc64le*)
$2="powerpc64le"
;;
powerpc64*)
$2="powerpc64"
;;
powerpc*)
$2="powerpc"
;;
riscv64*)
$2="riscv64"
;;
riscv|riscv32*)
$2="riscv32"
;;
rs6000)
$2="rs6000"
;;
s390x*)
$2="s390x"
;;
s390*)
$2="s390"
;;
sh4)
$2="sh4"
;;
sparc64*)
$2="sparc64"
;;
sparc*)
$2="sparc"
;;
vax)
$2="vax"
;;
x86_64|amd64)
$2="x86_64"
;;
*)
echo "Unknown CPU $1"
exit 1
;;
esac
])
# GHC_CONVERT_OS(os, converted_cpu, target_var)
# --------------------------------
# converts os from gnu to ghc naming, and assigns the result to $target_var
AC_DEFUN([GHC_CONVERT_OS],[
case "$1" in
gnu*) # e.g. i686-unknown-gnu0.9
$3="gnu"
;;
# watchos and tvos are ios variants as of May 2017.
ios|watchos|tvos)
$3="ios"
;;
linux-android*)
$3="linux-android"
;;
linux-*|linux)
$3="linux"
;;
netbsd*)
$3="netbsd"
;;
openbsd*)
$3="openbsd"
;;
# As far as I'm aware, none of these have relevant variants
freebsd|dragonfly|hpux|linuxaout|kfreebsdgnu|freebsd2|mingw32|darwin|nextstep2|nextstep3|sunos4|ultrix|haiku)
$3="$1"
;;
msys)
AC_MSG_ERROR([Building GHC using the msys toolchain is not supported; please use mingw instead. Perhaps you need to set 'MSYSTEM=MINGW64 or MINGW32?'])
;;
aix*) # e.g. powerpc-ibm-aix7.1.3.0
$3="aix"
;;
darwin*) # e.g. aarch64-apple-darwin14
$3="darwin"
;;
solaris2*)
$3="solaris2"
;;
freebsd*) # like i686-gentoo-freebsd7
# i686-gentoo-freebsd8
# i686-gentoo-freebsd8.2
$3="freebsd"
;;
nto-qnx*)
$3="nto-qnx"
;;
*)
echo "Unknown OS $1"
exit 1
;;
esac
])
GHC_CONVERT_CPU($host_cpu, ghcCPU)
GHC_CONVERT_OS($host_os, $ghcCPU, ghcOS)
AC_SUBST(GHC_CPU, $ghcCPU)
AC_SUBST(GHC_OS, $ghcOS)
### check whether we are indeed in the toplevel dir, otherwise copy required stuff to the current dir first
if test "${srcdir}" != "." -a "${srcdir}" != ""
then
# copy all the relevant stuff
echo "copying from: ${srcdir}"
for stuff in Makefile LICENSE VERSION mk test bin ehclib extlibs src
do
echo "copying into builddir: ${stuff}"
d=`dirname ${stuff}`
rsync --archive --update --exclude='.*' ${srcdir}/${stuff} ${d}
done
fi
### Version info, extract from file VERSION
# big change
EH_VERSION_MAJOR=`awk -F . '{print $1}' VERSION`
EH_VERSION_MAJOR_ZEROPAD=`printf "%02d" ${EH_VERSION_MAJOR}`
# small change, not usable with previous
EH_VERSION_MINOR=`awk -F . '{print $2}' VERSION`
EH_VERSION_MINOR_ZEROPAD=`printf "%02d" ${EH_VERSION_MINOR}`
# small change, still usable with previous
EH_VERSION_MINORMINOR=`awk -F . '{print $3}' VERSION`
EH_VERSION_MINORMINOR_ZEROPAD=`printf "%02d" ${EH_VERSION_MINORMINOR}`
# very small (kinda per commit, daily) change
EH_VERSION_MINORMINORMINOR=`awk -F . '{print $4}' VERSION`
EH_VERSION_MINORMINORMINOR_ZEROPAD=`printf "%02d" ${EH_VERSION_MINORMINORMINOR}`
# 20090415: this amount of detail will not be used, will be obsolete
EH_VERSION_STABILITY=alpha
AC_SUBST(EH_VERSION_MAJOR)
AC_SUBST(EH_VERSION_MINOR)
AC_SUBST(EH_VERSION_MINORMINOR)
AC_SUBST(EH_VERSION_MINORMINORMINOR)
AC_SUBST(EH_VERSION_STABILITY)
AC_SUBST(EH_VERSION_SHORT,$EH_VERSION_MAJOR.$EH_VERSION_MINOR)
AC_SUBST(EH_VERSION_MEDIUM,$EH_VERSION_MAJOR.$EH_VERSION_MINOR.$EH_VERSION_MINORMINOR)
AC_SUBST(EH_VERSION_FULL,$EH_VERSION_MAJOR.$EH_VERSION_MINOR.$EH_VERSION_MINORMINOR.$EH_VERSION_MINORMINORMINOR)
AC_SUBST(EH_VERSION_ASNUMBER,$EH_VERSION_MAJOR$EH_VERSION_MINOR_ZEROPAD$EH_VERSION_MINORMINOR_ZEROPAD$EH_VERSION_MINORMINORMINOR_ZEROPAD)
### global settings, variables, defaults
# command/msg to run when tool is absent
cmdForExitIfAbsentLibOrTool='echo "**** ERROR **** A tool or library is missing. Check ./configure summary." ; exit 1'
dnl macro for missing program
AC_DEFUN(MISSING_FOR_EH,
[
AC_MSG_ERROR([
You must install $1 before you can continue
Perhaps it is already installed, but not in your PATH?])
])
dnl macro for missing program which does not stop an alternate route of installing
AC_DEFUN(MISSING_FOR_EH_BUT_CAN_GO_ON,
[
AC_MSG_WARN([
You should have installed $1, but I will proceed without it.
However, this may lead to a partial install only.
Perhaps $1 is already installed, but not in your PATH?])
])
dnl macro for required programs
AC_DEFUN(REQUIRED_PROG_FOR_EH,
[
AC_PATH_PROG($1,$2)
if test -z "[$]$1"; then
ifelse([$3], , [ MISSING_FOR_EH([$2]) ], [ MISSING_FOR_EH([$3]) ])
fi
])
dnl macro for optional required programs, that is, an alternate install route exists
AC_DEFUN(REQUIRED_OPTIONAL_PROG_FOR_EH,
[
AC_PATH_PROG($1,$2)
if test -z "[$]$1"; then
ifelse([$3], , [ MISSING_FOR_EH_BUT_CAN_GO_ON([$2]) ], [ MISSING_FOR_EH_BUT_CAN_GO_ON([$3]) ])
fi
])
### obvious utils which are amiss on some platforms: m4
REQUIRED_PROG_FOR_EH(m4Cmd,m4)
### git log/history
AC_PATH_PROG(gitCmd,git)
if test -x "$gitCmd"
then
gitExists="yes"
gitHash=`git rev-parse HEAD | cut -c 1-10`
gitBranch=`git symbolic-ref HEAD`
gitVersionExists="yes"
echo "${gitBranch#refs/heads/}@$gitHash" > GITHASH
gitHashCmd="cat GITHASH"
else
gitExists="no"
gitVersionExists="no"
gitHashCmd="echo 'no git available'"
fi
AC_SUBST(GIT_EXISTS,$gitExists)
AC_SUBST(GIT_CMD,$gitCmd)
### git revision
gitHashVal=`${gitHashCmd}`
AC_SUBST(GIT_VERSION_EXISTS,$gitVersionExists)
AC_SUBST(GIT_VERSION_CMD,$gitHashCmd)
AC_SUBST(GIT_REVISION,$gitHashVal)
### enable options: java
AC_ARG_ENABLE(java, AS_HELP_STRING([--enable-java],[include java code generation]), [enableJava=yes], [enableJava=no])
AC_SUBST(ENABLE_JAVA,$enableJava)
if test x$enableJava = xyes
then
REQUIRED_PROG_FOR_EH(javacCmd,javac)
REQUIRED_PROG_FOR_EH(jarCmd,jar)
if test "$javacCmd" = "no"; then
javacCmd=""
jarCmd=""
javacExists="no"
else
javacExists="yes"
fi
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test ! -x "$toplevelSystemAbsolutePathPrefix/$jarCmd"
then
jarCmd="`echo $jarCmd | sed -e 's+/usr++'`"
fi
if test ! -x "$toplevelSystemAbsolutePathPrefix/$javacCmd"
then
javacCmd="`echo $javacCmd | sed -e 's+/usr++'`"
fi
;;
*)
;;
esac
AC_SUBST(JAVAC_CMD,$javacCmd)
AC_SUBST(JAR_CMD,$jarCmd)
fi
### enable options: js (JavaScript), default is yes
# AC_ARG_ENABLE(js, AS_HELP_STRING([--enable-js],[include JavaScript code generation]), [enableJavaScript=yes], [enableJavaScript=no])
enableJavaScript="yes"
AC_SUBST(ENABLE_JS,$enableJavaScript)
### enable options: cmm, default is no, temporary until development is ready
AC_ARG_ENABLE(cmm, AS_HELP_STRING([--enable-cmm],[include cmm code generation]), [enableCmm=yes], [enableCmm=no])
AC_SUBST(ENABLE_CMM,$enableCmm)
### enable options: llvm, default is no
AC_ARG_ENABLE(llvm, AS_HELP_STRING([--enable-llvm],[include llvm code generation]), [enableLlvm=yes], [enableLlvm=no])
AC_SUBST(ENABLE_LLVM,$enableLlvm)
### enable options: core-asinpoutp (Untyped Core), default is no
AC_ARG_ENABLE(core-asinpoutp, AS_HELP_STRING([--enable-core-asinpoutp],[allow use of Core untyped intermediate language as a backend and source language]), [enableCoreAsInpOutp=yes], [enableCoreAsInpOutp=no])
AC_SUBST(ENABLE_CORE_ASINPOUTP,$enableCoreAsInpOutp)
### enable options: corerun-asinpoutp (CoreRun variation of Core), default is no
AC_ARG_ENABLE(corerun-asinpoutp, AS_HELP_STRING([--enable-corerun-asinpoutp],[allow use of CoreRun untyped intermediate language as a backend and source language]), [enableCoreRunAsInpOutp=yes], [enableCoreRunAsInpOutp=no])
AC_SUBST(ENABLE_CORERUN_ASINPOUTP,$enableCoreRunAsInpOutp)
### enable options: core + system F (Core variation of Typed Core, picking from Typed Core), default is no
AC_ARG_ENABLE(coresysf, AS_HELP_STRING([--enable-coresysf],[include System F type generation for Core]), [enableCoreSysF=yes], [enableCoreSysF=no])
AC_SUBST(ENABLE_CORESYSF,$enableCoreSysF)
### enable options: tauphi (Tom Lokhorsts type based transformations on TyCore, based on work by Stefan Holdermans), default is no
AC_ARG_ENABLE(tauphi, AS_HELP_STRING([--enable-tauphi],[include TauPhi language extension and analyses]), [enableTauPhi=yes], [enableTauPhi=no])
AC_SUBST(ENABLE_TAUPHI,$enableTauPhi)
### enable options: use cabal sandbox for building libs, default is no
AC_ARG_ENABLE(sandbox, AS_HELP_STRING([--enable-sandbox],[build EHC/UHC libs with cabal sandbox]), [enableSandbox=yes], [enableSandbox=no])
AC_SUBST(ENABLE_SANDBOX,$enableSandbox)
### enable options: use cabal v2 commands for building libs, default is no
AC_ARG_ENABLE(v2-commands, AS_HELP_STRING([--enable-v2-commands],[build EHC/UHC libs with cabal v2 commands]), [enableV2Commands=yes], [enableV2Commands=no])
AC_SUBST(ENABLE_V2_COMMANDS,$enableV2Commands)
### enable options: turn on CHR based type system impl
AC_ARG_ENABLE(chrtysys, AS_HELP_STRING([--enable-chrtysys],[build EHC/UHC with CHR based type system]), [enableChrTySys=yes], [enableChrTySys=no])
AC_SUBST(ENABLE_CHRTYSYS,$enableChrTySys)
### cpp
AC_ARG_WITH(cpp,
[AS_HELP_STRING([--with-cpp=<cpp preprocessor>],[Use a command different from 'cpp' to compile with CPP.])],
[ cppCmd="$withval" ],
[
if test "$CPP" = ""; then
AC_PATH_PROG(cppCmd,cpp)
else
cppCmd=$CPP
fi
]
)
if test "$cppCmd" != "no" -a -x "$cppCmd"; then
cppExists="yes"
cppVersion=`$cppCmd --version`
else
cppCmd=""
cppExists="no"
fi
### cpp clang specific check, turning of some options
cppVersionHasClang=`echo ${cppVersion} | grep clang`
if test "${cppVersionHasClang}" = ""; then
cppClangEhcOptions=""
gccClangEhcOptions=""
else
cppClangEhcOptions="-Wno-invalid-pp-token"
gccClangEhcOptions="-Wno-array-bounds"
fi
### ranlib
REQUIRED_PROG_FOR_EH(ranlibCmd,ranlib)
# See remarks about cpp
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test ! -x "$toplevelSystemAbsolutePathPrefix/$ranlibCmd"
then
ranlibCmd="`echo $ranlibCmd | sed -e 's+/usr++'`"
fi
;;
*)
;;
esac
AC_SUBST(RANLIB_CMD,$ranlibCmd)
### ar
REQUIRED_PROG_FOR_EH(arCmd,ar)
# See remarks about cpp
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test ! -x "$toplevelSystemAbsolutePathPrefix/$arCmd"
then
arCmd="`echo $arCmd | sed -e 's+/usr++'`"
fi
;;
*)
;;
esac
AC_SUBST(AR_CMD,$arCmd)
### cat
REQUIRED_PROG_FOR_EH(catCmd,cat)
# See remarks about cpp
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test ! -x "$toplevelSystemAbsolutePathPrefix/$catCmd"
then
catCmd="`echo $catCmd | sed -e 's+/usr++'`"
fi
;;
*)
;;
esac
AC_SUBST(CAT_CMD,$catCmd)
### libtool
REQUIRED_OPTIONAL_PROG_FOR_EH(libtoolStaticCmd,libtool)
### 'with' option hardbaked choice of aspects
AC_ARG_WITH(aspects,
[AS_HELP_STRING([--with-aspects=<choice of aspects>],[Choice of aspects, can be overridden when 'make'ing.])],
[ aspects="$withval" ],)
AC_SUBST(ASPECTS, "$aspects")
### 'with' option for build suffix, which by default is derived from hardbaked aspects
AC_ARG_WITH(build-suffix,
[AC_HELP_STRING([--with-build-suffix=<suffix for build locations>],
[Suffix for build locations and library names of globally visible cabal managed libraries.])],
[ ehcBuildSuffix="$withval" ],)
if test "x$ehcBuildSuffix" = "x"
then
ehcBuildSuffix="`echo ${ASPECTS} | sed -e 's/ /-/g'`"
fi
AC_SUBST(EHC_BUILD_SUFFIX, "$ehcBuildSuffix")
### 'with' option for gcc options
AC_ARG_WITH(gcc-ehc-options,
[AS_HELP_STRING([--with-gcc-ehc-options=<gcc compiler options for compiling runtime and ehc's gcc invocation>],[Additional options to pass to GCC when compiling with EHC.])],
[ gccEhcOptions="$withval" ],)
# additional platform dependend options for gcc when compiling C from within ehc
case $HostPlatform in
i*86-pc-linux-gnu )
#gccEhcOptions="${gccClangEhcOptions} $gccEhcOptions -D__USE_BSD -D__USE_POSIX"
gccEhcOptions="${gccClangEhcOptions} $gccEhcOptions"
;;
*)
gccEhcOptions="${gccClangEhcOptions} $gccEhcOptions"
;;
esac
AC_SUBST(GCC_EHC_OPTIONS, "$gccEhcOptions")
### 'with' option for cpp options
AC_ARG_WITH(cpp-ehc-options,
[AS_HELP_STRING([--with-cpp-ehc-options=<cpp preprocessor options for ehc's cpp invocation>],[Additional options to pass to CPP when compiling with EHC.])],
[ cppEhcOptions="$withval" ],)
# additional platform dependend options for cpp when compiling C from within ehc
case $HostPlatform in
i*86-pc-linux-gnu )
cppEhcOptions="${cppClangEhcOptions} $cppEhcOptions -D__STDC__"
#cppEhcOptions="$cppEhcOptions -D__USE_BSD -D__USE_POSIX -D__STDC__"
;;
x86_64-*-linux-gnu )
cppEhcOptions="${cppClangEhcOptions} $cppEhcOptions -D__STDC__"
#cppEhcOptions="$cppEhcOptions -D__USE_BSD -D__USE_POSIX -D__STDC__"
;;
*)
cppEhcOptions="${cppClangEhcOptions}"
;;
esac
AC_SUBST(CPP_EHC_OPTIONS, "$cppEhcOptions")
### 'with' option for shuffle options
AC_ARG_WITH(shuffle-ehc-options,
[AS_HELP_STRING([--with-shuffle-ehc-options=<shuffle options for compiling ehc>],[Additional options to pass to SHUFFLE when compiling EHC.])],
[ shuffleEhcOptions="$withval" ],)
AC_SUBST(SHUFFLE_EHC_OPTIONS, "$shuffleEhcOptions")
### 'with' option for uuagc options
AC_ARG_WITH(uuagc-options,
[AS_HELP_STRING([--with-uuagc-options=<AG compiler options for compiling ehc>],[Additional options to pass to UUAGC when compiling EHC.])],
[ uuagcOptions="$withval" ],)
AC_SUBST(UUAGC_OPTIONS, "$uuagcOptions")
### 'with' option for uuagc options, specifically for EHC's AST
AC_ARG_WITH(uuagc-ehc-ast-options,
[AS_HELP_STRING([--with-uuagc-ehc-ast-options=<AG compiler options for compiling ehc's AST data types>],[Additional options to pass to UUAGC when compiling EHC's AST data types.])],
[ uuagcEhcAstOptions="$withval" ],)
AC_SUBST(UUAGC_EHC_AST_OPTIONS, "$uuagcEhcAstOptions")
### 'with' option for uuagc options, specifically for EHC's semantics
AC_ARG_WITH(uuagc-ehc-sem-options,
[AS_HELP_STRING([--with-uuagc-ehc-sem-options=<AG compiler options for compiling ehc's semantics>],[Additional options to pass to UUAGC when compiling EHC's AST semantics.])],
[ uuagcEhcSemOptions="$withval" ],)
AC_SUBST(UUAGC_EHC_SEM_OPTIONS, "$uuagcEhcSemOptions")
### 'with' option for shuffle options
AC_ARG_WITH(shuffle-options,
[AS_HELP_STRING([--with-shuffle-options=<shuffle options for compiling ehc>],[Additional options to pass to shuffle when compiling EHC.])],
[ shuffleOptions="$withval" ],)
AC_SUBST(SHUFFLE_OPTIONS, "$shuffleOptions")
### 'with' option for cabal config options
AC_ARG_WITH(cabal-config-options,
[AS_HELP_STRING([--with-cabal-config-options=<cabal configure options for compiling ehc>],[Additional options to pass to cabal's ./setup configure when compiling EHC.])],
[ cabalConfigureOptions="$withval" ],)
AC_SUBST(CABAL_CONFIGURE_OPTIONS, "$cabalConfigureOptions")
### 'with' option for additional ehc unixtool (gcc, cpp) prefix.
### Usually empty, but set for (e.g.) cygwin
AC_ARG_WITH(ehc-unixtool-prefix,
[AS_HELP_STRING([--with-ehc-unixtool-prefix=<additional prefix for unixtools (already with absolute pathnames) used by ehc>],[Additional prefix for unixtools used by ehc.])],
[ toplevelSystemAbsolutePathPrefix="$withval" ],)
# when no unixtool prefix is specified && running cygwin, take cygwin's equivalent of /
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test "$toplevelSystemAbsolutePathPrefix" = ""
then
toplevelSystemAbsolutePathPrefix="`cygpath --mixed /`"
fi
;;
*)
;;
esac
AC_SUBST(TOPLEVEL_SYSTEM_ABSPATH_PREFIX, "$toplevelSystemAbsolutePathPrefix")
### 'with' option for haddock
AC_ARG_WITH(haddock,
[AS_HELP_STRING([--with-haddock=<haddock>],[Use a command different from 'haddock' to generate doc.])],
[ haddockCmd="$withval" ],
[
if test "$HADDOCK" = ""; then
AC_PATH_PROG(haddockCmd,haddock)
else
haddockCmd=$HADDOCK
fi
]
)
if test "$haddockCmd" != "no" -a -x "$haddockCmd"; then
haddockExists="yes"
haddockVersion=`$haddockCmd --version | head -n 1`
else
haddockCmd=""
haddockExists="no"
fi
AC_SUBST(HADDOCK_CMD,$haddockCmd)
AC_SUBST(HADDOCK_VERSION, $haddockVersion)
### 'with' option for Haskell compiler, by default ghc
AC_ARG_WITH(hc,
[AS_HELP_STRING([--with-hc=<haskell compiler>],[Use a command different from 'ghc' to compile with GHC.])],
[ ghcCmd="$withval" ],
[
if test "$GHC" = ""; then
AC_PATH_PROG(ghcCmd,ghc)
else
ghcCmd=$GHC
fi
]
)
if test "$ghcCmd" != "no" -a -x "$ghcCmd" ; then
ghcExists="yes"
ghcVersion=`$ghcCmd --numeric-version`
else
ghcCmd=""
ghcExists="no"
fi
AC_SUBST(GHC_CMD,$ghcCmd)
AC_SUBST(GHC_VERSION, $ghcVersion)
### 'with' option for cabal, by default cabal
AC_ARG_WITH(cabal,
[AS_HELP_STRING([--with-cabal=<cabal package installer>],[Use a command different from 'cabal' to build libraries with GHC.])],
[ cabalCmd="$withval" ],
[
if test "$CABAL" = ""; then
AC_PATH_PROG(cabalCmd,cabal)
else
cabalCmd=$CABAL
fi
]
)
AC_SUBST(CABAL_CMD, $cabalCmd)
### 'with' option for ghc options
AC_ARG_WITH(ghc-ehc-options,
[AS_HELP_STRING([--with-ghc-ehc-options=<haskell compiler options for compiling ehc>],[Additional options to pass to GHC when compiling EHC.])],
[ ghcEhcOptions="$withval" ],)
### some options *must* be passed to ghc >= 7.xx, but *may not* be passed to earlier ones
case $ghcVersion in
6*)
;;
*)
ghcGenOptions="$ghcGenOptions -rtsopts"
;;
esac
AC_SUBST(GHC_EHC_OPTIONS, "$ghcEhcOptions")
AC_SUBST(GHC_GEN_OPTIONS, "$ghcGenOptions")
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
ghcCmd1=`echo $ghcCmd | sed 's+^/\(cygdrive/\)\?\(.\)/+\2:/+'`
echo "ghcCmd is $ghcCmd, raw is $ghcCmd1"
echo $ghcCmd | sed 's+^/\(cygdrive/\)\?\(.\)/+\2:/+'
;;
*)
ghcCmd1=$ghcCmd
;;
esac
AC_SUBST(GHC_CMD1,$ghcCmd1)
### assuming we have ghc, check for some of the additional tools
AC_PATH_PROG(ghcPkgCmd,ghc-pkg)
AC_PATH_PROG(hsc2hsCmd,hsc2hs)
AC_SUBST(HSC2HS_CMD,$hsc2hsCmd)
if test x$enableV2Commands = "xno"
then
### now we know we have ghc, check for some libraries using ghc-pkg
ghcLibsRequired="fgl vector uulib network binary hashable chr-data uhc-util base mtl transformers directory containers array process filepath utf8-string bytestring"
#if test x$enableClr = "xyes"
#then
# ghcLibsRequired="${ghcLibsRequired} primitive"
#fi
# gather for some libraries version info
ghcLibsRequiredWithVersion=""
ghcLibsRequiredWithoutVersion=""
if test x$ghcExists = xyes
then
if test -x "$ghcCmd" -a -x "$ghcPkgCmd"
then
for pkgBase in ${ghcLibsRequired}
do
pkg=`$ghcPkgCmd list --simple-output ${pkgBase} | sed -e 'y/ /\n/' | tail -1`
if test "x${pkg}" != "x" ; then
ghcLibsRequiredAndPresent="${pkg} ${ghcLibsRequiredAndPresent}"
pkgVersion=`echo ${pkg} | sed -E -e 's/^(([[^-]]+-)+)([[^.]]+(\.[[^.]]+)*)$/\3/'`
pkgVersionNoDot=`echo ${pkgVersion} | sed -E -e 's/\.//'g`
### here do special treatment of packages, now we have name&version of packages available
case ${pkgBase} in
chr-data)
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} chr-data>=0.1.0.0"
;;
uhc-util)
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} uhc-util>=0.1.7.0&&<0.1.8"
;;
uulib)
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} uulib>=0.9.19"
;;
base)
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} base>=4.7&&<5"
;;
hashable)
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} hashable>=1.2.4&&<1.3"
;;
fgl)
# with uhc-util >= 0.1.3.7 no longer necessary
if test ${pkgVersionNoDot} -ge 5500
then
#ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} fgl>=5.5 graphviz"
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} fgl"
else
#ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} fgl<5.5"
ghcLibsRequiredWithVersion="${ghcLibsRequiredWithVersion} fgl"
fi
;;
*)
ghcLibsRequiredWithoutVersion="${ghcLibsRequiredWithoutVersion} ${pkgBase}"
;;
esac
else
ghcLibsRequiredButAbsent="${pkgBase} ${ghcLibsRequiredButAbsent}"
fi
done
fi
fi
# GHC version dependencies: packages passed as option, cabal packages
cabal_base_lib_depends="${ghcLibsRequiredWithVersion} ${ghcLibsRequiredWithoutVersion}"
if test x$enableClr = "xyes"
then
cabal_base_lib_depends="$cabal_base_lib_depends language-cil"
fi
cabal_extra_lib_depends=""
optCabalAllowUndecidableInstances=UndecidableInstances
optStandardGHCPackages=""
# (1) GHC 6.6 and higher: no package util, lang, and data anymore
# (2) after ghc 6.4.1 the names of cabal option(s) changed
case $ghcVersion in
6.4.1)
optStandardGHCPackages="-package util -package lang -package data"
optCabalAllowUndecidableInstances=AllowUndecidableInstances
;;
6.4.2)
optStandardGHCPackages="-package util -package lang -package data"
;;
esac
fi
AC_SUBST(OPT_GHC_STANDARD_PACKAGES,"$optStandardGHCPackages")
AC_SUBST(CABAL_BASE_LIB_DEPENDS,"$cabal_base_lib_depends")
AC_SUBST(CABAL_EXTRA_LIB_DEPENDS,"$cabal_extra_lib_depends")
AC_SUBST(CABAL_OPT_ALLOW_UNDECIDABLE_INSTANCES,"$optCabalAllowUndecidableInstances")
# uuagc
AC_ARG_WITH(uuagc,
[AS_HELP_STRING([--with-uuagc=<uu ag compiler>],[Use a command different from 'uuagc' to compile with UUAGC.])],
[ uuagcCmd="$withval" ],
[
if test "$UUAGC" = ""; then
AC_PATH_PROG(uuagcCmd,uuagc)
else
uuagcCmd=$UUAGC
fi
]
)
if test "$uuagcCmd" != "no" -a -x "$uuagcCmd" ; then
uuagcExists="yes"
uuagcVersion=`$uuagcCmd --version`
buildToolDependenciesUnchecked="uuagc>=0.9.50.2 ${buildToolDependenciesUnchecked}"
else
uuagcCmd=""
uuagcExists="no"
fi
AC_SUBST(UUAGC_CMD,$uuagcCmd)
# shuffle
AC_ARG_WITH(shuffle,
[AS_HELP_STRING([--with-shuffle=<shuffle compiler>],[Use a command different from 'shuffle' to compile with shuffle.])],
[ shuffleCmd="$withval" ],
[
if test "$SHUFFLE" = ""; then
AC_PATH_PROG(shuffleCmd,shuffle)
else
shuffleCmd=$SHUFFLE
fi
]
)
if test "$shuffleCmd" != "no" -a -x "$shuffleCmd" ; then
shuffleExists="yes"
shuffleVersion=`$shuffleCmd --version`
buildToolDependenciesUnchecked="shuffle>=0.1.3.1 ${buildToolDependenciesUnchecked}"
else
shuffleCmd=""
shuffleExists="no"
fi
AC_SUBST(SHUFFLE_CMD,$shuffleCmd)
# ruler
AC_ARG_WITH(ruler,
[AS_HELP_STRING([--with-ruler=<ruler compiler>],[Use a command different from 'ruler' to compile with ruler.])],
[ rulerCmd="$withval" ],
[
if test "$RULER" = ""; then
AC_PATH_PROG(rulerCmd,ruler)
else
rulerCmd=$RULER
fi
]
)
if test "$rulerCmd" != "no" -a -x "$rulerCmd" ; then
rulerExists="yes"
rulerVersion=`$rulerCmd --version`
buildOptionalToolDependenciesUnchecked="ruler>=0.4.0.1 ${buildOptionalToolDependenciesUnchecked}"
else
rulerCmd="${cmdForExitIfAbsentLibOrTool}"
rulerExists="no"
fi
AC_SUBST(RULER_CMD,$rulerCmd)
AC_SUBST(RULER_EXISTS,$rulerExists)
# gcc
AC_ARG_WITH(gcc,
[AS_HELP_STRING([--with-gcc=<gcc compiler>],[Use a command different from 'gcc' to compile with GCC.])],
[ gccCmd="$withval" ],
[
if test "$GCC" = ""; then
AC_PATH_PROG(gccCmd,gcc)
else
gccCmd=$GCC
fi
]
)
if test "$gccCmd" != "no" -a -x "$gccCmd" ; then
gccExists="yes"
gccVersion=`$gccCmd -dumpversion`
else
gccCmd=""
gccExists="no"
fi
# See remarks about cpp
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test ! -x "$toplevelSystemAbsolutePathPrefix/$gccCmd"
then
gccCmd="`echo $gccCmd | sed -e 's+/usr++'`"
if test -L "$toplevelSystemAbsolutePathPrefix/$gccCmd"
then
gccCmd="$gccCmd-3"
fi
fi
;;
*)
;;
esac
AC_SUBST(GCC_CMD,$gccCmd)
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[#include <stdio.h>]], [[
FILE *fp;
fp = fopen("conftest.cc", "w");
if (fp == 0) return(1);
fprintf(fp, "cc_major_version=%d;cc_minor_version=%d;cc_patch_version=%d",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
fclose(fp);
]])],
[eval `cat conftest.cc`],
[cc_major_version=no],
)
AC_MSG_CHECKING([Version of $CC])
if test "$cc_major_version" = "no"; then
AC_MSG_RESULT([no])
AC_MSG_FAILURE([Requires that $CC is usable], [1])
else
cc_version="$cc_major_version.$cc_minor_version.$cc_patch_version"
AC_MSG_RESULT([$cc_version])
fi
case $cc_version in
4.0.1)
cc_std_flag="-std=gnu99"
;;
*)
cc_std_flag="-std=gnu99"
;;
esac
AC_SUBST(CC_STD_FLAG,$cc_std_flag)
# Now we have to deal with weird cygwin behaviour which allows /usr/bin to be used
# whereas in reality it is mapped onto /bin. Direct acccess to /usr/bin with a c:/cygwin prefix therefore does not work
# and has to be stripped of the /usr part.
# Then, the resulting filename may refer to a symbolic link. If so, Try to dereference it by postfixing -3, that is cpp becomes cpp-3
# For other tools like gcc we have to this too.
case $HostPlatform in
i*86-*-mingw* | i*86-*-cygwin* )
if test ! -x "$toplevelSystemAbsolutePathPrefix/$cppCmd"
then
cppCmd="`echo $cppCmd | sed -e 's+/usr++'`"
if test -L "$toplevelSystemAbsolutePathPrefix/$cppCmd"
then
cppCmd="$cppCmd-3"
fi
fi
;;
*)
;;
esac
AC_SUBST(CPP_CMD,$cppCmd)
if test x$enableLlvm = xyes
then
# LLVM Assembler
AC_ARG_WITH(llvm-as,
[AS_HELP_STRING([--with-llvm-as=<LLVM Assembler>],[Path to the LLVM Assembler])],
[ llvmAs="$withval" ],
[
if test "x$LLVM_AS" = "x"; then
if test x$enableLlvm = xyes
then
REQUIRED_PROG_FOR_EH(llvmAs,llvm-as)
fi
else
llvmAs=$LLVM_AS
fi
]
)
AC_SUBST(LLVM_AS_CMD,$llvmAs)
# LLVM Optimizer
AC_ARG_WITH(opt,
[AS_HELP_STRING([--with-llvm-opt=<LLVM bitcode optimizer>],[Path to the LLVM bitcode optimizer])],
[ llvmOpt="$withval" ],
[
if test "x$LLVM_OPT" = "x"; then
if test x$enableLlvm = xyes
then
REQUIRED_PROG_FOR_EH(llvmOpt,opt)
fi
else
llvmOpt=$LLVM_OPT
fi
]
)
AC_SUBST(LLVM_OPT_CMD,$llvmOpt)
# LLVM Compiler
AC_ARG_WITH(llc,
[AS_HELP_STRING([--with-llc=<LLVM Compiler>],[Path to the LLVM Compiler])],
[ llvmLlc="$withval" ],
[
if test "x$LLC" = "x"; then
if test x$enableLlvm = xyes
then
REQUIRED_PROG_FOR_EH(llvmLlc,llc)
fi
else
llvmLlc=$LLC
fi
]
)
AC_SUBST(LLVM_LLC_CMD,$llvmLlc)
if test -x $llvmLlc -a -x $llvmAs -a -x $llvmOpt
then
llvmExists=yes
else
llvmExists=no
fi
fi
# md5
AC_PATH_PROG(md5Cmd,md5 md5sum)
AC_SUBST(MD5_CMD,$md5Cmd)
# (gnu)tar; gnutar is required, but sometimes it already is available as tar
AC_CHECK_PROGS(tarCmd,gnutar tar)
AC_SUBST(TAR_CMD,$tarCmd)
# xxx
#AC_PATH_PROG(xxxCmd,xxx)
#echo xxxCmd: $xxxCmd
### Checks for libraries.
### Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
### what to make
#AC_SUBST(UUST_SUBDIRS,"shc lib")
### header & function presence
AC_HEADER_TIOCGWINSZ
AC_CHECK_HEADERS([dirent.h errno.h fcntl.h inttypes.h limits.h signal.h stdint.h string.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h vfork.h wctype.h windows.h])
# problematic headers, currently not dealt with:
#AC_CHECK_HEADERS(winsock.h)
AC_CHECK_FUNCS([ftruncate getclock getrusage gettimeofday lstat readdir_r _chsize])
AC_CHECK_FUNCS([ftime gmtime_r localtime_r])
AC_CHECK_FUNCS([lchown])
dnl ** check if it is safe to include both <time.h> and <sys/time.h>
m4_warn([obsolete],
[Update your code to rely only on HAVE_SYS_TIME_H,
then remove this warning and the obsolete code below it.
All current systems provide time.h; it need not be checked for.
Not all systems provide sys/time.h, but those that do, all allow
you to include it and time.h simultaneously.])dnl
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Obsolete code to be removed.
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
# End of obsolete code.
dnl ** how do we get a timezone name, and UTC offset ?
AC_STRUCT_TIMEZONE
dnl ** do we have altzone?