rts: drop unused 'SpinLockCount' typedef
[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 dnl--------------------------------------------------------------------
13 dnl * Deal with arguments telling us gmp is somewhere odd
14 dnl--------------------------------------------------------------------
15
16 FP_GMP
17
18 bootstrap_target=@TargetPlatform@
19 FPTOOLS_SET_PLATFORM_VARS
20
21 # ToDo: if Stage1Only=YES, should be YES
22 CrossCompiling=NO
23 CrossCompilePrefix=""
24 TargetPlatformFull="${target}"
25
26 AC_SUBST(CrossCompiling)
27 AC_SUBST(CrossCompilePrefix)
28 AC_SUBST(TargetPlatformFull)
29
30 Unregisterised="@Unregisterised@"
31 AC_SUBST(Unregisterised)
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
43 #
44 dnl ** figure out how to do a BSD-ish install **
45 #
46 AC_PROG_INSTALL
47
48 #
49 dnl ** how to do symlinks **
50 #
51 AC_PROG_LN_S()
52
53 #
54 dnl ** Find the path to sed **
55 #
56 AC_PATH_PROG(SedCmd,gsed sed,sed)
57
58 XCODE_VERSION()
59
60 dnl ** Which gcc to use?
61 dnl --------------------------------------------------------------
62 FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
63 CC="$WhatGccIsCalled"
64 export CC
65
66
67 dnl ** what cpp to use?
68 dnl --------------------------------------------------------------
69 AC_ARG_WITH(hs-cpp,
70 [AC_HELP_STRING([--with-hs-cpp=ARG],
71         [Use ARG as the path to cpp [default=autodetect]])],
72 [
73     if test "$HostOS" = "mingw32"
74     then
75         AC_MSG_WARN([Request to use $withval will be ignored])
76     else
77         HaskellCPPCmd=$withval
78     fi
79 ],
80 [
81     if test "$HostOS" != "mingw32"
82     then
83         HaskellCPPCmd=$WhatGccIsCalled
84     fi
85 ]
86 )
87
88
89
90 dnl ** what cpp flags to use?
91 dnl -----------------------------------------------------------
92 AC_ARG_WITH(hs-cpp-flags,
93   [AC_HELP_STRING([--with-hs-cpp-flags=ARG],
94           [Use ARG as the path to hs cpp [default=autodetect]])],
95   [
96       if test "$HostOS" = "mingw32"
97       then
98           AC_MSG_WARN([Request to use $withval will be ignored])
99       else
100           HaskellCPPArgs=$withval
101       fi
102   ],
103 [
104   $HaskellCPPCmd -x c /dev/null -dM -E > conftest.txt 2>&1
105   if grep "__clang__" conftest.txt >/dev/null 2>&1; then
106     HaskellCPPArgs="-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs "
107   else
108       $HaskellCPPCmd  -v > conftest.txt 2>&1
109       if  grep "gcc" conftest.txt >/dev/null 2>&1; then
110           HaskellCPPArgs="-E -undef -traditional "
111         else
112           $HaskellCPPCmd  --version > conftest.txt 2>&1
113           if grep "cpphs" conftest.txt >/dev/null 2>&1; then
114             HaskellCPPArgs="--cpp -traditional"
115           else
116             AC_MSG_WARN([configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly])
117             HaskellCPPArgs=""
118           fi
119       fi
120   fi
121   ]
122 )
123
124
125 dnl ** Which ld to use?
126 dnl --------------------------------------------------------------
127 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
128 LdCmd="$LD"
129 AC_SUBST([LdCmd])
130
131 FP_GCC_VERSION
132 AC_PROG_CPP
133
134 FP_PROG_LD_IS_GNU
135 FP_PROG_LD_BUILD_ID
136 FP_PROG_LD_NO_COMPACT_UNWIND
137 FP_PROG_LD_FILELIST
138
139 #
140 dnl ** Check gcc version and flags we need to pass it **
141 #
142 FP_GCC_EXTRA_FLAGS
143
144 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
145 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
146 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
147 # Stage 3 won't be supported by cross-compilation
148 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
149
150 AC_SUBST(CONF_CC_OPTS_STAGE0)
151 AC_SUBST(CONF_CC_OPTS_STAGE1)
152 AC_SUBST(CONF_CC_OPTS_STAGE2)
153 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
154 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
155 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
156 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
157 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
158 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
159 AC_SUBST(CONF_CPP_OPTS_STAGE0)
160 AC_SUBST(CONF_CPP_OPTS_STAGE1)
161 AC_SUBST(CONF_CPP_OPTS_STAGE2)
162
163 dnl ** Set up the variables for the platform in the settings file.
164 dnl May need to use gcc to find platform details.
165 dnl --------------------------------------------------------------
166 FPTOOLS_SET_HASKELL_PLATFORM_VARS
167
168 dnl WordSize for settings.in
169 AC_CHECK_SIZEOF(void *, 4)
170 WordSize=$ac_cv_sizeof_void_p
171 AC_SUBST(WordSize)
172
173 #
174 dnl ** how to invoke `ar' and `ranlib'
175 #
176 FP_PROG_AR_SUPPORTS_ATFILE
177 FP_PROG_AR_NEEDS_RANLIB
178
179 FP_SETTINGS
180
181 #
182 AC_CONFIG_FILES(settings mk/config.mk mk/install.mk)
183 AC_OUTPUT
184
185 # We get caught by
186 #     http://savannah.gnu.org/bugs/index.php?1516
187 #     $(eval ...) inside conditionals causes errors
188 # with make 3.80, so warn the user if it looks like they're about to
189 # try to use it.
190 # We would use "grep -q" here, but Solaris's grep doesn't support it.
191 checkMake380() {
192     if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
193     then
194         echo
195         echo "WARNING: It looks like \"$1\" is GNU make 3.80."
196         echo "This version cannot be used to build GHC."
197         echo "Please use GNU make >= 3.81."
198     fi
199 }
200
201 checkMake380 make
202 checkMake380 gmake
203
204 echo "****************************************************"
205 echo "Configuration done, ready to 'make install'"
206 echo "(see README and INSTALL files for more info.)"
207 echo "****************************************************"