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