+dnl ** check for ld, whether it has an -x option, and if it is GNU ld
+FP_PROG_LD_X
+FP_PROG_LD_IS_GNU
+
+dnl ** check for Apple-style dead-stripping support
+dnl (.subsections-via-symbols assembler directive)
+
+
+AC_MSG_CHECKING(for .subsections_via_symbols)
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
+ [Define to 1 if Apple-style dead-stripping is supported.])
+ ],
+ [AC_MSG_RESULT(no)])
+
+dnl *** check for GNU non-executable stack note support (ELF only)
+dnl (.section .note.GNU-stack,"",@progbits)
+
+AC_MSG_CHECKING(for GNU non-executable stack support)
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
+ [Define to 1 if GNU non-executable stack notes are supported.])
+ ],
+ [AC_MSG_RESULT(no)])
+
+dnl ** check for librt
+AC_CHECK_LIB(rt, clock_gettime)
+AC_CHECK_FUNCS(clock_gettime timer_create timer_settime)
+FP_CHECK_TIMER_CREATE
+
+dnl ** check for Apple's "interesting" long double compatibility scheme
+AC_MSG_CHECKING(for printf\$LDBLStub)
+AC_TRY_LINK_FUNC(printf\$LDBLStub,
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
+ [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
+ [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
+ ])
+
+# test for GTK+
+AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
+if test -n "$GTK_CONFIG"; then
+ if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
+ GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
+ else
+ AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
+ GTK_CONFIG=
+ fi
+fi
+AC_SUBST([GTK_CONFIG])
+
+#Checking for PAPI
+AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
+AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
+AC_SUBST(HavePapiLib)
+AC_SUBST(HavePapiHeader)
+
+if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
+ HavePapi=YES
+else
+ HavePapi=NO
+fi
+AC_SUBST(HavePapi)
+
+AC_CONFIG_FILES([mk/config.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml])
+AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
+AC_OUTPUT
+
+# We get caught by
+# http://savannah.gnu.org/bugs/index.php?1516
+# $(eval ...) inside conditionals causes errors
+# with make 3.80, so warn the user if it looks like they're about to
+# try to use it.
+# We would use "grep -q" here, but Solaris's grep doesn't support it.
+checkMake380() {
+ if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
+ then
+ echo
+ echo "WARNING: It looks like \"$1\" is GNU make 3.80."
+ echo "This version cannot be used to build GHC."
+ echo "Please use GNU make >= 3.81."
+ fi
+}
+
+checkMake380 make
+checkMake380 gmake
+
+echo ["
+----------------------------------------------------------------------
+Configure completed successfully.
+
+ Building GHC version : $ProjectVersion
+
+ Build platform : $BuildPlatform
+ Host platform : $HostPlatform
+ Target platform : $TargetPlatform
+"]
+
+if test "$BootingFromHc" = "YES"; then
+echo ["\
+ Bootstrapping from HC files.
+"]
+else
+echo ["\
+ Bootstrapping using : $WithGhc
+ which is version : $GhcVersion
+"]
+fi
+
+echo ["\
+ Using GCC : $WhatGccIsCalled
+ which is version : $GccVersion
+
+ ld : $LdCmd
+ Happy : $HappyCmd
+ Alex : $AlexCmd
+ Python : $PythonCmd
+ Perl : $PerlCmd"]
+
+if test "$HSCOLOUR" = ""; then
+echo ["
+ HsColour was not found; documentation will not contain source links
+"]
+else
+echo ["\
+ HsColour : $HSCOLOUR
+"]
+fi
+
+if test "$DIR_DOCBOOK_XSL" = ""; then
+echo ["\
+ Building DocBook documentation : no"]
+else
+echo ["\
+ Building DocBook documentation : yes"]
+fi
+
+
+echo ["\
+ Building shared libraries : $BuildSharedLibs"]
+
+echo ["----------------------------------------------------------------------
+"]