[project @ 1996-06-27 15:55:53 by partain]
[ghc.git] / configure.in
1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (grep for '^dnl' to see the outline of this file)
3 dnl
4 dnl * INITIAL SETUP, CHOICE OF PLATFORM(S)
5 #!/bin/sh
6 #
7 # (c) The AQUA Project, Glasgow University, 1994-1995
8 #
9 # Configure script for the Glasgow functional programming tools
10 # (created automagically by autoconf...do not edit by hand)
11 #
12 # Do "./configure --help" to see what flags are available.
13 # (Better yet, read the documentation!)
14 #
15 # -------------------------------------------------------------------------
16 AC_INIT(STARTUP.in)
17 #
18 # Prepare to generate the following header files
19 #
20 AC_CONFIG_HEADER(ghc/includes/config.h)
21 # and  literate/config.h ???
22 # ToDo !!!!!!!!!!!!!!!!
23 #
24 # No, we don't do `--srcdir'...
25 if test x"$srcdir" != 'x.' ; then
26     echo "This configuration does not support the \`--srcdir' option."
27     exit 1
28 fi
29
30 # -------------------------------------------------------------------------
31 dnl ** choose what blobs to build (ghc,hslibs,haggis,happy,nofib,????)
32
33 # set to the name for the dir if doing it, otherwise empty
34 DoingGHC='ghc'
35 DoingHsLibs=''
36 DoingNoFib=''
37 DoingHappy=''
38 DoingHaggis=''
39 DoingLiterate=''
40 # the following are not normally changed
41 DoingMkWorld='mkworld'
42 DoingGlaFpUtils='glafp-utils'
43
44 MkWorldSetup='std'
45
46 AC_ARG_ENABLE(ghc,
47    [
48 **********************************************************************
49 * Configuration options for the Glasgow functional-programming tools *
50 **********************************************************************
51
52 First, select *which* of the tools you want to build,
53 with --{enable,disable}-{ghc,hslibs,nofib,happy,haggis}.
54 (The default is: only GHC (Glasgow Haskell compiler).)
55
56 Second, you may set one of a few applies-in-all-cases options.
57 For example, --with-tmpdir=/usr/tmp.
58
59 Then you may set various options which are specifically for the
60 tools you choose in step 1.  For GHC, perhaps --enable-concurrent.
61 For NoFib, perhaps --enable-all-tests.  And so on.
62
63 The rest of this message lists all of the configure options.  If the
64 option is enabled by default, the message says how to disable it.  And
65 vice versa.
66
67 If you are confused, don't forget the installation documents that came
68 with the software!
69
70 *******************************************************************
71 ** FOR SELECTING WHICH GLASGOW FP TOOLS TO BUILD:
72
73 --disable-ghc     do *not* build GHC as part of Glasgow FP tools],
74    [case "$enableval" in
75         yes) DoingGHC='ghc'
76              ;;
77         no)  DoingGHC=''
78              ;;
79         *)   echo "I don't understand this option: --enable-ghc=$enableval"
80              exit 1
81              ;;
82     esac])
83 if test "xxx$DoingGHC" = 'xxxghc' -a \( ! -d ghc \) ; then
84     DoingGHC=''
85     echo 'Doing --disable-ghc, as there is no ghc directory'
86 fi
87 ghc_mkworld_site_ghc_jm='ghc/mkworld/site-ghc.jm'
88 ghc_includes_platform_h='ghc/includes/platform.h'
89 # duznae work: ghc_includes_config_h='ghc/includes/config.h'
90 if test "xxx$DoingGHC" = 'xxx' ; then
91     ghc_mkworld_site_ghc_jm=''
92     ghc_includes_platform_h=''
93 #   ghc_includes_config_h=''
94 fi
95
96 AC_ARG_ENABLE(hslibs,
97    [--enable-hslibs   build suite of Haskell libraries],
98    [case "$enableval" in
99         yes) DoingHsLibs='hslibs'
100              ;;
101         no)  DoingHsLibs=''
102              ;;
103         *)   echo "I don't understand this option: --enable-hslibs=$enableval"
104              exit 1
105              ;;
106     esac])
107 if test "xxx$DoingHsLibs" = 'xxxhslibs' -a \( ! -d hslibs \) ; then
108     DoingHsLibs=''
109     echo 'Doing --disable-hslibs, as there is no hslibs directory'
110 fi
111 hslibs_mkworld_site_hslibs_jm='hslibs/mkworld/site-hslibs.jm'
112 if test "xxx$DoingHsLibs" = 'xxx' ; then
113     hslibs_mkworld_site_hslibs_jm=''
114 fi
115
116 AC_ARG_ENABLE(nofib,
117    [--enable-nofib    build NoFib suite as part of Glasgow FP tools],
118    [case "$enableval" in
119         yes) DoingNoFib='nofib'
120              ;;
121         no)  DoingNoFib=''
122              ;;
123         *)   echo "I don't understand this option: --enable-nofib=$enableval"
124              exit 1
125              ;;
126     esac])
127 if test "xxx$DoingNoFib" = 'xxxnofib' -a \( ! -d nofib \) ; then
128     DoingNoFib=''
129     echo 'Doing --disable-nofib, as there is no nofib directory'
130 fi
131 nofib_mkworld_site_nofib_jm='nofib/mkworld/site-nofib.jm'
132 if test "xxx$DoingNoFib" = 'xxx' ; then
133     nofib_mkworld_site_nofib_jm=''
134 fi
135
136 AC_ARG_ENABLE(happy,
137    [--enable-happy    build Happy parser-generator as part of Glasgow FP tools],
138    [case "$enableval" in
139         yes) DoingHappy='happy'
140              ;;
141         no)  DoingHappy=''
142              ;;
143         *)   echo "I don't understand this option: --enable-happy=$enableval"
144              exit 1
145              ;;
146     esac])
147 if test "xxx$DoingHappy" = 'xxxhappy' -a \( ! -d happy \) ; then
148     DoingHappy=''
149     echo 'Doing --disable-happy, as there is no happy directory'
150 fi
151
152 AC_ARG_ENABLE(haggis,
153    [--enable-haggis   build Haggis GUI toolkit as part of Glasgow FP tools],
154    [case "$enableval" in
155         yes) DoingHaggis='haggis'
156              ;;
157         no)  DoingHaggis=''
158              ;;
159         *)   echo "I don't understand this option: --enable-haggis=$enableval"
160              exit 1
161              ;;
162     esac])
163 if test "xxx$DoingHaggis" = 'xxxhaggis' -a \( ! -d haggis \) ; then
164     DoingHaggis=''
165     echo 'Doing --disable-haggis, as there is no haggis directory'
166 fi
167
168 AC_ARG_ENABLE(literate,
169    [
170 The following three are \`for hackers only':
171 --disable-literate    do *not* build literate-programming stuff],
172    [case "$enableval" in
173         yes) DoingLiterate='literate'
174              ;;
175         no)  DoingLiterate=''
176              ;;
177         *)   echo "I don't understand this option: --enable-literate=$enableval"
178              exit 1
179              ;;
180     esac])
181 if test "xxx$DoingLiterate" = 'xxxliterate' -a \( ! -d literate \) ; then
182     DoingLiterate=''
183     echo 'Doing --disable-literate, as there is no literate directory'
184 fi
185
186 AC_ARG_ENABLE(mkworld,
187    [--disable-mkworld     do *not* build \`mkworld' configuration stuff],
188    [case "$enableval" in
189         yes) DoingMkWorld='mkworld'
190              ;;
191         no)  DoingMkWorld=''
192              ;;
193         *)   echo "I don't understand this option: --enable-mkworld=$enableval"
194              exit 1
195              ;;
196     esac])
197 if test "xxx$DoingMkWorld" = 'xxxmkworld' -a \( ! -d mkworld \) ; then
198     DoingMkWorld=''
199     echo 'Doing --disable-mkworld, as there is no mkworld directory'
200 fi
201
202 AC_ARG_ENABLE(glafp-utils,
203    [--disable-glafp-utils do *not* build \`glafp utilities'],
204    [case "$enableval" in
205         yes) DoingGlaFpUtils='glafp-utils'
206              ;;
207         no)  DoingGlaFpUtils=''
208              ;;
209         *)   echo "I don't understand this option: --enable-glafp-utils=$enableval"
210              exit 1
211              ;;
212     esac])
213 if test "xxx$DoingGlaFpUtils" = 'xxxglafp-utils' -a \( ! -d glafp-utils \) ; then
214     DoingGlaFpUtils=''
215     echo 'Doing --disable-glafp-utils, as there is no glafp-utils directory'
216 fi
217
218 AC_SUBST(DoingGHC)
219 AC_SUBST(DoingHsLibs)
220 AC_SUBST(DoingNoFib)
221 AC_SUBST(DoingHappy)
222 AC_SUBST(DoingHaggis)
223 AC_SUBST(DoingLiterate)
224 AC_SUBST(DoingMkWorld)
225 AC_SUBST(DoingGlaFpUtils)
226
227 # -------------------------------------------------------------------------
228 dnl ** choose host(/target/build) platform
229 # Guess host/target/build platform(s) if necessary.
230 # Partly stolen from GCC "configure".
231 #
232 if test "x$target" = xNONE ; then
233     if test "x$nonopt" != xNONE ; then
234         target=$nonopt
235     else
236         # This way of testing the result of a command substitution is
237         # defined by Posix.2 (section 3.9.1) as well as traditional shells.
238         if target=`$srcdir/config.guess` ; then
239             echo "Configuring for a ${target} host." 1>&2
240         else
241             echo 'Config.guess failed to determine the host type.  You need \
242 to specify one.' 1>&2
243             if test -r config.status ; then
244                 tail +2 config.status 1>&2
245             fi
246             exit 1
247         fi
248     fi
249 fi
250
251 # "$host" defaults to "$target"
252 if test "x$host" = xNONE ; then
253     host=$target
254 fi
255 # "$build" defaults to "$host"
256 if test "x$build" = xNONE ; then
257     build=$host
258 else
259     echo "This configuration does not support the \`--build' option."
260     exit 1
261 fi
262
263 dnl ** canonicalize platform names
264 # Canonicali[sz]e those babies
265 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
266 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
267 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
268
269 if test x"$TargetPlatform" != x"$HostPlatform" ; then
270     echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
271     exit 1
272 fi
273
274 # The following will be more difficult when we *are* cross-compiling.
275 # Suitable names to slam in *_CPP are in platform.h.in.
276 # We also record the architecture, vendor, and operating system (OS)
277 # separately.
278 case $HostPlatform in
279 alpha-dec-osf[[1234]]*)
280         HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
281         TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
282         BuildPlatform=alpha-dec-osf1 #hack
283         HostPlatform_CPP='alpha_dec_osf1'
284         HostArch_CPP='alpha'
285         HostVendor_CPP='dec'
286         HostOS_CPP='osf1'
287         ;;
288 hppa1.1-hp-hpux*)
289         HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
290         TargetPlatform=hppa1.1-hp-hpux
291         BuildPlatform=hppa1.1-hp-hpux
292         HostPlatform_CPP='hppa1_1_hp_hpux'
293         HostArch_CPP='hppa1_1'
294         HostVendor_CPP='hp'
295         HostOS_CPP='hpux'
296         ;;
297 i[[3456]]86-*-linuxaout*)
298         HostPlatform=i386-unknown-linuxaout # hack again
299         TargetPlatform=i386-unknown-linuxaout
300         BuildPlatform=i386-unknown-linuxaout
301         HostPlatform_CPP='i386_unknown_linuxaout'
302         HostArch_CPP='i386'
303         HostVendor_CPP='unknown'
304         HostOS_CPP='linuxaout'
305         ;;
306 i[[3456]]86-*-linux*)
307         HostPlatform=i386-unknown-linux # hack again
308         TargetPlatform=i386-unknown-linux
309         BuildPlatform=i386-unknown-linux
310         HostPlatform_CPP='i386_unknown_linux'
311         HostArch_CPP='i386'
312         HostVendor_CPP='unknown'
313         HostOS_CPP='linux'
314         ;;
315 i[[3456]]86-*-freebsd*)
316         HostPlatform=i386-unknown-freebsd # hack again
317         TargetPlatform=i386-unknown-freebsd
318         BuildPlatform=i386-unknown-freebsd
319         HostPlatform_CPP='i386_unknown_freebsd'
320         HostArch_CPP='i386'
321         HostVendor_CPP='unknown'
322         HostOS_CPP='freebsd'
323         ;;
324 i[[3456]]86-*-netbsd*)
325         HostPlatform=i386-unknown-netbsd # hack again
326         TargetPlatform=i386-unknown-netbsd
327         BuildPlatform=i386-unknown-netbsd
328         HostPlatform_CPP='i386_unknown_netbsd'
329         HostArch_CPP='i386'
330         HostVendor_CPP='unknown'
331         HostOS_CPP='netbsd'
332         ;;
333 i[[3456]]86-*-solaris2*)
334         HostPlatform=i386-unknown-solaris2 # hack again
335         TargetPlatform=i386-unknown-solaris2
336         BuildPlatform=i386-unknown-solaris2
337         HostPlatform_CPP='i386_unknown_solaris2'
338         HostArch_CPP='i386'
339         HostVendor_CPP='unknown'
340         HostOS_CPP='solaris2'
341         ;;
342 m68k-next-nextstep2)
343         HostPlatform_CPP='m68k_next_nextstep2'
344         HostArch_CPP='m68k'
345         HostVendor_CPP='next'
346         HostOS_CPP='nextstep2'
347         ;;
348 m68k-next-nextstep3)
349         HostPlatform_CPP='m68k_next_nextstep3'
350         HostArch_CPP='m68k'
351         HostVendor_CPP='next'
352         HostOS_CPP='nextstep3'
353         ;;
354 i[[3456]]86-next-nextstep3)
355         HostPlatform=i386-next-nextstep3 # hack again
356         TargetPlatform=i386-next-nextstep3
357         BuildPlatform=i386-next-nextstep3
358         HostPlatform_CPP='i386_next_nextstep3'
359         HostArch_CPP='i386'
360         HostVendor_CPP='next'
361         HostOS_CPP='nextstep3'
362         ;;
363 m68k-sun-sunos4*)
364         HostPlatform=m68k-sun-sunos4
365         TargetPlatform=m68k-sun-sunos4 #hack
366         BuildPlatform=m68k-sun-sunos4 #hack
367         HostPlatform_CPP='m68k_sun_sunos4'
368         HostArch_CPP='m68k'
369         HostVendor_CPP='sun'
370         HostOS_CPP='sunos4'
371         ;;
372 mips-dec-ultrix*)
373         HostPlatform_CPP='mips_dec_ultrix'
374         HostArch_CPP='mipsel'   # NB a little different
375         HostVendor_CPP='dec'
376         HostOS_CPP='ultrix'
377         ;;
378 mips-sgi-irix*)
379         HostPlatform=mips-sgi-irix
380         TargetPlatform=mips-sgi-irix #hack
381         BuildPlatform=mips-sgi-irix #hack
382         HostPlatform_CPP='mips_sgi_irix'
383         HostArch_CPP='mipseb'   # NB a little different
384         HostVendor_CPP='sgi'
385         HostOS_CPP='irix'
386         ;;
387 powerpc-ibm-aix*)
388         HostPlatform=powerpc-ibm-aix
389         TargetPlatform=powerpc-ibm-aix #hack
390         BuildPlatform=powerpc-ibm-aix #hack
391         HostPlatform_CPP='powerpc_ibm_aix'
392         HostArch_CPP='powerpc'
393         HostVendor_CPP='ibm'
394         HostOS_CPP='aix'
395         ;;
396 sparc-sun-sunos4*)
397         HostPlatform=sparc-sun-sunos4
398         TargetPlatform=sparc-sun-sunos4 #hack
399         BuildPlatform=sparc-sun-sunos4 #hack
400         HostPlatform_CPP='sparc_sun_sunos4'
401         HostArch_CPP='sparc'
402         HostVendor_CPP='sun'
403         HostOS_CPP='sunos4'
404         ;;
405 sparc-sun-solaris2*)
406         HostPlatform=sparc-sun-solaris2
407         TargetPlatform=sparc-sun-solaris2 #hack
408         BuildPlatform=sparc-sun-solaris2 #hack
409         HostPlatform_CPP='sparc_sun_solaris2'
410         HostArch_CPP='sparc'
411         HostVendor_CPP='sun'
412         HostOS_CPP='solaris2'
413         ;;
414 *)
415         echo "Unrecognised platform: $HostPlatform"
416         exit 1
417         ;;
418 esac
419
420 test -n "$verbose" && echo "Host platform set to $HostPlatform"
421 test -n "$verbose" -a x"$HostPlatform" != x"$TargetPlatform" \
422         && echo "Target platform set to $TargetPlatform"
423 test -n "$verbose" -a x"$BuildPlatform" != x"$HostPlatform" \
424         && echo "Build platform set to $BuildPlatform"
425
426 BuildPlatform_CPP=$HostPlatform_CPP
427 TargetPlatform_CPP=$HostPlatform_CPP
428 BuildArch_CPP=$HostArch_CPP
429 TargetArch_CPP=$HostArch_CPP
430 BuildOS_CPP=$HostOS_CPP
431 TargetOS_CPP=$HostOS_CPP
432 BuildVendor_CPP=$HostVendor_CPP
433 TargetVendor_CPP=$HostVendor_CPP
434 dnl Cannot afford all these AC_SUBSTs (because of braindead seds w/ 99 cmd limits
435 dnl AC_SUBST(BuildPlatform)
436 AC_SUBST(HostPlatform)
437 dnl AC_SUBST(TargetPlatform)
438 AC_SUBST(HostPlatform_CPP)
439 dnl AC_SUBST(BuildPlatform_CPP)
440 dnl AC_SUBST(TargetPlatform_CPP)
441 AC_SUBST(HostArch_CPP)
442 dnl AC_SUBST(BuildArch_CPP)
443 dnl AC_SUBST(TargetArch_CPP)
444 AC_SUBST(HostOS_CPP)
445 dnl AC_SUBST(BuildOS_CPP)
446 dnl AC_SUBST(TargetOS_CPP)
447 AC_SUBST(HostVendor_CPP)
448 dnl AC_SUBST(BuildVendor_CPP)
449 dnl AC_SUBST(TargetVendor_CPP)
450
451 # -------------------------------------------------------------------------
452 dnl
453 dnl * _GENERAL_ CONFIGURATION CHECKS
454 #
455 dnl ** are we at Glasgow?
456 #
457 if test -d /local/fp -a -d /users/fp/simonpj; then
458     echo "Brilliant!  You must be a Glaswegian."
459     AT_GLASGOW=1
460     if test "x$prefix" = xNONE; then
461         prefix=/local/fp
462         echo "Assuming installation prefix of $prefix"
463     fi
464     if test "x$exec_prefix" = xNONE; then
465         # Sigh: the defn of exec_prefix does not include the bin* bit...
466         # WDP 94/07
467         exec_prefix=/local/fp
468         echo "Assuming binary installation prefix of $exec_prefix"
469     fi
470 else
471     AT_GLASGOW=0
472 fi
473 AC_SUBST(AT_GLASGOW)
474 test -n "$verbose" && echo "    setting AT_GLASGOW to $AT_GLASGOW"
475 #
476 #
477 #
478 dnl ** does #! work?
479 #
480 AC_SYS_INTERPRETER()
481 #
482 dnl ** look for `perl', but watch out for version 4.035
483 #
484 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
485 if test -z "$PerlCmd"; then
486     echo "You must install perl before you can continue"
487     echo "Perhaps it is already installed, but not in your PATH?"
488     exit 1
489 else
490     $PerlCmd -v >conftest.out 2>&1
491     if egrep "version 4" conftest.out >/dev/null 2>&1; then
492         if egrep "Patch level: 35" conftest.out >/dev/null 2>&1; then
493             echo "
494 ************************************************************************
495 Uh-oh...looks like you have Perl 4.035.
496
497 Perl version 4.035 has a bug to do with recursion that will bite if
498 you run the lit2texi script, when making Info files from
499 literate files of various sorts.  Either use the current version
500 (4.036), an older version (e.g., perl 4.019) or apply the patch in
501 glafp-utils/perl-4.035-fixes to your 4.035 perl.
502 ************************************************************************
503 "
504         fi
505     else
506         if egrep "version 5" conftest.out >/dev/null 2>&1; then
507             :
508         else
509             echo "I'm not sure if your version of perl will work,"
510             echo "but it's worth a shot, eh?"
511         fi
512     fi
513     rm -fr conftest*
514 fi
515 #
516 dnl ** does #!.../perl work? (sometimes it's too long...)
517 echo "checking if \`#!$PerlCmd' works in shell scripts"
518 echo "#!$PerlCmd"'
519 exit $1;
520 ' > conftest
521 chmod u+x conftest
522 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
523 if test $? -ne 69; then
524    echo "It does!"
525 else
526    echo "It doesn't!  Perhaps \`#!$PerlCmd' is too long (often 32 characters max)"
527    exit 1
528 fi
529 rm -f conftest
530 #
531 dnl ** check if perl library is properly installed
532 # (by seeing if a "do 'getopts.pl'" works...
533 if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
534     :
535 else
536     echo "I think your perl library is misinstalled."
537     echo "The following script did not work:"
538     echo '      do "getopts.pl" || exit(1); exit(0);'
539     exit 1
540 fi
541 #
542 #
543 dnl ** look for GCC and find out which version
544 # Figure out which C compiler to use.  Gcc is preferred.
545 # If gcc, make sure it's at least 2.1
546 #
547 AC_PROG_CC
548 if test -z "$GCC"; then
549     echo "You would be better off with gcc"
550     echo "Perhaps it is already installed, but not in your PATH?"
551     HaveGcc='NO'
552 else
553     gcc -v > conftest.out 2>&1
554     echo '/version (\d+)\.(\d+)/ && $1*10+$2 > 20 && print "YES";' > conftest.pl
555     HaveGcc=`eval $PerlCmd -n conftest.pl conftest.out`
556     if test -z "$HaveGcc"; then
557         echo "I'm not sure if your version of gcc will work,"
558         echo "but it's worth a shot, eh?"
559         HaveGcc='YES'
560     fi
561     rm -fr conftest*
562 fi
563 AC_SUBST(HaveGcc)
564 AC_C_CROSS
565 #
566 dnl ** figure out how to do context diffs
567 # (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
568 #
569 echo foo > conftest1
570 echo foo > conftest2
571 if diff -C 1 conftest1 conftest2 > /dev/null 2>&1 ; then
572     ContextDiffCmd='diff -C 1'
573 else
574     if diff -c1 conftest1 conftest2 > /dev/null 2>&1 ; then
575         ContextDiffCmd='diff -c1'
576     else
577         echo "Can't figure out how to do context diffs."
578         echo "Neither \`diff -C 1' nor \`diff -c1' works."
579         exit 1
580     fi
581 fi
582 rm -f conftest1 conftest2
583 AC_SUBST(ContextDiffCmd)
584 #
585 dnl ** look for a decent parser generator (bison preferred)
586 #
587 #
588 AC_CHECK_PROG(YaccCmd, bison, bison -y)
589 if test -z "$YaccCmd"; then
590     echo "Can't find bison out there..."
591     AC_CHECK_PROG(WhatCmd, what, what, :)
592     AC_CHECK_PROG(YaccCmd, yacc, $ac_dir/$ac_word)
593     if test -z "$YaccCmd"; then
594         echo "But that's okay...I can't find yacc either."
595         YaccCmd=:
596     else
597         $WhatCmd $YaccCmd > conftest.out
598         if egrep 'y1\.c 1\..*SMI' conftest.out >/dev/null 2>&1; then
599             echo "I don't trust your $YaccCmd; it looks like an old Sun yacc"
600             if test -x /usr/lang/yacc; then
601                 echo "I'm going to use /usr/lang/yacc instead"
602                 YaccCmd=/usr/lang/yacc
603             else
604                 echo "I'm assuming the worst...no parser generator at all"
605                 YaccCmd=:
606             fi
607         elif egrep 'y1\.c.*Revision: 4\.2\.6\.3.*DEC' conftest.out >/dev/null 2>&1; then
608             echo "I don't trust your $YaccCmd; it looks like a lame DEC yacc"
609             echo "I'm assuming the worst...no parser generator at all"
610             YaccCmd=:
611         else
612             echo "But that's okay...as far as I know, your yacc will work."
613         fi
614         rm -fr conftest*
615     fi
616 fi
617
618 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
619 #
620 AC_PROG_LEX
621
622 #--------------------------------------------------------------
623 WithHc='haskell-compiler-unspecified'
624 WithHcType='HC_UNSPECIFIED'
625
626 AC_ARG_WITH(hc,
627    [
628 *******************************************************************
629 ** GENERAL OPTIONS WHICH APPLY TO ALL TOOLS:
630
631 --with-hc=<Haskell compiler>
632           ghc*     => Glasgow Haskell invoked by the name given
633           hbc*     => Chalmers HBC, invoked by the name given
634           nhc*     => Niklas Rojemo's "nhc", invoked by the name given
635           C or c   => Don't use a Haskell compiler;
636                       build from intermediate C (.hc) files.
637           in-place => Use ghc/driver/ghc; i.e. you've built GHC
638                       and you want to use it un-installed ("in-place").
639    ],
640    [case "$withval" in
641         ghc* | glhc* )
642                 WithHc=$withval
643                 ;;
644         hbc* )  WithHc=$withval
645                 ;;
646         nhc* )  WithHc=$withval
647                 ;;
648         c | C)  WithHc='C'
649                 ;;
650         in-place )
651                 WithHc='IN-PLACE'
652                 ;;
653         *)      echo "I don't understand this option: --with-hc=$withval"
654                 exit 1
655                 ;;
656     esac])
657
658 # make sure that what they said makes sense.... set WithHcType
659 case $WithHc in
660     haskell-compiler-unspecified ) # maybe they will say something later...
661             ;;
662     ghc* | glhc* )
663             WithHcType='HC_GLASGOW_GHC'
664             AC_CHECK_PROG(have_ghc,$WithHc,$ac_dir/$ac_word)
665             if test -z "$have_ghc"; then
666                 echo "Can't find Glasgow Haskell to compile with: $WithHc"
667                 exit 1
668             fi
669             ;;
670     hbc* )  # Look for the dastardly competition
671             WithHcType='HC_CHALMERS_HBC'
672             AC_CHECK_PROG(have_hbc,$WithHc,YES,NO)
673             if test $have_hbc = 'NO' ; then
674                 echo "Can't find Chalmers HBC to compile with: $WithHc"
675                 exit 1
676             fi
677             ;;
678     nhc* )  # Look for Niklas Rojemo's "nhc"
679             WithHcType='HC_ROJEMO_NHC'
680             AC_CHECK_PROG(have_nhc,$WithHc,YES,NO)
681             if test $have_nhc = 'NO' ; then
682                 echo "Can't find Niklas Rojemo's NHC to compile with: $WithHc"
683                 exit 1
684             fi
685             ;;
686     c | C)  WithHcType='HC_USE_HC_FILES'
687             ;;
688     IN-PLACE) WithHcType='HC_GLASGOW_GHC'
689             ;;
690 esac
691 AC_SUBST(WithHc)
692 AC_SUBST(WithHcType)
693
694 dnl ** Possibly use something else instead of 'gcc'.
695 WhatGccIsCalled=gcc
696 AC_ARG_WITH(gcc,
697    [--with-gcc=<gcc command>
698         Use a different command instead of 'gcc' for the GNU C compiler.],
699    [HaveGcc=YES; WhatGccIsCalled="$withval"])
700 AC_SUBST(WhatGccIsCalled)
701
702 dnl ** Choose which make to use (default 'make -r')
703 MakeCmd='make -r'
704 AC_ARG_WITH(make,
705    [ 
706 --with-make=<make command> 
707         Use an alternate command instead of 'make'.  This is useful
708         when GNU make is required (for instance when the default make
709         supplied by the system won't work, as is the case on FreeBSD
710         and NetBSD).  You probably want to include the '-r' flag with
711         make, to exclude implicit suffix rules.],
712    [MakeCmd="$withval"]) 
713 AC_SUBST(MakeCmd)
714
715 dnl ** possibly choose a different tmpdir (default /tmp)
716 # let the user decide where the best tmpdir is
717 # /tmp is the default; /usr/tmp is sometimes a good choice.
718 # Very site-specific.
719 TmpDir='/tmp'
720 AC_ARG_WITH(tmpdir,
721    [
722 --with-tmpdir=<temp directory> 
723         Use an alternative directory for temporary files (presumably
724         because /tmp is too small).],
725    [TmpDir="$withval"])
726 AC_SUBST(TmpDir)
727
728 dnl ** possibly set a max heap for Haskell compilations
729 # let the user specify a maximum heap to be used; the old
730 # "I have a 64MB machine, why not use a 32MB heap?" thing.
731 HcMaxHeapWasSet='NO'
732 HcMaxHeap='0'
733 AC_ARG_WITH(max-heap,
734    [
735 --with-max-heap=<heap size, e.g., 32m> 
736         Do all Haskell compilations with a heap of this size.  (If
737         you've got it, flaunt it.)],
738    [HcMaxHeapWasSet='YES'
739     HcMaxHeap="$withval"])
740 AC_SUBST(HcMaxHeapWasSet)
741 AC_SUBST(HcMaxHeap)
742
743 dnl ** figure out about mkdependHS
744 MkDependHSCmd=':'
745 if test -f ./ghc/utils/mkdependHS/mkdependHS \
746      -o -f ./ghc/utils/mkdependHS/mkdependHS.prl ; then
747     MkDependHSCmd='TopDirPwd/ghc/utils/mkdependHS/mkdependHS'
748 else
749     AC_CHECK_PROG(have_mkdependHS,mkdependHS,YES,NO)
750     if test $have_mkdependHS = 'YES' ; then
751         MkDependHSCmd='mkdependHS'
752     fi
753 fi
754 AC_SUBST(MkDependHSCmd)
755
756 # -------------------------------------------------------------------------
757 #
758 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
759 #
760 AC_PROG_CPP
761 if echo $CPP | egrep gcc >/dev/null 2>&1; then
762     echo > conftest.c
763     gcc -v -E conftest.c >/dev/null 2>conftest.out
764     echo '/(\S+\/cpp)/ && print "$1";' > conftest.pl
765     GNUCPP="`eval $PerlCmd -n conftest.pl conftest.out`"
766     test -n "$verbose" && echo "        setting GNUCPP to $GNUCPP"
767     RAWCPP="`eval $PerlCmd -n conftest.pl conftest.out` -traditional"
768     test -n "$verbose" && echo "        setting RAWCPP to $RAWCPP"
769     rm -fr conftest*
770 fi
771 # ToDo: what are GNUCPP and RAWCPP if the above if didn't fire? WDP 95/02
772 AC_SUBST(GNUCPP)
773 AC_SUBST(RAWCPP)
774 #
775 dnl ** figure out how to do a BSD-ish install
776 #
777 AC_PROG_INSTALL
778 #
779 dnl ** figure out what arguments to feed to `ar'
780 #
781 AC_CHECK_PROG(ArCmd,ar,$ac_dir/$ac_word)
782 if test -z "$ArCmd"; then
783     echo "You don't seem to have ar...I have no idea how to make a library"
784     exit 1;
785 fi
786 if $ArCmd clqs conftest.a >/dev/null 2>/dev/null; then
787     ArCmd="$ArCmd clqs"
788     NeedRanLib=''
789 elif $ArCmd cqs conftest.a >/dev/null 2>/dev/null; then
790     ArCmd="$ArCmd cqs"
791     NeedRanLib=''
792 elif $ArCmd clq conftest.a >/dev/null 2>/dev/null; then
793     ArCmd="$ArCmd clq"
794     NeedRanLib='YES'
795 elif $ArCmd cq conftest.a >/dev/null 2>/dev/null; then
796     ArCmd="$ArCmd cq"
797     NeedRanLib='YES'
798 elif $ArCmd cq conftest.a 2>&1 | grep 'no archive members specified' >/dev/null 2>/dev/null; then
799     ArCmd="$ArCmd cq"
800     NeedRanLib='YES'
801 else
802     echo "I can't figure out how to use your $ArCmd"
803     exit 1
804 fi
805 rm -rf conftest*
806 test -n "$ArCmd" && test -n "$verbose" && echo "        setting ArCmd to $ArCmd"
807 AC_SUBST(ArCmd)
808 #
809 dnl ** figure out if we need `ranlib'
810 #
811 if test -z "$NeedRanLib"; then
812     # we hackily override a few platforms on a case-by-case basis
813     case $HostPlatform in
814     i386-*-linuxaout)
815         NeedRanLib='YES'
816         ;;
817     *)  RANLIB=':'
818         ;;
819     esac
820     test -n "$verbose" && echo "        setting RANLIB to $RANLIB"
821 fi
822 if test -n "$NeedRanLib"; then
823     AC_PROG_RANLIB
824 fi
825 AC_SUBST(RANLIB)
826 #
827 dnl ** check for full ANSI header (.h) files
828 #
829 AC_HEADER_STDC
830 #
831 dnl ** check for specific header (.h) files that we are interested in
832 #
833 AC_CHECK_HEADERS(dirent.h fcntl.h grp.h malloc.h memory.h nlist.h pwd.h siginfo.h signal.h stdlib.h string.h sys/fault.h sys/file.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.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/vadvise.h sys/wait.h termios.h time.h types.h unistd.h utime.h vfork.h )
834 #
835 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
836 #
837 AC_HEADER_TIME
838 #
839 dnl ** how do we get a timezone name?
840 #
841 AC_STRUCT_TIMEZONE
842
843 dnl ** determine the type of signal()
844 #
845 AC_TYPE_SIGNAL
846 #
847 dnl ** check for specific library functions that we are interested in
848 #
849 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
850 #
851 dnl ** can we get alloca?
852 #
853 AC_FUNC_ALLOCA
854 #
855 dnl ** determine whether or not const works
856 #
857 AC_C_CONST
858 #
859 dnl ** check for leading underscores in symbol names
860 # We assume that they _aren't_ there if anything goes wrong.
861 #
862 echo checking for a leading underscore in symbol names
863 AC_TRY_RUN(
864 [#ifdef HAVE_NLIST_H
865 #include <nlist.h>
866 struct nlist xYzzY[] = {{"_xYzzY", 0},{0}};
867 #endif
868
869 main(argc, argv)
870 int argc;
871 char **argv;
872 {
873 #ifdef HAVE_NLIST_H
874     if(nlist(argv[0], xYzzY) == 0 && xYzzY[0].n_value != 0)
875         exit(0);
876 #endif
877     exit(1);
878 }], LeadingUnderscore='YES', LeadingUnderscore='NO', LeadingUnderscore='YES')
879 test -n "$verbose" && echo "    setting LeadingUnderscore to $LeadingUnderscore"
880
881 # -------------------------------------------------------------------------
882 dnl
883 dnl * `GHC' CONFIGURATION STUFF
884
885 if test "xxx$DoingGHC" = 'xxxghc' ; then
886 # a very big "if"!
887 #
888 dnl ** which builds to build?
889 # builds: normal = sequential _ap_o ; _p = profiling (sequential);
890 # _t = ticky; _u = unregisterized
891 GhcBuild_normal='YES'
892 GhcBuild_p='YES'
893 GhcBuild_t='NO'
894 GhcBuild_u='NO'
895 # _mc = concurrent; _mr = profiled concurrent; _mt = ticky concurrent
896 # _mp = parallel; _mg = gransim
897 GhcBuild_mc='NO'
898 GhcBuild_mr='NO'
899 GhcBuild_mt='NO'
900 GhcBuild_mp='NO'
901 GhcBuild_mg='NO'
902 # GC builds: _2s, _1s, _du (, _gn)
903 GhcBuild_2s='NO'
904 GhcBuild_1s='NO'
905 GhcBuild_du='NO'
906 # user builds: a...o
907 GhcBuild_a='NO'
908 GhcBuild_b='NO'
909 GhcBuild_c='NO'
910 GhcBuild_d='NO'
911 GhcBuild_e='NO'
912 GhcBuild_f='NO'
913 GhcBuild_g='NO'
914 GhcBuild_h='NO'
915 GhcBuild_i='NO'
916 GhcBuild_j='NO'
917 GhcBuild_k='NO'
918 GhcBuild_l='NO'
919 GhcBuild_m='NO'
920 GhcBuild_n='NO'
921 GhcBuild_o='NO'
922 GhcBuild_A='NO'
923 GhcBuild_B='NO'
924 # More could be added here...
925
926 AC_ARG_ENABLE(normal-build,
927    [
928 *******************************************************************
929 ** \`GHC' (GLASGOW HASKELL COMPILER) OPTIONS:
930
931 Choose all the \`builds' of GHC that you want:
932
933 --disable-normal-build do *not* build GHC for normal sequential code],
934    [case "$enableval" in
935         yes) GhcBuild_normal='YES'
936              ;;
937         no)  GhcBuild_normal='NO'
938              ;;
939         *)   echo "I don't understand this option: --enable-normal-build=$enableval"
940              exit 1
941              ;;
942     esac])
943
944 AC_ARG_ENABLE(profiling,
945    [--disable-profiling    do *not* build profiling features],
946    [case "$enableval" in
947         yes) GhcBuild_p='YES'
948              ;;
949         no)  GhcBuild_p='NO'
950              ;;
951         *)   echo "I don't understand this option: --enable-profiling=$enableval"
952              exit 1
953              ;;
954     esac])
955
956 AC_ARG_ENABLE(ticky,
957    [--enable-ticky         build for \`ticky-ticky' profiling (for implementors)],
958    [case "$enableval" in
959         yes) GhcBuild_t='YES'
960              ;;
961         no)  GhcBuild_t='NO'
962              ;;
963         *)   echo "I don't understand this option: --enable-ticky=$enableval"
964              exit 1
965              ;;
966     esac])
967
968 AC_ARG_ENABLE(concurrent,
969    [--enable-concurrent    turn on \`concurrent Haskell' features],
970    [case "$enableval" in
971         yes) GhcBuild_mc='YES'
972              ;;
973         no)  GhcBuild_mc='NO'
974              ;;
975         *)   echo "I don't understand this option: --enable-concurrent=$enableval"
976              exit 1
977              ;;
978     esac])
979
980 AC_ARG_ENABLE(profiled-concurrent,
981    [--enable-profiled-concurrent turn on profiling for \`concurrent Haskell'],
982    [case "$enableval" in
983         yes) GhcBuild_mr='YES'
984              ;;
985         no)  GhcBuild_mr='NO'
986              ;;
987         *)   echo "I don't understand this option: --enable-profiled-concurrent=$enableval"
988              exit 1
989              ;;
990     esac])
991
992 AC_ARG_ENABLE(ticky-concurrent,
993    [--enable-ticky-concurrent turn on \`ticky-ticky' profiling for \`concurrent Haskell'],
994    [case "$enableval" in
995         yes) GhcBuild_mt='YES'
996              ;;
997         no)  GhcBuild_mt='NO'
998              ;;
999         *)   echo "I don't understand this option: --enable-ticky-concurrent=$enableval"
1000              exit 1
1001              ;;
1002     esac])
1003
1004 AC_ARG_ENABLE(parallel,
1005    [--enable-parallel      turn on \`parallel Haskell' features],
1006    [case "$enableval" in
1007         yes) GhcBuild_mp='YES';
1008              ;;
1009         no)  GhcBuild_mp='NO'
1010              ;;
1011         *)   echo "I don't understand this option: --enable-parallel=$enableval"
1012              exit 1
1013              ;;
1014     esac])
1015
1016 AC_ARG_ENABLE(gransim,
1017    [--enable-gransim       turn on GranSim parallel simulator],
1018    [case "$enableval" in
1019         yes) GhcBuild_mg='YES';
1020              ;;
1021         no)  GhcBuild_mg='NO'
1022              ;;
1023         *)   echo "I don't understand this option: --enable-gransim=$enableval"
1024              exit 1
1025              ;;
1026     esac])
1027
1028 AC_ARG_ENABLE(gc-2s,
1029    [--enable-gc-2s         a build with the 2-space copying garbage collector],
1030    [case "$enableval" in
1031         yes) GhcBuild_2s='YES'
1032              ;;
1033         no)  GhcBuild_2s='NO'
1034              ;;
1035         *)   echo "I don't understand this option: --enable-gc-2s=$enableval"
1036              exit 1
1037              ;;
1038     esac])
1039
1040 AC_ARG_ENABLE(gc-1s,
1041    [--enable-gc-1s         a build with the 1-space compacting garbage collector],
1042    [case "$enableval" in
1043         yes) GhcBuild_1s='YES'
1044              ;;
1045         no)  GhcBuild_1s='NO'
1046              ;;
1047         *)   echo "I don't understand this option: --enable-gc-1s=$enableval"
1048              exit 1
1049              ;;
1050     esac])
1051
1052 AC_ARG_ENABLE(gc-du,
1053    [--enable-gc-du         a build with \`dual-mode' (1s/2s) garbage collector],
1054    [case "$enableval" in
1055         yes) GhcBuild_du='YES'
1056              ;;
1057         no)  GhcBuild_du='NO'
1058              ;;
1059         *)   echo "I don't understand this option: --enable-gc-du=$enableval"
1060              exit 1
1061              ;;
1062     esac])
1063
1064 AC_ARG_ENABLE(user-way-a,
1065    [--enable-user-way-a    build for \`user way a' (mostly for implementors)],
1066    [case "$enableval" in
1067         yes) GhcBuild_a='YES'
1068              ;;
1069         no)  GhcBuild_a='NO'
1070              ;;
1071         *)   echo "I don't understand this option: --enable-user-way-a=$enableval"
1072              exit 1
1073              ;;
1074     esac])
1075
1076 AC_ARG_ENABLE(user-way-b,
1077    [--enable-user-way-b    build for \`user way b' (mostly for implementors)],
1078    [case "$enableval" in
1079         yes) GhcBuild_b='YES'
1080              ;;
1081         no)  GhcBuild_b='NO'
1082              ;;
1083         *)   echo "I don't understand this option: --enable-user-way-b=$enableval"
1084              exit 1
1085              ;;
1086     esac])
1087
1088 AC_ARG_ENABLE(user-way-c,
1089    [--enable-user-way-c    build for \`user way c' (mostly for implementors)],
1090    [case "$enableval" in
1091         yes) GhcBuild_c='YES'
1092              ;;
1093         no)  GhcBuild_c='NO'
1094              ;;
1095         *)   echo "I don't understand this option: --enable-user-way-c=$enableval"
1096              exit 1
1097              ;;
1098     esac])
1099
1100 AC_ARG_ENABLE(user-way-d,
1101    [--enable-user-way-d    build for \`user way d' (mostly for implementors)],
1102    [case "$enableval" in
1103         yes) GhcBuild_d='YES'
1104              ;;
1105         no)  GhcBuild_d='NO'
1106              ;;
1107         *)   echo "I don't understand this option: --enable-user-way-d=$enableval"
1108              exit 1
1109              ;;
1110     esac])
1111
1112 AC_ARG_ENABLE(user-way-e,
1113    [--enable-user-way-e    build for \`user way e' (mostly for implementors)],
1114    [case "$enableval" in
1115         yes) GhcBuild_e='YES'
1116              ;;
1117         no)  GhcBuild_e='NO'
1118              ;;
1119         *)   echo "I don't understand this option: --enable-user-way-e=$enableval"
1120              exit 1
1121              ;;
1122     esac])
1123
1124 AC_ARG_ENABLE(user-way-f,
1125    [--enable-user-way-f    build for \`user way f' (mostly for implementors)],
1126    [case "$enableval" in
1127         yes) GhcBuild_f='YES'
1128              ;;
1129         no)  GhcBuild_f='NO'
1130              ;;
1131         *)   echo "I don't understand this option: --enable-user-way-f=$enableval"
1132              exit 1
1133              ;;
1134     esac])
1135
1136 AC_ARG_ENABLE(user-way-g,
1137    [--enable-user-way-g    build for \`user way g' (mostly for implementors)],
1138    [case "$enableval" in
1139         yes) GhcBuild_g='YES'
1140              ;;
1141         no)  GhcBuild_g='NO'
1142              ;;
1143         *)   echo "I don't understand this option: --enable-user-way-g=$enableval"
1144              exit 1
1145              ;;
1146     esac])
1147
1148 AC_ARG_ENABLE(user-way-h,
1149    [--enable-user-way-h    build for \`user way h' (mostly for implementors)],
1150    [case "$enableval" in
1151         yes) GhcBuild_h='YES'
1152              ;;
1153         no)  GhcBuild_h='NO'
1154              ;;
1155         *)   echo "I don't understand this option: --enable-user-way-h=$enableval"
1156              exit 1
1157              ;;
1158     esac])
1159
1160 AC_ARG_ENABLE(user-way-i,
1161    [--enable-user-way-i    build for \`user way i' (mostly for implementors)],
1162    [case "$enableval" in
1163         yes) GhcBuild_i='YES'
1164              ;;
1165         no)  GhcBuild_i='NO'
1166              ;;
1167         *)   echo "I don't understand this option: --enable-user-way-i=$enableval"
1168              exit 1
1169              ;;
1170     esac])
1171
1172 AC_ARG_ENABLE(user-way-j,
1173    [--enable-user-way-j    build for \`user way j' (mostly for implementors)],
1174    [case "$enableval" in
1175         yes) GhcBuild_j='YES'
1176              ;;
1177         no)  GhcBuild_j='NO'
1178              ;;
1179         *)   echo "I don't understand this option: --enable-user-way-j=$enableval"
1180              exit 1
1181              ;;
1182     esac])
1183
1184 AC_ARG_ENABLE(user-way-k,
1185    [--enable-user-way-k    build for \`user way k' (mostly for implementors)],
1186    [case "$enableval" in
1187         yes) GhcBuild_k='YES'
1188              ;;
1189         no)  GhcBuild_k='NO'
1190              ;;
1191         *)   echo "I don't understand this option: --enable-user-way-k=$enableval"
1192              exit 1
1193              ;;
1194     esac])
1195
1196 AC_ARG_ENABLE(user-way-l,
1197    [--enable-user-way-l    build for \`user way l' (mostly for implementors)],
1198    [case "$enableval" in
1199         yes) GhcBuild_l='YES'
1200              ;;
1201         no)  GhcBuild_l='NO'
1202              ;;
1203         *)   echo "I don't understand this option: --enable-user-way-l=$enableval"
1204              exit 1
1205              ;;
1206     esac])
1207
1208 AC_ARG_ENABLE(user-way-m,
1209    [--enable-user-way-m    build for \`user way m' (mostly for implementors)],
1210    [case "$enableval" in
1211         yes) GhcBuild_m='YES'
1212              ;;
1213         no)  GhcBuild_m='NO'
1214              ;;
1215         *)   echo "I don't understand this option: --enable-user-way-m=$enableval"
1216              exit 1
1217              ;;
1218     esac])
1219
1220 AC_ARG_ENABLE(user-way-n,
1221    [--enable-user-way-n    build for \`user way n' (mostly for implementors)],
1222    [case "$enableval" in
1223         yes) GhcBuild_n='YES'
1224              ;;
1225         no)  GhcBuild_n='NO'
1226              ;;
1227         *)   echo "I don't understand this option: --enable-user-way-n=$enableval"
1228              exit 1
1229              ;;
1230     esac])
1231
1232 AC_ARG_ENABLE(user-way-o,
1233    [--enable-user-way-o    build for \`user way o' (mostly for implementors)],
1234    [case "$enableval" in
1235         yes) GhcBuild_o='YES'
1236              ;;
1237         no)  GhcBuild_o='NO'
1238              ;;
1239         *)   echo "I don't understand this option: --enable-user-way-o=$enableval"
1240              exit 1
1241              ;;
1242     esac])
1243
1244 AC_ARG_ENABLE(user-way-A,
1245    [--enable-user-way-A    build for \`user way A' (mostly for implementors)],
1246    [case "$enableval" in
1247         yes) GhcBuild_A='YES'
1248              ;;
1249         no)  GhcBuild_A='NO'
1250              ;;
1251         *)   echo "I don't understand this option: --enable-user-way-A=$enableval"
1252              exit 1
1253              ;;
1254     esac])
1255
1256 AC_ARG_ENABLE(user-way-B,
1257    [--enable-user-way-B    build for \`user way B' (mostly for implementors)],
1258    [case "$enableval" in
1259         yes) GhcBuild_B='YES'
1260              ;;
1261         no)  GhcBuild_B='NO'
1262              ;;
1263         *)   echo "I don't understand this option: --enable-user-way-B=$enableval"
1264              exit 1
1265              ;;
1266     esac])
1267
1268 dnl We do not use AC_SUBST to communicate the GhcBuild_* info,
1269 dnl as some seds (notably OSF) only allow 99 commands (!!!).
1270 dnl We will do the equivalent by a HACK further down.
1271
1272 dnl AC_SUBST(GhcBuild_normal)
1273 dnl AC_SUBST(GhcBuild_p)
1274 dnl AC_SUBST(GhcBuild_t)
1275 dnl AC_SUBST(GhcBuild_u)
1276 dnl AC_SUBST(GhcBuild_mc)
1277 dnl AC_SUBST(GhcBuild_mr)
1278 dnl AC_SUBST(GhcBuild_mt)
1279 dnl AC_SUBST(GhcBuild_mp)
1280 dnl AC_SUBST(GhcBuild_mg)
1281 dnl AC_SUBST(GhcBuild_2s)
1282 dnl AC_SUBST(GhcBuild_1s)
1283 dnl AC_SUBST(GhcBuild_du)
1284 dnl AC_SUBST(GhcBuild_a)
1285 dnl AC_SUBST(GhcBuild_b)
1286 dnl AC_SUBST(GhcBuild_c)
1287 dnl AC_SUBST(GhcBuild_d)
1288 dnl AC_SUBST(GhcBuild_e)
1289 dnl AC_SUBST(GhcBuild_f)
1290 dnl AC_SUBST(GhcBuild_g)
1291 dnl AC_SUBST(GhcBuild_h)
1292 dnl AC_SUBST(GhcBuild_i)
1293 dnl AC_SUBST(GhcBuild_j)
1294 dnl AC_SUBST(GhcBuild_k)
1295 dnl AC_SUBST(GhcBuild_l)
1296 dnl AC_SUBST(GhcBuild_m)
1297 dnl AC_SUBST(GhcBuild_n)
1298 dnl AC_SUBST(GhcBuild_o)
1299 dnl AC_SUBST(GhcBuild_A)
1300 dnl AC_SUBST(GhcBuild_B)
1301
1302 #---------------------------------------------------------------
1303 #
1304 dnl ** which Haskell compiler to bootstrap GHC with?
1305 # Figure out what Haskell compiler(s) to use for booting
1306 #
1307 # first, the defaults...
1308 WithGhcHc='haskell-compiler-unspecified'
1309 WithGhcHcType='HC_UNSPECIFIED'
1310 GhcBuilderVersion='28'
1311
1312 AC_ARG_WITH(hc-for-ghc,
1313    [
1314 The Haskell compiler for bootstrapping GHC (if any); this option,
1315 if used, overrides --with-hc=<...>:
1316
1317     --with-hc-for-ghc=<Haskell compiler>
1318           ghc*     => Glasgow Haskell invoked by the name given
1319           C or c   => Don't use a Haskell compiler;
1320                       build from intermediate C (.hc) files.
1321    ],
1322    [case "$withval" in
1323         ghc* | glhc* )
1324                 WithGhcHc=$withval
1325                 ;;
1326         hbc* )  echo "HBC will not compile GHC 0.26 as is (sigh)"
1327                 exit 1
1328                 ;;
1329         c | C)  WithGhcHc='C'
1330                 WithGhcHcType='HC_USE_HC_FILES'
1331                 ;;
1332         *)      echo "I don't understand this option: --with-hc-for-ghc=$withval"
1333                 exit 1
1334                 ;;
1335     esac])
1336
1337 # make sure that what they said makes sense.... set WithGhcHcType
1338 case $WithGhcHc in
1339     haskell-compiler-unspecified ) # maybe they said something earlier...
1340             if test $WithHc = 'haskell-compiler-unspecified' ; then
1341                 echo "Neither --with-hc nor --with-hc-for-ghc was properly set"
1342                 exit 1
1343             fi
1344             if test $WithHcType = 'HC_GLASGOW_GHC' ; then
1345                 touch conftest.o
1346                 $WithHc -v -C conftest.o > conftest.out 2>&1
1347                 echo '/version (\d+)\.(\d+)/ && print ($1*100+$2);' > conftest.pl
1348                 GhcBuilderVersion=`eval $PerlCmd -n conftest.pl conftest.out`
1349                 rm -rf conftest*
1350             fi
1351             ;;
1352     ghc* | glhc* )
1353             WithGhcHcType='HC_GLASGOW_GHC'
1354             AC_CHECK_PROG(have_ghc_ghc,$WithGhcHc,$ac_dir/$ac_word)
1355             if test -z "$have_ghc_ghc"; then
1356                 echo "Can't find Glasgow Haskell to compile GHC with: $WithGhcHc"
1357                 exit 1
1358             else
1359                 touch conftest.o
1360                 $WithGhcHc -v -C conftest.o > conftest.out 2>&1
1361                 echo '/version (\d+)\.(\d+)/ && print ($1*100+$2);' > conftest.pl
1362                 GhcBuilderVersion=`eval $PerlCmd -n conftest.pl conftest.out`
1363                 rm -rf conftest*
1364             fi
1365             ;;
1366     c | C)  WithGhcHcType='HC_USE_HC_FILES'
1367             ;;
1368 esac
1369 AC_SUBST(GhcBuilderVersion)
1370 AC_SUBST(WithGhcHc)
1371 AC_SUBST(WithGhcHcType)
1372
1373 dnl ** use portable (slow) C? -- preferably not
1374 GhcWithRegisterised='YES'
1375 AC_ARG_ENABLE(portable-C,
1376    [Other things for GHC:
1377
1378 --enable-portable-C       use portable C (slow), not \`registerised' (fast)],
1379    [case "$enableval" in
1380         yes) GhcWithRegisterised='NO'
1381              ;;
1382         no)  GhcWithRegisterised='YES'
1383              ;;
1384         *)   echo "I don't understand this option: --enable-portable-C=$enableval"
1385              exit 1
1386              ;;
1387     esac])
1388
1389 if test $GhcWithRegisterised = 'YES'; then
1390     case $HostPlatform in
1391     alpha-* | hppa1.1-* | i386-* | m68k-* | mips-* | powerpc-* | sparc-* )
1392        ;;
1393     *)
1394        echo "Don't know non-portable C tricks for this platform: $HostPlatform"
1395        GhcWithRegisterised='NO'
1396        ;;
1397     esac
1398 fi
1399 AC_SUBST(GhcWithRegisterised)
1400
1401 if test $GhcWithRegisterised = 'NO'; then
1402     GhcBuild_u='YES'
1403     GhcBuild_normal='NO'
1404     GhcBuild_p='NO'
1405 fi
1406 # ToDo: make sure we can do concurrent for platform/circs...
1407 # ToDo: make sure we can do profiling for platform/circs...
1408 # ToDo: make sure we can do parallel for platform/circs...
1409 # ToDo: make sure we can do gransim for platform/circs...
1410
1411 dnl ** build GHC compiler proper (\`hsc') from .hc files?
1412 GhcWithHscBuiltViaC='NO'
1413 AC_ARG_ENABLE(hsc-built-via-C,
1414    [--enable-hsc-built-via-C  build compiler proper (hsc) from intermediate .hc
1415                           files (disabled by default)],
1416    [case "$enableval" in
1417         yes) GhcWithHscBuiltViaC='YES'
1418              ;;
1419         no)  GhcWithHscBuiltViaC='NO'
1420              ;;
1421         *)   echo "I don't understand this option: --enable-hsc-built-via-C=$enableval"
1422              exit 1
1423              ;;
1424     esac])
1425 case $WithGhcHc in
1426     haskell-compiler-unspecified ) # maybe they said something earlier...
1427             if test $WithHcType = 'HC_USE_HC_FILES' ; then
1428                 GhcWithHscBuiltViaC='YES'
1429             fi
1430             ;;
1431     c | C)  GhcWithHscBuiltViaC='YES'
1432             ;;
1433     *)      ;;
1434 esac
1435 AC_SUBST(GhcWithHscBuiltViaC)
1436
1437 dnl ** build \`hsc' with -O?
1438 GhcWithHscOptimised='YES'
1439 AC_ARG_ENABLE(hsc-optimised,
1440    [--disable-hsc-optimised   don't build compiler proper (hsc) with -O],
1441    [case "$enableval" in
1442         yes) GhcWithHscOptimised='YES'
1443              ;;
1444         no)  GhcWithHscOptimised='NO'
1445              ;;
1446         *)   echo "I don't understand this option: --enable-hsc-optimised=$enableval"
1447              exit 1
1448              ;;
1449     esac])
1450 AC_SUBST(GhcWithHscOptimised)
1451
1452 dnl ** build \`hsc' with -DDEBUG?
1453 GhcWithHscDebug='NO'
1454 AC_ARG_ENABLE(hsc-debug,
1455    [--enable-hsc-debug        build compiler proper (hsc) with -DDEBUG],
1456    [case "$enableval" in
1457         yes) GhcWithHscDebug='YES'
1458              ;;
1459         no)  GhcWithHscDebug='NO'
1460              ;;
1461         *)   echo "I don't understand this option: --enable-hsc-debug=$enableval"
1462              exit 1
1463              ;;
1464     esac])
1465 AC_SUBST(GhcWithHscDebug)
1466
1467 dnl ** omit native-code generator from \`hsc'?
1468 GhcWithNativeCodeGen='YES'
1469 AC_ARG_ENABLE(native-code-generator,
1470    [--enable-native-code-generator  build an n.c.g.
1471                           [enabled for supported platforms]],
1472    [case "$enableval" in
1473         yes) GhcWithNativeCodeGen='YES'
1474              ;;
1475         no)  GhcWithNativeCodeGen='NO'
1476              ;;
1477         *)   echo "I don't understand this option: --enable-native-code-generator=$enableval"
1478              exit 1
1479              ;;
1480     esac])
1481 if test $GhcWithNativeCodeGen = 'YES'; then
1482     case $TargetPlatform in
1483     i386-* | alpha-* | sparc-* )
1484        ;;
1485     *)
1486        echo "Don't have a native-code generator for this platform: $TargetPlatform"
1487        GhcWithNativeCodeGen='NO'
1488        ;;
1489     esac
1490 fi
1491 AC_SUBST(GhcWithNativeCodeGen)
1492
1493 dnl ** include Marlow's deforester in \`hsc'?
1494 GhcWithDeforester='NO'
1495 AC_ARG_ENABLE(deforester,
1496    [--enable-deforester       build deforester into compiler (HACKERS ONLY)],
1497    [case "$enableval" in
1498         yes) GhcWithDeforester='YES'
1499              ;;
1500         no)  GhcWithDeforester='NO'
1501              ;;
1502         *)   echo "I don't understand this option: --enable-deforester=$enableval"
1503              exit 1
1504              ;;
1505     esac])
1506 AC_SUBST(GhcWithDeforester)
1507
1508 dnl ** include Readline library?
1509 GhcWithReadline='NO'
1510 AC_ARG_ENABLE(readline-library,
1511    [--enable-readline-library include (GNU) readline library in -syslib GHC],
1512    [case "$enableval" in
1513         yes) GhcWithReadline='YES'
1514              ;;
1515         no)  GhcWithReadline='NO'
1516              ;;
1517         *)   echo "I don't understand this option: --enable-readline-library=$enableval"
1518              exit 1
1519              ;;
1520     esac])
1521 AC_SUBST(GhcWithReadline)
1522
1523 dnl ** include Sockets library?
1524 GhcWithSockets='NO'
1525 AC_ARG_ENABLE(sockets-library,
1526    [--enable-sockets-library  include the network-interface (sockets) library in -syslib GHC],
1527    [case "$enableval" in
1528         yes) GhcWithSockets='YES'
1529              ;;
1530         no)  GhcWithSockets='NO'
1531              ;;
1532         *)   echo "I don't understand this option: --enable-sockets-library=$enableval"
1533              exit 1
1534              ;;
1535     esac])
1536 AC_SUBST(GhcWithSockets)
1537
1538 dnl ** build the interpreter?
1539 BuildGHCI='NO'
1540 AC_ARG_ENABLE(ghci,
1541    [--enable-ghci             build Glasgow Haskell interpreter (HACKERS ONLY)],
1542    [case "$enableval" in
1543         yes) BuildGHCI='YES'
1544              ;;
1545         no)  BuildGHCI='NO'
1546              ;;
1547         *)   echo "I don't understand this option: --enable-ghci=$enableval"
1548              exit 1
1549              ;;
1550     esac])
1551 AC_SUBST(BuildGHCI)
1552
1553 # Here, by HACK means, we dump all the GhcBuild_ info
1554 # into a file.  See comment above.
1555 rm -f ghc/mkworld/buildinfo.jm
1556 echo creating ghc/mkworld/buildinfo.jm
1557 cat > ghc/mkworld/buildinfo.jm <<EOF
1558 XCOMM ** DO NOT EDIT! **
1559 XCOMM This file is obliterated every time 'configure' is run!
1560
1561 EOF
1562 for xx in normal p t u mc mr mt mp mg 2s 1s du a b c d e f g h i j k l m n o A B ; do
1563     eval "yy=\$GhcBuild_$xx"
1564     echo "#ifndef GhcBuild_$xx"     >> ghc/mkworld/buildinfo.jm
1565     echo "#define GhcBuild_$xx $yy" >> ghc/mkworld/buildinfo.jm
1566     echo "#endif"                   >> ghc/mkworld/buildinfo.jm
1567 done
1568
1569 # here ends a very big if DoingGHC = 'ghc' ...
1570 fi
1571
1572 # -------------------------------------------------------------------------
1573 dnl
1574 dnl * `HsLibs' CONFIGURATION STUFF
1575
1576 if test "xxx$DoingHsLibs" = 'xxxhslibs' ; then
1577 # a very big "if"!
1578
1579 dnl ** which Haskell compiler to use on hslibs?
1580 WithHsLibsHc='haskell-compiler-unspecified'
1581 WithHsLibsHcType='HC_UNSPECIFIED'
1582
1583 AC_ARG_WITH(hc-for-hslibs,
1584    [
1585 *******************************************************************
1586 ** \`HsLibs' HASKELL LIBRARIES OPTIONS:
1587
1588 The Haskell compiler to compile the Haskell Libraries suite; this
1589 option, if used, overrides --with-hc=<...>:
1590
1591     --with-hc-for-hslibs=<Haskell compiler>
1592           ghc*     => Glasgow Haskell invoked by the name given
1593                       and you want to use it un-installed ("in-place").],
1594    [case "$withval" in
1595         ghc* | glhc* )
1596                 WithHsLibsHc=$withval
1597                 ;;
1598         in-place )
1599                 WithHsLibsHc='IN-PLACE'
1600                 ;;
1601         *)      echo "I don't understand this option: --with-hc-for-hslibs=$withval"
1602                 exit 1
1603                 ;;
1604     esac])
1605
1606 # make sure that what they said makes sense.... set WithHsLibsHcType
1607 case $WithHsLibsHc in
1608     haskell-compiler-unspecified ) # maybe they said something earlier...
1609             if test $WithHc = 'haskell-compiler-unspecified' ; then
1610                 echo "Neither --with-hc nor --with-hc-for-hslibs was properly set"
1611                 exit 1
1612             fi
1613             ;;
1614     ghc* | glhc* )
1615             WithHsLibsHcType='HC_GLASGOW_GHC'
1616             AC_CHECK_PROG(have_ghc_hslibs,$WithHsLibsHc,$ac_dir/$ac_word)
1617             if test -z "$have_ghc_hslibs"; then
1618                 echo "Can't find Glasgow Haskell to compile HsLibs with: $WithHsLibsHc"
1619                 exit 1
1620             fi
1621             ;;
1622     IN-PLACE) WithHsLibsHcType='HC_GLASGOW_GHC'
1623             ;;
1624 esac
1625 AC_SUBST(WithHsLibsHc)
1626 AC_SUBST(WithHsLibsHcType)
1627
1628 # Here, by HACK means, we dump all the GhcBuild_ info
1629 # into a file.  See comment above.
1630 rm -f hslibs/mkworld/buildinfo.jm
1631 echo creating hslibs/mkworld/buildinfo.jm
1632 cat > hslibs/mkworld/buildinfo.jm <<EOF
1633 XCOMM ** DO NOT EDIT! **
1634 XCOMM This file is obliterated every time 'configure' is run!
1635
1636 EOF
1637 dnl Do not really know what to put here:
1638 dnl for xx in normal p t u mc mr mt mp mg 2s 1s du a b c d e f g h i j k l m n o A B ; do
1639 dnl     eval "yy=\$GhcBuild_$xx"
1640 dnl    echo "#ifndef GhcBuild_$xx"     >> ghc/mkworld/buildinfo.jm
1641 dnl    echo "#define GhcBuild_$xx $yy" >> ghc/mkworld/buildinfo.jm
1642 dnl    echo "#endif"                >> ghc/mkworld/buildinfo.jm
1643 dnl done
1644
1645 # here ends a very big if DoingHsLibs = 'hslibs' ...
1646 fi
1647 #
1648 # -------------------------------------------------------------------------
1649 dnl
1650 dnl * `Happy' CONFIGURATION STUFF
1651
1652 if test "xxx$DoingHappy" = 'xxxhappy' ; then
1653 # a very big "if"!
1654
1655 dnl ** which Haskell compiler to use on happy?
1656 WithHappyHc='haskell-compiler-unspecified'
1657 WithHappyHcType='HC_UNSPECIFIED'
1658
1659 AC_ARG_WITH(hc-for-happy,
1660    [
1661 *******************************************************************
1662 ** \`Happy' PARSER-GENERATOR OPTIONS:
1663
1664 The Haskell compiler to compile Happy; this option, if used, overrides
1665 --with-hc=<...>:
1666
1667     --with-hc-for-happy=<Haskell compiler>
1668           ghc*     => Glasgow Haskell invoked by the name given
1669           hbc*     => Chalmers HBC, invoked by the name given
1670           nhc*     => Niklas Rojemo's "nhc", invoked by the name given
1671           in-place => Use ghc/driver/ghc; i.e. you've built GHC
1672                       and you want to use it un-installed ("in-place").],
1673    [case "$withval" in
1674         ghc* | glhc* )
1675                 WithHappyHc=$withval
1676                 ;;
1677         hbc* )  WithHappyHc=$withval
1678                 ;;
1679         nhc* )  WithHappyHc=$withval
1680                 ;;
1681         in-place )
1682                 WithHappyHc='IN-PLACE'
1683                 ;;
1684         *)      echo "I don't understand this option: --with-hc-for-happy=$withval"
1685                 exit 1
1686                 ;;
1687     esac])
1688
1689 # make sure that what they said makes sense.... set WithHappyHcType
1690 case $WithHappyHc in
1691     haskell-compiler-unspecified ) # maybe they said something earlier...
1692             if test $WithHc = 'haskell-compiler-unspecified' ; then
1693                 echo "Neither --with-hc nor --with-hc-for-happy was properly set"
1694                 exit 1
1695             fi
1696             ;;
1697     ghc* | glhc* )
1698             WithHappyHcType='HC_GLASGOW_GHC'
1699             AC_CHECK_PROG(have_ghc_happy,$WithHappyHc,$ac_dir/$ac_word)
1700             if test -z "$have_ghc_happy"; then
1701                 echo "Can't find Glasgow Haskell to compile Happy with: $WithHappyHc"
1702                 exit 1
1703             fi
1704             ;;
1705     hbc* )  # Look for the dastardly competition
1706             WithHappyHcType='HC_CHALMERS_HBC'
1707             AC_CHECK_PROG(have_hbc,$WithHappyHc,YES,NO)
1708             if test $have_hbc = 'NO' ; then
1709                 echo "Can't find Chalmers HBC to compile with: $WithHappyHc"
1710                 exit 1
1711             fi
1712             ;;
1713     nhc* )  # Look for Niklas Rojemo's "nhc"
1714             WithHappyHcType='HC_ROJEMO_NHC'
1715             AC_CHECK_PROG(have_nhc,$WithHappyHc,YES,NO)
1716             if test $have_nhc = 'NO' ; then
1717                 echo "Can't find Niklas Rojemo's NHC to compile with: $WithHappyHc"
1718                 exit 1
1719             fi
1720             ;;
1721     IN-PLACE) WithHappyHcType='HC_GLASGOW_GHC'
1722             ;;
1723 esac
1724 AC_SUBST(WithHappyHc)
1725 AC_SUBST(WithHappyHcType)
1726
1727 # here ends a very big if DoingHappy = 'happy' ...
1728 fi
1729 #
1730 # -------------------------------------------------------------------------
1731 dnl
1732 dnl * `Haggis' CONFIGURATION STUFF
1733
1734 if test "xxx$DoingHaggis" = 'xxxhaggis' ; then
1735 # a very big "if"!
1736
1737 dnl ** which Haskell compiler to use on haggis?
1738 WithHaggisHc='haskell-compiler-unspecified'
1739 WithHaggisHcType='HC_UNSPECIFIED'
1740
1741 AC_ARG_WITH(hc-for-haggis,
1742    [
1743 *******************************************************************
1744 ** \`Haggis' HASKELL GUI TOOLKIT OPTIONS:
1745
1746 The Haskell compiler to compile the Haggis toolkit; this option, if
1747 used, overrides --with-hc=<...>:
1748
1749     --with-hc-for-haggis=<Haskell compiler>
1750           ghc*     => Glasgow Haskell invoked by the name given
1751                       and you want to use it un-installed ("in-place").],
1752    [case "$withval" in
1753         ghc* | glhc* )
1754                 WithHaggisHc=$withval
1755                 ;;
1756         in-place )
1757                 WithHaggisHc='IN-PLACE'
1758                 ;;
1759         *)      echo "I don't understand this option: --with-hc-for-haggis=$withval"
1760                 exit 1
1761                 ;;
1762     esac])
1763
1764 # make sure that what they said makes sense.... set WithHaggisHcType
1765 case $WithHaggisHc in
1766     haskell-compiler-unspecified ) # maybe they said something earlier...
1767             if test $WithHc = 'haskell-compiler-unspecified' ; then
1768                 echo "Neither --with-hc nor --with-hc-for-haggis was properly set"
1769                 exit 1
1770             fi
1771             ;;
1772     ghc* | glhc* )
1773             WithHaggisHcType='HC_GLASGOW_GHC'
1774             AC_CHECK_PROG(have_ghc_haggis,$WithHaggisHc,$ac_dir/$ac_word)
1775             if test -z "$have_ghc_haggis"; then
1776                 echo "Can't find Glasgow Haskell to compile Haggis with: $WithHaggisHc"
1777                 exit 1
1778             fi
1779             ;;
1780     IN-PLACE) WithHaggisHcType='HC_GLASGOW_GHC'
1781             ;;
1782 esac
1783 AC_SUBST(WithHaggisHc)
1784 AC_SUBST(WithHaggisHcType)
1785
1786 # here ends a very big if DoingHaggis = 'haggis' ...
1787 fi
1788 #
1789 # -------------------------------------------------------------------------
1790 dnl
1791 dnl * `Literate' CONFIGURATION STUFF
1792
1793 if test "xxx$DoingLiterate" = 'xxxliterate' ; then
1794 # a very big "if"!
1795
1796 BuildInfoUtils='NO'
1797 AC_ARG_ENABLE(info-utils,
1798    [
1799 *******************************************************************
1800 ** Literate programming system OPTIONS:
1801
1802 --enable-info-utils       build GNU info/makeinfo utilities],
1803    [case "$enableval" in
1804         yes) BuildInfoUtils='YES'
1805              ;;
1806         no)  BuildInfoUtils='NO'
1807              ;;
1808         *)   echo "I don't understand this option: --enable-info-utils=$enableval"
1809              exit 1
1810              ;;
1811     esac])
1812 AC_SUBST(BuildInfoUtils)
1813
1814 # here ends a very big if DoingLiterate = 'literate' ...
1815 fi
1816 #
1817 # -------------------------------------------------------------------------
1818 dnl
1819 dnl * `NoFib' CONFIGURATION STUFF
1820
1821 if test "xxx$DoingNoFib" = 'xxxnofib' ; then
1822 # a very big "if"!
1823
1824 dnl ** which Haskell compiler to test with NoFib?
1825 WithNoFibHc='haskell-compiler-unspecified'
1826 WithNoFibHcType='HC_UNSPECIFIED'
1827
1828 AC_ARG_WITH(hc-for-nofib,
1829    [
1830 *******************************************************************
1831 ** NoFib HASKELL BENCHMARK SUITE OPTIONS:
1832
1833 The Haskell compiler to compile the NoFib programs; this option, if
1834 used, overrides --with-hc=<...>:
1835
1836     --with-hc-for-nofib=<Haskell compiler>
1837           ghc*     => Glasgow Haskell invoked by the name given
1838           hbc*     => Chalmers HBC, invoked by the name given
1839           nhc*     => Niklas Rojemo's "nhc", invoked by the name given
1840           in-place => Use ghc/driver/ghc; i.e. you've built GHC
1841                       and you want to use it un-installed ("in-place").
1842    ],
1843    [case "$withval" in
1844         ghc* | glhc* )
1845                 WithNoFibHc=$withval
1846                 ;;
1847         hbc* )  WithNoFibHc=$withval
1848                 ;;
1849         nhc* )  WithNoFibHc=$withval
1850                 ;;
1851         in-place )
1852                 WithNoFibHc='IN-PLACE'
1853                 ;;
1854         *)      echo "I don't understand this option: --with-hc-for-nofib=$withval"
1855                 exit 1
1856                 ;;
1857     esac])
1858
1859 # make sure that what they said makes sense.... set WithHappyHcType
1860 case $WithNoFibHc in
1861     haskell-compiler-unspecified ) # maybe they said something earlier...
1862             if test $WithHc = 'haskell-compiler-unspecified' ; then
1863                 echo "Neither --with-hc nor --with-hc-for-nofib was properly set"
1864                 exit 1
1865             fi
1866             ;;
1867     ghc* | glhc* )
1868             WithNoFibHcType='HC_GLASGOW_GHC'
1869             AC_CHECK_PROG(have_ghc_nofib,$WithNoFibHc,$ac_dir/$ac_word)
1870             if test -z "$have_ghc_nofib"; then
1871                 echo "Can't find Glasgow Haskell to compile NoFib with: $WithNoFibHc"
1872                 exit 1
1873             fi
1874             ;;
1875     hbc* )  # Look for the dastardly competition
1876             WithNoFibHcType='HC_CHALMERS_HBC'
1877             AC_CHECK_PROG(have_hbc,$WithNoFibHc,YES,NO)
1878             if test $have_hbc = 'NO' ; then
1879                 echo "Can't find Chalmers HBC to compile NoFib with: $WithNoFibHc"
1880                 exit 1
1881             fi
1882             ;;
1883     nhc* )  # Look for Niklas Rojemo's "nhc"
1884             WithNoFibHcType='HC_ROJEMO_NHC'
1885             AC_CHECK_PROG(have_nhc,$WithNoFibHc,YES,NO)
1886             if test $have_nhc = 'NO' ; then
1887                 echo "Can't find Niklas Rojemo's NHC to compile NoFib with: $WithNoFibHc"
1888                 exit 1
1889             fi
1890             ;;
1891     IN-PLACE) WithNoFibHcType='HC_GLASGOW_GHC'
1892             ;;
1893 esac
1894 AC_SUBST(WithNoFibHc)
1895 AC_SUBST(WithNoFibHcType)
1896
1897 dnl ** what mkworld \`setup' should be used?
1898 AC_ARG_WITH(setup,
1899    [
1900 --with-setup=<setup> : What mkworld \`setup' should be used?
1901                        Choices: ghc, hbc, nhc
1902 ],
1903    [case "$withval" in
1904         ghc )   MkWorldSetup='ghc'
1905                 ;;
1906         hbc )   MkWorldSetup='hbc'
1907                 ;;
1908         nhc )   MkWorldSetup='nhc'
1909                 ;;
1910         *)      echo "I don't understand this option: --with-setup=$withval"
1911                 exit 1
1912                 ;;
1913     esac])
1914
1915 if test $MkWorldSetup = 'std' ; then
1916     echo 'You must do --with-setup=... (one of: ghc, hbc, or nhc) for NoFib'
1917     exit 1
1918 fi
1919
1920 # ---------------------------------------
1921 # What sets of tests should be run.
1922 #
1923 IncludeRealNoFibTests='YES'     # defaults
1924 IncludeSpectralNoFibTests='YES'
1925 IncludeImaginaryNoFibTests='YES'
1926 IncludeSpecialiseNoFibTests='NO'
1927 IncludeGHC_ONLYNoFibTests='NO'
1928 IncludePRIVATENoFibTests='NO'
1929 IncludeParallelNoFibTests='NO'
1930
1931 dnl ** should *all* NoFib tests be run?
1932 # special catch-all variant
1933 AC_ARG_ENABLE(all-tests,
1934    [Possibly turn on *all* of the possible tests (a sane choice
1935 only if using GHC):
1936
1937 --enable-all-tests    do *all* tests],
1938    [case "$enableval" in
1939         yes) IncludeGHC_ONLYNoFibTests='YES'
1940              IncludeSpecialiseNoFibTests='YES'
1941              IncludePRIVATENoFibTests='YES'
1942              IncludeParallelNoFibTests='YES'
1943              ;;
1944         no)  IncludeGHC_ONLYNoFibTests='NO'
1945              IncludeSpecialiseNoFibTests='NO'
1946              IncludePRIVATENoFibTests='NO'
1947              IncludeParallelNoFibTests='NO'
1948
1949              IncludeRealNoFibTests='NO'
1950              IncludeSpectralNoFibTests='NO'
1951              IncludeImaginaryNoFibTests='NO'
1952              ;;
1953         *)   echo "I don't understand this option: --enable-all-tests=$enableval"
1954              exit 1
1955              ;;
1956     esac])
1957
1958 dnl ** turn on/off individual categories of tests...
1959 # individual categories
1960 AC_ARG_ENABLE(imaginary-tests,
1961    [
1962 Enable/disable individual categories of tests:
1963
1964 --disable-imaginary-tests do *not* include imaginary tests],
1965    [case "$enableval" in
1966         yes) IncludeImaginaryNoFibTests='YES'
1967              ;;
1968         no)  IncludeImaginaryNoFibTests='NO'
1969              ;;
1970         *)   echo "I don't understand this option: --enable-imaginary-tests=$enableval"
1971              exit 1
1972              ;;
1973     esac])
1974
1975 AC_ARG_ENABLE(spectral-tests,
1976    [--disable-spectral-tests  do *not* include spectral tests],
1977    [case "$enableval" in
1978         yes) IncludeSpectralNoFibTests='YES'
1979              ;;
1980         no)  IncludeSpectralNoFibTests='NO'
1981              ;;
1982         *)   echo "I don't understand this option: --enable-spectral-tests=$enableval"
1983              exit 1
1984              ;;
1985     esac])
1986
1987 AC_ARG_ENABLE(real-tests,
1988    [--disable-real-tests      do *not* include real tests],
1989    [case "$enableval" in
1990         yes) IncludeRealNoFibTests='YES'
1991              ;;
1992         no)  IncludeRealNoFibTests='NO'
1993              ;;
1994         *)   echo "I don't understand this option: --enable-real-tests=$enableval"
1995              exit 1
1996              ;;
1997     esac])
1998
1999 AC_ARG_ENABLE(GHC-ONLY-tests,
2000    [--enable-GHC-ONLY-tests   include GHC_ONLY tests],
2001    [case "$enableval" in
2002         yes) IncludeGHC_ONLYNoFibTests='YES'
2003              ;;
2004         no)  IncludeGHC_ONLYNoFibTests='NO'
2005              ;;
2006         *)   echo "I don't understand this option: --enable-GHC-ONLY-tests=$enableval"
2007              exit 1
2008              ;;
2009     esac])
2010
2011 AC_ARG_ENABLE(specialise-tests,
2012    [--enable-specialise-tests  include specialisation tests],
2013    [case "$enableval" in
2014         yes) IncludeSpecialiseNoFibTests='YES'
2015              ;;
2016         no)  IncludeSpecialiseNoFibTests='NO'
2017              ;;
2018         *)   echo "I don't understand this option: --enable-specialise-tests=$enableval"
2019              exit 1
2020              ;;
2021     esac])
2022
2023 AC_ARG_ENABLE(PRIVATE-tests,
2024    [--enable-PRIVATE-tests    include PRIVATE tests],
2025    [case "$enableval" in
2026         yes) IncludePRIVATENoFibTests='YES'
2027              ;;
2028         no)  IncludePRIVATENoFibTests='NO'
2029              ;;
2030         *)   echo "I don't understand this option: --enable-PRIVATE-tests=$enableval"
2031              exit 1
2032              ;;
2033     esac])
2034
2035 AC_ARG_ENABLE(parallel-tests,
2036    [--enable-parallel-tests   include parallel tests
2037 ],
2038    [case "$enableval" in
2039         yes) IncludeParallelNoFibTests='YES'
2040              ;;
2041         no)  IncludeParallelNoFibTests='NO'
2042              ;;
2043         *)   echo "I don't understand this option: --enable-parallel-tests=$enableval"
2044              exit 1
2045              ;;
2046     esac])
2047
2048 dnl not AC_SUBSTd because of 99-command seds (sigh)
2049 dnl (See what follows instead)
2050 dnl AC_SUBST(IncludeRealNoFibTests)
2051 dnl AC_SUBST(IncludeSpectralNoFibTests)
2052 dnl AC_SUBST(IncludeImaginaryNoFibTests)
2053 dnl AC_SUBST(IncludeGHC_ONLYNoFibTests)
2054 dnl AC_SUBST(IncludeSpecialiseNoFibTests)
2055 dnl AC_SUBST(IncludePRIVATENoFibTests)
2056 dnl AC_SUBST(IncludeParallelNoFibTests)
2057
2058 # Here, by HACK means, we dump all the Include*NoFibTests info
2059 # into a file.  See comment above.
2060 rm -f nofib/mkworld/buildinfo.jm
2061 echo creating nofib/mkworld/buildinfo.jm
2062 cat > nofib/mkworld/buildinfo.jm <<EOF
2063 XCOMM ** DO NOT EDIT! **
2064 XCOMM This file is obliterated every time 'configure' is run!
2065
2066 EOF
2067 for xx in Real Spectral Imaginary GHC_ONLY Specialise PRIVATE Parallel ; do
2068     eval "yy=\$Include${xx}NoFibTests"
2069     echo "#ifndef Include${xx}NoFibTests"     >> nofib/mkworld/buildinfo.jm
2070     echo "#define Include${xx}NoFibTests $yy" >> nofib/mkworld/buildinfo.jm
2071     echo "#endif"                             >> nofib/mkworld/buildinfo.jm
2072 done
2073
2074 # here ends a very big if DoingNoFib = 'nofib' ...
2075 fi
2076 #
2077 # -------------------------------------------------------------------------
2078 dnl
2079 dnl * extract non-header files with substitution (end)
2080 #
2081 AC_SUBST(MkWorldSetup)
2082
2083 AC_OUTPUT(Makefile STARTUP mkworld/site.jm mkworld/platform.h mkworld/config.h $ghc_mkworld_site_ghc_jm $ghc_includes_platform_h $hslibs_mkworld_site_hslibs_jm $nofib_mkworld_site_nofib_jm)
2084
2085 echo '************************************************'
2086 echo '*** NOW DO: sh < STARTUP'
2087 echo '************************************************'
2088 exit 0