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)"
72 # The following will be more difficult when we *are* cross-compiling.
73 # Suitable names to slam in *_CPP are in platform.h.in.
74 # We also record the architecture, vendor, and operating system (OS)
77 alpha-dec-osf[[1234]]*)
78 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
79 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
80 BuildPlatform=alpha-dec-osf1 # hack
81 HostPlatform_CPP='alpha_dec_osf1'
87 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
88 TargetPlatform=hppa1.1-hp-hpux
89 BuildPlatform=hppa1.1-hp-hpux
90 HostPlatform_CPP='hppa1_1_hp_hpux'
91 HostArch_CPP='hppa1_1'
95 i[[3456]]86-*-linuxaout*)
96 HostPlatform=i386-unknown-linuxaout # hack again
97 TargetPlatform=i386-unknown-linuxaout
98 BuildPlatform=i386-unknown-linuxaout
99 HostPlatform_CPP='i386_unknown_linuxaout'
101 HostVendor_CPP='unknown'
102 HostOS_CPP='linuxaout'
104 i[[3456]]86-*-linux*)
105 HostPlatform=i386-unknown-linux # hack again
106 TargetPlatform=i386-unknown-linux
107 BuildPlatform=i386-unknown-linux
108 HostPlatform_CPP='i386_unknown_linux'
110 HostVendor_CPP='unknown'
113 i[[3456]]86-*-freebsd*)
114 HostPlatform=i386-unknown-freebsd # hack again
115 TargetPlatform=i386-unknown-freebsd
116 BuildPlatform=i386-unknown-freebsd
117 HostPlatform_CPP='i386_unknown_freebsd'
119 HostVendor_CPP='unknown'
122 i[[3456]]86-*-netbsd*)
123 HostPlatform=i386-unknown-netbsd # hack again
124 TargetPlatform=i386-unknown-netbsd
125 BuildPlatform=i386-unknown-netbsd
126 HostPlatform_CPP='i386_unknown_netbsd'
128 HostVendor_CPP='unknown'
131 i[[3456]]86-*-solaris2*)
132 HostPlatform=i386-unknown-solaris2 # hack again
133 TargetPlatform=i386-unknown-solaris2
134 BuildPlatform=i386-unknown-solaris2
135 HostPlatform_CPP='i386_unknown_solaris2'
137 HostVendor_CPP='unknown'
138 HostOS_CPP='solaris2'
140 i[[3456]]86-*-cygwin32*)
141 HostPlatform=i386-unknown-cygwin32 # hack again
142 TargetPlatform=i386-unknown-cygwin32
143 BuildPlatform=i386-unknown-cygwin32
144 HostPlatform_CPP='i386_unknown_cygwin32'
146 HostVendor_CPP='unknown'
147 HostOS_CPP='cygwin32'
150 HostPlatform_CPP='m68k_next_nextstep2'
152 HostVendor_CPP='next'
153 HostOS_CPP='nextstep2'
156 HostPlatform_CPP='m68k_next_nextstep3'
158 HostVendor_CPP='next'
159 HostOS_CPP='nextstep3'
161 i[[3456]]86-next-nextstep3)
162 HostPlatform=i386-next-nextstep3 # hack again
163 TargetPlatform=i386-next-nextstep3
164 BuildPlatform=i386-next-nextstep3
165 HostPlatform_CPP='i386_next_nextstep3'
167 HostVendor_CPP='next'
168 HostOS_CPP='nextstep3'
171 HostPlatform=m68k-sun-sunos4
172 TargetPlatform=m68k-sun-sunos4 #hack
173 BuildPlatform=m68k-sun-sunos4 #hack
174 HostPlatform_CPP='m68k_sun_sunos4'
180 HostPlatform_CPP='mips_dec_ultrix'
181 HostArch_CPP='mipsel' # NB a little different
186 HostPlatform=mips-sgi-irix
187 TargetPlatform=mips-sgi-irix #hack
188 BuildPlatform=mips-sgi-irix #hack
189 HostPlatform_CPP='mips_sgi_irix'
190 HostArch_CPP='mipseb' # NB a little different
195 HostPlatform=rs6000-ibm-aix
196 TargetPlatform=rs6000-ibm-aix #hack
197 BuildPlatform=rs6000-ibm-aix #hack
198 HostPlatform_CPP='rs6000_ibm_aix'
199 HostArch_CPP='rs6000'
204 HostPlatform=powerpc-ibm-aix
205 TargetPlatform=powerpc-ibm-aix #hack
206 BuildPlatform=powerpc-ibm-aix #hack
207 HostPlatform_CPP='powerpc_ibm_aix'
208 HostArch_CPP='powerpc'
213 HostPlatform=sparc-sun-sunos4
214 TargetPlatform=sparc-sun-sunos4 #hack
215 BuildPlatform=sparc-sun-sunos4 #hack
216 HostPlatform_CPP='sparc_sun_sunos4'
222 HostPlatform=sparc-sun-solaris2
223 TargetPlatform=sparc-sun-solaris2 #hack
224 BuildPlatform=sparc-sun-solaris2 #hack
225 HostPlatform_CPP='sparc_sun_solaris2'
228 HostOS_CPP='solaris2'
231 echo "Unrecognised platform: $HostPlatform"
235 echo "Canonicalised to: $HostPlatform"
236 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
237 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
239 BuildPlatform_CPP=$HostPlatform_CPP
240 TargetPlatform_CPP=$HostPlatform_CPP
241 BuildArch_CPP=$HostArch_CPP
242 TargetArch_CPP=$HostArch_CPP
243 BuildOS_CPP=$HostOS_CPP
245 TargetOS_CPP=$HostOS_CPP
246 BuildVendor_CPP=$HostVendor_CPP
247 TargetVendor_CPP=$HostVendor_CPP
249 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
250 dnl AC_SUBST(BuildPlatform)
252 AC_SUBST(HostPlatform)
253 AC_SUBST(TargetPlatform)
254 AC_SUBST(HostPlatform_CPP)
255 dnl AC_SUBST(BuildPlatform_CPP)
256 dnl AC_SUBST(TargetPlatform_CPP)
258 AC_SUBST(HostArch_CPP)
259 dnl AC_SUBST(BuildArch_CPP)
260 dnl AC_SUBST(TargetArch_CPP)
263 AC_SUBST(HostOS_Full)
264 dnl AC_SUBST(BuildOS_CPP)
265 dnl AC_SUBST(TargetOS_CPP)
267 AC_SUBST(HostVendor_CPP)
268 dnl AC_SUBST(BuildVendor_CPP)
269 dnl AC_SUBST(TargetVendor_CPP)
271 # -------------------------------------------------------------------------
273 dnl * _GENERAL_ CONFIGURATION CHECKS
275 dnl ** are we at Glasgow?
277 # This stuff is in danger of going away..
279 if test -d /local/fp -a -d /users/fp/simonpj; then
280 echo "Brilliant! You must be a Glaswegian."
282 if test "x$prefix" = xNONE; then
284 echo "Assuming installation prefix of $prefix"
286 if test "x$exec_prefix" = xNONE; then
287 # Sigh: the defn of exec_prefix does not include the bin* bit...
289 exec_prefix=/local/fp
290 echo "Assuming binary installation prefix of $exec_prefix"
296 test -n "$verbose" && echo " setting AT_GLASGOW to $AT_GLASGOW"
304 dnl ** look for `perl', but watch out for version 4.035
306 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
307 if test -z "$PerlCmd"; then
308 echo "You must install perl before you can continue"
309 echo "Perhaps it is already installed, but not in your PATH?"
312 $PerlCmd -v >conftest.out 2>&1
313 if egrep "version 4" conftest.out >/dev/null 2>&1; then
314 if egrep "Patch level: 35" conftest.out >/dev/null 2>&1; then
316 ************************************************************************
317 Uh-oh...looks like you have Perl 4.035.
319 Perl version 4.035 has a bug to do with recursion that will bite if
320 you run the lit2texi script, when making Info files from
321 literate files of various sorts. Either use the current version
322 (4.036), an older version (e.g., perl 4.019) or apply the patch in
323 glafp-utils/perl-4.035-fixes to your 4.035 perl.
324 ************************************************************************
328 if egrep "version 5" conftest.out >/dev/null 2>&1; then
331 echo "I'm not sure if your version of perl will work,"
332 echo "but it's worth a shot, eh?"
338 dnl ** does #!.../perl work? (sometimes it's too long...)
339 echo "checking if \`#!$PerlCmd' works in shell scripts"
344 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
345 if test $? -ne 69; then
348 echo "It doesn't! Perhaps \`#!$PerlCmd' is too long (often 32 characters max)"
353 dnl ** check if perl library is properly installed
354 # (by seeing if a "do 'getopts.pl'" works...
355 if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
358 echo "I think your perl library is misinstalled:"
359 echo "The following script did not work:"
360 echo ' do "getopts.pl" || exit(1); exit(0);'
361 echo 'But, anyway, we will continue in our quest..'
365 dnl ** look for GCC and find out which version
366 # Figure out which C compiler to use. Gcc is preferred.
367 # If gcc, make sure it's at least 2.1
370 if test -z "$GCC"; then
371 echo "You would be better off with gcc"
372 echo "Perhaps it is already installed, but not in your PATH?"
375 gcc -v > conftest.out 2>&1
376 echo '/version (\d+)\.(\d+)/ && $1*10+$2 > 20 && print "YES";' > conftest.pl
377 HaveGcc=`eval $PerlCmd -n conftest.pl conftest.out`
378 if test -z "$HaveGcc"; then
379 echo "I'm not sure if your version of gcc will work,"
380 echo "but it's worth a shot, eh?"
387 # Deprecated (AC_PROG_CC does it): AC_C_CROSS
389 dnl ** figure out how to do context diffs
390 # (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
394 if diff -C 1 conftest1 conftest2 > /dev/null 2>&1 ; then
395 ContextDiffCmd='diff -C 1'
397 if diff -c1 conftest1 conftest2 > /dev/null 2>&1 ; then
398 ContextDiffCmd='diff -c1'
400 echo "Can't figure out how to do context diffs."
401 echo "Neither \`diff -C 1' nor \`diff -c1' works."
405 rm -f conftest1 conftest2
406 AC_SUBST(ContextDiffCmd)
408 dnl ** look for a decent parser generator (bison preferred)
411 AC_CHECK_PROG(YaccCmd, bison, bison -y)
412 if test -z "$YaccCmd"; then
413 echo "Can't find bison out there..."
414 AC_CHECK_PROG(WhatCmd, what, what, :)
415 AC_CHECK_PROG(YaccCmd, yacc, $ac_dir/$ac_word)
416 if test -z "$YaccCmd"; then
417 echo "But that's okay...I can't find yacc either."
420 $WhatCmd $YaccCmd > conftest.out
421 if egrep 'y1\.c 1\..*SMI' conftest.out >/dev/null 2>&1; then
422 echo "I don't trust your $YaccCmd; it looks like an old Sun yacc"
423 if test -f /usr/lang/yacc; then
424 echo "I'm going to use /usr/lang/yacc instead"
425 YaccCmd=/usr/lang/yacc
427 echo "I'm assuming the worst...no parser generator at all"
430 elif egrep 'y1\.c.*Revision: 4\.2\.6\.3.*DEC' conftest.out >/dev/null 2>&1; then
431 echo "I don't trust your $YaccCmd; it looks like a lame DEC yacc"
432 echo "I'm assuming the worst...no parser generator at all"
435 echo "But that's okay...as far as I know, your yacc will work."
441 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
445 # -------------------------------------------------------------------------
447 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
450 if echo $CPP | egrep gcc >/dev/null 2>&1; then
452 gcc -v -E conftest.c >/dev/null 2>conftest.out
453 echo '/(\S+\/cpp)/ && print "$1";' > conftest.pl
454 # GNUCPP: used in jmake.c (GnuCppCmd) and in mkdependC
455 # (where we could do with the usual pre-#defines)
456 GNUCPP="`eval $PerlCmd -n conftest.pl conftest.out`"
457 test -n "$verbose" && echo " setting GNUCPP to $GNUCPP"
458 # RAWCPP: we do not want *any* pre-#defines...
459 # (e.g., hscpp, mkdependHS)
460 RAWCPP="`eval $PerlCmd -n conftest.pl conftest.out` -traditional"
461 test -n "$verbose" && echo " setting RAWCPP to $RAWCPP"
464 # ToDo: what are GNUCPP and RAWCPP if the above if didn't fire? WDP 95/02
468 dnl ** figure out how to do a BSD-ish install
472 dnl ** figure out what arguments to feed to `ar'
474 AC_CHECK_PROG(ArCmd,ar,$ac_dir/$ac_word)
475 if test -z "$ArCmd"; then
476 echo "You don't seem to have ar...I have no idea how to make a library"
479 if $ArCmd clqs conftest.a >/dev/null 2>/dev/null; then
482 elif $ArCmd cqs conftest.a >/dev/null 2>/dev/null; then
485 elif $ArCmd clq conftest.a >/dev/null 2>/dev/null; then
488 elif $ArCmd cq conftest.a >/dev/null 2>/dev/null; then
491 elif $ArCmd cq conftest.a 2>&1 | grep 'no archive members specified' >/dev/null 2>/dev/null; then
495 echo "I can't figure out how to use your $ArCmd"
499 test -n "$ArCmd" && test -n "$verbose" && echo " setting ArCmd to $ArCmd"
502 dnl ** figure out if we need `ranlib'
504 if test -z "$NeedRanLib"; then
505 # we hackily override a few platforms on a case-by-case basis
506 case $HostPlatform in
513 test -n "$verbose" && echo " setting RANLIB to $RANLIB"
515 if test -n "$NeedRanLib"; then
521 dnl ** Check to see whether ln -s works
526 dnl ** Find the path to sed **
527 AC_PATH_PROG(SedCmd,sed,$ac_dir/$ac_word)
529 # It better be around somewhere (we wouldn't
530 # exec this script properly if it wasn't!)
534 dnl ** check for time command **
535 AC_PATH_PROG(TimeCmd,time,$ac_dir/$ac_word)
539 dnl ** check for tar **
541 # if GNU tar is named gtar, look for it first.
543 AC_PATH_PROGS(TarCmd,gtar tar,tar)
547 dnl ** check for gzip/compress **
548 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
550 compress_nm=`basename $CompressCmd`
552 if test x"$compress_nm" = xgzip; then
553 CompressCmd="$CompressCmd -d"
558 AC_SUBST(CompressCmd)
559 AC_SUBST(CompressSuffix)
561 dnl ** check for installed happy binary
563 AC_PATH_PROG(HappyCmd,happy)
567 dnl ** check for installed lx binary
569 AC_PATH_PROG(LxCmd,lx)
572 dnl ** check for installed green-card binary
574 AC_PATH_PROG(GreencardCmd,green-card)
576 dnl ** check for full ANSI header (.h) files
581 dnl ** check for specific header (.h) files that we are interested in
583 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 )
586 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
590 dnl ** how do we get a timezone name, and UTC offset ?
595 dnl what's the type of timezone?
599 dnl do we have altzone?
603 dnl ** check for specific library functions that we are interested in
605 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
610 dnl ** can we get alloca?
612 dnl ** determine whether or not const works
614 dnl ** determine the type of signal()
618 dnl ** check for leading underscores in symbol names
622 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
625 # It'll break soon enough if it didn't, but we perform a sanity
626 # check here on the generated config.mk file to see if the
627 # sed that was used is of the well-behaved sort.
629 #grep @ mk/config.mk > conftest.out
630 #if grep -v '# enclosed in @at-signs@.' conftest.out >/dev/null 2>&1; then
633 # echo 'Hmm..suspicious, did the configure script perform all the @..@ substitutions in mk/config.mk?..';
634 # grep -v '# enclosed in @at-signs@.' conftest.out /dev/null
639 echo '************************************************'
640 echo '*** NOW DO: gmake boot followed by gmake all'
641 echo '************************************************'