2 # Process this file with autoconf to generate a configuration script.
4 # Copyright (C) 1997-2014 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
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
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 # --------------------------------
28 AC_CONFIG_SRCDIR(tree.c)
29 AC_CONFIG_HEADER(auto-host.h:config.in)
31 gcc_version=`cat $srcdir/BASE-VER`
33 # Determine the host, build, and target systems
38 # Determine the noncanonical target name, for directory use.
39 ACX_NONCANONICAL_TARGET
41 # Used for constructing correct paths for offload compilers.
42 real_target_noncanonical=${target_noncanonical}
45 # Determine the target- and build-specific subdirectories
48 # Set program_transform_name
51 # Check for bogus environment variables.
52 # Test if LIBRARY_PATH contains the notation for the current directory
53 # since this would lead to problems installing/building glibc.
54 # LIBRARY_PATH contains the current directory if one of the following
56 # - one of the terminals (":" and ";") is the first or last sign
57 # - two terminals occur directly after each other
58 # - the path contains an element with a dot in it
59 AC_MSG_CHECKING(LIBRARY_PATH variable)
61 case ${LIBRARY_PATH} in
62 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
63 library_path_setting="contains current directory"
66 library_path_setting="ok"
70 AC_MSG_RESULT($library_path_setting)
71 if test "$library_path_setting" != "ok"; then
73 *** LIBRARY_PATH shouldn't contain the current directory when
74 *** building gcc. Please change the environment variable
75 *** and run configure again.])
78 # Test if GCC_EXEC_PREFIX contains the notation for the current directory
79 # since this would lead to problems installing/building glibc.
80 # GCC_EXEC_PREFIX contains the current directory if one of the following
82 # - one of the terminals (":" and ";") is the first or last sign
83 # - two terminals occur directly after each other
84 # - the path contains an element with a dot in it
85 AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
87 case ${GCC_EXEC_PREFIX} in
88 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
89 gcc_exec_prefix_setting="contains current directory"
92 gcc_exec_prefix_setting="ok"
96 AC_MSG_RESULT($gcc_exec_prefix_setting)
97 if test "$gcc_exec_prefix_setting" != "ok"; then
99 *** GCC_EXEC_PREFIX shouldn't contain the current directory when
100 *** building gcc. Please change the environment variable
101 *** and run configure again.])
108 # Specify the local prefix
110 AC_ARG_WITH(local-prefix,
111 [AS_HELP_STRING([--with-local-prefix=DIR],
112 [specifies directory to put local include])],
113 [case "${withval}" in
114 yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
116 *) local_prefix=$with_local_prefix ;;
119 # Default local prefix if it is empty
120 if test x$local_prefix = x; then
121 local_prefix=/usr/local
124 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
125 # passed in by the toplevel make and thus we'd get different behavior
126 # depending on where we built the sources.
128 # Specify the g++ header file directory
129 AC_ARG_WITH(gxx-include-dir,
130 [AS_HELP_STRING([--with-gxx-include-dir=DIR],
131 [specifies directory to put g++ header files])],
132 [case "${withval}" in
133 yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
135 *) gcc_gxx_include_dir=$with_gxx_include_dir ;;
138 # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
139 if test x${gcc_gxx_include_dir} = x; then
140 if test x${enable_version_specific_runtime_libs} = xyes; then
141 gcc_gxx_include_dir='${libsubdir}/include/c++'
143 libstdcxx_incdir='include/c++/$(version)'
144 if test x$host != x$target; then
145 libstdcxx_incdir="$target_alias/$libstdcxx_incdir"
147 gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
151 gcc_gxx_include_dir_add_sysroot=0
152 if test "${with_sysroot+set}" = set; then
153 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
154 if test "${gcc_gxx_without_sysroot}"; then
155 gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
156 gcc_gxx_include_dir_add_sysroot=1
160 AC_ARG_WITH(cpp_install_dir,
161 [AC_HELP_STRING([--with-cpp-install-dir=DIR],
162 [install the user visible C preprocessor in DIR
163 (relative to PREFIX) as well as PREFIX/bin])],
164 [if test x$withval = xyes; then
165 AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
166 elif test x$withval != xno; then
167 cpp_install_dir=$withval
170 # We would like to our source tree to be readonly. However when releases or
171 # pre-releases are generated, the flex/bison generated files as well as the
172 # various formats of manuals need to be included along with the rest of the
173 # sources. Therefore we have --enable-generated-files-in-srcdir to do
176 AC_MSG_CHECKING([whether to place generated files in the source directory])
177 dnl generated-files-in-srcdir is disabled by default
178 AC_ARG_ENABLE(generated-files-in-srcdir,
179 [AS_HELP_STRING([--enable-generated-files-in-srcdir],
180 [put copies of generated files in source dir
181 intended for creating source tarballs for users
182 without texinfo bison or flex])],
183 generated_files_in_srcdir=$enableval,
184 generated_files_in_srcdir=no)
186 AC_MSG_RESULT($generated_files_in_srcdir)
188 if test "$generated_files_in_srcdir" = "yes"; then
195 # -------------------
196 # Find default linker
197 # -------------------
201 [AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])],
202 gnu_ld_flag="$with_gnu_ld",
205 # With pre-defined ld
207 [AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])],
208 DEFAULT_LINKER="$with_ld")
209 if test x"${DEFAULT_LINKER+set}" = x"set"; then
210 if test ! -x "$DEFAULT_LINKER"; then
211 AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
212 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
215 AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
216 [Define to enable the use of a default linker.])
219 AC_MSG_CHECKING([whether a default linker was specified])
220 if test x"${DEFAULT_LINKER+set}" = x"set"; then
221 if test x"$gnu_ld_flag" = x"no"; then
222 AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
224 AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
230 # With demangler in GNU ld
231 AC_ARG_WITH(demangler-in-ld,
232 [AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])],
233 demangler_in_ld="$with_demangler_in_ld",
236 # ----------------------
237 # Find default assembler
238 # ----------------------
242 [AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])],
243 gas_flag="$with_gnu_as",
247 [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])],
248 DEFAULT_ASSEMBLER="$with_as")
249 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
250 if test ! -x "$DEFAULT_ASSEMBLER"; then
251 AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
252 elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
255 AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
256 [Define to enable the use of a default assembler.])
259 AC_MSG_CHECKING([whether a default assembler was specified])
260 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
261 if test x"$gas_flag" = x"no"; then
262 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
264 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
274 # If a non-executable a.out is present (e.g. created by GNU as above even if
275 # invoked with -v only), the IRIX 6 native ld just overwrites the existing
276 # file, even when creating an executable, so an execution test fails.
277 # Remove possible default executable files to avoid this.
279 # FIXME: This really belongs into AC_PROG_CC and can be removed once
280 # Autoconf includes it.
281 rm -f a.out a.exe b.out
283 # Find the native compiler
286 ACX_PROG_GNAT([-I"$srcdir"/ada])
288 # Remove the -O2: for historical reasons, unless bootstrapping we prefer
289 # optimizations to be activated explicitly by the toplevel.
292 *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" `
293 CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;;
298 # Determine PICFLAG for target gnatlib.
299 GCC_PICFLAG_FOR_TARGET
300 AC_SUBST(PICFLAG_FOR_TARGET)
302 # -------------------------
303 # Check C compiler features
304 # -------------------------
306 AC_USE_SYSTEM_EXTENSIONS
312 # sizeof(char) is 1 by definition.
313 AC_CHECK_SIZEOF(void *)
314 AC_CHECK_SIZEOF(short)
316 AC_CHECK_SIZEOF(long)
317 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
319 if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
320 AC_MSG_ERROR([uint64_t or int64_t not found])
323 # check what underlying integer type int64_t uses
325 AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [
326 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
330 template <typename T> struct X { };
332 struct X<long> { typedef long t; };
333 ]], [[X<int64_t>::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])])
334 if test "$ac_cv_int64_t_type" = "long"; then
335 AC_DEFINE(INT64_T_IS_LONG, 1,
336 [Define if int64_t uses long as underlying type.])
338 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
342 template <typename T> struct X { };
344 struct X<long long> { typedef long long t; };
345 ]], [[X<int64_t>::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])])
352 # ---------------------
353 # Warnings and checking
354 # ---------------------
356 # Check $CC warning features (if it's GCC).
357 # We want to use -pedantic, but we don't want warnings about
361 # * C++11 narrowing conversions in { }
362 # So, we only use -pedantic if we can disable those warnings.
364 # In stage 1, disable -Wformat warnings from old GCCs about new % codes
365 AC_ARG_ENABLE(build-format-warnings,
366 AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
367 [],[enable_build_format_warnings=yes])
368 AS_IF([test $enable_build_format_warnings = no],
369 [wf_opt=-Wno-format],[wf_opt=])
370 ACX_PROG_CC_WARNING_OPTS(
371 m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt])), [loose_warn])
372 ACX_PROG_CC_WARNING_OPTS(
373 m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])),
375 ACX_PROG_CC_WARNING_OPTS(
376 m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
377 ACX_PROG_CC_WARNING_OPTS(
378 m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn])
379 ACX_PROG_CC_WARNING_OPTS(
380 m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
381 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
382 m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],
383 [-Wno-overlength-strings])), [strict_warn])
384 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn])
386 # The above macros do nothing if the compiler is not GCC. However, the
387 # Makefile has more goo to add other flags, so these variables are used
388 # to enable warnings only for GCC.
391 if test "x$GCC" = "xyes"; then
392 warn_cflags='$(GCC_WARN_CFLAGS)'
393 warn_cxxflags='$(GCC_WARN_CXXFLAGS)'
395 AC_SUBST(warn_cflags)
396 AC_SUBST(warn_cxxflags)
398 # Disable exceptions and RTTI if building with g++
399 ACX_PROG_CC_WARNING_OPTS(
400 m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])),
403 # Enable expensive internal checks
405 if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
409 AC_ARG_ENABLE(checking,
410 [AS_HELP_STRING([[--enable-checking[=LIST]]],
411 [enable expensive run-time checks. With LIST,
412 enable only specific categories of checks.
413 Categories are: yes,no,all,none,release.
414 Flags are: assert,df,fold,gc,gcac,gimple,misc,
415 rtlflag,rtl,runtime,tree,valgrind,types])],
416 [ac_checking_flags="${enableval}"],[
417 # Determine the default checks.
418 if test x$is_release = x ; then
419 ac_checking_flags=yes
421 ac_checking_flags=release
423 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
424 for check in release $ac_checking_flags
427 # these set all the flags to specific states
428 yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
429 ac_fold_checking= ; ac_gc_checking=1 ;
430 ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
431 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
432 ac_tree_checking=1 ; ac_valgrind_checking= ;
433 ac_types_checking=1 ;;
434 no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
435 ac_fold_checking= ; ac_gc_checking= ;
436 ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
437 ac_rtlflag_checking= ; ac_runtime_checking= ;
438 ac_tree_checking= ; ac_valgrind_checking= ;
439 ac_types_checking= ;;
440 all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
441 ac_fold_checking=1 ; ac_gc_checking=1 ;
442 ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
443 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
444 ac_tree_checking=1 ; ac_valgrind_checking= ;
445 ac_types_checking=1 ;;
446 release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
447 ac_fold_checking= ; ac_gc_checking= ;
448 ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
449 ac_rtlflag_checking= ; ac_runtime_checking=1 ;
450 ac_tree_checking= ; ac_valgrind_checking= ;
451 ac_types_checking= ;;
452 # these enable particular checks
453 assert) ac_assert_checking=1 ;;
454 df) ac_df_checking=1 ;;
455 fold) ac_fold_checking=1 ;;
456 gc) ac_gc_checking=1 ;;
457 gcac) ac_gc_always_collect=1 ;;
458 gimple) ac_gimple_checking=1 ;;
459 misc) ac_checking=1 ;;
460 rtl) ac_rtl_checking=1 ;;
461 rtlflag) ac_rtlflag_checking=1 ;;
462 runtime) ac_runtime_checking=1 ;;
463 tree) ac_tree_checking=1 ;;
464 types) ac_types_checking=1 ;;
465 valgrind) ac_valgrind_checking=1 ;;
466 *) AC_MSG_ERROR(unknown check category $check) ;;
472 if test x$ac_checking != x ; then
473 AC_DEFINE(ENABLE_CHECKING, 1,
474 [Define if you want more run-time sanity checks. This one gets a grab
475 bag of miscellaneous but relatively cheap checks.])
476 nocommon_flag=-fno-common
478 AC_SUBST(nocommon_flag)
479 if test x$ac_df_checking != x ; then
480 AC_DEFINE(ENABLE_DF_CHECKING, 1,
481 [Define if you want more run-time sanity checks for dataflow.])
483 if test x$ac_assert_checking != x ; then
484 AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
485 [Define if you want assertions enabled. This is a cheap check.])
487 if test x$ac_gimple_checking != x ; then
488 AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1,
489 [Define if you want operations on GIMPLE (the basic data structure of
490 the high-level optimizers) to be checked for dynamic type safety at
491 runtime. This is moderately expensive.])
493 GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
494 if test x$ac_runtime_checking != x ; then
495 AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
496 [Define if you want runtime assertions enabled. This is a cheap check.])
498 if test x$ac_tree_checking != x ; then
499 AC_DEFINE(ENABLE_TREE_CHECKING, 1,
500 [Define if you want all operations on trees (the basic data
501 structure of the front ends) to be checked for dynamic type safety
502 at runtime. This is moderately expensive. The tree browser debugging
503 routines will also be enabled by this option.
505 TREEBROWSER=tree-browser.o
508 if test x$ac_types_checking != x ; then
509 AC_DEFINE(ENABLE_TYPES_CHECKING, 1,
510 [Define if you want all gimple types to be verified after gimplifiation.
514 AC_SUBST(TREEBROWSER)
515 AC_SUBST(TREECHECKING)
516 if test x$ac_rtl_checking != x ; then
517 AC_DEFINE(ENABLE_RTL_CHECKING, 1,
518 [Define if you want all operations on RTL (the basic data structure
519 of the optimizer and back end) to be checked for dynamic type safety
520 at runtime. This is quite expensive.])
522 if test x$ac_rtlflag_checking != x ; then
523 AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
524 [Define if you want RTL flag accesses to be checked against the RTL
525 codes that are supported for each access macro. This is relatively
528 if test x$ac_gc_checking != x ; then
529 AC_DEFINE(ENABLE_GC_CHECKING, 1,
530 [Define if you want the garbage collector to do object poisoning and
531 other memory allocation checks. This is quite expensive.])
533 if test x$ac_gc_always_collect != x ; then
534 AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
535 [Define if you want the garbage collector to operate in maximally
536 paranoid mode, validating the entire heap and collecting garbage at
537 every opportunity. This is extremely expensive.])
539 if test x$ac_fold_checking != x ; then
540 AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
541 [Define if you want fold checked that it never destructs its argument.
542 This is quite expensive.])
544 valgrind_path_defines=
547 dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
548 dnl # an if statement. This was the source of very frustrating bugs
549 dnl # in converting to autoconf 2.5x!
550 AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
552 # It is certainly possible that there's valgrind but no valgrind.h.
553 # GCC relies on making annotations so we must have both.
554 AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>)
555 AC_PREPROC_IFELSE([AC_LANG_SOURCE(
556 [[#include <valgrind/memcheck.h>
557 #ifndef VALGRIND_DISCARD
558 #error VALGRIND_DISCARD not defined
560 [gcc_cv_header_valgrind_memcheck_h=yes],
561 [gcc_cv_header_valgrind_memcheck_h=no])
562 AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
563 AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
564 AC_PREPROC_IFELSE([AC_LANG_SOURCE(
565 [[#include <memcheck.h>
566 #ifndef VALGRIND_DISCARD
567 #error VALGRIND_DISCARD not defined
569 [gcc_cv_header_memcheck_h=yes],
570 [gcc_cv_header_memcheck_h=no])
571 AC_MSG_RESULT($gcc_cv_header_memcheck_h)
572 if test $gcc_cv_header_valgrind_memcheck_h = yes; then
573 AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
574 [Define if valgrind's valgrind/memcheck.h header is installed.])
576 if test $gcc_cv_header_memcheck_h = yes; then
577 AC_DEFINE(HAVE_MEMCHECK_H, 1,
578 [Define if valgrind's memcheck.h header is installed.])
581 if test x$ac_valgrind_checking != x ; then
582 AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
583 [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
584 if test "x$valgrind_path" = "x" \
585 || (test $have_valgrind_h = no \
586 && test $gcc_cv_header_memcheck_h = no \
587 && test $gcc_cv_header_valgrind_memcheck_h = no); then
588 AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
590 valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
591 valgrind_command="$valgrind_path -q"
592 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
593 [Define if you want to run subprograms and generated programs
594 through valgrind (a memory checker). This is extremely expensive.])
596 AC_SUBST(valgrind_path_defines)
597 AC_SUBST(valgrind_command)
599 # Enable code coverage collection
600 AC_ARG_ENABLE(coverage,
601 [AS_HELP_STRING([[--enable-coverage[=LEVEL]]],
602 [enable compiler's code coverage collection.
603 Use to measure compiler performance and locate
604 unused parts of the compiler. With LEVEL, specify
605 optimization. Values are opt, noopt,
607 [case "${enableval}" in
609 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
612 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
615 # a.k.a. --disable-coverage
619 AC_MSG_ERROR(unknown coverage setting $enableval)
623 AC_SUBST(coverage_flags)
625 AC_ARG_ENABLE(gather-detailed-mem-stats,
626 [AS_HELP_STRING([--enable-gather-detailed-mem-stats],
627 [enable detailed memory allocation stats gathering])], [],
628 [enable_gather_detailed_mem_stats=no])
629 gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi`
630 AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
631 [Define to enable detailed memory allocation stats gathering.])
633 AC_ARG_ENABLE(valgrind-annotations,
634 [AS_HELP_STRING([--enable-valgrind-annotations],
635 [enable valgrind runtime interaction])], [],
636 [enable_valgrind_annotations=no])
637 if test x$enable_valgrind_annotations != xno \
638 || test x$ac_valgrind_checking != x; then
639 if (test $have_valgrind_h = no \
640 && test $gcc_cv_header_memcheck_h = no \
641 && test $gcc_cv_header_valgrind_memcheck_h = no); then
642 AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h])
644 AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
645 [Define to get calls to the valgrind runtime enabled.])
648 # -------------------------------
649 # Miscenalleous configure options
650 # -------------------------------
654 [AS_HELP_STRING([--with-stabs],
655 [arrange to use stabs instead of host debug format])],
659 # Determine whether or not multilibs are enabled.
660 AC_ARG_ENABLE(multilib,
661 [AS_HELP_STRING([--enable-multilib],
662 [enable library support for multiple ABIs])],
663 [], [enable_multilib=yes])
664 AC_SUBST(enable_multilib)
666 # Determine whether or not multiarch is enabled.
667 AC_ARG_ENABLE(multiarch,
668 [AS_HELP_STRING([--enable-multiarch],
669 [enable support for multiarch paths])],
670 [case "${enableval}" in
671 yes|no|auto) enable_multiarch=$enableval;;
672 *) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;;
673 esac], [enable_multiarch=auto])
674 if test x${enable_multiarch} = xauto; then
675 if test x${with_native_system_header_dir} != x; then
676 ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)"
679 if test x$host != x$target && test "x$with_sysroot" = x; then
680 ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)"
684 AC_MSG_CHECKING(for multiarch configuration)
685 AC_SUBST(enable_multiarch)
686 AC_MSG_RESULT($enable_multiarch$ma_msg_suffix)
688 # needed for setting the multiarch name for soft-float/hard-float ABIs
692 # Enable __cxa_atexit for C++.
693 AC_ARG_ENABLE(__cxa_atexit,
694 [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
697 # Enable C extension for decimal float if target supports it.
698 GCC_AC_ENABLE_DECIMAL_FLOAT([$target])
700 dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi`
701 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
702 [Define to 1 to enable decimal float extension to C.])
704 # Use default_decimal_float for dependency.
705 enable_decimal_float=$default_decimal_float
707 bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi`
708 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid,
709 [Define to 1 to specify that we are using the BID decimal floating
710 point format instead of DPD])
712 # Enable C extension for fixed-point arithmetic.
713 AC_ARG_ENABLE(fixed-point,
714 [AS_HELP_STRING([--enable-fixed-point],
715 [enable fixed-point arithmetic extension to C])],
720 enable_fixed_point=yes
724 enable_fixed_point=yes
727 AC_MSG_WARN([fixed-point is not supported for this target, ignored])
728 enable_fixed_point=no
732 AC_SUBST(enable_fixed_point)
734 fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi`
735 AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint,
736 [Define to 1 to enable fixed-point arithmetic extension to C.])
739 # Pass with no value to take the default
740 # Pass with a value to specify a thread package
741 AC_ARG_ENABLE(threads,
742 [AS_HELP_STRING([[--enable-threads[=LIB]]],
743 [enable thread usage for target GCC,
744 using LIB thread package])],,
748 [AS_HELP_STRING([--enable-tls],
749 [enable or disable generation of tls code
750 overriding the assembler check for tls support])],
754 *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
755 Valid choices are 'yes' and 'no'.]) ;;
759 AC_ARG_ENABLE(objc-gc,
760 [AS_HELP_STRING([--enable-objc-gc],
761 [enable the use of Boehm's garbage collector with
762 the GNU Objective-C runtime])],
763 if test x$enable_objc_gc = xno; then
771 [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])],
772 dwarf2="$with_dwarf2",
775 AC_ARG_ENABLE(shared,
776 [AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])],
778 case $enable_shared in
782 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
783 for pkg in $enableval; do
784 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
791 ], [enable_shared=yes])
792 AC_SUBST(enable_shared)
794 AC_ARG_WITH([native-system-header-dir],
795 [ --with-native-system-header-dir=dir
796 use dir as the directory to look for standard
797 system header files in. Defaults to /usr/include.],
799 case ${with_native_system_header_dir} in
800 yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
801 /* | [[A-Za-z]]:[[\\/]]*) ;;
802 *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
804 configured_native_system_header_dir="${withval}"
805 ], [configured_native_system_header_dir=])
807 AC_ARG_WITH(build-sysroot,
808 [AS_HELP_STRING([--with-build-sysroot=sysroot],
809 [use sysroot as the system root during the build])],
810 [if test x"$withval" != x ; then
811 SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
813 [SYSROOT_CFLAGS_FOR_TARGET=])
814 AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
816 if test "x$prefix" = xNONE; then
817 test_prefix=/usr/local
821 if test "x$exec_prefix" = xNONE; then
822 test_exec_prefix=$test_prefix
824 test_exec_prefix=$exec_prefix
828 [AS_HELP_STRING([[--with-sysroot[=DIR]]],
829 [search for usr/lib, usr/include, et al, within DIR])],
831 case ${with_sysroot} in
832 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
833 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
836 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
837 CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
839 case ${TARGET_SYSTEM_ROOT} in
840 "${test_prefix}"|"${test_prefix}/"*|\
841 "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
842 '${prefix}'|'${prefix}/'*|\
843 '${exec_prefix}'|'${exec_prefix}/'*)
844 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
845 TARGET_SYSTEM_ROOT_DEFINE="$t"
850 TARGET_SYSTEM_ROOT_DEFINE=
851 CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
853 AC_SUBST(TARGET_SYSTEM_ROOT)
854 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
855 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
858 [AS_HELP_STRING([--with-specs=SPECS],
859 [add SPECS to driver command-line processing])],
860 [CONFIGURE_SPECS=$withval],
863 AC_SUBST(CONFIGURE_SPECS)
865 ACX_PKGVERSION([GCC])
866 ACX_BUGURL([http://gcc.gnu.org/bugs.html])
868 # Sanity check enable_languages in case someone does not run the toplevel
869 # configure # script.
870 AC_ARG_ENABLE(languages,
871 [AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])],
872 [case ,${enable_languages}, in
874 # go safe -- we cannot be much sure without the toplevel
876 # analysis of which target libs are present and usable
880 AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
885 enable_languages=c,${enable_languages}
888 [enable_languages=c])
890 AC_ARG_ENABLE(as-accelerator-for,
891 [AS_HELP_STRING([--enable-as-accelerator-for], [build compiler as accelerator target for given host])],
893 AC_DEFINE(ACCEL_COMPILER, 1,
894 [Define if this compiler should be built and used as the target
895 device compiler for OpenACC.])
896 enable_as_accelerator=yes
897 sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
898 program_transform_name=`echo $program_transform_name | sed $sedscript`
899 accel_dir_suffix=/accel/${target_noncanonical}
900 real_target_noncanonical=${enable_as_accelerator_for}
901 ], [enable_as_accelerator=no])
902 AC_SUBST(enable_as_accelerator)
904 AC_ARG_ENABLE(offload-targets,
905 [AS_HELP_STRING([--enable-offload-targets=LIST],
906 [enable offloading to devices from LIST])],
908 if test x"$enable_offload_targets" = x; then
909 AC_MSG_ERROR([no offload targets specified])
911 ], [enable_offload_targets=])
912 enable_offload_targets=`echo "$enable_offload_targets" | sed -e 's#,#:#g'`
913 AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$enable_offload_targets",
914 [Define to hold the list of target names suitable for offloading.])
915 if test x"$enable_offload_targets" != x; then
916 AC_DEFINE(ENABLE_OFFLOADING, 1,
917 [Define this to enable support for offloading.])
920 AC_ARG_WITH(multilib-list,
921 [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
923 with_multilib_list=default)
925 # -------------------------
926 # Checks for other programs
927 # -------------------------
931 # Find some useful tools
933 # We need awk to create options.c and options.h.
934 # Bail out if it's missing.
936 "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
943 AC_SUBST(ranlib_flags)
947 # See if cmp has --ignore-initial.
948 gcc_AC_PROG_CMP_IGNORE_INITIAL
950 # See if we have the mktemp command.
951 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
953 # See if makeinfo has been installed and is modern enough
954 # that we can use it.
955 ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
956 [GNU texinfo.* \([0-9][0-9.]*\)],
957 [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
958 if test $gcc_cv_prog_makeinfo_modern = no; then
960 *** Makeinfo is missing or too old.
961 *** Info documentation will not be built.])
968 # Is pod2man recent enough to regenerate manpages?
969 AC_MSG_CHECKING([for recent Pod::Man])
970 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
972 GENERATED_MANPAGES=generated-manpages
977 AC_SUBST(GENERATED_MANPAGES)
979 MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
982 dnl Don't use AC_PROG_LEX; we insist on flex.
983 dnl LEXLIB is not useful in gcc.
984 AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
987 AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
989 # Binutils are not build modules, unlike bison/flex/makeinfo. So we
990 # check for build == host before using them.
993 if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
994 && test -d ../binutils ; then
995 NM='${objdir}/../binutils/nm-new'
997 AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
1001 if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
1002 && test -d ../binutils ; then
1003 AR='${objdir}/../binutils/ar'
1005 AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
1008 # The jit documentation looks better if built with sphinx, but can be
1009 # built with texinfo if sphinx is not available.
1010 # Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
1011 AC_CHECK_PROG(doc_build_sys, sphinx-build, sphinx, texinfo)
1013 # --------------------
1014 # Checks for C headers
1015 # --------------------
1017 # Need to reject headers which give warnings, so that the -Werror bootstrap
1018 # works later. *sigh* This needs to come before all header checks.
1025 AC_HEADER_TIOCGWINSZ
1026 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
1027 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
1028 sys/resource.h sys/param.h sys/times.h sys/stat.h \
1029 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
1031 # Check for thread headers.
1032 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
1033 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1035 # These tests can't be done till we know if we have limits.h.
1039 # ----------------------
1040 # Checks for C++ headers
1041 # ----------------------
1043 dnl Autoconf will give an error in the configure script if there is no
1044 dnl C++ preprocessor. Hack to prevent that.
1045 m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl
1047 m4_popdef([AC_MSG_ERROR])[]dnl
1051 AC_CHECK_HEADERS(unordered_map)
1052 AC_CHECK_HEADERS(tr1/unordered_map)
1053 AC_CHECK_HEADERS(ext/hash_map)
1058 # Dependency checking.
1063 AC_CONFIG_COMMANDS([gccdepdir],[
1064 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
1065 for lang in $subdirs c-family common
1067 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
1068 done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
1070 ZW_PROG_COMPILER_DEPENDENCIES([CXX])
1078 # These libraries may be used by collect2.
1079 # We may need a special search path to get them linked.
1080 AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
1082 for libs in '' -lld -lmld \
1083 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
1084 '-L/usr/lib/cmplrs/cc3.11 -lmld'
1087 AC_TRY_LINK_FUNC(ldopen,
1088 [gcc_cv_collect2_libs="$libs"; break])
1091 test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
1092 case $gcc_cv_collect2_libs in
1094 *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
1096 AC_SUBST(COLLECT2_LIBS)
1098 # When building Ada code on Alpha, we need exc_resume which is usually in
1099 # -lexc. So test for it.
1102 AC_SEARCH_LIBS(exc_resume, exc)
1105 AC_SUBST(GNAT_LIBEXC)
1107 # To support -mcpu=native on Solaris/SPARC, we need libkstat.
1110 AC_SEARCH_LIBS(kstat_open, kstat)
1111 EXTRA_GCC_LIBS="$LIBS"
1113 AC_SUBST(EXTRA_GCC_LIBS)
1115 # Some systems put ldexp and frexp in libm instead of libc; assume
1116 # they're both in the same place. jcf-dump needs them.
1119 AC_SEARCH_LIBS(ldexp, m)
1124 # Use <inttypes.h> only if it exists,
1125 # doesn't clash with <sys/types.h>, declares intmax_t and defines
1127 AC_MSG_CHECKING(for inttypes.h)
1128 AC_CACHE_VAL(gcc_cv_header_inttypes_h,
1129 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1130 [[#define __STDC_FORMAT_MACROS
1131 #include <sys/types.h>
1132 #include <inttypes.h>]],
1137 [gcc_cv_header_inttypes_h=yes],
1138 [gcc_cv_header_inttypes_h=no])])
1139 AC_MSG_RESULT($gcc_cv_header_inttypes_h)
1140 if test $gcc_cv_header_inttypes_h = yes; then
1141 AC_DEFINE(HAVE_INTTYPES_H, 1,
1142 [Define if you have a working <inttypes.h> header file.])
1145 dnl Disabled until we have a complete test for buggy enum bitfields.
1146 dnl gcc_AC_C_ENUM_BF_UNSIGNED
1148 define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1149 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1150 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1151 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1152 putchar_unlocked putc_unlocked)
1153 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
1154 popen sysconf strsignal getrusage nl_langinfo \
1155 gettimeofday mbstowcs wcswidth mmap setlocale \
1156 gcc_UNLOCKED_FUNCS madvise)
1158 if test x$ac_cv_func_mbstowcs = xyes; then
1159 AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
1160 [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
1166 [gcc_cv_func_mbstowcs_works=yes],
1167 [gcc_cv_func_mbstowcs_works=no],
1168 [gcc_cv_func_mbstowcs_works=yes])])
1169 if test x$gcc_cv_func_mbstowcs_works = xyes; then
1170 AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1171 [Define this macro if mbstowcs does not crash when its
1172 first argument is NULL.])
1176 AC_CHECK_TYPE(ssize_t, int)
1177 AC_CHECK_TYPE(caddr_t, char *)
1179 GCC_AC_FUNC_MMAP_BLACKLIST
1183 # Under VMS, vfork works very differently than on Unix. The standard test
1184 # won't work, and it isn't easily adaptable. It makes more sense to
1186 ac_cv_func_vfork_works=yes
1191 # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different
1192 # iconv() prototype.
1197 # Until we have in-tree GNU iconv:
1199 AC_SUBST(LIBICONV_DEP)
1205 # We will need to find libiberty.h and ansidecl.h
1206 saved_CFLAGS="$CFLAGS"
1207 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
1208 saved_CXXFLAGS="$CXXFLAGS"
1209 CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
1210 gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
1211 stpcpy strnlen strsignal strstr strverscmp \
1212 errno snprintf vsnprintf vasprintf malloc realloc calloc \
1213 free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
1214 #include "ansidecl.h"
1215 #include "system.h"])
1217 gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
1218 #include "ansidecl.h"
1220 #ifdef HAVE_SYS_RESOURCE_H
1221 #include <sys/resource.h>
1225 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1226 #include "ansidecl.h"
1228 #ifdef HAVE_SYS_RESOURCE_H
1229 #include <sys/resource.h>
1231 ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
1232 [Define to `long' if <sys/resource.h> doesn't define.])])
1234 # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
1235 # FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname
1236 # in collect2.c, <fcntl.h> isn't visible, but the configure test below needs
1237 # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
1238 gcc_AC_CHECK_DECLS(ldgetname, , ,[
1239 #include "ansidecl.h"
1248 gcc_AC_CHECK_DECLS(times, , ,[
1249 #include "ansidecl.h"
1251 #ifdef HAVE_SYS_TIMES_H
1252 #include <sys/times.h>
1256 gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1257 #include "ansidecl.h"
1262 # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which hides the madvise()
1265 gcc_AC_CHECK_DECLS(madvise, , ,[
1266 #include "ansidecl.h"
1271 # More time-related stuff.
1272 AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
1273 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1274 #include "ansidecl.h"
1276 #ifdef HAVE_SYS_TIMES_H
1277 #include <sys/times.h>
1279 ]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
1280 if test $ac_cv_struct_tms = yes; then
1281 AC_DEFINE(HAVE_STRUCT_TMS, 1,
1282 [Define if <sys/times.h> defines struct tms.])
1285 # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1286 # revisit after autoconf 2.50.
1287 AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
1288 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1289 #include "ansidecl.h"
1291 ]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
1292 if test $gcc_cv_type_clock_t = yes; then
1293 AC_DEFINE(HAVE_CLOCK_T, 1,
1294 [Define if <time.h> defines clock_t.])
1297 # Check if F_SETLKW is supported by fcntl.
1298 AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [
1299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1300 #include <fcntl.h>]], [[
1306 return fcntl (1, F_SETLKW, &fl);]])],
1307 [ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])])
1308 if test $ac_cv_f_setlkw = yes; then
1309 AC_DEFINE(HOST_HAS_F_SETLKW, 1,
1310 [Define if F_SETLKW supported by fcntl.])
1313 # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
1314 CFLAGS="$saved_CFLAGS"
1315 CXXFLAGS="$saved_CXXFLAGS"
1317 # mkdir takes a single argument on some systems.
1318 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
1326 # With Setjmp/Longjmp based exception handling.
1327 AC_ARG_ENABLE(sjlj-exceptions,
1328 [AS_HELP_STRING([--enable-sjlj-exceptions],
1329 [arrange to use setjmp/longjmp exception handling])],
1332 if test $enableval != yes; then
1333 AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced])
1338 force_sjlj_exceptions=yes],
1341 force_sjlj_exceptions=yes
1345 force_sjlj_exceptions=yes
1349 force_sjlj_exceptions=no
1352 if test $force_sjlj_exceptions = yes; then
1353 sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1354 AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1355 [Define 0/1 to force the choice for exception handling model.])
1358 # --------------------------------------------------------
1359 # Build, host, and target specific configuration fragments
1360 # --------------------------------------------------------
1362 # Collect build-machine-specific information.
1363 . ${srcdir}/config.build
1365 # Collect host-machine-specific information.
1366 . ${srcdir}/config.host
1370 # Collect target-machine-specific information.
1371 . ${srcdir}/config.gcc
1373 extra_objs="${host_extra_objs} ${extra_objs}"
1374 extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
1376 # Default the target-machine variables that were not explicitly set.
1377 if test x"$tm_file" = x
1378 then tm_file=$cpu_type/$cpu_type.h; fi
1380 if test x"$extra_headers" = x
1381 then extra_headers=; fi
1383 if test x$md_file = x
1384 then md_file=$cpu_type/$cpu_type.md; fi
1386 if test x$out_file = x
1387 then out_file=$cpu_type/$cpu_type.c; fi
1389 if test x"$tmake_file" = x
1390 then tmake_file=$cpu_type/t-$cpu_type
1393 # Support --enable-initfini-array.
1394 if test x$enable_initfini_array != xno; then
1395 tm_file="${tm_file} initfini-array.h"
1398 if test x"$dwarf2" = xyes
1399 then tm_file="$tm_file tm-dwarf2.h"
1402 # Say what files are being used for the output code and MD file.
1403 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
1404 echo "Using \`$srcdir/config/$md_file' as machine description file."
1406 # If any of the xm_file variables contain nonexistent files, warn
1407 # about them and drop them.
1410 for x in $build_xm_file; do
1411 if test -f $srcdir/config/$x
1413 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1419 for x in $host_xm_file; do
1420 if test -f $srcdir/config/$x
1422 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1428 for x in $xm_file; do
1429 if test -f $srcdir/config/$x
1431 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1437 for f in $tm_file; do
1440 if test $count = ax; then
1441 echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1443 echo "Using the following target machine macro files:"
1444 for f in $tm_file; do
1445 echo " $srcdir/config/$f"
1449 if test x$use_long_long_for_widest_fast_int = xyes; then
1450 AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
1451 [Define to 1 if the 'long long' type is wider than 'long' but still
1452 efficiently supported by the host hardware.])
1455 gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi`
1456 AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.])
1458 gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
1459 AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.])
1462 for f in $host_xm_file; do
1465 if test $count = a; then
1467 elif test $count = ax; then
1468 echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1470 echo "Using the following host machine macro files:"
1471 for f in $host_xm_file; do
1472 echo " $srcdir/config/$f"
1475 echo "Using ${out_host_hook_obj} for host machine hooks."
1477 if test "$host_xm_file" != "$build_xm_file"; then
1479 for f in $build_xm_file; do
1482 if test $count = a; then
1484 elif test $count = ax; then
1485 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1487 echo "Using the following build machine macro files:"
1488 for f in $build_xm_file; do
1489 echo " $srcdir/config/$f"
1494 if test -n "$configured_native_system_header_dir"; then
1495 native_system_header_dir=$configured_native_system_header_dir
1497 NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir"
1498 AC_SUBST(NATIVE_SYSTEM_HEADER_DIR)
1502 AC_CACHE_CHECK([whether mcontext_t fields have underscores],
1503 gcc_cv_mcontext_underscores,
1505 #include <sys/cdefs.h>
1506 #include <sys/signal.h>
1507 #include <ucontext.h>
1508 int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
1510 gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
1511 if test $gcc_cv_mcontext_underscores = yes; then
1512 AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
1513 [mcontext_t fields start with __])
1522 # Check if a valid thread package
1523 case ${enable_threads} in
1526 target_thread_file='single'
1530 target_thread_file='single'
1532 aix | dce | lynx | mipssde | posix | rtems | \
1533 single | tpf | vxworks | win32)
1534 target_thread_file=${enable_threads}
1537 echo "${enable_threads} is an unknown thread package" 1>&2
1542 if test x${thread_file} = x; then
1543 # No thread file set by target-specific clauses in config.gcc,
1544 # so use file chosen by default logic above
1545 thread_file=${target_thread_file}
1553 if test x$enable___cxa_atexit = xyes || \
1554 test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
1555 if test x$host = x$target; then
1557 # mingw32 doesn't have __cxa_atexit but uses atexit registration
1558 # keyed to flag_use_cxa_atexit
1566 AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
1567 [echo "__cxa_atexit can't be enabled on this target"])
1571 # We can't check for __cxa_atexit when building a cross, so assume
1575 if test x$use_cxa_atexit = xyes; then
1576 AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
1577 [Define if you want to use __cxa_atexit, rather than atexit, to
1578 register C++ destructors for local statics and global objects.
1579 This is essential for fully standards-compliant handling of
1580 destructors, but requires __cxa_atexit in libc.])
1584 # Look for a file containing extra machine modes.
1585 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
1586 extra_modes_file='$(srcdir)'/config/${extra_modes}
1587 AC_SUBST(extra_modes_file)
1588 AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
1589 [Define to the name of a file containing a list of extra machine modes
1590 for this architecture.])
1593 # Convert extra_options into a form suitable for Makefile use.
1596 for f in $extra_options; do
1597 extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
1598 all_opt_files="$all_opt_files $srcdir/config/$f"
1600 AC_SUBST(extra_opt_files)
1602 # auto-host.h is the file containing items generated by autoconf and is
1603 # the first file included by config.h.
1604 # If host=build, it is correct to have bconfig include auto-host.h
1605 # as well. If host!=build, we are in error and need to do more
1606 # work to find out the build config parameters.
1607 if test x$host = x$build
1609 build_auto=auto-host.h
1611 # We create a subdir, then run autoconf in the subdir.
1612 # To prevent recursion we set host and build for the new
1613 # invocation of configure to the build for this invocation
1620 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
1621 *) realsrcdir=../${srcdir};;
1623 # Clearing GMPINC is necessary to prevent host headers being
1624 # used by the build compiler. Defining GENERATOR_FILE stops
1625 # system.h from including gmp.h.
1626 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
1627 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
1628 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
1629 GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
1630 ${realsrcdir}/configure \
1631 --enable-languages=${enable_languages-all} \
1632 --target=$target_alias --host=$build_alias --build=$build_alias
1634 # We just finished tests for the build machine, so rename
1635 # the file auto-build.h in the gcc directory.
1636 mv auto-host.h ../auto-build.h
1639 build_auto=auto-build.h
1641 AC_SUBST(build_subdir)
1643 tm_file="${tm_file} defaults.h"
1644 tm_p_file="${tm_p_file} tm-preds.h"
1645 host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1646 build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
1647 # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
1648 # put this back in temporarily.
1649 xm_file="auto-host.h ansidecl.h ${xm_file}"
1656 # Compile in configure arguments.
1657 if test -f configargs.h ; then
1658 # Being re-configured.
1659 gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
1660 gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1662 gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1665 # Double all backslashes and backslash all quotes to turn
1666 # gcc_config_arguments into a C string.
1667 sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
1668 $gcc_config_arguments
1670 gcc_config_arguments_str=`cat conftest.out`
1673 cat > configargs.h <<EOF
1674 /* Generated automatically. */
1675 static const char configuration_arguments[] = "$gcc_config_arguments_str";
1676 static const char thread_model[] = "$thread_file";
1678 static const struct {
1679 const char *name, *value;
1680 } configure_default_options[] = $configure_default_options;
1685 gcc_BASEVER=`cat $srcdir/BASE-VER`
1686 gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
1687 gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
1688 if test -f $srcdir/REVISION ; then
1689 gcc_REVISION=`cat $srcdir/REVISION`
1693 cat > plugin-version.h <<EOF
1694 #include "configargs.h"
1696 #define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'`
1697 #define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'`
1698 #define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'`
1699 #define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)
1701 static char basever[] = "$gcc_BASEVER";
1702 static char datestamp[] = "$gcc_DATESTAMP";
1703 static char devphase[] = "$gcc_DEVPHASE";
1704 static char revision[] = "$gcc_REVISION";
1706 /* FIXME plugins: We should make the version information more precise.
1707 One way to do is to add a checksum. */
1709 static struct plugin_gcc_version gcc_version = {basever, datestamp,
1711 configuration_arguments};
1715 # Internationalization
1716 ZW_GNU_GETTEXT_SISTER_DIR
1718 # If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
1719 # -liconv on the link line twice.
1720 case "$LIBINTL" in *$LIBICONV*)
1724 AC_ARG_ENABLE(secureplt,
1725 [AS_HELP_STRING([--enable-secureplt],
1726 [enable -msecure-plt by default for PowerPC])],
1729 AC_ARG_ENABLE(leading-mingw64-underscores,
1730 AS_HELP_STRING([--enable-leading-mingw64-underscores],
1731 [enable leading underscores on 64 bit mingw targets]),
1733 AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ],
1734 [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1,
1735 [Define if we should use leading underscore on 64 bit mingw targets])])
1738 [AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [],
1741 AC_ARG_ENABLE(frame-pointer,
1742 [AS_HELP_STRING([--enable-frame-pointer],
1743 [enable -fno-omit-frame-pointer by default for 32bit x86])], [],
1746 linux* | darwin[[8912]]*)
1747 # Enable -fomit-frame-pointer by default for Linux and Darwin with
1749 enable_frame_pointer=no
1752 enable_frame_pointer=yes
1757 # Windows32 Registry support for specifying GCC installation paths.
1758 AC_ARG_ENABLE(win32-registry,
1759 [AS_HELP_STRING([--disable-win32-registry],
1760 [disable lookup of installation paths in the
1761 Registry on Windows hosts])
1762 AS_HELP_STRING([--enable-win32-registry], [enable registry lookup (default)])
1763 AS_HELP_STRING([--enable-win32-registry=KEY],
1764 [use KEY instead of GCC version as the last portion
1765 of the registry key])],,)
1768 win32 | pe | cygwin* | mingw32* | uwin*)
1769 if test "x$enable_win32_registry" != xno; then
1770 AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
1773 if test "x$enable_win32_registry" != xno; then
1774 AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1775 [Define to 1 if installation paths should be looked up in the Windows
1776 Registry. Ignored on non-Windows hosts.])
1778 if test "x$enable_win32_registry" != xyes \
1779 && test "x$enable_win32_registry" != x; then
1780 AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
1781 [Define to be the last component of the Windows registry key under which
1782 to look for installation paths. The full key used will be
1783 HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
1784 The default is the GCC version number.])
1790 # Get an absolute path to the GCC top-level source directory
1791 holddir=`${PWDCMD-pwd}`
1793 topdir=`${PWDCMD-pwd}`
1796 # Conditionalize the makefile for this host machine.
1798 for f in ${host_xmake_file}
1800 if test -f ${srcdir}/config/$f
1802 xmake_file="${xmake_file} \$(srcdir)/config/$f"
1806 # Conditionalize the makefile for this target machine.
1808 for f in ${tmake_file}
1810 if test -f ${srcdir}/config/$f
1812 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
1815 tmake_file="${tmake_file_}"
1817 out_object_file=`basename $out_file .c`.o
1818 common_out_object_file=`basename $common_out_file .c`.o
1820 tm_file_list="options.h"
1821 tm_include_list="options.h insn-constants.h"
1822 for f in $tm_file; do
1825 f=`echo $f | sed 's/^..//'`
1826 tm_file_list="${tm_file_list} $f"
1827 tm_include_list="${tm_include_list} $f"
1830 tm_file_list="${tm_file_list} \$(srcdir)/$f"
1831 tm_include_list="${tm_include_list} $f"
1834 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
1835 tm_include_list="${tm_include_list} config/$f"
1842 for f in $tm_p_file; do
1845 tm_p_file_list="${tm_p_file_list} $f"
1846 tm_p_include_list="${tm_p_include_list} $f"
1849 tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
1850 tm_p_include_list="${tm_p_include_list} config/$f"
1856 for f in $xm_file; do
1859 xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
1860 xm_include_list="${xm_include_list} $f"
1863 xm_file_list="${xm_file_list} $f"
1864 xm_include_list="${xm_include_list} $f"
1867 xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
1868 xm_include_list="${xm_include_list} config/$f"
1874 host_xm_include_list=
1875 for f in $host_xm_file; do
1878 host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
1879 host_xm_include_list="${host_xm_include_list} $f"
1882 host_xm_file_list="${host_xm_file_list} $f"
1883 host_xm_include_list="${host_xm_include_list} $f"
1886 host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
1887 host_xm_include_list="${host_xm_include_list} config/$f"
1893 for f in $build_xm_file; do
1896 build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
1897 build_xm_include_list="${build_xm_include_list} $f"
1899 auto-build.h | auto-host.h )
1900 build_xm_file_list="${build_xm_file_list} $f"
1901 build_xm_include_list="${build_xm_include_list} $f"
1904 build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
1905 build_xm_include_list="${build_xm_include_list} config/$f"
1910 # Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
1911 # cross-compiler which does not use the native headers and libraries.
1912 # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1913 CROSS= AC_SUBST(CROSS)
1914 ALL=all.internal AC_SUBST(ALL)
1915 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
1917 if test "x$with_build_sysroot" != x; then
1918 build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
1920 # This value is used, even on a native system, because
1921 # CROSS_SYSTEM_HEADER_DIR is just
1922 # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR).
1923 build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
1926 if test x$host != x$target
1928 CROSS="-DCROSS_DIRECTORY_STRUCTURE"
1930 SYSTEM_HEADER_DIR=$build_system_header_dir
1931 case "$host","$target" in
1932 # Darwin crosses can use the host system's libraries and headers,
1933 # because of the fat library support. Of course, it must be the
1934 # same version of Darwin on both sides. Allow the user to
1935 # just say --target=foo-darwin without a version number to mean
1936 # "the version on this system".
1937 *-*-darwin*,*-*-darwin*)
1938 hostos=`echo $host | sed 's/.*-darwin/darwin/'`
1939 targetos=`echo $target | sed 's/.*-darwin/darwin/'`
1940 if test $hostos = $targetos -o $targetos = darwin ; then
1942 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
1947 i?86-*-*,x86_64-*-* \
1948 | powerpc*-*-*,powerpc64*-*-*)
1949 CROSS="$CROSS -DNATIVE_CROSS" ;;
1954 if test "x$with_headers" = x; then
1961 elif test "x$TARGET_SYSTEM_ROOT" != x; then
1962 SYSTEM_HEADER_DIR=$build_system_header_dir
1965 if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
1966 if test "x$with_headers" != x; then
1967 target_header_dir=$with_headers
1968 elif test "x$with_sysroot" = x; then
1969 target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
1970 elif test "x$with_build_sysroot" != "x"; then
1971 target_header_dir="${with_build_sysroot}${native_system_header_dir}"
1972 elif test "x$with_sysroot" = xyes; then
1973 target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
1975 target_header_dir="${with_sysroot}${native_system_header_dir}"
1978 target_header_dir=${native_system_header_dir}
1981 # If this is a cross-compiler that does not
1982 # have its own set of headers then define
1985 # If this is using newlib, without having the headers available now,
1986 # then define inhibit_libc in LIBGCC2_CFLAGS.
1987 # This prevents libgcc2 from containing any code which requires libc
1989 : ${inhibit_libc=false}
1990 if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
1991 test x$with_newlib = xyes ; } &&
1992 { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
1995 AC_SUBST(inhibit_libc)
1997 # When building gcc with a cross-compiler, we need to adjust things so
1998 # that the generator programs are still built with the native compiler.
1999 # Also, we cannot run fixincludes.
2001 # These are the normal (build=host) settings:
2002 CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
2003 CXX_FOR_BUILD='$(CXX)' AC_SUBST(CXX_FOR_BUILD)
2004 BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
2005 BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
2006 BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
2007 STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
2009 # And these apply if build != host, or we are generating coverage data
2010 if test x$build != x$host || test "x$coverage_flags" != x
2012 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
2013 BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
2014 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
2017 # Expand extra_headers to include complete path.
2018 # This substitutes for lots of t-* files.
2020 # Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
2021 for file in ${extra_headers} ; do
2022 extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
2025 # If use_gcc_tgmath is set, append ginclude/tgmath.h.
2026 if test x"$use_gcc_tgmath" = xyes
2027 then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
2030 # Define collect2 in Makefile.
2031 case $host_can_use_collect2 in
2033 *) collect2='collect2$(exeext)' ;;
2035 AC_SUBST([collect2])
2037 # Add a definition of USE_COLLECT2 if system wants one.
2038 case $use_collect2 in
2039 no) use_collect2= ;;
2042 host_xm_defines="${host_xm_defines} USE_COLLECT2"
2043 xm_defines="${xm_defines} USE_COLLECT2"
2044 case $host_can_use_collect2 in
2046 AC_MSG_ERROR([collect2 is required but cannot be built on this system])
2052 AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}",
2053 [Define to the name of the LTO plugin DSO that must be
2054 passed to the linker's -plugin=LIB option.])
2056 # ---------------------------
2057 # Assembler & linker features
2058 # ---------------------------
2060 # During stage 2, ld is actually gcc/collect-ld, which is a small script to
2061 # discern between when to use prev-ld/ld-new and when to use ld/ld-new.
2062 # However when ld-new is first executed from the build tree, libtool will
2063 # relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers
2064 # to the build tree. While doing this we need to use the previous-stage
2065 # linker, or we have an infinite loop. The presence of a shell script as
2066 # ld/ld-new, and the fact that the script *uses ld itself*, is what confuses
2067 # the gcc/collect-ld script. So we need to know how libtool works, or
2068 # exec-tool will fail.
2070 m4_defun([_LT_CONFIG_COMMANDS], [])
2073 AC_SUBST(enable_fast_install)
2075 # Identify the assembler which will work hand-in-glove with the newly
2076 # built GCC, so that we can examine its features. This is the assembler
2077 # which will be driven by the driver program.
2079 # If build != host, and we aren't building gas in-tree, we identify a
2080 # build->target assembler and hope that it will have the same features
2081 # as the host->target assembler we'll be using.
2082 gcc_cv_gas_major_version=
2083 gcc_cv_gas_minor_version=
2084 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
2086 m4_pattern_allow([AS_FOR_TARGET])dnl
2087 AS_VAR_SET_IF(gcc_cv_as,, [
2088 if test -x "$DEFAULT_ASSEMBLER"; then
2089 gcc_cv_as="$DEFAULT_ASSEMBLER"
2090 elif test -f $gcc_cv_as_gas_srcdir/configure.in \
2091 && test -f ../gas/Makefile \
2092 && test x$build = x$host; then
2093 gcc_cv_as=../gas/as-new$build_exeext
2094 elif test -x as$build_exeext; then
2095 # Build using assembler in the current directory.
2096 gcc_cv_as=./as$build_exeext
2097 elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then
2098 gcc_cv_as="$AS_FOR_TARGET"
2100 AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
2103 ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
2104 AC_SUBST(ORIGINAL_AS_FOR_TARGET)
2105 case "$ORIGINAL_AS_FOR_TARGET" in
2106 ./as | ./as$build_exeext) ;;
2107 *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
2110 AC_MSG_CHECKING(what assembler to use)
2111 if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then
2112 # Single tree build which includes gas. We want to prefer it
2113 # over whatever linker top-level may have detected, since
2114 # we'll use what we're building after installation anyway.
2115 AC_MSG_RESULT(newly built gas)
2117 _gcc_COMPUTE_GAS_VERSION
2118 in_tree_gas_is_elf=no
2119 if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2120 || (grep 'obj_format = multi' ../gas/Makefile \
2121 && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
2123 in_tree_gas_is_elf=yes
2126 AC_MSG_RESULT($gcc_cv_as)
2132 [[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]],
2133 [case "${enableval}" in
2139 install_gold_as_default=no
2141 [[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]],
2142 [case "${enableval}" in
2144 install_gold_as_default=yes
2147 if test x${default_ld} != x; then
2148 install_gold_as_default=yes
2154 AC_MSG_ERROR([invalid --enable-gold argument])
2158 # Identify the linker which will work hand-in-glove with the newly
2159 # built GCC, so that we can examine its features. This is the linker
2160 # which will be driven by the driver program.
2162 # If build != host, and we aren't building gas in-tree, we identify a
2163 # build->target linker and hope that it will have the same features
2164 # as the host->target linker we'll be using.
2165 gcc_cv_gld_major_version=
2166 gcc_cv_gld_minor_version=
2167 gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
2168 gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
2169 gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
2171 AS_VAR_SET_IF(gcc_cv_ld,, [
2172 if test -x "$DEFAULT_LINKER"; then
2173 gcc_cv_ld="$DEFAULT_LINKER"
2174 elif test $install_gold_as_default = yes \
2175 && test -f $gcc_cv_ld_gold_srcdir/configure.ac \
2176 && test -f ../gold/Makefile \
2177 && test x$build = x$host; then
2178 gcc_cv_ld=../gold/ld-new$build_exeext
2179 elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
2180 && test -f ../ld/Makefile \
2181 && test x$build = x$host; then
2182 gcc_cv_ld=../ld/ld-new$build_exeext
2183 elif test -x collect-ld$build_exeext; then
2184 # Build using linker in the current directory.
2185 gcc_cv_ld=./collect-ld$build_exeext
2186 elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then
2187 gcc_cv_ld="$LD_FOR_TARGET"
2189 AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
2192 ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
2193 PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"`
2194 # if the PLUGIN_LD is set ld-new, just have it as ld
2195 # as that is the installed named.
2196 if test x$PLUGIN_LD_SUFFIX = xld-new \
2197 || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then
2200 AC_ARG_WITH(plugin-ld,
2201 [AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])],
2202 [if test x"$withval" != x; then
2203 ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval"
2204 PLUGIN_LD_SUFFIX=`echo $withval | sed -e "s,$target_alias-,,"`
2206 AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET)
2207 AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker])
2209 # Check to see if we are using gold instead of ld
2210 AC_MSG_CHECKING(whether we are using gold)
2212 if test x$gcc_cv_ld != x; then
2213 if $gcc_cv_ld --version 2>/dev/null | sed 1q \
2214 | grep "GNU gold" > /dev/null; then
2218 AC_MSG_RESULT($ld_is_gold)
2220 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
2221 AC_SUBST(ORIGINAL_LD_FOR_TARGET)
2222 case "$ORIGINAL_LD_FOR_TARGET" in
2223 ./collect-ld | ./collect-ld$build_exeext) ;;
2224 *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
2227 AC_MSG_CHECKING(what linker to use)
2228 if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \
2229 || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then
2230 # Single tree build which includes ld. We want to prefer it
2231 # over whatever linker top-level may have detected, since
2232 # we'll use what we're building after installation anyway.
2233 AC_MSG_RESULT(newly built ld)
2235 in_tree_ld_is_elf=no
2236 if (grep 'EMUL = .*elf' ../ld/Makefile \
2237 || grep 'EMUL = .*linux' ../ld/Makefile \
2238 || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
2239 in_tree_ld_is_elf=yes
2240 elif test "$ld_is_gold" = yes; then
2241 in_tree_ld_is_elf=yes
2243 for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in
2246 gcc_cv_gld_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f`
2247 if test x$gcc_cv_gld_version != x; then
2251 case $gcc_cv_gld_version in
2254 *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;;
2257 gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
2258 gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
2260 ORIGINAL_LD_BFD_FOR_TARGET=../ld/ld-new$build_exeext
2261 ORIGINAL_LD_GOLD_FOR_TARGET=../gold/ld-new$build_exeext
2263 AC_MSG_RESULT($gcc_cv_ld)
2265 gcc_cvs_ld_program=`dirname $gcc_cv_ld`/`basename $gcc_cv_ld $host_exeext`
2266 ORIGINAL_LD_BFD_FOR_TARGET=${gcc_cvs_ld_program}.bfd$host_exeext
2267 ORIGINAL_LD_GOLD_FOR_TARGET=${gcc_cvs_ld_program}.gold$host_exeext
2270 AC_SUBST(ORIGINAL_LD_BFD_FOR_TARGET)
2271 AC_SUBST(ORIGINAL_LD_GOLD_FOR_TARGET)
2273 # Figure out what nm we will be using.
2274 gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
2275 AS_VAR_SET_IF(gcc_cv_nm,, [
2276 if test -f $gcc_cv_binutils_srcdir/configure.in \
2277 && test -f ../binutils/Makefile \
2278 && test x$build = x$host; then
2279 gcc_cv_nm=../binutils/nm-new$build_exeext
2280 elif test -x nm$build_exeext; then
2281 gcc_cv_nm=./nm$build_exeext
2282 elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then
2283 gcc_cv_nm="$NM_FOR_TARGET"
2285 AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
2288 AC_MSG_CHECKING(what nm to use)
2289 if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
2290 # Single tree build which includes binutils.
2291 AC_MSG_RESULT(newly built nm)
2294 AC_MSG_RESULT($gcc_cv_nm)
2298 ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
2299 AC_SUBST(ORIGINAL_NM_FOR_TARGET)
2300 case "$ORIGINAL_NM_FOR_TARGET" in
2301 ./nm | ./nm$build_exeext) ;;
2302 *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;;
2306 # Figure out what objdump we will be using.
2307 AS_VAR_SET_IF(gcc_cv_objdump,, [
2308 if test -f $gcc_cv_binutils_srcdir/configure.in \
2309 && test -f ../binutils/Makefile \
2310 && test x$build = x$host; then
2311 # Single tree build which includes binutils.
2312 gcc_cv_objdump=../binutils/objdump$build_exeext
2313 elif test -x objdump$build_exeext; then
2314 gcc_cv_objdump=./objdump$build_exeext
2315 elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then
2316 gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
2318 AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
2321 AC_MSG_CHECKING(what objdump to use)
2322 if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
2323 # Single tree build which includes binutils.
2324 AC_MSG_RESULT(newly built objdump)
2325 elif test x$gcc_cv_objdump = x; then
2326 AC_MSG_RESULT(not found)
2328 AC_MSG_RESULT($gcc_cv_objdump)
2331 # Figure out what readelf we will be using.
2332 AS_VAR_SET_IF(gcc_cv_readelf,, [
2333 if test -f $gcc_cv_binutils_srcdir/configure.in \
2334 && test -f ../binutils/Makefile \
2335 && test x$build = x$host; then
2336 # Single tree build which includes binutils.
2337 gcc_cv_readelf=../binutils/readelf$build_exeext
2338 elif test -x readelf$build_exeext; then
2339 gcc_cv_readelf=./readelf$build_exeext
2341 AC_PATH_PROG(gcc_cv_readelf, readelf)
2344 AC_MSG_CHECKING(what readelf to use)
2345 if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
2346 # Single tree build which includes binutils.
2347 AC_MSG_RESULT(newly built readelf)
2348 elif test x$gcc_cv_readelf = x; then
2349 AC_MSG_RESULT(not found)
2351 AC_MSG_RESULT($gcc_cv_readelf)
2354 # Figure out what assembler alignment features are present.
2355 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
2359 [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
2360 [Define if your assembler supports .balign and .p2align.])])
2362 gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
2365 [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
2366 [Define if your assembler supports specifying the maximum number
2367 of bytes to skip when using the GAS .p2align command.])])
2369 gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,
2372 [AC_DEFINE(HAVE_GAS_LITERAL16, 1,
2373 [Define if your assembler supports .literal16.])])
2375 gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
2377 [conftest_label1: .word 0
2379 conftest_label2: .word 0
2381 [if test x$gcc_cv_nm != x; then
2382 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
2383 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
2384 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
2386 else gcc_cv_as_subsection_m1=yes
2388 rm -f conftest.nm1 conftest.nm2
2390 [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
2391 [Define if your assembler supports .subsection and .subsection -1 starts
2392 emitting at the beginning of your section.])])
2394 gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
2397 [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
2399 gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
2401 [ .weakref foobar, barfnot],,
2402 [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
2404 gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
2407 .NSUBSPA $CODE$,COMDAT],,
2408 [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
2410 # .hidden needs to be supported in both the assembler and the linker,
2411 # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
2412 # This is irritatingly difficult to feature test for; we have to check the
2413 # date string after the version number. If we've got an in-tree
2414 # ld, we don't know its patchlevel version, so we set the baseline at 2.13
2416 # The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
2417 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
2423 # Darwin as has some visibility support, though with a different syntax.
2424 gcc_cv_as_hidden=yes
2428 # gnu_indirect_function type is an extension proposed at
2429 # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime
2430 # selection of function implementation
2431 AC_ARG_ENABLE(gnu-indirect-function,
2432 [AS_HELP_STRING([--enable-gnu-indirect-function],
2433 [enable the use of the @gnu_indirect_function to glibc systems])],
2434 [case $enable_gnu_indirect_function in
2436 *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function.
2437 Valid choices are 'yes' and 'no'.]) ;;
2439 [enable_gnu_indirect_function="$default_gnu_indirect_function"])
2441 gif=`if test x$enable_gnu_indirect_function = xyes; then echo 1; else echo 0; fi`
2442 AC_DEFINE_UNQUOTED(HAVE_GNU_INDIRECT_FUNCTION, $gif,
2443 [Define if your system supports gnu indirect functions.])
2447 if test $in_tree_ld != yes ; then
2448 ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
2449 if echo "$ld_ver" | grep GNU > /dev/null; then
2450 if test x"$ld_is_gold" = xyes; then
2451 # GNU gold --version looks like this:
2453 # GNU gold (GNU Binutils 2.21.51.20110225) 1.11
2455 # We extract the binutils version which is more familiar and specific
2456 # than the gold version.
2457 ld_vers=`echo $ld_ver | sed -n \
2458 -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
2460 # GNU ld --version looks like this:
2462 # GNU ld (GNU Binutils) 2.21.51.20110225
2463 ld_vers=`echo $ld_ver | sed -n \
2464 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
2466 ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
2467 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2468 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2469 ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
2473 # See acinclude.m4 (gcc_SUN_LD_VERSION) for the version number
2476 # Don't reuse gcc_gv_sun_ld_vers_* in case a linker other than
2477 # /usr/ccs/bin/ld has been configured.
2478 ld_ver=`$gcc_cv_ld -V 2>&1`
2479 if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then
2480 ld_vers=`echo $ld_ver | sed -n \
2481 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
2482 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2483 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2491 AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
2492 [[if test $in_tree_ld = yes ; then
2494 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 \
2495 && test $in_tree_ld_is_elf = yes; then
2496 gcc_cv_ld_hidden=yes
2499 gcc_cv_ld_hidden=yes
2500 if test x"$ld_is_gold" = xyes; then
2502 elif echo "$ld_ver" | grep GNU > /dev/null; then
2504 mmix-knuth-mmixware)
2505 # The linker emits by default mmo, not ELF, so "no" is appropriate.
2509 if test 0"$ld_date" -lt 20020404; then
2510 if test -n "$ld_date"; then
2511 # If there was date string, but was earlier than 2002-04-04, fail
2513 elif test -z "$ld_vers"; then
2514 # If there was no date string nor ld version number, something is wrong
2517 test -z "$ld_vers_patch" && ld_vers_patch=0
2518 if test "$ld_vers_major" -lt 2; then
2520 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
2521 gcc_cv_ld_hidden="no"
2522 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
2530 # Darwin ld has some visibility support.
2531 gcc_cv_ld_hidden=yes
2533 hppa64*-*-hpux* | ia64*-*-hpux*)
2534 gcc_cv_ld_hidden=yes
2536 *-*-solaris2.1[0-9]*)
2537 # Support for .hidden in Sun ld appeared in Solaris 9 FCS, but
2538 # .symbolic was only added in Solaris 9 12/02.
2539 gcc_cv_ld_hidden=yes
2547 libgcc_visibility=no
2548 AC_SUBST(libgcc_visibility)
2549 GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
2550 if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
2551 libgcc_visibility=yes
2552 AC_DEFINE(HAVE_GAS_HIDDEN, 1,
2553 [Define if your assembler and linker support .hidden.])
2556 AC_MSG_CHECKING(linker read-only and read-write section mixing)
2557 gcc_cv_ld_ro_rw_mix=unknown
2558 if test $in_tree_ld = yes ; then
2559 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 \
2560 && test $in_tree_ld_is_elf = yes; then
2561 gcc_cv_ld_ro_rw_mix=read-write
2563 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
2564 echo '.section myfoosect, "a"' > conftest1.s
2565 echo '.section myfoosect, "aw"' > conftest2.s
2566 echo '.byte 1' >> conftest2.s
2567 echo '.section myfoosect, "a"' > conftest3.s
2568 echo '.byte 0' >> conftest3.s
2569 if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
2570 && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
2571 && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
2572 && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
2573 conftest2.o conftest3.o > /dev/null 2>&1; then
2574 gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
2575 | sed -e '/myfoosect/!d' -e N`
2576 if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
2577 if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
2578 gcc_cv_ld_ro_rw_mix=read-only
2580 gcc_cv_ld_ro_rw_mix=read-write
2585 rm -f conftest.* conftest[123].*
2588 if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
2589 AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
2590 [Define if your linker links a mix of read-only
2591 and read-write sections into a read-write section.])
2593 AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
2595 gcc_AC_INITFINI_ARRAY
2597 # Check if we have .[us]leb128, and support symbol arithmetic with it.
2598 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
2606 [[# GAS versions before 2.11 do not support uleb128,
2607 # despite appearing to.
2608 # ??? There exists an elf-specific test that will crash
2609 # the assembler. Perhaps it's better to figure out whether
2610 # arbitrary sections are supported and try the test.
2611 as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
2612 if echo "$as_ver" | grep GNU > /dev/null; then
2613 as_vers=`echo $as_ver | sed -n \
2614 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
2615 as_major=`expr "$as_vers" : '\([0-9]*\)'`
2616 as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'`
2617 if test $as_major -eq 2 && test $as_minor -lt 11
2619 else gcc_cv_as_leb128=yes
2622 [AC_DEFINE(HAVE_AS_LEB128, 1,
2623 [Define if your assembler supports .sleb128 and .uleb128.])])
2625 # Check if we have assembler support for unwind directives.
2626 gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
2633 .cfi_escape 1, 2, 3, 4, 5
2637 # If the linker used on Solaris (like Sun ld) isn't capable of merging
2638 # read-only and read-write sections, we need to make sure that the
2639 # assembler used emits read-write .eh_frame sections.
2640 if test "x$gcc_cv_ld_ro_rw_mix" != xread-write; then
2641 if test "x$gcc_cv_objdump" != x; then
2642 if $gcc_cv_objdump -h conftest.o 2>/dev/null | \
2643 sed -e /.eh_frame/!d -e N | grep READONLY > /dev/null; then
2644 gcc_cv_as_cfi_directive=no
2647 i?86-*-solaris2.1[[0-9]]* | x86_64-*-solaris2.1[[0-9]]*)
2648 # On Solaris/x86, make sure that GCC and assembler agree on using
2649 # read-only .eh_frame sections for 64-bit.
2650 if test x$gas = xyes; then
2651 as_ix86_64_opt="--64"
2653 as_ix86_64_opt="-xarch=amd64"
2655 if $gcc_cv_as $as_ix86_64_opt -o conftest.o conftest.s > /dev/null 2>&1 && \
2656 $gcc_cv_objdump -h conftest.o 2>/dev/null | \
2657 sed -e /.eh_frame/!d -e N | \
2658 grep READONLY > /dev/null; then
2659 gcc_cv_as_cfi_directive=yes
2661 gcc_cv_as_cfi_directive=no
2665 gcc_cv_as_cfi_directive=yes
2670 # no objdump, err on the side of caution
2671 gcc_cv_as_cfi_directive=no
2674 gcc_cv_as_cfi_directive=yes
2678 gcc_cv_as_cfi_directive=yes
2681 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
2682 gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
2686 .cfi_adjust_cfa_offset 64
2688 .cfi_adjust_cfa_offset 128
2691 if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
2692 | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then
2693 gcc_cv_as_cfi_advance_working=yes
2697 # no objdump, err on the side of caution
2698 gcc_cv_as_cfi_advance_working=no
2700 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_DIRECTIVE)
2701 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
2702 [`if test $gcc_cv_as_cfi_directive = yes \
2703 && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`],
2704 [Define 0/1 if your assembler supports CFI directives.])
2706 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
2707 gcc_GAS_CHECK_FEATURE([cfi personality directive],
2708 gcc_cv_as_cfi_personality_directive, ,,
2711 .cfi_personality 0, symbol
2713 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
2714 [`if test $gcc_cv_as_cfi_personality_directive = yes;
2715 then echo 1; else echo 0; fi`],
2716 [Define 0/1 if your assembler supports .cfi_personality.])
2718 gcc_GAS_CHECK_FEATURE([cfi sections directive],
2719 gcc_cv_as_cfi_sections_directive, ,,
2721 .cfi_sections .debug_frame, .eh_frame
2725 win32 | pe | cygwin* | mingw32* | uwin*)
2726 # Need to check that we generated the correct relocation for the
2727 # .debug_frame section. This was fixed for binutils 2.21.
2728 gcc_cv_as_cfi_sections_directive=no
2729 if test "x$gcc_cv_objdump" != x; then
2730 if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \
2731 grep secrel > /dev/null; then
2732 gcc_cv_as_cfi_sections_directive=yes
2737 gcc_cv_as_cfi_sections_directive=yes
2740 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_SECTIONS_DIRECTIVE)
2741 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
2742 [`if test $gcc_cv_as_cfi_sections_directive = yes;
2743 then echo 1; else echo 0; fi`],
2744 [Define 0/1 if your assembler supports .cfi_sections.])
2746 # GAS versions up to and including 2.11.0 may mis-optimize
2748 gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
2756 .section .eh_frame,"aw",@progbits
2758 .4byte .LECIE1-.LSCIE1
2772 .4byte .LEFDE1-.LASFDE1
2774 .4byte .LASFDE1-__FRAME_BEGIN__
2782 [ dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
2783 cat > conftest.lit <<EOF
2784 0000 10000000 00000000 017a0001 781a0004 .........z..x...
2785 0010 01000000 12000000 18000000 00000000 ................
2786 0020 08000000 04080000 0044 .........D @&t@
2788 cat > conftest.big <<EOF
2789 0000 00000010 00000000 017a0001 781a0004 .........z..x...
2790 0010 00000001 00000012 00000018 00000000 ................
2791 0020 00000008 04000000 0844 .........D @&t@
2793 # If the assembler didn't choke, and we can objdump,
2794 # and we got the correct data, then succeed.
2795 # The text in the here-document typically retains its unix-style line
2796 # endings, while the output of objdump will use host line endings.
2797 # Therefore, use diff -b for the comparisons.
2798 if test x$gcc_cv_objdump != x \
2799 && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
2800 | tail -3 > conftest.got \
2801 && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \
2802 || diff -b conftest.big conftest.got > /dev/null 2>&1; }
2804 gcc_cv_as_eh_frame=yes
2805 elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
2806 gcc_cv_as_eh_frame=buggy
2808 # Uh oh, what do we do now?
2809 gcc_cv_as_eh_frame=no
2812 if test $gcc_cv_as_eh_frame = buggy; then
2813 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
2814 [Define if your assembler mis-optimizes .eh_frame data.])
2817 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2818 [elf,2,12,0], [--fatal-warnings],
2819 [.section .rodata.str, "aMS", @progbits, 1])
2820 if test $gcc_cv_as_shf_merge = no; then
2821 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2822 [elf,2,12,0], [--fatal-warnings],
2823 [.section .rodata.str, "aMS", %progbits, 1])
2825 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2826 [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2827 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
2829 gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)],
2830 gcc_cv_as_comdat_group,
2831 [elf,2,16,0], [--fatal-warnings],
2832 [.section .text,"axG",@progbits,.foo,comdat])
2833 if test $gcc_cv_as_comdat_group = yes; then
2834 gcc_cv_as_comdat_group_percent=no
2835 gcc_cv_as_comdat_group_group=no
2837 gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)],
2838 gcc_cv_as_comdat_group_percent,
2839 [elf,2,16,0], [--fatal-warnings],
2840 [.section .text,"axG",%progbits,.foo,comdat])
2841 if test $gcc_cv_as_comdat_group_percent = yes; then
2842 gcc_cv_as_comdat_group_group=no
2845 # Sun as uses a completely different syntax.
2850 .group foo,".text%foo",#comdat
2851 .section ".text%foo", #alloc,#execinstr,#progbits
2856 i?86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
2858 .group foo,.text%foo,#comdat
2859 .section .text%foo, "ax", @progbits
2865 gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)],
2866 gcc_cv_as_comdat_group_group,
2870 if test -z "${gcc_cv_as_comdat_group_group+set}"; then
2871 gcc_cv_as_comdat_group_group=no
2875 if test x"$ld_is_gold" = xyes; then
2877 elif test $in_tree_ld = yes ; then
2879 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 \
2880 && test $in_tree_ld_is_elf = yes; then
2883 elif echo "$ld_ver" | grep GNU > /dev/null; then
2885 if test 0"$ld_date" -lt 20050308; then
2886 if test -n "$ld_date"; then
2887 # If there was date string, but was earlier than 2005-03-08, fail
2889 elif test "$ld_vers_major" -lt 2; then
2891 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
2898 *-*-solaris2.1[1-9]*)
2900 # Sun ld has COMDAT group support since Solaris 9, but it doesn't
2901 # interoperate with GNU as until Solaris 11 build 130, i.e. ld
2904 # If using Sun as for COMDAT group as emitted by GCC, one needs at
2905 # least ld version 1.2267.
2906 if test "$ld_vers_major" -gt 1; then
2908 elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
2910 elif test "$ld_vers_minor" -ge 2267; then
2915 # Assume linkers other than GNU ld don't support COMDAT group.
2921 # Allow overriding the automatic COMDAT group tests above.
2922 AC_ARG_ENABLE(comdat,
2923 [AS_HELP_STRING([--enable-comdat], [enable COMDAT group support])],
2924 [comdat_group="$enable_comdat"])
2925 if test $comdat_group = no; then
2926 gcc_cv_as_comdat_group=no
2927 gcc_cv_as_comdat_group_percent=no
2928 gcc_cv_as_comdat_group_group=no
2930 AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
2931 [`if test $gcc_cv_as_comdat_group = yes \
2932 || test $gcc_cv_as_comdat_group_percent = yes \
2933 || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`],
2934 [Define 0/1 if your assembler and linker support COMDAT groups.])
2936 gcc_GAS_CHECK_FEATURE([line table discriminator support],
2937 gcc_cv_as_discriminator,
2941 .loc 1 1 0 discriminator 1],,
2942 [AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1,
2943 [Define if your assembler supports the .loc discriminator sub-directive.])])
2945 # Thread-local storage - the check is heavily parameterized.
2954 .section ".tdata","awT",@progbits
2957 ldq $27,__tls_get_addr($29) !literal!1
2958 lda $16,foo($29) !tlsgd!1
2959 jsr $26,($27),__tls_get_addr !lituse_tlsgd!1
2960 ldq $27,__tls_get_addr($29) !literal!2
2961 lda $16,foo($29) !tlsldm!2
2962 jsr $26,($27),__tls_get_addr !lituse_tlsldm!2
2963 ldq $1,foo($29) !gotdtprel
2964 ldah $2,foo($29) !dtprelhi
2965 lda $3,foo($2) !dtprello
2966 lda $4,foo($29) !dtprel
2967 ldq $1,foo($29) !gottprel
2968 ldah $2,foo($29) !tprelhi
2969 lda $3,foo($2) !tprello
2970 lda $4,foo($29) !tprel'
2973 tls_as_opt=--fatal-warnings
2975 cris-*-*|crisv32-*-*)
2977 .section ".tdata","awT",@progbits
2984 tls_as_opt=--fatal-warnings
2988 .section ".tdata","awT",@progbits
3000 .section ".tdata","awT",@progbits
3004 addil LT%foo-$tls_gdidx$,gp
3005 ldo RT%foo-$tls_gdidx$(%r1),%arg0
3008 addil LT%foo-$tls_ldidx$,gp
3010 ldo RT%foo-$tls_ldidx$(%r1),%arg0
3011 addil LR%foo-$tls_dtpoff$,%ret0
3012 ldo RR%foo-$tls_dtpoff$(%r1),%t1
3014 addil LT%foo-$tls_ieoff$,gp
3015 ldw RT%foo-$tls_ieoff$(%r1),%t2
3018 addil LR%foo-$tls_leoff$,%t1
3019 ldo RR%foo-$tls_leoff$(%r1),%t2'
3022 tls_as_opt=--fatal-warnings
3026 .section ".tdata","awT",%progbits
3037 i[34567]86-*-* | x86_64-*-*)
3039 i[34567]86-*-solaris2.* | x86_64-*-solaris2.1[0-9]*)
3046 if test x$on_solaris = xyes && test x$gas_flag = xno; then
3048 .section .tdata,"awt",@progbits'
3053 AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
3054 [Define to the flag used to mark TLS sections if the default (`T') doesn't work.])
3058 .section ".tdata","awT",@progbits'
3062 tls_as_opt="--fatal-warnings"
3066 conftest_s="$conftest_s
3070 leal foo@tlsgd(,%ebx,1), %eax
3071 leal foo@tlsldm(%ebx), %eax
3072 leal foo@dtpoff(%eax), %edx
3073 movl foo@gottpoff(%ebx), %eax
3074 subl foo@gottpoff(%ebx), %eax
3075 addl foo@gotntpoff(%ebx), %eax
3076 movl foo@indntpoff, %eax
3077 movl \$foo@tpoff, %eax
3078 subl \$foo@tpoff, %eax
3079 leal foo@ntpoff(%ecx), %eax"
3082 if test x$on_solaris = xyes; then
3084 yes) tls_as_opt="$tls_as_opt --64" ;;
3085 no) tls_as_opt="$tls_as_opt -xarch=amd64" ;;
3088 conftest_s="$conftest_s
3092 leaq foo@tlsgd(%rip), %rdi
3093 leaq foo@tlsld(%rip), %rdi
3094 leaq foo@dtpoff(%rax), %rdx
3095 movq foo@gottpoff(%rip), %rax
3096 movq \$foo@tpoff, %rax"
3102 .section ".tdata","awT",@progbits
3105 addl r16 = @ltoff(@dtpmod(foo#)), gp
3106 addl r17 = @ltoff(@dtprel(foo#)), gp
3107 addl r18 = @ltoff(@tprel(foo#)), gp
3108 addl r19 = @dtprel(foo#), gp
3109 adds r21 = @dtprel(foo#), r13
3110 movl r23 = @dtprel(foo#)
3111 addl r20 = @tprel(foo#), gp
3112 adds r22 = @tprel(foo#), r13
3113 movl r24 = @tprel(foo#)'
3116 tls_as_opt=--fatal-warnings
3120 .section .tdata,"awT",@progbits
3124 addik r5,r20,x@TLSGD
3125 addik r5,r20,x@TLSLDM'
3128 tls_as_opt='--fatal-warnings'
3132 .section .tdata,"awT",@progbits
3136 addiu $4, $28, %tlsgd(x)
3137 addiu $4, $28, %tlsldm(x)
3138 lui $4, %dtprel_hi(x)
3139 addiu $4, $4, %dtprel_lo(x)
3140 lw $4, %gottprel(x)($28)
3141 lui $4, %tprel_hi(x)
3142 addiu $4, $4, %tprel_lo(x)'
3145 tls_as_opt='-32 --fatal-warnings'
3149 .section .tdata,"awT",@progbits
3154 move.l x@TLSGD(%a5),%a0
3155 move.l x@TLSLDM(%a5),%a0
3156 move.l x@TLSLDO(%a5),%a0
3157 move.l x@TLSIE(%a5),%a0
3158 move.l x@TLSLE(%a5),%a0'
3161 tls_as_opt='--fatal-warnings'
3165 .section ".tdata","awT",@progbits'
3168 tls_as_opt="--fatal-warnings"
3172 .section ".tdata","awT",%progbits
3176 add x0, x0, #:tlsgd_lo12:x
3181 tls_as_opt='--fatal-warnings'
3185 .extern __get_tpointer
3203 .section ".tdata","awT",@progbits
3211 addi 3,2,ld0@got@tlsgd
3217 addi 3,2,x1@got@tlsld
3223 addis 9,3,x2@dtprel@ha
3224 addi 9,9,x2@dtprel@l
3227 ld 9,x3@got@dtprel(2)
3233 tls_as_opt="-a64 --fatal-warnings"
3237 .section ".tdata","awT",@progbits
3245 addi 3,31,ld0@got@tlsgd
3247 addi 3,31,x1@got@tlsld
3250 addis 9,3,x2@dtprel@ha
3251 addi 9,9,x2@dtprel@l
3252 lwz 9,x3@got@tprel(31)
3255 addis 9,2,x2@tprel@ha
3256 addi 9,9,x2@tprel@l'
3259 tls_as_opt="-a32 --fatal-warnings"
3263 .section ".tdata","awT",@progbits
3272 l %r1,foo@GOTNTPOFF(%r12)
3273 l %r1,0(%r1):tls_load:foo
3274 bas %r14,0(%r1,%r13):tls_gdcall:foo
3275 bas %r14,0(%r1,%r13):tls_ldcall:foo'
3278 tls_as_opt="-m31 --fatal-warnings"
3282 .section ".tdata","awT",@progbits
3290 lg %r1,foo@GOTNTPOFF(%r12)
3291 larl %r1,foo@INDNTPOFF
3292 brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo
3293 brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
3296 tls_as_opt="-m64 -Aesame --fatal-warnings"
3298 sh-*-* | sh[34]-*-*)
3300 .section ".tdata","awT",@progbits
3310 tls_as_opt=--fatal-warnings
3314 sparc*-sun-solaris2.*)
3321 if test x$on_solaris = xyes && test x$gas_flag = xno; then
3323 .section ".tdata",#alloc,#write,#tls'
3328 .section ".tdata","awT",@progbits'
3331 tls_as_opt="-32 --fatal-warnings"
3333 conftest_s="$conftest_s
3336 sethi %tgd_hi22(foo), %o0
3337 add %o0, %tgd_lo10(foo), %o1
3338 add %l7, %o1, %o0, %tgd_add(foo)
3339 call __tls_get_addr, %tgd_call(foo)
3340 sethi %tldm_hi22(foo), %l1
3341 add %l1, %tldm_lo10(foo), %l2
3342 add %l7, %l2, %o0, %tldm_add(foo)
3343 call __tls_get_addr, %tldm_call(foo)
3344 sethi %tldo_hix22(foo), %l3
3345 xor %l3, %tldo_lox10(foo), %l4
3346 add %o0, %l4, %l5, %tldo_add(foo)
3347 sethi %tie_hi22(foo), %o3
3348 add %o3, %tie_lo10(foo), %o3
3349 ld [%l7 + %o3], %o2, %tie_ld(foo)
3350 add %g7, %o2, %o4, %tie_add(foo)
3351 sethi %tle_hix22(foo), %l1
3352 xor %l1, %tle_lox10(foo), %o5
3353 ld [%g7 + %o5], %o1"
3357 .section ".tdata","awT",@progbits
3360 addli r0, zero, tls_gd(foo)
3361 auli r0, zero, tls_gd_ha16(foo)
3362 addli r0, r0, tls_gd_lo16(foo)
3364 addli r0, zero, tls_ie(foo)
3365 auli r0, r0, tls_ie_ha16(foo)
3366 addli r0, r0, tls_ie_lo16(foo)'
3369 tls_as_opt="--fatal-warnings"
3373 .section ".tdata","awT",@progbits
3376 shl16insli r0, zero, hw0_last_tls_gd(foo)
3377 shl16insli r0, zero, hw1_last_tls_gd(foo)
3378 shl16insli r0, r0, hw0_tls_gd(foo)
3380 shl16insli r0, zero, hw1_last_tls_ie(foo)
3381 shl16insli r0, r0, hw0_tls_ie(foo)'
3384 tls_as_opt="--fatal-warnings"
3388 .section ".tdata","awT",@progbits
3391 movi a8, foo@TLSFUNC
3392 movi a10, foo@TLSARG
3393 callx8.tls a8, foo@TLSCALL'
3400 if test "x$enable_tls" = xno ; then
3401 : # TLS explicitly disabled.
3402 elif test "x$enable_tls" = xyes ; then
3403 set_have_as_tls=yes # TLS explicitly enabled.
3404 elif test -z "$tls_first_major"; then
3405 : # If we don't have a check, assume no support.
3407 gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
3408 [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
3409 [set_have_as_tls=yes])
3411 if test $set_have_as_tls = yes ; then
3412 AC_DEFINE(HAVE_AS_TLS, 1,
3413 [Define if your assembler and linker support thread-local storage.])
3416 # Target-specific assembler checks.
3418 AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
3419 gcc_cv_ld_static_dynamic=no
3420 gcc_cv_ld_static_option='-Bstatic'
3421 gcc_cv_ld_dynamic_option='-Bdynamic'
3422 if test $in_tree_ld = yes ; then
3423 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
3424 gcc_cv_ld_static_dynamic=yes
3426 elif test x$gcc_cv_ld != x; then
3427 # Check if linker supports -Bstatic/-Bdynamic option
3428 if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
3429 && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
3430 gcc_cv_ld_static_dynamic=yes
3433 # AIX ld uses -b flags
3434 *-*-aix4.[[23]]* | *-*-aix[[5-9]]*)
3435 gcc_cv_ld_static_dynamic=yes
3436 gcc_cv_ld_static_option="-bstatic"
3437 gcc_cv_ld_dynamic_option="-bdynamic"
3439 # HP-UX ld uses -a flags to select between shared and archive.
3441 if test x"$gnu_ld" = xno; then
3442 gcc_cv_ld_static_dynamic=yes
3443 gcc_cv_ld_static_option="-aarchive_shared"
3444 gcc_cv_ld_dynamic_option="-adefault"
3447 # Solaris 2 ld always supports -Bstatic/-Bdynamic.
3449 gcc_cv_ld_static_dynamic=yes
3454 if test x"$gcc_cv_ld_static_dynamic" = xyes; then
3455 AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
3456 [Define if your linker supports -Bstatic/-Bdynamic or equivalent options.])
3457 AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option",
3458 [Define to the linker option to disable use of shared objects.])
3459 AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option",
3460 [Define to the linker option to enable use of shared objects.])
3462 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
3464 if test x"$demangler_in_ld" = xyes; then
3465 AC_MSG_CHECKING(linker --demangle support)
3466 gcc_cv_ld_demangle=no
3467 if test $in_tree_ld = yes; then
3468 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 \
3469 gcc_cv_ld_demangle=yes
3471 elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
3472 # Check if the GNU linker supports --demangle option
3473 if $gcc_cv_ld --help 2>/dev/null | grep no-demangle > /dev/null; then
3474 gcc_cv_ld_demangle=yes
3477 if test x"$gcc_cv_ld_demangle" = xyes; then
3478 AC_DEFINE(HAVE_LD_DEMANGLE, 1,
3479 [Define if your linker supports --demangle option.])
3481 AC_MSG_RESULT($gcc_cv_ld_demangle)
3484 AC_MSG_CHECKING(linker plugin support)
3486 if test -f liblto_plugin.la; then
3487 save_ld_ver="$ld_ver"
3488 save_ld_vers_major="$ld_vers_major"
3489 save_ld_vers_minor="$ld_vers_minor"
3490 save_ld_is_gold="$ld_is_gold"
3494 if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
3496 # FIXME: ld_is_gold?
3497 ld_vers_major="$gcc_cv_gld_major_version"
3498 ld_vers_minor="$gcc_cv_gld_minor_version"
3500 # Determine plugin linker version.
3501 # FIXME: Partial duplicate from above, generalize.
3503 ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q`
3504 if echo "$ld_ver" | grep GNU > /dev/null; then
3505 if echo "$ld_ver" | grep "GNU gold" > /dev/null; then
3507 ld_vers=`echo $ld_ver | sed -n \
3508 -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
3510 ld_vers=`echo $ld_ver | sed -n \
3511 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
3513 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
3514 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
3519 # Determine plugin support.
3520 if echo "$ld_ver" | grep GNU > /dev/null; then
3521 # Require GNU ld or gold 2.21+ for plugin support by default.
3522 if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then
3524 # Allow -fuse-linker-plugin to enable plugin support in GNU gold 2.20.
3525 elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then
3530 ld_ver="$save_ld_ver"
3531 ld_vers_major="$save_ld_vers_major"
3532 ld_vers_minor="$save_ld_vers_minor"
3533 ld_is_gold="$save_ld_is_gold"
3535 AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin,
3536 [Define to the level of your linker's plugin support.])
3537 AC_MSG_RESULT($gcc_cv_lto_plugin)
3541 gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,,
3542 [-mabi=lp64], [.text],,,)
3543 if test x$gcc_cv_as_aarch64_mabi = xyes; then
3544 AC_DEFINE(HAVE_AS_MABI_OPTION, 1,
3545 [Define if your assembler supports the -mabi option.])
3547 if test x$with_abi = xilp32; then
3548 AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
3549 Upgrade the Assembler.])
3551 if test x"$with_multilib_list" = xdefault; then
3552 TM_MULTILIB_CONFIG=lp64
3554 aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
3555 for aarch64_multilib in ${aarch64_multilibs}; do
3556 case ${aarch64_multilib} in
3558 AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
3559 Upgrade the Assembler.])
3567 # Enable default workaround for AArch64 Cortex-A53 erratum 835769.
3568 AC_ARG_ENABLE(fix-cortex-a53-835769,
3570 AS_HELP_STRING([--enable-fix-cortex-a53-835769],
3571 [enable workaround for AArch64 Cortex-A53 erratum 835769 by default])
3572 AS_HELP_STRING([--disable-fix-cortex-a53-835769],
3573 [disable workaround for AArch64 Cortex-A53 erratum 835769 by default])
3578 tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1"
3583 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\
3584 Valid choices are 'yes' and 'no'.])
3592 # All TARGET_ABI_OSF targets.
3593 alpha*-*-linux* | alpha*-*-*bsd*)
3594 gcc_GAS_CHECK_FEATURE([explicit relocation support],
3595 gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
3598 extbl $3, $2, $3 !lituse_bytoff!1
3599 ldq $2, a($29) !literal!1
3600 ldq $4, b($29) !literal!2
3601 ldq_u $3, 0($2) !lituse_base!1
3602 ldq $27, f($29) !literal!5
3603 jsr $26, ($27), f !lituse_jsr!5
3604 ldah $29, 0($26) !gpdisp!3
3605 lda $0, c($29) !gprel
3606 ldah $1, d($29) !gprelhigh
3607 lda $1, d($1) !gprellow
3608 lda $29, 0($29) !gpdisp!3],,
3609 [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
3610 [Define if your assembler supports explicit relocations.])])
3611 gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
3612 gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
3615 ldq $27, a($29) !literal!1
3616 jsr $26, ($27), a !lituse_jsrdirect!1],,
3617 [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
3618 [Define if your assembler supports the lituse_jsrdirect relocation.])])
3622 gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
3623 gcc_cv_as_cris_no_mul_bug,[2,15,91],
3624 [-no-mul-bug-abort], [.text],,
3625 [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
3626 [Define if your assembler supports the -no-mul-bug-abort option.])])
3630 gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
3631 [.register %g2, #scratch],,
3632 [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
3633 [Define if your assembler supports .register.])])
3635 gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,,
3636 [.section "nobits",#alloc,#write,#nobits
3637 .section "progbits",#alloc,#write,#progbits])
3638 AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS,
3639 [`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`],
3640 [Define to 1 if your assembler supports #nobits, 0 otherwise.])
3642 gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
3644 [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
3645 [Define if your assembler supports -relax option.])])
3647 gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs],
3648 gcc_cv_as_sparc_gotdata_op,,
3655 sethi %gdop_hix22(foo), %g1
3656 xor %g1, %gdop_lox10(foo), %g1
3657 ld [[%l7 + %g1]], %g2, %gdop(foo)],
3658 [if test x$gcc_cv_ld != x \
3659 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
3660 if test x$gcc_cv_objdump != x; then
3661 if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \
3662 | grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then
3663 gcc_cv_as_sparc_gotdata_op=no
3665 gcc_cv_as_sparc_gotdata_op=yes
3670 [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1,
3671 [Define if your assembler and linker support GOTDATA_OP relocs.])])
3673 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
3674 gcc_cv_as_sparc_ua_pcrel,,
3682 .uaword %r_disp32(foo)],
3683 [if test x$gcc_cv_ld != x \
3684 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
3685 gcc_cv_as_sparc_ua_pcrel=yes
3688 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
3689 [Define if your assembler and linker support unaligned PC relative relocs.])
3691 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
3692 gcc_cv_as_sparc_ua_pcrel_hidden,,
3697 .uaword %r_disp32(foo)
3698 .byte 0x32, 0x33, 0x34
3703 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
3704 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
3705 && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
3706 | grep ' 31000000 07323334' > /dev/null 2>&1; then
3707 if $gcc_cv_objdump -R conftest 2> /dev/null \
3708 | grep 'DISP32' > /dev/null 2>&1; then
3711 gcc_cv_as_sparc_ua_pcrel_hidden=yes
3715 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
3716 [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
3717 ]) # unaligned pcrel relocs
3719 gcc_GAS_CHECK_FEATURE([offsetable %lo()],
3720 gcc_cv_as_sparc_offsetable_lo10,,
3723 or %g1, %lo(ab) + 12, %g1
3724 or %g1, %lo(ab + 12), %g1],
3725 [if test x$gcc_cv_objdump != x \
3726 && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
3727 | grep ' 82106000 82106000' > /dev/null 2>&1; then
3728 gcc_cv_as_sparc_offsetable_lo10=yes
3730 [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
3731 [Define if your assembler supports offsetable %lo().])])
3733 gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions],
3734 gcc_cv_as_sparc_fmaf,,
3737 .register %g2, #scratch
3738 .register %g3, #scratch
3740 fmaddd %f0, %f2, %f4, %f6
3741 addxccc %g1, %g2, %g3
3742 fsrl32 %f2, %f4, %f8
3743 fnaddd %f10, %f12, %f14],,
3744 [AC_DEFINE(HAVE_AS_FMAF_HPC_VIS3, 1,
3745 [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])])
3747 gcc_GAS_CHECK_FEATURE([SPARC4 instructions],
3748 gcc_cv_as_sparc_sparc4,,
3751 .register %g2, #scratch
3752 .register %g3, #scratch
3755 1: cwbneg %g2, %g3, 1f
3758 aes_kexpand0 %f4, %f6, %f8
3759 des_round %f38, %f40, %f42, %f44
3760 camellia_f %f54, %f56, %f58, %f60
3761 kasumi_fi_xor %f46, %f48, %f50, %f52],,
3762 [AC_DEFINE(HAVE_AS_SPARC4, 1,
3763 [Define if your assembler supports SPARC4 instructions.])])
3765 gcc_GAS_CHECK_FEATURE([LEON instructions],
3766 gcc_cv_as_sparc_leon,,
3769 .register %g2, #scratch
3770 .register %g3, #scratch
3774 casa [[%g2]] 0xb, %g3, %g1],,
3775 [AC_DEFINE(HAVE_AS_LEON, 1,
3776 [Define if your assembler supports LEON instructions.])])
3780 i[34567]86-*-* | x86_64-*-*)
3784 # Full C++ conformance when using a shared libstdc++-v3 requires some
3785 # support from the Cygwin DLL, which in more recent versions exports
3786 # wrappers to aid in interposing and redirecting operators new, delete,
3787 # etc., as per n2800 #17.6.4.6 [replacement.functions]. Check if we
3788 # are configuring for a version of Cygwin that exports the wrappers.
3789 if test x$host = x$target && test x$host_cpu = xi686; then
3790 AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
3792 # Can't check presence of libc functions during cross-compile, so
3793 # we just have to assume we're building for an up-to-date target.
3794 gcc_ac_cygwin_dll_wrappers=yes
3796 AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
3797 [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
3798 [Define if you want to generate code by default that assumes that the
3799 Cygwin DLL exports wrappers to support libstdc++ function replacement.])
3802 cygwin* | pe | mingw32* | interix*)
3803 # Recent binutils allows the three-operand form of ".comm" on PE. This
3804 # definition is used unconditionally to initialise the default state of
3805 # the target option variable that governs usage of the feature.
3806 gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,
3807 [2,19,52],,[.comm foo,1,32])
3808 AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
3809 [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
3810 [Define if your assembler supports specifying the alignment
3811 of objects allocated using the GAS .comm command.])
3812 # Used for DWARF 2 in PE
3813 gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
3814 gcc_cv_as_ix86_pe_secrel32,
3820 [if test x$gcc_cv_ld != x \
3821 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
3822 gcc_cv_as_ix86_pe_secrel32=yes
3825 [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
3826 [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
3827 # Test if the assembler supports the extended form of the .section
3828 # directive that specifies section alignment. LTO support uses this,
3829 # but normally only after installation, so we warn but don't fail the
3830 # configure if LTO is enabled but the assembler does not support it.
3831 gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align,
3832 [2,20,1],-fatal-warnings,[.section lto_test,"dr0"])
3833 if test x$gcc_cv_as_section_has_align != xyes; then
3834 case ",$enable_languages," in
3836 AC_MSG_WARN([LTO for $target requires binutils >= 2.20.1, but version found appears insufficient; LTO will not work until binutils is upgraded.])
3843 # Test if the assembler supports the section flag 'e' for specifying
3844 # an excluded section.
3845 gcc_GAS_CHECK_FEATURE([.section with e], gcc_cv_as_section_has_e,
3846 [2,22,51], [--fatal-warnings],
3849 AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
3850 [`if test $gcc_cv_as_section_has_e = yes; then echo 1; else echo 0; fi`],
3851 [Define if your assembler supports specifying the section flag e.])
3853 gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
3854 gcc_cv_as_ix86_filds,,,
3855 [filds mem; fists mem],,
3856 [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
3857 [Define if your assembler uses filds and fists mnemonics.])])
3859 gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
3860 gcc_cv_as_ix86_fildq,,,
3861 [fildq mem; fistpq mem],,
3862 [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
3863 [Define if your assembler uses fildq and fistq mnemonics.])])
3865 gcc_GAS_CHECK_FEATURE([cmov syntax],
3866 gcc_cv_as_ix86_cmov_sun_syntax,,,
3867 [cmovl.l %edx, %eax],,
3868 [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
3869 [Define if your assembler supports the Sun syntax for cmov.])])
3871 gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
3872 gcc_cv_as_ix86_ffreep,,,
3874 [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
3875 [Define if your assembler supports the ffreep mnemonic.])])
3877 gcc_GAS_CHECK_FEATURE([.quad directive],
3878 gcc_cv_as_ix86_quad,,,
3880 [AC_DEFINE(HAVE_AS_IX86_QUAD, 1,
3881 [Define if your assembler supports the .quad directive.])])
3883 gcc_GAS_CHECK_FEATURE([sahf mnemonic],
3884 gcc_cv_as_ix86_sahf,,,
3887 [AC_DEFINE(HAVE_AS_IX86_SAHF, 1,
3888 [Define if your assembler supports the sahf mnemonic in 64bit mode.])])
3890 gcc_GAS_CHECK_FEATURE([interunit movq mnemonic],
3891 gcc_cv_as_ix86_interunit_movq,,,
3895 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ,
3896 [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`],
3897 [Define if your assembler supports interunit movq mnemonic.])
3899 gcc_GAS_CHECK_FEATURE([hle prefixes],
3900 gcc_cv_as_ix86_hle,,,
3901 [lock xacquire cmpxchg %esi, (%ecx)],,
3902 [AC_DEFINE(HAVE_AS_IX86_HLE, 1,
3903 [Define if your assembler supports HLE prefixes.])])
3905 gcc_GAS_CHECK_FEATURE([swap suffix],
3906 gcc_cv_as_ix86_swap,,,
3907 [movl.s %esp, %ebp],,
3908 [AC_DEFINE(HAVE_AS_IX86_SWAP, 1,
3909 [Define if your assembler supports the swap suffix.])])
3911 gcc_GAS_CHECK_FEATURE([different section symbol subtraction],
3912 gcc_cv_as_ix86_diff_sect_delta,,,
3920 [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1,
3921 [Define if your assembler supports the subtraction of symbols in different sections.])])
3923 # These two are used unconditionally by i386.[ch]; it is to be defined
3924 # to 1 if the feature is present, 0 otherwise.
3925 as_ix86_gotoff_in_data_opt=
3926 if test x$gas = xyes; then
3927 as_ix86_gotoff_in_data_opt="--32"
3929 gcc_GAS_CHECK_FEATURE([GOTOFF in data],
3930 gcc_cv_as_ix86_gotoff_in_data, [2,11,0],
3931 [$as_ix86_gotoff_in_data_opt],
3937 AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
3938 [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
3939 [Define true if the assembler supports '.long foo@GOTOFF'.])
3941 gcc_GAS_CHECK_FEATURE([rep and lock prefix],
3942 gcc_cv_as_ix86_rep_lock_prefix,,,
3948 lock addl %edi, (%eax,%esi)
3949 lock orl $0, (%esp)],,
3950 [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1,
3951 [Define if the assembler supports 'rep <insn>, lock <insn>'.])])
3953 gcc_GAS_CHECK_FEATURE([ud2 mnemonic],
3954 gcc_cv_as_ix86_ud2,,,
3956 [AC_DEFINE(HAVE_AS_IX86_UD2, 1,
3957 [Define if your assembler supports the 'ud2' mnemonic.])])
3959 gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
3960 gcc_cv_as_ix86_tlsgdplt,,,
3961 [call tls_gd@tlsgdplt],
3962 [if test x$gcc_cv_ld != x \
3963 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
3964 gcc_cv_as_ix86_tlsgdplt=yes
3967 [AC_DEFINE(HAVE_AS_IX86_TLSGDPLT, 1,
3968 [Define if your assembler and linker support @tlsgdplt.])])
3971 .section .tdata,"aw'$tls_section_flag'",@progbits
3973 .section .text,"ax",@progbits
3974 call tls_ld@tlsldmplt'
3975 gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc],
3976 gcc_cv_as_ix86_tlsldmplt,,,
3978 [if test x$gcc_cv_ld != x \
3979 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
3980 gcc_cv_as_ix86_tlsldmplt=yes
3983 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT,
3984 [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`],
3985 [Define to 1 if your assembler and linker support @tlsldmplt.])
3987 # Enforce 32-bit output with gas and gld.
3988 if test x$gas = xyes; then
3989 as_ix86_tls_ldm_opt="--32"
3991 if echo "$ld_ver" | grep GNU > /dev/null; then
3992 if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
3993 ld_ix86_tls_ldm_opt="-melf_i386_sol2"
3995 ld_ix86_tls_ldm_opt="-melf_i386"
3999 .section .text,"ax",@progbits
4001 .type _start, @function
4003 leal value@tlsldm(%ebx), %eax
4004 call ___tls_get_addr@plt
4006 .section .tdata,"aw'$tls_section_flag'",@progbits
4007 .type value, @object
4009 gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc],
4010 gcc_cv_as_ix86_tlsldm,,
4011 [$as_ix86_tls_ldm_opt],
4013 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
4014 && $gcc_cv_ld $ld_ix86_tls_ldm_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then
4015 if $gcc_cv_objdump -d conftest 2>/dev/null | grep nop > /dev/null \
4016 || dis conftest 2>/dev/null | grep nop > /dev/null; then
4017 gcc_cv_as_ix86_tlsldm=yes
4021 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDM,
4022 [`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`],
4023 [Define to 1 if your assembler and linker support @tlsldm.])
4028 gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
4029 gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
4031 addl r15 = @ltoffx(x#), gp
4033 ld8.mov r16 = [[r15]], x#],,
4034 [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
4035 [Define if your assembler supports ltoffx and ldxmov relocations.])])
4041 *-*-aix*) conftest_s=' .machine "pwr5"
4045 gcc_GAS_CHECK_FEATURE([.machine directive support],
4046 gcc_cv_as_machine_directive,,,
4047 [ .machine ppc7400])
4048 if test x$gcc_cv_as_machine_directive != xyes; then
4049 echo "*** This target requires an assembler supporting \".machine\"" >&2
4050 echo you can get it from: ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
4051 test x$build = x$target && exit 1
4055 *) conftest_s=' .machine power4
4060 gcc_GAS_CHECK_FEATURE([mfcr field support],
4061 gcc_cv_as_powerpc_mfcrf, [2,14,0],,
4063 [AC_DEFINE(HAVE_AS_MFCRF, 1,
4064 [Define if your assembler supports mfcr field.])])
4067 *-*-aix*) conftest_s=' .machine "pwr5"
4070 *) conftest_s=' .machine power5
4075 gcc_GAS_CHECK_FEATURE([popcntb support],
4076 gcc_cv_as_powerpc_popcntb, [2,17,0],,
4078 [AC_DEFINE(HAVE_AS_POPCNTB, 1,
4079 [Define if your assembler supports popcntb field.])])
4082 *-*-aix*) conftest_s=' .machine "pwr5x"
4085 *) conftest_s=' .machine power5
4090 gcc_GAS_CHECK_FEATURE([fp round support],
4091 gcc_cv_as_powerpc_fprnd, [2,17,0],,
4093 [AC_DEFINE(HAVE_AS_FPRND, 1,
4094 [Define if your assembler supports fprnd.])])
4097 *-*-aix*) conftest_s=' .machine "pwr6"
4100 *) conftest_s=' .machine power6
4105 gcc_GAS_CHECK_FEATURE([move fp gpr support],
4106 gcc_cv_as_powerpc_mfpgpr, [2,19,2],,
4108 [AC_DEFINE(HAVE_AS_MFPGPR, 1,
4109 [Define if your assembler supports mffgpr and mftgpr.])])
4112 *-*-aix*) conftest_s=' .csect .text[[PR]]
4114 addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
4118 addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
4119 *) conftest_s=' .text
4121 addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
4124 gcc_GAS_CHECK_FEATURE([rel16 relocs],
4125 gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
4127 [AC_DEFINE(HAVE_AS_REL16, 1,
4128 [Define if your assembler supports R_PPC_REL16 relocs.])])
4131 *-*-aix*) conftest_s=' .machine "pwr6"
4134 *) conftest_s=' .machine power6
4139 gcc_GAS_CHECK_FEATURE([compare bytes support],
4140 gcc_cv_as_powerpc_cmpb, [2,19,2], -a32,
4142 [AC_DEFINE(HAVE_AS_CMPB, 1,
4143 [Define if your assembler supports cmpb.])])
4146 *-*-aix*) conftest_s=' .machine "pwr6"
4149 *) conftest_s=' .machine power6
4154 gcc_GAS_CHECK_FEATURE([decimal float support],
4155 gcc_cv_as_powerpc_dfp, [2,19,2], -a32,
4157 [AC_DEFINE(HAVE_AS_DFP, 1,
4158 [Define if your assembler supports DFP instructions.])])
4161 *-*-aix*) conftest_s=' .machine "pwr7"
4164 *) conftest_s=' .machine power7
4169 gcc_GAS_CHECK_FEATURE([vector-scalar support],
4170 gcc_cv_as_powerpc_vsx, [2,19,2], -a32,
4172 [AC_DEFINE(HAVE_AS_VSX, 1,
4173 [Define if your assembler supports VSX instructions.])])
4176 *-*-aix*) conftest_s=' .machine "pwr7"
4179 *) conftest_s=' .machine power7
4184 gcc_GAS_CHECK_FEATURE([popcntd support],
4185 gcc_cv_as_powerpc_popcntd, [2,19,2], -a32,
4187 [AC_DEFINE(HAVE_AS_POPCNTD, 1,
4188 [Define if your assembler supports POPCNTD instructions.])])
4191 *-*-aix*) conftest_s=' .machine "pwr8"
4192 .csect .text[[PR]]';;
4193 *) conftest_s=' .machine power8
4197 gcc_GAS_CHECK_FEATURE([power8 support],
4198 gcc_cv_as_powerpc_power8, [2,19,2], -a32,
4200 [AC_DEFINE(HAVE_AS_POWER8, 1,
4201 [Define if your assembler supports POWER8 instructions.])])
4204 *-*-aix*) conftest_s=' .csect .text[[PR]]
4206 *) conftest_s=' .text
4210 gcc_GAS_CHECK_FEATURE([lwsync support],
4211 gcc_cv_as_powerpc_lwsync, [2,19,2], -a32,
4213 [AC_DEFINE(HAVE_AS_LWSYNC, 1,
4214 [Define if your assembler supports LWSYNC instructions.])])
4217 *-*-aix*) conftest_s=' .machine "476"
4220 *) conftest_s=' .machine "476"
4225 gcc_GAS_CHECK_FEATURE([data cache invalidate support],
4226 gcc_cv_as_powerpc_dci, [9,99,0], -a32,
4228 [AC_DEFINE(HAVE_AS_DCI, 1,
4229 [Define if your assembler supports the DCI/ICI instructions.])])
4231 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
4232 gcc_cv_as_powerpc_gnu_attribute, [2,18,0],,
4233 [.gnu_attribute 4,1],,
4234 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
4235 [Define if your assembler supports .gnu_attribute.])])
4237 gcc_GAS_CHECK_FEATURE([tls marker support],
4238 gcc_cv_as_powerpc_tls_markers, [2,20,0],,
4239 [ bl __tls_get_addr(x@tlsgd)],,
4240 [AC_DEFINE(HAVE_AS_TLS_MARKERS, 1,
4241 [Define if your assembler supports arg info for __tls_get_addr.])])
4245 gcc_GAS_CHECK_FEATURE([.ref support],
4246 gcc_cv_as_aix_ref, [2,21,0],,
4247 [ .csect stuff[[rw]]
4253 [AC_DEFINE(HAVE_AS_REF, 1,
4254 [Define if your assembler supports .ref])])
4260 gcc_GAS_CHECK_FEATURE([explicit relocation support],
4261 gcc_cv_as_mips_explicit_relocs, [2,14,0],,
4262 [ lw $4,%gp_rel(foo)($4)],,
4263 [if test x$target_cpu_default = x
4264 then target_cpu_default=MASK_EXPLICIT_RELOCS
4265 else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
4267 gcc_GAS_CHECK_FEATURE([-mno-shared support],
4268 gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],,
4269 [AC_DEFINE(HAVE_AS_NO_SHARED, 1,
4270 [Define if the assembler understands -mno-shared.])])
4272 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
4273 gcc_cv_as_mips_gnu_attribute, [2,18,0],,
4274 [.gnu_attribute 4,1],,
4275 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
4276 [Define if your assembler supports .gnu_attribute.])])
4278 gcc_GAS_CHECK_FEATURE([.module support],
4279 gcc_cv_as_mips_dot_module,,,
4281 [AC_DEFINE(HAVE_AS_DOT_MODULE, 1,
4282 [Define if your assembler supports .module.])])
4283 if test x$gcc_cv_as_mips_dot_module = xno \
4284 && test x$with_fp_32 != x; then
4286 [Requesting --with-fp-32= requires assembler support for .module.])
4289 gcc_GAS_CHECK_FEATURE([.micromips support],
4290 gcc_cv_as_micromips_support,,[--fatal-warnings],
4292 [AC_DEFINE(HAVE_GAS_MICROMIPS, 1,
4293 [Define if your assembler supports the .set micromips directive])])
4295 gcc_GAS_CHECK_FEATURE([.dtprelword support],
4296 gcc_cv_as_mips_dtprelword, [2,18,0],,
4297 [.section .tdata,"awT",@progbits
4301 .dtprelword x+0x8000],,
4302 [AC_DEFINE(HAVE_AS_DTPRELWORD, 1,
4303 [Define if your assembler supports .dtprelword.])])
4305 gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support],
4306 gcc_cv_as_mips_dspr1_mult,,,
4316 [AC_DEFINE(HAVE_AS_DSPR1_MULT, 1,
4317 [Define if your assembler supports DSPR1 mult.])])
4319 AC_MSG_CHECKING(assembler and linker for explicit JALR relocation)
4320 gcc_cv_as_ld_jalr_reloc=no
4321 if test $gcc_cv_as_mips_explicit_relocs = yes; then
4322 if test $in_tree_ld = yes ; then
4323 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 \
4324 && test $in_tree_ld_is_elf = yes; then
4325 gcc_cv_as_ld_jalr_reloc=yes
4327 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then
4328 echo ' .ent x' > conftest.s
4329 echo 'x: lw $2,%got_disp(y)($3)' >> conftest.s
4330 echo ' lw $25,%call16(y)($28)' >> conftest.s
4331 echo ' .reloc 1f,R_MIPS_JALR,y' >> conftest.s
4332 echo '1: jalr $25' >> conftest.s
4333 echo ' .reloc 1f,R_MIPS_JALR,x' >> conftest.s
4334 echo '1: jalr $25' >> conftest.s
4335 echo ' .end x' >> conftest.s
4336 if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \
4337 && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then
4338 if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null 2>&1 \
4339 && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null 2>&1; then
4340 gcc_cv_as_ld_jalr_reloc=yes
4346 if test $gcc_cv_as_ld_jalr_reloc = yes; then
4347 if test x$target_cpu_default = x; then
4348 target_cpu_default=MASK_RELAX_PIC_CALLS
4350 target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
4353 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
4355 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
4356 [gcc_cv_ld_mips_personality_relaxation],
4357 [gcc_cv_ld_mips_personality_relaxation=no
4358 if test $in_tree_ld = yes ; then
4359 if test "$gcc_cv_gld_major_version" -eq 2 \
4360 -a "$gcc_cv_gld_minor_version" -ge 21 \
4361 -o "$gcc_cv_gld_major_version" -gt 2; then
4362 gcc_cv_ld_mips_personality_relaxation=yes
4364 elif test x$gcc_cv_as != x \
4365 -a x$gcc_cv_ld != x \
4366 -a x$gcc_cv_readelf != x ; then
4367 cat > conftest.s <<EOF
4369 .cfi_personality 0x80,indirect_ptr
4376 .section .data,"aw",@progbits
4380 if $gcc_cv_as -KPIC -o conftest.o conftest.s > /dev/null 2>&1 \
4381 && $gcc_cv_ld -o conftest conftest.o -shared > /dev/null 2>&1; then
4382 if $gcc_cv_readelf -d conftest 2>&1 \
4383 | grep TEXTREL > /dev/null 2>&1; then
4385 elif $gcc_cv_readelf --relocs conftest 2>&1 \
4386 | grep 'R_MIPS_REL32 *$' > /dev/null 2>&1; then
4389 gcc_cv_ld_mips_personality_relaxation=yes
4393 rm -f conftest.s conftest.o conftest])
4394 if test x$gcc_cv_ld_mips_personality_relaxation = xyes; then
4395 AC_DEFINE(HAVE_LD_PERSONALITY_RELAXATION, 1,
4396 [Define if your linker can relax absolute .eh_frame personality
4397 pointers into PC-relative form.])
4400 gcc_GAS_CHECK_FEATURE([-mnan= support],
4401 gcc_cv_as_mips_nan,,
4403 [AC_DEFINE(HAVE_AS_NAN, 1,
4404 [Define if the assembler understands -mnan=.])])
4405 if test x$gcc_cv_as_mips_nan = xno \
4406 && test x$with_nan != x; then
4408 [Requesting --with-nan= requires assembler support for -mnan=])
4413 # Mips and HP-UX need the GNU assembler.
4414 # Linux on IA64 might be able to use the Intel assembler.
4417 mips*-*-* | *-*-hpux* )
4418 if test x$gas_flag = xyes \
4419 || test x"$host" != x"$build" \
4420 || test ! -x "$gcc_cv_as" \
4421 || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
4424 echo "*** This configuration requires the GNU assembler" >&2
4430 # ??? Not all targets support dwarf2 debug_line, even within a version
4431 # of gas. Moreover, we need to emit a valid instruction to trigger any
4432 # info to the output file. So, as supported targets are added to gas 2.11,
4433 # add some instruction here to (also) show we expect this might work.
4434 # ??? Once 2.11 is released, probably need to add first known working
4435 # version to the per-target configury.
4437 aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \
4438 | mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \
4439 | xstormy16 | xtensa)
4449 if test x"$insn" != x; then
4451 .file 1 \"conftest.s\"
4454 gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
4455 gcc_cv_as_dwarf2_debug_line,
4456 [elf,2,11,0],, [$conftest_s],
4457 [if test x$gcc_cv_objdump != x \
4458 && $gcc_cv_objdump -h conftest.o 2> /dev/null \
4459 | grep debug_line > /dev/null 2>&1; then
4460 gcc_cv_as_dwarf2_debug_line=yes
4463 # The .debug_line file table must be in the exact order that
4464 # we specified the files, since these indices are also used
4465 # by DW_AT_decl_file. Approximate this test by testing if
4466 # the assembler bitches if the same index is assigned twice.
4467 gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
4468 gcc_cv_as_dwarf2_file_buggy,,,
4472 if test $gcc_cv_as_dwarf2_debug_line = yes \
4473 && test $gcc_cv_as_dwarf2_file_buggy = no; then
4474 AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
4475 [Define if your assembler supports dwarf2 .file/.loc directives,
4476 and preserves file table indices exactly as given.])
4479 gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
4480 gcc_cv_as_gdwarf2_flag,
4481 [elf,2,11,0], [--gdwarf2], [$insn],,
4482 [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
4483 [Define if your assembler supports the --gdwarf2 option.])])
4485 gcc_GAS_CHECK_FEATURE([--gstabs option],
4486 gcc_cv_as_gstabs_flag,
4487 [elf,2,11,0], [--gstabs], [$insn],,
4488 [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
4489 [Define if your assembler supports the --gstabs option.])])
4491 gcc_GAS_CHECK_FEATURE([--debug-prefix-map option],
4492 gcc_cv_as_debug_prefix_map_flag,
4493 [2,18,0], [--debug-prefix-map /a=/b], [$insn],,
4494 [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1,
4495 [Define if your assembler supports the --debug-prefix-map option.])])
4498 gcc_GAS_CHECK_FEATURE([compressed debug sections],
4499 gcc_cv_as_compress_debug,,[--compress-debug-sections],,
4500 [# gas compiled without zlib cannot compress debug sections and warns
4501 # about it, but still exits successfully. So check for this, too.
4502 if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null
4504 gcc_cv_as_compress_debug=0
4505 elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1
4507 gcc_cv_as_compress_debug=1
4508 gcc_cv_as_compress_debug_option="--compress-debug-sections"
4509 gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
4511 gcc_cv_as_compress_debug=0
4512 # FIXME: Future gas versions will support ELF gABI style via
4513 # --compress-debug-sections[=type].
4515 AC_DEFINE_UNQUOTED(HAVE_AS_COMPRESS_DEBUG, $gcc_cv_as_compress_debug,
4516 [Define to the level of your assembler's compressed debug section support.])
4517 AC_DEFINE_UNQUOTED(AS_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_compress_debug_option",
4518 [Define to the assembler option to enable compressed debug sections.])
4519 AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_option",
4520 [Define to the assembler option to disable compressed debug sections.])
4522 gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
4525 [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
4526 [Define if your assembler supports .lcomm with an alignment field.])])
4528 if test x$with_sysroot = x && test x$host = x$target \
4529 && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
4530 && test "$prefix" != "NONE"; then
4531 AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
4532 [Define to PREFIX/include if cpp should also search that directory.])
4535 # Determine the version of glibc, if any, used on the target.
4536 AC_MSG_CHECKING([for target glibc version])
4537 AC_ARG_WITH([glibc-version],
4538 [AS_HELP_STRING([--with-glibc-version=M.N],
4539 [assume GCC used with glibc version M.N or later])], [
4540 if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then
4541 glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'`
4542 glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'`
4544 AC_MSG_ERROR([option --with-glibc-version requires a version number M.N])
4546 glibc_version_major=0
4547 glibc_version_minor=0
4548 [if test -f $target_header_dir/features.h \
4549 && glibc_version_major_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+[0-9]' $target_header_dir/features.h` \
4550 && glibc_version_minor_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+[0-9]' $target_header_dir/features.h`; then
4551 glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ ]*//'`
4552 glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ ]*//'`
4554 AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor])
4555 AC_DEFINE_UNQUOTED([TARGET_GLIBC_MAJOR], [$glibc_version_major],
4556 [GNU C Library major version number used on the target, or 0.])
4557 AC_DEFINE_UNQUOTED([TARGET_GLIBC_MINOR], [$glibc_version_minor],
4558 [GNU C Library minor version number used on the target, or 0.])
4560 AC_ARG_ENABLE(gnu-unique-object,
4561 [AS_HELP_STRING([--enable-gnu-unique-object],
4562 [enable the use of the @gnu_unique_object ELF extension on glibc systems])],
4563 [case $enable_gnu_unique_object in
4565 *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
4566 Valid choices are 'yes' and 'no'.]) ;;
4568 [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
4570 [.type foo, '$target_type_format_char'gnu_unique_object],,
4571 # We need to unquote above to to use the definition from config.gcc.
4572 # Also check for ld.so support, i.e. glibc 2.11 or higher.
4573 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [11], [enable_gnu_unique_object=yes], )]
4575 if test x$enable_gnu_unique_object = xyes; then
4576 AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
4577 [Define if your assembler supports @gnu_unique_object.])
4580 AC_CACHE_CHECK([assembler for tolerance to line number 0],
4581 [gcc_cv_as_line_zero],
4582 [gcc_cv_as_line_zero=no
4583 if test $in_tree_gas = yes; then
4584 gcc_GAS_VERSION_GTE_IFELSE(2, 16, 91, [gcc_cv_as_line_zero=yes])
4585 elif test "x$gcc_cv_as" != x; then
4586 { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
4587 if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) &&
4588 test "x`cat conftest.out`" = x
4590 gcc_cv_as_line_zero=yes
4592 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
4593 cat conftest.s >&AS_MESSAGE_LOG_FD
4594 echo "configure: error output was" >&AS_MESSAGE_LOG_FD
4595 cat conftest.out >&AS_MESSAGE_LOG_FD
4597 rm -f conftest.o conftest.s conftest.out
4599 if test "x$gcc_cv_as_line_zero" = xyes; then
4600 AC_DEFINE([HAVE_AS_LINE_ZERO], 1,
4601 [Define if the assembler won't complain about a line such as # 0 "" 2.])
4604 AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
4605 gcc_cv_ld_eh_frame_hdr=no
4606 if test $in_tree_ld = yes ; then
4607 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 \
4608 && test $in_tree_ld_is_elf = yes; then
4609 gcc_cv_ld_eh_frame_hdr=yes
4611 elif test x$gcc_cv_ld != x; then
4612 if echo "$ld_ver" | grep GNU > /dev/null; then
4613 # Check if linker supports --eh-frame-hdr option
4614 if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
4615 gcc_cv_ld_eh_frame_hdr=yes
4620 # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
4621 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
4622 gcc_cv_ld_eh_frame_hdr=yes
4628 GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
4629 if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
4630 AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
4631 [Define if your linker supports .eh_frame_hdr.])
4633 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
4635 AC_MSG_CHECKING(linker CIEv3 in .eh_frame support)
4636 gcc_cv_ld_eh_frame_ciev3=no
4637 if test $in_tree_ld = yes ; then
4638 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 \
4639 && test $in_tree_ld_is_elf = yes; then
4640 gcc_cv_ld_eh_frame_ciev3=yes
4642 elif test x$gcc_cv_ld != x; then
4643 if echo "$ld_ver" | grep GNU > /dev/null; then
4644 gcc_cv_ld_eh_frame_ciev3=yes
4645 if test 0"$ld_date" -lt 20040513; then
4646 if test -n "$ld_date"; then
4647 # If there was date string, but was earlier than 2004-05-13, fail
4648 gcc_cv_ld_eh_frame_ciev3=no
4649 elif test "$ld_vers_major" -lt 2; then
4650 gcc_cv_ld_eh_frame_ciev3=no
4651 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
4652 gcc_cv_ld_eh_frame_ciev3=no
4658 # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1.
4659 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then
4660 gcc_cv_ld_eh_frame_ciev3=yes
4666 AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3,
4667 [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`],
4668 [Define 0/1 if your linker supports CIE v3 in .eh_frame.])
4669 AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3)
4671 AC_MSG_CHECKING(linker position independent executable support)
4673 if test $in_tree_ld = yes ; then
4674 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 \
4675 && test $in_tree_ld_is_elf = yes; then
4678 elif test x$gcc_cv_ld != x; then
4679 # Check if linker supports -pie option
4680 if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then
4684 if test x"$gcc_cv_ld_pie" = xyes; then
4685 AC_DEFINE(HAVE_LD_PIE, 1,
4686 [Define if your linker supports -pie option.])
4688 AC_MSG_RESULT($gcc_cv_ld_pie)
4690 AC_MSG_CHECKING(linker EH-compatible garbage collection of sections)
4691 gcc_cv_ld_eh_gc_sections=no
4692 if test $in_tree_ld = yes ; then
4693 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 \
4694 && test $in_tree_ld_is_elf = yes; then
4695 gcc_cv_ld_eh_gc_sections=yes
4697 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
4698 cat > conftest.s <<EOF
4701 .type _start, @function
4704 .size _start, .-_start
4705 .section .text.foo,"ax",@progbits
4706 .type foo, @function
4710 .section .gcc_except_table.foo,"a",@progbits
4713 .section .eh_frame,"a",@progbits
4716 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
4717 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
4718 | grep "gc-sections option ignored" > /dev/null; then
4719 gcc_cv_ld_eh_gc_sections=no
4720 elif $gcc_cv_objdump -h conftest 2> /dev/null \
4721 | grep gcc_except_table > /dev/null; then
4722 gcc_cv_ld_eh_gc_sections=yes
4723 # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
4724 if test x$gcc_cv_as_comdat_group != xyes; then
4725 gcc_cv_ld_eh_gc_sections=no
4726 cat > conftest.s <<EOF
4729 .type _start, @function
4732 .size _start, .-_start
4733 .section .gnu.linkonce.t.foo,"ax",@progbits
4734 .type foo, @function
4738 .section .gcc_except_table.foo,"a",@progbits
4741 .section .eh_frame,"a",@progbits
4744 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
4745 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
4746 | grep "gc-sections option ignored" > /dev/null; then
4747 gcc_cv_ld_eh_gc_sections=no
4748 elif $gcc_cv_objdump -h conftest 2> /dev/null \
4749 | grep gcc_except_table > /dev/null; then
4750 gcc_cv_ld_eh_gc_sections=yes
4756 rm -f conftest.s conftest.o conftest
4760 # ??? This apparently exposes a binutils bug with PC-relative relocations.
4761 gcc_cv_ld_eh_gc_sections=no
4764 if test x$gcc_cv_ld_eh_gc_sections = xyes; then
4765 AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1,
4766 [Define if your linker supports garbage collection of
4767 sections in presence of EH frames.])
4769 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections)
4771 AC_MSG_CHECKING(linker EH garbage collection of sections bug)
4772 gcc_cv_ld_eh_gc_sections_bug=no
4773 if test $in_tree_ld = yes ; then
4774 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 \
4775 && test $in_tree_ld_is_elf = yes; then
4776 gcc_cv_ld_eh_gc_sections_bug=yes
4778 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
4779 gcc_cv_ld_eh_gc_sections_bug=yes
4780 cat > conftest.s <<EOF
4783 .type _start, @function
4786 .size _start, .-_start
4787 .section .text.startup.foo,"ax",@progbits
4788 .type foo, @function
4792 .section .gcc_except_table.foo,"a",@progbits
4795 .section .eh_frame,"a",@progbits
4798 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
4799 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
4800 | grep "gc-sections option ignored" > /dev/null; then
4802 elif $gcc_cv_objdump -h conftest 2> /dev/null \
4803 | grep gcc_except_table > /dev/null; then
4804 gcc_cv_ld_eh_gc_sections_bug=no
4807 rm -f conftest.s conftest.o conftest
4809 if test x$gcc_cv_ld_eh_gc_sections_bug = xyes; then
4810 AC_DEFINE(HAVE_LD_EH_GC_SECTIONS_BUG, 1,
4811 [Define if your linker has buggy garbage collection of
4812 sections support when .text.startup.foo like sections are used.])
4814 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug)
4816 AC_MSG_CHECKING(linker for compressed debug sections)
4817 # gold/gld support compressed debug sections since binutils 2.19/2.21
4818 if test $in_tree_ld = yes ; then
4819 gcc_cv_ld_compress_debug=0
4820 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 \
4821 && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then
4822 gcc_cv_ld_compress_debug=2
4823 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
4824 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 \
4825 && test $in_tree_ld_is_elf = yes; then
4826 gcc_cv_ld_compress_debug=1
4828 elif echo "$ld_ver" | grep GNU > /dev/null; then
4829 gcc_cv_ld_compress_debug=1
4830 if test 0"$ld_date" -lt 20050308; then
4831 if test -n "$ld_date"; then
4832 # If there was date string, but was earlier than 2005-03-08, fail
4833 gcc_cv_ld_compress_debug=0
4834 elif test "$ld_vers_major" -lt 2; then
4835 gcc_cv_ld_compress_debug=0
4836 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then
4837 gcc_cv_ld_compress_debug=0
4840 if test $ld_is_gold = yes; then
4841 gcc_cv_ld_compress_debug=2
4842 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
4848 # Introduced in Solaris 11.2.
4849 if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then
4850 gcc_cv_ld_compress_debug=3
4851 gcc_cv_ld_compress_debug_option="-z compress-sections"
4853 gcc_cv_ld_compress_debug=0
4857 # Assume linkers other than GNU ld don't support compessed debug
4859 gcc_cv_ld_compress_debug=0
4864 AC_DEFINE_UNQUOTED(HAVE_LD_COMPRESS_DEBUG, $gcc_cv_ld_compress_debug,
4865 [Define to the level of your linker's compressed debug section support.])
4866 AC_DEFINE_UNQUOTED(LD_COMPRESS_DEBUG_OPTION, "$gcc_cv_ld_compress_debug_option",
4867 [Define to the linker option to enable compressed debug sections.])
4868 AC_MSG_RESULT($gcc_cv_ld_compress_debug)
4874 AC_CACHE_CHECK(linker --as-needed support,
4875 gcc_cv_ld_as_needed,
4876 [gcc_cv_ld_as_needed=no
4877 gcc_cv_ld_as_needed_option='--as-needed'
4878 gcc_cv_ld_no_as_needed_option='--no-as-needed'
4879 if test $in_tree_ld = yes ; then
4880 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 \
4881 && test $in_tree_ld_is_elf = yes; then
4882 gcc_cv_ld_as_needed=yes
4884 elif test x$gcc_cv_ld != x; then
4885 # Check if linker supports --as-needed and --no-as-needed options
4886 if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
4887 gcc_cv_ld_as_needed=yes
4890 # Solaris 2 ld always supports -z ignore/-z record.
4892 gcc_cv_ld_as_needed=yes
4893 gcc_cv_ld_as_needed_option="-z ignore"
4894 gcc_cv_ld_no_as_needed_option="-z record"
4899 # --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
4900 # dl_iterate_phdr, i.e. since Solaris 11.
4902 *-*-solaris2.1[[1-9]]*)
4904 i?86-*-* | x86_64-*-*)
4905 if echo "$ld_ver" | grep GNU > /dev/null; then
4906 # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
4907 gcc_cv_ld_as_needed=no
4913 gcc_cv_ld_as_needed=no
4917 if test x"$gcc_cv_ld_as_needed" = xyes; then
4918 AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
4919 [Define if your linker supports --as-needed/--no-as-needed or equivalent options.])
4920 AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option",
4921 [Define to the linker option to ignore unused dependencies.])
4922 AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option",
4923 [Define to the linker option to keep unused dependencies.])
4926 AC_MSG_CHECKING(linker mapfile support for clearing hardware capabilities)
4927 saved_LDFLAGS="$LDFLAGS"
4928 for clearcap_map in sol2-clearcapv2.map sol2-clearcap.map; do
4929 LDFLAGS="$saved_LDFLAGS -Wl,-M,${srcdir}/config/$clearcap_map"
4930 AC_LINK_IFELSE([int main(void) {return 0;}],
4931 [gcc_cv_ld_clearcap=yes; break], [gcc_cv_ld_clearcap=no])
4933 LDFLAGS="$saved_LDFLAGS"
4934 if test "x$gcc_cv_ld_clearcap" = xyes; then
4935 AC_DEFINE([HAVE_LD_CLEARCAP], 1,
4936 [Define if the linker supports clearing hardware capabilities via mapfile.])
4937 AC_CONFIG_LINKS([clearcap.map:${srcdir}/config/$clearcap_map])
4939 AC_MSG_RESULT($gcc_cv_ld_clearcap)
4941 case "$target:$tm_file" in
4942 powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
4945 emul_name="-melf64lppc"
4948 emul_name="-melf64ppc"
4951 emul_name="-melf64ppc_fbsd"
4954 AC_CACHE_CHECK(linker support for omitting dot symbols,
4955 gcc_cv_ld_no_dot_syms,
4956 [gcc_cv_ld_no_dot_syms=no
4957 if test x"$ld_is_gold" = xyes; then
4958 gcc_cv_ld_no_dot_syms=yes
4959 elif test $in_tree_ld = yes ; then
4960 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
4961 gcc_cv_ld_no_dot_syms=yes
4963 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
4964 cat > conftest1.s <<EOF
4968 cat > conftest2.s <<EOF
4969 .section ".opd","aw"
4974 .quad .LEfoo,.TOC.@tocbase,0
4980 if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
4981 && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
4982 && $gcc_cv_ld $emul_name -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
4983 gcc_cv_ld_no_dot_syms=yes
4985 rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
4988 if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
4989 AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
4990 [Define if your PowerPC64 linker only needs function descriptor syms.])
4993 AC_CACHE_CHECK(linker large toc support,
4994 gcc_cv_ld_large_toc,
4995 [gcc_cv_ld_large_toc=no
4996 if test x"$ld_is_gold" = xyes; then
4997 gcc_cv_ld_large_toc=yes
4998 elif test $in_tree_ld = yes ; then
4999 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
5000 gcc_cv_ld_large_toc=yes
5002 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
5003 cat > conftest.s <<EOF
5004 .section ".tbss","awT",@nobits
5010 addis 9,13,ie0@got@tprel@ha
5011 ld 9,ie0@got@tprel@l(9)
5013 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
5014 && $gcc_cv_ld $emul_name --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then
5015 gcc_cv_ld_large_toc=yes
5017 rm -f conftest conftest.o conftest.s
5020 if test x"$gcc_cv_ld_large_toc" = xyes; then
5021 AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
5022 [Define if your PowerPC64 linker supports a large TOC.])
5029 AC_CACHE_CHECK(linker large toc support,
5030 gcc_cv_ld_large_toc,
5031 [gcc_cv_ld_large_toc=no
5032 if test x$gcc_cv_as != x ; then
5033 cat > conftest.s <<EOF
5043 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then
5044 gcc_cv_ld_large_toc=yes
5046 rm -f conftest conftest.o conftest.s
5049 if test x"$gcc_cv_ld_large_toc" = xyes; then
5050 AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
5051 [Define if your PowerPC64 linker supports a large TOC.])
5056 AC_CACHE_CHECK(linker --build-id support,
5058 [gcc_cv_ld_buildid=no
5059 if test $in_tree_ld = yes ; then
5060 if test "$gcc_cv_gld_major_version" -eq 2 -a \
5061 "$gcc_cv_gld_minor_version" -ge 18 -o \
5062 "$gcc_cv_gld_major_version" -gt 2 \
5063 && test $in_tree_ld_is_elf = yes; then
5064 gcc_cv_ld_buildid=yes
5066 elif test x$gcc_cv_ld != x; then
5067 if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
5068 gcc_cv_ld_buildid=yes
5071 if test x"$gcc_cv_ld_buildid" = xyes; then
5072 AC_DEFINE(HAVE_LD_BUILDID, 1,
5073 [Define if your linker supports --build-id.])
5076 AC_ARG_ENABLE(linker-build-id,
5077 [AS_HELP_STRING([--enable-linker-build-id],
5078 [compiler will always pass --build-id to linker])],
5080 enable_linker_build_id=no)
5082 if test x"$enable_linker_build_id" = xyes; then
5083 if test x"$gcc_cv_ld_buildid" = xyes; then
5084 AC_DEFINE(ENABLE_LD_BUILDID, 1,
5085 [Define if gcc should always pass --build-id to linker.])
5087 AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
5091 # In binutils 2.21, GNU ld gained support for new emulations fully
5092 # supporting the Solaris 2 ABI. Detect their presence in the linker used.
5093 AC_CACHE_CHECK(linker *_sol2 emulation support,
5094 gcc_cv_ld_sol2_emulation,
5095 [gcc_cv_ld_sol2_emulation=no
5096 if test $in_tree_ld = yes ; then
5097 if test "$gcc_cv_gld_major_version" -eq 2 -a \
5098 "$gcc_cv_gld_minor_version" -ge 21 -o \
5099 "$gcc_cv_gld_major_version" -gt 2 \
5100 && test $in_tree_ld_is_elf = yes; then
5101 gcc_cv_ld_sol2_emulation=yes
5103 elif test x$gcc_cv_ld != x; then
5104 if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \
5105 grep _sol2 > /dev/null; then
5106 gcc_cv_ld_sol2_emulation=yes
5109 if test x"$gcc_cv_ld_sol2_emulation" = xyes; then
5110 AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1,
5111 [Define if your linker supports the *_sol2 emulations.])
5114 AC_CACHE_CHECK(linker --sysroot support,
5116 [gcc_cv_ld_sysroot=no
5117 if test $in_tree_ld = yes ; then
5118 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
5119 gcc_cv_ld_sysroot=yes
5121 elif test x$gcc_cv_ld != x; then
5122 if $gcc_cv_ld --help 2>/dev/null | grep sysroot > /dev/null; then
5123 gcc_cv_ld_sysroot=yes
5126 if test x"$gcc_cv_ld_sysroot" = xyes; then
5127 AC_DEFINE(HAVE_LD_SYSROOT, 1,
5128 [Define if your linker supports --sysroot.])
5131 # Test for stack protector support in target C library.
5132 AC_CACHE_CHECK(__stack_chk_fail in target C library,
5133 gcc_cv_libc_provides_ssp,
5134 [gcc_cv_libc_provides_ssp=no
5136 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
5137 # glibc 2.4 and later provides __stack_chk_fail and
5138 # either __stack_chk_guard, or TLS access to stack guard canary.
5139 GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_libc_provides_ssp=yes], [
5140 [if test -f $target_header_dir/features.h \
5141 && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
5142 $target_header_dir/features.h > /dev/null; then
5143 if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \
5144 $target_header_dir/features.h > /dev/null && \
5145 test -f $target_header_dir/bits/uClibc_config.h && \
5146 $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_SSP__[ ]+1' \
5147 $target_header_dir/bits/uClibc_config.h > /dev/null; then
5148 gcc_cv_libc_provides_ssp=yes
5150 # all versions of Bionic support stack protector
5151 elif test -f $target_header_dir/sys/cdefs.h \
5152 && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \
5153 $target_header_dir/sys/cdefs.h > /dev/null; then
5154 gcc_cv_libc_provides_ssp=yes
5158 # Avoid complicated tests (see
5159 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
5160 # simply assert that glibc does provide this, which is true for all
5161 # realistically usable GNU/Hurd configurations.
5162 gcc_cv_libc_provides_ssp=yes;;
5163 *-*-darwin* | *-*-freebsd*)
5164 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
5165 [echo "no __stack_chk_fail on this target"])
5167 *) gcc_cv_libc_provides_ssp=no ;;
5170 if test x$gcc_cv_libc_provides_ssp = xyes; then
5171 AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
5172 [Define if your target C library provides stack protector support])
5175 # Test for <sys/sdt.h> on the target.
5176 GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
5177 AC_MSG_CHECKING(sys/sdt.h in the target C library)
5179 if test -f $target_header_dir/sys/sdt.h; then
5181 AC_DEFINE(HAVE_SYS_SDT_H, 1,
5182 [Define if your target C library provides sys/sdt.h])
5184 AC_MSG_RESULT($have_sys_sdt_h)
5186 # Check if TFmode long double should be used by default or not.
5187 # Some glibc targets used DFmode long double, but with glibc 2.4
5188 # and later they can use TFmode.
5190 powerpc*-*-linux* | \
5194 AC_ARG_WITH(long-double-128,
5195 [AS_HELP_STRING([--with-long-double-128],
5196 [use 128-bit long double by default])],
5197 gcc_cv_target_ldbl128="$with_long_double_128",
5198 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
5199 [gcc_cv_target_ldbl128=no
5200 grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
5201 $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
5202 && gcc_cv_target_ldbl128=yes
5206 if test x$gcc_cv_target_ldbl128 = xyes; then
5207 AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
5208 [Define if TFmode long double should be the default])
5211 AC_MSG_CHECKING(dl_iterate_phdr in target C library)
5212 gcc_cv_target_dl_iterate_phdr=unknown
5214 # Restrict to Solaris 11+. While most of the Solaris 11 linker changes
5215 # were backported to Solaris 10 Update 10, dl_iterate_phdr only lives in
5216 # libdl there, both complicating its use and breaking compatibility
5217 # between Solaris 10 updates.
5218 *-*-solaris2.1[[1-9]]*)
5219 # <link.h> needs both a dl_iterate_phdr declaration and support for
5220 # compilation with largefile support.
5221 if grep dl_iterate_phdr $target_header_dir/link.h > /dev/null 2>&1 \
5222 && grep 'large file capable' $target_header_dir/link.h > /dev/null 2>&1; then
5223 gcc_cv_target_dl_iterate_phdr=yes
5225 gcc_cv_target_dl_iterate_phdr=no
5228 *-*-dragonfly* | *-*-freebsd*)
5229 if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
5230 gcc_cv_target_dl_iterate_phdr=yes
5232 gcc_cv_target_dl_iterate_phdr=no
5236 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
5237 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
5238 AC_DEFINE(TARGET_DL_ITERATE_PHDR, 1,
5239 [Define if your target C library provides the `dl_iterate_phdr' function.])
5241 AC_MSG_RESULT($gcc_cv_target_dl_iterate_phdr)
5243 # We no longer support different GC mechanisms. Emit an error if
5244 # the user configures with --with-gc.
5246 [AS_HELP_STRING([--with-gc={page,zone}],
5247 [this option is not supported anymore. It used to choose
5248 the garbage collection mechanism to use with the compiler])],
5249 [AC_MSG_ERROR([Configure option --with-gc is only supported up to GCC 4.7.x])],
5252 # Libraries to use on the host. This will normally be set by the top
5253 # level Makefile. Here we simply capture the value for our Makefile.
5254 if test -z "${HOST_LIBS+set}"; then
5259 # Use the system's zlib library.
5261 zlibinc="-I\$(srcdir)/../zlib"
5262 AC_ARG_WITH(system-zlib,
5263 [AS_HELP_STRING([--with-system-zlib], [use installed libz])],
5270 dnl Very limited version of automake's enable-maintainer-mode
5272 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
5273 dnl maintainer-mode is disabled by default
5274 AC_ARG_ENABLE(maintainer-mode,
5275 [AS_HELP_STRING([--enable-maintainer-mode],
5276 [enable make rules and dependencies not useful
5277 (and sometimes confusing) to the casual installer])],
5278 maintainer_mode=$enableval,
5281 AC_MSG_RESULT($maintainer_mode)
5283 if test "$maintainer_mode" = "yes"; then
5290 dnl Whether to prevent multiple front-ends from linking at the same time
5292 AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once])
5293 AC_ARG_ENABLE(link-mutex,
5294 [AS_HELP_STRING([--enable-link-mutex],
5295 [avoid linking multiple front-ends at once to avoid thrashing
5296 on the build machine])],
5297 do_link_mutex=$enableval,
5299 AC_MSG_RESULT($do_link_mutex)
5301 if test "$do_link_mutex" = "yes"; then
5306 AC_SUBST(DO_LINK_MUTEX)
5312 # Make empty files to contain the specs and options for each language.
5313 # Then add #include lines to for a compiler that has specs and/or options.
5319 # These (without "all_") are set in each config-lang.in.
5320 # `language' must be a single word so is spelled singularly.
5323 all_outputs='Makefile'
5324 # List of language makefile fragments.
5326 # Additional files for gengtype
5327 all_gtfiles="$target_gtfiles"
5329 # These are the languages that are set in --enable-languages,
5330 # and are available in the GCC tree.
5331 all_selected_languages=
5333 # Add the language fragments.
5334 # Languages are added via two mechanisms. Some information must be
5335 # recorded in makefile variables, these are defined in config-lang.in.
5336 # We accumulate them and plug them into the main Makefile.
5337 # The other mechanism is a set of hooks for each of the main targets
5338 # like `clean', `install', etc.
5340 language_hooks="Make-hooks"
5342 for lang in ${srcdir}/*/config-lang.in
5345 test "$lang" = "${srcdir}/*/config-lang.in" && continue
5347 lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
5348 if test "x$lang_alias" = x
5350 echo "$lang doesn't set \$language." 1>&2
5353 subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
5354 subdirs="$subdirs $subdir"
5356 # $gcc_subdir is where the gcc integration files are to be found
5357 # for a language, both for internal compiler purposes (compiler
5358 # sources implementing front-end to GCC tree converters), and for
5359 # build infrastructure purposes (Make-lang.in, etc.)
5361 # This will be <subdir> (relative to $srcdir) if a line like
5362 # gcc_subdir="<subdir>" or gcc_subdir=<subdir>
5363 # is found in <langdir>/config-lang.in, and will remain <langdir>
5366 # Except for the language alias (fetched above), the regular
5367 # "config-lang.in" contents are always retrieved from $gcc_subdir,
5368 # so a <langdir>/config-lang.in setting gcc_subdir typically sets
5369 # only this and the language alias.
5371 gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^ ]*\).*$,\1,p' $lang`
5372 if [ "$gcc_subdir" = "" ]; then
5373 gcc_subdir="$subdir"
5376 case ",$enable_languages," in
5378 all_selected_languages="$all_selected_languages $lang_alias"
5379 if test -f $srcdir/$gcc_subdir/lang-specs.h; then
5380 lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h"
5392 . ${srcdir}/$gcc_subdir/config-lang.in
5393 if test "x$language" = x
5395 echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2
5400 case ",$enable_languages," in
5403 for i in $subdir_requires; do
5404 test -f "${srcdir}/$i/config-lang.in" && continue
5412 all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in"
5413 if test -f $srcdir/$gcc_subdir/lang.opt; then
5414 lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
5415 all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt"
5417 if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then
5418 lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def"
5420 all_languages="$all_languages $language"
5421 all_compilers="$all_compilers $compilers"
5422 all_outputs="$all_outputs $outputs"
5423 all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles"
5424 case ",$enable_languages," in
5426 AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.])
5428 AC_SUBST(enable_lto)
5435 for language in $all_selected_languages
5437 check_languages="$check_languages check-$language"
5440 # We link each language in with a set of hooks, reached indirectly via
5441 # lang.${target}. Only do so for selected languages.
5445 target_list="all.cross start.encap rest.encap tags \
5446 install-common install-man install-info install-pdf install-html dvi \
5447 pdf html uninstall info man srcextra srcman srcinfo \
5448 mostlyclean clean distclean maintainer-clean install-plugin"
5450 for t in $target_list
5453 for lang in $all_selected_languages
5457 echo "lang.$t: $x" >> Make-hooks
5461 # Option include files
5464 ${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk
5465 option_includes="option-includes.mk"
5466 AC_SUBST_FILE(option_includes)
5474 echo "dir ." > .gdbinit
5475 echo "dir ${srcdir}" >> .gdbinit
5476 if test x$gdb_needs_out_file_path = xyes
5478 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
5480 if test "x$subdirs" != x; then
5483 echo "dir ${srcdir}/$s" >> .gdbinit
5486 echo "source ${srcdir}/gdbinit.in" >> .gdbinit
5487 echo "python import sys; sys.path.append('${srcdir}'); import gdbhooks" >> .gdbinit
5489 # Put a breakpoint on __asan_report_error to help with debugging buffer
5492 *-fsanitize=address*)
5493 echo "source ${srcdir}/gdbasan.in" >> .gdbinit
5497 gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
5498 AC_SUBST(gcc_tooldir)
5501 # Find a directory in which to install a shared libgcc.
5503 AC_ARG_ENABLE(version-specific-runtime-libs,
5504 [AS_HELP_STRING([--enable-version-specific-runtime-libs],
5505 [specify that runtime libraries should be
5506 installed in a compiler-specific directory])])
5508 # Substitute configuration variables
5511 AC_SUBST(all_compilers)
5512 AC_SUBST(all_gtfiles)
5513 AC_SUBST(all_lang_makefrags)
5514 AC_SUBST(all_languages)
5515 AC_SUBST(all_selected_languages)
5516 AC_SUBST(build_exeext)
5517 AC_SUBST(build_install_headers_dir)
5518 AC_SUBST(build_xm_file_list)
5519 AC_SUBST(build_xm_include_list)
5520 AC_SUBST(build_xm_defines)
5521 AC_SUBST(build_file_translate)
5522 AC_SUBST(check_languages)
5523 AC_SUBST(cpp_install_dir)
5524 AC_SUBST(xmake_file)
5525 AC_SUBST(tmake_file)
5526 AC_SUBST(TM_ENDIAN_CONFIG)
5527 AC_SUBST(TM_MULTILIB_CONFIG)
5528 AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
5529 AC_SUBST(extra_gcc_objs)
5530 AC_SUBST(user_headers_inc_next_pre)
5531 AC_SUBST(user_headers_inc_next_post)
5532 AC_SUBST(extra_headers_list)
5533 AC_SUBST(extra_objs)
5534 AC_SUBST(extra_programs)
5535 AC_SUBST(float_h_file)
5536 AC_SUBST(gcc_config_arguments)
5537 AC_SUBST(gcc_gxx_include_dir)
5538 AC_SUBST(gcc_gxx_include_dir_add_sysroot)
5539 AC_SUBST(host_exeext)
5540 AC_SUBST(host_xm_file_list)
5541 AC_SUBST(host_xm_include_list)
5542 AC_SUBST(host_xm_defines)
5543 AC_SUBST(out_host_hook_obj)
5545 AC_SUBST(lang_opt_files)
5546 AC_SUBST(lang_specs_files)
5547 AC_SUBST(lang_tree_files)
5548 AC_SUBST(local_prefix)
5550 AC_SUBST(objc_boehm_gc)
5552 AC_SUBST(out_object_file)
5553 AC_SUBST(common_out_file)
5554 AC_SUBST(common_out_object_file)
5555 AC_SUBST(tm_file_list)
5556 AC_SUBST(tm_include_list)
5557 AC_SUBST(tm_defines)
5558 AC_SUBST(tm_p_file_list)
5559 AC_SUBST(tm_p_include_list)
5560 AC_SUBST(xm_file_list)
5561 AC_SUBST(xm_include_list)
5562 AC_SUBST(xm_defines)
5563 AC_SUBST(use_gcc_stdint)
5564 AC_SUBST(c_target_objs)
5565 AC_SUBST(cxx_target_objs)
5566 AC_SUBST(fortran_target_objs)
5567 AC_SUBST(target_cpu_default)
5568 AC_SUBST(real_target_noncanonical)
5569 AC_SUBST(accel_dir_suffix)
5571 AC_SUBST_FILE(language_hooks)
5574 if test x${build} = x${host} ; then
5575 if test x${host} = x${target} ; then
5576 echo "Links are now set up to build a native compiler for ${target}." 1>&2
5578 echo "Links are now set up to build a cross-compiler" 1>&2
5579 echo " from ${host} to ${target}." 1>&2
5582 if test x${host} = x${target} ; then
5583 echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
5584 echo " for ${target}." 1>&2
5586 echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
5587 echo " from ${host} to ${target}." 1>&2
5591 AC_ARG_VAR(GMPLIBS,[How to link GMP])
5592 AC_ARG_VAR(GMPINC,[How to find GMP include files])
5594 AC_ARG_VAR(ISLLIBS,[How to link ISL])
5595 AC_ARG_VAR(ISLINC,[How to find ISL include files])
5596 if test "x${ISLLIBS}" != "x" ; then
5597 AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
5601 AC_SUBST(pluginlibs)
5602 AC_SUBST(enable_plugin)
5603 if test x"$enable_plugin" = x"yes"; then
5604 AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
5608 # Enable --enable-host-shared
5609 AC_ARG_ENABLE(host-shared,
5610 [AS_HELP_STRING([--enable-host-shared],
5611 [build host code as shared libraries])],
5612 [PICFLAG=-fPIC], [PICFLAG=])
5613 AC_SUBST(enable_host_shared)
5617 AC_ARG_ENABLE(libquadmath-support,
5618 [AS_HELP_STRING([--disable-libquadmath-support],
5619 [disable libquadmath support for Fortran])],
5620 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
5621 ENABLE_LIBQUADMATH_SUPPORT=yes)
5622 if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then
5623 AC_DEFINE(ENABLE_LIBQUADMATH_SUPPORT, 1,
5624 [Define to 1 to enable libquadmath support])
5628 # Specify what hash style to use by default.
5629 AC_ARG_WITH([linker-hash-style],
5630 [AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
5631 [specify the linker hash style])],
5632 [case x"$withval" in
5634 LINKER_HASH_STYLE=sysv
5637 LINKER_HASH_STYLE=gnu
5640 LINKER_HASH_STYLE=both
5643 AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style])
5646 [LINKER_HASH_STYLE=''])
5647 if test x"${LINKER_HASH_STYLE}" != x; then
5648 AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE",
5649 [The linker hash style])
5652 # Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
5653 # of jit/jit-playback.c.
5654 cat > gcc-driver-name.h <<EOF
5655 #define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
5658 # Configure the subdirectories
5659 # AC_CONFIG_SUBDIRS($subdirs)
5661 # Create the Makefile
5662 # and configure language subdirectories
5663 AC_CONFIG_FILES($all_outputs)
5665 AC_CONFIG_COMMANDS([default],
5667 case ${CONFIG_HEADERS} in
5668 *auto-host.h:config.in*)
5671 # Make sure all the subdirs exist.
5672 for d in $subdirs doc build common c-family
5674 test -d $d || mkdir $d
5677 [subdirs='$subdirs'])