]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/configure.ac
re PR java/1305 ([JSR133] GCJ ignores volatile modifier)
[thirdparty/gcc.git] / gcc / configure.ac
CommitLineData
ca9bc441 1# configure.ac for GCC
46f18e7b
RK
2# Process this file with autoconf to generate a configuration script.
3
d3585b76 4# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
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 20#along with GCC; see the file COPYING. If not, write to the Free
366ccddb
KC
21#Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
22#02110-1301, USA.
46f18e7b 23
34a86c2b
NN
24# --------------------------------
25# Initialization and sanity checks
26# --------------------------------
27
8ab705be 28AC_PREREQ(2.59)
914c5af7
NN
29AC_INIT
30AC_CONFIG_SRCDIR(tree.c)
b7cb92ad 31AC_CONFIG_HEADER(auto-host.h:config.in)
cdcc6a01 32
9f18db39
PB
33gcc_version=`cat $srcdir/BASE-VER`
34
34a86c2b 35# Determine the host, build, and target systems
914c5af7
NN
36AC_CANONICAL_BUILD
37AC_CANONICAL_HOST
38AC_CANONICAL_TARGET
34a86c2b 39
caa55b1e 40# Determine the noncanonical target name, for directory use.
392765bf 41ACX_NONCANONICAL_TARGET
caa55b1e 42
4665e56c
NN
43# Determine the target- and build-specific subdirectories
44GCC_TOPLEV_SUBDIRS
45
34a86c2b
NN
46# Set program_transform_name
47AC_ARG_PROGRAM
46f18e7b 48
75a39864
JL
49# Check for bogus environment variables.
50# Test if LIBRARY_PATH contains the notation for the current directory
51# since this would lead to problems installing/building glibc.
52# LIBRARY_PATH contains the current directory if one of the following
53# is true:
54# - one of the terminals (":" and ";") is the first or last sign
55# - two terminals occur directly after each other
56# - the path contains an element with a dot in it
57AC_MSG_CHECKING(LIBRARY_PATH variable)
58changequote(,)dnl
59case ${LIBRARY_PATH} in
60 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
61 library_path_setting="contains current directory"
62 ;;
63 *)
64 library_path_setting="ok"
65 ;;
66esac
67changequote([,])dnl
68AC_MSG_RESULT($library_path_setting)
69if test "$library_path_setting" != "ok"; then
70AC_MSG_ERROR([
71*** LIBRARY_PATH shouldn't contain the current directory when
079bd08e 72*** building gcc. Please change the environment variable
75a39864
JL
73*** and run configure again.])
74fi
75
76# Test if GCC_EXEC_PREFIX contains the notation for the current directory
77# since this would lead to problems installing/building glibc.
78# GCC_EXEC_PREFIX contains the current directory if one of the following
79# is true:
80# - one of the terminals (":" and ";") is the first or last sign
81# - two terminals occur directly after each other
82# - the path contains an element with a dot in it
83AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
84changequote(,)dnl
85case ${GCC_EXEC_PREFIX} in
86 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
87 gcc_exec_prefix_setting="contains current directory"
88 ;;
89 *)
90 gcc_exec_prefix_setting="ok"
91 ;;
92esac
93changequote([,])dnl
94AC_MSG_RESULT($gcc_exec_prefix_setting)
95if test "$gcc_exec_prefix_setting" != "ok"; then
96AC_MSG_ERROR([
97*** GCC_EXEC_PREFIX shouldn't contain the current directory when
079bd08e 98*** building gcc. Please change the environment variable
75a39864
JL
99*** and run configure again.])
100fi
101
34a86c2b
NN
102# -----------
103# Directories
104# -----------
105
106# Specify the local prefix
107local_prefix=
108AC_ARG_WITH(local-prefix,
109[ --with-local-prefix=DIR specifies directory to put local include],
110[case "${withval}" in
111yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
112no) ;;
113*) local_prefix=$with_local_prefix ;;
114esac])
115
116# Default local prefix if it is empty
117if test x$local_prefix = x; then
118 local_prefix=/usr/local
119fi
120
121# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
122# passed in by the toplevel make and thus we'd get different behavior
123# depending on where we built the sources.
124gcc_gxx_include_dir=
125# Specify the g++ header file directory
126AC_ARG_WITH(gxx-include-dir,
127[ --with-gxx-include-dir=DIR
128 specifies directory to put g++ header files],
129[case "${withval}" in
130yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
131no) ;;
132*) gcc_gxx_include_dir=$with_gxx_include_dir ;;
133esac])
134
135if test x${gcc_gxx_include_dir} = x; then
136 if test x${enable_version_specific_runtime_libs} = xyes; then
137 gcc_gxx_include_dir='${libsubdir}/include/c++'
138 else
a1286ef5 139 libstdcxx_incdir='c++/$(version)'
34a86c2b
NN
140changequote(<<, >>)dnl
141 gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir}
142changequote([, ])dnl
143 fi
144fi
145
146AC_ARG_WITH(cpp_install_dir,
147[ --with-cpp-install-dir=DIR
148 install the user visible C preprocessor in DIR
149 (relative to PREFIX) as well as PREFIX/bin],
150[if test x$withval = xyes; then
151 AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
152elif test x$withval != xno; then
153 cpp_install_dir=$withval
154fi])
155
51b9ff45
KC
156# We would like to our source tree to be readonly. However when releases or
157# pre-releases are generated, the flex/bison generated files as well as the
158# various formats of manuals need to be included along with the rest of the
159# sources. Therefore we have --enable-generated-files-in-srcdir to do
160# just that.
161
03787dfd
KC
162AC_MSG_CHECKING([whether to place generated files in the source directory])
163 dnl generated-files-in-srcdir is disabled by default
164 AC_ARG_ENABLE(generated-files-in-srcdir,
165[ --enable-generated-files-in-srcdir
166 put copies of generated files in source dir
167 intended for creating source tarballs for users
168 without texinfo bison or flex.],
169 generated_files_in_srcdir=$enableval,
170 generated_files_in_srcdir=no)
171
172AC_MSG_RESULT($generated_files_in_srcdir)
173
174if test "$generated_files_in_srcdir" = "yes"; then
175 GENINSRC=''
03787dfd
KC
176else
177 GENINSRC='#'
03787dfd
KC
178fi
179AC_SUBST(GENINSRC)
51b9ff45 180
34a86c2b
NN
181# -------------------
182# Find default linker
183# -------------------
46f18e7b
RK
184
185# With GNU ld
186AC_ARG_WITH(gnu-ld,
187[ --with-gnu-ld arrange to work with GNU ld.],
df6faf79
JW
188gnu_ld_flag="$with_gnu_ld",
189gnu_ld_flag=no)
46f18e7b 190
ab339d62
AO
191# With pre-defined ld
192AC_ARG_WITH(ld,
e8bec136 193[ --with-ld arrange to use the specified ld (full pathname)],
3ccc3a56
AO
194DEFAULT_LINKER="$with_ld")
195if test x"${DEFAULT_LINKER+set}" = x"set"; then
196 if test ! -x "$DEFAULT_LINKER"; then
99c012a8 197 AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
e154a394 198 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
ab339d62
AO
199 gnu_ld_flag=yes
200 fi
119d24d1
KG
201 AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
202 [Define to enable the use of a default linker.])
ab339d62
AO
203fi
204
34a86c2b
NN
205AC_MSG_CHECKING([whether a default linker was specified])
206if test x"${DEFAULT_LINKER+set}" = x"set"; then
207 if test x"$gnu_ld_flag" = x"no"; then
208 AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
209 else
210 AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
211 fi
212else
213 AC_MSG_RESULT(no)
214fi
215
d594623a
L
216# With demangler in GNU ld
217AC_ARG_WITH(demangler-in-ld,
218[ --with-demangler-in-ld try to use demangler in GNU ld.],
219demangler_in_ld="$with_demangler_in_ld",
220demangler_in_ld=no)
221
34a86c2b
NN
222# ----------------------
223# Find default assembler
224# ----------------------
225
46f18e7b
RK
226# With GNU as
227AC_ARG_WITH(gnu-as,
e8bec136 228[ --with-gnu-as arrange to work with GNU as],
df6faf79
JW
229gas_flag="$with_gnu_as",
230gas_flag=no)
46f18e7b 231
ab339d62 232AC_ARG_WITH(as,
e8bec136 233[ --with-as arrange to use the specified as (full pathname)],
3ccc3a56
AO
234DEFAULT_ASSEMBLER="$with_as")
235if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
236 if test ! -x "$DEFAULT_ASSEMBLER"; then
99c012a8 237 AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
e154a394 238 elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
ab339d62
AO
239 gas_flag=yes
240 fi
119d24d1
KG
241 AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
242 [Define to enable the use of a default assembler.])
3ccc3a56 243fi
ab339d62 244
34a86c2b
NN
245AC_MSG_CHECKING([whether a default assembler was specified])
246if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
247 if test x"$gas_flag" = x"no"; then
248 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
4e88d51b 249 else
34a86c2b 250 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
4e88d51b 251 fi
34a86c2b
NN
252else
253 AC_MSG_RESULT(no)
4e88d51b 254fi
46f18e7b 255
34a86c2b
NN
256# ---------------
257# Find C compiler
258# ---------------
13c22933 259
426ca3ca
RO
260# If a non-executable a.out is present (e.g. created by GNU as above even if
261# invoked with -v only), the IRIX 6 native ld just overwrites the existing
262# file, even when creating an executable, so an execution test fails.
263# Remove possible default executable files to avoid this.
264#
265# FIXME: This really belongs into AC_PROG_CC and can be removed once
266# Autoconf includes it.
267rm -f a.out a.exe b.out
268
414d23ae
HPN
269# Find the native compiler
270AC_PROG_CC
3b620440 271AM_PROG_CC_C_O
414d23ae
HPN
272# autoconf is lame and doesn't give us any substitution variable for this.
273if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
274 NO_MINUS_C_MINUS_O=yes
275else
276 OUTPUT_OPTION='-o $@'
277fi
278AC_SUBST(NO_MINUS_C_MINUS_O)
279AC_SUBST(OUTPUT_OPTION)
280
73458fb7
NN
281# -------------------------
282# Check C compiler features
283# -------------------------
284
34a86c2b
NN
285AC_PROG_CPP
286AC_C_INLINE
34a86c2b 287
34a86c2b 288# sizeof(char) is 1 by definition.
bf3b7cd3
JD
289AC_CHECK_SIZEOF(void *)
290AC_CHECK_SIZEOF(short)
291AC_CHECK_SIZEOF(int)
292AC_CHECK_SIZEOF(long)
5ec1c5e6
KC
293AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
294AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)])
34a86c2b 295
34a86c2b
NN
296# ---------------------
297# Warnings and checking
298# ---------------------
299
b5472e1d
NN
300# Check $CC warning features (if it's GCC).
301# We want to use -pedantic, but we don't want warnings about
302# * 'long long'
303# * variadic macros
89a42ac8 304# * overlong strings
b5472e1d
NN
305# So, we only use -pedantic if we can disable those warnings.
306
307AC_CACHE_CHECK(
308 [whether ${CC} accepts -Wno-long-long],
309 [ac_cv_prog_cc_w_no_long_long],
310 [save_CFLAGS="$CFLAGS"
311 CFLAGS="-Wno-long-long"
312 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
313 [ac_cv_prog_cc_w_no_long_long=yes],
314 [ac_cv_prog_cc_w_no_long_long=no])
315 CFLAGS="$save_CFLAGS"
316 ])
317
318AC_CACHE_CHECK(
319 [whether ${CC} accepts -Wno-variadic-macros],
320 [ac_cv_prog_cc_w_no_variadic_macros],
321 [save_CFLAGS="$CFLAGS"
322 CFLAGS="-Wno-variadic-macros"
323 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
324 [ac_cv_prog_cc_w_no_variadic_macros=yes],
325 [ac_cv_prog_cc_w_no_variadic_macros=no])
326 CFLAGS="$save_CFLAGS"
327 ])
328
89a42ac8
ZW
329AC_CACHE_CHECK(
330 [whether ${CC} accepts -Wno-overlength-strings],
331 [ac_cv_prog_cc_w_no_overlength_strings],
332 [save_CFLAGS="$CFLAGS"
333 CFLAGS="-Wno-overlength-strings"
334 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
335 [ac_cv_prog_cc_w_no_overlength_strings=yes],
336 [ac_cv_prog_cc_w_no_overlength_strings=no])
337 CFLAGS="$save_CFLAGS"
338 ])
339
414d23ae 340strict1_warn=
b5472e1d 341if test $ac_cv_prog_cc_w_no_long_long = yes \
89a42ac8
ZW
342 && test $ac_cv_prog_cc_w_no_variadic_macros = yes \
343 && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then
344 strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings"
414d23ae 345fi
414d23ae 346
643d3bd2
NN
347# Add -Wold-style-definition if it's accepted
348AC_CACHE_CHECK(
349 [whether ${CC} accepts -Wold-style-definition],
350 [ac_cv_prog_cc_w_old_style_definition],
351 [save_CFLAGS="$CFLAGS"
352 CFLAGS="-Wold-style-definition"
353 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
354 [ac_cv_prog_cc_w_old_style_definition=yes],
355 [ac_cv_prog_cc_w_old_style_definition=no])
356 CFLAGS="$save_CFLAGS"
357 ])
358if test $ac_cv_prog_cc_w_old_style_definition = yes ; then
359 strict1_warn="${strict1_warn} -Wold-style-definition"
360fi
361
ac0f3f39
KG
362# Add -Wmissing-format-attribute if it's accepted
363AC_CACHE_CHECK(
364 [whether ${CC} accepts -Wmissing-format-attribute],
365 [ac_cv_prog_cc_w_missing_format_attribute],
366 [save_CFLAGS="$CFLAGS"
367 CFLAGS="-Wmissing-format-attribute"
368 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
369 [ac_cv_prog_cc_w_missing_format_attribute=yes],
370 [ac_cv_prog_cc_w_missing_format_attribute=no])
371 CFLAGS="$save_CFLAGS"
372 ])
373if test $ac_cv_prog_cc_w_missing_format_attribute = yes ; then
374 strict1_warn="${strict1_warn} -Wmissing-format-attribute"
375fi
376
09a9c095
NN
377# Enable -Werror, period.
378AC_ARG_ENABLE(werror_always,
379[ --enable-werror-always enable -Werror always], [],
380[enable_werror_always=no])
381if test x${enable_werror_always} = xyes ; then
382 strict1_warn="${strict1_warn} -Werror"
383 WERROR=-Werror
384fi
385
ac0f3f39
KG
386AC_SUBST(strict1_warn)
387
373477bb
GDR
388# Get C++ compatibility warning flag, if supported.
389AC_CACHE_CHECK(
390 [whether ${CC} accepts -Wc++-compat],
391 [ac_cv_prog_cc_w_cxx_compat],
392 [save_CFLAGS="$CFLAGS"
393 CFLAGS="-Wc++-compat"
394 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
395 [ac_cv_prog_cc_w_cxx_compat=yes],
396 [ac_cv_prog_cc_w_cxx_compat=no])
397 CFLAGS="$save_CFLAGS"
398 ])
399if test x${ac_cv_prog_cc_w_cxx_compat} = xyes; then
400 cxx_compat_warn="-Wc++-compat"
401fi
402AC_SUBST(cxx_compat_warn)
403
404
414d23ae
HPN
405# If the native compiler is GCC, we can enable warnings even in stage1.
406# That's useful for people building cross-compilers, or just running a
407# quick `make'.
408warn_cflags=
409if test "x$GCC" = "xyes"; then
410 warn_cflags='$(GCC_WARN_CFLAGS)'
411fi
412AC_SUBST(warn_cflags)
413
dd859b8a 414# Enable -Werror in bootstrap stage2 and later.
a1286ef5
ZW
415is_release=
416if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
417 is_release=yes
418fi
dd859b8a
KG
419AC_ARG_ENABLE(werror,
420[ --enable-werror enable -Werror in bootstrap stage2 and later], [],
06c37c96
NS
421[if test x$is_release = x ; then
422 # Default to "yes" on development branches.
423 enable_werror=yes
424else
425 # Default to "no" on release branches.
426 enable_werror=no
427fi])
dd859b8a
KG
428if test x$enable_werror = xyes ; then
429 WERROR=-Werror
430fi
431AC_SUBST(WERROR)
432
a494747c
MM
433# Enable expensive internal checks
434AC_ARG_ENABLE(checking,
f4524c9e
ZW
435[ --enable-checking[=LIST]
436 enable expensive run-time checks. With LIST,
437 enable only specific categories of checks.
cdce5c16
NS
438 Categories are: yes,no,all,none,release.
439 Flags are: assert,fold,gc,gcac,misc,
440 rtlflag,rtl,runtime,tree,valgrind.],
e1bbfc5c
NS
441[ac_checking_flags="${enableval}"],[
442# Determine the default checks.
443if test x$is_release = x ; then
444 ac_checking_flags=yes
445else
446 ac_checking_flags=release
447fi])
448ac_assert_checking=1
449ac_checking=
cdce5c16
NS
450ac_fold_checking=
451ac_gc_checking=
452ac_gc_always_collect=
119d24d1 453ac_rtl_checking=
4c76f856 454ac_rtlflag_checking=
b53ef395 455ac_runtime_checking=1
cdce5c16
NS
456ac_tree_checking=
457ac_valgrind_checking=
e1bbfc5c
NS
458IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
459for check in $ac_checking_flags
460do
461 case $check in
cdce5c16 462 # these set all the flags to specific states
e1bbfc5c 463 yes) ac_assert_checking=1 ; ac_checking=1 ;
cdce5c16
NS
464 ac_fold_checking= ; ac_gc_checking=1 ;
465 ac_gc_always_collect= ; ac_rtl_checking= ;
232b67d9 466 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
cdce5c16
NS
467 ac_tree_checking=1 ; ac_valgrind_checking= ;;
468 no|none) ac_assert_checking= ; ac_checking= ;
469 ac_fold_checking= ; ac_gc_checking= ;
470 ac_gc_always_collect= ; ac_rtl_checking= ;
232b67d9 471 ac_rtlflag_checking= ; ac_runtime_checking= ;
cdce5c16 472 ac_tree_checking= ; ac_valgrind_checking= ;;
e1bbfc5c 473 all) ac_assert_checking=1 ; ac_checking=1 ;
cdce5c16
NS
474 ac_fold_checking=1 ; ac_gc_checking=1 ;
475 ac_gc_always_collect=1 ; ac_rtl_checking=1 ;
476 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
477 ac_tree_checking=1 ; ac_valgrind_checking= ;;
478 release) ac_assert_checking=1 ; ac_checking= ;
479 ac_fold_checking= ; ac_gc_checking= ;
480 ac_gc_always_collect= ; ac_rtl_checking= ;
481 ac_rtlflag_checking= ; ac_runtime_checking=1 ;
482 ac_tree_checking= ; ac_valgrind_checking= ;;
483 # these enable particular checks
e1bbfc5c
NS
484 assert) ac_assert_checking=1 ;;
485 fold) ac_fold_checking=1 ;;
486 gc) ac_gc_checking=1 ;;
487 gcac) ac_gc_always_collect=1 ;;
488 misc) ac_checking=1 ;;
e1bbfc5c 489 rtl) ac_rtl_checking=1 ;;
cdce5c16 490 rtlflag) ac_rtlflag_checking=1 ;;
b53ef395 491 runtime) ac_runtime_checking=1 ;;
e1bbfc5c 492 tree) ac_tree_checking=1 ;;
cdce5c16 493 valgrind) ac_valgrind_checking=1 ;;
e1bbfc5c
NS
494 *) AC_MSG_ERROR(unknown check category $check) ;;
495 esac
496done
497IFS="$ac_save_IFS"
498
204250d2 499nocommon_flag=""
119d24d1
KG
500if test x$ac_checking != x ; then
501 AC_DEFINE(ENABLE_CHECKING, 1,
502[Define if you want more run-time sanity checks. This one gets a grab
503 bag of miscellaneous but relatively cheap checks.])
204250d2 504 nocommon_flag=-fno-common
119d24d1 505fi
204250d2 506AC_SUBST(nocommon_flag)
06c37c96
NS
507if test x$ac_assert_checking != x ; then
508 AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
509[Define if you want assertions enabled. This is a cheap check.])
510fi
232b67d9 511GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
b53ef395
NS
512if test x$ac_runtime_checking != x ; then
513 AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
514[Define if you want runtime assertions enabled. This is a cheap check.])
515fi
119d24d1
KG
516if test x$ac_tree_checking != x ; then
517 AC_DEFINE(ENABLE_TREE_CHECKING, 1,
518[Define if you want all operations on trees (the basic data
519 structure of the front ends) to be checked for dynamic type safety
13f05fd0
BM
520 at runtime. This is moderately expensive. The tree browser debugging
521 routines will also be enabled by this option.
522 ])
523 TREEBROWSER=tree-browser.o
119d24d1 524fi
13f05fd0 525AC_SUBST(TREEBROWSER)
119d24d1
KG
526if test x$ac_rtl_checking != x ; then
527 AC_DEFINE(ENABLE_RTL_CHECKING, 1,
528[Define if you want all operations on RTL (the basic data structure
529 of the optimizer and back end) to be checked for dynamic type safety
530 at runtime. This is quite expensive.])
531fi
4c76f856
JJ
532if test x$ac_rtlflag_checking != x ; then
533 AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
534[Define if you want RTL flag accesses to be checked against the RTL
535 codes that are supported for each access macro. This is relatively
536 cheap.])
537fi
119d24d1
KG
538if test x$ac_gc_checking != x ; then
539 AC_DEFINE(ENABLE_GC_CHECKING, 1,
540[Define if you want the garbage collector to do object poisoning and
541 other memory allocation checks. This is quite expensive.])
542fi
543if test x$ac_gc_always_collect != x ; then
544 AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
545[Define if you want the garbage collector to operate in maximally
546 paranoid mode, validating the entire heap and collecting garbage at
547 every opportunity. This is extremely expensive.])
548fi
5dfa45d0
JJ
549if test x$ac_fold_checking != x ; then
550 AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
551[Define if you want fold checked that it never destructs its argument.
552 This is quite expensive.])
553fi
414d23ae
HPN
554valgrind_path_defines=
555valgrind_command=
6938ec6c
NN
556
557dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
558dnl # an if statement. This was the source of very frustrating bugs
559dnl # in converting to autoconf 2.5x!
560AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
561
cdce5c16 562if test x$ac_valgrind_checking != x ; then
414d23ae
HPN
563 # It is certainly possible that there's valgrind but no valgrind.h.
564 # GCC relies on making annotations so we must have both.
a207b594 565 AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>)
f04f1d2c
KC
566 AC_PREPROC_IFELSE([AC_LANG_SOURCE(
567 [[#include <valgrind/memcheck.h>
a207b594
HPN
568#ifndef VALGRIND_DISCARD
569#error VALGRIND_DISCARD not defined
f04f1d2c 570#endif]])],
a207b594
HPN
571 [gcc_cv_header_valgrind_memcheck_h=yes],
572 [gcc_cv_header_valgrind_memcheck_h=no])
573 AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
14011ca4 574 AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
f04f1d2c
KC
575 AC_PREPROC_IFELSE([AC_LANG_SOURCE(
576 [[#include <memcheck.h>
14011ca4
AJ
577#ifndef VALGRIND_DISCARD
578#error VALGRIND_DISCARD not defined
f04f1d2c
KC
579#endif]])],
580 [gcc_cv_header_memcheck_h=yes],
581 [gcc_cv_header_memcheck_h=no])
14011ca4 582 AC_MSG_RESULT($gcc_cv_header_memcheck_h)
414d23ae
HPN
583 AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
584 [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
a207b594
HPN
585 if test "x$valgrind_path" = "x" \
586 || (test $have_valgrind_h = no \
587 && test $gcc_cv_header_memcheck_h = no \
588 && test $gcc_cv_header_valgrind_memcheck_h = no); then
589 AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
414d23ae
HPN
590 fi
591 valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
592 valgrind_command="$valgrind_path -q"
593 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
594[Define if you want to run subprograms and generated programs
595 through valgrind (a memory checker). This is extremely expensive.])
a207b594
HPN
596 if test $gcc_cv_header_valgrind_memcheck_h = yes; then
597 AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
598 [Define if valgrind's valgrind/memcheck.h header is installed.])
599 fi
14011ca4
AJ
600 if test $gcc_cv_header_memcheck_h = yes; then
601 AC_DEFINE(HAVE_MEMCHECK_H, 1,
602 [Define if valgrind's memcheck.h header is installed.])
603 fi
414d23ae
HPN
604fi
605AC_SUBST(valgrind_path_defines)
606AC_SUBST(valgrind_command)
51d0e20c 607
74ee1642
PB
608AC_ARG_ENABLE(mapped-location,
609[ --enable-mapped-location location_t is fileline integer cookie],,
610enable_mapped_location=no)
611
612if test "$enable_mapped_location" = yes ; then
613 AC_DEFINE(USE_MAPPED_LOCATION, 1,
614[Define if location_t is fileline integer cookie.])
615fi
616
22aa533e
NS
617# Enable code coverage collection
618AC_ARG_ENABLE(coverage,
619[ --enable-coverage[=LEVEL]
fb38008e 620 enable compiler's code coverage collection.
22aa533e 621 Use to measure compiler performance and locate
8601608f 622 unused parts of the compiler. With LEVEL, specify
22aa533e
NS
623 optimization. Values are opt, noopt,
624 default is noopt],
625[case "${enableval}" in
6dd297da
NN
626 yes|noopt)
627 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
628 ;;
629 opt)
630 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
631 ;;
632 no)
633 # a.k.a. --disable-coverage
634 coverage_flags=""
635 ;;
636 *)
637 AC_MSG_ERROR(unknown coverage setting $enableval)
638 ;;
22aa533e 639esac],
2043c38e 640[coverage_flags=""])
22aa533e
NS
641AC_SUBST(coverage_flags)
642
439a7e54
DN
643AC_ARG_ENABLE(gather-detailed-mem-stats,
644[ --enable-gather-detailed-mem-stats enable detailed memory allocation stats gathering], [],
645[enable_gather_detailed_mem_stats=no])
646if test x$enable_gather_detailed_mem_stats = xyes ; then
647 AC_DEFINE(GATHER_STATISTICS, 1,
648 [Define to enable detailed memory allocation stats gathering.])
649fi
650
73458fb7
NN
651# -------------------------------
652# Miscenalleous configure options
653# -------------------------------
34a86c2b
NN
654
655# With stabs
656AC_ARG_WITH(stabs,
657[ --with-stabs arrange to use stabs instead of host debug format],
658stabs="$with_stabs",
659stabs=no)
660
34a86c2b
NN
661# Determine whether or not multilibs are enabled.
662AC_ARG_ENABLE(multilib,
663[ --enable-multilib enable library support for multiple ABIs],
664[], [enable_multilib=yes])
665AC_SUBST(enable_multilib)
3ecc3258 666
4bafaa6f
L
667# Enable __cxa_atexit for C++.
668AC_ARG_ENABLE(__cxa_atexit,
669[ --enable-__cxa_atexit enable __cxa_atexit for C++],
670[], [])
2121a768 671
486aa804
BE
672# Enable C extension for decimal float if target supports it.
673AC_ARG_ENABLE(decimal-float,
674[ --enable-decimal-float enable decimal float extension to C],
675[
676 if test x$enablevar = xyes ; then
677 case $target in
678 powerpc*-*-linux* | i?86*-*-linux*)
a4a9df5f 679 enable_decimal_float=yes
486aa804
BE
680 ;;
681 *)
682 AC_MSG_WARN(decimal float is not supported for this target, ignored)
683 enable_decimal_float=no
684 ;;
685 esac
686 fi
a4a9df5f 687], [enable_decimal_float=no])
486aa804
BE
688
689AC_SUBST(enable_decimal_float)
690
691dfp=`if test $enable_decimal_float = yes; then echo 1; else echo 0; fi`
692AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
693[Define to 1 to enable decimal float extension to C.])
694
0bbb1697
RK
695# Enable threads
696# Pass with no value to take the default
697# Pass with a value to specify a thread package
698AC_ARG_ENABLE(threads,
e8bec136
RO
699[ --enable-threads enable thread usage for target GCC
700 --enable-threads=LIB use LIB thread package for target GCC],,
615be2cf 701[enable_threads=''])
0bbb1697 702
8dea1cca
DD
703AC_ARG_ENABLE(tls,
704[ --enable-tls enable or disable generation of tls code
705 overriding the assembler check for tls support],
706[
707 case $enable_tls in
708 yes | no) ;;
709 *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
710Valid choices are 'yes' and 'no'.]) ;;
711 esac
712], [enable_tls=''])
713
d8bb17c8
OP
714AC_ARG_ENABLE(objc-gc,
715[ --enable-objc-gc enable the use of Boehm's garbage collector with
e8bec136 716 the GNU Objective-C runtime],
2618c083 717if test x$enable_objc_gc = xno; then
d8bb17c8
OP
718 objc_boehm_gc=''
719else
720 objc_boehm_gc=1
721fi,
722objc_boehm_gc='')
723
90e6a802 724AC_ARG_WITH(dwarf2,
e8bec136 725[ --with-dwarf2 force the default debug format to be DWARF 2],
90e6a802
RL
726dwarf2="$with_dwarf2",
727dwarf2=no)
728
50503ac8 729AC_ARG_ENABLE(shared,
e8bec136 730[ --disable-shared don't provide a shared libgcc],
c785e0fa
AO
731[
732 case $enable_shared in
733 yes | no) ;;
734 *)
735 enable_shared=no
736 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
737 for pkg in $enableval; do
738 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
739 enable_shared=yes
740 fi
741 done
742 IFS="$ac_save_ifs"
743 ;;
744 esac
745], [enable_shared=yes])
50503ac8
RH
746AC_SUBST(enable_shared)
747
160633c6
MM
748AC_ARG_WITH(build-sysroot,
749 [ --with-build-sysroot=sysroot
750 use sysroot as the system root during the build])
751
4977bab6
ZW
752AC_ARG_WITH(sysroot,
753[ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
754[
755 case ${with_sysroot} in
caa55b1e 756 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
4977bab6
ZW
757 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
758 esac
759
760 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
761 CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
b28250ab 762
047d636f
DJ
763 if test "x$exec_prefix" = xNONE; then
764 if test "x$prefix" = xNONE; then
765 test_prefix=/usr/local
766 else
767 test_prefix=$prefix
768 fi
769 else
770 test_prefix=$exec_prefix
771 fi
772 case ${TARGET_SYSTEM_ROOT} in
91710e62
AO
773 "${test_prefix}"|"${test_prefix}/"*|\
774 '${exec_prefix}'|'${exec_prefix}/'*)
047d636f
DJ
775 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
776 TARGET_SYSTEM_ROOT_DEFINE="$t"
777 ;;
778 esac
4977bab6
ZW
779], [
780 TARGET_SYSTEM_ROOT=
db720d9a 781 TARGET_SYSTEM_ROOT_DEFINE=
4977bab6
ZW
782 CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
783])
784AC_SUBST(TARGET_SYSTEM_ROOT)
785AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
786AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
787
d1bd0ded 788# Build with intermodule optimisations
d1bd0ded
GK
789AC_ARG_ENABLE(intermodule,
790[ --enable-intermodule build the compiler in one step],
0c46c5c7
KC
791[case ${enable_intermodule} in
792 yes) onestep="-onestep";;
793 *) onestep="";;
794esac],
795[onestep=""])
d1bd0ded
GK
796AC_SUBST(onestep)
797
e4c9c075
PB
798# Sanity check enable_languages in case someone does not run the toplevel
799# configure # script.
800AC_ARG_ENABLE(languages,
801[ --enable-languages=LIST specify which front-ends to build],
802[case ,${enable_languages}, in
803 ,,|,yes,)
804 # go safe -- we cannot be much sure without the toplevel
805 # configure's
806 # analysis of which target libs are present and usable
807 enable_languages=c
808 ;;
809 *,all,*)
810 AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
811 ;;
812 *,c,*)
813 ;;
814 *)
815 enable_languages=c,${enable_languages}
816 ;;
817esac],
818[enable_languages=c])
819
e4c9c075 820
73458fb7
NN
821# -------------------------
822# Checks for other programs
823# -------------------------
61842080 824
e9a25f70
JL
825AC_PROG_MAKE_SET
826
46f18e7b
RK
827# Find some useful tools
828AC_PROG_AWK
776dc15d 829# We need awk to create options.c and options.h.
2c4902b9
NN
830# Bail out if it's missing.
831case ${AWK} in
832 "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
833esac
834
99e757d5 835gcc_AC_PROG_LN_S
ad6717df 836ACX_PROG_LN($LN_S)
46f18e7b 837AC_PROG_RANLIB
343a6100
MM
838case "${host}" in
839*-*-darwin*)
840 # By default, the Darwin ranlib will not treat common symbols as
841 # definitions when building the archive table of contents. Other
842 # ranlibs do that; pass an option to the Darwin ranlib that makes
843 # it behave similarly.
844 ranlib_flags="-c"
845 ;;
846*)
847 ranlib_flags=""
848esac
849AC_SUBST(ranlib_flags)
850
99e757d5 851gcc_AC_PROG_INSTALL
46f18e7b 852
3a000df0
KC
853# See if cmp has --ignore-initial.
854gcc_AC_PROG_CMP_IGNORE_INITIAL
855
955be633
JM
856# See if we have the mktemp command.
857AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
858
7c27e184
PB
859MISSING="${CONFIG_SHELL-/bin/sh} $srcdir/../missing"
860
861# See if makeinfo has been installed and is modern enough
862# that we can use it.
863gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
09fa0705 864 [GNU texinfo.* \([0-9][0-9.]*\)],
1a598a97 865 [4.[4-9]*])
09fa0705 866if test $gcc_cv_prog_makeinfo_modern = no; then
7c27e184 867 MAKEINFO="$MISSING makeinfo"
09fa0705
ZW
868 AC_MSG_WARN([
869*** Makeinfo is missing or too old.
17db6582 870*** Info documentation will not be built.])
09fa0705 871 BUILD_INFO=
09fa0705 872else
7c27e184 873 BUILD_INFO=info
09fa0705 874fi
7c27e184 875AC_SUBST(BUILD_INFO)
09fa0705 876
3f896fc2
JM
877# Is pod2man recent enough to regenerate manpages?
878AC_MSG_CHECKING([for recent Pod::Man])
7be33370 879if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
fd939e46 880 AC_MSG_RESULT(yes)
7c27e184 881 GENERATED_MANPAGES=generated-manpages
fd939e46
JM
882else
883 AC_MSG_RESULT(no)
884 GENERATED_MANPAGES=
885fi
7c27e184 886AC_SUBST(GENERATED_MANPAGES)
fd939e46 887
1e608388
ZW
888# How about lex?
889dnl Don't use AC_PROG_LEX; we insist on flex.
890dnl LEXLIB is not useful in gcc.
7c27e184 891AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
1e608388
ZW
892
893# Bison?
7c27e184
PB
894AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
895
896# Binutils are not build modules, unlike bison/flex/makeinfo. So we
897# check for build == host before using them.
1e608388 898
f6a874ac 899# NM
414adbdd
GK
900if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
901 && test -d ../binutils ; then
f6a874ac
JW
902 NM='$(objdir)/../binutils/nm-new'
903else
904 AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
905fi
906
907# AR
414adbdd
GK
908if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
909 && test -d ../binutils ; then
f6a874ac
JW
910 AR='$(objdir)/../binutils/ar'
911else
912 AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
913fi
914
915
73458fb7
NN
916# --------------------
917# Checks for C headers
918# --------------------
919
920AC_MSG_CHECKING(for GNU C library)
921AC_CACHE_VAL(gcc_cv_glibc,
f04f1d2c
KC
922[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
923 [[#include <features.h>]], [[
73458fb7
NN
924#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
925#error Not a GNU C library system
f04f1d2c
KC
926#endif]])],
927 [gcc_cv_glibc=yes],
928 [gcc_cv_glibc=no])])
73458fb7
NN
929AC_MSG_RESULT($gcc_cv_glibc)
930if test $gcc_cv_glibc = yes; then
931 AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
932fi
933
ca9bc441
NN
934# Need to reject headers which give warnings, so that the -Werror bootstrap
935# works later. *sigh* This needs to come before all header checks.
936AC_PROG_CPP_WERROR
937
73458fb7
NN
938AC_HEADER_STDC
939AC_HEADER_TIME
4f4e53dd 940ACX_HEADER_STRING
73458fb7 941AC_HEADER_SYS_WAIT
dfb77e37 942AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
1072ec3f 943 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
73458fb7 944 sys/resource.h sys/param.h sys/times.h sys/stat.h \
56694dd9 945 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
73458fb7
NN
946
947# Check for thread headers.
948AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
949AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
950
951# These tests can't be done till we know if we have limits.h.
952gcc_AC_C_CHAR_BIT
9791c75c 953AC_C_BIGENDIAN
73458fb7
NN
954
955# --------
956# UNSORTED
957# --------
958
959# Stage specific cflags for build.
960stage1_cflags=
961case $build in
962vax-*-*)
963 if test x$GCC = xyes
964 then
965 stage1_cflags="-Wa,-J"
966 else
967 stage1_cflags="-J"
968 fi
969 ;;
970powerpc-*-darwin*)
971 # The spiffy cpp-precomp chokes on some legitimate constructs in GCC
972 # sources; use -no-cpp-precomp to get to GNU cpp.
973 # Apple's GCC has bugs in designated initializer handling, so disable
974 # that too.
975 stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
976 ;;
977esac
978AC_SUBST(stage1_cflags)
979
4e70264f
ZW
980# These libraries may be used by collect2.
981# We may need a special search path to get them linked.
982AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
983[save_LIBS="$LIBS"
7f2749d4 984for libs in '' -lld -lmld \
4e70264f
ZW
985 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
986 '-L/usr/lib/cmplrs/cc3.11 -lmld'
987do
988 LIBS="$libs"
989 AC_TRY_LINK_FUNC(ldopen,
990 [gcc_cv_collect2_libs="$libs"; break])
991done
992LIBS="$save_LIBS"
993test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
994case $gcc_cv_collect2_libs in
995 "none required") ;;
996 *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
997esac
998AC_SUBST(COLLECT2_LIBS)
999
7f2749d4
RK
1000# When building Ada code on Alpha, we need exc_resume which is usually in
1001# -lexc. So test for it.
1002save_LIBS="$LIBS"
1003LIBS=
1004AC_SEARCH_LIBS(exc_resume, exc)
1005GNAT_LIBEXC="$LIBS"
1006LIBS="$save_LIBS"
1007AC_SUBST(GNAT_LIBEXC)
1008
62c9aa5f
ZW
1009# Some systems put ldexp and frexp in libm instead of libc; assume
1010# they're both in the same place. jcf-dump needs them.
1011save_LIBS="$LIBS"
1012LIBS=
1013AC_SEARCH_LIBS(ldexp, m)
1014LDEXP_LIB="$LIBS"
1015LIBS="$save_LIBS"
1016AC_SUBST(LDEXP_LIB)
1017
7636d567
JW
1018# Use <inttypes.h> only if it exists,
1019# doesn't clash with <sys/types.h>, and declares intmax_t.
1020AC_MSG_CHECKING(for inttypes.h)
1021AC_CACHE_VAL(gcc_cv_header_inttypes_h,
f04f1d2c
KC
1022[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1023[[#include <sys/types.h>
1024#include <inttypes.h>]],
1025 [[intmax_t i = -1;]])],
9da0e39b 1026 [gcc_cv_header_inttypes_h=yes],
f04f1d2c 1027 [gcc_cv_header_inttypes_h=no])])
7636d567 1028AC_MSG_RESULT($gcc_cv_header_inttypes_h)
9da0e39b 1029if test $gcc_cv_header_inttypes_h = yes; then
119d24d1
KG
1030 AC_DEFINE(HAVE_INTTYPES_H, 1,
1031 [Define if you have a working <inttypes.h> header file.])
9da0e39b 1032fi
cdcc6a01 1033
9612ab65
ZW
1034dnl Disabled until we have a complete test for buggy enum bitfields.
1035dnl gcc_AC_C_ENUM_BF_UNSIGNED
c149cc37 1036
0d667716
KG
1037define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1038 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1039 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1040 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1041 putchar_unlocked putc_unlocked)
52a6edcc 1042AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
0d667716
KG
1043 sysconf strsignal getrusage nl_langinfo scandir alphasort \
1044 gettimeofday mbstowcs wcswidth mmap mincore setlocale \
1045 gcc_UNLOCKED_FUNCS)
a81fb89e 1046
39f6c4c8
KW
1047if test x$ac_cv_func_mbstowcs = xyes; then
1048 AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
f04f1d2c 1049[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
39f6c4c8
KW
1050int main()
1051{
1052 mbstowcs(0, "", 0);
1053 return 0;
f04f1d2c
KC
1054}]])],
1055 [gcc_cv_func_mbstowcs_works=yes],
1056 [gcc_cv_func_mbstowcs_works=no],
1057 [gcc_cv_func_mbstowcs_works=yes])])
39f6c4c8
KW
1058 if test x$gcc_cv_func_mbstowcs_works = xyes; then
1059 AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1060 [Define this macro if mbstowcs does not crash when its
1061 first argument is NULL.])
1062 fi
1063fi
1064
78c9cb99 1065AC_CHECK_TYPE(ssize_t, int)
56f48ce9 1066
e256b8b6
DA
1067# Try to determine the array type of the second argument of getgroups
1068# for the target system (int or gid_t).
1069AC_TYPE_GETGROUPS
1070if test "${target}" = "${build}"; then
1071 TARGET_GETGROUPS_T=$ac_cv_type_getgroups
1072else
1073 case "${target}" in
1074 # This condition may need some tweaking. It should include all
1075 # targets where the array type of the second argument of getgroups
1076 # is int and the type of gid_t is not equivalent to int.
1077 *-*-sunos* | *-*-ultrix*)
1078 TARGET_GETGROUPS_T=int
1079 ;;
1080 *)
1081 TARGET_GETGROUPS_T=gid_t
1082 ;;
1083 esac
1084fi
1085AC_SUBST(TARGET_GETGROUPS_T)
1086
1072ec3f 1087gcc_AC_FUNC_MMAP_BLACKLIST
b27d2bd5
MK
1088
1089case "${host}" in
ee262b6f 1090*-*-*vms*)
2c55543b 1091 # Under VMS, vfork works very differently than on Unix. The standard test
ee262b6f
DR
1092 # won't work, and it isn't easily adaptable. It makes more sense to
1093 # just force it.
1094 ac_cv_func_vfork_works=yes
1095 ;;
b27d2bd5 1096esac
f04f1d2c 1097AC_FUNC_FORK
f1b54f9b 1098
f91abfce 1099AM_ICONV
56694dd9
ZW
1100# Until we have in-tree GNU iconv:
1101LIBICONV_DEP=
1102AC_SUBST(LIBICONV_DEP)
1103
1104AM_LC_MESSAGES
f91abfce 1105
a03ea89b
BM
1106AM_LANGINFO_CODESET
1107
86cf1cbd
KG
1108# We will need to find libiberty.h and ansidecl.h
1109saved_CFLAGS="$CFLAGS"
1110CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
ed5b9f96
GK
1111gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
1112 strsignal strstr strverscmp \
1113 errno snprintf vsnprintf vasprintf malloc realloc calloc \
367e8319 1114 free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
d02af173 1115#include "ansidecl.h"
86cf1cbd 1116#include "system.h"])
c5c76735 1117
f31e826b 1118gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
d02af173 1119#include "ansidecl.h"
86cf1cbd 1120#include "system.h"
d2cabf16
KG
1121#ifdef HAVE_SYS_RESOURCE_H
1122#include <sys/resource.h>
1123#endif
1124])
1125
f04f1d2c 1126AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
b2522d2b
HPN
1127#include "ansidecl.h"
1128#include "system.h"
1129#ifdef HAVE_SYS_RESOURCE_H
1130#include <sys/resource.h>
1131#endif
f04f1d2c 1132]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
b2522d2b
HPN
1133[Define to \`long' if <sys/resource.h> doesn't define.])])
1134
2102b2fe
RS
1135# On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
1136# FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname
1137# in collect2.c, <fcntl.h> isn't visible, but the configure test below needs
1138# to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
351df804
KG
1139gcc_AC_CHECK_DECLS(ldgetname, , ,[
1140#include "ansidecl.h"
1141#include "system.h"
1142#ifdef HAVE_LDFCN_H
2102b2fe
RS
1143#undef FREAD
1144#undef FWRITE
351df804
KG
1145#include <ldfcn.h>
1146#endif
1147])
1148
c1800ec8
ZW
1149gcc_AC_CHECK_DECLS(times, , ,[
1150#include "ansidecl.h"
1151#include "system.h"
1152#ifdef HAVE_SYS_TIMES_H
1153#include <sys/times.h>
1154#endif
1155])
1156
4f6d8cc8
GK
1157gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1158#include "ansidecl.h"
1159#include "system.h"
1160#include <signal.h>
1161])
1162
c1800ec8
ZW
1163# More time-related stuff.
1164AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
f04f1d2c 1165AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c1800ec8
ZW
1166#include "ansidecl.h"
1167#include "system.h"
1168#ifdef HAVE_SYS_TIMES_H
1169#include <sys/times.h>
1170#endif
f04f1d2c 1171]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
c1800ec8
ZW
1172if test $ac_cv_struct_tms = yes; then
1173 AC_DEFINE(HAVE_STRUCT_TMS, 1,
1174 [Define if <sys/times.h> defines struct tms.])
1175fi
1176
1177# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1178# revisit after autoconf 2.50.
1179AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
f04f1d2c 1180AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c1800ec8
ZW
1181#include "ansidecl.h"
1182#include "system.h"
f04f1d2c 1183]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
c1800ec8
ZW
1184if test $gcc_cv_type_clock_t = yes; then
1185 AC_DEFINE(HAVE_CLOCK_T, 1,
1186 [Define if <time.h> defines clock_t.])
1187fi
1188
86cf1cbd
KG
1189# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
1190CFLAGS="$saved_CFLAGS"
1191
eb70d86d
AS
1192gcc_AC_INITFINI_ARRAY
1193
75923b2f 1194# mkdir takes a single argument on some systems.
99e757d5 1195gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
75923b2f 1196
46f18e7b
RK
1197# File extensions
1198manext='.1'
1199objext='.o'
46f18e7b
RK
1200AC_SUBST(manext)
1201AC_SUBST(objext)
46f18e7b 1202
4977bab6
ZW
1203# With Setjmp/Longjmp based exception handling.
1204AC_ARG_ENABLE(sjlj-exceptions,
1205[ --enable-sjlj-exceptions
1206 arrange to use setjmp/longjmp exception handling],
1207[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1208AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1209 [Define 0/1 to force the choice for exception handling model.])])
1210
443728bb
L
1211# For platforms with the unwind ABI which includes an unwind library,
1212# libunwind, we can choose to use the system libunwind.
1213AC_ARG_WITH(system-libunwind,
1214[ --with-system-libunwind use installed libunwind])
4977bab6 1215
34a86c2b
NN
1216# --------------------------------------------------------
1217# Build, host, and target specific configuration fragments
1218# --------------------------------------------------------
1219
5b28c537
NN
1220# Collect build-machine-specific information.
1221. ${srcdir}/config.build
1222
a89ea0df
NN
1223# Collect host-machine-specific information.
1224. ${srcdir}/config.host
1225
ef69da62 1226target_gtfiles=
a89ea0df
NN
1227
1228# Collect target-machine-specific information.
b01bc573 1229. ${srcdir}/config.gcc
46f18e7b
RK
1230
1231extra_objs="${host_extra_objs} ${extra_objs}"
30500d84 1232extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
46f18e7b
RK
1233
1234# Default the target-machine variables that were not explicitly set.
75bffa71 1235if test x"$tm_file" = x
46f18e7b
RK
1236then tm_file=$cpu_type/$cpu_type.h; fi
1237
6b2adea9 1238if test x"$extra_headers" = x
46f18e7b
RK
1239then extra_headers=; fi
1240
75bffa71 1241if test x$md_file = x
e98e406f 1242then md_file=$cpu_type/$cpu_type.md; fi
46f18e7b 1243
75bffa71 1244if test x$out_file = x
46f18e7b
RK
1245then out_file=$cpu_type/$cpu_type.c; fi
1246
75bffa71 1247if test x"$tmake_file" = x
46f18e7b
RK
1248then tmake_file=$cpu_type/t-$cpu_type
1249fi
1250
90e6a802 1251if test x"$dwarf2" = xyes
756ee602 1252then tm_file="$tm_file tm-dwarf2.h"
90e6a802
RL
1253fi
1254
46f18e7b 1255# Say what files are being used for the output code and MD file.
11642c3a 1256echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
46f18e7b
RK
1257echo "Using \`$srcdir/config/$md_file' as machine description file."
1258
11642c3a 1259# If any of the xm_file variables contain nonexistent files, warn
4dc0535b
ZW
1260# about them and drop them.
1261
11642c3a
ZW
1262bx=
1263for x in $build_xm_file; do
1264 if test -f $srcdir/config/$x
1265 then bx="$bx $x"
11642c3a
ZW
1266 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1267 fi
1268done
1269build_xm_file="$bx"
1270
1271hx=
1272for x in $host_xm_file; do
1273 if test -f $srcdir/config/$x
1274 then hx="$hx $x"
11642c3a
ZW
1275 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1276 fi
1277done
1278host_xm_file="$hx"
1279
1280tx=
1281for x in $xm_file; do
1282 if test -f $srcdir/config/$x
1283 then tx="$tx $x"
11642c3a
ZW
1284 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1285 fi
1286done
1287xm_file="$tx"
1288
46f18e7b
RK
1289count=a
1290for f in $tm_file; do
1291 count=${count}x
1292done
75bffa71 1293if test $count = ax; then
46f18e7b
RK
1294 echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1295else
1296 echo "Using the following target machine macro files:"
1297 for f in $tm_file; do
1298 echo " $srcdir/config/$f"
1299 done
1300fi
1301
4977bab6
ZW
1302if test x$need_64bit_hwint = xyes; then
1303 AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1,
1304[Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).])
1305fi
1306
99fa8911
AP
1307if test x$use_long_long_for_widest_fast_int = xyes; then
1308 AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
1309[Define to 1 if the 'long long' (or '__int64') is wider than 'long' but still
1310efficiently supported by the host hardware.])
1311fi
1312
46f18e7b
RK
1313count=a
1314for f in $host_xm_file; do
1315 count=${count}x
1316done
11642c3a
ZW
1317if test $count = a; then
1318 :
1319elif test $count = ax; then
46f18e7b
RK
1320 echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1321else
1322 echo "Using the following host machine macro files:"
1323 for f in $host_xm_file; do
1324 echo " $srcdir/config/$f"
1325 done
1326fi
476d9098 1327echo "Using ${out_host_hook_obj} for host machine hooks."
46f18e7b 1328
75bffa71 1329if test "$host_xm_file" != "$build_xm_file"; then
46f18e7b
RK
1330 count=a
1331 for f in $build_xm_file; do
1332 count=${count}x
1333 done
11642c3a
ZW
1334 if test $count = a; then
1335 :
1336 elif test $count = ax; then
46f18e7b
RK
1337 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1338 else
1339 echo "Using the following build machine macro files:"
1340 for f in $build_xm_file; do
1341 echo " $srcdir/config/$f"
1342 done
1343 fi
1344fi
1345
4f6d8cc8
GK
1346case ${host} in
1347 powerpc-*-darwin*)
1348 AC_CACHE_CHECK([whether mcontext_t fields have underscores],
1349 gcc_cv_mcontext_underscores,
1350 AC_COMPILE_IFELSE([
1351#include <ucontext.h>
1352int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
1353],
1354 gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
1355 if test $gcc_cv_mcontext_underscores = yes; then
1356 AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
1357 [mcontext_t fields start with __])
1358 fi
1359 ;;
1360esac
1361
8bb915b6
NN
1362# ---------
1363# Threading
1364# ---------
1365
c2e494a8 1366# Check if a valid thread package
615be2cf 1367case ${enable_threads} in
c2e494a8
NN
1368 "" | no)
1369 # No threads
1370 target_thread_file='single'
1371 ;;
1372 yes)
1373 # default
1374 target_thread_file='single'
1375 ;;
18167442 1376 aix | dce | gnat | irix | posix | posix95 | rtems | \
769e49eb 1377 single | solaris | vxworks | win32 )
615be2cf 1378 target_thread_file=${enable_threads}
c2e494a8
NN
1379 ;;
1380 *)
615be2cf 1381 echo "${enable_threads} is an unknown thread package" 1>&2
c2e494a8
NN
1382 exit 1
1383 ;;
1384esac
1385
1386if test x${thread_file} = x; then
1387 # No thread file set by target-specific clauses in config.gcc,
1388 # so use file chosen by default logic above
1389 thread_file=${target_thread_file}
46f18e7b 1390fi
46f18e7b 1391
8bb915b6
NN
1392# Make gthr-default.h if we have a thread file.
1393gthread_flags=
1394if test $thread_file != single; then
1395 rm -f gthr-default.h
1396 echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
1397 gthread_flags=-DHAVE_GTHR_DEFAULT
1398fi
1399AC_SUBST(gthread_flags)
1400
1401# --------
1402# UNSORTED
1403# --------
1404
18fbf599 1405use_cxa_atexit=no
2121a768
JT
1406if test x$enable___cxa_atexit = xyes || \
1407 test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
18fbf599
PB
1408 if test x$host = x$target; then
1409 AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
1410 [echo "__cxa_atexit can't be enabled on this target"])
1411 else
1412 # We can't check for __cxa_atexit when building a cross, so assume
1413 # it is available
1414 use_cxa_atexit=yes
1415 fi
1416 if test x$use_cxa_atexit = xyes; then
c7b5e395 1417 AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
18fbf599
PB
1418 [Define if you want to use __cxa_atexit, rather than atexit, to
1419 register C++ destructors for local statics and global objects.
1420 This is essential for fully standards-compliant handling of
1421 destructors, but requires __cxa_atexit in libc.])
1422 fi
2121a768
JT
1423fi
1424
a5381466 1425# Look for a file containing extra machine modes.
1c0ca89d
ZW
1426if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
1427 extra_modes_file='$(srcdir)'/config/${extra_modes}
a5381466 1428 AC_SUBST(extra_modes_file)
e22340b0 1429 AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
a5381466
ZW
1430 [Define to the name of a file containing a list of extra machine modes
1431 for this architecture.])
a5381466
ZW
1432fi
1433
75685792
RS
1434# Convert extra_options into a form suitable for Makefile use.
1435extra_opt_files=
1436for f in $extra_options; do
1437 extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
1438done
1439AC_SUBST(extra_opt_files)
1440
b7cb92ad 1441# auto-host.h is the file containing items generated by autoconf and is
e9a25f70 1442# the first file included by config.h.
4977bab6 1443# If host=build, it is correct to have bconfig include auto-host.h
db81d74a
RH
1444# as well. If host!=build, we are in error and need to do more
1445# work to find out the build config parameters.
75bffa71 1446if test x$host = x$build
db81d74a 1447then
eaf4e618 1448 build_auto=auto-host.h
b7cb92ad
JL
1449else
1450 # We create a subdir, then run autoconf in the subdir.
1451 # To prevent recursion we set host and build for the new
1452 # invocation of configure to the build for this invocation
1453 # of configure.
1454 tempdir=build.$$
1455 rm -rf $tempdir
1456 mkdir $tempdir
1457 cd $tempdir
1458 case ${srcdir} in
b86ecfa9 1459 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
b7cb92ad
JL
1460 *) realsrcdir=../${srcdir};;
1461 esac
d920e825
L
1462 saved_CFLAGS="${CFLAGS}"
1463 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
1464 ${realsrcdir}/configure \
33e70558 1465 --enable-languages=${enable_languages-all} \
534d0cc0 1466 --target=$target_alias --host=$build_alias --build=$build_alias
d920e825 1467 CFLAGS="${saved_CFLAGS}"
b7cb92ad
JL
1468
1469 # We just finished tests for the build machine, so rename
1470 # the file auto-build.h in the gcc directory.
1471 mv auto-host.h ../auto-build.h
1472 cd ..
1473 rm -rf $tempdir
eaf4e618 1474 build_auto=auto-build.h
db81d74a 1475fi
71b5d516 1476AC_SUBST(build_subdir)
db81d74a 1477
eaf4e618 1478tm_file="${tm_file} defaults.h"
4977bab6
ZW
1479tm_p_file="${tm_p_file} tm-preds.h"
1480host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1481build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
49691411 1482# We don't want ansidecl.h in target files, write code there in ISO/GNU C.
b4862477 1483# put this back in temporarily.
232b67d9 1484xm_file="auto-host.h ansidecl.h ${xm_file}"
0056a9b5 1485
34a86c2b
NN
1486# --------
1487# UNSORTED
1488# --------
1489
afabd8e6 1490changequote(,)dnl
cc1e60ea 1491# Compile in configure arguments.
8105825d 1492if test -f configargs.h ; then
cc1e60ea 1493 # Being re-configured.
022dae81 1494 gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
cc1e60ea
JM
1495 gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1496else
1497 gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1498fi
eeae7b41
DJ
1499
1500# Double all backslashes and backslash all quotes to turn
1501# gcc_config_arguments into a C string.
1502sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
1503$gcc_config_arguments
1504EOF
1505gcc_config_arguments_str=`cat conftest.out`
1506rm -f conftest.out
1507
cc1e60ea
JM
1508cat > configargs.h <<EOF
1509/* Generated automatically. */
eeae7b41 1510static const char configuration_arguments[] = "$gcc_config_arguments_str";
a6687d2b 1511static const char thread_model[] = "$thread_file";
7816bea0
DJ
1512
1513static const struct {
1514 const char *name, *value;
1515} configure_default_options[] = $configure_default_options;
cc1e60ea 1516EOF
75bffa71 1517changequote([,])dnl
46f18e7b 1518
ab87f8c8 1519# Internationalization
56694dd9 1520ZW_GNU_GETTEXT_SISTER_DIR
dc6746e7 1521
56694dd9
ZW
1522# If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
1523# -liconv on the link line twice.
1524case "$LIBINTL" in *$LIBICONV*)
1525 LIBICONV= ;;
1526esac
ab87f8c8 1527
7f970b70
AM
1528AC_ARG_ENABLE(secureplt,
1529[ --enable-secureplt enable -msecure-plt by default for PowerPC],
1530[], [])
1531
f4ab28e3
MK
1532# Windows32 Registry support for specifying GCC installation paths.
1533AC_ARG_ENABLE(win32-registry,
1534[ --disable-win32-registry
e8bec136
RO
1535 disable lookup of installation paths in the
1536 Registry on Windows hosts
1537 --enable-win32-registry enable registry lookup (default)
f4ab28e3 1538 --enable-win32-registry=KEY
e8bec136
RO
1539 use KEY instead of GCC version as the last portion
1540 of the registry key],,)
a1286ef5 1541
4e70264f 1542case $host_os in
a1286ef5
ZW
1543 win32 | pe | cygwin* | mingw32* | uwin*)
1544 if test "x$enable_win32_registry" != xno; then
1545 AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
1546 fi
f4ab28e3 1547
a1286ef5
ZW
1548 if test "x$enable_win32_registry" != xno; then
1549 AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1550 [Define to 1 if installation paths should be looked up in the Windows
1551 Registry. Ignored on non-Windows hosts.])
1552
1553 if test "x$enable_win32_registry" != xyes \
1554 && test "x$enable_win32_registry" != x; then
1555 AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
1556 [Define to be the last component of the Windows registry key under which
1557 to look for installation paths. The full key used will be
1558 HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
1559 The default is the GCC version number.])
1560 fi
1561 fi
f4ab28e3
MK
1562 ;;
1563esac
1564
7fa10b25 1565# Get an absolute path to the GCC top-level source directory
1e6347d8 1566holddir=`${PWDCMD-pwd}`
7fa10b25 1567cd $srcdir
1e6347d8 1568topdir=`${PWDCMD-pwd}`
7fa10b25
RK
1569cd $holddir
1570
af5e4ada 1571# Conditionalize the makefile for this host machine.
2ed26f6b 1572xmake_file=
c406e779 1573for f in ${host_xmake_file}
94f42018 1574do
75bffa71 1575 if test -f ${srcdir}/config/$f
94f42018 1576 then
2ed26f6b 1577 xmake_file="${xmake_file} \$(srcdir)/config/$f"
94f42018
DE
1578 fi
1579done
46f18e7b 1580
af5e4ada 1581# Conditionalize the makefile for this target machine.
2ed26f6b 1582tmake_file_=
c406e779 1583for f in ${tmake_file}
94f42018 1584do
75bffa71 1585 if test -f ${srcdir}/config/$f
94f42018 1586 then
2ed26f6b 1587 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
94f42018
DE
1588 fi
1589done
2ed26f6b 1590tmake_file="${tmake_file_}"
5891b37d 1591
af5e4ada
DE
1592# If the host doesn't support symlinks, modify CC in
1593# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
1594# Otherwise, we can use "CC=$(CC)".
1595rm -f symtest.tem
35f06ae4
PB
1596case "$LN_S" in
1597 *-s*)
1598 cc_set_by_configure="\$(CC)"
1599 quoted_cc_set_by_configure="\$(CC)"
1600 stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
1601 quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
1602 ;;
1603 *)
1604 cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
1605 quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
1606 stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
1607 quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
1608 ;;
1609esac
5891b37d 1610
5395b47b
NN
1611# This is a terrible hack which will go away some day.
1612host_cc_for_libada=${CC}
1613AC_SUBST(host_cc_for_libada)
1e3fad21 1614
af5e4ada 1615out_object_file=`basename $out_file .c`.o
5891b37d 1616
75685792
RS
1617tm_file_list="options.h"
1618tm_include_list="options.h"
af5e4ada 1619for f in $tm_file; do
64ccbc99 1620 case $f in
d02af173 1621 defaults.h )
e22340b0
ZW
1622 tm_file_list="${tm_file_list} \$(srcdir)/$f"
1623 tm_include_list="${tm_include_list} $f"
1624 ;;
1625 * )
1626 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
1627 tm_include_list="${tm_include_list} config/$f"
1628 ;;
64ccbc99 1629 esac
af5e4ada 1630done
46f18e7b 1631
11642c3a 1632tm_p_file_list=
e22340b0 1633tm_p_include_list=
11642c3a 1634for f in $tm_p_file; do
4977bab6
ZW
1635 case $f in
1636 tm-preds.h )
e22340b0
ZW
1637 tm_p_file_list="${tm_p_file_list} $f"
1638 tm_p_include_list="${tm_p_include_list} $f"
1639 ;;
1640 * )
1641 tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
1642 tm_p_include_list="${tm_p_include_list} config/$f"
1643 esac
1644done
1645
1646xm_file_list=
1647xm_include_list=
1648for f in $xm_file; do
1649 case $f in
1650 ansidecl.h )
1651 xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
1652 xm_include_list="${xm_include_list} $f"
1653 ;;
1654 auto-host.h )
1655 xm_file_list="${xm_file_list} $f"
1656 xm_include_list="${xm_include_list} $f"
1657 ;;
1658 * )
1659 xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
1660 xm_include_list="${xm_include_list} config/$f"
1661 ;;
4977bab6 1662 esac
11642c3a
ZW
1663done
1664
af5e4ada 1665host_xm_file_list=
e22340b0 1666host_xm_include_list=
af5e4ada 1667for f in $host_xm_file; do
64ccbc99 1668 case $f in
d02af173 1669 ansidecl.h )
e22340b0
ZW
1670 host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
1671 host_xm_include_list="${host_xm_include_list} $f"
1672 ;;
e2500fed 1673 auto-host.h )
e22340b0
ZW
1674 host_xm_file_list="${host_xm_file_list} $f"
1675 host_xm_include_list="${host_xm_include_list} $f"
1676 ;;
1677 * )
1678 host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
1679 host_xm_include_list="${host_xm_include_list} config/$f"
1680 ;;
64ccbc99 1681 esac
af5e4ada
DE
1682done
1683
1684build_xm_file_list=
1685for f in $build_xm_file; do
64ccbc99 1686 case $f in
d02af173 1687 ansidecl.h )
e22340b0
ZW
1688 build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
1689 build_xm_include_list="${build_xm_include_list} $f"
1690 ;;
e2500fed 1691 auto-build.h | auto-host.h )
e22340b0
ZW
1692 build_xm_file_list="${build_xm_file_list} $f"
1693 build_xm_include_list="${build_xm_include_list} $f"
1694 ;;
1695 * )
1696 build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
1697 build_xm_include_list="${build_xm_include_list} config/$f"
1698 ;;
64ccbc99 1699 esac
af5e4ada 1700done
46f18e7b 1701
a078a589
ZW
1702# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
1703# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1704CROSS= AC_SUBST(CROSS)
1705ALL=all.internal AC_SUBST(ALL)
1706SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
b28250ab
MM
1707
1708if test "x$with_build_sysroot" != x; then
1709 build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
1710else
1711 # This value is used, even on a native system, because
1712 # CROSS_SYSTEM_HEADER_DIR is just
1713 # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR).
1714 build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
1715fi
1716
75bffa71 1717if test x$host != x$target
af5e4ada 1718then
a078a589
ZW
1719 CROSS="-DCROSS_COMPILE"
1720 ALL=all.cross
160633c6 1721 SYSTEM_HEADER_DIR=$build_system_header_dir
343f59d9 1722 case "$host","$target" in
3a7e8b87
GK
1723 # Darwin crosses can use the host system's libraries and headers,
1724 # because of the fat library support. Of course, it must be the
1725 # same version of Darwin on both sides. Allow the user to
1726 # just say --target=foo-darwin without a version number to mean
1727 # "the version on this system".
1728 *-*-darwin*,*-*-darwin*)
1729 hostos=`echo $host | sed 's/.*-darwin/darwin/'`
1730 targetos=`echo $target | sed 's/.*-darwin/darwin/'`
1731 if test $hostos = $targetos -o $targetos = darwin ; then
1732 CROSS=
1733 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
1734 with_headers=yes
1735 fi
1736 ;;
1737
343f59d9
AM
1738 i?86-*-*,x86_64-*-* \
1739 | powerpc*-*-*,powerpc64*-*-*)
1740 CROSS="$CROSS -DNATIVE_CROSS" ;;
1741 esac
7a615b25 1742elif test "x$TARGET_SYSTEM_ROOT" != x; then
b28250ab 1743 SYSTEM_HEADER_DIR=$build_system_header_dir
af5e4ada 1744fi
46f18e7b 1745
b39d221a
EC
1746# If this is a cross-compiler that does not
1747# have its own set of headers then define
1748# inhibit_libc
1749
dc06db20
R
1750# If this is using newlib, without having the headers available now,
1751# then define inhibit_libc in LIBGCC2_CFLAGS.
fecd6201
ZW
1752# This prevents libgcc2 from containing any code which requires libc
1753# support.
160633c6 1754inhibit_libc=false
dc06db20
R
1755if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
1756 test x$with_newlib = xyes ; } &&
e50084fa 1757 { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
160633c6 1758 inhibit_libc=true
b39d221a
EC
1759fi
1760AC_SUBST(inhibit_libc)
1761
a078a589
ZW
1762# When building gcc with a cross-compiler, we need to adjust things so
1763# that the generator programs are still built with the native compiler.
1764# Also, we cannot run fixincludes or fix-header.
a078a589
ZW
1765
1766# These are the normal (build=host) settings:
eaf9f3b2 1767CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
4977bab6 1768BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
a078a589 1769STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
587dc9c6
NN
1770
1771# Possibly disable fixproto, on a per-target basis.
1772case ${use_fixproto} in
1773 no)
1774 STMP_FIXPROTO=
1775 ;;
1776 yes)
1777 STMP_FIXPROTO=stmp-fixproto
1778 ;;
1779esac
1780AC_SUBST(STMP_FIXPROTO)
a078a589 1781
83599948
NS
1782# And these apply if build != host, or we are generating coverage data
1783if test x$build != x$host || test "x$coverage_flags" != x
af5e4ada 1784then
b11e4747 1785 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
a078a589 1786
7a615b25 1787 if test "x$TARGET_SYSTEM_ROOT" = x; then
d8e5117d 1788 if test "x$STMP_FIXPROTO" != x; then
de253ca4
GK
1789 STMP_FIXPROTO=stmp-install-fixproto
1790 fi
7a615b25 1791 fi
af5e4ada 1792fi
46f18e7b 1793
ae3a15bb
DE
1794# Expand extra_headers to include complete path.
1795# This substitutes for lots of t-* files.
1796extra_headers_list=
b1ef58c8
NN
1797# Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
1798for file in ${extra_headers} ; do
1799 extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
1800done
ae3a15bb 1801
c38f02df
ILT
1802# Define collect2 in Makefile.
1803case $host_can_use_collect2 in
1804 no) collect2= ;;
1805 *) collect2='collect2$(exeext)' ;;
1806esac
1807AC_SUBST([collect2])
1808
af5e4ada 1809# Add a definition of USE_COLLECT2 if system wants one.
34a86c2b
NN
1810case $use_collect2 in
1811 no) use_collect2= ;;
1812 "") ;;
1813 *)
1814 host_xm_defines="${host_xm_defines} USE_COLLECT2"
1815 xm_defines="${xm_defines} USE_COLLECT2"
c38f02df
ILT
1816 case $host_can_use_collect2 in
1817 no)
1818 AC_MSG_ERROR([collect2 is required but cannot be built on this system])
1819 ;;
1820 esac
34a86c2b
NN
1821 ;;
1822esac
af5e4ada 1823
630327c3
NN
1824# ---------------------------
1825# Assembler & linker features
1826# ---------------------------
1827
d869a8c4
NN
1828# Identify the assembler which will work hand-in-glove with the newly
1829# built GCC, so that we can examine its features. This is the assembler
1830# which will be driven by the driver program.
1831#
1832# If build != host, and we aren't building gas in-tree, we identify a
1833# build->target assembler and hope that it will have the same features
1834# as the host->target assembler we'll be using.
981d4858
JM
1835gcc_cv_gas_major_version=
1836gcc_cv_gas_minor_version=
a2f319ea 1837gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
e8b05380
PB
1838
1839m4_pattern_allow([AS_FOR_TARGET])dnl
1840AS_VAR_SET_IF(gcc_cv_as,, [
3ccc3a56
AO
1841if test -x "$DEFAULT_ASSEMBLER"; then
1842 gcc_cv_as="$DEFAULT_ASSEMBLER"
34a86c2b 1843elif test -f $gcc_cv_as_gas_srcdir/configure.in \
08d105fa
AO
1844 && test -f ../gas/Makefile \
1845 && test x$build = x$host; then
e8b05380
PB
1846 gcc_cv_as=../gas/as-new$build_exeext
1847elif test -x as$build_exeext; then
1848 # Build using assembler in the current directory.
1849 gcc_cv_as=./as$build_exeext
1850elif test -x $AS_FOR_TARGET; then
1851 gcc_cv_as="$AS_FOR_TARGET"
1852else
1853 AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
1854fi])
1855
1856ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
1857AC_SUBST(ORIGINAL_AS_FOR_TARGET)
1858
1859AC_MSG_CHECKING(what assembler to use)
1860if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then
08d105fa
AO
1861 # Single tree build which includes gas. We want to prefer it
1862 # over whatever linker top-level may have detected, since
1863 # we'll use what we're building after installation anyway.
e8b05380 1864 AC_MSG_RESULT(newly built gas)
ad9c4d9f
NN
1865 in_tree_gas=yes
1866 _gcc_COMPUTE_GAS_VERSION
5408ac6c
HPN
1867 in_tree_gas_is_elf=no
1868 if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
1869 || (grep 'obj_format = multi' ../gas/Makefile \
1870 && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
1871 then
1872 in_tree_gas_is_elf=yes
1873 fi
e8b05380
PB
1874else
1875 AC_MSG_RESULT($gcc_cv_as)
1876 in_tree_gas=no
981d4858
JM
1877fi
1878
d869a8c4
NN
1879# Identify the linker which will work hand-in-glove with the newly
1880# built GCC, so that we can examine its features. This is the linker
1881# which will be driven by the driver program.
1882#
1883# If build != host, and we aren't building gas in-tree, we identify a
1884# build->target linker and hope that it will have the same features
1885# as the host->target linker we'll be using.
275b60d6
JJ
1886gcc_cv_gld_major_version=
1887gcc_cv_gld_minor_version=
1888gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
1889gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
e8b05380
PB
1890
1891AS_VAR_SET_IF(gcc_cv_ld,, [
275b60d6
JJ
1892if test -x "$DEFAULT_LINKER"; then
1893 gcc_cv_ld="$DEFAULT_LINKER"
34a86c2b 1894elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
08d105fa
AO
1895 && test -f ../ld/Makefile \
1896 && test x$build = x$host; then
e8b05380
PB
1897 gcc_cv_ld=../ld/ld-new$build_exeext
1898elif test -x collect-ld$build_exeext; then
1899 # Build using linker in the current directory.
1900 gcc_cv_ld=./collect-ld$build_exeext
1901elif test -x $LD_FOR_TARGET; then
1902 gcc_cv_ld="$LD_FOR_TARGET"
1903else
1904 AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
1905fi])
1906
1907ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
1908AC_SUBST(ORIGINAL_LD_FOR_TARGET)
1909
1910AC_MSG_CHECKING(what linker to use)
1911if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext; then
08d105fa
AO
1912 # Single tree build which includes ld. We want to prefer it
1913 # over whatever linker top-level may have detected, since
1914 # we'll use what we're building after installation anyway.
e8b05380 1915 AC_MSG_RESULT(newly built ld)
34a86c2b 1916 in_tree_ld=yes
5408ac6c
HPN
1917 in_tree_ld_is_elf=no
1918 if (grep 'EMUL = .*elf' ../ld/Makefile \
8a45d680
AN
1919 || grep 'EMUL = .*linux' ../ld/Makefile \
1920 || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
5408ac6c
HPN
1921 in_tree_ld_is_elf=yes
1922 fi
275b60d6
JJ
1923 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
1924 do
1925changequote(,)dnl
58ea87a9 1926 gcc_cv_gld_version=`sed -n -e 's/^[ ]*\(VERSION=[0-9]*\.[0-9]*.*\)/\1/p' < $f`
275b60d6
JJ
1927 if test x$gcc_cv_gld_version != x; then
1928 break
1929 fi
1930 done
275b60d6
JJ
1931 gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
1932 gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1933changequote([,])dnl
e8b05380
PB
1934else
1935 AC_MSG_RESULT($gcc_cv_ld)
1936 in_tree_ld=no
275b60d6
JJ
1937fi
1938
981d4858 1939# Figure out what nm we will be using.
f9c1196a 1940gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
e8b05380 1941AS_VAR_SET_IF(gcc_cv_nm,, [
9f18db39 1942if test -f $gcc_cv_binutils_srcdir/configure.in \
c15b113b
DD
1943 && test -f ../binutils/Makefile \
1944 && test x$build = x$host; then
9f18db39
PB
1945 gcc_cv_nm=../binutils/nm-new$build_exeext
1946elif test -x nm$build_exeext; then
57991eba 1947 gcc_cv_nm=./nm$build_exeext
e8b05380
PB
1948elif test -x $NM_FOR_TARGET; then
1949 gcc_cv_nm="$NM_FOR_TARGET"
1950else
1951 AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
1952fi])
9f18db39 1953
9f18db39 1954AC_MSG_CHECKING(what nm to use)
e8b05380
PB
1955if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
1956 # Single tree build which includes binutils.
1957 AC_MSG_RESULT(newly built nm)
1958 in_tree_nm=yes
1959else
1960 AC_MSG_RESULT($gcc_cv_nm)
1961 in_tree_nm=no
1962fi
1963
1964ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
1965AC_SUBST(ORIGINAL_NM_FOR_TARGET)
981d4858 1966
3cae5780 1967# Figure out what objdump we will be using.
e8b05380 1968AS_VAR_SET_IF(gcc_cv_objdump,, [
d739199a 1969if test -f $gcc_cv_binutils_srcdir/configure.in \
c15b113b
DD
1970 && test -f ../binutils/Makefile \
1971 && test x$build = x$host; then
f9c1196a 1972 # Single tree build which includes binutils.
9f18db39 1973 gcc_cv_objdump=../binutils/objdump$build_exeext
d739199a
DJ
1974elif test -x objdump$build_exeext; then
1975 gcc_cv_objdump=./objdump$build_exeext
e8b05380
PB
1976elif test -x $OBJDUMP_FOR_TARGET; then
1977 gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
1978else
1979 AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
1980fi])
d739199a 1981
d739199a 1982AC_MSG_CHECKING(what objdump to use)
e8b05380
PB
1983if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
1984 # Single tree build which includes binutils.
1985 AC_MSG_RESULT(newly built objdump)
1986elif test x$gcc_cv_objdump = x; then
1987 AC_MSG_RESULT(not found)
1988else
1989 AC_MSG_RESULT($gcc_cv_objdump)
1990fi
3cae5780 1991
981d4858 1992# Figure out what assembler alignment features are present.
8ada417f
ZW
1993gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
1994 [2,6,0],,
1995[.balign 4
1996.p2align 2],,
1997[AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
1998 [Define if your assembler supports .balign and .p2align.])])
1999
2000gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
2001 [2,8,0],,
2002 [.p2align 4,,7],,
2003[AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
2004 [Define if your assembler supports specifying the maximum number
2005 of bytes to skip when using the GAS .p2align command.])])
2006
2007gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
2008 [elf,2,9,0],,
2009 [conftest_label1: .word 0
d1accaa3
JJ
2010.subsection -1
2011conftest_label2: .word 0
8ada417f
ZW
2012.previous],
2013 [if test x$gcc_cv_nm != x; then
2014 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
2015 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
2016 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
2017 then :
2018 else gcc_cv_as_subsection_m1=yes
2019 fi
2020 rm -f conftest.nm1 conftest.nm2
2021 fi],
2022 [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
2023 [Define if your assembler supports .subsection and .subsection -1 starts
2024 emitting at the beginning of your section.])])
2025
2026gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
2027 [2,2,0],,
2028 [ .weak foobar],,
2029[AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
2030
a0203ca7
AO
2031gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
2032 [2,17,0],,
2033 [ .weakref foobar, barfnot],,
2034[AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
2035
e41f3691
JDA
2036gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
2037 [2,15,91],,
2038 [ .SPACE $TEXT$
2039 .NSUBSPA $CODE$,COMDAT],,
2040[AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
2041
8ada417f
ZW
2042# .hidden needs to be supported in both the assembler and the linker,
2043# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
2044# This is irritatingly difficult to feature test for; we have to check the
2045# date string after the version number. If we've got an in-tree
2046# ld, we don't know its patchlevel version, so we set the baseline at 2.13
2047# to be safe.
2048# The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
2049gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
2050 [elf,2,13,0],,
2051[ .hidden foobar
2052foobar:])
2053
2054AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
2055[if test $in_tree_ld = yes ; then
2056 gcc_cv_ld_hidden=no
2057 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 13 -o "$gcc_cv_gld_major_version" -gt 2 \
2058 && test $in_tree_ld_is_elf = yes; then
2059 gcc_cv_ld_hidden=yes
2060 fi
2061else
2062 gcc_cv_ld_hidden=yes
bace148a 2063 ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
8ada417f 2064 if echo "$ld_ver" | grep GNU > /dev/null; then
c72931a6 2065changequote(,)dnl
8ada417f
ZW
2066 ld_vers=`echo $ld_ver | sed -n \
2067 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
2068 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
2069 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
2070 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
2071 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
11176d2a
JB
2072 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
2073 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p'`
8ada417f 2074 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'`
11176d2a
JB
2075 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2076 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2077 ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
8ada417f
ZW
2078 if test 0"$ld_date" -lt 20020404; then
2079 if test -n "$ld_date"; then
2080 # If there was date string, but was earlier than 2002-04-04, fail
2081 gcc_cv_ld_hidden=no
2082 elif test -z "$ld_vers"; then
2083 # If there was no date string nor ld version number, something is wrong
2084 gcc_cv_ld_hidden=no
2085 else
8ada417f
ZW
2086 test -z "$ld_vers_patch" && ld_vers_patch=0
2087 if test "$ld_vers_major" -lt 2; then
2088 gcc_cv_ld_hidden=no
2089 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
2090 gcc_cv_ld_hidden="no"
2091 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
2092 gcc_cv_ld_hidden=no
c72931a6 2093 fi
8ada417f
ZW
2094 fi
2095changequote([,])dnl
789b7de5 2096 fi
8ada417f 2097 else
28690784 2098 case "${target}" in
b0fd7d27 2099 hppa64*-*-hpux* | ia64*-*-hpux*)
28690784
JDA
2100 gcc_cv_ld_hidden=yes
2101 ;;
2102 *)
2103 gcc_cv_ld_hidden=no
2104 ;;
2105 esac
8ada417f
ZW
2106 fi
2107fi])
2108libgcc_visibility=no
9e944a16 2109AC_SUBST(libgcc_visibility)
232b67d9 2110GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
0f31374d 2111if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
8ada417f
ZW
2112 libgcc_visibility=yes
2113 AC_DEFINE(HAVE_GAS_HIDDEN, 1,
2114 [Define if your assembler and linker support .hidden.])
2115fi
6a9c5260 2116
8ada417f
ZW
2117# Check if we have .[us]leb128, and support symbol arithmetic with it.
2118gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
2119 [elf,2,11,0],,
2120[ .data
b7460f24
RH
2121 .uleb128 L2 - L1
2122L1:
2123 .uleb128 1280
2124 .sleb128 -1010
8ada417f
ZW
2125L2:],
2126 [# GAS versions before 2.11 do not support uleb128,
2127 # despite appearing to.
2128 # ??? There exists an elf-specific test that will crash
2129 # the assembler. Perhaps it's better to figure out whether
2130 # arbitrary sections are supported and try the test.
bace148a 2131 as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
8ada417f 2132 if echo "$as_ver" | grep GNU > /dev/null; then
78e766a0 2133changequote(,)dnl
8ada417f
ZW
2134 as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
2135 as_major=`echo $as_ver | sed 's/\..*//'`
2136 as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
78e766a0 2137changequote([,])dnl
8ada417f
ZW
2138 if test $as_major -eq 2 && test $as_minor -lt 11
2139 then :
2140 else gcc_cv_as_leb128=yes
2141 fi
2142 fi],
2143 [AC_DEFINE(HAVE_AS_LEB128, 1,
2144 [Define if your assembler supports .sleb128 and .uleb128.])])
2145
2146# GAS versions up to and including 2.11.0 may mis-optimize
2147# .eh_frame data.
2148gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
2149 [elf,2,12,0],,
2150[ .text
c64688ae
RH
2151.LFB1:
2152 .4byte 0
2153.L1:
2154 .4byte 0
2155.LFE1:
2156 .section .eh_frame,"aw",@progbits
2157__FRAME_BEGIN__:
2158 .4byte .LECIE1-.LSCIE1
2159.LSCIE1:
2160 .4byte 0x0
2161 .byte 0x1
2162 .ascii "z\0"
2163 .byte 0x1
2164 .byte 0x78
2165 .byte 0x1a
2166 .byte 0x0
2167 .byte 0x4
2168 .4byte 1
2169 .p2align 1
2170.LECIE1:
2171.LSFDE1:
2172 .4byte .LEFDE1-.LASFDE1
2173.LASFDE1:
2174 .4byte .LASFDE1-__FRAME_BEGIN__
2175 .4byte .LFB1
2176 .4byte .LFE1-.LFB1
2177 .byte 0x4
2178 .4byte .LFE1-.LFB1
2179 .byte 0x4
2180 .4byte .L1-.LFB1
8ada417f 2181.LEFDE1:],
ba479fd2
NN
2182[ dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
2183cat > conftest.lit <<EOF
c64688ae
RH
2184 0000 10000000 00000000 017a0001 781a0004 .........z..x...
2185 0010 01000000 12000000 18000000 00000000 ................
ba479fd2 2186 0020 08000000 04080000 0044 .........D @&t@
01efb963 2187EOF
ba479fd2 2188cat > conftest.big <<EOF
01efb963
AS
2189 0000 00000010 00000000 017a0001 781a0004 .........z..x...
2190 0010 00000001 00000012 00000018 00000000 ................
ba479fd2 2191 0020 00000008 04000000 0844 .........D @&t@
c64688ae 2192EOF
8ada417f
ZW
2193 # If the assembler didn't choke, and we can objdump,
2194 # and we got the correct data, then succeed.
2195 if test x$gcc_cv_objdump != x \
2196 && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
2197 | tail -3 > conftest.got \
2198 && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
2199 || cmp conftest.big conftest.got > /dev/null 2>&1; }
2200 then
2201 gcc_cv_as_eh_frame=yes
2202 elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
2203 gcc_cv_as_eh_frame=buggy
2204 else
2205 # Uh oh, what do we do now?
2206 gcc_cv_as_eh_frame=no
2207 fi])
2208
2209if test $gcc_cv_as_eh_frame = buggy; then
2210 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
2211 [Define if your assembler mis-optimizes .eh_frame data.])
201556f0 2212fi
201556f0 2213
8ada417f
ZW
2214gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2215 [elf,2,12,0], [--fatal-warnings],
5d4856a0 2216 [.section .rodata.str, "aMS", @progbits, 1])
c18a5b6c
MM
2217if test $gcc_cv_as_shf_merge = no; then
2218 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2219 [elf,2,12,0], [--fatal-warnings],
2220 [.section .rodata.str, "aMS", %progbits, 1])
2221fi
5d4856a0
RO
2222AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2223 [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2224[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
8ada417f 2225
c18a5b6c 2226gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
11176d2a 2227 [elf,2,16,0], [--fatal-warnings],
c18a5b6c
MM
2228 [.section .text,"axG",@progbits,.foo,comdat])
2229if test $gcc_cv_as_comdat_group = yes; then
2230 gcc_cv_as_comdat_group_percent=no
2231else
2232 gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
11176d2a 2233 [elf,2,16,0], [--fatal-warnings],
c18a5b6c
MM
2234 [.section .text,"axG",%progbits,.foo,comdat])
2235fi
11176d2a
JB
2236if test $in_tree_ld != yes && test x"$ld_vers" != x; then
2237 comdat_group=yes
2238 if test 0"$ld_date" -lt 20050308; then
2239 if test -n "$ld_date"; then
2240 # If there was date string, but was earlier than 2005-03-08, fail
2241 comdat_group=no
2242 elif test "$ld_vers_major" -lt 2; then
2243 comdat_group=no
2244 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
2245 comdat_group=no
2246 fi
2247 fi
1cf0118d
RO
2248else
2249 # assume linkers other than GNU ld don't support COMDAT group
2250 comdat_group=no
2251fi
2252if test $comdat_group = no; then
2253 gcc_cv_as_comdat_group=no
2254 gcc_cv_as_comdat_group_percent=no
11176d2a
JB
2255fi
2256AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
c18a5b6c 2257 [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
11176d2a 2258[Define 0/1 if your assembler and linker support COMDAT groups.])
c18a5b6c 2259
8ada417f 2260# Thread-local storage - the check is heavily parametrized.
f996902d
RH
2261conftest_s=
2262tls_first_major=
2263tls_first_minor=
9739c90c 2264tls_as_opt=
f996902d
RH
2265case "$target" in
2266changequote(,)dnl
6f9b006d
RH
2267 alpha*-*-*)
2268 conftest_s='
2269 .section ".tdata","awT",@progbits
2270foo: .long 25
2271 .text
2272 ldq $27,__tls_get_addr($29) !literal!1
2273 lda $16,foo($29) !tlsgd!1
2274 jsr $26,($27),__tls_get_addr !lituse_tlsgd!1
2275 ldq $27,__tls_get_addr($29) !literal!2
2276 lda $16,foo($29) !tlsldm!2
2277 jsr $26,($27),__tls_get_addr !lituse_tlsldm!2
2278 ldq $1,foo($29) !gotdtprel
2279 ldah $2,foo($29) !dtprelhi
2280 lda $3,foo($2) !dtprello
2281 lda $4,foo($29) !dtprel
2282 ldq $1,foo($29) !gottprel
2283 ldah $2,foo($29) !tprelhi
2284 lda $3,foo($2) !tprello
2285 lda $4,foo($29) !tprel'
2286 tls_first_major=2
2287 tls_first_minor=13
2f3321ca 2288 tls_as_opt=--fatal-warnings
6f9b006d 2289 ;;
e4dd71de
AH
2290 frv*-*-*)
2291 conftest_s='
2292 .section ".tdata","awT",@progbits
2293x: .long 25
2294 .text
2295 call #gettlsoff(x)'
2296 tls_first_major=2
2297 tls_first_minor=14
2298 ;;
51076f96
RC
2299 hppa*-*-linux*)
2300 conftest_s='
2301t1: .reg %r20
2302t2: .reg %r21
2303gp: .reg %r19
2304 .section ".tdata","awT",@progbits
2305foo: .long 25
2306 .text
2307 .align 4
2308 addil LT%foo-$tls_gdidx$,gp
2309 ldo RT%foo-$tls_gdidx$(%r1),%arg0
2310 b __tls_get_addr
2311 nop
2312 addil LT%foo-$tls_ldidx$,gp
2313 b __tls_get_addr
2314 ldo RT%foo-$tls_ldidx$(%r1),%arg0
2315 addil LR%foo-$tls_dtpoff$,%ret0
2316 ldo RR%foo-$tls_dtpoff$(%r1),%t1
2317 mfctl %cr27,%t1
2318 addil LT%foo-$tls_ieoff$,gp
2319 ldw RT%foo-$tls_ieoff$(%r1),%t2
2320 add %t1,%t2,%t3
2321 mfctl %cr27,%t1
2322 addil LR%foo-$tls_leoff$,%t1
2323 ldo RR%foo-$tls_leoff$(%r1),%t2'
2324 tls_first_major=2
2325 tls_first_minor=15
2326 tls_as_opt=--fatal-warnings
2327 ;;
d3585b76
DJ
2328 arm*-*-*)
2329 conftest_s='
2330 .section ".tdata","awT",%progbits
2331foo: .long 25
2332 .text
2333.word foo(gottpoff)
2334.word foo(tpoff)
2335.word foo(tlsgd)
2336.word foo(tlsldm)
2337.word foo(tlsldo)'
2338 tls_first_major=2
2339 tls_first_minor=17
2340 ;;
f996902d 2341 i[34567]86-*-*)
f996902d
RH
2342 conftest_s='
2343 .section ".tdata","awT",@progbits
2344foo: .long 25
2345 .text
2346 movl %gs:0, %eax
2347 leal foo@TLSGD(,%ebx,1), %eax
2348 leal foo@TLSLDM(%ebx), %eax
2349 leal foo@DTPOFF(%eax), %edx
2350 movl foo@GOTTPOFF(%ebx), %eax
2351 subl foo@GOTTPOFF(%ebx), %eax
75d38379
JJ
2352 addl foo@GOTNTPOFF(%ebx), %eax
2353 movl foo@INDNTPOFF, %eax
f996902d
RH
2354 movl $foo@TPOFF, %eax
2355 subl $foo@TPOFF, %eax
2356 leal foo@NTPOFF(%ecx), %eax'
2357 tls_first_major=2
75d38379 2358 tls_first_minor=14
2f3321ca 2359 tls_as_opt=--fatal-warnings
75d38379
JJ
2360 ;;
2361 x86_64-*-*)
2362 conftest_s='
2363 .section ".tdata","awT",@progbits
2364foo: .long 25
2365 .text
2366 movq %fs:0, %rax
2367 leaq foo@TLSGD(%rip), %rdi
2368 leaq foo@TLSLD(%rip), %rdi
2369 leaq foo@DTPOFF(%rax), %rdx
2370 movq foo@GOTTPOFF(%rip), %rax
2371 movq $foo@TPOFF, %rax'
2372 tls_first_major=2
2373 tls_first_minor=14
2f3321ca 2374 tls_as_opt=--fatal-warnings
f996902d 2375 ;;
7b6e506e
RH
2376 ia64-*-*)
2377 conftest_s='
2378 .section ".tdata","awT",@progbits
2379foo: data8 25
2380 .text
2381 addl r16 = @ltoff(@dtpmod(foo#)), gp
2382 addl r17 = @ltoff(@dtprel(foo#)), gp
2383 addl r18 = @ltoff(@tprel(foo#)), gp
2384 addl r19 = @dtprel(foo#), gp
2385 adds r21 = @dtprel(foo#), r13
2386 movl r23 = @dtprel(foo#)
2387 addl r20 = @tprel(foo#), gp
2388 adds r22 = @tprel(foo#), r13
2389 movl r24 = @tprel(foo#)'
2390 tls_first_major=2
2391 tls_first_minor=13
2f3321ca 2392 tls_as_opt=--fatal-warnings
7b6e506e 2393 ;;
69229b81
DJ
2394 mips*-*-*)
2395 conftest_s='
2396 .section .tdata,"awT",@progbits
2397x:
2398 .word 2
2399 .text
2400 addiu $4, $28, %tlsgd(x)
2401 addiu $4, $28, %tlsldm(x)
2402 lui $4, %dtprel_hi(x)
2403 addiu $4, $4, %dtprel_lo(x)
2404 lw $4, %gottprel(x)($28)
2405 lui $4, %tprel_hi(x)
2406 addiu $4, $4, %tprel_lo(x)'
2407 tls_first_major=2
2408 tls_first_minor=16
2409 tls_as_opt='-32 --fatal-warnings'
2410 ;;
c4501e62
JJ
2411 powerpc-*-*)
2412 conftest_s='
2413 .section ".tdata","awT",@progbits
2414 .align 2
2415ld0: .space 4
2416ld1: .space 4
2417x1: .space 4
2418x2: .space 4
2419x3: .space 4
2420 .text
2421 addi 3,31,ld0@got@tlsgd
2422 bl __tls_get_addr
2423 addi 3,31,x1@got@tlsld
2424 bl __tls_get_addr
2425 addi 9,3,x1@dtprel
2426 addis 9,3,x2@dtprel@ha
2427 addi 9,9,x2@dtprel@l
2428 lwz 9,x3@got@tprel(31)
2429 add 9,9,x@tls
2430 addi 9,2,x1@tprel
2431 addis 9,2,x2@tprel@ha
2432 addi 9,9,x2@tprel@l'
2433 tls_first_major=2
2434 tls_first_minor=14
2f3321ca 2435 tls_as_opt="-a32 --fatal-warnings"
c4501e62
JJ
2436 ;;
2437 powerpc64-*-*)
2438 conftest_s='
2439 .section ".tdata","awT",@progbits
2440 .align 3
2441ld0: .space 8
2442ld1: .space 8
2443x1: .space 8
2444x2: .space 8
2445x3: .space 8
2446 .text
2447 addi 3,2,ld0@got@tlsgd
2448 bl .__tls_get_addr
2449 nop
2450 addi 3,2,ld1@toc
2451 bl .__tls_get_addr
2452 nop
2453 addi 3,2,x1@got@tlsld
2454 bl .__tls_get_addr
2455 nop
2456 addi 9,3,x1@dtprel
2457 bl .__tls_get_addr
2458 nop
2459 addis 9,3,x2@dtprel@ha
2460 addi 9,9,x2@dtprel@l
2461 bl .__tls_get_addr
2462 nop
2463 ld 9,x3@got@dtprel(2)
2464 add 9,9,3
2465 bl .__tls_get_addr
2466 nop'
2467 tls_first_major=2
2468 tls_first_minor=14
2f3321ca 2469 tls_as_opt="-a64 --fatal-warnings"
c4501e62 2470 ;;
fd3cd001
UW
2471 s390-*-*)
2472 conftest_s='
2473 .section ".tdata","awT",@progbits
2474foo: .long 25
2475 .text
2476 .long foo@TLSGD
2477 .long foo@TLSLDM
2478 .long foo@DTPOFF
2479 .long foo@NTPOFF
2480 .long foo@GOTNTPOFF
2481 .long foo@INDNTPOFF
2482 l %r1,foo@GOTNTPOFF(%r12)
2483 l %r1,0(%r1):tls_load:foo
2484 bas %r14,0(%r1,%r13):tls_gdcall:foo
2485 bas %r14,0(%r1,%r13):tls_ldcall:foo'
2486 tls_first_major=2
2487 tls_first_minor=14
2f3321ca 2488 tls_as_opt="-m31 --fatal-warnings"
fd3cd001
UW
2489 ;;
2490 s390x-*-*)
2491 conftest_s='
2492 .section ".tdata","awT",@progbits
2493foo: .long 25
2494 .text
2495 .quad foo@TLSGD
2496 .quad foo@TLSLDM
2497 .quad foo@DTPOFF
2498 .quad foo@NTPOFF
2499 .quad foo@GOTNTPOFF
2500 lg %r1,foo@GOTNTPOFF(%r12)
2501 larl %r1,foo@INDNTPOFF
2502 brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo
2503 brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
2504 tls_first_major=2
2505 tls_first_minor=14
2f3321ca 2506 tls_as_opt="-m64 -Aesame --fatal-warnings"
fd3cd001 2507 ;;
9ff13962
KK
2508 sh-*-* | sh[34]-*-*)
2509 conftest_s='
2510 .section ".tdata","awT",@progbits
2511foo: .long 25
2512 .text
2513 .long foo@TLSGD
2514 .long foo@TLSLDM
2515 .long foo@DTPOFF
2516 .long foo@GOTTPOFF
2517 .long foo@TPOFF'
2518 tls_first_major=2
2519 tls_first_minor=13
2f3321ca 2520 tls_as_opt=--fatal-warnings
9ff13962 2521 ;;
5751a10b 2522 sparc*-*-*)
2f3321ca 2523 case "$target" in
7935dc1b
EB
2524 sparc*-sun-solaris2.[56789]*)
2525 # TLS was introduced in the Solaris 9 4/04 release but
2526 # we do not enable it by default on Solaris 9 either.
2527 if test "x$enable_tls" = xyes ; then
2528 on_solaris=yes
2529 else
2530 enable_tls=no;
2531 fi
2532 ;;
2f3321ca
EB
2533 sparc*-sun-solaris2.*)
2534 on_solaris=yes
2535 ;;
2536 *)
2537 on_solaris=no
2538 ;;
2539 esac
2540 if test x$on_solaris = xyes && test x$gas_flag = xno; then
2541 conftest_s='
2542 .section ".tdata",#alloc,#write,#tls
2543foo: .long 25
2544 .text
2545 sethi %tgd_hi22(foo), %o0
2546 add %o0, %tgd_lo10(foo), %o1
2547 add %l7, %o1, %o0, %tgd_add(foo)
2548 call __tls_get_addr, %tgd_call(foo)
2549 sethi %tldm_hi22(foo), %l1
2550 add %l1, %tldm_lo10(foo), %l2
2551 add %l7, %l2, %o0, %tldm_add(foo)
2552 call __tls_get_addr, %tldm_call(foo)
2553 sethi %tldo_hix22(foo), %l3
2554 xor %l3, %tldo_lox10(foo), %l4
2555 add %o0, %l4, %l5, %tldo_add(foo)
2556 sethi %tie_hi22(foo), %o3
2557 add %o3, %tie_lo10(foo), %o3
2558 ld [%l7 + %o3], %o2, %tie_ld(foo)
2559 add %g7, %o2, %o4, %tie_add(foo)
2560 sethi %tle_hix22(foo), %l1
2561 xor %l1, %tle_lox10(foo), %o5
2562 ld [%g7 + %o5], %o1'
2563 tls_first_major=0
2564 tls_first_minor=0
2565 else
2566 conftest_s='
5751a10b
JJ
2567 .section ".tdata","awT",@progbits
2568foo: .long 25
2569 .text
2570 sethi %tgd_hi22(foo), %o0
2571 add %o0, %tgd_lo10(foo), %o1
2572 add %l7, %o1, %o0, %tgd_add(foo)
2573 call __tls_get_addr, %tgd_call(foo)
2574 sethi %tldm_hi22(foo), %l1
2575 add %l1, %tldm_lo10(foo), %l2
2576 add %l7, %l2, %o0, %tldm_add(foo)
2577 call __tls_get_addr, %tldm_call(foo)
2578 sethi %tldo_hix22(foo), %l3
2579 xor %l3, %tldo_lox10(foo), %l4
2580 add %o0, %l4, %l5, %tldo_add(foo)
2581 sethi %tie_hi22(foo), %o3
2582 add %o3, %tie_lo10(foo), %o3
2583 ld [%l7 + %o3], %o2, %tie_ld(foo)
2584 add %g7, %o2, %o4, %tie_add(foo)
2585 sethi %tle_hix22(foo), %l1
2586 xor %l1, %tle_lox10(foo), %o5
2587 ld [%g7 + %o5], %o1'
2588 tls_first_major=2
2589 tls_first_minor=14
2f3321ca
EB
2590 tls_as_opt="-32 --fatal-warnings"
2591 fi
5751a10b
JJ
2592 ;;
2593changequote([,])dnl
f996902d 2594esac
8dea1cca
DD
2595set_have_as_tls=no
2596if test "x$enable_tls" = xno ; then
2597 : # TLS explicitly disabled.
2598elif test "x$enable_tls" = xyes ; then
2599 set_have_as_tls=yes # TLS explicitly enabled.
2600elif test -z "$tls_first_major"; then
8ada417f
ZW
2601 : # If we don't have a check, assume no support.
2602else
2603 gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
2f3321ca 2604 [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
8dea1cca
DD
2605 [set_have_as_tls=yes])
2606fi
2607if test $set_have_as_tls = yes ; then
2608 AC_DEFINE(HAVE_AS_TLS, 1,
2609 [Define if your assembler supports thread-local storage.])
f996902d 2610fi
8ada417f
ZW
2611
2612# Target-specific assembler checks.
f996902d 2613
7e9d8517
L
2614AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
2615gcc_cv_ld_static_dynamic=no
2616if test $in_tree_ld = yes ; then
2617 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10; then
2618 gcc_cv_ld_static_dynamic=yes
2619 fi
2620elif test x$gcc_cv_ld != x; then
2621 # Check if linker supports -Bstatic/-Bdynamic option
2622 if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
2623 && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
2624 gcc_cv_ld_static_dynamic=yes
2625 fi
2626fi
2627if test x"$gcc_cv_ld_static_dynamic" = xyes; then
2628 AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
2629[Define if your linker supports -Bstatic/-Bdynamic option.])
2630fi
2631AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
2632
d594623a
L
2633if test x"$demangler_in_ld" = xyes; then
2634 AC_MSG_CHECKING(linker --demangle support)
2635 gcc_cv_ld_demangle=no
2636 if test $in_tree_ld = yes; then
2637 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 14 -o "$gcc_cv_gld_major_version" -gt 2; then \
2638 gcc_cv_ld_demangle=yes
2639 fi
2640 elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
2641 # Check if the GNU linker supports --demangle option
2642 if $gcc_cv_ld --help 2>/dev/null | grep no-demangle > /dev/null; then
2643 gcc_cv_ld_demangle=yes
2644 fi
2645 fi
2646 if test x"$gcc_cv_ld_demangle" = xyes; then
2647 AC_DEFINE(HAVE_LD_DEMANGLE, 1,
2648[Define if your linker supports --demangle option.])
2649 fi
2650 AC_MSG_RESULT($gcc_cv_ld_demangle)
2651fi
2652
275b60d6 2653case "$target" in
3a37b08e
RH
2654 # All TARGET_ABI_OSF targets.
2655 alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
8ada417f
ZW
2656 gcc_GAS_CHECK_FEATURE([explicit relocation support],
2657 gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
2658[ .set nomacro
3a37b08e
RH
2659 .text
2660 extbl $3, $2, $3 !lituse_bytoff!1
2661 ldq $2, a($29) !literal!1
2662 ldq $4, b($29) !literal!2
2663 ldq_u $3, 0($2) !lituse_base!1
2664 ldq $27, f($29) !literal!5
2665 jsr $26, ($27), f !lituse_jsr!5
2666 ldah $29, 0($26) !gpdisp!3
2667 lda $0, c($29) !gprel
2668 ldah $1, d($29) !gprelhigh
2669 lda $1, d($1) !gprellow
8ada417f
ZW
2670 lda $29, 0($29) !gpdisp!3],,
2671 [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
2672 [Define if your assembler supports explicit relocations.])])
d006f5eb
RH
2673 gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
2674 gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
2675[ .set nomacro
2676 .text
2677 ldq $27, a($29) !literal!1
2678 jsr $26, ($27), a !lituse_jsrdirect!1],,
2679 [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
2680 [Define if your assembler supports the lituse_jsrdirect relocation.])])
3a37b08e 2681 ;;
e95b1e6a 2682
682a45fc
HPN
2683 cris-*-*)
2684 gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
2685 gcc_cv_as_cris_no_mul_bug,[2,15,91],
2686 [-no-mul-bug-abort], [.text],,
2687 [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
2688 [Define if your assembler supports the -no-mul-bug-abort option.])])
2689 ;;
2690
8ada417f
ZW
2691 sparc*-*-*)
2692 gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
2693 [.register %g2, #scratch],,
2694 [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
2695 [Define if your assembler supports .register.])])
2696
2697 gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
2698 [-relax], [.text],,
2699 [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
2700 [Define if your assembler supports -relax option.])])
2701
2702 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
2703 gcc_cv_as_sparc_ua_pcrel,,
2704 [-K PIC],
2705[.text
2706foo:
2707 nop
2708.data
2709.align 4
2710.byte 0
2711.uaword %r_disp32(foo)],
2712 [if test x$gcc_cv_ld != x \
2713 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
2714 gcc_cv_as_sparc_ua_pcrel=yes
2715 fi
2716 rm -f conftest],
2717 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
17e9e88c 2718 [Define if your assembler and linker support unaligned PC relative relocs.])
cf7b8b0d 2719
8ada417f
ZW
2720 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
2721 gcc_cv_as_sparc_ua_pcrel_hidden,,
2722 [-K PIC],
2723[.data
2724.align 4
2725.byte 0x31
2726.uaword %r_disp32(foo)
2727.byte 0x32, 0x33, 0x34
2728.global foo
2729.hidden foo
2730foo:
2731.skip 4],
2732 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
2733 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
2734 && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
2735 | grep ' 31000000 07323334' > /dev/null 2>&1; then
2736 if $gcc_cv_objdump -R conftest 2> /dev/null \
2737 | grep 'DISP32' > /dev/null 2>&1; then
2738 :
22252625 2739 else
8ada417f 2740 gcc_cv_as_sparc_ua_pcrel_hidden=yes
5b68c389 2741 fi
8ada417f
ZW
2742 fi
2743 rm -f conftest],
2744 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
2745 [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
2746 ]) # unaligned pcrel relocs
2747
2748 gcc_GAS_CHECK_FEATURE([offsetable %lo()],
2749 gcc_cv_as_sparc_offsetable_lo10,,
2750 [-xarch=v9],
2751[.text
2752 or %g1, %lo(ab) + 12, %g1
2753 or %g1, %lo(ab + 12), %g1],
2754 [if test x$gcc_cv_objdump != x \
ecb0ccbc 2755 && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
8ada417f 2756 | grep ' 82106000 82106000' > /dev/null 2>&1; then
1b5c0152 2757 gcc_cv_as_sparc_offsetable_lo10=yes
8ada417f
ZW
2758 fi],
2759 [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
2760 [Define if your assembler supports offsetable %lo().])])
1cb36a98
RH
2761 ;;
2762
2763changequote(,)dnl
c307e6dd 2764 i[34567]86-*-* | x86_64-*-*)
1cb36a98 2765changequote([,])dnl
d38bc601
BF
2766 case $target_os in
2767 cygwin* | pe | mingw32*)
2768 # Used for DWARF 2 in PE
2769 gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
2770 gcc_cv_as_ix86_pe_secrel32,
2771 [2,15,91],,
2772[.text
2773foo: nop
2774.data
2775 .secrel32 foo],
2776 [if test x$gcc_cv_ld != x \
2777 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
2778 gcc_cv_as_ix86_pe_secrel32=yes
2779 fi
2780 rm -f conftest],
2781 [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
2782 [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
2783 ;;
2784 esac
2785
8ada417f
ZW
2786 gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
2787 gcc_cv_as_ix86_filds_fists,
2788 [2,9,0],, [filds mem; fists mem],,
2789 [AC_DEFINE(HAVE_GAS_FILDS_FISTS, 1,
2790 [Define if your assembler uses the new HImode fild and fist notation.])])
2791
f6f5dff2
RO
2792 gcc_GAS_CHECK_FEATURE([cmov syntax],
2793 gcc_cv_as_ix86_cmov_sun_syntax,,,
2794 [cmovl.l %edx, %eax],,
2795 [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
2796 [Define if your assembler supports the Sun syntax for cmov.])])
2797
6f3ca281
ZW
2798 # This one is used unconditionally by i386.[ch]; it is to be defined
2799 # to 1 if the feature is present, 0 otherwise.
8ada417f
ZW
2800 gcc_GAS_CHECK_FEATURE([GOTOFF in data],
2801 gcc_cv_as_ix86_gotoff_in_data, [2,11,0],,
2802[ .text
f88c65f7
RH
2803.L0:
2804 nop
2805 .data
6f3ca281
ZW
2806 .long .L0@GOTOFF])
2807 AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
2808 [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
2809 [Define true if the assembler supports '.long foo@GOTOFF'.])
1cb36a98 2810 ;;
ef1ecf87
RH
2811
2812 ia64*-*-*)
8ada417f
ZW
2813 gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
2814 gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
cfa9ee99 2815[ .text
ef1ecf87
RH
2816 addl r15 = @ltoffx(x#), gp
2817 ;;
cfa9ee99 2818 ld8.mov r16 = [[r15]], x#],,
8ada417f
ZW
2819 [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
2820 [Define if your assembler supports ltoffx and ldxmov relocations.])])
2821
ef1ecf87 2822 ;;
8ada417f 2823
2c4a9cff 2824 powerpc*-*-*)
8ada417f 2825 case $target in
432218ba
DE
2826 *-*-aix*) conftest_s=' .machine "pwr5"
2827 .csect .text[[PR]]
6b37db3c 2828 mfcr 3,128';;
8af4d362
PB
2829 *-*-darwin*)
2830 gcc_GAS_CHECK_FEATURE([.machine directive support],
2831 gcc_cv_as_machine_directive,,,
2832 [ .machine ppc7400])
2833 if test x$gcc_cv_as_machine_directive != xyes; then
2834 echo "*** This target requires an assembler supporting \".machine\"" >&2
2835 echo you can get it from: ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
2836 test x$build = x$target && exit 1
2837 fi
2838 conftest_s=' .text
6b37db3c 2839 mfcr r3,128';;
4c67db14 2840 *) conftest_s=' .machine power4
d2ab3e37 2841 .text
6b37db3c 2842 mfcr 3,128';;
8ada417f 2843 esac
8ada417f
ZW
2844
2845 gcc_GAS_CHECK_FEATURE([mfcr field support],
2846 gcc_cv_as_powerpc_mfcrf, [2,14,0],,
2847 [$conftest_s],,
2848 [AC_DEFINE(HAVE_AS_MFCRF, 1,
2849 [Define if your assembler supports mfcr field.])])
432218ba
DE
2850
2851 case $target in
2852 *-*-aix*) conftest_s=' .machine "pwr5"
2853 .csect .text[[PR]]
2854 popcntb 3,3';;
2855 *) conftest_s=' .machine power5
2856 .text
2857 popcntb 3,3';;
2858 esac
2859
2860 gcc_GAS_CHECK_FEATURE([popcntb support],
2861 gcc_cv_as_powerpc_popcntb, [2,17,0],,
2862 [$conftest_s],,
2863 [AC_DEFINE(HAVE_AS_POPCNTB, 1,
2864 [Define if your assembler supports popcntb field.])])
2865
9719f3b7
DE
2866 case $target in
2867 *-*-aix*) conftest_s=' .machine "pwr5x"
2868 .csect .text[[PR]]
2869 frin 1,1';;
1e04bfdc 2870 *) conftest_s=' .machine power5
9719f3b7
DE
2871 .text
2872 frin 1,1';;
2873 esac
2874
2875 gcc_GAS_CHECK_FEATURE([fp round support],
2876 gcc_cv_as_powerpc_fprnd, [2,17,0],,
2877 [$conftest_s],,
2878 [AC_DEFINE(HAVE_AS_FPRND, 1,
2879 [Define if your assembler supports fprnd.])])
2880
7f970b70
AM
2881 case $target in
2882 *-*-aix*) conftest_s=' .csect .text[[PR]]
2883LCF..0:
2884 addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
2885 *-*-darwin*)
2886 conftest_s=' .text
2887LCF0:
2888 addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
2889 *) conftest_s=' .text
2890.LCF0:
2891 addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
2892 esac
2893
2894 gcc_GAS_CHECK_FEATURE([rel16 relocs],
2895 gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
2896 [$conftest_s],,
2897 [AC_DEFINE(HAVE_AS_REL16, 1,
2898 [Define if your assembler supports R_PPC_REL16 relocs.])])
2c4a9cff 2899 ;;
53b5ce19 2900
8ada417f
ZW
2901 mips*-*-*)
2902 gcc_GAS_CHECK_FEATURE([explicit relocation support],
2903 gcc_cv_as_mips_explicit_relocs, [2,14,0],,
2904[ lw $4,%gp_rel(foo)($4)],,
2905 [if test x$target_cpu_default = x
2906 then target_cpu_default=MASK_EXPLICIT_RELOCS
2907 else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
2908 fi])
dbad5e72
SE
2909 ;;
2910esac
2911
2912# Mips and HP-UX need the GNU assembler.
2913# Linux on IA64 might be able to use the Intel assembler.
8ada417f 2914
dbad5e72
SE
2915case "$target" in
2916 mips*-*-* | *-*-hpux* )
82563d35
RS
2917 if test x$gas_flag = xyes \
2918 || test x"$host" != x"$build" \
2919 || test ! -x "$gcc_cv_as" \
2920 || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
2921 :
2922 else
2923 echo "*** This configuration requires the GNU assembler" >&2
2924 exit 1
2925 fi
8ada417f
ZW
2926 ;;
2927esac
dbad5e72 2928
9d147085
RH
2929# ??? Not all targets support dwarf2 debug_line, even within a version
2930# of gas. Moreover, we need to emit a valid instruction to trigger any
2931# info to the output file. So, as supported targets are added to gas 2.11,
2932# add some instruction here to (also) show we expect this might work.
2933# ??? Once 2.11 is released, probably need to add first known working
2934# version to the per-target configury.
2935case "$target" in
80486e06 2936 i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
2853bc5a 2937 | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-* \
6afdc741 2938 | xstormy16*-*-* | cris-*-* | xtensa-*-* | bfin-*-*)
9d147085
RH
2939 insn="nop"
2940 ;;
57116d8d 2941 ia64*-*-* | s390*-*-*)
9d147085
RH
2942 insn="nop 0"
2943 ;;
2853bc5a
HPN
2944 mmix-*-*)
2945 insn="swym 0"
2946 ;;
8ada417f
ZW
2947esac
2948if test x"$insn" != x; then
2949 conftest_s="\
2950 .file 1 \"conftest.s\"
2951 .loc 1 3 0
2952 $insn"
2953 gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
2954 gcc_cv_as_dwarf2_debug_line,
2955 [elf,2,11,0],, [$conftest_s],
080a5bb0
EB
2956 [if test x$gcc_cv_objdump != x \
2957 && $gcc_cv_objdump -h conftest.o 2> /dev/null \
2958 | grep debug_line > /dev/null 2>&1; then
8ada417f
ZW
2959 gcc_cv_as_dwarf2_debug_line=yes
2960 fi])
2961
2962# The .debug_line file table must be in the exact order that
2963# we specified the files, since these indices are also used
2964# by DW_AT_decl_file. Approximate this test by testing if
2965# the assembler bitches if the same index is assigned twice.
2966 gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
2967 gcc_cv_as_dwarf2_file_buggy,,,
2968[ .file 1 "foo.s"
2969 .file 1 "bar.s"])
2970
2971 if test $gcc_cv_as_dwarf2_debug_line = yes \
2972 && test $gcc_cv_as_dwarf2_file_buggy = no; then
9d147085 2973 AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
8ada417f 2974 [Define if your assembler supports dwarf2 .file/.loc directives,
eaec9b3d 2975 and preserves file table indices exactly as given.])
8ada417f
ZW
2976 fi
2977
2978 gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
2979 gcc_cv_as_gdwarf2_flag,
2980 [elf,2,11,0], [--gdwarf2], [$insn],,
2981 [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
2982[Define if your assembler supports the --gdwarf2 option.])])
2983
2984 gcc_GAS_CHECK_FEATURE([--gstabs option],
2985 gcc_cv_as_gstabs_flag,
2986 [elf,2,11,0], [--gstabs], [$insn],
2987 [# The native Solaris 9/Intel assembler doesn't understand --gstabs
2988 # and warns about it, but still exits successfully. So check for
2989 # this.
2990 if AC_TRY_COMMAND([$gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null])
2991 then :
2992 else gcc_cv_as_gstabs_flag=yes
2993 fi],
2994 [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
2995[Define if your assembler supports the --gstabs option.])])
9d147085 2996fi
5f0e9ea2 2997
96d0f4dc
JJ
2998AC_MSG_CHECKING(linker read-only and read-write section mixing)
2999gcc_cv_ld_ro_rw_mix=unknown
34a86c2b 3000if test $in_tree_ld = yes ; then
5408ac6c
HPN
3001 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 \
3002 && test $in_tree_ld_is_elf = yes; then
96d0f4dc
JJ
3003 gcc_cv_ld_ro_rw_mix=read-write
3004 fi
3005elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
90e145da
KC
3006 echo '.section myfoosect, "a"' > conftest1.s
3007 echo '.section myfoosect, "aw"' > conftest2.s
96d0f4dc 3008 echo '.byte 1' >> conftest2.s
90e145da 3009 echo '.section myfoosect, "a"' > conftest3.s
96d0f4dc 3010 echo '.byte 0' >> conftest3.s
6cd656d0
KC
3011 if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
3012 && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
3013 && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
96d0f4dc 3014 && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
c6cc7e13 3015 conftest2.o conftest3.o > /dev/null 2>&1; then
96d0f4dc 3016 gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
c6cc7e13 3017 | sed -e '/myfoosect/!d' -e N`
96d0f4dc
JJ
3018 if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
3019 if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
3020 gcc_cv_ld_ro_rw_mix=read-only
3021 else
3022 gcc_cv_ld_ro_rw_mix=read-write
3023 fi
3024 fi
3025 fi
3026changequote(,)dnl
3027 rm -f conftest.* conftest[123].*
3028changequote([,])dnl
3029fi
3030if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
3031 AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
3032 [Define if your linker links a mix of read-only
3033 and read-write sections into a read-write section.])
3034fi
3035AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
3036
275b60d6
JJ
3037AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
3038gcc_cv_ld_eh_frame_hdr=no
34a86c2b 3039if test $in_tree_ld = yes ; then
5408ac6c
HPN
3040 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 \
3041 && test $in_tree_ld_is_elf = yes; then
275b60d6
JJ
3042 gcc_cv_ld_eh_frame_hdr=yes
3043 fi
3044elif test x$gcc_cv_ld != x; then
3045 # Check if linker supports --eh-frame-hdr option
3046 if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
3047 gcc_cv_ld_eh_frame_hdr=yes
3048 fi
3049fi
232b67d9 3050GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
275b60d6
JJ
3051if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
3052 AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
3053[Define if your linker supports --eh-frame-hdr option.])
3054fi
3055AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
3056
24a4dd31
JJ
3057AC_MSG_CHECKING(linker position independent executable support)
3058gcc_cv_ld_pie=no
3059if test $in_tree_ld = yes ; then
5408ac6c
HPN
3060 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 \
3061 && test $in_tree_ld_is_elf = yes; then
24a4dd31
JJ
3062 gcc_cv_ld_pie=yes
3063 fi
3064elif test x$gcc_cv_ld != x; then
3065 # Check if linker supports -pie option
3066 if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then
3067 gcc_cv_ld_pie=yes
3068 fi
3069fi
3070if test x"$gcc_cv_ld_pie" = xyes; then
3071 AC_DEFINE(HAVE_LD_PIE, 1,
3072[Define if your linker supports -pie option.])
3073fi
3074AC_MSG_RESULT($gcc_cv_ld_pie)
3075
630327c3
NN
3076# --------
3077# UNSORTED
3078# --------
3079
82e923f6
RS
3080AC_CACHE_CHECK(linker --as-needed support,
3081gcc_cv_ld_as_needed,
3082[gcc_cv_ld_as_needed=no
765f1bf9
AM
3083if test $in_tree_ld = yes ; then
3084 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
3085 && test $in_tree_ld_is_elf = yes; then
3086 gcc_cv_ld_as_needed=yes
3087 fi
3088elif test x$gcc_cv_ld != x; then
3089 # Check if linker supports --as-needed and --no-as-needed options
3090 if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
3091 gcc_cv_ld_as_needed=yes
3092 fi
3093fi
82e923f6 3094])
765f1bf9
AM
3095if test x"$gcc_cv_ld_as_needed" = xyes; then
3096 AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
3097[Define if your linker supports --as-needed and --no-as-needed options.])
3098fi
765f1bf9 3099
d82bf747
AM
3100case "$target:$tm_file" in
3101 powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
85b776df
AM
3102 AC_CACHE_CHECK(linker support for omitting dot symbols,
3103 gcc_cv_ld_no_dot_syms,
3104 [gcc_cv_ld_no_dot_syms=no
3105 if test $in_tree_ld = yes ; then
3106 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
3107 gcc_cv_ld_no_dot_syms=yes
3108 fi
3109 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
3110 cat > conftest1.s <<EOF
3111 .text
3112 bl .foo
3113EOF
3114 cat > conftest2.s <<EOF
3115 .section ".opd","aw"
3116 .align 3
3117 .globl foo
3118 .type foo,@function
3119foo:
3120 .quad .LEfoo,.TOC.@tocbase,0
3121 .text
3122.LEfoo:
3123 blr
3124 .size foo,.-.LEfoo
3125EOF
3126 if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
3127 && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
3128 && $gcc_cv_ld -melf64ppc -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
3129 gcc_cv_ld_no_dot_syms=yes
3130 fi
3131 rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
3132 fi
3133 ])
3134 if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
3135 AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
3136 [Define if your PowerPC64 linker only needs function descriptor syms.])
3137 fi
3138 ;;
3139esac
3140
380e5ca4
MM
3141AC_CACHE_CHECK(linker --sysroot support,
3142 gcc_cv_ld_sysroot,
3143 [gcc_cv_ld_sysroot=no
3144 if test $in_tree_ld = yes ; then
3145 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 ; then
7032df40 3146 gcc_cv_ld_sysroot=yes
380e5ca4
MM
3147 fi
3148 elif test x$gcc_cv_ld != x; then
3149 if $gcc_cv_ld --help 2>/dev/null | grep sysroot > /dev/null; then
3150 gcc_cv_ld_sysroot=yes
3151 fi
3152 fi])
3153if test x"$gcc_cv_ld_sysroot" = xyes; then
3154 AC_DEFINE(HAVE_LD_SYSROOT, 1,
3155 [Define if your linker supports --sysroot.])
3156fi
3157
9fb28a67 3158if test x$with_sysroot = x && test x$host = x$target \
047d636f 3159 && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
8ada417f
ZW
3160 AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
3161[Define to PREFIX/include if cpp should also search that directory.])
793e9558
PB
3162fi
3163
77008252
JJ
3164# Test for stack protector support in target C library.
3165case "$target" in
3166 *-*-linux*)
3167 AC_CACHE_CHECK(__stack_chk_fail in target GNU C library,
3168 gcc_cv_libc_provides_ssp,
3169 [gcc_cv_libc_provides_ssp=no
3170 if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
3171 if test "x$with_sysroot" = x; then
3172 glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
3173 elif test "x$with_sysroot" = xyes; then
3174 glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
3175 else
3176 glibc_header_dir="${with_sysroot}/usr/include"
3177 fi
3178 else
3179 glibc_header_dir=/usr/include
3180 fi
3181 # glibc 2.4 and later provides __stack_chk_fail and
3182 # either __stack_chk_guard, or TLS access to stack guard canary.
3183 if test -f $glibc_header_dir/features.h \
3184 && $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
3185 $glibc_header_dir/features.h > /dev/null; then
3186 if $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \
3187 $glibc_header_dir/features.h > /dev/null; then
3188 gcc_cv_libc_provides_ssp=yes
3189 elif $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC__[ ]+2' \
3190 $glibc_header_dir/features.h > /dev/null \
3191 && $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \
3192 $glibc_header_dir/features.h > /dev/null; then
3193 gcc_cv_libc_provides_ssp=yes
3194 fi
3195 fi]) ;;
3196 *) gcc_cv_libc_provides_ssp=no ;;
3197esac
3198if test x$gcc_cv_libc_provides_ssp = xyes; then
3199 AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
3200 [Define if your target C library provides stack protector support])
3201fi
3202
ed965309
JJ
3203# Check if TFmode long double should be used by default or not.
3204# Some glibc targets used DFmode long double, but with glibc 2.4
3205# and later they can use TFmode.
3206case "$target" in
3207 powerpc*-*-*gnu* | \
3208 sparc*-*-linux* | \
3209 s390*-*-linux* | \
3210 alpha*-*-linux*)
3211 AC_ARG_WITH(long-double-128,
3212[ --with-long-double-128 Use 128-bit long double by default.],
3213 gcc_cv_target_ldbl128="$with_long_double_128",
3214 [gcc_cv_target_ldbl128=no
3215 if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
3216 if test "x$with_sysroot" = x; then
3217 glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
3218 elif test "x$with_sysroot" = xyes; then
3219 glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
3220 else
3221 glibc_header_dir="${with_sysroot}/usr/include"
3222 fi
3223 else
3224 glibc_header_dir=/usr/include
3225 fi
3226 grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
3227 $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
3228 && gcc_cv_target_ldbl128=yes])
3229 ;;
3230esac
3231if test x$gcc_cv_target_ldbl128 = xyes; then
3232 AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
3233 [Define if TFmode long double should be the default])
3234fi
3235
81bf3d9e
RH
3236# Find out what GC implementation we want, or may, use.
3237AC_ARG_WITH(gc,
59415997 3238[ --with-gc={page,zone} choose the garbage collection mechanism to use
e8bec136 3239 with the compiler],
81bf3d9e 3240[case "$withval" in
08cee789 3241 page)
81bf3d9e
RH
3242 GGC=ggc-$withval
3243 ;;
08cee789
DJ
3244 zone)
3245 GGC=ggc-$withval
3246 AC_DEFINE(GGC_ZONE, 1, [Define if the zone collector is in use])
3247 ;;
81bf3d9e
RH
3248 *)
3249 AC_MSG_ERROR([$withval is an invalid option to --with-gc])
3250 ;;
3251esac],
130fadbb 3252[GGC=ggc-page])
81bf3d9e
RH
3253AC_SUBST(GGC)
3254echo "Using $GGC for garbage collection."
3255
3c809ba4 3256# Use the system's zlib library.
b8dad04b
ZW
3257zlibdir=-L../zlib
3258zlibinc="-I\$(srcdir)/../zlib"
3c809ba4
AG
3259AC_ARG_WITH(system-zlib,
3260[ --with-system-zlib use installed libz],
3261zlibdir=
3262zlibinc=
3263)
3264AC_SUBST(zlibdir)
3265AC_SUBST(zlibinc)
3266
dc6746e7
PT
3267dnl Very limited version of automake's enable-maintainer-mode
3268
3269AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3270 dnl maintainer-mode is disabled by default
3271 AC_ARG_ENABLE(maintainer-mode,
e8bec136
RO
3272[ --enable-maintainer-mode
3273 enable make rules and dependencies not useful
dc6746e7
PT
3274 (and sometimes confusing) to the casual installer],
3275 maintainer_mode=$enableval,
3276 maintainer_mode=no)
3277
3278AC_MSG_RESULT($maintainer_mode)
3279
3280if test "$maintainer_mode" = "yes"; then
3281 MAINT=''
3282else
3283 MAINT='#'
3284fi
3285AC_SUBST(MAINT)dnl
3286
630327c3
NN
3287# --------------
3288# Language hooks
3289# --------------
3290
571a8de5
DE
3291# Make empty files to contain the specs and options for each language.
3292# Then add #include lines to for a compiler that has specs and/or options.
3293
cc11cc9b 3294subdirs=
d7b42618 3295lang_opt_files=
571a8de5 3296lang_specs_files=
3103b7db 3297lang_tree_files=
571a8de5
DE
3298# These (without "all_") are set in each config-lang.in.
3299# `language' must be a single word so is spelled singularly.
3300all_languages=
3301all_boot_languages=
3302all_compilers=
3303all_stagestuff=
53c7ffe7 3304all_outputs='Makefile gccbug mklibgcc libada-mk'
571a8de5 3305# List of language makefile fragments.
2ed26f6b
ZW
3306all_lang_makefrags=
3307# List of language subdirectory makefiles. Deprecated.
571a8de5 3308all_lang_makefiles=
e2500fed 3309# Files for gengtype
ef69da62 3310all_gtfiles="$target_gtfiles"
8ac9d31f
TJ
3311# Files for gengtype with language
3312all_gtfiles_files_langs=
3313all_gtfiles_files_files=
571a8de5 3314
cc11cc9b
PB
3315# These are the languages that are set in --enable-languages,
3316# and are available in the GCC tree.
3317all_selected_languages=
3318
571a8de5
DE
3319# Add the language fragments.
3320# Languages are added via two mechanisms. Some information must be
3321# recorded in makefile variables, these are defined in config-lang.in.
3322# We accumulate them and plug them into the main Makefile.
3323# The other mechanism is a set of hooks for each of the main targets
3324# like `clean', `install', etc.
3325
571a8de5
DE
3326language_hooks="Make-hooks"
3327
cc11cc9b 3328for lang in ${srcdir}/*/config-lang.in
571a8de5 3329do
cc11cc9b
PB
3330 case $lang in
3331 # The odd quoting in the next line works around
3332 # an apparent bug in bash 1.12 on linux.
3333changequote(,)dnl
3334 ${srcdir}/[*]/config-lang.in)
3335 continue ;;
3336 *)
3337 lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
3338 if test "x$lang_alias" = x
3339 then
3340 echo "$lang doesn't set \$language." 1>&2
3341 exit 1
3342 fi
3343 subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
3344 subdirs="$subdirs $subdir"
3345 case ",$enable_languages," in
3346 *,$lang_alias,*)
3347 all_selected_languages="$all_selected_languages $lang_alias"
3348 if test -f $srcdir/$subdir/lang-specs.h; then
3349 lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
3350 fi
3351 ;;
3352 esac
3353changequote([,])dnl
3354
3355 if test -f $srcdir/$subdir/lang.opt; then
3356 lang_opt_files="$lang_opt_files $srcdir/$subdir/lang.opt"
3357 fi
3358 if test -f $srcdir/$subdir/$subdir-tree.def; then
3359 lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
3360 fi
3361
3362 language=
3363 boot_language=
3364 compilers=
3365 stagestuff=
3366 outputs=
3367 gtfiles=
3368 . ${srcdir}/$subdir/config-lang.in
3369 if test "x$language" = x
3370 then
3371 echo "${srcdir}/$subdir/config-lang.in doesn't set \$language." 1>&2
3372 exit 1
3373 fi
3374 all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$subdir/Make-lang.in"
3375 if test -f ${srcdir}/$subdir/Makefile.in
3376 then all_lang_makefiles="$subdir/Makefile"
3377 fi
3378 all_languages="$all_languages $language"
3379 if test "x$boot_language" = xyes
3380 then
3381 all_boot_languages="$all_boot_languages $language"
3382 fi
3383 all_compilers="$all_compilers $compilers"
3384 all_stagestuff="$all_stagestuff $stagestuff"
3385 all_outputs="$all_outputs $outputs"
3386 all_gtfiles="$all_gtfiles $gtfiles"
3387 for f in $gtfiles
3388 do
3389 all_gtfiles_files_langs="$all_gtfiles_files_langs ${subdir} "
3390 all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
3391 done
3392 ;;
3393 esac
571a8de5
DE
3394done
3395
8ac9d31f
TJ
3396# Pick up gtfiles for c
3397gtfiles=
cc11cc9b 3398subdir="c"
8ac9d31f
TJ
3399. ${srcdir}/c-config-lang.in
3400all_gtfiles="$all_gtfiles $gtfiles"
c406e779 3401for f in $gtfiles
8ac9d31f 3402do
cc11cc9b 3403 all_gtfiles_files_langs="$all_gtfiles_files_langs ${subdir} "
8ac9d31f 3404 all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
8ac9d31f
TJ
3405done
3406
cbc59f01 3407check_languages=
cc11cc9b 3408for language in $all_selected_languages
cbc59f01 3409do
cc11cc9b 3410 check_languages="$check_languages check-$language"
cbc59f01
DD
3411done
3412
62b81e45 3413# We link each language in with a set of hooks, reached indirectly via
cc11cc9b 3414# lang.${target}. Only do so for selected languages.
571a8de5
DE
3415
3416rm -f Make-hooks
3417touch Make-hooks
bd97af06 3418target_list="all.cross start.encap rest.encap tags \
b2d7fd7b 3419 install-common install-man install-info dvi html \
a541f69d 3420 uninstall info man srcextra srcman srcinfo \
a03ad584 3421 mostlyclean clean distclean maintainer-clean \
8f231b5d 3422 stage1 stage2 stage3 stage4 stageprofile stagefeedback"
cc11cc9b 3423
571a8de5
DE
3424for t in $target_list
3425do
3426 x=
cc11cc9b 3427 for lang in $all_selected_languages
571a8de5 3428 do
cc11cc9b 3429 x="$x $lang.$t"
571a8de5
DE
3430 done
3431 echo "lang.$t: $x" >> Make-hooks
3432done
3433
630327c3
NN
3434# --------
3435# UNSORTED
3436# --------
3437
cc06d68c 3438# Create .gdbinit.
296e46bd 3439
cc06d68c
GP
3440echo "dir ." > .gdbinit
3441echo "dir ${srcdir}" >> .gdbinit
3442if test x$gdb_needs_out_file_path = xyes
3443then
3444 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
3445fi
3446if test "x$subdirs" != x; then
3447 for s in $subdirs
3448 do
3449 echo "dir ${srcdir}/$s" >> .gdbinit
3450 done
296e46bd 3451fi
cc06d68c 3452echo "source ${srcdir}/gdbinit.in" >> .gdbinit
296e46bd 3453
8f8d3278
NC
3454# If $(exec_prefix) exists and is not the same as $(prefix), then compute an
3455# absolute path for gcc_tooldir based on inserting the number of up-directory
3456# movements required to get from $(exec_prefix) to $(prefix) into the basic
3457# $(libsubdir)/@(unlibsubdir) based path.
82cbf8f7
JL
3458# Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
3459# make and thus we'd get different behavior depending on where we built the
3460# sources.
5949a9fc 3461if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
caa55b1e 3462 gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_noncanonical)'
d062c304 3463else
8f8d3278
NC
3464changequote(<<, >>)dnl
3465# An explanation of the sed strings:
3466# -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix'
3467# -e 's|/$||' match a trailing forward slash and eliminates it
3468# -e 's|^[^/]|/|' forces the string to start with a forward slash (*)
ff7cc307 3469# -e 's|/[^/]*|../|g' replaces each occurrence of /<directory> with ../
8f8d3278
NC
3470#
3471# (*) Note this pattern overwrites the first character of the string
3472# with a forward slash if one is not already present. This is not a
3473# problem because the exact names of the sub-directories concerned is
3474# unimportant, just the number of them matters.
3475#
3476# The practical upshot of these patterns is like this:
3477#
3478# prefix exec_prefix result
3479# ------ ----------- ------
3480# /foo /foo/bar ../
3481# /foo/ /foo/bar ../
3482# /foo /foo/bar/ ../
3483# /foo/ /foo/bar/ ../
3484# /foo /foo/bar/ugg ../../
3485#
4c112cda 3486 dollar='$$'
caa55b1e 3487 gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_noncanonical)"
8f8d3278 3488changequote([, ])dnl
d062c304
JL
3489fi
3490AC_SUBST(gcc_tooldir)
4c112cda 3491AC_SUBST(dollar)
d062c304 3492
2bbea3a6
RH
3493# Find a directory in which to install a shared libgcc.
3494
3495AC_ARG_ENABLE(version-specific-runtime-libs,
e8bec136
RO
3496[ --enable-version-specific-runtime-libs
3497 specify that runtime libraries should be
3498 installed in a compiler-specific directory])
2bbea3a6 3499
5b15f277 3500AC_ARG_WITH(slibdir,
22482f74 3501[ --with-slibdir=DIR shared libraries in DIR [[LIBDIR]]],
5b15f277
RH
3502slibdir="$with_slibdir",
3503if test "${enable_version_specific_runtime_libs+set}" = set; then
2bbea3a6 3504 slibdir='$(libsubdir)'
5b15f277 3505elif test "$host" != "$target"; then
2bbea3a6
RH
3506 slibdir='$(build_tooldir)/lib'
3507else
5b15f277
RH
3508 slibdir='$(libdir)'
3509fi)
2bbea3a6
RH
3510AC_SUBST(slibdir)
3511
1e6347d8 3512objdir=`${PWDCMD-pwd}`
7e717196
JL
3513AC_SUBST(objdir)
3514
22482f74
MS
3515AC_ARG_WITH(datarootdir,
3516[ --with-datarootdir=DIR Use DIR as the data root [[PREFIX/share]]],
3517datarootdir="\${prefix}/$with_datarootdir",
3518datarootdir='$(prefix)/share')
3519AC_SUBST(datarootdir)
3520
3521AC_ARG_WITH(docdir,
3522[ --with-docdir=DIR Install documentation in DIR [[DATAROOTDIR]]],
3523docdir="\${prefix}/$with_docdir",
3524docdir='$(datarootdir)')
3525AC_SUBST(docdir)
3526
3527AC_ARG_WITH(htmldir,
3528[ --with-htmldir=DIR html documentation in in DIR [[DOCDIR]]],
3529htmldir="\${prefix}/$with_htmldir",
3530htmldir='$(docdir)')
3531AC_SUBST(htmldir)
3532
46f18e7b
RK
3533# Substitute configuration variables
3534AC_SUBST(subdirs)
8ac9d31f 3535AC_SUBST(srcdir)
46f18e7b
RK
3536AC_SUBST(all_boot_languages)
3537AC_SUBST(all_compilers)
e2500fed 3538AC_SUBST(all_gtfiles)
8ac9d31f
TJ
3539AC_SUBST(all_gtfiles_files_langs)
3540AC_SUBST(all_gtfiles_files_files)
2ed26f6b 3541AC_SUBST(all_lang_makefrags)
9f3d1bc2
BK
3542AC_SUBST(all_lang_makefiles)
3543AC_SUBST(all_languages)
cc11cc9b 3544AC_SUBST(all_selected_languages)
9f3d1bc2
BK
3545AC_SUBST(all_stagestuff)
3546AC_SUBST(build_exeext)
3547AC_SUBST(build_install_headers_dir)
3548AC_SUBST(build_xm_file_list)
e22340b0 3549AC_SUBST(build_xm_include_list)
11642c3a 3550AC_SUBST(build_xm_defines)
cbc59f01 3551AC_SUBST(check_languages)
9f3d1bc2 3552AC_SUBST(cc_set_by_configure)
5aa82ace 3553AC_SUBST(quoted_cc_set_by_configure)
9f3d1bc2 3554AC_SUBST(cpp_install_dir)
2ed26f6b
ZW
3555AC_SUBST(xmake_file)
3556AC_SUBST(tmake_file)
30500d84 3557AC_SUBST(extra_gcc_objs)
9f3d1bc2 3558AC_SUBST(extra_headers_list)
46f18e7b 3559AC_SUBST(extra_objs)
9f3d1bc2
BK
3560AC_SUBST(extra_parts)
3561AC_SUBST(extra_passes)
3562AC_SUBST(extra_programs)
9f3d1bc2 3563AC_SUBST(float_h_file)
cc1e60ea 3564AC_SUBST(gcc_config_arguments)
9f3d1bc2 3565AC_SUBST(gcc_gxx_include_dir)
e2187d3b 3566AC_SUBST(libstdcxx_incdir)
9f3d1bc2 3567AC_SUBST(host_exeext)
46f18e7b 3568AC_SUBST(host_xm_file_list)
e22340b0 3569AC_SUBST(host_xm_include_list)
11642c3a 3570AC_SUBST(host_xm_defines)
476d9098 3571AC_SUBST(out_host_hook_obj)
9f3d1bc2 3572AC_SUBST(install)
d7b42618 3573AC_SUBST(lang_opt_files)
9f3d1bc2 3574AC_SUBST(lang_specs_files)
3103b7db 3575AC_SUBST(lang_tree_files)
46f18e7b 3576AC_SUBST(local_prefix)
9f3d1bc2
BK
3577AC_SUBST(md_file)
3578AC_SUBST(objc_boehm_gc)
3579AC_SUBST(out_file)
3580AC_SUBST(out_object_file)
46f18e7b 3581AC_SUBST(stage_prefix_set_by_configure)
596151e1 3582AC_SUBST(quoted_stage_prefix_set_by_configure)
9f3d1bc2
BK
3583AC_SUBST(thread_file)
3584AC_SUBST(tm_file_list)
e22340b0 3585AC_SUBST(tm_include_list)
d5355cb2 3586AC_SUBST(tm_defines)
11642c3a 3587AC_SUBST(tm_p_file_list)
e22340b0
ZW
3588AC_SUBST(tm_p_include_list)
3589AC_SUBST(xm_file_list)
3590AC_SUBST(xm_include_list)
3d9d2476 3591AC_SUBST(xm_defines)
aac69a49
NC
3592AC_SUBST(c_target_objs)
3593AC_SUBST(cxx_target_objs)
11642c3a 3594AC_SUBST(target_cpu_default)
46f18e7b 3595
46f18e7b
RK
3596AC_SUBST_FILE(language_hooks)
3597
7903cebc
NN
3598# Echo link setup.
3599if test x${build} = x${host} ; then
3600 if test x${host} = x${target} ; then
3601 echo "Links are now set up to build a native compiler for ${target}." 1>&2
3602 else
3603 echo "Links are now set up to build a cross-compiler" 1>&2
3604 echo " from ${host} to ${target}." 1>&2
3605 fi
46f18e7b 3606else
7903cebc
NN
3607 if test x${host} = x${target} ; then
3608 echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
3609 echo " for ${target}." 1>&2
3610 else
3611 echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
3612 echo " from ${host} to ${target}." 1>&2
3613 fi
46f18e7b
RK
3614fi
3615
6de9cd9a
DN
3616AC_ARG_VAR(GMPLIBS,[How to link GMP])
3617AC_ARG_VAR(GMPINC,[How to find GMP include files])
3618
46f18e7b
RK
3619# Configure the subdirectories
3620# AC_CONFIG_SUBDIRS($subdirs)
3621
3622# Create the Makefile
5891b37d 3623# and configure language subdirectories
914c5af7
NN
3624AC_CONFIG_FILES($all_outputs)
3625
3626AC_CONFIG_COMMANDS([default],
cdcc6a01 3627[
f1faaabd
NN
3628case ${CONFIG_HEADERS} in
3629 *auto-host.h:config.in*)
3630 echo > cstamp-h ;;
cdcc6a01 3631esac
2ed26f6b 3632# Make sure all the subdirs exist.
3b620440 3633for d in $subdirs doc build
2ed26f6b 3634do
2ed26f6b 3635 test -d $d || mkdir $d
2ed26f6b 3636done
93cf819d
BK
3637# If the host supports symlinks, point stage[1234] at ../stage[1234] so
3638# bootstrapping and the installation procedure can still use
3639# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks,
3640# FLAGS_TO_PASS has been modified to solve the problem there.
3641# This is virtually a duplicate of what happens in configure.lang; we do
3642# an extra check to make sure this only happens if ln -s can be used.
35f06ae4
PB
3643case "$LN_S" in
3644 *-s*)
3645 for d in ${subdirs} ; do
1e6347d8 3646 STARTDIR=`${PWDCMD-pwd}`
4e8a434e 3647 cd $d
8f231b5d 3648 for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include
4e8a434e
BK
3649 do
3650 rm -f $t
35f06ae4 3651 $LN_S ../$t $t 2>/dev/null
4e8a434e
BK
3652 done
3653 cd $STARTDIR
35f06ae4
PB
3654 done
3655 ;;
3656esac
0d24f4d1 3657],
35f06ae4 3658[subdirs='$subdirs'])
914c5af7 3659AC_OUTPUT