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.7], [glasgow-haskell-bugs@haskell.org], [ghc])
18 if test ! -f mk/config.h.in; then
19 echo "mk/config.h.in doesn't exist: perhaps you haven't run 'autoreconf'?"
23 FP_SETUP_PROJECT_VERSION
25 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
26 AC_SUBST([release], [1])
28 # First off, a distrib sanity check..
29 AC_CONFIG_SRCDIR([mk/config.mk.in])
31 dnl * We require autoconf version 2.52
32 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
33 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
36 dnl * Declare subdirectories that have a private configure script
38 dnl After the toplevel configuration is complete, the script will recurse into
39 dnl these subdirectories if they exist. The use of a cache file makes repeated
41 AC_CONFIG_SUBDIRS([libraries])
43 # -------------------------------------------------------------------------
44 # Prepare to generate the following header files
47 AC_CONFIG_HEADER(mk/config.h)
49 # No, semi-sadly, we don't do `--srcdir'...
50 if test x"$srcdir" != 'x.' ; then
51 echo "This configuration does not support the \`--srcdir' option.."
55 dnl--------------------------------------------------------------------
56 dnl * Choose host(/target/build) platform
57 dnl--------------------------------------------------------------------
59 dnl Guess host/target/build platform(s) if necessary.
62 # "$host" defaults to "$target"
63 if test "x$host" = xNONE ; then
67 dnl ** canonicalize platform names
68 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
69 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
70 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
72 if test x"$TargetPlatform" != x"$HostPlatform" ; then
73 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
79 # The following will be more difficult when we *are* cross-compiling.
80 # Suitable names to slam in *_CPP are in platform.h.in.
81 # We also record the architecture, vendor, and operating system (OS)
84 alpha*-dec-osf[[12]]*)
85 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
86 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
87 BuildPlatform=alpha-dec-osf1 # hack
88 HostPlatform_CPP='alpha_dec_osf1'
93 alpha*-dec-osf[[345]]*)
94 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
95 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
96 BuildPlatform=alpha-dec-osf3 # hack
97 HostPlatform_CPP='alpha_dec_osf3'
102 alpha*-unknown-linux*)
103 HostPlatform=alpha-unknown-linux
104 TargetPlatform=alpha-unknown-linux
105 BuildPlatform=alpha-unknown-linux
106 HostPlatform_CPP='alpha_unknown_linux'
108 HostVendor_CPP='unknown'
111 alpha*-unknown-freebsd*)
112 HostPlatform=alpha-unknown-freebsd
113 TargetPlatform=alpha-unknown-freebsd
114 BuildPlatform=alpha-unknown-freebsd
115 HostPlatform_CPP='alpha_unknown_freebsd'
117 HostVendor_CPP='unknown'
120 alpha*-unknown-openbsd*)
121 HostPlatform=alpha-unknown-openbsd
122 TargetPlatform=alpha-unknown-openbsd
123 BuildPlatform=alpha-unknown-openbsd
124 HostPlatform_CPP='alpha_unknown_openbsd'
126 HostVendor_CPP='unknown'
129 amd64-*-openbsd*|x86_64-*-openbsd*)
130 HostPlatform=x86_64-unknown-openbsd
131 TargetPlatform=x86_64-unknown-openbsd
132 BuildPlatform=x86_64-unknown-openbsd
133 HostPlatform_CPP='x86_64_unknown_openbsd'
134 HostArch_CPP='x86_64'
135 HostVendor_CPP='unknown'
139 HostPlatform=x86_64-unknown-freebsd
140 TargetPlatform=x86_64-unknown-freebsd
141 BuildPlatform=x86_64-unknown-freebsd
142 HostPlatform_CPP='x86_64_unknown_freebsd'
143 HostArch_CPP='x86_64'
144 HostVendor_CPP='unknown'
148 HostPlatform=arm-unknown-linux # hack again
149 TargetPlatform=arm-unknown-linux
150 BuildPlatform=arm-unknown-linux
151 HostPlatform_CPP='arm_unknown_linux'
153 HostVendor_CPP='unknown'
157 HostPlatform=arm-unknown-openbsd
158 TargetPlatform=arm-unknown-openbsd
159 BuildPlatform=arm-unknown-openbsd
160 HostPlatform_CPP='arm_unknown_openbsd'
162 HostVendor_CPP='unknown'
166 HostPlatform=hppa-unknown-linux # hack again
167 TargetPlatform=hppa-unknown-linux
168 BuildPlatform=hppa-unknown-linux
169 HostPlatform_CPP='hppa_unknown_linux'
171 HostVendor_CPP='unknown'
175 HostPlatform=hppa-unknown-openbsd # hack again
176 TargetPlatform=hppa-unknown-openbsd
177 BuildPlatform=hppa-unknown-openbsd
178 HostPlatform_CPP='hppa_unknown_openbsd'
180 HostVendor_CPP='unknown'
184 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
185 TargetPlatform=hppa1.1-hp-hpux
186 BuildPlatform=hppa1.1-hp-hpux
187 HostPlatform_CPP='hppa1_1_hp_hpux'
188 HostArch_CPP='hppa1_1'
192 i[[3456]]86-*-linuxaout*)
193 HostPlatform=i386-unknown-linuxaout # hack again
194 TargetPlatform=i386-unknown-linuxaout
195 BuildPlatform=i386-unknown-linuxaout
196 HostPlatform_CPP='i386_unknown_linuxaout'
198 HostVendor_CPP='unknown'
199 HostOS_CPP='linuxaout'
201 i[[3456]]86-*-linux*)
202 HostPlatform=i386-unknown-linux # hack again
203 TargetPlatform=i386-unknown-linux
204 BuildPlatform=i386-unknown-linux
205 HostPlatform_CPP='i386_unknown_linux'
207 HostVendor_CPP='unknown'
210 i[[3456]]86-*-kfreebsd*-gnu)
211 HostPlatform=i386-unknown-kfreebsdgnu # hack again
212 TargetPlatform=i386-unknown-kfreebsdgnu
213 BuildPlatform=i386-unknown-kfreebsdgnu
214 HostPlatform_CPP='i386_unknown_kfreebsdgnu'
216 HostVendor_CPP='unknown'
217 HostOS_CPP='kfreebsdgnu'
219 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
220 HostPlatform=i386-unknown-freebsd # hack again
221 TargetPlatform=i386-unknown-freebsd
222 BuildPlatform=i386-unknown-freebsd
223 HostPlatform_CPP='i386_unknown_freebsd'
225 HostVendor_CPP='unknown'
228 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
229 HostPlatform=i386-unknown-freebsd2 # hack again
230 TargetPlatform=i386-unknown-freebsd2
231 BuildPlatform=i386-unknown-freebsd2
232 HostPlatform_CPP='i386_unknown_freebsd2'
234 HostVendor_CPP='unknown'
235 HostOS_CPP='freebsd2'
237 i[[3456]]86-*-netbsd*)
238 HostPlatform=i386-unknown-netbsd # hack again
239 TargetPlatform=i386-unknown-netbsd
240 BuildPlatform=i386-unknown-netbsd
241 HostPlatform_CPP='i386_unknown_netbsd'
243 HostVendor_CPP='unknown'
246 i[[3456]]86-*-openbsd*)
247 HostPlatform=i386-unknown-openbsd # hack again
248 TargetPlatform=i386-unknown-openbsd
249 BuildPlatform=i386-unknown-openbsd
250 HostPlatform_CPP='i386_unknown_openbsd'
252 HostVendor_CPP='unknown'
255 i[[3456]]86-*-solaris2*)
256 HostPlatform=i386-unknown-solaris2 # hack again
257 TargetPlatform=i386-unknown-solaris2
258 BuildPlatform=i386-unknown-solaris2
259 HostPlatform_CPP='i386_unknown_solaris2'
261 HostVendor_CPP='unknown'
262 HostOS_CPP='solaris2'
264 i[[3456]]86-*-cygwin*)
265 HostPlatform=i386-unknown-cygwin32 # hack again
266 TargetPlatform=i386-unknown-cygwin32
267 BuildPlatform=i386-unknown-cygwin32
268 HostPlatform_CPP='i386_unknown_cygwin32'
270 HostVendor_CPP='unknown'
271 HostOS_CPP='cygwin32'
274 i[[3456]]86-*-mingw32*)
275 HostPlatform=i386-unknown-mingw32 # hack again
276 TargetPlatform=i386-unknown-mingw32
277 BuildPlatform=i386-unknown-mingw32
278 HostPlatform_CPP='i386_unknown_mingw32'
280 HostVendor_CPP='unknown'
284 i[[3456]]86-apple-darwin*)
285 HostPlatform=i386-apple-darwin
286 TargetPlatform=i386-apple-darwin #hack
287 BuildPlatform=i386-apple-darwin #hack
288 HostPlatform_CPP='i386_apple_darwin'
290 HostVendor_CPP='apple'
294 HostPlatform=i386-unknown-gnu
295 TargetPlatform=i386-unknown-gnu
296 BuildPlatform=i386-unknown-gnu
297 HostPlatform_CPP=i386_unknown_gnu
299 HostVendor_CPP=unknown
303 HostPlatform=ia64-unknown-linux # hack again
304 TargetPlatform=ia64-unknown-linux
305 BuildPlatform=ia64-unknown-linux
306 HostPlatform_CPP='ia64_unknown_linux'
308 HostVendor_CPP='unknown'
312 HostPlatform=x86_64-unknown-linux
313 TargetPlatform=x86_64-unknown-linux
314 BuildPlatform=x86_64-unknown-linux
315 HostPlatform_CPP='x86_64_unknown_linux'
316 HostArch_CPP='x86_64'
317 HostVendor_CPP='unknown'
320 x86_64-apple-darwin*)
321 HostPlatform=x86_64-apple-darwin
322 TargetPlatform=x86_64-apple-darwin
323 BuildPlatform=x86_64-apple-darwin
324 HostPlatform_CPP='x86_64_apple_darwin'
325 HostArch_CPP='x86_64'
326 HostVendor_CPP='apple'
330 HostPlatform=m68k-unknown-linux # hack again
331 TargetPlatform=m68k-unknown-linux
332 BuildPlatform=m68k-unknown-linux
333 HostPlatform_CPP='m68k_unknown_linux'
335 HostVendor_CPP='unknown'
339 HostPlatform_CPP='m68k_next_nextstep2'
341 HostVendor_CPP='next'
342 HostOS_CPP='nextstep2'
345 HostPlatform_CPP='m68k_next_nextstep3'
347 HostVendor_CPP='next'
348 HostOS_CPP='nextstep3'
350 i[[3456]]86-next-nextstep3)
351 HostPlatform=i386-next-nextstep3 # hack again
352 TargetPlatform=i386-next-nextstep3
353 BuildPlatform=i386-next-nextstep3
354 HostPlatform_CPP='i386_next_nextstep3'
356 HostVendor_CPP='next'
357 HostOS_CPP='nextstep3'
360 HostPlatform=m68k-unknown-openbsd
361 TargetPlatform=m68k-unknown-openbsd
362 BuildPlatform=m68k-unknown-openbsd
363 HostPlatform_CPP='m68k_unknown_openbsd'
365 HostVendor_CPP='unknown'
369 HostPlatform=m68k-unknown-netbsd
370 TargetPlatform=m68k-unknown-netbsd
371 BuildPlatform=m68k-unknown-netbsd
372 HostPlatform_CPP='m68k_unknown_netbsd'
374 HostVendor_CPP='unknown'
378 HostPlatform=m68k-sun-sunos4
379 TargetPlatform=m68k-sun-sunos4 #hack
380 BuildPlatform=m68k-sun-sunos4 #hack
381 HostPlatform_CPP='m68k_sun_sunos4'
387 HostPlatform=m88k-unknown-openbsd
388 TargetPlatform=m88k-unknown-openbsd
389 BuildPlatform=m88k-unknown-openbsd
390 HostPlatform_CPP='m88k_unknown_openbsd'
392 HostVendor_CPP='unknown'
396 HostPlatform=mips-unknown-linux # hack again
397 TargetPlatform=mips-unknown-linux
398 BuildPlatform=mips-unknown-linux
399 HostPlatform_CPP='mips_unknown_linux'
401 HostVendor_CPP='unknown'
405 HostPlatform=mipsel-unknown-linux # hack again
406 TargetPlatform=mipsel-unknown-linux
407 BuildPlatform=mipsel-unknown-linux
408 HostPlatform_CPP='mipsel_unknown_linux'
409 HostArch_CPP='mipsel'
410 HostVendor_CPP='unknown'
414 HostPlatform_CPP='mips_dec_ultrix'
415 HostArch_CPP='mipsel' # NB a little different
420 HostPlatform=mips-sgi-irix
421 TargetPlatform=mips-sgi-irix #hack
422 BuildPlatform=mips-sgi-irix #hack
423 HostPlatform_CPP='mips_sgi_irix'
424 HostArch_CPP='mipseb' # NB a little different
429 HostPlatform=rs6000-ibm-aix
430 TargetPlatform=rs6000-ibm-aix #hack
431 BuildPlatform=rs6000-ibm-aix #hack
432 HostPlatform_CPP='rs6000_ibm_aix'
433 HostArch_CPP='rs6000'
438 HostPlatform=powerpc-ibm-aix
439 TargetPlatform=powerpc-ibm-aix #hack
440 BuildPlatform=powerpc-ibm-aix #hack
441 HostPlatform_CPP='powerpc_ibm_aix'
442 HostArch_CPP='powerpc'
446 powerpc-apple-darwin*)
447 HostPlatform=powerpc-apple-darwin
448 TargetPlatform=powerpc-apple-darwin #hack
449 BuildPlatform=powerpc-apple-darwin #hack
450 HostPlatform_CPP='powerpc_apple_darwin'
451 HostArch_CPP='powerpc'
452 HostVendor_CPP='apple'
455 powerpc-unknown-linux*)
456 HostPlatform=powerpc-unknown-linux
457 TargetPlatform=powerpc-unknown-linux
458 BuildPlatform=powerpc-unknown-linux
459 HostPlatform_CPP='powerpc_unknown_linux'
460 HostArch_CPP='powerpc'
461 HostVendor_CPP='unknown'
464 powerpc-unknown-openbsd*)
465 HostPlatform=powerpc-unknown-openbsd
466 TargetPlatform=powerpc-unknown-openbsd
467 BuildPlatform=powerpc-unknown-openbsd
468 HostPlatform_CPP='powerpc_unknown_openbsd'
469 HostArch_CPP='powerpc'
470 HostVendor_CPP='unknown'
473 powerpc64-unknown-linux*)
474 HostPlatform=powerpc64-unknown-linux
475 TargetPlatform=powerpc64-unknown-linux
476 BuildPlatform=powerpc64-unknown-linux
477 HostPlatform_CPP='powerpc64_unknown_linux'
478 HostArch_CPP='powerpc64'
479 HostVendor_CPP='unknown'
484 HostPlatform=s390-ibm-linux
485 TargetPlatform=s390-ibm-linux #hack
486 BuildPlatform=s390-ibm-linux #hack
487 HostPlatform_CPP='s390_ibm_linux'
493 HostPlatform=sparc-sun-sunos4
494 TargetPlatform=sparc-sun-sunos4 #hack
495 BuildPlatform=sparc-sun-sunos4 #hack
496 HostPlatform_CPP='sparc_sun_sunos4'
502 HostPlatform=sparc-sun-solaris2
503 TargetPlatform=sparc-sun-solaris2 #hack
504 BuildPlatform=sparc-sun-solaris2 #hack
505 HostPlatform_CPP='sparc_sun_solaris2'
508 HostOS_CPP='solaris2'
511 HostPlatform=sparc-unknown-linux
512 TargetPlatform=sparc-unknown-linux
513 BuildPlatform=sparc-unknown-linux
514 HostPlatform_CPP='sparc_unknown_linux'
516 HostVendor_CPP='unknown'
520 HostPlatform=sparc-unknown-openbsd
521 TargetPlatform=sparc-unknown-openbsd
522 BuildPlatform=sparc-unknown-openbsd
523 HostPlatform_CPP='sparc_unknown_openbsd'
525 HostVendor_CPP='unknown'
529 HostPlatform=sparc64-unknown-openbsd
530 TargetPlatform=sparc64-unknown-openbsd
531 BuildPlatform=sparc64-unknown-openbsd
532 HostPlatform_CPP='sparc64_unknown_openbsd'
533 HostArch_CPP='sparc64'
534 HostVendor_CPP='unknown'
538 HostPlatform=vax-unknown-openbsd
539 TargetPlatform=vax-unknown-openbsd
540 BuildPlatform=vax-unknown-openbsd
541 HostPlatform_CPP='vax_unknown_openbsd'
543 HostVendor_CPP='unknown'
547 echo "Unrecognised platform: $HostPlatform"
551 echo "Canonicalised to: $HostPlatform"
552 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
553 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
555 BuildPlatform_CPP=$HostPlatform_CPP
556 TargetPlatform_CPP=$HostPlatform_CPP
557 BuildArch_CPP=$HostArch_CPP
558 TargetArch_CPP=$HostArch_CPP
559 BuildOS_CPP=$HostOS_CPP
561 TargetOS_CPP=$HostOS_CPP
562 BuildVendor_CPP=$HostVendor_CPP
563 TargetVendor_CPP=$HostVendor_CPP
565 AC_SUBST(BuildPlatform)
566 AC_SUBST(HostPlatform)
567 AC_SUBST(TargetPlatform)
568 AC_SUBST(HostPlatform_CPP)
569 AC_SUBST(BuildPlatform_CPP)
570 AC_SUBST(TargetPlatform_CPP)
572 AC_SUBST(HostArch_CPP)
573 AC_SUBST(BuildArch_CPP)
574 AC_SUBST(TargetArch_CPP)
577 AC_SUBST(HostOS_Full)
578 AC_SUBST(BuildOS_CPP)
579 AC_SUBST(TargetOS_CPP)
581 AC_SUBST(HostVendor_CPP)
582 AC_SUBST(BuildVendor_CPP)
583 AC_SUBST(TargetVendor_CPP)
587 dnl --------------------------------------------------------------
588 dnl * Calculate absolute path to build tree
589 dnl --------------------------------------------------------------
591 AC_MSG_CHECKING(for path to top of build tree)
595 dnl Remove common automounter nonsense
597 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
599 dnl Find 'hardtop_plat', the native format for 'hardtop'
600 dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes
603 dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert
604 dnl /cygdrive/c/foo to c:/foo but we must not do that if we
605 dnl aren't building using Cygwin (notably msys), because
606 dnl cygpath doesn't exist. It seems that 'bash' sets
607 dnl OSTYPE to 'cygwin' or 'msys' respectively, but cygwin's
608 dnl 'sh' does not. So we hackily assume that if the shell
609 dnl hasn't set it to 'msys' then we must be in Cygwin.
612 dnl The Right Thing is probably to test $BuildPlatform
613 dnl instead, but we are sloppy about setting that correctly
614 dnl at the moment, so we just work around for now.
616 dnl The quotes round "$(OSTYPE)" are essential, for the
617 dnl Cygwin-sh case where OSTYPE is not set.
618 case $HostPlatform in
619 i386-unknown-mingw32 | i386-unknown-cygwin32)
620 if test "${OSTYPE}" != "msys"
622 # convert $hardtop to a path that mingw will understand too
623 cyghardtop=${hardtop}
624 hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
625 hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
627 dnl OK, so we're in the MSYS case. hardtop looks like /c/....
628 dnl We want to make hardtop_plat into c:/...
629 dnl Stop using [] for quotes temporarily, so we can use [] in the sed regexp
631 hardtop_plat=`echo ${hardtop} | sed -e 's@^/\\([a-zA-Z]\\)/@\\1:/@g'`
636 hardtop_plat=${hardtop}
640 AC_SUBST(hardtop_plat)
642 AC_MSG_RESULT(${hardtop})
644 # We don't support building in directories with spaces.
646 *' '*) AC_MSG_ERROR([
647 The build system does not support building in a directory containing
648 space characters. Suggestion: move the build tree somewhere else.])
652 dnl --------------------------------------------------------------
653 dnl * Project specific configuration options
654 dnl --------------------------------------------------------------
655 dnl What follows is a bunch of options that can either be configured
656 dnl through command line options to the configure script or by
657 dnl supplying defns in the build tree's mk/build.mk. Having the option to
658 dnl use either is considered a Feature.
660 dnl ** What command to use to compile compiler sources ?
661 dnl --------------------------------------------------------------
664 [AC_HELP_STRING([--with-ghc=ARG],
665 [Use ARG as the path to GHC [default=autodetect]])],
666 [WithGhc="$withval"],
667 [if test "$GHC" = ""; then
668 AC_PATH_PROG([GHC], [ghc])
674 [AC_HELP_STRING([--with-hc=ARG],
675 [Use ARG as the path to the compiler for compiling ordinary
676 Haskell code (default= value of --with-ghc)])],
682 if test "$WithGhc" != ""; then
683 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
684 AC_SUBST(GhcVersion)dnl
685 AC_SUBST(GhcMajVersion)dnl
686 AC_SUBST(GhcMinVersion)dnl
687 AC_SUBST(GhcPatchLevel)dnl
690 # Check whether this GHC has readline installed
693 AC_PATH_PROGS(NHC,nhc nhc98)
694 AC_PATH_PROG(HBC,hbc)
696 dnl ** Which gcc to use?
697 dnl --------------------------------------------------------------
699 [AC_HELP_STRING([--with-gcc=ARG],
700 [Use ARG as the path to GCC [default=autodetect]])],
701 [WhatGccIsCalled="$withval"
702 if test "x$HostPlatform" = "xi386-unknown-mingw32"
704 if test "${OSTYPE}" != "msys"
706 # Canonicalise to <drive>:/path/to/gcc
707 withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
713 [WhatGccIsCalled="gcc"]
715 AC_SUBST(WhatGccIsCalled)
717 dnl ** Booting from .hc files?
718 dnl --------------------------------------------------------------
719 AC_ARG_ENABLE(hc-boot,
720 [AC_HELP_STRING([--enable-hc-boot],
721 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
722 (This option is mostly of interest to porters.) [default=no]])],
723 [ if test x"$enableval" = x"yes"; then
731 AC_SUBST(BootingFromHc)
733 dnl ** Booting from unregisterised .hc files?
734 dnl --------------------------------------------------------------
735 AC_ARG_ENABLE(hc-boot-unregisterised,
736 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
737 [ With --enable-hc-boot, treat the intermediate .hc files as
738 unregisterised rather than registerised code.
739 (This option is mostly of interest to porters.) [default=no]])],
740 [ if test x"$enableval" = x"yes"; then
741 BootingFromUnregisterisedHc=YES
743 BootingFromUnregisterisedHc=NO
746 [BootingFromUnregisterisedHc=NO]
748 AC_SUBST(BootingFromUnregisterisedHc)
750 if test "$BootingFromHc" = "NO"; then
751 if test "$BootingFromUnregisterisedHc" = "YES"; then
752 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
756 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
757 if test "$BootingFromHc" = "NO" -a "$WithGhc" = "" -a -d "$srcdir/compiler"; then
758 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
761 dnl ** Enable the construction of Win32 DLLs?
762 dnl --------------------------------------------------------------
764 dnl [ The ability to build the RTS and libraries as separate DLLs used
765 dnl to be supported, but isn't currently (updates to the RTS, compiler
766 dnl and build system would be required to bring it back again.)
767 dnl Hence, exposing it as an option is false advertisement, so better
768 dnl disable it to avoid confusion (but leave it commented-out rather
769 dnl than removed in order to remind ourselves to bring back the
770 dnl feature at some stage.) ]
772 dnl AC_ARG_ENABLE(win32-dlls,
773 dnl [ --enable-win32-dlls
774 dnl If on a Win32 platform running mingw32/cygwin, enable the
775 dnl construction of DLLs containing ghc-compiled code.
778 dnl case $HostOS_CPP in
781 dnl *) echo "Unrecognised win32 platform: $HostPlatform"
785 dnl EnableWin32DLLs=YES
787 dnl [EnableWin32DLLs=NO]
789 dnl AC_SUBST(EnableWin32DLLs)
790 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
791 dnl AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
794 dnl ** Enable the building of the ObjectIO?
795 dnl --------------------------------------------------------------
796 AC_ARG_ENABLE(objectio,
797 [AC_HELP_STRING([--enable-objectio],
798 [Build ObjectIO, a portable GUI library for Haskell. [default=no]])],
799 [ if test x"$enableval" = x"yes"; then
800 GhcLibsWithObjectIO=YES
802 GhcLibsWithObjectIO=NO
805 [GhcLibsWithObjectIO=NO]
807 AC_SUBST(GhcLibsWithObjectIO)
809 dnl ** .NET interop support?
810 dnl --------------------------------------------------------------
811 AC_ARG_ENABLE(dotnet,
812 [AC_HELP_STRING([--enable-dotnet],
813 [Build .NET interop layer. [default=no]])],
814 [ if test x"$enableval" = x"yes"; then
815 DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
821 AC_SUBST(DotnetSupport)
823 dnl --------------------------------------------------------------
824 dnl End of configure script option section
825 dnl --------------------------------------------------------------
828 dnl --------------------------------------------------------------
829 dnl * General configuration checks
830 dnl --------------------------------------------------------------
832 dnl ** Can the unix package be built?
833 dnl --------------------------------------------------------------
835 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
840 AC_SUBST([GhcLibsWithUnix])
845 dnl ** look for `perl', but only in /bin on Windows
848 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
849 if test -z "$PerlCmd"; then
850 echo "You must install the version of Perl shipped with GHC"
851 echo "(or a compatible one) in /bin."
856 AC_PATH_PROG(PerlCmd,perl)
857 if test -z "$PerlCmd"; then
858 echo "You must install perl before you can continue"
859 echo "Perhaps it is already installed, but not in your PATH?"
862 FPTOOLS_CHECK_PERL_VERSION
867 dnl ** does #! path/to/perl work? (sometimes it's too long...)
870 dnl ** check for Python
871 AC_PATH_PROG(PythonCmd,python)
873 dnl ** look for GCC and find out which version
874 dnl Figure out which C compiler to use. Gcc is preferred.
875 dnl If gcc, make sure it's at least 2.1
879 FP_GCC_NEEDS_NO_OMIT_LFPTR
880 FP_GCC_HAS_NO_UNIT_AT_A_TIME
883 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
886 dnl ** Without optimization some INLINE trickery fails for GHCi
889 dnl ** Try to add -mno-cygwin to the C compiler options
890 FP_CHECK_FLAG([-mno-cygwin], [
891 SRC_CC_OPTS="-mno-cygwin $SRC_CC_OPTS"
892 CPPFLAGS="-mno-cygwin $CPPFLAGS"])
893 AC_SUBST(SRC_CC_OPTS)
895 dnl ** figure out how to do context diffs
898 dnl ** Find find command (for Win32's benefit)
901 dnl ** Find sort command (for the benefit of Win32 environs)
904 dnl ** figure out how to do a BSD-ish install
906 dnl Let's make sure install-sh is executable here. If we got it from
907 dnl a darcs repo, it might not be (see bug #978).
910 dnl If you can run configure, you certainly have /bin/sh
911 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
913 dnl ** how to invoke `ar' and `ranlib'
914 FP_PROG_AR_NEEDS_RANLIB
915 FP_PROG_AR_SUPPORTS_INPUT
917 dnl ** Check to see whether ln -s works
921 dnl ** Find the path to sed
922 AC_PATH_PROG(SedCmd,sed)
925 dnl ** check for time command
926 AC_PATH_PROG(TimeCmd,time)
929 dnl if GNU tar is named gtar, look for it first.
930 AC_PATH_PROGS(TarCmd,gtar tar,tar)
932 dnl ** check for DocBook toolchain
934 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 /opt/local/share/xsl/docbook-xsl])
937 dnl ** check for ghc-pkg command
940 AC_ARG_WITH(greencard,
941 [AC_HELP_STRING([--with-greencard=ARG],
942 [Use ARG as the path to greencard [default=autodetct]])],
944 GreenCardCmd=$withval;
945 FPTOOLS_GREENCARD(3.00)
949 dnl ** check for installed happy binary + version
950 dnl (don't do it if we're booting from .hc files though.)
951 if test "$BootingFromHc" = "NO"; then
955 dnl ** check for installed haddock
958 dnl ** check for installed alex binary + version
959 dnl (don't do it if we're booting from .hc files though.)
960 if test "$BootingFromHc" = "NO"; then
964 dnl --------------------------------------------------
965 dnl ### program checking section ends here ###
966 dnl --------------------------------------------------
968 dnl --------------------------------------------------
969 dnl * Platform header file and syscall feature tests
970 dnl ### checking the state of the local header files and syscalls ###
972 dnl ** check for full ANSI header (.h) files
975 dnl ** Enable large file support. NB. do this before testing the type of
976 dnl off_t, because it will affect the result of that test.
979 dnl ** check for specific header (.h) files that we are interested in
980 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])
982 AC_CHECK_HEADER([readline/readline.h], [HaveReadlineReadlineH=YES], [HaveReadlineReadlineH=NO])
983 AC_CHECK_HEADER([readline/history.h], [HaveReadlineHistoryH=YES], [HaveReadlineHistoryH=NO])
985 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
986 GhcLibsWithReadline=YES
987 AC_DEFINE([HAVE_READLINE_HEADERS], [1], [Define to 1 if readline/readline.h and readline/history.h exist.])
989 GhcLibsWithReadline=NO
990 AC_DEFINE([HAVE_READLINE_HEADERS], [0], [Define to 1 if readline/readline.h and readline/history.h exist.])
992 AC_SUBST(GhcLibsWithReadline)
994 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
997 dnl ** do we have long longs?
998 AC_CHECK_TYPES([long long])
1000 dnl ** what are the sizes of various types
1001 AC_CHECK_SIZEOF(char, 1)
1002 AC_CHECK_SIZEOF(double, 8)
1003 AC_CHECK_SIZEOF(float, 4)
1004 AC_CHECK_SIZEOF(int, 4)
1005 AC_CHECK_SIZEOF(long, 4)
1006 if test "$ac_cv_type_long_long" = yes; then
1007 AC_CHECK_SIZEOF(long long, 8)
1009 AC_CHECK_SIZEOF(short, 2)
1010 AC_CHECK_SIZEOF(unsigned char, 1)
1011 AC_CHECK_SIZEOF(unsigned int, 4)
1012 AC_CHECK_SIZEOF(unsigned long, 4)
1013 if test "$ac_cv_type_long_long" = yes; then
1014 AC_CHECK_SIZEOF(unsigned long long, 8)
1016 AC_CHECK_SIZEOF(unsigned short, 2)
1017 AC_CHECK_SIZEOF(void *, 4)
1019 dnl ** what are alignment constraints on various types
1020 FP_CHECK_ALIGNMENT(char)
1021 FP_CHECK_ALIGNMENT(double)
1022 FP_CHECK_ALIGNMENT(float)
1023 FP_CHECK_ALIGNMENT(int)
1024 FP_CHECK_ALIGNMENT(long)
1025 if test "$ac_cv_type_long_long" = yes; then
1026 FP_CHECK_ALIGNMENT(long long)
1028 FP_CHECK_ALIGNMENT(short)
1029 FP_CHECK_ALIGNMENT(unsigned char)
1030 FP_CHECK_ALIGNMENT(unsigned int)
1031 FP_CHECK_ALIGNMENT(unsigned long)
1032 if test "$ac_cv_type_long_long" = yes; then
1033 FP_CHECK_ALIGNMENT(unsigned long long)
1035 FP_CHECK_ALIGNMENT(unsigned short)
1036 FP_CHECK_ALIGNMENT(void *)
1038 FP_CHECK_FUNC([WinExec],
1039 [@%:@include <windows.h>], [WinExec("",0)])
1041 FP_CHECK_FUNC([GetModuleFileName],
1042 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1044 dnl ** check return type of signal handlers
1045 dnl Foo: assumes we can use prototypes.
1046 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1047 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1048 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1049 dnl #include <signal.h>
1053 dnl void (*signal (int, void (*)(int)))(int);
1056 dnl [ac_cv_type_signal_handler=void_int],
1057 dnl [ac_cv_type_signal_handler=int_void])])
1058 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1059 dnl AC_DEFINE(VOID_INT_SIGNALS)
1062 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1064 if test "$ac_cv_type_signal" = void; then
1065 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).])
1068 dnl ** check for more functions
1069 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1070 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r])
1071 dnl ** For ghc/rts/gmp:
1072 AC_CHECK_FUNCS([getpagesize])
1074 dnl ** check whether this machine has gmp3 installed
1075 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1076 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
1077 HaveLibGmp=NO; LibGmp=not-installed))
1078 AC_SUBST(HaveLibGmp)
1081 dnl ** (Mac OS X only: check for GMP.framework)
1083 case $HostPlatform in
1085 AC_MSG_CHECKING([for GMP.framework])
1087 LIBS="-framework GMP"
1088 AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkGMP=YES,)
1089 if test $HaveFrameworkGMP = YES; then
1090 AC_DEFINE([HAVE_FRAMEWORK_GMP], [1], [Define to 1 if GMP.framework is installed (Mac OS X only).])
1093 AC_MSG_RESULT([$HaveFrameworkGMP])
1096 AC_SUBST(HaveFrameworkGMP)
1098 dnl ** check for mingwex library
1099 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1100 AC_SUBST(HaveLibMingwEx)
1102 if test $HaveLibMingwEx = YES ; then
1103 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1106 if test "$HaveLibGmp" = "NO"; then
1107 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1108 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1112 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1113 dnl the order of these tests matters: bfd needs liberty
1114 AC_CHECK_LIB(iberty, xmalloc)
1115 AC_CHECK_LIB(bfd, bfd_init)
1117 dnl ** check for math library
1118 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1119 if test x"$fp_libm_not_needed" = xdunno; then
1120 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1124 dnl ################################################################
1125 dnl Check for libraries
1126 dnl ################################################################
1128 dnl ** check whether we need -ldl to get dlopen()
1130 AC_CHECK_LIB(dl, dlopen,
1132 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1137 dnl --------------------------------------------------
1138 dnl * Miscellaneous feature tests
1139 dnl --------------------------------------------------
1141 dnl ** can we get alloca?
1144 dnl ** Working vfork?
1147 dnl ** determine whether or not const works
1150 dnl ** are we big endian?
1152 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
1154 dnl ** check for leading underscores in symbol names
1155 FP_LEADING_UNDERSCORE
1157 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1161 dnl ** check for Apple-style dead-stripping support
1162 dnl (.subsections-via-symbols assembler directive)
1165 AC_MSG_CHECKING(for .subsections_via_symbols)
1167 [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
1169 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1170 [Define to 1 if Apple-style dead-stripping is supported.])
1172 [AC_MSG_RESULT(no)])
1174 dnl *** check for GNU non-executable stack note support (ELF only)
1175 dnl (.section .note.GNU-stack,"",@progbits)
1177 AC_MSG_CHECKING(for GNU non-executable stack support)
1179 [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
1181 AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
1182 [Define to 1 if GNU non-executable stack notes are supported.])
1184 [AC_MSG_RESULT(no)])
1186 dnl ** check for librt
1187 AC_CHECK_LIB(rt, clock_gettime)
1188 AC_CHECK_FUNCS(clock_gettime)
1190 dnl ** check for Apple's "interesting" long double compatibility scheme
1191 AC_MSG_CHECKING(for printf\$LDBLStub)
1192 AC_TRY_LINK_FUNC(printf\$LDBLStub,
1195 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
1196 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1200 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
1201 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1205 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
1206 if test -n "$GTK_CONFIG"; then
1207 if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
1208 GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
1210 AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
1214 AC_SUBST([GTK_CONFIG])
1217 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
1218 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
1219 AC_SUBST(HavePapiLib)
1220 AC_SUBST(HavePapiHeader)
1222 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
1229 AC_CONFIG_FILES([mk/config.mk ghc.spec docs/users_guide/ug-book.xml])
1230 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])