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 # This uses GHC, so put it after the "GHC is required" check above:
386 if test "$HostOS" = "mingw32"
388 CC="$hardtop/inplace/mingw/bin/gcc.exe"
389 LD="$hardtop/inplace/mingw/bin/ld.exe"
390 NM="$hardtop/inplace/mingw/bin/nm.exe"
391 if ! test -d inplace/mingw ||
392 test inplace/mingw -ot ghc-tarballs/mingw/binutils*.tar.gz ||
393 test inplace/mingw -ot ghc-tarballs/mingw/gcc-core*.tar.gz ||
394 test inplace/mingw -ot ghc-tarballs/mingw/libcrypt*.tar.bz2 ||
395 test inplace/mingw -ot ghc-tarballs/mingw/mingw-runtime*.tar.gz ||
396 test inplace/mingw -ot ghc-tarballs/mingw/perl*.tar.bz2 ||
397 test inplace/mingw -ot ghc-tarballs/mingw/w32api*.tar.gz
399 AC_MSG_NOTICE([Making in-tree mingw tree])
404 tar -zxf ../../ghc-tarballs/mingw/binutils*.tar.gz
405 tar -zxf ../../ghc-tarballs/mingw/gcc-core*.tar.gz
406 tar -jxf ../../ghc-tarballs/mingw/libcrypt*.tar.bz2
407 tar -zxf ../../ghc-tarballs/mingw/mingw-runtime*.tar.gz
408 tar -jxf ../../ghc-tarballs/mingw/perl*.tar.bz2
409 tar -zxf ../../ghc-tarballs/mingw/w32api*.tar.gz
410 mv bin/gcc.exe bin/realgcc.exe
412 inplace/mingw/bin/realgcc.exe driver/gcc/gcc.c driver/utils/getLocation.c -Idriver/utils -o inplace/mingw/bin/gcc.exe
413 AC_MSG_NOTICE([In-tree mingw tree created])
417 dnl ** Which gcc to use?
418 dnl --------------------------------------------------------------
419 FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
421 WhatGccIsCalled="$CC"
422 AC_SUBST(WhatGccIsCalled)
424 dnl ** Which ld to use?
425 dnl --------------------------------------------------------------
426 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld])
430 dnl ** Which nm to use?
431 dnl --------------------------------------------------------------
432 FP_ARG_WITH_PATH_GNU_PROG([NM], [nm])
436 dnl ** Mac OS X: explicit deployment target
437 dnl --------------------------------------------------------------
438 AC_ARG_WITH([macosx-deployment-target],
439 [AC_HELP_STRING([--with-macosx-deployment-target=VERSION],
440 [Build for Mac OS VERSION and higher (default= version of build host)])],
441 [FP_MACOSX_DEPLOYMENT_TARGET="$withval"
442 if test "x$TargetOS_CPP-$TargetVendor_CPP" != "xdarwin-apple"; then
443 # ignore everywhere, but on Mac OS
444 AC_MSG_WARN([--macosx-deployment-target is only available on Mac OS X])
445 FP_MACOSX_DEPLOYMENT_TARGET=none
447 [FP_MACOSX_DEPLOYMENT_TARGET=none]
449 FP_CHECK_MACOSX_DEPLOYMENT_TARGET
450 AC_SUBST(MACOSX_DEPLOYMENT_VERSION)
451 AC_SUBST(MACOSX_DEPLOYMENT_SDK)
453 dnl --------------------------------------------------------------
454 dnl End of configure script option section
455 dnl --------------------------------------------------------------
458 dnl --------------------------------------------------------------
459 dnl * General configuration checks
460 dnl --------------------------------------------------------------
462 dnl ** Can the unix package be built?
463 dnl --------------------------------------------------------------
465 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
470 AC_SUBST([GhcLibsWithUnix])
475 dnl ** look for `perl', but only in /bin on Windows
478 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
479 if test -z "$PerlCmd"; then
480 echo "You must install the version of Perl shipped with GHC"
481 echo "(or a compatible one) in /bin."
486 AC_PATH_PROG(PerlCmd,perl)
487 if test -z "$PerlCmd"; then
488 echo "You must install perl before you can continue"
489 echo "Perhaps it is already installed, but not in your PATH?"
492 FPTOOLS_CHECK_PERL_VERSION
497 dnl ** does #! path/to/perl work? (sometimes it's too long...)
500 dnl ** check for Python
501 AC_PATH_PROG(PythonCmd,python)
503 dnl ** look for GCC and find out which version
504 dnl Figure out which C compiler to use. Gcc is preferred.
505 dnl If gcc, make sure it's at least 2.1
510 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
513 AC_SUBST(CONF_CC_OPTS)
514 AC_SUBST(CONF_LD_OPTS)
516 dnl ** figure out how to do context diffs
519 dnl Let's make sure install-sh is executable here. If we got it from
520 dnl a darcs repo, it might not be (see bug #978).
522 dnl ** figure out how to do a BSD-ish install
525 dnl If you can run configure, you certainly have /bin/sh
526 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
528 dnl ** how to invoke `ar' and `ranlib'
529 FP_PROG_AR_NEEDS_RANLIB
530 FP_PROG_AR_SUPPORTS_INPUT
532 dnl ** Check to see whether ln -s works
536 dnl ** Find the path to sed
537 AC_PATH_PROG(SedCmd,sed)
540 dnl ** check for time command
541 AC_PATH_PROG(TimeCmd,time)
544 dnl if GNU tar is named gtar, look for it first.
545 AC_PATH_PROGS(TarCmd,gtar tar,tar)
547 dnl ** check for patch
548 dnl if GNU patch is named gpatch, look for it first
549 AC_PATH_PROGS(PatchCmd,gpatch patch, patch)
551 AC_PATH_PROG(HSCOLOUR,HsColour)
552 # HsColour is passed to Cabal, so we need a native path
553 if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
554 test "${OSTYPE}" != "msys" && \
555 test "${HSCOLOUR}" != ""
557 # Canonicalise to <drive>:/path/to/gcc
558 HSCOLOUR=`cygpath -m ${HSCOLOUR}`
561 dnl ** check for DocBook toolchain
568 dnl ** check for ghc-pkg command
571 dnl ** check for installed happy binary + version
572 dnl (don't do it if we're booting from .hc files though.)
573 if test "$BootingFromHc" = "NO"; then
577 dnl ** check for installed alex binary + version
578 dnl (don't do it if we're booting from .hc files though.)
579 if test "$BootingFromHc" = "NO"; then
583 dnl --------------------------------------------------
584 dnl ### program checking section ends here ###
585 dnl --------------------------------------------------
587 dnl --------------------------------------------------
588 dnl * Platform header file and syscall feature tests
589 dnl ### checking the state of the local header files and syscalls ###
591 dnl ** check for full ANSI header (.h) files
594 dnl ** Enable large file support. NB. do this before testing the type of
595 dnl off_t, because it will affect the result of that test.
598 dnl ** check for specific header (.h) files that we are interested in
599 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])
601 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
604 dnl ** do we have long longs?
605 AC_CHECK_TYPES([long long])
607 dnl ** what are the sizes of various types
608 AC_CHECK_SIZEOF(char, 1)
609 AC_CHECK_SIZEOF(double, 8)
610 AC_CHECK_SIZEOF(float, 4)
611 AC_CHECK_SIZEOF(int, 4)
612 AC_CHECK_SIZEOF(long, 4)
613 if test "$ac_cv_type_long_long" = yes; then
614 AC_CHECK_SIZEOF(long long, 8)
616 AC_CHECK_SIZEOF(short, 2)
617 AC_CHECK_SIZEOF(unsigned char, 1)
618 AC_CHECK_SIZEOF(unsigned int, 4)
619 AC_CHECK_SIZEOF(unsigned long, 4)
620 if test "$ac_cv_type_long_long" = yes; then
621 AC_CHECK_SIZEOF(unsigned long long, 8)
623 AC_CHECK_SIZEOF(unsigned short, 2)
624 AC_CHECK_SIZEOF(void *, 4)
626 dnl ** what are alignment constraints on various types
627 FP_CHECK_ALIGNMENT(char)
628 FP_CHECK_ALIGNMENT(double)
629 FP_CHECK_ALIGNMENT(float)
630 FP_CHECK_ALIGNMENT(int)
631 FP_CHECK_ALIGNMENT(long)
632 if test "$ac_cv_type_long_long" = yes; then
633 FP_CHECK_ALIGNMENT(long long)
635 FP_CHECK_ALIGNMENT(short)
636 FP_CHECK_ALIGNMENT(unsigned char)
637 FP_CHECK_ALIGNMENT(unsigned int)
638 FP_CHECK_ALIGNMENT(unsigned long)
639 if test "$ac_cv_type_long_long" = yes; then
640 FP_CHECK_ALIGNMENT(unsigned long long)
642 FP_CHECK_ALIGNMENT(unsigned short)
643 FP_CHECK_ALIGNMENT(void *)
645 FP_CHECK_FUNC([WinExec],
646 [@%:@include <windows.h>], [WinExec("",0)])
648 FP_CHECK_FUNC([GetModuleFileName],
649 [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
651 dnl ** check return type of signal handlers
652 dnl Foo: assumes we can use prototypes.
653 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
654 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
655 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
656 dnl #include <signal.h>
660 dnl void (*signal (int, void (*)(int)))(int);
663 dnl [ac_cv_type_signal_handler=void_int],
664 dnl [ac_cv_type_signal_handler=int_void])])
665 dnl if test "$ac_cv_type_signal_handler" = void_int; then
666 dnl AC_DEFINE(VOID_INT_SIGNALS)
669 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
671 if test "$ac_cv_type_signal" = void; then
672 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).])
675 dnl ** check for more functions
676 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
677 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity setlocale])
680 #include <sys/types.h>
681 #include <sys/time.h>
683 struct itimerval tval;
684 tval.it_value.tv_sec = 1;
685 tval.it_value.tv_usec = 0;
686 tval.it_interval = tval.it_value;
687 return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0;
689 ],[AC_DEFINE([HAVE_SETITIMER_VIRTUAL], [1], [Define to 1 if setitimer accepts ITIMER_VIRTUAL, 0 else.])])
691 dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
692 dnl ** _POSIX_C_SOURCE is defined
693 AC_CHECK_DECLS([ctime_r], , ,
694 [#define _POSIX_SOURCE 1
695 #define _POSIX_C_SOURCE 199506L
698 dnl ** check for mingwex library
699 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
700 AC_SUBST(HaveLibMingwEx)
702 if test $HaveLibMingwEx = YES ; then
703 AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
706 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
707 dnl the order of these tests matters: bfd needs liberty
708 AC_CHECK_LIB(iberty, xmalloc)
709 AC_CHECK_LIB(bfd, bfd_init)
711 dnl ** check for math library
712 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
713 if test x"$fp_libm_not_needed" = xdunno; then
714 AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
718 dnl ################################################################
719 dnl Check for libraries
720 dnl ################################################################
722 dnl ** check whether we need -ldl to get dlopen()
724 AC_CHECK_LIB(dl, dlopen,
726 AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
731 dnl --------------------------------------------------
732 dnl * Miscellaneous feature tests
733 dnl --------------------------------------------------
735 dnl ** can we get alloca?
738 dnl ** Working vfork?
741 dnl ** determine whether or not const works
744 dnl ** are we big endian?
746 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
748 dnl ** check for leading underscores in symbol names
749 FP_LEADING_UNDERSCORE
751 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
755 dnl ** check for Apple-style dead-stripping support
756 dnl (.subsections-via-symbols assembler directive)
759 AC_MSG_CHECKING(for .subsections_via_symbols)
761 [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
763 AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
764 [Define to 1 if Apple-style dead-stripping is supported.])
768 dnl *** check for GNU non-executable stack note support (ELF only)
769 dnl (.section .note.GNU-stack,"",@progbits)
771 AC_MSG_CHECKING(for GNU non-executable stack support)
773 [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
775 AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
776 [Define to 1 if GNU non-executable stack notes are supported.])
780 dnl ** check for librt
781 AC_CHECK_LIB(rt, clock_gettime)
782 AC_CHECK_FUNCS(clock_gettime timer_create timer_settime)
783 FP_CHECK_TIMER_CREATE
785 dnl ** check for Apple's "interesting" long double compatibility scheme
786 AC_MSG_CHECKING(for printf\$LDBLStub)
787 AC_TRY_LINK_FUNC(printf\$LDBLStub,
790 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
791 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
795 AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
796 [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
800 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
801 if test -n "$GTK_CONFIG"; then
802 if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
803 GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
805 AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
809 AC_SUBST([GTK_CONFIG])
812 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
813 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
814 AC_SUBST(HavePapiLib)
815 AC_SUBST(HavePapiHeader)
817 AC_CHECK_FUNCS(__mingw_vfprintf)
819 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
826 if test "$HAVE_DOCBOOK_XSL" = "NO" ||
827 test "$XsltprocCmd" = ""
829 BUILD_DOCBOOK_HTML=NO
831 BUILD_DOCBOOK_HTML=YES
833 AC_SUBST(BUILD_DOCBOOK_HTML)
835 if test "$DblatexCmd" = ""
841 BUILD_DOCBOOK_PDF=YES
843 AC_SUBST(BUILD_DOCBOOK_PS)
844 AC_SUBST(BUILD_DOCBOOK_PDF)
846 if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
847 AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
850 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])
851 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
855 # http://savannah.gnu.org/bugs/index.php?1516
856 # $(eval ...) inside conditionals causes errors
857 # with make 3.80, so warn the user if it looks like they're about to
859 # We would use "grep -q" here, but Solaris's grep doesn't support it.
861 if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
864 echo "WARNING: It looks like \"$1\" is GNU make 3.80."
865 echo "This version cannot be used to build GHC."
866 echo "Please use GNU make >= 3.81."
874 ----------------------------------------------------------------------
875 Configure completed successfully.
877 Building GHC version : $ProjectVersion
879 Build platform : $BuildPlatform
880 Host platform : $HostPlatform
881 Target platform : $TargetPlatform
884 if test "$BootingFromHc" = "YES"; then
886 Bootstrapping from HC files.
890 Bootstrapping using : $WithGhc
891 which is version : $GhcVersion
896 Using GCC : $WhatGccIsCalled
897 which is version : $GccVersion
900 Happy : $HappyCmd ($HappyVersion)
901 Alex : $AlexCmd ($AlexVersion)
904 dblatex : $DblatexCmd
905 xsltproc : $XsltprocCmd"]
907 if test "$HSCOLOUR" = ""; then
909 HsColour was not found; documentation will not contain source links
918 Building DocBook HTML documentation : $BUILD_DOCBOOK_HTML
919 Building DocBook PS documentation : $BUILD_DOCBOOK_PS
920 Building DocBook PDF documentation : $BUILD_DOCBOOK_PDF"]
922 echo ["----------------------------------------------------------------------
926 For a standard build of GHC (fully optimised with profiling), type (g)make.
928 To make changes to the default build configuration, copy the file
929 mk/build.mk.sample to mk/build.mk, and edit the settings in there.
931 For more information on how to configure your GHC build, see
932 http://hackage.haskell.org/trac/ghc/wiki/Building