Merge branch 'master' of http://darcs.haskell.org/ghc
[ghc.git] / distrib / configure.ac.in
1 dnl
2 dnl Binary distribution configure script
3 dnl
4 #!/bin/sh
5 #
6
7 AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc])
8
9 FP_BINDIST_GHC_PWD
10 FP_FIND_ROOT
11
12 BootingFromHc=NO
13 AC_SUBST(BootingFromHc)
14
15 dnl--------------------------------------------------------------------
16 dnl * Deal with arguments telling us gmp is somewhere odd
17 dnl--------------------------------------------------------------------
18
19 FP_GMP
20
21 bootstrap_target=`ghc/stage2/build/tmp/ghc-stage2 +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
22 FPTOOLS_SET_PLATFORM_VARS
23
24 #
25 dnl ** Check Perl installation **
26 #
27 AC_PATH_PROG(PerlCmd,perl)
28 if test -z "$PerlCmd"; then
29    echo "You must install perl before you can continue"
30    echo "Perhaps it is already installed, but not in your PATH?"
31    exit 1
32 fi
33 FPTOOLS_SHEBANG_PERL
34
35 #
36 dnl ** figure out how to do a BSD-ish install **
37 #
38 AC_PROG_INSTALL
39
40 #
41 dnl ** how to do symlinks **
42 #
43 AC_PROG_LN_S()
44
45 #
46 dnl ** Find the path to sed **
47 #
48 AC_PATH_PROG(SedCmd,gsed sed,sed)
49
50 XCODE_VERSION()
51
52 dnl ** Which gcc to use?
53 dnl --------------------------------------------------------------
54 FIND_GCC()
55
56 FP_GCC_VERSION
57 AC_PROG_CPP
58
59 #
60 dnl ** Check gcc version and flags we need to pass it **
61 #
62 FP_GCC_EXTRA_FLAGS
63
64 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
65 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
66 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
67 # Stage 3 won't be supported by cross-compilation
68 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
69
70 AC_SUBST(CONF_CC_OPTS_STAGE0)
71 AC_SUBST(CONF_CC_OPTS_STAGE1)
72 AC_SUBST(CONF_CC_OPTS_STAGE2)
73 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
74 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
75 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
76 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
77 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
78 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
79 AC_SUBST(CONF_CPP_OPTS_STAGE0)
80 AC_SUBST(CONF_CPP_OPTS_STAGE1)
81 AC_SUBST(CONF_CPP_OPTS_STAGE2)
82
83 FP_SETTINGS
84
85 #
86 dnl ** how to invoke `ar' and `ranlib'
87 #
88 FP_PROG_AR_NEEDS_RANLIB
89
90 #
91 AC_CONFIG_FILES(settings mk/config.mk mk/install.mk)
92 AC_OUTPUT
93
94 # We get caught by
95 #     http://savannah.gnu.org/bugs/index.php?1516
96 #     $(eval ...) inside conditionals causes errors
97 # with make 3.80, so warn the user if it looks like they're about to
98 # try to use it.
99 # We would use "grep -q" here, but Solaris's grep doesn't support it.
100 checkMake380() {
101     if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
102     then
103         echo
104         echo "WARNING: It looks like \"$1\" is GNU make 3.80."
105         echo "This version cannot be used to build GHC."
106         echo "Please use GNU make >= 3.81."
107     fi
108 }
109
110 checkMake380 make
111 checkMake380 gmake
112
113 echo "****************************************************"
114 echo "Configuration done, ready to 'make install'"
115 echo "(see README and INSTALL files for more info.)"
116 echo "****************************************************"