1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (run "grep '^dnl \*' configure.ac | sed -e 's/dnl / /g; s/\*\*/ +/g;'"
3 dnl (or some such) to see the outline of this file)
6 # (c) The AQUA Project, Glasgow University, 1994-2004
8 # Configure script template for the Glasgow functional programming tools
10 # Process with 'autoreconf' to get a working configure script.
12 # For the generated configure script, do "./configure --help" to
13 # see what flags are available. (Better yet, read the documentation!)
16 AC_INIT([fptools build system], [1.0], [cvs-fptools@haskell.org], [fptools])
18 # First off, a distrib sanity check..
19 AC_CONFIG_SRCDIR([mk/config.mk.in])
21 dnl * We require autoconf version 2.52
22 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
23 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
26 dnl * Declare subdirectories that have a private configure script
28 dnl After the toplevel configuration is complete, the script will recurse into
29 dnl these subdirectories if they exist. The use of a cache file makes repeated
31 AC_CONFIG_SUBDIRS([ghc libraries])
33 # -------------------------------------------------------------------------
34 # Prepare to generate the following header files
37 AC_CONFIG_HEADER(mk/config.h)
39 # No, semi-sadly, we don't do `--srcdir'...
40 if test x"$srcdir" != 'x.' ; then
41 echo "This configuration does not support the \`--srcdir' option.."
45 dnl--------------------------------------------------------------------
46 dnl * Choose host(/target/build) platform
47 dnl--------------------------------------------------------------------
49 dnl Guess host/target/build platform(s) if necessary.
52 # "$host" defaults to "$target"
53 if test "x$host" = xNONE ; then
57 dnl ** canonicalize platform names
58 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
59 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
60 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
62 if test x"$TargetPlatform" != x"$HostPlatform" ; then
63 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
69 # The following will be more difficult when we *are* cross-compiling.
70 # Suitable names to slam in *_CPP are in platform.h.in.
71 # We also record the architecture, vendor, and operating system (OS)
74 alpha*-dec-osf[[12]]*)
75 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
76 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
77 BuildPlatform=alpha-dec-osf1 # hack
78 HostPlatform_CPP='alpha_dec_osf1'
83 alpha*-dec-osf[[345]]*)
84 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
85 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
86 BuildPlatform=alpha-dec-osf3 # hack
87 HostPlatform_CPP='alpha_dec_osf3'
92 alpha*-unknown-linux*)
93 HostPlatform=alpha-unknown-linux
94 TargetPlatform=alpha-unknown-linux
95 BuildPlatform=alpha-unknown-linux
96 HostPlatform_CPP='alpha_unknown_linux'
98 HostVendor_CPP='unknown'
101 alpha*-unknown-freebsd*)
102 HostPlatform=alpha-unknown-freebsd
103 TargetPlatform=alpha-unknown-freebsd
104 BuildPlatform=alpha-unknown-freebsd
105 HostPlatform_CPP='alpha_unknown_freebsd'
107 HostVendor_CPP='unknown'
110 alpha*-unknown-openbsd*)
111 HostPlatform=alpha-unknown-openbsd
112 TargetPlatform=alpha-unknown-openbsd
113 BuildPlatform=alpha-unknown-openbsd
114 HostPlatform_CPP='alpha_unknown_openbsd'
116 HostVendor_CPP='unknown'
119 amd64-*-openbsd*|x86_64-*-openbsd*)
120 HostPlatform=x86_64-unknown-openbsd
121 TargetPlatform=x86_64-unknown-openbsd
122 BuildPlatform=x86_64-unknown-openbsd
123 HostPlatform_CPP='x86_64_unknown_openbsd'
124 HostArch_CPP='x86_64'
125 HostVendor_CPP='unknown'
129 HostPlatform=x86_64-unknown-freebsd
130 TargetPlatform=x86_64-unknown-freebsd
131 BuildPlatform=x86_64-unknown-freebsd
132 HostPlatform_CPP='x86_64_unknown_freebsd'
133 HostArch_CPP='x86_64'
134 HostVendor_CPP='unknown'
138 HostPlatform=arm-unknown-linux # hack again
139 TargetPlatform=arm-unknown-linux
140 BuildPlatform=arm-unknown-linux
141 HostPlatform_CPP='arm_unknown_linux'
143 HostVendor_CPP='unknown'
147 HostPlatform=arm-unknown-openbsd
148 TargetPlatform=arm-unknown-openbsd
149 BuildPlatform=arm-unknown-openbsd
150 HostPlatform_CPP='arm_unknown_openbsd'
152 HostVendor_CPP='unknown'
156 HostPlatform=hppa-unknown-linux # hack again
157 TargetPlatform=hppa-unknown-linux
158 BuildPlatform=hppa-unknown-linux
159 HostPlatform_CPP='hppa_unknown_linux'
161 HostVendor_CPP='unknown'
165 HostPlatform=hppa-unknown-openbsd # hack again
166 TargetPlatform=hppa-unknown-openbsd
167 BuildPlatform=hppa-unknown-openbsd
168 HostPlatform_CPP='hppa_unknown_openbsd'
170 HostVendor_CPP='unknown'
174 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
175 TargetPlatform=hppa1.1-hp-hpux
176 BuildPlatform=hppa1.1-hp-hpux
177 HostPlatform_CPP='hppa1_1_hp_hpux'
178 HostArch_CPP='hppa1_1'
182 i[[3456]]86-*-linuxaout*)
183 HostPlatform=i386-unknown-linuxaout # hack again
184 TargetPlatform=i386-unknown-linuxaout
185 BuildPlatform=i386-unknown-linuxaout
186 HostPlatform_CPP='i386_unknown_linuxaout'
188 HostVendor_CPP='unknown'
189 HostOS_CPP='linuxaout'
191 i[[3456]]86-*-linux*)
192 HostPlatform=i386-unknown-linux # hack again
193 TargetPlatform=i386-unknown-linux
194 BuildPlatform=i386-unknown-linux
195 HostPlatform_CPP='i386_unknown_linux'
197 HostVendor_CPP='unknown'
200 i[[3456]]86-*-kfreebsd*-gnu)
201 HostPlatform=i386-unknown-kfreebsdgnu # hack again
202 TargetPlatform=i386-unknown-kfreebsdgnu
203 BuildPlatform=i386-unknown-kfreebsdgnu
204 HostPlatform_CPP='i386_unknown_kfreebsdgnu'
206 HostVendor_CPP='unknown'
207 HostOS_CPP='kfreebsdgnu'
209 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
210 HostPlatform=i386-unknown-freebsd # hack again
211 TargetPlatform=i386-unknown-freebsd
212 BuildPlatform=i386-unknown-freebsd
213 HostPlatform_CPP='i386_unknown_freebsd'
215 HostVendor_CPP='unknown'
218 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
219 HostPlatform=i386-unknown-freebsd2 # hack again
220 TargetPlatform=i386-unknown-freebsd2
221 BuildPlatform=i386-unknown-freebsd2
222 HostPlatform_CPP='i386_unknown_freebsd2'
224 HostVendor_CPP='unknown'
225 HostOS_CPP='freebsd2'
227 i[[3456]]86-*-netbsd*)
228 HostPlatform=i386-unknown-netbsd # hack again
229 TargetPlatform=i386-unknown-netbsd
230 BuildPlatform=i386-unknown-netbsd
231 HostPlatform_CPP='i386_unknown_netbsd'
233 HostVendor_CPP='unknown'
236 i[[3456]]86-*-openbsd*)
237 HostPlatform=i386-unknown-openbsd # hack again
238 TargetPlatform=i386-unknown-openbsd
239 BuildPlatform=i386-unknown-openbsd
240 HostPlatform_CPP='i386_unknown_openbsd'
242 HostVendor_CPP='unknown'
245 i[[3456]]86-*-solaris2*)
246 HostPlatform=i386-unknown-solaris2 # hack again
247 TargetPlatform=i386-unknown-solaris2
248 BuildPlatform=i386-unknown-solaris2
249 HostPlatform_CPP='i386_unknown_solaris2'
251 HostVendor_CPP='unknown'
252 HostOS_CPP='solaris2'
254 i[[3456]]86-*-cygwin*)
255 HostPlatform=i386-unknown-cygwin32 # hack again
256 TargetPlatform=i386-unknown-cygwin32
257 BuildPlatform=i386-unknown-cygwin32
258 HostPlatform_CPP='i386_unknown_cygwin32'
260 HostVendor_CPP='unknown'
261 HostOS_CPP='cygwin32'
264 i[[3456]]86-*-mingw32*)
265 HostPlatform=i386-unknown-mingw32 # hack again
266 TargetPlatform=i386-unknown-mingw32
267 BuildPlatform=i386-unknown-mingw32
268 HostPlatform_CPP='i386_unknown_mingw32'
270 HostVendor_CPP='unknown'
274 i[[3456]]86-apple-darwin*)
275 HostPlatform=i386-apple-darwin
276 TargetPlatform=i386-apple-darwin #hack
277 BuildPlatform=i386-apple-darwin #hack
278 HostPlatform_CPP='i386_apple_darwin'
280 HostVendor_CPP='apple'
284 HostPlatform=i386-unknown-gnu
285 TargetPlatform=i386-unknown-gnu
286 BuildPlatform=i386-unknown-gnu
287 HostPlatform_CPP=i386_unknown_gnu
289 HostVendor_CPP=unknown
293 HostPlatform=ia64-unknown-linux # hack again
294 TargetPlatform=ia64-unknown-linux
295 BuildPlatform=ia64-unknown-linux
296 HostPlatform_CPP='ia64_unknown_linux'
298 HostVendor_CPP='unknown'
302 HostPlatform=x86_64-unknown-linux
303 TargetPlatform=x86_64-unknown-linux
304 BuildPlatform=x86_64-unknown-linux
305 HostPlatform_CPP='x86_64_unknown_linux'
306 HostArch_CPP='x86_64'
307 HostVendor_CPP='unknown'
311 HostPlatform=m68k-unknown-linux # hack again
312 TargetPlatform=m68k-unknown-linux
313 BuildPlatform=m68k-unknown-linux
314 HostPlatform_CPP='m68k_unknown_linux'
316 HostVendor_CPP='unknown'
320 HostPlatform_CPP='m68k_next_nextstep2'
322 HostVendor_CPP='next'
323 HostOS_CPP='nextstep2'
326 HostPlatform_CPP='m68k_next_nextstep3'
328 HostVendor_CPP='next'
329 HostOS_CPP='nextstep3'
331 i[[3456]]86-next-nextstep3)
332 HostPlatform=i386-next-nextstep3 # hack again
333 TargetPlatform=i386-next-nextstep3
334 BuildPlatform=i386-next-nextstep3
335 HostPlatform_CPP='i386_next_nextstep3'
337 HostVendor_CPP='next'
338 HostOS_CPP='nextstep3'
341 HostPlatform=m68k-unknown-openbsd
342 TargetPlatform=m68k-unknown-openbsd
343 BuildPlatform=m68k-unknown-openbsd
344 HostPlatform_CPP='m68k_unknown_openbsd'
346 HostVendor_CPP='unknown'
350 HostPlatform=m68k-unknown-netbsd
351 TargetPlatform=m68k-unknown-netbsd
352 BuildPlatform=m68k-unknown-netbsd
353 HostPlatform_CPP='m68k_unknown_netbsd'
355 HostVendor_CPP='unknown'
359 HostPlatform=m68k-sun-sunos4
360 TargetPlatform=m68k-sun-sunos4 #hack
361 BuildPlatform=m68k-sun-sunos4 #hack
362 HostPlatform_CPP='m68k_sun_sunos4'
368 HostPlatform=m88k-unknown-openbsd
369 TargetPlatform=m88k-unknown-openbsd
370 BuildPlatform=m88k-unknown-openbsd
371 HostPlatform_CPP='m88k_unknown_openbsd'
373 HostVendor_CPP='unknown'
377 HostPlatform=mips-unknown-linux # hack again
378 TargetPlatform=mips-unknown-linux
379 BuildPlatform=mips-unknown-linux
380 HostPlatform_CPP='mips_unknown_linux'
382 HostVendor_CPP='unknown'
386 HostPlatform_CPP='mips_dec_ultrix'
387 HostArch_CPP='mipsel' # NB a little different
392 HostPlatform=mips-sgi-irix
393 TargetPlatform=mips-sgi-irix #hack
394 BuildPlatform=mips-sgi-irix #hack
395 HostPlatform_CPP='mips_sgi_irix'
396 HostArch_CPP='mipseb' # NB a little different
401 HostPlatform=rs6000-ibm-aix
402 TargetPlatform=rs6000-ibm-aix #hack
403 BuildPlatform=rs6000-ibm-aix #hack
404 HostPlatform_CPP='rs6000_ibm_aix'
405 HostArch_CPP='rs6000'
410 HostPlatform=powerpc-ibm-aix
411 TargetPlatform=powerpc-ibm-aix #hack
412 BuildPlatform=powerpc-ibm-aix #hack
413 HostPlatform_CPP='powerpc_ibm_aix'
414 HostArch_CPP='powerpc'
418 powerpc-apple-darwin*)
419 HostPlatform=powerpc-apple-darwin
420 TargetPlatform=powerpc-apple-darwin #hack
421 BuildPlatform=powerpc-apple-darwin #hack
422 HostPlatform_CPP='powerpc_apple_darwin'
423 HostArch_CPP='powerpc'
424 HostVendor_CPP='apple'
427 powerpc-unknown-linux*)
428 HostPlatform=powerpc-unknown-linux
429 TargetPlatform=powerpc-unknown-linux
430 BuildPlatform=powerpc-unknown-linux
431 HostPlatform_CPP='powerpc_unknown_linux'
432 HostArch_CPP='powerpc'
433 HostVendor_CPP='unknown'
436 powerpc-unknown-openbsd*)
437 HostPlatform=powerpc-unknown-openbsd
438 TargetPlatform=powerpc-unknown-openbsd
439 BuildPlatform=powerpc-unknown-openbsd
440 HostPlatform_CPP='powerpc_unknown_openbsd'
441 HostArch_CPP='powerpc'
442 HostVendor_CPP='unknown'
445 powerpc64-unknown-linux*)
446 HostPlatform=powerpc64-unknown-linux
447 TargetPlatform=powerpc64-unknown-linux
448 BuildPlatform=powerpc64-unknown-linux
449 HostPlatform_CPP='powerpc64_unknown_linux'
450 HostArch_CPP='powerpc64'
451 HostVendor_CPP='unknown'
456 HostPlatform=s390-ibm-linux
457 TargetPlatform=s390-ibm-linux #hack
458 BuildPlatform=s390-ibm-linux #hack
459 HostPlatform_CPP='s390_ibm_linux'
465 HostPlatform=sparc-sun-sunos4
466 TargetPlatform=sparc-sun-sunos4 #hack
467 BuildPlatform=sparc-sun-sunos4 #hack
468 HostPlatform_CPP='sparc_sun_sunos4'
474 HostPlatform=sparc-sun-solaris2
475 TargetPlatform=sparc-sun-solaris2 #hack
476 BuildPlatform=sparc-sun-solaris2 #hack
477 HostPlatform_CPP='sparc_sun_solaris2'
480 HostOS_CPP='solaris2'
483 HostPlatform=sparc-unknown-linux
484 TargetPlatform=sparc-unknown-linux
485 BuildPlatform=sparc-unknown-linux
486 HostPlatform_CPP='sparc_unknown_linux'
488 HostVendor_CPP='unknown'
492 HostPlatform=sparc-unknown-openbsd
493 TargetPlatform=sparc-unknown-openbsd
494 BuildPlatform=sparc-unknown-openbsd
495 HostPlatform_CPP='sparc_unknown_openbsd'
497 HostVendor_CPP='unknown'
501 HostPlatform=sparc64-unknown-openbsd
502 TargetPlatform=sparc64-unknown-openbsd
503 BuildPlatform=sparc64-unknown-openbsd
504 HostPlatform_CPP='sparc64_unknown_openbsd'
505 HostArch_CPP='sparc64'
506 HostVendor_CPP='unknown'
510 HostPlatform=vax-unknown-openbsd
511 TargetPlatform=vax-unknown-openbsd
512 BuildPlatform=vax-unknown-openbsd
513 HostPlatform_CPP='vax_unknown_openbsd'
515 HostVendor_CPP='unknown'
519 echo "Unrecognised platform: $HostPlatform"
523 echo "Canonicalised to: $HostPlatform"
524 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
525 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
527 BuildPlatform_CPP=$HostPlatform_CPP
528 TargetPlatform_CPP=$HostPlatform_CPP
529 BuildArch_CPP=$HostArch_CPP
530 TargetArch_CPP=$HostArch_CPP
531 BuildOS_CPP=$HostOS_CPP
533 TargetOS_CPP=$HostOS_CPP
534 BuildVendor_CPP=$HostVendor_CPP
535 TargetVendor_CPP=$HostVendor_CPP
537 AC_SUBST(BuildPlatform)
538 AC_SUBST(HostPlatform)
539 AC_SUBST(TargetPlatform)
540 AC_SUBST(HostPlatform_CPP)
541 AC_SUBST(BuildPlatform_CPP)
542 AC_SUBST(TargetPlatform_CPP)
544 AC_SUBST(HostArch_CPP)
545 AC_SUBST(BuildArch_CPP)
546 AC_SUBST(TargetArch_CPP)
549 AC_SUBST(HostOS_Full)
550 AC_SUBST(BuildOS_CPP)
551 AC_SUBST(TargetOS_CPP)
553 AC_SUBST(HostVendor_CPP)
554 AC_SUBST(BuildVendor_CPP)
555 AC_SUBST(TargetVendor_CPP)
559 dnl --------------------------------------------------------------
560 dnl * Calculate absolute path to build tree
561 dnl --------------------------------------------------------------
563 AC_MSG_CHECKING(for path to top of build tree)
567 dnl Remove common automounter nonsense
569 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
571 dnl Find 'hardtop_plat', the native format for 'hardtop'
572 dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes being escaped).
574 dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert /cygdrive/c/foo to c:/foo
575 dnl but we must not do that if we aren't building using Cygwin (notably msys),
576 dnl because cygpath doesn't exist. It seems that 'bash' sets OSTYPE to 'cygwin'
577 dnl or 'msys' respectively, but cygwin's 'sh' does not. So we hackily assume
578 dnl that if the shell hasn't set it to 'msys' then we must be in Cygwin. Sigh.
580 dnl The Right Thing is probably to test $BuildPlatform instead, but we are sloppy
581 dnl about setting that correctly at the moment, so we just work around for now.
583 dnl The quotes round "$(OSTYPE)" are essential, for the Cygwin-sh case where OSTYPE
585 case $HostPlatform in
586 i386-unknown-mingw32 | i386-unknown-cygwin32)
587 if test "${OSTYPE}" != "msys"
589 # convert $hardtop to a path that mingw will understand too
590 cyghardtop=${hardtop}
591 hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
592 hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
594 hardtop_plat=${hardtop}
598 hardtop_plat=${hardtop}
602 AC_SUBST(hardtop_plat)
604 AC_MSG_RESULT(${hardtop})
606 # We don't support building in directories with spaces.
608 *' '*) AC_MSG_ERROR([
609 The build system does not support building in a directory containing
610 space characters. Suggestion: move the build tree somewhere else.])
614 dnl --------------------------------------------------------------
615 dnl * Project specific configuration options
616 dnl --------------------------------------------------------------
617 dnl What follows is a bunch of options that can either be configured
618 dnl through command line options to the configure script or by
619 dnl supplying defns in the build tree's mk/build.mk. Having the option to
620 dnl use either is considered a Feature.
622 dnl ** What command to use to compile compiler sources ?
623 dnl --------------------------------------------------------------
626 [AC_HELP_STRING([--with-ghc=ARG],
627 [Use ARG as the path to GHC [default=autodetect]])],
628 [WithGhc="$withval"],
629 [if test "$GHC" = ""; then
630 AC_PATH_PROG([GHC], [ghc])
636 [AC_HELP_STRING([--with-hc=ARG],
637 [Use ARG as the path to the compiler for compiling ordinary
638 Haskell code (default= value of --with-ghc)])],
644 if test "$WithGhc" != ""; then
645 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
646 AC_SUBST(GhcVersion)dnl
647 AC_SUBST(GhcMajVersion)dnl
648 AC_SUBST(GhcMinVersion)dnl
649 AC_SUBST(GhcPatchLevel)dnl
652 AC_PATH_PROGS(NHC,nhc nhc98)
653 AC_PATH_PROG(HBC,hbc)
655 dnl ** Which gcc to use?
656 dnl --------------------------------------------------------------
658 [AC_HELP_STRING([--with-gcc=ARG],
659 [Use ARG as the path to GCC [default=autodetect]])],
660 [WhatGccIsCalled="$withval"
661 if test "x$HostPlatform" = "xi386-unknown-mingw32"
663 if test "${OSTYPE}" != "msys"
665 # Canonicalise to <drive>:/path/to/gcc
666 withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
672 [WhatGccIsCalled="gcc"]
674 AC_SUBST(WhatGccIsCalled)
676 dnl ** Booting from .hc files?
677 dnl --------------------------------------------------------------
678 AC_ARG_ENABLE(hc-boot,
679 [AC_HELP_STRING([--enable-hc-boot],
680 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
681 (This option is mostly of interest to porters.) [default=no]])],
682 [ if test x"$enableval" = x"yes"; then
690 AC_SUBST(BootingFromHc)
692 dnl ** Booting from unregisterised .hc files?
693 dnl --------------------------------------------------------------
694 AC_ARG_ENABLE(hc-boot-unregisterised,
695 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
696 [ With --enable-hc-boot, treat the intermediate .hc files as
697 unregisterised rather than registerised code.
698 (This option is mostly of interest to porters.) [default=no]])],
699 [ if test x"$enableval" = x"yes"; then
700 BootingFromUnregisterisedHc=YES
702 BootingFromUnregisterisedHc=NO
705 [BootingFromUnregisterisedHc=NO]
707 AC_SUBST(BootingFromUnregisterisedHc)
709 if test "$BootingFromHc" = "NO"; then
710 if test "$BootingFromUnregisterisedHc" = "YES"; then
711 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
715 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
716 if test "$BootingFromHc" = "NO" -a "$WithGhc" = "" -a -d "$srcdir/ghc"; then
717 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
720 dnl ** --enable-threaded-rts (not used any more)
721 dnl --------------------------------------------------------------
722 AC_ARG_ENABLE(threaded-rts,
723 [AC_HELP_STRING([--enable-threaded-rts],
724 [DEPRECATED (backwards compatibility only). [default=no]])],
725 [ if test x"$enableval" = x"yes"; then
733 AC_SUBST(ThreadedRts)
735 dnl ** Enable the construction of Win32 DLLs?
736 dnl --------------------------------------------------------------
738 dnl [ The ability to build the RTS and libraries as separate DLLs used
739 dnl to be supported, but isn't currently (updates to the RTS, compiler
740 dnl and build system would be required to bring it back again.)
741 dnl Hence, exposing it as an option is false advertisement, so better
742 dnl disable it to avoid confusion (but leave it commented-out rather
743 dnl than removed in order to remind ourselves to bring back the
744 dnl feature at some stage.) ]
746 dnl AC_ARG_ENABLE(win32-dlls,
747 dnl [ --enable-win32-dlls
748 dnl If on a Win32 platform running mingw32/cygwin, enable the
749 dnl construction of DLLs containing ghc-compiled code.
752 dnl case $HostOS_CPP in
755 dnl *) echo "Unrecognised win32 platform: $HostPlatform"
759 dnl EnableWin32DLLs=YES
761 dnl [EnableWin32DLLs=NO]
763 dnl AC_SUBST(EnableWin32DLLs)
764 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
765 dnl AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
768 dnl ** Enable the building of the ObjectIO?
769 dnl --------------------------------------------------------------
770 AC_ARG_ENABLE(objectio,
771 [AC_HELP_STRING([--enable-objectio],
772 [Build ObjectIO, a portable GUI library for Haskell. [default=no]])],
773 [ if test x"$enableval" = x"yes"; then
774 GhcLibsWithObjectIO=YES
776 GhcLibsWithObjectIO=NO
779 [GhcLibsWithObjectIO=NO]
781 AC_SUBST(GhcLibsWithObjectIO)
783 dnl ** .NET interop support?
784 dnl --------------------------------------------------------------
785 AC_ARG_ENABLE(dotnet,
786 [AC_HELP_STRING([--enable-dotnet],
787 [Build .NET interop layer. [default=no]])],
788 [ if test x"$enableval" = x"yes"; then
789 DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
795 AC_SUBST(DotnetSupport)
797 dnl --------------------------------------------------------------
798 dnl End of configure script option section
799 dnl --------------------------------------------------------------
802 dnl --------------------------------------------------------------
803 dnl * General configuration checks
804 dnl --------------------------------------------------------------
806 dnl ** Can the unix package be built?
807 dnl --------------------------------------------------------------
809 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
814 AC_SUBST([GhcLibsWithUnix])
819 dnl ** look for `perl', but only in /bin on Windows
822 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
823 if test -z "$PerlCmd"; then
824 echo "You must install the version of Perl shipped with GHC"
825 echo "(or a compatible one) in /bin."
830 AC_PATH_PROG(PerlCmd,perl)
831 if test -z "$PerlCmd"; then
832 echo "You must install perl before you can continue"
833 echo "Perhaps it is already installed, but not in your PATH?"
836 FPTOOLS_CHECK_PERL_VERSION
841 dnl ** does #! path/to/perl work? (sometimes it's too long...)
844 dnl ** check for Python
845 AC_PATH_PROG(PythonCmd,python)
847 dnl ** look for GCC and find out which version
848 dnl Figure out which C compiler to use. Gcc is preferred.
849 dnl If gcc, make sure it's at least 2.1
854 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
857 dnl ** Without optimization some INLINE trickery fails for GHCi
860 dnl ** Try to add -mno-cygwin to the C compiler options
861 FP_CHECK_FLAG([-mno-cygwin], [
862 SRC_CC_OPTS="-mno-cygwin $SRC_CC_OPTS"
863 CPPFLAGS="-mno-cygwin $CPPFLAGS"])
864 AC_SUBST(SRC_CC_OPTS)
866 dnl ** figure out how to do context diffs
869 dnl ** Find find command (for Win32's benefit)
872 dnl ** Find sort command (for the benefit of Win32 environs)
875 dnl ** figure out how to do a BSD-ish install
878 dnl If you can run configure, you certainly have /bin/sh
879 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
881 dnl ** how to invoke `ar' and `ranlib'
882 FP_PROG_AR_NEEDS_RANLIB
883 FP_PROG_AR_SUPPORTS_INPUT
885 dnl ** Check to see whether ln -s works
889 dnl ** Find the path to sed
890 AC_PATH_PROG(SedCmd,sed)
893 dnl ** check for time command
894 AC_PATH_PROG(TimeCmd,time)
897 dnl if GNU tar is named gtar, look for it first.
898 AC_PATH_PROGS(TarCmd,gtar tar,tar)
900 dnl ** check for DocBook toolchain
902 FP_DIR_DOCBOOK_XSL([/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/sgml/docbook/docbook-xsl-stylesheets* /usr/share/sgml/docbook/xsl-stylesheets* /opt/kde?/share/apps/ksgmltools2/docbook/xsl /usr/share/docbook-xsl /usr/share/sgml/docbkxsl /usr/local/share/xsl/docbook /sw/share/xml/xsl/docbook-xsl])
905 dnl ** check for ghc-pkg command
908 AC_ARG_WITH(greencard,
909 [AC_HELP_STRING([--with-greencard=ARG],
910 [Use ARG as the path to greencard [default=autodetct]])],
912 GreenCardCmd=$withval;
913 FPTOOLS_GREENCARD(3.00)
917 AC_ARG_ENABLE(src-tree-happy,
918 [AC_HELP_STRING([--enable-src-tree-happy],
919 [Build and use source tree (fptools/happy) version of Happy.
920 [default=autodetect]])],
921 [ if test x"$enableval" = x"yes"; then
929 dnl ** check for installed happy binary + version
930 dnl (don't do it if we're booting from .hc files though.)
931 if test "$BootingFromHc" = "NO"; then
935 AC_ARG_ENABLE(src-tree-haddock,
936 [AC_HELP_STRING([--enable-src-tree-haddock],
937 [Build and use source tree (fptools/haddock) version of Haddock.
938 [default=autodetect]])],
939 [ if test x"$enableval" = x"yes"; then
940 UseSrcTreeHaddock=YES
945 [UseSrcTreeHaddock=NO]
947 dnl ** check for installed haddock
950 AC_ARG_ENABLE(src-tree-alex,
951 [AC_HELP_STRING([--enable-src-tree-alex],
952 [Build and use source tree (fptools/alex) version of Alex.
953 [default=autodetect]])],
954 [ if test x"$enableval" = x"yes"; then
962 dnl ** check for installed alex binary + version
963 dnl (don't do it if we're booting from .hc files though.)
964 if test "$BootingFromHc" = "NO"; then
968 dnl --------------------------------------------------
969 dnl ### program checking section ends here ###
970 dnl --------------------------------------------------
972 dnl --------------------------------------------------
973 dnl * Platform header file and syscall feature tests
974 dnl ### checking the state of the local header files and syscalls ###
976 dnl ** check for full ANSI header (.h) files
979 dnl ** Enable large file support. NB. do this before testing the type of
980 dnl off_t, because it will affect the result of that test.
983 dnl ** check for specific header (.h) files that we are interested in
984 AC_CHECK_HEADERS([bfd.h ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/mman.h sys/resource.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h])
986 AC_CHECK_HEADER([readline/readline.h], [HaveReadlineReadlineH=YES], [HaveReadlineReadlineH=NO])
987 AC_CHECK_HEADER([readline/history.h], [HaveReadlineHistoryH=YES], [HaveReadlineHistoryH=NO])
989 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
990 GhcLibsWithReadline=YES
991 AC_DEFINE([HAVE_READLINE_HEADERS], [1], [Define to 1 if readline/readline.h and readline/history.h exist.])
993 GhcLibsWithReadline=NO
994 AC_DEFINE([HAVE_READLINE_HEADERS], [0], [Define to 1 if readline/readline.h and readline/history.h exist.])
996 AC_SUBST(GhcLibsWithReadline)
998 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
1001 dnl ** how do we get a timezone name, and UTC offset ?
1004 dnl ** do we have altzone?
1007 dnl ** do we have long longs?
1008 AC_CHECK_TYPES([long long])
1010 dnl ** what are the sizes of various types
1011 AC_CHECK_SIZEOF(char, 1)
1012 AC_CHECK_SIZEOF(double, 8)
1013 AC_CHECK_SIZEOF(float, 4)
1014 AC_CHECK_SIZEOF(int, 4)
1015 AC_CHECK_SIZEOF(long, 4)
1016 if test "$ac_cv_type_long_long" = yes; then
1017 AC_CHECK_SIZEOF(long long, 8)
1019 AC_CHECK_SIZEOF(short, 2)
1020 AC_CHECK_SIZEOF(unsigned char, 1)
1021 AC_CHECK_SIZEOF(unsigned int, 4)
1022 AC_CHECK_SIZEOF(unsigned long, 4)
1023 if test "$ac_cv_type_long_long" = yes; then
1024 AC_CHECK_SIZEOF(unsigned long long, 8)
1026 AC_CHECK_SIZEOF(unsigned short, 2)
1027 AC_CHECK_SIZEOF(void *, 4)
1029 dnl ** what are alignment constraints on various types
1030 FP_CHECK_ALIGNMENT(char)
1031 FP_CHECK_ALIGNMENT(double)
1032 FP_CHECK_ALIGNMENT(float)
1033 FP_CHECK_ALIGNMENT(int)
1034 FP_CHECK_ALIGNMENT(long)
1035 if test "$ac_cv_type_long_long" = yes; then
1036 FP_CHECK_ALIGNMENT(long long)
1038 FP_CHECK_ALIGNMENT(short)
1039 FP_CHECK_ALIGNMENT(unsigned char)
1040 FP_CHECK_ALIGNMENT(unsigned int)
1041 FP_CHECK_ALIGNMENT(unsigned long)
1042 if test "$ac_cv_type_long_long" = yes; then
1043 FP_CHECK_ALIGNMENT(unsigned long long)
1045 FP_CHECK_ALIGNMENT(unsigned short)
1046 FP_CHECK_ALIGNMENT(void *)
1048 FP_CHECK_FUNC([WinExec],
1049 [@%:@include <windows.h>], [WinExec("",0)])
1051 FP_CHECK_FUNC([GetModuleFileName],
1052 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1054 dnl ** check return type of signal handlers
1055 dnl Foo: assumes we can use prototypes.
1056 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1057 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1058 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1059 dnl #include <signal.h>
1063 dnl void (*signal (int, void (*)(int)))(int);
1066 dnl [ac_cv_type_signal_handler=void_int],
1067 dnl [ac_cv_type_signal_handler=int_void])])
1068 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1069 dnl AC_DEFINE(VOID_INT_SIGNALS)
1072 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1074 if test "$ac_cv_type_signal" = void; then
1075 AC_DEFINE([VOID_INT_SIGNALS], [1], [Define to 1 if signal handlers have type void (*)(int). Otherwise, they're assumed to have type int (*)(void).])
1078 dnl ** check for more functions
1079 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1080 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r])
1081 dnl ** For ghc/rts/gmp:
1082 AC_CHECK_FUNCS([getpagesize])
1084 dnl ** check whether this machine has gmp3 installed
1085 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1086 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
1087 HaveLibGmp=NO; LibGmp=not-installed))
1088 AC_SUBST(HaveLibGmp)
1091 dnl ** (Mac OS X only: check for GMP.framework)
1093 case $HostPlatform in
1095 AC_MSG_CHECKING([for GMP.framework])
1097 LIBS="-framework GMP"
1098 AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkGMP=YES,)
1099 if test $HaveFrameworkGMP = YES; then
1100 AC_DEFINE([HAVE_FRAMEWORK_GMP], [1], [Define to 1 if GMP.framework is installed (Mac OS X only).])
1103 AC_MSG_RESULT([$HaveFrameworkGMP])
1106 AC_SUBST(HaveFrameworkGMP)
1108 dnl ** check for mingwex library
1109 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1110 AC_SUBST(HaveLibMingwEx)
1112 if test $HaveLibMingwEx = YES ; then
1113 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1116 if test "$HaveLibGmp" = "NO"; then
1117 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1118 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1122 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1123 dnl the order of these tests matters: bfd needs liberty
1124 AC_CHECK_LIB(iberty, xmalloc)
1125 AC_CHECK_LIB(bfd, bfd_init)
1127 dnl ** check for readline, for Hugs and hslibs' Readline
1128 dnl ncurses supersedes termcap and curses, but for compatibility,
1129 dnl we have to check for all...
1130 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=YES; LibTermcap=ncurses,
1131 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=YES; LibTermcap=termcap,
1132 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=YES; LibTermcap=curses,
1133 HaveLibTermcap=NO; LibTermcap=not-installed)))
1135 if test $HaveLibTermcap = YES ; then
1136 LIBS="-l$LibTermcap $LIBS"
1137 AC_CHECK_LIB(readline, readline, HaveLibReadline=YES, HaveLibReadline=NO)
1140 if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES ; then
1141 AC_DEFINE([HAVE_READLINE_LIBS], [1], [Define to 1 if readline plus any additional libs needed for it exist.])
1142 LibsReadline="readline $LibTermcap"
1144 AC_DEFINE([HAVE_READLINE_LIBS], [0], [Define to 1 if readline plus any additional libs needed for it exist.])
1147 AC_SUBST(LibsReadline)
1149 if test "$HaveLibReadline"; then
1150 AC_CHECK_LIB(readline, rl_erase_empty_line,
1151 [AC_DEFINE([HAVE_READLINE_4], [1], [Define to 1 if readline has version >= 4.0.])],
1152 [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])])
1153 AC_CHECK_LIB(readline, rl_free_undo_list,
1154 [AC_DEFINE([HAVE_READLINE_4_2], [1], [Define to 1 if readline has version >= 4.2.])],
1155 [AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])])
1157 AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])
1158 AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])
1161 dnl ** check for math library
1162 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1163 if test x"$fp_libm_not_needed" = xdunno; then
1164 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1168 dnl ################################################################
1169 dnl Check for libraries
1170 dnl ################################################################
1172 dnl ** check whether we need -ldl to get dlopen()
1174 AC_CHECK_LIB(dl, dlopen,
1176 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1181 dnl --------------------------------------------------
1182 dnl * Miscellaneous feature tests
1183 dnl --------------------------------------------------
1185 dnl ** can we get alloca?
1188 dnl ** Working vfork?
1191 dnl ** determine whether or not const works
1194 dnl ** are we big endian?
1197 dnl ** check for leading underscores in symbol names
1198 FP_LEADING_UNDERSCORE
1200 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1204 dnl ** check for Apple-style dead-stripping support
1205 dnl (.subsections-via-symbols assembler directive)
1208 AC_MSG_CHECKING(for .subsections_via_symbols)
1209 AC_TRY_COMPILE(,[__asm__ (".subsections_via_symbols");],
1212 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1213 [Define to 1 if Apple-style dead-stripping is supported.])
1217 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[0],
1218 [Define to 1 if Apple-style dead-stripping is supported.])
1221 dnl ** check for librt
1222 AC_CHECK_LIB(rt, clock_gettime)
1223 AC_CHECK_FUNCS(clock_gettime)
1225 dnl ** check for Apple's "interesting" long double compatibility scheme
1226 AC_MSG_CHECKING(for printf$LDBLStub)
1227 AC_TRY_LINK_FUNC(printf$LSBLStub,
1230 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
1231 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1235 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
1236 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1240 AC_CONFIG_FILES([mk/config.mk])
1241 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])