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.13], [glasgow-haskell-bugs@haskell.org], [ghc])
18 # Set this to YES for a released version, otherwise NO
23 # The primary version (e.g. 6.7, 6.6.1) is set in the AC_INIT line
24 # above. If this is not a released version, then we will append the
25 # date to the version number (e.g. 6.7.20070204). The date is
26 # constructed by finding the date of the most recent patch in the
27 # darcs repository. If this is a source distribution (not a darcs
28 # checkout), then we ship a file 'VERSION' containing the full version
29 # when the source distribution was created.
31 if test ! -f mk/config.h.in; then
32 echo "mk/config.h.in doesn't exist: perhaps you haven't run 'sh boot'?"
36 AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
38 dnl ----------------------------------------------------------
39 dnl ** Find unixy sort and find commands,
40 dnl ** which are needed by FP_SETUP_PROJECT_VERSION
42 dnl ** Find find command (for Win32's benefit)
45 dnl ** Find sort command (for the benefit of Win32 environs)
48 dnl ----------------------------------------------------------
49 FP_SETUP_PROJECT_VERSION
51 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
52 AC_SUBST([release], [1])
54 # First off, a distrib sanity check..
55 AC_CONFIG_SRCDIR([mk/config.mk.in])
57 dnl * We require autoconf version 2.52
58 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
59 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
62 # -------------------------------------------------------------------------
63 # Prepare to generate the following header files
66 AC_CONFIG_HEADER(mk/config.h)
68 # No, semi-sadly, we don't do `--srcdir'...
69 if test x"$srcdir" != 'x.' ; then
70 echo "This configuration does not support the \`--srcdir' option.."
74 dnl --------------------------------------------------------------
75 dnl * Project specific configuration options
76 dnl --------------------------------------------------------------
77 dnl What follows is a bunch of options that can either be configured
78 dnl through command line options to the configure script or by
79 dnl supplying defns in the build tree's mk/build.mk. Having the option to
80 dnl use either is considered a Feature.
82 dnl ** What command to use to compile compiler sources ?
83 dnl --------------------------------------------------------------
86 [AC_HELP_STRING([--with-ghc=ARG],
87 [Use ARG as the path to GHC [default=autodetect]])],
89 [if test "$GHC" = ""; then
90 AC_PATH_PROG([GHC], [ghc])
94 dnl ** Booting from .hc files?
95 dnl --------------------------------------------------------------
96 AC_ARG_ENABLE(hc-boot,
97 [AC_HELP_STRING([--enable-hc-boot],
98 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
99 (This option is mostly of interest to porters.) [default=no]])],
100 [ if test x"$enableval" = x"yes"; then
108 AC_SUBST(BootingFromHc)
110 AC_ARG_ENABLE(bootstrap-with-devel-snapshot,
111 [AC_HELP_STRING([--enable-bootstrap-with-devel-snapshot],
112 [Allow bootstrapping using a development snapshot of GHC. This is not guaranteed to work.])],
113 EnableBootstrapWithDevelSnaphost=YES,
114 EnableBootstrapWithDevelSnaphost=NO
117 if test "$WithGhc" != ""; then
118 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
120 if test "$GhcMajVersion" = "unknown" -o "$GhcMinVersion" = "unknown"; then
121 AC_MSG_ERROR([Cannot determine the version of $WithGhc. Is it really GHC?])
124 AC_SUBST(GhcVersion)dnl
125 AC_SUBST(GhcMajVersion)dnl
126 AC_SUBST(GhcMinVersion)dnl
127 AC_SUBST(GhcPatchLevel)dnl
128 GhcMinVersion2=`echo "$GhcMinVersion" | sed 's/^\\(.\\)$/0\\1/'`
129 GhcCanonVersion="$GhcMajVersion$GhcMinVersion2"
130 if test $GhcCanonVersion -ge 609; then ghc_ge_609=YES; else ghc_ge_609=NO; fi
131 FP_COMPARE_VERSIONS($GhcVersion,[-ge],[6.10.2],
132 [ghc_ge_6102=YES], [ghc_ge_6102=NO])
133 if test $GhcCanonVersion -ge 611; then ghc_ge_611=YES; else ghc_ge_611=NO; fi
134 AC_SUBST(ghc_ge_609)dnl
135 AC_SUBST(ghc_ge_6102)dnl
136 AC_SUBST(ghc_ge_611)dnl
139 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
140 if test "$BootingFromHc" = "NO" -a -d "$srcdir/compiler"; then
141 if test "$WithGhc" = ""; then
142 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
144 FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[6.8],
145 [AC_MSG_ERROR([GHC version 6.8 or later is required to compile GHC.])])dnl
147 if test `expr $GhcMinVersion % 2` = "1"; then
148 if test "$EnableBootstrapWithDevelSnaphost" = "NO"; then
150 $WithGhc is a development snapshot of GHC, version $GhcVersion.
151 Bootstrapping using this version of GHC is not supported, and may not
152 work. Use --enable-bootstrap-with-devel-snapshot to try it anyway,
153 or --with-ghc to specify a different GHC to use.])
158 # GHC is passed to Cabal, so we need a native path
159 if test "${WithGhc}" != ""
161 ghc_host=`${WithGhc} +RTS --info | grep 'Host platform' | sed -e 's/.*, "//' -e 's/")//'`
163 if test "$ghc_host" = "i386-unknown-mingw32"
165 if test "${OSTYPE}" = "msys"
167 WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"`
169 # Canonicalise to <drive>:/path/to/ghc
170 WithGhc=`cygpath -m ${WithGhc}`
172 echo "GHC path canonicalised to: ${WithGhc}"
177 dnl ** Without optimization some INLINE trickery fails for GHCi
180 dnl Allow to specify iconv options to the toplevel configure script
181 dnl so they can be properly passed to sub-builds.
182 dnl Note: ICONV_LIB_DIRS and ICONV_INCLUDE_DIRS are not predefined
183 dnl to the empty string to allow them to be overridden from the
186 AC_ARG_WITH([iconv-includes],
187 [AC_HELP_STRING([--with-iconv-includes],
188 [directory containing iconv.h])],
189 [ICONV_INCLUDE_DIRS=$withval])
191 AC_ARG_WITH([iconv-libraries],
192 [AC_HELP_STRING([--with-iconv-libraries],
193 [directory containing iconv library])],
194 [ICONV_LIB_DIRS=$withval])
196 AC_SUBST(ICONV_INCLUDE_DIRS)
197 AC_SUBST(ICONV_LIB_DIRS)
199 dnl--------------------------------------------------------------------
200 dnl * Choose host(/target/build) platform
201 dnl--------------------------------------------------------------------
202 dnl We don't use the standard autoconf macros for this, but instead
203 dnl ask the bootstrapping compiler what platform it is for
205 dnl Guess host/target/build platform(s) if necessary.
206 m4_divert_once([HELP_CANON],
209 --build=BUILD configure for building on BUILD [guessed]
210 --host=HOST cross-compile to build programs to run on HOST [guessed]
211 --target=TARGET configure for building compilers for TARGET [guessed]]])dnl
213 if test "$build" = ""
215 if test "${WithGhc}" != ""
217 build=`${WithGhc} +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
218 echo "Build platform inferred as: $build"
220 echo "Can't work out build platform"
227 if test "${WithGhc}" != ""
229 host=`${WithGhc} +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
230 echo "Host platform inferred as: $host"
232 echo "Can't work out host platform"
237 if test "$target" = ""
239 if test "${WithGhc}" != ""
241 target=`${WithGhc} +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
242 echo "Target platform inferred as: $target"
244 echo "Can't work out target platform"
253 AC_MSG_WARN([GHC does not support the Cygwin target at the moment])
254 AC_MSG_WARN([I'm assuming you wanted to build for i386-unknown-mingw32])
261 i386-apple-darwin|powerpc-apple-darwin)
263 CFLAGS="$CFLAGS -m32"
264 LDFLAGS="$LDFLAGS -m32"
265 CONF_CC_OPTS="$CONF_CC_OPTS -m32"
266 CONF_LD_OPTS="$CONF_LD_OPTS -m32"
270 CFLAGS="$CFLAGS -m64"
271 LDFLAGS="$LDFLAGS -m64"
272 CONF_CC_OPTS="$CONF_CC_OPTS -m64"
273 CONF_LD_OPTS="$CONF_LD_OPTS -m64"
279 alpha|arm|hppa|hppa1_1|i386|ia64|m68k|mips|mipseb|mipsel|powerpc|powerpc64|rs6000|s390|sparc|sparc64|vax|x86_64)
282 echo "Unknown arch $1"
290 dec|unknown|hp|apple|next|sun|sgi|ibm)
293 echo "Unknown vendor $1"
301 linux|freebsd|netbsd|openbsd|osf1|osf3|hpux|linuxaout|kfreebsdgnu|freebsd2|solaris2|cygwin32|mingw32|darwin|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix)
304 echo "Unknown OS '$1'"
311 BuildArch=`echo "$build" | sed 's/-.*//'`
312 BuildVendor=`echo "$build" | sed -e 's/.*-\(.*\)-.*/\1/'`
313 BuildOS=`echo "$build" | sed 's/.*-//'`
314 BuildPlatform_CPP=`echo "$BuildPlatform" | sed -e 's/\./_/g' -e 's/-/_/g'`
315 BuildArch_CPP=` echo "$BuildArch" | sed -e 's/\./_/g' -e 's/-/_/g'`
316 BuildVendor_CPP=` echo "$BuildVendor" | sed -e 's/\./_/g' -e 's/-/_/g'`
317 BuildOS_CPP=` echo "$BuildOS" | sed -e 's/\./_/g' -e 's/-/_/g'`
319 checkArch "$BuildArch"
320 checkVendor "$BuildVendor"
324 HostArch=`echo "$host" | sed 's/-.*//'`
325 HostVendor=`echo "$host" | sed -e 's/.*-\(.*\)-.*/\1/'`
326 HostOS=`echo "$host" | sed 's/.*-//'`
327 HostPlatform_CPP=`echo "$HostPlatform" | sed -e 's/\./_/g' -e 's/-/_/g'`
328 HostArch_CPP=` echo "$HostArch" | sed -e 's/\./_/g' -e 's/-/_/g'`
329 HostVendor_CPP=` echo "$HostVendor" | sed -e 's/\./_/g' -e 's/-/_/g'`
330 HostOS_CPP=` echo "$HostOS" | sed -e 's/\./_/g' -e 's/-/_/g'`
332 checkArch "$HostArch"
333 checkVendor "$HostVendor"
336 TargetPlatform=$target
337 TargetArch=`echo "$target" | sed 's/-.*//'`
338 TargetVendor=`echo "$target" | sed -e 's/.*-\(.*\)-.*/\1/'`
339 TargetOS=`echo "$target" | sed 's/.*-//'`
340 TargetPlatform_CPP=`echo "$TargetPlatform" | sed -e 's/\./_/g' -e 's/-/_/g'`
341 TargetArch_CPP=` echo "$TargetArch" | sed -e 's/\./_/g' -e 's/-/_/g'`
342 TargetVendor_CPP=` echo "$TargetVendor" | sed -e 's/\./_/g' -e 's/-/_/g'`
343 TargetOS_CPP=` echo "$TargetOS" | sed -e 's/\./_/g' -e 's/-/_/g'`
345 checkArch "$TargetArch"
346 checkVendor "$TargetVendor"
349 AC_SUBST(BuildPlatform)
350 AC_SUBST(HostPlatform)
351 AC_SUBST(TargetPlatform)
352 AC_SUBST(HostPlatform_CPP)
353 AC_SUBST(BuildPlatform_CPP)
354 AC_SUBST(TargetPlatform_CPP)
356 AC_SUBST(HostArch_CPP)
357 AC_SUBST(BuildArch_CPP)
358 AC_SUBST(TargetArch_CPP)
361 AC_SUBST(BuildOS_CPP)
362 AC_SUBST(TargetOS_CPP)
364 AC_SUBST(HostVendor_CPP)
365 AC_SUBST(BuildVendor_CPP)
366 AC_SUBST(TargetVendor_CPP)
372 [AC_HELP_STRING([--with-hc=ARG],
373 [Use ARG as the path to the compiler for compiling ordinary
374 Haskell code (default= value of --with-ghc)])],
380 AC_PATH_PROGS(NHC,nhc nhc98)
381 AC_PATH_PROG(HBC,hbc)
383 dnl ** Which gcc to use?
384 dnl --------------------------------------------------------------
386 [AC_HELP_STRING([--with-gcc=ARG],
387 [Use ARG as the path to GCC [default=autodetect]])],
388 [WhatGccIsCalled="$withval"
389 if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
390 test "${OSTYPE}" != "msys" && \
391 test "${withval}" != ""
393 # Canonicalise to <drive>:/path/to/gcc
394 withval=`cygpath -m ${withval}`
399 [WhatGccIsCalled="gcc"]
401 AC_SUBST(WhatGccIsCalled)
403 dnl ** Which ld to use?
404 dnl --------------------------------------------------------------
406 [AC_HELP_STRING([--with-ld=ARG],
407 [Use ARG as the path to LD [default=autodetect]])],
408 [if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
409 test "${OSTYPE}" != "msys" && \
410 test "${withval}" != ""
412 # Canonicalise to <drive>:/path/to/ld
413 withval=`cygpath -m ${withval}`
421 # This uses GHC, so put it after the "GHC is required" check above:
425 dnl ** Mac OS X: explicit deployment target
426 dnl --------------------------------------------------------------
427 AC_ARG_WITH([macosx-deployment-target],
428 [AC_HELP_STRING([--with-macosx-deployment-target=VERSION],
429 [Build for Mac OS VERSION and higher (default= version of build host)])],
430 [FP_MACOSX_DEPLOYMENT_TARGET="$withval"
431 if test "x$TargetOS_CPP-$TargetVendor_CPP" != "xdarwin-apple"; then
432 # ignore everywhere, but on Mac OS
433 AC_MSG_WARN([--macosx-deployment-target is only available on Mac OS X])
434 FP_MACOSX_DEPLOYMENT_TARGET=none
436 [FP_MACOSX_DEPLOYMENT_TARGET=none]
438 FP_CHECK_MACOSX_DEPLOYMENT_TARGET
439 AC_SUBST(MACOSX_DEPLOYMENT_VERSION)
440 AC_SUBST(MACOSX_DEPLOYMENT_SDK)
442 dnl --------------------------------------------------------------
443 dnl End of configure script option section
444 dnl --------------------------------------------------------------
447 dnl --------------------------------------------------------------
448 dnl * General configuration checks
449 dnl --------------------------------------------------------------
451 dnl ** Can the unix package be built?
452 dnl --------------------------------------------------------------
454 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
459 AC_SUBST([GhcLibsWithUnix])
464 dnl ** look for `perl', but only in /bin on Windows
467 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
468 if test -z "$PerlCmd"; then
469 echo "You must install the version of Perl shipped with GHC"
470 echo "(or a compatible one) in /bin."
475 AC_PATH_PROG(PerlCmd,perl)
476 if test -z "$PerlCmd"; then
477 echo "You must install perl before you can continue"
478 echo "Perhaps it is already installed, but not in your PATH?"
481 FPTOOLS_CHECK_PERL_VERSION
486 dnl ** does #! path/to/perl work? (sometimes it's too long...)
489 dnl ** check for Python
490 AC_PATH_PROG(PythonCmd,python)
492 dnl ** look for GCC and find out which version
493 dnl Figure out which C compiler to use. Gcc is preferred.
494 dnl If gcc, make sure it's at least 2.1
499 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
502 AC_SUBST(CONF_CC_OPTS)
503 AC_SUBST(CONF_LD_OPTS)
505 dnl ** figure out how to do context diffs
508 dnl Let's make sure install-sh is executable here. If we got it from
509 dnl a darcs repo, it might not be (see bug #978).
511 dnl ** figure out how to do a BSD-ish install
514 dnl If you can run configure, you certainly have /bin/sh
515 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
517 dnl ** how to invoke `ar' and `ranlib'
518 FP_PROG_AR_NEEDS_RANLIB
519 FP_PROG_AR_SUPPORTS_INPUT
521 dnl ** Check to see whether ln -s works
525 dnl ** Find the path to sed
526 AC_PATH_PROG(SedCmd,sed)
529 dnl ** check for time command
530 AC_PATH_PROG(TimeCmd,time)
533 dnl if GNU tar is named gtar, look for it first.
534 AC_PATH_PROGS(TarCmd,gtar tar,tar)
536 dnl ** check for patch
537 dnl if GNU patch is named gpatch, look for it first
538 AC_PATH_PROGS(PatchCmd,gpatch patch, patch)
540 AC_PATH_PROG(HSCOLOUR,HsColour)
541 # HsColour is passed to Cabal, so we need a native path
542 if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
543 test "${OSTYPE}" != "msys" && \
544 test "${HSCOLOUR}" != ""
546 # Canonicalise to <drive>:/path/to/gcc
547 HSCOLOUR=`cygpath -m ${HSCOLOUR}`
550 dnl ** check for DocBook toolchain
557 dnl ** check for ghc-pkg command
560 dnl ** check for installed happy binary + version
561 dnl (don't do it if we're booting from .hc files though.)
562 if test "$BootingFromHc" = "NO"; then
566 dnl ** check for installed alex binary + version
567 dnl (don't do it if we're booting from .hc files though.)
568 if test "$BootingFromHc" = "NO"; then
572 dnl --------------------------------------------------
573 dnl ### program checking section ends here ###
574 dnl --------------------------------------------------
576 dnl --------------------------------------------------
577 dnl * Platform header file and syscall feature tests
578 dnl ### checking the state of the local header files and syscalls ###
580 dnl ** check for full ANSI header (.h) files
583 dnl ** Enable large file support. NB. do this before testing the type of
584 dnl off_t, because it will affect the result of that test.
587 dnl ** check for specific header (.h) files that we are interested in
588 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 sched.h])
590 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
593 dnl ** do we have long longs?
594 AC_CHECK_TYPES([long long])
596 dnl ** what are the sizes of various types
597 AC_CHECK_SIZEOF(char, 1)
598 AC_CHECK_SIZEOF(double, 8)
599 AC_CHECK_SIZEOF(float, 4)
600 AC_CHECK_SIZEOF(int, 4)
601 AC_CHECK_SIZEOF(long, 4)
602 if test "$ac_cv_type_long_long" = yes; then
603 AC_CHECK_SIZEOF(long long, 8)
605 AC_CHECK_SIZEOF(short, 2)
606 AC_CHECK_SIZEOF(unsigned char, 1)
607 AC_CHECK_SIZEOF(unsigned int, 4)
608 AC_CHECK_SIZEOF(unsigned long, 4)
609 if test "$ac_cv_type_long_long" = yes; then
610 AC_CHECK_SIZEOF(unsigned long long, 8)
612 AC_CHECK_SIZEOF(unsigned short, 2)
613 AC_CHECK_SIZEOF(void *, 4)
615 dnl ** what are alignment constraints on various types
616 FP_CHECK_ALIGNMENT(char)
617 FP_CHECK_ALIGNMENT(double)
618 FP_CHECK_ALIGNMENT(float)
619 FP_CHECK_ALIGNMENT(int)
620 FP_CHECK_ALIGNMENT(long)
621 if test "$ac_cv_type_long_long" = yes; then
622 FP_CHECK_ALIGNMENT(long long)
624 FP_CHECK_ALIGNMENT(short)
625 FP_CHECK_ALIGNMENT(unsigned char)
626 FP_CHECK_ALIGNMENT(unsigned int)
627 FP_CHECK_ALIGNMENT(unsigned long)
628 if test "$ac_cv_type_long_long" = yes; then
629 FP_CHECK_ALIGNMENT(unsigned long long)
631 FP_CHECK_ALIGNMENT(unsigned short)
632 FP_CHECK_ALIGNMENT(void *)
634 FP_CHECK_FUNC([WinExec],
635 [@%:@include <windows.h>], [WinExec("",0)])
637 FP_CHECK_FUNC([GetModuleFileName],
638 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
640 dnl ** check return type of signal handlers
641 dnl Foo: assumes we can use prototypes.
642 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
643 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
644 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
645 dnl #include <signal.h>
649 dnl void (*signal (int, void (*)(int)))(int);
652 dnl [ac_cv_type_signal_handler=void_int],
653 dnl [ac_cv_type_signal_handler=int_void])])
654 dnl if test "$ac_cv_type_signal_handler" = void_int; then
655 dnl AC_DEFINE(VOID_INT_SIGNALS)
658 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
660 if test "$ac_cv_type_signal" = void; then
661 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).])
664 dnl ** check for more functions
665 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
666 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity setlocale])
669 #include <sys/types.h>
670 #include <sys/time.h>
672 struct itimerval tval;
673 tval.it_value.tv_sec = 1;
674 tval.it_value.tv_usec = 0;
675 tval.it_interval = tval.it_value;
676 return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0;
678 ],[AC_DEFINE([HAVE_SETITIMER_VIRTUAL], [1], [Define to 1 if setitimer accepts ITIMER_VIRTUAL, 0 else.])])
680 dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
681 dnl ** _POSIX_C_SOURCE is defined
682 AC_CHECK_DECLS([ctime_r], , ,
683 [#define _POSIX_SOURCE 1
684 #define _POSIX_C_SOURCE 199506L
687 dnl ** check for mingwex library
688 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
689 AC_SUBST(HaveLibMingwEx)
691 if test $HaveLibMingwEx = YES ; then
692 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
695 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
696 dnl the order of these tests matters: bfd needs liberty
697 AC_CHECK_LIB(iberty, xmalloc)
698 AC_CHECK_LIB(bfd, bfd_init)
700 dnl ** check for math library
701 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
702 if test x"$fp_libm_not_needed" = xdunno; then
703 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
707 dnl ################################################################
708 dnl Check for libraries
709 dnl ################################################################
711 dnl ** check whether we need -ldl to get dlopen()
713 AC_CHECK_LIB(dl, dlopen,
715 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
720 dnl --------------------------------------------------
721 dnl * Miscellaneous feature tests
722 dnl --------------------------------------------------
724 dnl ** can we get alloca?
727 dnl ** Working vfork?
730 dnl ** determine whether or not const works
733 dnl ** are we big endian?
735 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
737 dnl ** check for leading underscores in symbol names
738 FP_LEADING_UNDERSCORE
740 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
744 dnl ** check for Apple-style dead-stripping support
745 dnl (.subsections-via-symbols assembler directive)
748 AC_MSG_CHECKING(for .subsections_via_symbols)
750 [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
752 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
753 [Define to 1 if Apple-style dead-stripping is supported.])
757 dnl *** check for GNU non-executable stack note support (ELF only)
758 dnl (.section .note.GNU-stack,"",@progbits)
760 AC_MSG_CHECKING(for GNU non-executable stack support)
762 [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
764 AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
765 [Define to 1 if GNU non-executable stack notes are supported.])
769 dnl ** check for librt
770 AC_CHECK_LIB(rt, clock_gettime)
771 AC_CHECK_FUNCS(clock_gettime timer_create timer_settime)
772 FP_CHECK_TIMER_CREATE
774 dnl ** check for Apple's "interesting" long double compatibility scheme
775 AC_MSG_CHECKING(for printf\$LDBLStub)
776 AC_TRY_LINK_FUNC(printf\$LDBLStub,
779 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
780 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
784 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
785 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
789 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
790 if test -n "$GTK_CONFIG"; then
791 if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
792 GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
794 AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
798 AC_SUBST([GTK_CONFIG])
801 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
802 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
803 AC_SUBST(HavePapiLib)
804 AC_SUBST(HavePapiHeader)
806 AC_CHECK_FUNCS(__mingw_vfprintf)
808 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
815 if test "$HAVE_DOCBOOK_XSL" = "NO" ||
816 test "$XsltprocCmd" = ""
818 BUILD_DOCBOOK_HTML=NO
820 BUILD_DOCBOOK_HTML=YES
822 AC_SUBST(BUILD_DOCBOOK_HTML)
824 if test "$DblatexCmd" = ""
830 BUILD_DOCBOOK_PDF=YES
832 AC_SUBST(BUILD_DOCBOOK_PS)
833 AC_SUBST(BUILD_DOCBOOK_PDF)
835 if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
836 AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
839 AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml distrib/ghc.iss distrib/configure-bin.ac])
840 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
844 # http://savannah.gnu.org/bugs/index.php?1516
845 # $(eval ...) inside conditionals causes errors
846 # with make 3.80, so warn the user if it looks like they're about to
848 # We would use "grep -q" here, but Solaris's grep doesn't support it.
850 if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
853 echo "WARNING: It looks like \"$1\" is GNU make 3.80."
854 echo "This version cannot be used to build GHC."
855 echo "Please use GNU make >= 3.81."
863 ----------------------------------------------------------------------
864 Configure completed successfully.
866 Building GHC version : $ProjectVersion
868 Build platform : $BuildPlatform
869 Host platform : $HostPlatform
870 Target platform : $TargetPlatform
873 if test "$BootingFromHc" = "YES"; then
875 Bootstrapping from HC files.
879 Bootstrapping using : $WithGhc
880 which is version : $GhcVersion
885 Using GCC : $WhatGccIsCalled
886 which is version : $GccVersion
889 Happy : $HappyCmd ($HappyVersion)
890 Alex : $AlexCmd ($AlexVersion)
893 dblatex : $DblatexCmd
894 xsltproc : $XsltprocCmd"]
896 if test "$HSCOLOUR" = ""; then
898 HsColour was not found; documentation will not contain source links
907 Building DocBook HTML documentation : $BUILD_DOCBOOK_HTML
908 Building DocBook PS documentation : $BUILD_DOCBOOK_PS
909 Building DocBook PDF documentation : $BUILD_DOCBOOK_PDF"]
911 echo ["----------------------------------------------------------------------
915 For a standard build of GHC (fully optimised with profiling), type (g)make.
917 To make changes to the default build configuration, copy the file
918 mk/build.mk.sample to mk/build.mk, and edit the settings in there.
920 For more information on how to configure your GHC build, see
921 http://hackage.haskell.org/trac/ghc/wiki/Building