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 University of Glasgow 1994-2004
8 # Configure script template for GHC
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 # Set this to YES for a released version, otherwise NO
21 # The primary version (e.g. 6.7, 6.6.1) is set in the AC_INIT line
22 # above. If this is not a released version, then we will append the
23 # date to the version number (e.g. 6.7.20070204). The date is
24 # constructed by finding the date of the most recent patch in the
25 # darcs repository. If this is a source distribution (not a darcs
26 # checkout), then we ship a file 'VERSION' containing the full version
27 # when the source distribution was created.
29 if test ! -f mk/config.h.in; then
30 echo "mk/config.h.in doesn't exist: perhaps you haven't run 'autoreconf'?"
34 FP_SETUP_PROJECT_VERSION
36 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
37 AC_SUBST([release], [1])
39 # First off, a distrib sanity check..
40 AC_CONFIG_SRCDIR([mk/config.mk.in])
42 dnl * We require autoconf version 2.52
43 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
44 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
47 dnl * Declare subdirectories that have a private configure script
49 dnl After the toplevel configuration is complete, the script will recurse into
50 dnl these subdirectories if they exist. The use of a cache file makes repeated
52 AC_CONFIG_SUBDIRS([libraries])
54 # -------------------------------------------------------------------------
55 # Prepare to generate the following header files
58 AC_CONFIG_HEADER(mk/config.h)
60 # No, semi-sadly, we don't do `--srcdir'...
61 if test x"$srcdir" != 'x.' ; then
62 echo "This configuration does not support the \`--srcdir' option.."
66 dnl--------------------------------------------------------------------
67 dnl * Choose host(/target/build) platform
68 dnl--------------------------------------------------------------------
70 dnl Guess host/target/build platform(s) if necessary.
73 # "$host" defaults to "$target"
74 if test "x$host" = xNONE ; then
78 dnl ** canonicalize platform names
79 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
80 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
81 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
83 if test x"$TargetPlatform" != x"$HostPlatform" ; then
84 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
90 # The following will be more difficult when we *are* cross-compiling.
91 # Suitable names to slam in *_CPP are in platform.h.in.
92 # We also record the architecture, vendor, and operating system (OS)
95 alpha*-dec-osf[[12]]*)
96 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
97 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
98 BuildPlatform=alpha-dec-osf1 # hack
99 HostPlatform_CPP='alpha_dec_osf1'
104 alpha*-dec-osf[[345]]*)
105 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
106 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
107 BuildPlatform=alpha-dec-osf3 # hack
108 HostPlatform_CPP='alpha_dec_osf3'
113 alpha*-unknown-linux*)
114 HostPlatform=alpha-unknown-linux
115 TargetPlatform=alpha-unknown-linux
116 BuildPlatform=alpha-unknown-linux
117 HostPlatform_CPP='alpha_unknown_linux'
119 HostVendor_CPP='unknown'
122 alpha*-unknown-freebsd*)
123 HostPlatform=alpha-unknown-freebsd
124 TargetPlatform=alpha-unknown-freebsd
125 BuildPlatform=alpha-unknown-freebsd
126 HostPlatform_CPP='alpha_unknown_freebsd'
128 HostVendor_CPP='unknown'
131 alpha*-unknown-openbsd*)
132 HostPlatform=alpha-unknown-openbsd
133 TargetPlatform=alpha-unknown-openbsd
134 BuildPlatform=alpha-unknown-openbsd
135 HostPlatform_CPP='alpha_unknown_openbsd'
137 HostVendor_CPP='unknown'
140 amd64-*-openbsd*|x86_64-*-openbsd*)
141 HostPlatform=x86_64-unknown-openbsd
142 TargetPlatform=x86_64-unknown-openbsd
143 BuildPlatform=x86_64-unknown-openbsd
144 HostPlatform_CPP='x86_64_unknown_openbsd'
145 HostArch_CPP='x86_64'
146 HostVendor_CPP='unknown'
150 HostPlatform=x86_64-unknown-freebsd
151 TargetPlatform=x86_64-unknown-freebsd
152 BuildPlatform=x86_64-unknown-freebsd
153 HostPlatform_CPP='x86_64_unknown_freebsd'
154 HostArch_CPP='x86_64'
155 HostVendor_CPP='unknown'
159 HostPlatform=arm-unknown-linux # hack again
160 TargetPlatform=arm-unknown-linux
161 BuildPlatform=arm-unknown-linux
162 HostPlatform_CPP='arm_unknown_linux'
164 HostVendor_CPP='unknown'
168 HostPlatform=arm-unknown-openbsd
169 TargetPlatform=arm-unknown-openbsd
170 BuildPlatform=arm-unknown-openbsd
171 HostPlatform_CPP='arm_unknown_openbsd'
173 HostVendor_CPP='unknown'
177 HostPlatform=hppa-unknown-linux # hack again
178 TargetPlatform=hppa-unknown-linux
179 BuildPlatform=hppa-unknown-linux
180 HostPlatform_CPP='hppa_unknown_linux'
182 HostVendor_CPP='unknown'
186 HostPlatform=hppa-unknown-openbsd # hack again
187 TargetPlatform=hppa-unknown-openbsd
188 BuildPlatform=hppa-unknown-openbsd
189 HostPlatform_CPP='hppa_unknown_openbsd'
191 HostVendor_CPP='unknown'
195 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
196 TargetPlatform=hppa1.1-hp-hpux
197 BuildPlatform=hppa1.1-hp-hpux
198 HostPlatform_CPP='hppa1_1_hp_hpux'
199 HostArch_CPP='hppa1_1'
203 i[[3456]]86-*-linuxaout*)
204 HostPlatform=i386-unknown-linuxaout # hack again
205 TargetPlatform=i386-unknown-linuxaout
206 BuildPlatform=i386-unknown-linuxaout
207 HostPlatform_CPP='i386_unknown_linuxaout'
209 HostVendor_CPP='unknown'
210 HostOS_CPP='linuxaout'
212 i[[3456]]86-*-linux*)
213 HostPlatform=i386-unknown-linux # hack again
214 TargetPlatform=i386-unknown-linux
215 BuildPlatform=i386-unknown-linux
216 HostPlatform_CPP='i386_unknown_linux'
218 HostVendor_CPP='unknown'
221 i[[3456]]86-*-kfreebsd*-gnu)
222 HostPlatform=i386-unknown-kfreebsdgnu # hack again
223 TargetPlatform=i386-unknown-kfreebsdgnu
224 BuildPlatform=i386-unknown-kfreebsdgnu
225 HostPlatform_CPP='i386_unknown_kfreebsdgnu'
227 HostVendor_CPP='unknown'
228 HostOS_CPP='kfreebsdgnu'
230 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
231 HostPlatform=i386-unknown-freebsd # hack again
232 TargetPlatform=i386-unknown-freebsd
233 BuildPlatform=i386-unknown-freebsd
234 HostPlatform_CPP='i386_unknown_freebsd'
236 HostVendor_CPP='unknown'
239 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
240 HostPlatform=i386-unknown-freebsd2 # hack again
241 TargetPlatform=i386-unknown-freebsd2
242 BuildPlatform=i386-unknown-freebsd2
243 HostPlatform_CPP='i386_unknown_freebsd2'
245 HostVendor_CPP='unknown'
246 HostOS_CPP='freebsd2'
248 i[[3456]]86-*-netbsd*)
249 HostPlatform=i386-unknown-netbsd # hack again
250 TargetPlatform=i386-unknown-netbsd
251 BuildPlatform=i386-unknown-netbsd
252 HostPlatform_CPP='i386_unknown_netbsd'
254 HostVendor_CPP='unknown'
257 i[[3456]]86-*-openbsd*)
258 HostPlatform=i386-unknown-openbsd # hack again
259 TargetPlatform=i386-unknown-openbsd
260 BuildPlatform=i386-unknown-openbsd
261 HostPlatform_CPP='i386_unknown_openbsd'
263 HostVendor_CPP='unknown'
266 i[[3456]]86-*-solaris2*)
267 HostPlatform=i386-unknown-solaris2 # hack again
268 TargetPlatform=i386-unknown-solaris2
269 BuildPlatform=i386-unknown-solaris2
270 HostPlatform_CPP='i386_unknown_solaris2'
272 HostVendor_CPP='unknown'
273 HostOS_CPP='solaris2'
275 i[[3456]]86-*-cygwin*)
276 HostPlatform=i386-unknown-cygwin32 # hack again
277 TargetPlatform=i386-unknown-cygwin32
278 BuildPlatform=i386-unknown-cygwin32
279 HostPlatform_CPP='i386_unknown_cygwin32'
281 HostVendor_CPP='unknown'
282 HostOS_CPP='cygwin32'
285 i[[3456]]86-*-mingw32*)
286 HostPlatform=i386-unknown-mingw32 # hack again
287 TargetPlatform=i386-unknown-mingw32
288 BuildPlatform=i386-unknown-mingw32
289 HostPlatform_CPP='i386_unknown_mingw32'
291 HostVendor_CPP='unknown'
295 i[[3456]]86-apple-darwin*)
296 HostPlatform=i386-apple-darwin
297 TargetPlatform=i386-apple-darwin #hack
298 BuildPlatform=i386-apple-darwin #hack
299 HostPlatform_CPP='i386_apple_darwin'
301 HostVendor_CPP='apple'
305 HostPlatform=i386-unknown-gnu
306 TargetPlatform=i386-unknown-gnu
307 BuildPlatform=i386-unknown-gnu
308 HostPlatform_CPP=i386_unknown_gnu
310 HostVendor_CPP=unknown
314 HostPlatform=ia64-unknown-linux # hack again
315 TargetPlatform=ia64-unknown-linux
316 BuildPlatform=ia64-unknown-linux
317 HostPlatform_CPP='ia64_unknown_linux'
319 HostVendor_CPP='unknown'
323 HostPlatform=x86_64-unknown-linux
324 TargetPlatform=x86_64-unknown-linux
325 BuildPlatform=x86_64-unknown-linux
326 HostPlatform_CPP='x86_64_unknown_linux'
327 HostArch_CPP='x86_64'
328 HostVendor_CPP='unknown'
331 x86_64-apple-darwin*)
332 HostPlatform=x86_64-apple-darwin
333 TargetPlatform=x86_64-apple-darwin
334 BuildPlatform=x86_64-apple-darwin
335 HostPlatform_CPP='x86_64_apple_darwin'
336 HostArch_CPP='x86_64'
337 HostVendor_CPP='apple'
341 HostPlatform=m68k-unknown-linux # hack again
342 TargetPlatform=m68k-unknown-linux
343 BuildPlatform=m68k-unknown-linux
344 HostPlatform_CPP='m68k_unknown_linux'
346 HostVendor_CPP='unknown'
350 HostPlatform_CPP='m68k_next_nextstep2'
352 HostVendor_CPP='next'
353 HostOS_CPP='nextstep2'
356 HostPlatform_CPP='m68k_next_nextstep3'
358 HostVendor_CPP='next'
359 HostOS_CPP='nextstep3'
361 i[[3456]]86-next-nextstep3)
362 HostPlatform=i386-next-nextstep3 # hack again
363 TargetPlatform=i386-next-nextstep3
364 BuildPlatform=i386-next-nextstep3
365 HostPlatform_CPP='i386_next_nextstep3'
367 HostVendor_CPP='next'
368 HostOS_CPP='nextstep3'
371 HostPlatform=m68k-unknown-openbsd
372 TargetPlatform=m68k-unknown-openbsd
373 BuildPlatform=m68k-unknown-openbsd
374 HostPlatform_CPP='m68k_unknown_openbsd'
376 HostVendor_CPP='unknown'
380 HostPlatform=m68k-unknown-netbsd
381 TargetPlatform=m68k-unknown-netbsd
382 BuildPlatform=m68k-unknown-netbsd
383 HostPlatform_CPP='m68k_unknown_netbsd'
385 HostVendor_CPP='unknown'
389 HostPlatform=m68k-sun-sunos4
390 TargetPlatform=m68k-sun-sunos4 #hack
391 BuildPlatform=m68k-sun-sunos4 #hack
392 HostPlatform_CPP='m68k_sun_sunos4'
398 HostPlatform=m88k-unknown-openbsd
399 TargetPlatform=m88k-unknown-openbsd
400 BuildPlatform=m88k-unknown-openbsd
401 HostPlatform_CPP='m88k_unknown_openbsd'
403 HostVendor_CPP='unknown'
407 HostPlatform=mips-unknown-linux # hack again
408 TargetPlatform=mips-unknown-linux
409 BuildPlatform=mips-unknown-linux
410 HostPlatform_CPP='mips_unknown_linux'
412 HostVendor_CPP='unknown'
416 HostPlatform=mipsel-unknown-linux # hack again
417 TargetPlatform=mipsel-unknown-linux
418 BuildPlatform=mipsel-unknown-linux
419 HostPlatform_CPP='mipsel_unknown_linux'
420 HostArch_CPP='mipsel'
421 HostVendor_CPP='unknown'
425 HostPlatform_CPP='mips_dec_ultrix'
426 HostArch_CPP='mipsel' # NB a little different
431 HostPlatform=mips-sgi-irix
432 TargetPlatform=mips-sgi-irix #hack
433 BuildPlatform=mips-sgi-irix #hack
434 HostPlatform_CPP='mips_sgi_irix'
435 HostArch_CPP='mipseb' # NB a little different
440 HostPlatform=rs6000-ibm-aix
441 TargetPlatform=rs6000-ibm-aix #hack
442 BuildPlatform=rs6000-ibm-aix #hack
443 HostPlatform_CPP='rs6000_ibm_aix'
444 HostArch_CPP='rs6000'
449 HostPlatform=powerpc-ibm-aix
450 TargetPlatform=powerpc-ibm-aix #hack
451 BuildPlatform=powerpc-ibm-aix #hack
452 HostPlatform_CPP='powerpc_ibm_aix'
453 HostArch_CPP='powerpc'
457 powerpc-apple-darwin*)
458 HostPlatform=powerpc-apple-darwin
459 TargetPlatform=powerpc-apple-darwin #hack
460 BuildPlatform=powerpc-apple-darwin #hack
461 HostPlatform_CPP='powerpc_apple_darwin'
462 HostArch_CPP='powerpc'
463 HostVendor_CPP='apple'
466 powerpc-unknown-linux*)
467 HostPlatform=powerpc-unknown-linux
468 TargetPlatform=powerpc-unknown-linux
469 BuildPlatform=powerpc-unknown-linux
470 HostPlatform_CPP='powerpc_unknown_linux'
471 HostArch_CPP='powerpc'
472 HostVendor_CPP='unknown'
475 powerpc-unknown-openbsd*)
476 HostPlatform=powerpc-unknown-openbsd
477 TargetPlatform=powerpc-unknown-openbsd
478 BuildPlatform=powerpc-unknown-openbsd
479 HostPlatform_CPP='powerpc_unknown_openbsd'
480 HostArch_CPP='powerpc'
481 HostVendor_CPP='unknown'
484 powerpc64-unknown-linux*)
485 HostPlatform=powerpc64-unknown-linux
486 TargetPlatform=powerpc64-unknown-linux
487 BuildPlatform=powerpc64-unknown-linux
488 HostPlatform_CPP='powerpc64_unknown_linux'
489 HostArch_CPP='powerpc64'
490 HostVendor_CPP='unknown'
495 HostPlatform=s390-ibm-linux
496 TargetPlatform=s390-ibm-linux #hack
497 BuildPlatform=s390-ibm-linux #hack
498 HostPlatform_CPP='s390_ibm_linux'
504 HostPlatform=sparc-sun-sunos4
505 TargetPlatform=sparc-sun-sunos4 #hack
506 BuildPlatform=sparc-sun-sunos4 #hack
507 HostPlatform_CPP='sparc_sun_sunos4'
513 HostPlatform=sparc-sun-solaris2
514 TargetPlatform=sparc-sun-solaris2 #hack
515 BuildPlatform=sparc-sun-solaris2 #hack
516 HostPlatform_CPP='sparc_sun_solaris2'
519 HostOS_CPP='solaris2'
522 HostPlatform=sparc-unknown-linux
523 TargetPlatform=sparc-unknown-linux
524 BuildPlatform=sparc-unknown-linux
525 HostPlatform_CPP='sparc_unknown_linux'
527 HostVendor_CPP='unknown'
531 HostPlatform=sparc-unknown-openbsd
532 TargetPlatform=sparc-unknown-openbsd
533 BuildPlatform=sparc-unknown-openbsd
534 HostPlatform_CPP='sparc_unknown_openbsd'
536 HostVendor_CPP='unknown'
540 HostPlatform=sparc64-unknown-openbsd
541 TargetPlatform=sparc64-unknown-openbsd
542 BuildPlatform=sparc64-unknown-openbsd
543 HostPlatform_CPP='sparc64_unknown_openbsd'
544 HostArch_CPP='sparc64'
545 HostVendor_CPP='unknown'
549 HostPlatform=vax-unknown-openbsd
550 TargetPlatform=vax-unknown-openbsd
551 BuildPlatform=vax-unknown-openbsd
552 HostPlatform_CPP='vax_unknown_openbsd'
554 HostVendor_CPP='unknown'
558 echo "Unrecognised platform: $HostPlatform"
562 echo "Canonicalised to: $HostPlatform"
563 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
564 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
566 BuildPlatform_CPP=$HostPlatform_CPP
567 TargetPlatform_CPP=$HostPlatform_CPP
568 BuildArch_CPP=$HostArch_CPP
569 TargetArch_CPP=$HostArch_CPP
570 BuildOS_CPP=$HostOS_CPP
572 TargetOS_CPP=$HostOS_CPP
573 BuildVendor_CPP=$HostVendor_CPP
574 TargetVendor_CPP=$HostVendor_CPP
576 AC_SUBST(BuildPlatform)
577 AC_SUBST(HostPlatform)
578 AC_SUBST(TargetPlatform)
579 AC_SUBST(HostPlatform_CPP)
580 AC_SUBST(BuildPlatform_CPP)
581 AC_SUBST(TargetPlatform_CPP)
583 AC_SUBST(HostArch_CPP)
584 AC_SUBST(BuildArch_CPP)
585 AC_SUBST(TargetArch_CPP)
588 AC_SUBST(HostOS_Full)
589 AC_SUBST(BuildOS_CPP)
590 AC_SUBST(TargetOS_CPP)
592 AC_SUBST(HostVendor_CPP)
593 AC_SUBST(BuildVendor_CPP)
594 AC_SUBST(TargetVendor_CPP)
598 dnl --------------------------------------------------------------
599 dnl * Calculate absolute path to build tree
600 dnl --------------------------------------------------------------
602 AC_MSG_CHECKING(for path to top of build tree)
606 dnl Remove common automounter nonsense
608 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
610 dnl Find 'hardtop_plat', the native format for 'hardtop'
611 dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes
614 dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert
615 dnl /cygdrive/c/foo to c:/foo but we must not do that if we
616 dnl aren't building using Cygwin (notably msys), because
617 dnl cygpath doesn't exist. It seems that 'bash' sets
618 dnl OSTYPE to 'cygwin' or 'msys' respectively, but cygwin's
619 dnl 'sh' does not. So we hackily assume that if the shell
620 dnl hasn't set it to 'msys' then we must be in Cygwin.
623 dnl The Right Thing is probably to test $BuildPlatform
624 dnl instead, but we are sloppy about setting that correctly
625 dnl at the moment, so we just work around for now.
627 dnl The quotes round "$(OSTYPE)" are essential, for the
628 dnl Cygwin-sh case where OSTYPE is not set.
629 case $HostPlatform in
630 i386-unknown-mingw32 | i386-unknown-cygwin32)
631 if test "${OSTYPE}" != "msys"
633 # convert $hardtop to a path that mingw will understand too
634 cyghardtop=${hardtop}
635 hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
636 hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
638 dnl OK, so we're in the MSYS case. hardtop looks like /c/....
639 dnl We want to make hardtop_plat into c:/...
640 dnl Stop using [] for quotes temporarily, so we can use [] in the sed regexp
642 hardtop_plat=`echo ${hardtop} | sed -e 's@^/\\([a-zA-Z]\\)/@\\1:/@g'`
647 hardtop_plat=${hardtop}
651 AC_SUBST(hardtop_plat)
653 AC_MSG_RESULT(${hardtop})
655 # We don't support building in directories with spaces.
657 *' '*) AC_MSG_ERROR([
658 The build system does not support building in a directory containing
659 space characters. Suggestion: move the build tree somewhere else.])
663 dnl --------------------------------------------------------------
664 dnl * Project specific configuration options
665 dnl --------------------------------------------------------------
666 dnl What follows is a bunch of options that can either be configured
667 dnl through command line options to the configure script or by
668 dnl supplying defns in the build tree's mk/build.mk. Having the option to
669 dnl use either is considered a Feature.
671 dnl ** What command to use to compile compiler sources ?
672 dnl --------------------------------------------------------------
675 [AC_HELP_STRING([--with-ghc=ARG],
676 [Use ARG as the path to GHC [default=autodetect]])],
677 [WithGhc="$withval"],
678 [if test "$GHC" = ""; then
679 AC_PATH_PROG([GHC], [ghc])
685 [AC_HELP_STRING([--with-hc=ARG],
686 [Use ARG as the path to the compiler for compiling ordinary
687 Haskell code (default= value of --with-ghc)])],
693 if test "$WithGhc" != ""; then
694 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
695 AC_SUBST(GhcVersion)dnl
696 AC_SUBST(GhcMajVersion)dnl
697 AC_SUBST(GhcMinVersion)dnl
698 AC_SUBST(GhcPatchLevel)dnl
701 # Check whether this GHC has readline installed
704 AC_PATH_PROGS(NHC,nhc nhc98)
705 AC_PATH_PROG(HBC,hbc)
707 dnl ** Which gcc to use?
708 dnl --------------------------------------------------------------
710 [AC_HELP_STRING([--with-gcc=ARG],
711 [Use ARG as the path to GCC [default=autodetect]])],
712 [WhatGccIsCalled="$withval"
713 if test "x$HostPlatform" = "xi386-unknown-mingw32"
715 if test "${OSTYPE}" != "msys"
717 # Canonicalise to <drive>:/path/to/gcc
718 withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
724 [WhatGccIsCalled="gcc"]
726 AC_SUBST(WhatGccIsCalled)
728 dnl ** Booting from .hc files?
729 dnl --------------------------------------------------------------
730 AC_ARG_ENABLE(hc-boot,
731 [AC_HELP_STRING([--enable-hc-boot],
732 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
733 (This option is mostly of interest to porters.) [default=no]])],
734 [ if test x"$enableval" = x"yes"; then
742 AC_SUBST(BootingFromHc)
744 dnl ** Booting from unregisterised .hc files?
745 dnl --------------------------------------------------------------
746 AC_ARG_ENABLE(hc-boot-unregisterised,
747 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
748 [ With --enable-hc-boot, treat the intermediate .hc files as
749 unregisterised rather than registerised code.
750 (This option is mostly of interest to porters.) [default=no]])],
751 [ if test x"$enableval" = x"yes"; then
752 BootingFromUnregisterisedHc=YES
754 BootingFromUnregisterisedHc=NO
757 [BootingFromUnregisterisedHc=NO]
759 AC_SUBST(BootingFromUnregisterisedHc)
761 if test "$BootingFromHc" = "NO"; then
762 if test "$BootingFromUnregisterisedHc" = "YES"; then
763 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
767 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
768 if test "$BootingFromHc" = "NO" -a "$WithGhc" = "" -a -d "$srcdir/compiler"; then
769 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
772 dnl ** Enable the construction of Win32 DLLs?
773 dnl --------------------------------------------------------------
775 dnl [ The ability to build the RTS and libraries as separate DLLs used
776 dnl to be supported, but isn't currently (updates to the RTS, compiler
777 dnl and build system would be required to bring it back again.)
778 dnl Hence, exposing it as an option is false advertisement, so better
779 dnl disable it to avoid confusion (but leave it commented-out rather
780 dnl than removed in order to remind ourselves to bring back the
781 dnl feature at some stage.) ]
783 dnl AC_ARG_ENABLE(win32-dlls,
784 dnl [ --enable-win32-dlls
785 dnl If on a Win32 platform running mingw32/cygwin, enable the
786 dnl construction of DLLs containing ghc-compiled code.
789 dnl case $HostOS_CPP in
792 dnl *) echo "Unrecognised win32 platform: $HostPlatform"
796 dnl EnableWin32DLLs=YES
798 dnl [EnableWin32DLLs=NO]
800 dnl AC_SUBST(EnableWin32DLLs)
801 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
802 dnl AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
805 dnl ** Enable the building of the ObjectIO?
806 dnl --------------------------------------------------------------
807 AC_ARG_ENABLE(objectio,
808 [AC_HELP_STRING([--enable-objectio],
809 [Build ObjectIO, a portable GUI library for Haskell. [default=no]])],
810 [ if test x"$enableval" = x"yes"; then
811 GhcLibsWithObjectIO=YES
813 GhcLibsWithObjectIO=NO
816 [GhcLibsWithObjectIO=NO]
818 AC_SUBST(GhcLibsWithObjectIO)
820 dnl ** .NET interop support?
821 dnl --------------------------------------------------------------
822 AC_ARG_ENABLE(dotnet,
823 [AC_HELP_STRING([--enable-dotnet],
824 [Build .NET interop layer. [default=no]])],
825 [ if test x"$enableval" = x"yes"; then
826 DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
832 AC_SUBST(DotnetSupport)
834 dnl --------------------------------------------------------------
835 dnl End of configure script option section
836 dnl --------------------------------------------------------------
839 dnl --------------------------------------------------------------
840 dnl * General configuration checks
841 dnl --------------------------------------------------------------
843 dnl ** Can the unix package be built?
844 dnl --------------------------------------------------------------
846 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
851 AC_SUBST([GhcLibsWithUnix])
856 dnl ** look for `perl', but only in /bin on Windows
859 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
860 if test -z "$PerlCmd"; then
861 echo "You must install the version of Perl shipped with GHC"
862 echo "(or a compatible one) in /bin."
867 AC_PATH_PROG(PerlCmd,perl)
868 if test -z "$PerlCmd"; then
869 echo "You must install perl before you can continue"
870 echo "Perhaps it is already installed, but not in your PATH?"
873 FPTOOLS_CHECK_PERL_VERSION
878 dnl ** does #! path/to/perl work? (sometimes it's too long...)
881 dnl ** check for Python
882 AC_PATH_PROG(PythonCmd,python)
884 dnl ** look for GCC and find out which version
885 dnl Figure out which C compiler to use. Gcc is preferred.
886 dnl If gcc, make sure it's at least 2.1
890 FP_GCC_NEEDS_NO_OMIT_LFPTR
891 FP_GCC_HAS_NO_UNIT_AT_A_TIME
894 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
897 dnl ** Without optimization some INLINE trickery fails for GHCi
900 dnl ** Try to add -mno-cygwin to the C compiler options
901 FP_CHECK_FLAG([-mno-cygwin], [
902 SRC_CC_OPTS="-mno-cygwin $SRC_CC_OPTS"
903 CPPFLAGS="-mno-cygwin $CPPFLAGS"])
904 AC_SUBST(SRC_CC_OPTS)
906 dnl ** figure out how to do context diffs
909 dnl ** Find find command (for Win32's benefit)
912 dnl ** Find sort command (for the benefit of Win32 environs)
915 dnl ** figure out how to do a BSD-ish install
917 dnl Let's make sure install-sh is executable here. If we got it from
918 dnl a darcs repo, it might not be (see bug #978).
921 dnl If you can run configure, you certainly have /bin/sh
922 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
924 dnl ** how to invoke `ar' and `ranlib'
925 FP_PROG_AR_NEEDS_RANLIB
926 FP_PROG_AR_SUPPORTS_INPUT
928 dnl ** Check to see whether ln -s works
932 dnl ** Find the path to sed
933 AC_PATH_PROG(SedCmd,sed)
936 dnl ** check for time command
937 AC_PATH_PROG(TimeCmd,time)
940 dnl if GNU tar is named gtar, look for it first.
941 AC_PATH_PROGS(TarCmd,gtar tar,tar)
943 dnl ** check for DocBook toolchain
945 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])
948 dnl ** check for ghc-pkg command
951 AC_ARG_WITH(greencard,
952 [AC_HELP_STRING([--with-greencard=ARG],
953 [Use ARG as the path to greencard [default=autodetct]])],
955 GreenCardCmd=$withval;
956 FPTOOLS_GREENCARD(3.00)
960 dnl ** check for installed happy binary + version
961 dnl (don't do it if we're booting from .hc files though.)
962 if test "$BootingFromHc" = "NO"; then
966 dnl ** check for installed haddock
969 dnl ** check for installed alex binary + version
970 dnl (don't do it if we're booting from .hc files though.)
971 if test "$BootingFromHc" = "NO"; then
975 dnl --------------------------------------------------
976 dnl ### program checking section ends here ###
977 dnl --------------------------------------------------
979 dnl --------------------------------------------------
980 dnl * Platform header file and syscall feature tests
981 dnl ### checking the state of the local header files and syscalls ###
983 dnl ** check for full ANSI header (.h) files
986 dnl ** Enable large file support. NB. do this before testing the type of
987 dnl off_t, because it will affect the result of that test.
990 dnl ** check for specific header (.h) files that we are interested in
991 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])
993 AC_CHECK_HEADER([readline/readline.h], [HaveReadlineReadlineH=YES], [HaveReadlineReadlineH=NO])
994 AC_CHECK_HEADER([readline/history.h], [HaveReadlineHistoryH=YES], [HaveReadlineHistoryH=NO])
996 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
997 GhcLibsWithReadline=YES
998 AC_DEFINE([HAVE_READLINE_HEADERS], [1], [Define to 1 if readline/readline.h and readline/history.h exist.])
1000 GhcLibsWithReadline=NO
1001 AC_DEFINE([HAVE_READLINE_HEADERS], [0], [Define to 1 if readline/readline.h and readline/history.h exist.])
1003 AC_SUBST(GhcLibsWithReadline)
1005 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
1008 dnl ** do we have long longs?
1009 AC_CHECK_TYPES([long long])
1011 dnl ** what are the sizes of various types
1012 AC_CHECK_SIZEOF(char, 1)
1013 AC_CHECK_SIZEOF(double, 8)
1014 AC_CHECK_SIZEOF(float, 4)
1015 AC_CHECK_SIZEOF(int, 4)
1016 AC_CHECK_SIZEOF(long, 4)
1017 if test "$ac_cv_type_long_long" = yes; then
1018 AC_CHECK_SIZEOF(long long, 8)
1020 AC_CHECK_SIZEOF(short, 2)
1021 AC_CHECK_SIZEOF(unsigned char, 1)
1022 AC_CHECK_SIZEOF(unsigned int, 4)
1023 AC_CHECK_SIZEOF(unsigned long, 4)
1024 if test "$ac_cv_type_long_long" = yes; then
1025 AC_CHECK_SIZEOF(unsigned long long, 8)
1027 AC_CHECK_SIZEOF(unsigned short, 2)
1028 AC_CHECK_SIZEOF(void *, 4)
1030 dnl ** what are alignment constraints on various types
1031 FP_CHECK_ALIGNMENT(char)
1032 FP_CHECK_ALIGNMENT(double)
1033 FP_CHECK_ALIGNMENT(float)
1034 FP_CHECK_ALIGNMENT(int)
1035 FP_CHECK_ALIGNMENT(long)
1036 if test "$ac_cv_type_long_long" = yes; then
1037 FP_CHECK_ALIGNMENT(long long)
1039 FP_CHECK_ALIGNMENT(short)
1040 FP_CHECK_ALIGNMENT(unsigned char)
1041 FP_CHECK_ALIGNMENT(unsigned int)
1042 FP_CHECK_ALIGNMENT(unsigned long)
1043 if test "$ac_cv_type_long_long" = yes; then
1044 FP_CHECK_ALIGNMENT(unsigned long long)
1046 FP_CHECK_ALIGNMENT(unsigned short)
1047 FP_CHECK_ALIGNMENT(void *)
1049 FP_CHECK_FUNC([WinExec],
1050 [@%:@include <windows.h>], [WinExec("",0)])
1052 FP_CHECK_FUNC([GetModuleFileName],
1053 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1055 dnl ** check return type of signal handlers
1056 dnl Foo: assumes we can use prototypes.
1057 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1058 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1059 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1060 dnl #include <signal.h>
1064 dnl void (*signal (int, void (*)(int)))(int);
1067 dnl [ac_cv_type_signal_handler=void_int],
1068 dnl [ac_cv_type_signal_handler=int_void])])
1069 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1070 dnl AC_DEFINE(VOID_INT_SIGNALS)
1073 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1075 if test "$ac_cv_type_signal" = void; then
1076 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).])
1079 dnl ** check for more functions
1080 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1081 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r])
1082 dnl ** For ghc/rts/gmp:
1083 AC_CHECK_FUNCS([getpagesize])
1085 dnl ** check whether this machine has gmp3 installed
1086 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1087 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
1088 HaveLibGmp=NO; LibGmp=not-installed))
1089 AC_SUBST(HaveLibGmp)
1092 dnl ** (Mac OS X only: check for GMP.framework)
1094 case $HostPlatform in
1096 AC_MSG_CHECKING([for GMP.framework])
1098 LIBS="-framework GMP"
1099 AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkGMP=YES,)
1100 if test $HaveFrameworkGMP = YES; then
1101 AC_DEFINE([HAVE_FRAMEWORK_GMP], [1], [Define to 1 if GMP.framework is installed (Mac OS X only).])
1104 AC_MSG_RESULT([$HaveFrameworkGMP])
1107 AC_SUBST(HaveFrameworkGMP)
1109 dnl ** check for mingwex library
1110 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1111 AC_SUBST(HaveLibMingwEx)
1113 if test $HaveLibMingwEx = YES ; then
1114 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1117 if test "$HaveLibGmp" = "NO"; then
1118 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1119 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1123 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1124 dnl the order of these tests matters: bfd needs liberty
1125 AC_CHECK_LIB(iberty, xmalloc)
1126 AC_CHECK_LIB(bfd, bfd_init)
1128 dnl ** check for math library
1129 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1130 if test x"$fp_libm_not_needed" = xdunno; then
1131 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1135 dnl ################################################################
1136 dnl Check for libraries
1137 dnl ################################################################
1139 dnl ** check whether we need -ldl to get dlopen()
1141 AC_CHECK_LIB(dl, dlopen,
1143 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1148 dnl --------------------------------------------------
1149 dnl * Miscellaneous feature tests
1150 dnl --------------------------------------------------
1152 dnl ** can we get alloca?
1155 dnl ** Working vfork?
1158 dnl ** determine whether or not const works
1161 dnl ** are we big endian?
1163 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
1165 dnl ** check for leading underscores in symbol names
1166 FP_LEADING_UNDERSCORE
1168 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1172 dnl ** check for Apple-style dead-stripping support
1173 dnl (.subsections-via-symbols assembler directive)
1176 AC_MSG_CHECKING(for .subsections_via_symbols)
1178 [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
1180 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1181 [Define to 1 if Apple-style dead-stripping is supported.])
1183 [AC_MSG_RESULT(no)])
1185 dnl *** check for GNU non-executable stack note support (ELF only)
1186 dnl (.section .note.GNU-stack,"",@progbits)
1188 AC_MSG_CHECKING(for GNU non-executable stack support)
1190 [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
1192 AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
1193 [Define to 1 if GNU non-executable stack notes are supported.])
1195 [AC_MSG_RESULT(no)])
1197 dnl ** check for librt
1198 AC_CHECK_LIB(rt, clock_gettime)
1199 AC_CHECK_FUNCS(clock_gettime)
1201 dnl ** check for Apple's "interesting" long double compatibility scheme
1202 AC_MSG_CHECKING(for printf\$LDBLStub)
1203 AC_TRY_LINK_FUNC(printf\$LDBLStub,
1206 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
1207 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1211 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
1212 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1216 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
1217 if test -n "$GTK_CONFIG"; then
1218 if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
1219 GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
1221 AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
1225 AC_SUBST([GTK_CONFIG])
1228 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
1229 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
1230 AC_SUBST(HavePapiLib)
1231 AC_SUBST(HavePapiHeader)
1233 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
1240 AC_CONFIG_FILES([mk/config.mk ghc.spec docs/users_guide/ug-book.xml])
1241 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])