]>
Commit | Line | Data |
---|---|---|
1322177d | 1 | # configure.in for GCC |
46f18e7b RK |
2 | # Process this file with autoconf to generate a configuration script. |
3 | ||
027faee7 | 4 | # Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
eb70d86d | 5 | # Free Software Foundation, Inc. |
46f18e7b | 6 | |
1322177d | 7 | #This file is part of GCC. |
46f18e7b | 8 | |
1322177d LB |
9 | #GCC is free software; you can redistribute it and/or modify it under |
10 | #the terms of the GNU General Public License as published by the Free | |
11 | #Software Foundation; either version 2, or (at your option) any later | |
12 | #version. | |
46f18e7b | 13 | |
1322177d LB |
14 | #GCC is distributed in the hope that it will be useful, but WITHOUT |
15 | #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 | #for more details. | |
46f18e7b RK |
18 | |
19 | #You should have received a copy of the GNU General Public License | |
1322177d LB |
20 | #along with GCC; see the file COPYING. If not, write to the Free |
21 | #Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
22 | #02111-1307, USA. | |
46f18e7b | 23 | |
34a86c2b NN |
24 | # -------------------------------- |
25 | # Initialization and sanity checks | |
26 | # -------------------------------- | |
27 | ||
890ad3ea | 28 | AC_PREREQ(2.13) |
46f18e7b | 29 | AC_INIT(tree.c) |
b7cb92ad | 30 | AC_CONFIG_HEADER(auto-host.h:config.in) |
cdcc6a01 | 31 | |
34a86c2b NN |
32 | # Determine the host, build, and target systems |
33 | AC_CANONICAL_SYSTEM | |
34 | ||
73458fb7 NN |
35 | # Define variables host_canonical and build_canonical |
36 | build_canonical=${build} | |
37 | host_canonical=${host} | |
38 | AC_SUBST(build_canonical) | |
39 | AC_SUBST(host_canonical) | |
40 | ||
6a1b7268 | 41 | target_subdir=${target_alias} |
73458fb7 NN |
42 | AC_SUBST(target_subdir) |
43 | ||
34a86c2b NN |
44 | # Set program_transform_name |
45 | AC_ARG_PROGRAM | |
46f18e7b | 46 | |
75a39864 JL |
47 | # Check for bogus environment variables. |
48 | # Test if LIBRARY_PATH contains the notation for the current directory | |
49 | # since this would lead to problems installing/building glibc. | |
50 | # LIBRARY_PATH contains the current directory if one of the following | |
51 | # is true: | |
52 | # - one of the terminals (":" and ";") is the first or last sign | |
53 | # - two terminals occur directly after each other | |
54 | # - the path contains an element with a dot in it | |
55 | AC_MSG_CHECKING(LIBRARY_PATH variable) | |
56 | changequote(,)dnl | |
57 | case ${LIBRARY_PATH} in | |
58 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
59 | library_path_setting="contains current directory" | |
60 | ;; | |
61 | *) | |
62 | library_path_setting="ok" | |
63 | ;; | |
64 | esac | |
65 | changequote([,])dnl | |
66 | AC_MSG_RESULT($library_path_setting) | |
67 | if test "$library_path_setting" != "ok"; then | |
68 | AC_MSG_ERROR([ | |
69 | *** LIBRARY_PATH shouldn't contain the current directory when | |
079bd08e | 70 | *** building gcc. Please change the environment variable |
75a39864 JL |
71 | *** and run configure again.]) |
72 | fi | |
73 | ||
74 | # Test if GCC_EXEC_PREFIX contains the notation for the current directory | |
75 | # since this would lead to problems installing/building glibc. | |
76 | # GCC_EXEC_PREFIX contains the current directory if one of the following | |
77 | # is true: | |
78 | # - one of the terminals (":" and ";") is the first or last sign | |
79 | # - two terminals occur directly after each other | |
80 | # - the path contains an element with a dot in it | |
81 | AC_MSG_CHECKING(GCC_EXEC_PREFIX variable) | |
82 | changequote(,)dnl | |
83 | case ${GCC_EXEC_PREFIX} in | |
84 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
85 | gcc_exec_prefix_setting="contains current directory" | |
86 | ;; | |
87 | *) | |
88 | gcc_exec_prefix_setting="ok" | |
89 | ;; | |
90 | esac | |
91 | changequote([,])dnl | |
92 | AC_MSG_RESULT($gcc_exec_prefix_setting) | |
93 | if test "$gcc_exec_prefix_setting" != "ok"; then | |
94 | AC_MSG_ERROR([ | |
95 | *** GCC_EXEC_PREFIX shouldn't contain the current directory when | |
079bd08e | 96 | *** building gcc. Please change the environment variable |
75a39864 JL |
97 | *** and run configure again.]) |
98 | fi | |
99 | ||
34a86c2b NN |
100 | # ----------- |
101 | # Directories | |
102 | # ----------- | |
103 | ||
104 | # Specify the local prefix | |
105 | local_prefix= | |
106 | AC_ARG_WITH(local-prefix, | |
107 | [ --with-local-prefix=DIR specifies directory to put local include], | |
108 | [case "${withval}" in | |
109 | yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; | |
110 | no) ;; | |
111 | *) local_prefix=$with_local_prefix ;; | |
112 | esac]) | |
113 | ||
114 | # Default local prefix if it is empty | |
115 | if test x$local_prefix = x; then | |
116 | local_prefix=/usr/local | |
117 | fi | |
118 | ||
119 | # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only | |
120 | # passed in by the toplevel make and thus we'd get different behavior | |
121 | # depending on where we built the sources. | |
122 | gcc_gxx_include_dir= | |
123 | # Specify the g++ header file directory | |
124 | AC_ARG_WITH(gxx-include-dir, | |
125 | [ --with-gxx-include-dir=DIR | |
126 | specifies directory to put g++ header files], | |
127 | [case "${withval}" in | |
128 | yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;; | |
129 | no) ;; | |
130 | *) gcc_gxx_include_dir=$with_gxx_include_dir ;; | |
131 | esac]) | |
132 | ||
133 | if test x${gcc_gxx_include_dir} = x; then | |
134 | if test x${enable_version_specific_runtime_libs} = xyes; then | |
135 | gcc_gxx_include_dir='${libsubdir}/include/c++' | |
136 | else | |
137 | topsrcdir=${srcdir}/.. . ${srcdir}/../config.if | |
138 | changequote(<<, >>)dnl | |
139 | gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir} | |
140 | changequote([, ])dnl | |
141 | fi | |
142 | fi | |
143 | ||
144 | AC_ARG_WITH(cpp_install_dir, | |
145 | [ --with-cpp-install-dir=DIR | |
146 | install the user visible C preprocessor in DIR | |
147 | (relative to PREFIX) as well as PREFIX/bin], | |
148 | [if test x$withval = xyes; then | |
149 | AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) | |
150 | elif test x$withval != xno; then | |
151 | cpp_install_dir=$withval | |
152 | fi]) | |
153 | ||
154 | # ------------------- | |
155 | # Find default linker | |
156 | # ------------------- | |
46f18e7b RK |
157 | |
158 | # With GNU ld | |
159 | AC_ARG_WITH(gnu-ld, | |
160 | [ --with-gnu-ld arrange to work with GNU ld.], | |
df6faf79 JW |
161 | gnu_ld_flag="$with_gnu_ld", |
162 | gnu_ld_flag=no) | |
46f18e7b | 163 | |
ab339d62 AO |
164 | # With pre-defined ld |
165 | AC_ARG_WITH(ld, | |
e8bec136 | 166 | [ --with-ld arrange to use the specified ld (full pathname)], |
3ccc3a56 AO |
167 | DEFAULT_LINKER="$with_ld") |
168 | if test x"${DEFAULT_LINKER+set}" = x"set"; then | |
169 | if test ! -x "$DEFAULT_LINKER"; then | |
170 | AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) | |
e154a394 | 171 | elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then |
ab339d62 AO |
172 | gnu_ld_flag=yes |
173 | fi | |
119d24d1 KG |
174 | AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER", |
175 | [Define to enable the use of a default linker.]) | |
ab339d62 AO |
176 | fi |
177 | ||
34a86c2b NN |
178 | AC_MSG_CHECKING([whether a default linker was specified]) |
179 | if test x"${DEFAULT_LINKER+set}" = x"set"; then | |
180 | if test x"$gnu_ld_flag" = x"no"; then | |
181 | AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) | |
182 | else | |
183 | AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) | |
184 | fi | |
185 | else | |
186 | AC_MSG_RESULT(no) | |
187 | fi | |
188 | ||
189 | # ---------------------- | |
190 | # Find default assembler | |
191 | # ---------------------- | |
192 | ||
46f18e7b RK |
193 | # With GNU as |
194 | AC_ARG_WITH(gnu-as, | |
e8bec136 | 195 | [ --with-gnu-as arrange to work with GNU as], |
df6faf79 JW |
196 | gas_flag="$with_gnu_as", |
197 | gas_flag=no) | |
46f18e7b | 198 | |
ab339d62 | 199 | AC_ARG_WITH(as, |
e8bec136 | 200 | [ --with-as arrange to use the specified as (full pathname)], |
3ccc3a56 AO |
201 | DEFAULT_ASSEMBLER="$with_as") |
202 | if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then | |
203 | if test ! -x "$DEFAULT_ASSEMBLER"; then | |
204 | AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) | |
e154a394 | 205 | elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then |
ab339d62 AO |
206 | gas_flag=yes |
207 | fi | |
119d24d1 KG |
208 | AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER", |
209 | [Define to enable the use of a default assembler.]) | |
3ccc3a56 | 210 | fi |
ab339d62 | 211 | |
34a86c2b NN |
212 | AC_MSG_CHECKING([whether a default assembler was specified]) |
213 | if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then | |
214 | if test x"$gas_flag" = x"no"; then | |
215 | AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) | |
4e88d51b | 216 | else |
34a86c2b | 217 | AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) |
4e88d51b | 218 | fi |
34a86c2b NN |
219 | else |
220 | AC_MSG_RESULT(no) | |
4e88d51b | 221 | fi |
46f18e7b | 222 | |
34a86c2b NN |
223 | # --------------- |
224 | # Find C compiler | |
225 | # --------------- | |
13c22933 | 226 | |
414d23ae HPN |
227 | # Find the native compiler |
228 | AC_PROG_CC | |
229 | AC_PROG_CC_C_O | |
230 | # autoconf is lame and doesn't give us any substitution variable for this. | |
231 | if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then | |
232 | NO_MINUS_C_MINUS_O=yes | |
233 | else | |
234 | OUTPUT_OPTION='-o $@' | |
235 | fi | |
236 | AC_SUBST(NO_MINUS_C_MINUS_O) | |
237 | AC_SUBST(OUTPUT_OPTION) | |
238 | ||
73458fb7 NN |
239 | # ------------------------- |
240 | # Check C compiler features | |
241 | # ------------------------- | |
242 | ||
414d23ae HPN |
243 | AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long, |
244 | ac_cv_prog_cc_no_long_long, | |
245 | [save_CFLAGS="$CFLAGS" | |
246 | CFLAGS="-Wno-long-long" | |
247 | AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes, | |
248 | ac_cv_prog_cc_no_long_long=no) | |
249 | CFLAGS="$save_CFLAGS"]) | |
250 | ||
34a86c2b NN |
251 | AC_PROG_CPP |
252 | AC_C_INLINE | |
253 | gcc_AC_C_VOLATILE | |
254 | ||
255 | gcc_AC_C_LONG_DOUBLE | |
256 | gcc_AC_C_LONG_LONG | |
257 | gcc_AC_C__BOOL | |
258 | ||
259 | # sizeof(char) is 1 by definition. | |
260 | AC_COMPILE_CHECK_SIZEOF(short) | |
261 | AC_COMPILE_CHECK_SIZEOF(int) | |
262 | AC_COMPILE_CHECK_SIZEOF(long) | |
263 | if test $ac_cv_c_long_long = yes; then | |
264 | AC_COMPILE_CHECK_SIZEOF(long long) | |
265 | fi | |
266 | if test $ac_cv_c___int64 = yes; then | |
267 | AC_COMPILE_CHECK_SIZEOF(__int64) | |
268 | fi | |
269 | ||
270 | gcc_AC_C_CHARSET | |
271 | ||
272 | # ----------------- | |
273 | # Find Ada compiler | |
274 | # ----------------- | |
275 | ||
276 | # See if GNAT has been installed | |
277 | gcc_AC_PROG_GNAT | |
278 | ||
414d23ae HPN |
279 | if test x$have_gnat != xno ; then |
280 | AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long, | |
281 | ac_cv_prog_adac_no_long_long, | |
282 | [cat >conftest.adb <<EOF | |
283 | procedure conftest is begin null; end conftest; | |
284 | EOF | |
285 | if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then | |
286 | ac_cv_prog_adac_no_long_long=yes | |
287 | else | |
288 | ac_cv_prog_adac_no_long_long=no | |
289 | fi | |
290 | rm -f conftest*]) | |
291 | else | |
292 | ac_cv_prog_adac_no_long_long=yes | |
293 | fi | |
294 | ||
34a86c2b NN |
295 | # --------------------- |
296 | # Warnings and checking | |
297 | # --------------------- | |
298 | ||
414d23ae HPN |
299 | strict1_warn= |
300 | if test $ac_cv_prog_cc_no_long_long = yes && \ | |
301 | test $ac_cv_prog_adac_no_long_long = yes ; then | |
302 | strict1_warn="-pedantic -Wno-long-long" | |
303 | fi | |
304 | AC_SUBST(strict1_warn) | |
305 | ||
414d23ae HPN |
306 | # If the native compiler is GCC, we can enable warnings even in stage1. |
307 | # That's useful for people building cross-compilers, or just running a | |
308 | # quick `make'. | |
309 | warn_cflags= | |
310 | if test "x$GCC" = "xyes"; then | |
311 | warn_cflags='$(GCC_WARN_CFLAGS)' | |
312 | fi | |
313 | AC_SUBST(warn_cflags) | |
314 | ||
dd859b8a KG |
315 | # Enable -Werror in bootstrap stage2 and later. |
316 | # Change the default to "no" on release branches. | |
317 | AC_ARG_ENABLE(werror, | |
318 | [ --enable-werror enable -Werror in bootstrap stage2 and later], [], | |
319 | [enable_werror=yes]) | |
320 | if test x$enable_werror = xyes ; then | |
321 | WERROR=-Werror | |
322 | fi | |
323 | AC_SUBST(WERROR) | |
324 | ||
a494747c MM |
325 | # Enable expensive internal checks |
326 | AC_ARG_ENABLE(checking, | |
f4524c9e ZW |
327 | [ --enable-checking[=LIST] |
328 | enable expensive run-time checks. With LIST, | |
329 | enable only specific categories of checks. | |
4c76f856 JJ |
330 | Categories are: misc,tree,rtl,rtlflag,gc,gcac; |
331 | default is misc,tree,gc,rtlflag], | |
119d24d1 KG |
332 | [ac_checking= |
333 | ac_tree_checking= | |
334 | ac_rtl_checking= | |
4c76f856 | 335 | ac_rtlflag_checking= |
119d24d1 KG |
336 | ac_gc_checking= |
337 | ac_gc_always_collect= | |
338 | case "${enableval}" in | |
4c76f856 JJ |
339 | yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; |
340 | ac_rtlflag_checking=1 ;; | |
4e88d51b | 341 | no) ;; |
59f406b7 | 342 | *) IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," |
f4524c9e ZW |
343 | set fnord $enableval; shift |
344 | IFS="$ac_save_IFS" | |
c62e45ad KG |
345 | for check |
346 | do | |
f4524c9e | 347 | case $check in |
119d24d1 KG |
348 | misc) ac_checking=1 ;; |
349 | tree) ac_tree_checking=1 ;; | |
4c76f856 | 350 | rtlflag) ac_rtlflag_checking=1 ;; |
119d24d1 KG |
351 | rtl) ac_rtl_checking=1 ;; |
352 | gc) ac_gc_checking=1 ;; | |
353 | gcac) ac_gc_always_collect=1 ;; | |
414d23ae | 354 | valgrind) ac_checking_valgrind=1 ;; |
f4524c9e ZW |
355 | *) AC_MSG_ERROR(unknown check category $check) ;; |
356 | esac | |
357 | done | |
358 | ;; | |
119d24d1 | 359 | esac |
51d0e20c AJ |
360 | ], |
361 | # Enable some checks by default for development versions of GCC | |
4c76f856 | 362 | [ac_checking=1; ac_tree_checking=1; ac_gc_checking=1; ac_rtlflag_checking=1;]) |
204250d2 | 363 | nocommon_flag="" |
119d24d1 KG |
364 | if test x$ac_checking != x ; then |
365 | AC_DEFINE(ENABLE_CHECKING, 1, | |
366 | [Define if you want more run-time sanity checks. This one gets a grab | |
367 | bag of miscellaneous but relatively cheap checks.]) | |
204250d2 | 368 | nocommon_flag=-fno-common |
119d24d1 | 369 | fi |
204250d2 | 370 | AC_SUBST(nocommon_flag) |
119d24d1 KG |
371 | if test x$ac_tree_checking != x ; then |
372 | AC_DEFINE(ENABLE_TREE_CHECKING, 1, | |
373 | [Define if you want all operations on trees (the basic data | |
374 | structure of the front ends) to be checked for dynamic type safety | |
375 | at runtime. This is moderately expensive.]) | |
376 | fi | |
377 | if test x$ac_rtl_checking != x ; then | |
378 | AC_DEFINE(ENABLE_RTL_CHECKING, 1, | |
379 | [Define if you want all operations on RTL (the basic data structure | |
380 | of the optimizer and back end) to be checked for dynamic type safety | |
381 | at runtime. This is quite expensive.]) | |
382 | fi | |
4c76f856 JJ |
383 | if test x$ac_rtlflag_checking != x ; then |
384 | AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1, | |
385 | [Define if you want RTL flag accesses to be checked against the RTL | |
386 | codes that are supported for each access macro. This is relatively | |
387 | cheap.]) | |
388 | fi | |
119d24d1 KG |
389 | if test x$ac_gc_checking != x ; then |
390 | AC_DEFINE(ENABLE_GC_CHECKING, 1, | |
391 | [Define if you want the garbage collector to do object poisoning and | |
392 | other memory allocation checks. This is quite expensive.]) | |
393 | fi | |
394 | if test x$ac_gc_always_collect != x ; then | |
395 | AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1, | |
396 | [Define if you want the garbage collector to operate in maximally | |
397 | paranoid mode, validating the entire heap and collecting garbage at | |
398 | every opportunity. This is extremely expensive.]) | |
399 | fi | |
414d23ae HPN |
400 | valgrind_path_defines= |
401 | valgrind_command= | |
402 | if test x$ac_checking_valgrind != x ; then | |
403 | # It is certainly possible that there's valgrind but no valgrind.h. | |
404 | # GCC relies on making annotations so we must have both. | |
14011ca4 AJ |
405 | AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>) |
406 | AC_TRY_CPP( | |
407 | [#include <memcheck.h> | |
408 | #ifndef VALGRIND_DISCARD | |
409 | #error VALGRIND_DISCARD not defined | |
410 | #endif], | |
411 | [gcc_cv_header_memcheck_h=yes], | |
412 | gcc_cv_header_memcheck_h=no) | |
413 | AC_MSG_RESULT($gcc_cv_header_memcheck_h) | |
414d23ae HPN |
414 | AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) |
415 | AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, | |
416 | [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) | |
72bd67f9 AJ |
417 | if test "x$valgrind_path" = "x" || (test $have_valgrind_h = no && test $gcc_cv_header_memcheck_h = no); then |
418 | AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h/memcheck.h]) | |
414d23ae HPN |
419 | fi |
420 | valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' | |
421 | valgrind_command="$valgrind_path -q" | |
422 | AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, | |
423 | [Define if you want to run subprograms and generated programs | |
424 | through valgrind (a memory checker). This is extremely expensive.]) | |
14011ca4 AJ |
425 | if test $gcc_cv_header_memcheck_h = yes; then |
426 | AC_DEFINE(HAVE_MEMCHECK_H, 1, | |
427 | [Define if valgrind's memcheck.h header is installed.]) | |
428 | fi | |
414d23ae HPN |
429 | fi |
430 | AC_SUBST(valgrind_path_defines) | |
431 | AC_SUBST(valgrind_command) | |
51d0e20c | 432 | |
22aa533e NS |
433 | # Enable code coverage collection |
434 | AC_ARG_ENABLE(coverage, | |
435 | [ --enable-coverage[=LEVEL] | |
436 | enable compiler\'s code coverage collection. | |
437 | Use to measure compiler performance and locate | |
8601608f | 438 | unused parts of the compiler. With LEVEL, specify |
22aa533e NS |
439 | optimization. Values are opt, noopt, |
440 | default is noopt], | |
441 | [case "${enableval}" in | |
442 | yes|noopt) | |
8601608f | 443 | coverage_flags="-fprofile-arcs -ftest-coverage -O0 -DSELF_COVERAGE=1" |
22aa533e NS |
444 | ;; |
445 | opt) | |
8601608f | 446 | coverage_flags="-fprofile-arcs -ftest-coverage -O2 -DSELF_COVERAGE=2" |
22aa533e NS |
447 | ;; |
448 | *) | |
449 | AC_MSG_ERROR(unknown coverage setting $enableval) | |
450 | ;; | |
451 | esac], | |
2043c38e | 452 | [coverage_flags=""]) |
22aa533e NS |
453 | AC_SUBST(coverage_flags) |
454 | ||
73458fb7 NN |
455 | # ------------------------------- |
456 | # Miscenalleous configure options | |
457 | # ------------------------------- | |
34a86c2b NN |
458 | |
459 | # With stabs | |
460 | AC_ARG_WITH(stabs, | |
461 | [ --with-stabs arrange to use stabs instead of host debug format], | |
462 | stabs="$with_stabs", | |
463 | stabs=no) | |
464 | ||
465 | # With ELF | |
466 | AC_ARG_WITH(elf, | |
467 | [ --with-elf arrange to use ELF instead of host debug format], | |
468 | elf="$with_elf", | |
469 | elf=no) | |
470 | ||
471 | # Determine whether or not multilibs are enabled. | |
472 | AC_ARG_ENABLE(multilib, | |
473 | [ --enable-multilib enable library support for multiple ABIs], | |
474 | [], [enable_multilib=yes]) | |
475 | AC_SUBST(enable_multilib) | |
3ecc3258 | 476 | |
4bafaa6f L |
477 | # Enable __cxa_atexit for C++. |
478 | AC_ARG_ENABLE(__cxa_atexit, | |
479 | [ --enable-__cxa_atexit enable __cxa_atexit for C++], | |
480 | [], []) | |
2121a768 | 481 | |
c5c76735 JL |
482 | # Enable Multibyte Characters for C/C++ |
483 | AC_ARG_ENABLE(c-mbchar, | |
e8bec136 | 484 | [ --enable-c-mbchar enable multibyte characters for C and C++], |
2618c083 | 485 | if test x$enable_c_mbchar != xno; then |
9ec7291f ZW |
486 | AC_DEFINE(MULTIBYTE_CHARS, 1, |
487 | [Define if you want the C and C++ compilers to support multibyte | |
488 | character sets for source code.]) | |
c5c76735 JL |
489 | fi) |
490 | ||
0bbb1697 RK |
491 | # Enable threads |
492 | # Pass with no value to take the default | |
493 | # Pass with a value to specify a thread package | |
494 | AC_ARG_ENABLE(threads, | |
e8bec136 RO |
495 | [ --enable-threads enable thread usage for target GCC |
496 | --enable-threads=LIB use LIB thread package for target GCC],, | |
0bbb1697 RK |
497 | enable_threads='') |
498 | ||
e445171e | 499 | enable_threads_flag=$enable_threads |
0bbb1697 | 500 | # Check if a valid thread package |
e445171e | 501 | case x${enable_threads_flag} in |
0bbb1697 RK |
502 | x | xno) |
503 | # No threads | |
a851212a | 504 | target_thread_file='single' |
0bbb1697 RK |
505 | ;; |
506 | xyes) | |
507 | # default | |
a851212a | 508 | target_thread_file='' |
0bbb1697 RK |
509 | ;; |
510 | xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ | |
6d412a7b | 511 | xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix | xgnat) |
e445171e | 512 | target_thread_file=$enable_threads_flag |
0bbb1697 RK |
513 | ;; |
514 | *) | |
515 | echo "$enable_threads is an unknown thread package" 1>&2 | |
516 | exit 1 | |
517 | ;; | |
518 | esac | |
519 | ||
d8bb17c8 OP |
520 | AC_ARG_ENABLE(objc-gc, |
521 | [ --enable-objc-gc enable the use of Boehm's garbage collector with | |
e8bec136 | 522 | the GNU Objective-C runtime], |
2618c083 | 523 | if test x$enable_objc_gc = xno; then |
d8bb17c8 OP |
524 | objc_boehm_gc='' |
525 | else | |
526 | objc_boehm_gc=1 | |
527 | fi, | |
528 | objc_boehm_gc='') | |
529 | ||
90e6a802 | 530 | AC_ARG_WITH(dwarf2, |
e8bec136 | 531 | [ --with-dwarf2 force the default debug format to be DWARF 2], |
90e6a802 RL |
532 | dwarf2="$with_dwarf2", |
533 | dwarf2=no) | |
534 | ||
50503ac8 | 535 | AC_ARG_ENABLE(shared, |
e8bec136 | 536 | [ --disable-shared don't provide a shared libgcc], |
c785e0fa AO |
537 | [ |
538 | case $enable_shared in | |
539 | yes | no) ;; | |
540 | *) | |
541 | enable_shared=no | |
542 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," | |
543 | for pkg in $enableval; do | |
544 | if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then | |
545 | enable_shared=yes | |
546 | fi | |
547 | done | |
548 | IFS="$ac_save_ifs" | |
549 | ;; | |
550 | esac | |
551 | ], [enable_shared=yes]) | |
50503ac8 RH |
552 | AC_SUBST(enable_shared) |
553 | ||
4977bab6 ZW |
554 | AC_ARG_WITH(sysroot, |
555 | [ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.], | |
556 | [ | |
557 | case ${with_sysroot} in | |
91710e62 | 558 | yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;; |
4977bab6 ZW |
559 | *) TARGET_SYSTEM_ROOT=$with_sysroot ;; |
560 | esac | |
561 | ||
562 | TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' | |
563 | CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)' | |
047d636f DJ |
564 | |
565 | if test "x$exec_prefix" = xNONE; then | |
566 | if test "x$prefix" = xNONE; then | |
567 | test_prefix=/usr/local | |
568 | else | |
569 | test_prefix=$prefix | |
570 | fi | |
571 | else | |
572 | test_prefix=$exec_prefix | |
573 | fi | |
574 | case ${TARGET_SYSTEM_ROOT} in | |
91710e62 AO |
575 | "${test_prefix}"|"${test_prefix}/"*|\ |
576 | '${exec_prefix}'|'${exec_prefix}/'*) | |
047d636f DJ |
577 | t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" |
578 | TARGET_SYSTEM_ROOT_DEFINE="$t" | |
579 | ;; | |
580 | esac | |
4977bab6 ZW |
581 | ], [ |
582 | TARGET_SYSTEM_ROOT= | |
db720d9a | 583 | TARGET_SYSTEM_ROOT_DEFINE= |
4977bab6 ZW |
584 | CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' |
585 | ]) | |
586 | AC_SUBST(TARGET_SYSTEM_ROOT) | |
587 | AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) | |
588 | AC_SUBST(CROSS_SYSTEM_HEADER_DIR) | |
589 | ||
73458fb7 NN |
590 | # ------------------------- |
591 | # Checks for other programs | |
592 | # ------------------------- | |
61842080 | 593 | |
e9a25f70 JL |
594 | AC_PROG_MAKE_SET |
595 | ||
46f18e7b RK |
596 | # Find some useful tools |
597 | AC_PROG_AWK | |
99e757d5 KG |
598 | gcc_AC_PROG_LN |
599 | gcc_AC_PROG_LN_S | |
46f18e7b | 600 | AC_PROG_RANLIB |
99e757d5 | 601 | gcc_AC_PROG_INSTALL |
46f18e7b | 602 | |
955be633 JM |
603 | # See if we have the mktemp command. |
604 | AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) | |
605 | ||
09fa0705 ZW |
606 | # Do we have a single-tree copy of texinfo? |
607 | if test -f $srcdir/../texinfo/Makefile.in; then | |
608 | MAKEINFO='$(objdir)/../texinfo/makeinfo/makeinfo' | |
609 | gcc_cv_prog_makeinfo_modern=yes | |
610 | AC_MSG_RESULT([Using makeinfo from the unified source tree.]) | |
611 | else | |
612 | # See if makeinfo has been installed and is modern enough | |
613 | # that we can use it. | |
614 | gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, | |
615 | [GNU texinfo.* \([0-9][0-9.]*\)], | |
a38f87a9 | 616 | [4.[2-9]*]) |
09fa0705 ZW |
617 | fi |
618 | ||
619 | if test $gcc_cv_prog_makeinfo_modern = no; then | |
620 | AC_MSG_WARN([ | |
621 | *** Makeinfo is missing or too old. | |
17db6582 | 622 | *** Info documentation will not be built.]) |
09fa0705 | 623 | BUILD_INFO= |
09fa0705 ZW |
624 | else |
625 | BUILD_INFO=info AC_SUBST(BUILD_INFO) | |
09fa0705 ZW |
626 | fi |
627 | ||
3f896fc2 JM |
628 | # Is pod2man recent enough to regenerate manpages? |
629 | AC_MSG_CHECKING([for recent Pod::Man]) | |
7be33370 | 630 | if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then |
fd939e46 JM |
631 | AC_MSG_RESULT(yes) |
632 | GENERATED_MANPAGES=generated-manpages AC_SUBST(GENERATED_MANPAGES) | |
633 | else | |
634 | AC_MSG_RESULT(no) | |
635 | GENERATED_MANPAGES= | |
636 | fi | |
637 | ||
baade80b PE |
638 | # 'make compare' can be significantly faster, if cmp itself can |
639 | # skip bytes instead of using tail. The test being performed is | |
640 | # "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2" | |
641 | # but we need to sink errors and handle broken shells. | |
642 | AC_MSG_CHECKING([for cmp's capabilities]) | |
643 | echo abfoo >t1 | |
644 | echo cdfoo >t2 | |
645 | if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then | |
646 | if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then | |
647 | make_compare_target=slowcompare | |
648 | else | |
649 | make_compare_target=gnucompare | |
650 | fi | |
c7a5cf61 PE |
651 | else |
652 | make_compare_target=slowcompare | |
653 | fi | |
baade80b | 654 | rm t1 t2 |
c7a5cf61 | 655 | AC_SUBST(make_compare_target) |
baade80b | 656 | AC_MSG_RESULT($make_compare_target) |
c7a5cf61 | 657 | |
1e608388 ZW |
658 | # How about lex? |
659 | dnl Don't use AC_PROG_LEX; we insist on flex. | |
660 | dnl LEXLIB is not useful in gcc. | |
661 | if test -f $srcdir/../flex/skel.c; then | |
662 | FLEX='$(objdir)/../flex/flex' | |
663 | else | |
9118405f | 664 | AC_CHECK_PROG(FLEX, flex, flex, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing flex) |
1e608388 ZW |
665 | fi |
666 | ||
667 | # Bison? | |
668 | # The -L switch is so bison can find its skeleton file. | |
669 | if test -f $srcdir/../bison/bison.simple; then | |
670 | BISON='$(objdir)/../bison/bison -L $(srcdir)/../bison/' | |
671 | else | |
9118405f | 672 | AC_CHECK_PROG(BISON, bison, bison, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison) |
1e608388 ZW |
673 | fi |
674 | ||
73458fb7 NN |
675 | # -------------------- |
676 | # Checks for C headers | |
677 | # -------------------- | |
678 | ||
679 | AC_MSG_CHECKING(for GNU C library) | |
680 | AC_CACHE_VAL(gcc_cv_glibc, | |
681 | [AC_TRY_COMPILE( | |
682 | [#include <features.h>],[ | |
683 | #if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) | |
684 | #error Not a GNU C library system | |
685 | #endif], | |
686 | [gcc_cv_glibc=yes], | |
687 | gcc_cv_glibc=no)]) | |
688 | AC_MSG_RESULT($gcc_cv_glibc) | |
689 | if test $gcc_cv_glibc = yes; then | |
690 | AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library]) | |
691 | fi | |
692 | ||
693 | AC_HEADER_STDC | |
694 | AC_HEADER_TIME | |
695 | gcc_AC_HEADER_STDBOOL | |
696 | gcc_AC_HEADER_STRING | |
697 | AC_HEADER_SYS_WAIT | |
698 | AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \ | |
1072ec3f | 699 | fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ |
73458fb7 | 700 | sys/resource.h sys/param.h sys/times.h sys/stat.h \ |
2bd02043 | 701 | direct.h malloc.h langinfo.h ldfcn.h wchar.h) |
73458fb7 NN |
702 | |
703 | # Check for thread headers. | |
704 | AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) | |
705 | AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) | |
706 | ||
707 | # These tests can't be done till we know if we have limits.h. | |
708 | gcc_AC_C_CHAR_BIT | |
709 | AC_C_BIGENDIAN_CROSS | |
73458fb7 NN |
710 | |
711 | # -------- | |
712 | # UNSORTED | |
713 | # -------- | |
714 | ||
715 | # Stage specific cflags for build. | |
716 | stage1_cflags= | |
717 | case $build in | |
718 | vax-*-*) | |
719 | if test x$GCC = xyes | |
720 | then | |
721 | stage1_cflags="-Wa,-J" | |
722 | else | |
723 | stage1_cflags="-J" | |
724 | fi | |
725 | ;; | |
726 | powerpc-*-darwin*) | |
727 | # The spiffy cpp-precomp chokes on some legitimate constructs in GCC | |
728 | # sources; use -no-cpp-precomp to get to GNU cpp. | |
729 | # Apple's GCC has bugs in designated initializer handling, so disable | |
730 | # that too. | |
731 | stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0" | |
732 | ;; | |
733 | esac | |
734 | AC_SUBST(stage1_cflags) | |
735 | ||
4e70264f ZW |
736 | # These libraries may be used by collect2. |
737 | # We may need a special search path to get them linked. | |
738 | AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs, | |
739 | [save_LIBS="$LIBS" | |
7f2749d4 | 740 | for libs in '' -lld -lmld \ |
4e70264f ZW |
741 | '-L/usr/lib/cmplrs/cc2.11 -lmld' \ |
742 | '-L/usr/lib/cmplrs/cc3.11 -lmld' | |
743 | do | |
744 | LIBS="$libs" | |
745 | AC_TRY_LINK_FUNC(ldopen, | |
746 | [gcc_cv_collect2_libs="$libs"; break]) | |
747 | done | |
748 | LIBS="$save_LIBS" | |
749 | test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required']) | |
750 | case $gcc_cv_collect2_libs in | |
751 | "none required") ;; | |
752 | *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;; | |
753 | esac | |
754 | AC_SUBST(COLLECT2_LIBS) | |
755 | ||
7f2749d4 RK |
756 | # When building Ada code on Alpha, we need exc_resume which is usually in |
757 | # -lexc. So test for it. | |
758 | save_LIBS="$LIBS" | |
759 | LIBS= | |
760 | AC_SEARCH_LIBS(exc_resume, exc) | |
761 | GNAT_LIBEXC="$LIBS" | |
762 | LIBS="$save_LIBS" | |
763 | AC_SUBST(GNAT_LIBEXC) | |
764 | ||
62c9aa5f ZW |
765 | # Some systems put ldexp and frexp in libm instead of libc; assume |
766 | # they're both in the same place. jcf-dump needs them. | |
767 | save_LIBS="$LIBS" | |
768 | LIBS= | |
769 | AC_SEARCH_LIBS(ldexp, m) | |
770 | LDEXP_LIB="$LIBS" | |
771 | LIBS="$save_LIBS" | |
772 | AC_SUBST(LDEXP_LIB) | |
773 | ||
890ad3ea | 774 | # See if the stage1 system preprocessor understands the ANSI C |
4bc5fbd4 | 775 | # preprocessor stringification operator. (Used by symcat.h.) |
890ad3ea | 776 | AC_C_STRINGIZE |
76844337 | 777 | |
7636d567 JW |
778 | # Use <inttypes.h> only if it exists, |
779 | # doesn't clash with <sys/types.h>, and declares intmax_t. | |
780 | AC_MSG_CHECKING(for inttypes.h) | |
781 | AC_CACHE_VAL(gcc_cv_header_inttypes_h, | |
782 | [AC_TRY_COMPILE( | |
783 | [#include <sys/types.h> | |
784 | #include <inttypes.h>], | |
785 | [intmax_t i = -1;], | |
9da0e39b | 786 | [gcc_cv_header_inttypes_h=yes], |
7636d567 JW |
787 | gcc_cv_header_inttypes_h=no)]) |
788 | AC_MSG_RESULT($gcc_cv_header_inttypes_h) | |
9da0e39b | 789 | if test $gcc_cv_header_inttypes_h = yes; then |
119d24d1 KG |
790 | AC_DEFINE(HAVE_INTTYPES_H, 1, |
791 | [Define if you have a working <inttypes.h> header file.]) | |
9da0e39b | 792 | fi |
cdcc6a01 | 793 | |
9612ab65 ZW |
794 | dnl Disabled until we have a complete test for buggy enum bitfields. |
795 | dnl gcc_AC_C_ENUM_BF_UNSIGNED | |
c149cc37 | 796 | |
6af8c740 KG |
797 | AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \ |
798 | sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \ | |
a15135c9 | 799 | fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \ |
1072ec3f | 800 | scandir alphasort gettimeofday mbstowcs wcswidth mmap) |
a81fb89e | 801 | |
39f6c4c8 KW |
802 | if test x$ac_cv_func_mbstowcs = xyes; then |
803 | AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works, | |
804 | [ AC_TRY_RUN([#include <stdlib.h> | |
805 | int main() | |
806 | { | |
807 | mbstowcs(0, "", 0); | |
808 | return 0; | |
809 | }], | |
810 | gcc_cv_func_mbstowcs_works=yes, | |
811 | gcc_cv_func_mbstowcs_works=no, | |
812 | gcc_cv_func_mbstowcs_works=yes)]) | |
813 | if test x$gcc_cv_func_mbstowcs_works = xyes; then | |
814 | AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1, | |
815 | [Define this macro if mbstowcs does not crash when its | |
816 | first argument is NULL.]) | |
817 | fi | |
818 | fi | |
819 | ||
f12bc141 | 820 | AC_CHECK_TYPE(ssize_t, int) |
56f48ce9 | 821 | |
e256b8b6 DA |
822 | # Try to determine the array type of the second argument of getgroups |
823 | # for the target system (int or gid_t). | |
824 | AC_TYPE_GETGROUPS | |
825 | if test "${target}" = "${build}"; then | |
826 | TARGET_GETGROUPS_T=$ac_cv_type_getgroups | |
827 | else | |
828 | case "${target}" in | |
829 | # This condition may need some tweaking. It should include all | |
830 | # targets where the array type of the second argument of getgroups | |
831 | # is int and the type of gid_t is not equivalent to int. | |
832 | *-*-sunos* | *-*-ultrix*) | |
833 | TARGET_GETGROUPS_T=int | |
834 | ;; | |
835 | *) | |
836 | TARGET_GETGROUPS_T=gid_t | |
837 | ;; | |
838 | esac | |
839 | fi | |
840 | AC_SUBST(TARGET_GETGROUPS_T) | |
841 | ||
99e757d5 | 842 | gcc_AC_FUNC_PRINTF_PTR |
1072ec3f | 843 | gcc_AC_FUNC_MMAP_BLACKLIST |
b27d2bd5 MK |
844 | |
845 | case "${host}" in | |
846 | *-*-uwin*) | |
34fa3e7d MM |
847 | AC_MSG_ERROR([ |
848 | *** UWIN may not be used as a host platform because | |
849 | *** linking with posix.dll is not allowed by the GNU GPL]) | |
b27d2bd5 | 850 | ;; |
ee262b6f DR |
851 | *-*-*vms*) |
852 | # Under VMS, vfork works very different than on Unix. The standard test | |
853 | # won't work, and it isn't easily adaptable. It makes more sense to | |
854 | # just force it. | |
855 | ac_cv_func_vfork_works=yes | |
856 | ;; | |
b27d2bd5 | 857 | esac |
c375c43b | 858 | AC_FUNC_VFORK |
f1b54f9b | 859 | |
f91abfce TT |
860 | AM_ICONV |
861 | ||
86cf1cbd KG |
862 | # We will need to find libiberty.h and ansidecl.h |
863 | saved_CFLAGS="$CFLAGS" | |
864 | CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" | |
8e944909 | 865 | gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \ |
3b681e9d | 866 | strsignal putc_unlocked fputs_unlocked fwrite_unlocked \ |
a7475ab1 | 867 | fprintf_unlocked strstr errno vasprintf \ |
c1800ec8 | 868 | malloc realloc calloc free basename getopt clock, , ,[ |
d02af173 | 869 | #include "ansidecl.h" |
86cf1cbd | 870 | #include "system.h"]) |
c5c76735 | 871 | |
f31e826b | 872 | gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ |
d02af173 | 873 | #include "ansidecl.h" |
86cf1cbd | 874 | #include "system.h" |
d2cabf16 KG |
875 | #ifdef HAVE_SYS_RESOURCE_H |
876 | #include <sys/resource.h> | |
877 | #endif | |
878 | ]) | |
879 | ||
b2522d2b HPN |
880 | AC_TRY_COMPILE([ |
881 | #include "ansidecl.h" | |
882 | #include "system.h" | |
883 | #ifdef HAVE_SYS_RESOURCE_H | |
884 | #include <sys/resource.h> | |
885 | #endif | |
886 | ],[rlim_t l = 0;],,[AC_DEFINE([rlim_t],[long], | |
887 | [Define to \`long' if <sys/resource.h> doesn't define.])]) | |
888 | ||
351df804 KG |
889 | gcc_AC_CHECK_DECLS(ldgetname, , ,[ |
890 | #include "ansidecl.h" | |
891 | #include "system.h" | |
892 | #ifdef HAVE_LDFCN_H | |
893 | #include <ldfcn.h> | |
894 | #endif | |
895 | ]) | |
896 | ||
c1800ec8 ZW |
897 | gcc_AC_CHECK_DECLS(times, , ,[ |
898 | #include "ansidecl.h" | |
899 | #include "system.h" | |
900 | #ifdef HAVE_SYS_TIMES_H | |
901 | #include <sys/times.h> | |
902 | #endif | |
903 | ]) | |
904 | ||
905 | # More time-related stuff. | |
906 | AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ | |
907 | AC_TRY_COMPILE([ | |
908 | #include "ansidecl.h" | |
909 | #include "system.h" | |
910 | #ifdef HAVE_SYS_TIMES_H | |
911 | #include <sys/times.h> | |
912 | #endif | |
913 | ], [struct tms tms;], ac_cv_struct_tms=yes, ac_cv_struct_tms=no)]) | |
914 | if test $ac_cv_struct_tms = yes; then | |
915 | AC_DEFINE(HAVE_STRUCT_TMS, 1, | |
916 | [Define if <sys/times.h> defines struct tms.]) | |
917 | fi | |
918 | ||
919 | # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. | |
920 | # revisit after autoconf 2.50. | |
921 | AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ | |
922 | AC_TRY_COMPILE([ | |
923 | #include "ansidecl.h" | |
924 | #include "system.h" | |
925 | ], [clock_t x;], gcc_cv_type_clock_t=yes, gcc_cv_type_clock_t=no)]) | |
926 | if test $gcc_cv_type_clock_t = yes; then | |
927 | AC_DEFINE(HAVE_CLOCK_T, 1, | |
928 | [Define if <time.h> defines clock_t.]) | |
929 | fi | |
930 | ||
a12b5bd9 ZW |
931 | AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar, |
932 | [AC_TRY_COMPILE([ | |
933 | #include "ansidecl.h" | |
934 | #include "system.h" | |
935 | ], | |
936 | [if ((uchar *)0) return 0; | |
937 | if (sizeof(uchar)) return 0;], | |
938 | ac_cv_type_uchar=yes, ac_cv_type_uchar=no)]) | |
939 | if test $ac_cv_type_uchar = yes; then | |
940 | AC_DEFINE(HAVE_UCHAR, 1, | |
941 | [Define if <sys/types.h> defines \`uchar'.]) | |
942 | fi | |
943 | ||
86cf1cbd KG |
944 | # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. |
945 | CFLAGS="$saved_CFLAGS" | |
946 | ||
eb70d86d AS |
947 | gcc_AC_INITFINI_ARRAY |
948 | ||
75923b2f | 949 | # mkdir takes a single argument on some systems. |
99e757d5 | 950 | gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG |
75923b2f | 951 | |
46f18e7b RK |
952 | # File extensions |
953 | manext='.1' | |
954 | objext='.o' | |
46f18e7b RK |
955 | AC_SUBST(manext) |
956 | AC_SUBST(objext) | |
46f18e7b | 957 | |
4977bab6 ZW |
958 | # With Setjmp/Longjmp based exception handling. |
959 | AC_ARG_ENABLE(sjlj-exceptions, | |
960 | [ --enable-sjlj-exceptions | |
961 | arrange to use setjmp/longjmp exception handling], | |
962 | [sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` | |
963 | AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, | |
964 | [Define 0/1 to force the choice for exception handling model.])]) | |
965 | ||
966 | AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no) | |
967 | # Use libunwind based exception handling. | |
968 | AC_ARG_ENABLE(libunwind-exceptions, | |
969 | [ --enable-libunwind-exceptions force use libunwind for exceptions], | |
970 | use_libunwind_exceptions=$enableval, | |
971 | use_libunwind_exceptions=$use_libunwind_default) | |
972 | if test x"$use_libunwind_exceptions" = xyes; then | |
973 | AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1, | |
974 | [Define if gcc should use -lunwind.]) | |
975 | fi | |
976 | ||
34a86c2b NN |
977 | # -------------------------------------------------------- |
978 | # Build, host, and target specific configuration fragments | |
979 | # -------------------------------------------------------- | |
980 | ||
ef69da62 | 981 | target_gtfiles= |
46f18e7b | 982 | build_xm_file= |
61536478 | 983 | build_xm_defines= |
46f18e7b RK |
984 | build_install_headers_dir=install-headers-tar |
985 | build_exeext= | |
986 | host_xm_file= | |
61536478 | 987 | host_xm_defines= |
46f18e7b RK |
988 | host_xmake_file= |
989 | host_truncate_target= | |
6e26218f | 990 | host_exeext= |
46f18e7b RK |
991 | |
992 | # Decode the host machine, then the target machine. | |
993 | # For the host machine, we save the xm_file variable as host_xm_file; | |
994 | # then we decode the target machine and forget everything else | |
995 | # that came from the host machine. | |
996 | for machine in $build $host $target; do | |
61ed06c3 | 997 | . ${srcdir}/config.gcc |
46f18e7b RK |
998 | done |
999 | ||
1000 | extra_objs="${host_extra_objs} ${extra_objs}" | |
1001 | ||
1002 | # Default the target-machine variables that were not explicitly set. | |
75bffa71 | 1003 | if test x"$tm_file" = x |
46f18e7b RK |
1004 | then tm_file=$cpu_type/$cpu_type.h; fi |
1005 | ||
6b2adea9 | 1006 | if test x"$extra_headers" = x |
46f18e7b RK |
1007 | then extra_headers=; fi |
1008 | ||
75bffa71 | 1009 | if test x$md_file = x |
e98e406f | 1010 | then md_file=$cpu_type/$cpu_type.md; fi |
46f18e7b | 1011 | |
75bffa71 | 1012 | if test x$out_file = x |
46f18e7b RK |
1013 | then out_file=$cpu_type/$cpu_type.c; fi |
1014 | ||
75bffa71 | 1015 | if test x"$tmake_file" = x |
46f18e7b RK |
1016 | then tmake_file=$cpu_type/t-$cpu_type |
1017 | fi | |
1018 | ||
90e6a802 | 1019 | if test x"$dwarf2" = xyes |
756ee602 | 1020 | then tm_file="$tm_file tm-dwarf2.h" |
90e6a802 RL |
1021 | fi |
1022 | ||
46f18e7b | 1023 | # Say what files are being used for the output code and MD file. |
11642c3a | 1024 | echo "Using \`$srcdir/config/$out_file' for machine-specific logic." |
46f18e7b RK |
1025 | echo "Using \`$srcdir/config/$md_file' as machine description file." |
1026 | ||
11642c3a | 1027 | # If any of the xm_file variables contain nonexistent files, warn |
4dc0535b ZW |
1028 | # about them and drop them. |
1029 | ||
11642c3a ZW |
1030 | bx= |
1031 | for x in $build_xm_file; do | |
1032 | if test -f $srcdir/config/$x | |
1033 | then bx="$bx $x" | |
11642c3a ZW |
1034 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1035 | fi | |
1036 | done | |
1037 | build_xm_file="$bx" | |
1038 | ||
1039 | hx= | |
1040 | for x in $host_xm_file; do | |
1041 | if test -f $srcdir/config/$x | |
1042 | then hx="$hx $x" | |
11642c3a ZW |
1043 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1044 | fi | |
1045 | done | |
1046 | host_xm_file="$hx" | |
1047 | ||
1048 | tx= | |
1049 | for x in $xm_file; do | |
1050 | if test -f $srcdir/config/$x | |
1051 | then tx="$tx $x" | |
11642c3a ZW |
1052 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1053 | fi | |
1054 | done | |
1055 | xm_file="$tx" | |
1056 | ||
46f18e7b RK |
1057 | count=a |
1058 | for f in $tm_file; do | |
1059 | count=${count}x | |
1060 | done | |
75bffa71 | 1061 | if test $count = ax; then |
46f18e7b RK |
1062 | echo "Using \`$srcdir/config/$tm_file' as target machine macro file." |
1063 | else | |
1064 | echo "Using the following target machine macro files:" | |
1065 | for f in $tm_file; do | |
1066 | echo " $srcdir/config/$f" | |
1067 | done | |
1068 | fi | |
1069 | ||
4977bab6 ZW |
1070 | if test x$need_64bit_hwint = xyes; then |
1071 | AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1, | |
1072 | [Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).]) | |
1073 | fi | |
1074 | ||
46f18e7b RK |
1075 | count=a |
1076 | for f in $host_xm_file; do | |
1077 | count=${count}x | |
1078 | done | |
11642c3a ZW |
1079 | if test $count = a; then |
1080 | : | |
1081 | elif test $count = ax; then | |
46f18e7b RK |
1082 | echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." |
1083 | else | |
1084 | echo "Using the following host machine macro files:" | |
1085 | for f in $host_xm_file; do | |
1086 | echo " $srcdir/config/$f" | |
1087 | done | |
1088 | fi | |
476d9098 | 1089 | echo "Using ${out_host_hook_obj} for host machine hooks." |
46f18e7b | 1090 | |
75bffa71 | 1091 | if test "$host_xm_file" != "$build_xm_file"; then |
46f18e7b RK |
1092 | count=a |
1093 | for f in $build_xm_file; do | |
1094 | count=${count}x | |
1095 | done | |
11642c3a ZW |
1096 | if test $count = a; then |
1097 | : | |
1098 | elif test $count = ax; then | |
46f18e7b RK |
1099 | echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." |
1100 | else | |
1101 | echo "Using the following build machine macro files:" | |
1102 | for f in $build_xm_file; do | |
1103 | echo " $srcdir/config/$f" | |
1104 | done | |
1105 | fi | |
1106 | fi | |
1107 | ||
75bffa71 ILT |
1108 | if test x$thread_file = x; then |
1109 | if test x$target_thread_file != x; then | |
a851212a JW |
1110 | thread_file=$target_thread_file |
1111 | else | |
1112 | thread_file='single' | |
1113 | fi | |
46f18e7b | 1114 | fi |
46f18e7b | 1115 | |
2121a768 JT |
1116 | if test x$enable___cxa_atexit = xyes || \ |
1117 | test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then | |
1118 | AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1, | |
1119 | [Define if you want to use __cxa_atexit, rather than atexit, to | |
1120 | register C++ destructors for local statics and global objects. | |
1121 | This is essential for fully standards-compliant handling of | |
1122 | destructors, but requires __cxa_atexit in libc.]) | |
1123 | fi | |
1124 | ||
a5381466 | 1125 | # Look for a file containing extra machine modes. |
1c0ca89d ZW |
1126 | if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then |
1127 | extra_modes_file='$(srcdir)'/config/${extra_modes} | |
a5381466 | 1128 | AC_SUBST(extra_modes_file) |
1c0ca89d | 1129 | AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "$extra_modes", |
a5381466 ZW |
1130 | [Define to the name of a file containing a list of extra machine modes |
1131 | for this architecture.]) | |
1132 | AC_DEFINE(EXTRA_CC_MODES, 1, | |
1133 | [Define if the target architecture needs extra machine modes to represent | |
1134 | the results of comparisons.]) | |
1135 | fi | |
1136 | ||
b7cb92ad | 1137 | # auto-host.h is the file containing items generated by autoconf and is |
e9a25f70 | 1138 | # the first file included by config.h. |
4977bab6 | 1139 | # If host=build, it is correct to have bconfig include auto-host.h |
db81d74a RH |
1140 | # as well. If host!=build, we are in error and need to do more |
1141 | # work to find out the build config parameters. | |
75bffa71 | 1142 | if test x$host = x$build |
db81d74a | 1143 | then |
eaf4e618 | 1144 | build_auto=auto-host.h |
06f0b04c | 1145 | FORBUILD=.. |
b7cb92ad JL |
1146 | else |
1147 | # We create a subdir, then run autoconf in the subdir. | |
1148 | # To prevent recursion we set host and build for the new | |
1149 | # invocation of configure to the build for this invocation | |
1150 | # of configure. | |
1151 | tempdir=build.$$ | |
1152 | rm -rf $tempdir | |
1153 | mkdir $tempdir | |
1154 | cd $tempdir | |
1155 | case ${srcdir} in | |
b86ecfa9 | 1156 | /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; |
b7cb92ad JL |
1157 | *) realsrcdir=../${srcdir};; |
1158 | esac | |
d920e825 L |
1159 | saved_CFLAGS="${CFLAGS}" |
1160 | CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ | |
1161 | ${realsrcdir}/configure \ | |
534d0cc0 | 1162 | --target=$target_alias --host=$build_alias --build=$build_alias |
d920e825 | 1163 | CFLAGS="${saved_CFLAGS}" |
b7cb92ad JL |
1164 | |
1165 | # We just finished tests for the build machine, so rename | |
1166 | # the file auto-build.h in the gcc directory. | |
1167 | mv auto-host.h ../auto-build.h | |
1168 | cd .. | |
1169 | rm -rf $tempdir | |
eaf4e618 | 1170 | build_auto=auto-build.h |
61138bb6 | 1171 | FORBUILD=../build-$build_alias |
db81d74a | 1172 | fi |
06f0b04c | 1173 | AC_SUBST(FORBUILD) |
db81d74a | 1174 | |
eaf4e618 | 1175 | tm_file="${tm_file} defaults.h" |
4977bab6 ZW |
1176 | tm_p_file="${tm_p_file} tm-preds.h" |
1177 | host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" | |
1178 | build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" | |
49691411 | 1179 | # We don't want ansidecl.h in target files, write code there in ISO/GNU C. |
b4862477 KG |
1180 | # put this back in temporarily. |
1181 | xm_file="ansidecl.h ${xm_file}" | |
0056a9b5 | 1182 | |
34a86c2b NN |
1183 | # -------- |
1184 | # UNSORTED | |
1185 | # -------- | |
1186 | ||
46f18e7b | 1187 | # Truncate the target if necessary |
75bffa71 | 1188 | if test x$host_truncate_target != x; then |
46f18e7b RK |
1189 | target=`echo $target | sed -e 's/\(..............\).*/\1/'` |
1190 | fi | |
1191 | ||
f1943b77 | 1192 | # Get the version trigger filename from the toplevel |
75bffa71 | 1193 | if test "${with_gcc_version_trigger+set}" = set; then |
f1943b77 MH |
1194 | gcc_version_trigger=$with_gcc_version_trigger |
1195 | else | |
1196 | gcc_version_trigger=${srcdir}/version.c | |
1197 | fi | |
75bffa71 | 1198 | changequote(,)dnl |
022dae81 | 1199 | gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'` |
8763704d | 1200 | gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` |
cc1e60ea JM |
1201 | |
1202 | # Compile in configure arguments. | |
8105825d | 1203 | if test -f configargs.h ; then |
cc1e60ea | 1204 | # Being re-configured. |
022dae81 | 1205 | gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` |
cc1e60ea JM |
1206 | gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" |
1207 | else | |
1208 | gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" | |
1209 | fi | |
1210 | cat > configargs.h <<EOF | |
1211 | /* Generated automatically. */ | |
1212 | static const char configuration_arguments[] = "$gcc_config_arguments"; | |
a6687d2b | 1213 | static const char thread_model[] = "$thread_file"; |
7816bea0 DJ |
1214 | |
1215 | static const struct { | |
1216 | const char *name, *value; | |
1217 | } configure_default_options[] = $configure_default_options; | |
cc1e60ea | 1218 | EOF |
75bffa71 | 1219 | changequote([,])dnl |
46f18e7b | 1220 | |
ab87f8c8 JL |
1221 | # Internationalization |
1222 | PACKAGE=gcc | |
1223 | VERSION="$gcc_version" | |
ab87f8c8 JL |
1224 | AC_SUBST(PACKAGE) |
1225 | AC_SUBST(VERSION) | |
1226 | ||
dc6746e7 | 1227 | # Enable NLS support by default |
ab87f8c8 | 1228 | AC_ARG_ENABLE(nls, |
dc6746e7 PT |
1229 | [ --enable-nls use Native Language Support (default)], |
1230 | , enable_nls=yes) | |
1231 | ||
1232 | # if cross compiling, disable NLS support. | |
1233 | # It's not worth the trouble, at least for now. | |
1234 | ||
063a4b85 | 1235 | if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then |
dc6746e7 PT |
1236 | AC_MSG_WARN(Disabling NLS support for canadian cross compiler.) |
1237 | enable_nls=no | |
1238 | fi | |
ab87f8c8 JL |
1239 | |
1240 | AM_GNU_GETTEXT | |
ab87f8c8 | 1241 | |
f4ab28e3 MK |
1242 | # Windows32 Registry support for specifying GCC installation paths. |
1243 | AC_ARG_ENABLE(win32-registry, | |
1244 | [ --disable-win32-registry | |
e8bec136 RO |
1245 | disable lookup of installation paths in the |
1246 | Registry on Windows hosts | |
1247 | --enable-win32-registry enable registry lookup (default) | |
f4ab28e3 | 1248 | --enable-win32-registry=KEY |
e8bec136 RO |
1249 | use KEY instead of GCC version as the last portion |
1250 | of the registry key],,) | |
4e70264f ZW |
1251 | case $host_os in |
1252 | win32 | pe | cygwin* | mingw32* | uwin*) | |
f4ab28e3 | 1253 | AC_MSG_CHECKING(whether windows registry support is requested) |
9dd53f2c | 1254 | if test "x$enable_win32_registry" != xno; then |
119d24d1 KG |
1255 | AC_DEFINE(ENABLE_WIN32_REGISTRY, 1, |
1256 | [Define to 1 if installation paths should be looked up in Windows32 | |
91029a29 | 1257 | Registry. Ignored on non windows32 hosts.]) |
f4ab28e3 | 1258 | AC_MSG_RESULT(yes) |
4e70264f | 1259 | AC_SEARCH_LIBS(RegOpenKeyExA, advapi32) |
f4ab28e3 MK |
1260 | else |
1261 | AC_MSG_RESULT(no) | |
1262 | fi | |
1263 | ||
1264 | # Check if user specified a different registry key. | |
9dd53f2c | 1265 | case "x${enable_win32_registry}" in |
f4ab28e3 MK |
1266 | x | xyes) |
1267 | # default. | |
1268 | gcc_cv_win32_registry_key="$VERSION" | |
1269 | ;; | |
1270 | xno) | |
1271 | # no registry lookup. | |
1272 | gcc_cv_win32_registry_key='' | |
1273 | ;; | |
1274 | *) | |
1275 | # user-specified key. | |
1276 | gcc_cv_win32_registry_key="$enable_win32_registry" | |
1277 | ;; | |
1278 | esac | |
1279 | ||
9dd53f2c | 1280 | if test "x$enable_win32_registry" != xno; then |
f4ab28e3 | 1281 | AC_MSG_CHECKING(registry key on windows hosts) |
119d24d1 KG |
1282 | AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$gcc_cv_win32_registry_key", |
1283 | [Define to be the last portion of registry key on windows hosts.]) | |
f4ab28e3 MK |
1284 | AC_MSG_RESULT($gcc_cv_win32_registry_key) |
1285 | fi | |
4e70264f ZW |
1286 | ;; |
1287 | esac | |
f4ab28e3 | 1288 | |
7fa10b25 | 1289 | # Get an absolute path to the GCC top-level source directory |
1e6347d8 | 1290 | holddir=`${PWDCMD-pwd}` |
7fa10b25 | 1291 | cd $srcdir |
1e6347d8 | 1292 | topdir=`${PWDCMD-pwd}` |
7fa10b25 RK |
1293 | cd $holddir |
1294 | ||
af5e4ada | 1295 | # Conditionalize the makefile for this host machine. |
94f42018 DE |
1296 | # Make-host contains the concatenation of all host makefile fragments |
1297 | # [there can be more than one]. This file is built by configure.frag. | |
1298 | host_overrides=Make-host | |
af5e4ada | 1299 | dep_host_xmake_file= |
94f42018 DE |
1300 | for f in .. ${host_xmake_file} |
1301 | do | |
75bffa71 | 1302 | if test -f ${srcdir}/config/$f |
94f42018 DE |
1303 | then |
1304 | dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f" | |
1305 | fi | |
1306 | done | |
46f18e7b | 1307 | |
af5e4ada | 1308 | # Conditionalize the makefile for this target machine. |
94f42018 DE |
1309 | # Make-target contains the concatenation of all host makefile fragments |
1310 | # [there can be more than one]. This file is built by configure.frag. | |
1311 | target_overrides=Make-target | |
af5e4ada | 1312 | dep_tmake_file= |
94f42018 DE |
1313 | for f in .. ${tmake_file} |
1314 | do | |
75bffa71 | 1315 | if test -f ${srcdir}/config/$f |
94f42018 DE |
1316 | then |
1317 | dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f" | |
1318 | fi | |
1319 | done | |
5891b37d | 1320 | |
34a86c2b NN |
1321 | symbolic_link='ln -s' |
1322 | ||
af5e4ada DE |
1323 | # If the host doesn't support symlinks, modify CC in |
1324 | # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works. | |
1325 | # Otherwise, we can use "CC=$(CC)". | |
1326 | rm -f symtest.tem | |
61536478 | 1327 | if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null |
af5e4ada DE |
1328 | then |
1329 | cc_set_by_configure="\$(CC)" | |
5aa82ace | 1330 | quoted_cc_set_by_configure="\$(CC)" |
af5e4ada | 1331 | stage_prefix_set_by_configure="\$(STAGE_PREFIX)" |
596151e1 | 1332 | quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)" |
af5e4ada | 1333 | else |
61536478 JL |
1334 | rm -f symtest.tem |
1335 | if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null | |
1336 | then | |
1337 | symbolic_link="cp -p" | |
1338 | else | |
1339 | symbolic_link="cp" | |
1340 | fi | |
af5e4ada | 1341 | cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`" |
5aa82ace | 1342 | quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`" |
af5e4ada | 1343 | stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`" |
596151e1 | 1344 | quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`" |
af5e4ada DE |
1345 | fi |
1346 | rm -f symtest.tem | |
5891b37d | 1347 | |
af5e4ada | 1348 | out_object_file=`basename $out_file .c`.o |
5891b37d | 1349 | |
af5e4ada DE |
1350 | tm_file_list= |
1351 | for f in $tm_file; do | |
64ccbc99 | 1352 | case $f in |
d02af173 ZW |
1353 | ansidecl.h ) |
1354 | tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;; | |
1355 | defaults.h ) | |
e2500fed | 1356 | tm_file_list="${tm_file_list} \$(srcdir)/$f" ;; |
64ccbc99 KG |
1357 | *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;; |
1358 | esac | |
af5e4ada | 1359 | done |
46f18e7b | 1360 | |
11642c3a ZW |
1361 | tm_p_file_list= |
1362 | for f in $tm_p_file; do | |
4977bab6 ZW |
1363 | case $f in |
1364 | tm-preds.h ) | |
1365 | tm_p_file_list="${tm_p_file_list} $f" ;; | |
1366 | *) tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" ;; | |
1367 | esac | |
11642c3a ZW |
1368 | done |
1369 | ||
af5e4ada DE |
1370 | host_xm_file_list= |
1371 | for f in $host_xm_file; do | |
64ccbc99 | 1372 | case $f in |
d02af173 ZW |
1373 | ansidecl.h ) |
1374 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;; | |
e2500fed | 1375 | auto-host.h ) |
64ccbc99 | 1376 | host_xm_file_list="${host_xm_file_list} $f" ;; |
e2500fed GK |
1377 | defaults.h ) |
1378 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;; | |
64ccbc99 KG |
1379 | *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;; |
1380 | esac | |
af5e4ada DE |
1381 | done |
1382 | ||
1383 | build_xm_file_list= | |
1384 | for f in $build_xm_file; do | |
64ccbc99 | 1385 | case $f in |
d02af173 ZW |
1386 | ansidecl.h ) |
1387 | build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;; | |
e2500fed | 1388 | auto-build.h | auto-host.h ) |
64ccbc99 | 1389 | build_xm_file_list="${build_xm_file_list} $f" ;; |
e2500fed GK |
1390 | defaults.h ) |
1391 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;; | |
64ccbc99 KG |
1392 | *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;; |
1393 | esac | |
af5e4ada | 1394 | done |
46f18e7b | 1395 | |
a078a589 ZW |
1396 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. |
1397 | # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR. | |
1398 | CROSS= AC_SUBST(CROSS) | |
1399 | ALL=all.internal AC_SUBST(ALL) | |
1400 | SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR) | |
75bffa71 | 1401 | if test x$host != x$target |
af5e4ada | 1402 | then |
a078a589 ZW |
1403 | CROSS="-DCROSS_COMPILE" |
1404 | ALL=all.cross | |
1405 | SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' | |
343f59d9 AM |
1406 | case "$host","$target" in |
1407 | i?86-*-*,x86_64-*-* \ | |
1408 | | powerpc*-*-*,powerpc64*-*-*) | |
1409 | CROSS="$CROSS -DNATIVE_CROSS" ;; | |
1410 | esac | |
7a615b25 AO |
1411 | elif test "x$TARGET_SYSTEM_ROOT" != x; then |
1412 | # This is just $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR) | |
1413 | SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' | |
af5e4ada | 1414 | fi |
46f18e7b | 1415 | |
b39d221a EC |
1416 | # If this is a cross-compiler that does not |
1417 | # have its own set of headers then define | |
1418 | # inhibit_libc | |
1419 | ||
dc06db20 R |
1420 | # If this is using newlib, without having the headers available now, |
1421 | # then define inhibit_libc in LIBGCC2_CFLAGS. | |
fecd6201 ZW |
1422 | # This prevents libgcc2 from containing any code which requires libc |
1423 | # support. | |
b39d221a | 1424 | inhibit_libc= |
dc06db20 R |
1425 | if { { test x$host != x$target && test "x$with_sysroot" = x ; } || |
1426 | test x$with_newlib = xyes ; } && | |
1427 | test "x$with_headers" = x ; then | |
b39d221a | 1428 | inhibit_libc=-Dinhibit_libc |
b39d221a EC |
1429 | fi |
1430 | AC_SUBST(inhibit_libc) | |
1431 | ||
a078a589 ZW |
1432 | # When building gcc with a cross-compiler, we need to adjust things so |
1433 | # that the generator programs are still built with the native compiler. | |
1434 | # Also, we cannot run fixincludes or fix-header. | |
a078a589 ZW |
1435 | |
1436 | # These are the normal (build=host) settings: | |
5c35940c NN |
1437 | BUILD_PREFIX= AC_SUBST(BUILD_PREFIX) |
1438 | BUILD_PREFIX_1=ignore- AC_SUBST(BUILD_PREFIX_1) | |
4977bab6 ZW |
1439 | BUILD_CC='$(CC)' AC_SUBST(BUILD_CC) |
1440 | BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS) | |
a078a589 ZW |
1441 | |
1442 | STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC) | |
1443 | STMP_FIXPROTO=stmp-fixproto AC_SUBST(STMP_FIXPROTO) | |
1444 | ||
1445 | # And these apply if build != host. | |
75bffa71 | 1446 | if test x$build != x$host |
af5e4ada | 1447 | then |
5c35940c NN |
1448 | BUILD_PREFIX=build- |
1449 | BUILD_PREFIX_1=build- | |
4977bab6 ZW |
1450 | BUILD_CC='$(CC_FOR_BUILD)' |
1451 | BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)' | |
a078a589 | 1452 | |
7a615b25 AO |
1453 | if test "x$TARGET_SYSTEM_ROOT" = x; then |
1454 | STMP_FIXINC= | |
1455 | STMP_FIXPROTO= | |
1456 | fi | |
af5e4ada | 1457 | fi |
46f18e7b | 1458 | |
ae3a15bb DE |
1459 | # Expand extra_headers to include complete path. |
1460 | # This substitutes for lots of t-* files. | |
1461 | extra_headers_list= | |
75bffa71 | 1462 | if test "x$extra_headers" = x |
ae3a15bb DE |
1463 | then true |
1464 | else | |
29f7a208 | 1465 | # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers. |
ae3a15bb DE |
1466 | for file in $extra_headers; |
1467 | do | |
29f7a208 | 1468 | extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}" |
ae3a15bb DE |
1469 | done |
1470 | fi | |
1471 | ||
af5e4ada | 1472 | # Add a definition of USE_COLLECT2 if system wants one. |
34a86c2b NN |
1473 | case $use_collect2 in |
1474 | no) use_collect2= ;; | |
1475 | "") ;; | |
1476 | *) | |
1477 | host_xm_defines="${host_xm_defines} USE_COLLECT2" | |
1478 | xm_defines="${xm_defines} USE_COLLECT2" | |
1479 | ;; | |
1480 | esac | |
af5e4ada | 1481 | |
d869a8c4 NN |
1482 | # Identify the assembler which will work hand-in-glove with the newly |
1483 | # built GCC, so that we can examine its features. This is the assembler | |
1484 | # which will be driven by the driver program. | |
1485 | # | |
1486 | # If build != host, and we aren't building gas in-tree, we identify a | |
1487 | # build->target assembler and hope that it will have the same features | |
1488 | # as the host->target assembler we'll be using. | |
981d4858 | 1489 | AC_MSG_CHECKING(what assembler to use) |
34a86c2b | 1490 | in_tree_gas=no |
9e423e6d | 1491 | gcc_cv_as= |
981d4858 JM |
1492 | gcc_cv_gas_major_version= |
1493 | gcc_cv_gas_minor_version= | |
a2f319ea | 1494 | gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas |
3ccc3a56 AO |
1495 | if test -x "$DEFAULT_ASSEMBLER"; then |
1496 | gcc_cv_as="$DEFAULT_ASSEMBLER" | |
1497 | elif test -x "$AS"; then | |
1498 | gcc_cv_as="$AS" | |
ab339d62 | 1499 | elif test -x as$host_exeext; then |
9e423e6d JW |
1500 | # Build using assembler in the current directory. |
1501 | gcc_cv_as=./as$host_exeext | |
34a86c2b NN |
1502 | elif test -f $gcc_cv_as_gas_srcdir/configure.in \ |
1503 | && test -f ../gas/Makefile; then | |
ad9c4d9f NN |
1504 | # Single tree build which includes gas. |
1505 | in_tree_gas=yes | |
1506 | _gcc_COMPUTE_GAS_VERSION | |
f9c1196a ZW |
1507 | rm -f as$host_exeext |
1508 | $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null | |
981d4858 JM |
1509 | fi |
1510 | ||
534d0cc0 | 1511 | if test "x$gcc_cv_as" = x; then |
779243f7 JL |
1512 | # Search the same directories that the installed compiler will |
1513 | # search. Else we may find the wrong assembler and lose. If we | |
1514 | # do not find a suitable assembler binary, then try the user's | |
1515 | # path. | |
1516 | # | |
1517 | # Also note we have to check MD_EXEC_PREFIX before checking the | |
1518 | # user's path. Unfortunately, there is no good way to get at the | |
1519 | # value of MD_EXEC_PREFIX here. So we do a brute force search | |
1520 | # through all the known MD_EXEC_PREFIX values. Ugh. This needs | |
1521 | # to be fixed as part of the make/configure rewrite too. | |
1522 | ||
1523 | if test "x$exec_prefix" = xNONE; then | |
1524 | if test "x$prefix" = xNONE; then | |
1525 | test_prefix=/usr/local | |
1526 | else | |
1527 | test_prefix=$prefix | |
1528 | fi | |
1529 | else | |
1530 | test_prefix=$exec_prefix | |
1531 | fi | |
1532 | ||
1533 | # If the loop below does not find an assembler, then use whatever | |
1534 | # one we can find in the users's path. | |
1535 | # user's path. | |
55a2ea2a AM |
1536 | if test "x$program_prefix" != xNONE; then |
1537 | gcc_cv_as=${program_prefix}as$host_exeext | |
1538 | else | |
1539 | gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext | |
1540 | fi | |
1541 | ||
1542 | test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \ | |
1543 | $test_prefix/lib/gcc-lib/$target_alias \ | |
1544 | /usr/lib/gcc/$target_alias/$gcc_version \ | |
1545 | /usr/lib/gcc/$target_alias \ | |
1546 | $test_prefix/$target_alias/bin/$target_alias/$gcc_version \ | |
1547 | $test_prefix/$target_alias/bin" | |
1548 | ||
1549 | if test x$host = x$target; then | |
1550 | test_dirs="$test_dirs \ | |
779243f7 JL |
1551 | /usr/libexec \ |
1552 | /usr/ccs/gcc \ | |
1553 | /usr/ccs/bin \ | |
1554 | /udk/usr/ccs/bin \ | |
1555 | /bsd43/usr/lib/cmplrs/cc \ | |
1556 | /usr/cross64/usr/bin \ | |
1557 | /usr/lib/cmplrs/cc \ | |
1558 | /sysv/usr/lib/cmplrs/cc \ | |
1559 | /svr4/usr/lib/cmplrs/cc \ | |
1560 | /usr/bin" | |
55a2ea2a | 1561 | fi |
779243f7 JL |
1562 | |
1563 | for dir in $test_dirs; do | |
55a2ea2a | 1564 | if test -x $dir/as$host_exeext; then |
779243f7 JL |
1565 | gcc_cv_as=$dir/as$host_exeext |
1566 | break; | |
1567 | fi | |
1568 | done | |
9e423e6d | 1569 | fi |
34a86c2b NN |
1570 | case $in_tree_gas in |
1571 | yes) | |
1572 | AC_MSG_RESULT("newly built gas") | |
1573 | ;; | |
1574 | no) | |
1575 | AC_MSG_RESULT($gcc_cv_as) | |
1576 | ;; | |
1577 | esac | |
981d4858 | 1578 | |
d869a8c4 NN |
1579 | # Identify the linker which will work hand-in-glove with the newly |
1580 | # built GCC, so that we can examine its features. This is the linker | |
1581 | # which will be driven by the driver program. | |
1582 | # | |
1583 | # If build != host, and we aren't building gas in-tree, we identify a | |
1584 | # build->target linker and hope that it will have the same features | |
1585 | # as the host->target linker we'll be using. | |
275b60d6 | 1586 | AC_MSG_CHECKING(what linker to use) |
34a86c2b | 1587 | in_tree_ld=no |
275b60d6 JJ |
1588 | gcc_cv_ld= |
1589 | gcc_cv_gld_major_version= | |
1590 | gcc_cv_gld_minor_version= | |
1591 | gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld | |
1592 | gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd | |
1593 | if test -x "$DEFAULT_LINKER"; then | |
1594 | gcc_cv_ld="$DEFAULT_LINKER" | |
1595 | elif test -x "$LD"; then | |
1596 | gcc_cv_ld="$LD" | |
f9c1196a | 1597 | elif test -x collect-ld$host_exeext; then |
275b60d6 | 1598 | # Build using linker in the current directory. |
f9c1196a | 1599 | gcc_cv_ld=./collect-ld$host_exeext |
34a86c2b NN |
1600 | elif test -f $gcc_cv_ld_gld_srcdir/configure.in \ |
1601 | && test -f ../ld/Makefile; then | |
275b60d6 | 1602 | # Single tree build which includes ld. |
34a86c2b | 1603 | in_tree_ld=yes |
275b60d6 JJ |
1604 | for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in |
1605 | do | |
1606 | changequote(,)dnl | |
1607 | gcc_cv_gld_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` | |
1608 | changequote([,])dnl | |
1609 | if test x$gcc_cv_gld_version != x; then | |
1610 | break | |
1611 | fi | |
1612 | done | |
1613 | changequote(,)dnl | |
1614 | gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"` | |
1615 | gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"` | |
1616 | changequote([,])dnl | |
f9c1196a ZW |
1617 | rm -f collect-ld$host_exeext |
1618 | $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext \ | |
1619 | 2>/dev/null | |
275b60d6 JJ |
1620 | fi |
1621 | ||
534d0cc0 | 1622 | if test "x$gcc_cv_ld" = x; then |
275b60d6 JJ |
1623 | # Search the same directories that the installed compiler will |
1624 | # search. Else we may find the wrong linker and lose. If we | |
1625 | # do not find a suitable linker binary, then try the user's | |
1626 | # path. | |
1627 | # | |
1628 | # Also note we have to check MD_EXEC_PREFIX before checking the | |
1629 | # user's path. Unfortunately, there is no good way to get at the | |
1630 | # value of MD_EXEC_PREFIX here. So we do a brute force search | |
1631 | # through all the known MD_EXEC_PREFIX values. Ugh. This needs | |
1632 | # to be fixed as part of the make/configure rewrite too. | |
1633 | ||
1634 | if test "x$exec_prefix" = xNONE; then | |
1635 | if test "x$prefix" = xNONE; then | |
1636 | test_prefix=/usr/local | |
1637 | else | |
1638 | test_prefix=$prefix | |
1639 | fi | |
1640 | else | |
1641 | test_prefix=$exec_prefix | |
1642 | fi | |
1643 | ||
1644 | # If the loop below does not find an linker, then use whatever | |
1645 | # one we can find in the users's path. | |
1646 | # user's path. | |
55a2ea2a AM |
1647 | if test "x$program_prefix" != xNONE; then |
1648 | gcc_cv_ld=${program_prefix}ld$host_exeext | |
1649 | else | |
1650 | gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext | |
1651 | fi | |
1652 | ||
1653 | test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \ | |
1654 | $test_prefix/lib/gcc-lib/$target_alias \ | |
1655 | /usr/lib/gcc/$target_alias/$gcc_version \ | |
1656 | /usr/lib/gcc/$target_alias \ | |
1657 | $test_prefix/$target_alias/bin/$target_alias/$gcc_version \ | |
1658 | $test_prefix/$target_alias/bin" | |
1659 | ||
1660 | if test x$host = x$target; then | |
1661 | test_dirs="$test_dirs \ | |
275b60d6 JJ |
1662 | /usr/libexec \ |
1663 | /usr/ccs/gcc \ | |
1664 | /usr/ccs/bin \ | |
1665 | /udk/usr/ccs/bin \ | |
1666 | /bsd43/usr/lib/cmplrs/cc \ | |
1667 | /usr/cross64/usr/bin \ | |
1668 | /usr/lib/cmplrs/cc \ | |
1669 | /sysv/usr/lib/cmplrs/cc \ | |
1670 | /svr4/usr/lib/cmplrs/cc \ | |
1671 | /usr/bin" | |
55a2ea2a | 1672 | fi |
275b60d6 JJ |
1673 | |
1674 | for dir in $test_dirs; do | |
55a2ea2a | 1675 | if test -x $dir/ld$host_exeext; then |
275b60d6 JJ |
1676 | gcc_cv_ld=$dir/ld$host_exeext |
1677 | break; | |
1678 | fi | |
1679 | done | |
1680 | fi | |
34a86c2b NN |
1681 | case $in_tree_ld in |
1682 | yes) | |
1683 | AC_MSG_RESULT("newly built ld") | |
1684 | ;; | |
1685 | no) | |
1686 | AC_MSG_RESULT($gcc_cv_ld) | |
1687 | ;; | |
1688 | esac | |
275b60d6 | 1689 | |
981d4858 | 1690 | # Figure out what nm we will be using. |
f9c1196a | 1691 | gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils |
981d4858 | 1692 | AC_MSG_CHECKING(what nm to use) |
f9c1196a | 1693 | in_tree_nm=no |
981d4858 JM |
1694 | if test -x nm$host_exeext; then |
1695 | gcc_cv_nm=./nm$host_exeext | |
f9c1196a ZW |
1696 | elif test -f $gcc_cv_binutils_srcdir/configure.in \ |
1697 | && test -f ../binutils/Makefile; then | |
1698 | # Single tree build which includes binutils. | |
1699 | in_tree_nm=yes | |
1700 | gcc_cv_nm=./nm$host_exeext | |
1701 | rm -f nm$host_exeext | |
1702 | $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null | |
534d0cc0 AM |
1703 | elif test "x$program_prefix" != xNONE; then |
1704 | gcc_cv_nm=${program_prefix}nm$host_exeext | |
1705 | else | |
1706 | gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext | |
981d4858 | 1707 | fi |
f9c1196a ZW |
1708 | case $in_tree_nm in |
1709 | yes) AC_MSG_RESULT("newly built nm") ;; | |
1710 | no) AC_MSG_RESULT($gcc_cv_nm) ;; | |
1711 | esac | |
981d4858 | 1712 | |
3cae5780 AS |
1713 | # Figure out what objdump we will be using. |
1714 | AC_MSG_CHECKING(what objdump to use) | |
f9c1196a | 1715 | in_tree_objdump=no |
3cae5780 AS |
1716 | if test -x objdump$host_exeext; then |
1717 | gcc_cv_objdump=./objdump$host_exeext | |
f9c1196a ZW |
1718 | elif test -f $gcc_cv_binutils_srcdir/configure.in \ |
1719 | && test -f ../binutils/Makefile; then | |
1720 | # Single tree build which includes binutils. | |
1721 | in_tree_objdump=yes | |
1722 | gcc_cv_objdump=./objdump$host_exeext | |
1723 | rm -f objdump$host_exeext | |
1724 | $symbolic_link ../binutils/objdump$host_exeext \ | |
1725 | objdump$host_exeext 2>/dev/null | |
534d0cc0 AM |
1726 | elif test "x$program_prefix" != xNONE; then |
1727 | gcc_cv_objdump=${program_prefix}objdump$host_exeext | |
1728 | else | |
f9c1196a ZW |
1729 | gcc_cv_objdump=`echo objdump | \ |
1730 | sed ${program_transform_name}`$host_exeext | |
3cae5780 | 1731 | fi |
f9c1196a ZW |
1732 | case $in_tree_objdump in |
1733 | yes) AC_MSG_RESULT("newly built objdump") ;; | |
1734 | no) AC_MSG_RESULT($gcc_cv_objdump) ;; | |
1735 | esac | |
3cae5780 | 1736 | |
981d4858 JM |
1737 | # Figure out what assembler alignment features are present. |
1738 | AC_MSG_CHECKING(assembler alignment features) | |
9d147085 | 1739 | gcc_cv_as_alignment_features=none |
34a86c2b | 1740 | if test $in_tree_gas = yes; then |
ad9c4d9f NN |
1741 | # Gas version 2.6 and later support for .balign and .p2align. |
1742 | gcc_GAS_VERSION_GTE_IFELSE(2,6,0,[ | |
1743 | gcc_cv_as_alignment_features=".balign and .p2align" | |
1744 | AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN) | |
1745 | ]) | |
1746 | # Gas version 2.8 and later support specifying the maximum | |
1747 | # bytes to skip when using .p2align. | |
1748 | gcc_GAS_VERSION_GTE_IFELSE(2,8,0,[ | |
1749 | gcc_cv_as_alignment_features=".p2align including maximum skip" | |
1750 | AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN) | |
1751 | ]) | |
981d4858 | 1752 | elif test x$gcc_cv_as != x; then |
00ccc16d JL |
1753 | # Check if we have .balign and .p2align |
1754 | echo ".balign 4" > conftest.s | |
1755 | echo ".p2align 2" >> conftest.s | |
1756 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
1757 | gcc_cv_as_alignment_features=".balign and .p2align" | |
1758 | AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN) | |
1759 | fi | |
1760 | rm -f conftest.s conftest.o | |
9e423e6d JW |
1761 | # Check if specifying the maximum bytes to skip when |
1762 | # using .p2align is supported. | |
1763 | echo ".p2align 4,,7" > conftest.s | |
1764 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
1765 | gcc_cv_as_alignment_features=".p2align including maximum skip" | |
1766 | AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN) | |
1767 | fi | |
1768 | rm -f conftest.s conftest.o | |
1769 | fi | |
1770 | AC_MSG_RESULT($gcc_cv_as_alignment_features) | |
1771 | ||
d1accaa3 | 1772 | AC_MSG_CHECKING(assembler subsection support) |
9d147085 | 1773 | gcc_cv_as_subsections=no |
34a86c2b | 1774 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
1775 | gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[ |
1776 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then | |
1777 | gcc_cv_as_subsections="working .subsection -1" | |
1778 | fi | |
1779 | ]) | |
981d4858 | 1780 | elif test x$gcc_cv_as != x; then |
d1accaa3 JJ |
1781 | # Check if we have .subsection |
1782 | echo ".subsection 1" > conftest.s | |
1783 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
1784 | gcc_cv_as_subsections=".subsection" | |
d1accaa3 JJ |
1785 | if test x$gcc_cv_nm != x; then |
1786 | cat > conftest.s <<EOF | |
1787 | conftest_label1: .word 0 | |
1788 | .subsection -1 | |
1789 | conftest_label2: .word 0 | |
1790 | .previous | |
1791 | EOF | |
1792 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
1793 | $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 | |
1794 | $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 | |
1b015bec AO |
1795 | if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then |
1796 | : | |
1797 | else | |
d1accaa3 | 1798 | gcc_cv_as_subsections="working .subsection -1" |
d1accaa3 JJ |
1799 | fi |
1800 | fi | |
1801 | fi | |
1802 | fi | |
1803 | rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 | |
1804 | fi | |
981d4858 JM |
1805 | if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then |
1806 | AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1, | |
1807 | [Define if your assembler supports .subsection and .subsection -1 starts | |
1808 | emitting at the beginning of your section.]) | |
1809 | fi | |
d1accaa3 JJ |
1810 | AC_MSG_RESULT($gcc_cv_as_subsections) |
1811 | ||
12822146 | 1812 | AC_MSG_CHECKING(assembler weak support) |
9d147085 | 1813 | gcc_cv_as_weak=no |
34a86c2b | 1814 | if test $in_tree_gas = yes ; then |
ad9c4d9f | 1815 | gcc_GAS_VERSION_GTE_IFELSE(2,2,0,[ |
981d4858 | 1816 | gcc_cv_as_weak="yes" |
ad9c4d9f | 1817 | ]) |
981d4858 | 1818 | elif test x$gcc_cv_as != x; then |
12822146 JL |
1819 | # Check if we have .weak |
1820 | echo " .weak foobar" > conftest.s | |
1821 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
12822146 JL |
1822 | gcc_cv_as_weak="yes" |
1823 | fi | |
1824 | rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 | |
1825 | fi | |
981d4858 JM |
1826 | if test x"$gcc_cv_as_weak" = xyes; then |
1827 | AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.]) | |
1828 | fi | |
12822146 JL |
1829 | AC_MSG_RESULT($gcc_cv_as_weak) |
1830 | ||
6a9c5260 | 1831 | AC_MSG_CHECKING(assembler hidden support) |
9d147085 | 1832 | gcc_cv_as_hidden=no |
34a86c2b | 1833 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
1834 | gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[ |
1835 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then | |
1836 | gcc_cv_as_hidden="yes" | |
1837 | fi | |
1838 | ]) | |
981d4858 | 1839 | elif test x$gcc_cv_as != x; then |
6a9c5260 UD |
1840 | # Check if we have .hidden |
1841 | echo " .hidden foobar" > conftest.s | |
1842 | echo "foobar:" >> conftest.s | |
1843 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
6a9c5260 UD |
1844 | gcc_cv_as_hidden="yes" |
1845 | fi | |
1846 | rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 | |
c72931a6 RH |
1847 | |
1848 | # GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. | |
1849 | # This is irritatingly difficult to feature test for. Look for | |
1850 | # the date string after the version number. | |
1851 | ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1` | |
1852 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
1853 | changequote(,)dnl | |
96ef4bdc MM |
1854 | ld_vers=`echo $ld_ver | sed -n 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\(\|\.[0-9][0-9]*\(\|\.[0-9][0-9]*\)\)\)\([ ].*\|\)$,\1,p'` |
1855 | ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` | |
c72931a6 | 1856 | if test 0"$ld_date" -lt 20020404; then |
4832c9e1 JJ |
1857 | if test -n "$ld_date"; then |
1858 | # If there was date string, but was earlier than 2002-04-04, fail | |
1859 | gcc_cv_as_hidden="no" | |
1860 | elif test -z "$ld_vers"; then | |
1861 | # If there was no date string nor ld version number, something is wrong | |
1862 | gcc_cv_as_hidden="no" | |
1863 | else | |
1864 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` | |
1865 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
1866 | ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'` | |
1867 | test -z "$ld_vers_patch" && ld_vers_patch=0 | |
1868 | if test "$ld_vers_major" -lt 2; then | |
1869 | gcc_cv_as_hidden="no" | |
1870 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then | |
1871 | gcc_cv_as_hidden="no" | |
1872 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 \ | |
1873 | -a "$ld_vers_patch" -eq 0; then | |
1874 | gcc_cv_as_hidden="no" | |
1875 | fi | |
1876 | fi | |
c72931a6 | 1877 | fi |
4832c9e1 | 1878 | changequote([,])dnl |
c72931a6 | 1879 | fi |
6a9c5260 | 1880 | fi |
789b7de5 | 1881 | case "$target" in |
027faee7 | 1882 | mips-sgi-irix6*) |
789b7de5 RO |
1883 | if test x"$gnu_ld_flag" = x"no"; then |
1884 | # Even if using gas with .hidden support, the resulting object files | |
027faee7 AO |
1885 | # cannot be linked with the IRIX 6 O32 linker. With the N32 and |
1886 | # N64 linkers, the problem is that the linker refuses to accept | |
1887 | # -call_shared (passed by default to the linker) and -r (used to | |
1888 | # link the object file generated without .hidden directives with | |
1889 | # one that hides symbols), so we also lose. | |
6d07784a | 1890 | gcc_cv_as_hidden=no |
789b7de5 RO |
1891 | fi |
1892 | ;; | |
1893 | esac | |
6d07784a RO |
1894 | if test x"$gcc_cv_as_hidden" = xyes; then |
1895 | AC_DEFINE(HAVE_GAS_HIDDEN, 1, | |
1896 | [Define if your assembler supports .hidden.]) | |
1897 | fi | |
1898 | AC_MSG_RESULT($gcc_cv_as_hidden) | |
1899 | libgcc_visibility=$gcc_cv_as_hidden | |
9e944a16 | 1900 | AC_SUBST(libgcc_visibility) |
6a9c5260 | 1901 | |
b7460f24 | 1902 | AC_MSG_CHECKING(assembler leb128 support) |
fbe42b1b | 1903 | gcc_cv_as_leb128=no |
34a86c2b | 1904 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
1905 | gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[ |
1906 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then | |
1907 | gcc_cv_as_leb128="yes" | |
1908 | fi | |
1909 | ]) | |
b7460f24 RH |
1910 | elif test x$gcc_cv_as != x; then |
1911 | # Check if we have .[us]leb128, and support symbol arithmetic with it. | |
1912 | cat > conftest.s <<EOF | |
1913 | .data | |
1914 | .uleb128 L2 - L1 | |
1915 | L1: | |
1916 | .uleb128 1280 | |
1917 | .sleb128 -1010 | |
1918 | L2: | |
1919 | EOF | |
1920 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
78e766a0 RH |
1921 | gcc_cv_as_leb128="yes" |
1922 | ||
1923 | # GAS versions before 2.11 do not support uleb128, | |
1924 | # despite appearing to. | |
1925 | # ??? There exists an elf-specific test that will crash | |
1926 | # the assembler. Perhaps it's better to figure out whether | |
1927 | # arbitrary sections are supported and try the test. | |
1928 | as_ver=`$gcc_cv_as --version 2>/dev/null | head -1` | |
1929 | if echo "$as_ver" | grep GNU > /dev/null; then | |
78e766a0 | 1930 | changequote(,)dnl |
5fed851d | 1931 | as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'` |
0461a052 | 1932 | as_major=`echo $as_ver | sed 's/\..*//'` |
3d399d67 | 1933 | as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'` |
78e766a0 RH |
1934 | changequote([,])dnl |
1935 | if test $as_major -eq 2 -a $as_minor -lt 11; then | |
1936 | gcc_cv_as_leb128="no" | |
1937 | fi | |
fbe42b1b | 1938 | fi |
b7460f24 RH |
1939 | fi |
1940 | rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 | |
1941 | fi | |
1942 | if test x"$gcc_cv_as_leb128" = xyes; then | |
1943 | AC_DEFINE(HAVE_AS_LEB128, 1, | |
1944 | [Define if your assembler supports .uleb128.]) | |
1945 | fi | |
1946 | AC_MSG_RESULT($gcc_cv_as_leb128) | |
1947 | ||
c64688ae RH |
1948 | AC_MSG_CHECKING(assembler eh_frame optimization) |
1949 | gcc_cv_as_eh_frame=no | |
34a86c2b | 1950 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
1951 | gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[ |
1952 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then | |
1953 | gcc_cv_as_eh_frame="yes" | |
1954 | fi | |
1955 | ]) | |
c64688ae RH |
1956 | elif test x$gcc_cv_as != x; then |
1957 | # Check if this is GAS. | |
41948db5 SS |
1958 | as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1` |
1959 | rm -f a.out 2> /dev/null | |
c64688ae RH |
1960 | if echo "$as_ver" | grep GNU > /dev/null; then |
1961 | # Versions up to and including 2.11.0 may mis-optimize | |
1962 | # .eh_frame data. Try something. | |
1963 | cat > conftest.s <<EOF | |
1964 | .text | |
1965 | .LFB1: | |
1966 | .4byte 0 | |
1967 | .L1: | |
1968 | .4byte 0 | |
1969 | .LFE1: | |
1970 | .section .eh_frame,"aw",@progbits | |
1971 | __FRAME_BEGIN__: | |
1972 | .4byte .LECIE1-.LSCIE1 | |
1973 | .LSCIE1: | |
1974 | .4byte 0x0 | |
1975 | .byte 0x1 | |
1976 | .ascii "z\0" | |
1977 | .byte 0x1 | |
1978 | .byte 0x78 | |
1979 | .byte 0x1a | |
1980 | .byte 0x0 | |
1981 | .byte 0x4 | |
1982 | .4byte 1 | |
1983 | .p2align 1 | |
1984 | .LECIE1: | |
1985 | .LSFDE1: | |
1986 | .4byte .LEFDE1-.LASFDE1 | |
1987 | .LASFDE1: | |
1988 | .4byte .LASFDE1-__FRAME_BEGIN__ | |
1989 | .4byte .LFB1 | |
1990 | .4byte .LFE1-.LFB1 | |
1991 | .byte 0x4 | |
1992 | .4byte .LFE1-.LFB1 | |
1993 | .byte 0x4 | |
1994 | .4byte .L1-.LFB1 | |
1995 | .LEFDE1: | |
1996 | EOF | |
01efb963 | 1997 | cat > conftest.lit <<EOF |
c64688ae RH |
1998 | 0000 10000000 00000000 017a0001 781a0004 .........z..x... |
1999 | 0010 01000000 12000000 18000000 00000000 ................ | |
2000 | 0020 08000000 04080000 0044 .........D | |
01efb963 AS |
2001 | EOF |
2002 | cat > conftest.big <<EOF | |
2003 | 0000 00000010 00000000 017a0001 781a0004 .........z..x... | |
2004 | 0010 00000001 00000012 00000018 00000000 ................ | |
2005 | 0020 00000008 04000000 0844 .........D | |
c64688ae RH |
2006 | EOF |
2007 | # If the assembler didn't choke, and we can objdump, | |
2008 | # and we got the correct data, then succeed. | |
2009 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ | |
3cae5780 | 2010 | && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \ |
c64688ae | 2011 | | tail -3 > conftest.got \ |
01efb963 AS |
2012 | && { cmp conftest.lit conftest.got > /dev/null 2>&1 \ |
2013 | || cmp conftest.big conftest.got > /dev/null 2>&1; } | |
c64688ae RH |
2014 | then |
2015 | gcc_cv_as_eh_frame="yes" | |
2016 | else | |
2017 | gcc_cv_as_eh_frame="bad" | |
2018 | if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then | |
2019 | AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1, | |
2020 | [Define if your assembler mis-optimizes .eh_frame data.]) | |
2021 | fi | |
2022 | fi | |
2023 | fi | |
2024 | rm -f conftest.* | |
2025 | fi | |
2026 | AC_MSG_RESULT($gcc_cv_as_eh_frame) | |
2027 | ||
201556f0 JJ |
2028 | AC_MSG_CHECKING(assembler section merging support) |
2029 | gcc_cv_as_shf_merge=no | |
34a86c2b | 2030 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
2031 | gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[ |
2032 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then | |
2033 | gcc_cv_as_shf_merge=yes | |
2034 | fi | |
2035 | ]) | |
201556f0 JJ |
2036 | elif test x$gcc_cv_as != x; then |
2037 | # Check if we support SHF_MERGE sections | |
2038 | echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s | |
a8b7afb9 | 2039 | if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1; then |
201556f0 JJ |
2040 | gcc_cv_as_shf_merge=yes |
2041 | fi | |
2042 | rm -f conftest.s conftest.o | |
2043 | fi | |
2044 | if test x"$gcc_cv_as_shf_merge" = xyes; then | |
2045 | AC_DEFINE(HAVE_GAS_SHF_MERGE, 1, | |
2046 | [Define if your assembler supports marking sections with SHF_MERGE flag.]) | |
2047 | fi | |
2048 | AC_MSG_RESULT($gcc_cv_as_shf_merge) | |
2049 | ||
f996902d RH |
2050 | AC_MSG_CHECKING(assembler thread-local storage support) |
2051 | gcc_cv_as_tls=no | |
2052 | conftest_s= | |
2053 | tls_first_major= | |
2054 | tls_first_minor= | |
9739c90c | 2055 | tls_as_opt= |
f996902d RH |
2056 | case "$target" in |
2057 | changequote(,)dnl | |
6f9b006d RH |
2058 | alpha*-*-*) |
2059 | conftest_s=' | |
2060 | .section ".tdata","awT",@progbits | |
2061 | foo: .long 25 | |
2062 | .text | |
2063 | ldq $27,__tls_get_addr($29) !literal!1 | |
2064 | lda $16,foo($29) !tlsgd!1 | |
2065 | jsr $26,($27),__tls_get_addr !lituse_tlsgd!1 | |
2066 | ldq $27,__tls_get_addr($29) !literal!2 | |
2067 | lda $16,foo($29) !tlsldm!2 | |
2068 | jsr $26,($27),__tls_get_addr !lituse_tlsldm!2 | |
2069 | ldq $1,foo($29) !gotdtprel | |
2070 | ldah $2,foo($29) !dtprelhi | |
2071 | lda $3,foo($2) !dtprello | |
2072 | lda $4,foo($29) !dtprel | |
2073 | ldq $1,foo($29) !gottprel | |
2074 | ldah $2,foo($29) !tprelhi | |
2075 | lda $3,foo($2) !tprello | |
2076 | lda $4,foo($29) !tprel' | |
2077 | tls_first_major=2 | |
2078 | tls_first_minor=13 | |
2079 | ;; | |
f996902d RH |
2080 | i[34567]86-*-*) |
2081 | changequote([,])dnl | |
2082 | conftest_s=' | |
2083 | .section ".tdata","awT",@progbits | |
2084 | foo: .long 25 | |
2085 | .text | |
2086 | movl %gs:0, %eax | |
2087 | leal foo@TLSGD(,%ebx,1), %eax | |
2088 | leal foo@TLSLDM(%ebx), %eax | |
2089 | leal foo@DTPOFF(%eax), %edx | |
2090 | movl foo@GOTTPOFF(%ebx), %eax | |
2091 | subl foo@GOTTPOFF(%ebx), %eax | |
75d38379 JJ |
2092 | addl foo@GOTNTPOFF(%ebx), %eax |
2093 | movl foo@INDNTPOFF, %eax | |
f996902d RH |
2094 | movl $foo@TPOFF, %eax |
2095 | subl $foo@TPOFF, %eax | |
2096 | leal foo@NTPOFF(%ecx), %eax' | |
2097 | tls_first_major=2 | |
75d38379 JJ |
2098 | tls_first_minor=14 |
2099 | ;; | |
2100 | x86_64-*-*) | |
2101 | conftest_s=' | |
2102 | .section ".tdata","awT",@progbits | |
2103 | foo: .long 25 | |
2104 | .text | |
2105 | movq %fs:0, %rax | |
2106 | leaq foo@TLSGD(%rip), %rdi | |
2107 | leaq foo@TLSLD(%rip), %rdi | |
2108 | leaq foo@DTPOFF(%rax), %rdx | |
2109 | movq foo@GOTTPOFF(%rip), %rax | |
2110 | movq $foo@TPOFF, %rax' | |
2111 | tls_first_major=2 | |
2112 | tls_first_minor=14 | |
f996902d | 2113 | ;; |
7b6e506e RH |
2114 | ia64-*-*) |
2115 | conftest_s=' | |
2116 | .section ".tdata","awT",@progbits | |
2117 | foo: data8 25 | |
2118 | .text | |
2119 | addl r16 = @ltoff(@dtpmod(foo#)), gp | |
2120 | addl r17 = @ltoff(@dtprel(foo#)), gp | |
2121 | addl r18 = @ltoff(@tprel(foo#)), gp | |
2122 | addl r19 = @dtprel(foo#), gp | |
2123 | adds r21 = @dtprel(foo#), r13 | |
2124 | movl r23 = @dtprel(foo#) | |
2125 | addl r20 = @tprel(foo#), gp | |
2126 | adds r22 = @tprel(foo#), r13 | |
2127 | movl r24 = @tprel(foo#)' | |
2128 | tls_first_major=2 | |
2129 | tls_first_minor=13 | |
2130 | ;; | |
c4501e62 JJ |
2131 | powerpc-*-*) |
2132 | conftest_s=' | |
2133 | .section ".tdata","awT",@progbits | |
2134 | .align 2 | |
2135 | ld0: .space 4 | |
2136 | ld1: .space 4 | |
2137 | x1: .space 4 | |
2138 | x2: .space 4 | |
2139 | x3: .space 4 | |
2140 | .text | |
2141 | addi 3,31,ld0@got@tlsgd | |
2142 | bl __tls_get_addr | |
2143 | addi 3,31,x1@got@tlsld | |
2144 | bl __tls_get_addr | |
2145 | addi 9,3,x1@dtprel | |
2146 | addis 9,3,x2@dtprel@ha | |
2147 | addi 9,9,x2@dtprel@l | |
2148 | lwz 9,x3@got@tprel(31) | |
2149 | add 9,9,x@tls | |
2150 | addi 9,2,x1@tprel | |
2151 | addis 9,2,x2@tprel@ha | |
2152 | addi 9,9,x2@tprel@l' | |
2153 | tls_first_major=2 | |
2154 | tls_first_minor=14 | |
9739c90c | 2155 | tls_as_opt=-a32 |
c4501e62 JJ |
2156 | ;; |
2157 | powerpc64-*-*) | |
2158 | conftest_s=' | |
2159 | .section ".tdata","awT",@progbits | |
2160 | .align 3 | |
2161 | ld0: .space 8 | |
2162 | ld1: .space 8 | |
2163 | x1: .space 8 | |
2164 | x2: .space 8 | |
2165 | x3: .space 8 | |
2166 | .text | |
2167 | addi 3,2,ld0@got@tlsgd | |
2168 | bl .__tls_get_addr | |
2169 | nop | |
2170 | addi 3,2,ld1@toc | |
2171 | bl .__tls_get_addr | |
2172 | nop | |
2173 | addi 3,2,x1@got@tlsld | |
2174 | bl .__tls_get_addr | |
2175 | nop | |
2176 | addi 9,3,x1@dtprel | |
2177 | bl .__tls_get_addr | |
2178 | nop | |
2179 | addis 9,3,x2@dtprel@ha | |
2180 | addi 9,9,x2@dtprel@l | |
2181 | bl .__tls_get_addr | |
2182 | nop | |
2183 | ld 9,x3@got@dtprel(2) | |
2184 | add 9,9,3 | |
2185 | bl .__tls_get_addr | |
2186 | nop' | |
2187 | tls_first_major=2 | |
2188 | tls_first_minor=14 | |
9739c90c | 2189 | tls_as_opt=-a64 |
c4501e62 | 2190 | ;; |
fd3cd001 UW |
2191 | s390-*-*) |
2192 | conftest_s=' | |
2193 | .section ".tdata","awT",@progbits | |
2194 | foo: .long 25 | |
2195 | .text | |
2196 | .long foo@TLSGD | |
2197 | .long foo@TLSLDM | |
2198 | .long foo@DTPOFF | |
2199 | .long foo@NTPOFF | |
2200 | .long foo@GOTNTPOFF | |
2201 | .long foo@INDNTPOFF | |
2202 | l %r1,foo@GOTNTPOFF(%r12) | |
2203 | l %r1,0(%r1):tls_load:foo | |
2204 | bas %r14,0(%r1,%r13):tls_gdcall:foo | |
2205 | bas %r14,0(%r1,%r13):tls_ldcall:foo' | |
2206 | tls_first_major=2 | |
2207 | tls_first_minor=14 | |
9739c90c | 2208 | tls_as_opt=-m31 |
fd3cd001 UW |
2209 | ;; |
2210 | s390x-*-*) | |
2211 | conftest_s=' | |
2212 | .section ".tdata","awT",@progbits | |
2213 | foo: .long 25 | |
2214 | .text | |
2215 | .quad foo@TLSGD | |
2216 | .quad foo@TLSLDM | |
2217 | .quad foo@DTPOFF | |
2218 | .quad foo@NTPOFF | |
2219 | .quad foo@GOTNTPOFF | |
2220 | lg %r1,foo@GOTNTPOFF(%r12) | |
2221 | larl %r1,foo@INDNTPOFF | |
2222 | brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo | |
2223 | brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' | |
2224 | tls_first_major=2 | |
2225 | tls_first_minor=14 | |
9739c90c | 2226 | tls_as_opt="-m64 -Aesame" |
fd3cd001 | 2227 | ;; |
f996902d RH |
2228 | esac |
2229 | if test -z "$tls_first_major"; then | |
2230 | : | |
34a86c2b | 2231 | elif test $in_tree_gas = yes ; then |
ad9c4d9f | 2232 | gcc_GAS_VERSION_GTE_IFELSE($tls_first_major,$tls_first_minor,0,[ |
f996902d | 2233 | gcc_cv_as_tls=yes |
ad9c4d9f | 2234 | ]) |
f996902d RH |
2235 | elif test x$gcc_cv_as != x; then |
2236 | echo "$conftest_s" > conftest.s | |
9739c90c | 2237 | if $gcc_cv_as $tls_as_opt --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1 |
f996902d RH |
2238 | then |
2239 | gcc_cv_as_tls=yes | |
2240 | fi | |
2241 | rm -f conftest.s conftest.o | |
2242 | fi | |
2243 | if test "$gcc_cv_as_tls" = yes; then | |
2244 | AC_DEFINE(HAVE_AS_TLS, 1, | |
2245 | [Define if your assembler supports thread-local storage.]) | |
2246 | fi | |
2247 | AC_MSG_RESULT($gcc_cv_as_tls) | |
2248 | ||
275b60d6 | 2249 | case "$target" in |
3a37b08e RH |
2250 | # All TARGET_ABI_OSF targets. |
2251 | alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*) | |
2252 | AC_CACHE_CHECK([assembler supports explicit relocations], | |
2253 | gcc_cv_as_explicit_relocs, [ | |
2254 | gcc_cv_as_explicit_relocs=unknown | |
34a86c2b | 2255 | if test $in_tree_gas = yes ; then |
ad9c4d9f | 2256 | gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[ |
3a37b08e | 2257 | gcc_cv_as_explicit_relocs=yes |
ad9c4d9f | 2258 | ]) |
3a37b08e RH |
2259 | elif test x$gcc_cv_as != x; then |
2260 | cat > conftest.s << 'EOF' | |
2261 | .set nomacro | |
2262 | .text | |
2263 | extbl $3, $2, $3 !lituse_bytoff!1 | |
2264 | ldq $2, a($29) !literal!1 | |
2265 | ldq $4, b($29) !literal!2 | |
2266 | ldq_u $3, 0($2) !lituse_base!1 | |
2267 | ldq $27, f($29) !literal!5 | |
2268 | jsr $26, ($27), f !lituse_jsr!5 | |
2269 | ldah $29, 0($26) !gpdisp!3 | |
2270 | lda $0, c($29) !gprel | |
2271 | ldah $1, d($29) !gprelhigh | |
2272 | lda $1, d($1) !gprellow | |
2273 | lda $29, 0($29) !gpdisp!3 | |
2274 | EOF | |
2275 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
2276 | gcc_cv_as_explicit_relocs=yes | |
2277 | else | |
2278 | gcc_cv_as_explicit_relocs=no | |
2279 | fi | |
2280 | rm -f conftest.s conftest.o | |
2281 | fi | |
2282 | ]) | |
2283 | if test "x$gcc_cv_as_explicit_relocs" = xyes; then | |
2284 | AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1, | |
2285 | [Define if your assembler supports explicit relocations.]) | |
2286 | fi | |
2287 | ;; | |
1cb36a98 | 2288 | sparc*-*-*) |
5b68c389 AO |
2289 | AC_CACHE_CHECK([assembler .register pseudo-op support], |
2290 | gcc_cv_as_register_pseudo_op, [ | |
2291 | gcc_cv_as_register_pseudo_op=unknown | |
2292 | if test x$gcc_cv_as != x; then | |
2293 | # Check if we have .register | |
2294 | echo ".register %g2, #scratch" > conftest.s | |
2295 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
1cb36a98 | 2296 | gcc_cv_as_register_pseudo_op=yes |
5b68c389 AO |
2297 | else |
2298 | gcc_cv_as_register_pseudo_op=no | |
2299 | fi | |
2300 | rm -f conftest.s conftest.o | |
1cb36a98 | 2301 | fi |
5b68c389 AO |
2302 | ]) |
2303 | if test "x$gcc_cv_as_register_pseudo_op" = xyes; then | |
119d24d1 KG |
2304 | AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, |
2305 | [Define if your assembler supports .register.]) | |
1cb36a98 | 2306 | fi |
1cb36a98 | 2307 | |
e95b1e6a JJ |
2308 | AC_CACHE_CHECK([assembler supports -relax], |
2309 | gcc_cv_as_relax_opt, [ | |
2310 | gcc_cv_as_relax_opt=unknown | |
2311 | if test x$gcc_cv_as != x; then | |
2312 | # Check if gas supports -relax | |
2313 | echo ".text" > conftest.s | |
2314 | if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then | |
2315 | gcc_cv_as_relax_opt=yes | |
2316 | else | |
2317 | gcc_cv_as_relax_opt=no | |
2318 | fi | |
2319 | rm -f conftest.s conftest.o | |
2320 | fi | |
2321 | ]) | |
2322 | if test "x$gcc_cv_as_relax_opt" = xyes; then | |
2323 | AC_DEFINE(HAVE_AS_RELAX_OPTION, 1, | |
2324 | [Define if your assembler supports -relax option.]) | |
2325 | fi | |
2326 | ||
17e9e88c JJ |
2327 | AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], |
2328 | gcc_cv_as_sparc_ua_pcrel, [ | |
2329 | gcc_cv_as_sparc_ua_pcrel=unknown | |
2330 | if test x$gcc_cv_as != x -a x$gcc_cv_ld != x; then | |
2331 | gcc_cv_as_sparc_ua_pcrel=no | |
2332 | echo ".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo)" > conftest.s | |
cf7b8b0d JJ |
2333 | if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \ |
2334 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then | |
2335 | gcc_cv_as_sparc_ua_pcrel=yes | |
17e9e88c JJ |
2336 | fi |
2337 | rm -f conftest.s conftest.o conftest | |
2338 | fi | |
2339 | ]) | |
2340 | if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then | |
2341 | AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, | |
2342 | [Define if your assembler and linker support unaligned PC relative relocs.]) | |
2343 | fi | |
2344 | ||
cf7b8b0d JJ |
2345 | AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs against hidden symbols], |
2346 | gcc_cv_as_sparc_ua_pcrel_hidden, [ | |
2347 | if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then | |
2348 | gcc_cv_as_sparc_ua_pcrel_hidden=unknown | |
2349 | if test x$gcc_cv_objdump != x; then | |
2350 | gcc_cv_as_sparc_ua_pcrel_hidden=no | |
2351 | echo ".data; .align 4; .byte 0x31; .uaword %r_disp32(foo)" > conftest.s | |
2352 | echo ".byte 0x32, 0x33, 0x34; .global foo; .hidden foo" >> conftest.s | |
2353 | echo "foo: .skip 4" >> conftest.s | |
2354 | if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \ | |
2355 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \ | |
2356 | && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \ | |
2357 | | grep ' 31000000 07323334' > /dev/null 2>&1; then | |
2358 | if $gcc_cv_objdump -R conftest 2> /dev/null \ | |
2359 | | grep 'DISP32' > /dev/null 2>&1; then | |
2360 | : | |
2361 | else | |
2362 | gcc_cv_as_sparc_ua_pcrel_hidden=yes | |
2363 | fi | |
2364 | fi | |
2365 | fi | |
2366 | rm -f conftest.s conftest.o conftest | |
2367 | else | |
2368 | gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel" | |
2369 | fi | |
2370 | ]) | |
2371 | if test "x$gcc_cv_as_sparc_ua_pcrel_hidden" = xyes; then | |
2372 | AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1, | |
2373 | [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.]) | |
2374 | fi | |
2375 | ||
22252625 JJ |
2376 | AC_CACHE_CHECK([for assembler offsetable %lo() support], |
2377 | gcc_cv_as_offsetable_lo10, [ | |
2378 | gcc_cv_as_offsetable_lo10=unknown | |
2379 | if test "x$gcc_cv_as" != x; then | |
2380 | # Check if assembler has offsetable %lo() | |
2381 | echo "or %g1, %lo(ab) + 12, %g1" > conftest.s | |
2382 | echo "or %g1, %lo(ab + 12), %g1" > conftest1.s | |
2383 | if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \ | |
2384 | > /dev/null 2>&1 && | |
2385 | $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \ | |
2386 | > /dev/null 2>&1; then | |
2387 | if cmp conftest.o conftest1.o > /dev/null 2>&1; then | |
5b68c389 | 2388 | gcc_cv_as_offsetable_lo10=no |
22252625 JJ |
2389 | else |
2390 | gcc_cv_as_offsetable_lo10=yes | |
1cb36a98 | 2391 | fi |
22252625 JJ |
2392 | else |
2393 | gcc_cv_as_offsetable_lo10=no | |
5b68c389 | 2394 | fi |
22252625 | 2395 | rm -f conftest.s conftest.o conftest1.s conftest1.o |
1cb36a98 | 2396 | fi |
22252625 JJ |
2397 | ]) |
2398 | if test "x$gcc_cv_as_offsetable_lo10" = xyes; then | |
2399 | AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1, | |
2400 | [Define if your assembler supports offsetable %lo().]) | |
1cb36a98 | 2401 | fi |
cb65112a | 2402 | |
1cb36a98 RH |
2403 | ;; |
2404 | ||
2405 | changequote(,)dnl | |
c307e6dd | 2406 | i[34567]86-*-* | x86_64-*-*) |
1cb36a98 RH |
2407 | changequote([,])dnl |
2408 | AC_MSG_CHECKING(assembler instructions) | |
2409 | gcc_cv_as_instructions= | |
34a86c2b | 2410 | if test $in_tree_gas = yes ; then |
ad9c4d9f | 2411 | gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[ |
981d4858 | 2412 | gcc_cv_as_instructions="filds fists" |
ad9c4d9f | 2413 | ]) |
981d4858 | 2414 | elif test x$gcc_cv_as != x; then |
53b5ce19 JW |
2415 | set "filds fists" "filds mem; fists mem" |
2416 | while test $# -gt 0 | |
2417 | do | |
2418 | echo "$2" > conftest.s | |
2419 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
2420 | gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" " | |
53b5ce19 JW |
2421 | fi |
2422 | shift 2 | |
2423 | done | |
2424 | rm -f conftest.s conftest.o | |
1cb36a98 | 2425 | fi |
981d4858 | 2426 | if test x"$gcc_cv_as_instructions" != x; then |
ee7692d2 | 2427 | AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | sed -e 's/ $//' | tr '[a-z ]' '[A-Z_]'`) |
981d4858 | 2428 | fi |
1cb36a98 | 2429 | AC_MSG_RESULT($gcc_cv_as_instructions) |
f88c65f7 RH |
2430 | |
2431 | AC_MSG_CHECKING(assembler GOTOFF in data directives) | |
2432 | gcc_cv_as_gotoff_in_data=no | |
34a86c2b | 2433 | if test $in_tree_gas = yes ; then |
ad9c4d9f | 2434 | gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[ |
f88c65f7 | 2435 | gcc_cv_as_gotoff_in_data=yes |
ad9c4d9f | 2436 | ]) |
f88c65f7 RH |
2437 | elif test x$gcc_cv_as != x; then |
2438 | cat > conftest.s <<EOF | |
2439 | .text | |
2440 | .L0: | |
2441 | nop | |
2442 | .data | |
2443 | .long .L0@GOTOFF | |
2444 | EOF | |
2445 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
2446 | gcc_cv_as_gotoff_in_data=yes | |
2447 | fi | |
2448 | fi | |
2449 | AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA, | |
2450 | [`if test $gcc_cv_as_gotoff_in_data = yes; then echo 1; else echo 0; fi`], | |
2451 | [Define true if the assembler supports '.long foo@GOTOFF'.]) | |
2452 | AC_MSG_RESULT($gcc_cv_as_gotoff_in_data) | |
1cb36a98 | 2453 | ;; |
ef1ecf87 RH |
2454 | |
2455 | ia64*-*-*) | |
2456 | AC_CACHE_CHECK([assembler supports ltoffx and ldxmov], | |
2457 | gcc_cv_as_ltoffx_ldxmov_relocs, [ | |
2458 | gcc_cv_as_ltoffx_ldxmov_relocs=unknown | |
ad9c4d9f NN |
2459 | if test $in_tree_gas = yes ; then |
2460 | gcc_GAS_VERSION_GTE_IFELSE(2,14,0,[ | |
2461 | gcc_cv_as_ltoffx_ldxmov_relocs=yes | |
2462 | ]) | |
ef1ecf87 RH |
2463 | elif test x$gcc_cv_as != x; then |
2464 | cat > conftest.s << 'EOF' | |
2465 | changequote(,)dnl | |
2466 | .text | |
2467 | addl r15 = @ltoffx(x#), gp | |
2468 | ;; | |
2469 | ld8.mov r16 = [r15], x# | |
2470 | EOF | |
2471 | changequote([,])dnl | |
2472 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
2473 | gcc_cv_as_ltoffx_ldxmov_relocs=yes | |
2474 | else | |
2475 | gcc_cv_as_ltoffx_ldxmov_relocs=no | |
2476 | fi | |
2477 | rm -f conftest.s conftest.o | |
2478 | fi | |
2479 | ]) | |
2480 | if test "x$gcc_cv_as_ltoffx_ldxmov_relocs" = xyes; then | |
2481 | AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1, | |
2482 | [Define if your assembler supports ltoffx and ldxmov relocations.]) | |
2483 | fi | |
2484 | ;; | |
1cb36a98 | 2485 | esac |
53b5ce19 | 2486 | |
9d147085 RH |
2487 | AC_MSG_CHECKING(assembler dwarf2 debug_line support) |
2488 | gcc_cv_as_dwarf2_debug_line=no | |
2489 | # ??? Not all targets support dwarf2 debug_line, even within a version | |
2490 | # of gas. Moreover, we need to emit a valid instruction to trigger any | |
2491 | # info to the output file. So, as supported targets are added to gas 2.11, | |
2492 | # add some instruction here to (also) show we expect this might work. | |
2493 | # ??? Once 2.11 is released, probably need to add first known working | |
2494 | # version to the per-target configury. | |
2495 | case "$target" in | |
80486e06 | 2496 | i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \ |
f8000836 | 2497 | | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-* | xstormy16*-*-*) |
9d147085 RH |
2498 | insn="nop" |
2499 | ;; | |
2500 | ia64*-*-*) | |
2501 | insn="nop 0" | |
2502 | ;; | |
2503 | esac | |
34a86c2b | 2504 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
2505 | gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[ |
2506 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ | |
2507 | && test x"$insn" != x ; then | |
2508 | gcc_cv_as_dwarf2_debug_line="yes" | |
2509 | fi | |
2510 | ]) | |
9d147085 | 2511 | elif test x$gcc_cv_as != x -a x"$insn" != x ; then |
acc187f5 RH |
2512 | echo ' .file 1 "conftest.s"' > conftest.s |
2513 | echo ' .loc 1 3 0' >> conftest.s | |
9d147085 | 2514 | echo " $insn" >> conftest.s |
981975b6 | 2515 | # ??? This fails with non-gnu grep. |
9d147085 RH |
2516 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ |
2517 | && grep debug_line conftest.o > /dev/null 2>&1 ; then | |
981975b6 | 2518 | # The .debug_line file table must be in the exact order that |
eaec9b3d | 2519 | # we specified the files, since these indices are also used |
981975b6 RH |
2520 | # by DW_AT_decl_file. Approximate this test by testing if |
2521 | # the assembler bitches if the same index is assigned twice. | |
2522 | echo ' .file 1 "foo.s"' > conftest.s | |
2523 | echo ' .file 1 "bar.s"' >> conftest.s | |
2524 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 | |
2525 | then | |
2526 | gcc_cv_as_dwarf2_debug_line="no" | |
2527 | else | |
2528 | gcc_cv_as_dwarf2_debug_line="yes" | |
2529 | fi | |
9d147085 RH |
2530 | fi |
2531 | rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 | |
2532 | fi | |
2533 | if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then | |
2534 | AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1, | |
981975b6 | 2535 | [Define if your assembler supports dwarf2 .file/.loc directives, |
eaec9b3d | 2536 | and preserves file table indices exactly as given.]) |
9d147085 RH |
2537 | fi |
2538 | AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line) | |
2539 | ||
5f0e9ea2 GK |
2540 | AC_MSG_CHECKING(assembler --gdwarf2 support) |
2541 | gcc_cv_as_gdwarf2_flag=no | |
34a86c2b | 2542 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
2543 | gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[ |
2544 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ | |
2545 | && test x"$insn" != x ; then | |
2546 | gcc_cv_as_gdwarf2_flag="yes" | |
2547 | fi | |
2548 | ]) | |
5f0e9ea2 GK |
2549 | elif test x$gcc_cv_as != x -a x"$insn" != x ; then |
2550 | echo '' > conftest.s | |
2551 | # ??? This fails with non-gnu grep. | |
2552 | if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1 | |
2553 | then | |
2554 | gcc_cv_as_gdwarf2_flag="yes" | |
2555 | fi | |
2556 | rm -f conftest.s conftest.o | |
2557 | fi | |
2558 | if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then | |
2559 | AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1, | |
2560 | [Define if your assembler supports the --gdwarf2 option.]) | |
2561 | fi | |
2562 | AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag) | |
2563 | ||
2564 | AC_MSG_CHECKING(assembler --gstabs support) | |
2565 | gcc_cv_as_gstabs_flag=no | |
34a86c2b | 2566 | if test $in_tree_gas = yes ; then |
ad9c4d9f NN |
2567 | gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[ |
2568 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ | |
2569 | && test x"$insn" != x ; then | |
2570 | gcc_cv_as_gstabs_flag="yes" | |
2571 | fi | |
2572 | ]) | |
5f0e9ea2 GK |
2573 | elif test x$gcc_cv_as != x -a x"$insn" != x ; then |
2574 | echo '' > conftest.s | |
2575 | # ??? This fails with non-gnu grep. | |
2576 | if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then | |
2577 | gcc_cv_as_gstabs_flag="yes" | |
2578 | fi | |
2579 | rm -f conftest.s conftest.o | |
2580 | fi | |
2581 | if test x"$gcc_cv_as_gstabs_flag" = xyes; then | |
2582 | AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1, | |
2583 | [Define if your assembler supports the --gstabs option.]) | |
2584 | fi | |
2585 | AC_MSG_RESULT($gcc_cv_as_gstabs_flag) | |
2586 | ||
96d0f4dc JJ |
2587 | AC_MSG_CHECKING(linker read-only and read-write section mixing) |
2588 | gcc_cv_ld_ro_rw_mix=unknown | |
34a86c2b | 2589 | if test $in_tree_ld = yes ; then |
96d0f4dc JJ |
2590 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then |
2591 | gcc_cv_ld_ro_rw_mix=read-write | |
2592 | fi | |
2593 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then | |
2594 | echo '.section "myfoosect", "a"' > conftest1.s | |
2595 | echo '.section "myfoosect", "aw"' > conftest2.s | |
2596 | echo '.byte 1' >> conftest2.s | |
2597 | echo '.section "myfoosect", "a"' > conftest3.s | |
2598 | echo '.byte 0' >> conftest3.s | |
6cd656d0 KC |
2599 | if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \ |
2600 | && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
2601 | && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \ | |
96d0f4dc | 2602 | && $gcc_cv_ld -shared -o conftest1.so conftest1.o \ |
c6cc7e13 | 2603 | conftest2.o conftest3.o > /dev/null 2>&1; then |
96d0f4dc | 2604 | gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ |
c6cc7e13 | 2605 | | sed -e '/myfoosect/!d' -e N` |
96d0f4dc JJ |
2606 | if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then |
2607 | if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then | |
2608 | gcc_cv_ld_ro_rw_mix=read-only | |
2609 | else | |
2610 | gcc_cv_ld_ro_rw_mix=read-write | |
2611 | fi | |
2612 | fi | |
2613 | fi | |
2614 | changequote(,)dnl | |
2615 | rm -f conftest.* conftest[123].* | |
2616 | changequote([,])dnl | |
2617 | fi | |
2618 | if test x$gcc_cv_ld_ro_rw_mix = xread-write; then | |
2619 | AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1, | |
2620 | [Define if your linker links a mix of read-only | |
2621 | and read-write sections into a read-write section.]) | |
2622 | fi | |
2623 | AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) | |
2624 | ||
275b60d6 JJ |
2625 | AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support) |
2626 | gcc_cv_ld_eh_frame_hdr=no | |
34a86c2b | 2627 | if test $in_tree_ld = yes ; then |
275b60d6 JJ |
2628 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then |
2629 | gcc_cv_ld_eh_frame_hdr=yes | |
2630 | fi | |
2631 | elif test x$gcc_cv_ld != x; then | |
2632 | # Check if linker supports --eh-frame-hdr option | |
2633 | if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then | |
2634 | gcc_cv_ld_eh_frame_hdr=yes | |
2635 | fi | |
2636 | fi | |
2637 | if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then | |
2638 | AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1, | |
2639 | [Define if your linker supports --eh-frame-hdr option.]) | |
2640 | fi | |
2641 | AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr) | |
2642 | ||
24a4dd31 JJ |
2643 | AC_MSG_CHECKING(linker position independent executable support) |
2644 | gcc_cv_ld_pie=no | |
2645 | if test $in_tree_ld = yes ; then | |
2646 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then | |
2647 | gcc_cv_ld_pie=yes | |
2648 | fi | |
2649 | elif test x$gcc_cv_ld != x; then | |
2650 | # Check if linker supports -pie option | |
2651 | if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then | |
2652 | gcc_cv_ld_pie=yes | |
2653 | fi | |
2654 | fi | |
2655 | if test x"$gcc_cv_ld_pie" = xyes; then | |
2656 | AC_DEFINE(HAVE_LD_PIE, 1, | |
2657 | [Define if your linker supports -pie option.]) | |
2658 | fi | |
2659 | AC_MSG_RESULT($gcc_cv_ld_pie) | |
2660 | ||
4357a6c3 CD |
2661 | # Miscellaneous target-specific checks. |
2662 | case "$target" in | |
2663 | mips*-*-*) | |
2664 | AC_MSG_CHECKING(whether libgloss uses STARTUP directives consistently) | |
2665 | gcc_cv_mips_libgloss_startup=no | |
2666 | gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss | |
2667 | if test "x$exec_prefix" = xNONE; then | |
2668 | if test "x$prefix" = xNONE; then | |
2669 | test_prefix=/usr/local | |
2670 | else | |
2671 | test_prefix=$prefix | |
2672 | fi | |
2673 | else | |
2674 | test_prefix=$exec_prefix | |
2675 | fi | |
2676 | for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld | |
2677 | do | |
2678 | if grep '^STARTUP' $f > /dev/null 2>&1; then | |
2679 | gcc_cv_mips_libgloss_startup=yes | |
2680 | break | |
2681 | fi | |
2682 | done | |
2683 | if test x"$gcc_cv_mips_libgloss_startup" = xyes; then | |
2684 | AC_DEFINE(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES, 1, | |
2685 | [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.]) | |
2686 | fi | |
2687 | AC_MSG_RESULT($gcc_cv_mips_libgloss_startup) | |
cafe096b EC |
2688 | |
2689 | AC_MSG_CHECKING(whether the assembler has explicit relocation support) | |
2690 | if test x$gcc_cv_mips_explicit_relocs = x; then | |
2691 | gcc_cv_mips_explicit_relocs=no | |
2692 | if test x$gcc_cv_as != x; then | |
2693 | echo ' lw $4,%gp_rel(foo)($4)' > conftest.s | |
2694 | if $gcc_cv_as conftest.s -o conftest.o > /dev/null 2>&1; then | |
2695 | gcc_cv_mips_explicit_relocs=yes | |
2696 | fi | |
2697 | rm -f conftest.s conftest.o | |
2698 | fi | |
2699 | fi | |
2700 | if test $gcc_cv_mips_explicit_relocs = yes; then | |
2701 | test x$target_cpu_default != x || target_cpu_default=0 | |
2702 | target_cpu_default="(${target_cpu_default}|MASK_EXPLICIT_RELOCS)" | |
2703 | fi | |
2704 | AC_MSG_RESULT($gcc_cv_mips_explicit_relocs) | |
4357a6c3 CD |
2705 | ;; |
2706 | esac | |
2707 | ||
9fb28a67 | 2708 | if test x$with_sysroot = x && test x$host = x$target \ |
047d636f | 2709 | && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then |
793e9558 PB |
2710 | AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include") |
2711 | fi | |
2712 | ||
571a8de5 | 2713 | # Figure out what language subdirectories are present. |
71205e0b MH |
2714 | # Look if the user specified --enable-languages="..."; if not, use |
2715 | # the environment variable $LANGUAGES if defined. $LANGUAGES might | |
2716 | # go away some day. | |
cc9a08e0 | 2717 | # NB: embedded tabs in this IF block -- do not untabify |
71205e0b MH |
2718 | if test x"${enable_languages+set}" != xset; then |
2719 | if test x"${LANGUAGES+set}" = xset; then | |
cc9a08e0 PE |
2720 | enable_languages="${LANGUAGES}" |
2721 | AC_MSG_WARN([setting LANGUAGES is deprecated, use --enable-languages instead]) | |
2722 | ||
71205e0b MH |
2723 | else |
2724 | enable_languages=all | |
2725 | fi | |
d6c6b553 | 2726 | else |
015089dd TJ |
2727 | if test x"${enable_languages}" = x \ |
2728 | || test x"${enable_languages}" = xyes; | |
cc9a08e0 PE |
2729 | then |
2730 | AC_MSG_ERROR([--enable-languages needs at least one language argument]) | |
d6c6b553 | 2731 | fi |
71205e0b | 2732 | fi |
cc9a08e0 | 2733 | enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'` |
75382c6d TT |
2734 | |
2735 | # First scan to see if an enabled language requires some other language. | |
2736 | # We assume that a given config-lang.in will list all the language | |
2737 | # front ends it requires, even if some are required indirectly. | |
2738 | for lang in ${srcdir}/*/config-lang.in .. | |
2739 | do | |
2740 | case $lang in | |
2741 | ..) | |
2742 | ;; | |
2743 | # The odd quoting in the next line works around | |
2744 | # an apparent bug in bash 1.12 on linux. | |
2745 | changequote(,)dnl | |
2746 | ${srcdir}/[*]/config-lang.in) | |
2747 | ;; | |
2748 | *) | |
2749 | lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` | |
2750 | this_lang_requires=`sed -n -e 's,^lang_requires=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_requires=\([^ ]*\).*$,\1,p' $lang` | |
2751 | for other in $this_lang_requires | |
2752 | do | |
2753 | case ,${enable_languages}, in | |
2754 | *,$other,*) | |
2755 | ;; | |
2756 | *,all,*) | |
2757 | ;; | |
1bf17cc4 | 2758 | *,$lang_alias,*) |
75382c6d TT |
2759 | enable_languages="$enable_languages,$other" |
2760 | ;; | |
2761 | esac | |
2762 | done | |
2763 | ;; | |
2764 | changequote([,])dnl | |
2765 | esac | |
2766 | done | |
2767 | ||
015089dd TJ |
2768 | expected_languages=`echo ,${enable_languages}, | sed -e 's:,: :g' -e 's: *: :g' -e 's: *: :g' -e 's:^ ::' -e 's: $::'` |
2769 | found_languages= | |
571a8de5 DE |
2770 | subdirs= |
2771 | for lang in ${srcdir}/*/config-lang.in .. | |
2772 | do | |
2773 | case $lang in | |
2774 | ..) ;; | |
2775 | # The odd quoting in the next line works around | |
2776 | # an apparent bug in bash 1.12 on linux. | |
75bffa71 ILT |
2777 | changequote(,)dnl |
2778 | ${srcdir}/[*]/config-lang.in) ;; | |
71205e0b MH |
2779 | *) |
2780 | lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` | |
2b60b2cb AO |
2781 | this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ ]*\).*$,\1,p' $lang` |
2782 | build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ ]*\).*$,\1,p' $lang` | |
71205e0b MH |
2783 | if test "x$lang_alias" = x |
2784 | then | |
2785 | echo "$lang doesn't set \$language." 1>&2 | |
2786 | exit 1 | |
2787 | fi | |
2b60b2cb AO |
2788 | case ${build_by_default},${enable_languages}, in |
2789 | *,$lang_alias,*) add_this_lang=yes ;; | |
2790 | no,*) add_this_lang=no ;; | |
2791 | *,all,*) add_this_lang=yes ;; | |
2792 | *) add_this_lang=no ;; | |
2793 | esac | |
015089dd | 2794 | found_languages="${found_languages} ${lang_alias}" |
71205e0b MH |
2795 | if test x"${add_this_lang}" = xyes; then |
2796 | case $lang in | |
2797 | ${srcdir}/ada/config-lang.in) | |
1ffc5c6e | 2798 | if test x$have_gnat = xyes ; then |
71205e0b MH |
2799 | subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" |
2800 | fi | |
2801 | ;; | |
2802 | *) | |
2803 | subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" | |
2804 | ;; | |
2805 | esac | |
2806 | fi | |
2807 | ;; | |
75bffa71 | 2808 | changequote([,])dnl |
571a8de5 DE |
2809 | esac |
2810 | done | |
2811 | ||
015089dd TJ |
2812 | missing_languages= |
2813 | for expected_language in ${expected_languages} .. | |
2814 | do | |
2815 | if test "${expected_language}" != ..; then | |
2816 | missing_language="${expected_language}" | |
2817 | if test "${expected_language}" = "c" \ | |
2818 | || test "${expected_language}" = "all"; then | |
2819 | missing_language= | |
2820 | fi | |
2821 | for found_language in ${found_languages} .. | |
2822 | do | |
2823 | if test "${found_language}" != ..; then | |
2824 | if test "${expected_language}" = "${found_language}"; then | |
2825 | missing_language= | |
2826 | fi | |
2827 | fi | |
2828 | done | |
2829 | if test "x${missing_language}" != x; then | |
2830 | missing_languages="${missing_languages} ${missing_language}" | |
2831 | fi | |
2832 | fi | |
2833 | done | |
2834 | ||
2835 | if test "x$missing_languages" != x; then | |
2836 | AC_MSG_ERROR([ | |
2837 | The following requested languages were not found:${missing_languages} | |
2838 | The following languages were available: c${found_languages}]) | |
02ef40d9 TJ |
2839 | fi |
2840 | ||
f24af81b TT |
2841 | # Make gthr-default.h if we have a thread file. |
2842 | gthread_flags= | |
75bffa71 | 2843 | if test $thread_file != single; then |
f24af81b | 2844 | rm -f gthr-default.h |
db0d1ed9 | 2845 | echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h |
f24af81b TT |
2846 | gthread_flags=-DHAVE_GTHR_DEFAULT |
2847 | fi | |
2848 | AC_SUBST(gthread_flags) | |
2849 | ||
81bf3d9e RH |
2850 | # Find out what GC implementation we want, or may, use. |
2851 | AC_ARG_WITH(gc, | |
e8bec136 RO |
2852 | [ --with-gc={simple,page} choose the garbage collection mechanism to use |
2853 | with the compiler], | |
81bf3d9e RH |
2854 | [case "$withval" in |
2855 | simple | page) | |
2856 | GGC=ggc-$withval | |
2857 | ;; | |
2858 | *) | |
2859 | AC_MSG_ERROR([$withval is an invalid option to --with-gc]) | |
2860 | ;; | |
2861 | esac], | |
130fadbb | 2862 | [GGC=ggc-page]) |
81bf3d9e RH |
2863 | AC_SUBST(GGC) |
2864 | echo "Using $GGC for garbage collection." | |
2865 | ||
3c809ba4 | 2866 | # Use the system's zlib library. |
b8dad04b ZW |
2867 | zlibdir=-L../zlib |
2868 | zlibinc="-I\$(srcdir)/../zlib" | |
3c809ba4 AG |
2869 | AC_ARG_WITH(system-zlib, |
2870 | [ --with-system-zlib use installed libz], | |
2871 | zlibdir= | |
2872 | zlibinc= | |
2873 | ) | |
2874 | AC_SUBST(zlibdir) | |
2875 | AC_SUBST(zlibinc) | |
2876 | ||
dc6746e7 PT |
2877 | dnl Very limited version of automake's enable-maintainer-mode |
2878 | ||
2879 | AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) | |
2880 | dnl maintainer-mode is disabled by default | |
2881 | AC_ARG_ENABLE(maintainer-mode, | |
e8bec136 RO |
2882 | [ --enable-maintainer-mode |
2883 | enable make rules and dependencies not useful | |
dc6746e7 PT |
2884 | (and sometimes confusing) to the casual installer], |
2885 | maintainer_mode=$enableval, | |
2886 | maintainer_mode=no) | |
2887 | ||
2888 | AC_MSG_RESULT($maintainer_mode) | |
2889 | ||
2890 | if test "$maintainer_mode" = "yes"; then | |
2891 | MAINT='' | |
2892 | else | |
2893 | MAINT='#' | |
2894 | fi | |
2895 | AC_SUBST(MAINT)dnl | |
2896 | ||
571a8de5 DE |
2897 | # Make empty files to contain the specs and options for each language. |
2898 | # Then add #include lines to for a compiler that has specs and/or options. | |
2899 | ||
2900 | lang_specs_files= | |
2901 | lang_options_files= | |
3103b7db | 2902 | lang_tree_files= |
571a8de5 DE |
2903 | for subdir in . $subdirs |
2904 | do | |
75bffa71 | 2905 | if test -f $srcdir/$subdir/lang-specs.h; then |
0d24f4d1 | 2906 | lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h" |
571a8de5 | 2907 | fi |
75bffa71 | 2908 | if test -f $srcdir/$subdir/lang-options.h; then |
0d24f4d1 | 2909 | lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h" |
571a8de5 | 2910 | fi |
3103b7db | 2911 | if test -f $srcdir/$subdir/$subdir-tree.def; then |
0d24f4d1 | 2912 | lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def" |
3103b7db | 2913 | fi |
571a8de5 DE |
2914 | done |
2915 | ||
2916 | # These (without "all_") are set in each config-lang.in. | |
2917 | # `language' must be a single word so is spelled singularly. | |
2918 | all_languages= | |
2919 | all_boot_languages= | |
2920 | all_compilers= | |
2921 | all_stagestuff= | |
e34a3d31 | 2922 | all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc mkheaders' |
571a8de5 DE |
2923 | # List of language makefile fragments. |
2924 | all_lang_makefiles= | |
e2500fed | 2925 | # Files for gengtype |
ef69da62 | 2926 | all_gtfiles="$target_gtfiles" |
8ac9d31f TJ |
2927 | # Files for gengtype with language |
2928 | all_gtfiles_files_langs= | |
2929 | all_gtfiles_files_files= | |
571a8de5 DE |
2930 | |
2931 | # Add the language fragments. | |
2932 | # Languages are added via two mechanisms. Some information must be | |
2933 | # recorded in makefile variables, these are defined in config-lang.in. | |
2934 | # We accumulate them and plug them into the main Makefile. | |
2935 | # The other mechanism is a set of hooks for each of the main targets | |
2936 | # like `clean', `install', etc. | |
2937 | ||
2938 | language_fragments="Make-lang" | |
2939 | language_hooks="Make-hooks" | |
2940 | ||
2941 | for s in .. $subdirs | |
2942 | do | |
75bffa71 | 2943 | if test $s != ".." |
571a8de5 DE |
2944 | then |
2945 | language= | |
2946 | boot_language= | |
2947 | compilers= | |
2948 | stagestuff= | |
0280cf84 | 2949 | outputs= |
e2500fed | 2950 | gtfiles= |
571a8de5 | 2951 | . ${srcdir}/$s/config-lang.in |
75bffa71 | 2952 | if test "x$language" = x |
571a8de5 DE |
2953 | then |
2954 | echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2 | |
2955 | exit 1 | |
2956 | fi | |
72aaffbd ZW |
2957 | all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in" |
2958 | if test -f ${srcdir}/$s/Makefile.in | |
2959 | then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in" | |
2960 | fi | |
571a8de5 | 2961 | all_languages="$all_languages $language" |
75bffa71 | 2962 | if test "x$boot_language" = xyes |
571a8de5 DE |
2963 | then |
2964 | all_boot_languages="$all_boot_languages $language" | |
2965 | fi | |
2966 | all_compilers="$all_compilers $compilers" | |
2967 | all_stagestuff="$all_stagestuff $stagestuff" | |
0280cf84 | 2968 | all_outputs="$all_outputs $outputs" |
e2500fed | 2969 | all_gtfiles="$all_gtfiles $gtfiles" |
8ac9d31f TJ |
2970 | for f in .. $gtfiles |
2971 | do | |
2972 | if test $f != ".." | |
2973 | then | |
2974 | all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} " | |
2975 | all_gtfiles_files_files="$all_gtfiles_files_files ${f} " | |
2976 | fi | |
2977 | done | |
571a8de5 DE |
2978 | fi |
2979 | done | |
2980 | ||
8ac9d31f TJ |
2981 | # Pick up gtfiles for c |
2982 | gtfiles= | |
2983 | s="c" | |
2984 | . ${srcdir}/c-config-lang.in | |
2985 | all_gtfiles="$all_gtfiles $gtfiles" | |
2986 | for f in .. $gtfiles | |
2987 | do | |
2988 | if test $f != ".." | |
2989 | then | |
2990 | all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} " | |
2991 | all_gtfiles_files_files="$all_gtfiles_files_files ${f} " | |
2992 | fi | |
2993 | done | |
2994 | ||
cbc59f01 DD |
2995 | check_languages= |
2996 | for language in .. $all_languages | |
2997 | do | |
2998 | if test $language != ".." | |
2999 | then | |
3000 | check_languages="$check_languages check-$language" | |
3001 | fi | |
3002 | done | |
3003 | ||
571a8de5 DE |
3004 | # Since we can't use `::' targets, we link each language in |
3005 | # with a set of hooks, reached indirectly via lang.${target}. | |
3006 | ||
3007 | rm -f Make-hooks | |
3008 | touch Make-hooks | |
65ebbf81 | 3009 | target_list="all.build all.cross start.encap rest.encap tags \ |
d3945f0a | 3010 | info dvi generated-manpages \ |
571a8de5 | 3011 | install-normal install-common install-info install-man \ |
436a88a6 | 3012 | uninstall \ |
571a8de5 | 3013 | mostlyclean clean distclean extraclean maintainer-clean \ |
8f231b5d | 3014 | stage1 stage2 stage3 stage4 stageprofile stagefeedback" |
571a8de5 DE |
3015 | for t in $target_list |
3016 | do | |
3017 | x= | |
ab87f8c8 | 3018 | for lang in .. $all_languages |
571a8de5 | 3019 | do |
ab87f8c8 JL |
3020 | if test $lang != ".."; then |
3021 | x="$x $lang.$t" | |
571a8de5 DE |
3022 | fi |
3023 | done | |
3024 | echo "lang.$t: $x" >> Make-hooks | |
3025 | done | |
3026 | ||
cc06d68c | 3027 | # Create .gdbinit. |
296e46bd | 3028 | |
cc06d68c GP |
3029 | echo "dir ." > .gdbinit |
3030 | echo "dir ${srcdir}" >> .gdbinit | |
3031 | if test x$gdb_needs_out_file_path = xyes | |
3032 | then | |
3033 | echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit | |
3034 | fi | |
3035 | if test "x$subdirs" != x; then | |
3036 | for s in $subdirs | |
3037 | do | |
3038 | echo "dir ${srcdir}/$s" >> .gdbinit | |
3039 | done | |
296e46bd | 3040 | fi |
cc06d68c | 3041 | echo "source ${srcdir}/gdbinit.in" >> .gdbinit |
296e46bd | 3042 | |
8f8d3278 NC |
3043 | # If $(exec_prefix) exists and is not the same as $(prefix), then compute an |
3044 | # absolute path for gcc_tooldir based on inserting the number of up-directory | |
3045 | # movements required to get from $(exec_prefix) to $(prefix) into the basic | |
3046 | # $(libsubdir)/@(unlibsubdir) based path. | |
82cbf8f7 JL |
3047 | # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel |
3048 | # make and thus we'd get different behavior depending on where we built the | |
3049 | # sources. | |
5949a9fc | 3050 | if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then |
d062c304 JL |
3051 | gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)' |
3052 | else | |
8f8d3278 NC |
3053 | changequote(<<, >>)dnl |
3054 | # An explanation of the sed strings: | |
3055 | # -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix' | |
3056 | # -e 's|/$||' match a trailing forward slash and eliminates it | |
3057 | # -e 's|^[^/]|/|' forces the string to start with a forward slash (*) | |
ff7cc307 | 3058 | # -e 's|/[^/]*|../|g' replaces each occurrence of /<directory> with ../ |
8f8d3278 NC |
3059 | # |
3060 | # (*) Note this pattern overwrites the first character of the string | |
3061 | # with a forward slash if one is not already present. This is not a | |
3062 | # problem because the exact names of the sub-directories concerned is | |
3063 | # unimportant, just the number of them matters. | |
3064 | # | |
3065 | # The practical upshot of these patterns is like this: | |
3066 | # | |
3067 | # prefix exec_prefix result | |
3068 | # ------ ----------- ------ | |
3069 | # /foo /foo/bar ../ | |
3070 | # /foo/ /foo/bar ../ | |
3071 | # /foo /foo/bar/ ../ | |
3072 | # /foo/ /foo/bar/ ../ | |
3073 | # /foo /foo/bar/ugg ../../ | |
3074 | # | |
4c112cda NC |
3075 | dollar='$$' |
3076 | gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)" | |
8f8d3278 | 3077 | changequote([, ])dnl |
d062c304 JL |
3078 | fi |
3079 | AC_SUBST(gcc_tooldir) | |
4c112cda | 3080 | AC_SUBST(dollar) |
d062c304 | 3081 | |
2bbea3a6 RH |
3082 | # Find a directory in which to install a shared libgcc. |
3083 | ||
3084 | AC_ARG_ENABLE(version-specific-runtime-libs, | |
e8bec136 RO |
3085 | [ --enable-version-specific-runtime-libs |
3086 | specify that runtime libraries should be | |
3087 | installed in a compiler-specific directory]) | |
2bbea3a6 | 3088 | |
5b15f277 RH |
3089 | AC_ARG_WITH(slibdir, |
3090 | [ --with-slibdir=DIR shared libraries in DIR [LIBDIR]], | |
3091 | slibdir="$with_slibdir", | |
3092 | if test "${enable_version_specific_runtime_libs+set}" = set; then | |
2bbea3a6 | 3093 | slibdir='$(libsubdir)' |
5b15f277 | 3094 | elif test "$host" != "$target"; then |
2bbea3a6 RH |
3095 | slibdir='$(build_tooldir)/lib' |
3096 | else | |
5b15f277 RH |
3097 | slibdir='$(libdir)' |
3098 | fi) | |
2bbea3a6 RH |
3099 | AC_SUBST(slibdir) |
3100 | ||
1e6347d8 | 3101 | objdir=`${PWDCMD-pwd}` |
7e717196 JL |
3102 | AC_SUBST(objdir) |
3103 | ||
94f42018 DE |
3104 | # Process the language and host/target makefile fragments. |
3105 | ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file" | |
47866ac0 | 3106 | |
46f18e7b RK |
3107 | # Substitute configuration variables |
3108 | AC_SUBST(subdirs) | |
8ac9d31f | 3109 | AC_SUBST(srcdir) |
46f18e7b RK |
3110 | AC_SUBST(all_boot_languages) |
3111 | AC_SUBST(all_compilers) | |
e2500fed | 3112 | AC_SUBST(all_gtfiles) |
8ac9d31f TJ |
3113 | AC_SUBST(all_gtfiles_files_langs) |
3114 | AC_SUBST(all_gtfiles_files_files) | |
9f3d1bc2 BK |
3115 | AC_SUBST(all_lang_makefiles) |
3116 | AC_SUBST(all_languages) | |
9f3d1bc2 BK |
3117 | AC_SUBST(all_stagestuff) |
3118 | AC_SUBST(build_exeext) | |
3119 | AC_SUBST(build_install_headers_dir) | |
3120 | AC_SUBST(build_xm_file_list) | |
11642c3a ZW |
3121 | AC_SUBST(build_xm_file) |
3122 | AC_SUBST(build_xm_defines) | |
cbc59f01 | 3123 | AC_SUBST(check_languages) |
9f3d1bc2 | 3124 | AC_SUBST(cc_set_by_configure) |
5aa82ace | 3125 | AC_SUBST(quoted_cc_set_by_configure) |
9f3d1bc2 | 3126 | AC_SUBST(cpp_install_dir) |
9f3d1bc2 BK |
3127 | AC_SUBST(dep_host_xmake_file) |
3128 | AC_SUBST(dep_tmake_file) | |
9f3d1bc2 | 3129 | AC_SUBST(extra_headers_list) |
46f18e7b | 3130 | AC_SUBST(extra_objs) |
9f3d1bc2 BK |
3131 | AC_SUBST(extra_parts) |
3132 | AC_SUBST(extra_passes) | |
3133 | AC_SUBST(extra_programs) | |
9f3d1bc2 | 3134 | AC_SUBST(float_h_file) |
cc1e60ea | 3135 | AC_SUBST(gcc_config_arguments) |
9f3d1bc2 | 3136 | AC_SUBST(gcc_gxx_include_dir) |
e2187d3b | 3137 | AC_SUBST(libstdcxx_incdir) |
9f3d1bc2 | 3138 | AC_SUBST(gcc_version) |
8763704d | 3139 | AC_SUBST(gcc_version_full) |
9f3d1bc2 BK |
3140 | AC_SUBST(gcc_version_trigger) |
3141 | AC_SUBST(host_exeext) | |
46f18e7b | 3142 | AC_SUBST(host_extra_gcc_objs) |
46f18e7b | 3143 | AC_SUBST(host_xm_file_list) |
11642c3a ZW |
3144 | AC_SUBST(host_xm_file) |
3145 | AC_SUBST(host_xm_defines) | |
476d9098 | 3146 | AC_SUBST(out_host_hook_obj) |
9f3d1bc2 | 3147 | AC_SUBST(install) |
46f18e7b | 3148 | AC_SUBST(lang_options_files) |
9f3d1bc2 | 3149 | AC_SUBST(lang_specs_files) |
3103b7db | 3150 | AC_SUBST(lang_tree_files) |
46f18e7b | 3151 | AC_SUBST(local_prefix) |
9f3d1bc2 BK |
3152 | AC_SUBST(md_file) |
3153 | AC_SUBST(objc_boehm_gc) | |
3154 | AC_SUBST(out_file) | |
3155 | AC_SUBST(out_object_file) | |
46f18e7b | 3156 | AC_SUBST(stage_prefix_set_by_configure) |
596151e1 | 3157 | AC_SUBST(quoted_stage_prefix_set_by_configure) |
e9a25f70 | 3158 | AC_SUBST(symbolic_link) |
9f3d1bc2 BK |
3159 | AC_SUBST(thread_file) |
3160 | AC_SUBST(tm_file_list) | |
11642c3a | 3161 | AC_SUBST(tm_file) |
d5355cb2 | 3162 | AC_SUBST(tm_defines) |
11642c3a ZW |
3163 | AC_SUBST(tm_p_file_list) |
3164 | AC_SUBST(tm_p_file) | |
3165 | AC_SUBST(xm_file) | |
3d9d2476 | 3166 | AC_SUBST(xm_defines) |
66fe41af | 3167 | AC_SUBST(target_alias) |
aac69a49 NC |
3168 | AC_SUBST(c_target_objs) |
3169 | AC_SUBST(cxx_target_objs) | |
11642c3a | 3170 | AC_SUBST(target_cpu_default) |
46f18e7b RK |
3171 | |
3172 | AC_SUBST_FILE(target_overrides) | |
3173 | AC_SUBST_FILE(host_overrides) | |
46f18e7b RK |
3174 | AC_SUBST_FILE(language_fragments) |
3175 | AC_SUBST_FILE(language_hooks) | |
3176 | ||
3177 | # Echo that links are built | |
75bffa71 | 3178 | if test x$host = x$target |
46f18e7b RK |
3179 | then |
3180 | str1="native " | |
3181 | else | |
3182 | str1="cross-" | |
3183 | str2=" from $host" | |
3184 | fi | |
3185 | ||
75bffa71 | 3186 | if test x$host != x$build |
46f18e7b RK |
3187 | then |
3188 | str3=" on a $build system" | |
3189 | fi | |
3190 | ||
75bffa71 | 3191 | if test "x$str2" != x || test "x$str3" != x |
46f18e7b RK |
3192 | then |
3193 | str4= | |
3194 | fi | |
3195 | ||
3196 | echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2 | |
3197 | ||
75bffa71 | 3198 | if test "x$str2" != x || test "x$str3" != x |
46f18e7b RK |
3199 | then |
3200 | echo " ${str2}${str3}." 1>&2 | |
3201 | fi | |
3202 | ||
61536478 | 3203 | # Truncate the target if necessary |
75bffa71 | 3204 | if test x$host_truncate_target != x; then |
61536478 JL |
3205 | target=`echo $target | sed -e 's/\(..............\).*/\1/'` |
3206 | fi | |
3207 | ||
46f18e7b RK |
3208 | # Configure the subdirectories |
3209 | # AC_CONFIG_SUBDIRS($subdirs) | |
3210 | ||
3211 | # Create the Makefile | |
5891b37d | 3212 | # and configure language subdirectories |
0280cf84 | 3213 | AC_OUTPUT($all_outputs, |
cdcc6a01 | 3214 | [ |
cdcc6a01 | 3215 | case x$CONFIG_HEADERS in |
b7cb92ad | 3216 | xauto-host.h:config.in) |
818b66cc | 3217 | echo > cstamp-h ;; |
cdcc6a01 | 3218 | esac |
93cf819d BK |
3219 | # If the host supports symlinks, point stage[1234] at ../stage[1234] so |
3220 | # bootstrapping and the installation procedure can still use | |
3221 | # CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, | |
3222 | # FLAGS_TO_PASS has been modified to solve the problem there. | |
3223 | # This is virtually a duplicate of what happens in configure.lang; we do | |
3224 | # an extra check to make sure this only happens if ln -s can be used. | |
75bffa71 | 3225 | if test "$symbolic_link" = "ln -s"; then |
d8140df6 | 3226 | for d in .. ${subdirs} fixinc ; do |
75bffa71 | 3227 | if test $d != ..; then |
1e6347d8 | 3228 | STARTDIR=`${PWDCMD-pwd}` |
4e8a434e | 3229 | cd $d |
8f231b5d | 3230 | for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include |
4e8a434e BK |
3231 | do |
3232 | rm -f $t | |
3233 | $symbolic_link ../$t $t 2>/dev/null | |
3234 | done | |
3235 | cd $STARTDIR | |
93cf819d BK |
3236 | fi |
3237 | done | |
3238 | else true ; fi | |
ab87f8c8 JL |
3239 | # Avoid having to add intl to our include paths. |
3240 | if test -f intl/libintl.h; then | |
3241 | echo creating libintl.h | |
3242 | echo '#include "intl/libintl.h"' >libintl.h | |
3243 | fi | |
0d24f4d1 ZW |
3244 | ], |
3245 | [subdirs='$subdirs' | |
3246 | symbolic_link='$symbolic_link' | |
cdcc6a01 | 3247 | ]) |