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)
44 dnl ----------------------------------------------------------
45 FP_SETUP_PROJECT_VERSION
47 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
48 AC_SUBST([release], [1])
50 # First off, a distrib sanity check..
51 AC_CONFIG_SRCDIR([mk/config.mk.in])
53 dnl * We require autoconf version 2.60
54 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
55 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
56 dnl Using autoconf 2.59 started to give nonsense like this
57 dnl #define SIZEOF_CHAR 0
61 # -------------------------------------------------------------------------
62 # Prepare to generate the following header files
65 AC_CONFIG_HEADER(mk/config.h)
67 # No, semi-sadly, we don't do `--srcdir'...
68 if test x"$srcdir" != 'x.' ; then
69 echo "This configuration does not support the \`--srcdir' option.."
73 dnl --------------------------------------------------------------
74 dnl * Project specific configuration options
75 dnl --------------------------------------------------------------
76 dnl What follows is a bunch of options that can either be configured
77 dnl through command line options to the configure script or by
78 dnl supplying defns in the build tree's mk/build.mk. Having the option to
79 dnl use either is considered a Feature.
81 dnl ** What command to use to compile compiler sources ?
82 dnl --------------------------------------------------------------
85 [AC_HELP_STRING([--with-ghc=ARG],
86 [Use ARG as the path to GHC [default=autodetect]])],
88 [if test "$GHC" = ""; then
89 AC_PATH_PROG([GHC], [ghc])
93 dnl ** Tell the make system which OS we are using
94 dnl $OSTYPE is set by the operating system to "msys" or "cygwin" or something
97 AC_ARG_ENABLE(bootstrap-with-devel-snapshot,
98 [AC_HELP_STRING([--enable-bootstrap-with-devel-snapshot],
99 [Allow bootstrapping using a development snapshot of GHC. This is not guaranteed to work.])],
100 EnableBootstrapWithDevelSnaphost=YES,
101 EnableBootstrapWithDevelSnaphost=NO
104 if test "$WithGhc" != ""; then
105 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
107 if test "$GhcMajVersion" = "unknown" -o "$GhcMinVersion" = "unknown"; then
108 AC_MSG_ERROR([Cannot determine the version of $WithGhc. Is it really GHC?])
111 AC_SUBST(GhcVersion)dnl
112 AC_SUBST(GhcMajVersion)dnl
113 AC_SUBST(GhcMinVersion)dnl
114 AC_SUBST(GhcPatchLevel)dnl
115 GhcMinVersion2=`echo "$GhcMinVersion" | sed 's/^\\(.\\)$/0\\1/'`
116 GhcCanonVersion="$GhcMajVersion$GhcMinVersion2"
118 BOOTSTRAPPING_GHC_INFO_FIELD([OS_STAGE0],[target os])
119 BOOTSTRAPPING_GHC_INFO_FIELD([CC_STAGE0],[C compiler command])
120 dnl ToDo, once "ld command" is reliably available.
121 dnl Then, we can remove the LD_STAGE0 hack in mk/build-package-date.mk
122 dnl BOOTSTRAPPING_GHC_INFO_FIELD([LD_STAGE0],[ld command])
123 if test "x$OS_STAGE0" != "xOSDarwin"; then
124 BOOTSTRAPPING_GHC_INFO_FIELD([AR_STAGE0],[ar command])
125 BOOTSTRAPPING_GHC_INFO_FIELD([AR_OPTS_STAGE0],[ar flags])
126 BOOTSTRAPPING_GHC_INFO_FIELD([ArSupportsAtFile_STAGE0],[ar supports at file])
129 AR_OPTS_STAGE0='$(AR_OPTS)'
130 ArSupportsAtFile_STAGE0='$(ArSupportsAtFile)'
134 dnl ** Must have GHC to build GHC
135 if test "$WithGhc" = ""
137 AC_MSG_ERROR([GHC is required.])
139 FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.4],
140 [AC_MSG_ERROR([GHC version 7.4 or later is required to compile GHC.])])dnl
142 if test `expr $GhcMinVersion % 2` = "1"
144 if test "$EnableBootstrapWithDevelSnaphost" = "NO"
147 $WithGhc is a development snapshot of GHC, version $GhcVersion.
148 Bootstrapping using this version of GHC is not supported, and may not
149 work. Use --enable-bootstrap-with-devel-snapshot to try it anyway,
150 or --with-ghc to specify a different GHC to use.])
154 FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.5],
155 GHC_PACKAGE_DB_FLAG=package-conf,
156 GHC_PACKAGE_DB_FLAG=package-db)
157 AC_SUBST(GHC_PACKAGE_DB_FLAG)
159 # GHC is passed to Cabal, so we need a native path
160 if test "${WithGhc}" != ""
162 ghc_host_os=`"${WithGhc}" +RTS --info | grep 'Host OS' | sed -e 's/.*, "//' -e 's/")//'`
164 if test "$ghc_host_os" = "mingw32"
166 if test "${OSTYPE}" = "msys"
168 WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"`
170 # Canonicalise to <drive>:/path/to/ghc
171 WithGhc=`cygpath -m "${WithGhc}"`
173 echo "GHC path canonicalised to: ${WithGhc}"
178 dnl ** Without optimization some INLINE trickery fails for GHCi
181 dnl--------------------------------------------------------------------
182 dnl * Choose host(/target/build) platform
183 dnl--------------------------------------------------------------------
184 dnl If we aren't explicitly told what values to use with configure flags,
185 dnl we ask the bootstrapping compiler what platform it is for
187 if test "${WithGhc}" != ""
189 bootstrap_host=`"${WithGhc}" +RTS --info | grep '^ ,("Host platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
190 bootstrap_target=`"${WithGhc}" +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
191 if test "$bootstrap_host" != "$bootstrap_target"
193 echo "Bootstrapping GHC is a cross compiler. This probably isn't going to work"
197 # We have to run these unconditionally, but we may discard their
198 # results in the following code
203 FPTOOLS_SET_PLATFORM_VARS
205 # Verify that the installed (bootstrap) GHC is capable of generating
206 # code for the requested build platform.
207 if test "$BuildPlatform" != "$bootstrap_target"
209 echo "This GHC (${WithGhc}) does not generate code for the build platform"
210 echo " GHC target platform : $bootstrap_target"
211 echo " Desired build platform : $BuildPlatform"
215 # Testing if we shall enable shared libs support on Solaris.
216 # Anything older than SunOS 5.11 aka Solaris 11 (Express) is broken.
218 SOLARIS_BROKEN_SHLD=NO
222 # here we go with the test
223 MINOR=`uname -r|cut -d '.' -f 2-`
224 if test "$MINOR" -lt "11"; then
225 SOLARIS_BROKEN_SHLD=YES
230 AC_SUBST(SOLARIS_BROKEN_SHLD)
232 dnl ** Do an unregisterised build?
233 dnl --------------------------------------------------------------
235 i386|x86_64|powerpc|arm)
236 UnregisterisedDefault=NO
239 UnregisterisedDefault=YES
242 AC_ARG_ENABLE(unregisterised,
243 [AC_HELP_STRING([--enable-unregisterised],
244 [Build an unregisterised compiler (enabled by default on platforms without registerised support) [default="$UnregisterisedDefault"]])],
245 [ if test x"$enableval" = x"yes"; then
251 [Unregisterised="$UnregisterisedDefault"]
253 AC_SUBST(Unregisterised)
256 [AC_HELP_STRING([--with-hc=ARG],
257 [Use ARG as the path to the compiler for compiling ordinary
258 Haskell code (default= value of --with-ghc)])],
264 # This uses GHC, so put it after the "GHC is required" check above:
268 if test "$HostOS" = "mingw32"
270 test -d inplace || mkdir inplace
272 if test "$HostArch" = "i386"
274 # NB. If you update the tarballs to a new version of gcc, don't
275 # forget to tweak the paths in driver/gcc/gcc.c.
276 if ! test -d inplace/mingw ||
277 test inplace/mingw -ot ghc-tarballs/mingw/binutils*.tar.lzma ||
278 test inplace/mingw -ot ghc-tarballs/mingw/gcc-core*.tar.lzma ||
279 test inplace/mingw -ot ghc-tarballs/mingw/gcc-c++*.tar.lzma ||
280 test inplace/mingw -ot ghc-tarballs/mingw/libgcc*.tar.gz ||
281 test inplace/mingw -ot ghc-tarballs/mingw/libgmp*.tar.gz ||
282 test inplace/mingw -ot ghc-tarballs/mingw/libmpc*.tar.gz ||
283 test inplace/mingw -ot ghc-tarballs/mingw/libmpfr*.tar.gz ||
284 test inplace/mingw -ot ghc-tarballs/mingw/libstdc*.tar.lzma ||
285 test inplace/mingw -ot ghc-tarballs/mingw/mingwrt*-dev.tar.gz ||
286 test inplace/mingw -ot ghc-tarballs/mingw/mingwrt*-dll.tar.gz ||
287 test inplace/mingw -ot ghc-tarballs/mingw/w32api*.tar.lzma
289 AC_MSG_NOTICE([Making in-tree mingw tree])
294 tar --lzma -xf ../../ghc-tarballs/mingw/binutils*.tar.lzma &&
295 tar --lzma -xf ../../ghc-tarballs/mingw/gcc-core*.tar.lzma &&
296 tar --lzma -xf ../../ghc-tarballs/mingw/gcc-c++*.tar.lzma &&
297 tar --lzma -xf ../../ghc-tarballs/mingw/libgcc*.tar.lzma &&
298 tar --lzma -xf ../../ghc-tarballs/mingw/libgmp*.tar.lzma &&
299 tar --lzma -xf ../../ghc-tarballs/mingw/libmpc*.tar.lzma &&
300 tar --lzma -xf ../../ghc-tarballs/mingw/libmpfr*.tar.lzma &&
301 tar --lzma -xf ../../ghc-tarballs/mingw/libstdc*.tar.lzma &&
302 tar -z -xf ../../ghc-tarballs/mingw/mingwrt*-dev.tar.gz &&
303 tar -z -xf ../../ghc-tarballs/mingw/mingwrt*-dll.tar.gz &&
304 tar --lzma -xf ../../ghc-tarballs/mingw/w32api*.tar.lzma &&
305 mv bin/gcc.exe bin/realgcc.exe
307 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
308 AC_MSG_NOTICE([In-tree mingw tree created])
311 # NB. If you update the tarballs to a new version of gcc, don't
312 # forget to tweak the paths in driver/gcc/gcc.c.
313 if ! test -d inplace/mingw ||
314 test inplace/mingw -ot ghc-tarballs/mingw64/*.tar.bz2
316 AC_MSG_NOTICE([Making in-tree mingw tree])
321 tar -jxf ../../ghc-tarballs/mingw64/*.tar.bz2
323 AC_MSG_NOTICE([In-tree mingw tree created])
327 mingwbin="$hardtop/inplace/mingw/bin/"
328 CC="${mingwbin}gcc.exe"
329 LD="${mingwbin}ld.exe"
330 NM="${mingwbin}nm.exe"
331 OBJDUMP="${mingwbin}objdump.exe"
332 fp_prog_ar="${mingwbin}ar.exe"
334 if ! test -d inplace/perl ||
335 test inplace/perl -ot ghc-tarballs/perl/ghc-perl*.tar.gz
337 AC_MSG_NOTICE([Making in-tree perl tree])
342 tar -zxf ../../ghc-tarballs/perl/ghc-perl*.tar.gz
344 AC_MSG_NOTICE([In-tree perl tree created])
350 AC_ARG_WITH([system-libffi],
351 [AC_HELP_STRING([--with-system-libffi],
352 [Use system provided libffi for RTS [default=no]])
355 AS_IF([test "x$with_system_libffi" = "xyes"],
356 [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"]
360 AC_SUBST(UseSystemLibFFI)
362 AC_ARG_WITH([ffi-includes],
363 [AC_HELP_STRING([--with-ffi-includes=ARG]
364 [Find includes for libffi in ARG [default=system default]])
367 if test "x$UseSystemLibFFI" != "xYES"; then
368 AC_MSG_WARN([--with-ffi-includes will be ignored, --with-system-libffi not set])
370 FFIIncludeDir="$withval"
371 LIBFFI_CFLAGS="-I $withval"
375 AC_SUBST(FFIIncludeDir)
377 AC_ARG_WITH([ffi-libraries],
378 [AC_HELP_STRING([--with-ffi-libraries=ARG]
379 [Find libffi in ARG [default=system default]])
382 if test "x$UseSystemLibFFI" != "xYES"; then
383 AC_MSG_WARN([--with-ffi-libraries will be ignored, --with-system-libffi not set])
385 FFILibDir="$withval" LIBFFI_LDFLAGS="-L$withval"
391 AS_IF([test "$UseSystemLibFFI" = "YES"], [
393 CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
395 LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS"
396 AC_CHECK_LIB(ffi, ffi_call,
397 [AC_CHECK_HEADERS([ffi.h], [break], [])
398 AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])],
399 [AC_MSG_ERROR([Cannot find system libffi])])
410 if test "$TargetOS_CPP" = "darwin"
412 # Split objects is broken (#4013) with XCode < 3.2
413 if test "$XCodeVersion1" -lt 3
417 if test "$XCodeVersion1" -eq 3
419 if test "$XCodeVersion2" -lt 2
426 AC_SUBST([SplitObjsBroken])
428 dnl ** Building a cross compiler?
429 dnl --------------------------------------------------------------
431 # If 'host' and 'target' differ, then this means we are building a cross-compiler.
432 if test "$target" != "$host" ; then
434 cross_compiling=yes # This tells configure that it can accept just 'target',
436 # configure: error: cannot run C compiled programs.
437 # If you meant to cross compile, use `--host'.
439 if test "$build" != "$host" ; then
443 BUILD: $build (the architecture we're building on)
444 HOST: $host (the architecture the compiler we're building will execute on)
445 TARGET: $target (the architecture the compiler we're building will produce code for)
447 BUILD must equal HOST; that is, we do not support building GHC itself
448 with a cross-compiler. To cross-compile GHC itself, set TARGET: stage
449 1 will be a cross-compiler, and stage 2 will be the cross-compiled
453 if test "$CrossCompiling" = "YES"
455 CrossCompilePrefix="${target}-"
457 CrossCompilePrefix=""
459 TargetPlatformFull="${target}"
460 AC_SUBST(CrossCompiling)
461 AC_SUBST(CrossCompilePrefix)
462 AC_SUBST(TargetPlatformFull)
464 dnl ** Which gcc to use?
465 dnl --------------------------------------------------------------
466 FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
467 CC="$WhatGccIsCalled"
470 dnl ** Which ld to use?
471 dnl --------------------------------------------------------------
472 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
476 dnl ** Which nm to use?
477 dnl --------------------------------------------------------------
478 FP_ARG_WITH_PATH_GNU_PROG([NM], [nm], [nm])
482 # Note: we may not have objdump on OS X, and we only need it on Windows (for DLL checks)
485 dnl ** Which objdump to use?
486 dnl --------------------------------------------------------------
487 FP_ARG_WITH_PATH_GNU_PROG([OBJDUMP], [objdump], [objdump])
488 ObjdumpCmd="$OBJDUMP"
489 AC_SUBST([ObjdumpCmd])
493 dnl ** Which LLVM llc to use?
494 dnl --------------------------------------------------------------
495 FIND_LLVM_PROG([LLC], [llc], [llc])
499 dnl ** Which LLVM opt to use?
500 dnl --------------------------------------------------------------
501 FIND_LLVM_PROG([OPT], [opt], [opt])
505 dnl --------------------------------------------------------------
506 dnl End of configure script option section
507 dnl --------------------------------------------------------------
510 dnl --------------------------------------------------------------
511 dnl * General configuration checks
512 dnl --------------------------------------------------------------
514 dnl ** Can the unix package be built?
515 dnl --------------------------------------------------------------
517 if test "$TargetOS" = "mingw32"
523 AC_SUBST([GhcLibsWithUnix])
528 dnl ** look for `perl'
531 PerlCmd=$hardtop/inplace/perl/perl
534 AC_PATH_PROG(PerlCmd,perl)
535 if test -z "$PerlCmd"
537 echo "You must install perl before you can continue"
538 echo "Perhaps it is already installed, but not in your PATH?"
541 FPTOOLS_CHECK_PERL_VERSION
546 dnl ** look for GCC and find out which version
547 dnl Figure out which C compiler to use. Gcc is preferred.
548 dnl If gcc, make sure it's at least 3.0
552 dnl ** look to see if we have a C compiler using an llvm back end.
558 FP_PROG_LD_NO_COMPACT_UNWIND
562 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
563 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
564 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
565 # Stage 3 won't be supported by cross-compilation
566 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
570 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
573 AC_SUBST(CONF_CC_OPTS_STAGE0)
574 AC_SUBST(CONF_CC_OPTS_STAGE1)
575 AC_SUBST(CONF_CC_OPTS_STAGE2)
576 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
577 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
578 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
579 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
580 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
581 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
582 AC_SUBST(CONF_CPP_OPTS_STAGE0)
583 AC_SUBST(CONF_CPP_OPTS_STAGE1)
584 AC_SUBST(CONF_CPP_OPTS_STAGE2)
586 dnl ** Set up the variables for the platform in the settings file.
587 dnl May need to use gcc to find platform details.
588 dnl --------------------------------------------------------------
589 FPTOOLS_SET_HASKELL_PLATFORM_VARS
591 dnl ** figure out how to do context diffs
594 dnl Let's make sure install-sh is executable here. If we got it from
595 dnl a darcs repo, it might not be (see bug #978).
597 dnl ** figure out how to do a BSD-ish install
600 dnl If you can run configure, you certainly have /bin/sh
601 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
603 dnl ** how to invoke `ar' and `ranlib'
604 FP_PROG_AR_SUPPORTS_ATFILE
605 FP_PROG_AR_NEEDS_RANLIB
607 dnl ** Check to see whether ln -s works
612 dnl ** Find the path to sed
613 AC_PATH_PROGS(SedCmd,gsed sed,sed)
616 dnl ** check for time command
617 AC_PATH_PROG(TimeCmd,time)
620 dnl if GNU tar is named gtar, look for it first.
621 AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar)
623 dnl ** check for patch
624 dnl if GNU patch is named gpatch, look for it first
625 AC_PATH_PROGS(PatchCmd,gpatch patch, patch)
627 dnl ** check for dtrace (currently only implemented for Mac OS X)
629 AC_PATH_PROG(DtraceCmd,dtrace)
630 if test -n "$DtraceCmd"; then
631 if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then
637 AC_PATH_PROG(HSCOLOUR,HsColour)
638 # HsColour is passed to Cabal, so we need a native path
639 if test "$HostOS" = "mingw32" && \
640 test "${OSTYPE}" != "msys" && \
641 test "${HSCOLOUR}" != ""
643 # Canonicalise to <drive>:/path/to/gcc
644 HSCOLOUR=`cygpath -m ${HSCOLOUR}`
647 dnl ** check for DocBook toolchain
652 dnl ** check for ghc-pkg command
655 dnl ** check for installed happy binary + version
658 dnl ** check for installed alex binary + version
661 dnl --------------------------------------------------
662 dnl ### program checking section ends here ###
663 dnl --------------------------------------------------
665 dnl --------------------------------------------------
666 dnl * Platform header file and syscall feature tests
667 dnl ### checking the state of the local header files and syscalls ###
669 dnl ** check for full ANSI header (.h) files
672 dnl ** Enable large file support. NB. do this before testing the type of
673 dnl off_t, because it will affect the result of that test.
676 dnl ** check for specific header (.h) files that we are interested in
677 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/param.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])
679 dnl sys/cpuset.h needs sys/param.h to be included first on FreeBSD 9.1; #7708
680 AC_CHECK_HEADERS([sys/cpuset.h], [], [],
681 [[#if HAVE_SYS_PARAM_H
682 # include <sys/param.h>
686 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
689 dnl ** do we have long longs?
690 AC_CHECK_TYPES([long long])
692 dnl ** what are the sizes of various types
693 AC_CHECK_SIZEOF(char, 1)
694 AC_CHECK_SIZEOF(double, 8)
695 AC_CHECK_SIZEOF(float, 4)
696 AC_CHECK_SIZEOF(int, 4)
697 AC_CHECK_SIZEOF(long, 4)
698 if test "$ac_cv_type_long_long" = yes; then
699 AC_CHECK_SIZEOF(long long, 8)
701 AC_CHECK_SIZEOF(short, 2)
702 AC_CHECK_SIZEOF(unsigned char, 1)
703 AC_CHECK_SIZEOF(unsigned int, 4)
704 AC_CHECK_SIZEOF(unsigned long, 4)
705 if test "$ac_cv_type_long_long" = yes; then
706 AC_CHECK_SIZEOF(unsigned long long, 8)
708 AC_CHECK_SIZEOF(unsigned short, 2)
709 AC_CHECK_SIZEOF(void *, 4)
711 dnl for use in settings.in
712 WordSize=$ac_cv_sizeof_void_p
715 dnl ** what are alignment constraints on various types
716 FP_CHECK_ALIGNMENT(char)
717 FP_CHECK_ALIGNMENT(double)
718 FP_CHECK_ALIGNMENT(float)
719 FP_CHECK_ALIGNMENT(int)
720 FP_CHECK_ALIGNMENT(long)
721 if test "$ac_cv_type_long_long" = yes; then
722 FP_CHECK_ALIGNMENT(long long)
724 FP_CHECK_ALIGNMENT(short)
725 FP_CHECK_ALIGNMENT(unsigned char)
726 FP_CHECK_ALIGNMENT(unsigned int)
727 FP_CHECK_ALIGNMENT(unsigned long)
728 if test "$ac_cv_type_long_long" = yes; then
729 FP_CHECK_ALIGNMENT(unsigned long long)
731 FP_CHECK_ALIGNMENT(unsigned short)
732 FP_CHECK_ALIGNMENT(void *)
734 FP_CHECK_FUNC([WinExec],
735 [@%:@include <windows.h>], [WinExec("",0)])
737 FP_CHECK_FUNC([GetModuleFileName],
738 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
740 dnl ** check return type of signal handlers
741 dnl Foo: assumes we can use prototypes.
742 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
743 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
744 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
745 dnl #include <signal.h>
749 dnl void (*signal (int, void (*)(int)))(int);
752 dnl [ac_cv_type_signal_handler=void_int],
753 dnl [ac_cv_type_signal_handler=int_void])])
754 dnl if test "$ac_cv_type_signal_handler" = void_int; then
755 dnl AC_DEFINE(VOID_INT_SIGNALS)
758 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
760 if test "$ac_cv_type_signal" = void; then
761 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).])
764 dnl ** check for more functions
765 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
766 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity setlocale])
768 dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
769 dnl ** _POSIX_C_SOURCE is defined
770 AC_CHECK_DECLS([ctime_r], , ,
771 [#define _POSIX_SOURCE 1
772 #define _POSIX_C_SOURCE 199506L
775 dnl ** check for mingwex library
776 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
777 AC_SUBST(HaveLibMingwEx)
779 if test $HaveLibMingwEx = YES ; then
780 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
783 dnl ** check for math library
784 dnl Keep that check as early as possible.
785 dnl as we need to know whether we need libm
786 dnl for math functions or not
787 dnl (see http://hackage.haskell.org/trac/ghc/ticket/3730)
788 AC_CHECK_LIB(m, atan, HaveLibM=YES, HaveLibM=NO)
789 if test $HaveLibM = YES
791 AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm])
794 dnl ** check whether this machine has BFD and libiberty installed (used for debugging)
795 dnl the order of these tests matters: bfd needs libiberty
796 AC_CHECK_LIB(iberty, xmalloc)
797 AC_CHECK_LIB(bfd, bfd_uncompress_section_contents)
799 dnl ################################################################
800 dnl Check for libraries
801 dnl ################################################################
803 dnl ** check whether we need -ldl to get dlopen()
805 AC_CHECK_LIB(dl, dlopen,
807 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
812 dnl --------------------------------------------------
813 dnl * Miscellaneous feature tests
814 dnl --------------------------------------------------
816 dnl ** can we get alloca?
819 dnl ** working vfork?
822 dnl ** determine whether or not const works
825 dnl ** are we big endian?
827 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
829 dnl ** check for leading underscores in symbol names
830 FP_LEADING_UNDERSCORE
834 dnl ** check for librt
835 AC_CHECK_LIB(rt, clock_gettime)
836 AC_CHECK_FUNCS(clock_gettime timer_settime)
837 FP_CHECK_TIMER_CREATE
839 dnl ** check for Apple's "interesting" long double compatibility scheme
840 AC_MSG_CHECKING(for printf\$LDBLStub)
841 AC_TRY_LINK_FUNC(printf\$LDBLStub,
844 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
845 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
849 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
850 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
853 dnl ** check for eventfd which is needed by the I/O manager
854 AC_CHECK_HEADERS([sys/eventfd.h])
855 AC_CHECK_FUNCS([eventfd])
858 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
859 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
860 AC_SUBST(HavePapiLib)
861 AC_SUBST(HavePapiHeader)
863 AC_CHECK_FUNCS(__mingw_vfprintf)
865 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
872 if test "$HAVE_DOCBOOK_XSL" = "NO" ||
873 test "$XsltprocCmd" = ""
875 BUILD_DOCBOOK_HTML=NO
877 BUILD_DOCBOOK_HTML=YES
879 AC_SUBST(BUILD_DOCBOOK_HTML)
881 if test "$DblatexCmd" = ""
887 BUILD_DOCBOOK_PDF=YES
889 AC_SUBST(BUILD_DOCBOOK_PS)
890 AC_SUBST(BUILD_DOCBOOK_PDF)
892 LIBRARY_VERSION(base)
893 LIBRARY_VERSION(Cabal, Cabal/Cabal)
894 LIBRARY_VERSION(ghc-prim)
895 LIBRARY_ghc_VERSION="$ProjectVersion"
896 AC_SUBST(LIBRARY_ghc_VERSION)
898 if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
899 AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
902 AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal settings docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/configure.ac])
906 # http://savannah.gnu.org/bugs/index.php?1516
907 # $(eval ...) inside conditionals causes errors
908 # with make 3.80, so warn the user if it looks like they're about to
910 # We would use "grep -q" here, but Solaris's grep doesn't support it.
912 if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
915 echo "WARNING: It looks like \"$1\" is GNU make 3.80."
916 echo "This version cannot be used to build GHC."
917 echo "Please use GNU make >= 3.81."
925 ----------------------------------------------------------------------
926 Configure completed successfully.
928 Building GHC version : $ProjectVersion
930 Build platform : $BuildPlatform
931 Host platform : $HostPlatform
932 Target platform : $TargetPlatform
936 Bootstrapping using : $WithGhc
937 which is version : $GhcVersion
940 if test "x$CC_LLVM_BACKEND" = "x1"; then
941 if test "x$CC_CLANG_BACKEND" = "x1"; then
942 CompilerName="clang "
944 CompilerName="llvm-gcc "
951 Using $CompilerName : $WhatGccIsCalled
952 which is version : $GccVersion
953 Building a cross compiler : $CrossCompiling
956 Happy : $HappyCmd ($HappyVersion)
957 Alex : $AlexCmd ($AlexVersion)
959 dblatex : $DblatexCmd
960 xsltproc : $XsltprocCmd
966 if test "$HSCOLOUR" = ""; then
968 HsColour was not found; documentation will not contain source links
977 Building DocBook HTML documentation : $BUILD_DOCBOOK_HTML
978 Building DocBook PS documentation : $BUILD_DOCBOOK_PS
979 Building DocBook PDF documentation : $BUILD_DOCBOOK_PDF"]
981 echo ["----------------------------------------------------------------------
985 For a standard build of GHC (fully optimised with profiling), type (g)make.
987 To make changes to the default build configuration, copy the file
988 mk/build.mk.sample to mk/build.mk, and edit the settings in there.
990 For more information on how to configure your GHC build, see
991 http://hackage.haskell.org/trac/ghc/wiki/Building