1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (run "grep '^dnl \*' configure.ac | sed -e 's/dnl / /g; s/\*\*/ +/g;'"
3 dnl (or some such) to see the outline of this file)
6 # (c) The AQUA Project, Glasgow University, 1994-2004
8 # Configure script template for the Glasgow functional programming tools
10 # Process with 'autoreconf' to get a working configure script.
12 # For the generated configure script, do "./configure --help" to
13 # see what flags are available. (Better yet, read the documentation!)
16 AC_INIT([fptools build system], [1.0], [cvs-fptools@haskell.org], [fptools])
18 # First off, a distrib sanity check..
19 AC_CONFIG_SRCDIR([mk/config.mk.in])
21 dnl * We require autoconf version 2.52
22 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
23 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
26 dnl * Declare subdirectories that have a private configure script
28 dnl After the toplevel configuration is complete, the script will recurse into
29 dnl these subdirectories if they exist. The use of a cache file makes repeated
31 AC_CONFIG_SUBDIRS([ghc libraries])
33 # -------------------------------------------------------------------------
34 # Prepare to generate the following header files
37 AC_CONFIG_HEADER(mk/config.h)
39 # No, semi-sadly, we don't do `--srcdir'...
40 if test x"$srcdir" != 'x.' ; then
41 echo "This configuration does not support the \`--srcdir' option.."
45 dnl--------------------------------------------------------------------
46 dnl * Choose host(/target/build) platform
47 dnl--------------------------------------------------------------------
49 dnl Guess host/target/build platform(s) if necessary.
52 # "$host" defaults to "$target"
53 if test "x$host" = xNONE ; then
57 dnl ** canonicalize platform names
58 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
59 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
60 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
62 if test x"$TargetPlatform" != x"$HostPlatform" ; then
63 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
69 # The following will be more difficult when we *are* cross-compiling.
70 # Suitable names to slam in *_CPP are in platform.h.in.
71 # We also record the architecture, vendor, and operating system (OS)
74 alpha*-dec-osf[[12]]*)
75 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
76 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
77 BuildPlatform=alpha-dec-osf1 # hack
78 HostPlatform_CPP='alpha_dec_osf1'
83 alpha*-dec-osf[[345]]*)
84 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
85 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
86 BuildPlatform=alpha-dec-osf3 # hack
87 HostPlatform_CPP='alpha_dec_osf3'
92 alpha*-unknown-linux*)
93 HostPlatform=alpha-unknown-linux
94 TargetPlatform=alpha-unknown-linux
95 BuildPlatform=alpha-unknown-linux
96 HostPlatform_CPP='alpha_unknown_linux'
98 HostVendor_CPP='unknown'
101 alpha*-unknown-freebsd*)
102 HostPlatform=alpha-unknown-freebsd
103 TargetPlatform=alpha-unknown-freebsd
104 BuildPlatform=alpha-unknown-freebsd
105 HostPlatform_CPP='alpha_unknown_freebsd'
107 HostVendor_CPP='unknown'
110 alpha*-unknown-openbsd*)
111 HostPlatform=alpha-unknown-openbsd
112 TargetPlatform=alpha-unknown-openbsd
113 BuildPlatform=alpha-unknown-openbsd
114 HostPlatform_CPP='alpha_unknown_openbsd'
116 HostVendor_CPP='unknown'
119 amd64-*-openbsd*|x86_64-*-openbsd*)
120 HostPlatform=x86_64-unknown-openbsd
121 TargetPlatform=x86_64-unknown-openbsd
122 BuildPlatform=x86_64-unknown-openbsd
123 HostPlatform_CPP='x86_64_unknown_openbsd'
124 HostArch_CPP='x86_64'
125 HostVendor_CPP='unknown'
129 HostPlatform=arm-unknown-linux # hack again
130 TargetPlatform=arm-unknown-linux
131 BuildPlatform=arm-unknown-linux
132 HostPlatform_CPP='arm_unknown_linux'
134 HostVendor_CPP='unknown'
138 HostPlatform=arm-unknown-openbsd
139 TargetPlatform=arm-unknown-openbsd
140 BuildPlatform=arm-unknown-openbsd
141 HostPlatform_CPP='arm_unknown_openbsd'
143 HostVendor_CPP='unknown'
147 HostPlatform=hppa-unknown-linux # hack again
148 TargetPlatform=hppa-unknown-linux
149 BuildPlatform=hppa-unknown-linux
150 HostPlatform_CPP='hppa_unknown_linux'
152 HostVendor_CPP='unknown'
156 HostPlatform=hppa-unknown-openbsd # hack again
157 TargetPlatform=hppa-unknown-openbsd
158 BuildPlatform=hppa-unknown-openbsd
159 HostPlatform_CPP='hppa_unknown_openbsd'
161 HostVendor_CPP='unknown'
165 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
166 TargetPlatform=hppa1.1-hp-hpux
167 BuildPlatform=hppa1.1-hp-hpux
168 HostPlatform_CPP='hppa1_1_hp_hpux'
169 HostArch_CPP='hppa1_1'
173 i[[3456]]86-*-linuxaout*)
174 HostPlatform=i386-unknown-linuxaout # hack again
175 TargetPlatform=i386-unknown-linuxaout
176 BuildPlatform=i386-unknown-linuxaout
177 HostPlatform_CPP='i386_unknown_linuxaout'
179 HostVendor_CPP='unknown'
180 HostOS_CPP='linuxaout'
182 i[[3456]]86-*-linux*)
183 HostPlatform=i386-unknown-linux # hack again
184 TargetPlatform=i386-unknown-linux
185 BuildPlatform=i386-unknown-linux
186 HostPlatform_CPP='i386_unknown_linux'
188 HostVendor_CPP='unknown'
192 HostPlatform=i386-unknown-gnu
193 TargetPlatform=i386-unknown-gnu
194 BuildPlatform=i386-unknown-gnu
195 HostPlatform_CPP=i386_unknown_gnu
197 HostVendor_CPP=unknown
200 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
201 HostPlatform=i386-unknown-freebsd # hack again
202 TargetPlatform=i386-unknown-freebsd
203 BuildPlatform=i386-unknown-freebsd
204 HostPlatform_CPP='i386_unknown_freebsd'
206 HostVendor_CPP='unknown'
209 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
210 HostPlatform=i386-unknown-freebsd2 # hack again
211 TargetPlatform=i386-unknown-freebsd2
212 BuildPlatform=i386-unknown-freebsd2
213 HostPlatform_CPP='i386_unknown_freebsd2'
215 HostVendor_CPP='unknown'
216 HostOS_CPP='freebsd2'
218 i[[3456]]86-*-netbsd*)
219 HostPlatform=i386-unknown-netbsd # hack again
220 TargetPlatform=i386-unknown-netbsd
221 BuildPlatform=i386-unknown-netbsd
222 HostPlatform_CPP='i386_unknown_netbsd'
224 HostVendor_CPP='unknown'
227 i[[3456]]86-*-openbsd*)
228 HostPlatform=i386-unknown-openbsd # hack again
229 TargetPlatform=i386-unknown-openbsd
230 BuildPlatform=i386-unknown-openbsd
231 HostPlatform_CPP='i386_unknown_openbsd'
233 HostVendor_CPP='unknown'
236 i[[3456]]86-*-solaris2*)
237 HostPlatform=i386-unknown-solaris2 # hack again
238 TargetPlatform=i386-unknown-solaris2
239 BuildPlatform=i386-unknown-solaris2
240 HostPlatform_CPP='i386_unknown_solaris2'
242 HostVendor_CPP='unknown'
243 HostOS_CPP='solaris2'
245 i[[3456]]86-*-cygwin*)
246 HostPlatform=i386-unknown-cygwin32 # hack again
247 TargetPlatform=i386-unknown-cygwin32
248 BuildPlatform=i386-unknown-cygwin32
249 HostPlatform_CPP='i386_unknown_cygwin32'
251 HostVendor_CPP='unknown'
252 HostOS_CPP='cygwin32'
255 i[[3456]]86-*-mingw32*)
256 HostPlatform=i386-unknown-mingw32 # hack again
257 TargetPlatform=i386-unknown-mingw32
258 BuildPlatform=i386-unknown-mingw32
259 HostPlatform_CPP='i386_unknown_mingw32'
261 HostVendor_CPP='unknown'
266 HostPlatform=ia64-unknown-linux # hack again
267 TargetPlatform=ia64-unknown-linux
268 BuildPlatform=ia64-unknown-linux
269 HostPlatform_CPP='ia64_unknown_linux'
271 HostVendor_CPP='unknown'
275 HostPlatform=x86_64-unknown-linux
276 TargetPlatform=x86_64-unknown-linux
277 BuildPlatform=x86_64-unknown-linux
278 HostPlatform_CPP='x86_64_unknown_linux'
279 HostArch_CPP='x86_64'
280 HostVendor_CPP='unknown'
284 HostPlatform=m68k-unknown-linux # hack again
285 TargetPlatform=m68k-unknown-linux
286 BuildPlatform=m68k-unknown-linux
287 HostPlatform_CPP='m68k_unknown_linux'
289 HostVendor_CPP='unknown'
293 HostPlatform_CPP='m68k_next_nextstep2'
295 HostVendor_CPP='next'
296 HostOS_CPP='nextstep2'
299 HostPlatform_CPP='m68k_next_nextstep3'
301 HostVendor_CPP='next'
302 HostOS_CPP='nextstep3'
304 i[[3456]]86-next-nextstep3)
305 HostPlatform=i386-next-nextstep3 # hack again
306 TargetPlatform=i386-next-nextstep3
307 BuildPlatform=i386-next-nextstep3
308 HostPlatform_CPP='i386_next_nextstep3'
310 HostVendor_CPP='next'
311 HostOS_CPP='nextstep3'
314 HostPlatform=m68k-unknown-openbsd
315 TargetPlatform=m68k-unknown-openbsd
316 BuildPlatform=m68k-unknown-openbsd
317 HostPlatform_CPP='m68k_unknown_openbsd'
319 HostVendor_CPP='unknown'
323 HostPlatform=m68k-unknown-netbsd
324 TargetPlatform=m68k-unknown-netbsd
325 BuildPlatform=m68k-unknown-netbsd
326 HostPlatform_CPP='m68k_unknown_netbsd'
328 HostVendor_CPP='unknown'
332 HostPlatform=m68k-sun-sunos4
333 TargetPlatform=m68k-sun-sunos4 #hack
334 BuildPlatform=m68k-sun-sunos4 #hack
335 HostPlatform_CPP='m68k_sun_sunos4'
341 HostPlatform=m88k-unknown-openbsd
342 TargetPlatform=m88k-unknown-openbsd
343 BuildPlatform=m88k-unknown-openbsd
344 HostPlatform_CPP='m88k_unknown_openbsd'
346 HostVendor_CPP='unknown'
350 HostPlatform=mips-unknown-linux # hack again
351 TargetPlatform=mips-unknown-linux
352 BuildPlatform=mips-unknown-linux
353 HostPlatform_CPP='mips_unknown_linux'
355 HostVendor_CPP='unknown'
359 HostPlatform_CPP='mips_dec_ultrix'
360 HostArch_CPP='mipsel' # NB a little different
365 HostPlatform=mips-sgi-irix
366 TargetPlatform=mips-sgi-irix #hack
367 BuildPlatform=mips-sgi-irix #hack
368 HostPlatform_CPP='mips_sgi_irix'
369 HostArch_CPP='mipseb' # NB a little different
374 HostPlatform=rs6000-ibm-aix
375 TargetPlatform=rs6000-ibm-aix #hack
376 BuildPlatform=rs6000-ibm-aix #hack
377 HostPlatform_CPP='rs6000_ibm_aix'
378 HostArch_CPP='rs6000'
383 HostPlatform=powerpc-ibm-aix
384 TargetPlatform=powerpc-ibm-aix #hack
385 BuildPlatform=powerpc-ibm-aix #hack
386 HostPlatform_CPP='powerpc_ibm_aix'
387 HostArch_CPP='powerpc'
391 powerpc-apple-darwin*)
392 HostPlatform=powerpc-apple-darwin
393 TargetPlatform=powerpc-apple-darwin #hack
394 BuildPlatform=powerpc-apple-darwin #hack
395 HostPlatform_CPP='powerpc_apple_darwin'
396 HostArch_CPP='powerpc'
397 HostVendor_CPP='apple'
400 powerpc-unknown-linux*)
401 HostPlatform=powerpc-unknown-linux
402 TargetPlatform=powerpc-unknown-linux
403 BuildPlatform=powerpc-unknown-linux
404 HostPlatform_CPP='powerpc_unknown_linux'
405 HostArch_CPP='powerpc'
406 HostVendor_CPP='unknown'
409 powerpc-unknown-openbsd*)
410 HostPlatform=powerpc-unknown-openbsd
411 TargetPlatform=powerpc-unknown-openbsd
412 BuildPlatform=powerpc-unknown-openbsd
413 HostPlatform_CPP='powerpc_unknown_openbsd'
414 HostArch_CPP='powerpc'
415 HostVendor_CPP='unknown'
418 powerpc64-unknown-linux*)
419 HostPlatform=powerpc64-unknown-linux
420 TargetPlatform=powerpc64-unknown-linux
421 BuildPlatform=powerpc64-unknown-linux
422 HostPlatform_CPP='powerpc64_unknown_linux'
423 HostArch_CPP='powerpc64'
424 HostVendor_CPP='unknown'
429 HostPlatform=s390-ibm-linux
430 TargetPlatform=s390-ibm-linux #hack
431 BuildPlatform=s390-ibm-linux #hack
432 HostPlatform_CPP='s390_ibm_linux'
438 HostPlatform=sparc-sun-sunos4
439 TargetPlatform=sparc-sun-sunos4 #hack
440 BuildPlatform=sparc-sun-sunos4 #hack
441 HostPlatform_CPP='sparc_sun_sunos4'
447 HostPlatform=sparc-sun-solaris2
448 TargetPlatform=sparc-sun-solaris2 #hack
449 BuildPlatform=sparc-sun-solaris2 #hack
450 HostPlatform_CPP='sparc_sun_solaris2'
453 HostOS_CPP='solaris2'
456 HostPlatform=sparc-unknown-linux
457 TargetPlatform=sparc-unknown-linux
458 BuildPlatform=sparc-unknown-linux
459 HostPlatform_CPP='sparc_unknown_linux'
461 HostVendor_CPP='unknown'
465 HostPlatform=sparc-unknown-openbsd
466 TargetPlatform=sparc-unknown-openbsd
467 BuildPlatform=sparc-unknown-openbsd
468 HostPlatform_CPP='sparc_unknown_openbsd'
470 HostVendor_CPP='unknown'
474 HostPlatform=sparc64-unknown-openbsd
475 TargetPlatform=sparc64-unknown-openbsd
476 BuildPlatform=sparc64-unknown-openbsd
477 HostPlatform_CPP='sparc64_unknown_openbsd'
478 HostArch_CPP='sparc64'
479 HostVendor_CPP='unknown'
483 HostPlatform=vax-unknown-openbsd
484 TargetPlatform=vax-unknown-openbsd
485 BuildPlatform=vax-unknown-openbsd
486 HostPlatform_CPP='vax_unknown_openbsd'
488 HostVendor_CPP='unknown'
492 echo "Unrecognised platform: $HostPlatform"
496 echo "Canonicalised to: $HostPlatform"
497 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
498 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
500 BuildPlatform_CPP=$HostPlatform_CPP
501 TargetPlatform_CPP=$HostPlatform_CPP
502 BuildArch_CPP=$HostArch_CPP
503 TargetArch_CPP=$HostArch_CPP
504 BuildOS_CPP=$HostOS_CPP
506 TargetOS_CPP=$HostOS_CPP
507 BuildVendor_CPP=$HostVendor_CPP
508 TargetVendor_CPP=$HostVendor_CPP
510 AC_SUBST(BuildPlatform)
511 AC_SUBST(HostPlatform)
512 AC_SUBST(TargetPlatform)
513 AC_SUBST(HostPlatform_CPP)
514 AC_SUBST(BuildPlatform_CPP)
515 AC_SUBST(TargetPlatform_CPP)
517 AC_SUBST(HostArch_CPP)
518 AC_SUBST(BuildArch_CPP)
519 AC_SUBST(TargetArch_CPP)
522 AC_SUBST(HostOS_Full)
523 AC_SUBST(BuildOS_CPP)
524 AC_SUBST(TargetOS_CPP)
526 AC_SUBST(HostVendor_CPP)
527 AC_SUBST(BuildVendor_CPP)
528 AC_SUBST(TargetVendor_CPP)
532 dnl --------------------------------------------------------------
533 dnl * Calculate absolute path to build tree
534 dnl --------------------------------------------------------------
536 AC_MSG_CHECKING(for path to top of build tree)
540 dnl Remove common automounter nonsense
542 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
544 dnl Find 'hardtop_plat', the native format for 'hardtop'
545 dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes being escaped).
547 dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert /cygdrive/c/foo to c:/foo
548 dnl but we must not do that if we aren't building using Cygwin (notably msys),
549 dnl because cygpath doesn't exist. It seems that 'bash' sets OSTYPE to 'cygwin'
550 dnl or 'msys' respectively, but cygwin's 'sh' does not. So we hackily assume
551 dnl that if the shell hasn't set it to 'msys' then we must be in Cygwin. Sigh.
553 dnl The Right Thing is probably to test $BuildPlatform instead, but we are sloppy
554 dnl about setting that correctly at the moment, so we just work around for now.
556 dnl The quotes round "$(OSTYPE)" are essential, for the Cygwin-sh case where OSTYPE
558 case $HostPlatform in
559 i386-unknown-mingw32 | i386-unknown-cygwin32)
560 if test "${OSTYPE}" != "msys"
562 # convert $hardtop to a path that mingw will understand too
563 cyghardtop=${hardtop}
564 hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
565 hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
567 hardtop_plat=${hardtop}
571 hardtop_plat=${hardtop}
575 AC_SUBST(hardtop_plat)
577 AC_MSG_RESULT(${hardtop})
579 # We don't support building in directories with spaces.
581 *' '*) AC_MSG_ERROR([
582 The build system does not support building in a directory containing
583 space characters. Suggestion: move the build tree somewhere else.])
587 dnl --------------------------------------------------------------
588 dnl * Project specific configuration options
589 dnl --------------------------------------------------------------
590 dnl What follows is a bunch of options that can either be configured
591 dnl through command line options to the configure script or by
592 dnl supplying defns in the build tree's mk/build.mk. Having the option to
593 dnl use either is considered a Feature.
595 dnl ** What command to use to compile compiler sources ?
596 dnl --------------------------------------------------------------
599 [AC_HELP_STRING([--with-ghc=ARG],
600 [Use ARG as the path to GHC [default=autodetect]])],
601 [WithGhc="$withval"],
602 [if test "$GHC" = ""; then
603 AC_PATH_PROG([GHC], [ghc])
609 [AC_HELP_STRING([--with-hc=ARG],
610 [Use ARG as the path to the compiler for compiling ordinary
611 Haskell code (default= value of --with-ghc)])],
617 if test "$WithGhc" != ""; then
618 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
619 AC_SUBST(GhcVersion)dnl
620 AC_SUBST(GhcMajVersion)dnl
621 AC_SUBST(GhcMinVersion)dnl
622 AC_SUBST(GhcPatchLevel)dnl
625 AC_PATH_PROGS(NHC,nhc nhc98)
626 AC_PATH_PROG(HBC,hbc)
628 dnl ** Which gcc to use?
629 dnl --------------------------------------------------------------
631 [AC_HELP_STRING([--with-gcc=ARG],
632 [Use ARG as the path to GCC [default=autodetect]])],
633 [WhatGccIsCalled="$withval"
634 if test "x$HostPlatform" = "xi386-unknown-mingw32"
636 if test "${OSTYPE}" != "msys"
638 # Canonicalise to <drive>:/path/to/gcc
639 withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
645 [WhatGccIsCalled="gcc"]
647 AC_SUBST(WhatGccIsCalled)
649 dnl ** Booting from .hc files?
650 dnl --------------------------------------------------------------
651 AC_ARG_ENABLE(hc-boot,
652 [AC_HELP_STRING([--enable-hc-boot],
653 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
654 (This option is mostly of interest to porters.) [default=no]])],
655 [ if test x"$enableval" = x"yes"; then
663 AC_SUBST(BootingFromHc)
665 dnl ** Booting from unregisterised .hc files?
666 dnl --------------------------------------------------------------
667 AC_ARG_ENABLE(hc-boot-unregisterised,
668 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
669 [ With --enable-hc-boot, treat the intermediate .hc files as
670 unregisterised rather than registerised code.
671 (This option is mostly of interest to porters.) [default=no]])],
672 [ if test x"$enableval" = x"yes"; then
673 BootingFromUnregisterisedHc=YES
675 BootingFromUnregisterisedHc=NO
678 [BootingFromUnregisterisedHc=NO]
680 AC_SUBST(BootingFromUnregisterisedHc)
682 if test "$BootingFromHc" = "NO"; then
683 if test "$BootingFromUnregisterisedHc" = "YES"; then
684 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
688 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
689 if test "$BootingFromHc" = "NO" -a "$WithGhc" = "" -a -d "$srcdir/ghc"; then
690 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
693 dnl ** --enable-threaded-rts (not used any more)
694 dnl --------------------------------------------------------------
695 AC_ARG_ENABLE(threaded-rts,
696 [AC_HELP_STRING([--enable-threaded-rts],
697 [DEPRECATED (backwards compatibility only). [default=no]])],
698 [ if test x"$enableval" = x"yes"; then
706 AC_SUBST(ThreadedRts)
708 dnl ** Enable the construction of Win32 DLLs?
709 dnl --------------------------------------------------------------
711 dnl [ The ability to build the RTS and libraries as separate DLLs used
712 dnl to be supported, but isn't currently (updates to the RTS, compiler
713 dnl and build system would be required to bring it back again.)
714 dnl Hence, exposing it as an option is false advertisement, so better
715 dnl disable it to avoid confusion (but leave it commented-out rather
716 dnl than removed in order to remind ourselves to bring back the
717 dnl feature at some stage.) ]
719 dnl AC_ARG_ENABLE(win32-dlls,
720 dnl [ --enable-win32-dlls
721 dnl If on a Win32 platform running mingw32/cygwin, enable the
722 dnl construction of DLLs containing ghc-compiled code.
725 dnl case $HostOS_CPP in
728 dnl *) echo "Unrecognised win32 platform: $HostPlatform"
732 dnl EnableWin32DLLs=YES
734 dnl [EnableWin32DLLs=NO]
736 dnl AC_SUBST(EnableWin32DLLs)
737 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
738 dnl AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
741 dnl ** Enable the building of the ObjectIO?
742 dnl --------------------------------------------------------------
743 AC_ARG_ENABLE(objectio,
744 [AC_HELP_STRING([--enable-objectio],
745 [Build ObjectIO, a portable GUI library for Haskell. [default=no]])],
746 [ if test x"$enableval" = x"yes"; then
747 GhcLibsWithObjectIO=YES
749 GhcLibsWithObjectIO=NO
752 [GhcLibsWithObjectIO=NO]
754 AC_SUBST(GhcLibsWithObjectIO)
756 dnl ** .NET interop support?
757 dnl --------------------------------------------------------------
758 AC_ARG_ENABLE(dotnet,
759 [AC_HELP_STRING([--enable-dotnet],
760 [Build .NET interop layer. [default=no]])],
761 [ if test x"$enableval" = x"yes"; then
762 DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
768 AC_SUBST(DotnetSupport)
770 dnl --------------------------------------------------------------
771 dnl End of configure script option section
772 dnl --------------------------------------------------------------
775 dnl --------------------------------------------------------------
776 dnl * General configuration checks
777 dnl --------------------------------------------------------------
779 dnl ** Can the unix package be built?
780 dnl --------------------------------------------------------------
782 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
787 AC_SUBST([GhcLibsWithUnix])
792 dnl ** look for `perl', but only in /bin on Windows
795 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
796 if test -z "$PerlCmd"; then
797 echo "You must install the version of Perl shipped with GHC"
798 echo "(or a compatible one) in /bin."
803 AC_PATH_PROG(PerlCmd,perl)
804 if test -z "$PerlCmd"; then
805 echo "You must install perl before you can continue"
806 echo "Perhaps it is already installed, but not in your PATH?"
809 FPTOOLS_CHECK_PERL_VERSION
814 dnl ** does #! path/to/perl work? (sometimes it's too long...)
817 dnl ** check for Python
818 AC_PATH_PROG(PythonCmd,python)
820 dnl ** look for GCC and find out which version
821 dnl Figure out which C compiler to use. Gcc is preferred.
822 dnl If gcc, make sure it's at least 2.1
827 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
830 dnl ** Without optimization some INLINE trickery fails for GHCi
833 dnl ** Try to add -mno-cygwin to the C compiler options
834 FP_CHECK_FLAG([-mno-cygwin], [
835 SRC_CC_OPTS="-mno-cygwin $SRC_CC_OPTS"
836 CPPFLAGS="-mno-cygwin $CPPFLAGS"])
837 AC_SUBST(SRC_CC_OPTS)
839 dnl ** figure out how to do context diffs
842 dnl ** Find find command (for Win32's benefit)
845 dnl ** Find sort command (for the benefit of Win32 environs)
848 dnl ** figure out how to do a BSD-ish install
851 dnl If you can run configure, you certainly have /bin/sh
852 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
854 dnl ** how to invoke `ar' and `ranlib'
855 FP_PROG_AR_NEEDS_RANLIB
856 FP_PROG_AR_SUPPORTS_INPUT
858 dnl ** Check to see whether ln -s works
862 dnl ** Find the path to sed
863 AC_PATH_PROG(SedCmd,sed)
866 dnl ** check for time command
867 AC_PATH_PROG(TimeCmd,time)
870 dnl if GNU tar is named gtar, look for it first.
871 AC_PATH_PROGS(TarCmd,gtar tar,tar)
873 dnl ** check for DocBook toolchain
875 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])
878 dnl ** check for ghc-pkg command
881 AC_ARG_WITH(greencard,
882 [AC_HELP_STRING([--with-greencard=ARG],
883 [Use ARG as the path to greencard [default=autodetct]])],
885 GreenCardCmd=$withval;
886 FPTOOLS_GREENCARD(3.00)
890 AC_ARG_ENABLE(src-tree-happy,
891 [AC_HELP_STRING([--enable-src-tree-happy],
892 [Build and use source tree (fptools/happy) version of Happy.
893 [default=autodetect]])],
894 [ if test x"$enableval" = x"yes"; then
902 dnl ** check for installed happy binary + version
903 dnl (don't do it if we're booting from .hc files though.)
904 if test "$BootingFromHc" = "NO"; then
908 AC_ARG_ENABLE(src-tree-haddock,
909 [AC_HELP_STRING([--enable-src-tree-haddock],
910 [Build and use source tree (fptools/haddock) version of Haddock.
911 [default=autodetect]])],
912 [ if test x"$enableval" = x"yes"; then
913 UseSrcTreeHaddock=YES
918 [UseSrcTreeHaddock=NO]
920 dnl ** check for installed haddock
923 AC_ARG_ENABLE(src-tree-alex,
924 [AC_HELP_STRING([--enable-src-tree-alex],
925 [Build and use source tree (fptools/alex) version of Alex.
926 [default=autodetect]])],
927 [ if test x"$enableval" = x"yes"; then
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 ** how do we get a timezone name, and UTC offset ?
977 dnl ** do we have altzone?
980 dnl ** do we have long longs?
981 AC_CHECK_TYPES([long long])
983 dnl ** what are the sizes of various types
984 AC_CHECK_SIZEOF(char, 1)
985 AC_CHECK_SIZEOF(double, 8)
986 AC_CHECK_SIZEOF(float, 4)
987 AC_CHECK_SIZEOF(int, 4)
988 AC_CHECK_SIZEOF(long, 4)
989 if test "$ac_cv_type_long_long" = yes; then
990 AC_CHECK_SIZEOF(long long, 8)
992 AC_CHECK_SIZEOF(short, 2)
993 AC_CHECK_SIZEOF(unsigned char, 1)
994 AC_CHECK_SIZEOF(unsigned int, 4)
995 AC_CHECK_SIZEOF(unsigned long, 4)
996 if test "$ac_cv_type_long_long" = yes; then
997 AC_CHECK_SIZEOF(unsigned long long, 8)
999 AC_CHECK_SIZEOF(unsigned short, 2)
1000 AC_CHECK_SIZEOF(void *, 4)
1002 dnl ** what are alignment constraints on various types
1003 FP_CHECK_ALIGNMENT(char)
1004 FP_CHECK_ALIGNMENT(double)
1005 FP_CHECK_ALIGNMENT(float)
1006 FP_CHECK_ALIGNMENT(int)
1007 FP_CHECK_ALIGNMENT(long)
1008 if test "$ac_cv_type_long_long" = yes; then
1009 FP_CHECK_ALIGNMENT(long long)
1011 FP_CHECK_ALIGNMENT(short)
1012 FP_CHECK_ALIGNMENT(unsigned char)
1013 FP_CHECK_ALIGNMENT(unsigned int)
1014 FP_CHECK_ALIGNMENT(unsigned long)
1015 if test "$ac_cv_type_long_long" = yes; then
1016 FP_CHECK_ALIGNMENT(unsigned long long)
1018 FP_CHECK_ALIGNMENT(unsigned short)
1019 FP_CHECK_ALIGNMENT(void *)
1021 FP_CHECK_FUNC([WinExec],
1022 [@%:@include <windows.h>], [WinExec("",0)])
1024 FP_CHECK_FUNC([GetModuleFileName],
1025 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1027 dnl ** check return type of signal handlers
1028 dnl Foo: assumes we can use prototypes.
1029 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1030 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1031 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1032 dnl #include <signal.h>
1036 dnl void (*signal (int, void (*)(int)))(int);
1039 dnl [ac_cv_type_signal_handler=void_int],
1040 dnl [ac_cv_type_signal_handler=int_void])])
1041 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1042 dnl AC_DEFINE(VOID_INT_SIGNALS)
1045 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1047 if test "$ac_cv_type_signal" = void; then
1048 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).])
1051 dnl ** check for more functions
1052 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1053 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times])
1054 dnl ** For ghc/rts/gmp:
1055 AC_CHECK_FUNCS([getpagesize])
1057 dnl ** check whether this machine has gmp3 installed
1058 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1059 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
1060 HaveLibGmp=NO; LibGmp=not-installed))
1061 AC_SUBST(HaveLibGmp)
1064 dnl ** (Mac OS X only: check for GMP.framework)
1066 if test $HostPlatform = "powerpc-apple-darwin"; then
1067 AC_MSG_CHECKING([for GMP.framework])
1069 LIBS="-framework GMP"
1070 AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkGMP=YES,)
1071 if test $HaveFrameworkGMP = YES; then
1072 AC_DEFINE([HAVE_FRAMEWORK_GMP], [1], [Define to 1 if GMP.framework is installed (Mac OS X only).])
1075 AC_MSG_RESULT([$HaveFrameworkGMP])
1077 AC_SUBST(HaveFrameworkGMP)
1079 dnl ** check for mingwex library
1080 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1081 AC_SUBST(HaveLibMingwEx)
1083 if test $HaveLibMingwEx = YES ; then
1084 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1087 if test "$HaveLibGmp" = "NO"; then
1088 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1089 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1093 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1094 dnl the order of these tests matters: bfd needs liberty
1095 AC_CHECK_LIB(iberty, xmalloc)
1096 AC_CHECK_LIB(bfd, bfd_init)
1098 dnl ** check for readline, for Hugs and hslibs' Readline
1099 dnl ncurses supersedes termcap and curses, but for compatibility,
1100 dnl we have to check for all...
1101 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=YES; LibTermcap=ncurses,
1102 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=YES; LibTermcap=termcap,
1103 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=YES; LibTermcap=curses,
1104 HaveLibTermcap=NO; LibTermcap=not-installed)))
1106 if test $HaveLibTermcap = YES ; then
1107 LIBS="-l$LibTermcap $LIBS"
1108 AC_CHECK_LIB(readline, readline, HaveLibReadline=YES, HaveLibReadline=NO)
1111 if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES ; then
1112 AC_DEFINE([HAVE_READLINE_LIBS], [1], [Define to 1 if readline plus any additional libs needed for it exist.])
1113 LibsReadline="readline $LibTermcap"
1115 AC_DEFINE([HAVE_READLINE_LIBS], [0], [Define to 1 if readline plus any additional libs needed for it exist.])
1118 AC_SUBST(LibsReadline)
1120 if test "$HaveLibReadline"; then
1121 AC_CHECK_LIB(readline, rl_erase_empty_line,
1122 [AC_DEFINE([HAVE_READLINE_4], [1], [Define to 1 if readline has version >= 4.0.])],
1123 [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])])
1124 AC_CHECK_LIB(readline, rl_free_undo_list,
1125 [AC_DEFINE([HAVE_READLINE_4_2], [1], [Define to 1 if readline has version >= 4.2.])],
1126 [AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])])
1128 AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])
1129 AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])
1132 dnl ** check for math library
1133 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1134 if test x"$fp_libm_not_needed" = xdunno; then
1135 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1139 dnl ################################################################
1140 dnl Check for libraries
1141 dnl ################################################################
1143 dnl ** check for libdl & RTLD_NEXT
1145 AC_CHECK_LIB(dl, dlopen,
1147 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1152 dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to set
1153 AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
1162 AC_DEFINE([HAVE_RTLDNEXT], [1], [Define to 1 if we can see RTLD_NEXT in dlfcn.h.])
1168 AC_SUBST(HaveRtldNext)
1170 dnl ** RTLD_LOCAL isn't available on cygwin or openbsd
1171 AC_MSG_CHECKING(for RTLD_LOCAL from dlfcn.h)
1180 AC_DEFINE([HAVE_RTLDLOCAL], [1], [Define to 1 if RTLD_LOCAL is available.])
1186 AC_SUBST(HaveRtldLocal)
1188 dnl ** RTLD_GLOBAL isn't available on openbsd
1189 AC_MSG_CHECKING(for RTLD_GLOBAL from dlfcn.h)
1198 AC_DEFINE([HAVE_RTLDGLOBAL], [1], [Define to 1 if RTLD_GLOBAL is available.])
1204 AC_SUBST(HaveRtldGlobal)
1206 dnl ** RTLD_NOW isn't available on openbsd
1207 AC_MSG_CHECKING(for RTLD_NOW from dlfcn.h)
1216 AC_DEFINE([HAVE_RTLDNOW], [1], [Define to 1 if we can see RTLD_NOW in dlfcn.h])
1222 AC_SUBST(HaveRtldNow)
1224 dnl --------------------------------------------------
1225 dnl * Miscellaneous feature tests
1226 dnl --------------------------------------------------
1228 dnl ** can we get alloca?
1231 dnl ** Working vfork?
1234 dnl ** determine whether or not const works
1237 dnl ** are we big endian?
1240 dnl ** check for leading underscores in symbol names
1241 FP_LEADING_UNDERSCORE
1243 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1247 dnl ** check for Apple-style dead-stripping support
1248 dnl (.subsections-via-symbols assembler directive)
1251 AC_MSG_CHECKING(for .subsections_via_symbols)
1252 AC_TRY_COMPILE(,[__asm__ (".subsections_via_symbols");],
1255 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1256 [Define to 1 if Apple-style dead-stripping is supported.])
1260 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[0],
1261 [Define to 1 if Apple-style dead-stripping is supported.])
1264 AC_CONFIG_FILES([mk/config.mk])
1265 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])