[project @ 1998-08-14 11:45:04 by sof]
[ghc-hetmet.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-1997
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 # First off, a distrib sanity check..
16 AC_INIT(mk/config.mk.in)
17
18 # -------------------------------------------------------------------------
19 # Prepare to generate the following header files
20 #
21 #
22 AC_CONFIG_HEADER(mk/config.h)
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 # Remove common automounter nonsense + convert from UNC to DOS style paths
32 # (cygwin32-beta18 for UNC isn't quite there yet.)
33 #
34 hardtop=`pwd`
35 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|' | sed 's|^//\(.\)/|\1:/|' `
36
37 echo ''
38 echo "*** The top of your build tree is: $hardtop"
39 AC_SUBST(hardtop)
40
41 ####--------------------------------------------------------------------
42 dnl ** choose host(/target/build) platform
43 #
44 # Guess host/target/build platform(s) if necessary.
45 #
46 AC_CANONICAL_SYSTEM
47
48 # "$host" defaults to "$target"
49 if test "x$host" = xNONE ; then
50     host=$target
51 fi
52 # "$build" defaults to "$host"
53 #if test "x$build" = xNONE ; then
54 #    build=$host
55 #else
56 #    echo "This configuration does not support the \`--build' option."
57 #    exit 1
58 #fi
59
60 dnl ** canonicalize platform names
61 # Canonicali[sz]e those babies
62 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
63 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
64 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
65
66 if test x"$TargetPlatform" != x"$HostPlatform" ; then
67     echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
68     exit 1
69 fi
70
71 exeext=''
72 #
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)
76 # separately.
77 case $HostPlatform in
78 alpha-dec-osf[[12]]*)
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'
83         HostArch_CPP='alpha'
84         HostVendor_CPP='dec'
85         HostOS_CPP='osf1'
86         ;;
87 alpha-dec-osf[[34]]*)
88         HostPlatform=alpha-dec-osf3   # canonicalise for our purposes
89         TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
90         BuildPlatform=alpha-dec-osf3  # hack
91         HostPlatform_CPP='alpha_dec_osf3'
92         HostArch_CPP='alpha'
93         HostVendor_CPP='dec'
94         HostOS_CPP='osf3'
95         ;;
96 hppa1.1-hp-hpux*)
97         HostPlatform=hppa1.1-hp-hpux  # canonicalise for our purposes (hack)
98         TargetPlatform=hppa1.1-hp-hpux
99         BuildPlatform=hppa1.1-hp-hpux
100         HostPlatform_CPP='hppa1_1_hp_hpux'
101         HostArch_CPP='hppa1_1'
102         HostVendor_CPP='hp'
103         HostOS_CPP='hpux'
104         ;;
105 i[[3456]]86-*-linuxaout*)
106         HostPlatform=i386-unknown-linuxaout   # hack again
107         TargetPlatform=i386-unknown-linuxaout
108         BuildPlatform=i386-unknown-linuxaout
109         HostPlatform_CPP='i386_unknown_linuxaout'
110         HostArch_CPP='i386'
111         HostVendor_CPP='unknown'
112         HostOS_CPP='linuxaout'
113         ;;
114 i[[3456]]86-*-linux*)
115         HostPlatform=i386-unknown-linux # hack again
116         TargetPlatform=i386-unknown-linux
117         BuildPlatform=i386-unknown-linux
118         HostPlatform_CPP='i386_unknown_linux'
119         HostArch_CPP='i386'
120         HostVendor_CPP='unknown'
121         HostOS_CPP='linux'
122         ;;
123 i[[3456]]86-*-freebsd*)
124         HostPlatform=i386-unknown-freebsd # hack again
125         TargetPlatform=i386-unknown-freebsd
126         BuildPlatform=i386-unknown-freebsd
127         HostPlatform_CPP='i386_unknown_freebsd'
128         HostArch_CPP='i386'
129         HostVendor_CPP='unknown'
130         HostOS_CPP='freebsd'
131         ;;
132 i[[3456]]86-*-netbsd*)
133         HostPlatform=i386-unknown-netbsd # hack again
134         TargetPlatform=i386-unknown-netbsd
135         BuildPlatform=i386-unknown-netbsd
136         HostPlatform_CPP='i386_unknown_netbsd'
137         HostArch_CPP='i386'
138         HostVendor_CPP='unknown'
139         HostOS_CPP='netbsd'
140         ;;
141 i[[3456]]86-*-solaris2*)
142         HostPlatform=i386-unknown-solaris2 # hack again
143         TargetPlatform=i386-unknown-solaris2
144         BuildPlatform=i386-unknown-solaris2
145         HostPlatform_CPP='i386_unknown_solaris2'
146         HostArch_CPP='i386'
147         HostVendor_CPP='unknown'
148         HostOS_CPP='solaris2'
149         ;;
150 i[[3456]]86-*-cygwin32*)
151         HostPlatform=i386-unknown-cygwin32 # hack again
152         TargetPlatform=i386-unknown-cygwin32
153         BuildPlatform=i386-unknown-cygwin32
154         HostPlatform_CPP='i386_unknown_cygwin32'
155         HostArch_CPP='i386'
156         HostVendor_CPP='unknown'
157         HostOS_CPP='cygwin32'
158         exeext='.exe'
159         ;;
160 m68k-next-nextstep2)
161         HostPlatform_CPP='m68k_next_nextstep2'
162         HostArch_CPP='m68k'
163         HostVendor_CPP='next'
164         HostOS_CPP='nextstep2'
165         ;;
166 m68k-next-nextstep3)
167         HostPlatform_CPP='m68k_next_nextstep3'
168         HostArch_CPP='m68k'
169         HostVendor_CPP='next'
170         HostOS_CPP='nextstep3'
171         ;;
172 i[[3456]]86-next-nextstep3)
173         HostPlatform=i386-next-nextstep3 # hack again
174         TargetPlatform=i386-next-nextstep3
175         BuildPlatform=i386-next-nextstep3
176         HostPlatform_CPP='i386_next_nextstep3'
177         HostArch_CPP='i386'
178         HostVendor_CPP='next'
179         HostOS_CPP='nextstep3'
180         ;;
181 m68k-sun-sunos4*)
182         HostPlatform=m68k-sun-sunos4
183         TargetPlatform=m68k-sun-sunos4 #hack
184         BuildPlatform=m68k-sun-sunos4 #hack
185         HostPlatform_CPP='m68k_sun_sunos4'
186         HostArch_CPP='m68k'
187         HostVendor_CPP='sun'
188         HostOS_CPP='sunos4'
189         ;;
190 mips-dec-ultrix*)
191         HostPlatform_CPP='mips_dec_ultrix'
192         HostArch_CPP='mipsel'   # NB a little different
193         HostVendor_CPP='dec'
194         HostOS_CPP='ultrix'
195         ;;
196 mips-sgi-irix*)
197         HostPlatform=mips-sgi-irix
198         TargetPlatform=mips-sgi-irix #hack
199         BuildPlatform=mips-sgi-irix #hack
200         HostPlatform_CPP='mips_sgi_irix'
201         HostArch_CPP='mipseb'   # NB a little different
202         HostVendor_CPP='sgi'
203         HostOS_CPP='irix'
204         ;;
205 rs6000-ibm-aix*)
206         HostPlatform=rs6000-ibm-aix
207         TargetPlatform=rs6000-ibm-aix #hack
208         BuildPlatform=rs6000-ibm-aix #hack
209         HostPlatform_CPP='rs6000_ibm_aix'
210         HostArch_CPP='rs6000'
211         HostVendor_CPP='ibm'
212         HostOS_CPP='aix'
213         ;;
214 powerpc-ibm-aix*)
215         HostPlatform=powerpc-ibm-aix
216         TargetPlatform=powerpc-ibm-aix #hack
217         BuildPlatform=powerpc-ibm-aix #hack
218         HostPlatform_CPP='powerpc_ibm_aix'
219         HostArch_CPP='powerpc'
220         HostVendor_CPP='ibm'
221         HostOS_CPP='aix'
222         ;;
223 sparc-sun-sunos4*)
224         HostPlatform=sparc-sun-sunos4
225         TargetPlatform=sparc-sun-sunos4 #hack
226         BuildPlatform=sparc-sun-sunos4 #hack
227         HostPlatform_CPP='sparc_sun_sunos4'
228         HostArch_CPP='sparc'
229         HostVendor_CPP='sun'
230         HostOS_CPP='sunos4'
231         ;;
232 sparc-sun-solaris2*)
233         HostPlatform=sparc-sun-solaris2
234         TargetPlatform=sparc-sun-solaris2 #hack
235         BuildPlatform=sparc-sun-solaris2 #hack
236         HostPlatform_CPP='sparc_sun_solaris2'
237         HostArch_CPP='sparc'
238         HostVendor_CPP='sun'
239         HostOS_CPP='solaris2'
240         ;;
241 *)
242         echo "Unrecognised platform: $HostPlatform"
243         exit 1
244         ;;
245 esac
246 echo "Canonicalised to: $HostPlatform"
247 test  x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
248 test  x"$BuildPlatform" != x"$HostPlatform"  && echo "Build platform set to $BuildPlatform"
249
250 BuildPlatform_CPP=$HostPlatform_CPP
251 TargetPlatform_CPP=$HostPlatform_CPP
252 BuildArch_CPP=$HostArch_CPP
253 TargetArch_CPP=$HostArch_CPP
254 BuildOS_CPP=$HostOS_CPP
255 HostOS_Full=$host_os
256 TargetOS_CPP=$HostOS_CPP
257 BuildVendor_CPP=$HostVendor_CPP
258 TargetVendor_CPP=$HostVendor_CPP
259
260 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
261 dnl AC_SUBST(BuildPlatform)
262
263 AC_SUBST(HostPlatform)
264 AC_SUBST(TargetPlatform)
265 AC_SUBST(HostPlatform_CPP)
266 dnl AC_SUBST(BuildPlatform_CPP)
267 dnl AC_SUBST(TargetPlatform_CPP)
268
269 AC_SUBST(HostArch_CPP)
270 dnl AC_SUBST(BuildArch_CPP)
271 dnl AC_SUBST(TargetArch_CPP)
272
273 AC_SUBST(HostOS_CPP)
274 AC_SUBST(HostOS_Full)
275 dnl AC_SUBST(BuildOS_CPP)
276 dnl AC_SUBST(TargetOS_CPP)
277
278 AC_SUBST(HostVendor_CPP)
279 dnl AC_SUBST(BuildVendor_CPP)
280 dnl AC_SUBST(TargetVendor_CPP)
281
282 AC_SUBST(exeext)
283
284 dnl * Booting from .hc files?
285 #--------------------------------------------------------------
286 AC_ARG_ENABLE(hc-boot,
287    [
288 Boot the Glasgow Haskell Compiler from intermediate .hc files.
289 (This option is mostly of interest for porters.)
290    ],
291
292    BootingFromHc=YES,
293    BootingFromHc=NO
294 )
295 AC_SUBST(BootingFromHc)
296
297 # -------------------------------------------------------------------------
298 dnl
299 dnl * _GENERAL_ CONFIGURATION CHECKS
300 #
301
302 #
303 dnl ** does #! work?
304 #
305 AC_SYS_INTERPRETER()
306 #
307 dnl ** look for `perl', but watch out for version 4.035
308 #
309 AC_PATH_PROG(PerlCmd,perl)
310 if test -z "$PerlCmd"; then
311    echo "You must install perl before you can continue"
312    echo "Perhaps it is already installed, but not in your PATH?"
313    exit 1
314 else
315 FPTOOLS_CHECK_PERL_VERSION
316 fi
317
318 #
319 dnl ** does #!.../perl work? (sometimes it's too long...)
320 #
321 FPTOOLS_SHEBANG_PERL
322
323 #
324 dnl ** look for GCC and find out which version
325 # Figure out which C compiler to use.  Gcc is preferred.
326 # If gcc, make sure it's at least 2.1
327 #
328 AC_PROG_CC
329 FPTOOLS_HAVE_GCC
330
331 #
332 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
333 #
334 AC_PROG_CPP
335 FPTOOLS_PROG_GNUCPP
336
337 #
338 dnl ** figure out how to do context diffs
339 #
340 FPTOOLS_PROG_DIFF
341
342 #
343 dnl ** look for a decent parser generator (bison preferred)
344 #
345 # (FPTOOLS_PROG_YACCY is AC_PROG_YACC, but with some extra testing 
346 # on the suitability of the 'yacc' returned.)
347 FPTOOLS_PROG_YACCY
348
349 #
350 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
351 #
352 AC_PROG_LEX
353
354 #
355 dnl ** figure out how to do a BSD-ish install
356 #
357 AC_PROG_INSTALL
358 #
359 dnl ** how to invoke `ar' and `ranlib'
360 #
361 FPTOOLS_PROG_AR_AND_RANLIB
362
363 #
364 #
365 dnl ** Check to see whether ln -s works
366 #
367 AC_PROG_LN_S
368
369 #
370 dnl ** Find the path to sed **
371 #
372 AC_PATH_PROG(SedCmd,sed)
373
374 #
375 dnl ** check for time command **
376 AC_PATH_PROG(TimeCmd,time)
377
378 #
379 dnl ** check for tar **
380 #
381 # if GNU tar is named gtar, look for it first.
382 #
383 AC_PATH_PROGS(TarCmd,gtar tar,tar)
384
385 #
386 dnl ** check for gzip/compress **
387 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
388
389 compress_nm=`basename $CompressCmd`
390 if test x"$compress_nm" = xgzip; then
391   CompressCmd="$CompressCmd -d"
392   CompressSuffix="gz"
393 else
394   CompressSuffix="Z"
395 fi
396 AC_SUBST(CompressCmd)
397 AC_SUBST(CompressSuffix)
398
399 dnl
400 dnl ** check for installed happy binary + version
401 dnl    (don't do it if we're booting from .hc files though.)
402 if (test "$BootingFromHc" = "NO"); then
403 FPTOOLS_HAPPY
404 fi;
405
406 #### program checking section ends here ####
407
408 ####--------------------------------------------------
409 #### checking the state of the local header files and syscalls ####
410
411 #
412 dnl ** check for full ANSI header (.h) files
413 #
414 AC_HEADER_STDC
415
416 #
417 dnl ** check for specific header (.h) files that we are interested in
418 #
419 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 bfd.h)
420
421 #
422 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
423 #
424 AC_HEADER_TIME
425 #
426 dnl ** how do we get a timezone name, and UTC offset ?
427 #
428 AC_STRUCT_TIMEZONE
429
430
431 dnl ** what's the type of timezone?
432 FPTOOLS_TYPE_TIMEZONE
433
434 #
435 dnl ** do we have altzone?
436 FPTOOLS_ALTZONE
437
438 dnl ** what are the sizes of various types
439 dnl    (these must come before GHC_CHECK_ALIGNMENT)
440 AC_CHECK_SIZEOF(unsigned int,4)
441 AC_CHECK_SIZEOF(float,       4)
442 AC_CHECK_SIZEOF(double,      8)
443 AC_CHECK_SIZEOF(long,        4)
444 AC_CHECK_SIZEOF(void *,      4)
445
446 dnl ** what are alignment constraints on various types
447 FPTOOLS_CHECK_ALIGNMENT(unsigned int) dnl redundant but harmless
448 FPTOOLS_CHECK_ALIGNMENT(long)
449 FPTOOLS_CHECK_ALIGNMENT(float)
450 FPTOOLS_CHECK_ALIGNMENT(double)
451
452 dnl ** do we have long longs?
453 FPTOOLS_C_LONG_LONG
454
455 #
456 dnl ** check for specific library functions that we are interested in
457 #
458 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
459
460 #
461 dnl ** check whether this machine has GMP 2.0 installed
462 #
463 AC_CHECK_LIB(gmp,  mpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
464   AC_CHECK_LIB(gmp2, mpz_fdiv_qr,  HaveLibGmp=YES; LibGmp=gmp2,
465     HaveLibGmp=No; LibGmp=not-installed))
466 AC_SUBST(HaveLibGmp)
467 AC_SUBST(LibGmp)
468
469 #
470 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
471 dnl ** the order of these tests matters: bfd needs liberty
472 #
473 AC_CHECK_LIB(iberty, xmalloc)
474 AC_CHECK_LIB(bfd,    bfd_init)
475
476 #
477 # Misc
478 #
479 dnl ** can we get alloca?
480 AC_FUNC_ALLOCA
481 dnl ** determine whether or not const works
482 AC_C_CONST
483 dnl ** are we big endian?
484 AC_C_BIGENDIAN
485 dnl ** determine the type of signal()
486 AC_TYPE_SIGNAL
487
488 #
489 dnl ** check for leading underscores in symbol names
490 #
491 FPTOOLS_UNDERSCORE
492
493 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
494
495 echo ''
496 echo '************************************************'
497 echo '*** NOW DO: gmake boot followed by gmake all'
498 echo '***         (where gmake == GNU make)'
499 echo '************************************************'
500 exit 0