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-2012
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], [7.7], [glasgow-haskell-bugs@haskell.org], [ghc])
18 # Set this to YES for a released version, otherwise NO
21 # The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line
22 # above. If this is not a released version, then we will append the
23 # date to the version number (e.g. 7.4.20111220). The date is
24 # constructed by finding the date of the most recent patch in the
25 # git repository. If this is a source distribution (not a git
26 # checkout), then we ship a file 'VERSION' containing the full version
27 # when the source distribution was created.
29 if test ! -f mk/config.h.in; then
30 echo "mk/config.h.in doesn't exist: perhaps you haven't run 'perl boot'?"
34 AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
36 dnl ----------------------------------------------------------
37 dnl ** Find unixy sort and find commands,
38 dnl ** which are needed by FP_SETUP_PROJECT_VERSION
40 dnl ** Find find command (for Win32's benefit)
43 dnl ----------------------------------------------------------
44 FP_SETUP_PROJECT_VERSION
46 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
47 AC_SUBST([release], [1])
49 # First off, a distrib sanity check..
50 AC_CONFIG_SRCDIR([mk/config.mk.in])
52 dnl * We require autoconf version 2.60
53 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
54 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
55 dnl Using autoconf 2.59 started to give nonsense like this
56 dnl #define SIZEOF_CHAR 0
60 # -------------------------------------------------------------------------
61 # Prepare to generate the following header files
64 AC_CONFIG_HEADER(mk/config.h)
66 # No, semi-sadly, we don't do `--srcdir'...
67 if test x"$srcdir" != 'x.' ; then
68 echo "This configuration does not support the \`--srcdir' option.."
72 dnl --------------------------------------------------------------
73 dnl * Project specific configuration options
74 dnl --------------------------------------------------------------
75 dnl What follows is a bunch of options that can either be configured
76 dnl through command line options to the configure script or by
77 dnl supplying defns in the build tree's mk/build.mk. Having the option to
78 dnl use either is considered a Feature.
80 dnl ** What command to use to compile compiler sources ?
81 dnl --------------------------------------------------------------
84 [AC_HELP_STRING([--with-ghc=ARG],
85 [Use ARG as the path to GHC [default=autodetect]])],
87 [if test "$GHC" = ""; then
88 AC_PATH_PROG([GHC], [ghc])
92 dnl ** Tell the make system which OS we are using
93 dnl $OSTYPE is set by the operating system to "msys" or "cygwin" or something
96 dnl ** Booting from .hc files?
97 dnl --------------------------------------------------------------
98 AC_ARG_ENABLE(hc-boot,
99 [AC_HELP_STRING([--enable-hc-boot],
100 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
101 (This option is mostly of interest to porters.) [default=no]])],
102 [ if test x"$enableval" = x"yes"; then
110 AC_SUBST(BootingFromHc)
112 AC_ARG_ENABLE(bootstrap-with-devel-snapshot,
113 [AC_HELP_STRING([--enable-bootstrap-with-devel-snapshot],
114 [Allow bootstrapping using a development snapshot of GHC. This is not guaranteed to work.])],
115 EnableBootstrapWithDevelSnaphost=YES,
116 EnableBootstrapWithDevelSnaphost=NO
119 if test "$WithGhc" != ""; then
120 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
122 if test "$GhcMajVersion" = "unknown" -o "$GhcMinVersion" = "unknown"; then
123 AC_MSG_ERROR([Cannot determine the version of $WithGhc. Is it really GHC?])
126 AC_SUBST(GhcVersion)dnl
127 AC_SUBST(GhcMajVersion)dnl
128 AC_SUBST(GhcMinVersion)dnl
129 AC_SUBST(GhcPatchLevel)dnl
130 GhcMinVersion2=`echo "$GhcMinVersion" | sed 's/^\\(.\\)$/0\\1/'`
131 GhcCanonVersion="$GhcMajVersion$GhcMinVersion2"
133 BOOTSTRAPPING_GHC_INFO_FIELD([OS_STAGE0],[target os])
134 BOOTSTRAPPING_GHC_INFO_FIELD([CC_STAGE0],[C compiler command])
135 if test "x$OS_STAGE0" != "xOSDarwin"; then
136 BOOTSTRAPPING_GHC_INFO_FIELD([AR_STAGE0],[ar command])
137 BOOTSTRAPPING_GHC_INFO_FIELD([AR_OPTS_STAGE0],[ar flags])
138 BOOTSTRAPPING_GHC_INFO_FIELD([ArSupportsAtFile_STAGE0],[ar supports at file])
141 AR_OPTS_STAGE0='$(AR_OPTS)'
142 ArSupportsAtFile_STAGE0='$(ArSupportsAtFile)'
146 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
147 if test "$BootingFromHc" = "NO"; then
148 if test "$WithGhc" = ""; then
149 AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
151 FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.4],
152 [AC_MSG_ERROR([GHC version 7.4 or later is required to compile GHC.])])dnl
154 if test `expr $GhcMinVersion % 2` = "1"; then
155 if test "$EnableBootstrapWithDevelSnaphost" = "NO"; then
157 $WithGhc is a development snapshot of GHC, version $GhcVersion.
158 Bootstrapping using this version of GHC is not supported, and may not
159 work. Use --enable-bootstrap-with-devel-snapshot to try it anyway,
160 or --with-ghc to specify a different GHC to use.])
164 GHC_PACKAGE_DB_FLAG=package-db
165 FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.5],GHC_PACKAGE_DB_FLAG=package-conf)
166 AC_SUBST(GHC_PACKAGE_DB_FLAG)
169 # GHC is passed to Cabal, so we need a native path
170 if test "${WithGhc}" != ""
172 ghc_host_os=`"${WithGhc}" +RTS --info | grep 'Host OS' | sed -e 's/.*, "//' -e 's/")//'`
174 if test "$ghc_host_os" = "mingw32"
176 if test "${OSTYPE}" = "msys"
178 WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"`
180 # Canonicalise to <drive>:/path/to/ghc
181 WithGhc=`cygpath -m "${WithGhc}"`
183 echo "GHC path canonicalised to: ${WithGhc}"
188 dnl ** Without optimization some INLINE trickery fails for GHCi
191 dnl--------------------------------------------------------------------
192 dnl * Choose host(/target/build) platform
193 dnl--------------------------------------------------------------------
194 dnl If we aren't explicitly told what values to use with configure flags,
195 dnl we ask the bootstrapping compiler what platform it is for
197 if test "${WithGhc}" != ""
199 bootstrap_host=`"${WithGhc}" +RTS --info | grep '^ ,("Host platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
200 bootstrap_target=`"${WithGhc}" +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
201 if test "$bootstrap_host" != "$bootstrap_target"
203 echo "Bootstrapping GHC is a cross compiler. This probably isn't going to work"
207 # We have to run these unconditionally, but we may discard their
208 # results in the following code
213 FPTOOLS_SET_PLATFORM_VARS
215 # Verify that the installed (bootstrap) GHC is capable of generating
216 # code for the requested build platform.
217 if test "$BootingFromHc" = "NO"
219 if test "$BuildPlatform" != "$bootstrap_target"
221 echo "This GHC (${WithGhc}) does not generate code for the build platform"
222 echo " GHC target platform : $bootstrap_target"
223 echo " Desired build platform : $BuildPlatform"
228 # Testing if we shall enable shared libs support on Solaris.
229 # Anything older than SunOS 5.11 aka Solaris 11 (Express) is broken.
231 SOLARIS_BROKEN_SHLD=NO
235 # here we go with the test
236 MINOR=`uname -r|cut -d '.' -f 2-`
237 if test "$MINOR" -lt "11"; then
238 SOLARIS_BROKEN_SHLD=YES
243 AC_SUBST(SOLARIS_BROKEN_SHLD)
245 dnl ** Do an unregisterised build?
246 dnl --------------------------------------------------------------
248 i386|x86_64|powerpc|arm)
249 UnregisterisedDefault=NO
252 UnregisterisedDefault=YES
255 AC_ARG_ENABLE(unregisterised,
256 [AC_HELP_STRING([--enable-unregisterised],
257 [Build an unregisterised compiler (enabled by default on platforms without registerised support) [default="$UnregisterisedDefault"]])],
258 [ if test x"$enableval" = x"yes"; then
264 [Unregisterised="$UnregisterisedDefault"]
266 AC_SUBST(Unregisterised)
269 [AC_HELP_STRING([--with-hc=ARG],
270 [Use ARG as the path to the compiler for compiling ordinary
271 Haskell code (default= value of --with-ghc)])],
277 # This uses GHC, so put it after the "GHC is required" check above:
281 if test "$HostOS" = "mingw32"
283 test -d inplace || mkdir inplace
285 if test "$HostArch" = "i386"
287 # NB. If you update the tarballs to a new version of gcc, don't
288 # forget to tweak the paths in driver/gcc/gcc.c.
289 if ! test -d inplace/mingw ||
290 test inplace/mingw -ot ghc-tarballs/mingw/binutils*.tar.lzma ||
291 test inplace/mingw -ot ghc-tarballs/mingw/gcc-core*.tar.lzma ||
292 test inplace/mingw -ot ghc-tarballs/mingw/gcc-c++*.tar.lzma ||
293 test inplace/mingw -ot ghc-tarballs/mingw/libgcc*.tar.gz ||
294 test inplace/mingw -ot ghc-tarballs/mingw/libgmp*.tar.gz ||
295 test inplace/mingw -ot ghc-tarballs/mingw/libmpc*.tar.gz ||
296 test inplace/mingw -ot ghc-tarballs/mingw/libmpfr*.tar.gz ||
297 test inplace/mingw -ot ghc-tarballs/mingw/libstdc*.tar.lzma ||
298 test inplace/mingw -ot ghc-tarballs/mingw/mingwrt*-dev.tar.gz ||
299 test inplace/mingw -ot ghc-tarballs/mingw/mingwrt*-dll.tar.gz ||
300 test inplace/mingw -ot ghc-tarballs/mingw/w32api*.tar.lzma
302 AC_MSG_NOTICE([Making in-tree mingw tree])
307 tar --lzma -xf ../../ghc-tarballs/mingw/binutils*.tar.lzma &&
308 tar --lzma -xf ../../ghc-tarballs/mingw/gcc-core*.tar.lzma &&
309 tar --lzma -xf ../../ghc-tarballs/mingw/gcc-c++*.tar.lzma &&
310 tar --lzma -xf ../../ghc-tarballs/mingw/libgcc*.tar.lzma &&
311 tar --lzma -xf ../../ghc-tarballs/mingw/libgmp*.tar.lzma &&
312 tar --lzma -xf ../../ghc-tarballs/mingw/libmpc*.tar.lzma &&
313 tar --lzma -xf ../../ghc-tarballs/mingw/libmpfr*.tar.lzma &&
314 tar --lzma -xf ../../ghc-tarballs/mingw/libstdc*.tar.lzma &&
315 tar -z -xf ../../ghc-tarballs/mingw/mingwrt*-dev.tar.gz &&
316 tar -z -xf ../../ghc-tarballs/mingw/mingwrt*-dll.tar.gz &&
317 tar --lzma -xf ../../ghc-tarballs/mingw/w32api*.tar.lzma &&
318 mv bin/gcc.exe bin/realgcc.exe
320 PATH=`pwd`/inplace/mingw/bin:$PATH inplace/mingw/bin/realgcc.exe driver/gcc/gcc.c driver/utils/cwrapper.c driver/utils/getLocation.c -Idriver/utils -o inplace/mingw/bin/gcc.exe
321 AC_MSG_NOTICE([In-tree mingw tree created])
324 # NB. If you update the tarballs to a new version of gcc, don't
325 # forget to tweak the paths in driver/gcc/gcc.c.
326 if ! test -d inplace/mingw ||
327 test inplace/mingw -ot ghc-tarballs/mingw64/*.tar.bz2
329 AC_MSG_NOTICE([Making in-tree mingw tree])
334 tar -jxf ../../ghc-tarballs/mingw64/*.tar.bz2
336 AC_MSG_NOTICE([In-tree mingw tree created])
340 mingwbin="$hardtop/inplace/mingw/bin/"
341 CC="${mingwbin}gcc.exe"
342 LD="${mingwbin}ld.exe"
343 NM="${mingwbin}nm.exe"
344 OBJDUMP="${mingwbin}objdump.exe"
345 fp_prog_ar="${mingwbin}ar.exe"
347 if ! test -d inplace/perl ||
348 test inplace/perl -ot ghc-tarballs/perl/ghc-perl*.tar.gz
350 AC_MSG_NOTICE([Making in-tree perl tree])
355 tar -zxf ../../ghc-tarballs/perl/ghc-perl*.tar.gz
357 AC_MSG_NOTICE([In-tree perl tree created])
363 AC_ARG_WITH([system-libffi],
364 [AC_HELP_STRING([--with-system-libffi],
365 [Use system provided libffi for RTS [default=no]])
368 AS_IF([test "x$with_system_libffi" = "xyes"],
369 [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"]
373 AC_SUBST(UseSystemLibFFI)
375 AC_ARG_WITH([ffi-includes],
376 [AC_HELP_STRING([--with-ffi-includes=ARG]
377 [Find includes for libffi in ARG [default=system default]])
380 if test "x$UseSystemLibFFI" != "xYES"; then
381 AC_MSG_WARN([--with-ffi-includes will be ignored, --with-system-libffi not set])
383 FFIIncludeDir="$withval"
384 LIBFFI_CFLAGS="-I $withval"
388 AC_SUBST(FFIIncludeDir)
390 AC_ARG_WITH([ffi-libraries],
391 [AC_HELP_STRING([--with-ffi-libraries=ARG]
392 [Find libffi in ARG [default=system default]])
395 if test "x$UseSystemLibFFI" != "xYES"; then
396 AC_MSG_WARN([--with-ffi-libraries will be ignored, --with-system-libffi not set])
398 FFILibDir="$withval" LIBFFI_LDFLAGS="-L$withval"
404 AS_IF([test "$UseSystemLibFFI" = "YES"], [
406 CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
408 LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS"
409 AC_CHECK_LIB(ffi, ffi_call,
410 [AC_CHECK_HEADERS([ffi.h], [break], [])
411 AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])],
412 [AC_MSG_ERROR([Cannot find system libffi])])
423 if test "$TargetOS_CPP" = "darwin"
425 # Split objects is broken (#4013) with XCode < 3.2
426 if test "$XCodeVersion1" -lt 3
430 if test "$XCodeVersion1" -eq 3
432 if test "$XCodeVersion2" -lt 2
439 AC_SUBST([SplitObjsBroken])
441 dnl ** Building a cross compiler?
442 dnl --------------------------------------------------------------
444 # If 'host' and 'target' differ, then this means we are building a cross-compiler.
445 if test "$target" != "$host" ; then
447 cross_compiling=yes # This tells configure that it can accept just 'target',
449 # configure: error: cannot run C compiled programs.
450 # If you meant to cross compile, use `--host'.
452 if test "$build" != "$host" ; then
456 BUILD: $build (the architecture we're building on)
457 HOST: $host (the architecture the compiler we're building will execute on)
458 TARGET: $target (the architecture the compiler we're building will produce code for)
460 BUILD must equal HOST; that is, we do not support building GHC itself
461 with a cross-compiler. To cross-compile GHC itself, set TARGET: stage
462 1 will be a cross-compiler, and stage 2 will be the cross-compiled
466 if test "$CrossCompiling" = "YES"
468 CrossCompilePrefix="${target}-"
470 CrossCompilePrefix=""
472 TargetPlatformFull="${target}"
473 AC_SUBST(CrossCompiling)
474 AC_SUBST(CrossCompilePrefix)
475 AC_SUBST(TargetPlatformFull)
477 dnl ** Which gcc to use?
478 dnl --------------------------------------------------------------
479 FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
480 CC="$WhatGccIsCalled"
483 dnl ** Which ld to use?
484 dnl --------------------------------------------------------------
485 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
489 dnl ** Which nm to use?
490 dnl --------------------------------------------------------------
491 FP_ARG_WITH_PATH_GNU_PROG([NM], [nm], [nm])
495 # Note: we may not have objdump on OS X, and we only need it on Windows (for DLL checks)
498 dnl ** Which objdump to use?
499 dnl --------------------------------------------------------------
500 FP_ARG_WITH_PATH_GNU_PROG([OBJDUMP], [objdump], [objdump])
501 ObjdumpCmd="$OBJDUMP"
502 AC_SUBST([ObjdumpCmd])
506 dnl ** Which LLVM llc to use?
507 dnl --------------------------------------------------------------
508 FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([LLC], [llc], [llc])
512 dnl ** Which LLVM opt to use?
513 dnl --------------------------------------------------------------
514 FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([OPT], [opt], [opt])
518 dnl ** Mac OS X: explicit deployment target
519 dnl --------------------------------------------------------------
520 AC_ARG_WITH([macosx-deployment-target],
521 [AC_HELP_STRING([--with-macosx-deployment-target=VERSION],
522 [Build for Mac OS VERSION and higher (default= version of build host)])],
523 [FP_MACOSX_DEPLOYMENT_TARGET="$withval"
524 if test "x$TargetOS_CPP-$TargetVendor_CPP" != "xdarwin-apple"; then
525 # ignore everywhere, but on Mac OS
526 AC_MSG_WARN([--macosx-deployment-target is only available on Mac OS X])
527 FP_MACOSX_DEPLOYMENT_TARGET=none
529 [FP_MACOSX_DEPLOYMENT_TARGET=none]
531 FP_CHECK_MACOSX_DEPLOYMENT_TARGET
532 AC_SUBST(MACOSX_DEPLOYMENT_VERSION)
533 AC_SUBST(MACOSX_DEPLOYMENT_SDK)
535 dnl --------------------------------------------------------------
536 dnl End of configure script option section
537 dnl --------------------------------------------------------------
540 dnl --------------------------------------------------------------
541 dnl * General configuration checks
542 dnl --------------------------------------------------------------
544 dnl ** Can the unix package be built?
545 dnl --------------------------------------------------------------
547 if test "$TargetOS" = "mingw32"
553 AC_SUBST([GhcLibsWithUnix])
558 dnl ** look for `perl'
561 PerlCmd=$hardtop/inplace/perl/perl
564 AC_PATH_PROG(PerlCmd,perl)
565 if test -z "$PerlCmd"
567 echo "You must install perl before you can continue"
568 echo "Perhaps it is already installed, but not in your PATH?"
571 FPTOOLS_CHECK_PERL_VERSION
576 dnl ** look for GCC and find out which version
577 dnl Figure out which C compiler to use. Gcc is preferred.
578 dnl If gcc, make sure it's at least 3.0
582 dnl ** look to see if we have a C compiler using an llvm back end.
586 FP_PROG_LD_HashSize31
587 FP_PROG_LD_ReduceMemoryOverheads
590 FP_PROG_LD_NO_COMPACT_UNWIND
593 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
594 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
595 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
596 # Stage 3 won't be supported by cross-compilation
597 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
601 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
604 AC_SUBST(CONF_CC_OPTS_STAGE0)
605 AC_SUBST(CONF_CC_OPTS_STAGE1)
606 AC_SUBST(CONF_CC_OPTS_STAGE2)
607 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
608 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
609 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
610 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
611 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
612 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
613 AC_SUBST(CONF_CPP_OPTS_STAGE0)
614 AC_SUBST(CONF_CPP_OPTS_STAGE1)
615 AC_SUBST(CONF_CPP_OPTS_STAGE2)
617 dnl ** Set up the variables for the platform in the settings file.
618 dnl May need to use gcc to find platform details.
619 dnl --------------------------------------------------------------
620 FPTOOLS_SET_HASKELL_PLATFORM_VARS
622 dnl ** figure out how to do context diffs
625 dnl Let's make sure install-sh is executable here. If we got it from
626 dnl a darcs repo, it might not be (see bug #978).
628 dnl ** figure out how to do a BSD-ish install
631 dnl If you can run configure, you certainly have /bin/sh
632 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
634 dnl ** how to invoke `ar' and `ranlib'
635 FP_PROG_AR_SUPPORTS_ATFILE
636 FP_PROG_AR_NEEDS_RANLIB
638 dnl ** Check to see whether ln -s works
643 dnl ** Find the path to sed
644 AC_PATH_PROGS(SedCmd,gsed sed,sed)
647 dnl ** check for time command
648 AC_PATH_PROG(TimeCmd,time)
651 dnl if GNU tar is named gtar, look for it first.
652 AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar)
654 dnl ** check for patch
655 dnl if GNU patch is named gpatch, look for it first
656 AC_PATH_PROGS(PatchCmd,gpatch patch, patch)
658 dnl ** check for dtrace (currently only implemented for Mac OS X)
660 AC_PATH_PROG(DtraceCmd,dtrace)
661 if test -n "$DtraceCmd"; then
662 if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then
668 AC_PATH_PROG(HSCOLOUR,HsColour)
669 # HsColour is passed to Cabal, so we need a native path
670 if test "$HostOS" = "mingw32" && \
671 test "${OSTYPE}" != "msys" && \
672 test "${HSCOLOUR}" != ""
674 # Canonicalise to <drive>:/path/to/gcc
675 HSCOLOUR=`cygpath -m ${HSCOLOUR}`
678 dnl ** check for DocBook toolchain
683 dnl ** check for ghc-pkg command
686 dnl ** check for installed happy binary + version
687 dnl (don't do it if we're booting from .hc files though.)
688 if test "$BootingFromHc" = "NO"; then
692 dnl ** check for installed alex binary + version
693 dnl (don't do it if we're booting from .hc files though.)
694 if test "$BootingFromHc" = "NO"; then
698 dnl --------------------------------------------------
699 dnl ### program checking section ends here ###
700 dnl --------------------------------------------------
702 dnl --------------------------------------------------
703 dnl * Platform header file and syscall feature tests
704 dnl ### checking the state of the local header files and syscalls ###
706 dnl ** check for full ANSI header (.h) files
709 dnl ** Enable large file support. NB. do this before testing the type of
710 dnl off_t, because it will affect the result of that test.
713 dnl ** check for specific header (.h) files that we are interested in
714 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/cpuset.h sys/mman.h sys/resource.h sys/select.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])
716 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
719 dnl ** do we have long longs?
720 AC_CHECK_TYPES([long long])
722 dnl ** what are the sizes of various types
723 AC_CHECK_SIZEOF(char, 1)
724 AC_CHECK_SIZEOF(double, 8)
725 AC_CHECK_SIZEOF(float, 4)
726 AC_CHECK_SIZEOF(int, 4)
727 AC_CHECK_SIZEOF(long, 4)
728 if test "$ac_cv_type_long_long" = yes; then
729 AC_CHECK_SIZEOF(long long, 8)
731 AC_CHECK_SIZEOF(short, 2)
732 AC_CHECK_SIZEOF(unsigned char, 1)
733 AC_CHECK_SIZEOF(unsigned int, 4)
734 AC_CHECK_SIZEOF(unsigned long, 4)
735 if test "$ac_cv_type_long_long" = yes; then
736 AC_CHECK_SIZEOF(unsigned long long, 8)
738 AC_CHECK_SIZEOF(unsigned short, 2)
739 AC_CHECK_SIZEOF(void *, 4)
741 dnl for use in settings.in
742 WordSize=$ac_cv_sizeof_void_p
745 dnl ** what are alignment constraints on various types
746 FP_CHECK_ALIGNMENT(char)
747 FP_CHECK_ALIGNMENT(double)
748 FP_CHECK_ALIGNMENT(float)
749 FP_CHECK_ALIGNMENT(int)
750 FP_CHECK_ALIGNMENT(long)
751 if test "$ac_cv_type_long_long" = yes; then
752 FP_CHECK_ALIGNMENT(long long)
754 FP_CHECK_ALIGNMENT(short)
755 FP_CHECK_ALIGNMENT(unsigned char)
756 FP_CHECK_ALIGNMENT(unsigned int)
757 FP_CHECK_ALIGNMENT(unsigned long)
758 if test "$ac_cv_type_long_long" = yes; then
759 FP_CHECK_ALIGNMENT(unsigned long long)
761 FP_CHECK_ALIGNMENT(unsigned short)
762 FP_CHECK_ALIGNMENT(void *)
764 FP_CHECK_FUNC([WinExec],
765 [@%:@include <windows.h>], [WinExec("",0)])
767 FP_CHECK_FUNC([GetModuleFileName],
768 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
770 dnl ** check return type of signal handlers
771 dnl Foo: assumes we can use prototypes.
772 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
773 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
774 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
775 dnl #include <signal.h>
779 dnl void (*signal (int, void (*)(int)))(int);
782 dnl [ac_cv_type_signal_handler=void_int],
783 dnl [ac_cv_type_signal_handler=int_void])])
784 dnl if test "$ac_cv_type_signal_handler" = void_int; then
785 dnl AC_DEFINE(VOID_INT_SIGNALS)
788 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
790 if test "$ac_cv_type_signal" = void; then
791 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).])
794 dnl ** check for more functions
795 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
796 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity setlocale])
798 dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
799 dnl ** _POSIX_C_SOURCE is defined
800 AC_CHECK_DECLS([ctime_r], , ,
801 [#define _POSIX_SOURCE 1
802 #define _POSIX_C_SOURCE 199506L
805 dnl ** check for mingwex library
806 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
807 AC_SUBST(HaveLibMingwEx)
809 if test $HaveLibMingwEx = YES ; then
810 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
813 dnl ** check for math library
814 dnl Keep that check as early as possible.
815 dnl as we need to know whether we need libm
816 dnl for math functions or not
817 dnl (see http://hackage.haskell.org/trac/ghc/ticket/3730)
818 AC_CHECK_LIB(m, atan, HaveLibM=YES, HaveLibM=NO)
819 if test $HaveLibM = YES
821 AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm])
824 dnl ** check whether this machine has BFD and libiberty installed (used for debugging)
825 dnl the order of these tests matters: bfd needs libiberty
826 AC_CHECK_LIB(iberty, xmalloc)
827 AC_CHECK_LIB(bfd, bfd_uncompress_section_contents)
829 dnl ################################################################
830 dnl Check for libraries
831 dnl ################################################################
833 dnl ** check whether we need -ldl to get dlopen()
835 AC_CHECK_LIB(dl, dlopen,
837 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
842 dnl --------------------------------------------------
843 dnl * Miscellaneous feature tests
844 dnl --------------------------------------------------
846 dnl ** can we get alloca?
849 dnl ** working vfork?
852 dnl ** determine whether or not const works
855 dnl ** are we big endian?
857 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
859 dnl ** check for leading underscores in symbol names
860 FP_LEADING_UNDERSCORE
864 dnl ** check for librt
865 AC_CHECK_LIB(rt, clock_gettime)
866 AC_CHECK_FUNCS(clock_gettime timer_settime)
867 FP_CHECK_TIMER_CREATE
869 dnl ** check for Apple's "interesting" long double compatibility scheme
870 AC_MSG_CHECKING(for printf\$LDBLStub)
871 AC_TRY_LINK_FUNC(printf\$LDBLStub,
874 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
875 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
879 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
880 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
883 dnl ** check for eventfd which is needed by the I/O manager
884 AC_CHECK_HEADERS([sys/eventfd.h])
885 AC_CHECK_FUNCS([eventfd])
888 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
889 if test -n "$GTK_CONFIG"; then
890 if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
891 GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
893 AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
897 AC_SUBST([GTK_CONFIG])
900 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
901 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
902 AC_SUBST(HavePapiLib)
903 AC_SUBST(HavePapiHeader)
905 AC_CHECK_FUNCS(__mingw_vfprintf)
907 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
914 if test "$HAVE_DOCBOOK_XSL" = "NO" ||
915 test "$XsltprocCmd" = ""
917 BUILD_DOCBOOK_HTML=NO
919 BUILD_DOCBOOK_HTML=YES
921 AC_SUBST(BUILD_DOCBOOK_HTML)
923 if test "$DblatexCmd" = ""
929 BUILD_DOCBOOK_PDF=YES
931 AC_SUBST(BUILD_DOCBOOK_PS)
932 AC_SUBST(BUILD_DOCBOOK_PDF)
934 LIBRARY_VERSION(base)
935 LIBRARY_VERSION(Cabal, Cabal/Cabal)
936 LIBRARY_VERSION(ghc-prim)
937 LIBRARY_ghc_VERSION="$ProjectVersion"
938 AC_SUBST(LIBRARY_ghc_VERSION)
940 if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
941 AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
944 AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec settings docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/ghc.iss distrib/configure.ac])
945 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
949 # http://savannah.gnu.org/bugs/index.php?1516
950 # $(eval ...) inside conditionals causes errors
951 # with make 3.80, so warn the user if it looks like they're about to
953 # We would use "grep -q" here, but Solaris's grep doesn't support it.
955 if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
958 echo "WARNING: It looks like \"$1\" is GNU make 3.80."
959 echo "This version cannot be used to build GHC."
960 echo "Please use GNU make >= 3.81."
968 ----------------------------------------------------------------------
969 Configure completed successfully.
971 Building GHC version : $ProjectVersion
973 Build platform : $BuildPlatform
974 Host platform : $HostPlatform
975 Target platform : $TargetPlatform
978 if test "$BootingFromHc" = "YES"; then
980 Bootstrapping from HC files.
984 Bootstrapping using : $WithGhc
985 which is version : $GhcVersion
990 Using GCC : $WhatGccIsCalled
991 which is version : $GccVersion
992 Building a cross compiler : $CrossCompiling
995 Happy : $HappyCmd ($HappyVersion)
996 Alex : $AlexCmd ($AlexVersion)
998 dblatex : $DblatexCmd
999 xsltproc : $XsltprocCmd"]
1001 if test "$HSCOLOUR" = ""; then
1003 HsColour was not found; documentation will not contain source links
1007 HsColour : $HSCOLOUR
1012 Building DocBook HTML documentation : $BUILD_DOCBOOK_HTML
1013 Building DocBook PS documentation : $BUILD_DOCBOOK_PS
1014 Building DocBook PDF documentation : $BUILD_DOCBOOK_PDF"]
1016 echo ["----------------------------------------------------------------------
1020 For a standard build of GHC (fully optimised with profiling), type (g)make.
1022 To make changes to the default build configuration, copy the file
1023 mk/build.mk.sample to mk/build.mk, and edit the settings in there.
1025 For more information on how to configure your GHC build, see
1026 http://hackage.haskell.org/trac/ghc/wiki/Building