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-*-kfreebsd*-gnu)
201 HostPlatform=i386-unknown-kfreebsdgnu # hack again
202 TargetPlatform=i386-unknown-kfreebsdgnu
203 BuildPlatform=i386-unknown-kfreebsdgnu
204 HostPlatform_CPP='i386_unknown_kfreebsdgnu'
206 HostVendor_CPP='unknown'
207 HostOS_CPP='kfreebsdgnu'
209 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
210 HostPlatform=i386-unknown-freebsd # hack again
211 TargetPlatform=i386-unknown-freebsd
212 BuildPlatform=i386-unknown-freebsd
213 HostPlatform_CPP='i386_unknown_freebsd'
215 HostVendor_CPP='unknown'
218 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
219 HostPlatform=i386-unknown-freebsd2 # hack again
220 TargetPlatform=i386-unknown-freebsd2
221 BuildPlatform=i386-unknown-freebsd2
222 HostPlatform_CPP='i386_unknown_freebsd2'
224 HostVendor_CPP='unknown'
225 HostOS_CPP='freebsd2'
227 i[[3456]]86-*-netbsd*)
228 HostPlatform=i386-unknown-netbsd # hack again
229 TargetPlatform=i386-unknown-netbsd
230 BuildPlatform=i386-unknown-netbsd
231 HostPlatform_CPP='i386_unknown_netbsd'
233 HostVendor_CPP='unknown'
236 i[[3456]]86-*-openbsd*)
237 HostPlatform=i386-unknown-openbsd # hack again
238 TargetPlatform=i386-unknown-openbsd
239 BuildPlatform=i386-unknown-openbsd
240 HostPlatform_CPP='i386_unknown_openbsd'
242 HostVendor_CPP='unknown'
245 i[[3456]]86-*-solaris2*)
246 HostPlatform=i386-unknown-solaris2 # hack again
247 TargetPlatform=i386-unknown-solaris2
248 BuildPlatform=i386-unknown-solaris2
249 HostPlatform_CPP='i386_unknown_solaris2'
251 HostVendor_CPP='unknown'
252 HostOS_CPP='solaris2'
254 i[[3456]]86-*-cygwin*)
255 HostPlatform=i386-unknown-cygwin32 # hack again
256 TargetPlatform=i386-unknown-cygwin32
257 BuildPlatform=i386-unknown-cygwin32
258 HostPlatform_CPP='i386_unknown_cygwin32'
260 HostVendor_CPP='unknown'
261 HostOS_CPP='cygwin32'
264 i[[3456]]86-*-mingw32*)
265 HostPlatform=i386-unknown-mingw32 # hack again
266 TargetPlatform=i386-unknown-mingw32
267 BuildPlatform=i386-unknown-mingw32
268 HostPlatform_CPP='i386_unknown_mingw32'
270 HostVendor_CPP='unknown'
274 i[[3456]]86-apple-darwin*)
275 HostPlatform=i386-apple-darwin
276 TargetPlatform=i386-apple-darwin #hack
277 BuildPlatform=i386-apple-darwin #hack
278 HostPlatform_CPP='i386_apple_darwin'
280 HostVendor_CPP='apple'
284 HostPlatform=ia64-unknown-linux # hack again
285 TargetPlatform=ia64-unknown-linux
286 BuildPlatform=ia64-unknown-linux
287 HostPlatform_CPP='ia64_unknown_linux'
289 HostVendor_CPP='unknown'
293 HostPlatform=x86_64-unknown-linux
294 TargetPlatform=x86_64-unknown-linux
295 BuildPlatform=x86_64-unknown-linux
296 HostPlatform_CPP='x86_64_unknown_linux'
297 HostArch_CPP='x86_64'
298 HostVendor_CPP='unknown'
302 HostPlatform=m68k-unknown-linux # hack again
303 TargetPlatform=m68k-unknown-linux
304 BuildPlatform=m68k-unknown-linux
305 HostPlatform_CPP='m68k_unknown_linux'
307 HostVendor_CPP='unknown'
311 HostPlatform_CPP='m68k_next_nextstep2'
313 HostVendor_CPP='next'
314 HostOS_CPP='nextstep2'
317 HostPlatform_CPP='m68k_next_nextstep3'
319 HostVendor_CPP='next'
320 HostOS_CPP='nextstep3'
322 i[[3456]]86-next-nextstep3)
323 HostPlatform=i386-next-nextstep3 # hack again
324 TargetPlatform=i386-next-nextstep3
325 BuildPlatform=i386-next-nextstep3
326 HostPlatform_CPP='i386_next_nextstep3'
328 HostVendor_CPP='next'
329 HostOS_CPP='nextstep3'
332 HostPlatform=m68k-unknown-openbsd
333 TargetPlatform=m68k-unknown-openbsd
334 BuildPlatform=m68k-unknown-openbsd
335 HostPlatform_CPP='m68k_unknown_openbsd'
337 HostVendor_CPP='unknown'
341 HostPlatform=m68k-unknown-netbsd
342 TargetPlatform=m68k-unknown-netbsd
343 BuildPlatform=m68k-unknown-netbsd
344 HostPlatform_CPP='m68k_unknown_netbsd'
346 HostVendor_CPP='unknown'
350 HostPlatform=m68k-sun-sunos4
351 TargetPlatform=m68k-sun-sunos4 #hack
352 BuildPlatform=m68k-sun-sunos4 #hack
353 HostPlatform_CPP='m68k_sun_sunos4'
359 HostPlatform=m88k-unknown-openbsd
360 TargetPlatform=m88k-unknown-openbsd
361 BuildPlatform=m88k-unknown-openbsd
362 HostPlatform_CPP='m88k_unknown_openbsd'
364 HostVendor_CPP='unknown'
368 HostPlatform=mips-unknown-linux # hack again
369 TargetPlatform=mips-unknown-linux
370 BuildPlatform=mips-unknown-linux
371 HostPlatform_CPP='mips_unknown_linux'
373 HostVendor_CPP='unknown'
377 HostPlatform_CPP='mips_dec_ultrix'
378 HostArch_CPP='mipsel' # NB a little different
383 HostPlatform=mips-sgi-irix
384 TargetPlatform=mips-sgi-irix #hack
385 BuildPlatform=mips-sgi-irix #hack
386 HostPlatform_CPP='mips_sgi_irix'
387 HostArch_CPP='mipseb' # NB a little different
392 HostPlatform=rs6000-ibm-aix
393 TargetPlatform=rs6000-ibm-aix #hack
394 BuildPlatform=rs6000-ibm-aix #hack
395 HostPlatform_CPP='rs6000_ibm_aix'
396 HostArch_CPP='rs6000'
401 HostPlatform=powerpc-ibm-aix
402 TargetPlatform=powerpc-ibm-aix #hack
403 BuildPlatform=powerpc-ibm-aix #hack
404 HostPlatform_CPP='powerpc_ibm_aix'
405 HostArch_CPP='powerpc'
409 powerpc-apple-darwin*)
410 HostPlatform=powerpc-apple-darwin
411 TargetPlatform=powerpc-apple-darwin #hack
412 BuildPlatform=powerpc-apple-darwin #hack
413 HostPlatform_CPP='powerpc_apple_darwin'
414 HostArch_CPP='powerpc'
415 HostVendor_CPP='apple'
418 powerpc-unknown-linux*)
419 HostPlatform=powerpc-unknown-linux
420 TargetPlatform=powerpc-unknown-linux
421 BuildPlatform=powerpc-unknown-linux
422 HostPlatform_CPP='powerpc_unknown_linux'
423 HostArch_CPP='powerpc'
424 HostVendor_CPP='unknown'
427 powerpc-unknown-openbsd*)
428 HostPlatform=powerpc-unknown-openbsd
429 TargetPlatform=powerpc-unknown-openbsd
430 BuildPlatform=powerpc-unknown-openbsd
431 HostPlatform_CPP='powerpc_unknown_openbsd'
432 HostArch_CPP='powerpc'
433 HostVendor_CPP='unknown'
436 powerpc64-unknown-linux*)
437 HostPlatform=powerpc64-unknown-linux
438 TargetPlatform=powerpc64-unknown-linux
439 BuildPlatform=powerpc64-unknown-linux
440 HostPlatform_CPP='powerpc64_unknown_linux'
441 HostArch_CPP='powerpc64'
442 HostVendor_CPP='unknown'
447 HostPlatform=s390-ibm-linux
448 TargetPlatform=s390-ibm-linux #hack
449 BuildPlatform=s390-ibm-linux #hack
450 HostPlatform_CPP='s390_ibm_linux'
456 HostPlatform=sparc-sun-sunos4
457 TargetPlatform=sparc-sun-sunos4 #hack
458 BuildPlatform=sparc-sun-sunos4 #hack
459 HostPlatform_CPP='sparc_sun_sunos4'
465 HostPlatform=sparc-sun-solaris2
466 TargetPlatform=sparc-sun-solaris2 #hack
467 BuildPlatform=sparc-sun-solaris2 #hack
468 HostPlatform_CPP='sparc_sun_solaris2'
471 HostOS_CPP='solaris2'
474 HostPlatform=sparc-unknown-linux
475 TargetPlatform=sparc-unknown-linux
476 BuildPlatform=sparc-unknown-linux
477 HostPlatform_CPP='sparc_unknown_linux'
479 HostVendor_CPP='unknown'
483 HostPlatform=sparc-unknown-openbsd
484 TargetPlatform=sparc-unknown-openbsd
485 BuildPlatform=sparc-unknown-openbsd
486 HostPlatform_CPP='sparc_unknown_openbsd'
488 HostVendor_CPP='unknown'
492 HostPlatform=sparc64-unknown-openbsd
493 TargetPlatform=sparc64-unknown-openbsd
494 BuildPlatform=sparc64-unknown-openbsd
495 HostPlatform_CPP='sparc64_unknown_openbsd'
496 HostArch_CPP='sparc64'
497 HostVendor_CPP='unknown'
501 HostPlatform=vax-unknown-openbsd
502 TargetPlatform=vax-unknown-openbsd
503 BuildPlatform=vax-unknown-openbsd
504 HostPlatform_CPP='vax_unknown_openbsd'
506 HostVendor_CPP='unknown'
510 echo "Unrecognised platform: $HostPlatform"
514 echo "Canonicalised to: $HostPlatform"
515 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
516 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
518 BuildPlatform_CPP=$HostPlatform_CPP
519 TargetPlatform_CPP=$HostPlatform_CPP
520 BuildArch_CPP=$HostArch_CPP
521 TargetArch_CPP=$HostArch_CPP
522 BuildOS_CPP=$HostOS_CPP
524 TargetOS_CPP=$HostOS_CPP
525 BuildVendor_CPP=$HostVendor_CPP
526 TargetVendor_CPP=$HostVendor_CPP
528 AC_SUBST(BuildPlatform)
529 AC_SUBST(HostPlatform)
530 AC_SUBST(TargetPlatform)
531 AC_SUBST(HostPlatform_CPP)
532 AC_SUBST(BuildPlatform_CPP)
533 AC_SUBST(TargetPlatform_CPP)
535 AC_SUBST(HostArch_CPP)
536 AC_SUBST(BuildArch_CPP)
537 AC_SUBST(TargetArch_CPP)
540 AC_SUBST(HostOS_Full)
541 AC_SUBST(BuildOS_CPP)
542 AC_SUBST(TargetOS_CPP)
544 AC_SUBST(HostVendor_CPP)
545 AC_SUBST(BuildVendor_CPP)
546 AC_SUBST(TargetVendor_CPP)
550 dnl --------------------------------------------------------------
551 dnl * Calculate absolute path to build tree
552 dnl --------------------------------------------------------------
554 AC_MSG_CHECKING(for path to top of build tree)
558 dnl Remove common automounter nonsense
560 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
562 dnl Find 'hardtop_plat', the native format for 'hardtop'
563 dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes being escaped).
565 dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert /cygdrive/c/foo to c:/foo
566 dnl but we must not do that if we aren't building using Cygwin (notably msys),
567 dnl because cygpath doesn't exist. It seems that 'bash' sets OSTYPE to 'cygwin'
568 dnl or 'msys' respectively, but cygwin's 'sh' does not. So we hackily assume
569 dnl that if the shell hasn't set it to 'msys' then we must be in Cygwin. Sigh.
571 dnl The Right Thing is probably to test $BuildPlatform instead, but we are sloppy
572 dnl about setting that correctly at the moment, so we just work around for now.
574 dnl The quotes round "$(OSTYPE)" are essential, for the Cygwin-sh case where OSTYPE
576 case $HostPlatform in
577 i386-unknown-mingw32 | i386-unknown-cygwin32)
578 if test "${OSTYPE}" != "msys"
580 # convert $hardtop to a path that mingw will understand too
581 cyghardtop=${hardtop}
582 hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
583 hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
585 hardtop_plat=${hardtop}
589 hardtop_plat=${hardtop}
593 AC_SUBST(hardtop_plat)
595 AC_MSG_RESULT(${hardtop})
597 # We don't support building in directories with spaces.
599 *' '*) AC_MSG_ERROR([
600 The build system does not support building in a directory containing
601 space characters. Suggestion: move the build tree somewhere else.])
605 dnl --------------------------------------------------------------
606 dnl * Project specific configuration options
607 dnl --------------------------------------------------------------
608 dnl What follows is a bunch of options that can either be configured
609 dnl through command line options to the configure script or by
610 dnl supplying defns in the build tree's mk/build.mk. Having the option to
611 dnl use either is considered a Feature.
613 dnl ** What command to use to compile compiler sources ?
614 dnl --------------------------------------------------------------
617 [AC_HELP_STRING([--with-ghc=ARG],
618 [Use ARG as the path to GHC [default=autodetect]])],
619 [WithGhc="$withval"],
620 [if test "$GHC" = ""; then
621 AC_PATH_PROG([GHC], [ghc])
627 [AC_HELP_STRING([--with-hc=ARG],
628 [Use ARG as the path to the compiler for compiling ordinary
629 Haskell code (default= value of --with-ghc)])],
635 if test "$WithGhc" != ""; then
636 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
637 AC_SUBST(GhcVersion)dnl
638 AC_SUBST(GhcMajVersion)dnl
639 AC_SUBST(GhcMinVersion)dnl
640 AC_SUBST(GhcPatchLevel)dnl
643 AC_PATH_PROGS(NHC,nhc nhc98)
644 AC_PATH_PROG(HBC,hbc)
646 dnl ** Which gcc to use?
647 dnl --------------------------------------------------------------
649 [AC_HELP_STRING([--with-gcc=ARG],
650 [Use ARG as the path to GCC [default=autodetect]])],
651 [WhatGccIsCalled="$withval"
652 if test "x$HostPlatform" = "xi386-unknown-mingw32"
654 if test "${OSTYPE}" != "msys"
656 # Canonicalise to <drive>:/path/to/gcc
657 withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
663 [WhatGccIsCalled="gcc"]
665 AC_SUBST(WhatGccIsCalled)
667 dnl ** Booting from .hc files?
668 dnl --------------------------------------------------------------
669 AC_ARG_ENABLE(hc-boot,
670 [AC_HELP_STRING([--enable-hc-boot],
671 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
672 (This option is mostly of interest to porters.) [default=no]])],
673 [ if test x"$enableval" = x"yes"; then
681 AC_SUBST(BootingFromHc)
683 dnl ** Booting from unregisterised .hc files?
684 dnl --------------------------------------------------------------
685 AC_ARG_ENABLE(hc-boot-unregisterised,
686 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
687 [ With --enable-hc-boot, treat the intermediate .hc files as
688 unregisterised rather than registerised code.
689 (This option is mostly of interest to porters.) [default=no]])],
690 [ if test x"$enableval" = x"yes"; then
691 BootingFromUnregisterisedHc=YES
693 BootingFromUnregisterisedHc=NO
696 [BootingFromUnregisterisedHc=NO]
698 AC_SUBST(BootingFromUnregisterisedHc)
700 if test "$BootingFromHc" = "NO"; then
701 if test "$BootingFromUnregisterisedHc" = "YES"; then
702 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
706 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
707 if test "$BootingFromHc" = "NO" -a "$WithGhc" = "" -a -d "$srcdir/ghc"; then
708 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
711 dnl ** --enable-threaded-rts (not used any more)
712 dnl --------------------------------------------------------------
713 AC_ARG_ENABLE(threaded-rts,
714 [AC_HELP_STRING([--enable-threaded-rts],
715 [DEPRECATED (backwards compatibility only). [default=no]])],
716 [ if test x"$enableval" = x"yes"; then
724 AC_SUBST(ThreadedRts)
726 dnl ** Enable the construction of Win32 DLLs?
727 dnl --------------------------------------------------------------
729 dnl [ The ability to build the RTS and libraries as separate DLLs used
730 dnl to be supported, but isn't currently (updates to the RTS, compiler
731 dnl and build system would be required to bring it back again.)
732 dnl Hence, exposing it as an option is false advertisement, so better
733 dnl disable it to avoid confusion (but leave it commented-out rather
734 dnl than removed in order to remind ourselves to bring back the
735 dnl feature at some stage.) ]
737 dnl AC_ARG_ENABLE(win32-dlls,
738 dnl [ --enable-win32-dlls
739 dnl If on a Win32 platform running mingw32/cygwin, enable the
740 dnl construction of DLLs containing ghc-compiled code.
743 dnl case $HostOS_CPP in
746 dnl *) echo "Unrecognised win32 platform: $HostPlatform"
750 dnl EnableWin32DLLs=YES
752 dnl [EnableWin32DLLs=NO]
754 dnl AC_SUBST(EnableWin32DLLs)
755 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
756 dnl AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
759 dnl ** Enable the building of the ObjectIO?
760 dnl --------------------------------------------------------------
761 AC_ARG_ENABLE(objectio,
762 [AC_HELP_STRING([--enable-objectio],
763 [Build ObjectIO, a portable GUI library for Haskell. [default=no]])],
764 [ if test x"$enableval" = x"yes"; then
765 GhcLibsWithObjectIO=YES
767 GhcLibsWithObjectIO=NO
770 [GhcLibsWithObjectIO=NO]
772 AC_SUBST(GhcLibsWithObjectIO)
774 dnl ** .NET interop support?
775 dnl --------------------------------------------------------------
776 AC_ARG_ENABLE(dotnet,
777 [AC_HELP_STRING([--enable-dotnet],
778 [Build .NET interop layer. [default=no]])],
779 [ if test x"$enableval" = x"yes"; then
780 DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
786 AC_SUBST(DotnetSupport)
788 dnl --------------------------------------------------------------
789 dnl End of configure script option section
790 dnl --------------------------------------------------------------
793 dnl --------------------------------------------------------------
794 dnl * General configuration checks
795 dnl --------------------------------------------------------------
797 dnl ** Can the unix package be built?
798 dnl --------------------------------------------------------------
800 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
805 AC_SUBST([GhcLibsWithUnix])
810 dnl ** look for `perl', but only in /bin on Windows
813 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
814 if test -z "$PerlCmd"; then
815 echo "You must install the version of Perl shipped with GHC"
816 echo "(or a compatible one) in /bin."
821 AC_PATH_PROG(PerlCmd,perl)
822 if test -z "$PerlCmd"; then
823 echo "You must install perl before you can continue"
824 echo "Perhaps it is already installed, but not in your PATH?"
827 FPTOOLS_CHECK_PERL_VERSION
832 dnl ** does #! path/to/perl work? (sometimes it's too long...)
835 dnl ** check for Python
836 AC_PATH_PROG(PythonCmd,python)
838 dnl ** look for GCC and find out which version
839 dnl Figure out which C compiler to use. Gcc is preferred.
840 dnl If gcc, make sure it's at least 2.1
845 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
848 dnl ** Without optimization some INLINE trickery fails for GHCi
851 dnl ** Try to add -mno-cygwin to the C compiler options
852 FP_CHECK_FLAG([-mno-cygwin], [
853 SRC_CC_OPTS="-mno-cygwin $SRC_CC_OPTS"
854 CPPFLAGS="-mno-cygwin $CPPFLAGS"])
855 AC_SUBST(SRC_CC_OPTS)
857 dnl ** figure out how to do context diffs
860 dnl ** Find find command (for Win32's benefit)
863 dnl ** Find sort command (for the benefit of Win32 environs)
866 dnl ** figure out how to do a BSD-ish install
869 dnl If you can run configure, you certainly have /bin/sh
870 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
872 dnl ** how to invoke `ar' and `ranlib'
873 FP_PROG_AR_NEEDS_RANLIB
874 FP_PROG_AR_SUPPORTS_INPUT
876 dnl ** Check to see whether ln -s works
880 dnl ** Find the path to sed
881 AC_PATH_PROG(SedCmd,sed)
884 dnl ** check for time command
885 AC_PATH_PROG(TimeCmd,time)
888 dnl if GNU tar is named gtar, look for it first.
889 AC_PATH_PROGS(TarCmd,gtar tar,tar)
891 dnl ** check for DocBook toolchain
893 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])
896 dnl ** check for ghc-pkg command
899 AC_ARG_WITH(greencard,
900 [AC_HELP_STRING([--with-greencard=ARG],
901 [Use ARG as the path to greencard [default=autodetct]])],
903 GreenCardCmd=$withval;
904 FPTOOLS_GREENCARD(3.00)
908 AC_ARG_ENABLE(src-tree-happy,
909 [AC_HELP_STRING([--enable-src-tree-happy],
910 [Build and use source tree (fptools/happy) version of Happy.
911 [default=autodetect]])],
912 [ if test x"$enableval" = x"yes"; then
920 dnl ** check for installed happy binary + version
921 dnl (don't do it if we're booting from .hc files though.)
922 if test "$BootingFromHc" = "NO"; then
926 AC_ARG_ENABLE(src-tree-haddock,
927 [AC_HELP_STRING([--enable-src-tree-haddock],
928 [Build and use source tree (fptools/haddock) version of Haddock.
929 [default=autodetect]])],
930 [ if test x"$enableval" = x"yes"; then
931 UseSrcTreeHaddock=YES
936 [UseSrcTreeHaddock=NO]
938 dnl ** check for installed haddock
941 AC_ARG_ENABLE(src-tree-alex,
942 [AC_HELP_STRING([--enable-src-tree-alex],
943 [Build and use source tree (fptools/alex) version of Alex.
944 [default=autodetect]])],
945 [ if test x"$enableval" = x"yes"; then
953 dnl ** check for installed alex binary + version
954 dnl (don't do it if we're booting from .hc files though.)
955 if test "$BootingFromHc" = "NO"; then
959 dnl --------------------------------------------------
960 dnl ### program checking section ends here ###
961 dnl --------------------------------------------------
963 dnl --------------------------------------------------
964 dnl * Platform header file and syscall feature tests
965 dnl ### checking the state of the local header files and syscalls ###
967 dnl ** check for full ANSI header (.h) files
970 dnl ** Enable large file support. NB. do this before testing the type of
971 dnl off_t, because it will affect the result of that test.
974 dnl ** check for specific header (.h) files that we are interested in
975 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])
977 AC_CHECK_HEADER([readline/readline.h], [HaveReadlineReadlineH=YES], [HaveReadlineReadlineH=NO])
978 AC_CHECK_HEADER([readline/history.h], [HaveReadlineHistoryH=YES], [HaveReadlineHistoryH=NO])
980 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
981 GhcLibsWithReadline=YES
982 AC_DEFINE([HAVE_READLINE_HEADERS], [1], [Define to 1 if readline/readline.h and readline/history.h exist.])
984 GhcLibsWithReadline=NO
985 AC_DEFINE([HAVE_READLINE_HEADERS], [0], [Define to 1 if readline/readline.h and readline/history.h exist.])
987 AC_SUBST(GhcLibsWithReadline)
989 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
992 dnl ** how do we get a timezone name, and UTC offset ?
995 dnl ** do we have altzone?
998 dnl ** do we have long longs?
999 AC_CHECK_TYPES([long long])
1001 dnl ** what are the sizes of various types
1002 AC_CHECK_SIZEOF(char, 1)
1003 AC_CHECK_SIZEOF(double, 8)
1004 AC_CHECK_SIZEOF(float, 4)
1005 AC_CHECK_SIZEOF(int, 4)
1006 AC_CHECK_SIZEOF(long, 4)
1007 if test "$ac_cv_type_long_long" = yes; then
1008 AC_CHECK_SIZEOF(long long, 8)
1010 AC_CHECK_SIZEOF(short, 2)
1011 AC_CHECK_SIZEOF(unsigned char, 1)
1012 AC_CHECK_SIZEOF(unsigned int, 4)
1013 AC_CHECK_SIZEOF(unsigned long, 4)
1014 if test "$ac_cv_type_long_long" = yes; then
1015 AC_CHECK_SIZEOF(unsigned long long, 8)
1017 AC_CHECK_SIZEOF(unsigned short, 2)
1018 AC_CHECK_SIZEOF(void *, 4)
1020 dnl ** what are alignment constraints on various types
1021 FP_CHECK_ALIGNMENT(char)
1022 FP_CHECK_ALIGNMENT(double)
1023 FP_CHECK_ALIGNMENT(float)
1024 FP_CHECK_ALIGNMENT(int)
1025 FP_CHECK_ALIGNMENT(long)
1026 if test "$ac_cv_type_long_long" = yes; then
1027 FP_CHECK_ALIGNMENT(long long)
1029 FP_CHECK_ALIGNMENT(short)
1030 FP_CHECK_ALIGNMENT(unsigned char)
1031 FP_CHECK_ALIGNMENT(unsigned int)
1032 FP_CHECK_ALIGNMENT(unsigned long)
1033 if test "$ac_cv_type_long_long" = yes; then
1034 FP_CHECK_ALIGNMENT(unsigned long long)
1036 FP_CHECK_ALIGNMENT(unsigned short)
1037 FP_CHECK_ALIGNMENT(void *)
1039 FP_CHECK_FUNC([WinExec],
1040 [@%:@include <windows.h>], [WinExec("",0)])
1042 FP_CHECK_FUNC([GetModuleFileName],
1043 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1045 dnl ** check return type of signal handlers
1046 dnl Foo: assumes we can use prototypes.
1047 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1048 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1049 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1050 dnl #include <signal.h>
1054 dnl void (*signal (int, void (*)(int)))(int);
1057 dnl [ac_cv_type_signal_handler=void_int],
1058 dnl [ac_cv_type_signal_handler=int_void])])
1059 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1060 dnl AC_DEFINE(VOID_INT_SIGNALS)
1063 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1065 if test "$ac_cv_type_signal" = void; then
1066 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).])
1069 dnl ** check for more functions
1070 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1071 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r])
1072 dnl ** For ghc/rts/gmp:
1073 AC_CHECK_FUNCS([getpagesize])
1075 dnl ** check whether this machine has gmp3 installed
1076 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1077 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
1078 HaveLibGmp=NO; LibGmp=not-installed))
1079 AC_SUBST(HaveLibGmp)
1082 dnl ** (Mac OS X only: check for GMP.framework)
1084 if test $HostPlatform = "powerpc-apple-darwin"; then
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])
1095 AC_SUBST(HaveFrameworkGMP)
1097 dnl ** check for mingwex library
1098 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1099 AC_SUBST(HaveLibMingwEx)
1101 if test $HaveLibMingwEx = YES ; then
1102 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1105 if test "$HaveLibGmp" = "NO"; then
1106 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1107 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1111 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1112 dnl the order of these tests matters: bfd needs liberty
1113 AC_CHECK_LIB(iberty, xmalloc)
1114 AC_CHECK_LIB(bfd, bfd_init)
1116 dnl ** check for readline, for Hugs and hslibs' Readline
1117 dnl ncurses supersedes termcap and curses, but for compatibility,
1118 dnl we have to check for all...
1119 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=YES; LibTermcap=ncurses,
1120 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=YES; LibTermcap=termcap,
1121 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=YES; LibTermcap=curses,
1122 HaveLibTermcap=NO; LibTermcap=not-installed)))
1124 if test $HaveLibTermcap = YES ; then
1125 LIBS="-l$LibTermcap $LIBS"
1126 AC_CHECK_LIB(readline, readline, HaveLibReadline=YES, HaveLibReadline=NO)
1129 if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES ; then
1130 AC_DEFINE([HAVE_READLINE_LIBS], [1], [Define to 1 if readline plus any additional libs needed for it exist.])
1131 LibsReadline="readline $LibTermcap"
1133 AC_DEFINE([HAVE_READLINE_LIBS], [0], [Define to 1 if readline plus any additional libs needed for it exist.])
1136 AC_SUBST(LibsReadline)
1138 if test "$HaveLibReadline"; then
1139 AC_CHECK_LIB(readline, rl_erase_empty_line,
1140 [AC_DEFINE([HAVE_READLINE_4], [1], [Define to 1 if readline has version >= 4.0.])],
1141 [AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])])
1142 AC_CHECK_LIB(readline, rl_free_undo_list,
1143 [AC_DEFINE([HAVE_READLINE_4_2], [1], [Define to 1 if readline has version >= 4.2.])],
1144 [AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])])
1146 AC_DEFINE([HAVE_READLINE_4], [0], [Define to 1 if readline has version >= 4.0.])
1147 AC_DEFINE([HAVE_READLINE_4_2], [0], [Define to 1 if readline has version >= 4.2.])
1150 dnl ** check for math library
1151 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1152 if test x"$fp_libm_not_needed" = xdunno; then
1153 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1157 dnl ################################################################
1158 dnl Check for libraries
1159 dnl ################################################################
1161 dnl ** check whether we need -ldl to get dlopen()
1163 AC_CHECK_LIB(dl, dlopen,
1165 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1170 dnl --------------------------------------------------
1171 dnl * Miscellaneous feature tests
1172 dnl --------------------------------------------------
1174 dnl ** can we get alloca?
1177 dnl ** Working vfork?
1180 dnl ** determine whether or not const works
1183 dnl ** are we big endian?
1186 dnl ** check for leading underscores in symbol names
1187 FP_LEADING_UNDERSCORE
1189 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1193 dnl ** check for Apple-style dead-stripping support
1194 dnl (.subsections-via-symbols assembler directive)
1197 AC_MSG_CHECKING(for .subsections_via_symbols)
1198 AC_TRY_COMPILE(,[__asm__ (".subsections_via_symbols");],
1201 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1202 [Define to 1 if Apple-style dead-stripping is supported.])
1206 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[0],
1207 [Define to 1 if Apple-style dead-stripping is supported.])
1210 dnl ** check for librt
1211 AC_CHECK_LIB(rt, clock_gettime)
1212 AC_CHECK_FUNCS(clock_gettime)
1214 dnl ** check for Apple's "interesting" long double compatibility scheme
1215 AC_MSG_CHECKING(for printf$LDBLStub)
1216 AC_TRY_LINK_FUNC(printf$LSBLStub,
1219 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
1220 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1224 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
1225 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1229 AC_CONFIG_FILES([mk/config.mk])
1230 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])