Set stage-specific CC/LD opts in the bindist configure.ac
[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_FIND_ROOT
10
11 BootingFromHc=NO
12 AC_SUBST(BootingFromHc)
13
14 dnl--------------------------------------------------------------------
15 dnl * Deal with arguments telling us gmp is somewhere odd
16 dnl--------------------------------------------------------------------
17
18 FP_ARG_GMP
19
20 GMP_INCLUDE_DIRS=
21 GMP_LIB_DIRS=
22 if test "x$gmp_libraries" != "xNONE"; then
23   LDFLAGS="-L$gmp_libraries $LDFLAGS"
24   GMP_LIB_DIRS=$gmp_libraries
25 fi
26 if test "x$gmp_includes" != "xNONE"; then
27   CPPFLAGS="-I$gmp_includes $CPPFLAGS"
28   GMP_INCLUDE_DIRS=$gmp_includes
29 fi
30 AC_SUBST(GMP_INCLUDE_DIRS)
31 AC_SUBST(GMP_LIB_DIRS)
32
33 #
34 dnl ** Check Perl installation **
35 #
36 AC_PATH_PROG(PerlCmd,perl)
37 if test -z "$PerlCmd"; then
38    echo "You must install perl before you can continue"
39    echo "Perhaps it is already installed, but not in your PATH?"
40    exit 1
41 fi
42 FPTOOLS_SHEBANG_PERL
43
44 #
45 dnl ** figure out how to do a BSD-ish install **
46 #
47 AC_PROG_INSTALL
48
49 #
50 dnl ** how to do symlinks **
51 #
52 AC_PROG_LN_S()
53
54 #
55 dnl ** how to invoke `ar' and `ranlib'
56 #
57 FP_PROG_AR_NEEDS_RANLIB
58
59 #
60 dnl ** Find the path to sed **
61 #
62 AC_PATH_PROG(SedCmd,sed)
63
64 #
65 dnl ** How to invoke gcc/cpp **
66 #
67 FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
68 export CC
69 WhatGccIsCalled="$CC"
70 AC_SUBST(WhatGccIsCalled)
71
72 FP_HAVE_GCC
73 AC_PROG_CPP
74
75 #
76 dnl ** Check gcc version and flags we need to pass it **
77 #
78 FP_GCC_EXTRA_FLAGS
79
80 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS])
81 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_LD_OPTS_STAGE0])
82 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_LD_OPTS_STAGE1])
83 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_LD_OPTS_STAGE2])
84
85 AC_SUBST(CONF_CC_OPTS_STAGE0)
86 AC_SUBST(CONF_CC_OPTS_STAGE1)
87 AC_SUBST(CONF_CC_OPTS_STAGE2)
88 AC_SUBST(CONF_LD_OPTS_STAGE0)
89 AC_SUBST(CONF_LD_OPTS_STAGE1)
90 AC_SUBST(CONF_LD_OPTS_STAGE2)
91
92 #
93 AC_CONFIG_FILES(extra-gcc-opts mk/config.mk mk/install.mk)
94 AC_OUTPUT
95
96 # We get caught by
97 #     http://savannah.gnu.org/bugs/index.php?1516
98 #     $(eval ...) inside conditionals causes errors
99 # with make 3.80, so warn the user if it looks like they're about to
100 # try to use it.
101 # We would use "grep -q" here, but Solaris's grep doesn't support it.
102 checkMake380() {
103     if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
104     then
105         echo
106         echo "WARNING: It looks like \"$1\" is GNU make 3.80."
107         echo "This version cannot be used to build GHC."
108         echo "Please use GNU make >= 3.81."
109     fi
110 }
111
112 checkMake380 make
113 checkMake380 gmake
114
115 echo "****************************************************"
116 echo "Configuration done, ready to 'make install'"
117 echo "(see README and INSTALL files for more info.)"
118 echo "****************************************************"