dnl dnl Binary distribution configure script dnl #!/bin/sh # AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc]) FP_BINDIST_GHC_PWD FP_FIND_ROOT dnl-------------------------------------------------------------------- dnl * Deal with arguments telling us gmp is somewhere odd dnl-------------------------------------------------------------------- FP_GMP bootstrap_target=@TargetPlatform@ FPTOOLS_SET_PLATFORM_VARS # ToDo: if Stage1Only=YES, should be YES CrossCompiling=NO CrossCompilePrefix="" TargetPlatformFull="${target}" AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) Unregisterised="@Unregisterised@" AC_SUBST(Unregisterised) # dnl ** Check Perl installation ** # AC_PATH_PROG(PerlCmd,perl) if test -z "$PerlCmd"; then echo "You must install perl before you can continue" echo "Perhaps it is already installed, but not in your PATH?" exit 1 fi # dnl ** figure out how to do a BSD-ish install ** # AC_PROG_INSTALL # dnl ** how to do symlinks ** # AC_PROG_LN_S() # dnl ** Find the path to sed ** # AC_PATH_PROG(SedCmd,gsed sed,sed) XCODE_VERSION() dnl ** Which gcc to use? dnl -------------------------------------------------------------- FIND_GCC([WhatGccIsCalled], [gcc], [gcc]) CC="$WhatGccIsCalled" export CC dnl ** what cpp to use? dnl -------------------------------------------------------------- AC_ARG_WITH(hs-cpp, [AC_HELP_STRING([--with-hs-cpp=ARG], [Use ARG as the path to cpp [default=autodetect]])], [ if test "$HostOS" = "mingw32" then AC_MSG_WARN([Request to use $withval will be ignored]) else HaskellCPPCmd=$withval fi ], [ if test "$HostOS" != "mingw32" then HaskellCPPCmd=$WhatGccIsCalled fi ] ) dnl ** what cpp flags to use? dnl ----------------------------------------------------------- AC_ARG_WITH(hs-cpp-flags, [AC_HELP_STRING([--with-hs-cpp-flags=ARG], [Use ARG as the path to hs cpp [default=autodetect]])], [ if test "$HostOS" = "mingw32" then AC_MSG_WARN([Request to use $withval will be ignored]) else HaskellCPPArgs=$withval fi ], [ $HaskellCPPCmd -x c /dev/null -dM -E > conftest.txt 2>&1 if grep "__clang__" conftest.txt >/dev/null 2>&1; then HaskellCPPArgs="-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs " else $HaskellCPPCmd -v > conftest.txt 2>&1 if grep "gcc" conftest.txt >/dev/null 2>&1; then HaskellCPPArgs="-E -undef -traditional " else $HaskellCPPCmd --version > conftest.txt 2>&1 if grep "cpphs" conftest.txt >/dev/null 2>&1; then HaskellCPPArgs="--cpp -traditional" else AC_MSG_WARN([configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly]) HaskellCPPArgs="" fi fi fi ] ) dnl ** Which ld to use? dnl -------------------------------------------------------------- FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) LdCmd="$LD" AC_SUBST([LdCmd]) FP_GCC_VERSION AC_PROG_CPP FP_PROG_LD_IS_GNU FP_PROG_LD_BUILD_ID FP_PROG_LD_NO_COMPACT_UNWIND FP_PROG_LD_FILELIST # dnl ** Check gcc version and flags we need to pass it ** # FP_GCC_EXTRA_FLAGS FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS]) FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0]) FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1]) # Stage 3 won't be supported by cross-compilation FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2]) AC_SUBST(CONF_CC_OPTS_STAGE0) AC_SUBST(CONF_CC_OPTS_STAGE1) AC_SUBST(CONF_CC_OPTS_STAGE2) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1) AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1) AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2) AC_SUBST(CONF_CPP_OPTS_STAGE0) AC_SUBST(CONF_CPP_OPTS_STAGE1) AC_SUBST(CONF_CPP_OPTS_STAGE2) dnl ** Set up the variables for the platform in the settings file. dnl May need to use gcc to find platform details. dnl -------------------------------------------------------------- FPTOOLS_SET_HASKELL_PLATFORM_VARS dnl WordSize for settings.in AC_CHECK_SIZEOF(void *, 4) WordSize=$ac_cv_sizeof_void_p AC_SUBST(WordSize) # dnl ** how to invoke `ar' and `ranlib' # FP_PROG_AR_SUPPORTS_ATFILE FP_PROG_AR_NEEDS_RANLIB FP_SETTINGS # AC_CONFIG_FILES(settings mk/config.mk mk/install.mk) 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 "****************************************************" echo "Configuration done, ready to 'make install'" echo "(see README and INSTALL files for more info.)" echo "****************************************************"