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)
78 alpha-dec-osf[[1234]]*)
79 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
80 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
81 BuildPlatform=alpha-dec-osf1 # hack
82 HostPlatform_CPP='alpha_dec_osf1'
88 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
89 TargetPlatform=hppa1.1-hp-hpux
90 BuildPlatform=hppa1.1-hp-hpux
91 HostPlatform_CPP='hppa1_1_hp_hpux'
92 HostArch_CPP='hppa1_1'
96 i[[3456]]86-*-linuxaout*)
97 HostPlatform=i386-unknown-linuxaout # hack again
98 TargetPlatform=i386-unknown-linuxaout
99 BuildPlatform=i386-unknown-linuxaout
100 HostPlatform_CPP='i386_unknown_linuxaout'
102 HostVendor_CPP='unknown'
103 HostOS_CPP='linuxaout'
105 i[[3456]]86-*-linux*)
106 HostPlatform=i386-unknown-linux # hack again
107 TargetPlatform=i386-unknown-linux
108 BuildPlatform=i386-unknown-linux
109 HostPlatform_CPP='i386_unknown_linux'
111 HostVendor_CPP='unknown'
114 i[[3456]]86-*-freebsd*)
115 HostPlatform=i386-unknown-freebsd # hack again
116 TargetPlatform=i386-unknown-freebsd
117 BuildPlatform=i386-unknown-freebsd
118 HostPlatform_CPP='i386_unknown_freebsd'
120 HostVendor_CPP='unknown'
123 i[[3456]]86-*-netbsd*)
124 HostPlatform=i386-unknown-netbsd # hack again
125 TargetPlatform=i386-unknown-netbsd
126 BuildPlatform=i386-unknown-netbsd
127 HostPlatform_CPP='i386_unknown_netbsd'
129 HostVendor_CPP='unknown'
132 i[[3456]]86-*-solaris2*)
133 HostPlatform=i386-unknown-solaris2 # hack again
134 TargetPlatform=i386-unknown-solaris2
135 BuildPlatform=i386-unknown-solaris2
136 HostPlatform_CPP='i386_unknown_solaris2'
138 HostVendor_CPP='unknown'
139 HostOS_CPP='solaris2'
141 i[[3456]]86-*-cygwin32*)
142 HostPlatform=i386-unknown-cygwin32 # hack again
143 TargetPlatform=i386-unknown-cygwin32
144 BuildPlatform=i386-unknown-cygwin32
145 HostPlatform_CPP='i386_unknown_cygwin32'
147 HostVendor_CPP='unknown'
148 HostOS_CPP='cygwin32'
151 HostPlatform_CPP='m68k_next_nextstep2'
153 HostVendor_CPP='next'
154 HostOS_CPP='nextstep2'
157 HostPlatform_CPP='m68k_next_nextstep3'
159 HostVendor_CPP='next'
160 HostOS_CPP='nextstep3'
162 i[[3456]]86-next-nextstep3)
163 HostPlatform=i386-next-nextstep3 # hack again
164 TargetPlatform=i386-next-nextstep3
165 BuildPlatform=i386-next-nextstep3
166 HostPlatform_CPP='i386_next_nextstep3'
168 HostVendor_CPP='next'
169 HostOS_CPP='nextstep3'
172 HostPlatform=m68k-sun-sunos4
173 TargetPlatform=m68k-sun-sunos4 #hack
174 BuildPlatform=m68k-sun-sunos4 #hack
175 HostPlatform_CPP='m68k_sun_sunos4'
181 HostPlatform_CPP='mips_dec_ultrix'
182 HostArch_CPP='mipsel' # NB a little different
187 HostPlatform=mips-sgi-irix
188 TargetPlatform=mips-sgi-irix #hack
189 BuildPlatform=mips-sgi-irix #hack
190 HostPlatform_CPP='mips_sgi_irix'
191 HostArch_CPP='mipseb' # NB a little different
196 HostPlatform=powerpc-ibm-aix
197 TargetPlatform=powerpc-ibm-aix #hack
198 BuildPlatform=powerpc-ibm-aix #hack
199 HostPlatform_CPP='powerpc_ibm_aix'
200 HostArch_CPP='powerpc'
205 HostPlatform=sparc-sun-sunos4
206 TargetPlatform=sparc-sun-sunos4 #hack
207 BuildPlatform=sparc-sun-sunos4 #hack
208 HostPlatform_CPP='sparc_sun_sunos4'
214 HostPlatform=sparc-sun-solaris2
215 TargetPlatform=sparc-sun-solaris2 #hack
216 BuildPlatform=sparc-sun-solaris2 #hack
217 HostPlatform_CPP='sparc_sun_solaris2'
220 HostOS_CPP='solaris2'
223 echo "Unrecognised platform: $HostPlatform"
227 echo "Which we'll canonicalise into: $HostPlatform"
228 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
229 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
231 BuildPlatform_CPP=$HostPlatform_CPP
232 TargetPlatform_CPP=$HostPlatform_CPP
233 BuildArch_CPP=$HostArch_CPP
234 TargetArch_CPP=$HostArch_CPP
235 BuildOS_CPP=$HostOS_CPP
236 TargetOS_CPP=$HostOS_CPP
237 BuildVendor_CPP=$HostVendor_CPP
238 TargetVendor_CPP=$HostVendor_CPP
240 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
241 dnl AC_SUBST(BuildPlatform)
242 AC_SUBST(HostPlatform)
243 AC_SUBST(TargetPlatform)
244 AC_SUBST(HostPlatform_CPP)
245 dnl AC_SUBST(BuildPlatform_CPP)
246 dnl AC_SUBST(TargetPlatform_CPP)
247 AC_SUBST(HostArch_CPP)
248 dnl AC_SUBST(BuildArch_CPP)
249 dnl AC_SUBST(TargetArch_CPP)
251 dnl AC_SUBST(BuildOS_CPP)
252 dnl AC_SUBST(TargetOS_CPP)
253 AC_SUBST(HostVendor_CPP)
254 dnl AC_SUBST(BuildVendor_CPP)
255 dnl AC_SUBST(TargetVendor_CPP)
257 # -------------------------------------------------------------------------
259 dnl * _GENERAL_ CONFIGURATION CHECKS
261 dnl ** are we at Glasgow?
263 # This stuff is in danger of going away..
265 if test -d /local/fp -a -d /users/fp/simonpj; then
266 echo "Brilliant! You must be a Glaswegian."
268 if test "x$prefix" = xNONE; then
270 echo "Assuming installation prefix of $prefix"
272 if test "x$exec_prefix" = xNONE; then
273 # Sigh: the defn of exec_prefix does not include the bin* bit...
275 exec_prefix=/local/fp
276 echo "Assuming binary installation prefix of $exec_prefix"
282 test -n "$verbose" && echo " setting AT_GLASGOW to $AT_GLASGOW"
290 dnl ** look for `perl', but watch out for version 4.035
292 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
293 if test -z "$PerlCmd"; then
294 echo "You must install perl before you can continue"
295 echo "Perhaps it is already installed, but not in your PATH?"
298 $PerlCmd -v >conftest.out 2>&1
299 if egrep "version 4" conftest.out >/dev/null 2>&1; then
300 if egrep "Patch level: 35" conftest.out >/dev/null 2>&1; then
302 ************************************************************************
303 Uh-oh...looks like you have Perl 4.035.
305 Perl version 4.035 has a bug to do with recursion that will bite if
306 you run the lit2texi script, when making Info files from
307 literate files of various sorts. Either use the current version
308 (4.036), an older version (e.g., perl 4.019) or apply the patch in
309 glafp-utils/perl-4.035-fixes to your 4.035 perl.
310 ************************************************************************
314 if egrep "version 5" conftest.out >/dev/null 2>&1; then
317 echo "I'm not sure if your version of perl will work,"
318 echo "but it's worth a shot, eh?"
324 dnl ** does #!.../perl work? (sometimes it's too long...)
325 echo "checking if \`#!$PerlCmd' works in shell scripts"
330 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
331 if test $? -ne 69; then
334 echo "It doesn't! Perhaps \`#!$PerlCmd' is too long (often 32 characters max)"
339 dnl ** check if perl library is properly installed
340 # (by seeing if a "do 'getopts.pl'" works...
341 if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
344 echo "I think your perl library is misinstalled:"
345 echo "The following script did not work:"
346 echo ' do "getopts.pl" || exit(1); exit(0);'
347 echo 'But, anyway, we will continue in our quest..'
351 dnl ** look for GCC and find out which version
352 # Figure out which C compiler to use. Gcc is preferred.
353 # If gcc, make sure it's at least 2.1
356 if test -z "$GCC"; then
357 echo "You would be better off with gcc"
358 echo "Perhaps it is already installed, but not in your PATH?"
361 gcc -v > conftest.out 2>&1
362 echo '/version (\d+)\.(\d+)/ && $1*10+$2 > 20 && print "YES";' > conftest.pl
363 HaveGcc=`eval $PerlCmd -n conftest.pl conftest.out`
364 if test -z "$HaveGcc"; then
365 echo "I'm not sure if your version of gcc will work,"
366 echo "but it's worth a shot, eh?"
373 # Deprecated (AC_PROG_CC does it): AC_C_CROSS
375 dnl ** figure out how to do context diffs
376 # (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
380 if diff -C 1 conftest1 conftest2 > /dev/null 2>&1 ; then
381 ContextDiffCmd='diff -C 1'
383 if diff -c1 conftest1 conftest2 > /dev/null 2>&1 ; then
384 ContextDiffCmd='diff -c1'
386 echo "Can't figure out how to do context diffs."
387 echo "Neither \`diff -C 1' nor \`diff -c1' works."
391 rm -f conftest1 conftest2
392 AC_SUBST(ContextDiffCmd)
394 dnl ** look for a decent parser generator (bison preferred)
397 AC_CHECK_PROG(YaccCmd, bison, bison -y)
398 if test -z "$YaccCmd"; then
399 echo "Can't find bison out there..."
400 AC_CHECK_PROG(WhatCmd, what, what, :)
401 AC_CHECK_PROG(YaccCmd, yacc, $ac_dir/$ac_word)
402 if test -z "$YaccCmd"; then
403 echo "But that's okay...I can't find yacc either."
406 $WhatCmd $YaccCmd > conftest.out
407 if egrep 'y1\.c 1\..*SMI' conftest.out >/dev/null 2>&1; then
408 echo "I don't trust your $YaccCmd; it looks like an old Sun yacc"
409 if test -f /usr/lang/yacc; then
410 echo "I'm going to use /usr/lang/yacc instead"
411 YaccCmd=/usr/lang/yacc
413 echo "I'm assuming the worst...no parser generator at all"
416 elif egrep 'y1\.c.*Revision: 4\.2\.6\.3.*DEC' conftest.out >/dev/null 2>&1; then
417 echo "I don't trust your $YaccCmd; it looks like a lame DEC yacc"
418 echo "I'm assuming the worst...no parser generator at all"
421 echo "But that's okay...as far as I know, your yacc will work."
427 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
431 # -------------------------------------------------------------------------
433 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
436 if echo $CPP | egrep gcc >/dev/null 2>&1; then
438 gcc -v -E conftest.c >/dev/null 2>conftest.out
439 echo '/(\S+\/cpp)/ && print "$1";' > conftest.pl
440 # GNUCPP: used in jmake.c (GnuCppCmd) and in mkdependC
441 # (where we could do with the usual pre-#defines)
442 GNUCPP="`eval $PerlCmd -n conftest.pl conftest.out`"
443 test -n "$verbose" && echo " setting GNUCPP to $GNUCPP"
444 # RAWCPP: we do not want *any* pre-#defines...
445 # (e.g., hscpp, mkdependHS)
446 RAWCPP="`eval $PerlCmd -n conftest.pl conftest.out` -traditional"
447 test -n "$verbose" && echo " setting RAWCPP to $RAWCPP"
450 # ToDo: what are GNUCPP and RAWCPP if the above if didn't fire? WDP 95/02
454 dnl ** figure out how to do a BSD-ish install
458 dnl ** figure out what arguments to feed to `ar'
460 AC_CHECK_PROG(ArCmd,ar,$ac_dir/$ac_word)
461 if test -z "$ArCmd"; then
462 echo "You don't seem to have ar...I have no idea how to make a library"
465 if $ArCmd clqs conftest.a >/dev/null 2>/dev/null; then
468 elif $ArCmd cqs conftest.a >/dev/null 2>/dev/null; then
471 elif $ArCmd clq conftest.a >/dev/null 2>/dev/null; then
474 elif $ArCmd cq conftest.a >/dev/null 2>/dev/null; then
477 elif $ArCmd cq conftest.a 2>&1 | grep 'no archive members specified' >/dev/null 2>/dev/null; then
481 echo "I can't figure out how to use your $ArCmd"
485 test -n "$ArCmd" && test -n "$verbose" && echo " setting ArCmd to $ArCmd"
488 dnl ** figure out if we need `ranlib'
490 if test -z "$NeedRanLib"; then
491 # we hackily override a few platforms on a case-by-case basis
492 case $HostPlatform in
499 test -n "$verbose" && echo " setting RANLIB to $RANLIB"
501 if test -n "$NeedRanLib"; then
507 dnl ** Check to see whether ln -s works
512 dnl ** Find the path to sed **
513 AC_PATH_PROG(SedCmd,sed,$ac_dir/$ac_word)
515 # It better be around somewhere (we wouldn't
516 # exec this script properly if it wasn't!)
520 dnl ** check for time command **
521 AC_PATH_PROG(TimeCmd,time,$ac_dir/$ac_word)
525 dnl ** check for tar **
527 # if GNU tar is named gtar, look for it first.
529 AC_PATH_PROGS(TarCmd,gtar tar,tar)
533 dnl ** check for gzip/compress **
534 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
536 compress_nm=`basename $CompressCmd`
538 if test x"$compress_nm" = xgzip; then
539 CompressCmd="$CompressCmd -d"
544 AC_SUBST(CompressCmd)
545 AC_SUBST(CompressSuffix)
547 dnl ** check for installed happy binary
549 AC_PATH_PROG(HappyCmd,happy)
553 dnl ** check for installed lx binary
555 AC_PATH_PROG(LxCmd,lx)
559 dnl ** check for full ANSI header (.h) files
563 dnl ** check for specific header (.h) files that we are interested in
565 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 )
567 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
571 dnl ** how do we get a timezone name?
575 dnl ** determine the type of signal()
579 dnl ** check for specific library functions that we are interested in
581 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
583 dnl ** can we get alloca?
587 dnl ** determine whether or not const works
591 dnl ** check for leading underscores in symbol names
592 # We assume that they _aren't_ there if anything goes wrong.
594 echo checking for a leading underscore in symbol names
598 struct nlist xYzzY[] = {{"_xYzzY", 0},{0}};
606 if(nlist(argv[0], xYzzY) == 0 && xYzzY[0].n_value != 0)
610 }], LeadingUnderscore='YES', LeadingUnderscore='NO', LeadingUnderscore='YES')
611 test -n "$verbose" && echo " setting LeadingUnderscore to $LeadingUnderscore"
612 AC_SUBST(LeadingUnderscore)
614 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
617 # It'll break soon enough if it didn't, but we perform a sanity
618 # check here on the generated config.mk file to see if the
619 # sed that was used is of the well-behaved sort.
621 #grep @ mk/config.mk > conftest.out
622 #if grep -v '# enclosed in @at-signs@.' conftest.out >/dev/null 2>&1; then
625 # echo 'Hmm..suspicious, did the configure script perform all the @..@ substitutions in mk/config.mk?..';
626 # grep -v '# enclosed in @at-signs@.' conftest.out /dev/null
631 echo '************************************************'
632 echo '*** NOW DO: gmake boot followed by gmake all'
633 echo '************************************************'