-dnl ** check for ld, and whether ld has -x option
-AC_PATH_PROG(LdCmdRaw, ld)
-case $HostOS_CPP in
- mingw32) LdCmd=`cygpath -w ${LdCmdRaw} | sed -e 's@\\\\@/@g' `
- ;;
- *) LdCmd=${LdCmdRaw}
- ;;
-esac
-AC_SUBST(LdCmd)
-FPTOOLS_LD_X
-
-FP_EMPTY_STRUCTS
-
-AC_MSG_CHECKING([for SIGPOLL])
-AC_EGREP_CPP(we_have_sigpoll,
-[#include <signal.h>
-#ifdef SIGPOLL
-we_have_sigpoll
-#endif
-], AC_DEFINE([HAVE_SIGPOLL], [1], [Define to 1 if you have the sigpoll() function.]) haveSIGPOLL=yes, haveSIGPOLL=no)
-AC_MSG_RESULT([$haveSIGPOLL])
-
-AC_MSG_CHECKING([for _SC_GETGR_R_SIZE_MAX])
-AC_EGREP_CPP(we_have_that_sysconf_thing,
-[
-#include <unistd.h>
-#ifdef _SC_GETGR_R_SIZE_MAX
-we_have_that_sysconf_thing
-#endif
-],
-[AC_MSG_RESULT([yes])
-AC_DEFINE([HAVE_SC_GETGR_R_SIZE_MAX], [1], [Define to 1 if <unistd.h> defines _SC_GETGR_R_SIZE_MAX.])],
-[AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([for _SC_GETPW_R_SIZE_MAX])
-AC_EGREP_CPP(we_have_that_sysconf_thing,
-[
-#include <unistd.h>
-#ifdef _SC_GETPW_R_SIZE_MAX
-we_have_that_sysconf_thing
-#endif
-],
-[AC_MSG_RESULT([yes])
-AC_DEFINE([HAVE_SC_GETPW_R_SIZE_MAX], [1], [Define to 1 if <unistd.h> defines _SC_GETPW_R_SIZE_MAX.])],
-[AC_MSG_RESULT([no])])
+# 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)
+
+if test "$DIR_DOCBOOK_XSL" = "" ||
+ test "$XsltprocCmd" = ""
+then
+ BUILD_DOCBOOK_HTML=NO
+else
+ BUILD_DOCBOOK_HTML=YES
+fi
+AC_SUBST(BUILD_DOCBOOK_HTML)
+
+if test "$DblatexCmd" = ""
+then
+ BUILD_DOCBOOK_PS=NO
+ BUILD_DOCBOOK_PDF=NO
+else
+ BUILD_DOCBOOK_PS=YES
+ BUILD_DOCBOOK_PDF=YES
+fi
+AC_SUBST(BUILD_DOCBOOK_PS)
+AC_SUBST(BUILD_DOCBOOK_PDF)
+
+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
+
+echo "Building DocBook HTML documentation: $BUILD_DOCBOOK_HTML"
+echo "Building DocBook PS documentation: $BUILD_DOCBOOK_PS"
+echo "Building DocBook PDF documentation: $BUILD_DOCBOOK_PDF"
+
+echo ["Building shared libraries : $BuildSharedLibs"]
+
+echo ["----------------------------------------------------------------------
+"]
+
+echo "\
+For a standard build of GHC (fully optimised with profiling), type (g)make.
+
+To make changes to the default build configuration, copy the file
+mk/build.mk.sample to mk/build.mk, and edit the settings in there.