]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/configure.ac
configure: drop version checks for in-tree gas [PR91602]
[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
99dee823 4# Copyright (C) 1997-2021 Free Software Foundation, Inc.
46f18e7b 5
1322177d 6#This file is part of GCC.
46f18e7b 7
1322177d
LB
8#GCC is free software; you can redistribute it and/or modify it under
9#the terms of the GNU General Public License as published by the Free
9dcd6f09 10#Software Foundation; either version 3, or (at your option) any later
1322177d 11#version.
46f18e7b 12
1322177d
LB
13#GCC is distributed in the hope that it will be useful, but WITHOUT
14#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16#for more details.
46f18e7b
RK
17
18#You should have received a copy of the GNU General Public License
9dcd6f09
NC
19#along with GCC; see the file COPYING3. If not see
20#<http://www.gnu.org/licenses/>.
46f18e7b 21
34a86c2b
NN
22# --------------------------------
23# Initialization and sanity checks
24# --------------------------------
25
914c5af7
NN
26AC_INIT
27AC_CONFIG_SRCDIR(tree.c)
b7cb92ad 28AC_CONFIG_HEADER(auto-host.h:config.in)
cdcc6a01 29
9f18db39
PB
30gcc_version=`cat $srcdir/BASE-VER`
31
34a86c2b 32# Determine the host, build, and target systems
914c5af7
NN
33AC_CANONICAL_BUILD
34AC_CANONICAL_HOST
35AC_CANONICAL_TARGET
34a86c2b 36
47e62307
EB
37# Determine the noncanonical host name, for Ada.
38ACX_NONCANONICAL_HOST
39
caa55b1e 40# Determine the noncanonical target name, for directory use.
392765bf 41ACX_NONCANONICAL_TARGET
caa55b1e 42
85c64bbe
BS
43# Used for constructing correct paths for offload compilers.
44real_target_noncanonical=${target_noncanonical}
45accel_dir_suffix=
46
4665e56c
NN
47# Determine the target- and build-specific subdirectories
48GCC_TOPLEV_SUBDIRS
49
34a86c2b
NN
50# Set program_transform_name
51AC_ARG_PROGRAM
46f18e7b 52
75a39864
JL
53# Check for bogus environment variables.
54# Test if LIBRARY_PATH contains the notation for the current directory
55# since this would lead to problems installing/building glibc.
56# LIBRARY_PATH contains the current directory if one of the following
57# is true:
58# - one of the terminals (":" and ";") is the first or last sign
59# - two terminals occur directly after each other
60# - the path contains an element with a dot in it
61AC_MSG_CHECKING(LIBRARY_PATH variable)
62changequote(,)dnl
63case ${LIBRARY_PATH} in
64 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
65 library_path_setting="contains current directory"
66 ;;
67 *)
68 library_path_setting="ok"
69 ;;
70esac
71changequote([,])dnl
72AC_MSG_RESULT($library_path_setting)
73if test "$library_path_setting" != "ok"; then
74AC_MSG_ERROR([
75*** LIBRARY_PATH shouldn't contain the current directory when
079bd08e 76*** building gcc. Please change the environment variable
75a39864
JL
77*** and run configure again.])
78fi
79
80# Test if GCC_EXEC_PREFIX contains the notation for the current directory
81# since this would lead to problems installing/building glibc.
82# GCC_EXEC_PREFIX contains the current directory if one of the following
83# is true:
84# - one of the terminals (":" and ";") is the first or last sign
85# - two terminals occur directly after each other
86# - the path contains an element with a dot in it
87AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
88changequote(,)dnl
89case ${GCC_EXEC_PREFIX} in
90 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
91 gcc_exec_prefix_setting="contains current directory"
92 ;;
93 *)
94 gcc_exec_prefix_setting="ok"
95 ;;
96esac
97changequote([,])dnl
98AC_MSG_RESULT($gcc_exec_prefix_setting)
99if test "$gcc_exec_prefix_setting" != "ok"; then
100AC_MSG_ERROR([
101*** GCC_EXEC_PREFIX shouldn't contain the current directory when
079bd08e 102*** building gcc. Please change the environment variable
75a39864
JL
103*** and run configure again.])
104fi
105
34a86c2b
NN
106# -----------
107# Directories
108# -----------
109
110# Specify the local prefix
111local_prefix=
112AC_ARG_WITH(local-prefix,
b88ecf55
AS
113[AS_HELP_STRING([--with-local-prefix=DIR],
114 [specifies directory to put local include])],
34a86c2b
NN
115[case "${withval}" in
116yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
117no) ;;
118*) local_prefix=$with_local_prefix ;;
119esac])
120
121# Default local prefix if it is empty
122if test x$local_prefix = x; then
123 local_prefix=/usr/local
124fi
125
54b710be
YR
126AC_ARG_WITH([native-system-header-dir],
127 [ --with-native-system-header-dir=dir
128 use dir as the directory to look for standard
129 system header files in. Defaults to /usr/include.],
130[
131 case ${with_native_system_header_dir} in
132 yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
133 /* | [[A-Za-z]]:[[\\/]]*) ;;
134 *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
135 esac
136 configured_native_system_header_dir="${withval}"
137], [configured_native_system_header_dir=])
138
139AC_ARG_WITH(build-sysroot,
140 [AS_HELP_STRING([--with-build-sysroot=sysroot],
141 [use sysroot as the system root during the build])],
142 [if test x"$withval" != x ; then
143 SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
144 fi],
145 [SYSROOT_CFLAGS_FOR_TARGET=])
146AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
147
148if test "x$prefix" = xNONE; then
149 test_prefix=/usr/local
150else
151 test_prefix=$prefix
152fi
153if test "x$exec_prefix" = xNONE; then
154 test_exec_prefix=$test_prefix
155else
156 test_exec_prefix=$exec_prefix
157fi
158
159AC_ARG_WITH(sysroot,
160[AS_HELP_STRING([[--with-sysroot[=DIR]]],
161 [search for usr/lib, usr/include, et al, within DIR])],
162[
163 case ${with_sysroot} in
164 /) ;;
165 */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
166 esac
167 case ${with_sysroot} in
168 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
169 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
170 esac
171
172 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
173 CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
174
175 case ${TARGET_SYSTEM_ROOT} in
176 "${test_prefix}"|"${test_prefix}/"*|\
177 "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
178 '${prefix}'|'${prefix}/'*|\
179 '${exec_prefix}'|'${exec_prefix}/'*)
180 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
181 TARGET_SYSTEM_ROOT_DEFINE="$t"
182 ;;
183 esac
184], [
185 TARGET_SYSTEM_ROOT=
186 TARGET_SYSTEM_ROOT_DEFINE=
187 CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
188])
189AC_SUBST(TARGET_SYSTEM_ROOT)
190AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
191AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
192
34a86c2b
NN
193# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
194# passed in by the toplevel make and thus we'd get different behavior
195# depending on where we built the sources.
196gcc_gxx_include_dir=
197# Specify the g++ header file directory
198AC_ARG_WITH(gxx-include-dir,
b88ecf55
AS
199[AS_HELP_STRING([--with-gxx-include-dir=DIR],
200 [specifies directory to put g++ header files])],
34a86c2b
NN
201[case "${withval}" in
202yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
203no) ;;
204*) gcc_gxx_include_dir=$with_gxx_include_dir ;;
205esac])
206
b4d3485e
EB
207# If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate
208# the former in the latter and, upon success, compute gcc_gxx_include_dir as
209# relative to the sysroot.
210gcc_gxx_include_dir_add_sysroot=0
211
0f57bf40 212# This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
34a86c2b
NN
213if test x${gcc_gxx_include_dir} = x; then
214 if test x${enable_version_specific_runtime_libs} = xyes; then
215 gcc_gxx_include_dir='${libsubdir}/include/c++'
216 else
0f57bf40
MM
217 libstdcxx_incdir='include/c++/$(version)'
218 if test x$host != x$target; then
219 libstdcxx_incdir="$target_alias/$libstdcxx_incdir"
220 fi
15c723f3 221 gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
34a86c2b 222 fi
b4d3485e 223elif test "${with_sysroot+set}" = set; then
17719d09
HS
224 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
225 if test "${gcc_gxx_without_sysroot}"; then
b4d3485e 226 gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
17719d09
HS
227 gcc_gxx_include_dir_add_sysroot=1
228 fi
229fi
230
662b9c55
IS
231# Configuration for an alternate set of C++ headers.
232gcc_gxx_libcxx_include_dir=
233# Specify the alternate g++ header file directory
234AC_ARG_WITH(gxx-libcxx-include-dir,
235[AS_HELP_STRING([--with-gxx-libcxx-include-dir=DIR],
236 [specifies directory to find libc++ header files])],
237[case "${withval}" in
238yes) AC_MSG_ERROR(bad value ${withval} given for libc++ include directory) ;;
239no) ;;
240*) gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir ;;
241esac])
242
243# If both --with-sysroot and --with-gxx-libcxx-include-dir are passed, we
244# check to see if the latter starts with the former and, upon success, compute
245# gcc_gxx_libcxx_include_dir as relative to the sysroot.
246gcc_gxx_libcxx_include_dir_add_sysroot=0
247
248if test x${gcc_gxx_libcxx_include_dir} != x; then
249 AC_DEFINE(ENABLE_STDLIB_OPTION, 1,
250 [Define if the -stdlib= option should be enabled.])
251else
252 AC_DEFINE(ENABLE_STDLIB_OPTION, 0)
253fi
254# ??? This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
255if test x${gcc_gxx_libcxx_include_dir} = x; then
256 if test x${enable_version_specific_runtime_libs} = xyes; then
257 gcc_gxx_libcxx_include_dir='${libsubdir}/libc++_include/c++/v1'
258 else
259 libcxx_incdir='libc++_include/c++/$(version)/v1'
260 if test x$host != x$target; then
261 libcxx_incdir="$target_alias/$libcxx_incdir"
262 fi
263 gcc_gxx_libcxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libcxx_incdir"
264 fi
265elif test "${with_sysroot+set}" = set; then
266 gcc_gxx_libcxx_without_sysroot=`expr "${gcc_gxx_libcxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
267 if test "${gcc_gxx_libcxx_without_sysroot}"; then
268 gcc_gxx_libcxx_include_dir="${gcc_gxx_libcxx_without_sysroot}"
269 gcc_gxx_libcxx_include_dir_add_sysroot=1
270 fi
271fi
272
34a86c2b 273AC_ARG_WITH(cpp_install_dir,
b88ecf55
AS
274[AC_HELP_STRING([--with-cpp-install-dir=DIR],
275 [install the user visible C preprocessor in DIR
276 (relative to PREFIX) as well as PREFIX/bin])],
34a86c2b
NN
277[if test x$withval = xyes; then
278 AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
279elif test x$withval != xno; then
280 cpp_install_dir=$withval
281fi])
282
51b9ff45
KC
283# We would like to our source tree to be readonly. However when releases or
284# pre-releases are generated, the flex/bison generated files as well as the
285# various formats of manuals need to be included along with the rest of the
286# sources. Therefore we have --enable-generated-files-in-srcdir to do
287# just that.
288
03787dfd
KC
289AC_MSG_CHECKING([whether to place generated files in the source directory])
290 dnl generated-files-in-srcdir is disabled by default
291 AC_ARG_ENABLE(generated-files-in-srcdir,
b88ecf55
AS
292 [AS_HELP_STRING([--enable-generated-files-in-srcdir],
293 [put copies of generated files in source dir
294 intended for creating source tarballs for users
295 without texinfo bison or flex])],
03787dfd
KC
296 generated_files_in_srcdir=$enableval,
297 generated_files_in_srcdir=no)
298
299AC_MSG_RESULT($generated_files_in_srcdir)
300
301if test "$generated_files_in_srcdir" = "yes"; then
302 GENINSRC=''
03787dfd
KC
303else
304 GENINSRC='#'
03787dfd
KC
305fi
306AC_SUBST(GENINSRC)
51b9ff45 307
34a86c2b
NN
308# -------------------
309# Find default linker
310# -------------------
46f18e7b
RK
311
312# With GNU ld
313AC_ARG_WITH(gnu-ld,
b88ecf55 314[AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])],
df6faf79
JW
315gnu_ld_flag="$with_gnu_ld",
316gnu_ld_flag=no)
46f18e7b 317
eb89c82f 318case $target in
3b5e8ee4
IS
319 *darwin*)
320 ld64_flag=yes # Darwin can only use a ld64-compatible linker.
321 dsymutil_flag=yes # Darwin uses dsymutil to link debug.
322 ;;
323 *)
324 ld64_flag=no
325 dsymutil_flag=no
326 ;;
eb89c82f
IS
327esac
328
ab339d62
AO
329# With pre-defined ld
330AC_ARG_WITH(ld,
b88ecf55 331[AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])],
3ccc3a56
AO
332DEFAULT_LINKER="$with_ld")
333if test x"${DEFAULT_LINKER+set}" = x"set"; then
334 if test ! -x "$DEFAULT_LINKER"; then
99c012a8 335 AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
e154a394 336 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
ab339d62 337 gnu_ld_flag=yes
eb89c82f
IS
338 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep ld64- > /dev/null; then
339 ld64_flag=yes
ab339d62 340 fi
119d24d1
KG
341 AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
342 [Define to enable the use of a default linker.])
ab339d62
AO
343fi
344
34a86c2b
NN
345AC_MSG_CHECKING([whether a default linker was specified])
346if test x"${DEFAULT_LINKER+set}" = x"set"; then
347 if test x"$gnu_ld_flag" = x"no"; then
348 AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
349 else
350 AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
351 fi
352else
353 AC_MSG_RESULT(no)
354fi
355
d594623a
L
356# With demangler in GNU ld
357AC_ARG_WITH(demangler-in-ld,
b88ecf55 358[AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])],
d594623a 359demangler_in_ld="$with_demangler_in_ld",
df45fc34 360demangler_in_ld=yes)
d594623a 361
3b5e8ee4
IS
362# Allow the user to specify a dsymutil executable (used on Darwin only, so far)
363AC_ARG_WITH(dsymutil,
364[AS_HELP_STRING([--with-dsymutil], [arrange to use the specified dsymutil (full pathname)])],
365DEFAULT_DSYMUTIL="$with_dsymutil")
366
367dsymutil_vers=
368if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then
369 if test ! -x "$DEFAULT_DSYMUTIL"; then
370 AC_MSG_ERROR([cannot execute: $DEFAULT_DSYMUTIL: check --with-dsymutil or env. var. DEFAULT_DSYMUTIL])
371 else
372 if dsymutil_vers=`$DEFAULT_DSYMUTIL -v /dev/null 2>&1`; then
373 dsymutil_flag=yes
374 fi
375 fi
376 AC_DEFINE_UNQUOTED(DEFAULT_DSYMUTIL,"$DEFAULT_DSYMUTIL",
377 [Define to enable the use of a default debug linker.])
378fi
379
380AC_MSG_CHECKING([whether a default dsymutil was specified])
381if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then
382 AC_MSG_RESULT([yes ($DEFAULT_DSYMUTIL)])
383else
384 AC_MSG_RESULT(no)
385fi
386
34a86c2b
NN
387# ----------------------
388# Find default assembler
389# ----------------------
390
46f18e7b
RK
391# With GNU as
392AC_ARG_WITH(gnu-as,
b88ecf55 393[AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])],
df6faf79
JW
394gas_flag="$with_gnu_as",
395gas_flag=no)
46f18e7b 396
ab339d62 397AC_ARG_WITH(as,
b88ecf55 398[AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])],
3ccc3a56
AO
399DEFAULT_ASSEMBLER="$with_as")
400if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
401 if test ! -x "$DEFAULT_ASSEMBLER"; then
99c012a8 402 AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
e154a394 403 elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
ab339d62
AO
404 gas_flag=yes
405 fi
119d24d1
KG
406 AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
407 [Define to enable the use of a default assembler.])
3ccc3a56 408fi
ab339d62 409
34a86c2b
NN
410AC_MSG_CHECKING([whether a default assembler was specified])
411if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
412 if test x"$gas_flag" = x"no"; then
413 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
4e88d51b 414 else
34a86c2b 415 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
4e88d51b 416 fi
34a86c2b
NN
417else
418 AC_MSG_RESULT(no)
4e88d51b 419fi
46f18e7b 420
34a86c2b
NN
421# ---------------
422# Find C compiler
423# ---------------
13c22933 424
426ca3ca
RO
425# If a non-executable a.out is present (e.g. created by GNU as above even if
426# invoked with -v only), the IRIX 6 native ld just overwrites the existing
427# file, even when creating an executable, so an execution test fails.
428# Remove possible default executable files to avoid this.
429#
430# FIXME: This really belongs into AC_PROG_CC and can be removed once
431# Autoconf includes it.
432rm -f a.out a.exe b.out
433
414d23ae
HPN
434# Find the native compiler
435AC_PROG_CC
00020c16 436AC_PROG_CXX
e8679fd5 437ACX_PROG_GNAT([-I"$srcdir"/ada/libgnat])
3d4e720a 438
13ccfea8
JM
439# Do configure tests with the C++ compiler, since that's what we build with.
440AC_LANG(C++)
441
ec6c7392
PB
442# Remove the -O2: for historical reasons, unless bootstrapping we prefer
443# optimizations to be activated explicitly by the toplevel.
444case "$CC" in
445 */prev-gcc/xgcc*) ;;
dadbefd3
JJ
446 *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" `
447 CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;;
ec6c7392
PB
448esac
449AC_SUBST(CFLAGS)
8bf4ee34 450AC_SUBST(CXXFLAGS)
ec6c7392 451
e3aa9eba
RO
452# Determine PICFLAG for target gnatlib.
453GCC_PICFLAG_FOR_TARGET
454AC_SUBST(PICFLAG_FOR_TARGET)
455
73458fb7
NN
456# -------------------------
457# Check C compiler features
458# -------------------------
459
60d26958 460AC_USE_SYSTEM_EXTENSIONS
5329b59a 461
34a86c2b
NN
462AC_PROG_CPP
463AC_C_INLINE
34a86c2b 464
480767a9
ILT
465AC_SYS_LARGEFILE
466
34a86c2b 467# sizeof(char) is 1 by definition.
bf3b7cd3
JD
468AC_CHECK_SIZEOF(void *)
469AC_CHECK_SIZEOF(short)
470AC_CHECK_SIZEOF(int)
471AC_CHECK_SIZEOF(long)
5ec1c5e6 472AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
7c2a2dbf 473GCC_STDINT_TYPES
edf6ddf6
RB
474if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
475 AC_MSG_ERROR([uint64_t or int64_t not found])
476fi
34a86c2b 477
35987ae9 478# check what underlying integer type int64_t uses
35987ae9
RB
479AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [
480AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
481#ifdef HAVE_STDINT_H
482#include <stdint.h>
483#endif
484template <typename T> struct X { };
485template <>
486struct X<long> { typedef long t; };
487]], [[X<int64_t>::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])])
488if test "$ac_cv_int64_t_type" = "long"; then
489 AC_DEFINE(INT64_T_IS_LONG, 1,
490 [Define if int64_t uses long as underlying type.])
491else
492AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
493#ifdef HAVE_STDINT_H
494#include <stdint.h>
495#endif
496template <typename T> struct X { };
497template <>
498struct X<long long> { typedef long long t; };
499]], [[X<int64_t>::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])])
500fi
35987ae9 501
3dde4d65
MM
502AC_CACHE_CHECK(for std::swap in <utility>, ac_cv_std_swap_in_utility, [
503AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
504#include <utility>
505]], [[int a, b; std::swap(a,b);]])],[ac_cv_std_swap_in_utility=yes],[ac_cv_std_swap_in_utility=no])])
506if test $ac_cv_std_swap_in_utility = yes; then
507 AC_DEFINE(HAVE_SWAP_IN_UTILITY, 1,
508 [Define if <utility> defines std::swap.])
509fi
510
4c0cca18
UW
511# Check whether compiler is affected by placement new aliasing bug (PR 29286).
512# If the host compiler is affected by the bug, and we build with optimization
513# enabled (which happens e.g. when cross-compiling), the pool allocator may
514# get miscompiled. Use -fno-strict-aliasing to work around this problem.
515# Since there is no reliable feature check for the presence of this bug,
516# we simply use a GCC version number check. (This should never trigger for
517# stages 2 or 3 of a native bootstrap.)
518aliasing_flags=
519if test "$GCC" = yes; then
520 saved_CXXFLAGS="$CXXFLAGS"
521
522 # The following test compilation will succeed if and only if $CXX accepts
523 # -fno-strict-aliasing *and* is older than GCC 4.3.
524 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
525 AC_MSG_CHECKING([whether $CXX is affected by placement new aliasing bug])
22e05272 526 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
4c0cca18
UW
527#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
528#error compiler not affected by placement new aliasing bug
529#endif
22e05272 530])],
4c0cca18
UW
531 [AC_MSG_RESULT([yes]); aliasing_flags='-fno-strict-aliasing'],
532 [AC_MSG_RESULT([no])])
533
534 CXXFLAGS="$saved_CXXFLAGS"
535fi
536AC_SUBST(aliasing_flags)
35987ae9
RB
537
538
539
34a86c2b
NN
540# ---------------------
541# Warnings and checking
542# ---------------------
543
b5472e1d
NN
544# Check $CC warning features (if it's GCC).
545# We want to use -pedantic, but we don't want warnings about
546# * 'long long'
547# * variadic macros
89a42ac8 548# * overlong strings
25339f10 549# * C++11 narrowing conversions in { }
b5472e1d
NN
550# So, we only use -pedantic if we can disable those warnings.
551
1652c6da
JM
552# In stage 1, disable -Wformat warnings from old GCCs about new % codes
553AC_ARG_ENABLE(build-format-warnings,
554 AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
555 [],[enable_build_format_warnings=yes])
556AS_IF([test $enable_build_format_warnings = no],
557 [wf_opt=-Wno-format],[wf_opt=])
ff771de3 558ACX_PROG_CXX_WARNING_OPTS(
9bf40084 559 m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
0ecf545c
MS
560 [-Wcast-qual -Wno-error=format-diag $wf_opt])),
561 [loose_warn])
f6e377f8 562ACX_PROG_CC_WARNING_OPTS(
0ecf545c
MS
563 m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ],
564 [-Wno-error=format-diag])), [c_loose_warn])
ff771de3 565ACX_PROG_CXX_WARNING_OPTS(
ec9d5ad1
UB
566 m4_quote(m4_do([-Wmissing-format-attribute ],
567 [-Woverloaded-virtual])), [strict_warn])
00020c16
ILT
568ACX_PROG_CC_WARNING_OPTS(
569 m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
ff771de3 570ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC(
75c9cbe3
AS
571 m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],
572 [-Wno-overlength-strings])), [strict_warn])
ff771de3 573ACX_PROG_CXX_WARNINGS_ARE_ERRORS([manual], [strict_warn])
3bbd5a19
PB
574
575# The above macros do nothing if the compiler is not GCC. However, the
00020c16
ILT
576# Makefile has more goo to add other flags, so these variables are used
577# to enable warnings only for GCC.
414d23ae 578warn_cflags=
00020c16 579warn_cxxflags=
414d23ae
HPN
580if test "x$GCC" = "xyes"; then
581 warn_cflags='$(GCC_WARN_CFLAGS)'
00020c16 582 warn_cxxflags='$(GCC_WARN_CXXFLAGS)'
414d23ae
HPN
583fi
584AC_SUBST(warn_cflags)
00020c16 585AC_SUBST(warn_cxxflags)
414d23ae 586
e9411247
MM
587# Disable exceptions and RTTI if building with g++
588ACX_PROG_CC_WARNING_OPTS(
3d47a53a
UB
589 m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])),
590 [noexception_flags])
e9411247 591
8b1f719a 592# Enable expensive internal checks
a1286ef5
ZW
593is_release=
594if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
595 is_release=yes
596fi
dd859b8a 597
a494747c 598AC_ARG_ENABLE(checking,
b88ecf55
AS
599[AS_HELP_STRING([[--enable-checking[=LIST]]],
600 [enable expensive run-time checks. With LIST,
601 enable only specific categories of checks.
602 Categories are: yes,no,all,none,release.
7db11a5a 603 Flags are: assert,df,extra,fold,gc,gcac,gimple,misc,
b88ecf55 604 rtlflag,rtl,runtime,tree,valgrind,types])],
e1bbfc5c
NS
605[ac_checking_flags="${enableval}"],[
606# Determine the default checks.
607if test x$is_release = x ; then
7db11a5a 608 ac_checking_flags=yes,extra
e1bbfc5c
NS
609else
610 ac_checking_flags=release
611fi])
e1bbfc5c 612IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
04c3028a 613for check in release $ac_checking_flags
e1bbfc5c
NS
614do
615 case $check in
cdce5c16 616 # these set all the flags to specific states
0d475361 617 yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
7db11a5a 618 ac_fold_checking= ; ac_gc_checking=1 ; ac_extra_checking= ;
726a989a 619 ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
232b67d9 620 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
7e98624c 621 ac_tree_checking=1 ; ac_valgrind_checking= ;
1b24a790 622 ac_types_checking=1 ;;
3089f8b5 623 no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
7db11a5a 624 ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
726a989a 625 ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
232b67d9 626 ac_rtlflag_checking= ; ac_runtime_checking= ;
7e98624c
RG
627 ac_tree_checking= ; ac_valgrind_checking= ;
628 ac_types_checking= ;;
3089f8b5 629 all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
7db11a5a 630 ac_fold_checking=1 ; ac_gc_checking=1 ; ac_extra_checking=1 ;
726a989a 631 ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
cdce5c16 632 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
7e98624c
RG
633 ac_tree_checking=1 ; ac_valgrind_checking= ;
634 ac_types_checking=1 ;;
3089f8b5 635 release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
7db11a5a 636 ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
726a989a 637 ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
cdce5c16 638 ac_rtlflag_checking= ; ac_runtime_checking=1 ;
7e98624c
RG
639 ac_tree_checking= ; ac_valgrind_checking= ;
640 ac_types_checking= ;;
cdce5c16 641 # these enable particular checks
e1bbfc5c 642 assert) ac_assert_checking=1 ;;
7db11a5a
JJ
643 df) ac_df_checking=1 ;;
644 extra) ac_extra_checking=1 ;;
e1bbfc5c
NS
645 fold) ac_fold_checking=1 ;;
646 gc) ac_gc_checking=1 ;;
647 gcac) ac_gc_always_collect=1 ;;
726a989a 648 gimple) ac_gimple_checking=1 ;;
e1bbfc5c 649 misc) ac_checking=1 ;;
e1bbfc5c 650 rtl) ac_rtl_checking=1 ;;
cdce5c16 651 rtlflag) ac_rtlflag_checking=1 ;;
b53ef395 652 runtime) ac_runtime_checking=1 ;;
e1bbfc5c 653 tree) ac_tree_checking=1 ;;
7e98624c 654 types) ac_types_checking=1 ;;
cdce5c16 655 valgrind) ac_valgrind_checking=1 ;;
e1bbfc5c
NS
656 *) AC_MSG_ERROR(unknown check category $check) ;;
657 esac
658done
659IFS="$ac_save_IFS"
660
204250d2 661nocommon_flag=""
119d24d1 662if test x$ac_checking != x ; then
b06f87c7
BE
663 AC_DEFINE(CHECKING_P, 1,
664[Define to 0/1 if you want more run-time sanity checks. This one gets a grab
665bag of miscellaneous but relatively cheap checks.])
204250d2 666 nocommon_flag=-fno-common
7ec491c0
MM
667else
668 AC_DEFINE(CHECKING_P, 0)
119d24d1 669fi
204250d2 670AC_SUBST(nocommon_flag)
b06f87c7
BE
671if test x$ac_extra_checking != x ; then
672 AC_DEFINE(ENABLE_EXTRA_CHECKING, 1,
673[Define to 0/1 if you want extra run-time checking that might affect code
674generation.])
675else
676 AC_DEFINE(ENABLE_EXTRA_CHECKING, 0)
677fi
3089f8b5
PB
678if test x$ac_df_checking != x ; then
679 AC_DEFINE(ENABLE_DF_CHECKING, 1,
680[Define if you want more run-time sanity checks for dataflow.])
681fi
06c37c96
NS
682if test x$ac_assert_checking != x ; then
683 AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
684[Define if you want assertions enabled. This is a cheap check.])
685fi
726a989a
RB
686if test x$ac_gimple_checking != x ; then
687 AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1,
688[Define if you want operations on GIMPLE (the basic data structure of
689the high-level optimizers) to be checked for dynamic type safety at
690runtime. This is moderately expensive.])
691fi
232b67d9 692GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
b53ef395
NS
693if test x$ac_runtime_checking != x ; then
694 AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
695[Define if you want runtime assertions enabled. This is a cheap check.])
696fi
119d24d1
KG
697if test x$ac_tree_checking != x ; then
698 AC_DEFINE(ENABLE_TREE_CHECKING, 1,
699[Define if you want all operations on trees (the basic data
700 structure of the front ends) to be checked for dynamic type safety
8d2ccbd2 701 at runtime. This is moderately expensive.
13f05fd0 702 ])
7cb9fd07 703 TREECHECKING=yes
119d24d1 704fi
7e98624c
RG
705if test x$ac_types_checking != x ; then
706 AC_DEFINE(ENABLE_TYPES_CHECKING, 1,
707[Define if you want all gimple types to be verified after gimplifiation.
708 This is cheap.
709 ])
710fi
7cb9fd07 711AC_SUBST(TREECHECKING)
119d24d1
KG
712if test x$ac_rtl_checking != x ; then
713 AC_DEFINE(ENABLE_RTL_CHECKING, 1,
714[Define if you want all operations on RTL (the basic data structure
715 of the optimizer and back end) to be checked for dynamic type safety
716 at runtime. This is quite expensive.])
717fi
4c76f856
JJ
718if test x$ac_rtlflag_checking != x ; then
719 AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
720[Define if you want RTL flag accesses to be checked against the RTL
721 codes that are supported for each access macro. This is relatively
722 cheap.])
723fi
119d24d1
KG
724if test x$ac_gc_checking != x ; then
725 AC_DEFINE(ENABLE_GC_CHECKING, 1,
726[Define if you want the garbage collector to do object poisoning and
727 other memory allocation checks. This is quite expensive.])
728fi
729if test x$ac_gc_always_collect != x ; then
730 AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
731[Define if you want the garbage collector to operate in maximally
732 paranoid mode, validating the entire heap and collecting garbage at
733 every opportunity. This is extremely expensive.])
734fi
5dfa45d0
JJ
735if test x$ac_fold_checking != x ; then
736 AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
737[Define if you want fold checked that it never destructs its argument.
738 This is quite expensive.])
739fi
414d23ae
HPN
740valgrind_path_defines=
741valgrind_command=
6938ec6c
NN
742
743dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
744dnl # an if statement. This was the source of very frustrating bugs
745dnl # in converting to autoconf 2.5x!
746AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
747
279a935f
RB
748# It is certainly possible that there's valgrind but no valgrind.h.
749# GCC relies on making annotations so we must have both.
750AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>)
751AC_PREPROC_IFELSE([AC_LANG_SOURCE(
752 [[#include <valgrind/memcheck.h>
a207b594
HPN
753#ifndef VALGRIND_DISCARD
754#error VALGRIND_DISCARD not defined
f04f1d2c 755#endif]])],
a207b594
HPN
756 [gcc_cv_header_valgrind_memcheck_h=yes],
757 [gcc_cv_header_valgrind_memcheck_h=no])
279a935f
RB
758AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
759AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
760AC_PREPROC_IFELSE([AC_LANG_SOURCE(
761 [[#include <memcheck.h>
14011ca4
AJ
762#ifndef VALGRIND_DISCARD
763#error VALGRIND_DISCARD not defined
f04f1d2c
KC
764#endif]])],
765 [gcc_cv_header_memcheck_h=yes],
766 [gcc_cv_header_memcheck_h=no])
279a935f
RB
767AC_MSG_RESULT($gcc_cv_header_memcheck_h)
768if test $gcc_cv_header_valgrind_memcheck_h = yes; then
769 AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
770 [Define if valgrind's valgrind/memcheck.h header is installed.])
771fi
772if test $gcc_cv_header_memcheck_h = yes; then
773 AC_DEFINE(HAVE_MEMCHECK_H, 1,
774 [Define if valgrind's memcheck.h header is installed.])
775fi
776
777if test x$ac_valgrind_checking != x ; then
414d23ae
HPN
778 AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
779 [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
a207b594
HPN
780 if test "x$valgrind_path" = "x" \
781 || (test $have_valgrind_h = no \
782 && test $gcc_cv_header_memcheck_h = no \
783 && test $gcc_cv_header_valgrind_memcheck_h = no); then
784 AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
414d23ae
HPN
785 fi
786 valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
787 valgrind_command="$valgrind_path -q"
788 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
789[Define if you want to run subprograms and generated programs
790 through valgrind (a memory checker). This is extremely expensive.])
791fi
792AC_SUBST(valgrind_path_defines)
793AC_SUBST(valgrind_command)
51d0e20c 794
22aa533e
NS
795# Enable code coverage collection
796AC_ARG_ENABLE(coverage,
b88ecf55
AS
797[AS_HELP_STRING([[--enable-coverage[=LEVEL]]],
798 [enable compiler's code coverage collection.
799 Use to measure compiler performance and locate
800 unused parts of the compiler. With LEVEL, specify
801 optimization. Values are opt, noopt,
802 default is noopt])],
22aa533e 803[case "${enableval}" in
6dd297da 804 yes|noopt)
9879232c 805 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0 -fkeep-static-functions"
6dd297da
NN
806 ;;
807 opt)
9879232c 808 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2 -fkeep-static-functions"
6dd297da
NN
809 ;;
810 no)
811 # a.k.a. --disable-coverage
812 coverage_flags=""
813 ;;
814 *)
815 AC_MSG_ERROR(unknown coverage setting $enableval)
816 ;;
22aa533e 817esac],
2043c38e 818[coverage_flags=""])
22aa533e
NS
819AC_SUBST(coverage_flags)
820
439a7e54 821AC_ARG_ENABLE(gather-detailed-mem-stats,
b88ecf55
AS
822[AS_HELP_STRING([--enable-gather-detailed-mem-stats],
823 [enable detailed memory allocation stats gathering])], [],
439a7e54 824[enable_gather_detailed_mem_stats=no])
7aa6d18a
SB
825gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi`
826AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
827[Define to enable detailed memory allocation stats gathering.])
439a7e54 828
279a935f
RB
829AC_ARG_ENABLE(valgrind-annotations,
830[AS_HELP_STRING([--enable-valgrind-annotations],
831 [enable valgrind runtime interaction])], [],
832[enable_valgrind_annotations=no])
833if test x$enable_valgrind_annotations != xno \
834 || test x$ac_valgrind_checking != x; then
835 if (test $have_valgrind_h = no \
836 && test $gcc_cv_header_memcheck_h = no \
837 && test $gcc_cv_header_valgrind_memcheck_h = no); then
838 AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h])
839 fi
840 AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
841[Define to get calls to the valgrind runtime enabled.])
842fi
843
73458fb7
NN
844# -------------------------------
845# Miscenalleous configure options
846# -------------------------------
34a86c2b
NN
847
848# With stabs
849AC_ARG_WITH(stabs,
b88ecf55
AS
850[AS_HELP_STRING([--with-stabs],
851 [arrange to use stabs instead of host debug format])],
34a86c2b
NN
852stabs="$with_stabs",
853stabs=no)
854
34a86c2b
NN
855# Determine whether or not multilibs are enabled.
856AC_ARG_ENABLE(multilib,
b88ecf55
AS
857[AS_HELP_STRING([--enable-multilib],
858 [enable library support for multiple ABIs])],
34a86c2b
NN
859[], [enable_multilib=yes])
860AC_SUBST(enable_multilib)
3ecc3258 861
e0cdc09f
MK
862# Determine whether or not multiarch is enabled.
863AC_ARG_ENABLE(multiarch,
864[AS_HELP_STRING([--enable-multiarch],
865 [enable support for multiarch paths])],
5213f20c
MK
866[case "${enableval}" in
867yes|no|auto) enable_multiarch=$enableval;;
868*) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;;
e0cdc09f
MK
869esac], [enable_multiarch=auto])
870if test x${enable_multiarch} = xauto; then
871 if test x${with_native_system_header_dir} != x; then
872 ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)"
873 enable_multiarch=no
874 fi
875 if test x$host != x$target && test "x$with_sysroot" = x; then
876 ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)"
877 enable_multiarch=no
878 fi
879fi
880AC_MSG_CHECKING(for multiarch configuration)
881AC_SUBST(enable_multiarch)
882AC_MSG_RESULT($enable_multiarch$ma_msg_suffix)
883
884# needed for setting the multiarch name for soft-float/hard-float ABIs
d757eae9 885AC_SUBST(with_cpu)
e0cdc09f
MK
886AC_SUBST(with_float)
887
630b1e3a
TC
888# default stack clash protection guard size as power of twos in bytes.
889# Please keep these in sync with params.def.
890stk_clash_min=12
891stk_clash_max=30
892
893# Keep the default value when the option is not used to 0, this allows us to
894# distinguish between the cases where the user specifially set a value via
895# configure and when the normal default value is used.
896AC_ARG_WITH(stack-clash-protection-guard-size,
897[AS_HELP_STRING([--with-stack-clash-protection-guard-size=size],
898[Set the default stack clash protection guard size for specific targets as a power of two in bytes.])],
899[DEFAULT_STK_CLASH_GUARD_SIZE="$with_stack_clash_protection_guard_size"], [DEFAULT_STK_CLASH_GUARD_SIZE=0])
900if test $DEFAULT_STK_CLASH_GUARD_SIZE -ne 0 \
901 && (test $DEFAULT_STK_CLASH_GUARD_SIZE -lt $stk_clash_min \
902 || test $DEFAULT_STK_CLASH_GUARD_SIZE -gt $stk_clash_max); then
903 AC_MSG_ERROR(m4_normalize([
904 Invalid value $DEFAULT_STK_CLASH_GUARD_SIZE for --with-stack-clash-protection-guard-size. \
905 Must be between $stk_clash_min and $stk_clash_max.]))
906fi
907
908AC_DEFINE_UNQUOTED(DEFAULT_STK_CLASH_GUARD_SIZE, $DEFAULT_STK_CLASH_GUARD_SIZE,
909 [Define to larger than zero set the default stack clash protector size.])
910
4bafaa6f
L
911# Enable __cxa_atexit for C++.
912AC_ARG_ENABLE(__cxa_atexit,
b88ecf55 913[AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
4bafaa6f 914[], [])
2121a768 915
486aa804 916# Enable C extension for decimal float if target supports it.
3c39bca6 917GCC_AC_ENABLE_DECIMAL_FLOAT([$target])
486aa804 918
79b87c74 919dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi`
486aa804
BE
920AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
921[Define to 1 to enable decimal float extension to C.])
922
cc0ae0ca
L
923# Use default_decimal_float for dependency.
924enable_decimal_float=$default_decimal_float
925
79b87c74
MM
926bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi`
927AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid,
928[Define to 1 to specify that we are using the BID decimal floating
929point format instead of DPD])
930
ab22c1fa
CF
931# Enable C extension for fixed-point arithmetic.
932AC_ARG_ENABLE(fixed-point,
b88ecf55
AS
933[AS_HELP_STRING([--enable-fixed-point],
934 [enable fixed-point arithmetic extension to C])],
935[],
ab22c1fa
CF
936[
937 case $target in
655b30bf
JB
938 arm*)
939 enable_fixed_point=yes
940 ;;
941
ab22c1fa 942 mips*-*-*)
b24513a1 943 enable_fixed_point=yes
ab22c1fa
CF
944 ;;
945 *)
84f47d20 946 AC_MSG_WARN([fixed-point is not supported for this target, ignored])
ab22c1fa
CF
947 enable_fixed_point=no
948 ;;
949 esac
950])
951AC_SUBST(enable_fixed_point)
952
953fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi`
954AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint,
955[Define to 1 to enable fixed-point arithmetic extension to C.])
956
0bbb1697
RK
957# Enable threads
958# Pass with no value to take the default
959# Pass with a value to specify a thread package
960AC_ARG_ENABLE(threads,
b88ecf55
AS
961[AS_HELP_STRING([[--enable-threads[=LIB]]],
962 [enable thread usage for target GCC,
963 using LIB thread package])],,
615be2cf 964[enable_threads=''])
0bbb1697 965
8dea1cca 966AC_ARG_ENABLE(tls,
b88ecf55
AS
967[AS_HELP_STRING([--enable-tls],
968 [enable or disable generation of tls code
969 overriding the assembler check for tls support])],
8dea1cca
DD
970[
971 case $enable_tls in
972 yes | no) ;;
973 *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
974Valid choices are 'yes' and 'no'.]) ;;
975 esac
976], [enable_tls=''])
977
ad103b01
RO
978AC_ARG_ENABLE(vtable-verify,
979[AS_HELP_STRING([--enable-vtable-verify],
980 [enable vtable verification feature])],,
981[enable_vtable_verify=no])
982vtable_verify=`if test x$enable_vtable_verify = xyes; then echo 1; else echo 0; fi`
983AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
984[Define 0/1 if vtable verification feature is enabled.])
985
757bf1df
DM
986AC_ARG_ENABLE(analyzer,
987[AS_HELP_STRING([--disable-analyzer],
988 [disable -fanalyzer static analyzer])],
989if test x$enable_analyzer = xno; then
990 analyzer=0
991else
992 analyzer=1
993fi,
994analyzer=1)
995AC_DEFINE_UNQUOTED(ENABLE_ANALYZER, $analyzer,
996[Define 0/1 if static analyzer feature is enabled.])
997
d8bb17c8 998AC_ARG_ENABLE(objc-gc,
b88ecf55
AS
999[AS_HELP_STRING([--enable-objc-gc],
1000 [enable the use of Boehm's garbage collector with
1001 the GNU Objective-C runtime])],
2618c083 1002if test x$enable_objc_gc = xno; then
d8bb17c8
OP
1003 objc_boehm_gc=''
1004else
1005 objc_boehm_gc=1
1006fi,
1007objc_boehm_gc='')
1008
90e6a802 1009AC_ARG_WITH(dwarf2,
b88ecf55 1010[AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])],
87921b81 1011dwarf2="$with_dwarf2",
90e6a802
RL
1012dwarf2=no)
1013
50503ac8 1014AC_ARG_ENABLE(shared,
b88ecf55 1015[AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])],
c785e0fa
AO
1016[
1017 case $enable_shared in
1018 yes | no) ;;
1019 *)
1020 enable_shared=no
1021 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1022 for pkg in $enableval; do
1023 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
1024 enable_shared=yes
1025 fi
1026 done
1027 IFS="$ac_save_ifs"
1028 ;;
1029 esac
1030], [enable_shared=yes])
50503ac8
RH
1031AC_SUBST(enable_shared)
1032
1765b023
RV
1033AC_ARG_ENABLE(gcov,
1034[ --disable-gcov don't provide libgcov and related host tools],
1035[], [enable_gcov=yes])
1036AC_SUBST(enable_gcov)
1037
e11ddaf5
NS
1038AC_ARG_WITH(specs,
1039 [AS_HELP_STRING([--with-specs=SPECS],
1040 [add SPECS to driver command-line processing])],
1041 [CONFIGURE_SPECS=$withval],
1042 [CONFIGURE_SPECS=]
1043)
1044AC_SUBST(CONFIGURE_SPECS)
1045
2f41c1d6 1046ACX_PKGVERSION([GCC])
9334ef9e 1047ACX_BUGURL([https://gcc.gnu.org/bugs/])
2f41c1d6 1048
b4c7ca2e
DM
1049# Allow overriding the default URL for documentation
1050AC_ARG_WITH(documentation-root-url,
1051 AS_HELP_STRING([--with-documentation-root-url=URL],
1052 [Root for documentation URLs]),
1053 [case "$withval" in
1054 yes) AC_MSG_ERROR([documentation root URL not specified]) ;;
1055 no) AC_MSG_ERROR([documentation root URL not specified]) ;;
e33a1eae
JJ
1056 */) DOCUMENTATION_ROOT_URL="$withval" ;;
1057 *) AC_MSG_ERROR([documentation root URL does not end with /]) ;;
b4c7ca2e 1058 esac],
fa29cf0c 1059 DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/"
b4c7ca2e 1060)
e33a1eae
JJ
1061AC_DEFINE_UNQUOTED(DOCUMENTATION_ROOT_URL,"$DOCUMENTATION_ROOT_URL",
1062 [Define to the root for documentation URLs.])
b4c7ca2e 1063
691eeb65
JJ
1064# Allow overriding the default URL for GCC changes
1065AC_ARG_WITH(changes-root-url,
1066 AS_HELP_STRING([--with-changes-root-url=URL],
1067 [Root for GCC changes URLs]),
1068 [case "$withval" in
1069 yes) AC_MSG_ERROR([changes root URL not specified]) ;;
1070 no) AC_MSG_ERROR([changes root URL not specified]) ;;
e33a1eae
JJ
1071 */) CHANGES_ROOT_URL="$withval" ;;
1072 *) AC_MSG_ERROR([changes root URL does not end with /]) ;;
691eeb65
JJ
1073 esac],
1074 CHANGES_ROOT_URL="https://gcc.gnu.org/"
1075)
e33a1eae
JJ
1076AC_DEFINE_UNQUOTED(CHANGES_ROOT_URL,"$CHANGES_ROOT_URL",
1077 [Define to the root for URLs about GCC changes.])
691eeb65 1078
e4c9c075
PB
1079# Sanity check enable_languages in case someone does not run the toplevel
1080# configure # script.
1081AC_ARG_ENABLE(languages,
b88ecf55 1082[AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])],
e4c9c075
PB
1083[case ,${enable_languages}, in
1084 ,,|,yes,)
1085 # go safe -- we cannot be much sure without the toplevel
1086 # configure's
1087 # analysis of which target libs are present and usable
1088 enable_languages=c
1089 ;;
1090 *,all,*)
1091 AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
1092 ;;
1093 *,c,*)
1094 ;;
1095 *)
1096 enable_languages=c,${enable_languages}
1097 ;;
1098esac],
1099[enable_languages=c])
1100
8951374d
MR
1101# If top-level libada has been disabled, then wire in install-gnatlib
1102# invocation with `make install', so that one can build and install
1103# the library manually with `make -C gcc all gnatlib gnattools install'.
1104if test x"$enable_libada" = xno; then
1105 gnat_install_lib=gnat-install-lib
1106else
1107 gnat_install_lib=
1108fi
1109AC_SUBST(gnat_install_lib)
1110
85c64bbe
BS
1111if test x"$enable_as_accelerator_for" != x; then
1112 AC_DEFINE(ACCEL_COMPILER, 1,
1113 [Define if this compiler should be built as the offload target compiler.])
1114 enable_as_accelerator=yes
1115 case "${target}" in
1116 *-intelmicemul-*)
1117 # In this case we expect offload compiler to be built as native, so we
1118 # need to rename the driver to avoid clashes with host's drivers.
1119 program_transform_name="s&^&${target}-&" ;;
1120 esac
1121 sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
1122 program_transform_name=`echo $program_transform_name | sed $sedscript`
1123 accel_dir_suffix=/accel/${target_noncanonical}
1124 real_target_noncanonical=${enable_as_accelerator_for}
1125fi
1126AC_SUBST(enable_as_accelerator)
1127AC_SUBST(real_target_noncanonical)
1128AC_SUBST(accel_dir_suffix)
1129
1130for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
1131 tgt=`echo $tgt | sed 's/=.*//'`
b2b40051 1132
c56684fd
MJ
1133 enable_offloading=1
1134 case "$tgt" in
1135 *-intelmic-* | *-intelmicemul-*)
1136 omp_device_property=omp-device-properties-i386
1137 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device"
1138 ;;
1139 amdgcn*)
1140 omp_device_property=omp-device-properties-gcn
1141 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device"
1142 ;;
1143 nvptx*)
1144 omp_device_property=omp-device-properties-nvptx
1145 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device"
1146 ;;
1147 *)
1148 AC_MSG_ERROR([unknown offload target specified])
1149 ;;
1150 esac
1151 omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}"
1152 omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}"
b2b40051 1153
85c64bbe
BS
1154 if test x"$offload_targets" = x; then
1155 offload_targets=$tgt
1156 else
64186aad 1157 offload_targets="$offload_targets,$tgt"
85c64bbe
BS
1158 fi
1159done
9ba66bf5
JJ
1160AC_SUBST(omp_device_properties)
1161AC_SUBST(omp_device_property_deps)
1162
85c64bbe 1163AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
64186aad 1164 [Define to offload targets, separated by commas.])
b2b40051 1165if test x"$enable_offloading" != x; then
85c64bbe
BS
1166 AC_DEFINE(ENABLE_OFFLOADING, 1,
1167 [Define this to enable support for offloading.])
1d899da2
TS
1168else
1169 AC_DEFINE(ENABLE_OFFLOADING, 0,
1170 [Define this to enable support for offloading.])
85c64bbe
BS
1171fi
1172
fe5bfa67
TB
1173if test "x$enable_offload_defaulted" = xyes; then
1174 AC_DEFINE(OFFLOAD_DEFAULTED, 1,
1175 [Define to 1 to if -foffload is defaulted])
1176fi
1177
aca600aa 1178AC_ARG_WITH(multilib-list,
17a819cb 1179[AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
aca600aa
AS
1180:,
1181with_multilib_list=default)
1182
c1e66912
KC
1183AC_ARG_WITH(multilib-generator,
1184[AS_HELP_STRING([--with-multilib-generator], [Multi-libs configuration string (RISC-V only)])],
1185:,
1186with_multilib_generator=default)
1187
73458fb7
NN
1188# -------------------------
1189# Checks for other programs
1190# -------------------------
61842080 1191
e9a25f70
JL
1192AC_PROG_MAKE_SET
1193
46f18e7b
RK
1194# Find some useful tools
1195AC_PROG_AWK
776dc15d 1196# We need awk to create options.c and options.h.
2c4902b9
NN
1197# Bail out if it's missing.
1198case ${AWK} in
1199 "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
1200esac
1201
99e757d5 1202gcc_AC_PROG_LN_S
ad6717df 1203ACX_PROG_LN($LN_S)
46f18e7b 1204AC_PROG_RANLIB
10eb188c 1205ranlib_flags=""
343a6100
MM
1206AC_SUBST(ranlib_flags)
1207
99e757d5 1208gcc_AC_PROG_INSTALL
46f18e7b 1209
3a000df0
KC
1210# See if cmp has --ignore-initial.
1211gcc_AC_PROG_CMP_IGNORE_INITIAL
1212
955be633
JM
1213# See if we have the mktemp command.
1214AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
1215
7c27e184
PB
1216# See if makeinfo has been installed and is modern enough
1217# that we can use it.
3bbd5a19 1218ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
09fa0705 1219 [GNU texinfo.* \([0-9][0-9.]*\)],
7326a39e 1220 [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
09fa0705
ZW
1221if test $gcc_cv_prog_makeinfo_modern = no; then
1222 AC_MSG_WARN([
1223*** Makeinfo is missing or too old.
17db6582 1224*** Info documentation will not be built.])
09fa0705 1225 BUILD_INFO=
09fa0705 1226else
7c27e184 1227 BUILD_INFO=info
09fa0705 1228fi
7c27e184 1229AC_SUBST(BUILD_INFO)
09fa0705 1230
3f896fc2
JM
1231# Is pod2man recent enough to regenerate manpages?
1232AC_MSG_CHECKING([for recent Pod::Man])
7be33370 1233if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
fd939e46 1234 AC_MSG_RESULT(yes)
7c27e184 1235 GENERATED_MANPAGES=generated-manpages
fd939e46
JM
1236else
1237 AC_MSG_RESULT(no)
1238 GENERATED_MANPAGES=
1239fi
7c27e184 1240AC_SUBST(GENERATED_MANPAGES)
fd939e46 1241
3bbd5a19
PB
1242MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
1243
1e608388
ZW
1244# How about lex?
1245dnl Don't use AC_PROG_LEX; we insist on flex.
1246dnl LEXLIB is not useful in gcc.
7c27e184 1247AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
1e608388
ZW
1248
1249# Bison?
7c27e184
PB
1250AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
1251
1252# Binutils are not build modules, unlike bison/flex/makeinfo. So we
1253# check for build == host before using them.
1e608388 1254
f6a874ac 1255# NM
414adbdd
GK
1256if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
1257 && test -d ../binutils ; then
bfa912a8 1258 NM='${objdir}/../binutils/nm-new'
f6a874ac
JW
1259else
1260 AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
1261fi
1262
1263# AR
414adbdd
GK
1264if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
1265 && test -d ../binutils ; then
bfa912a8 1266 AR='${objdir}/../binutils/ar'
f6a874ac
JW
1267else
1268 AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
1269fi
1270
35485da9
DM
1271# The jit documentation looks better if built with sphinx, but can be
1272# built with texinfo if sphinx is not available.
1273# Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
1274AC_CHECK_PROG(doc_build_sys, sphinx-build, sphinx, texinfo)
f6a874ac 1275
73458fb7
NN
1276# --------------------
1277# Checks for C headers
1278# --------------------
1279
ca9bc441
NN
1280# Need to reject headers which give warnings, so that the -Werror bootstrap
1281# works later. *sigh* This needs to come before all header checks.
1282AC_PROG_CPP_WERROR
1283
73458fb7
NN
1284AC_HEADER_STDC
1285AC_HEADER_TIME
4f4e53dd 1286ACX_HEADER_STRING
73458fb7 1287AC_HEADER_SYS_WAIT
c68a6e08 1288AC_HEADER_TIOCGWINSZ
dfb77e37 1289AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
37050045 1290 fcntl.h ftw.h unistd.h sys/file.h sys/time.h sys/mman.h \
9ec469f5 1291 sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \
4fbfcf44 1292 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
73458fb7
NN
1293
1294# Check for thread headers.
1295AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
1296AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1297
1298# These tests can't be done till we know if we have limits.h.
1299gcc_AC_C_CHAR_BIT
9791c75c 1300AC_C_BIGENDIAN
73458fb7 1301
5427046f
ILT
1302# ----------------------
1303# Checks for C++ headers
1304# ----------------------
1305
c658f0ce
ILT
1306dnl Autoconf will give an error in the configure script if there is no
1307dnl C++ preprocessor. Hack to prevent that.
1308m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl
1309AC_PROG_CXXCPP
1310m4_popdef([AC_MSG_ERROR])[]dnl
1311
5427046f
ILT
1312AC_CHECK_HEADERS(unordered_map)
1313AC_CHECK_HEADERS(tr1/unordered_map)
1314AC_CHECK_HEADERS(ext/hash_map)
1315
043378c3
TT
1316# --------
1317# Dependency checking.
1318# --------
1319
043378c3
TT
1320ZW_CREATE_DEPDIR
1321AC_CONFIG_COMMANDS([gccdepdir],[
1322 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
73b75827 1323 for lang in $subdirs c-family common analyzer rtl-ssa
043378c3
TT
1324 do
1325 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
1326 done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
1327
54c09437 1328ZW_PROG_COMPILER_DEPENDENCIES([CXX])
5427046f 1329
73458fb7
NN
1330# --------
1331# UNSORTED
1332# --------
1333
73458fb7 1334
4e70264f
ZW
1335# These libraries may be used by collect2.
1336# We may need a special search path to get them linked.
1337AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
1338[save_LIBS="$LIBS"
7f2749d4 1339for libs in '' -lld -lmld \
4e70264f
ZW
1340 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
1341 '-L/usr/lib/cmplrs/cc3.11 -lmld'
1342do
1343 LIBS="$libs"
1344 AC_TRY_LINK_FUNC(ldopen,
1345 [gcc_cv_collect2_libs="$libs"; break])
1346done
1347LIBS="$save_LIBS"
1348test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
1349case $gcc_cv_collect2_libs in
1350 "none required") ;;
1351 *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
1352esac
1353AC_SUBST(COLLECT2_LIBS)
1354
7f2749d4
RK
1355# When building Ada code on Alpha, we need exc_resume which is usually in
1356# -lexc. So test for it.
1357save_LIBS="$LIBS"
1358LIBS=
1359AC_SEARCH_LIBS(exc_resume, exc)
1360GNAT_LIBEXC="$LIBS"
1361LIBS="$save_LIBS"
1362AC_SUBST(GNAT_LIBEXC)
1363
e3b3fa45
RO
1364# To support -mcpu=native on Solaris/SPARC, we need libkstat.
1365save_LIBS="$LIBS"
1366LIBS=
1367AC_SEARCH_LIBS(kstat_open, kstat)
1368EXTRA_GCC_LIBS="$LIBS"
1369LIBS="$save_LIBS"
1370AC_SUBST(EXTRA_GCC_LIBS)
1371
a20893cf
RO
1372# Solaris needs libsocket and libnsl for socket functions before 11.4.
1373# C++ needs those for libcody.
1374save_LIBS="$LIBS"
1375LIBS=
1376AX_LIB_SOCKET_NSL
1377NETLIBS="$LIBS"
1378LIBS="$save_LIBS"
1379AC_SUBST(NETLIBS)
1380
62c9aa5f
ZW
1381# Some systems put ldexp and frexp in libm instead of libc; assume
1382# they're both in the same place. jcf-dump needs them.
1383save_LIBS="$LIBS"
1384LIBS=
1385AC_SEARCH_LIBS(ldexp, m)
1386LDEXP_LIB="$LIBS"
1387LIBS="$save_LIBS"
1388AC_SUBST(LDEXP_LIB)
1389
7431c1a1
AS
1390# Some systems need dlopen
1391save_LIBS="$LIBS"
1392LIBS=
1393AC_SEARCH_LIBS(dlopen, dl)
1394DL_LIB="$LIBS"
1395LIBS="$save_LIBS"
1396AC_SUBST(DL_LIB)
1397
7636d567 1398# Use <inttypes.h> only if it exists,
35987ae9
RB
1399# doesn't clash with <sys/types.h>, declares intmax_t and defines
1400# PRId64
7636d567
JW
1401AC_MSG_CHECKING(for inttypes.h)
1402AC_CACHE_VAL(gcc_cv_header_inttypes_h,
f04f1d2c 1403[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
35987ae9
RB
1404[[#define __STDC_FORMAT_MACROS
1405#include <sys/types.h>
f04f1d2c 1406#include <inttypes.h>]],
35987ae9
RB
1407 [[intmax_t i = -1;
1408#ifndef PRId64
1409choke me
1410#endif]])],
9da0e39b 1411 [gcc_cv_header_inttypes_h=yes],
f04f1d2c 1412 [gcc_cv_header_inttypes_h=no])])
7636d567 1413AC_MSG_RESULT($gcc_cv_header_inttypes_h)
9da0e39b 1414if test $gcc_cv_header_inttypes_h = yes; then
119d24d1
KG
1415 AC_DEFINE(HAVE_INTTYPES_H, 1,
1416 [Define if you have a working <inttypes.h> header file.])
9da0e39b 1417fi
cdcc6a01 1418
87741e51
ML
1419# Look for the ZSTD package.
1420ZSTD_INCLUDE=
1421ZSTD_LIB=
1422AC_SUBST(ZSTD_INCLUDE)
1423AC_SUBST(ZSTD_LIB)
1424ZSTD_CPPFLAGS=
1425ZSTD_LDFLAGS=
77625675
MK
1426AC_SUBST(ZSTD_CPPFLAGS)
1427AC_SUBST(ZSTD_LDFLAGS)
87741e51
ML
1428AC_ARG_WITH(zstd,
1429 [AS_HELP_STRING([--with-zstd=PATH],
1430 [specify prefix directory for installed zstd library.
1431 Equivalent to --with-zstd-include=PATH/include
1432 plus --with-zstd-lib=PATH/lib])])
1433AC_ARG_WITH(zstd-include,
1434 [AS_HELP_STRING([--with-zstd-include=PATH],
1435 [specify directory for installed zstd include files])])
1436AC_ARG_WITH(zstd-lib,
1437 [AS_HELP_STRING([--with-zstd-lib=PATH],
1438 [specify directory for the installed zstd library])])
1439case "x$with_zstd" in
1440 x) ;;
1441 xno)
0fb0240a
ML
1442 ZSTD_INCLUDE=
1443 ZSTD_LIB=
87741e51
ML
1444 ;;
1445 *) ZSTD_INCLUDE=$with_zstd/include
1446 ZSTD_LIB=$with_zstd/lib
1447 ;;
1448esac
0fb0240a
ML
1449
1450if test "x$with_zstd" != xno; then
87741e51
ML
1451if test "x$with_zstd_include" != x; then
1452 ZSTD_INCLUDE=$with_zstd_include
1453fi
1454if test "x$with_zstd_lib" != x; then
1455 ZSTD_LIB=$with_zstd_lib
1456fi
1457if test "x$ZSTD_INCLUDE" != x \
1458 && test "x$ZSTD_INCLUDE" != xno; then
1459 ZSTD_CPPFLAGS=-I$ZSTD_INCLUDE
1460fi
1461if test "x$ZSTD_LIB" != x \
1462 && test "x$ZSTD_LIB" != xno; then
1463 ZSTD_LDFLAGS=-L$ZSTD_LIB
1464fi
1465
1466CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
1467LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
1468
1469AC_MSG_CHECKING(for zstd.h)
1470AC_CACHE_VAL(gcc_cv_header_zstd_h,
6649df18
JW
1471# We require version 1.3.0 or later. This is the first version that has
1472# ZSTD_getFrameContentSize.
87741e51 1473[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6649df18
JW
1474[[#include <zstd.h>
1475#if ZSTD_VERSION_NUMBER < 10300
1476#error "need zstd 1.3.0 or better"
1477#endif]])],
87741e51
ML
1478 [gcc_cv_header_zstd_h=yes],
1479 [gcc_cv_header_zstd_h=no])])
1480AC_MSG_RESULT($gcc_cv_header_zstd_h)
1481if test $gcc_cv_header_zstd_h = yes; then
1482 AC_DEFINE(HAVE_ZSTD_H, 1,
1483 [Define if you have a working <zstd.h> header file.])
68c4570a 1484elif test "x$with_zstd" != x; then
0fb0240a 1485 as_fn_error $? "Unable to find zstd.h. See config.log for details." "$LINENO" 5
87741e51
ML
1486fi
1487
1488# LTO can use zstd compression algorithm
1489save_LIBS="$LIBS"
1490LIBS=
1491AC_SEARCH_LIBS(ZSTD_compress, zstd)
1492ZSTD_LIB="$LIBS"
1493LIBS="$save_LIBS"
1494AC_SUBST(ZSTD_LIB)
0fb0240a 1495fi
87741e51 1496
9612ab65
ZW
1497dnl Disabled until we have a complete test for buggy enum bitfields.
1498dnl gcc_AC_C_ENUM_BF_UNSIGNED
c149cc37 1499
0d667716
KG
1500define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1501 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1502 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1503 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1504 putchar_unlocked putc_unlocked)
384d8786 1505AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
b6d94045 1506 popen sysconf strsignal getrusage nl_langinfo \
e1f07131
NS
1507 gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
1508 gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat)
a81fb89e 1509
39f6c4c8
KW
1510if test x$ac_cv_func_mbstowcs = xyes; then
1511 AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
f04f1d2c 1512[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
39f6c4c8
KW
1513int main()
1514{
1515 mbstowcs(0, "", 0);
1516 return 0;
f04f1d2c
KC
1517}]])],
1518 [gcc_cv_func_mbstowcs_works=yes],
1519 [gcc_cv_func_mbstowcs_works=no],
1520 [gcc_cv_func_mbstowcs_works=yes])])
39f6c4c8
KW
1521 if test x$gcc_cv_func_mbstowcs_works = xyes; then
1522 AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1523 [Define this macro if mbstowcs does not crash when its
1524 first argument is NULL.])
1525 fi
1526fi
1527
78c9cb99 1528AC_CHECK_TYPE(ssize_t, int)
bba09b5a 1529AC_CHECK_TYPE(caddr_t, char *)
e1f07131
NS
1530AC_CHECK_TYPE(sighander_t,
1531 AC_DEFINE(HAVE_SIGHANDLER_T, 1,
1532 [Define if <sys/signal.h> defines sighandler_t]),
1533 ,signal.h)
56f48ce9 1534
2f6935f4 1535GCC_AC_FUNC_MMAP_BLACKLIST
b27d2bd5
MK
1536
1537case "${host}" in
ee262b6f 1538*-*-*vms*)
2c55543b 1539 # Under VMS, vfork works very differently than on Unix. The standard test
ee262b6f
DR
1540 # won't work, and it isn't easily adaptable. It makes more sense to
1541 # just force it.
1542 ac_cv_func_vfork_works=yes
1543 ;;
b27d2bd5 1544esac
f04f1d2c 1545AC_FUNC_FORK
f1b54f9b 1546
0823efed 1547AM_ICONV
5b6d595b 1548
56694dd9
ZW
1549# Until we have in-tree GNU iconv:
1550LIBICONV_DEP=
bf5372e7
YS
1551if test -f "$LTLIBICONV"; then
1552 LIBICONV_DEP=$LTLIBICONV
1553fi
56694dd9
ZW
1554AC_SUBST(LIBICONV_DEP)
1555
1556AM_LC_MESSAGES
f91abfce 1557
a03ea89b
BM
1558AM_LANGINFO_CODESET
1559
86cf1cbd
KG
1560# We will need to find libiberty.h and ansidecl.h
1561saved_CFLAGS="$CFLAGS"
b8f6a302 1562CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
87fb500b 1563saved_CXXFLAGS="$CXXFLAGS"
b8f6a302 1564CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
13ccfea8
JM
1565
1566# gcc_AC_CHECK_DECLS doesn't support overloaded functions, so use the
1567# normal autoconf function for these. But force definition of
1568# HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre
1569# basename handling in libiberty.h.
1570AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[
1571#undef HAVE_DECL_BASENAME
1572#define HAVE_DECL_BASENAME 1
1573#include "ansidecl.h"
1574#include "system.h"])
1575
384d8786 1576gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \
13ccfea8 1577 madvise stpcpy strnlen strsignal strverscmp \
297c364d 1578 strtol strtoul strtoll strtoull setenv unsetenv \
ed5b9f96 1579 errno snprintf vsnprintf vasprintf malloc realloc calloc \
13ccfea8 1580 free getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
d02af173 1581#include "ansidecl.h"
86cf1cbd 1582#include "system.h"])
c5c76735 1583
f31e826b 1584gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
d02af173 1585#include "ansidecl.h"
86cf1cbd 1586#include "system.h"
d2cabf16
KG
1587#ifdef HAVE_SYS_RESOURCE_H
1588#include <sys/resource.h>
1589#endif
1590])
1591
5187b01a 1592gcc_AC_CHECK_DECLS(mallinfo mallinfo2, , ,[
c9ef0409
JH
1593#include "ansidecl.h"
1594#include "system.h"
1595#ifdef HAVE_MALLOC_H
1596#include <malloc.h>
1597#endif
1598])
1599
f04f1d2c 1600AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
b2522d2b
HPN
1601#include "ansidecl.h"
1602#include "system.h"
1603#ifdef HAVE_SYS_RESOURCE_H
1604#include <sys/resource.h>
1605#endif
f04f1d2c 1606]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
236ec2d7 1607[Define to `long' if <sys/resource.h> doesn't define.])])
b2522d2b 1608
2102b2fe
RS
1609# On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
1610# FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname
1611# in collect2.c, <fcntl.h> isn't visible, but the configure test below needs
1612# to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
351df804
KG
1613gcc_AC_CHECK_DECLS(ldgetname, , ,[
1614#include "ansidecl.h"
1615#include "system.h"
1616#ifdef HAVE_LDFCN_H
2102b2fe
RS
1617#undef FREAD
1618#undef FWRITE
351df804
KG
1619#include <ldfcn.h>
1620#endif
1621])
1622
c1800ec8
ZW
1623gcc_AC_CHECK_DECLS(times, , ,[
1624#include "ansidecl.h"
1625#include "system.h"
1626#ifdef HAVE_SYS_TIMES_H
1627#include <sys/times.h>
1628#endif
1629])
1630
4f6d8cc8
GK
1631gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1632#include "ansidecl.h"
1633#include "system.h"
1634#include <signal.h>
1635])
1636
c1800ec8
ZW
1637# More time-related stuff.
1638AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
f04f1d2c 1639AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c1800ec8
ZW
1640#include "ansidecl.h"
1641#include "system.h"
1642#ifdef HAVE_SYS_TIMES_H
1643#include <sys/times.h>
1644#endif
f04f1d2c 1645]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
c1800ec8
ZW
1646if test $ac_cv_struct_tms = yes; then
1647 AC_DEFINE(HAVE_STRUCT_TMS, 1,
1648 [Define if <sys/times.h> defines struct tms.])
1649fi
1650
1651# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1652# revisit after autoconf 2.50.
1653AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
f04f1d2c 1654AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c1800ec8
ZW
1655#include "ansidecl.h"
1656#include "system.h"
f04f1d2c 1657]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
c1800ec8
ZW
1658if test $gcc_cv_type_clock_t = yes; then
1659 AC_DEFINE(HAVE_CLOCK_T, 1,
1660 [Define if <time.h> defines clock_t.])
1661fi
1662
c1736aea
TJ
1663# Check if F_SETLKW is supported by fcntl.
1664AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [
1665AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1666#include <fcntl.h>]], [[
1667struct flock fl;
1668fl.l_whence = 0;
1669fl.l_start = 0;
1670fl.l_len = 0;
1671fl.l_pid = 0;
1672return fcntl (1, F_SETLKW, &fl);]])],
1673[ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])])
1674if test $ac_cv_f_setlkw = yes; then
1675 AC_DEFINE(HOST_HAS_F_SETLKW, 1,
1676 [Define if F_SETLKW supported by fcntl.])
1677fi
1678
e1f07131
NS
1679# Check if O_CLOEXEC is defined by fcntl
1680AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
1681AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1682#include <fcntl.h>]], [[
1683return open ("/dev/null", O_RDONLY | O_CLOEXEC);]])],
1684[ac_cv_o_cloexec=yes],[ac_cv_o_cloexec=no])])
1685if test $ac_cv_o_cloexec = yes; then
1686 AC_DEFINE(HOST_HAS_O_CLOEXEC, 1,
1687 [Define if O_CLOEXEC supported by fcntl.])
1688fi
1689
1690# C++ Modules would like some networking features to provide the mapping
1691# server. You can still use modules without them though.
1692# The following network-related checks could probably do with some
1693# Windows and other non-linux defenses and checking.
1694
1695# Local socket connectivity wants AF_UNIX networking
1696# Check for AF_UNIX networking
1697AC_CACHE_CHECK(for AF_UNIX, ac_cv_af_unix, [
1698AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1699#include <sys/types.h>
1700#include <sys/socket.h>
1701#include <sys/un.h>
1702#include <netinet/in.h>]],[[
1703sockaddr_un un;
1704un.sun_family = AF_UNSPEC;
1705int fd = socket (AF_UNIX, SOCK_STREAM, 0);
1706connect (fd, (sockaddr *)&un, sizeof (un));]])],
1707[ac_cv_af_unix=yes],
1708[ac_cv_af_unix=no])])
1709if test $ac_cv_af_unix = yes; then
1710 AC_DEFINE(HAVE_AF_UNIX, 1,
1711 [Define if AF_UNIX supported.])
1712fi
1713
1714# Remote socket connectivity wants AF_INET6 networking
1715# Check for AF_INET6 networking
1716AC_CACHE_CHECK(for AF_INET6, ac_cv_af_inet6, [
1717AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1718#include <sys/types.h>
1719#include <sys/socket.h>
1720#include <netinet/in.h>
1721#include <netdb.h>]],[[
1722sockaddr_in6 in6;
1723in6.sin6_family = AF_UNSPEC;
1724struct addrinfo *addrs = 0;
1725struct addrinfo hints;
1726hints.ai_flags = 0;
1727hints.ai_family = AF_INET6;
1728hints.ai_socktype = SOCK_STREAM;
1729hints.ai_protocol = 0;
1730hints.ai_canonname = 0;
1731hints.ai_addr = 0;
1732hints.ai_next = 0;
1733int e = getaddrinfo ("localhost", 0, &hints, &addrs);
1734const char *str = gai_strerror (e);
1735freeaddrinfo (addrs);
1736int fd = socket (AF_INET6, SOCK_STREAM, 0);
1737connect (fd, (sockaddr *)&in6, sizeof (in6));]])],
1738[ac_cv_af_inet6=yes],
1739[ac_cv_af_inet6=no])])
1740if test $ac_cv_af_inet6 = yes; then
1741 AC_DEFINE(HAVE_AF_INET6, 1,
1742 [Define if AF_INET6 supported.])
1743fi
1744
9ec469f5
EB
1745# Check if _LK_LOCK is supported by _locking
1746AC_CACHE_CHECK(for _LK_LOCK, ac_cv_lk_lock, [
1747AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1748#include <io.h>
1749#include <sys/locking.h>]], [[
1750 int fd;
1751 return _locking (fd, _LK_LOCK, 0);]])],
1752[ac_cv_lk_lock=yes],[ac_cv_lk_lock=no])])
1753if test $ac_cv_lk_lock = yes; then
1754 AC_DEFINE(HOST_HAS_LK_LOCK, 1,
1755 [Define if _LK_LOC supported by _locking.])
1756fi
1757
87fb500b 1758# Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
86cf1cbd 1759CFLAGS="$saved_CFLAGS"
87fb500b 1760CXXFLAGS="$saved_CXXFLAGS"
86cf1cbd 1761
75923b2f 1762# mkdir takes a single argument on some systems.
99e757d5 1763gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
75923b2f 1764
46f18e7b
RK
1765# File extensions
1766manext='.1'
1767objext='.o'
46f18e7b
RK
1768AC_SUBST(manext)
1769AC_SUBST(objext)
46f18e7b 1770
4977bab6
ZW
1771# With Setjmp/Longjmp based exception handling.
1772AC_ARG_ENABLE(sjlj-exceptions,
b88ecf55
AS
1773[AS_HELP_STRING([--enable-sjlj-exceptions],
1774 [arrange to use setjmp/longjmp exception handling])],
399fe3e1
JDA
1775[case $target in
1776 *-*-hpux10*)
1777 if test $enableval != yes; then
1778 AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced])
1779 enableval=yes
1780 fi
1781 ;;
1782esac
1783force_sjlj_exceptions=yes],
1784[case $target in
1785 *-*-hpux10*)
1786 force_sjlj_exceptions=yes
1787 enableval=yes
1788 ;;
9b0af790
JB
1789 lm32*-*-*)
1790 force_sjlj_exceptions=yes
1791 enableval=yes
1792 ;;
399fe3e1
JDA
1793 *)
1794 force_sjlj_exceptions=no
1795 ;;
1796esac])
1797if test $force_sjlj_exceptions = yes; then
1798 sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1799 AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1800 [Define 0/1 to force the choice for exception handling model.])
1801fi
4977bab6 1802
34a86c2b
NN
1803# --------------------------------------------------------
1804# Build, host, and target specific configuration fragments
1805# --------------------------------------------------------
1806
5b28c537 1807# Collect build-machine-specific information.
2c811fd3 1808. ${srcdir}/config.build || exit 1
5b28c537 1809
a89ea0df 1810# Collect host-machine-specific information.
2c811fd3 1811. ${srcdir}/config.host || exit 1
a89ea0df 1812
ef69da62 1813target_gtfiles=
a89ea0df
NN
1814
1815# Collect target-machine-specific information.
2c811fd3 1816. ${srcdir}/config.gcc || exit 1
46f18e7b
RK
1817
1818extra_objs="${host_extra_objs} ${extra_objs}"
30500d84 1819extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
46f18e7b
RK
1820
1821# Default the target-machine variables that were not explicitly set.
75bffa71 1822if test x"$tm_file" = x
46f18e7b
RK
1823then tm_file=$cpu_type/$cpu_type.h; fi
1824
6b2adea9 1825if test x"$extra_headers" = x
46f18e7b
RK
1826then extra_headers=; fi
1827
75bffa71 1828if test x$md_file = x
e98e406f 1829then md_file=$cpu_type/$cpu_type.md; fi
46f18e7b 1830
75bffa71 1831if test x$out_file = x
46f18e7b
RK
1832then out_file=$cpu_type/$cpu_type.c; fi
1833
75bffa71 1834if test x"$tmake_file" = x
46f18e7b
RK
1835then tmake_file=$cpu_type/t-$cpu_type
1836fi
1837
e9c9f128
JJ
1838# Support --enable-initfini-array.
1839if test x$enable_initfini_array != xno; then
1840 tm_file="${tm_file} initfini-array.h"
1841fi
1842
90e6a802 1843if test x"$dwarf2" = xyes
756ee602 1844then tm_file="$tm_file tm-dwarf2.h"
90e6a802
RL
1845fi
1846
46f18e7b 1847# Say what files are being used for the output code and MD file.
11642c3a 1848echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
46f18e7b
RK
1849echo "Using \`$srcdir/config/$md_file' as machine description file."
1850
11642c3a 1851# If any of the xm_file variables contain nonexistent files, warn
4dc0535b
ZW
1852# about them and drop them.
1853
11642c3a
ZW
1854bx=
1855for x in $build_xm_file; do
1856 if test -f $srcdir/config/$x
1857 then bx="$bx $x"
11642c3a
ZW
1858 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1859 fi
1860done
1861build_xm_file="$bx"
1862
1863hx=
1864for x in $host_xm_file; do
1865 if test -f $srcdir/config/$x
1866 then hx="$hx $x"
11642c3a
ZW
1867 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1868 fi
1869done
1870host_xm_file="$hx"
1871
1872tx=
1873for x in $xm_file; do
1874 if test -f $srcdir/config/$x
1875 then tx="$tx $x"
11642c3a
ZW
1876 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1877 fi
1878done
1879xm_file="$tx"
1880
46f18e7b
RK
1881count=a
1882for f in $tm_file; do
1883 count=${count}x
1884done
75bffa71 1885if test $count = ax; then
46f18e7b
RK
1886 echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1887else
1888 echo "Using the following target machine macro files:"
1889 for f in $tm_file; do
1890 echo " $srcdir/config/$f"
1891 done
1892fi
1893
99fa8911
AP
1894if test x$use_long_long_for_widest_fast_int = xyes; then
1895 AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
edf6ddf6 1896[Define to 1 if the 'long long' type is wider than 'long' but still
99fa8911
AP
1897efficiently supported by the host hardware.])
1898fi
1899
b993039f
EB
1900gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi`
1901AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.])
1902
1903gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
1904AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.])
1905
46f18e7b
RK
1906count=a
1907for f in $host_xm_file; do
1908 count=${count}x
1909done
11642c3a
ZW
1910if test $count = a; then
1911 :
1912elif test $count = ax; then
46f18e7b
RK
1913 echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1914else
1915 echo "Using the following host machine macro files:"
1916 for f in $host_xm_file; do
1917 echo " $srcdir/config/$f"
1918 done
1919fi
476d9098 1920echo "Using ${out_host_hook_obj} for host machine hooks."
46f18e7b 1921
75bffa71 1922if test "$host_xm_file" != "$build_xm_file"; then
46f18e7b
RK
1923 count=a
1924 for f in $build_xm_file; do
1925 count=${count}x
1926 done
11642c3a
ZW
1927 if test $count = a; then
1928 :
1929 elif test $count = ax; then
46f18e7b
RK
1930 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1931 else
1932 echo "Using the following build machine macro files:"
1933 for f in $build_xm_file; do
1934 echo " $srcdir/config/$f"
1935 done
1936 fi
1937fi
1938
08b2bad2
SB
1939if test -n "$configured_native_system_header_dir"; then
1940 native_system_header_dir=$configured_native_system_header_dir
1941fi
1942NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir"
1943AC_SUBST(NATIVE_SYSTEM_HEADER_DIR)
1944
4f6d8cc8 1945case ${host} in
b8ec3cc8 1946 powerpc*-*-darwin*)
4f6d8cc8
GK
1947 AC_CACHE_CHECK([whether mcontext_t fields have underscores],
1948 gcc_cv_mcontext_underscores,
22e05272 1949 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
ba7da42a 1950#include <sys/cdefs.h>
de4fb767 1951#include <sys/signal.h>
4f6d8cc8
GK
1952#include <ucontext.h>
1953int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
22e05272 1954])],
4f6d8cc8
GK
1955 gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
1956 if test $gcc_cv_mcontext_underscores = yes; then
1957 AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
1958 [mcontext_t fields start with __])
1959 fi
1960 ;;
1961esac
1962
8bb915b6
NN
1963# ---------
1964# Threading
1965# ---------
1966
c2e494a8 1967# Check if a valid thread package
615be2cf 1968case ${enable_threads} in
c2e494a8
NN
1969 "" | no)
1970 # No threads
1971 target_thread_file='single'
1972 ;;
1973 yes)
1974 # default
1975 target_thread_file='single'
1976 ;;
ddaad3c8 1977 aix | dce | lynx | mipssde | posix | rtems | \
da90c957 1978 single | tpf | vxworks | win32)
615be2cf 1979 target_thread_file=${enable_threads}
c2e494a8
NN
1980 ;;
1981 *)
615be2cf 1982 echo "${enable_threads} is an unknown thread package" 1>&2
c2e494a8
NN
1983 exit 1
1984 ;;
1985esac
1986
1987if test x${thread_file} = x; then
1988 # No thread file set by target-specific clauses in config.gcc,
1989 # so use file chosen by default logic above
1990 thread_file=${target_thread_file}
46f18e7b 1991fi
46f18e7b 1992
8bb915b6
NN
1993# --------
1994# UNSORTED
1995# --------
1996
18fbf599 1997use_cxa_atexit=no
2121a768
JT
1998if test x$enable___cxa_atexit = xyes || \
1999 test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
18fbf599 2000 if test x$host = x$target; then
97388150
DS
2001 case $host in
2002 # mingw32 doesn't have __cxa_atexit but uses atexit registration
2003 # keyed to flag_use_cxa_atexit
2004 *-*-mingw32*)
2005 use_cxa_atexit=yes
2006 ;;
99113dff
DE
2007 powerpc-ibm-aix*)
2008 use_cxa_atexit=yes
2009 ;;
97388150
DS
2010 *)
2011 AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
2012 [echo "__cxa_atexit can't be enabled on this target"])
5f60e48f 2013 ;;
97388150 2014 esac
18fbf599
PB
2015 else
2016 # We can't check for __cxa_atexit when building a cross, so assume
2017 # it is available
2018 use_cxa_atexit=yes
2019 fi
2020 if test x$use_cxa_atexit = xyes; then
c7b5e395 2021 AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
18fbf599
PB
2022 [Define if you want to use __cxa_atexit, rather than atexit, to
2023 register C++ destructors for local statics and global objects.
2024 This is essential for fully standards-compliant handling of
2025 destructors, but requires __cxa_atexit in libc.])
2026 fi
2121a768
JT
2027fi
2028
a5381466 2029# Look for a file containing extra machine modes.
1c0ca89d
ZW
2030if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
2031 extra_modes_file='$(srcdir)'/config/${extra_modes}
a5381466 2032 AC_SUBST(extra_modes_file)
e22340b0 2033 AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
a5381466
ZW
2034 [Define to the name of a file containing a list of extra machine modes
2035 for this architecture.])
a5381466
ZW
2036fi
2037
75685792
RS
2038# Convert extra_options into a form suitable for Makefile use.
2039extra_opt_files=
fd438373 2040all_opt_files=
75685792
RS
2041for f in $extra_options; do
2042 extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
fd438373 2043 all_opt_files="$all_opt_files $srcdir/config/$f"
75685792
RS
2044done
2045AC_SUBST(extra_opt_files)
2046
b7cb92ad 2047# auto-host.h is the file containing items generated by autoconf and is
e9a25f70 2048# the first file included by config.h.
4977bab6 2049# If host=build, it is correct to have bconfig include auto-host.h
db81d74a
RH
2050# as well. If host!=build, we are in error and need to do more
2051# work to find out the build config parameters.
75bffa71 2052if test x$host = x$build
db81d74a 2053then
eaf4e618 2054 build_auto=auto-host.h
499d66aa 2055 HAVE_AUTO_BUILD='# '
b7cb92ad
JL
2056else
2057 # We create a subdir, then run autoconf in the subdir.
2058 # To prevent recursion we set host and build for the new
2059 # invocation of configure to the build for this invocation
2060 # of configure.
2061 tempdir=build.$$
2062 rm -rf $tempdir
2063 mkdir $tempdir
2064 cd $tempdir
2065 case ${srcdir} in
b86ecfa9 2066 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
b7cb92ad
JL
2067 *) realsrcdir=../${srcdir};;
2068 esac
2ceb362d
AM
2069 # Clearing GMPINC is necessary to prevent host headers being
2070 # used by the build compiler. Defining GENERATOR_FILE stops
2071 # system.h from including gmp.h.
d920e825 2072 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
2ceb362d
AM
2073 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
2074 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
2075 GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
d920e825 2076 ${realsrcdir}/configure \
33e70558 2077 --enable-languages=${enable_languages-all} \
499d66aa
AO
2078 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
2079 ${enable_option_checking+--enable-option-checking="$enable_option_checking"} \
2080 --target=$target_alias --host=$build_alias \
2081 --build=$build_alias || exit # retaining $tempdir
b7cb92ad
JL
2082
2083 # We just finished tests for the build machine, so rename
2084 # the file auto-build.h in the gcc directory.
2085 mv auto-host.h ../auto-build.h
2086 cd ..
2087 rm -rf $tempdir
eaf4e618 2088 build_auto=auto-build.h
499d66aa 2089 HAVE_AUTO_BUILD=
db81d74a 2090fi
71b5d516 2091AC_SUBST(build_subdir)
499d66aa 2092AC_SUBST(HAVE_AUTO_BUILD)
db81d74a 2093
eaf4e618 2094tm_file="${tm_file} defaults.h"
4977bab6 2095tm_p_file="${tm_p_file} tm-preds.h"
b4c522fa 2096tm_d_file="${tm_d_file} defaults.h"
4977bab6
ZW
2097host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
2098build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
49691411 2099# We don't want ansidecl.h in target files, write code there in ISO/GNU C.
b4862477 2100# put this back in temporarily.
232b67d9 2101xm_file="auto-host.h ansidecl.h ${xm_file}"
0056a9b5 2102
34a86c2b
NN
2103# --------
2104# UNSORTED
2105# --------
2106
afabd8e6 2107changequote(,)dnl
cc1e60ea 2108# Compile in configure arguments.
8105825d 2109if test -f configargs.h ; then
cc1e60ea 2110 # Being re-configured.
022dae81 2111 gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
54de7d7d
JJ
2112 gcc_reconf_arguments=`echo "$gcc_config_arguments" | sed -e 's/^.*\( : (reconfigured) .*$\)/\1/'`
2113 if [ "$gcc_reconf_arguments" != " : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" ]; then
2114 gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
2115 fi
cc1e60ea
JM
2116else
2117 gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
2118fi
eeae7b41
DJ
2119
2120# Double all backslashes and backslash all quotes to turn
2121# gcc_config_arguments into a C string.
2122sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
2123$gcc_config_arguments
2124EOF
2125gcc_config_arguments_str=`cat conftest.out`
2126rm -f conftest.out
2127
cc1e60ea
JM
2128cat > configargs.h <<EOF
2129/* Generated automatically. */
eeae7b41 2130static const char configuration_arguments[] = "$gcc_config_arguments_str";
a6687d2b 2131static const char thread_model[] = "$thread_file";
7816bea0
DJ
2132
2133static const struct {
2134 const char *name, *value;
2135} configure_default_options[] = $configure_default_options;
cc1e60ea 2136EOF
75bffa71 2137changequote([,])dnl
46f18e7b 2138
0c463e16 2139changequote(,)dnl
40540e68
RAE
2140gcc_BASEVER=`cat $srcdir/BASE-VER`
2141gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
2142gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
0c463e16 2143if test -f $srcdir/REVISION ; then
40540e68 2144 gcc_REVISION=`cat $srcdir/REVISION`
0c463e16
RAE
2145else
2146 gcc_REVISION=""
2147fi
2148cat > plugin-version.h <<EOF
2149#include "configargs.h"
2150
bf588455
BS
2151#define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'`
2152#define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'`
2153#define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'`
2154#define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)
2155
0c463e16
RAE
2156static char basever[] = "$gcc_BASEVER";
2157static char datestamp[] = "$gcc_DATESTAMP";
2158static char devphase[] = "$gcc_DEVPHASE";
2159static char revision[] = "$gcc_REVISION";
2160
2161/* FIXME plugins: We should make the version information more precise.
2162 One way to do is to add a checksum. */
2163
2164static struct plugin_gcc_version gcc_version = {basever, datestamp,
2165 devphase, revision,
2166 configuration_arguments};
2167EOF
2168changequote([,])dnl
2169
3c36aa6b
JJ
2170# Determine what GCC version number to use in filesystem paths.
2171GCC_BASE_VER
2172
ab87f8c8 2173# Internationalization
56694dd9 2174ZW_GNU_GETTEXT_SISTER_DIR
dc6746e7 2175
56694dd9
ZW
2176# If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
2177# -liconv on the link line twice.
2178case "$LIBINTL" in *$LIBICONV*)
2179 LIBICONV= ;;
2180esac
ab87f8c8 2181
7f970b70 2182AC_ARG_ENABLE(secureplt,
b88ecf55
AS
2183[AS_HELP_STRING([--enable-secureplt],
2184 [enable -msecure-plt by default for PowerPC])],
7f970b70
AM
2185[], [])
2186
446163e2
TP
2187AC_ARG_ENABLE(mingw-wildcard,
2188[AS_HELP_STRING([--enable-mingw-wildcard],
2189 [Set whether to expand wildcard on command-line.
2190 Default to platform configuration])],
2191[],[enable_mingw_wildcard=platform])
2192AS_IF([test x"$enable_mingw_wildcard" != xplatform ],
2193 [AC_DEFINE_UNQUOTED(MINGW_DOWILDCARD,
2194 $(test x"$enable_mingw_wildcard" = xno; echo $?),
2195 [Value to set mingw's _dowildcard to.])])
2196
67aeaded
AO
2197AC_ARG_ENABLE(large-address-aware,
2198[AS_HELP_STRING([--enable-large-address-aware],
2199 [Link mingw executables with --large-address-aware])])
2200AS_IF([test x"$enable_large_address_aware" = xyes],
2201 [AC_DEFINE([MINGW_DEFAULT_LARGE_ADDR_AWARE], 1,
2202 [Define if we should link mingw executables with --large-address-aware])])
2203
ad211091
KT
2204AC_ARG_ENABLE(leading-mingw64-underscores,
2205 AS_HELP_STRING([--enable-leading-mingw64-underscores],
b88ecf55 2206 [enable leading underscores on 64 bit mingw targets]),
ad211091
KT
2207 [],[])
2208AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ],
2209 [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1,
2210 [Define if we should use leading underscore on 64 bit mingw targets])])
2211
922e3e33 2212AC_ARG_ENABLE(cld,
b88ecf55 2213[AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [],
922e3e33
UB
2214[enable_cld=no])
2215
d79389af 2216AC_ARG_ENABLE(frame-pointer,
b88ecf55 2217[AS_HELP_STRING([--enable-frame-pointer],
fd661a34 2218 [enable -fno-omit-frame-pointer by default for x86])], [],
d79389af
L
2219[
2220case $target_os in
6221eb9d 2221linux* | gnu* | darwin[[8912]]* | cygwin* | mingw*)
7d48b7ad 2222 # Enable -fomit-frame-pointer by default for these systems with DWARF2.
d79389af
L
2223 enable_frame_pointer=no
2224 ;;
2225*)
2226 enable_frame_pointer=yes
2227 ;;
2228esac
2229])
2230
fd661a34
UB
2231case $target in
2232i[[34567]]86-*-* | x86_64-*-*)
2233 if test "x$enable_cld" = xyes; then
2234 tm_defines="${tm_defines} USE_IX86_CLD=1"
2235 fi
2236 if test "x$enable_frame_pointer" = xyes; then
2237 tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1"
2238 fi
2239 ;;
2240esac
2241
f4ab28e3
MK
2242# Windows32 Registry support for specifying GCC installation paths.
2243AC_ARG_ENABLE(win32-registry,
b88ecf55
AS
2244[AS_HELP_STRING([--disable-win32-registry],
2245 [disable lookup of installation paths in the
2246 Registry on Windows hosts])
2247AS_HELP_STRING([--enable-win32-registry], [enable registry lookup (default)])
2248AS_HELP_STRING([--enable-win32-registry=KEY],
2249 [use KEY instead of GCC version as the last portion
2250 of the registry key])],,)
a1286ef5 2251
4e70264f 2252case $host_os in
abe64d9e 2253 win32 | pe | cygwin* | mingw32*)
a1286ef5
ZW
2254 if test "x$enable_win32_registry" != xno; then
2255 AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
2256 fi
f4ab28e3 2257
a1286ef5
ZW
2258 if test "x$enable_win32_registry" != xno; then
2259 AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
2260 [Define to 1 if installation paths should be looked up in the Windows
2261 Registry. Ignored on non-Windows hosts.])
2262
2263 if test "x$enable_win32_registry" != xyes \
2264 && test "x$enable_win32_registry" != x; then
2265 AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
2266 [Define to be the last component of the Windows registry key under which
2267 to look for installation paths. The full key used will be
2268 HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
2269 The default is the GCC version number.])
2270 fi
2271 fi
f4ab28e3
MK
2272 ;;
2273esac
2274
7fa10b25 2275# Get an absolute path to the GCC top-level source directory
1e6347d8 2276holddir=`${PWDCMD-pwd}`
7fa10b25 2277cd $srcdir
1e6347d8 2278topdir=`${PWDCMD-pwd}`
7fa10b25
RK
2279cd $holddir
2280
af5e4ada 2281# Conditionalize the makefile for this host machine.
2ed26f6b 2282xmake_file=
c406e779 2283for f in ${host_xmake_file}
94f42018 2284do
75bffa71 2285 if test -f ${srcdir}/config/$f
94f42018 2286 then
2ed26f6b 2287 xmake_file="${xmake_file} \$(srcdir)/config/$f"
94f42018
DE
2288 fi
2289done
46f18e7b 2290
af5e4ada 2291# Conditionalize the makefile for this target machine.
2ed26f6b 2292tmake_file_=
c406e779 2293for f in ${tmake_file}
94f42018 2294do
75bffa71 2295 if test -f ${srcdir}/config/$f
94f42018 2296 then
2ed26f6b 2297 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
94f42018
DE
2298 fi
2299done
d228ee80 2300tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
5891b37d 2301
af5e4ada 2302out_object_file=`basename $out_file .c`.o
c49a6962 2303common_out_object_file=`basename $common_out_file .c`.o
5891b37d 2304
75685792 2305tm_file_list="options.h"
f938f60c 2306tm_include_list="options.h insn-constants.h"
af5e4ada 2307for f in $tm_file; do
64ccbc99 2308 case $f in
3ca43df7
RS
2309 ./* )
2310 f=`echo $f | sed 's/^..//'`
2311 tm_file_list="${tm_file_list} $f"
2312 tm_include_list="${tm_include_list} $f"
2313 ;;
d02af173 2314 defaults.h )
e22340b0
ZW
2315 tm_file_list="${tm_file_list} \$(srcdir)/$f"
2316 tm_include_list="${tm_include_list} $f"
2317 ;;
2318 * )
2319 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
2320 tm_include_list="${tm_include_list} config/$f"
2321 ;;
64ccbc99 2322 esac
af5e4ada 2323done
46f18e7b 2324
11642c3a 2325tm_p_file_list=
e22340b0 2326tm_p_include_list=
11642c3a 2327for f in $tm_p_file; do
4977bab6
ZW
2328 case $f in
2329 tm-preds.h )
e22340b0
ZW
2330 tm_p_file_list="${tm_p_file_list} $f"
2331 tm_p_include_list="${tm_p_include_list} $f"
2332 ;;
2333 * )
2334 tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
2335 tm_p_include_list="${tm_p_include_list} config/$f"
2336 esac
2337done
2338
b4c522fa
IB
2339tm_d_file_list=
2340tm_d_include_list="options.h insn-constants.h"
2341for f in $tm_d_file; do
2342 case $f in
2343 defaults.h )
2344 tm_d_file_list="${tm_d_file_list} \$(srcdir)/$f"
2345 tm_d_include_list="${tm_d_include_list} $f"
2346 ;;
2347 * )
2348 tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f"
2349 tm_d_include_list="${tm_d_include_list} config/$f"
2350 ;;
2351 esac
2352done
2353
e22340b0
ZW
2354xm_file_list=
2355xm_include_list=
2356for f in $xm_file; do
2357 case $f in
2358 ansidecl.h )
2359 xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
2360 xm_include_list="${xm_include_list} $f"
2361 ;;
2362 auto-host.h )
2363 xm_file_list="${xm_file_list} $f"
2364 xm_include_list="${xm_include_list} $f"
2365 ;;
2366 * )
2367 xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
2368 xm_include_list="${xm_include_list} config/$f"
2369 ;;
4977bab6 2370 esac
11642c3a
ZW
2371done
2372
af5e4ada 2373host_xm_file_list=
e22340b0 2374host_xm_include_list=
af5e4ada 2375for f in $host_xm_file; do
64ccbc99 2376 case $f in
d02af173 2377 ansidecl.h )
e22340b0
ZW
2378 host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
2379 host_xm_include_list="${host_xm_include_list} $f"
2380 ;;
e2500fed 2381 auto-host.h )
e22340b0
ZW
2382 host_xm_file_list="${host_xm_file_list} $f"
2383 host_xm_include_list="${host_xm_include_list} $f"
2384 ;;
2385 * )
2386 host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
2387 host_xm_include_list="${host_xm_include_list} config/$f"
2388 ;;
64ccbc99 2389 esac
af5e4ada
DE
2390done
2391
2392build_xm_file_list=
2393for f in $build_xm_file; do
64ccbc99 2394 case $f in
d02af173 2395 ansidecl.h )
e22340b0
ZW
2396 build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
2397 build_xm_include_list="${build_xm_include_list} $f"
2398 ;;
e2500fed 2399 auto-build.h | auto-host.h )
e22340b0
ZW
2400 build_xm_file_list="${build_xm_file_list} $f"
2401 build_xm_include_list="${build_xm_include_list} $f"
2402 ;;
2403 * )
2404 build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
2405 build_xm_include_list="${build_xm_include_list} config/$f"
2406 ;;
64ccbc99 2407 esac
af5e4ada 2408done
46f18e7b 2409
2989d30c
GK
2410# Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
2411# cross-compiler which does not use the native headers and libraries.
a078a589
ZW
2412# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
2413CROSS= AC_SUBST(CROSS)
2414ALL=all.internal AC_SUBST(ALL)
2415SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
0c90d48b 2416BUILD_SYSTEM_HEADER_DIR=$SYSTEM_HEADER_DIR AC_SUBST(BUILD_SYSTEM_HEADER_DIR)
b28250ab 2417
0c90d48b
BE
2418if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x ||
2419 test x$build != x$host || test "x$with_build_sysroot" != x; then
2420 if test "x$with_build_sysroot" != x; then
2421 BUILD_SYSTEM_HEADER_DIR=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
2422 else
2423 BUILD_SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
2424 fi
b28250ab 2425
0c90d48b
BE
2426 if test x$host != x$target
2427 then
2428 CROSS="-DCROSS_DIRECTORY_STRUCTURE"
2429 ALL=all.cross
2430 SYSTEM_HEADER_DIR=$BUILD_SYSTEM_HEADER_DIR
2431 elif test "x$TARGET_SYSTEM_ROOT" != x; then
2432 SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
2433 fi
46f18e7b 2434
0c90d48b
BE
2435 if test "x$with_build_sysroot" != "x"; then
2436 target_header_dir="${with_build_sysroot}${native_system_header_dir}"
7d7d00ba
HPN
2437 elif test "x$with_sysroot" = x; then
2438 target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
7d7d00ba
HPN
2439 elif test "x$with_sysroot" = xyes; then
2440 target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
2441 else
2442 target_header_dir="${with_sysroot}${native_system_header_dir}"
2443 fi
2444else
2445 target_header_dir=${native_system_header_dir}
2446fi
2447
b39d221a
EC
2448# If this is a cross-compiler that does not
2449# have its own set of headers then define
2450# inhibit_libc
2451
dc06db20
R
2452# If this is using newlib, without having the headers available now,
2453# then define inhibit_libc in LIBGCC2_CFLAGS.
fecd6201
ZW
2454# This prevents libgcc2 from containing any code which requires libc
2455# support.
a929bc28 2456: ${inhibit_libc=false}
dc06db20
R
2457if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
2458 test x$with_newlib = xyes ; } &&
7d7d00ba 2459 { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
160633c6 2460 inhibit_libc=true
b39d221a
EC
2461fi
2462AC_SUBST(inhibit_libc)
2463
a078a589
ZW
2464# When building gcc with a cross-compiler, we need to adjust things so
2465# that the generator programs are still built with the native compiler.
52c0e446 2466# Also, we cannot run fixincludes.
a078a589
ZW
2467
2468# These are the normal (build=host) settings:
eaf9f3b2 2469CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
bdd5dc28 2470CXX_FOR_BUILD='$(CXX)' AC_SUBST(CXX_FOR_BUILD)
4977bab6 2471BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
bdd5dc28 2472BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
f8c33439 2473BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
a078a589 2474STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
587dc9c6 2475
5148d2e3
L
2476BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS)' AC_SUBST(BUILD_NO_PIE_CFLAGS)
2477BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' AC_SUBST(BUILD_NO_PIE_FLAG)
2478
83599948
NS
2479# And these apply if build != host, or we are generating coverage data
2480if test x$build != x$host || test "x$coverage_flags" != x
af5e4ada 2481then
5116b54e
TB
2482 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)'
2483 BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)'
f8c33439 2484 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
5148d2e3
L
2485
2486 NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}}
2487 NO_PIE_FLAG_FOR_BUILD=${NO_PIE_FLAG_FOR_BUILD-${NO_PIE_FLAG}}
2488 BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS_FOR_BUILD)'
2489 BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG_FOR_BUILD)'
af5e4ada 2490fi
5148d2e3
L
2491AC_SUBST(NO_PIE_CFLAGS_FOR_BUILD)
2492AC_SUBST(NO_PIE_FLAG_FOR_BUILD)
46f18e7b 2493
ae3a15bb
DE
2494# Expand extra_headers to include complete path.
2495# This substitutes for lots of t-* files.
2496extra_headers_list=
b1ef58c8
NN
2497# Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
2498for file in ${extra_headers} ; do
2499 extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
2500done
ae3a15bb 2501
1617e5ee
GK
2502# If use_gcc_tgmath is set, append ginclude/tgmath.h.
2503if test x"$use_gcc_tgmath" = xyes
2504then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
2505fi
2506
c38f02df
ILT
2507# Define collect2 in Makefile.
2508case $host_can_use_collect2 in
2509 no) collect2= ;;
2510 *) collect2='collect2$(exeext)' ;;
2511esac
2512AC_SUBST([collect2])
2513
af5e4ada 2514# Add a definition of USE_COLLECT2 if system wants one.
34a86c2b
NN
2515case $use_collect2 in
2516 no) use_collect2= ;;
2517 "") ;;
2518 *)
2519 host_xm_defines="${host_xm_defines} USE_COLLECT2"
2520 xm_defines="${xm_defines} USE_COLLECT2"
c38f02df
ILT
2521 case $host_can_use_collect2 in
2522 no)
2523 AC_MSG_ERROR([collect2 is required but cannot be built on this system])
2524 ;;
2525 esac
34a86c2b
NN
2526 ;;
2527esac
af5e4ada 2528
1cd0b716
DK
2529AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}",
2530[Define to the name of the LTO plugin DSO that must be
2531 passed to the linker's -plugin=LIB option.])
2532
630327c3
NN
2533# ---------------------------
2534# Assembler & linker features
2535# ---------------------------
2536
da0f6381
PB
2537# During stage 2, ld is actually gcc/collect-ld, which is a small script to
2538# discern between when to use prev-ld/ld-new and when to use ld/ld-new.
2539# However when ld-new is first executed from the build tree, libtool will
2540# relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers
2541# to the build tree. While doing this we need to use the previous-stage
2542# linker, or we have an infinite loop. The presence of a shell script as
2543# ld/ld-new, and the fact that the script *uses ld itself*, is what confuses
2544# the gcc/collect-ld script. So we need to know how libtool works, or
2545# exec-tool will fail.
2546
2547m4_defun([_LT_CONFIG_COMMANDS], [])
2548AC_PROG_LIBTOOL
2549AC_SUBST(objdir)
2550AC_SUBST(enable_fast_install)
2551
d869a8c4
NN
2552# Identify the assembler which will work hand-in-glove with the newly
2553# built GCC, so that we can examine its features. This is the assembler
2554# which will be driven by the driver program.
2555#
2556# If build != host, and we aren't building gas in-tree, we identify a
2557# build->target assembler and hope that it will have the same features
2558# as the host->target assembler we'll be using.
a2f319ea 2559gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
e8b05380
PB
2560
2561m4_pattern_allow([AS_FOR_TARGET])dnl
2562AS_VAR_SET_IF(gcc_cv_as,, [
3ccc3a56
AO
2563if test -x "$DEFAULT_ASSEMBLER"; then
2564 gcc_cv_as="$DEFAULT_ASSEMBLER"
6b1786aa 2565elif test -f $gcc_cv_as_gas_srcdir/configure.ac \
08d105fa
AO
2566 && test -f ../gas/Makefile \
2567 && test x$build = x$host; then
e8b05380
PB
2568 gcc_cv_as=../gas/as-new$build_exeext
2569elif test -x as$build_exeext; then
2570 # Build using assembler in the current directory.
2571 gcc_cv_as=./as$build_exeext
4a150fc8 2572elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then
e8b05380
PB
2573 gcc_cv_as="$AS_FOR_TARGET"
2574else
2575 AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
2576fi])
2577
2578ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
2579AC_SUBST(ORIGINAL_AS_FOR_TARGET)
be0fe523
PB
2580case "$ORIGINAL_AS_FOR_TARGET" in
2581 ./as | ./as$build_exeext) ;;
2582 *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
2583esac
e8b05380 2584
40f213e6
L
2585default_ld=
2586AC_ARG_ENABLE(ld,
2587[[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]],
2588[case "${enableval}" in
2589 no)
2590 default_ld=ld.gold
2591 ;;
2592 esac])
2593
95204cd5 2594install_gold_as_default=no
40f213e6
L
2595AC_ARG_ENABLE(gold,
2596[[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]],
2597[case "${enableval}" in
2598 default)
2599 install_gold_as_default=yes
2600 ;;
2601 yes)
2602 if test x${default_ld} != x; then
2603 install_gold_as_default=yes
2604 fi
2605 ;;
2606 no)
2607 ;;
2608 *)
2609 AC_MSG_ERROR([invalid --enable-gold argument])
2610 ;;
95204cd5 2611 esac])
40f213e6 2612
d869a8c4
NN
2613# Identify the linker which will work hand-in-glove with the newly
2614# built GCC, so that we can examine its features. This is the linker
2615# which will be driven by the driver program.
2616#
2617# If build != host, and we aren't building gas in-tree, we identify a
2618# build->target linker and hope that it will have the same features
2619# as the host->target linker we'll be using.
275b60d6
JJ
2620gcc_cv_gld_major_version=
2621gcc_cv_gld_minor_version=
2622gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
40f213e6 2623gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
275b60d6 2624gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
e8b05380
PB
2625
2626AS_VAR_SET_IF(gcc_cv_ld,, [
275b60d6
JJ
2627if test -x "$DEFAULT_LINKER"; then
2628 gcc_cv_ld="$DEFAULT_LINKER"
40f213e6
L
2629elif test $install_gold_as_default = yes \
2630 && test -f $gcc_cv_ld_gold_srcdir/configure.ac \
2631 && test -f ../gold/Makefile \
2632 && test x$build = x$host; then
2633 gcc_cv_ld=../gold/ld-new$build_exeext
6b1786aa 2634elif test -f $gcc_cv_ld_gld_srcdir/configure.ac \
08d105fa
AO
2635 && test -f ../ld/Makefile \
2636 && test x$build = x$host; then
e8b05380
PB
2637 gcc_cv_ld=../ld/ld-new$build_exeext
2638elif test -x collect-ld$build_exeext; then
2639 # Build using linker in the current directory.
2640 gcc_cv_ld=./collect-ld$build_exeext
4a150fc8 2641elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then
e8b05380
PB
2642 gcc_cv_ld="$LD_FOR_TARGET"
2643else
2644 AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
2645fi])
2646
5938f74d 2647ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
36d21883 2648PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"`
01a88d35
AP
2649# if the PLUGIN_LD is set ld-new, just have it as ld
2650# as that is the installed named.
3cecbdfa
TS
2651if test x$PLUGIN_LD_SUFFIX = xld-new \
2652 || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then
01a88d35
AP
2653 PLUGIN_LD_SUFFIX=ld
2654fi
5938f74d 2655AC_ARG_WITH(plugin-ld,
b88ecf55 2656[AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])],
5938f74d
L
2657[if test x"$withval" != x; then
2658 ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval"
bcefc344 2659 PLUGIN_LD_SUFFIX="$withval"
5938f74d
L
2660 fi])
2661AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET)
36d21883 2662AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker])
5938f74d 2663
1dcc82c2
DK
2664# Check to see if we are using gold instead of ld
2665AC_MSG_CHECKING(whether we are using gold)
2666ld_is_gold=no
2667if test x$gcc_cv_ld != x; then
2668 if $gcc_cv_ld --version 2>/dev/null | sed 1q \
2669 | grep "GNU gold" > /dev/null; then
2670 ld_is_gold=yes
2671 fi
2672fi
2673AC_MSG_RESULT($ld_is_gold)
2674
402565b6
LB
2675AC_MSG_CHECKING(gold linker with split stack support as non default)
2676# Check to see if default ld is not gold, but gold is
2677# available and has support for split stack. If gcc was configured
2678# with gold then no checking is done.
2679#
2680if test x$ld_is_gold = xno && which ${gcc_cv_ld}.gold >/dev/null 2>&1; then
2681
2682# For platforms other than powerpc64*, enable as appropriate.
2683
2684 gold_non_default=no
2685 ld_gold=`which ${gcc_cv_ld}.gold`
2686# Make sure this gold has minimal split stack support
2687 if $ld_gold --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
2688 ld_vers=`$ld_gold --version | sed 1q`
2689 gold_vers=`echo $ld_vers | sed -n \
2690 -e 's,^[[^)]]*[[ ]]\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*[[^)]]*\)) .*$,\1,p'`
2691 case $target in
2692# check that the gold version contains the complete split stack support
2693# on powerpc64 big and little endian
2694 powerpc64*-*-*)
2695 case "$gold_vers" in
2696 2.25.[[1-9]]*|2.2[[6-9]][[.0-9]]*|2.[[3-9]][[.0-9]]*|[[3-9]].[[.0-9]]*) gold_non_default=yes
2697 ;;
2698 *) gold_non_default=no
2699 ;;
2700 esac
2701 ;;
2702 esac
2703 fi
2704 if test $gold_non_default = yes; then
2705 AC_DEFINE(HAVE_GOLD_NON_DEFAULT_SPLIT_STACK, 1,
2706 [Define if the gold linker supports split stack and is available as a non-default])
2707 fi
2708fi
2709AC_MSG_RESULT($gold_non_default)
2710
e8b05380
PB
2711ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
2712AC_SUBST(ORIGINAL_LD_FOR_TARGET)
be0fe523
PB
2713case "$ORIGINAL_LD_FOR_TARGET" in
2714 ./collect-ld | ./collect-ld$build_exeext) ;;
2715 *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
2716esac
e8b05380
PB
2717
2718AC_MSG_CHECKING(what linker to use)
55b46574
RO
2719if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \
2720 || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then
08d105fa
AO
2721 # Single tree build which includes ld. We want to prefer it
2722 # over whatever linker top-level may have detected, since
2723 # we'll use what we're building after installation anyway.
e8b05380 2724 AC_MSG_RESULT(newly built ld)
34a86c2b 2725 in_tree_ld=yes
5408ac6c
HPN
2726 in_tree_ld_is_elf=no
2727 if (grep 'EMUL = .*elf' ../ld/Makefile \
8a45d680
AN
2728 || grep 'EMUL = .*linux' ../ld/Makefile \
2729 || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
5408ac6c 2730 in_tree_ld_is_elf=yes
55b46574
RO
2731 elif test "$ld_is_gold" = yes; then
2732 in_tree_ld_is_elf=yes
5408ac6c 2733 fi
6b1786aa 2734 for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.ac $gcc_cv_ld_gld_srcdir/Makefile.in
275b60d6
JJ
2735 do
2736changequote(,)dnl
81179208 2737 gcc_cv_gld_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f`
275b60d6
JJ
2738 if test x$gcc_cv_gld_version != x; then
2739 break
2740 fi
2741 done
81179208
HPN
2742 case $gcc_cv_gld_version in
2743 VERSION=[0-9]*) ;;
2744changequote([,])dnl
2745 *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;;
2746changequote(,)dnl
2747 esac
275b60d6
JJ
2748 gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
2749 gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
2750changequote([,])dnl
40f213e6
L
2751 ORIGINAL_LD_BFD_FOR_TARGET=../ld/ld-new$build_exeext
2752 ORIGINAL_LD_GOLD_FOR_TARGET=../gold/ld-new$build_exeext
e8b05380
PB
2753else
2754 AC_MSG_RESULT($gcc_cv_ld)
2755 in_tree_ld=no
40f213e6
L
2756 gcc_cvs_ld_program=`dirname $gcc_cv_ld`/`basename $gcc_cv_ld $host_exeext`
2757 ORIGINAL_LD_BFD_FOR_TARGET=${gcc_cvs_ld_program}.bfd$host_exeext
2758 ORIGINAL_LD_GOLD_FOR_TARGET=${gcc_cvs_ld_program}.gold$host_exeext
275b60d6
JJ
2759fi
2760
40f213e6
L
2761AC_SUBST(ORIGINAL_LD_BFD_FOR_TARGET)
2762AC_SUBST(ORIGINAL_LD_GOLD_FOR_TARGET)
2763
981d4858 2764# Figure out what nm we will be using.
f9c1196a 2765gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
e8b05380 2766AS_VAR_SET_IF(gcc_cv_nm,, [
6b1786aa 2767if test -f $gcc_cv_binutils_srcdir/configure.ac \
c15b113b
DD
2768 && test -f ../binutils/Makefile \
2769 && test x$build = x$host; then
9f18db39
PB
2770 gcc_cv_nm=../binutils/nm-new$build_exeext
2771elif test -x nm$build_exeext; then
57991eba 2772 gcc_cv_nm=./nm$build_exeext
4a150fc8 2773elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then
e8b05380
PB
2774 gcc_cv_nm="$NM_FOR_TARGET"
2775else
2776 AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
2777fi])
9f18db39 2778
9f18db39 2779AC_MSG_CHECKING(what nm to use)
e8b05380
PB
2780if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
2781 # Single tree build which includes binutils.
2782 AC_MSG_RESULT(newly built nm)
2783 in_tree_nm=yes
2784else
2785 AC_MSG_RESULT($gcc_cv_nm)
2786 in_tree_nm=no
2787fi
2788
2789ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
2790AC_SUBST(ORIGINAL_NM_FOR_TARGET)
be0fe523
PB
2791case "$ORIGINAL_NM_FOR_TARGET" in
2792 ./nm | ./nm$build_exeext) ;;
2793 *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;;
2794esac
2795
981d4858 2796
3cae5780 2797# Figure out what objdump we will be using.
e8b05380 2798AS_VAR_SET_IF(gcc_cv_objdump,, [
6b1786aa 2799if test -f $gcc_cv_binutils_srcdir/configure.ac \
c15b113b
DD
2800 && test -f ../binutils/Makefile \
2801 && test x$build = x$host; then
f9c1196a 2802 # Single tree build which includes binutils.
9f18db39 2803 gcc_cv_objdump=../binutils/objdump$build_exeext
d739199a
DJ
2804elif test -x objdump$build_exeext; then
2805 gcc_cv_objdump=./objdump$build_exeext
4a150fc8 2806elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then
e8b05380
PB
2807 gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
2808else
2809 AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
2810fi])
d739199a 2811
d739199a 2812AC_MSG_CHECKING(what objdump to use)
e8b05380
PB
2813if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
2814 # Single tree build which includes binutils.
2815 AC_MSG_RESULT(newly built objdump)
2816elif test x$gcc_cv_objdump = x; then
2817 AC_MSG_RESULT(not found)
2818else
2819 AC_MSG_RESULT($gcc_cv_objdump)
2820fi
3cae5780 2821
6e97481b
JJ
2822# Figure out what readelf we will be using.
2823AS_VAR_SET_IF(gcc_cv_readelf,, [
6b1786aa 2824if test -f $gcc_cv_binutils_srcdir/configure.ac \
6e97481b
JJ
2825 && test -f ../binutils/Makefile \
2826 && test x$build = x$host; then
2827 # Single tree build which includes binutils.
2828 gcc_cv_readelf=../binutils/readelf$build_exeext
2829elif test -x readelf$build_exeext; then
2830 gcc_cv_readelf=./readelf$build_exeext
32a18c8c
L
2831elif ( set dummy $READELF_FOR_TARGET; test -x $[2] ); then
2832 gcc_cv_readelf="$READELF_FOR_TARGET"
6e97481b 2833else
32a18c8c 2834 AC_PATH_PROG(gcc_cv_readelf, $READELF_FOR_TARGET)
6e97481b
JJ
2835fi])
2836
2837AC_MSG_CHECKING(what readelf to use)
2838if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
2839 # Single tree build which includes binutils.
2840 AC_MSG_RESULT(newly built readelf)
2841elif test x$gcc_cv_readelf = x; then
2842 AC_MSG_RESULT(not found)
2843else
2844 AC_MSG_RESULT($gcc_cv_readelf)
2845fi
2846
e4a9a572
IS
2847# Figure out what otool we will be using.
2848AS_VAR_SET_IF(gcc_cv_otool,, [
2849if test -x otool$build_exeext; then
2850 gcc_cv_otool=./otool$build_exeext
2851elif ( set dummy $OTOOL_FOR_TARGET; test -x $[2] ); then
2852 gcc_cv_otool="$OTOOL_FOR_TARGET"
2853else
2854 AC_PATH_PROG(gcc_cv_otool, $OTOOL_FOR_TARGET)
2855fi])
2856
2857AC_MSG_CHECKING(what otool to use)
2858if test x$gcc_cv_otool = x; then
2859 AC_MSG_RESULT(not found)
2860else
2861 AC_MSG_RESULT($gcc_cv_otool)
2862fi
2863
3b5e8ee4
IS
2864# Figure out the dsymutil we will use.
2865AS_VAR_SET_IF(gcc_cv_dsymutil,, [
2866if test -x "$DEFAULT_DSYMUTIL"; then
2867 gcc_cv_dsymutil="$DEFAULT_DSYMUTIL"
2868elif test -x dsymutil$build_exeext; then
2869 gcc_cv_dsymutil=./dsymutil$build_exeext
2870elif ( set dummy $DSYMUTIL_FOR_TARGET; test -x $[2] ); then
2871 gcc_cv_dsymutil=$DSYMUTIL_FOR_TARGET
2872elif ( set dummy $DSYMUTIL; test -x $[2] ); then
2873 gcc_cv_dsymutil=$DSYMUTIL
2874else
2875 AC_PATH_PROG(gcc_cv_dsymutil, $DSYMUTIL_FOR_TARGET)
2876fi])
2877
2878ORIGINAL_DSYMUTIL_FOR_TARGET=$gcc_cv_dsymutil
2879AC_SUBST(ORIGINAL_DSYMUTIL_FOR_TARGET)
2880case "$ORIGINAL_DSYMUTIL_FOR_TARGET" in
2881 ./dsymutil | ./dsymutil$build_exeext) ;;
2882 *) AC_CONFIG_FILES(dsymutil:exec-tool.in, [chmod +x dsymutil]) ;;
2883esac
2884
981d4858 2885# Figure out what assembler alignment features are present.
8ada417f
ZW
2886gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
2887 [2,6,0],,
2888[.balign 4
2889.p2align 2],,
2890[AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
2891 [Define if your assembler supports .balign and .p2align.])])
2892
2893gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
2894 [2,8,0],,
2895 [.p2align 4,,7],,
2896[AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
2897 [Define if your assembler supports specifying the maximum number
2898 of bytes to skip when using the GAS .p2align command.])])
2899
5708d18d
MS
2900gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,
2901 [2,8,0],,
2902 [.literal16],,
2903[AC_DEFINE(HAVE_GAS_LITERAL16, 1,
2904 [Define if your assembler supports .literal16.])])
2905
8ada417f
ZW
2906gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
2907 [elf,2,9,0],,
2908 [conftest_label1: .word 0
d1accaa3
JJ
2909.subsection -1
2910conftest_label2: .word 0
8ada417f
ZW
2911.previous],
2912 [if test x$gcc_cv_nm != x; then
2913 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
2914 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
2915 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
2916 then :
2917 else gcc_cv_as_subsection_m1=yes
2918 fi
2919 rm -f conftest.nm1 conftest.nm2
2920 fi],
2921 [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
2922 [Define if your assembler supports .subsection and .subsection -1 starts
2923 emitting at the beginning of your section.])])
2924
2925gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
2926 [2,2,0],,
2927 [ .weak foobar],,
2928[AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
2929
a0203ca7
AO
2930gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
2931 [2,17,0],,
2932 [ .weakref foobar, barfnot],,
2933[AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
2934
e41f3691
JDA
2935gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
2936 [2,15,91],,
2937 [ .SPACE $TEXT$
2938 .NSUBSPA $CODE$,COMDAT],,
2939[AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
2940
8ada417f
ZW
2941# .hidden needs to be supported in both the assembler and the linker,
2942# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
2943# This is irritatingly difficult to feature test for; we have to check the
2944# date string after the version number. If we've got an in-tree
2945# ld, we don't know its patchlevel version, so we set the baseline at 2.13
2946# to be safe.
2947# The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
8d91472f
DE
2948case "${target}" in
2949 *-*-aix*)
2950 conftest_s=' .globl foobar,hidden'
2951 ;;
2952 *)
2953 conftest_s=' .hidden foobar
2954foobar:'
2955 ;;
2956esac
8ada417f 2957gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
8d91472f 2958 [elf,2,13,0],, [$conftest_s])
ee610fcd
RO
2959case "${target}" in
2960 *-*-darwin*)
2961 # Darwin as has some visibility support, though with a different syntax.
2962 gcc_cv_as_hidden=yes
2963 ;;
2964esac
8ada417f 2965
ba885ec5
NS
2966# gnu_indirect_function type is an extension proposed at
2967# http://groups.google/com/group/generic-abi/files. It allows dynamic runtime
2968# selection of function implementation
f6c5fbfd
NS
2969AC_ARG_ENABLE(gnu-indirect-function,
2970 [AS_HELP_STRING([--enable-gnu-indirect-function],
2971 [enable the use of the @gnu_indirect_function to glibc systems])],
2972 [case $enable_gnu_indirect_function in
2973 yes | no) ;;
2974 *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function.
2975Valid choices are 'yes' and 'no'.]) ;;
2976 esac],
2977 [enable_gnu_indirect_function="$default_gnu_indirect_function"])
2f251a05 2978
97976c07
NC
2979case "${target}" in
2980 riscv*-*-linux*)
2981 AC_MSG_CHECKING(linker ifunc IRELATIVE support)
2982 cat > conftest.s <<EOF
2983 .text
2984 .type foo_resolver, @function
2985foo_resolver:
2986 ret
2987 .size foo_resolver, .-foo_resolver
2988
2989 .globl foo
2990 .type foo, %gnu_indirect_function
2991 .set foo, foo_resolver
2992
2993 .globl bar
2994 .type bar, @function
2995bar:
2996 call foo
2997 ret
2998 .size bar, .-bar
2999EOF
3000 if test x$gcc_cv_as != x \
3001 && test x$gcc_cv_ld != x \
3002 && test x$gcc_cv_readelf != x \
3003 && $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
3004 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
3005 && $gcc_cv_readelf --relocs --wide conftest \
3006 | grep R_RISCV_IRELATIVE > /dev/null 2>&1; then
3007 enable_gnu_indirect_function=yes
3008 fi
3009 rm -f conftest conftest.o conftest.s
3010 AC_MSG_RESULT($enable_gnu_indirect_function)
3011 ;;
3012esac
3013
2f251a05
AI
3014gif=`if test x$enable_gnu_indirect_function = xyes; then echo 1; else echo 0; fi`
3015AC_DEFINE_UNQUOTED(HAVE_GNU_INDIRECT_FUNCTION, $gif,
3016[Define if your system supports gnu indirect functions.])
3017
ba885ec5 3018
10ca6198
JJ
3019changequote(,)dnl
3020if test $in_tree_ld != yes ; then
3021 ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
55b46574
RO
3022 if echo "$ld_ver" | grep GNU > /dev/null; then
3023 if test x"$ld_is_gold" = xyes; then
3024 # GNU gold --version looks like this:
3025 #
3026 # GNU gold (GNU Binutils 2.21.51.20110225) 1.11
3027 #
3028 # We extract the binutils version which is more familiar and specific
3029 # than the gold version.
3030 ld_vers=`echo $ld_ver | sed -n \
3031 -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
3032 else
3033 # GNU ld --version looks like this:
3034 #
3035 # GNU ld (GNU Binutils) 2.21.51.20110225
3036 ld_vers=`echo $ld_ver | sed -n \
3037 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
3038 fi
08bf7bde 3039 ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)\(-*\)\([01][0-9]\)\2\([0-3][0-9]\).*$,\1\3\4,p'`
10ca6198
JJ
3040 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
3041 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
3042 ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
55c4f715
RO
3043 else
3044 case "${target}" in
3045 *-*-solaris2*)
dea82cdb 3046 # Solaris 2 ld -V output looks like this for a regular version:
55c4f715 3047 #
dea82cdb
RO
3048 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699
3049 #
3050 # but test versions add stuff at the end:
3051 #
3052 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10
3053 #
dea82cdb
RO
3054 # ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version
3055 # numbers can be used in ld.so.1 feature checks even if a different
3056 # linker is configured.
55c4f715 3057 ld_ver=`$gcc_cv_ld -V 2>&1`
7cd4af82 3058 if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then
55c4f715 3059 ld_vers=`echo $ld_ver | sed -n \
7cd4af82 3060 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
55c4f715
RO
3061 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
3062 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
3063 fi
3064 ;;
3065 esac
10ca6198
JJ
3066 fi
3067fi
3068changequote([,])dnl
3069
8ada417f 3070AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
e5dfb95f 3071[[if test $in_tree_ld = yes ; then
8ada417f
ZW
3072 gcc_cv_ld_hidden=no
3073 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 \
3074 && test $in_tree_ld_is_elf = yes; then
3075 gcc_cv_ld_hidden=yes
3076 fi
3077else
3078 gcc_cv_ld_hidden=yes
55b46574
RO
3079 if test x"$ld_is_gold" = xyes; then
3080 :
3081 elif echo "$ld_ver" | grep GNU > /dev/null; then
8ada417f
ZW
3082 if test 0"$ld_date" -lt 20020404; then
3083 if test -n "$ld_date"; then
3084 # If there was date string, but was earlier than 2002-04-04, fail
3085 gcc_cv_ld_hidden=no
3086 elif test -z "$ld_vers"; then
3087 # If there was no date string nor ld version number, something is wrong
3088 gcc_cv_ld_hidden=no
3089 else
8ada417f
ZW
3090 test -z "$ld_vers_patch" && ld_vers_patch=0
3091 if test "$ld_vers_major" -lt 2; then
3092 gcc_cv_ld_hidden=no
3093 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
3094 gcc_cv_ld_hidden="no"
3095 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
3096 gcc_cv_ld_hidden=no
c72931a6 3097 fi
8ada417f 3098 fi
789b7de5 3099 fi
8ada417f 3100 else
28690784 3101 case "${target}" in
8d91472f
DE
3102 *-*-aix[789]*)
3103 gcc_cv_ld_hidden=yes
3104 ;;
ee610fcd
RO
3105 *-*-darwin*)
3106 # Darwin ld has some visibility support.
3107 gcc_cv_ld_hidden=yes
3108 ;;
b0fd7d27 3109 hppa64*-*-hpux* | ia64*-*-hpux*)
28690784
JDA
3110 gcc_cv_ld_hidden=yes
3111 ;;
ccd1242e 3112 *-*-solaris2*)
a93e1899
RO
3113 # Support for .hidden in Sun ld appeared in Solaris 9 FCS, but
3114 # .symbolic was only added in Solaris 9 12/02.
5e87dc23
RO
3115 gcc_cv_ld_hidden=yes
3116 ;;
28690784
JDA
3117 *)
3118 gcc_cv_ld_hidden=no
3119 ;;
3120 esac
8ada417f 3121 fi
e5dfb95f 3122fi]])
8ada417f 3123libgcc_visibility=no
9e944a16 3124AC_SUBST(libgcc_visibility)
232b67d9 3125GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
0f31374d 3126if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
8ada417f
ZW
3127 libgcc_visibility=yes
3128 AC_DEFINE(HAVE_GAS_HIDDEN, 1,
3129 [Define if your assembler and linker support .hidden.])
3130fi
6a9c5260 3131
e73da78e
RO
3132AC_MSG_CHECKING(linker read-only and read-write section mixing)
3133gcc_cv_ld_ro_rw_mix=unknown
3134if test $in_tree_ld = yes ; then
3135 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 \
3136 && test $in_tree_ld_is_elf = yes; then
3137 gcc_cv_ld_ro_rw_mix=read-write
3138 fi
3139elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
3140 echo '.section myfoosect, "a"' > conftest1.s
3141 echo '.section myfoosect, "aw"' > conftest2.s
3142 echo '.byte 1' >> conftest2.s
3143 echo '.section myfoosect, "a"' > conftest3.s
3144 echo '.byte 0' >> conftest3.s
3145 if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
3146 && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
3147 && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
3148 && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
3149 conftest2.o conftest3.o > /dev/null 2>&1; then
3150 gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
3151 | sed -e '/myfoosect/!d' -e N`
3152 if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
3153 if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
3154 gcc_cv_ld_ro_rw_mix=read-only
3155 else
3156 gcc_cv_ld_ro_rw_mix=read-write
3157 fi
3158 fi
3159 fi
3160changequote(,)dnl
3161 rm -f conftest.* conftest[123].*
3162changequote([,])dnl
3163fi
3164if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
3165 AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
3166 [Define if your linker links a mix of read-only
3167 and read-write sections into a read-write section.])
3168fi
3169AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
3170
e9c9f128
JJ
3171gcc_AC_INITFINI_ARRAY
3172
8ada417f 3173# Check if we have .[us]leb128, and support symbol arithmetic with it.
2133e773
IS
3174# Older versions of GAS and some non-GNU assemblers, have a bugs handling
3175# these directives, even when they appear to accept them.
8ada417f 3176gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
2133e773 3177 [elf,2,11,0],,
8ada417f 3178[ .data
b7460f24
RH
3179 .uleb128 L2 - L1
3180L1:
3181 .uleb128 1280
3182 .sleb128 -1010
2133e773
IS
3183L2:
3184 .uleb128 0x8000000000000000
3185],
3186[[
3187if test "x$gcc_cv_objdump" != x; then
3188 if $gcc_cv_objdump -s conftest.o 2>/dev/null \
3189 | grep '04800a8e 78808080 80808080 808001' >/dev/null; then
3190 gcc_cv_as_leb128=yes
3191 fi
3192elif test "x$gcc_cv_otool" != x; then
3193 if $gcc_cv_otool -d conftest.o 2>/dev/null \
3194 | grep '04 80 0a 8e 78 80 80 80 80 80 80 80 80 80 01' >/dev/null; then
3195 gcc_cv_as_leb128=yes
3196 fi
3197else
3198 # play safe, assume the assembler is broken.
3199 :
3200fi
3201]],
3202 [AC_DEFINE(HAVE_AS_LEB128, 1,
3203 [Define if your assembler supports .sleb128 and .uleb128.])],
3204 [AC_DEFINE(HAVE_AS_LEB128, 0,
3205 [Define if your assembler supports .sleb128 and .uleb128.])])
8ada417f 3206
a836f142
RO
3207# Determine if an .eh_frame section is read-only.
3208gcc_fn_eh_frame_ro () {
3209 $gcc_cv_as $1 -o conftest.o conftest.s > /dev/null 2>&1 && \
3210 $gcc_cv_objdump -h conftest.o 2>/dev/null | \
3211 sed -e '/.eh_frame/!d' -e N | grep READONLY > /dev/null
3212}
3213
d4ea4622
RH
3214# Check if we have assembler support for unwind directives.
3215gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
6e60703f 3216 ,,
d4ea4622
RH
3217[ .text
3218 .cfi_startproc
3219 .cfi_offset 0, 0
3220 .cfi_same_value 1
3221 .cfi_def_cfa 1, 2
3222 .cfi_escape 1, 2, 3, 4, 5
e73da78e
RO
3223 .cfi_endproc],
3224[case "$target" in
3225 *-*-solaris*)
3226 # If the linker used on Solaris (like Sun ld) isn't capable of merging
3227 # read-only and read-write sections, we need to make sure that the
3228 # assembler used emits read-write .eh_frame sections.
a836f142
RO
3229 if test "x$gcc_cv_ld_ro_rw_mix" = xread-write; then
3230 gcc_cv_as_cfi_directive=yes
3231 elif test "x$gcc_cv_objdump" = x; then
3232 # No objdump, err on the side of caution.
3233 gcc_cv_as_cfi_directive=no
3234 else
3235 if test x$gas = xyes; then
3236 as_32_opt="--32"
3237 as_64_opt="--64"
e73da78e 3238 else
a836f142
RO
3239 as_32_opt="-m32"
3240 as_64_opt="-m64"
e73da78e 3241 fi
a836f142
RO
3242 case "$target" in
3243 sparc*-*-solaris2.*)
3244 # On Solaris/SPARC, .eh_frame sections should always be read-write.
3245 if gcc_fn_eh_frame_ro $as_32_opt \
3246 || gcc_fn_eh_frame_ro $as_64_opt; then
3247 gcc_cv_as_cfi_directive=no
3248 else
3249 gcc_cv_as_cfi_directive=yes
3250 fi
3251 ;;
3252 i?86-*-solaris2.* | x86_64-*-solaris2.*)
3253 # On Solaris/x86, make sure that GCC and assembler agree on using
3254 # read-only .eh_frame sections for 64-bit.
3255 if gcc_fn_eh_frame_ro $as_32_opt; then
3256 gcc_cv_as_cfi_directive=no
3257 elif gcc_fn_eh_frame_ro $as_64_opt; then
3258 gcc_cv_as_cfi_directive=yes
3259 else
3260 gcc_cv_as_cfi_directive=no
3261 fi
3262 ;;
3263 esac
e73da78e
RO
3264 fi
3265 ;;
3266 *-*-*)
3267 gcc_cv_as_cfi_directive=yes
3268 ;;
3269esac])
92053f38 3270if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
6e97481b
JJ
3271gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
3272 ,,
3273[ .text
3274 .cfi_startproc
3275 .cfi_adjust_cfa_offset 64
7ac22e17 3276 .skip 75040, 0
6e97481b
JJ
3277 .cfi_adjust_cfa_offset 128
3278 .cfi_endproc],
e5dfb95f 3279[[
92053f38 3280if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
7ac22e17 3281 | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then
6e97481b
JJ
3282 gcc_cv_as_cfi_advance_working=yes
3283fi
e5dfb95f 3284]])
6e97481b 3285else
92053f38 3286 # no objdump, err on the side of caution
66f91112 3287 gcc_cv_as_cfi_advance_working=no
6e97481b 3288fi
174425ad 3289GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_DIRECTIVE)
d4ea4622 3290AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
6e97481b
JJ
3291 [`if test $gcc_cv_as_cfi_directive = yes \
3292 && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`],
058514b3
RH
3293 [Define 0/1 if your assembler supports CFI directives.])
3294
174425ad 3295GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
058514b3 3296gcc_GAS_CHECK_FEATURE([cfi personality directive],
6e60703f 3297 gcc_cv_as_cfi_personality_directive, ,,
058514b3 3298[ .text
042628f9 3299 .cfi_startproc
058514b3
RH
3300 .cfi_personality 0, symbol
3301 .cfi_endproc])
3302AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
22e05272 3303 [`if test $gcc_cv_as_cfi_personality_directive = yes; then echo 1; else echo 0; fi`],
058514b3 3304 [Define 0/1 if your assembler supports .cfi_personality.])
d4ea4622 3305
7d45fb94
JJ
3306gcc_GAS_CHECK_FEATURE([cfi sections directive],
3307 gcc_cv_as_cfi_sections_directive, ,,
3308[ .text
3309 .cfi_sections .debug_frame, .eh_frame
3310 .cfi_startproc
92053f38
RH
3311 .cfi_endproc],
3312[case $target_os in
abe64d9e 3313 win32 | pe | cygwin* | mingw32*)
92053f38
RH
3314 # Need to check that we generated the correct relocation for the
3315 # .debug_frame section. This was fixed for binutils 2.21.
3316 gcc_cv_as_cfi_sections_directive=no
3317 if test "x$gcc_cv_objdump" != x; then
3318 if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \
3319 grep secrel > /dev/null; then
3320 gcc_cv_as_cfi_sections_directive=yes
3321 fi
3322 fi
3323 ;;
3324 *)
3325 gcc_cv_as_cfi_sections_directive=yes
3326 ;;
3327esac])
174425ad 3328GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_SECTIONS_DIRECTIVE)
7d45fb94 3329AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
22e05272 3330 [`if test $gcc_cv_as_cfi_sections_directive = yes; then echo 1; else echo 0; fi`],
7d45fb94
JJ
3331 [Define 0/1 if your assembler supports .cfi_sections.])
3332
8ada417f
ZW
3333# GAS versions up to and including 2.11.0 may mis-optimize
3334# .eh_frame data.
3335gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
3336 [elf,2,12,0],,
3337[ .text
c64688ae
RH
3338.LFB1:
3339 .4byte 0
3340.L1:
3341 .4byte 0
3342.LFE1:
3343 .section .eh_frame,"aw",@progbits
3344__FRAME_BEGIN__:
3345 .4byte .LECIE1-.LSCIE1
3346.LSCIE1:
3347 .4byte 0x0
3348 .byte 0x1
3349 .ascii "z\0"
3350 .byte 0x1
3351 .byte 0x78
3352 .byte 0x1a
3353 .byte 0x0
3354 .byte 0x4
3355 .4byte 1
3356 .p2align 1
3357.LECIE1:
3358.LSFDE1:
3359 .4byte .LEFDE1-.LASFDE1
3360.LASFDE1:
3361 .4byte .LASFDE1-__FRAME_BEGIN__
3362 .4byte .LFB1
3363 .4byte .LFE1-.LFB1
3364 .byte 0x4
3365 .4byte .LFE1-.LFB1
3366 .byte 0x4
3367 .4byte .L1-.LFB1
8ada417f 3368.LEFDE1:],
ba479fd2
NN
3369[ dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
3370cat > conftest.lit <<EOF
c64688ae
RH
3371 0000 10000000 00000000 017a0001 781a0004 .........z..x...
3372 0010 01000000 12000000 18000000 00000000 ................
ba479fd2 3373 0020 08000000 04080000 0044 .........D @&t@
01efb963 3374EOF
ba479fd2 3375cat > conftest.big <<EOF
01efb963
AS
3376 0000 00000010 00000000 017a0001 781a0004 .........z..x...
3377 0010 00000001 00000012 00000018 00000000 ................
ba479fd2 3378 0020 00000008 04000000 0844 .........D @&t@
c64688ae 3379EOF
8ada417f
ZW
3380 # If the assembler didn't choke, and we can objdump,
3381 # and we got the correct data, then succeed.
dbc02e7f
AS
3382 # The text in the here-document typically retains its unix-style line
3383 # endings, while the output of objdump will use host line endings.
3384 # Therefore, use diff -b for the comparisons.
8ada417f
ZW
3385 if test x$gcc_cv_objdump != x \
3386 && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
3387 | tail -3 > conftest.got \
dbc02e7f
AS
3388 && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \
3389 || diff -b conftest.big conftest.got > /dev/null 2>&1; }
8ada417f
ZW
3390 then
3391 gcc_cv_as_eh_frame=yes
3392 elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
3393 gcc_cv_as_eh_frame=buggy
3394 else
3395 # Uh oh, what do we do now?
3396 gcc_cv_as_eh_frame=no
3397 fi])
3398
3399if test $gcc_cv_as_eh_frame = buggy; then
3400 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
3401 [Define if your assembler mis-optimizes .eh_frame data.])
201556f0 3402fi
201556f0 3403
f8d70404
RO
3404# Test if the assembler supports the section flag 'e' or #exclude for
3405# specifying an excluded section.
3406gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_e,
3407 [2,22,51], [--fatal-warnings],
3408 [.section foo1,"e"
3409 .byte 0,0,0,0])
3410if test $gcc_cv_as_section_exclude_e = no; then
3411 case "${target}" in
3412 # Solaris as uses #exclude instead.
3413 *-*-solaris2*)
3414 case "${target}" in
3415 sparc*-*-solaris2*)
3416 conftest_s='.section "foo1", #exclude'
3417 ;;
3418 i?86-*-solaris2* | x86_64-*-solaris2*)
3419 conftest_s='.section foo1, #exclude'
3420 ;;
3421 esac
3422 ;;
3423 esac
3424 gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_hash,,,
3425 [$conftest_s
3426 .byte 0,0,0,0])
3427fi
3428AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
3429 [`if test $gcc_cv_as_section_exclude_e = yes || test $gcc_cv_as_section_exclude_hash = yes; then echo 1; else echo 0; fi`],
3430[Define if your assembler supports specifying the exclude section flag.])
3431
6fbec038
L
3432# Test if the assembler supports the section flag 'R' for specifying
3433# section with SHF_GNU_RETAIN.
3434case "${target}" in
3435 # Solaris may use GNU assembler with Solairs ld. Even if GNU
3436 # assembler supports the section flag 'R', it doesn't mean that
3437 # Solairs ld supports it.
3438 *-*-solaris2*)
3439 gcc_cv_as_shf_gnu_retain=no
3440 ;;
3441 *)
3442 gcc_GAS_CHECK_FEATURE([section 'R' flag], gcc_cv_as_shf_gnu_retain,
3443 [elf,2,36,0], [--fatal-warnings],
3444 [.section .foo,"awR",%progbits
3445.byte 0])
3446 ;;
3447esac
3448AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_GNU_RETAIN,
3449 [`if test $gcc_cv_as_shf_gnu_retain = yes; then echo 1; else echo 0; fi`],
3450 [Define 0/1 if your assembler supports marking sections with SHF_GNU_RETAIN flag.])
3451
694d4a6d
L
3452# Test if the assembler supports the section flag 'o' for specifying
3453# section with link-order.
3454case "${target}" in
3455 # Solaris may use GNU assembler with Solairs ld. Even if GNU
3456 # assembler supports the section flag 'o', it doesn't mean that
3457 # Solairs ld supports it.
3458 *-*-solaris2*)
3459 gcc_cv_as_section_link_order=no
3460 ;;
3461 *)
3462 gcc_GAS_CHECK_FEATURE([section 'o' flag], gcc_cv_as_section_link_order,
3463 [2,35,0], [--fatal-warnings],
3464 [.section .foo,"a"
3465.byte 0
3466.section __patchable_function_entries,"awo",%progbits,.foo
3467.byte 0])
3468 ;;
3469esac
3470AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_LINK_ORDER,
3471 [`if test $gcc_cv_as_section_link_order = yes; then echo 1; else echo 0; fi`],
3472 [Define 0/1 if your assembler supports 'o' flag in .section directive.])
3473
8ada417f
ZW
3474gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
3475 [elf,2,12,0], [--fatal-warnings],
5d4856a0 3476 [.section .rodata.str, "aMS", @progbits, 1])
c18a5b6c
MM
3477if test $gcc_cv_as_shf_merge = no; then
3478 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
3479 [elf,2,12,0], [--fatal-warnings],
3480 [.section .rodata.str, "aMS", %progbits, 1])
3481fi
5d4856a0
RO
3482AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
3483 [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
3484[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
8ada417f 3485
dc6b6330
RO
3486gcc_cv_ld_aligned_shf_merge=yes
3487case "$target" in
dc6b6330
RO
3488 # SHF_MERGE support is broken in Solaris ld up to Solaris 11.3/SPARC for
3489 # alignment > 1.
3490 sparc*-*-solaris2.11*)
3491 if test x"$gnu_ld" = xno \
3492 && test "$ld_vers_major" -lt 2 && test "$ld_vers_minor" -lt 3159; then
3493 gcc_cv_ld_aligned_shf_merge=no
3494 fi
3495 ;;
3496esac
3497AC_DEFINE_UNQUOTED(HAVE_LD_ALIGNED_SHF_MERGE,
3498 [`if test $gcc_cv_ld_aligned_shf_merge = yes; then echo 1; else echo 0; fi`],
3499[Define 0/1 if your linker supports the SHF_MERGE flag with section alignment > 1.])
3500
01704e5a
RO
3501gcc_GAS_CHECK_FEATURE([stabs directive], gcc_cv_as_stabs_directive, ,,
3502[.stabs "gcc2_compiled.",60,0,0,0],,
3503[AC_DEFINE(HAVE_AS_STABS_DIRECTIVE, 1,
3504 [Define if your assembler supports .stabs.])])
3505
2ca48caa
RO
3506gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)],
3507 gcc_cv_as_comdat_group,
11176d2a 3508 [elf,2,16,0], [--fatal-warnings],
c18a5b6c
MM
3509 [.section .text,"axG",@progbits,.foo,comdat])
3510if test $gcc_cv_as_comdat_group = yes; then
3511 gcc_cv_as_comdat_group_percent=no
2ca48caa 3512 gcc_cv_as_comdat_group_group=no
c18a5b6c 3513else
2ca48caa
RO
3514 gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)],
3515 gcc_cv_as_comdat_group_percent,
11176d2a 3516 [elf,2,16,0], [--fatal-warnings],
c18a5b6c 3517 [.section .text,"axG",%progbits,.foo,comdat])
2ca48caa
RO
3518 if test $gcc_cv_as_comdat_group_percent = yes; then
3519 gcc_cv_as_comdat_group_group=no
3520 else
3521 case "${target}" in
3522 # Sun as uses a completely different syntax.
3523 *-*-solaris2*)
3524 case "${target}" in
3525 sparc*-*-solaris2*)
3526 conftest_s='
3527 .group foo,".text%foo",#comdat
3528 .section ".text%foo", #alloc,#execinstr,#progbits
3529 .globl foo
3530 foo:
3531 '
3532 ;;
ccd1242e 3533 i?86-*-solaris2* | x86_64-*-solaris2*)
2ca48caa
RO
3534 conftest_s='
3535 .group foo,.text%foo,#comdat
3536 .section .text%foo, "ax", @progbits
3537 .globl foo
3538 foo:
3539 '
3540 ;;
3541 esac
3542 gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)],
3543 gcc_cv_as_comdat_group_group,
3544 ,, [$conftest_s])
3545 ;;
3546 esac
56e675ce
RO
3547 if test -z "${gcc_cv_as_comdat_group_group+set}"; then
3548 gcc_cv_as_comdat_group_group=no
3549 fi
2ca48caa 3550 fi
c18a5b6c 3551fi
1dcc82c2
DK
3552if test x"$ld_is_gold" = xyes; then
3553 comdat_group=yes
3554elif test $in_tree_ld = yes ; then
39ba7b7d
JB
3555 comdat_group=no
3556 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 \
3557 && test $in_tree_ld_is_elf = yes; then
3558 comdat_group=yes
3559 fi
55c4f715 3560elif echo "$ld_ver" | grep GNU > /dev/null; then
11176d2a
JB
3561 comdat_group=yes
3562 if test 0"$ld_date" -lt 20050308; then
3563 if test -n "$ld_date"; then
3564 # If there was date string, but was earlier than 2005-03-08, fail
3565 comdat_group=no
3566 elif test "$ld_vers_major" -lt 2; then
3567 comdat_group=no
3568 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
3569 comdat_group=no
3570 fi
3571 fi
1cf0118d 3572else
55c4f715
RO
3573changequote(,)dnl
3574 case "${target}" in
3575 *-*-solaris2.1[1-9]*)
2ca48caa 3576 comdat_group=no
55c4f715
RO
3577 # Sun ld has COMDAT group support since Solaris 9, but it doesn't
3578 # interoperate with GNU as until Solaris 11 build 130, i.e. ld
3579 # version 1.688.
3580 #
2ca48caa
RO
3581 # If using Sun as for COMDAT group as emitted by GCC, one needs at
3582 # least ld version 1.2267.
3583 if test "$ld_vers_major" -gt 1; then
55c4f715 3584 comdat_group=yes
2ca48caa
RO
3585 elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
3586 comdat_group=yes
3587 elif test "$ld_vers_minor" -ge 2267; then
3588 comdat_group=yes
55c4f715
RO
3589 fi
3590 ;;
3591 *)
3592 # Assume linkers other than GNU ld don't support COMDAT group.
3593 comdat_group=no
3594 ;;
3595 esac
3596changequote([,])dnl
1cf0118d 3597fi
55c4f715
RO
3598# Allow overriding the automatic COMDAT group tests above.
3599AC_ARG_ENABLE(comdat,
3600 [AS_HELP_STRING([--enable-comdat], [enable COMDAT group support])],
3601 [comdat_group="$enable_comdat"])
1cf0118d
RO
3602if test $comdat_group = no; then
3603 gcc_cv_as_comdat_group=no
3604 gcc_cv_as_comdat_group_percent=no
2ca48caa 3605 gcc_cv_as_comdat_group_group=no
11176d2a
JB
3606fi
3607AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
2ca48caa
RO
3608 [`if test $gcc_cv_as_comdat_group = yes \
3609 || test $gcc_cv_as_comdat_group_percent = yes \
3610 || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`],
11176d2a 3611[Define 0/1 if your assembler and linker support COMDAT groups.])
c18a5b6c 3612
af2e3244
RO
3613# Restrict this test to Solaris/x86: other targets define this statically.
3614case "${target}" in
3615 i?86-*-solaris2* | x86_64-*-solaris2*)
3616 AC_MSG_CHECKING(support for hidden thunks in linkonce sections)
3617 if test $in_tree_ld = yes || echo "$ld_ver" | grep GNU > /dev/null; then
3618 hidden_linkonce=yes
3619 else
3620 case "${target}" in
3621 # Full support for hidden thunks in linkonce sections only appeared in
3622 # Solaris 11/OpenSolaris.
3623 *-*-solaris2.1[[1-9]]*)
3624 hidden_linkonce=yes
3625 ;;
3626 *)
3627 hidden_linkonce=no
3628 ;;
3629 esac
3630 fi
3631 AC_MSG_RESULT($hidden_linkonce)
3632 AC_DEFINE_UNQUOTED(USE_HIDDEN_LINKONCE,
3633 [`if test $hidden_linkonce = yes; then echo 1; else echo 0; fi`],
3634 [Define 0/1 if your linker supports hidden thunks in linkonce sections.])
3635 ;;
3636esac
3637
894f597f
AO
3638gcc_GAS_CHECK_FEATURE([line table is_stmt support],
3639 gcc_cv_as_is_stmt,
3640 [2,16,92],,
3641[ .text
3642 .file 1 "conf.c"
3643 .loc 1 1 0 is_stmt 1],,
3644[AC_DEFINE(HAVE_GAS_LOC_STMT, 1,
3645 [Define if your assembler supports the .loc is_stmt sub-directive.])])
3646
6c52e687
CC
3647gcc_GAS_CHECK_FEATURE([line table discriminator support],
3648 gcc_cv_as_discriminator,
3649 [2,19,51],,
3650[ .text
3651 .file 1 "conf.c"
3652 .loc 1 1 0 discriminator 1],,
3653[AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1,
3654 [Define if your assembler supports the .loc discriminator sub-directive.])])
3655
02afb6a9
JL
3656# Catch the newlib flag of the same name so we can gate GCC features on it.
3657AC_ARG_ENABLE(newlib-nano-formatted-io,
3658[AS_HELP_STRING([--enable-newlib-nano-formatted-io], [Use nano version
3659 formatted IO])],
3660[case "${enableval}" in
3661 yes|no)
3662 ;;
3663 *)
3664 AC_MSG_ERROR([unknown newlib-nano-formatted-io setting $enableval])
3665 ;;
3666esac], [])
3667
6a7a462c 3668# Thread-local storage - the check is heavily parameterized.
f996902d
RH
3669conftest_s=
3670tls_first_major=
3671tls_first_minor=
9739c90c 3672tls_as_opt=
f996902d
RH
3673case "$target" in
3674changequote(,)dnl
6f9b006d
RH
3675 alpha*-*-*)
3676 conftest_s='
3677 .section ".tdata","awT",@progbits
3678foo: .long 25
3679 .text
3680 ldq $27,__tls_get_addr($29) !literal!1
3681 lda $16,foo($29) !tlsgd!1
3682 jsr $26,($27),__tls_get_addr !lituse_tlsgd!1
3683 ldq $27,__tls_get_addr($29) !literal!2
3684 lda $16,foo($29) !tlsldm!2
3685 jsr $26,($27),__tls_get_addr !lituse_tlsldm!2
3686 ldq $1,foo($29) !gotdtprel
3687 ldah $2,foo($29) !dtprelhi
3688 lda $3,foo($2) !dtprello
3689 lda $4,foo($29) !dtprel
3690 ldq $1,foo($29) !gottprel
3691 ldah $2,foo($29) !tprelhi
3692 lda $3,foo($2) !tprello
3693 lda $4,foo($29) !tprel'
3694 tls_first_major=2
3695 tls_first_minor=13
2f3321ca 3696 tls_as_opt=--fatal-warnings
6f9b006d 3697 ;;
28633bbd
CZ
3698 arc*-*-*)
3699 conftest_s='
3700 add_s r0,r0, @foo@tpoff'
3701 tls_first_major=2
3702 tls_first_minor=23
3703 ;;
ad9646c7
HPN
3704 cris-*-*|crisv32-*-*)
3705 conftest_s='
3706 .section ".tdata","awT",@progbits
3707x: .long 25
3708 .text
3709 move.d x:IE,$r10
3710 nop'
3711 tls_first_major=2
3712 tls_first_minor=20
3713 tls_as_opt=--fatal-warnings
3714 ;;
e4dd71de
AH
3715 frv*-*-*)
3716 conftest_s='
3717 .section ".tdata","awT",@progbits
3718x: .long 25
3719 .text
3720 call #gettlsoff(x)'
3721 tls_first_major=2
3722 tls_first_minor=14
3723 ;;
51076f96
RC
3724 hppa*-*-linux*)
3725 conftest_s='
3726t1: .reg %r20
3727t2: .reg %r21
3728gp: .reg %r19
3729 .section ".tdata","awT",@progbits
3730foo: .long 25
3731 .text
3732 .align 4
3733 addil LT%foo-$tls_gdidx$,gp
3734 ldo RT%foo-$tls_gdidx$(%r1),%arg0
3735 b __tls_get_addr
3736 nop
3737 addil LT%foo-$tls_ldidx$,gp
3738 b __tls_get_addr
3739 ldo RT%foo-$tls_ldidx$(%r1),%arg0
3740 addil LR%foo-$tls_dtpoff$,%ret0
3741 ldo RR%foo-$tls_dtpoff$(%r1),%t1
3742 mfctl %cr27,%t1
3743 addil LT%foo-$tls_ieoff$,gp
3744 ldw RT%foo-$tls_ieoff$(%r1),%t2
3745 add %t1,%t2,%t3
3746 mfctl %cr27,%t1
3747 addil LR%foo-$tls_leoff$,%t1
3748 ldo RR%foo-$tls_leoff$(%r1),%t2'
3749 tls_first_major=2
3750 tls_first_minor=15
3751 tls_as_opt=--fatal-warnings
3752 ;;
d3585b76
DJ
3753 arm*-*-*)
3754 conftest_s='
3755 .section ".tdata","awT",%progbits
3756foo: .long 25
3757 .text
3758.word foo(gottpoff)
3759.word foo(tpoff)
3760.word foo(tlsgd)
3761.word foo(tlsldm)
3762.word foo(tlsldo)'
3763 tls_first_major=2
3764 tls_first_minor=17
3765 ;;
fe4e71e4 3766 i[34567]86-*-* | x86_64-*-*)
f1c26cad 3767 case "$target" in
ccd1242e 3768 i[34567]86-*-solaris2.* | x86_64-*-solaris2.*)
f1c26cad 3769 on_solaris=yes
fbdd5d87 3770 ;;
f1c26cad
RO
3771 *)
3772 on_solaris=no
3773 ;;
3774 esac
3775 if test x$on_solaris = xyes && test x$gas_flag = xno; then
3776 conftest_s='
3777 .section .tdata,"awt",@progbits'
3778 tls_first_major=0
3779 tls_first_minor=0
caa16d41 3780 tls_section_flag=t
f1c26cad
RO
3781changequote([,])dnl
3782 AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
3783[Define to the flag used to mark TLS sections if the default (`T') doesn't work.])
3784changequote(,)dnl
3785 else
3786 conftest_s='
3787 .section ".tdata","awT",@progbits'
3788 tls_first_major=2
3789 tls_first_minor=14
caa16d41 3790 tls_section_flag=T
f1c26cad
RO
3791 tls_as_opt="--fatal-warnings"
3792 fi
fe4e71e4
RO
3793 case "$target" in
3794 i[34567]86-*-*)
700d4572
RO
3795 if test x$on_solaris = xyes; then
3796 case $gas_flag in
3797 yes) tls_as_opt="$tls_as_opt --32" ;;
3798 esac
3799 fi
fe4e71e4 3800 conftest_s="$conftest_s
f996902d
RH
3801foo: .long 25
3802 .text
3803 movl %gs:0, %eax
f1c26cad
RO
3804 leal foo@tlsgd(,%ebx,1), %eax
3805 leal foo@tlsldm(%ebx), %eax
3806 leal foo@dtpoff(%eax), %edx
3807 movl foo@gottpoff(%ebx), %eax
3808 subl foo@gottpoff(%ebx), %eax
3809 addl foo@gotntpoff(%ebx), %eax
3810 movl foo@indntpoff, %eax
3811 movl \$foo@tpoff, %eax
3812 subl \$foo@tpoff, %eax
3813 leal foo@ntpoff(%ecx), %eax"
fe4e71e4
RO
3814 ;;
3815 x86_64-*-*)
3816 if test x$on_solaris = xyes; then
3817 case $gas_flag in
3818 yes) tls_as_opt="$tls_as_opt --64" ;;
3819 no) tls_as_opt="$tls_as_opt -xarch=amd64" ;;
3820 esac
3821 fi
3822 conftest_s="$conftest_s
75d38379
JJ
3823foo: .long 25
3824 .text
3825 movq %fs:0, %rax
fe4e71e4
RO
3826 leaq foo@tlsgd(%rip), %rdi
3827 leaq foo@tlsld(%rip), %rdi
3828 leaq foo@dtpoff(%rax), %rdx
3829 movq foo@gottpoff(%rip), %rax
3830 movq \$foo@tpoff, %rax"
3831 ;;
3832 esac
3833 ;;
7b6e506e
RH
3834 ia64-*-*)
3835 conftest_s='
3836 .section ".tdata","awT",@progbits
3837foo: data8 25
3838 .text
3839 addl r16 = @ltoff(@dtpmod(foo#)), gp
3840 addl r17 = @ltoff(@dtprel(foo#)), gp
3841 addl r18 = @ltoff(@tprel(foo#)), gp
3842 addl r19 = @dtprel(foo#), gp
3843 adds r21 = @dtprel(foo#), r13
3844 movl r23 = @dtprel(foo#)
3845 addl r20 = @tprel(foo#), gp
3846 adds r22 = @tprel(foo#), r13
3847 movl r24 = @tprel(foo#)'
3848 tls_first_major=2
3849 tls_first_minor=13
2f3321ca 3850 tls_as_opt=--fatal-warnings
7b6e506e 3851 ;;
8cc9a5a5
EI
3852 microblaze*-*-*)
3853 conftest_s='
3854 .section .tdata,"awT",@progbits
3855x:
3856 .word 2
3857 .text
3858 addik r5,r20,x@TLSGD
3859 addik r5,r20,x@TLSLDM'
3860 tls_first_major=2
3861 tls_first_minor=20
3862 tls_as_opt='--fatal-warnings'
3863 ;;
69229b81
DJ
3864 mips*-*-*)
3865 conftest_s='
3866 .section .tdata,"awT",@progbits
3867x:
3868 .word 2
3869 .text
3870 addiu $4, $28, %tlsgd(x)
3871 addiu $4, $28, %tlsldm(x)
3872 lui $4, %dtprel_hi(x)
3873 addiu $4, $4, %dtprel_lo(x)
3874 lw $4, %gottprel(x)($28)
3875 lui $4, %tprel_hi(x)
3876 addiu $4, $4, %tprel_lo(x)'
3877 tls_first_major=2
3878 tls_first_minor=16
3879 tls_as_opt='-32 --fatal-warnings'
3880 ;;
75df395f
MK
3881 m68k-*-*)
3882 conftest_s='
3883 .section .tdata,"awT",@progbits
3884x:
3885 .word 2
3886 .text
3887foo:
3888 move.l x@TLSGD(%a5),%a0
3889 move.l x@TLSLDM(%a5),%a0
3890 move.l x@TLSLDO(%a5),%a0
3891 move.l x@TLSIE(%a5),%a0
3892 move.l x@TLSLE(%a5),%a0'
3893 tls_first_major=2
3894 tls_first_minor=19
3895 tls_as_opt='--fatal-warnings'
3896 ;;
e430824f
CLT
3897 nios2-*-*)
3898 conftest_s='
3899 .section ".tdata","awT",@progbits'
3900 tls_first_major=2
3901 tls_first_minor=23
3902 tls_as_opt="--fatal-warnings"
3903 ;;
24034425
IB
3904 aarch64*-*-*)
3905 conftest_s='
3906 .section ".tdata","awT",%progbits
3907foo: .long 25
3908 .text
3909 adrp x0, :tlsgd:x
3910 add x0, x0, #:tlsgd_lo12:x
3911 bl __tls_get_addr
3912 nop'
3913 tls_first_major=2
3914 tls_first_minor=20
3915 tls_as_opt='--fatal-warnings'
3916 ;;
3965b35f
SH
3917 or1k*-*-*)
3918 conftest_s='
3919 .section ".tdata","awT",@progbits
3920foo: .long 25
3921 .text
3922 l.movhi r3, tpoffha(foo)
3923 l.add r3, r3, r10
3924 l.lwz r4, tpofflo(foo)(r3)'
3925 tls_first_major=2
3926 tls_first_minor=30
3927 tls_as_opt=--fatal-warnings
3928 ;;
7a8b1ec4
DE
3929 powerpc-ibm-aix*)
3930 conftest_s='
3931 .extern __get_tpointer
3932 .toc
3933LC..1:
3934 .tc a[TC],a[TL]@le
3935 .csect .text[PR]
3936.tlstest:
3937 lwz 9,LC..1(2)
3938 bla __get_tpointer
3939 lwzx 3,9,3
3940 .globl a
3941 .csect a[TL],4
3942a:
3943 .space 4'
3944 tls_first_major=0
3945 tls_first_minor=0
3946 ;;
227eb343 3947 powerpc64*-*-*)
c4501e62
JJ
3948 conftest_s='
3949 .section ".tdata","awT",@progbits
3950 .align 3
3951ld0: .space 8
3952ld1: .space 8
3953x1: .space 8
3954x2: .space 8
3955x3: .space 8
3956 .text
3957 addi 3,2,ld0@got@tlsgd
3958 bl .__tls_get_addr
3959 nop
3960 addi 3,2,ld1@toc
3961 bl .__tls_get_addr
3962 nop
3963 addi 3,2,x1@got@tlsld
3964 bl .__tls_get_addr
3965 nop
3966 addi 9,3,x1@dtprel
3967 bl .__tls_get_addr
3968 nop
3969 addis 9,3,x2@dtprel@ha
3970 addi 9,9,x2@dtprel@l
3971 bl .__tls_get_addr
3972 nop
3973 ld 9,x3@got@dtprel(2)
3974 add 9,9,3
3975 bl .__tls_get_addr
3976 nop'
3977 tls_first_major=2
3978 tls_first_minor=14
2f3321ca 3979 tls_as_opt="-a64 --fatal-warnings"
c4501e62 3980 ;;
01ae4861
AM
3981 powerpc*-*-*)
3982 conftest_s='
3983 .section ".tdata","awT",@progbits
3984 .align 2
3985ld0: .space 4
3986ld1: .space 4
3987x1: .space 4
3988x2: .space 4
3989x3: .space 4
3990 .text
3991 addi 3,31,ld0@got@tlsgd
3992 bl __tls_get_addr
3993 addi 3,31,x1@got@tlsld
3994 bl __tls_get_addr
3995 addi 9,3,x1@dtprel
3996 addis 9,3,x2@dtprel@ha
3997 addi 9,9,x2@dtprel@l
3998 lwz 9,x3@got@tprel(31)
3999 add 9,9,x@tls
4000 addi 9,2,x1@tprel
4001 addis 9,2,x2@tprel@ha
4002 addi 9,9,x2@tprel@l'
4003 tls_first_major=2
4004 tls_first_minor=14
4005 tls_as_opt="-a32 --fatal-warnings"
4006 ;;
09cae750
PD
4007 riscv*-*-*)
4008 conftest_s='
4009 .section .tdata,"awT",@progbits
4010x: .word 2
4011 .text
4012 la.tls.gd a0,x
4013 call __tls_get_addr'
4014 tls_first_major=2
4015 tls_first_minor=21
4016 tls_as_opt='--fatal-warnings'
4017 ;;
fd3cd001
UW
4018 s390-*-*)
4019 conftest_s='
4020 .section ".tdata","awT",@progbits
4021foo: .long 25
4022 .text
4023 .long foo@TLSGD
4024 .long foo@TLSLDM
4025 .long foo@DTPOFF
4026 .long foo@NTPOFF
4027 .long foo@GOTNTPOFF
4028 .long foo@INDNTPOFF
4029 l %r1,foo@GOTNTPOFF(%r12)
4030 l %r1,0(%r1):tls_load:foo
4031 bas %r14,0(%r1,%r13):tls_gdcall:foo
4032 bas %r14,0(%r1,%r13):tls_ldcall:foo'
4033 tls_first_major=2
4034 tls_first_minor=14
2f3321ca 4035 tls_as_opt="-m31 --fatal-warnings"
fd3cd001
UW
4036 ;;
4037 s390x-*-*)
4038 conftest_s='
4039 .section ".tdata","awT",@progbits
4040foo: .long 25
4041 .text
4042 .quad foo@TLSGD
4043 .quad foo@TLSLDM
4044 .quad foo@DTPOFF
4045 .quad foo@NTPOFF
4046 .quad foo@GOTNTPOFF
4047 lg %r1,foo@GOTNTPOFF(%r12)
4048 larl %r1,foo@INDNTPOFF
4049 brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo
4050 brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
4051 tls_first_major=2
4052 tls_first_minor=14
2f3321ca 4053 tls_as_opt="-m64 -Aesame --fatal-warnings"
fd3cd001 4054 ;;
311adabe 4055 sh-*-* | sh[123456789lbe]*-*-*)
9ff13962
KK
4056 conftest_s='
4057 .section ".tdata","awT",@progbits
4058foo: .long 25
4059 .text
4060 .long foo@TLSGD
4061 .long foo@TLSLDM
4062 .long foo@DTPOFF
4063 .long foo@GOTTPOFF
4064 .long foo@TPOFF'
4065 tls_first_major=2
4066 tls_first_minor=13
2f3321ca 4067 tls_as_opt=--fatal-warnings
9ff13962 4068 ;;
5751a10b 4069 sparc*-*-*)
2f3321ca
EB
4070 case "$target" in
4071 sparc*-sun-solaris2.*)
4072 on_solaris=yes
4073 ;;
4074 *)
4075 on_solaris=no
4076 ;;
4077 esac
4078 if test x$on_solaris = xyes && test x$gas_flag = xno; then
4079 conftest_s='
16c9d3b1 4080 .section ".tdata",#alloc,#write,#tls'
2f3321ca
EB
4081 tls_first_major=0
4082 tls_first_minor=0
4083 else
4084 conftest_s='
16c9d3b1
RO
4085 .section ".tdata","awT",@progbits'
4086 tls_first_major=2
4087 tls_first_minor=14
4088 tls_as_opt="-32 --fatal-warnings"
4089 fi
4090 conftest_s="$conftest_s
5751a10b
JJ
4091foo: .long 25
4092 .text
4093 sethi %tgd_hi22(foo), %o0
4094 add %o0, %tgd_lo10(foo), %o1
4095 add %l7, %o1, %o0, %tgd_add(foo)
4096 call __tls_get_addr, %tgd_call(foo)
4097 sethi %tldm_hi22(foo), %l1
4098 add %l1, %tldm_lo10(foo), %l2
4099 add %l7, %l2, %o0, %tldm_add(foo)
4100 call __tls_get_addr, %tldm_call(foo)
4101 sethi %tldo_hix22(foo), %l3
4102 xor %l3, %tldo_lox10(foo), %l4
4103 add %o0, %l4, %l5, %tldo_add(foo)
4104 sethi %tie_hi22(foo), %o3
4105 add %o3, %tie_lo10(foo), %o3
4106 ld [%l7 + %o3], %o2, %tie_ld(foo)
4107 add %g7, %o2, %o4, %tie_add(foo)
4108 sethi %tle_hix22(foo), %l1
4109 xor %l1, %tle_lox10(foo), %o5
16c9d3b1 4110 ld [%g7 + %o5], %o1"
5751a10b 4111 ;;
dd552284
WL
4112 tilepro*-*-*)
4113 conftest_s='
4114 .section ".tdata","awT",@progbits
4115foo: .long 25
4116 .text
4117 addli r0, zero, tls_gd(foo)
4118 auli r0, zero, tls_gd_ha16(foo)
4119 addli r0, r0, tls_gd_lo16(foo)
4120 jal __tls_get_addr
4121 addli r0, zero, tls_ie(foo)
4122 auli r0, r0, tls_ie_ha16(foo)
4123 addli r0, r0, tls_ie_lo16(foo)'
4124 tls_first_major=2
4125 tls_first_minor=22
4126 tls_as_opt="--fatal-warnings"
4127 ;;
4128 tilegx*-*-*)
4129 conftest_s='
4130 .section ".tdata","awT",@progbits
4131foo: .long 25
4132 .text
4133 shl16insli r0, zero, hw0_last_tls_gd(foo)
4134 shl16insli r0, zero, hw1_last_tls_gd(foo)
4135 shl16insli r0, r0, hw0_tls_gd(foo)
4136 jal __tls_get_addr
4137 shl16insli r0, zero, hw1_last_tls_ie(foo)
4138 shl16insli r0, r0, hw0_tls_ie(foo)'
4139 tls_first_major=2
4140 tls_first_minor=22
4141 tls_as_opt="--fatal-warnings"
4142 ;;
6a7a462c
BW
4143 xtensa*-*-*)
4144 conftest_s='
4145 .section ".tdata","awT",@progbits
4146foo: .long 25
4147 .text
4148 movi a8, foo@TLSFUNC
4149 movi a10, foo@TLSARG
4150 callx8.tls a8, foo@TLSCALL'
4151 tls_first_major=2
4152 tls_first_minor=19
4153 ;;
5751a10b 4154changequote([,])dnl
f996902d 4155esac
8dea1cca
DD
4156set_have_as_tls=no
4157if test "x$enable_tls" = xno ; then
4158 : # TLS explicitly disabled.
4159elif test "x$enable_tls" = xyes ; then
4160 set_have_as_tls=yes # TLS explicitly enabled.
4161elif test -z "$tls_first_major"; then
8ada417f
ZW
4162 : # If we don't have a check, assume no support.
4163else
4164 gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
2f3321ca 4165 [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
8dea1cca
DD
4166 [set_have_as_tls=yes])
4167fi
4168if test $set_have_as_tls = yes ; then
4169 AC_DEFINE(HAVE_AS_TLS, 1,
16c9d3b1 4170 [Define if your assembler and linker support thread-local storage.])
f996902d 4171fi
8ada417f
ZW
4172
4173# Target-specific assembler checks.
f996902d 4174
7e9d8517
L
4175AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
4176gcc_cv_ld_static_dynamic=no
c6092243
RO
4177gcc_cv_ld_static_option='-Bstatic'
4178gcc_cv_ld_dynamic_option='-Bdynamic'
7e9d8517 4179if test $in_tree_ld = yes ; then
83f0ccb8 4180 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
4181 gcc_cv_ld_static_dynamic=yes
4182 fi
4183elif test x$gcc_cv_ld != x; then
bb127cd8 4184 # Check if linker supports -Bstatic/-Bdynamic option
8dc877eb
RO
4185 if $gcc_cv_ld --help 2>&1 | grep -- -Bstatic > /dev/null \
4186 && $gcc_cv_ld --help 2>&1 | grep -- -Bdynamic > /dev/null; then
bb127cd8
RO
4187 gcc_cv_ld_static_dynamic=yes
4188 else
4189 case "$target" in
478f60f9
MH
4190 # AIX ld uses -b flags
4191 *-*-aix4.[[23]]* | *-*-aix[[5-9]]*)
4192 gcc_cv_ld_static_dynamic=yes
4193 gcc_cv_ld_static_option="-bstatic"
4194 gcc_cv_ld_dynamic_option="-bdynamic"
4195 ;;
f903e000
SE
4196 # HP-UX ld uses -a flags to select between shared and archive.
4197 *-*-hpux*)
4198 if test x"$gnu_ld" = xno; then
4199 gcc_cv_ld_static_dynamic=yes
4200 gcc_cv_ld_static_option="-aarchive_shared"
4201 gcc_cv_ld_dynamic_option="-adefault"
4202 fi
4203 ;;
bb127cd8
RO
4204 # Solaris 2 ld always supports -Bstatic/-Bdynamic.
4205 *-*-solaris2*)
4206 gcc_cv_ld_static_dynamic=yes
4207 ;;
4208 esac
4209 fi
7e9d8517
L
4210fi
4211if test x"$gcc_cv_ld_static_dynamic" = xyes; then
4212 AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
c6092243
RO
4213[Define if your linker supports -Bstatic/-Bdynamic or equivalent options.])
4214 AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option",
4215[Define to the linker option to disable use of shared objects.])
4216 AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option",
4217[Define to the linker option to enable use of shared objects.])
7e9d8517
L
4218fi
4219AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
4220
deb3da39
DM
4221AC_MSG_CHECKING(linker --version-script option)
4222gcc_cv_ld_version_script=no
4223ld_version_script_option=''
4224if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
4225 gcc_cv_ld_version_script=yes
4226 ld_version_script_option='--version-script'
4227elif test x$gcc_cv_ld != x; then
4228 case "$target" in
4229 # Solaris 2 ld always supports -M. It also supports a subset of
4230 # --version-script since Solaris 11.4, but requires
4231 # -z gnu-version-script-compat to activate.
4232 *-*-solaris2*)
4233 gcc_cv_ld_version_script=yes
4234 ld_version_script_option='-M'
4235 ;;
4236 esac
4237fi
4238# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
4239AC_MSG_RESULT($gcc_cv_ld_version_script)
4240AC_SUBST(ld_version_script_option)
4241
4242AC_MSG_CHECKING(linker soname option)
4243gcc_cv_ld_soname=no
4244if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
4245 gcc_cv_ld_soname=yes
4246 ld_soname_option='-soname'
4247elif test x$gcc_cv_ld != x; then
4248 case "$target" in
4249 *-*-darwin*)
4250 gcc_cv_ld_soname=yes
4251 ld_soname_option='-install_name'
4252 ;;
ea143da7
RO
4253 # Solaris 2 ld always supports -h. It also supports --soname for GNU
4254 # ld compatiblity since some Solaris 10 update.
4255 *-*-solaris2*)
4256 gcc_cv_ld_soname=yes
4257 ld_soname_option='-h'
4258 ;;
deb3da39
DM
4259 esac
4260fi
4261# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
4262AC_MSG_RESULT($gcc_cv_ld_soname)
4263AC_SUBST(ld_soname_option)
4264
d594623a
L
4265if test x"$demangler_in_ld" = xyes; then
4266 AC_MSG_CHECKING(linker --demangle support)
4267 gcc_cv_ld_demangle=no
4268 if test $in_tree_ld = yes; then
4269 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 \
4270 gcc_cv_ld_demangle=yes
4271 fi
4272 elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
4273 # Check if the GNU linker supports --demangle option
8dc877eb 4274 if $gcc_cv_ld --help 2>&1 | grep no-demangle > /dev/null; then
d594623a
L
4275 gcc_cv_ld_demangle=yes
4276 fi
4277 fi
4278 if test x"$gcc_cv_ld_demangle" = xyes; then
4279 AC_DEFINE(HAVE_LD_DEMANGLE, 1,
4280[Define if your linker supports --demangle option.])
4281 fi
4282 AC_MSG_RESULT($gcc_cv_ld_demangle)
4283fi
4284
96bdf9b4 4285AC_MSG_CHECKING(linker plugin support)
55b46574 4286gcc_cv_lto_plugin=0
f3d533d3 4287if test -f liblto_plugin.la; then
df33b41f
RO
4288 save_ld_ver="$ld_ver"
4289 save_ld_vers_major="$ld_vers_major"
4290 save_ld_vers_minor="$ld_vers_minor"
4291 save_ld_is_gold="$ld_is_gold"
4292
4293 ld_is_gold=no
55b46574 4294
df33b41f
RO
4295 if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
4296 ld_ver="GNU ld"
4297 # FIXME: ld_is_gold?
4298 ld_vers_major="$gcc_cv_gld_major_version"
4299 ld_vers_minor="$gcc_cv_gld_minor_version"
4300 else
4301 # Determine plugin linker version.
4302 # FIXME: Partial duplicate from above, generalize.
4303changequote(,)dnl
4304 ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q`
4305 if echo "$ld_ver" | grep GNU > /dev/null; then
4306 if echo "$ld_ver" | grep "GNU gold" > /dev/null; then
4307 ld_is_gold=yes
4308 ld_vers=`echo $ld_ver | sed -n \
4309 -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
4310 else
4311 ld_vers=`echo $ld_ver | sed -n \
4312 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
4313 fi
4314 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
4315 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
55b46574 4316 fi
df33b41f
RO
4317changequote([,])dnl
4318 fi
4319
4320 # Determine plugin support.
4321 if echo "$ld_ver" | grep GNU > /dev/null; then
55b46574
RO
4322 # Require GNU ld or gold 2.21+ for plugin support by default.
4323 if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then
4324 gcc_cv_lto_plugin=2
4325 # Allow -fuse-linker-plugin to enable plugin support in GNU gold 2.20.
4326 elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then
4327 gcc_cv_lto_plugin=1
96bdf9b4 4328 fi
96bdf9b4 4329 fi
df33b41f
RO
4330
4331 ld_ver="$save_ld_ver"
4332 ld_vers_major="$save_ld_vers_major"
4333 ld_vers_minor="$save_ld_vers_minor"
4334 ld_is_gold="$save_ld_is_gold"
96bdf9b4 4335fi
55b46574
RO
4336AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin,
4337 [Define to the level of your linker's plugin support.])
96bdf9b4
JH
4338AC_MSG_RESULT($gcc_cv_lto_plugin)
4339
b410cf1d
IS
4340# Target OS-specific assembler checks.
4341
4342case "$target_os" in
4343 darwin*)
4344 gcc_GAS_CHECK_FEATURE([-mmacosx-version-min option],
4345 gcc_cv_as_mmacosx_version_min,,
4346 [-mmacosx-version-min=10.1], [.text],,
4347 [AC_DEFINE(HAVE_AS_MMACOSX_VERSION_MIN_OPTION, 1,
4348 [Define if your Mac OS X assembler supports the -mmacos-version-min option.])])
4349 ;;
4350esac
4351
4352# Target CPU-specific assembler checks.
4353
275b60d6 4354case "$target" in
63892fa2
KV
4355 aarch64*-*-*)
4356 gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,,
4357 [-mabi=lp64], [.text],,,)
4358 if test x$gcc_cv_as_aarch64_mabi = xyes; then
4359 AC_DEFINE(HAVE_AS_MABI_OPTION, 1,
4360 [Define if your assembler supports the -mabi option.])
4361 else
4362 if test x$with_abi = xilp32; then
4363 AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
4364 Upgrade the Assembler.])
4365 fi
4366 if test x"$with_multilib_list" = xdefault; then
4367 TM_MULTILIB_CONFIG=lp64
4368 else
4369 aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
4370 for aarch64_multilib in ${aarch64_multilibs}; do
4371 case ${aarch64_multilib} in
4372 ilp32)
4373 AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
4374 Upgrade the Assembler.])
4375 ;;
4376 *)
4377 ;;
4378 esac
4379 done
4380 fi
4381 fi
34ecdb0f
JW
4382 # Check if we have binutils support for relocations types needed by -fpic
4383 gcc_GAS_CHECK_FEATURE([-fpic relocs], gcc_cv_as_aarch64_picreloc,,,
4384 [
4385 .text
4386 ldr x0, [[x2, #:gotpage_lo15:globalsym]]
4387 ],,[AC_DEFINE(HAVE_AS_SMALL_PIC_RELOCS, 1,
4388 [Define if your assembler supports relocs needed by -fpic.])])
c7ff4f0f
SD
4389 # Enable Branch Target Identification Mechanism and Return Address
4390 # Signing by default.
4391 AC_ARG_ENABLE(standard-branch-protection,
4392 [
4393AS_HELP_STRING([--enable-standard-branch-protection],
4394 [enable Branch Target Identification Mechanism and Return Address Signing by default for AArch64])
4395AS_HELP_STRING([--disable-standard-branch-protection],
4396 [disable Branch Target Identification Mechanism and Return Address Signing by default for AArch64])
4397 ],
4398 [
4399 case $enableval in
4400 yes)
4401 tm_defines="${tm_defines} TARGET_ENABLE_BTI=1 TARGET_ENABLE_PAC_RET=1"
4402 ;;
4403 no)
4404 ;;
4405 *)
4406 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-standard-branch-protection.\
4407 Valid choices are 'yes' and 'no'.])
4408 ;;
4409 esac
4410 ],
4411 [])
5e396da6
KT
4412 # Enable default workaround for AArch64 Cortex-A53 erratum 835769.
4413 AC_ARG_ENABLE(fix-cortex-a53-835769,
4414 [
4415AS_HELP_STRING([--enable-fix-cortex-a53-835769],
4416 [enable workaround for AArch64 Cortex-A53 erratum 835769 by default])
4417AS_HELP_STRING([--disable-fix-cortex-a53-835769],
4418 [disable workaround for AArch64 Cortex-A53 erratum 835769 by default])
4419 ],
4420 [
4421 case $enableval in
4422 yes)
4423 tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1"
4424 ;;
4425 no)
4426 ;;
4427 *)
4428 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\
4429 Valid choices are 'yes' and 'no'.])
4430 ;;
4431
4432 esac
4433 ],
4434 [])
bf05ef76
YR
4435 # Enable default workaround for AArch64 Cortex-A53 erratum 843419.
4436 AC_ARG_ENABLE(fix-cortex-a53-843419,
4437 [
4438AS_HELP_STRING([--enable-fix-cortex-a53-843419],
4439 [enable workaround for AArch64 Cortex-A53 erratum 843419 by default])
4440AS_HELP_STRING([--disable-fix-cortex-a53-843419],
4441 [disable workaround for AArch64 Cortex-A53 erratum 843419 by default])
4442 ],
4443 [
4444 case $enableval in
4445 yes)
4446 tm_defines="${tm_defines} TARGET_FIX_ERR_A53_843419_DEFAULT=1"
4447 ;;
4448 no)
4449 ;;
4450 *)
4451 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-843419.\
4452 Valid choices are 'yes' and 'no'.])
4453 ;;
4454
4455 esac
4456 ],
4457 [])
63892fa2
KV
4458 ;;
4459
3a37b08e 4460 # All TARGET_ABI_OSF targets.
5c30094f 4461 alpha*-*-linux* | alpha*-*-*bsd*)
8ada417f
ZW
4462 gcc_GAS_CHECK_FEATURE([explicit relocation support],
4463 gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
4464[ .set nomacro
3a37b08e
RH
4465 .text
4466 extbl $3, $2, $3 !lituse_bytoff!1
4467 ldq $2, a($29) !literal!1
4468 ldq $4, b($29) !literal!2
4469 ldq_u $3, 0($2) !lituse_base!1
4470 ldq $27, f($29) !literal!5
4471 jsr $26, ($27), f !lituse_jsr!5
4472 ldah $29, 0($26) !gpdisp!3
4473 lda $0, c($29) !gprel
4474 ldah $1, d($29) !gprelhigh
4475 lda $1, d($1) !gprellow
8ada417f
ZW
4476 lda $29, 0($29) !gpdisp!3],,
4477 [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
4478 [Define if your assembler supports explicit relocations.])])
d006f5eb
RH
4479 gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
4480 gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
4481[ .set nomacro
4482 .text
4483 ldq $27, a($29) !literal!1
4484 jsr $26, ($27), a !lituse_jsrdirect!1],,
4485 [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
4486 [Define if your assembler supports the lituse_jsrdirect relocation.])])
3a37b08e 4487 ;;
e95b1e6a 4488
0c9dc4ae
GJL
4489 avr-*-*)
4490 gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,,
4491 [--mlink-relax], [.text],,
4492 [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1,
4493 [Define if your avr assembler supports --mlink-relax option.])])
4494
4495 gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,,
4496 [-mrmw], [.text],,
4497 [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1,
4498 [Define if your avr assembler supports -mrmw option.])])
3266ddb3 4499
63866e04
GJL
4500 gcc_GAS_CHECK_FEATURE([__gcc_isr pseudo instruction],
4501 gcc_cv_as_avr_mgccisr,,
4502 [-mgcc-isr], [.text
4503 __gcc_isr 1
4504 __gcc_isr 2
4505 __gcc_isr 0,r24
4506 ],,
4507 [AC_DEFINE(HAVE_AS_AVR_MGCCISR_OPTION, 1,
4508 [Define if your avr assembler supports -mgcc-isr option.])])
4509
3266ddb3
GJL
4510 # Check how default linker description file implements .rodata for
4511 # avrxmega3 (PR21472). avr-gcc assumes .rodata is *not* loaded to
4512 # RAM so avr-gcc skips __do_copy_data for .rodata objects.
4513 AC_MSG_CHECKING(binutils for avrxmega3 .rodata support)
4514 cat > conftest.s <<EOF
4515 .section .rodata,"a",@progbits
4516 .global xxvaryy
4517 ;; avr-nm should print "... R xxvaryy", not "... D xxvaryy".
4518 xxvaryy:
4519 .word 1
4520EOF
4521 rm -f conftest.nm
4522 AC_TRY_COMMAND([$gcc_cv_as -mmcu=avrxmega3 conftest.s -o conftest.o])
4523 AC_TRY_COMMAND([$gcc_cv_ld -mavrxmega3 conftest.o -o conftest.elf])
4524 AC_TRY_COMMAND([$gcc_cv_nm conftest.elf > conftest.nm])
98f9d0ca 4525 if test -s conftest.nm
3266ddb3
GJL
4526 then
4527 if grep ' R xxvaryy' conftest.nm > /dev/null; then
4528 AC_MSG_RESULT(yes)
98f9d0ca
GJL
4529 AC_DEFINE(HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH, 1,
4530 [Define if your default avr linker script for avrxmega3 leaves .rodata in flash.])
3266ddb3
GJL
4531 else
4532 AC_MSG_RESULT(no: avrxmega3 .rodata located in RAM)
4533 echo "$as_me: nm output was" >&AS_MESSAGE_LOG_FD
4534 cat conftest.nm >&AS_MESSAGE_LOG_FD
3266ddb3 4535 avr_ld_ver="`$gcc_cv_ld -v | sed -e 's:^.* ::'`"
98f9d0ca 4536 AC_MSG_WARN([[support for avrxmega3 .rodata in flash needs Binutils 2.29 or higher (have $avr_ld_ver)]])
3266ddb3
GJL
4537 fi
4538 else
4539 AC_MSG_RESULT(test failed)
4540 echo "$as_me: failed program was" >&AS_MESSAGE_LOG_FD
4541 cat conftest.s >&AS_MESSAGE_LOG_FD
98f9d0ca 4542 AC_MSG_WARN([[see `config.log' for details]])
3266ddb3 4543 fi
98f9d0ca 4544 rm -f conftest.s conftest.o conftest.elf conftest.nm
0c9dc4ae
GJL
4545 ;;
4546
682a45fc
HPN
4547 cris-*-*)
4548 gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
4549 gcc_cv_as_cris_no_mul_bug,[2,15,91],
4550 [-no-mul-bug-abort], [.text],,
4551 [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
4552 [Define if your assembler supports the -no-mul-bug-abort option.])])
4553 ;;
4554
8ada417f 4555 sparc*-*-*)
8ada417f
ZW
4556 gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
4557 [-relax], [.text],,
4558 [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
4559 [Define if your assembler supports -relax option.])])
4560
878ee0ab
DM
4561 gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs],
4562 gcc_cv_as_sparc_gotdata_op,,
4563 [-K PIC],
4564[.text
6d7b45ad 4565.align 4
878ee0ab
DM
4566foo:
4567 nop
4568bar:
4569 sethi %gdop_hix22(foo), %g1
4570 xor %g1, %gdop_lox10(foo), %g1
4571 ld [[%l7 + %g1]], %g2, %gdop(foo)],
4572 [if test x$gcc_cv_ld != x \
46bc665f 4573 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
7673c962
RO
4574 if test x$gcc_cv_objdump != x; then
4575 if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \
4576 | grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then
46bc665f 4577 gcc_cv_as_sparc_gotdata_op=no
7673c962 4578 else
46bc665f 4579 gcc_cv_as_sparc_gotdata_op=yes
46bc665f 4580 fi
46bc665f 4581 fi
878ee0ab
DM
4582 fi
4583 rm -f conftest],
4584 [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1,
4585 [Define if your assembler and linker support GOTDATA_OP relocs.])])
4586
8ada417f
ZW
4587 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
4588 gcc_cv_as_sparc_ua_pcrel,,
4589 [-K PIC],
4590[.text
4591foo:
4592 nop
4593.data
4594.align 4
4595.byte 0
4596.uaword %r_disp32(foo)],
4597 [if test x$gcc_cv_ld != x \
4598 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
4599 gcc_cv_as_sparc_ua_pcrel=yes
4600 fi
4601 rm -f conftest],
4602 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
17e9e88c 4603 [Define if your assembler and linker support unaligned PC relative relocs.])
cf7b8b0d 4604
8ada417f
ZW
4605 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
4606 gcc_cv_as_sparc_ua_pcrel_hidden,,
4607 [-K PIC],
4608[.data
4609.align 4
4610.byte 0x31
4611.uaword %r_disp32(foo)
4612.byte 0x32, 0x33, 0x34
4613.global foo
4614.hidden foo
4615foo:
4616.skip 4],
4617 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
4618 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
4619 && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
4620 | grep ' 31000000 07323334' > /dev/null 2>&1; then
4621 if $gcc_cv_objdump -R conftest 2> /dev/null \
4622 | grep 'DISP32' > /dev/null 2>&1; then
4623 :
22252625 4624 else
8ada417f 4625 gcc_cv_as_sparc_ua_pcrel_hidden=yes
5b68c389 4626 fi
8ada417f
ZW
4627 fi
4628 rm -f conftest],
4629 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
4630 [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
4631 ]) # unaligned pcrel relocs
4632
4633 gcc_GAS_CHECK_FEATURE([offsetable %lo()],
4634 gcc_cv_as_sparc_offsetable_lo10,,
4635 [-xarch=v9],
4636[.text
4637 or %g1, %lo(ab) + 12, %g1
4638 or %g1, %lo(ab + 12), %g1],
4639 [if test x$gcc_cv_objdump != x \
ecb0ccbc 4640 && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
8ada417f 4641 | grep ' 82106000 82106000' > /dev/null 2>&1; then
1b5c0152 4642 gcc_cv_as_sparc_offsetable_lo10=yes
8ada417f
ZW
4643 fi],
4644 [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
4645 [Define if your assembler supports offsetable %lo().])])
e8b141b5
DM
4646
4647 gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions],
4648 gcc_cv_as_sparc_fmaf,,
4649 [-xarch=v9d],
4650 [.text
26e2f443
DM
4651 .register %g2, #scratch
4652 .register %g3, #scratch
e8b141b5
DM
4653 .align 4
4654 fmaddd %f0, %f2, %f4, %f6
4655 addxccc %g1, %g2, %g3
4656 fsrl32 %f2, %f4, %f8
4657 fnaddd %f10, %f12, %f14],,
4658 [AC_DEFINE(HAVE_AS_FMAF_HPC_VIS3, 1,
4659 [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])])
8b98b5fd
DM
4660
4661 gcc_GAS_CHECK_FEATURE([SPARC4 instructions],
4662 gcc_cv_as_sparc_sparc4,,
4663 [-xarch=sparc4],
4664 [.text
4665 .register %g2, #scratch
4666 .register %g3, #scratch
4667 .align 4
4668 cxbe %g2, %g3, 1f
46691: cwbneg %g2, %g3, 1f
46701: sha1
4671 md5
4672 aes_kexpand0 %f4, %f6, %f8
4673 des_round %f38, %f40, %f42, %f44
4674 camellia_f %f54, %f56, %f58, %f60
4675 kasumi_fi_xor %f46, %f48, %f50, %f52],,
4676 [AC_DEFINE(HAVE_AS_SPARC4, 1,
4677 [Define if your assembler supports SPARC4 instructions.])])
1f65ae7a 4678
690f24b7
JM
4679 gcc_GAS_CHECK_FEATURE([SPARC5 and VIS 4.0 instructions],
4680 gcc_cv_as_sparc_sparc5,,
4681 [-xarch=sparc5],
4682 [.text
4683 .register %g2, #scratch
4684 .register %g3, #scratch
4685 .align 4
4686 subxc %g1, %g2, %g3
4687 fpadd8 %f0, %f2, %f4],,
4688 [AC_DEFINE(HAVE_AS_SPARC5_VIS4, 1,
4689 [Define if your assembler supports SPARC5 and VIS 4.0 instructions.])])
4690
bcc3c3f1
JM
4691 gcc_GAS_CHECK_FEATURE([SPARC6 instructions],
4692 gcc_cv_as_sparc_sparc6,,
4693 [-xarch=sparc6],
4694 [.text
4695 .register %g2, #scratch
4696 .register %g3, #scratch
4697 .align 4
4698 rd %entropy, %g1
4699 fpsll64x %f0, %f2, %f4],,
4700 [AC_DEFINE(HAVE_AS_SPARC6, 1,
4701 [Define if your assembler supports SPARC6 instructions.])])
4702
1f65ae7a
EB
4703 gcc_GAS_CHECK_FEATURE([LEON instructions],
4704 gcc_cv_as_sparc_leon,,
4705 [-Aleon],
4706 [.text
4707 .register %g2, #scratch
4708 .register %g3, #scratch
4709 .align 4
4710 smac %g2, %g3, %g1
4711 umac %g2, %g3, %g1
ba21a04a 4712 casa [[%g2]] 0xb, %g3, %g1],,
1f65ae7a
EB
4713 [AC_DEFINE(HAVE_AS_LEON, 1,
4714 [Define if your assembler supports LEON instructions.])])
1cb36a98
RH
4715 ;;
4716
4717changequote(,)dnl
c307e6dd 4718 i[34567]86-*-* | x86_64-*-*)
1cb36a98 4719changequote([,])dnl
f7e413e2
DK
4720 case $target_os in
4721 cygwin*)
4722 # Full C++ conformance when using a shared libstdc++-v3 requires some
4723 # support from the Cygwin DLL, which in more recent versions exports
4724 # wrappers to aid in interposing and redirecting operators new, delete,
4725 # etc., as per n2800 #17.6.4.6 [replacement.functions]. Check if we
4726 # are configuring for a version of Cygwin that exports the wrappers.
b802ae5c 4727 if test x$host = x$target && test x$host_cpu = xi686; then
f7e413e2
DK
4728 AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
4729 else
4730 # Can't check presence of libc functions during cross-compile, so
4731 # we just have to assume we're building for an up-to-date target.
4732 gcc_ac_cygwin_dll_wrappers=yes
4733 fi
4734 AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
4735 [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
4736 [Define if you want to generate code by default that assumes that the
4737 Cygwin DLL exports wrappers to support libstdc++ function replacement.])
4738 esac
d38bc601 4739 case $target_os in
ee2499b4 4740 cygwin* | pe | mingw32*)
233215fe
DK
4741 # Recent binutils allows the three-operand form of ".comm" on PE. This
4742 # definition is used unconditionally to initialise the default state of
4743 # the target option variable that governs usage of the feature.
4744 gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,
4745 [2,19,52],,[.comm foo,1,32])
4746 AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
4747 [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
4748 [Define if your assembler supports specifying the alignment
4749 of objects allocated using the GAS .comm command.])
d38bc601
BF
4750 # Used for DWARF 2 in PE
4751 gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
4752 gcc_cv_as_ix86_pe_secrel32,
4753 [2,15,91],,
4754[.text
4755foo: nop
4756.data
4757 .secrel32 foo],
4758 [if test x$gcc_cv_ld != x \
4759 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
4760 gcc_cv_as_ix86_pe_secrel32=yes
4761 fi
4762 rm -f conftest],
4763 [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
4764 [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
3bec79c5
DK
4765 # Test if the assembler supports the extended form of the .section
4766 # directive that specifies section alignment. LTO support uses this,
4767 # but normally only after installation, so we warn but don't fail the
4768 # configure if LTO is enabled but the assembler does not support it.
4769 gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align,
4770 [2,20,1],-fatal-warnings,[.section lto_test,"dr0"])
4771 if test x$gcc_cv_as_section_has_align != xyes; then
4772 case ",$enable_languages," in
4773 *,lto,*)
4774 AC_MSG_WARN([LTO for $target requires binutils >= 2.20.1, but version found appears insufficient; LTO will not work until binutils is upgraded.])
4775 ;;
4776 esac
4777 fi
d38bc601
BF
4778 ;;
4779 esac
743b8dd6
IS
4780 case $target_os in
4781 darwin2[[0-9]]* | darwin19*)
4782 gcc_GAS_CHECK_FEATURE([llvm assembler x86-pad-for-align option],
4783 gcc_cv_as_mllvm_x86_pad_for_align,,
4784 [-mllvm -x86-pad-for-align=false], [.text],,
4785 [AC_DEFINE(HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN, 1,
4786 [Define if your Mac OS X assembler supports -mllvm -x86-pad-for-align=false.])])
4787 ;;
4788 esac
d38bc601 4789
8c2e5ecf
RO
4790 gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,,
4791 [-xbrace_comment=no], [.text],,
4792 [AC_DEFINE(HAVE_AS_XBRACE_COMMENT_OPTION, 1,
4793 [Define if your assembler supports -xbrace_comment option.])])
4794
8ada417f 4795 gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
a3a5e3d1 4796 gcc_cv_as_ix86_filds,,,
005f915e 4797 [filds (%ebp); fists (%ebp)],,
a3a5e3d1
UB
4798 [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
4799 [Define if your assembler uses filds and fists mnemonics.])])
4800
4801 gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
4802 gcc_cv_as_ix86_fildq,,,
005f915e 4803 [fildq (%ebp); fistpq (%ebp)],,
a3a5e3d1
UB
4804 [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
4805 [Define if your assembler uses fildq and fistq mnemonics.])])
8ada417f 4806
f6f5dff2
RO
4807 gcc_GAS_CHECK_FEATURE([cmov syntax],
4808 gcc_cv_as_ix86_cmov_sun_syntax,,,
4809 [cmovl.l %edx, %eax],,
4810 [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
4811 [Define if your assembler supports the Sun syntax for cmov.])])
4812
b6c03bcd
RS
4813 gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
4814 gcc_cv_as_ix86_ffreep,,,
4815 [ffreep %st(1)],,
4816 [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
4817 [Define if your assembler supports the ffreep mnemonic.])])
4818
ed104137
RO
4819 gcc_GAS_CHECK_FEATURE([.quad directive],
4820 gcc_cv_as_ix86_quad,,,
4821 [.quad 0],,
4822 [AC_DEFINE(HAVE_AS_IX86_QUAD, 1,
4823 [Define if your assembler supports the .quad directive.])])
4824
38ca3765
UB
4825 gcc_GAS_CHECK_FEATURE([sahf mnemonic],
4826 gcc_cv_as_ix86_sahf,,,
953c29f7
UB
4827 [.code64
4828 sahf],,
38ca3765 4829 [AC_DEFINE(HAVE_AS_IX86_SAHF, 1,
953c29f7 4830 [Define if your assembler supports the sahf mnemonic in 64bit mode.])])
38ca3765 4831
fe04878d
UB
4832 gcc_GAS_CHECK_FEATURE([interunit movq mnemonic],
4833 gcc_cv_as_ix86_interunit_movq,,,
4834 [.code64
4835 movq %mm0, %rax
13a26a7d
UB
4836 movq %rax, %xmm0])
4837 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ,
4838 [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`],
4839 [Define if your assembler supports interunit movq mnemonic.])
fe04878d 4840
5dcfdccd
KY
4841 gcc_GAS_CHECK_FEATURE([hle prefixes],
4842 gcc_cv_as_ix86_hle,,,
54af4523 4843 [lock xacquire cmpxchg %esi, (%ecx)],,
5dcfdccd
KY
4844 [AC_DEFINE(HAVE_AS_IX86_HLE, 1,
4845 [Define if your assembler supports HLE prefixes.])])
4846
afd2c302
SD
4847 gcc_GAS_CHECK_FEATURE([swap suffix],
4848 gcc_cv_as_ix86_swap,,,
4849 [movl.s %esp, %ebp],,
4850 [AC_DEFINE(HAVE_AS_IX86_SWAP, 1,
4851 [Define if your assembler supports the swap suffix.])])
4852
68b92f78
RS
4853 gcc_GAS_CHECK_FEATURE([different section symbol subtraction],
4854 gcc_cv_as_ix86_diff_sect_delta,,,
4855 [.section .rodata
4856.L1:
4857 .long .L2-.L1
4858 .long .L3-.L1
4859 .text
4860.L3: nop
4861.L2: nop],,
4862 [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1,
4863 [Define if your assembler supports the subtraction of symbols in different sections.])])
4864
2433310d
RO
4865 gcc_GAS_CHECK_FEATURE([rep and lock prefix],
4866 gcc_cv_as_ix86_rep_lock_prefix,,,
4867 [rep movsl
43283548
UB
4868 rep ret
4869 rep nop
4870 rep bsf %ecx, %eax
4871 rep bsr %ecx, %eax
4bade865 4872 lock addl %edi, (%eax,%esi)
7085bfb6
UB
4873 lock orl $0, (%esp)],,
4874 [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1,
4875 [Define if the assembler supports 'rep <insn>, lock <insn>'.])])
2433310d 4876
88f7c49a
RM
4877 gcc_GAS_CHECK_FEATURE([ud2 mnemonic],
4878 gcc_cv_as_ix86_ud2,,,
4879 [ud2],,
4880 [AC_DEFINE(HAVE_AS_IX86_UD2, 1,
4881 [Define if your assembler supports the 'ud2' mnemonic.])])
4882
e1ebd31d
UB
4883 # Enforce 32-bit output with gas and gld.
4884 if test x$gas = xyes; then
4885 as_ix86_gas_32_opt="--32"
4886 fi
4887 if echo "$ld_ver" | grep GNU > /dev/null; then
4888 if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
4889 ld_ix86_gld_32_opt="-melf_i386_sol2"
4890 else
4891 ld_ix86_gld_32_opt="-melf_i386"
4892 fi
4893 fi
4894
8950516e 4895 gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
e1ebd31d
UB
4896 gcc_cv_as_ix86_tlsgdplt,,
4897 [$as_ix86_gas_32_opt],
0f24748c
RO
4898 [call tls_gd@tlsgdplt],
4899 [if test x$gcc_cv_ld != x \
e1ebd31d 4900 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then
0f24748c
RO
4901 gcc_cv_as_ix86_tlsgdplt=yes
4902 fi
4903 rm -f conftest],
8950516e 4904 [AC_DEFINE(HAVE_AS_IX86_TLSGDPLT, 1,
0f24748c 4905 [Define if your assembler and linker support @tlsgdplt.])])
8950516e 4906
040c446d
RO
4907 conftest_s='
4908 .section .tdata,"aw'$tls_section_flag'",@progbits
4909tls_ld:
4910 .section .text,"ax",@progbits
4911 call tls_ld@tlsldmplt'
e1ebd31d 4912
8950516e 4913 gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc],
e1ebd31d
UB
4914 gcc_cv_as_ix86_tlsldmplt,,
4915 [$as_ix86_gas_32_opt],
040c446d 4916 [$conftest_s],
0f24748c 4917 [if test x$gcc_cv_ld != x \
e1ebd31d 4918 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then
0f24748c
RO
4919 gcc_cv_as_ix86_tlsldmplt=yes
4920 fi
caa16d41
RO
4921 rm -f conftest])
4922 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT,
4923 [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`],
4924 [Define to 1 if your assembler and linker support @tlsldmplt.])
4925
caa16d41
RO
4926 conftest_s='
4927 .section .text,"ax",@progbits
4928 .globl _start
4929 .type _start, @function
4930_start:
4931 leal value@tlsldm(%ebx), %eax
4932 call ___tls_get_addr@plt
4933
4934 .section .tdata,"aw'$tls_section_flag'",@progbits
4935 .type value, @object
4936value:'
4937 gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc],
4938 gcc_cv_as_ix86_tlsldm,,
49677530 4939 [$as_ix86_gas_32_opt],
caa16d41
RO
4940 [$conftest_s],
4941 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
49677530 4942 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then
caa16d41
RO
4943 if $gcc_cv_objdump -d conftest 2>/dev/null | grep nop > /dev/null \
4944 || dis conftest 2>/dev/null | grep nop > /dev/null; then
4945 gcc_cv_as_ix86_tlsldm=yes
4946 fi
4947 fi
4948 rm -f conftest])
4949 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDM,
4950 [`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`],
4951 [Define to 1 if your assembler and linker support @tlsldm.])
8950516e 4952
c0597759
L
4953 conftest_s='
4954 .data
4955bar:
4956 .byte 1
4957 .text
4958 .global _start
4959_start:
4960 cmpl $0, bar@GOT
4961 jmp *_start@GOT'
4962 gcc_GAS_CHECK_FEATURE([R_386_GOT32X reloc],
4963 gcc_cv_as_ix86_got32x,,
49677530 4964 [$as_ix86_gas_32_opt],
c0597759
L
4965 [$conftest_s],
4966 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
4967 && test x$gcc_cv_readelf != x \
4968 && $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
4969 | grep R_386_GOT32X > /dev/null 2>&1 \
49677530 4970 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then
c0597759
L
4971 if $gcc_cv_objdump -dw conftest 2>&1 \
4972 | grep 0xffffff > /dev/null 2>&1; then
4973 gcc_cv_as_ix86_got32x=no
4974 else
4975 gcc_cv_as_ix86_got32x=yes
4976 fi
4977 fi
4978 rm -f conftest])
4979 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_GOT32X,
4980 [`if test x"$gcc_cv_as_ix86_got32x" = xyes; then echo 1; else echo 0; fi`],
4981 [Define 0/1 if your assembler and linker support @GOT.])
e1ebd31d
UB
4982
4983 gcc_GAS_CHECK_FEATURE([GOTOFF in data],
4984 gcc_cv_as_ix86_gotoff_in_data, [2,11,0],
4985 [$as_ix86_gas_32_opt],
4986[ .text
4987.L0:
4988 nop
4989 .data
4990 .long .L0@GOTOFF])
4991 AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
4992 [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
4993 [Define true if the assembler supports '.long foo@GOTOFF'.])
4994
de86ff8f
L
4995 conftest_s='
4996 .section .text,"ax",@progbits
4997 .globl _start
4998 .type _start, @function
4999_start:
5000 leal ld@tlsldm(%ecx), %eax
5001 call *___tls_get_addr@GOT(%ecx)
5002 leal gd@tlsgd(%ecx), %eax
5003 call *___tls_get_addr@GOT(%ecx)
5004
5005 .section .tdata,"aw'$tls_section_flag'",@progbits
5006 .type ld, @object
5007ld:
5008 .byte 0
5009 .globl gd
5010 .type gd, @object
5011gd:
5012 .byte 0'
5013 gcc_GAS_CHECK_FEATURE([calling ___tls_get_addr via GOT],
5014 gcc_cv_as_ix86_tls_get_addr_via_got,,
5015 [$as_ix86_gas_32_opt],
5016 [$conftest_s],
5017 [if test x$gcc_cv_ld != x \
5018 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then
5019 gcc_cv_as_ix86_tls_get_addr_via_got=yes
5020 fi
5021 rm -f conftest])
5022 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLS_GET_ADDR_GOT,
5023 [`if test x"$gcc_cv_as_ix86_tls_get_addr_via_got" = xyes; then echo 1; else echo 0; fi`],
5024 [Define 0/1 if your assembler and linker support calling ___tls_get_addr via GOT.])
1cb36a98 5025 ;;
ef1ecf87
RH
5026
5027 ia64*-*-*)
8ada417f
ZW
5028 gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
5029 gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
cfa9ee99 5030[ .text
ef1ecf87
RH
5031 addl r15 = @ltoffx(x#), gp
5032 ;;
d8b3b4f4
JM
5033 ld8.mov r16 = [[r15]], x#
5034],,
8ada417f
ZW
5035 [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
5036 [Define if your assembler supports ltoffx and ldxmov relocations.])])
5037
ef1ecf87 5038 ;;
8ada417f 5039
2c4a9cff 5040 powerpc*-*-*)
4b7a5264 5041
8ada417f 5042 case $target in
8af4d362
PB
5043 *-*-darwin*)
5044 gcc_GAS_CHECK_FEATURE([.machine directive support],
5045 gcc_cv_as_machine_directive,,,
5046 [ .machine ppc7400])
5047 if test x$gcc_cv_as_machine_directive != xyes; then
5048 echo "*** This target requires an assembler supporting \".machine\"" >&2
aeebd94c 5049 echo you can get it from: https://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
8af4d362
PB
5050 test x$build = x$target && exit 1
5051 fi
4b7a5264
DE
5052 ;;
5053 esac
5054
5055 case $target in
5056 *-*-aix*) conftest_s=' .machine "pwr5"
5057 .csect .text[[PR]]
5058 mfcr 3,128';;
5059 *-*-darwin*) conftest_s=' .text
6b37db3c 5060 mfcr r3,128';;
4c67db14 5061 *) conftest_s=' .machine power4
d2ab3e37 5062 .text
6b37db3c 5063 mfcr 3,128';;
8ada417f 5064 esac
8ada417f
ZW
5065
5066 gcc_GAS_CHECK_FEATURE([mfcr field support],
5067 gcc_cv_as_powerpc_mfcrf, [2,14,0],,
5068 [$conftest_s],,
5069 [AC_DEFINE(HAVE_AS_MFCRF, 1,
5070 [Define if your assembler supports mfcr field.])])
432218ba 5071
7f970b70
AM
5072 case $target in
5073 *-*-aix*) conftest_s=' .csect .text[[PR]]
5074LCF..0:
5075 addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
5076 *-*-darwin*)
5077 conftest_s=' .text
5078LCF0:
5079 addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
5080 *) conftest_s=' .text
5081.LCF0:
5082 addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
5083 esac
5084
695d8830
AS
5085 gcc_GAS_CHECK_FEATURE([rel16 relocs],
5086 gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
5087 [$conftest_s],,
5088 [AC_DEFINE(HAVE_AS_REL16, 1,
5089 [Define if your assembler supports R_PPC_REL16 relocs.])])
5090
d40c9e33
PB
5091 case $target in
5092 *-*-aix*) conftest_s=' .machine "pwr7"
5093 .csect .text[[PR]]
5094 lxvd2x 1,2,3';;
5095 *) conftest_s=' .machine power7
5096 .text
5097 lxvd2x 1,2,3';;
5098 esac
5099
5100 gcc_GAS_CHECK_FEATURE([vector-scalar support],
cacf1ca8 5101 gcc_cv_as_powerpc_vsx, [2,19,2], -a32,
d40c9e33
PB
5102 [$conftest_s],,
5103 [AC_DEFINE(HAVE_AS_VSX, 1,
5104 [Define if your assembler supports VSX instructions.])])
5105
e51917ae
JM
5106 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5107 gcc_cv_as_powerpc_gnu_attribute, [2,18,0],,
5108 [.gnu_attribute 4,1],,
5109 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5110 [Define if your assembler supports .gnu_attribute.])])
9752c4ad 5111
157bb85d
UW
5112 gcc_GAS_CHECK_FEATURE([prologue entry point marker support],
5113 gcc_cv_as_powerpc_entry_markers, [2,26,0],-a64 --fatal-warnings,
5114 [ .reloc .,R_PPC64_ENTRY; nop],,
5115 [AC_DEFINE(HAVE_AS_ENTRY_MARKERS, 1,
5116 [Define if your assembler supports the R_PPC64_ENTRY relocation.])])
5117
3f79c0ad
AM
5118 gcc_GAS_CHECK_FEATURE([plt sequence marker support],
5119 gcc_cv_as_powerpc_pltseq_markers, [2,31,0],-a32 --fatal-warnings,
5120 [ .reloc .,R_PPC_PLTSEQ; nop],,
5121 [AC_DEFINE(HAVE_AS_PLTSEQ, 1,
5122 [Define if your assembler supports R_PPC*_PLTSEQ relocations.])])
5123
636cf8b1
RS
5124 case $target in
5125 *-*-aix*)
a52f938b 5126 gcc_GAS_CHECK_FEATURE([AIX .ref support],
e8548a47 5127 gcc_cv_as_aix_ref, [2,21,0],,
636cf8b1
RS
5128 [ .csect stuff[[rw]]
5129 stuff:
5130 .long 1
5131 .extern sym
5132 .ref sym
5133 ],,
5134 [AC_DEFINE(HAVE_AS_REF, 1,
5135 [Define if your assembler supports .ref])])
53b5ce19 5136
a52f938b 5137 gcc_GAS_CHECK_FEATURE([AIX DWARF location lists section support],
51fbbb92 5138 gcc_cv_as_aix_dwloc, [2,21,0],,
a52f938b
DE
5139 [ .dwsect 0xA0000
5140 Lframe..0:
eb657a49 5141 .vbyte 4,Lframe..0
51fbbb92
DE
5142 ],,
5143 [AC_DEFINE(HAVE_XCOFF_DWARF_EXTRAS, 1,
a52f938b 5144 [Define if your assembler supports AIX debug frame section label reference.])])
51fbbb92
DE
5145 ;;
5146 esac
5147 ;;
5148
8ada417f
ZW
5149 mips*-*-*)
5150 gcc_GAS_CHECK_FEATURE([explicit relocation support],
5151 gcc_cv_as_mips_explicit_relocs, [2,14,0],,
5152[ lw $4,%gp_rel(foo)($4)],,
5153 [if test x$target_cpu_default = x
5154 then target_cpu_default=MASK_EXPLICIT_RELOCS
5155 else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
5156 fi])
51fbbb92 5157
4551169f
RS
5158 gcc_GAS_CHECK_FEATURE([-mno-shared support],
5159 gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],,
5160 [AC_DEFINE(HAVE_AS_NO_SHARED, 1,
5161 [Define if the assembler understands -mno-shared.])])
dcb957d9
JM
5162
5163 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5164 gcc_cv_as_mips_gnu_attribute, [2,18,0],,
5165 [.gnu_attribute 4,1],,
5166 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5167 [Define if your assembler supports .gnu_attribute.])])
a44380d2 5168
050af144 5169 gcc_GAS_CHECK_FEATURE([.module support],
a871c139
MF
5170 gcc_cv_as_mips_dot_module,,[-32],
5171 [.module mips2
5172 .module fp=xx],,
050af144
MF
5173 [AC_DEFINE(HAVE_AS_DOT_MODULE, 1,
5174 [Define if your assembler supports .module.])])
5175 if test x$gcc_cv_as_mips_dot_module = xno \
5176 && test x$with_fp_32 != x; then
5177 AC_MSG_ERROR(
5178 [Requesting --with-fp-32= requires assembler support for .module.])
5179 fi
5180
22c4c869 5181 gcc_GAS_CHECK_FEATURE([.micromips support],
b1485a33 5182 gcc_cv_as_micromips_support,,[--fatal-warnings],
22c4c869
CM
5183 [.set micromips],,
5184 [AC_DEFINE(HAVE_GAS_MICROMIPS, 1,
5185 [Define if your assembler supports the .set micromips directive])])
5186
a44380d2
JM
5187 gcc_GAS_CHECK_FEATURE([.dtprelword support],
5188 gcc_cv_as_mips_dtprelword, [2,18,0],,
5189 [.section .tdata,"awT",@progbits
5190x:
5191 .word 2
5192 .text
5193 .dtprelword x+0x8000],,
5194 [AC_DEFINE(HAVE_AS_DTPRELWORD, 1,
5195 [Define if your assembler supports .dtprelword.])])
b53da244 5196
293b77b0
CF
5197 gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support],
5198 gcc_cv_as_mips_dspr1_mult,,,
5199[ .set mips32r2
5200 .set nodspr2
5201 .set dsp
5202 madd $ac3,$4,$5
5203 maddu $ac3,$4,$5
5204 msub $ac3,$4,$5
5205 msubu $ac3,$4,$5
5206 mult $ac3,$4,$5
5207 multu $ac3,$4,$5],,
5208 [AC_DEFINE(HAVE_AS_DSPR1_MULT, 1,
5209 [Define if your assembler supports DSPR1 mult.])])
5210
b53da244
AN
5211 AC_MSG_CHECKING(assembler and linker for explicit JALR relocation)
5212 gcc_cv_as_ld_jalr_reloc=no
5213 if test $gcc_cv_as_mips_explicit_relocs = yes; then
5214 if test $in_tree_ld = yes ; then
5215 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 20 -o "$gcc_cv_gld_major_version" -gt 2 \
5216 && test $in_tree_ld_is_elf = yes; then
5217 gcc_cv_as_ld_jalr_reloc=yes
5218 fi
5219 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then
5220 echo ' .ent x' > conftest.s
1e1f96b5
CM
5221 echo 'x: lw $2,%got_disp(y)($3)' >> conftest.s
5222 echo ' lw $25,%call16(y)($28)' >> conftest.s
b53da244
AN
5223 echo ' .reloc 1f,R_MIPS_JALR,y' >> conftest.s
5224 echo '1: jalr $25' >> conftest.s
5225 echo ' .reloc 1f,R_MIPS_JALR,x' >> conftest.s
5226 echo '1: jalr $25' >> conftest.s
5227 echo ' .end x' >> conftest.s
5228 if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \
5229 && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then
bc492e47
RO
5230 if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null 2>&1 \
5231 && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null 2>&1; then
b53da244
AN
5232 gcc_cv_as_ld_jalr_reloc=yes
5233 fi
5234 fi
5235 rm -f conftest.*
5236 fi
5237 fi
5238 if test $gcc_cv_as_ld_jalr_reloc = yes; then
5239 if test x$target_cpu_default = x; then
5240 target_cpu_default=MASK_RELAX_PIC_CALLS
5241 else
5242 target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
5243 fi
5244 fi
5245 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
49576e25
RS
5246
5247 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
5248 [gcc_cv_ld_mips_personality_relaxation],
5249 [gcc_cv_ld_mips_personality_relaxation=no
5250 if test $in_tree_ld = yes ; then
5251 if test "$gcc_cv_gld_major_version" -eq 2 \
5252 -a "$gcc_cv_gld_minor_version" -ge 21 \
5253 -o "$gcc_cv_gld_major_version" -gt 2; then
5254 gcc_cv_ld_mips_personality_relaxation=yes
5255 fi
5256 elif test x$gcc_cv_as != x \
5257 -a x$gcc_cv_ld != x \
5258 -a x$gcc_cv_readelf != x ; then
5259 cat > conftest.s <<EOF
5260 .cfi_startproc
5261 .cfi_personality 0x80,indirect_ptr
5262 .ent test
5263test:
5264 nop
5265 .end test
5266 .cfi_endproc
5267
5268 .section .data,"aw",@progbits
5269indirect_ptr:
5270 .dc.a personality
5271EOF
5272 if $gcc_cv_as -KPIC -o conftest.o conftest.s > /dev/null 2>&1 \
5273 && $gcc_cv_ld -o conftest conftest.o -shared > /dev/null 2>&1; then
5274 if $gcc_cv_readelf -d conftest 2>&1 \
5275 | grep TEXTREL > /dev/null 2>&1; then
5276 :
5277 elif $gcc_cv_readelf --relocs conftest 2>&1 \
5278 | grep 'R_MIPS_REL32 *$' > /dev/null 2>&1; then
5279 :
5280 else
5281 gcc_cv_ld_mips_personality_relaxation=yes
5282 fi
5283 fi
5284 fi
5285 rm -f conftest.s conftest.o conftest])
5286 if test x$gcc_cv_ld_mips_personality_relaxation = xyes; then
5287 AC_DEFINE(HAVE_LD_PERSONALITY_RELAXATION, 1,
5288 [Define if your linker can relax absolute .eh_frame personality
5289pointers into PC-relative form.])
5290 fi
ff3f3951
MR
5291
5292 gcc_GAS_CHECK_FEATURE([-mnan= support],
5293 gcc_cv_as_mips_nan,,
5294 [-mnan=2008],,,
5295 [AC_DEFINE(HAVE_AS_NAN, 1,
5296 [Define if the assembler understands -mnan=.])])
5297 if test x$gcc_cv_as_mips_nan = xno \
5298 && test x$with_nan != x; then
5299 AC_MSG_ERROR(
5300 [Requesting --with-nan= requires assembler support for -mnan=])
5301 fi
dbad5e72 5302 ;;
8682b1a5
JL
5303 msp430-*-*)
5304 # Earlier GAS versions generically support .gnu_attribute, but the
5305 # msp430 assembler will not do anything with it.
5306 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5307 gcc_cv_as_msp430_gnu_attribute, [2,33,50],,
5308 [.gnu_attribute 4,1],,
5309 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5310 [Define if your assembler supports .gnu_attribute.])])
5311 gcc_GAS_CHECK_FEATURE([.mspabi_attribute support],
5312 gcc_cv_as_msp430_mspabi_attribute, [2,33,50],,
b75863a8 5313 [.mspabi_attribute 4,2],,
8682b1a5
JL
5314 [AC_DEFINE(HAVE_AS_MSPABI_ATTRIBUTE, 1,
5315 [Define if your assembler supports .mspabi_attribute.])])
02afb6a9
JL
5316 if test x$enable_newlib_nano_formatted_io = xyes; then
5317 AC_DEFINE(HAVE_NEWLIB_NANO_FORMATTED_IO, 1, [Define if GCC has been
5318configured with --enable-newlib-nano-formatted-io.])
5319 fi
8682b1a5 5320 ;;
2d33dcfe
SL
5321 nios2-*-*)
5322 # Versions 2.33 and earlier lacked support for the %gotoff relocation
5323 # syntax that is documented in the ABI specification.
5324 gcc_GAS_CHECK_FEATURE([support for %gotoff relocations in constant data],
5325 gcc_cv_as_nios2_gotoff_relocation,,,
5326[ .extern foo
5327 .data
5328 .long %gotoff(foo)],,
5329 [AC_DEFINE(HAVE_AS_NIOS2_GOTOFF_RELOCATION, 1,
5330 [Define if your assembler supports %gotoff relocation syntax.])])
5331 ;;
8e966210
KC
5332 riscv*-*-*)
5333 gcc_GAS_CHECK_FEATURE([.attribute support],
5334 gcc_cv_as_riscv_attribute, [2,32,0],,
5335 [.attribute stack_align,4],,
5336 [AC_DEFINE(HAVE_AS_RISCV_ATTRIBUTE, 1,
5337 [Define if your assembler supports .attribute.])])
4b815282
KC
5338 gcc_GAS_CHECK_FEATURE([-misa-spec= support],
5339 gcc_cv_as_riscv_isa_spec,,
5340 [-misa-spec=2.2],,,
5341 [AC_DEFINE(HAVE_AS_MISA_SPEC, 1,
5342 [Define if the assembler understands -misa-spec=.])])
5343 gcc_GAS_CHECK_FEATURE([-march=rv32i_zifencei support],
5344 gcc_cv_as_riscv_march_zifencei,,
5345 [-march=rv32i_zifencei],,,
5346 [AC_DEFINE(HAVE_AS_MARCH_ZIFENCEI, 1,
5347 [Define if the assembler understands -march=rv*_zifencei.])])
8e966210 5348 ;;
45901378
AK
5349 s390*-*-*)
5350 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5351 gcc_cv_as_s390_gnu_attribute, [2,18,0],,
5352 [.gnu_attribute 8,1],,
5353 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5354 [Define if your assembler supports .gnu_attribute.])])
ec47b086
DV
5355 gcc_GAS_CHECK_FEATURE([.machine and .machinemode support],
5356 gcc_cv_as_s390_machine_machinemode, [2,24,0],,
5357 [ .machinemode push
5358 .machinemode pop
5359 .machine push
5360 .machine pop],,
5361 [AC_DEFINE(HAVE_AS_MACHINE_MACHINEMODE, 1,
5362 [Define if your assembler supports .machine and .machinemode.])])
5363 gcc_GAS_CHECK_FEATURE([architecture modifiers support],
5364 gcc_cv_as_s390_architecture_modifiers, [2,26,0],,
5365 [ .machine z13+vx ],,
5366 [AC_DEFINE(HAVE_AS_ARCHITECTURE_MODIFIERS, 1,
5367 [Define if your assembler supports architecture modifiers.])])
b8923037
AK
5368 gcc_GAS_CHECK_FEATURE([vector load/store alignment hints],
5369 gcc_cv_as_s390_vector_loadstore_alignment_hints, [2,31,0],,
5370 [ vl %v24,0(%r15),3 ],,
5371 [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS, 1,
5372 [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument.])])
929fd91b
SSF
5373 gcc_GAS_CHECK_FEATURE([vector load/store alignment hints on z13],
5374 gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13,, [-mzarch -march=z13],
5375 [ vl %v24,0(%r15),3 ],,
5376 [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13, 1,
5377 [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument on z13.])])
b8923037 5378
45901378 5379 ;;
dbad5e72
SE
5380esac
5381
5382# Mips and HP-UX need the GNU assembler.
5383# Linux on IA64 might be able to use the Intel assembler.
8ada417f 5384
dbad5e72
SE
5385case "$target" in
5386 mips*-*-* | *-*-hpux* )
82563d35
RS
5387 if test x$gas_flag = xyes \
5388 || test x"$host" != x"$build" \
5389 || test ! -x "$gcc_cv_as" \
5390 || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
5391 :
5392 else
5393 echo "*** This configuration requires the GNU assembler" >&2
5394 exit 1
5395 fi
8ada417f
ZW
5396 ;;
5397esac
dbad5e72 5398
cfa1f822
MV
5399# This tests if the assembler supports two registers for global_load functions
5400# (like in LLVM versions <12) or one register (like in LLVM 12).
5401case "$target" in
5402 amdgcn-* | gcn-*)
5403 AC_MSG_CHECKING(assembler fix for global_load functions)
5404 gcc_cv_as_gcn_global_load_fixed=yes
5405 if test x$gcc_cv_as != x; then
5406 cat > conftest.s <<EOF
5407 global_store_dwordx2 v[[1:2]], v[[4:5]], s[[14:15]]
5408EOF
5409 if $gcc_cv_as -triple=amdgcn--amdhsa -filetype=obj -mcpu=gfx900 -o conftest.o conftest.s > /dev/null 2>&1; then
5410 gcc_cv_as_gcn_global_load_fixed=no
5411 fi
5412 rm -f conftest.s conftest.o conftest
5413 fi
5414 global_load_fixed=`if test x$gcc_cv_as_gcn_global_load_fixed = xyes; then echo 1; else echo 0; fi`
5415 AC_DEFINE_UNQUOTED(HAVE_GCN_ASM_GLOBAL_LOAD_FIXED, $global_load_fixed,
5416 [Define if your assembler has fixed global_load functions.])
5417 AC_MSG_RESULT($gcc_cv_as_gcn_global_load_fixed)
5418 ;;
5419esac
5420
1af16666
AS
5421case "$target" in
5422 amdgcn-* | gcn-*)
5423 gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+sram-ecc for fiji],
5424 gcc_cv_as_gcn_sram_ecc_fiji,,
5425 [-triple=amdgcn--amdhsa -mcpu=fiji -mattr=-xnack -mattr=+sram-ecc],
5426 [.amdgcn_target "amdgcn-unknown-amdhsa--gfx803+sram-ecc"],,
5427 [AC_DEFINE(HAVE_GCN_SRAM_ECC_FIJI, 1,
5428 [Define if your assembler allows -mattr=+sram-ecc for fiji.])])
5429 gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+sram-ecc for gfx900],
5430 gcc_cv_as_gcn_sram_ecc_gfx900,,
5431 [-triple=amdgcn--amdhsa -mcpu=gfx900 -mattr=-xnack -mattr=+sram-ecc],
5432 [.amdgcn_target "amdgcn-unknown-amdhsa--gfx900+sram-ecc"],,
5433 [AC_DEFINE(HAVE_GCN_SRAM_ECC_GFX900, 1,
5434 [Define if your assembler allows -mattr=+sram-ecc for gfx900.])])
5435 gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+sram-ecc for gfx906],
5436 gcc_cv_as_gcn_sram_ecc_gfx906,,
5437 [-triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=-xnack -mattr=+sram-ecc],
5438 [.amdgcn_target "amdgcn-unknown-amdhsa--gfx906+sram-ecc"],,
5439 [AC_DEFINE(HAVE_GCN_SRAM_ECC_GFX906, 1,
5440 [Define if your assembler allows -mattr=+sram-ecc for gfx906.])])
5441 gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+sram-ecc for gfx908],
5442 gcc_cv_as_gcn_sram_ecc_gfx908,,
5443 [-triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=-xnack -mattr=+sram-ecc],
5444 [.amdgcn_target "amdgcn-unknown-amdhsa--gfx908+sram-ecc"],,
5445 [AC_DEFINE(HAVE_GCN_SRAM_ECC_GFX908, 1,
5446 [Define if your assembler allows -mattr=+sram-ecc for gfx908.])])
5447 ;;
5448esac
5449
9d147085
RH
5450# ??? Not all targets support dwarf2 debug_line, even within a version
5451# of gas. Moreover, we need to emit a valid instruction to trigger any
5452# info to the output file. So, as supported targets are added to gas 2.11,
5453# add some instruction here to (also) show we expect this might work.
5454# ??? Once 2.11 is released, probably need to add first known working
5455# version to the per-target configury.
7fa2619a 5456case "$cpu_type" in
56856b58 5457 aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | m32c | m68k \
2f2aeda9 5458 | microblaze | mips | nds32 | nios2 | pa | riscv | rs6000 | score | sparc \
7c22e690 5459 | tilegx | tilepro | visium | xstormy16 | xtensa)
9d147085
RH
5460 insn="nop"
5461 ;;
7fa2619a 5462 ia64 | s390)
9d147085
RH
5463 insn="nop 0"
5464 ;;
7fa2619a 5465 mmix)
2853bc5a
HPN
5466 insn="swym 0"
5467 ;;
8ada417f
ZW
5468esac
5469if test x"$insn" != x; then
5470 conftest_s="\
5471 .file 1 \"conftest.s\"
5472 .loc 1 3 0
5473 $insn"
5474 gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
5475 gcc_cv_as_dwarf2_debug_line,
5476 [elf,2,11,0],, [$conftest_s],
080a5bb0
EB
5477 [if test x$gcc_cv_objdump != x \
5478 && $gcc_cv_objdump -h conftest.o 2> /dev/null \
5479 | grep debug_line > /dev/null 2>&1; then
8ada417f 5480 gcc_cv_as_dwarf2_debug_line=yes
f1b2727f
IS
5481 elif test x$gcc_cv_otool != x \
5482 && $gcc_cv_otool -l conftest.o 2> /dev/null \
5483 | grep debug_line > /dev/null 2>&1; then
5484 gcc_cv_as_dwarf2_debug_line=yes
8ada417f
ZW
5485 fi])
5486
5487# The .debug_line file table must be in the exact order that
5488# we specified the files, since these indices are also used
5489# by DW_AT_decl_file. Approximate this test by testing if
5490# the assembler bitches if the same index is assigned twice.
5491 gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
5492 gcc_cv_as_dwarf2_file_buggy,,,
5493[ .file 1 "foo.s"
5494 .file 1 "bar.s"])
5495
5496 if test $gcc_cv_as_dwarf2_debug_line = yes \
5497 && test $gcc_cv_as_dwarf2_file_buggy = no; then
bd2b9f1e 5498 AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
8ada417f 5499 [Define if your assembler supports dwarf2 .file/.loc directives,
eaec9b3d 5500 and preserves file table indices exactly as given.])
bd2b9f1e
AO
5501
5502 if test $gcc_cv_as_leb128 = yes; then
5503 conftest_s="\
5504 .file 1 \"conftest.s\"
5505 .loc 1 3 0 view .LVU1
5506 $insn
5507 .data
5508 .uleb128 .LVU1
5509 .uleb128 .LVU1
5510"
5511 gcc_GAS_CHECK_FEATURE([dwarf2 debug_view support],
5512 gcc_cv_as_dwarf2_debug_view,
5513 [elf,2,27,0],,[$conftest_s],,
5514 [AC_DEFINE(HAVE_AS_DWARF2_DEBUG_VIEW, 1,
5515 [Define if your assembler supports views in dwarf2 .loc directives.])])
5516 fi
8ada417f
ZW
5517 fi
5518
5519 gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
5520 gcc_cv_as_gdwarf2_flag,
5521 [elf,2,11,0], [--gdwarf2], [$insn],,
5522 [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
5523[Define if your assembler supports the --gdwarf2 option.])])
5524
6923255e
JJ
5525 gcc_GAS_CHECK_FEATURE([--gdwarf-5 option],
5526 gcc_cv_as_gdwarf_5_flag,
fe5cb7f9 5527 [elf,2,36,0], [--gdwarf-5], [$insn],
aca12136
EB
5528 [if test x$gcc_cv_objdump != x \
5529 && $gcc_cv_objdump -Wi conftest.o 2>&1 \
fe5cb7f9
JJ
5530 | grep DW_TAG_compile_unit > /dev/null 2>&1; then
5531 gcc_cv_as_gdwarf_5_flag=yes;
5532 fi],[AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1,
6923255e
JJ
5533[Define if your assembler supports the --gdwarf-5 option.])])
5534
aca12136
EB
5535 case $target_os in
5536 win32 | pe | cygwin* | mingw32*)
5537 section_flags=\"dr\"
5538 function_type=".def foo; .scl 2; .type 32; .endef"
5539 function_size="";;
5540 *)
5541 section_flags=\"\",%progbits
5542 function_type=".type foo, %function"
5543 function_size=".size foo, .-foo";;
5544 esac
6923255e
JJ
5545 dwarf4_debug_info_size=0x46
5546 dwarf4_high_pc_form=7
5547 dwarf4_debug_aranges_size=0x2c
5548 dwarf4_line_sz=9
5549 for dwarf4_addr_size in 8 4; do
5550 conftest_s="\
5551 .file \"a.c\"
5552 .text
5553.Ltext0:
5554 .p2align 4
5555 .globl foo
aca12136 5556 $function_type
6923255e
JJ
5557foo:
5558.LFB0:
5559.LM1:
5560 $insn
5561.LM2:
5562.LFE0:
aca12136 5563 $function_size
6923255e 5564.Letext0:
aca12136 5565 .section .debug_info,$section_flags
6923255e
JJ
5566.Ldebug_info0:
5567 .4byte $dwarf4_debug_info_size
5568 .2byte 0x4
5569 .4byte .Ldebug_abbrev0
5570 .byte 0x$dwarf4_addr_size
5571 .byte 0x1
5572 .ascii \"GNU C17\\0\"
5573 .byte 0xc
5574 .ascii \"a.c\\0\"
5575 .ascii \"/\\0\"
5576 .${dwarf4_addr_size}byte .Ltext0
5577 .${dwarf4_addr_size}byte .Letext0-.Ltext0
5578 .4byte .Ldebug_line0
5579 .byte 0x2
5580 .ascii \"foo\\0\"
5581 .byte 0x1
5582 .byte 0x2
5583 .byte 0x1
5584 .${dwarf4_addr_size}byte .LFB0
5585 .${dwarf4_addr_size}byte .LFE0-.LFB0
5586 .byte 0x1
5587 .byte 0x9c
5588 .byte 0
aca12136 5589 .section .debug_abbrev,$section_flags
6923255e
JJ
5590.Ldebug_abbrev0:
5591 .byte 0x1
5592 .byte 0x11
5593 .byte 0x1
5594 .byte 0x25
5595 .byte 0x8
5596 .byte 0x13
5597 .byte 0xb
5598 .byte 0x3
5599 .byte 0x8
5600 .byte 0x1b
5601 .byte 0x8
5602 .byte 0x11
5603 .byte 0x1
5604 .byte 0x12
5605 .byte 0x$dwarf4_high_pc_form
5606 .byte 0x10
5607 .byte 0x17
5608 .byte 0
5609 .byte 0
5610 .byte 0x2
5611 .byte 0x2e
5612 .byte 0
5613 .byte 0x3f
5614 .byte 0x19
5615 .byte 0x3
5616 .byte 0x8
5617 .byte 0x3a
5618 .byte 0xb
5619 .byte 0x3b
5620 .byte 0xb
5621 .byte 0x39
5622 .byte 0xb
5623 .byte 0x11
5624 .byte 0x1
5625 .byte 0x12
5626 .byte 0x$dwarf4_high_pc_form
5627 .byte 0x40
5628 .byte 0x18
5629 .byte 0
5630 .byte 0
5631 .byte 0
aca12136 5632 .section .debug_aranges,$section_flags
6923255e
JJ
5633 .4byte $dwarf4_debug_aranges_size
5634 .2byte 0x2
5635 .4byte .Ldebug_info0
5636 .byte 0x8
5637 .byte 0
5638 .2byte 0
5639 .2byte 0
5640 .${dwarf4_addr_size}byte .Ltext0
5641 .${dwarf4_addr_size}byte .Letext0-.Ltext0
5642 .${dwarf4_addr_size}byte 0
5643 .${dwarf4_addr_size}byte 0
aca12136 5644 .section .debug_line,$section_flags
6923255e
JJ
5645.Ldebug_line0:
5646 .4byte .LELT0-.LSLT0
5647.LSLT0:
5648 .2byte 0x4
5649 .4byte .LELTP0-.LASLTP0
5650.LASLTP0:
5651 .byte 0x1
5652 .byte 0x1
5653 .byte 0x1
5654 .byte 0xf6
5655 .byte 0xf2
5656 .byte 0xd
5657 .byte 0
5658 .byte 0x1
5659 .byte 0x1
5660 .byte 0x1
5661 .byte 0x1
5662 .byte 0
5663 .byte 0
5664 .byte 0
5665 .byte 0x1
5666 .byte 0
5667 .byte 0
5668 .byte 0x1
5669 .byte 0
5670 .ascii \"a.c\\0\"
5671 .byte 0
5672 .byte 0
5673 .byte 0
5674 .byte 0
5675.LELTP0:
5676 .byte 0
5677 .byte 0x$dwarf4_line_sz
5678 .byte 0x2
5679 .${dwarf4_addr_size}byte .LM1
5680 .byte 0x18
5681 .byte 0x5
5682 .byte 0x1
5683 .byte 0
5684 .byte 0x$dwarf4_line_sz
5685 .byte 0x2
5686 .${dwarf4_addr_size}byte .LM2
5687 .byte 0x1
5688 .byte 0x5
5689 .byte 0x1
5690 .byte 0
5691 .byte 0x$dwarf4_line_sz
5692 .byte 0x2
5693 .${dwarf4_addr_size}byte .Letext0
5694 .byte 0
5695 .byte 0x1
5696 .byte 0x1
5697.LELT0:
aca12136 5698 .section .debug_str,$section_flags
6923255e
JJ
5699 .ident \"GCC\"
5700"
5701 dwarf4_success=no
5702 if test $dwarf4_addr_size = 4; then
5703 gcc_GAS_CHECK_FEATURE([assembly of compiler generated 32-bit .debug_line],
5704 gcc_cv_as_debug_line_32_flag,
5705 [elf,2,36,0], [], [$conftest_s],,
1aeb7d7d 5706 [dwarf4_success=yes])
6923255e
JJ
5707 else
5708 gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line],
5709 gcc_cv_as_debug_line_64_flag,
5710 [elf,2,36,0], [], [$conftest_s],,
5711 [dwarf4_success=yes])
5712 fi
5713 if test $dwarf4_success = yes; then
1aeb7d7d 5714 dwarf4_success=no
6923255e
JJ
5715 gcc_GAS_CHECK_FEATURE([--gdwarf-4 not refusing compiler generated .debug_line],
5716 gcc_cv_as_dwarf_4_debug_line_flag,
5717 [elf,2,36,0], [--gdwarf-4], [$conftest_s],,
1aeb7d7d 5718 [dwarf4_success=yes])
6923255e
JJ
5719 break
5720 fi
5721 dwarf4_debug_info_size=0x36
5722 dwarf4_high_pc_form=6
5723 dwarf4_debug_aranges_size=0x1c
5724 dwarf4_line_sz=5
5725 done
5726
1aeb7d7d
L
5727 if test $dwarf4_success = yes; then
5728 conftest_s="\
5729 .file \"foo.c\"
5730 .text
5731bar:
5732#APP
5733# 82 \"xxx.h\" 1
5734 $insn
5735# 0 \"\" 2
5736#NO_APP
5737 $insn
5738foo:
5739 .file 1 \"foo.c\"
5740 $insn
5741 .file 2 \"foo.h\"
5742 ret
5743"
5744 dwarf4_success=no
5745 gcc_GAS_CHECK_FEATURE([--gdwarf-4 with the APP marker],
5746 gcc_cv_as_dwarf_4_app_flag,,
5747 [--gdwarf-4], [$conftest_s],, [dwarf4_success=yes])
5748 fi
5749
5750 if test $dwarf4_success = yes; then
5751 conftest_s="\
5752 .text
5753 .globl foo
aca12136 5754 $function_type
1aeb7d7d
L
5755foo:
5756 $insn
aca12136 5757 $function_size
1aeb7d7d
L
5758 .file 1 \"foo.c\"
5759"
5760 gcc_GAS_CHECK_FEATURE([working --gdwarf-4/--gdwarf-5 for all sources],
5761 gcc_cv_as_working_gdwarf_n_flag,,
5762 [--gdwarf-4],
5763 [$conftest_s],
5764 [changequote(,)dnl
aca12136
EB
5765 if test x$gcc_cv_objdump != x \
5766 && $gcc_cv_objdump -W conftest.o 2>&1 \
1aeb7d7d
L
5767 | grep conftest.s > /dev/null 2>&1; then
5768 gcc_cv_as_working_gdwarf_n_flag=no
5769 else
5770 gcc_cv_as_working_gdwarf_n_flag=yes
5771 fi
5772 changequote([,])dnl])
5773 if test $gcc_cv_as_working_gdwarf_n_flag = yes; then
5774 AC_DEFINE(HAVE_AS_WORKING_DWARF_N_FLAG, 1,
5775[Define if your assembler supports --gdwarf-4/--gdwarf-5 even with
5776 compiler generated .debug_line.])
5777 fi
5778 fi
5779
8ada417f
ZW
5780 gcc_GAS_CHECK_FEATURE([--gstabs option],
5781 gcc_cv_as_gstabs_flag,
d9f069ab 5782 [elf,2,11,0], [--gstabs], [$insn],,
8ada417f
ZW
5783 [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
5784[Define if your assembler supports the --gstabs option.])])
c8aea42c
PB
5785
5786 gcc_GAS_CHECK_FEATURE([--debug-prefix-map option],
5787 gcc_cv_as_debug_prefix_map_flag,
303a4698 5788 [2,18,0], [--debug-prefix-map /a=/b], [$insn],,
c8aea42c
PB
5789 [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1,
5790[Define if your assembler supports the --debug-prefix-map option.])])
9d147085 5791fi
5f0e9ea2 5792
29d7cbd1 5793gcc_GAS_CHECK_FEATURE([compressed debug sections],
7320a4b5 5794 gcc_cv_as_compress_debug,,,,
29d7cbd1
RO
5795 [# gas compiled without zlib cannot compress debug sections and warns
5796 # about it, but still exits successfully. So check for this, too.
5797 if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null
5798 then
5799 gcc_cv_as_compress_debug=0
7320a4b5
RO
5800 # Since binutils 2.26, gas supports --compress-debug-sections=type,
5801 # defaulting to the ELF gABI format.
5802 elif $gcc_cv_as --compress-debug-sections=zlib-gnu -o conftest.o conftest.s > /dev/null 2>&1
5803 then
5804 gcc_cv_as_compress_debug=2
5805 gcc_cv_as_compress_debug_option="--compress-debug-sections"
5806 gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
5807 # Before binutils 2.26, gas only supported --compress-debug-options and
5808 # emitted the traditional GNU format.
29d7cbd1
RO
5809 elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1
5810 then
5811 gcc_cv_as_compress_debug=1
5812 gcc_cv_as_compress_debug_option="--compress-debug-sections"
5813 gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
5814 else
5815 gcc_cv_as_compress_debug=0
29d7cbd1
RO
5816 fi])
5817AC_DEFINE_UNQUOTED(HAVE_AS_COMPRESS_DEBUG, $gcc_cv_as_compress_debug,
5818[Define to the level of your assembler's compressed debug section support.])
5819AC_DEFINE_UNQUOTED(AS_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_compress_debug_option",
5820[Define to the assembler option to enable compressed debug sections.])
5821AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_option",
5822[Define to the assembler option to disable compressed debug sections.])
5823
28e6bb13
NC
5824gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
5825 ,,
5826[.lcomm bar,4,16],,
5827[AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
5828 [Define if your assembler supports .lcomm with an alignment field.])])
5829
75a2bcc0
JM
5830if test x$with_sysroot = x && test x$host = x$target \
5831 && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
5832 && test "$prefix" != "NONE"; then
5833 AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
5834[Define to PREFIX/include if cpp should also search that directory.])
5835fi
5836
75a2bcc0
JM
5837# Determine the version of glibc, if any, used on the target.
5838AC_MSG_CHECKING([for target glibc version])
5839AC_ARG_WITH([glibc-version],
5840 [AS_HELP_STRING([--with-glibc-version=M.N],
5841 [assume GCC used with glibc version M.N or later])], [
5842if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then
5843 glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'`
5844 glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'`
5845else
5846 AC_MSG_ERROR([option --with-glibc-version requires a version number M.N])
5847fi], [
5848glibc_version_major=0
5849glibc_version_minor=0
5850[if test -f $target_header_dir/features.h \
5851 && glibc_version_major_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+[0-9]' $target_header_dir/features.h` \
5852 && glibc_version_minor_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+[0-9]' $target_header_dir/features.h`; then
5853 glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ ]*//'`
5854 glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ ]*//'`
5855fi]])
5856AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor])
2f73a6c7
JM
5857AC_DEFINE_UNQUOTED([TARGET_GLIBC_MAJOR], [$glibc_version_major],
5858[GNU C Library major version number used on the target, or 0.])
5859AC_DEFINE_UNQUOTED([TARGET_GLIBC_MINOR], [$glibc_version_minor],
5860[GNU C Library minor version number used on the target, or 0.])
75a2bcc0 5861
e31bcd1b 5862AC_ARG_ENABLE(gnu-unique-object,
87e6d9dc
TB
5863 [AS_HELP_STRING([--enable-gnu-unique-object],
5864 [enable the use of the @gnu_unique_object ELF extension on glibc systems])],
e31bcd1b
JM
5865 [case $enable_gnu_unique_object in
5866 yes | no) ;;
5867 *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
5868Valid choices are 'yes' and 'no'.]) ;;
5869 esac],
5870 [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
5871 [elf,2,19,52],,
5ab22850
RR
5872 [.type foo, '$target_type_format_char'gnu_unique_object],,
5873# We need to unquote above to to use the definition from config.gcc.
e31bcd1b 5874# Also check for ld.so support, i.e. glibc 2.11 or higher.
75a2bcc0
JM
5875 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [11], [enable_gnu_unique_object=yes], )]
5876 )])
e31bcd1b
JM
5877if test x$enable_gnu_unique_object = xyes; then
5878 AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
5879 [Define if your assembler supports @gnu_unique_object.])
5880fi
5881
03943c05
AO
5882AC_CACHE_CHECK([assembler for tolerance to line number 0],
5883 [gcc_cv_as_line_zero],
5884 [gcc_cv_as_line_zero=no
7cad8a8f 5885 if test "x$gcc_cv_as" != x; then
03943c05
AO
5886 { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
5887 if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) &&
5888 test "x`cat conftest.out`" = x
5889 then
5890 gcc_cv_as_line_zero=yes
5891 else
5892 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
5893 cat conftest.s >&AS_MESSAGE_LOG_FD
5894 echo "configure: error output was" >&AS_MESSAGE_LOG_FD
5895 cat conftest.out >&AS_MESSAGE_LOG_FD
5896 fi
5897 rm -f conftest.o conftest.s conftest.out
5898 fi])
5899if test "x$gcc_cv_as_line_zero" = xyes; then
5900 AC_DEFINE([HAVE_AS_LINE_ZERO], 1,
5901[Define if the assembler won't complain about a line such as # 0 "" 2.])
5902fi
5903
25e08379
PP
5904AC_MSG_CHECKING(support for thin archives)
5905thin_archive_support=no
5906echo 'int main (void) { return 0; }' > conftest.c
5907if ($AR --version | sed 1q | grep "GNU ar" \
5908 && $CC $CFLAGS -c conftest.c \
5909 && $AR rcT conftest.a conftest.o \
5910 && $CC $CFLAGS $LDFLAGS -o conftest conftest.a) >/dev/null 2>&1; then
5911 thin_archive_support=yes
5912fi
5913rm -f conftest.c conftest.o conftest.a conftest
5914AC_MSG_RESULT($thin_archive_support)
5915AC_SUBST(thin_archive_support)
5916
275b60d6
JJ
5917AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
5918gcc_cv_ld_eh_frame_hdr=no
34a86c2b 5919if test $in_tree_ld = yes ; then
5408ac6c
HPN
5920 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 \
5921 && test $in_tree_ld_is_elf = yes; then
275b60d6
JJ
5922 gcc_cv_ld_eh_frame_hdr=yes
5923 fi
5924elif test x$gcc_cv_ld != x; then
6961669f
RO
5925 if echo "$ld_ver" | grep GNU > /dev/null; then
5926 # Check if linker supports --eh-frame-hdr option
8dc877eb 5927 if $gcc_cv_ld --help 2>&1 | grep eh-frame-hdr > /dev/null; then
6961669f
RO
5928 gcc_cv_ld_eh_frame_hdr=yes
5929 fi
5930 else
5931 case "$target" in
5932 *-*-solaris2*)
e279edb0
RO
5933 # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
5934 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
6961669f
RO
5935 gcc_cv_ld_eh_frame_hdr=yes
5936 fi
5937 ;;
5938 esac
5939 fi
275b60d6 5940fi
232b67d9 5941GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
275b60d6
JJ
5942if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
5943 AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
6961669f 5944[Define if your linker supports .eh_frame_hdr.])
275b60d6
JJ
5945fi
5946AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
5947
5022315a
RO
5948AC_MSG_CHECKING(linker CIEv3 in .eh_frame support)
5949gcc_cv_ld_eh_frame_ciev3=no
5950if test $in_tree_ld = yes ; then
5951 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 \
5952 && test $in_tree_ld_is_elf = yes; then
5953 gcc_cv_ld_eh_frame_ciev3=yes
5954 fi
5955elif test x$gcc_cv_ld != x; then
5956 if echo "$ld_ver" | grep GNU > /dev/null; then
5957 gcc_cv_ld_eh_frame_ciev3=yes
5958 if test 0"$ld_date" -lt 20040513; then
5959 if test -n "$ld_date"; then
5960 # If there was date string, but was earlier than 2004-05-13, fail
5961 gcc_cv_ld_eh_frame_ciev3=no
5962 elif test "$ld_vers_major" -lt 2; then
5963 gcc_cv_ld_eh_frame_ciev3=no
5964 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
5965 gcc_cv_ld_eh_frame_ciev3=no
5966 fi
5967 fi
5968 else
5969 case "$target" in
5970 *-*-solaris2*)
5971 # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1.
5972 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then
5973 gcc_cv_ld_eh_frame_ciev3=yes
5974 fi
5975 ;;
5976 esac
5977 fi
5978fi
5979AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3,
5980 [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`],
5981 [Define 0/1 if your linker supports CIE v3 in .eh_frame.])
5982AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3)
5983
24a4dd31
JJ
5984AC_MSG_CHECKING(linker position independent executable support)
5985gcc_cv_ld_pie=no
5986if test $in_tree_ld = yes ; then
df2a1cc4
RO
5987 case "$target" in
5988 # Full PIE support on Solaris was only introduced in gld 2.26.
5989 *-*-solaris2*) gcc_gld_pie_min_version=26 ;;
5990 *) gcc_gld_pie_min_version=15 ;;
5991 esac
5992 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge "$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \
5408ac6c 5993 && test $in_tree_ld_is_elf = yes; then
24a4dd31
JJ
5994 gcc_cv_ld_pie=yes
5995 fi
5996elif test x$gcc_cv_ld != x; then
df2a1cc4 5997 # Check if linker supports -pie option
8dc877eb 5998 if $gcc_cv_ld --help 2>&1 | grep -- -pie > /dev/null; then
df2a1cc4
RO
5999 gcc_cv_ld_pie=yes
6000 case "$target" in
6001 *-*-solaris2*)
6002 if echo "$ld_ver" | grep GNU > /dev/null \
6003 && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then
6004 gcc_cv_ld_pie=no
6005 fi
6006 ;;
6007 esac
6008 else
6009 case "$target" in
6010 *-*-solaris2.1[[1-9]]*)
f021f1d3 6011 # Solaris 11.3 added PIE support.
df2a1cc4
RO
6012 if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
6013 gcc_cv_ld_pie=yes
24a4dd31 6014 fi
df2a1cc4
RO
6015 ;;
6016 esac
6017 fi
24a4dd31
JJ
6018fi
6019if test x"$gcc_cv_ld_pie" = xyes; then
6020 AC_DEFINE(HAVE_LD_PIE, 1,
df2a1cc4 6021[Define if your linker supports PIE option.])
24a4dd31
JJ
6022fi
6023AC_MSG_RESULT($gcc_cv_ld_pie)
77ad54d9
ST
6024
6025AC_MSG_CHECKING(linker PIE support with copy reloc)
6026gcc_cv_ld_pie_copyreloc=no
6027if test $gcc_cv_ld_pie = yes ; then
6028 if test $in_tree_ld = yes ; then
6029 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
6030 gcc_cv_ld_pie_copyreloc=yes
6031 fi
6032 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6033 # Check if linker supports -pie option with copy reloc
6034 case "$target" in
6035 i?86-*-linux* | x86_64-*-linux*)
6036 cat > conftest1.s <<EOF
6037 .globl a_glob
6038 .data
6039 .type a_glob, @object
6040 .size a_glob, 4
6041a_glob:
6042 .long 2
6043EOF
6044 cat > conftest2.s <<EOF
6045 .text
6046 .globl main
6047 .type main, @function
6048main:
6049 movl %eax, a_glob(%rip)
6050 .size main, .-main
7b3592ee
L
6051 .globl ptr
6052 .section .data.rel,"aw",@progbits
6053 .type ptr, @object
6054ptr:
6055 .quad a_glob
77ad54d9
ST
6056EOF
6057 if $gcc_cv_as --64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
6058 && $gcc_cv_ld -shared -melf_x86_64 -o conftest1.so conftest1.o > /dev/null 2>&1 \
6059 && $gcc_cv_as --64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
6060 && $gcc_cv_ld -pie -melf_x86_64 -o conftest conftest2.o conftest1.so > /dev/null 2>&1; then
6061 gcc_cv_ld_pie_copyreloc=yes
6062 fi
6063 rm -f conftest conftest1.so conftest1.o conftest2.o conftest1.s conftest2.s
6064 ;;
6065 esac
6066 fi
77ad54d9 6067fi
1be71446
L
6068AC_DEFINE_UNQUOTED(HAVE_LD_PIE_COPYRELOC,
6069 [`if test x"$gcc_cv_ld_pie_copyreloc" = xyes; then echo 1; else echo 0; fi`],
6070 [Define 0/1 if your linker supports -pie option with copy reloc.])
77ad54d9 6071AC_MSG_RESULT($gcc_cv_ld_pie_copyreloc)
24a4dd31 6072
22ba88ef
EB
6073AC_MSG_CHECKING(linker EH-compatible garbage collection of sections)
6074gcc_cv_ld_eh_gc_sections=no
6075if test $in_tree_ld = yes ; then
6076 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 \
6077 && test $in_tree_ld_is_elf = yes; then
6078 gcc_cv_ld_eh_gc_sections=yes
6079 fi
6080elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
6081 cat > conftest.s <<EOF
6082 .section .text
6083.globl _start
6084 .type _start, @function
6085_start:
6086 .long foo
6087 .size _start, .-_start
6088 .section .text.foo,"ax",@progbits
6089 .type foo, @function
6090foo:
6091 .long 0
6092 .size foo, .-foo
6093 .section .gcc_except_table.foo,"a",@progbits
6094.L0:
6095 .long 0
6096 .section .eh_frame,"a",@progbits
6097 .long .L0
6098EOF
6099 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6100 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
6101 | grep "gc-sections option ignored" > /dev/null; then
6102 gcc_cv_ld_eh_gc_sections=no
2e2b183b
RO
6103 elif $gcc_cv_objdump -h conftest 2> /dev/null \
6104 | grep gcc_except_table > /dev/null; then
22ba88ef 6105 gcc_cv_ld_eh_gc_sections=yes
e9d207d9
EB
6106 # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
6107 if test x$gcc_cv_as_comdat_group != xyes; then
6108 gcc_cv_ld_eh_gc_sections=no
6109 cat > conftest.s <<EOF
6110 .section .text
6111.globl _start
6112 .type _start, @function
6113_start:
6114 .long foo
6115 .size _start, .-_start
6116 .section .gnu.linkonce.t.foo,"ax",@progbits
6117 .type foo, @function
6118foo:
6119 .long 0
6120 .size foo, .-foo
6121 .section .gcc_except_table.foo,"a",@progbits
6122.L0:
6123 .long 0
6124 .section .eh_frame,"a",@progbits
6125 .long .L0
6126EOF
6127 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6128 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
6129 | grep "gc-sections option ignored" > /dev/null; then
6130 gcc_cv_ld_eh_gc_sections=no
2e2b183b
RO
6131 elif $gcc_cv_objdump -h conftest 2> /dev/null \
6132 | grep gcc_except_table > /dev/null; then
e9d207d9
EB
6133 gcc_cv_ld_eh_gc_sections=yes
6134 fi
6135 fi
6136 fi
22ba88ef
EB
6137 fi
6138 fi
6139 rm -f conftest.s conftest.o conftest
6140fi
e9d207d9
EB
6141case "$target" in
6142 hppa*-*-linux*)
6143 # ??? This apparently exposes a binutils bug with PC-relative relocations.
6144 gcc_cv_ld_eh_gc_sections=no
6145 ;;
6146esac
22ba88ef
EB
6147if test x$gcc_cv_ld_eh_gc_sections = xyes; then
6148 AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1,
6149 [Define if your linker supports garbage collection of
6150 sections in presence of EH frames.])
6151fi
6152AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections)
6153
1b500976
JJ
6154AC_MSG_CHECKING(linker EH garbage collection of sections bug)
6155gcc_cv_ld_eh_gc_sections_bug=no
6156if test $in_tree_ld = yes ; then
6157 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -lt 19 -o "$gcc_cv_gld_major_version" -lt 2 \
6158 && test $in_tree_ld_is_elf = yes; then
6159 gcc_cv_ld_eh_gc_sections_bug=yes
6160 fi
6161elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x -a x$gcc_cv_as_comdat_group = xyes; then
6162 gcc_cv_ld_eh_gc_sections_bug=yes
6163 cat > conftest.s <<EOF
6164 .section .text
6165.globl _start
6166 .type _start, @function
6167_start:
6168 .long foo
6169 .size _start, .-_start
6170 .section .text.startup.foo,"ax",@progbits
6171 .type foo, @function
6172foo:
6173 .long 0
6174 .size foo, .-foo
6175 .section .gcc_except_table.foo,"a",@progbits
6176.L0:
6177 .long 0
6178 .section .eh_frame,"a",@progbits
6179 .long .L0
6180EOF
6181 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6182 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
6183 | grep "gc-sections option ignored" > /dev/null; then
6184 :
6185 elif $gcc_cv_objdump -h conftest 2> /dev/null \
6186 | grep gcc_except_table > /dev/null; then
6187 gcc_cv_ld_eh_gc_sections_bug=no
6188 fi
6189 fi
6190 rm -f conftest.s conftest.o conftest
6191fi
6192if test x$gcc_cv_ld_eh_gc_sections_bug = xyes; then
6193 AC_DEFINE(HAVE_LD_EH_GC_SECTIONS_BUG, 1,
6194 [Define if your linker has buggy garbage collection of
6195 sections support when .text.startup.foo like sections are used.])
6196fi
6197AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug)
6198
29d7cbd1
RO
6199AC_MSG_CHECKING(linker for compressed debug sections)
6200# gold/gld support compressed debug sections since binutils 2.19/2.21
7320a4b5 6201# In binutils 2.26, gld gained support for the ELF gABI format.
29d7cbd1
RO
6202if test $in_tree_ld = yes ; then
6203 gcc_cv_ld_compress_debug=0
6204 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 19 -o "$gcc_cv_gld_major_version" -gt 2 \
6205 && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then
6206 gcc_cv_ld_compress_debug=2
6207 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
7320a4b5
RO
6208 elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 26 -o "$gcc_cv_gld_major_version" -gt 2 \
6209 && test $in_tree_ld_is_elf = yes && test $ld_is_gold = no; then
6210 gcc_cv_ld_compress_debug=3
6211 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
29d7cbd1
RO
6212 elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2 \
6213 && test $in_tree_ld_is_elf = yes; then
6214 gcc_cv_ld_compress_debug=1
6215 fi
6216elif echo "$ld_ver" | grep GNU > /dev/null; then
7320a4b5
RO
6217 if test "$ld_vers_major" -lt 2 \
6218 || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then
6219 gcc_cv_ld_compress_debug=0
6220 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then
6221 gcc_cv_ld_compress_debug=1
6222 else
6223 gcc_cv_ld_compress_debug=3
6224 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
29d7cbd1
RO
6225 fi
6226 if test $ld_is_gold = yes; then
6227 gcc_cv_ld_compress_debug=2
6228 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
6229 fi
6230else
6231changequote(,)dnl
6232 case "${target}" in
6233 *-*-solaris2*)
6234 # Introduced in Solaris 11.2.
6235 if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then
6236 gcc_cv_ld_compress_debug=3
6237 gcc_cv_ld_compress_debug_option="-z compress-sections"
6238 else
6239 gcc_cv_ld_compress_debug=0
6240 fi
6241 ;;
6242 *)
6243 # Assume linkers other than GNU ld don't support compessed debug
6244 # sections.
6245 gcc_cv_ld_compress_debug=0
6246 ;;
6247 esac
6248changequote([,])dnl
6249fi
6250AC_DEFINE_UNQUOTED(HAVE_LD_COMPRESS_DEBUG, $gcc_cv_ld_compress_debug,
6251[Define to the level of your linker's compressed debug section support.])
6252AC_DEFINE_UNQUOTED(LD_COMPRESS_DEBUG_OPTION, "$gcc_cv_ld_compress_debug_option",
6253[Define to the linker option to enable compressed debug sections.])
6254AC_MSG_RESULT($gcc_cv_ld_compress_debug)
6255
eb89c82f
IS
6256if test x"$ld64_flag" = x"yes"; then
6257
6258 # Set defaults for possibly untestable items.
6259 gcc_cv_ld64_export_dynamic=0
6260
6261 if test "$build" = "$host"; then
6262 darwin_try_test=1
6263 else
6264 darwin_try_test=0
6265 fi
6266
6267 # On Darwin, because of FAT library support, it is often possible to execute
6268 # exes from compatible archs even when the host differs from the build system.
6269 case "$build","$host" in
6270 x86_64-*-darwin*,i?86-*-darwin* | powerpc64*-*-darwin*,powerpc*-*-darwin*)
6271 darwin_try_test=1;;
6272 *) ;;
6273 esac
6274
6275 # If the configurer specified a minimum ld64 version to be supported, then use
6276 # that to determine feature support.
6277 if test x"${gcc_cv_ld64_version}" != x; then
c6d01ef8
IS
6278 AC_MSG_CHECKING(ld64 specified version)
6279 gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'`
eb89c82f
IS
6280 AC_MSG_RESULT($gcc_cv_ld64_major)
6281 if test "$gcc_cv_ld64_major" -ge 236; then
6282 gcc_cv_ld64_export_dynamic=1
6283 fi
6284 elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
6285 # If the version was not specified, try to find it.
6286 AC_MSG_CHECKING(linker version)
6287 if test x"${gcc_cv_ld64_version}" = x; then
6288 gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | grep ld64 | sed s/.*ld64-// | awk '{print $1}'`
6289 fi
6290 AC_MSG_RESULT($gcc_cv_ld64_version)
6291
6292 AC_MSG_CHECKING(linker for -export_dynamic support)
6293 gcc_cv_ld64_export_dynamic=1
6294 if $gcc_cv_ld -export_dynamic < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
6295 gcc_cv_ld64_export_dynamic=0
6296 fi
6297 AC_MSG_RESULT($gcc_cv_ld64_export_dynamic)
6298 fi
6299
6300 if test x"${gcc_cv_ld64_version}" != x; then
6301 AC_DEFINE_UNQUOTED(LD64_VERSION, "${gcc_cv_ld64_version}",
6302 [Define to ld64 version.])
6303 fi
6304
6305 AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic,
6306 [Define to 1 if ld64 supports '-export_dynamic'.])
6307fi
6308
3b5e8ee4
IS
6309if test x"$dsymutil_flag" = x"yes"; then
6310
6311 # If the user specified a dsymutil path, then we will already have the
6312 # version string, otherwise, pick it up.
6313 if test x"$gcc_cv_dsymutil" = x; then
6314 AC_MSG_WARN([dsymutil is a required tool for this system, but not found])
6315 dsymutil_vers="tool unspecified"
6316 elif test x"$dsymutil_vers" = x; then
6317 dsymutil_vers=`$gcc_cv_dsymutil -v /dev/null 2>&1`
6318 fi
6319
6320 dsymutil_temp=`echo $dsymutil_vers | sed 1q`
6321 AC_MSG_CHECKING(dsymutil version "$dsymutil_temp")
6322 if echo $dsymutil_temp | grep dwarfutils- > /dev/null; then
6323 dsymutil_kind=DWARFUTILS
6324 dsymutil_vers=`echo $dsymutil_temp | sed 's/.*dwarfutils-\([[0-9\.]]*\).*/\1/'`
6325 elif echo $dsymutil_temp | grep clang- > /dev/null; then
6326 dsymutil_kind=CLANG
6327 dsymutil_vers=`echo $dsymutil_temp | sed 's/.*clang-\([[0-9\.]]*\).*/\1/'`
6328 elif echo $dsymutil_temp | grep 'LLVM version ' > /dev/null; then
6329 dsymutil_kind=LLVM
6330 dsymutil_vers=`echo $dsymutil_temp | sed 's/.*LLVM\ version\ \([[0-9\.]]*\).*/\1/'`
6331 else
6332 dsymutil_kind=UNKNOWN
6333 dsymutil_vers="0.0"
6334 fi
6335 dsymutil_major=`expr "$dsymutil_vers" : '\([[0-9]]*\)'`
6336 dsymutil_minor=`expr "$dsymutil_vers" : '[[0-9]]*\.\([[0-9]]*\)'`
6337 dsymutil_tiny=`expr "$dsymutil_vers" : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
6338 if test x"${dsymutil_minor}" = x; then
6339 dsymutil_minor=0
6340 fi
6341 if test x"${dsymutil_tiny}" = x; then
6342 dsymutil_tiny=0
6343 fi
6344 AC_DEFINE_UNQUOTED(DSYMUTIL_VERSION, [$dsymutil_kind,${dsymutil_major},${dsymutil_minor},${dsymutil_tiny}],
6345 [Define to the dsymutil version.])
6346 AC_MSG_RESULT($dsymutil_vers : $dsymutil_kind ${dsymutil_major} ${dsymutil_minor} ${dsymutil_tiny} )
6347fi
6348
a49a96f6
JJ
6349case $target_os in
6350 win32 | pe | cygwin* | mingw32*)
6351 AC_MSG_CHECKING(broken PE linker dwarf5 support)
6352 gcc_cv_ld_broken_pe_dwarf5=yes
6353 if test $in_tree_ld = yes ; then
6354 if grep -q '\.debug_loclists.*BLOCK.*__section_alignment__.*NOLOAD.*:' \
6355 $gcc_cv_ld_gld_srcdir/scripttempl/pe*.sc \
6356 && grep -q '\.debug_rnglists.*BLOCK.*__section_alignment__.*NOLOAD.*:' \
6357 $gcc_cv_ld_gld_srcdir/scripttempl/pe*.sc; then
6358 gcc_cv_ld_broken_pe_dwarf5=no
6359 fi
6360 else
6361 if $gcc_cv_ld --verbose 2>&1 | grep -q '\.debug_loclists.*BLOCK.*__section_alignment__.*NOLOAD.*:' \
6362 && $gcc_cv_ld --verbose 2>&1 | grep -q '\.debug_rnglists.*BLOCK.*__section_alignment__.*NOLOAD.*:'; then
6363 gcc_cv_ld_broken_pe_dwarf5=no
6364 fi
6365 fi
6366 if test x$gcc_cv_ld_broken_pe_dwarf5 = xyes; then
6367 AC_DEFINE(HAVE_LD_BROKEN_PE_DWARF5, 1,
6368 [Define if the PE linker has broken DWARF 5 support.])
6369 fi
6370 AC_MSG_RESULT($gcc_cv_ld_broken_pe_dwarf5)
2bdf17de
EB
6371
6372 AC_MSG_CHECKING(PE linker --disable-dynamicbase support)
6373 gcc_cv_ld_disable_dynamicbase=no
6374 if test $in_tree_ld = yes; then
6375 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 36 -o "$gcc_cv_gld_major_version" -gt 2; then \
6376 gcc_cv_ld_disable_dynamicbase=yes
6377 fi
6378 else
6379 if $gcc_cv_ld --help 2>&1 | grep -q 'disable\-]dynamicbase' > /dev/null; then
6380 gcc_cv_ld_disable_dynamicbase=yes
6381 fi
6382 fi
6383 if test x"$gcc_cv_ld_disable_dynamicbase" = xyes; then
6384 AC_DEFINE(HAVE_LD_PE_DISABLE_DYNAMICBASE, 1,
6385 [Define if the PE linker supports --disable-dynamicbase option.])
6386 fi
6387 AC_MSG_RESULT($gcc_cv_ld_disable_dynamicbase)
a49a96f6
JJ
6388 ;;
6389esac
6390
630327c3
NN
6391# --------
6392# UNSORTED
6393# --------
6394
82e923f6
RS
6395AC_CACHE_CHECK(linker --as-needed support,
6396gcc_cv_ld_as_needed,
6397[gcc_cv_ld_as_needed=no
e927b6ad
RO
6398gcc_cv_ld_as_needed_option='--as-needed'
6399gcc_cv_ld_no_as_needed_option='--no-as-needed'
765f1bf9
AM
6400if test $in_tree_ld = yes ; then
6401 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 \
6402 && test $in_tree_ld_is_elf = yes; then
6403 gcc_cv_ld_as_needed=yes
fefedb94
JJ
6404 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 28; then
6405 gcc_cv_ld_as_needed_option='--push-state --as-needed'
6406 gcc_cv_ld_no_as_needed_option='--pop-state'
6407 fi
765f1bf9
AM
6408 fi
6409elif test x$gcc_cv_ld != x; then
8dc877eb
RO
6410 # Check if linker supports --as-needed and --no-as-needed options
6411 if $gcc_cv_ld --help 2>&1 | grep as-needed > /dev/null; then
6412 gcc_cv_ld_as_needed=yes
fefedb94
JJ
6413 if $gcc_cv_ld --help 2>&1 | grep push-state > /dev/null \
6414 && $gcc_cv_ld --help 2>&1 | grep pop-state > /dev/null \
6415 && echo "$ld_ver" | grep GNU > /dev/null \
6416 && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 28; then
6417 # Use these options only when both ld.bfd and ld.gold support
6418 # --push-state/--pop-state, which unfortunately wasn't added
6419 # at the same time.
6420 gcc_cv_ld_as_needed_option='--push-state --as-needed'
6421 gcc_cv_ld_no_as_needed_option='--pop-state'
6422 fi
8dc877eb
RO
6423 fi
6424 case "$target:$gnu_ld" in
6425 *-*-solaris2*:no)
6426 # Solaris 2 ld always supports -z ignore/-z record. Prefer the native
6427 # forms.
6428 gcc_cv_ld_as_needed=yes
6429 gcc_cv_ld_as_needed_option="-z ignore"
6430 gcc_cv_ld_no_as_needed_option="-z record"
6431 ;;
6432 esac
765f1bf9 6433fi
56cf7859
RO
6434# --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
6435# dl_iterate_phdr, i.e. since Solaris 11.
6436case "$target" in
6437 *-*-solaris2.1[[1-9]]*)
6438 case "$target" in
6439 i?86-*-* | x86_64-*-*)
6440 if echo "$ld_ver" | grep GNU > /dev/null; then
6441 # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
6442 gcc_cv_ld_as_needed=no
6443 fi
6444 ;;
6445 esac
6446 ;;
6447 *-*-solaris2*)
6448 gcc_cv_ld_as_needed=no
6449 ;;
6450esac
82e923f6 6451])
765f1bf9
AM
6452if test x"$gcc_cv_ld_as_needed" = xyes; then
6453 AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
e927b6ad
RO
6454[Define if your linker supports --as-needed/--no-as-needed or equivalent options.])
6455 AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option",
6456[Define to the linker option to ignore unused dependencies.])
6457 AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option",
6458[Define to the linker option to keep unused dependencies.])
765f1bf9 6459fi
765f1bf9 6460
3c698bf0
RO
6461AC_MSG_CHECKING(linker mapfile support for clearing hardware capabilities)
6462saved_LDFLAGS="$LDFLAGS"
6463for clearcap_map in sol2-clearcapv2.map sol2-clearcap.map; do
6464 LDFLAGS="$saved_LDFLAGS -Wl,-M,${srcdir}/config/$clearcap_map"
22e05272 6465 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
3c698bf0
RO
6466 [gcc_cv_ld_clearcap=yes; break], [gcc_cv_ld_clearcap=no])
6467done
6468LDFLAGS="$saved_LDFLAGS"
6469if test "x$gcc_cv_ld_clearcap" = xyes; then
6470 AC_DEFINE([HAVE_LD_CLEARCAP], 1,
6471[Define if the linker supports clearing hardware capabilities via mapfile.])
6472 AC_CONFIG_LINKS([clearcap.map:${srcdir}/config/$clearcap_map])
6473fi
6474AC_MSG_RESULT($gcc_cv_ld_clearcap)
6475
e9dda04f
AM
6476case "$target" in
6477 powerpc*-*-*)
6478 case "$target" in
6479 *le-*-linux*)
6480 emul_name="-melf32lppc"
6481 ;;
6482 *)
6483 emul_name="-melf32ppc"
6484 ;;
6485 esac
6486 AC_CACHE_CHECK(linker .gnu.attributes long double support,
6487 gcc_cv_ld_ppc_attr,
6488 [gcc_cv_ld_ppc_attr=no
6489 if test x"$ld_is_gold" = xyes; then
6490 gcc_cv_ld_ppc_attr=yes
6491 elif test $in_tree_ld = yes ; then
6492 if test "$gcc_cv_gld_major_version" -eq 2 \
6493 -a "$gcc_cv_gld_minor_version" -ge 28 \
6494 -o "$gcc_cv_gld_major_version" -gt 2; then
6495 gcc_cv_ld_ppc_attr=yes
6496 fi
6497 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6498 # check that merging the long double .gnu_attribute doesn't warn
6499 cat > conftest1.s <<EOF
6500 .gnu_attribute 4,1
6501EOF
6502 cat > conftest2.s <<EOF
6503 .gnu_attribute 4,9
6504EOF
6505 if $gcc_cv_as -a32 -o conftest1.o conftest1.s > /dev/null 2>&1 \
6506 && $gcc_cv_as -a32 -o conftest2.o conftest2.s > /dev/null 2>&1 \
6507 && $gcc_cv_ld $emul_name -r -o conftest.o conftest1.o conftest2.o > /dev/null 2> conftest.err \
6508 && test ! -s conftest.err; then
6509 gcc_cv_ld_ppc_attr=yes
6510 fi
6511 rm -f conftest.err conftest.o conftest1.o conftest2.o conftest1.s conftest2.s
6512 fi
6513 ])
6514 if test x$gcc_cv_ld_ppc_attr = xyes; then
6515 AC_DEFINE(HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE, 1,
6516 [Define if your PowerPC linker has .gnu.attributes long double support.])
6517 fi
6518 ;;
6519esac
6520
d82bf747 6521case "$target:$tm_file" in
a26f86dc
AT
6522 powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
6523 case "$target" in
14523c25
AB
6524 *le-*-linux*)
6525 emul_name="-melf64lppc"
6526 ;;
a26f86dc
AT
6527 *-*-linux*)
6528 emul_name="-melf64ppc"
6529 ;;
2a418323
PK
6530 *le-*-freebsd*)
6531 emul_name="-melf64lppc_fbsd"
6532 ;;
a26f86dc
AT
6533 *-*-freebsd*)
6534 emul_name="-melf64ppc_fbsd"
6535 ;;
6536 esac
85b776df
AM
6537 AC_CACHE_CHECK(linker support for omitting dot symbols,
6538 gcc_cv_ld_no_dot_syms,
6539 [gcc_cv_ld_no_dot_syms=no
38e1b75f
AM
6540 if test x"$ld_is_gold" = xyes; then
6541 gcc_cv_ld_no_dot_syms=yes
6542 elif test $in_tree_ld = yes ; then
85b776df
AM
6543 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
6544 gcc_cv_ld_no_dot_syms=yes
6545 fi
6546 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6547 cat > conftest1.s <<EOF
6548 .text
6549 bl .foo
6550EOF
6551 cat > conftest2.s <<EOF
6552 .section ".opd","aw"
6553 .align 3
6554 .globl foo
6555 .type foo,@function
6556foo:
6557 .quad .LEfoo,.TOC.@tocbase,0
6558 .text
6559.LEfoo:
6560 blr
6561 .size foo,.-.LEfoo
6562EOF
6563 if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
6564 && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
a26f86dc 6565 && $gcc_cv_ld $emul_name -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
85b776df
AM
6566 gcc_cv_ld_no_dot_syms=yes
6567 fi
6568 rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
6569 fi
6570 ])
6571 if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
6572 AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
6573 [Define if your PowerPC64 linker only needs function descriptor syms.])
6574 fi
070b27da
AM
6575
6576 AC_CACHE_CHECK(linker large toc support,
6577 gcc_cv_ld_large_toc,
6578 [gcc_cv_ld_large_toc=no
38e1b75f
AM
6579 if test x"$ld_is_gold" = xyes; then
6580 gcc_cv_ld_large_toc=yes
6581 elif test $in_tree_ld = yes ; then
070b27da
AM
6582 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then
6583 gcc_cv_ld_large_toc=yes
6584 fi
6585 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6586 cat > conftest.s <<EOF
6587 .section ".tbss","awT",@nobits
6588 .align 3
6589ie0: .space 8
6590 .global _start
6591 .text
6592_start:
6593 addis 9,13,ie0@got@tprel@ha
6594 ld 9,ie0@got@tprel@l(9)
6595EOF
6596 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
a26f86dc 6597 && $gcc_cv_ld $emul_name --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then
070b27da
AM
6598 gcc_cv_ld_large_toc=yes
6599 fi
6600 rm -f conftest conftest.o conftest.s
6601 fi
6602 ])
6603 if test x"$gcc_cv_ld_large_toc" = xyes; then
6604 AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
6605 [Define if your PowerPC64 linker supports a large TOC.])
6606 fi
3954ead0
AM
6607
6608 AC_CACHE_CHECK(linker toc pointer alignment,
6609 gcc_cv_ld_toc_align,
6610 [if test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_nm != x; then
6611 cat > conftest.s <<EOF
6612 .global _start
6613 .text
6614_start:
6615 addis 9,2,x@got@ha
6616 .section .data.rel.ro,"aw",@progbits
6617 .p2align 16
6618 .space 32768
6619x: .quad .TOC.
6620EOF
6621 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
458bc9b1 6622 && $gcc_cv_ld $emul_name -z norelro -o conftest conftest.o > /dev/null 2>&1; then
3954ead0
AM
6623 gcc_cv_ld_toc_align=`$gcc_cv_nm conftest | ${AWK} '/\.TOC\./ { match ($0, "0[[[:xdigit:]]]*", a); print strtonum ("0x" substr(a[[0]], length(a[[0]])-3)) }'`
6624 fi
6625 rm -f conftest conftest.o conftest.s
6626 fi
6627 ])
6628 if test -n "$gcc_cv_ld_toc_align" && test $gcc_cv_ld_toc_align -gt 8; then
6629 AC_DEFINE_UNQUOTED(POWERPC64_TOC_POINTER_ALIGNMENT, $gcc_cv_ld_toc_align,
6630 [Define to .TOC. alignment forced by your linker.])
6631 fi
85b776df
AM
6632 ;;
6633esac
6634
9e81cc8b
DE
6635case "$target" in
6636 *-*-aix*)
6637 AC_CACHE_CHECK(linker large toc support,
6638 gcc_cv_ld_large_toc,
6639 [gcc_cv_ld_large_toc=no
6640 if test x$gcc_cv_as != x ; then
6641 cat > conftest.s <<EOF
6642 .toc
6643LC..1:
6644 .tc a[[TC]],a[[RW]]
6645 .extern a[[RW]]
6646 .csect .text[[PR]]
6647.largetoctest:
6648 addis 9,LC..1@u(2)
6649 ld 3,LC..1@l(9)
6650EOF
6651 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then
6652 gcc_cv_ld_large_toc=yes
6653 fi
6654 rm -f conftest conftest.o conftest.s
6655 fi
6656 ])
6657 if test x"$gcc_cv_ld_large_toc" = xyes; then
6658 AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
01ae4861 6659 [Define if your PowerPC64 linker supports a large TOC.])
9e81cc8b
DE
6660 fi
6661 ;;
6662esac
6663
cd533689
PP
6664AC_CACHE_CHECK(linker --build-id support,
6665 gcc_cv_ld_buildid,
6666 [gcc_cv_ld_buildid=no
6667 if test $in_tree_ld = yes ; then
6668 if test "$gcc_cv_gld_major_version" -eq 2 -a \
6669 "$gcc_cv_gld_minor_version" -ge 18 -o \
6670 "$gcc_cv_gld_major_version" -gt 2 \
6671 && test $in_tree_ld_is_elf = yes; then
6672 gcc_cv_ld_buildid=yes
6673 fi
6674 elif test x$gcc_cv_ld != x; then
8dc877eb 6675 if $gcc_cv_ld --help 2>&1 | grep build-id > /dev/null; then
cd533689
PP
6676 gcc_cv_ld_buildid=yes
6677 fi
6678 fi])
6679if test x"$gcc_cv_ld_buildid" = xyes; then
6680 AC_DEFINE(HAVE_LD_BUILDID, 1,
6681 [Define if your linker supports --build-id.])
6682fi
6683
6684AC_ARG_ENABLE(linker-build-id,
b88ecf55
AS
6685[AS_HELP_STRING([--enable-linker-build-id],
6686 [compiler will always pass --build-id to linker])],
cd533689
PP
6687[],
6688enable_linker_build_id=no)
6689
6690if test x"$enable_linker_build_id" = xyes; then
6691 if test x"$gcc_cv_ld_buildid" = xyes; then
6692 AC_DEFINE(ENABLE_LD_BUILDID, 1,
6693 [Define if gcc should always pass --build-id to linker.])
6694 else
6695 AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
6696 fi
6697fi
6698
a6198222
RO
6699# In binutils 2.21, GNU ld gained support for new emulations fully
6700# supporting the Solaris 2 ABI. Detect their presence in the linker used.
6701AC_CACHE_CHECK(linker *_sol2 emulation support,
6702 gcc_cv_ld_sol2_emulation,
6703 [gcc_cv_ld_sol2_emulation=no
6704 if test $in_tree_ld = yes ; then
6705 if test "$gcc_cv_gld_major_version" -eq 2 -a \
6706 "$gcc_cv_gld_minor_version" -ge 21 -o \
6707 "$gcc_cv_gld_major_version" -gt 2 \
6708 && test $in_tree_ld_is_elf = yes; then
6709 gcc_cv_ld_sol2_emulation=yes
6710 fi
6711 elif test x$gcc_cv_ld != x; then
6712 if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \
6713 grep _sol2 > /dev/null; then
6714 gcc_cv_ld_sol2_emulation=yes
6715 fi
6716 fi])
6717if test x"$gcc_cv_ld_sol2_emulation" = xyes; then
6718 AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1,
6719 [Define if your linker supports the *_sol2 emulations.])
6720fi
6721
380e5ca4
MM
6722AC_CACHE_CHECK(linker --sysroot support,
6723 gcc_cv_ld_sysroot,
6724 [gcc_cv_ld_sysroot=no
6725 if test $in_tree_ld = yes ; then
6726 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 6727 gcc_cv_ld_sysroot=yes
380e5ca4
MM
6728 fi
6729 elif test x$gcc_cv_ld != x; then
8dc877eb 6730 if $gcc_cv_ld --help 2>&1 | grep sysroot > /dev/null; then
380e5ca4
MM
6731 gcc_cv_ld_sysroot=yes
6732 fi
6733 fi])
6734if test x"$gcc_cv_ld_sysroot" = xyes; then
6735 AC_DEFINE(HAVE_LD_SYSROOT, 1,
6736 [Define if your linker supports --sysroot.])
6737fi
6738
2d110442
RO
6739case $target in
6740*-*-solaris2*)
6741 # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
6742 AC_CACHE_CHECK([system-provided CRTs on Solaris],
6743 gcc_cv_solaris_crts,
6744 [gcc_cv_solaris_crts=no
6745 if test x$host != x$target; then
6746 if test "x$with_sysroot" = xyes; then
6747 target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
6748 else
6749 target_sysroot="${with_sysroot}"
6750 fi
6751 fi
6752 target_libdir="$target_sysroot/usr/lib"
6753 # At the time they were added, gcrt1.o became a symlink for backwards
6754 # compatibility on x86, while crt1.o was added on sparc, so check for that.
6755 case $target in
6756 i?86-*-solaris2* | x86_64-*-solaris2*)
6757 if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
6758 ;;
6759 sparc*-*-solaris2*)
6760 if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
6761 ;;
6762 esac])
6763 ;;
6764esac
6765if test x$gcc_cv_solaris_crts = xyes; then
6766 AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
6767 [Define if the system-provided CRTs are present on Solaris.])
6768fi
6769
78fd4c51
SL
6770AC_ARG_ENABLE(libssp,
6771[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
6772[case "${enableval}" in
6773 yes|no)
6774 ;;
6775 *)
6776 AC_MSG_ERROR([unknown libssp setting $enableval])
6777 ;;
6778esac], [])
6779
77008252 6780# Test for stack protector support in target C library.
a6ccdbab 6781AC_CACHE_CHECK(__stack_chk_fail in target C library,
78fd4c51
SL
6782 gcc_cv_libc_provides_ssp,
6783 [gcc_cv_libc_provides_ssp=no
6784 if test "x$enable_libssp" = "xno"; then
6785 gcc_cv_libc_provides_ssp=yes
6786 elif test "x$enable_libssp" = "xyes"; then
6787 gcc_cv_libc_provides_ssp=no
6788 else
a6ccdbab 6789 case "$target" in
755658a5
GR
6790 *-*-musl*)
6791 # All versions of musl provide stack protector
6792 gcc_cv_libc_provides_ssp=yes;;
8466af06 6793 *-*-linux* | *-*-kfreebsd*-gnu)
75a2bcc0 6794 # glibc 2.4 and later provides __stack_chk_fail and
77008252 6795 # either __stack_chk_guard, or TLS access to stack guard canary.
75a2bcc0
JM
6796 GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_libc_provides_ssp=yes], [
6797 [if test -f $target_header_dir/features.h \
1a242e3c 6798 && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
6961669f 6799 $target_header_dir/features.h > /dev/null; then
75a2bcc0 6800 if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \
6961669f
RO
6801 $target_header_dir/features.h > /dev/null && \
6802 test -f $target_header_dir/bits/uClibc_config.h && \
1a242e3c 6803 $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_SSP__[ ]+1' \
6961669f 6804 $target_header_dir/bits/uClibc_config.h > /dev/null; then
fed6d628 6805 gcc_cv_libc_provides_ssp=yes
77008252 6806 fi
40295cc7
IZ
6807 # all versions of Bionic support stack protector
6808 elif test -f $target_header_dir/sys/cdefs.h \
6809 && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \
6810 $target_header_dir/sys/cdefs.h > /dev/null; then
6811 gcc_cv_libc_provides_ssp=yes
75a2bcc0 6812 fi]])
a6ccdbab 6813 ;;
4cc115a2
TS
6814 *-*-gnu*)
6815 # Avoid complicated tests (see
6816 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
6817 # simply assert that glibc does provide this, which is true for all
6818 # realistically usable GNU/Hurd configurations.
755658a5 6819 # All supported versions of musl provide it as well
4cc115a2 6820 gcc_cv_libc_provides_ssp=yes;;
388dc9e6 6821 *-*-darwin* | *-*-freebsd* | *-*-netbsd*)
a6ccdbab
EC
6822 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
6823 [echo "no __stack_chk_fail on this target"])
6824 ;;
78fd4c51
SL
6825 *) gcc_cv_libc_provides_ssp=no ;;
6826 esac
6827 fi])
a6ccdbab 6828
77008252
JJ
6829if test x$gcc_cv_libc_provides_ssp = xyes; then
6830 AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
6831 [Define if your target C library provides stack protector support])
6832fi
6833
e0f6cba0
MG
6834# Check whether --enable-default-ssp was given.
6835AC_ARG_ENABLE(default-ssp,
6836[AS_HELP_STRING([--enable-default-ssp],
6837 [enable Stack Smashing Protection as default])],[
6838if test x$gcc_cv_libc_provides_ssp = xyes; then
6839 case "$target" in
6840 ia64*-*-*) enable_default_ssp=no ;;
6841 *) enable_default_ssp=$enableval ;;
6842 esac
6843else
6844 enable_default_ssp=no
6845fi],
6846enable_default_ssp=no)
9a557138 6847if test x$enable_default_ssp = xyes ; then
e0f6cba0
MG
6848 AC_DEFINE(ENABLE_DEFAULT_SSP, 1,
6849 [Define if your target supports default stack protector and it is enabled.])
6850fi
6851AC_SUBST([enable_default_ssp])
6852
f4e749b4
TT
6853# Test for <sys/sdt.h> on the target.
6854GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
6855AC_MSG_CHECKING(sys/sdt.h in the target C library)
6856have_sys_sdt_h=no
6857if test -f $target_header_dir/sys/sdt.h; then
d11aaed7 6858 have_sys_sdt_h=yes
f4e749b4
TT
6859 AC_DEFINE(HAVE_SYS_SDT_H, 1,
6860 [Define if your target C library provides sys/sdt.h])
6861fi
6862AC_MSG_RESULT($have_sys_sdt_h)
6863
ed965309
JJ
6864# Check if TFmode long double should be used by default or not.
6865# Some glibc targets used DFmode long double, but with glibc 2.4
6866# and later they can use TFmode.
6867case "$target" in
f7cc5390 6868 powerpc*-*-linux* | \
ed965309
JJ
6869 sparc*-*-linux* | \
6870 s390*-*-linux* | \
6871 alpha*-*-linux*)
6872 AC_ARG_WITH(long-double-128,
b88ecf55
AS
6873 [AS_HELP_STRING([--with-long-double-128],
6874 [use 128-bit long double by default])],
8d7be8d6
SN
6875 gcc_cv_target_ldbl128="$with_long_double_128", [
6876 case "$target" in
6877 s390*-*-linux-musl*)
6878 gcc_cv_target_ldbl128=yes
6879 ;;
6880 powerpc*-*-linux-musl*)
6881 gcc_cv_target_ldbl128=no
6882 ;;
6883 *)]
75a2bcc0
JM
6884 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
6885 [gcc_cv_target_ldbl128=no
ed965309 6886 grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
6961669f 6887 $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
65280f6c 6888 && gcc_cv_target_ldbl128=yes
8d7be8d6
SN
6889 ]])]
6890 [
6891 ;;
6892 esac
6893 ])
ed965309
JJ
6894 ;;
6895esac
6896if test x$gcc_cv_target_ldbl128 = xyes; then
6897 AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
6898 [Define if TFmode long double should be the default])
6899fi
6900
8c7a27d5
MM
6901# Check if TFmode long double target should use the IBM extended double or IEEE
6902# 128-bit floating point formats if long doubles are 128-bits long. The long
6903# double type can only be switched on powerpc64 bit Linux systems where VSX is
6904# supported. Other PowerPC systems do not build the IEEE 128-bit emulator in
6905# libgcc.
6906AC_ARG_WITH([long-double-format],
6907 [AS_HELP_STRING([--with-long-double-format={ieee,ibm}]
6908 [Specify whether PowerPC long double uses IEEE or IBM format])],[
6909case "$target:$with_long_double_format" in
6910 powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm)
6911 :
6912 ;;
6913 powerpc64-*-linux*:ieee | powerpc64-*-linux*:ibm)
6914 # IEEE 128-bit emulation is only built on 64-bit VSX Linux systems
6915 case "$with_cpu" in
6916 power7 | power8 | power9 | power1*)
6917 :
6918 ;;
6919 *)
6920 AC_MSG_ERROR([Configuration option --with-long-double-format is only \
6921supported if the default cpu is power7 or newer])
6922 with_long_double_format=""
6923 ;;
6924 esac
6925 ;;
de2c1d00 6926 powerpc64*-*-linux*:*)
8c7a27d5
MM
6927 AC_MSG_ERROR([--with-long-double-format argument should be ibm or ieee])
6928 with_long_double_format=""
6929 ;;
6930 *)
6931 AC_MSG_ERROR([Configure option --with-long-double-format is only supported \
6932on 64-bit PowerPC VSX Linux systems])
6933 with_long_double_format=""
6934 ;;
6935esac],
6936 [])
6937
26a2e6ae
PB
6938# Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
6939# values in the TCB. Currently, only GLIBC 2.23 and later support this.
6940gcc_cv_libc_provides_hwcap_in_tcb=no
6941case "$target" in
6942 powerpc*-*-linux*)
6943 GCC_GLIBC_VERSION_GTE_IFELSE([2], [23], [gcc_cv_libc_provides_hwcap_in_tcb=yes], )
6944 ;;
6945esac
6946if test x$gcc_cv_libc_provides_hwcap_in_tcb = xyes; then
6947 AC_DEFINE(TARGET_LIBC_PROVIDES_HWCAP_IN_TCB, 1,
6948 [Define if your target C Library provides the AT_HWCAP value in the TCB])
6949fi
6950
54b3d52c
DM
6951# Check if the target LIBC handles PT_GNU_STACK.
6952gcc_cv_libc_gnustack=unknown
6953case "$target" in
6954 mips*-*-linux*)
6955 GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
6956 ;;
6957esac
6958if test x$gcc_cv_libc_gnustack = xyes; then
6959 AC_DEFINE(TARGET_LIBC_GNUSTACK, 1,
6960 [Define if your target C Library properly handles PT_GNU_STACK])
6961fi
6962
6961669f
RO
6963AC_MSG_CHECKING(dl_iterate_phdr in target C library)
6964gcc_cv_target_dl_iterate_phdr=unknown
6965case "$target" in
ccd1242e 6966 *-*-solaris2*)
6961669f
RO
6967 # <link.h> needs both a dl_iterate_phdr declaration and support for
6968 # compilation with largefile support.
6969 if grep dl_iterate_phdr $target_header_dir/link.h > /dev/null 2>&1 \
6970 && grep 'large file capable' $target_header_dir/link.h > /dev/null 2>&1; then
6971 gcc_cv_target_dl_iterate_phdr=yes
6972 else
6973 gcc_cv_target_dl_iterate_phdr=no
6974 fi
6975 ;;
dbed5a9b
JM
6976 *-*-dragonfly* | *-*-freebsd*)
6977 if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
6978 gcc_cv_target_dl_iterate_phdr=yes
6979 else
6980 gcc_cv_target_dl_iterate_phdr=no
6981 fi
6982 ;;
755658a5
GR
6983 *-linux-musl*)
6984 gcc_cv_target_dl_iterate_phdr=yes
6985 ;;
6961669f
RO
6986esac
6987GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
6988if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
6989 AC_DEFINE(TARGET_DL_ITERATE_PHDR, 1,
6990[Define if your target C library provides the `dl_iterate_phdr' function.])
6991fi
6992AC_MSG_RESULT($gcc_cv_target_dl_iterate_phdr)
6993
cd030c07
DN
6994# We no longer support different GC mechanisms. Emit an error if
6995# the user configures with --with-gc.
81bf3d9e 6996AC_ARG_WITH(gc,
b88ecf55 6997[AS_HELP_STRING([--with-gc={page,zone}],
cd030c07
DN
6998 [this option is not supported anymore. It used to choose
6999 the garbage collection mechanism to use with the compiler])],
7000[AC_MSG_ERROR([Configure option --with-gc is only supported up to GCC 4.7.x])],
7001[])
81bf3d9e 7002
00020c16
ILT
7003# Libraries to use on the host. This will normally be set by the top
7004# level Makefile. Here we simply capture the value for our Makefile.
7005if test -z "${HOST_LIBS+set}"; then
7006 HOST_LIBS=
7007fi
7008AC_SUBST(HOST_LIBS)
7009
3c809ba4 7010# Use the system's zlib library.
96a58590 7011AM_ZLIB
3c809ba4 7012
dc6746e7
PT
7013dnl Very limited version of automake's enable-maintainer-mode
7014
7015AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
7016 dnl maintainer-mode is disabled by default
7017 AC_ARG_ENABLE(maintainer-mode,
b88ecf55
AS
7018[AS_HELP_STRING([--enable-maintainer-mode],
7019 [enable make rules and dependencies not useful
7020 (and sometimes confusing) to the casual installer])],
dc6746e7
PT
7021 maintainer_mode=$enableval,
7022 maintainer_mode=no)
7023
7024AC_MSG_RESULT($maintainer_mode)
7025
7026if test "$maintainer_mode" = "yes"; then
7027 MAINT=''
7028else
7029 MAINT='#'
7030fi
7031AC_SUBST(MAINT)dnl
7032
427b248d
JM
7033dnl Whether to prevent multiple front-ends from linking at the same time
7034
7035AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once])
7036 AC_ARG_ENABLE(link-mutex,
7037[AS_HELP_STRING([--enable-link-mutex],
7038 [avoid linking multiple front-ends at once to avoid thrashing
7039 on the build machine])],
7040 do_link_mutex=$enableval,
7041 do_link_mutex=no)
7042AC_MSG_RESULT($do_link_mutex)
7043
7044if test "$do_link_mutex" = "yes"; then
7045 DO_LINK_MUTEX=true
7046else
7047 DO_LINK_MUTEX=false
7048fi
7049AC_SUBST(DO_LINK_MUTEX)
7050
d326ebc9
JJ
7051dnl Whether to prevent multiple GCC front-ends from linking at the same time
7052
7053AC_MSG_CHECKING([whether to serialize linking of multiple front-ends])
7054 AC_ARG_ENABLE(link-serialization,
7055[AS_HELP_STRING([--enable-link-serialization],
7056 [avoid linking multiple GCC front-ends at once using make
7057 dependencies to avoid thrashing on the build machine])],
7058 do_link_serialization=$enableval,
7059 do_link_serialization=no)
7060AC_MSG_RESULT($do_link_serialization)
7061
7062case "$do_link_serialization" in
7063 yes)
7064 DO_LINK_SERIALIZATION=1;;
7065 [[1-9]] | [[1-9]][[0-9]] | [[1-9]][[0-9]][[0-9]])
7066 DO_LINK_SERIALIZATION=$do_link_serialization;;
7067 no)
7068 DO_LINK_SERIALIZATION=;;
7069 *)
7070 AC_MSG_ERROR(bad value ${do_link_serialization} given for --enable-link-serialization) ;;
7071esac
7072AC_SUBST(DO_LINK_SERIALIZATION)
7073
630327c3
NN
7074# --------------
7075# Language hooks
7076# --------------
7077
571a8de5
DE
7078# Make empty files to contain the specs and options for each language.
7079# Then add #include lines to for a compiler that has specs and/or options.
7080
cc11cc9b 7081subdirs=
d7b42618 7082lang_opt_files=
571a8de5 7083lang_specs_files=
3103b7db 7084lang_tree_files=
571a8de5
DE
7085# These (without "all_") are set in each config-lang.in.
7086# `language' must be a single word so is spelled singularly.
7087all_languages=
571a8de5 7088all_compilers=
fda9c731 7089all_outputs='Makefile'
223bf296
TS
7090# List of language configure and makefile fragments.
7091all_lang_configurefrags=
2ed26f6b 7092all_lang_makefrags=
11a67599 7093# Additional files for gengtype
ef69da62 7094all_gtfiles="$target_gtfiles"
571a8de5 7095
cc11cc9b
PB
7096# These are the languages that are set in --enable-languages,
7097# and are available in the GCC tree.
7098all_selected_languages=
7099
571a8de5
DE
7100# Add the language fragments.
7101# Languages are added via two mechanisms. Some information must be
7102# recorded in makefile variables, these are defined in config-lang.in.
7103# We accumulate them and plug them into the main Makefile.
7104# The other mechanism is a set of hooks for each of the main targets
7105# like `clean', `install', etc.
7106
571a8de5
DE
7107language_hooks="Make-hooks"
7108
cc11cc9b 7109for lang in ${srcdir}/*/config-lang.in
571a8de5 7110do
cc11cc9b 7111changequote(,)dnl
1546bb64
PB
7112 test "$lang" = "${srcdir}/*/config-lang.in" && continue
7113
cc11cc9b
PB
7114 lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
7115 if test "x$lang_alias" = x
7116 then
7117 echo "$lang doesn't set \$language." 1>&2
7118 exit 1
7119 fi
7120 subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
7121 subdirs="$subdirs $subdir"
349c3166
OH
7122
7123 # $gcc_subdir is where the gcc integration files are to be found
7124 # for a language, both for internal compiler purposes (compiler
7125 # sources implementing front-end to GCC tree converters), and for
7126 # build infrastructure purposes (Make-lang.in, etc.)
7127 #
7128 # This will be <subdir> (relative to $srcdir) if a line like
7129 # gcc_subdir="<subdir>" or gcc_subdir=<subdir>
7130 # is found in <langdir>/config-lang.in, and will remain <langdir>
7131 # otherwise.
7132 #
7133 # Except for the language alias (fetched above), the regular
7134 # "config-lang.in" contents are always retrieved from $gcc_subdir,
7135 # so a <langdir>/config-lang.in setting gcc_subdir typically sets
7136 # only this and the language alias.
7137
7138 gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^ ]*\).*$,\1,p' $lang`
7139 if [ "$gcc_subdir" = "" ]; then
7140 gcc_subdir="$subdir"
7141 fi
7142
cc11cc9b
PB
7143 case ",$enable_languages," in
7144 *,$lang_alias,*)
7145 all_selected_languages="$all_selected_languages $lang_alias"
349c3166
OH
7146 if test -f $srcdir/$gcc_subdir/lang-specs.h; then
7147 lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h"
cc11cc9b
PB
7148 fi
7149 ;;
7150 esac
7151changequote([,])dnl
7152
cc11cc9b
PB
7153 language=
7154 boot_language=
7155 compilers=
cc11cc9b
PB
7156 outputs=
7157 gtfiles=
1546bb64 7158 subdir_requires=
349c3166 7159 . ${srcdir}/$gcc_subdir/config-lang.in
cc11cc9b
PB
7160 if test "x$language" = x
7161 then
349c3166 7162 echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2
cc11cc9b
PB
7163 exit 1
7164 fi
1546bb64
PB
7165
7166 ok=:
7167 case ",$enable_languages," in
7168 *,$lang_alias,*) ;;
7169 *)
7170 for i in $subdir_requires; do
b6348cb3 7171 test -f "${srcdir}/$i/config-lang.in" && continue
1546bb64
PB
7172 ok=false
7173 break
7174 done
7175 ;;
7176 esac
7177 $ok || continue
7178
223bf296 7179 all_lang_configurefrags="$all_lang_configurefrags \$(srcdir)/$gcc_subdir/config-lang.in"
ff99d05f
JJ
7180 if test "x$language" = xc && test -n "$all_lang_makefrags"; then
7181 # Put c/Make-lang.in fragment first to match serialization languages order.
7182 all_lang_makefrags="\$(srcdir)/$gcc_subdir/Make-lang.in $all_lang_makefrags"
7183 else
7184 all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in"
7185 fi
349c3166
OH
7186 if test -f $srcdir/$gcc_subdir/lang.opt; then
7187 lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
fd438373 7188 all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt"
1546bb64 7189 fi
349c3166
OH
7190 if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then
7191 lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def"
1546bb64 7192 fi
cc11cc9b 7193 all_languages="$all_languages $language"
cc11cc9b 7194 all_compilers="$all_compilers $compilers"
cc11cc9b 7195 all_outputs="$all_outputs $outputs"
11a67599 7196 all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles"
d7f09764
DN
7197 case ",$enable_languages," in
7198 *,lto,*)
7199 AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.])
7200 enable_lto=yes
7201 AC_SUBST(enable_lto)
7202 ;;
7203 *) ;;
7204 esac
571a8de5
DE
7205done
7206
cbc59f01 7207check_languages=
cc11cc9b 7208for language in $all_selected_languages
cbc59f01 7209do
cc11cc9b 7210 check_languages="$check_languages check-$language"
cbc59f01
DD
7211done
7212
033eb567
DM
7213selftest_languages=
7214for language in $all_selected_languages
7215do
7216 selftest_languages="$selftest_languages selftest-$language"
7217done
7218
62b81e45 7219# We link each language in with a set of hooks, reached indirectly via
cc11cc9b 7220# lang.${target}. Only do so for selected languages.
571a8de5
DE
7221
7222rm -f Make-hooks
7223touch Make-hooks
bd97af06 7224target_list="all.cross start.encap rest.encap tags \
55bcd32b
AJ
7225 install-common install-man install-info install-pdf install-html dvi \
7226 pdf html uninstall info man srcextra srcman srcinfo \
2a4c0366 7227 mostlyclean clean distclean maintainer-clean install-plugin"
cc11cc9b 7228
571a8de5
DE
7229for t in $target_list
7230do
7231 x=
cc11cc9b 7232 for lang in $all_selected_languages
571a8de5 7233 do
cc11cc9b 7234 x="$x $lang.$t"
571a8de5
DE
7235 done
7236 echo "lang.$t: $x" >> Make-hooks
7237done
7238
d326ebc9
JJ
7239echo "ifeq (\$(DO_LINK_SERIALIZATION),)" >> Make-hooks
7240echo "SERIAL_LIST =" >> Make-hooks
7241echo else >> Make-hooks
7242lang_cnt=0
7243lang_list=
a774a6a2 7244prev=c
d326ebc9
JJ
7245serialization_languages=c
7246for lang in $all_selected_languages
7247do
7248 test $lang = c && continue
7249 if test $lang = lto; then
7250 serialization_languages="$serialization_languages lto1 lto2"
7251 else
7252 serialization_languages="$serialization_languages $lang"
7253 fi
7254done
7255for lang in $serialization_languages
7256do
7257 test $lang = c && continue
7258 lang_cnt=`expr $lang_cnt + 1`
7259 lang_list=" $prev$lang_list"
a774a6a2 7260 prev=${lang}
d326ebc9
JJ
7261done
7262echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks
7263echo endif >> Make-hooks
7264echo "SERIAL_COUNT = `expr $lang_cnt + 1`" >> Make-hooks
7265echo "INDEX.c = 0" >> Make-hooks
7266lang_idx=1
7267for lang in $serialization_languages
7268do
7269 test $lang = c && continue
a774a6a2 7270 echo "$lang.prev = \$(if \$(word $lang_cnt,\$(SERIAL_LIST)),\$(\$(word $lang_cnt,\$(SERIAL_LIST)).serial))" >> Make-hooks
d326ebc9
JJ
7271 echo "INDEX.$lang = $lang_idx" >> Make-hooks
7272 lang_cnt=`expr $lang_cnt - 1`
7273 lang_idx=`expr $lang_idx + 1`
7274done
7275
fd438373
MM
7276# --------
7277# Option include files
7278# --------
7279
7280${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk
7281option_includes="option-includes.mk"
7282AC_SUBST_FILE(option_includes)
7283
630327c3
NN
7284# --------
7285# UNSORTED
7286# --------
7287
cc06d68c 7288# Create .gdbinit.
296e46bd 7289
cc06d68c
GP
7290echo "dir ." > .gdbinit
7291echo "dir ${srcdir}" >> .gdbinit
7292if test x$gdb_needs_out_file_path = xyes
7293then
7294 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
7295fi
7296if test "x$subdirs" != x; then
7297 for s in $subdirs
7298 do
7299 echo "dir ${srcdir}/$s" >> .gdbinit
7300 done
296e46bd 7301fi
cc06d68c 7302echo "source ${srcdir}/gdbinit.in" >> .gdbinit
8dce4dbc 7303echo "python import sys; sys.path.append('${srcdir}'); import gdbhooks" >> .gdbinit
296e46bd 7304
3bd7b086
L
7305# Put a breakpoint on __asan_report_error to help with debugging buffer
7306# overflow.
7307case "$CFLAGS" in
7308*-fsanitize=address*)
7309 echo "source ${srcdir}/gdbasan.in" >> .gdbinit
7310 ;;
7311esac
7312
15c723f3 7313gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
d062c304 7314AC_SUBST(gcc_tooldir)
4c112cda 7315AC_SUBST(dollar)
d062c304 7316
2bbea3a6
RH
7317# Find a directory in which to install a shared libgcc.
7318
7319AC_ARG_ENABLE(version-specific-runtime-libs,
b88ecf55
AS
7320[AS_HELP_STRING([--enable-version-specific-runtime-libs],
7321 [specify that runtime libraries should be
7322 installed in a compiler-specific directory])])
2bbea3a6 7323
46f18e7b
RK
7324# Substitute configuration variables
7325AC_SUBST(subdirs)
8ac9d31f 7326AC_SUBST(srcdir)
46f18e7b 7327AC_SUBST(all_compilers)
e2500fed 7328AC_SUBST(all_gtfiles)
223bf296 7329AC_SUBST(all_lang_configurefrags)
2ed26f6b 7330AC_SUBST(all_lang_makefrags)
9f3d1bc2 7331AC_SUBST(all_languages)
cc11cc9b 7332AC_SUBST(all_selected_languages)
9f3d1bc2
BK
7333AC_SUBST(build_exeext)
7334AC_SUBST(build_install_headers_dir)
7335AC_SUBST(build_xm_file_list)
e22340b0 7336AC_SUBST(build_xm_include_list)
11642c3a 7337AC_SUBST(build_xm_defines)
a0e527e3 7338AC_SUBST(build_file_translate)
cbc59f01 7339AC_SUBST(check_languages)
033eb567 7340AC_SUBST(selftest_languages)
9f3d1bc2 7341AC_SUBST(cpp_install_dir)
2ed26f6b
ZW
7342AC_SUBST(xmake_file)
7343AC_SUBST(tmake_file)
aca600aa
AS
7344AC_SUBST(TM_ENDIAN_CONFIG)
7345AC_SUBST(TM_MULTILIB_CONFIG)
7346AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
30500d84 7347AC_SUBST(extra_gcc_objs)
9b91e436
KT
7348AC_SUBST(user_headers_inc_next_pre)
7349AC_SUBST(user_headers_inc_next_post)
9f3d1bc2 7350AC_SUBST(extra_headers_list)
46f18e7b 7351AC_SUBST(extra_objs)
9f3d1bc2 7352AC_SUBST(extra_programs)
9f3d1bc2 7353AC_SUBST(float_h_file)
cc1e60ea 7354AC_SUBST(gcc_config_arguments)
9f3d1bc2 7355AC_SUBST(gcc_gxx_include_dir)
17719d09 7356AC_SUBST(gcc_gxx_include_dir_add_sysroot)
662b9c55
IS
7357AC_SUBST(gcc_gxx_libcxx_include_dir)
7358AC_SUBST(gcc_gxx_libcxx_include_dir_add_sysroot)
9f3d1bc2 7359AC_SUBST(host_exeext)
46f18e7b 7360AC_SUBST(host_xm_file_list)
e22340b0 7361AC_SUBST(host_xm_include_list)
11642c3a 7362AC_SUBST(host_xm_defines)
476d9098 7363AC_SUBST(out_host_hook_obj)
9f3d1bc2 7364AC_SUBST(install)
d7b42618 7365AC_SUBST(lang_opt_files)
9f3d1bc2 7366AC_SUBST(lang_specs_files)
3103b7db 7367AC_SUBST(lang_tree_files)
46f18e7b 7368AC_SUBST(local_prefix)
9f3d1bc2
BK
7369AC_SUBST(md_file)
7370AC_SUBST(objc_boehm_gc)
7371AC_SUBST(out_file)
7372AC_SUBST(out_object_file)
c49a6962
JM
7373AC_SUBST(common_out_file)
7374AC_SUBST(common_out_object_file)
9f3d1bc2 7375AC_SUBST(tm_file_list)
e22340b0 7376AC_SUBST(tm_include_list)
d5355cb2 7377AC_SUBST(tm_defines)
11642c3a 7378AC_SUBST(tm_p_file_list)
e22340b0 7379AC_SUBST(tm_p_include_list)
b4c522fa
IB
7380AC_SUBST(tm_d_file_list)
7381AC_SUBST(tm_d_include_list)
e22340b0
ZW
7382AC_SUBST(xm_file_list)
7383AC_SUBST(xm_include_list)
3d9d2476 7384AC_SUBST(xm_defines)
207bf79d 7385AC_SUBST(use_gcc_stdint)
aac69a49
NC
7386AC_SUBST(c_target_objs)
7387AC_SUBST(cxx_target_objs)
c776a6d0 7388AC_SUBST(fortran_target_objs)
b4c522fa 7389AC_SUBST(d_target_objs)
11642c3a 7390AC_SUBST(target_cpu_default)
46f18e7b 7391
46f18e7b
RK
7392AC_SUBST_FILE(language_hooks)
7393
7903cebc
NN
7394# Echo link setup.
7395if test x${build} = x${host} ; then
7396 if test x${host} = x${target} ; then
7397 echo "Links are now set up to build a native compiler for ${target}." 1>&2
7398 else
7399 echo "Links are now set up to build a cross-compiler" 1>&2
7400 echo " from ${host} to ${target}." 1>&2
7401 fi
46f18e7b 7402else
7903cebc
NN
7403 if test x${host} = x${target} ; then
7404 echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
7405 echo " for ${target}." 1>&2
7406 else
7407 echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
7408 echo " from ${host} to ${target}." 1>&2
7409 fi
46f18e7b
RK
7410fi
7411
6de9cd9a
DN
7412AC_ARG_VAR(GMPLIBS,[How to link GMP])
7413AC_ARG_VAR(GMPINC,[How to find GMP include files])
7414
e357a5e0
SP
7415AC_ARG_VAR(ISLLIBS,[How to link isl])
7416AC_ARG_VAR(ISLINC,[How to find isl include files])
eae1a5d4
RG
7417if test "x${ISLLIBS}" != "x" ; then
7418 AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
7419fi
f8bf9252 7420
ddc8de03 7421GCC_ENABLE_PLUGINS
68a607d8
DN
7422AC_SUBST(pluginlibs)
7423AC_SUBST(enable_plugin)
7424if test x"$enable_plugin" = x"yes"; then
7425 AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
7426fi
7427
87e6d9dc 7428
459260ec
DM
7429# Enable --enable-host-shared
7430AC_ARG_ENABLE(host-shared,
7431[AS_HELP_STRING([--enable-host-shared],
7432 [build host code as shared libraries])],
7433[PICFLAG=-fPIC], [PICFLAG=])
7434AC_SUBST(enable_host_shared)
7435AC_SUBST(PICFLAG)
7436
7437
87e6d9dc
TB
7438AC_ARG_ENABLE(libquadmath-support,
7439[AS_HELP_STRING([--disable-libquadmath-support],
7440 [disable libquadmath support for Fortran])],
7441ENABLE_LIBQUADMATH_SUPPORT=$enableval,
7442ENABLE_LIBQUADMATH_SUPPORT=yes)
7443if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then
7444 AC_DEFINE(ENABLE_LIBQUADMATH_SUPPORT, 1,
7445 [Define to 1 to enable libquadmath support])
7446fi
7447
7448
79bec923
ST
7449# Specify what hash style to use by default.
7450AC_ARG_WITH([linker-hash-style],
7451[AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
7452 [specify the linker hash style])],
7453[case x"$withval" in
7454 xsysv)
7455 LINKER_HASH_STYLE=sysv
7456 ;;
7457 xgnu)
7458 LINKER_HASH_STYLE=gnu
7459 ;;
7460 xboth)
7461 LINKER_HASH_STYLE=both
7462 ;;
7463 *)
7464 AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style])
7465 ;;
7466 esac],
7467[LINKER_HASH_STYLE=''])
7468if test x"${LINKER_HASH_STYLE}" != x; then
7469 AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE",
7470 [The linker hash style])
7471fi
7472
899c78ae
JJ
7473# Specify what should be the default of -fdiagnostics-color option.
7474AC_ARG_WITH([diagnostics-color],
7475[AC_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}],
7476 [specify the default of -fdiagnostics-color option
7477 auto-if-env stands for -fdiagnostics-color=auto if
7478 GCC_COLOR environment variable is present and
7479 -fdiagnostics-color=never otherwise])],
7480[case x"$withval" in
7481 xnever)
7482 DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO
7483 ;;
7484 xauto)
7485 DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO
7486 ;;
7487 xauto-if-env)
7488 DIAGNOSTICS_COLOR_DEFAULT=-1
7489 ;;
7490 xalways)
7491 DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES
7492 ;;
7493 *)
7494 AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-color])
7495 ;;
7496 esac],
7497[DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO])
7498AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, $DIAGNOSTICS_COLOR_DEFAULT,
7499 [The default for -fdiagnostics-color option])
7500
458c8d64
BE
7501# Specify what should be the default of -fdiagnostics-urls option.
7502AC_ARG_WITH([diagnostics-urls],
7503[AC_HELP_STRING([--with-diagnostics-urls={never,auto,auto-if-env,always}],
7504 [specify the default of -fdiagnostics-urls option
7505 auto-if-env stands for -fdiagnostics-urls=auto if
7506 GCC_URLS or TERM_URLS environment variable is present and
7507 -fdiagnostics-urls=never otherwise])],
7508[case x"$withval" in
7509 xnever)
7510 DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_NO
7511 ;;
7512 xauto)
7513 DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_AUTO
7514 ;;
7515 xauto-if-env)
7516 DIAGNOSTICS_URLS_DEFAULT=-1
7517 ;;
7518 xalways)
7519 DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_YES
7520 ;;
7521 *)
7522 AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-urls])
7523 ;;
7524 esac],
7525[DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_AUTO])
7526AC_DEFINE_UNQUOTED(DIAGNOSTICS_URLS_DEFAULT, $DIAGNOSTICS_URLS_DEFAULT,
7527 [The default for -fdiagnostics-urls option])
7528
35485da9
DM
7529# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
7530# of jit/jit-playback.c.
001ddaa8
DM
7531gcc_driver_version=`eval "${get_gcc_base_ver} $srcdir/BASE-VER"`
7532echo "gcc_driver_version: ${gcc_driver_version}"
35485da9 7533cat > gcc-driver-name.h <<EOF
001ddaa8 7534#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_driver_version}${exeext}"
35485da9
DM
7535EOF
7536
428b3812
L
7537# Check whether --enable-default-pie was given.
7538AC_ARG_ENABLE(default-pie,
7539[AS_HELP_STRING([--enable-default-pie],
7540 [enable Position Independent Executable as default])],
7541enable_default_pie=$enableval,
7542enable_default_pie=no)
9a557138 7543if test x$enable_default_pie = xyes ; then
428b3812
L
7544 AC_DEFINE(ENABLE_DEFAULT_PIE, 1,
7545 [Define if your target supports default PIE and it is enabled.])
7546fi
7547AC_SUBST([enable_default_pie])
7548
7549# Check if -fno-PIE works.
7550AC_CACHE_CHECK([for -fno-PIE option],
7551 [gcc_cv_c_no_fpie],
fee22a80
L
7552 [saved_CXXFLAGS="$CXXFLAGS"
7553 CXXFLAGS="$CXXFLAGS -fno-PIE"
22e05272 7554 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
428b3812
L
7555 [gcc_cv_c_no_fpie=yes],
7556 [gcc_cv_c_no_fpie=no])
fee22a80 7557 CXXFLAGS="$saved_CXXFLAGS"])
428b3812
L
7558if test "$gcc_cv_c_no_fpie" = "yes"; then
7559 NO_PIE_CFLAGS="-fno-PIE"
7560fi
7561AC_SUBST([NO_PIE_CFLAGS])
7562
7563# Check if -no-pie works.
7564AC_CACHE_CHECK([for -no-pie option],
7565 [gcc_cv_no_pie],
7566 [saved_LDFLAGS="$LDFLAGS"
7567 LDFLAGS="$LDFLAGS -no-pie"
22e05272 7568 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
428b3812
L
7569 [gcc_cv_no_pie=yes],
7570 [gcc_cv_no_pie=no])
7571 LDFLAGS="$saved_LDFLAGS"])
7572if test "$gcc_cv_no_pie" = "yes"; then
7573 NO_PIE_FLAG="-no-pie"
7574fi
7575AC_SUBST([NO_PIE_FLAG])
7576
7e9c5bb0
L
7577# Enable Intel CET on Intel CET enabled host if jit is enabled.
7578GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
7579case x$enable_languages in
7580*jit*)
7581 ;;
7582*)
7583 CET_HOST_FLAGS=
7584 ;;
7585esac
7586AC_SUBST(CET_HOST_FLAGS)
7587
6de59c8a
IE
7588# Check linker supports '-z bndplt'
7589ld_bndplt_support=no
7590AC_MSG_CHECKING(linker -z bndplt option)
7591if test x"$ld_is_gold" = xno; then
7592 if test $in_tree_ld = yes ; then
7593 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
7594 ld_bndplt_support=yes
7595 fi
7596 elif test x$gcc_cv_ld != x; then
7597 # Check if linker supports -a bndplt option
8dc877eb 7598 if $gcc_cv_ld --help 2>&1 | grep -- '-z bndplt' > /dev/null; then
6de59c8a
IE
7599 ld_bndplt_support=yes
7600 fi
7601 fi
7602fi
7603if test x"$ld_bndplt_support" = xyes; then
7604 AC_DEFINE(HAVE_LD_BNDPLT_SUPPORT, 1,
7605 [Define if your linker supports -z bndplt])
7606fi
7607AC_MSG_RESULT($ld_bndplt_support)
7608
7e495577
AI
7609# Check linker supports '--push-state'/'--pop-state'
7610ld_pushpopstate_support=no
7611AC_MSG_CHECKING(linker --push-state/--pop-state options)
7612if test x"$ld_is_gold" = xno; then
7613 if test $in_tree_ld = yes ; then
7614 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
7615 ld_pushpopstate_support=yes
7616 fi
7617 elif test x$gcc_cv_ld != x; then
7618 # Check if linker supports --push-state/--pop-state options
8dc877eb 7619 if $gcc_cv_ld --help 2>&1 | grep -- '--push-state' > /dev/null; then
7e495577
AI
7620 ld_pushpopstate_support=yes
7621 fi
7622 fi
7623fi
7624if test x"$ld_pushpopstate_support" = xyes; then
7625 AC_DEFINE(HAVE_LD_PUSHPOPSTATE_SUPPORT, 1,
7626 [Define if your linker supports --push-state/--pop-state])
7627fi
7628AC_MSG_RESULT($ld_pushpopstate_support)
7629
a5dd6b69
MH
7630# On s390, float_t has historically been statically defined as double for no
7631# good reason. To comply with the C standard in the light of this definition,
7632# gcc has evaluated float expressions in double precision when in
7633# standards-compatible mode or when given -fexcess-precision=standard. To enable
7634# a smooth transition towards the new model used by most architectures, where
7635# gcc describes its behavior via the macro __FLT_EVAL_METHOD__ and glibc derives
7636# float_t from that, this behavior can be configured with
7637# --enable-s390-excess-float-precision. When given as enabled, that flag selects
33f92509
MH
7638# the old model. When omitted, native builds and cross compiles that have target
7639# libc headers will detect whether libc clamps float_t to double and in that
7640# case maintain the old model. Otherwise, they will default to the new model.
a5dd6b69
MH
7641AC_ARG_ENABLE(s390-excess-float-precision,
7642 [AS_HELP_STRING([--enable-s390-excess-float-precision],
7643 [on s390 targets, evaluate float with double precision
7644 when in standards-conforming mode])],
7645 [],[enable_s390_excess_float_precision=auto])
7646
7647case $target in
7648 s390*-linux*)
33f92509
MH
7649 if test x"$enable_s390_excess_float_precision" = xauto; then
7650 # Can we autodetect the behavior of the target libc?
7651 if test "$target" = "$host" -a "$host" = "$build"; then
7652 enable_s390_excess_float_precision=autodetect
7653 elif test "x$with_headers" != xno; then
7654 # cross build. are target headers available?
7655 # carefully coerce the build-system compiler to use target headers
7656 saved_CXXFLAGS="$CXXFLAGS"
47abe2ab
MH
7657 fixed_XGCC_FLAGS_FOR_TARGET=`echo "$XGCC_FLAGS_FOR_TARGET" | sed 's/-B/-idirafter/g'`
7658 CROSS_TEST_CXXFLAGS="-nostdinc $fixed_XGCC_FLAGS_FOR_TARGET"
33f92509
MH
7659 CXXFLAGS="$CROSS_TEST_CXXFLAGS"
7660 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7661#include <math.h>
7662]])], [enable_s390_excess_float_precision=autodetect], [])
7663 CXXFLAGS="$saved_CXXFLAGS"
7664 fi
7665
7666 if test x"$enable_s390_excess_float_precision" = xautodetect; then
7667 saved_CXXFLAGS="$CXXFLAGS"
7668 if ! test "$target" = "$host" -a "$host" = "$build"; then
7669 CXXFLAGS="$CROSS_TEST_CXXFLAGS"
7670 unset CROSS_TEST_CXXFLAGS
7671 fi
7672 AC_CACHE_CHECK([for glibc clamping float_t to double],
7673 gcc_cv_float_t_clamped_to_double, [
7674 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
a5dd6b69
MH
7675#define __FLT_EVAL_METHOD__ 0
7676#include <math.h>
33f92509
MH
7677int dummy[sizeof(float_t) == sizeof(double) ? 1 : -1];
7678]])],
7679 [gcc_cv_float_t_clamped_to_double=yes],
7680 [gcc_cv_float_t_clamped_to_double=no])])
7681 CXXFLAGS="$saved_CXXFLAGS"
7682 enable_s390_excess_float_precision="$gcc_cv_float_t_clamped_to_double"
7683 else
7684 # no way to detect behavior of target libc, default to new model
7685 enable_s390_excess_float_precision=no
a5dd6b69
MH
7686 fi
7687 fi
7688
7689 GCC_TARGET_TEMPLATE(ENABLE_S390_EXCESS_FLOAT_PRECISION)
7690 if test x"$enable_s390_excess_float_precision" = xyes; then
7691 AC_DEFINE(ENABLE_S390_EXCESS_FLOAT_PRECISION, 1,
7692[Define to enable evaluating float expressions with double precision in
7693standards-compatible mode on s390 targets.])
7694 fi
7695 ;;
7696esac
7697
46f18e7b
RK
7698# Configure the subdirectories
7699# AC_CONFIG_SUBDIRS($subdirs)
7700
7701# Create the Makefile
5891b37d 7702# and configure language subdirectories
914c5af7
NN
7703AC_CONFIG_FILES($all_outputs)
7704
7705AC_CONFIG_COMMANDS([default],
cdcc6a01 7706[
f1faaabd
NN
7707case ${CONFIG_HEADERS} in
7708 *auto-host.h:config.in*)
7709 echo > cstamp-h ;;
cdcc6a01 7710esac
2ed26f6b 7711# Make sure all the subdirs exist.
c49a6962 7712for d in $subdirs doc build common c-family
2ed26f6b 7713do
2ed26f6b 7714 test -d $d || mkdir $d
2ed26f6b 7715done
0d24f4d1 7716],
35f06ae4 7717[subdirs='$subdirs'])
914c5af7 7718AC_OUTPUT
fd438373 7719