|
|
1
|
+dnl
|
|
|
2
|
+dnl Binary distribution configure script
|
|
|
3
|
+dnl
|
|
|
4
|
+#!/bin/sh
|
|
|
5
|
+#
|
|
|
6
|
+
|
|
|
7
|
+AC_INIT([The Glorious Glasgow Haskell Compilation System], [10.1.20260925], [glasgow-haskell-bugs@haskell.org], [ghc-AC_PACKAGE_VERSION])
|
|
|
8
|
+
|
|
|
9
|
+dnl See /configure.ac for rationale.
|
|
|
10
|
+AC_PREREQ([2.69])
|
|
|
11
|
+
|
|
|
12
|
+AC_CONFIG_MACRO_DIRS([../m4])
|
|
|
13
|
+
|
|
|
14
|
+dnl--------------------------------------------------------------------
|
|
|
15
|
+dnl * Deal with arguments telling us gmp is somewhere odd
|
|
|
16
|
+dnl--------------------------------------------------------------------
|
|
|
17
|
+
|
|
|
18
|
+build_alias=x86_64-unknown-linux
|
|
|
19
|
+host_alias=x86_64-unknown-linux
|
|
|
20
|
+target_alias=x86_64-unknown-linux
|
|
|
21
|
+
|
|
|
22
|
+dnl this makes sure `./configure --target=<cross-compile-target>`
|
|
|
23
|
+dnl works as expected, since we're slightly modifying how Autoconf
|
|
|
24
|
+dnl interprets build/host/target and how this interacts with $CC tests
|
|
|
25
|
+test -n "$target_alias" && ac_tool_prefix=$target_alias-
|
|
|
26
|
+
|
|
|
27
|
+dnl Various things from the source distribution configure
|
|
|
28
|
+bootstrap_build=x86_64-unknown-linux
|
|
|
29
|
+bootstrap_host=x86_64-unknown-linux
|
|
|
30
|
+bootstrap_target=x86_64-unknown-linux
|
|
|
31
|
+
|
|
|
32
|
+bootstrap_llvm_target=x86_64-unknown-linux
|
|
|
33
|
+
|
|
|
34
|
+TargetHasLibm=YES
|
|
|
35
|
+
|
|
|
36
|
+UseLibffiForAdjustors=NO
|
|
|
37
|
+AC_SUBST(UseLibffiForAdjustors)
|
|
|
38
|
+
|
|
|
39
|
+GhcWithSMP=YES
|
|
|
40
|
+AC_SUBST(GhcWithSMP)
|
|
|
41
|
+
|
|
|
42
|
+# We have to run these unconditionally as FPTOOLS_SET_PLATFORMS_VARS wants the
|
|
|
43
|
+# values it computes.
|
|
|
44
|
+AC_CANONICAL_BUILD
|
|
|
45
|
+AC_CANONICAL_HOST
|
|
|
46
|
+AC_CANONICAL_TARGET
|
|
|
47
|
+
|
|
|
48
|
+FPTOOLS_SET_PLATFORMS_VARS
|
|
|
49
|
+
|
|
|
50
|
+# Requires FPTOOLS_SET_PLATFORMS_VARS to be run first.
|
|
|
51
|
+FP_FIND_ROOT
|
|
|
52
|
+
|
|
|
53
|
+CrossCompiling=NO
|
|
|
54
|
+# If 'host' and 'target' differ, then this means we are building a cross-compiler.
|
|
|
55
|
+if test "$target" != "$host" ; then
|
|
|
56
|
+ CrossCompiling=YES
|
|
|
57
|
+ cross_compiling=yes # This tells configure that it can accept just 'target',
|
|
|
58
|
+ # otherwise you get
|
|
|
59
|
+ # configure: error: cannot run C compiled programs.
|
|
|
60
|
+ # If you meant to cross compile, use `--host'.
|
|
|
61
|
+fi
|
|
|
62
|
+LeadingUnderscore="NO"
|
|
|
63
|
+CrossCompilePrefix=""
|
|
|
64
|
+TablesNextToCode="YES"
|
|
|
65
|
+
|
|
|
66
|
+AC_SUBST(LeadingUnderscore)
|
|
|
67
|
+AC_SUBST(CrossCompiling)
|
|
|
68
|
+AC_SUBST(CrossCompilePrefix)
|
|
|
69
|
+AC_SUBST(TablesNextToCode)
|
|
|
70
|
+
|
|
|
71
|
+Unregisterised="NO"
|
|
|
72
|
+AC_SUBST(Unregisterised)
|
|
|
73
|
+
|
|
|
74
|
+#
|
|
|
75
|
+dnl ** figure out how to do a BSD-ish install **
|
|
|
76
|
+#
|
|
|
77
|
+AC_PROG_INSTALL
|
|
|
78
|
+
|
|
|
79
|
+#
|
|
|
80
|
+dnl ** how to do symlinks **
|
|
|
81
|
+#
|
|
|
82
|
+AC_PROG_LN_S()
|
|
|
83
|
+
|
|
|
84
|
+#
|
|
|
85
|
+dnl ** Find the path to sed **
|
|
|
86
|
+#
|
|
|
87
|
+AC_PATH_PROG(SedCmd,gsed sed,sed)
|
|
|
88
|
+
|
|
|
89
|
+dnl ** check for Python for testsuite driver
|
|
|
90
|
+FIND_PYTHON
|
|
|
91
|
+FP_PROG_FIND
|
|
|
92
|
+if test -z "$FindCmd"
|
|
|
93
|
+then
|
|
|
94
|
+ AC_MSG_ERROR([find is required.])
|
|
|
95
|
+fi
|
|
|
96
|
+
|
|
|
97
|
+AC_ARG_ENABLE(distro-toolchain,
|
|
|
98
|
+[AS_HELP_STRING([--enable-distro-toolchain],
|
|
|
99
|
+ [Do not use bundled Windows toolchain binaries.])],
|
|
|
100
|
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableDistroToolchain])],
|
|
|
101
|
+ [EnableDistroToolchain=NO]
|
|
|
102
|
+)
|
|
|
103
|
+AC_SUBST([EnableDistroToolchain])
|
|
|
104
|
+
|
|
|
105
|
+if test "$HostOS" = "mingw32" -a "$EnableDistroToolchain" = "NO"; then
|
|
|
106
|
+ FP_SETUP_WINDOWS_TOOLCHAIN([$hardtop/mingw/], [\$\$topdir/../mingw/])
|
|
|
107
|
+fi
|
|
|
108
|
+
|
|
|
109
|
+
|
|
|
110
|
+if test "$HostOS" = "darwin"; then
|
|
|
111
|
+ # On darwin, we need to clean the extended attributes of the
|
|
|
112
|
+ # ghc-toolchain binary and its dynamic library before we can execute it in the bindist
|
|
|
113
|
+ # (this is a workaround for #24554, for the lack of proper notarisation #17418)
|
|
|
114
|
+
|
|
|
115
|
+ # The following is the work around suggested by @carter in #17418 during
|
|
|
116
|
+ # install time. This should help us with code signing issues by removing
|
|
|
117
|
+ # extended attributes from all files.
|
|
|
118
|
+ XATTR="${XATTR:-/usr/bin/xattr}"
|
|
|
119
|
+
|
|
|
120
|
+ if test -e "${XATTR}"; then
|
|
|
121
|
+
|
|
|
122
|
+ # Instead of cleaning the attributes of the ghc-toolchain binary only,
|
|
|
123
|
+ # we clean them from all files in the bin/ and lib/ directories, as it additionally future
|
|
|
124
|
+ # proofs running executables from the bindist besides ghc-toolchain at configure time, and
|
|
|
125
|
+ # we can avoid figuring out the path to the ghc-toolchain dynlib specifically.
|
|
|
126
|
+ "$XATTR" -rc bin/
|
|
|
127
|
+ "$XATTR" -rc lib/
|
|
|
128
|
+
|
|
|
129
|
+ fi
|
|
|
130
|
+fi
|
|
|
131
|
+
|
|
|
132
|
+AC_ARG_ENABLE(ghc-toolchain,
|
|
|
133
|
+[AS_HELP_STRING([--enable-ghc-toolchain],
|
|
|
134
|
+ [Whether to use the newer ghc-toolchain tool to configure ghc targets])],
|
|
|
135
|
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableGhcToolchain])],
|
|
|
136
|
+ [EnableGhcToolchain=NO]
|
|
|
137
|
+)
|
|
|
138
|
+AC_SUBST([EnableGhcToolchain])
|
|
|
139
|
+
|
|
|
140
|
+AC_ARG_ENABLE(strict-ghc-toolchain-check,
|
|
|
141
|
+[AS_HELP_STRING([--enable-strict-ghc-toolchain-check],
|
|
|
142
|
+ [Whether to raise an error if the output of ghc-toolchain differs from configure])],
|
|
|
143
|
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableStrictGhcToolchainCheck])],
|
|
|
144
|
+ [EnableStrictGhcToolchainCheck=NO]
|
|
|
145
|
+)
|
|
|
146
|
+AC_SUBST([EnableStrictGhcToolchainCheck])
|
|
|
147
|
+
|
|
|
148
|
+dnl ** Which gcc to use?
|
|
|
149
|
+dnl --------------------------------------------------------------
|
|
|
150
|
+AC_PROG_CC([cc gcc clang])
|
|
|
151
|
+AC_PROG_CXX([c++ g++ clang++])
|
|
|
152
|
+# Work around #24324
|
|
|
153
|
+MOVE_TO_FLAGS([CC],[CFLAGS])
|
|
|
154
|
+MOVE_TO_FLAGS([CXX],[CXXFLAGS])
|
|
|
155
|
+
|
|
|
156
|
+dnl ** figure out how to invoke the C preprocessor (i.e. `gcc -E`)
|
|
|
157
|
+AC_PROG_CPP
|
|
|
158
|
+
|
|
|
159
|
+# --with-hs-cpp/--with-hs-cpp-flags
|
|
|
160
|
+FP_HSCPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
|
|
|
161
|
+AC_SUBST([HaskellCPPCmd])
|
|
|
162
|
+AC_SUBST([HaskellCPPArgs])
|
|
|
163
|
+
|
|
|
164
|
+# --with-js-cpp/--with-js-cpp-flags
|
|
|
165
|
+FP_JSCPP_CMD_WITH_ARGS(JavaScriptCPPCmd, JavaScriptCPPArgs)
|
|
|
166
|
+AC_SUBST([JavaScriptCPPCmd])
|
|
|
167
|
+AC_SUBST([JavaScriptCPPArgs])
|
|
|
168
|
+
|
|
|
169
|
+# --with-cmm-cpp/--with-cmm-cpp-flags
|
|
|
170
|
+FP_CMM_CPP_CMD_WITH_ARGS([$CC], [CmmCPPCmd], [CmmCPPArgs], [CmmCPPSupportsG0])
|
|
|
171
|
+AC_SUBST([CmmCPPCmd])
|
|
|
172
|
+AC_SUBST([CmmCPPArgs])
|
|
|
173
|
+AC_SUBST([CmmCPPSupportsG0])
|
|
|
174
|
+
|
|
|
175
|
+dnl ** Which ld to use?
|
|
|
176
|
+dnl --------------------------------------------------------------
|
|
|
177
|
+FIND_LD([$target],[GccUseLdOpt])
|
|
|
178
|
+FIND_MERGE_OBJECTS()
|
|
|
179
|
+CONF_GCC_LINKER_OPTS_STAGE1="$CONF_GCC_LINKER_OPTS_STAGE1 $GccUseLdOpt"
|
|
|
180
|
+CONF_GCC_LINKER_OPTS_STAGE2="$CONF_GCC_LINKER_OPTS_STAGE2 $GccUseLdOpt"
|
|
|
181
|
+CFLAGS="$CFLAGS $GccUseLdOpt"
|
|
|
182
|
+
|
|
|
183
|
+FP_PROG_LD_IS_GNU
|
|
|
184
|
+FP_PROG_LD_NO_COMPACT_UNWIND
|
|
|
185
|
+FP_PROG_LD_FILELIST
|
|
|
186
|
+FP_PROG_LD_SINGLE_MODULE
|
|
|
187
|
+
|
|
|
188
|
+dnl ** which strip to use?
|
|
|
189
|
+dnl --------------------------------------------------------------
|
|
|
190
|
+AC_CHECK_TARGET_TOOL([STRIP], [strip])
|
|
|
191
|
+StripCmd="$STRIP"
|
|
|
192
|
+AC_SUBST([StripCmd])
|
|
|
193
|
+
|
|
|
194
|
+# Here is where we re-target which specific version of the LLVM
|
|
|
195
|
+# tools we are looking for. In the past, GHC supported a number of
|
|
|
196
|
+# versions of LLVM simultaneously, but that stopped working around
|
|
|
197
|
+# 3.5/3.6 release of LLVM.
|
|
|
198
|
+LlvmMinVersion=13
|
|
|
199
|
+LlvmMaxVersion=24
|
|
|
200
|
+
|
|
|
201
|
+dnl ** Which LLVM llc to use?
|
|
|
202
|
+dnl --------------------------------------------------------------
|
|
|
203
|
+AC_ARG_VAR(LLC,[Use as the path to LLVM's llc [default=autodetect]])
|
|
|
204
|
+FIND_LLVM_PROG([LLC], [llc], [$LlvmMinVersion], [$LlvmMaxVersion])
|
|
|
205
|
+LlcCmd="$LLC"
|
|
|
206
|
+AC_SUBST([LlcCmd])
|
|
|
207
|
+
|
|
|
208
|
+dnl ** Which LLVM opt to use?
|
|
|
209
|
+dnl --------------------------------------------------------------
|
|
|
210
|
+AC_ARG_VAR(OPT,[Use as the path to LLVM's opt [default=autodetect]])
|
|
|
211
|
+FIND_LLVM_PROG([OPT], [opt], [$LlvmMinVersion], [$LlvmMaxVersion])
|
|
|
212
|
+OptCmd="$OPT"
|
|
|
213
|
+AC_SUBST([OptCmd])
|
|
|
214
|
+
|
|
|
215
|
+dnl ** look to see if we have a C compiler using an llvm back end.
|
|
|
216
|
+dnl
|
|
|
217
|
+FP_CC_LLVM_BACKEND
|
|
|
218
|
+AC_SUBST(CcLlvmBackend)
|
|
|
219
|
+
|
|
|
220
|
+dnl ** Which LLVM assembler to use?
|
|
|
221
|
+dnl --------------------------------------------------------------
|
|
|
222
|
+AC_ARG_VAR(LLVMAS,[Use as the path to LLVM's assembler (typically clang) [default=autodetect]])
|
|
|
223
|
+if test "x$CcLlvmBackend" = "xYES" && test -z "$LLVMAS"; then
|
|
|
224
|
+ LLVMAS="$CC"
|
|
|
225
|
+fi
|
|
|
226
|
+FIND_LLVM_PROG([LLVMAS], [clang], [$LlvmMinVersion], [$LlvmMaxVersion])
|
|
|
227
|
+LlvmAsCmd="$LLVMAS"
|
|
|
228
|
+AC_SUBST([LlvmAsCmd])
|
|
|
229
|
+
|
|
|
230
|
+dnl ** Which LLVM llvm-dlltool to use?
|
|
|
231
|
+dnl --------------------------------------------------------------
|
|
|
232
|
+AC_CHECK_TARGET_TOOL([DlltoolCmd],[llvm-dlltool])
|
|
|
233
|
+AC_ARG_VAR(DlltoolCmd,[Use as the path to LLVM's llvm-dlltool [default=autodetect]])
|
|
|
234
|
+FIND_LLVM_PROG([DlltoolCmd], [llvm-dlltool], [$LlvmMinVersion], [$LlvmMaxVersion])
|
|
|
235
|
+AC_SUBST([DlltoolCmd])
|
|
|
236
|
+
|
|
|
237
|
+dnl We know that `clang` supports `--target` and it is necessary to pass it
|
|
|
238
|
+dnl lest we see #25793.
|
|
|
239
|
+if test -z "$LlvmAsFlags" && ! test -z "$LlvmTarget"; then
|
|
|
240
|
+ LlvmAsFlags="--target=$LlvmTarget"
|
|
|
241
|
+fi
|
|
|
242
|
+AC_SUBST([LlvmAsFlags])
|
|
|
243
|
+
|
|
|
244
|
+dnl ** Check gcc version and flags we need to pass it **
|
|
|
245
|
+FP_GCC_VERSION
|
|
|
246
|
+FP_GCC_SUPPORTS_NO_PIE
|
|
|
247
|
+FP_GCC_SUPPORTS_VIA_C_FLAGS
|
|
|
248
|
+
|
|
|
249
|
+FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
|
|
|
250
|
+FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
|
|
|
251
|
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
|
|
|
252
|
+# Stage 3 won't be supported by cross-compilation
|
|
|
253
|
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
|
|
|
254
|
+
|
|
|
255
|
+#-no_fixup_chains
|
|
|
256
|
+FP_LD_NO_FIXUP_CHAINS([target], [LDFLAGS])
|
|
|
257
|
+FP_LD_NO_FIXUP_CHAINS([build], [CONF_GCC_LINKER_OPTS_STAGE0])
|
|
|
258
|
+FP_LD_NO_FIXUP_CHAINS([target], [CONF_GCC_LINKER_OPTS_STAGE1])
|
|
|
259
|
+FP_LD_NO_FIXUP_CHAINS([target], [CONF_GCC_LINKER_OPTS_STAGE2])
|
|
|
260
|
+
|
|
|
261
|
+#-no_warn_duplicate_libraries
|
|
|
262
|
+FP_LD_NO_WARN_DUPLICATE_LIBRARIES([build], [CONF_GCC_LINKER_OPTS_STAGE0])
|
|
|
263
|
+FP_LD_NO_WARN_DUPLICATE_LIBRARIES([target], [CONF_GCC_LINKER_OPTS_STAGE1])
|
|
|
264
|
+FP_LD_NO_WARN_DUPLICATE_LIBRARIES([target], [CONF_GCC_LINKER_OPTS_STAGE2])
|
|
|
265
|
+
|
|
|
266
|
+FP_MERGE_OBJECTS_SUPPORTS_RESPONSE_FILES
|
|
|
267
|
+
|
|
|
268
|
+AC_SUBST(CONF_CC_OPTS_STAGE0)
|
|
|
269
|
+AC_SUBST(CONF_CC_OPTS_STAGE1)
|
|
|
270
|
+AC_SUBST(CONF_CC_OPTS_STAGE2)
|
|
|
271
|
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
|
|
|
272
|
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
|
|
|
273
|
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
|
|
|
274
|
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
|
|
|
275
|
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
|
|
|
276
|
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
|
|
|
277
|
+AC_SUBST(CONF_CPP_OPTS_STAGE0)
|
|
|
278
|
+AC_SUBST(CONF_CPP_OPTS_STAGE1)
|
|
|
279
|
+AC_SUBST(CONF_CPP_OPTS_STAGE2)
|
|
|
280
|
+
|
|
|
281
|
+dnl Identify C++ standard library flavour and location
|
|
|
282
|
+FP_FIND_CXX_STD_LIB
|
|
|
283
|
+AC_CONFIG_FILES([mk/system-cxx-std-lib-1.0.conf])
|
|
|
284
|
+
|
|
|
285
|
+dnl ** Which otool to use on macOS
|
|
|
286
|
+dnl --------------------------------------------------------------
|
|
|
287
|
+AC_CHECK_TARGET_TOOL([OTOOL], [otool])
|
|
|
288
|
+OtoolCmd="$OTOOL"
|
|
|
289
|
+AC_SUBST(OtoolCmd)
|
|
|
290
|
+
|
|
|
291
|
+dnl ** Which install_name_tool to use on macOS
|
|
|
292
|
+dnl --------------------------------------------------------------
|
|
|
293
|
+AC_CHECK_TARGET_TOOL([INSTALL_NAME_TOOL], [install_name_tool])
|
|
|
294
|
+InstallNameToolCmd="$INSTALL_NAME_TOOL"
|
|
|
295
|
+AC_SUBST(InstallNameToolCmd)
|
|
|
296
|
+
|
|
|
297
|
+# Check that we have the same emsdk version as the one we were built with.
|
|
|
298
|
+ConfiguredEmsdkVersion=
|
|
|
299
|
+EMSDK_VERSION("", "", ${ConfiguredEmsdkVersion})
|
|
|
300
|
+
|
|
|
301
|
+dnl ** Set up the variables for the platform in the settings file.
|
|
|
302
|
+dnl May need to use gcc to find platform details.
|
|
|
303
|
+dnl --------------------------------------------------------------
|
|
|
304
|
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Build])
|
|
|
305
|
+
|
|
|
306
|
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host])
|
|
|
307
|
+AC_SUBST(HaskellHostArch)
|
|
|
308
|
+AC_SUBST(HaskellHostOs)
|
|
|
309
|
+
|
|
|
310
|
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Target])
|
|
|
311
|
+AC_SUBST(HaskellTargetArch)
|
|
|
312
|
+AC_SUBST(HaskellTargetOs)
|
|
|
313
|
+
|
|
|
314
|
+GHC_SUBSECTIONS_VIA_SYMBOLS
|
|
|
315
|
+AC_SUBST(TargetHasSubsectionsViaSymbols)
|
|
|
316
|
+
|
|
|
317
|
+GHC_IDENT_DIRECTIVE
|
|
|
318
|
+AC_SUBST(TargetHasIdentDirective)
|
|
|
319
|
+
|
|
|
320
|
+GHC_GNU_NONEXEC_STACK
|
|
|
321
|
+AC_SUBST(TargetHasGnuNonexecStack)
|
|
|
322
|
+
|
|
|
323
|
+GHC_LLVM_TARGET_SET_VAR
|
|
|
324
|
+AC_SUBST(LlvmTarget)
|
|
|
325
|
+
|
|
|
326
|
+dnl ** See whether cc supports --target=<triple> and set
|
|
|
327
|
+dnl CONF_CC_OPTS_STAGE[12] accordingly.
|
|
|
328
|
+FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_CXX_OPTS_STAGE1])
|
|
|
329
|
+FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_CXX_OPTS_STAGE2])
|
|
|
330
|
+
|
|
|
331
|
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_GCC_LINKER_OPTS_STAGE1])
|
|
|
332
|
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_GCC_LINKER_OPTS_STAGE2])
|
|
|
333
|
+
|
|
|
334
|
+dnl Pass -Qunused-arguments or otherwise GHC will have very noisy invocations of Clang
|
|
|
335
|
+FP_CC_IGNORE_UNUSED_ARGS([$CC], [CONF_CC_OPTS_STAGE1])
|
|
|
336
|
+FP_CC_IGNORE_UNUSED_ARGS([$CC], [CONF_CC_OPTS_STAGE2])
|
|
|
337
|
+
|
|
|
338
|
+# CPP, CPPFLAGS
|
|
|
339
|
+# --with-cpp/-with-cpp-flags
|
|
|
340
|
+dnl Note that we must do this after setting and using the C11 CPPFLAGS, or
|
|
|
341
|
+dnl otherwise risk trying to configure the C11 and LD flags using -E as a CPPFLAG
|
|
|
342
|
+FP_CPP_CMD_WITH_ARGS([$CC_STAGE0],[CPPCmd_STAGE0],[CONF_CPP_OPTS_STAGE0])
|
|
|
343
|
+FP_CPP_CMD_WITH_ARGS([$CC],[CPPCmd],[CONF_CPP_OPTS_STAGE1])
|
|
|
344
|
+FP_CPP_CMD_WITH_ARGS([$CC],[CPPCmd],[CONF_CPP_OPTS_STAGE2])
|
|
|
345
|
+AC_SUBST([CPPCmd_STAGE0])
|
|
|
346
|
+AC_SUBST([CPPCmd])
|
|
|
347
|
+
|
|
|
348
|
+dnl TargetWordSize for settings file
|
|
|
349
|
+AC_CHECK_SIZEOF(void *, 4)
|
|
|
350
|
+if test "x$ac_cv_sizeof_void_p" = "x0"; then
|
|
|
351
|
+ AC_MSG_ERROR([Failed to determine machine word size. Does your toolchain actually work?])
|
|
|
352
|
+fi
|
|
|
353
|
+dnl Check that the toolchain we have is consistent with what the compiler expects
|
|
|
354
|
+if test "x$ac_cv_sizeof_void_p" != "x8"; then
|
|
|
355
|
+ AC_MSG_ERROR([This binary distribution produces binaries for a target with
|
|
|
356
|
+ word size of 8, but your target toolchain produces binaries
|
|
|
357
|
+ with a word size of $ac_cv_sizeof_void_p. Are you sure your toolchain
|
|
|
358
|
+ targets the intended target platform of this compiler?])
|
|
|
359
|
+fi
|
|
|
360
|
+TargetWordSize=$ac_cv_sizeof_void_p
|
|
|
361
|
+AC_SUBST(TargetWordSize)
|
|
|
362
|
+
|
|
|
363
|
+dnl TargetWordBigEndian for settings file
|
|
|
364
|
+AC_C_BIGENDIAN([TargetWordBigEndian=YES],[TargetWordBigEndian=NO])
|
|
|
365
|
+dnl Check that the toolchain we have is consistent with what the compiler expects
|
|
|
366
|
+if test "x$TargetWordBigEndian" != "xNO"; then
|
|
|
367
|
+ AC_MSG_ERROR([This binary distribution produces binaries for a target with
|
|
|
368
|
+ a different byte order than your target toolchain.
|
|
|
369
|
+ Are you sure your toolchain targets the intended target platform
|
|
|
370
|
+ of this compiler?])
|
|
|
371
|
+fi
|
|
|
372
|
+AC_SUBST(TargetWordBigEndian)
|
|
|
373
|
+
|
|
|
374
|
+#
|
|
|
375
|
+dnl ** how to invoke `ar' and `ranlib'
|
|
|
376
|
+#
|
|
|
377
|
+FP_PROG_AR_SUPPORTS_ATFILE
|
|
|
378
|
+FP_PROG_AR_SUPPORTS_DASH_L
|
|
|
379
|
+FP_PROG_AR_NEEDS_RANLIB
|
|
|
380
|
+RanlibCmd="$RANLIB"
|
|
|
381
|
+AC_SUBST([RanlibCmd])
|
|
|
382
|
+
|
|
|
383
|
+LINKER_SUPPORTS_VERBATIM_LINKING
|
|
|
384
|
+
|
|
|
385
|
+dnl ** Have libdw?
|
|
|
386
|
+dnl --------------------------------------------------------------
|
|
|
387
|
+dnl Check for a usable version of libdw/elfutils
|
|
|
388
|
+dnl Currently we need 0.158 or newer.
|
|
|
389
|
+UseLibdw=NO
|
|
|
390
|
+if test "x$UseLibdw" = "xYES" ; then
|
|
|
391
|
+ AC_CHECK_LIB(dw, dwfl_attach_state,
|
|
|
392
|
+ [UseLibdw=YES],
|
|
|
393
|
+ [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])]
|
|
|
394
|
+ )
|
|
|
395
|
+fi
|
|
|
396
|
+AC_SUBST(UseLibdw)
|
|
|
397
|
+
|
|
|
398
|
+dnl What is the version of the base library which we are going to use?
|
|
|
399
|
+dnl The user can use BASE_UNIT_ID at install time to point the compiler to
|
|
|
400
|
+dnl link against a different base package by default.
|
|
|
401
|
+dnl If the package is unavailable it will simply not be linked against.
|
|
|
402
|
+BaseUnitId=base-4.23.0.0-inplace
|
|
|
403
|
+if test -n "$BASE_UNIT_ID"; then
|
|
|
404
|
+ BaseUnitId="$BASE_UNIT_ID"
|
|
|
405
|
+fi
|
|
|
406
|
+
|
|
|
407
|
+AC_SUBST(BaseUnitId)
|
|
|
408
|
+
|
|
|
409
|
+# We get caught by
|
|
|
410
|
+# http://savannah.gnu.org/bugs/index.php?1516
|
|
|
411
|
+# $(eval ...) inside conditionals causes errors
|
|
|
412
|
+# with make 3.80, so warn the user if it looks like they're about to
|
|
|
413
|
+# try to use it.
|
|
|
414
|
+# We would use "grep -q" here, but Solaris's grep doesn't support it.
|
|
|
415
|
+checkMake380() {
|
|
|
416
|
+ if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
|
|
|
417
|
+ then
|
|
|
418
|
+ echo
|
|
|
419
|
+ echo "WARNING: It looks like \"$1\" is GNU make 3.80."
|
|
|
420
|
+ echo "This version cannot be used to build GHC."
|
|
|
421
|
+ echo "Please use GNU make >= 3.81."
|
|
|
422
|
+ fi
|
|
|
423
|
+}
|
|
|
424
|
+
|
|
|
425
|
+checkMake380 make
|
|
|
426
|
+checkMake380 gmake
|
|
|
427
|
+
|
|
|
428
|
+# Toolchain target files
|
|
|
429
|
+FIND_GHC_TOOLCHAIN_BIN([YES])
|
|
|
430
|
+PREP_TARGET_FILE
|
|
|
431
|
+FIND_GHC_TOOLCHAIN([.])
|
|
|
432
|
+
|
|
|
433
|
+AC_CONFIG_FILES([config.mk])
|
|
|
434
|
+AC_CONFIG_FILES([default.host.target])
|
|
|
435
|
+AC_CONFIG_FILES([default.target])
|
|
|
436
|
+AC_CONFIG_FILES([mk/hsc2hs])
|
|
|
437
|
+AC_OUTPUT
|
|
|
438
|
+
|
|
|
439
|
+VALIDATE_GHC_TOOLCHAIN([default.target],[default.target.ghc-toolchain])
|
|
|
440
|
+
|
|
|
441
|
+if test "$EnableDistroToolchain" = "YES"; then
|
|
|
442
|
+ # If the user specified --enable-distro-toolchain then we just use the
|
|
|
443
|
+ # executable names, not paths. We do this by finding strings of paths to
|
|
|
444
|
+ # programs and keeping the basename only:
|
|
|
445
|
+ cp default.target default.target.bak
|
|
|
446
|
+
|
|
|
447
|
+ while IFS= read -r line; do
|
|
|
448
|
+ if echo "$line" | grep -q 'prgPath = "'; then
|
|
|
449
|
+ path=$(echo "$line" | sed -E 's/.*prgPath = "([[^"]]+)".*/\1/')
|
|
|
450
|
+ base=$(basename "$path")
|
|
|
451
|
+ echo "$line" | sed "s|$path|$base|"
|
|
|
452
|
+ else
|
|
|
453
|
+ echo "$line"
|
|
|
454
|
+ fi
|
|
|
455
|
+ done < default.target.bak > default.target
|
|
|
456
|
+ echo "Applied --enable-distro-toolchain basename substitution to default.target:"
|
|
|
457
|
+ cat default.target
|
|
|
458
|
+fi
|
|
|
459
|
+
|
|
|
460
|
+if test "$windows" = YES -a "$EnableDistroToolchain" = "NO"; then
|
|
|
461
|
+ # Handle the Windows toolchain installed in FP_SETUP_WINDOWS_TOOLCHAIN.
|
|
|
462
|
+ # We need to issue a substitution to use $tooldir,
|
|
|
463
|
+ # See Note [tooldir: How GHC finds mingw on Windows]
|
|
|
464
|
+ SUBST_TOOLDIR([default.target])
|
|
|
465
|
+ echo "Applied tooldir substitution to default.target:"
|
|
|
466
|
+ cat default.target
|
|
|
467
|
+fi
|
|
|
468
|
+
|
|
|
469
|
+rm -Rf acargs acghc-toolchain actmp-ghc-toolchain
|
|
|
470
|
+
|
|
|
471
|
+echo "****************************************************"
|
|
|
472
|
+echo "Configuration done, ready to 'make install'"
|
|
|
473
|
+echo "(see README and INSTALL files for more info.)"
|
|
|
474
|
+echo "****************************************************" |