configure.ac.in 3.16 KB
Newer Older
1 2 3 4 5 6
dnl
dnl Binary distribution configure script
dnl
#!/bin/sh
#

7
AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc])
8

9
FP_BINDIST_GHC_PWD
Ian Lynagh's avatar
Ian Lynagh committed
10 11
FP_FIND_ROOT

12 13 14
BootingFromHc=NO
AC_SUBST(BootingFromHc)

15 16 17 18
dnl--------------------------------------------------------------------
dnl * Deal with arguments telling us gmp is somewhere odd
dnl--------------------------------------------------------------------

Ian Lynagh's avatar
Ian Lynagh committed
19
FP_GMP
20

21 22 23
bootstrap_target=`ghc/stage2/build/tmp/ghc-stage2 +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
FPTOOLS_SET_PLATFORM_VARS

24
#
25 26 27 28 29 30 31
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
32
fi
33
FPTOOLS_SHEBANG_PERL
34

sof's avatar
sof committed
35 36
#
dnl ** figure out how to do a BSD-ish install **
37 38
#
AC_PROG_INSTALL
sof's avatar
sof committed
39 40 41 42

#
dnl ** how to do symlinks **
#
sof's avatar
sof committed
43
AC_PROG_LN_S()
sof's avatar
sof committed
44 45 46

#
dnl ** Find the path to sed **
47
#
Ian Lynagh's avatar
Ian Lynagh committed
48
AC_PATH_PROG(SedCmd,gsed sed,sed)
49

sof's avatar
sof committed
50
#
51
dnl ** How to invoke gcc/cpp **
sof's avatar
sof committed
52
#
53 54 55 56 57
FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
export CC
WhatGccIsCalled="$CC"
AC_SUBST(WhatGccIsCalled)

58
FP_HAVE_GCC
59
AC_PROG_CPP
60

sof's avatar
sof committed
61
#
62 63 64 65
dnl ** Check gcc version and flags we need to pass it **
#
FP_GCC_EXTRA_FLAGS

66 67 68 69 70
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])
71 72 73 74

AC_SUBST(CONF_CC_OPTS_STAGE0)
AC_SUBST(CONF_CC_OPTS_STAGE1)
AC_SUBST(CONF_CC_OPTS_STAGE2)
75 76 77 78 79 80 81 82 83
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)
84

Ian Lynagh's avatar
Ian Lynagh committed
85 86 87 88 89
#
dnl ** how to invoke `ar' and `ranlib'
#
FP_PROG_AR_NEEDS_RANLIB

90
#
91
AC_CONFIG_FILES(extra-gcc-opts mk/config.mk mk/install.mk)
92
AC_OUTPUT
93

94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
# 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

113
echo "****************************************************"
114
echo "Configuration done, ready to 'make install'"
sof's avatar
sof committed
115
echo "(see README and INSTALL files for more info.)"
116
echo "****************************************************"