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=rs6000-ibm-aix
197 TargetPlatform=rs6000-ibm-aix #hack
198 BuildPlatform=rs6000-ibm-aix #hack
199 HostPlatform_CPP='rs6000_ibm_aix'
200 HostArch_CPP='rs6000'
205 HostPlatform=powerpc-ibm-aix
206 TargetPlatform=powerpc-ibm-aix #hack
207 BuildPlatform=powerpc-ibm-aix #hack
208 HostPlatform_CPP='powerpc_ibm_aix'
209 HostArch_CPP='powerpc'
214 HostPlatform=sparc-sun-sunos4
215 TargetPlatform=sparc-sun-sunos4 #hack
216 BuildPlatform=sparc-sun-sunos4 #hack
217 HostPlatform_CPP='sparc_sun_sunos4'
223 HostPlatform=sparc-sun-solaris2
224 TargetPlatform=sparc-sun-solaris2 #hack
225 BuildPlatform=sparc-sun-solaris2 #hack
226 HostPlatform_CPP='sparc_sun_solaris2'
229 HostOS_CPP='solaris2'
232 echo "Unrecognised platform: $HostPlatform"
236 echo "Which we'll canonicalise into: $HostPlatform"
237 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
238 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
240 BuildPlatform_CPP=$HostPlatform_CPP
241 TargetPlatform_CPP=$HostPlatform_CPP
242 BuildArch_CPP=$HostArch_CPP
243 TargetArch_CPP=$HostArch_CPP
244 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)
251 AC_SUBST(HostPlatform)
252 AC_SUBST(TargetPlatform)
253 AC_SUBST(HostPlatform_CPP)
254 dnl AC_SUBST(BuildPlatform_CPP)
255 dnl AC_SUBST(TargetPlatform_CPP)
256 AC_SUBST(HostArch_CPP)
257 dnl AC_SUBST(BuildArch_CPP)
258 dnl AC_SUBST(TargetArch_CPP)
260 dnl AC_SUBST(BuildOS_CPP)
261 dnl AC_SUBST(TargetOS_CPP)
262 AC_SUBST(HostVendor_CPP)
263 dnl AC_SUBST(BuildVendor_CPP)
264 dnl AC_SUBST(TargetVendor_CPP)
266 # -------------------------------------------------------------------------
268 dnl * _GENERAL_ CONFIGURATION CHECKS
270 dnl ** are we at Glasgow?
272 # This stuff is in danger of going away..
274 if test -d /local/fp -a -d /users/fp/simonpj; then
275 echo "Brilliant! You must be a Glaswegian."
277 if test "x$prefix" = xNONE; then
279 echo "Assuming installation prefix of $prefix"
281 if test "x$exec_prefix" = xNONE; then
282 # Sigh: the defn of exec_prefix does not include the bin* bit...
284 exec_prefix=/local/fp
285 echo "Assuming binary installation prefix of $exec_prefix"
291 test -n "$verbose" && echo " setting AT_GLASGOW to $AT_GLASGOW"
299 dnl ** look for `perl', but watch out for version 4.035
301 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
302 if test -z "$PerlCmd"; then
303 echo "You must install perl before you can continue"
304 echo "Perhaps it is already installed, but not in your PATH?"
307 $PerlCmd -v >conftest.out 2>&1
308 if egrep "version 4" conftest.out >/dev/null 2>&1; then
309 if egrep "Patch level: 35" conftest.out >/dev/null 2>&1; then
311 ************************************************************************
312 Uh-oh...looks like you have Perl 4.035.
314 Perl version 4.035 has a bug to do with recursion that will bite if
315 you run the lit2texi script, when making Info files from
316 literate files of various sorts. Either use the current version
317 (4.036), an older version (e.g., perl 4.019) or apply the patch in
318 glafp-utils/perl-4.035-fixes to your 4.035 perl.
319 ************************************************************************
323 if egrep "version 5" conftest.out >/dev/null 2>&1; then
326 echo "I'm not sure if your version of perl will work,"
327 echo "but it's worth a shot, eh?"
333 dnl ** does #!.../perl work? (sometimes it's too long...)
334 echo "checking if \`#!$PerlCmd' works in shell scripts"
339 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
340 if test $? -ne 69; then
343 echo "It doesn't! Perhaps \`#!$PerlCmd' is too long (often 32 characters max)"
348 dnl ** check if perl library is properly installed
349 # (by seeing if a "do 'getopts.pl'" works...
350 if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
353 echo "I think your perl library is misinstalled:"
354 echo "The following script did not work:"
355 echo ' do "getopts.pl" || exit(1); exit(0);'
356 echo 'But, anyway, we will continue in our quest..'
360 dnl ** look for GCC and find out which version
361 # Figure out which C compiler to use. Gcc is preferred.
362 # If gcc, make sure it's at least 2.1
365 if test -z "$GCC"; then
366 echo "You would be better off with gcc"
367 echo "Perhaps it is already installed, but not in your PATH?"
370 gcc -v > conftest.out 2>&1
371 echo '/version (\d+)\.(\d+)/ && $1*10+$2 > 20 && print "YES";' > conftest.pl
372 HaveGcc=`eval $PerlCmd -n conftest.pl conftest.out`
373 if test -z "$HaveGcc"; then
374 echo "I'm not sure if your version of gcc will work,"
375 echo "but it's worth a shot, eh?"
382 # Deprecated (AC_PROG_CC does it): AC_C_CROSS
384 dnl ** figure out how to do context diffs
385 # (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
389 if diff -C 1 conftest1 conftest2 > /dev/null 2>&1 ; then
390 ContextDiffCmd='diff -C 1'
392 if diff -c1 conftest1 conftest2 > /dev/null 2>&1 ; then
393 ContextDiffCmd='diff -c1'
395 echo "Can't figure out how to do context diffs."
396 echo "Neither \`diff -C 1' nor \`diff -c1' works."
400 rm -f conftest1 conftest2
401 AC_SUBST(ContextDiffCmd)
403 dnl ** look for a decent parser generator (bison preferred)
406 AC_CHECK_PROG(YaccCmd, bison, bison -y)
407 if test -z "$YaccCmd"; then
408 echo "Can't find bison out there..."
409 AC_CHECK_PROG(WhatCmd, what, what, :)
410 AC_CHECK_PROG(YaccCmd, yacc, $ac_dir/$ac_word)
411 if test -z "$YaccCmd"; then
412 echo "But that's okay...I can't find yacc either."
415 $WhatCmd $YaccCmd > conftest.out
416 if egrep 'y1\.c 1\..*SMI' conftest.out >/dev/null 2>&1; then
417 echo "I don't trust your $YaccCmd; it looks like an old Sun yacc"
418 if test -f /usr/lang/yacc; then
419 echo "I'm going to use /usr/lang/yacc instead"
420 YaccCmd=/usr/lang/yacc
422 echo "I'm assuming the worst...no parser generator at all"
425 elif egrep 'y1\.c.*Revision: 4\.2\.6\.3.*DEC' conftest.out >/dev/null 2>&1; then
426 echo "I don't trust your $YaccCmd; it looks like a lame DEC yacc"
427 echo "I'm assuming the worst...no parser generator at all"
430 echo "But that's okay...as far as I know, your yacc will work."
436 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
440 # -------------------------------------------------------------------------
442 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
445 if echo $CPP | egrep gcc >/dev/null 2>&1; then
447 gcc -v -E conftest.c >/dev/null 2>conftest.out
448 echo '/(\S+\/cpp)/ && print "$1";' > conftest.pl
449 # GNUCPP: used in jmake.c (GnuCppCmd) and in mkdependC
450 # (where we could do with the usual pre-#defines)
451 GNUCPP="`eval $PerlCmd -n conftest.pl conftest.out`"
452 test -n "$verbose" && echo " setting GNUCPP to $GNUCPP"
453 # RAWCPP: we do not want *any* pre-#defines...
454 # (e.g., hscpp, mkdependHS)
455 RAWCPP="`eval $PerlCmd -n conftest.pl conftest.out` -traditional"
456 test -n "$verbose" && echo " setting RAWCPP to $RAWCPP"
459 # ToDo: what are GNUCPP and RAWCPP if the above if didn't fire? WDP 95/02
463 dnl ** figure out how to do a BSD-ish install
467 dnl ** figure out what arguments to feed to `ar'
469 AC_CHECK_PROG(ArCmd,ar,$ac_dir/$ac_word)
470 if test -z "$ArCmd"; then
471 echo "You don't seem to have ar...I have no idea how to make a library"
474 if $ArCmd clqs conftest.a >/dev/null 2>/dev/null; then
477 elif $ArCmd cqs conftest.a >/dev/null 2>/dev/null; then
480 elif $ArCmd clq conftest.a >/dev/null 2>/dev/null; then
483 elif $ArCmd cq conftest.a >/dev/null 2>/dev/null; then
486 elif $ArCmd cq conftest.a 2>&1 | grep 'no archive members specified' >/dev/null 2>/dev/null; then
490 echo "I can't figure out how to use your $ArCmd"
494 test -n "$ArCmd" && test -n "$verbose" && echo " setting ArCmd to $ArCmd"
497 dnl ** figure out if we need `ranlib'
499 if test -z "$NeedRanLib"; then
500 # we hackily override a few platforms on a case-by-case basis
501 case $HostPlatform in
508 test -n "$verbose" && echo " setting RANLIB to $RANLIB"
510 if test -n "$NeedRanLib"; then
516 dnl ** Check to see whether ln -s works
521 dnl ** Find the path to sed **
522 AC_PATH_PROG(SedCmd,sed,$ac_dir/$ac_word)
524 # It better be around somewhere (we wouldn't
525 # exec this script properly if it wasn't!)
529 dnl ** check for time command **
530 AC_PATH_PROG(TimeCmd,time,$ac_dir/$ac_word)
534 dnl ** check for tar **
536 # if GNU tar is named gtar, look for it first.
538 AC_PATH_PROGS(TarCmd,gtar tar,tar)
542 dnl ** check for gzip/compress **
543 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
545 compress_nm=`basename $CompressCmd`
547 if test x"$compress_nm" = xgzip; then
548 CompressCmd="$CompressCmd -d"
553 AC_SUBST(CompressCmd)
554 AC_SUBST(CompressSuffix)
556 dnl ** check for installed happy binary
558 AC_PATH_PROG(HappyCmd,happy)
562 dnl ** check for installed lx binary
564 AC_PATH_PROG(LxCmd,lx)
568 dnl ** check for full ANSI header (.h) files
572 dnl ** check for specific header (.h) files that we are interested in
574 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 )
576 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
580 dnl ** how do we get a timezone name?
584 dnl ** determine the type of signal()
588 dnl ** check for specific library functions that we are interested in
590 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
592 dnl ** can we get alloca?
596 dnl ** determine whether or not const works
600 dnl ** check for leading underscores in symbol names
601 # We assume that they _aren't_ there if anything goes wrong.
603 echo checking for a leading underscore in symbol names
607 struct nlist xYzzY[] = {{"_xYzzY", 0},{0}};
615 if(nlist(argv[0], xYzzY) == 0 && xYzzY[0].n_value != 0)
619 }], LeadingUnderscore='YES', LeadingUnderscore='NO', LeadingUnderscore='YES')
620 test -n "$verbose" && echo " setting LeadingUnderscore to $LeadingUnderscore"
621 AC_SUBST(LeadingUnderscore)
623 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
626 # It'll break soon enough if it didn't, but we perform a sanity
627 # check here on the generated config.mk file to see if the
628 # sed that was used is of the well-behaved sort.
630 #grep @ mk/config.mk > conftest.out
631 #if grep -v '# enclosed in @at-signs@.' conftest.out >/dev/null 2>&1; then
634 # echo 'Hmm..suspicious, did the configure script perform all the @..@ substitutions in mk/config.mk?..';
635 # grep -v '# enclosed in @at-signs@.' conftest.out /dev/null
640 echo '************************************************'
641 echo '*** NOW DO: gmake boot followed by gmake all'
642 echo '************************************************'