Define LdCmd 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_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 BuildingCrossCompiler=NO
25 PortingCompiler=NO
26 CrossCompiling=NO
27 CrossCompilePrefix=""
28 TargetPlatformFull="${target}"
29
30 AC_SUBST(BuildingCrossCompiler)  # 'toolchain' case
31 AC_SUBST(PortingCompiler)        # 'port' case
32 AC_SUBST(CrossCompiling)         # BuildingCrossCompiler OR PortingCompiler
33 AC_SUBST(CrossCompilePrefix)
34 AC_SUBST(TargetPlatformFull)
35
36 #
37 dnl ** Check Perl installation **
38 #
39 AC_PATH_PROG(PerlCmd,perl)
40 if test -z "$PerlCmd"; then
41    echo "You must install perl before you can continue"
42    echo "Perhaps it is already installed, but not in your PATH?"
43    exit 1
44 fi
45 FPTOOLS_SHEBANG_PERL
46
47 #
48 dnl ** figure out how to do a BSD-ish install **
49 #
50 AC_PROG_INSTALL
51
52 #
53 dnl ** how to do symlinks **
54 #
55 AC_PROG_LN_S()
56
57 #
58 dnl ** Find the path to sed **
59 #
60 AC_PATH_PROG(SedCmd,gsed sed,sed)
61
62 XCODE_VERSION()
63
64 dnl ** Which gcc to use?
65 dnl --------------------------------------------------------------
66 FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
67 CC="$WhatGccIsCalled"
68 export CC
69
70 dnl ** Which ld to use?
71 dnl --------------------------------------------------------------
72 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
73 LdCmd="$LD"
74 AC_SUBST([LdCmd])
75
76 FP_GCC_VERSION
77 AC_PROG_CPP
78
79 FP_PROG_LD_HashSize31
80 FP_PROG_LD_ReduceMemoryOverheads
81 FP_PROG_LD_IS_GNU
82 FP_PROG_LD_BUILD_ID
83 FP_PROG_LD_NO_COMPACT_UNWIND
84
85 #
86 dnl ** Check gcc version and flags we need to pass it **
87 #
88 FP_GCC_EXTRA_FLAGS
89
90 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
91 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
92 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
93 # Stage 3 won't be supported by cross-compilation
94 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
95
96 AC_SUBST(CONF_CC_OPTS_STAGE0)
97 AC_SUBST(CONF_CC_OPTS_STAGE1)
98 AC_SUBST(CONF_CC_OPTS_STAGE2)
99 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
100 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
101 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
102 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
103 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
104 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
105 AC_SUBST(CONF_CPP_OPTS_STAGE0)
106 AC_SUBST(CONF_CPP_OPTS_STAGE1)
107 AC_SUBST(CONF_CPP_OPTS_STAGE2)
108
109 dnl ** Set up the variables for the platform in the settings file.
110 dnl May need to use gcc to find platform details.
111 dnl --------------------------------------------------------------
112 FPTOOLS_SET_HASKELL_PLATFORM_VARS
113
114 dnl WordSize for settings.in
115 AC_CHECK_SIZEOF(void *, 4)
116 WordSize=$ac_cv_sizeof_void_p
117 AC_SUBST(WordSize)
118
119 #
120 dnl ** how to invoke `ar' and `ranlib'
121 #
122 FP_PROG_AR_NEEDS_RANLIB
123
124 FP_SETTINGS
125
126 #
127 AC_CONFIG_FILES(settings mk/config.mk mk/install.mk)
128 AC_OUTPUT
129
130 # We get caught by
131 #     http://savannah.gnu.org/bugs/index.php?1516
132 #     $(eval ...) inside conditionals causes errors
133 # with make 3.80, so warn the user if it looks like they're about to
134 # try to use it.
135 # We would use "grep -q" here, but Solaris's grep doesn't support it.
136 checkMake380() {
137     if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
138     then
139         echo
140         echo "WARNING: It looks like \"$1\" is GNU make 3.80."
141         echo "This version cannot be used to build GHC."
142         echo "Please use GNU make >= 3.81."
143     fi
144 }
145
146 checkMake380 make
147 checkMake380 gmake
148
149 echo "****************************************************"
150 echo "Configuration done, ready to 'make install'"
151 echo "(see README and INSTALL files for more info.)"
152 echo "****************************************************"