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