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([The Glorious Glasgow Haskell Compilation System], [6.5], [glasgow-haskell-bugs@haskell.org], [ghc])
18 FP_SETUP_PROJECT_VERSION
20 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
21 AC_SUBST([release], [1])
23 # First off, a distrib sanity check..
24 AC_CONFIG_SRCDIR([mk/config.mk.in])
26 dnl * We require autoconf version 2.52
27 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
28 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
31 dnl * Declare subdirectories that have a private configure script
33 dnl After the toplevel configuration is complete, the script will recurse into
34 dnl these subdirectories if they exist. The use of a cache file makes repeated
36 AC_CONFIG_SUBDIRS([libraries])
38 # -------------------------------------------------------------------------
39 # Prepare to generate the following header files
42 AC_CONFIG_HEADER(mk/config.h)
44 # No, semi-sadly, we don't do `--srcdir'...
45 if test x"$srcdir" != 'x.' ; then
46 echo "This configuration does not support the \`--srcdir' option.."
50 dnl--------------------------------------------------------------------
51 dnl * Choose host(/target/build) platform
52 dnl--------------------------------------------------------------------
54 dnl Guess host/target/build platform(s) if necessary.
57 # "$host" defaults to "$target"
58 if test "x$host" = xNONE ; then
62 dnl ** canonicalize platform names
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)"
74 # The following will be more difficult when we *are* cross-compiling.
75 # Suitable names to slam in *_CPP are in platform.h.in.
76 # We also record the architecture, vendor, and operating system (OS)
79 alpha*-dec-osf[[12]]*)
80 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
81 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
82 BuildPlatform=alpha-dec-osf1 # hack
83 HostPlatform_CPP='alpha_dec_osf1'
88 alpha*-dec-osf[[345]]*)
89 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
90 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
91 BuildPlatform=alpha-dec-osf3 # hack
92 HostPlatform_CPP='alpha_dec_osf3'
97 alpha*-unknown-linux*)
98 HostPlatform=alpha-unknown-linux
99 TargetPlatform=alpha-unknown-linux
100 BuildPlatform=alpha-unknown-linux
101 HostPlatform_CPP='alpha_unknown_linux'
103 HostVendor_CPP='unknown'
106 alpha*-unknown-freebsd*)
107 HostPlatform=alpha-unknown-freebsd
108 TargetPlatform=alpha-unknown-freebsd
109 BuildPlatform=alpha-unknown-freebsd
110 HostPlatform_CPP='alpha_unknown_freebsd'
112 HostVendor_CPP='unknown'
115 alpha*-unknown-openbsd*)
116 HostPlatform=alpha-unknown-openbsd
117 TargetPlatform=alpha-unknown-openbsd
118 BuildPlatform=alpha-unknown-openbsd
119 HostPlatform_CPP='alpha_unknown_openbsd'
121 HostVendor_CPP='unknown'
124 amd64-*-openbsd*|x86_64-*-openbsd*)
125 HostPlatform=x86_64-unknown-openbsd
126 TargetPlatform=x86_64-unknown-openbsd
127 BuildPlatform=x86_64-unknown-openbsd
128 HostPlatform_CPP='x86_64_unknown_openbsd'
129 HostArch_CPP='x86_64'
130 HostVendor_CPP='unknown'
134 HostPlatform=x86_64-unknown-freebsd
135 TargetPlatform=x86_64-unknown-freebsd
136 BuildPlatform=x86_64-unknown-freebsd
137 HostPlatform_CPP='x86_64_unknown_freebsd'
138 HostArch_CPP='x86_64'
139 HostVendor_CPP='unknown'
143 HostPlatform=arm-unknown-linux # hack again
144 TargetPlatform=arm-unknown-linux
145 BuildPlatform=arm-unknown-linux
146 HostPlatform_CPP='arm_unknown_linux'
148 HostVendor_CPP='unknown'
152 HostPlatform=arm-unknown-openbsd
153 TargetPlatform=arm-unknown-openbsd
154 BuildPlatform=arm-unknown-openbsd
155 HostPlatform_CPP='arm_unknown_openbsd'
157 HostVendor_CPP='unknown'
161 HostPlatform=hppa-unknown-linux # hack again
162 TargetPlatform=hppa-unknown-linux
163 BuildPlatform=hppa-unknown-linux
164 HostPlatform_CPP='hppa_unknown_linux'
166 HostVendor_CPP='unknown'
170 HostPlatform=hppa-unknown-openbsd # hack again
171 TargetPlatform=hppa-unknown-openbsd
172 BuildPlatform=hppa-unknown-openbsd
173 HostPlatform_CPP='hppa_unknown_openbsd'
175 HostVendor_CPP='unknown'
179 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
180 TargetPlatform=hppa1.1-hp-hpux
181 BuildPlatform=hppa1.1-hp-hpux
182 HostPlatform_CPP='hppa1_1_hp_hpux'
183 HostArch_CPP='hppa1_1'
187 i[[3456]]86-*-linuxaout*)
188 HostPlatform=i386-unknown-linuxaout # hack again
189 TargetPlatform=i386-unknown-linuxaout
190 BuildPlatform=i386-unknown-linuxaout
191 HostPlatform_CPP='i386_unknown_linuxaout'
193 HostVendor_CPP='unknown'
194 HostOS_CPP='linuxaout'
196 i[[3456]]86-*-linux*)
197 HostPlatform=i386-unknown-linux # hack again
198 TargetPlatform=i386-unknown-linux
199 BuildPlatform=i386-unknown-linux
200 HostPlatform_CPP='i386_unknown_linux'
202 HostVendor_CPP='unknown'
205 i[[3456]]86-*-kfreebsd*-gnu)
206 HostPlatform=i386-unknown-kfreebsdgnu # hack again
207 TargetPlatform=i386-unknown-kfreebsdgnu
208 BuildPlatform=i386-unknown-kfreebsdgnu
209 HostPlatform_CPP='i386_unknown_kfreebsdgnu'
211 HostVendor_CPP='unknown'
212 HostOS_CPP='kfreebsdgnu'
214 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
215 HostPlatform=i386-unknown-freebsd # hack again
216 TargetPlatform=i386-unknown-freebsd
217 BuildPlatform=i386-unknown-freebsd
218 HostPlatform_CPP='i386_unknown_freebsd'
220 HostVendor_CPP='unknown'
223 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
224 HostPlatform=i386-unknown-freebsd2 # hack again
225 TargetPlatform=i386-unknown-freebsd2
226 BuildPlatform=i386-unknown-freebsd2
227 HostPlatform_CPP='i386_unknown_freebsd2'
229 HostVendor_CPP='unknown'
230 HostOS_CPP='freebsd2'
232 i[[3456]]86-*-netbsd*)
233 HostPlatform=i386-unknown-netbsd # hack again
234 TargetPlatform=i386-unknown-netbsd
235 BuildPlatform=i386-unknown-netbsd
236 HostPlatform_CPP='i386_unknown_netbsd'
238 HostVendor_CPP='unknown'
241 i[[3456]]86-*-openbsd*)
242 HostPlatform=i386-unknown-openbsd # hack again
243 TargetPlatform=i386-unknown-openbsd
244 BuildPlatform=i386-unknown-openbsd
245 HostPlatform_CPP='i386_unknown_openbsd'
247 HostVendor_CPP='unknown'
250 i[[3456]]86-*-solaris2*)
251 HostPlatform=i386-unknown-solaris2 # hack again
252 TargetPlatform=i386-unknown-solaris2
253 BuildPlatform=i386-unknown-solaris2
254 HostPlatform_CPP='i386_unknown_solaris2'
256 HostVendor_CPP='unknown'
257 HostOS_CPP='solaris2'
259 i[[3456]]86-*-cygwin*)
260 HostPlatform=i386-unknown-cygwin32 # hack again
261 TargetPlatform=i386-unknown-cygwin32
262 BuildPlatform=i386-unknown-cygwin32
263 HostPlatform_CPP='i386_unknown_cygwin32'
265 HostVendor_CPP='unknown'
266 HostOS_CPP='cygwin32'
269 i[[3456]]86-*-mingw32*)
270 HostPlatform=i386-unknown-mingw32 # hack again
271 TargetPlatform=i386-unknown-mingw32
272 BuildPlatform=i386-unknown-mingw32
273 HostPlatform_CPP='i386_unknown_mingw32'
275 HostVendor_CPP='unknown'
279 i[[3456]]86-apple-darwin*)
280 HostPlatform=i386-apple-darwin
281 TargetPlatform=i386-apple-darwin #hack
282 BuildPlatform=i386-apple-darwin #hack
283 HostPlatform_CPP='i386_apple_darwin'
285 HostVendor_CPP='apple'
289 HostPlatform=i386-unknown-gnu
290 TargetPlatform=i386-unknown-gnu
291 BuildPlatform=i386-unknown-gnu
292 HostPlatform_CPP=i386_unknown_gnu
294 HostVendor_CPP=unknown
298 HostPlatform=ia64-unknown-linux # hack again
299 TargetPlatform=ia64-unknown-linux
300 BuildPlatform=ia64-unknown-linux
301 HostPlatform_CPP='ia64_unknown_linux'
303 HostVendor_CPP='unknown'
307 HostPlatform=x86_64-unknown-linux
308 TargetPlatform=x86_64-unknown-linux
309 BuildPlatform=x86_64-unknown-linux
310 HostPlatform_CPP='x86_64_unknown_linux'
311 HostArch_CPP='x86_64'
312 HostVendor_CPP='unknown'
316 HostPlatform=m68k-unknown-linux # hack again
317 TargetPlatform=m68k-unknown-linux
318 BuildPlatform=m68k-unknown-linux
319 HostPlatform_CPP='m68k_unknown_linux'
321 HostVendor_CPP='unknown'
325 HostPlatform_CPP='m68k_next_nextstep2'
327 HostVendor_CPP='next'
328 HostOS_CPP='nextstep2'
331 HostPlatform_CPP='m68k_next_nextstep3'
333 HostVendor_CPP='next'
334 HostOS_CPP='nextstep3'
336 i[[3456]]86-next-nextstep3)
337 HostPlatform=i386-next-nextstep3 # hack again
338 TargetPlatform=i386-next-nextstep3
339 BuildPlatform=i386-next-nextstep3
340 HostPlatform_CPP='i386_next_nextstep3'
342 HostVendor_CPP='next'
343 HostOS_CPP='nextstep3'
346 HostPlatform=m68k-unknown-openbsd
347 TargetPlatform=m68k-unknown-openbsd
348 BuildPlatform=m68k-unknown-openbsd
349 HostPlatform_CPP='m68k_unknown_openbsd'
351 HostVendor_CPP='unknown'
355 HostPlatform=m68k-unknown-netbsd
356 TargetPlatform=m68k-unknown-netbsd
357 BuildPlatform=m68k-unknown-netbsd
358 HostPlatform_CPP='m68k_unknown_netbsd'
360 HostVendor_CPP='unknown'
364 HostPlatform=m68k-sun-sunos4
365 TargetPlatform=m68k-sun-sunos4 #hack
366 BuildPlatform=m68k-sun-sunos4 #hack
367 HostPlatform_CPP='m68k_sun_sunos4'
373 HostPlatform=m88k-unknown-openbsd
374 TargetPlatform=m88k-unknown-openbsd
375 BuildPlatform=m88k-unknown-openbsd
376 HostPlatform_CPP='m88k_unknown_openbsd'
378 HostVendor_CPP='unknown'
382 HostPlatform=mips-unknown-linux # hack again
383 TargetPlatform=mips-unknown-linux
384 BuildPlatform=mips-unknown-linux
385 HostPlatform_CPP='mips_unknown_linux'
387 HostVendor_CPP='unknown'
391 HostPlatform=mipsel-unknown-linux # hack again
392 TargetPlatform=mipsel-unknown-linux
393 BuildPlatform=mipsel-unknown-linux
394 HostPlatform_CPP='mipsel_unknown_linux'
395 HostArch_CPP='mipsel'
396 HostVendor_CPP='unknown'
400 HostPlatform_CPP='mips_dec_ultrix'
401 HostArch_CPP='mipsel' # NB a little different
406 HostPlatform=mips-sgi-irix
407 TargetPlatform=mips-sgi-irix #hack
408 BuildPlatform=mips-sgi-irix #hack
409 HostPlatform_CPP='mips_sgi_irix'
410 HostArch_CPP='mipseb' # NB a little different
415 HostPlatform=rs6000-ibm-aix
416 TargetPlatform=rs6000-ibm-aix #hack
417 BuildPlatform=rs6000-ibm-aix #hack
418 HostPlatform_CPP='rs6000_ibm_aix'
419 HostArch_CPP='rs6000'
424 HostPlatform=powerpc-ibm-aix
425 TargetPlatform=powerpc-ibm-aix #hack
426 BuildPlatform=powerpc-ibm-aix #hack
427 HostPlatform_CPP='powerpc_ibm_aix'
428 HostArch_CPP='powerpc'
432 powerpc-apple-darwin*)
433 HostPlatform=powerpc-apple-darwin
434 TargetPlatform=powerpc-apple-darwin #hack
435 BuildPlatform=powerpc-apple-darwin #hack
436 HostPlatform_CPP='powerpc_apple_darwin'
437 HostArch_CPP='powerpc'
438 HostVendor_CPP='apple'
441 powerpc-unknown-linux*)
442 HostPlatform=powerpc-unknown-linux
443 TargetPlatform=powerpc-unknown-linux
444 BuildPlatform=powerpc-unknown-linux
445 HostPlatform_CPP='powerpc_unknown_linux'
446 HostArch_CPP='powerpc'
447 HostVendor_CPP='unknown'
450 powerpc-unknown-openbsd*)
451 HostPlatform=powerpc-unknown-openbsd
452 TargetPlatform=powerpc-unknown-openbsd
453 BuildPlatform=powerpc-unknown-openbsd
454 HostPlatform_CPP='powerpc_unknown_openbsd'
455 HostArch_CPP='powerpc'
456 HostVendor_CPP='unknown'
459 powerpc64-unknown-linux*)
460 HostPlatform=powerpc64-unknown-linux
461 TargetPlatform=powerpc64-unknown-linux
462 BuildPlatform=powerpc64-unknown-linux
463 HostPlatform_CPP='powerpc64_unknown_linux'
464 HostArch_CPP='powerpc64'
465 HostVendor_CPP='unknown'
470 HostPlatform=s390-ibm-linux
471 TargetPlatform=s390-ibm-linux #hack
472 BuildPlatform=s390-ibm-linux #hack
473 HostPlatform_CPP='s390_ibm_linux'
479 HostPlatform=sparc-sun-sunos4
480 TargetPlatform=sparc-sun-sunos4 #hack
481 BuildPlatform=sparc-sun-sunos4 #hack
482 HostPlatform_CPP='sparc_sun_sunos4'
488 HostPlatform=sparc-sun-solaris2
489 TargetPlatform=sparc-sun-solaris2 #hack
490 BuildPlatform=sparc-sun-solaris2 #hack
491 HostPlatform_CPP='sparc_sun_solaris2'
494 HostOS_CPP='solaris2'
497 HostPlatform=sparc-unknown-linux
498 TargetPlatform=sparc-unknown-linux
499 BuildPlatform=sparc-unknown-linux
500 HostPlatform_CPP='sparc_unknown_linux'
502 HostVendor_CPP='unknown'
506 HostPlatform=sparc-unknown-openbsd
507 TargetPlatform=sparc-unknown-openbsd
508 BuildPlatform=sparc-unknown-openbsd
509 HostPlatform_CPP='sparc_unknown_openbsd'
511 HostVendor_CPP='unknown'
515 HostPlatform=sparc64-unknown-openbsd
516 TargetPlatform=sparc64-unknown-openbsd
517 BuildPlatform=sparc64-unknown-openbsd
518 HostPlatform_CPP='sparc64_unknown_openbsd'
519 HostArch_CPP='sparc64'
520 HostVendor_CPP='unknown'
524 HostPlatform=vax-unknown-openbsd
525 TargetPlatform=vax-unknown-openbsd
526 BuildPlatform=vax-unknown-openbsd
527 HostPlatform_CPP='vax_unknown_openbsd'
529 HostVendor_CPP='unknown'
533 echo "Unrecognised platform: $HostPlatform"
537 echo "Canonicalised to: $HostPlatform"
538 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
539 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
541 BuildPlatform_CPP=$HostPlatform_CPP
542 TargetPlatform_CPP=$HostPlatform_CPP
543 BuildArch_CPP=$HostArch_CPP
544 TargetArch_CPP=$HostArch_CPP
545 BuildOS_CPP=$HostOS_CPP
547 TargetOS_CPP=$HostOS_CPP
548 BuildVendor_CPP=$HostVendor_CPP
549 TargetVendor_CPP=$HostVendor_CPP
551 AC_SUBST(BuildPlatform)
552 AC_SUBST(HostPlatform)
553 AC_SUBST(TargetPlatform)
554 AC_SUBST(HostPlatform_CPP)
555 AC_SUBST(BuildPlatform_CPP)
556 AC_SUBST(TargetPlatform_CPP)
558 AC_SUBST(HostArch_CPP)
559 AC_SUBST(BuildArch_CPP)
560 AC_SUBST(TargetArch_CPP)
563 AC_SUBST(HostOS_Full)
564 AC_SUBST(BuildOS_CPP)
565 AC_SUBST(TargetOS_CPP)
567 AC_SUBST(HostVendor_CPP)
568 AC_SUBST(BuildVendor_CPP)
569 AC_SUBST(TargetVendor_CPP)
573 dnl --------------------------------------------------------------
574 dnl * Calculate absolute path to build tree
575 dnl --------------------------------------------------------------
577 AC_MSG_CHECKING(for path to top of build tree)
581 dnl Remove common automounter nonsense
583 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
585 dnl Find 'hardtop_plat', the native format for 'hardtop'
586 dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes
589 dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert
590 dnl /cygdrive/c/foo to c:/foo but we must not do that if we
591 dnl aren't building using Cygwin (notably msys), because
592 dnl cygpath doesn't exist. It seems that 'bash' sets
593 dnl OSTYPE to 'cygwin' or 'msys' respectively, but cygwin's
594 dnl 'sh' does not. So we hackily assume that if the shell
595 dnl hasn't set it to 'msys' then we must be in Cygwin.
598 dnl The Right Thing is probably to test $BuildPlatform
599 dnl instead, but we are sloppy about setting that correctly
600 dnl at the moment, so we just work around for now.
602 dnl The quotes round "$(OSTYPE)" are essential, for the
603 dnl Cygwin-sh case where OSTYPE is not set.
604 case $HostPlatform in
605 i386-unknown-mingw32 | i386-unknown-cygwin32)
606 if test "${OSTYPE}" != "msys"
608 # convert $hardtop to a path that mingw will understand too
609 cyghardtop=${hardtop}
610 hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
611 hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
613 hardtop_plat=${hardtop}
617 hardtop_plat=${hardtop}
621 AC_SUBST(hardtop_plat)
623 AC_MSG_RESULT(${hardtop})
625 # We don't support building in directories with spaces.
627 *' '*) AC_MSG_ERROR([
628 The build system does not support building in a directory containing
629 space characters. Suggestion: move the build tree somewhere else.])
633 dnl --------------------------------------------------------------
634 dnl * Project specific configuration options
635 dnl --------------------------------------------------------------
636 dnl What follows is a bunch of options that can either be configured
637 dnl through command line options to the configure script or by
638 dnl supplying defns in the build tree's mk/build.mk. Having the option to
639 dnl use either is considered a Feature.
641 dnl ** What command to use to compile compiler sources ?
642 dnl --------------------------------------------------------------
645 [AC_HELP_STRING([--with-ghc=ARG],
646 [Use ARG as the path to GHC [default=autodetect]])],
647 [WithGhc="$withval"],
648 [if test "$GHC" = ""; then
649 AC_PATH_PROG([GHC], [ghc])
655 [AC_HELP_STRING([--with-hc=ARG],
656 [Use ARG as the path to the compiler for compiling ordinary
657 Haskell code (default= value of --with-ghc)])],
663 if test "$WithGhc" != ""; then
664 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
665 AC_SUBST(GhcVersion)dnl
666 AC_SUBST(GhcMajVersion)dnl
667 AC_SUBST(GhcMinVersion)dnl
668 AC_SUBST(GhcPatchLevel)dnl
671 # Check whether this GHC has readline installed
674 AC_PATH_PROGS(NHC,nhc nhc98)
675 AC_PATH_PROG(HBC,hbc)
677 dnl ** Which gcc to use?
678 dnl --------------------------------------------------------------
680 [AC_HELP_STRING([--with-gcc=ARG],
681 [Use ARG as the path to GCC [default=autodetect]])],
682 [WhatGccIsCalled="$withval"
683 if test "x$HostPlatform" = "xi386-unknown-mingw32"
685 if test "${OSTYPE}" != "msys"
687 # Canonicalise to <drive>:/path/to/gcc
688 withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
694 [WhatGccIsCalled="gcc"]
696 AC_SUBST(WhatGccIsCalled)
698 dnl ** Booting from .hc files?
699 dnl --------------------------------------------------------------
700 AC_ARG_ENABLE(hc-boot,
701 [AC_HELP_STRING([--enable-hc-boot],
702 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
703 (This option is mostly of interest to porters.) [default=no]])],
704 [ if test x"$enableval" = x"yes"; then
712 AC_SUBST(BootingFromHc)
714 dnl ** Booting from unregisterised .hc files?
715 dnl --------------------------------------------------------------
716 AC_ARG_ENABLE(hc-boot-unregisterised,
717 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
718 [ With --enable-hc-boot, treat the intermediate .hc files as
719 unregisterised rather than registerised code.
720 (This option is mostly of interest to porters.) [default=no]])],
721 [ if test x"$enableval" = x"yes"; then
722 BootingFromUnregisterisedHc=YES
724 BootingFromUnregisterisedHc=NO
727 [BootingFromUnregisterisedHc=NO]
729 AC_SUBST(BootingFromUnregisterisedHc)
731 if test "$BootingFromHc" = "NO"; then
732 if test "$BootingFromUnregisterisedHc" = "YES"; then
733 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
737 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
738 if test "$BootingFromHc" = "NO" -a "$WithGhc" = "" -a -d "$srcdir/compiler"; then
739 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
742 dnl ** Enable the construction of Win32 DLLs?
743 dnl --------------------------------------------------------------
745 dnl [ The ability to build the RTS and libraries as separate DLLs used
746 dnl to be supported, but isn't currently (updates to the RTS, compiler
747 dnl and build system would be required to bring it back again.)
748 dnl Hence, exposing it as an option is false advertisement, so better
749 dnl disable it to avoid confusion (but leave it commented-out rather
750 dnl than removed in order to remind ourselves to bring back the
751 dnl feature at some stage.) ]
753 dnl AC_ARG_ENABLE(win32-dlls,
754 dnl [ --enable-win32-dlls
755 dnl If on a Win32 platform running mingw32/cygwin, enable the
756 dnl construction of DLLs containing ghc-compiled code.
759 dnl case $HostOS_CPP in
762 dnl *) echo "Unrecognised win32 platform: $HostPlatform"
766 dnl EnableWin32DLLs=YES
768 dnl [EnableWin32DLLs=NO]
770 dnl AC_SUBST(EnableWin32DLLs)
771 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
772 dnl AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
775 dnl ** Enable the building of the ObjectIO?
776 dnl --------------------------------------------------------------
777 AC_ARG_ENABLE(objectio,
778 [AC_HELP_STRING([--enable-objectio],
779 [Build ObjectIO, a portable GUI library for Haskell. [default=no]])],
780 [ if test x"$enableval" = x"yes"; then
781 GhcLibsWithObjectIO=YES
783 GhcLibsWithObjectIO=NO
786 [GhcLibsWithObjectIO=NO]
788 AC_SUBST(GhcLibsWithObjectIO)
790 dnl ** .NET interop support?
791 dnl --------------------------------------------------------------
792 AC_ARG_ENABLE(dotnet,
793 [AC_HELP_STRING([--enable-dotnet],
794 [Build .NET interop layer. [default=no]])],
795 [ if test x"$enableval" = x"yes"; then
796 DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
802 AC_SUBST(DotnetSupport)
804 dnl --------------------------------------------------------------
805 dnl End of configure script option section
806 dnl --------------------------------------------------------------
809 dnl --------------------------------------------------------------
810 dnl * General configuration checks
811 dnl --------------------------------------------------------------
813 dnl ** Can the unix package be built?
814 dnl --------------------------------------------------------------
816 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
821 AC_SUBST([GhcLibsWithUnix])
826 dnl ** look for `perl', but only in /bin on Windows
829 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
830 if test -z "$PerlCmd"; then
831 echo "You must install the version of Perl shipped with GHC"
832 echo "(or a compatible one) in /bin."
837 AC_PATH_PROG(PerlCmd,perl)
838 if test -z "$PerlCmd"; then
839 echo "You must install perl before you can continue"
840 echo "Perhaps it is already installed, but not in your PATH?"
843 FPTOOLS_CHECK_PERL_VERSION
848 dnl ** does #! path/to/perl work? (sometimes it's too long...)
851 dnl ** check for Python
852 AC_PATH_PROG(PythonCmd,python)
854 dnl ** look for GCC and find out which version
855 dnl Figure out which C compiler to use. Gcc is preferred.
856 dnl If gcc, make sure it's at least 2.1
860 FP_GCC_NEEDS_NO_OMIT_LFPTR
861 FP_GCC_HAS_NO_UNIT_AT_A_TIME
863 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
866 dnl ** Without optimization some INLINE trickery fails for GHCi
869 dnl ** Try to add -mno-cygwin to the C compiler options
870 FP_CHECK_FLAG([-mno-cygwin], [
871 SRC_CC_OPTS="-mno-cygwin $SRC_CC_OPTS"
872 CPPFLAGS="-mno-cygwin $CPPFLAGS"])
873 AC_SUBST(SRC_CC_OPTS)
875 dnl ** figure out how to do context diffs
878 dnl ** Find find command (for Win32's benefit)
881 dnl ** Find sort command (for the benefit of Win32 environs)
884 dnl ** figure out how to do a BSD-ish install
887 dnl If you can run configure, you certainly have /bin/sh
888 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
890 dnl ** how to invoke `ar' and `ranlib'
891 FP_PROG_AR_NEEDS_RANLIB
892 FP_PROG_AR_SUPPORTS_INPUT
894 dnl ** Check to see whether ln -s works
898 dnl ** Find the path to sed
899 AC_PATH_PROG(SedCmd,sed)
902 dnl ** check for time command
903 AC_PATH_PROG(TimeCmd,time)
906 dnl if GNU tar is named gtar, look for it first.
907 AC_PATH_PROGS(TarCmd,gtar tar,tar)
909 dnl ** check for DocBook toolchain
911 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])
914 dnl ** check for ghc-pkg command
917 AC_ARG_WITH(greencard,
918 [AC_HELP_STRING([--with-greencard=ARG],
919 [Use ARG as the path to greencard [default=autodetct]])],
921 GreenCardCmd=$withval;
922 FPTOOLS_GREENCARD(3.00)
926 dnl ** check for installed happy binary + version
927 dnl (don't do it if we're booting from .hc files though.)
928 if test "$BootingFromHc" = "NO"; then
932 dnl ** check for installed haddock
935 dnl ** check for installed alex binary + version
936 dnl (don't do it if we're booting from .hc files though.)
937 if test "$BootingFromHc" = "NO"; then
941 dnl --------------------------------------------------
942 dnl ### program checking section ends here ###
943 dnl --------------------------------------------------
945 dnl --------------------------------------------------
946 dnl * Platform header file and syscall feature tests
947 dnl ### checking the state of the local header files and syscalls ###
949 dnl ** check for full ANSI header (.h) files
952 dnl ** Enable large file support. NB. do this before testing the type of
953 dnl off_t, because it will affect the result of that test.
956 dnl ** check for specific header (.h) files that we are interested in
957 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])
959 AC_CHECK_HEADER([readline/readline.h], [HaveReadlineReadlineH=YES], [HaveReadlineReadlineH=NO])
960 AC_CHECK_HEADER([readline/history.h], [HaveReadlineHistoryH=YES], [HaveReadlineHistoryH=NO])
962 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
963 GhcLibsWithReadline=YES
964 AC_DEFINE([HAVE_READLINE_HEADERS], [1], [Define to 1 if readline/readline.h and readline/history.h exist.])
966 GhcLibsWithReadline=NO
967 AC_DEFINE([HAVE_READLINE_HEADERS], [0], [Define to 1 if readline/readline.h and readline/history.h exist.])
969 AC_SUBST(GhcLibsWithReadline)
971 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
974 dnl ** do we have long longs?
975 AC_CHECK_TYPES([long long])
977 dnl ** what are the sizes of various types
978 AC_CHECK_SIZEOF(char, 1)
979 AC_CHECK_SIZEOF(double, 8)
980 AC_CHECK_SIZEOF(float, 4)
981 AC_CHECK_SIZEOF(int, 4)
982 AC_CHECK_SIZEOF(long, 4)
983 if test "$ac_cv_type_long_long" = yes; then
984 AC_CHECK_SIZEOF(long long, 8)
986 AC_CHECK_SIZEOF(short, 2)
987 AC_CHECK_SIZEOF(unsigned char, 1)
988 AC_CHECK_SIZEOF(unsigned int, 4)
989 AC_CHECK_SIZEOF(unsigned long, 4)
990 if test "$ac_cv_type_long_long" = yes; then
991 AC_CHECK_SIZEOF(unsigned long long, 8)
993 AC_CHECK_SIZEOF(unsigned short, 2)
994 AC_CHECK_SIZEOF(void *, 4)
996 dnl ** what are alignment constraints on various types
997 FP_CHECK_ALIGNMENT(char)
998 FP_CHECK_ALIGNMENT(double)
999 FP_CHECK_ALIGNMENT(float)
1000 FP_CHECK_ALIGNMENT(int)
1001 FP_CHECK_ALIGNMENT(long)
1002 if test "$ac_cv_type_long_long" = yes; then
1003 FP_CHECK_ALIGNMENT(long long)
1005 FP_CHECK_ALIGNMENT(short)
1006 FP_CHECK_ALIGNMENT(unsigned char)
1007 FP_CHECK_ALIGNMENT(unsigned int)
1008 FP_CHECK_ALIGNMENT(unsigned long)
1009 if test "$ac_cv_type_long_long" = yes; then
1010 FP_CHECK_ALIGNMENT(unsigned long long)
1012 FP_CHECK_ALIGNMENT(unsigned short)
1013 FP_CHECK_ALIGNMENT(void *)
1015 FP_CHECK_FUNC([WinExec],
1016 [@%:@include <windows.h>], [WinExec("",0)])
1018 FP_CHECK_FUNC([GetModuleFileName],
1019 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1021 dnl ** check return type of signal handlers
1022 dnl Foo: assumes we can use prototypes.
1023 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1024 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1025 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1026 dnl #include <signal.h>
1030 dnl void (*signal (int, void (*)(int)))(int);
1033 dnl [ac_cv_type_signal_handler=void_int],
1034 dnl [ac_cv_type_signal_handler=int_void])])
1035 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1036 dnl AC_DEFINE(VOID_INT_SIGNALS)
1039 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1041 if test "$ac_cv_type_signal" = void; then
1042 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).])
1045 dnl ** check for more functions
1046 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1047 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r])
1048 dnl ** For ghc/rts/gmp:
1049 AC_CHECK_FUNCS([getpagesize])
1051 dnl ** check whether this machine has gmp3 installed
1052 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1053 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
1054 HaveLibGmp=NO; LibGmp=not-installed))
1055 AC_SUBST(HaveLibGmp)
1058 dnl ** (Mac OS X only: check for GMP.framework)
1060 case $HostPlatform in
1062 AC_MSG_CHECKING([for GMP.framework])
1064 LIBS="-framework GMP"
1065 AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkGMP=YES,)
1066 if test $HaveFrameworkGMP = YES; then
1067 AC_DEFINE([HAVE_FRAMEWORK_GMP], [1], [Define to 1 if GMP.framework is installed (Mac OS X only).])
1070 AC_MSG_RESULT([$HaveFrameworkGMP])
1073 AC_SUBST(HaveFrameworkGMP)
1075 dnl ** check for mingwex library
1076 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1077 AC_SUBST(HaveLibMingwEx)
1079 if test $HaveLibMingwEx = YES ; then
1080 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1083 if test "$HaveLibGmp" = "NO"; then
1084 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1085 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1089 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1090 dnl the order of these tests matters: bfd needs liberty
1091 AC_CHECK_LIB(iberty, xmalloc)
1092 AC_CHECK_LIB(bfd, bfd_init)
1094 dnl ** check for math library
1095 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1096 if test x"$fp_libm_not_needed" = xdunno; then
1097 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1101 dnl ################################################################
1102 dnl Check for libraries
1103 dnl ################################################################
1105 dnl ** check whether we need -ldl to get dlopen()
1107 AC_CHECK_LIB(dl, dlopen,
1109 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1114 dnl --------------------------------------------------
1115 dnl * Miscellaneous feature tests
1116 dnl --------------------------------------------------
1118 dnl ** can we get alloca?
1121 dnl ** Working vfork?
1124 dnl ** determine whether or not const works
1127 dnl ** are we big endian?
1130 dnl ** check for leading underscores in symbol names
1131 FP_LEADING_UNDERSCORE
1133 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1137 dnl ** check for Apple-style dead-stripping support
1138 dnl (.subsections-via-symbols assembler directive)
1141 AC_MSG_CHECKING(for .subsections_via_symbols)
1143 [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
1145 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1146 [Define to 1 if Apple-style dead-stripping is supported.])
1148 [AC_MSG_RESULT(no)])
1150 dnl *** check for GNU non-executable stack note support (ELF only)
1151 dnl (.section .note.GNU-stack,"",@progbits)
1153 AC_MSG_CHECKING(for GNU non-executable stack support)
1155 [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
1157 AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
1158 [Define to 1 if GNU non-executable stack notes are supported.])
1160 [AC_MSG_RESULT(no)])
1162 dnl ** check for librt
1163 AC_CHECK_LIB(rt, clock_gettime)
1164 AC_CHECK_FUNCS(clock_gettime)
1166 dnl ** check for Apple's "interesting" long double compatibility scheme
1167 AC_MSG_CHECKING(for printf$LDBLStub)
1168 AC_TRY_LINK_FUNC(printf$LSBLStub,
1171 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
1172 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1176 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
1177 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1181 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
1182 if test -n "$GTK_CONFIG"; then
1183 if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
1184 GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
1186 AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
1190 AC_SUBST([GTK_CONFIG])
1192 AC_CONFIG_FILES([mk/config.mk ghc.spec docs/users_guide/ug-book.xml])
1193 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])