configure.ac.in 3.98 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 15
dnl--------------------------------------------------------------------
dnl * Deal with arguments telling us gmp is somewhere odd
dnl--------------------------------------------------------------------

Ian Lynagh's avatar
Ian Lynagh committed
16
FP_GMP
17

18
bootstrap_target=@TargetPlatform@
19 20
FPTOOLS_SET_PLATFORM_VARS

21
# ToDo: if Stage1Only=YES, should be YES
22 23 24 25
CrossCompiling=NO
CrossCompilePrefix=""
TargetPlatformFull="${target}"

26
AC_SUBST(CrossCompiling)
27 28 29
AC_SUBST(CrossCompilePrefix)
AC_SUBST(TargetPlatformFull)

30 31 32
Unregisterised="@Unregisterised@"
AC_SUBST(Unregisterised)

33
#
34 35 36 37 38 39 40
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
41 42
fi

sof's avatar
sof committed
43 44
#
dnl ** figure out how to do a BSD-ish install **
45 46
#
AC_PROG_INSTALL
sof's avatar
sof committed
47 48 49 50

#
dnl ** how to do symlinks **
#
sof's avatar
sof committed
51
AC_PROG_LN_S()
sof's avatar
sof committed
52 53 54

#
dnl ** Find the path to sed **
55
#
Ian Lynagh's avatar
Ian Lynagh committed
56
AC_PATH_PROG(SedCmd,gsed sed,sed)
57

58
XCODE_VERSION()
59 60 61

dnl ** Which gcc to use?
dnl --------------------------------------------------------------
62 63 64
FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
CC="$WhatGccIsCalled"
export CC
65

66 67
# --with-hs-cpp/--with-hs-cpp-flags
FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
68

69 70 71 72 73 74
dnl ** Which ld to use?
dnl --------------------------------------------------------------
FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
LdCmd="$LD"
AC_SUBST([LdCmd])

75
FP_GCC_VERSION
76
AC_PROG_CPP
77

78 79 80
FP_PROG_LD_IS_GNU
FP_PROG_LD_BUILD_ID
FP_PROG_LD_NO_COMPACT_UNWIND
81
FP_PROG_LD_FILELIST
82

sof's avatar
sof committed
83
#
84 85 86 87
dnl ** Check gcc version and flags we need to pass it **
#
FP_GCC_EXTRA_FLAGS

88 89 90 91 92
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])
93 94 95 96

AC_SUBST(CONF_CC_OPTS_STAGE0)
AC_SUBST(CONF_CC_OPTS_STAGE1)
AC_SUBST(CONF_CC_OPTS_STAGE2)
97 98 99 100 101 102 103 104 105
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)
106

107 108 109 110 111
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

112 113 114 115 116
dnl WordSize for settings.in
AC_CHECK_SIZEOF(void *, 4)
WordSize=$ac_cv_sizeof_void_p
AC_SUBST(WordSize)

Ian Lynagh's avatar
Ian Lynagh committed
117 118 119
#
dnl ** how to invoke `ar' and `ranlib'
#
120
FP_PROG_AR_SUPPORTS_ATFILE
Ian Lynagh's avatar
Ian Lynagh committed
121 122
FP_PROG_AR_NEEDS_RANLIB

123 124
FP_SETTINGS

125
#
126
AC_CONFIG_FILES(settings mk/config.mk mk/install.mk)
127
AC_OUTPUT
128

129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
# 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

148
echo "****************************************************"
149
echo "Configuration done, ready to 'make install'"
sof's avatar
sof committed
150
echo "(see README and INSTALL files for more info.)"
151
echo "****************************************************"