1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (grep for '^dnl' to see the outline of this file)
4 dnl * INITIAL SETUP, CHOICE OF PLATFORM(S)
7 # (c) The AQUA Project, Glasgow University, 1994-1997
9 # Configure script for the Glasgow functional programming tools
10 # (created automagically by autoconf...do not edit by hand)
12 # Do "./configure --help" to see what flags are available.
13 # (Better yet, read the documentation!)
15 # First off, a distrib sanity check..
16 AC_INIT(mk/config.mk.in)
18 # -------------------------------------------------------------------------
19 # Prepare to generate the following header files
22 AC_CONFIG_HEADER(mk/config.h)
24 # No, we don't do `--srcdir'...
25 if test x"$srcdir" != 'x.' ; then
26 echo "This configuration does not support the \`--srcdir' option.."
31 # Remove some automounter nonsense (Glasgow specific gruff)
34 hardtop=`echo $hardtop | sed 's|^/tmp_mnt/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|'`
36 #OLD: hardtop=`echo $hardtop | sed 's|^/tmp_mnt/|/|' | sed 's|^/export/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|'`
39 echo "*** The top of your build tree is: $hardtop"
42 # -------------------------------------------------------------------------
43 dnl ** choose host(/target/build) platform
45 # Guess host/target/build platform(s) if necessary.
49 # "$host" defaults to "$target"
50 if test "x$host" = xNONE ; then
53 # "$build" defaults to "$host"
54 #if test "x$build" = xNONE ; then
57 # echo "This configuration does not support the \`--build' option."
61 dnl ** canonicalize platform names
62 # Canonicali[sz]e those babies
63 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
64 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
65 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
67 if test x"$TargetPlatform" != x"$HostPlatform" ; then
68 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
73 # The following will be more difficult when we *are* cross-compiling.
74 # Suitable names to slam in *_CPP are in platform.h.in.
75 # We also record the architecture, vendor, and operating system (OS)
77 HostPlatformFull=$HostPlatform
79 alpha-dec-osf[[1234]]*)
80 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
81 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
82 BuildPlatform=alpha-dec-osf1 # hack
83 HostPlatform_CPP='alpha_dec_osf1'
89 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
90 TargetPlatform=hppa1.1-hp-hpux
91 BuildPlatform=hppa1.1-hp-hpux
92 HostPlatform_CPP='hppa1_1_hp_hpux'
93 HostArch_CPP='hppa1_1'
97 i[[3456]]86-*-linuxaout*)
98 HostPlatform=i386-unknown-linuxaout # hack again
99 TargetPlatform=i386-unknown-linuxaout
100 BuildPlatform=i386-unknown-linuxaout
101 HostPlatform_CPP='i386_unknown_linuxaout'
103 HostVendor_CPP='unknown'
104 HostOS_CPP='linuxaout'
106 i[[3456]]86-*-linux*)
107 HostPlatform=i386-unknown-linux # hack again
108 TargetPlatform=i386-unknown-linux
109 BuildPlatform=i386-unknown-linux
110 HostPlatform_CPP='i386_unknown_linux'
112 HostVendor_CPP='unknown'
115 i[[3456]]86-*-freebsd*)
116 HostPlatform=i386-unknown-freebsd # hack again
117 TargetPlatform=i386-unknown-freebsd
118 BuildPlatform=i386-unknown-freebsd
119 HostPlatform_CPP='i386_unknown_freebsd'
121 HostVendor_CPP='unknown'
124 i[[3456]]86-*-netbsd*)
125 HostPlatform=i386-unknown-netbsd # hack again
126 TargetPlatform=i386-unknown-netbsd
127 BuildPlatform=i386-unknown-netbsd
128 HostPlatform_CPP='i386_unknown_netbsd'
130 HostVendor_CPP='unknown'
133 i[[3456]]86-*-solaris2*)
134 HostPlatform=i386-unknown-solaris2 # hack again
135 TargetPlatform=i386-unknown-solaris2
136 BuildPlatform=i386-unknown-solaris2
137 HostPlatform_CPP='i386_unknown_solaris2'
139 HostVendor_CPP='unknown'
140 HostOS_CPP='solaris2'
142 i[[3456]]86-*-cygwin32*)
143 HostPlatform=i386-unknown-cygwin32 # hack again
144 TargetPlatform=i386-unknown-cygwin32
145 BuildPlatform=i386-unknown-cygwin32
146 HostPlatform_CPP='i386_unknown_cygwin32'
148 HostVendor_CPP='unknown'
149 HostOS_CPP='cygwin32'
152 HostPlatform_CPP='m68k_next_nextstep2'
154 HostVendor_CPP='next'
155 HostOS_CPP='nextstep2'
158 HostPlatform_CPP='m68k_next_nextstep3'
160 HostVendor_CPP='next'
161 HostOS_CPP='nextstep3'
163 i[[3456]]86-next-nextstep3)
164 HostPlatform=i386-next-nextstep3 # hack again
165 TargetPlatform=i386-next-nextstep3
166 BuildPlatform=i386-next-nextstep3
167 HostPlatform_CPP='i386_next_nextstep3'
169 HostVendor_CPP='next'
170 HostOS_CPP='nextstep3'
173 HostPlatform=m68k-sun-sunos4
174 TargetPlatform=m68k-sun-sunos4 #hack
175 BuildPlatform=m68k-sun-sunos4 #hack
176 HostPlatform_CPP='m68k_sun_sunos4'
182 HostPlatform_CPP='mips_dec_ultrix'
183 HostArch_CPP='mipsel' # NB a little different
188 HostPlatform=mips-sgi-irix
189 TargetPlatform=mips-sgi-irix #hack
190 BuildPlatform=mips-sgi-irix #hack
191 HostPlatform_CPP='mips_sgi_irix'
192 HostArch_CPP='mipseb' # NB a little different
197 HostPlatform=rs6000-ibm-aix
198 TargetPlatform=rs6000-ibm-aix #hack
199 BuildPlatform=rs6000-ibm-aix #hack
200 HostPlatform_CPP='rs6000_ibm_aix'
201 HostArch_CPP='rs6000'
206 HostPlatform=powerpc-ibm-aix
207 TargetPlatform=powerpc-ibm-aix #hack
208 BuildPlatform=powerpc-ibm-aix #hack
209 HostPlatform_CPP='powerpc_ibm_aix'
210 HostArch_CPP='powerpc'
215 HostPlatform=sparc-sun-sunos4
216 TargetPlatform=sparc-sun-sunos4 #hack
217 BuildPlatform=sparc-sun-sunos4 #hack
218 HostPlatform_CPP='sparc_sun_sunos4'
224 HostPlatform=sparc-sun-solaris2
225 TargetPlatform=sparc-sun-solaris2 #hack
226 BuildPlatform=sparc-sun-solaris2 #hack
227 HostPlatform_CPP='sparc_sun_solaris2'
230 HostOS_CPP='solaris2'
233 echo "Unrecognised platform: $HostPlatform"
237 echo "Which we'll canonicalise into: $HostPlatform"
238 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
239 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
241 BuildPlatform_CPP=$HostPlatform_CPP
242 TargetPlatform_CPP=$HostPlatform_CPP
243 BuildArch_CPP=$HostArch_CPP
244 TargetArch_CPP=$HostArch_CPP
245 BuildOS_CPP=$HostOS_CPP
246 TargetOS_CPP=$HostOS_CPP
247 BuildVendor_CPP=$HostVendor_CPP
248 TargetVendor_CPP=$HostVendor_CPP
250 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
251 dnl AC_SUBST(BuildPlatform)
252 AC_SUBST(HostPlatformFull)
253 AC_SUBST(HostPlatform)
254 AC_SUBST(TargetPlatform)
255 AC_SUBST(HostPlatform_CPP)
256 dnl AC_SUBST(BuildPlatform_CPP)
257 dnl AC_SUBST(TargetPlatform_CPP)
258 AC_SUBST(HostArch_CPP)
259 dnl AC_SUBST(BuildArch_CPP)
260 dnl AC_SUBST(TargetArch_CPP)
262 dnl AC_SUBST(BuildOS_CPP)
263 dnl AC_SUBST(TargetOS_CPP)
264 AC_SUBST(HostVendor_CPP)
265 dnl AC_SUBST(BuildVendor_CPP)
266 dnl AC_SUBST(TargetVendor_CPP)
268 # -------------------------------------------------------------------------
270 dnl * _GENERAL_ CONFIGURATION CHECKS
272 dnl ** are we at Glasgow?
274 # This stuff is in danger of going away..
276 if test -d /local/fp -a -d /users/fp/simonpj; then
277 echo "Brilliant! You must be a Glaswegian."
279 if test "x$prefix" = xNONE; then
281 echo "Assuming installation prefix of $prefix"
283 if test "x$exec_prefix" = xNONE; then
284 # Sigh: the defn of exec_prefix does not include the bin* bit...
286 exec_prefix=/local/fp
287 echo "Assuming binary installation prefix of $exec_prefix"
293 test -n "$verbose" && echo " setting AT_GLASGOW to $AT_GLASGOW"
301 dnl ** look for `perl', but watch out for version 4.035
303 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
304 if test -z "$PerlCmd"; then
305 echo "You must install perl before you can continue"
306 echo "Perhaps it is already installed, but not in your PATH?"
309 $PerlCmd -v >conftest.out 2>&1
310 if egrep "version 4" conftest.out >/dev/null 2>&1; then
311 if egrep "Patch level: 35" conftest.out >/dev/null 2>&1; then
313 ************************************************************************
314 Uh-oh...looks like you have Perl 4.035.
316 Perl version 4.035 has a bug to do with recursion that will bite if
317 you run the lit2texi script, when making Info files from
318 literate files of various sorts. Either use the current version
319 (4.036), an older version (e.g., perl 4.019) or apply the patch in
320 glafp-utils/perl-4.035-fixes to your 4.035 perl.
321 ************************************************************************
325 if egrep "version 5" conftest.out >/dev/null 2>&1; then
328 echo "I'm not sure if your version of perl will work,"
329 echo "but it's worth a shot, eh?"
335 dnl ** does #!.../perl work? (sometimes it's too long...)
336 echo "checking if \`#!$PerlCmd' works in shell scripts"
341 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
342 if test $? -ne 69; then
345 echo "It doesn't! Perhaps \`#!$PerlCmd' is too long (often 32 characters max)"
350 dnl ** check if perl library is properly installed
351 # (by seeing if a "do 'getopts.pl'" works...
352 if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
355 echo "I think your perl library is misinstalled:"
356 echo "The following script did not work:"
357 echo ' do "getopts.pl" || exit(1); exit(0);'
358 echo 'But, anyway, we will continue in our quest..'
362 dnl ** look for GCC and find out which version
363 # Figure out which C compiler to use. Gcc is preferred.
364 # If gcc, make sure it's at least 2.1
367 if test -z "$GCC"; then
368 echo "You would be better off with gcc"
369 echo "Perhaps it is already installed, but not in your PATH?"
372 gcc -v > conftest.out 2>&1
373 echo '/version (\d+)\.(\d+)/ && $1*10+$2 > 20 && print "YES";' > conftest.pl
374 HaveGcc=`eval $PerlCmd -n conftest.pl conftest.out`
375 if test -z "$HaveGcc"; then
376 echo "I'm not sure if your version of gcc will work,"
377 echo "but it's worth a shot, eh?"
384 # Deprecated (AC_PROG_CC does it): AC_C_CROSS
386 dnl ** figure out how to do context diffs
387 # (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
391 if diff -C 1 conftest1 conftest2 > /dev/null 2>&1 ; then
392 ContextDiffCmd='diff -C 1'
394 if diff -c1 conftest1 conftest2 > /dev/null 2>&1 ; then
395 ContextDiffCmd='diff -c1'
397 echo "Can't figure out how to do context diffs."
398 echo "Neither \`diff -C 1' nor \`diff -c1' works."
402 rm -f conftest1 conftest2
403 AC_SUBST(ContextDiffCmd)
405 dnl ** look for a decent parser generator (bison preferred)
408 AC_CHECK_PROG(YaccCmd, bison, bison -y)
409 if test -z "$YaccCmd"; then
410 echo "Can't find bison out there..."
411 AC_CHECK_PROG(WhatCmd, what, what, :)
412 AC_CHECK_PROG(YaccCmd, yacc, $ac_dir/$ac_word)
413 if test -z "$YaccCmd"; then
414 echo "But that's okay...I can't find yacc either."
417 $WhatCmd $YaccCmd > conftest.out
418 if egrep 'y1\.c 1\..*SMI' conftest.out >/dev/null 2>&1; then
419 echo "I don't trust your $YaccCmd; it looks like an old Sun yacc"
420 if test -f /usr/lang/yacc; then
421 echo "I'm going to use /usr/lang/yacc instead"
422 YaccCmd=/usr/lang/yacc
424 echo "I'm assuming the worst...no parser generator at all"
427 elif egrep 'y1\.c.*Revision: 4\.2\.6\.3.*DEC' conftest.out >/dev/null 2>&1; then
428 echo "I don't trust your $YaccCmd; it looks like a lame DEC yacc"
429 echo "I'm assuming the worst...no parser generator at all"
432 echo "But that's okay...as far as I know, your yacc will work."
438 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
442 # -------------------------------------------------------------------------
444 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
447 if echo $CPP | egrep gcc >/dev/null 2>&1; then
449 gcc -v -E conftest.c >/dev/null 2>conftest.out
450 echo '/(\S+\/cpp)/ && print "$1";' > conftest.pl
451 # GNUCPP: used in jmake.c (GnuCppCmd) and in mkdependC
452 # (where we could do with the usual pre-#defines)
453 GNUCPP="`eval $PerlCmd -n conftest.pl conftest.out`"
454 test -n "$verbose" && echo " setting GNUCPP to $GNUCPP"
455 # RAWCPP: we do not want *any* pre-#defines...
456 # (e.g., hscpp, mkdependHS)
457 RAWCPP="`eval $PerlCmd -n conftest.pl conftest.out` -traditional"
458 test -n "$verbose" && echo " setting RAWCPP to $RAWCPP"
461 # ToDo: what are GNUCPP and RAWCPP if the above if didn't fire? WDP 95/02
465 dnl ** figure out how to do a BSD-ish install
469 dnl ** figure out what arguments to feed to `ar'
471 AC_CHECK_PROG(ArCmd,ar,$ac_dir/$ac_word)
472 if test -z "$ArCmd"; then
473 echo "You don't seem to have ar...I have no idea how to make a library"
476 if $ArCmd clqs conftest.a >/dev/null 2>/dev/null; then
479 elif $ArCmd cqs conftest.a >/dev/null 2>/dev/null; then
482 elif $ArCmd clq conftest.a >/dev/null 2>/dev/null; then
485 elif $ArCmd cq conftest.a >/dev/null 2>/dev/null; then
488 elif $ArCmd cq conftest.a 2>&1 | grep 'no archive members specified' >/dev/null 2>/dev/null; then
492 echo "I can't figure out how to use your $ArCmd"
496 test -n "$ArCmd" && test -n "$verbose" && echo " setting ArCmd to $ArCmd"
499 dnl ** figure out if we need `ranlib'
501 if test -z "$NeedRanLib"; then
502 # we hackily override a few platforms on a case-by-case basis
503 case $HostPlatform in
510 test -n "$verbose" && echo " setting RANLIB to $RANLIB"
512 if test -n "$NeedRanLib"; then
518 dnl ** Check to see whether ln -s works
523 dnl ** Find the path to sed **
524 AC_PATH_PROG(SedCmd,sed,$ac_dir/$ac_word)
526 # It better be around somewhere (we wouldn't
527 # exec this script properly if it wasn't!)
531 dnl ** check for time command **
532 AC_PATH_PROG(TimeCmd,time,$ac_dir/$ac_word)
536 dnl ** check for tar **
538 # if GNU tar is named gtar, look for it first.
540 AC_PATH_PROGS(TarCmd,gtar tar,tar)
544 dnl ** check for gzip/compress **
545 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
547 compress_nm=`basename $CompressCmd`
549 if test x"$compress_nm" = xgzip; then
550 CompressCmd="$CompressCmd -d"
555 AC_SUBST(CompressCmd)
556 AC_SUBST(CompressSuffix)
558 dnl ** check for installed happy binary
560 AC_PATH_PROG(HappyCmd,happy)
564 dnl ** check for installed lx binary
566 AC_PATH_PROG(LxCmd,lx)
570 dnl ** check for full ANSI header (.h) files
574 dnl ** check for specific header (.h) files that we are interested in
576 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/socket.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 readline/readline.h )
578 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
582 dnl ** how do we get a timezone name, and UTC offset ?
586 AC_MSG_CHECKING([for altzone])
587 AC_TRY_LINK([#include <time.h>], [return altzone;], AC_DEFINE(HAVE_ALTZONE),HaveAltZone=no)
588 AC_MSG_RESULT($HaveAltZone)
590 dnl ** determine the type of signal()
594 dnl ** check for specific library functions that we are interested in
596 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
598 dnl ** can we get alloca?
602 dnl ** determine whether or not const works
606 dnl ** check for leading underscores in symbol names
607 # We assume that they _aren't_ there if anything goes wrong.
609 echo checking for a leading underscore in symbol names
613 struct nlist xYzzY[] = {{"_xYzzY", 0},{0}};
621 if(nlist(argv[0], xYzzY) == 0 && xYzzY[0].n_value != 0)
625 }], LeadingUnderscore='YES', LeadingUnderscore='NO', LeadingUnderscore='YES')
626 test -n "$verbose" && echo " setting LeadingUnderscore to $LeadingUnderscore"
627 AC_SUBST(LeadingUnderscore)
629 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
632 # It'll break soon enough if it didn't, but we perform a sanity
633 # check here on the generated config.mk file to see if the
634 # sed that was used is of the well-behaved sort.
636 #grep @ mk/config.mk > conftest.out
637 #if grep -v '# enclosed in @at-signs@.' conftest.out >/dev/null 2>&1; then
640 # echo 'Hmm..suspicious, did the configure script perform all the @..@ substitutions in mk/config.mk?..';
641 # grep -v '# enclosed in @at-signs@.' conftest.out /dev/null
646 echo '************************************************'
647 echo '*** NOW DO: gmake boot followed by gmake all'
648 echo '************************************************'