* MAINTAINERS (nvptx): Add self.
[official-gcc.git] / gcc / configure.ac
bloba192ad92129ac47403523723c8315c69fe497a80
1 # configure.ac for GCC
2 # Process this file with autoconf to generate a configuration script.
4 # Copyright (C) 1997-2015 Free Software Foundation, Inc.
6 #This file is part of GCC.
8 #GCC is free software; you can redistribute it and/or modify it under
9 #the terms of the GNU General Public License as published by the Free
10 #Software Foundation; either version 3, or (at your option) any later
11 #version.
13 #GCC is distributed in the hope that it will be useful, but WITHOUT
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 #for more details.
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING3.  If not see
20 #<http://www.gnu.org/licenses/>.
22 # --------------------------------
23 # Initialization and sanity checks
24 # --------------------------------
26 AC_PREREQ(2.64)
27 AC_INIT
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
34 AC_CANONICAL_BUILD
35 AC_CANONICAL_HOST
36 AC_CANONICAL_TARGET
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}
43 accel_dir_suffix=
45 # Determine the target- and build-specific subdirectories
46 GCC_TOPLEV_SUBDIRS
48 # Set program_transform_name
49 AC_ARG_PROGRAM
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
55 # is true:
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)
60 changequote(,)dnl
61 case ${LIBRARY_PATH} in
62   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
63     library_path_setting="contains current directory"
64     ;;
65   *)
66     library_path_setting="ok"
67     ;;
68 esac
69 changequote([,])dnl
70 AC_MSG_RESULT($library_path_setting)
71 if test "$library_path_setting" != "ok"; then
72 AC_MSG_ERROR([
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
81 # is true:
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)
86 changequote(,)dnl
87 case ${GCC_EXEC_PREFIX} in
88   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
89     gcc_exec_prefix_setting="contains current directory"
90     ;;
91   *)
92     gcc_exec_prefix_setting="ok"
93     ;;
94 esac
95 changequote([,])dnl
96 AC_MSG_RESULT($gcc_exec_prefix_setting)
97 if test "$gcc_exec_prefix_setting" != "ok"; then
98 AC_MSG_ERROR([
99 *** GCC_EXEC_PREFIX shouldn't contain the current directory when
100 *** building gcc. Please change the environment variable
101 *** and run configure again.])
104 # -----------
105 # Directories
106 # -----------
108 # Specify the local prefix
109 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) ;;
115 no)     ;;
116 *)      local_prefix=$with_local_prefix ;;
117 esac])
119 # Default local prefix if it is empty
120 if test x$local_prefix = x; then
121         local_prefix=/usr/local
124 AC_ARG_WITH([native-system-header-dir],
125   [  --with-native-system-header-dir=dir
126                           use dir as the directory to look for standard
127                           system header files in.  Defaults to /usr/include.],
129  case ${with_native_system_header_dir} in
130  yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
131  /* | [[A-Za-z]]:[[\\/]]*) ;;
132  *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
133  esac
134  configured_native_system_header_dir="${withval}"
135 ], [configured_native_system_header_dir=])
137 AC_ARG_WITH(build-sysroot, 
138   [AS_HELP_STRING([--with-build-sysroot=sysroot],
139                   [use sysroot as the system root during the build])],
140   [if test x"$withval" != x ; then
141      SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
142    fi],
143   [SYSROOT_CFLAGS_FOR_TARGET=])
144 AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
146 if test "x$prefix" = xNONE; then
147  test_prefix=/usr/local
148 else
149  test_prefix=$prefix
151 if test "x$exec_prefix" = xNONE; then
152  test_exec_prefix=$test_prefix
153 else
154  test_exec_prefix=$exec_prefix
157 AC_ARG_WITH(sysroot,
158 [AS_HELP_STRING([[--with-sysroot[=DIR]]],
159                 [search for usr/lib, usr/include, et al, within DIR])],
161  case ${with_sysroot} in
162  /) ;;
163  */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
164  esac
165  case ${with_sysroot} in
166  yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
167  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
168  esac
169    
170  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
171  CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
172         
173  case ${TARGET_SYSTEM_ROOT} in
174  "${test_prefix}"|"${test_prefix}/"*|\
175  "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
176  '${prefix}'|'${prefix}/'*|\
177  '${exec_prefix}'|'${exec_prefix}/'*)
178    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
179    TARGET_SYSTEM_ROOT_DEFINE="$t"
180    ;;
181  esac
182 ], [
183  TARGET_SYSTEM_ROOT=
184  TARGET_SYSTEM_ROOT_DEFINE=
185  CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
187 AC_SUBST(TARGET_SYSTEM_ROOT)
188 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
189 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
191 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
192 # passed in by the toplevel make and thus we'd get different behavior
193 # depending on where we built the sources.
194 gcc_gxx_include_dir=
195 # Specify the g++ header file directory
196 AC_ARG_WITH(gxx-include-dir,
197 [AS_HELP_STRING([--with-gxx-include-dir=DIR],
198                 [specifies directory to put g++ header files])],
199 [case "${withval}" in
200 yes)    AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
201 no)     ;;
202 *)      gcc_gxx_include_dir=$with_gxx_include_dir ;;
203 esac])
205 # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
206 if test x${gcc_gxx_include_dir} = x; then
207   if test x${enable_version_specific_runtime_libs} = xyes; then
208     gcc_gxx_include_dir='${libsubdir}/include/c++'
209   else
210     libstdcxx_incdir='include/c++/$(version)'
211     if test x$host != x$target; then
212        libstdcxx_incdir="$target_alias/$libstdcxx_incdir"
213     fi
214     gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
215   fi
218 gcc_gxx_include_dir_add_sysroot=0
219 if test "${with_sysroot+set}" = set; then
220   gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
221   if test "${gcc_gxx_without_sysroot}"; then
222     if test x${with_sysroot} != x/; then
223       gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
224     fi
225     gcc_gxx_include_dir_add_sysroot=1
226   fi
229 AC_ARG_WITH(cpp_install_dir,
230 [AC_HELP_STRING([--with-cpp-install-dir=DIR],
231                 [install the user visible C preprocessor in DIR
232                  (relative to PREFIX) as well as PREFIX/bin])],
233 [if test x$withval = xyes; then
234   AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
235 elif test x$withval != xno; then
236   cpp_install_dir=$withval
237 fi])
239 # We would like to our source tree to be readonly.  However when releases or
240 # pre-releases are generated, the flex/bison generated files as well as the 
241 # various formats of manuals need to be included along with the rest of the
242 # sources.  Therefore we have --enable-generated-files-in-srcdir to do 
243 # just that.
245 AC_MSG_CHECKING([whether to place generated files in the source directory])
246   dnl generated-files-in-srcdir is disabled by default
247   AC_ARG_ENABLE(generated-files-in-srcdir, 
248     [AS_HELP_STRING([--enable-generated-files-in-srcdir],
249                     [put copies of generated files in source dir
250                      intended for creating source tarballs for users
251                      without texinfo bison or flex])],
252       generated_files_in_srcdir=$enableval,
253       generated_files_in_srcdir=no)
255 AC_MSG_RESULT($generated_files_in_srcdir)
257 if test "$generated_files_in_srcdir" = "yes"; then
258   GENINSRC=''
259 else
260   GENINSRC='#'
262 AC_SUBST(GENINSRC)
264 # -------------------
265 # Find default linker
266 # -------------------
268 # With GNU ld
269 AC_ARG_WITH(gnu-ld,
270 [AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])],
271 gnu_ld_flag="$with_gnu_ld",
272 gnu_ld_flag=no)
274 # With pre-defined ld
275 AC_ARG_WITH(ld,
276 [AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])],
277 DEFAULT_LINKER="$with_ld")
278 if test x"${DEFAULT_LINKER+set}" = x"set"; then
279   if test ! -x "$DEFAULT_LINKER"; then
280     AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
281   elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
282     gnu_ld_flag=yes
283   fi
284   AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
285         [Define to enable the use of a default linker.])
288 AC_MSG_CHECKING([whether a default linker was specified])
289 if test x"${DEFAULT_LINKER+set}" = x"set"; then
290   if test x"$gnu_ld_flag" = x"no"; then
291     AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
292   else
293     AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
294   fi
295 else
296   AC_MSG_RESULT(no)
299 # With demangler in GNU ld
300 AC_ARG_WITH(demangler-in-ld,
301 [AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])],
302 demangler_in_ld="$with_demangler_in_ld",
303 demangler_in_ld=yes)
305 # ----------------------
306 # Find default assembler
307 # ----------------------
309 # With GNU as
310 AC_ARG_WITH(gnu-as,
311 [AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])],
312 gas_flag="$with_gnu_as",
313 gas_flag=no)
315 AC_ARG_WITH(as,
316 [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])],
317 DEFAULT_ASSEMBLER="$with_as")
318 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
319   if test ! -x "$DEFAULT_ASSEMBLER"; then
320     AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
321   elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
322     gas_flag=yes
323   fi
324   AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
325         [Define to enable the use of a default assembler.])
328 AC_MSG_CHECKING([whether a default assembler was specified])
329 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
330   if test x"$gas_flag" = x"no"; then
331     AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
332   else
333     AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
334   fi
335 else
336   AC_MSG_RESULT(no)
339 # ---------------
340 # Find C compiler
341 # ---------------
343 # If a non-executable a.out is present (e.g. created by GNU as above even if
344 # invoked with -v only), the IRIX 6 native ld just overwrites the existing
345 # file, even when creating an executable, so an execution test fails.
346 # Remove possible default executable files to avoid this.
348 # FIXME: This really belongs into AC_PROG_CC and can be removed once
349 # Autoconf includes it.
350 rm -f a.out a.exe b.out
352 # Find the native compiler
353 AC_PROG_CC
354 AC_PROG_CXX
355 ACX_PROG_GNAT([-I"$srcdir"/ada])
357 # Do configure tests with the C++ compiler, since that's what we build with.
358 AC_LANG(C++)
360 # Remove the -O2: for historical reasons, unless bootstrapping we prefer
361 # optimizations to be activated explicitly by the toplevel.
362 case "$CC" in
363   */prev-gcc/xgcc*) ;;
364   *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[       ]]//" -e "s/-O[[gs]][[  ]]//" -e "s/-O[[0-9]]*[[        ]]//" `
365      CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[   ]]//" -e "s/-O[[gs]][[  ]]//" -e "s/-O[[0-9]]*[[        ]]//" ` ;;
366 esac
367 AC_SUBST(CFLAGS)
368 AC_SUBST(CXXFLAGS)
370 # Determine PICFLAG for target gnatlib.
371 GCC_PICFLAG_FOR_TARGET
372 AC_SUBST(PICFLAG_FOR_TARGET)
374 # -------------------------
375 # Check C compiler features
376 # -------------------------
378 AC_USE_SYSTEM_EXTENSIONS
379 AC_PROG_CPP
380 AC_C_INLINE
382 AC_SYS_LARGEFILE
384 # sizeof(char) is 1 by definition.
385 AC_CHECK_SIZEOF(void *)
386 AC_CHECK_SIZEOF(short)
387 AC_CHECK_SIZEOF(int)
388 AC_CHECK_SIZEOF(long)
389 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
390 GCC_STDINT_TYPES
391 if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
392   AC_MSG_ERROR([uint64_t or int64_t not found])
395 # check what underlying integer type int64_t uses
396 AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [
397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
398 #ifdef HAVE_STDINT_H
399 #include <stdint.h>
400 #endif
401 template <typename T> struct X { };
402 template <>
403 struct X<long> { typedef long t; };
404 ]], [[X<int64_t>::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])])
405 if test "$ac_cv_int64_t_type" = "long"; then
406   AC_DEFINE(INT64_T_IS_LONG, 1,
407   [Define if int64_t uses long as underlying type.])
408 else
409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
410 #ifdef HAVE_STDINT_H
411 #include <stdint.h>
412 #endif
413 template <typename T> struct X { };
414 template <>
415 struct X<long long> { typedef long long t; };
416 ]], [[X<int64_t>::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])])
422 # ---------------------
423 # Warnings and checking
424 # ---------------------
426 # Check $CC warning features (if it's GCC).
427 # We want to use -pedantic, but we don't want warnings about
428 # * 'long long'
429 # * variadic macros
430 # * overlong strings
431 # * C++11 narrowing conversions in { }
432 # So, we only use -pedantic if we can disable those warnings.
434 # In stage 1, disable -Wformat warnings from old GCCs about new % codes
435 AC_ARG_ENABLE(build-format-warnings,
436   AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
437   [],[enable_build_format_warnings=yes])
438 AS_IF([test $enable_build_format_warnings = no],
439       [wf_opt=-Wno-format],[wf_opt=])
440 ACX_PROG_CXX_WARNING_OPTS(
441         m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt])), [loose_warn])
442 ACX_PROG_CC_WARNING_OPTS(
443         m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])),
444         [c_loose_warn])
445 ACX_PROG_CXX_WARNING_OPTS(
446         m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
447 ACX_PROG_CXX_WARNING_OPTS(
448         m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn])
449 ACX_PROG_CC_WARNING_OPTS(
450         m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
451 ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC(
452         m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ], 
453                        [-Wno-overlength-strings])), [strict_warn])
454 ACX_PROG_CXX_WARNINGS_ARE_ERRORS([manual], [strict_warn])
456 # The above macros do nothing if the compiler is not GCC.  However, the
457 # Makefile has more goo to add other flags, so these variables are used
458 # to enable warnings only for GCC.
459 warn_cflags=
460 warn_cxxflags=
461 if test "x$GCC" = "xyes"; then
462   warn_cflags='$(GCC_WARN_CFLAGS)'
463   warn_cxxflags='$(GCC_WARN_CXXFLAGS)'
465 AC_SUBST(warn_cflags)
466 AC_SUBST(warn_cxxflags)
468 # Disable exceptions and RTTI if building with g++
469 ACX_PROG_CC_WARNING_OPTS(
470         m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])),
471                        [noexception_flags])
472         
473 # Enable expensive internal checks
474 is_release=
475 if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
476   is_release=yes
479 AC_ARG_ENABLE(checking,
480 [AS_HELP_STRING([[--enable-checking[=LIST]]],
481                 [enable expensive run-time checks.  With LIST,
482                  enable only specific categories of checks.
483                  Categories are: yes,no,all,none,release.
484                  Flags are: assert,df,fold,gc,gcac,gimple,misc,
485                  rtlflag,rtl,runtime,tree,valgrind,types])],
486 [ac_checking_flags="${enableval}"],[
487 # Determine the default checks.
488 if test x$is_release = x ; then
489   ac_checking_flags=yes
490 else
491   ac_checking_flags=release
492 fi])
493 IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
494 for check in release $ac_checking_flags
496         case $check in
497         # these set all the flags to specific states
498         yes)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
499                         ac_fold_checking= ; ac_gc_checking=1 ;
500                         ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
501                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
502                         ac_tree_checking=1 ; ac_valgrind_checking= ;
503                         ac_types_checking=1 ;;
504         no|none)        ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
505                         ac_fold_checking= ; ac_gc_checking= ;
506                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
507                         ac_rtlflag_checking= ; ac_runtime_checking= ;
508                         ac_tree_checking= ; ac_valgrind_checking= ;
509                         ac_types_checking= ;;
510         all)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
511                         ac_fold_checking=1 ; ac_gc_checking=1 ;
512                         ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
513                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
514                         ac_tree_checking=1 ; ac_valgrind_checking= ;
515                         ac_types_checking=1 ;;
516         release)        ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
517                         ac_fold_checking= ; ac_gc_checking= ;
518                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
519                         ac_rtlflag_checking= ; ac_runtime_checking=1 ;
520                         ac_tree_checking= ; ac_valgrind_checking= ;
521                         ac_types_checking= ;;
522         # these enable particular checks
523         assert)         ac_assert_checking=1 ;;
524         df)             ac_df_checking=1 ;;
525         fold)           ac_fold_checking=1 ;;
526         gc)             ac_gc_checking=1 ;;
527         gcac)           ac_gc_always_collect=1 ;;
528         gimple)         ac_gimple_checking=1 ;;
529         misc)           ac_checking=1 ;;
530         rtl)            ac_rtl_checking=1 ;;
531         rtlflag)        ac_rtlflag_checking=1 ;;
532         runtime)        ac_runtime_checking=1 ;;
533         tree)           ac_tree_checking=1 ;;
534         types)          ac_types_checking=1 ;;
535         valgrind)       ac_valgrind_checking=1 ;;
536         *)      AC_MSG_ERROR(unknown check category $check) ;;
537         esac
538 done
539 IFS="$ac_save_IFS"
541 nocommon_flag=""
542 if test x$ac_checking != x ; then
543   AC_DEFINE(ENABLE_CHECKING, 1,
544 [Define if you want more run-time sanity checks.  This one gets a grab
545    bag of miscellaneous but relatively cheap checks.])
546   nocommon_flag=-fno-common
548 AC_SUBST(nocommon_flag)
549 if test x$ac_df_checking != x ; then
550   AC_DEFINE(ENABLE_DF_CHECKING, 1,
551 [Define if you want more run-time sanity checks for dataflow.])
553 if test x$ac_assert_checking != x ; then
554   AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
555 [Define if you want assertions enabled.  This is a cheap check.])
557 if test x$ac_gimple_checking != x ; then
558   AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1,
559 [Define if you want operations on GIMPLE (the basic data structure of
560 the high-level optimizers) to be checked for dynamic type safety at
561 runtime.  This is moderately expensive.])
563 GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
564 if test x$ac_runtime_checking != x ; then
565   AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
566 [Define if you want runtime assertions enabled.  This is a cheap check.])
568 if test x$ac_tree_checking != x ; then
569   AC_DEFINE(ENABLE_TREE_CHECKING, 1,
570 [Define if you want all operations on trees (the basic data
571    structure of the front ends) to be checked for dynamic type safety
572    at runtime.  This is moderately expensive.
573    ])
574   TREECHECKING=yes
576 if test x$ac_types_checking != x ; then
577   AC_DEFINE(ENABLE_TYPES_CHECKING, 1,
578 [Define if you want all gimple types to be verified after gimplifiation.
579    This is cheap.
580    ])
582 AC_SUBST(TREECHECKING)
583 if test x$ac_rtl_checking != x ; then
584   AC_DEFINE(ENABLE_RTL_CHECKING, 1,
585 [Define if you want all operations on RTL (the basic data structure
586    of the optimizer and back end) to be checked for dynamic type safety
587    at runtime.  This is quite expensive.])
589 if test x$ac_rtlflag_checking != x ; then
590   AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
591 [Define if you want RTL flag accesses to be checked against the RTL
592    codes that are supported for each access macro.  This is relatively
593    cheap.])
595 if test x$ac_gc_checking != x ; then
596   AC_DEFINE(ENABLE_GC_CHECKING, 1,
597 [Define if you want the garbage collector to do object poisoning and
598    other memory allocation checks.  This is quite expensive.])
600 if test x$ac_gc_always_collect != x ; then
601   AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
602 [Define if you want the garbage collector to operate in maximally
603    paranoid mode, validating the entire heap and collecting garbage at
604    every opportunity.  This is extremely expensive.])
606 if test x$ac_fold_checking != x ; then
607   AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
608 [Define if you want fold checked that it never destructs its argument.
609    This is quite expensive.])
611 valgrind_path_defines=
612 valgrind_command=
614 dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
615 dnl # an if statement.  This was the source of very frustrating bugs
616 dnl # in converting to autoconf 2.5x!
617 AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
619 # It is certainly possible that there's valgrind but no valgrind.h.
620 # GCC relies on making annotations so we must have both.
621 AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>)
622 AC_PREPROC_IFELSE([AC_LANG_SOURCE(
623   [[#include <valgrind/memcheck.h>
624 #ifndef VALGRIND_DISCARD
625 #error VALGRIND_DISCARD not defined
626 #endif]])],
627   [gcc_cv_header_valgrind_memcheck_h=yes],
628   [gcc_cv_header_valgrind_memcheck_h=no])
629 AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
630 AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
631 AC_PREPROC_IFELSE([AC_LANG_SOURCE(
632   [[#include <memcheck.h>
633 #ifndef VALGRIND_DISCARD
634 #error VALGRIND_DISCARD not defined
635 #endif]])],
636   [gcc_cv_header_memcheck_h=yes],
637   [gcc_cv_header_memcheck_h=no])
638 AC_MSG_RESULT($gcc_cv_header_memcheck_h)
639 if test $gcc_cv_header_valgrind_memcheck_h = yes; then
640   AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
641         [Define if valgrind's valgrind/memcheck.h header is installed.])
643 if test $gcc_cv_header_memcheck_h = yes; then
644   AC_DEFINE(HAVE_MEMCHECK_H, 1,
645         [Define if valgrind's memcheck.h header is installed.])
648 if test x$ac_valgrind_checking != x ; then
649   AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
650         [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
651   if test "x$valgrind_path" = "x" \
652     || (test $have_valgrind_h = no \
653         && test $gcc_cv_header_memcheck_h = no \
654         && test $gcc_cv_header_valgrind_memcheck_h = no); then
655         AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
656   fi
657   valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
658   valgrind_command="$valgrind_path -q"
659   AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
660 [Define if you want to run subprograms and generated programs
661    through valgrind (a memory checker).  This is extremely expensive.])
663 AC_SUBST(valgrind_path_defines)
664 AC_SUBST(valgrind_command)
666 # Enable code coverage collection
667 AC_ARG_ENABLE(coverage,
668 [AS_HELP_STRING([[--enable-coverage[=LEVEL]]],
669                 [enable compiler's code coverage collection.
670                  Use to measure compiler performance and locate
671                  unused parts of the compiler. With LEVEL, specify
672                  optimization. Values are opt, noopt,
673                  default is noopt])],
674 [case "${enableval}" in
675   yes|noopt)
676     coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
677     ;;
678   opt)
679     coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
680     ;;
681   no)
682     # a.k.a. --disable-coverage
683     coverage_flags=""
684     ;;
685   *)
686     AC_MSG_ERROR(unknown coverage setting $enableval)
687     ;;
688 esac],
689 [coverage_flags=""])
690 AC_SUBST(coverage_flags)
692 AC_ARG_ENABLE(gather-detailed-mem-stats, 
693 [AS_HELP_STRING([--enable-gather-detailed-mem-stats],
694                 [enable detailed memory allocation stats gathering])], [],
695 [enable_gather_detailed_mem_stats=no])
696 gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi`
697 AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
698 [Define to enable detailed memory allocation stats gathering.])
700 AC_ARG_ENABLE(valgrind-annotations,
701 [AS_HELP_STRING([--enable-valgrind-annotations],
702                 [enable valgrind runtime interaction])], [],
703 [enable_valgrind_annotations=no])
704 if test x$enable_valgrind_annotations != xno \
705     || test x$ac_valgrind_checking != x; then
706   if (test $have_valgrind_h = no \
707       && test $gcc_cv_header_memcheck_h = no \
708       && test $gcc_cv_header_valgrind_memcheck_h = no); then
709     AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h])
710   fi
711   AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
712 [Define to get calls to the valgrind runtime enabled.])
715 # -------------------------------
716 # Miscenalleous configure options
717 # -------------------------------
719 # With stabs
720 AC_ARG_WITH(stabs,
721 [AS_HELP_STRING([--with-stabs],
722                 [arrange to use stabs instead of host debug format])],
723 stabs="$with_stabs",
724 stabs=no)
726 # Determine whether or not multilibs are enabled.
727 AC_ARG_ENABLE(multilib,
728 [AS_HELP_STRING([--enable-multilib],
729                 [enable library support for multiple ABIs])],
730 [], [enable_multilib=yes])
731 AC_SUBST(enable_multilib)
733 # Determine whether or not multiarch is enabled.
734 AC_ARG_ENABLE(multiarch,
735 [AS_HELP_STRING([--enable-multiarch],
736                 [enable support for multiarch paths])],
737 [case "${enableval}" in
738 yes|no|auto) enable_multiarch=$enableval;;
739 *) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;;
740 esac], [enable_multiarch=auto])
741 if test x${enable_multiarch} = xauto; then
742   if test x${with_native_system_header_dir} != x; then
743     ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)"
744     enable_multiarch=no
745   fi
746   if test x$host != x$target && test "x$with_sysroot" = x; then
747     ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)"
748     enable_multiarch=no
749   fi
751 AC_MSG_CHECKING(for multiarch configuration)
752 AC_SUBST(enable_multiarch)
753 AC_MSG_RESULT($enable_multiarch$ma_msg_suffix)
755 # needed for setting the multiarch name for soft-float/hard-float ABIs
756 AC_SUBST(with_cpu)
757 AC_SUBST(with_float)
759 # Enable __cxa_atexit for C++.
760 AC_ARG_ENABLE(__cxa_atexit,
761 [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
762 [], [])
764 # Enable C extension for decimal float if target supports it.
765 GCC_AC_ENABLE_DECIMAL_FLOAT([$target])
767 dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi`
768 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
769 [Define to 1 to enable decimal float extension to C.])
771 # Use default_decimal_float for dependency.
772 enable_decimal_float=$default_decimal_float
774 bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi`
775 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid,
776 [Define to 1 to specify that we are using the BID decimal floating
777 point format instead of DPD])
779 # Enable C extension for fixed-point arithmetic.
780 AC_ARG_ENABLE(fixed-point,
781 [AS_HELP_STRING([--enable-fixed-point],
782                 [enable fixed-point arithmetic extension to C])],
785   case $target in
786     arm*)
787       enable_fixed_point=yes
788       ;;
790     mips*-*-*)
791       enable_fixed_point=yes
792       ;;
793     *)
794       AC_MSG_WARN([fixed-point is not supported for this target, ignored])
795       enable_fixed_point=no
796       ;;
797   esac
799 AC_SUBST(enable_fixed_point)
801 fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi`
802 AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint,
803 [Define to 1 to enable fixed-point arithmetic extension to C.])
805 # Enable threads
806 # Pass with no value to take the default
807 # Pass with a value to specify a thread package
808 AC_ARG_ENABLE(threads,
809 [AS_HELP_STRING([[--enable-threads[=LIB]]],
810                 [enable thread usage for target GCC,
811                  using LIB thread package])],,
812 [enable_threads=''])
814 AC_ARG_ENABLE(tls,
815 [AS_HELP_STRING([--enable-tls],
816                 [enable or disable generation of tls code
817                  overriding the assembler check for tls support])],
819   case $enable_tls in
820     yes | no) ;;
821     *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
822 Valid choices are 'yes' and 'no'.]) ;;
823   esac
824 ], [enable_tls=''])
826 AC_ARG_ENABLE(objc-gc,
827 [AS_HELP_STRING([--enable-objc-gc],
828                 [enable the use of Boehm's garbage collector with
829                  the GNU Objective-C runtime])],
830 if test x$enable_objc_gc = xno; then
831         objc_boehm_gc=''
832 else
833         objc_boehm_gc=1
835 objc_boehm_gc='')
837 AC_ARG_WITH(dwarf2,
838 [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])],
839 dwarf2="$with_dwarf2",
840 dwarf2=no)
842 AC_ARG_ENABLE(shared,
843 [AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])],
845   case $enable_shared in
846   yes | no) ;;
847   *)
848     enable_shared=no
849     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
850     for pkg in $enableval; do
851       if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
852         enable_shared=yes
853       fi
854     done
855     IFS="$ac_save_ifs"
856     ;;
857   esac
858 ], [enable_shared=yes])
859 AC_SUBST(enable_shared)
861 AC_ARG_WITH(specs,
862   [AS_HELP_STRING([--with-specs=SPECS],
863                   [add SPECS to driver command-line processing])],
864   [CONFIGURE_SPECS=$withval],
865   [CONFIGURE_SPECS=]
867 AC_SUBST(CONFIGURE_SPECS)
869 ACX_PKGVERSION([GCC])
870 ACX_BUGURL([http://gcc.gnu.org/bugs.html])
872 # Sanity check enable_languages in case someone does not run the toplevel
873 # configure # script.
874 AC_ARG_ENABLE(languages,
875 [AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])],
876 [case ,${enable_languages}, in
877        ,,|,yes,)
878                 # go safe -- we cannot be much sure without the toplevel
879                 # configure's
880                 # analysis of which target libs are present and usable
881                 enable_languages=c
882                 ;;
883          *,all,*)
884                 AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
885                 ;;
886         *,c,*)
887                 ;;
888         *)
889                 enable_languages=c,${enable_languages}
890                 ;;
891 esac],
892 [enable_languages=c])
894 if test x"$enable_as_accelerator_for" != x; then
895   AC_DEFINE(ACCEL_COMPILER, 1,
896     [Define if this compiler should be built as the offload target compiler.])
897   enable_as_accelerator=yes
898   case "${target}" in
899     *-intelmicemul-*)
900       # In this case we expect offload compiler to be built as native, so we
901       # need to rename the driver to avoid clashes with host's drivers.
902       program_transform_name="s&^&${target}-&" ;;
903   esac
904   sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
905   program_transform_name=`echo $program_transform_name | sed $sedscript`
906   accel_dir_suffix=/accel/${target_noncanonical}
907   real_target_noncanonical=${enable_as_accelerator_for}
909 AC_SUBST(enable_as_accelerator)
910 AC_SUBST(real_target_noncanonical)
911 AC_SUBST(accel_dir_suffix)
913 for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
914   tgt=`echo $tgt | sed 's/=.*//'`
915   if test x"$offload_targets" = x; then
916     offload_targets=$tgt
917   else
918     offload_targets="$offload_targets:$tgt"
919   fi
920 done
921 AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
922   [Define to hold the list of target names suitable for offloading.])
923 if test x"$offload_targets" != x; then
924   AC_DEFINE(ENABLE_OFFLOADING, 1,
925     [Define this to enable support for offloading.])
928 AC_ARG_WITH(multilib-list,
929 [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
931 with_multilib_list=default)
933 # -------------------------
934 # Checks for other programs
935 # -------------------------
937 AC_PROG_MAKE_SET
939 # Find some useful tools
940 AC_PROG_AWK
941 # We need awk to create options.c and options.h.
942 # Bail out if it's missing.
943 case ${AWK} in
944   "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
945 esac
947 gcc_AC_PROG_LN_S
948 ACX_PROG_LN($LN_S)
949 AC_PROG_RANLIB
950 ranlib_flags=""
951 AC_SUBST(ranlib_flags)
952      
953 gcc_AC_PROG_INSTALL
955 # See if cmp has --ignore-initial.
956 gcc_AC_PROG_CMP_IGNORE_INITIAL
958 # See if we have the mktemp command.
959 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
961 # See if makeinfo has been installed and is modern enough
962 # that we can use it.
963 ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
964   [GNU texinfo.* \([0-9][0-9.]*\)],
965   [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
966 if test $gcc_cv_prog_makeinfo_modern = no; then
967   AC_MSG_WARN([
968 *** Makeinfo is missing or too old.
969 *** Info documentation will not be built.])
970   BUILD_INFO=
971 else
972   BUILD_INFO=info
974 AC_SUBST(BUILD_INFO)
976 # Is pod2man recent enough to regenerate manpages?
977 AC_MSG_CHECKING([for recent Pod::Man])
978 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
979   AC_MSG_RESULT(yes)
980   GENERATED_MANPAGES=generated-manpages
981 else
982   AC_MSG_RESULT(no)
983   GENERATED_MANPAGES=
985 AC_SUBST(GENERATED_MANPAGES)
987 MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
989 # How about lex?
990 dnl Don't use AC_PROG_LEX; we insist on flex.
991 dnl LEXLIB is not useful in gcc.
992 AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
994 # Bison?
995 AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
997 # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
998 # check for build == host before using them.
1000 # NM
1001 if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
1002   && test -d ../binutils ; then
1003   NM='${objdir}/../binutils/nm-new'
1004 else
1005   AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
1008 # AR
1009 if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
1010   && test -d ../binutils ; then
1011   AR='${objdir}/../binutils/ar'
1012 else
1013   AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
1016 # The jit documentation looks better if built with sphinx, but can be
1017 # built with texinfo if sphinx is not available.
1018 # Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
1019 AC_CHECK_PROG(doc_build_sys, sphinx-build, sphinx, texinfo)
1021 # --------------------
1022 # Checks for C headers
1023 # --------------------
1025 # Need to reject headers which give warnings, so that the -Werror bootstrap
1026 # works later. *sigh*  This needs to come before all header checks.
1027 AC_PROG_CPP_WERROR
1029 AC_HEADER_STDC
1030 AC_HEADER_TIME
1031 ACX_HEADER_STRING
1032 AC_HEADER_SYS_WAIT
1033 AC_HEADER_TIOCGWINSZ
1034 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
1035                  fcntl.h ftw.h unistd.h sys/file.h sys/time.h sys/mman.h \
1036                  sys/resource.h sys/param.h sys/times.h sys/stat.h \
1037                  direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
1039 # Check for thread headers.
1040 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
1041 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1043 # These tests can't be done till we know if we have limits.h.
1044 gcc_AC_C_CHAR_BIT
1045 AC_C_BIGENDIAN
1047 # ----------------------
1048 # Checks for C++ headers
1049 # ----------------------
1051 dnl Autoconf will give an error in the configure script if there is no
1052 dnl C++ preprocessor.  Hack to prevent that.
1053 m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl
1054 AC_PROG_CXXCPP
1055 m4_popdef([AC_MSG_ERROR])[]dnl
1057 AC_CHECK_HEADERS(unordered_map)
1058 AC_CHECK_HEADERS(tr1/unordered_map)
1059 AC_CHECK_HEADERS(ext/hash_map)
1061 # --------
1062 # Dependency checking.
1063 # --------
1065 ZW_CREATE_DEPDIR
1066 AC_CONFIG_COMMANDS([gccdepdir],[
1067   ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
1068   for lang in $subdirs c-family common
1069   do
1070       ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
1071   done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
1073 ZW_PROG_COMPILER_DEPENDENCIES([CXX])
1075 # --------
1076 # UNSORTED
1077 # --------
1080 # These libraries may be used by collect2.
1081 # We may need a special search path to get them linked.
1082 AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
1083 [save_LIBS="$LIBS"
1084 for libs in '' -lld -lmld \
1085                 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
1086                 '-L/usr/lib/cmplrs/cc3.11 -lmld'
1088         LIBS="$libs"
1089         AC_TRY_LINK_FUNC(ldopen,
1090                 [gcc_cv_collect2_libs="$libs"; break])
1091 done
1092 LIBS="$save_LIBS"
1093 test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
1094 case $gcc_cv_collect2_libs in
1095         "none required")        ;;
1096         *)      COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
1097 esac
1098 AC_SUBST(COLLECT2_LIBS)
1100 # When building Ada code on Alpha, we need exc_resume which is usually in
1101 # -lexc.  So test for it.
1102 save_LIBS="$LIBS"
1103 LIBS=
1104 AC_SEARCH_LIBS(exc_resume, exc)
1105 GNAT_LIBEXC="$LIBS"
1106 LIBS="$save_LIBS"
1107 AC_SUBST(GNAT_LIBEXC)
1109 # To support -mcpu=native on Solaris/SPARC, we need libkstat.
1110 save_LIBS="$LIBS"
1111 LIBS=
1112 AC_SEARCH_LIBS(kstat_open, kstat)
1113 EXTRA_GCC_LIBS="$LIBS"
1114 LIBS="$save_LIBS"
1115 AC_SUBST(EXTRA_GCC_LIBS)
1117 # Some systems put ldexp and frexp in libm instead of libc; assume
1118 # they're both in the same place.  jcf-dump needs them.
1119 save_LIBS="$LIBS"
1120 LIBS=
1121 AC_SEARCH_LIBS(ldexp, m)
1122 LDEXP_LIB="$LIBS"
1123 LIBS="$save_LIBS"
1124 AC_SUBST(LDEXP_LIB)
1126 # Use <inttypes.h> only if it exists,
1127 # doesn't clash with <sys/types.h>, declares intmax_t and defines
1128 # PRId64
1129 AC_MSG_CHECKING(for inttypes.h)
1130 AC_CACHE_VAL(gcc_cv_header_inttypes_h,
1131 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1132 [[#define __STDC_FORMAT_MACROS
1133 #include <sys/types.h>
1134 #include <inttypes.h>]],
1135   [[intmax_t i = -1;
1136 #ifndef PRId64
1137 choke me
1138 #endif]])],
1139   [gcc_cv_header_inttypes_h=yes],
1140   [gcc_cv_header_inttypes_h=no])])
1141 AC_MSG_RESULT($gcc_cv_header_inttypes_h)
1142 if test $gcc_cv_header_inttypes_h = yes; then
1143   AC_DEFINE(HAVE_INTTYPES_H, 1,
1144         [Define if you have a working <inttypes.h> header file.])
1147 dnl Disabled until we have a complete test for buggy enum bitfields.
1148 dnl gcc_AC_C_ENUM_BF_UNSIGNED
1150 define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1151   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1152   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1153   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1154   putchar_unlocked putc_unlocked)
1155 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
1156         popen sysconf strsignal getrusage nl_langinfo \
1157         gettimeofday mbstowcs wcswidth mmap setlocale \
1158         gcc_UNLOCKED_FUNCS madvise)
1160 if test x$ac_cv_func_mbstowcs = xyes; then
1161   AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
1162 [    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
1163 int main()
1165   mbstowcs(0, "", 0);
1166   return 0;
1167 }]])],
1168     [gcc_cv_func_mbstowcs_works=yes],
1169     [gcc_cv_func_mbstowcs_works=no],
1170     [gcc_cv_func_mbstowcs_works=yes])])
1171   if test x$gcc_cv_func_mbstowcs_works = xyes; then
1172     AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1173   [Define this macro if mbstowcs does not crash when its
1174    first argument is NULL.])
1175   fi
1178 AC_CHECK_TYPE(ssize_t, int)
1179 AC_CHECK_TYPE(caddr_t, char *)
1181 GCC_AC_FUNC_MMAP_BLACKLIST
1183 case "${host}" in
1184 *-*-*vms*)
1185   # Under VMS, vfork works very differently than on Unix. The standard test 
1186   # won't work, and it isn't easily adaptable. It makes more sense to
1187   # just force it.
1188   ac_cv_func_vfork_works=yes
1189   ;;
1190 esac
1191 AC_FUNC_FORK
1193 AM_ICONV
1195 # Until we have in-tree GNU iconv:
1196 LIBICONV_DEP=
1197 AC_SUBST(LIBICONV_DEP)
1199 AM_LC_MESSAGES
1201 AM_LANGINFO_CODESET
1203 # We will need to find libiberty.h and ansidecl.h
1204 saved_CFLAGS="$CFLAGS"
1205 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
1206 saved_CXXFLAGS="$CXXFLAGS"
1207 CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
1209 # gcc_AC_CHECK_DECLS doesn't support overloaded functions, so use the
1210 # normal autoconf function for these.  But force definition of
1211 # HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre
1212 # basename handling in libiberty.h.
1213 AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[
1214 #undef HAVE_DECL_BASENAME
1215 #define HAVE_DECL_BASENAME 1
1216 #include "ansidecl.h"
1217 #include "system.h"])
1219 gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \
1220         madvise stpcpy strnlen strsignal strverscmp \
1221         strtol strtoul strtoll strtoull \
1222         errno snprintf vsnprintf vasprintf malloc realloc calloc \
1223         free getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
1224 #include "ansidecl.h"
1225 #include "system.h"])
1227 gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
1228 #include "ansidecl.h"
1229 #include "system.h"
1230 #ifdef HAVE_SYS_RESOURCE_H
1231 #include <sys/resource.h>
1232 #endif
1235 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1236 #include "ansidecl.h"
1237 #include "system.h"
1238 #ifdef HAVE_SYS_RESOURCE_H
1239 #include <sys/resource.h>
1240 #endif
1241 ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
1242 [Define to `long' if <sys/resource.h> doesn't define.])])
1244 # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
1245 # FREAD and FWRITE macros.  Fortunately, for GCC's single usage of ldgetname
1246 # in collect2.c, <fcntl.h> isn't visible, but the configure test below needs
1247 # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
1248 gcc_AC_CHECK_DECLS(ldgetname, , ,[
1249 #include "ansidecl.h"
1250 #include "system.h"
1251 #ifdef HAVE_LDFCN_H
1252 #undef FREAD
1253 #undef FWRITE
1254 #include <ldfcn.h>
1255 #endif
1258 gcc_AC_CHECK_DECLS(times, , ,[
1259 #include "ansidecl.h"
1260 #include "system.h"
1261 #ifdef HAVE_SYS_TIMES_H
1262 #include <sys/times.h>
1263 #endif
1266 gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1267 #include "ansidecl.h"
1268 #include "system.h"
1269 #include <signal.h>
1272 # More time-related stuff.
1273 AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
1274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1275 #include "ansidecl.h"
1276 #include "system.h"
1277 #ifdef HAVE_SYS_TIMES_H
1278 #include <sys/times.h>
1279 #endif
1280 ]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
1281 if test $ac_cv_struct_tms = yes; then
1282   AC_DEFINE(HAVE_STRUCT_TMS, 1,
1283   [Define if <sys/times.h> defines struct tms.])
1286 # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1287 # revisit after autoconf 2.50.
1288 AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
1289 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1290 #include "ansidecl.h"
1291 #include "system.h"
1292 ]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
1293 if test $gcc_cv_type_clock_t = yes; then
1294   AC_DEFINE(HAVE_CLOCK_T, 1,
1295   [Define if <time.h> defines clock_t.])
1298 # Check if F_SETLKW is supported by fcntl.
1299 AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [
1300 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1301 #include <fcntl.h>]], [[
1302 struct flock fl;
1303 fl.l_whence = 0;
1304 fl.l_start = 0;
1305 fl.l_len = 0;
1306 fl.l_pid = 0;
1307 return fcntl (1, F_SETLKW, &fl);]])],
1308 [ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])])
1309 if test $ac_cv_f_setlkw = yes; then
1310   AC_DEFINE(HOST_HAS_F_SETLKW, 1,
1311   [Define if F_SETLKW supported by fcntl.])
1314 # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
1315 CFLAGS="$saved_CFLAGS"
1316 CXXFLAGS="$saved_CXXFLAGS"
1318 # mkdir takes a single argument on some systems. 
1319 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
1321 # File extensions
1322 manext='.1'
1323 objext='.o'
1324 AC_SUBST(manext)
1325 AC_SUBST(objext)
1327 # With Setjmp/Longjmp based exception handling.
1328 AC_ARG_ENABLE(sjlj-exceptions,
1329 [AS_HELP_STRING([--enable-sjlj-exceptions],
1330                 [arrange to use setjmp/longjmp exception handling])],
1331 [case $target in
1332   *-*-hpux10*)
1333     if test $enableval != yes; then
1334       AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced])
1335       enableval=yes
1336     fi
1337     ;;
1338 esac
1339 force_sjlj_exceptions=yes],
1340 [case $target in
1341   *-*-hpux10*)
1342     force_sjlj_exceptions=yes
1343     enableval=yes
1344     ;;
1345   lm32*-*-*)
1346      force_sjlj_exceptions=yes
1347      enableval=yes
1348      ;;
1349   *)
1350     force_sjlj_exceptions=no
1351     ;;
1352 esac])
1353 if test $force_sjlj_exceptions = yes; then
1354   sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1355   AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1356     [Define 0/1 to force the choice for exception handling model.])
1359 # --------------------------------------------------------
1360 # Build, host, and target specific configuration fragments
1361 # --------------------------------------------------------
1363 # Collect build-machine-specific information.
1364 . ${srcdir}/config.build
1366 # Collect host-machine-specific information.
1367 . ${srcdir}/config.host
1369 target_gtfiles=
1371 # Collect target-machine-specific information.
1372 . ${srcdir}/config.gcc
1374 extra_objs="${host_extra_objs} ${extra_objs}"
1375 extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
1377 # Default the target-machine variables that were not explicitly set.
1378 if test x"$tm_file" = x
1379 then tm_file=$cpu_type/$cpu_type.h; fi
1381 if test x"$extra_headers" = x
1382 then extra_headers=; fi
1384 if test x$md_file = x
1385 then md_file=$cpu_type/$cpu_type.md; fi
1387 if test x$out_file = x
1388 then out_file=$cpu_type/$cpu_type.c; fi
1390 if test x"$tmake_file" = x
1391 then tmake_file=$cpu_type/t-$cpu_type
1394 # Support --enable-initfini-array.
1395 if test x$enable_initfini_array != xno; then
1396   tm_file="${tm_file} initfini-array.h"
1399 if test x"$dwarf2" = xyes
1400 then tm_file="$tm_file tm-dwarf2.h"
1403 # Say what files are being used for the output code and MD file.
1404 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
1405 echo "Using \`$srcdir/config/$md_file' as machine description file."
1407 # If any of the xm_file variables contain nonexistent files, warn
1408 # about them and drop them.
1411 for x in $build_xm_file; do
1412   if    test -f $srcdir/config/$x
1413   then      bx="$bx $x"
1414   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1415   fi
1416 done
1417 build_xm_file="$bx"
1420 for x in $host_xm_file; do
1421   if    test -f $srcdir/config/$x
1422   then      hx="$hx $x"
1423   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1424   fi
1425 done
1426 host_xm_file="$hx"
1429 for x in $xm_file; do
1430   if    test -f $srcdir/config/$x
1431   then      tx="$tx $x"
1432   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1433   fi
1434 done
1435 xm_file="$tx"
1437 count=a
1438 for f in $tm_file; do
1439         count=${count}x
1440 done
1441 if test $count = ax; then
1442         echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1443 else
1444         echo "Using the following target machine macro files:"
1445         for f in $tm_file; do
1446                 echo "  $srcdir/config/$f"
1447         done
1450 if test x$use_long_long_for_widest_fast_int = xyes; then
1451         AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
1452 [Define to 1 if the 'long long' type is wider than 'long' but still
1453 efficiently supported by the host hardware.])
1456 gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi`
1457 AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.])
1459 gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
1460 AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.])
1462 count=a
1463 for f in $host_xm_file; do
1464         count=${count}x
1465 done
1466 if test $count = a; then
1467         :
1468 elif test $count = ax; then
1469         echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1470 else
1471         echo "Using the following host machine macro files:"
1472         for f in $host_xm_file; do
1473                 echo "  $srcdir/config/$f"
1474         done
1476 echo "Using ${out_host_hook_obj} for host machine hooks."
1478 if test "$host_xm_file" != "$build_xm_file"; then
1479         count=a
1480         for f in $build_xm_file; do
1481                 count=${count}x
1482         done
1483         if test $count = a; then
1484                 :
1485         elif test $count = ax; then
1486                 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1487         else
1488                 echo "Using the following build machine macro files:"
1489                 for f in $build_xm_file; do
1490                         echo "  $srcdir/config/$f"
1491                 done
1492         fi
1495 if test -n "$configured_native_system_header_dir"; then
1496   native_system_header_dir=$configured_native_system_header_dir
1498 NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir"
1499 AC_SUBST(NATIVE_SYSTEM_HEADER_DIR)
1501 case ${host} in
1502   powerpc*-*-darwin*)
1503     AC_CACHE_CHECK([whether mcontext_t fields have underscores],
1504       gcc_cv_mcontext_underscores,
1505       AC_COMPILE_IFELSE([
1506 #include <sys/cdefs.h>
1507 #include <sys/signal.h>
1508 #include <ucontext.h>
1509 int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
1511         gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
1512       if test $gcc_cv_mcontext_underscores = yes; then
1513         AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
1514           [mcontext_t fields start with __])
1515       fi
1516     ;;
1517 esac
1519 # ---------
1520 # Threading
1521 # ---------
1523 # Check if a valid thread package
1524 case ${enable_threads} in
1525   "" | no)
1526     # No threads
1527     target_thread_file='single'
1528     ;;
1529   yes)
1530     # default
1531     target_thread_file='single'
1532     ;;
1533   aix | dce | lynx | mipssde | posix | rtems | \
1534   single | tpf | vxworks | win32)
1535     target_thread_file=${enable_threads}
1536     ;;
1537   *)
1538     echo "${enable_threads} is an unknown thread package" 1>&2
1539     exit 1
1540     ;;
1541 esac
1543 if test x${thread_file} = x; then
1544   # No thread file set by target-specific clauses in config.gcc,
1545   # so use file chosen by default logic above
1546   thread_file=${target_thread_file}
1549 # --------
1550 # UNSORTED
1551 # --------
1553 use_cxa_atexit=no
1554 if test x$enable___cxa_atexit = xyes || \
1555    test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
1556   if test x$host = x$target; then
1557     case $host in
1558       # mingw32 doesn't have __cxa_atexit but uses atexit registration
1559       # keyed to flag_use_cxa_atexit
1560       *-*-mingw32*)
1561         use_cxa_atexit=yes
1562         ;;
1563       powerpc-ibm-aix*)
1564         use_cxa_atexit=yes
1565         ;;
1566       *)
1567         AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
1568           [echo "__cxa_atexit can't be enabled on this target"])
1569         ;;
1570     esac
1571   else
1572     # We can't check for __cxa_atexit when building a cross, so assume
1573     # it is available 
1574     use_cxa_atexit=yes
1575   fi
1576   if test x$use_cxa_atexit = xyes; then
1577     AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
1578       [Define if you want to use __cxa_atexit, rather than atexit, to
1579       register C++ destructors for local statics and global objects.
1580       This is essential for fully standards-compliant handling of
1581       destructors, but requires __cxa_atexit in libc.])
1582   fi
1585 # Look for a file containing extra machine modes.
1586 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
1587   extra_modes_file='$(srcdir)'/config/${extra_modes}
1588   AC_SUBST(extra_modes_file)
1589   AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
1590   [Define to the name of a file containing a list of extra machine modes
1591    for this architecture.])
1594 # Convert extra_options into a form suitable for Makefile use.
1595 extra_opt_files=
1596 all_opt_files=
1597 for f in $extra_options; do
1598   extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
1599   all_opt_files="$all_opt_files $srcdir/config/$f"
1600 done
1601 AC_SUBST(extra_opt_files)
1603 # auto-host.h is the file containing items generated by autoconf and is
1604 # the first file included by config.h.
1605 # If host=build, it is correct to have bconfig include auto-host.h
1606 # as well.  If host!=build, we are in error and need to do more 
1607 # work to find out the build config parameters.
1608 if test x$host = x$build
1609 then
1610         build_auto=auto-host.h
1611 else
1612         # We create a subdir, then run autoconf in the subdir.
1613         # To prevent recursion we set host and build for the new
1614         # invocation of configure to the build for this invocation
1615         # of configure. 
1616         tempdir=build.$$
1617         rm -rf $tempdir
1618         mkdir $tempdir
1619         cd $tempdir
1620         case ${srcdir} in
1621         /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
1622         *) realsrcdir=../${srcdir};;
1623         esac
1624         # Clearing GMPINC is necessary to prevent host headers being
1625         # used by the build compiler.  Defining GENERATOR_FILE stops
1626         # system.h from including gmp.h.
1627         CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
1628         CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
1629         LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
1630         GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
1631         ${realsrcdir}/configure \
1632                 --enable-languages=${enable_languages-all} \
1633                 --target=$target_alias --host=$build_alias --build=$build_alias
1635         # We just finished tests for the build machine, so rename
1636         # the file auto-build.h in the gcc directory.
1637         mv auto-host.h ../auto-build.h
1638         cd ..
1639         rm -rf $tempdir
1640         build_auto=auto-build.h
1642 AC_SUBST(build_subdir)
1644 tm_file="${tm_file} defaults.h"
1645 tm_p_file="${tm_p_file} tm-preds.h"
1646 host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1647 build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
1648 # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
1649 # put this back in temporarily.
1650 xm_file="auto-host.h ansidecl.h ${xm_file}"
1652 # --------
1653 # UNSORTED
1654 # --------
1656 changequote(,)dnl
1657 # Compile in configure arguments.
1658 if test -f configargs.h ; then
1659         # Being re-configured.
1660         gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
1661         gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1662 else
1663         gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1666 # Double all backslashes and backslash all quotes to turn
1667 # gcc_config_arguments into a C string.
1668 sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
1669 $gcc_config_arguments
1671 gcc_config_arguments_str=`cat conftest.out`
1672 rm -f conftest.out
1674 cat > configargs.h <<EOF
1675 /* Generated automatically. */
1676 static const char configuration_arguments[] = "$gcc_config_arguments_str";
1677 static const char thread_model[] = "$thread_file";
1679 static const struct {
1680   const char *name, *value;
1681 } configure_default_options[] = $configure_default_options;
1683 changequote([,])dnl
1685 changequote(,)dnl
1686 gcc_BASEVER=`cat $srcdir/BASE-VER`
1687 gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
1688 gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
1689 if test -f $srcdir/REVISION ; then
1690         gcc_REVISION=`cat $srcdir/REVISION`
1691 else
1692         gcc_REVISION=""
1694 cat > plugin-version.h <<EOF
1695 #include "configargs.h"
1697 #define GCCPLUGIN_VERSION_MAJOR   `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'`
1698 #define GCCPLUGIN_VERSION_MINOR   `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'`
1699 #define GCCPLUGIN_VERSION_PATCHLEVEL   `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'`
1700 #define GCCPLUGIN_VERSION  (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)
1702 static char basever[] = "$gcc_BASEVER";
1703 static char datestamp[] = "$gcc_DATESTAMP";
1704 static char devphase[] = "$gcc_DEVPHASE";
1705 static char revision[] = "$gcc_REVISION";
1707 /* FIXME plugins: We should make the version information more precise.
1708    One way to do is to add a checksum. */
1710 static struct plugin_gcc_version gcc_version = {basever, datestamp,
1711                                                 devphase, revision,
1712                                                 configuration_arguments};
1714 changequote([,])dnl
1716 # Internationalization
1717 ZW_GNU_GETTEXT_SISTER_DIR
1719 # If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
1720 # -liconv on the link line twice.
1721 case "$LIBINTL" in *$LIBICONV*)
1722         LIBICONV= ;;
1723 esac
1725 AC_ARG_ENABLE(secureplt,
1726 [AS_HELP_STRING([--enable-secureplt],
1727                 [enable -msecure-plt by default for PowerPC])],
1728 [], [])
1730 AC_ARG_ENABLE(leading-mingw64-underscores,
1731   AS_HELP_STRING([--enable-leading-mingw64-underscores],
1732                  [enable leading underscores on 64 bit mingw targets]),
1733   [],[])
1734 AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ],
1735   [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1,
1736     [Define if we should use leading underscore on 64 bit mingw targets])])
1738 AC_ARG_ENABLE(cld,
1739 [AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [],
1740 [enable_cld=no])
1742 AC_ARG_ENABLE(frame-pointer,
1743 [AS_HELP_STRING([--enable-frame-pointer],
1744                 [enable -fno-omit-frame-pointer by default for 32bit x86])], [],
1746 case $target_os in
1747 linux* | darwin[[8912]]*)
1748   # Enable -fomit-frame-pointer by default for Linux and Darwin with
1749   # DWARF2.
1750   enable_frame_pointer=no
1751   ;;
1753   enable_frame_pointer=yes
1754   ;;
1755 esac
1758 # Windows32 Registry support for specifying GCC installation paths.
1759 AC_ARG_ENABLE(win32-registry,
1760 [AS_HELP_STRING([--disable-win32-registry],
1761                 [disable lookup of installation paths in the
1762                  Registry on Windows hosts])
1763 AS_HELP_STRING([--enable-win32-registry], [enable registry lookup (default)])
1764 AS_HELP_STRING([--enable-win32-registry=KEY],
1765                [use KEY instead of GCC version as the last portion
1766                 of the registry key])],,)
1768 case $host_os in
1769   win32 | pe | cygwin* | mingw32* | uwin*)
1770     if test "x$enable_win32_registry" != xno; then
1771       AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
1772     fi
1774     if test "x$enable_win32_registry" != xno; then
1775       AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1776   [Define to 1 if installation paths should be looked up in the Windows
1777    Registry. Ignored on non-Windows hosts.])
1779       if test "x$enable_win32_registry" != xyes \
1780          && test "x$enable_win32_registry" != x; then
1781         AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
1782   [Define to be the last component of the Windows registry key under which
1783    to look for installation paths.  The full key used will be 
1784    HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
1785    The default is the GCC version number.])
1786       fi
1787     fi
1788   ;;
1789 esac
1791 # Get an absolute path to the GCC top-level source directory
1792 holddir=`${PWDCMD-pwd}`
1793 cd $srcdir
1794 topdir=`${PWDCMD-pwd}`
1795 cd $holddir
1797 # Conditionalize the makefile for this host machine.
1798 xmake_file=
1799 for f in ${host_xmake_file}
1801         if test -f ${srcdir}/config/$f
1802         then
1803                 xmake_file="${xmake_file} \$(srcdir)/config/$f"
1804         fi
1805 done
1807 # Conditionalize the makefile for this target machine.
1808 tmake_file_=
1809 for f in ${tmake_file}
1811         if test -f ${srcdir}/config/$f
1812         then
1813                 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
1814         fi
1815 done
1816 tmake_file="${tmake_file_}"
1818 out_object_file=`basename $out_file .c`.o
1819 common_out_object_file=`basename $common_out_file .c`.o
1821 tm_file_list="options.h"
1822 tm_include_list="options.h insn-constants.h"
1823 for f in $tm_file; do
1824   case $f in
1825     ./* )
1826        f=`echo $f | sed 's/^..//'`
1827        tm_file_list="${tm_file_list} $f"
1828        tm_include_list="${tm_include_list} $f"
1829        ;;
1830     defaults.h )
1831        tm_file_list="${tm_file_list} \$(srcdir)/$f"
1832        tm_include_list="${tm_include_list} $f"
1833        ;;
1834     * )
1835        tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
1836        tm_include_list="${tm_include_list} config/$f"
1837        ;;
1838   esac
1839 done
1841 tm_p_file_list=
1842 tm_p_include_list=
1843 for f in $tm_p_file; do
1844   case $f in
1845     tm-preds.h )
1846        tm_p_file_list="${tm_p_file_list} $f"
1847        tm_p_include_list="${tm_p_include_list} $f"
1848        ;;
1849     * )
1850        tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
1851        tm_p_include_list="${tm_p_include_list} config/$f"
1852   esac
1853 done
1855 xm_file_list=
1856 xm_include_list=
1857 for f in $xm_file; do
1858   case $f in
1859     ansidecl.h )
1860        xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
1861        xm_include_list="${xm_include_list} $f"
1862        ;;
1863     auto-host.h )
1864        xm_file_list="${xm_file_list} $f"
1865        xm_include_list="${xm_include_list} $f"
1866        ;;
1867     * )
1868        xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
1869        xm_include_list="${xm_include_list} config/$f"
1870        ;;
1871   esac
1872 done
1874 host_xm_file_list=
1875 host_xm_include_list=
1876 for f in $host_xm_file; do
1877   case $f in
1878     ansidecl.h )
1879        host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
1880        host_xm_include_list="${host_xm_include_list} $f"
1881        ;;
1882     auto-host.h )
1883        host_xm_file_list="${host_xm_file_list} $f"
1884        host_xm_include_list="${host_xm_include_list} $f"
1885        ;;
1886     * )
1887        host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
1888        host_xm_include_list="${host_xm_include_list} config/$f"
1889        ;;
1890   esac
1891 done
1893 build_xm_file_list=
1894 for f in $build_xm_file; do
1895   case $f in
1896     ansidecl.h )
1897        build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
1898        build_xm_include_list="${build_xm_include_list} $f"
1899        ;;
1900     auto-build.h | auto-host.h )
1901        build_xm_file_list="${build_xm_file_list} $f"
1902        build_xm_include_list="${build_xm_include_list} $f"
1903        ;;
1904     * )
1905        build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
1906        build_xm_include_list="${build_xm_include_list} config/$f"
1907        ;;
1908   esac
1909 done
1911 # Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
1912 # cross-compiler which does not use the native headers and libraries.
1913 # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1914 CROSS=                                          AC_SUBST(CROSS)
1915 ALL=all.internal                                AC_SUBST(ALL)
1916 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
1918 if test "x$with_build_sysroot" != x; then
1919   build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
1920 else
1921   # This value is used, even on a native system, because 
1922   # CROSS_SYSTEM_HEADER_DIR is just 
1923   # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR).
1924   build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
1927 if test x$host != x$target
1928 then
1929         CROSS="-DCROSS_DIRECTORY_STRUCTURE"
1930         ALL=all.cross
1931         SYSTEM_HEADER_DIR=$build_system_header_dir
1932         case "$host","$target" in
1933         # Darwin crosses can use the host system's libraries and headers,
1934         # because of the fat library support.  Of course, it must be the
1935         # same version of Darwin on both sides.  Allow the user to
1936         # just say --target=foo-darwin without a version number to mean
1937         # "the version on this system".
1938             *-*-darwin*,*-*-darwin*)
1939                 hostos=`echo $host | sed 's/.*-darwin/darwin/'`
1940                 targetos=`echo $target | sed 's/.*-darwin/darwin/'`
1941                 if test $hostos = $targetos -o $targetos = darwin ; then
1942                     CROSS=
1943                     SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
1944                     with_headers=yes
1945                 fi
1946                 ;;
1948             i?86-*-*,x86_64-*-* \
1949             | powerpc*-*-*,powerpc64*-*-*)
1950                 CROSS="$CROSS -DNATIVE_CROSS" ;;
1951         esac
1953         case $target in
1954                 *-*-mingw*)
1955                         if test "x$with_headers" = x; then
1956                                 with_headers=yes
1957                         fi
1958                         ;;
1959                 *)
1960                         ;;
1961         esac
1962 elif test "x$TARGET_SYSTEM_ROOT" != x; then
1963         SYSTEM_HEADER_DIR=$build_system_header_dir 
1966 if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
1967   if test "x$with_headers" != x; then
1968     target_header_dir=$with_headers
1969   elif test "x$with_sysroot" = x; then
1970     target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
1971   elif test "x$with_build_sysroot" != "x"; then
1972     target_header_dir="${with_build_sysroot}${native_system_header_dir}"
1973   elif test "x$with_sysroot" = xyes; then
1974     target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
1975   else
1976     target_header_dir="${with_sysroot}${native_system_header_dir}"
1977   fi
1978 else
1979   target_header_dir=${native_system_header_dir}
1982 # If this is a cross-compiler that does not
1983 # have its own set of headers then define
1984 # inhibit_libc
1986 # If this is using newlib, without having the headers available now,
1987 # then define inhibit_libc in LIBGCC2_CFLAGS.
1988 # This prevents libgcc2 from containing any code which requires libc
1989 # support.
1990 : ${inhibit_libc=false}
1991 if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
1992        test x$with_newlib = xyes ; } &&
1993      { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
1994        inhibit_libc=true
1996 AC_SUBST(inhibit_libc)
1998 # When building gcc with a cross-compiler, we need to adjust things so
1999 # that the generator programs are still built with the native compiler.
2000 # Also, we cannot run fixincludes.
2002 # These are the normal (build=host) settings:
2003 CC_FOR_BUILD='$(CC)'            AC_SUBST(CC_FOR_BUILD)
2004 CXX_FOR_BUILD='$(CXX)'          AC_SUBST(CXX_FOR_BUILD)
2005 BUILD_CFLAGS='$(ALL_CFLAGS)'    AC_SUBST(BUILD_CFLAGS)
2006 BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
2007 BUILD_LDFLAGS='$(LDFLAGS)'      AC_SUBST(BUILD_LDFLAGS)
2008 STMP_FIXINC=stmp-fixinc         AC_SUBST(STMP_FIXINC)
2010 # And these apply if build != host, or we are generating coverage data
2011 if test x$build != x$host || test "x$coverage_flags" != x
2012 then
2013     BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
2014     BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
2015     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
2018 # Expand extra_headers to include complete path.
2019 # This substitutes for lots of t-* files.
2020 extra_headers_list=
2021 # Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
2022 for file in ${extra_headers} ; do
2023   extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
2024 done
2026 # If use_gcc_tgmath is set, append ginclude/tgmath.h.
2027 if test x"$use_gcc_tgmath" = xyes
2028 then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
2031 # Define collect2 in Makefile.
2032 case $host_can_use_collect2 in
2033   no) collect2= ;;
2034   *) collect2='collect2$(exeext)' ;;
2035 esac
2036 AC_SUBST([collect2])
2038 # Add a definition of USE_COLLECT2 if system wants one.
2039 case $use_collect2 in
2040   no) use_collect2= ;;
2041   "") ;;
2042   *) 
2043     host_xm_defines="${host_xm_defines} USE_COLLECT2"
2044     xm_defines="${xm_defines} USE_COLLECT2"
2045     case $host_can_use_collect2 in
2046       no)
2047         AC_MSG_ERROR([collect2 is required but cannot be built on this system])
2048         ;;
2049     esac
2050     ;;
2051 esac
2053 AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}",
2054 [Define to the name of the LTO plugin DSO that must be
2055   passed to the linker's -plugin=LIB option.])
2057 # ---------------------------
2058 # Assembler & linker features
2059 # ---------------------------
2061 # During stage 2, ld is actually gcc/collect-ld, which is a small script to
2062 # discern between when to use prev-ld/ld-new and when to use ld/ld-new.
2063 # However when ld-new is first executed from the build tree, libtool will
2064 # relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers
2065 # to the build tree.  While doing this we need to use the previous-stage
2066 # linker, or we have an infinite loop.  The presence of a shell script as
2067 # ld/ld-new, and the fact that the script *uses ld itself*, is what confuses
2068 # the gcc/collect-ld script.  So we need to know how libtool works, or
2069 # exec-tool will fail.
2071 m4_defun([_LT_CONFIG_COMMANDS], [])
2072 AC_PROG_LIBTOOL
2073 AC_SUBST(objdir)
2074 AC_SUBST(enable_fast_install)
2076 # Identify the assembler which will work hand-in-glove with the newly
2077 # built GCC, so that we can examine its features.  This is the assembler
2078 # which will be driven by the driver program.
2080 # If build != host, and we aren't building gas in-tree, we identify a
2081 # build->target assembler and hope that it will have the same features
2082 # as the host->target assembler we'll be using.
2083 gcc_cv_gas_major_version=
2084 gcc_cv_gas_minor_version=
2085 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
2087 m4_pattern_allow([AS_FOR_TARGET])dnl
2088 AS_VAR_SET_IF(gcc_cv_as,, [
2089 if test -x "$DEFAULT_ASSEMBLER"; then
2090         gcc_cv_as="$DEFAULT_ASSEMBLER"
2091 elif test -f $gcc_cv_as_gas_srcdir/configure.ac \
2092      && test -f ../gas/Makefile \
2093      && test x$build = x$host; then
2094         gcc_cv_as=../gas/as-new$build_exeext
2095 elif test -x as$build_exeext; then
2096         # Build using assembler in the current directory.
2097         gcc_cv_as=./as$build_exeext
2098 elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then
2099         gcc_cv_as="$AS_FOR_TARGET"
2100 else
2101         AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
2102 fi])
2104 ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
2105 AC_SUBST(ORIGINAL_AS_FOR_TARGET)
2106 case "$ORIGINAL_AS_FOR_TARGET" in
2107   ./as | ./as$build_exeext) ;;
2108   *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
2109 esac 
2111 AC_MSG_CHECKING(what assembler to use)
2112 if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then
2113   # Single tree build which includes gas.  We want to prefer it
2114   # over whatever linker top-level may have detected, since
2115   # we'll use what we're building after installation anyway.
2116   AC_MSG_RESULT(newly built gas)
2117   in_tree_gas=yes
2118   _gcc_COMPUTE_GAS_VERSION
2119   in_tree_gas_is_elf=no
2120   if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2121      || (grep 'obj_format = multi' ../gas/Makefile \
2122          && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
2123   then
2124     in_tree_gas_is_elf=yes
2125   fi
2126 else
2127   AC_MSG_RESULT($gcc_cv_as)
2128   in_tree_gas=no
2131 default_ld=
2132 AC_ARG_ENABLE(ld,
2133 [[  --enable-ld[=ARG]       build ld [ARG={default,yes,no}]]],
2134 [case "${enableval}" in
2135  no)
2136    default_ld=ld.gold
2137    ;;
2138  esac])
2140 install_gold_as_default=no
2141 AC_ARG_ENABLE(gold,
2142 [[  --enable-gold[=ARG]     build gold [ARG={default,yes,no}]]],
2143 [case "${enableval}" in
2144  default)
2145    install_gold_as_default=yes
2146    ;;
2147  yes)
2148    if test x${default_ld} != x; then
2149      install_gold_as_default=yes
2150    fi
2151    ;;
2152  no)
2153    ;;
2154  *)
2155    AC_MSG_ERROR([invalid --enable-gold argument])
2156    ;;
2157  esac])
2159 # Identify the linker which will work hand-in-glove with the newly
2160 # built GCC, so that we can examine its features.  This is the linker
2161 # which will be driven by the driver program.
2163 # If build != host, and we aren't building gas in-tree, we identify a
2164 # build->target linker and hope that it will have the same features
2165 # as the host->target linker we'll be using.
2166 gcc_cv_gld_major_version=
2167 gcc_cv_gld_minor_version=
2168 gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
2169 gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
2170 gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
2172 AS_VAR_SET_IF(gcc_cv_ld,, [
2173 if test -x "$DEFAULT_LINKER"; then
2174         gcc_cv_ld="$DEFAULT_LINKER"
2175 elif test $install_gold_as_default = yes \
2176      && test -f $gcc_cv_ld_gold_srcdir/configure.ac \
2177      && test -f ../gold/Makefile \
2178      && test x$build = x$host; then
2179         gcc_cv_ld=../gold/ld-new$build_exeext
2180 elif test -f $gcc_cv_ld_gld_srcdir/configure.ac \
2181      && test -f ../ld/Makefile \
2182      && test x$build = x$host; then
2183         gcc_cv_ld=../ld/ld-new$build_exeext
2184 elif test -x collect-ld$build_exeext; then
2185         # Build using linker in the current directory.
2186         gcc_cv_ld=./collect-ld$build_exeext
2187 elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then
2188         gcc_cv_ld="$LD_FOR_TARGET"
2189 else
2190         AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
2191 fi])
2193 ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
2194 PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"`
2195 # if the PLUGIN_LD is set ld-new, just have it as ld
2196 # as that is the installed named.
2197 if test x$PLUGIN_LD_SUFFIX = xld-new \
2198    || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then
2199   PLUGIN_LD_SUFFIX=ld
2201 AC_ARG_WITH(plugin-ld,
2202 [AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])],
2203 [if test x"$withval" != x; then
2204    ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval"
2205    PLUGIN_LD_SUFFIX=`echo $withval | sed -e "s,$target_alias-,,"`
2206  fi])
2207 AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET)
2208 AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker])
2210 # Check to see if we are using gold instead of ld
2211 AC_MSG_CHECKING(whether we are using gold)
2212 ld_is_gold=no
2213 if test x$gcc_cv_ld != x; then
2214   if $gcc_cv_ld --version 2>/dev/null | sed 1q \
2215      | grep "GNU gold" > /dev/null; then
2216     ld_is_gold=yes
2217   fi
2219 AC_MSG_RESULT($ld_is_gold)
2221 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
2222 AC_SUBST(ORIGINAL_LD_FOR_TARGET)
2223 case "$ORIGINAL_LD_FOR_TARGET" in
2224   ./collect-ld | ./collect-ld$build_exeext) ;;
2225   *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
2226 esac 
2228 AC_MSG_CHECKING(what linker to use)
2229 if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \
2230    || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then
2231         # Single tree build which includes ld.  We want to prefer it
2232         # over whatever linker top-level may have detected, since
2233         # we'll use what we're building after installation anyway.
2234         AC_MSG_RESULT(newly built ld)
2235         in_tree_ld=yes
2236         in_tree_ld_is_elf=no
2237         if (grep 'EMUL = .*elf' ../ld/Makefile \
2238             || grep 'EMUL = .*linux' ../ld/Makefile \
2239             || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
2240           in_tree_ld_is_elf=yes
2241         elif test "$ld_is_gold" = yes; then
2242           in_tree_ld_is_elf=yes
2243         fi
2244         for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.ac $gcc_cv_ld_gld_srcdir/Makefile.in
2245         do
2246 changequote(,)dnl
2247                 gcc_cv_gld_version=`sed -n -e 's/^[     ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f`
2248                 if test x$gcc_cv_gld_version != x; then
2249                         break
2250                 fi
2251         done
2252         case $gcc_cv_gld_version in
2253           VERSION=[0-9]*) ;;
2254 changequote([,])dnl
2255           *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;;
2256 changequote(,)dnl
2257         esac
2258         gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
2259         gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
2260 changequote([,])dnl
2261         ORIGINAL_LD_BFD_FOR_TARGET=../ld/ld-new$build_exeext
2262         ORIGINAL_LD_GOLD_FOR_TARGET=../gold/ld-new$build_exeext
2263 else
2264         AC_MSG_RESULT($gcc_cv_ld)
2265         in_tree_ld=no
2266         gcc_cvs_ld_program=`dirname $gcc_cv_ld`/`basename $gcc_cv_ld $host_exeext`
2267         ORIGINAL_LD_BFD_FOR_TARGET=${gcc_cvs_ld_program}.bfd$host_exeext
2268         ORIGINAL_LD_GOLD_FOR_TARGET=${gcc_cvs_ld_program}.gold$host_exeext
2271 AC_SUBST(ORIGINAL_LD_BFD_FOR_TARGET)
2272 AC_SUBST(ORIGINAL_LD_GOLD_FOR_TARGET)
2274 # Figure out what nm we will be using.
2275 gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
2276 AS_VAR_SET_IF(gcc_cv_nm,, [
2277 if test -f $gcc_cv_binutils_srcdir/configure.ac \
2278      && test -f ../binutils/Makefile \
2279      && test x$build = x$host; then
2280         gcc_cv_nm=../binutils/nm-new$build_exeext
2281 elif test -x nm$build_exeext; then
2282         gcc_cv_nm=./nm$build_exeext
2283 elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then
2284         gcc_cv_nm="$NM_FOR_TARGET"
2285 else
2286         AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
2287 fi])
2289 AC_MSG_CHECKING(what nm to use)
2290 if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
2291         # Single tree build which includes binutils.
2292         AC_MSG_RESULT(newly built nm)
2293         in_tree_nm=yes
2294 else
2295         AC_MSG_RESULT($gcc_cv_nm)
2296         in_tree_nm=no
2299 ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
2300 AC_SUBST(ORIGINAL_NM_FOR_TARGET)
2301 case "$ORIGINAL_NM_FOR_TARGET" in
2302   ./nm | ./nm$build_exeext) ;;
2303   *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;;
2304 esac
2307 # Figure out what objdump we will be using.
2308 AS_VAR_SET_IF(gcc_cv_objdump,, [
2309 if test -f $gcc_cv_binutils_srcdir/configure.ac \
2310      && test -f ../binutils/Makefile \
2311      && test x$build = x$host; then
2312         # Single tree build which includes binutils.
2313         gcc_cv_objdump=../binutils/objdump$build_exeext
2314 elif test -x objdump$build_exeext; then
2315         gcc_cv_objdump=./objdump$build_exeext
2316 elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then
2317         gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
2318 else
2319         AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
2320 fi])
2322 AC_MSG_CHECKING(what objdump to use)
2323 if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
2324         # Single tree build which includes binutils.
2325         AC_MSG_RESULT(newly built objdump)
2326 elif test x$gcc_cv_objdump = x; then
2327         AC_MSG_RESULT(not found)
2328 else
2329         AC_MSG_RESULT($gcc_cv_objdump)
2332 # Figure out what readelf we will be using.
2333 AS_VAR_SET_IF(gcc_cv_readelf,, [
2334 if test -f $gcc_cv_binutils_srcdir/configure.ac \
2335      && test -f ../binutils/Makefile \
2336      && test x$build = x$host; then
2337         # Single tree build which includes binutils.
2338         gcc_cv_readelf=../binutils/readelf$build_exeext
2339 elif test -x readelf$build_exeext; then
2340         gcc_cv_readelf=./readelf$build_exeext
2341 else
2342         AC_PATH_PROG(gcc_cv_readelf, readelf)
2343 fi])
2345 AC_MSG_CHECKING(what readelf to use)
2346 if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
2347         # Single tree build which includes binutils.
2348         AC_MSG_RESULT(newly built readelf)
2349 elif test x$gcc_cv_readelf = x; then
2350         AC_MSG_RESULT(not found)
2351 else
2352         AC_MSG_RESULT($gcc_cv_readelf)
2355 # Figure out what assembler alignment features are present.
2356 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
2357  [2,6,0],,
2358 [.balign 4
2359 .p2align 2],,
2360 [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
2361   [Define if your assembler supports .balign and .p2align.])])
2363 gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
2364  [2,8,0],,
2365  [.p2align 4,,7],,
2366 [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
2367   [Define if your assembler supports specifying the maximum number
2368    of bytes to skip when using the GAS .p2align command.])])
2370 gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,
2371  [2,8,0],,
2372  [.literal16],,
2373 [AC_DEFINE(HAVE_GAS_LITERAL16, 1,
2374   [Define if your assembler supports .literal16.])])
2376 gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
2377  [elf,2,9,0],,
2378  [conftest_label1: .word 0
2379 .subsection -1
2380 conftest_label2: .word 0
2381 .previous],
2382  [if test x$gcc_cv_nm != x; then
2383     $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
2384     $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
2385     if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
2386     then :
2387     else gcc_cv_as_subsection_m1=yes
2388     fi
2389     rm -f conftest.nm1 conftest.nm2
2390   fi],
2391  [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
2392   [Define if your assembler supports .subsection and .subsection -1 starts
2393    emitting at the beginning of your section.])])
2395 gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
2396  [2,2,0],,
2397  [      .weak foobar],,
2398 [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
2400 gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
2401  [2,17,0],,
2402  [      .weakref foobar, barfnot],,
2403 [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
2405 gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
2406  [2,15,91],,
2407  [      .SPACE $TEXT$
2408         .NSUBSPA $CODE$,COMDAT],,
2409 [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
2411 # .hidden needs to be supported in both the assembler and the linker,
2412 # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
2413 # This is irritatingly difficult to feature test for; we have to check the
2414 # date string after the version number.  If we've got an in-tree
2415 # ld, we don't know its patchlevel version, so we set the baseline at 2.13
2416 # to be safe.
2417 # The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
2418 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
2419  [elf,2,13,0],,
2420 [       .hidden foobar
2421 foobar:])
2422 case "${target}" in
2423   *-*-darwin*)
2424     # Darwin as has some visibility support, though with a different syntax.
2425     gcc_cv_as_hidden=yes
2426     ;;
2427 esac
2429 # gnu_indirect_function type is an extension proposed at
2430 # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime
2431 # selection of function implementation
2432 AC_ARG_ENABLE(gnu-indirect-function,
2433  [AS_HELP_STRING([--enable-gnu-indirect-function],
2434                  [enable the use of the @gnu_indirect_function to glibc systems])],
2435  [case $enable_gnu_indirect_function in
2436     yes | no) ;;
2437     *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function.
2438 Valid choices are 'yes' and 'no'.]) ;;
2439   esac],
2440  [enable_gnu_indirect_function="$default_gnu_indirect_function"])
2442 gif=`if test x$enable_gnu_indirect_function = xyes; then echo 1; else echo 0; fi`
2443 AC_DEFINE_UNQUOTED(HAVE_GNU_INDIRECT_FUNCTION, $gif,
2444 [Define if your system supports gnu indirect functions.])
2447 changequote(,)dnl
2448 if test $in_tree_ld != yes ; then
2449   ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
2450   if echo "$ld_ver" | grep GNU > /dev/null; then
2451     if test x"$ld_is_gold" = xyes; then
2452       # GNU gold --version looks like this:
2453       #
2454       # GNU gold (GNU Binutils 2.21.51.20110225) 1.11
2455       #
2456       # We extract the binutils version which is more familiar and specific
2457       # than the gold version.
2458       ld_vers=`echo $ld_ver | sed -n \
2459           -e 's,^[^)]*[  ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
2460     else
2461       # GNU ld --version looks like this:
2462       #
2463       # GNU ld (GNU Binutils) 2.21.51.20110225
2464       ld_vers=`echo $ld_ver | sed -n \
2465           -e 's,^.*[     ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
2466     fi
2467     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'`
2468     ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2469     ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2470     ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
2471   else
2472     case "${target}" in
2473       *-*-solaris2*)
2474         # See acinclude.m4 (gcc_SUN_LD_VERSION) for the version number
2475         # format.
2476         #
2477         # Don't reuse gcc_gv_sun_ld_vers_* in case a linker other than
2478         # /usr/ccs/bin/ld has been configured.
2479         ld_ver=`$gcc_cv_ld -V 2>&1`
2480         if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then
2481           ld_vers=`echo $ld_ver | sed -n \
2482             -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
2483           ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2484           ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2485         fi
2486         ;;
2487     esac
2488   fi
2490 changequote([,])dnl
2492 AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
2493 [[if test $in_tree_ld = yes ; then
2494   gcc_cv_ld_hidden=no
2495   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 \
2496      && test $in_tree_ld_is_elf = yes; then
2497      gcc_cv_ld_hidden=yes
2498   fi
2499 else
2500   gcc_cv_ld_hidden=yes
2501   if test x"$ld_is_gold" = xyes; then
2502     :
2503   elif echo "$ld_ver" | grep GNU > /dev/null; then
2504     case "${target}" in
2505       mmix-knuth-mmixware)
2506         # The linker emits by default mmo, not ELF, so "no" is appropriate.
2507         gcc_cv_ld_hidden=no
2508         ;;
2509     esac
2510     if test 0"$ld_date" -lt 20020404; then
2511       if test -n "$ld_date"; then
2512         # If there was date string, but was earlier than 2002-04-04, fail
2513         gcc_cv_ld_hidden=no
2514       elif test -z "$ld_vers"; then
2515         # If there was no date string nor ld version number, something is wrong
2516         gcc_cv_ld_hidden=no
2517       else
2518         test -z "$ld_vers_patch" && ld_vers_patch=0
2519         if test "$ld_vers_major" -lt 2; then
2520           gcc_cv_ld_hidden=no
2521         elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
2522           gcc_cv_ld_hidden="no"
2523         elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
2524           gcc_cv_ld_hidden=no
2525         fi
2526       fi
2527     fi
2528   else
2529     case "${target}" in
2530       *-*-darwin*)
2531         # Darwin ld has some visibility support.
2532         gcc_cv_ld_hidden=yes
2533         ;;
2534       hppa64*-*-hpux* | ia64*-*-hpux*)
2535         gcc_cv_ld_hidden=yes
2536         ;;
2537       *-*-solaris2.1[0-9]*)
2538         # Support for .hidden in Sun ld appeared in Solaris 9 FCS, but
2539         # .symbolic was only added in Solaris 9 12/02.
2540         gcc_cv_ld_hidden=yes
2541         ;;
2542       *)
2543         gcc_cv_ld_hidden=no
2544         ;;
2545     esac
2546   fi
2547 fi]])
2548 libgcc_visibility=no
2549 AC_SUBST(libgcc_visibility)
2550 GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
2551 if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
2552   libgcc_visibility=yes
2553   AC_DEFINE(HAVE_GAS_HIDDEN, 1,
2554   [Define if your assembler and linker support .hidden.])
2557 AC_MSG_CHECKING(linker read-only and read-write section mixing)
2558 gcc_cv_ld_ro_rw_mix=unknown
2559 if test $in_tree_ld = yes ; then
2560   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 \
2561      && test $in_tree_ld_is_elf = yes; then
2562     gcc_cv_ld_ro_rw_mix=read-write
2563   fi
2564 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
2565   echo '.section myfoosect, "a"' > conftest1.s
2566   echo '.section myfoosect, "aw"' > conftest2.s
2567   echo '.byte 1' >> conftest2.s
2568   echo '.section myfoosect, "a"' > conftest3.s
2569   echo '.byte 0' >> conftest3.s
2570   if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
2571      && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
2572      && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
2573      && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
2574         conftest2.o conftest3.o > /dev/null 2>&1; then
2575     gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
2576                          | sed -e '/myfoosect/!d' -e N`
2577     if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
2578       if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
2579         gcc_cv_ld_ro_rw_mix=read-only
2580       else
2581         gcc_cv_ld_ro_rw_mix=read-write
2582       fi
2583     fi
2584   fi
2585 changequote(,)dnl
2586   rm -f conftest.* conftest[123].*
2587 changequote([,])dnl
2589 if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
2590         AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
2591   [Define if your linker links a mix of read-only
2592    and read-write sections into a read-write section.])
2594 AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
2596 gcc_AC_INITFINI_ARRAY
2598 # Check if we have .[us]leb128, and support symbol arithmetic with it.
2599 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
2600   [elf,2,11,0],,
2601 [       .data
2602         .uleb128 L2 - L1
2604         .uleb128 1280
2605         .sleb128 -1010
2606 L2:],
2607 [[# GAS versions before 2.11 do not support uleb128,
2608   # despite appearing to.
2609   # ??? There exists an elf-specific test that will crash
2610   # the assembler.  Perhaps it's better to figure out whether
2611   # arbitrary sections are supported and try the test.
2612   as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
2613   if echo "$as_ver" | grep GNU > /dev/null; then
2614     as_vers=`echo $as_ver | sed -n \
2615         -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
2616     as_major=`expr "$as_vers" : '\([0-9]*\)'`
2617     as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'`
2618     if test $as_major -eq 2 && test $as_minor -lt 11
2619     then :
2620     else gcc_cv_as_leb128=yes
2621     fi
2622   fi]],
2623   [AC_DEFINE(HAVE_AS_LEB128, 1,
2624     [Define if your assembler supports .sleb128 and .uleb128.])])
2626 # Check if we have assembler support for unwind directives.
2627 gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
2628   ,,
2629 [       .text
2630         .cfi_startproc
2631         .cfi_offset 0, 0
2632         .cfi_same_value 1
2633         .cfi_def_cfa 1, 2
2634         .cfi_escape 1, 2, 3, 4, 5
2635         .cfi_endproc],
2636 [case "$target" in
2637   *-*-solaris*)
2638     # If the linker used on Solaris (like Sun ld) isn't capable of merging
2639     # read-only and read-write sections, we need to make sure that the
2640     # assembler used emits read-write .eh_frame sections.
2641     if test "x$gcc_cv_ld_ro_rw_mix" != xread-write; then
2642       if test "x$gcc_cv_objdump" != x; then
2643         if $gcc_cv_objdump -h conftest.o 2>/dev/null | \
2644                 sed -e /.eh_frame/!d -e N | grep READONLY > /dev/null; then
2645           gcc_cv_as_cfi_directive=no
2646         else
2647           case "$target" in
2648             i?86-*-solaris2.1[[0-9]]* | x86_64-*-solaris2.1[[0-9]]*)
2649               # On Solaris/x86, make sure that GCC and assembler agree on using
2650               # read-only .eh_frame sections for 64-bit.
2651               if test x$gas = xyes; then
2652                  as_ix86_64_opt="--64"
2653               else
2654                  as_ix86_64_opt="-xarch=amd64"
2655               fi
2656               if $gcc_cv_as $as_ix86_64_opt -o conftest.o conftest.s > /dev/null 2>&1 && \
2657                 $gcc_cv_objdump -h conftest.o 2>/dev/null | \
2658                         sed -e /.eh_frame/!d -e N | \
2659                         grep READONLY > /dev/null; then
2660                 gcc_cv_as_cfi_directive=yes
2661               else
2662                 gcc_cv_as_cfi_directive=no
2663               fi
2664               ;;
2665             *)
2666               gcc_cv_as_cfi_directive=yes
2667               ;;
2668           esac 
2669         fi
2670       else
2671         # no objdump, err on the side of caution
2672         gcc_cv_as_cfi_directive=no
2673       fi
2674     else
2675       gcc_cv_as_cfi_directive=yes
2676     fi
2677     ;;
2678   *-*-*)
2679     gcc_cv_as_cfi_directive=yes
2680     ;;
2681 esac])
2682 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
2683 gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
2684   ,,
2685 [       .text
2686         .cfi_startproc
2687         .cfi_adjust_cfa_offset 64
2688         .skip 75040, 0
2689         .cfi_adjust_cfa_offset 128
2690         .cfi_endproc],
2692 if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
2693     | grep 'DW_CFA_advance_loc[24]:[    ][      ]*75040[        ]' >/dev/null; then
2694    gcc_cv_as_cfi_advance_working=yes
2697 else
2698   # no objdump, err on the side of caution
2699   gcc_cv_as_cfi_advance_working=no
2701 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_DIRECTIVE)
2702 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
2703   [`if test $gcc_cv_as_cfi_directive = yes \
2704        && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`],
2705   [Define 0/1 if your assembler supports CFI directives.])
2707 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
2708 gcc_GAS_CHECK_FEATURE([cfi personality directive],
2709   gcc_cv_as_cfi_personality_directive, ,,
2710 [       .text
2711         .cfi_startproc
2712         .cfi_personality 0, symbol
2713         .cfi_endproc])
2714 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
2715   [`if test $gcc_cv_as_cfi_personality_directive = yes;
2716     then echo 1; else echo 0; fi`],
2717   [Define 0/1 if your assembler supports .cfi_personality.])
2719 gcc_GAS_CHECK_FEATURE([cfi sections directive],
2720   gcc_cv_as_cfi_sections_directive, ,,
2721 [       .text
2722         .cfi_sections .debug_frame, .eh_frame
2723         .cfi_startproc
2724         .cfi_endproc],
2725 [case $target_os in
2726   win32 | pe | cygwin* | mingw32* | uwin*)
2727     # Need to check that we generated the correct relocation for the
2728     # .debug_frame section.  This was fixed for binutils 2.21.
2729     gcc_cv_as_cfi_sections_directive=no
2730     if test "x$gcc_cv_objdump" != x; then
2731      if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \
2732         grep secrel > /dev/null; then
2733       gcc_cv_as_cfi_sections_directive=yes
2734      fi
2735     fi
2736     ;;
2737   *)
2738     gcc_cv_as_cfi_sections_directive=yes
2739     ;;
2740 esac])
2741 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_SECTIONS_DIRECTIVE)
2742 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
2743   [`if test $gcc_cv_as_cfi_sections_directive = yes;
2744     then echo 1; else echo 0; fi`],
2745   [Define 0/1 if your assembler supports .cfi_sections.])
2747 # GAS versions up to and including 2.11.0 may mis-optimize
2748 # .eh_frame data.
2749 gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
2750   [elf,2,12,0],,
2751 [       .text
2752 .LFB1:
2753         .4byte  0
2754 .L1:
2755         .4byte  0
2756 .LFE1:
2757         .section        .eh_frame,"aw",@progbits
2758 __FRAME_BEGIN__:
2759         .4byte  .LECIE1-.LSCIE1
2760 .LSCIE1:
2761         .4byte  0x0
2762         .byte   0x1
2763         .ascii "z\0"
2764         .byte   0x1
2765         .byte   0x78
2766         .byte   0x1a
2767         .byte   0x0
2768         .byte   0x4
2769         .4byte  1
2770         .p2align 1
2771 .LECIE1:
2772 .LSFDE1:
2773         .4byte  .LEFDE1-.LASFDE1
2774 .LASFDE1:
2775         .4byte  .LASFDE1-__FRAME_BEGIN__
2776         .4byte  .LFB1
2777         .4byte  .LFE1-.LFB1
2778         .byte   0x4
2779         .4byte  .LFE1-.LFB1
2780         .byte   0x4
2781         .4byte  .L1-.LFB1
2782 .LEFDE1:],
2783 [  dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
2784 cat > conftest.lit <<EOF
2785  0000 10000000 00000000 017a0001 781a0004  .........z..x...
2786  0010 01000000 12000000 18000000 00000000  ................
2787  0020 08000000 04080000 0044               .........D      @&t@
2789 cat > conftest.big <<EOF
2790  0000 00000010 00000000 017a0001 781a0004  .........z..x...
2791  0010 00000001 00000012 00000018 00000000  ................
2792  0020 00000008 04000000 0844               .........D      @&t@
2794   # If the assembler didn't choke, and we can objdump,
2795   # and we got the correct data, then succeed.
2796   # The text in the here-document typically retains its unix-style line
2797   # endings, while the output of objdump will use host line endings.
2798   # Therefore, use diff -b for the comparisons.
2799   if test x$gcc_cv_objdump != x \
2800   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
2801      | tail -3 > conftest.got \
2802   && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \
2803     || diff -b conftest.big conftest.got > /dev/null 2>&1; }
2804   then
2805     gcc_cv_as_eh_frame=yes
2806   elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
2807     gcc_cv_as_eh_frame=buggy
2808   else
2809     # Uh oh, what do we do now?
2810     gcc_cv_as_eh_frame=no
2811   fi])
2813 if test $gcc_cv_as_eh_frame = buggy; then
2814   AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
2815   [Define if your assembler mis-optimizes .eh_frame data.])
2818 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2819  [elf,2,12,0], [--fatal-warnings],
2820  [.section .rodata.str, "aMS", @progbits, 1])
2821 if test $gcc_cv_as_shf_merge = no; then
2822   gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2823     [elf,2,12,0], [--fatal-warnings],
2824     [.section .rodata.str, "aMS", %progbits, 1])
2826 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2827   [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2828 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
2830 gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)],
2831  gcc_cv_as_comdat_group,
2832  [elf,2,16,0], [--fatal-warnings],
2833  [.section .text,"axG",@progbits,.foo,comdat])
2834 if test $gcc_cv_as_comdat_group = yes; then
2835   gcc_cv_as_comdat_group_percent=no
2836   gcc_cv_as_comdat_group_group=no
2837 else
2838  gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)],
2839    gcc_cv_as_comdat_group_percent,
2840    [elf,2,16,0], [--fatal-warnings],
2841    [.section .text,"axG",%progbits,.foo,comdat])
2842  if test $gcc_cv_as_comdat_group_percent = yes; then
2843    gcc_cv_as_comdat_group_group=no
2844  else
2845    case "${target}" in
2846      # Sun as uses a completely different syntax.
2847      *-*-solaris2*)
2848        case "${target}" in
2849          sparc*-*-solaris2*)
2850            conftest_s='
2851                .group foo,".text%foo",#comdat
2852                .section ".text%foo", #alloc,#execinstr,#progbits
2853                .globl foo
2854              foo:
2855              '
2856            ;;
2857          i?86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
2858            conftest_s='
2859                .group foo,.text%foo,#comdat
2860                .section .text%foo, "ax", @progbits
2861                .globl  foo
2862              foo:
2863              '
2864            ;;
2865        esac
2866        gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)],
2867          gcc_cv_as_comdat_group_group,
2868          ,, [$conftest_s])
2869        ;;
2870    esac
2871    if test -z "${gcc_cv_as_comdat_group_group+set}"; then
2872      gcc_cv_as_comdat_group_group=no
2873    fi
2874  fi
2876 if test x"$ld_is_gold" = xyes; then
2877   comdat_group=yes
2878 elif test $in_tree_ld = yes ; then
2879   comdat_group=no
2880   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 \
2881      && test $in_tree_ld_is_elf = yes; then
2882      comdat_group=yes
2883   fi
2884 elif echo "$ld_ver" | grep GNU > /dev/null; then
2885   comdat_group=yes
2886   if test 0"$ld_date" -lt 20050308; then
2887     if test -n "$ld_date"; then
2888       # If there was date string, but was earlier than 2005-03-08, fail
2889       comdat_group=no
2890     elif test "$ld_vers_major" -lt 2; then
2891       comdat_group=no
2892     elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
2893       comdat_group=no
2894     fi
2895   fi
2896 else
2897 changequote(,)dnl
2898   case "${target}" in
2899     *-*-solaris2.1[1-9]*)
2900       comdat_group=no
2901       # Sun ld has COMDAT group support since Solaris 9, but it doesn't
2902       # interoperate with GNU as until Solaris 11 build 130, i.e. ld
2903       # version 1.688.
2904       #
2905       # If using Sun as for COMDAT group as emitted by GCC, one needs at
2906       # least ld version 1.2267.
2907       if test "$ld_vers_major" -gt 1; then
2908         comdat_group=yes
2909       elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
2910         comdat_group=yes
2911       elif test "$ld_vers_minor" -ge 2267; then
2912         comdat_group=yes
2913       fi
2914       ;;
2915     *)
2916       # Assume linkers other than GNU ld don't support COMDAT group.
2917       comdat_group=no
2918       ;;
2919   esac
2920 changequote([,])dnl
2922 # Allow overriding the automatic COMDAT group tests above.
2923 AC_ARG_ENABLE(comdat,
2924   [AS_HELP_STRING([--enable-comdat], [enable COMDAT group support])],
2925   [comdat_group="$enable_comdat"])
2926 if test $comdat_group = no; then
2927   gcc_cv_as_comdat_group=no
2928   gcc_cv_as_comdat_group_percent=no
2929   gcc_cv_as_comdat_group_group=no
2931 AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
2932   [`if test $gcc_cv_as_comdat_group = yes \
2933     || test $gcc_cv_as_comdat_group_percent = yes \
2934     || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`],
2935 [Define 0/1 if your assembler and linker support COMDAT groups.])
2937 gcc_GAS_CHECK_FEATURE([line table discriminator support],
2938  gcc_cv_as_discriminator,
2939  [2,19,51],,
2940 [       .text
2941         .file 1 "conf.c"
2942         .loc 1 1 0 discriminator 1],,
2943 [AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1,
2944   [Define if your assembler supports the .loc discriminator sub-directive.])])
2946 # Thread-local storage - the check is heavily parameterized.
2947 conftest_s=
2948 tls_first_major=
2949 tls_first_minor=
2950 tls_as_opt=
2951 case "$target" in
2952 changequote(,)dnl
2953   alpha*-*-*)
2954     conftest_s='
2955         .section ".tdata","awT",@progbits
2956 foo:    .long   25
2957         .text
2958         ldq     $27,__tls_get_addr($29)         !literal!1
2959         lda     $16,foo($29)                    !tlsgd!1
2960         jsr     $26,($27),__tls_get_addr        !lituse_tlsgd!1
2961         ldq     $27,__tls_get_addr($29)         !literal!2
2962         lda     $16,foo($29)                    !tlsldm!2
2963         jsr     $26,($27),__tls_get_addr        !lituse_tlsldm!2
2964         ldq     $1,foo($29)                     !gotdtprel
2965         ldah    $2,foo($29)                     !dtprelhi
2966         lda     $3,foo($2)                      !dtprello
2967         lda     $4,foo($29)                     !dtprel
2968         ldq     $1,foo($29)                     !gottprel
2969         ldah    $2,foo($29)                     !tprelhi
2970         lda     $3,foo($2)                      !tprello
2971         lda     $4,foo($29)                     !tprel'
2972         tls_first_major=2
2973         tls_first_minor=13
2974         tls_as_opt=--fatal-warnings
2975         ;;
2976   cris-*-*|crisv32-*-*)
2977     conftest_s='
2978         .section ".tdata","awT",@progbits
2979 x:      .long   25
2980         .text
2981         move.d x:IE,$r10
2982         nop'
2983         tls_first_major=2
2984         tls_first_minor=20
2985         tls_as_opt=--fatal-warnings
2986         ;;
2987   frv*-*-*)
2988     conftest_s='
2989         .section ".tdata","awT",@progbits
2990 x:      .long   25
2991         .text
2992         call    #gettlsoff(x)'
2993         tls_first_major=2
2994         tls_first_minor=14
2995         ;;
2996   hppa*-*-linux*)
2997     conftest_s='
2998 t1:     .reg    %r20
2999 t2:     .reg    %r21
3000 gp:     .reg    %r19
3001         .section ".tdata","awT",@progbits
3002 foo:    .long   25
3003         .text
3004         .align  4
3005         addil LT%foo-$tls_gdidx$,gp
3006         ldo RT%foo-$tls_gdidx$(%r1),%arg0
3007         b __tls_get_addr
3008         nop             
3009         addil LT%foo-$tls_ldidx$,gp
3010         b __tls_get_addr
3011         ldo RT%foo-$tls_ldidx$(%r1),%arg0
3012         addil LR%foo-$tls_dtpoff$,%ret0
3013         ldo RR%foo-$tls_dtpoff$(%r1),%t1
3014         mfctl %cr27,%t1                 
3015         addil LT%foo-$tls_ieoff$,gp
3016         ldw RT%foo-$tls_ieoff$(%r1),%t2
3017         add %t1,%t2,%t3                 
3018         mfctl %cr27,%t1                 
3019         addil LR%foo-$tls_leoff$,%t1
3020         ldo RR%foo-$tls_leoff$(%r1),%t2'
3021         tls_first_major=2
3022         tls_first_minor=15
3023         tls_as_opt=--fatal-warnings
3024         ;;
3025   arm*-*-*)
3026     conftest_s='
3027         .section ".tdata","awT",%progbits
3028 foo:    .long   25
3029         .text
3030 .word foo(gottpoff)
3031 .word foo(tpoff)
3032 .word foo(tlsgd)
3033 .word foo(tlsldm)
3034 .word foo(tlsldo)'
3035         tls_first_major=2
3036         tls_first_minor=17
3037         ;;
3038   i[34567]86-*-* | x86_64-*-*)
3039     case "$target" in
3040       i[34567]86-*-solaris2.* | x86_64-*-solaris2.1[0-9]*)
3041         on_solaris=yes
3042         ;;
3043       *)
3044         on_solaris=no
3045         ;;
3046     esac
3047     if test x$on_solaris = xyes && test x$gas_flag = xno; then
3048       conftest_s='
3049         .section .tdata,"awt",@progbits'
3050       tls_first_major=0
3051       tls_first_minor=0
3052       tls_section_flag=t
3053 changequote([,])dnl
3054       AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
3055 [Define to the flag used to mark TLS sections if the default (`T') doesn't work.])
3056 changequote(,)dnl
3057     else
3058       conftest_s='
3059         .section ".tdata","awT",@progbits'
3060       tls_first_major=2
3061       tls_first_minor=14
3062       tls_section_flag=T
3063       tls_as_opt="--fatal-warnings"
3064     fi
3065     case "$target" in
3066       i[34567]86-*-*)
3067         conftest_s="$conftest_s
3068 foo:    .long   25
3069         .text
3070         movl    %gs:0, %eax
3071         leal    foo@tlsgd(,%ebx,1), %eax
3072         leal    foo@tlsldm(%ebx), %eax
3073         leal    foo@dtpoff(%eax), %edx
3074         movl    foo@gottpoff(%ebx), %eax
3075         subl    foo@gottpoff(%ebx), %eax
3076         addl    foo@gotntpoff(%ebx), %eax
3077         movl    foo@indntpoff, %eax
3078         movl    \$foo@tpoff, %eax
3079         subl    \$foo@tpoff, %eax
3080         leal    foo@ntpoff(%ecx), %eax"
3081         ;;
3082       x86_64-*-*)
3083         if test x$on_solaris = xyes; then
3084           case $gas_flag in
3085             yes) tls_as_opt="$tls_as_opt --64" ;;
3086             no)  tls_as_opt="$tls_as_opt -xarch=amd64" ;;
3087           esac    
3088         fi
3089         conftest_s="$conftest_s
3090 foo:    .long   25
3091         .text
3092         movq    %fs:0, %rax
3093         leaq    foo@tlsgd(%rip), %rdi
3094         leaq    foo@tlsld(%rip), %rdi
3095         leaq    foo@dtpoff(%rax), %rdx
3096         movq    foo@gottpoff(%rip), %rax
3097         movq    \$foo@tpoff, %rax"
3098         ;;
3099     esac
3100     ;;
3101   ia64-*-*)
3102     conftest_s='
3103         .section ".tdata","awT",@progbits
3104 foo:    data8   25
3105         .text
3106         addl    r16 = @ltoff(@dtpmod(foo#)), gp
3107         addl    r17 = @ltoff(@dtprel(foo#)), gp
3108         addl    r18 = @ltoff(@tprel(foo#)), gp
3109         addl    r19 = @dtprel(foo#), gp
3110         adds    r21 = @dtprel(foo#), r13
3111         movl    r23 = @dtprel(foo#)
3112         addl    r20 = @tprel(foo#), gp
3113         adds    r22 = @tprel(foo#), r13
3114         movl    r24 = @tprel(foo#)'
3115         tls_first_major=2
3116         tls_first_minor=13
3117         tls_as_opt=--fatal-warnings
3118         ;;
3119   microblaze*-*-*)
3120     conftest_s='
3121         .section .tdata,"awT",@progbits
3123         .word 2
3124         .text
3125         addik r5,r20,x@TLSGD
3126         addik r5,r20,x@TLSLDM'
3127         tls_first_major=2
3128         tls_first_minor=20
3129         tls_as_opt='--fatal-warnings'
3130         ;;
3131   mips*-*-*)
3132     conftest_s='
3133         .section .tdata,"awT",@progbits
3135         .word 2
3136         .text
3137         addiu $4, $28, %tlsgd(x)
3138         addiu $4, $28, %tlsldm(x)
3139         lui $4, %dtprel_hi(x)
3140         addiu $4, $4, %dtprel_lo(x)
3141         lw $4, %gottprel(x)($28)
3142         lui $4, %tprel_hi(x)
3143         addiu $4, $4, %tprel_lo(x)'
3144         tls_first_major=2
3145         tls_first_minor=16
3146         tls_as_opt='-32 --fatal-warnings'
3147         ;;
3148   m68k-*-*)
3149     conftest_s='
3150         .section .tdata,"awT",@progbits
3152         .word 2
3153         .text
3154 foo:
3155         move.l x@TLSGD(%a5),%a0
3156         move.l x@TLSLDM(%a5),%a0
3157         move.l x@TLSLDO(%a5),%a0
3158         move.l x@TLSIE(%a5),%a0
3159         move.l x@TLSLE(%a5),%a0'
3160         tls_first_major=2
3161         tls_first_minor=19
3162         tls_as_opt='--fatal-warnings'
3163         ;;
3164   nios2-*-*)
3165       conftest_s='
3166         .section ".tdata","awT",@progbits'
3167         tls_first_major=2
3168         tls_first_minor=23
3169         tls_as_opt="--fatal-warnings"
3170         ;;
3171   aarch64*-*-*)
3172     conftest_s='
3173         .section ".tdata","awT",%progbits
3174 foo:    .long   25
3175         .text
3176         adrp  x0, :tlsgd:x
3177         add   x0, x0, #:tlsgd_lo12:x
3178         bl    __tls_get_addr
3179         nop'
3180         tls_first_major=2
3181         tls_first_minor=20
3182         tls_as_opt='--fatal-warnings'
3183         ;;
3184   powerpc-ibm-aix*)
3185     conftest_s='
3186         .extern __get_tpointer
3187         .toc
3188 LC..1:
3189         .tc a[TC],a[TL]@le
3190         .csect .text[PR]
3191 .tlstest:
3192         lwz 9,LC..1(2)
3193         bla __get_tpointer
3194         lwzx 3,9,3
3195         .globl a
3196         .csect a[TL],4
3198         .space 4'
3199         tls_first_major=0
3200         tls_first_minor=0
3201         ;;
3202   powerpc64*-*-*)
3203     conftest_s='
3204         .section ".tdata","awT",@progbits
3205         .align 3
3206 ld0:    .space 8
3207 ld1:    .space 8
3208 x1:     .space 8
3209 x2:     .space 8
3210 x3:     .space 8
3211         .text
3212         addi 3,2,ld0@got@tlsgd
3213         bl .__tls_get_addr
3214         nop
3215         addi 3,2,ld1@toc
3216         bl .__tls_get_addr
3217         nop
3218         addi 3,2,x1@got@tlsld
3219         bl .__tls_get_addr
3220         nop
3221         addi 9,3,x1@dtprel
3222         bl .__tls_get_addr
3223         nop
3224         addis 9,3,x2@dtprel@ha
3225         addi 9,9,x2@dtprel@l
3226         bl .__tls_get_addr
3227         nop
3228         ld 9,x3@got@dtprel(2)
3229         add 9,9,3
3230         bl .__tls_get_addr
3231         nop'
3232         tls_first_major=2
3233         tls_first_minor=14
3234         tls_as_opt="-a64 --fatal-warnings"
3235         ;;
3236   powerpc*-*-*)
3237     conftest_s='
3238         .section ".tdata","awT",@progbits
3239         .align 2
3240 ld0:    .space 4
3241 ld1:    .space 4
3242 x1:     .space 4
3243 x2:     .space 4
3244 x3:     .space 4
3245         .text
3246         addi 3,31,ld0@got@tlsgd
3247         bl __tls_get_addr
3248         addi 3,31,x1@got@tlsld
3249         bl __tls_get_addr
3250         addi 9,3,x1@dtprel
3251         addis 9,3,x2@dtprel@ha
3252         addi 9,9,x2@dtprel@l
3253         lwz 9,x3@got@tprel(31)
3254         add 9,9,x@tls
3255         addi 9,2,x1@tprel
3256         addis 9,2,x2@tprel@ha
3257         addi 9,9,x2@tprel@l'
3258         tls_first_major=2
3259         tls_first_minor=14
3260         tls_as_opt="-a32 --fatal-warnings"
3261         ;;
3262   s390-*-*)
3263     conftest_s='
3264         .section ".tdata","awT",@progbits
3265 foo:    .long   25
3266         .text
3267         .long   foo@TLSGD
3268         .long   foo@TLSLDM
3269         .long   foo@DTPOFF
3270         .long   foo@NTPOFF
3271         .long   foo@GOTNTPOFF
3272         .long   foo@INDNTPOFF
3273         l       %r1,foo@GOTNTPOFF(%r12)
3274         l       %r1,0(%r1):tls_load:foo
3275         bas     %r14,0(%r1,%r13):tls_gdcall:foo
3276         bas     %r14,0(%r1,%r13):tls_ldcall:foo'
3277         tls_first_major=2
3278         tls_first_minor=14
3279         tls_as_opt="-m31 --fatal-warnings"
3280         ;;
3281   s390x-*-*)
3282     conftest_s='
3283         .section ".tdata","awT",@progbits
3284 foo:    .long   25
3285         .text
3286         .quad   foo@TLSGD
3287         .quad   foo@TLSLDM
3288         .quad   foo@DTPOFF
3289         .quad   foo@NTPOFF
3290         .quad   foo@GOTNTPOFF
3291         lg      %r1,foo@GOTNTPOFF(%r12)
3292         larl    %r1,foo@INDNTPOFF
3293         brasl   %r14,__tls_get_offset@PLT:tls_gdcall:foo
3294         brasl   %r14,__tls_get_offset@PLT:tls_ldcall:foo'
3295         tls_first_major=2
3296         tls_first_minor=14
3297         tls_as_opt="-m64 -Aesame --fatal-warnings"
3298         ;;
3299   sh-*-* | sh[34]-*-*)
3300     conftest_s='
3301         .section ".tdata","awT",@progbits
3302 foo:    .long   25
3303         .text
3304         .long   foo@TLSGD
3305         .long   foo@TLSLDM
3306         .long   foo@DTPOFF
3307         .long   foo@GOTTPOFF
3308         .long   foo@TPOFF'
3309         tls_first_major=2
3310         tls_first_minor=13
3311         tls_as_opt=--fatal-warnings
3312         ;;
3313   sparc*-*-*)
3314     case "$target" in
3315       sparc*-sun-solaris2.*)
3316         on_solaris=yes
3317         ;;
3318       *)
3319         on_solaris=no
3320         ;;
3321     esac
3322     if test x$on_solaris = xyes && test x$gas_flag = xno; then
3323       conftest_s='
3324         .section ".tdata",#alloc,#write,#tls'
3325         tls_first_major=0
3326         tls_first_minor=0
3327     else
3328       conftest_s='
3329         .section ".tdata","awT",@progbits'
3330         tls_first_major=2
3331         tls_first_minor=14
3332         tls_as_opt="-32 --fatal-warnings"
3333     fi
3334     conftest_s="$conftest_s
3335 foo:    .long   25
3336         .text
3337         sethi   %tgd_hi22(foo), %o0
3338         add     %o0, %tgd_lo10(foo), %o1
3339         add     %l7, %o1, %o0, %tgd_add(foo)
3340         call    __tls_get_addr, %tgd_call(foo)
3341         sethi   %tldm_hi22(foo), %l1
3342         add     %l1, %tldm_lo10(foo), %l2
3343         add     %l7, %l2, %o0, %tldm_add(foo)
3344         call    __tls_get_addr, %tldm_call(foo)
3345         sethi   %tldo_hix22(foo), %l3
3346         xor     %l3, %tldo_lox10(foo), %l4
3347         add     %o0, %l4, %l5, %tldo_add(foo)
3348         sethi   %tie_hi22(foo), %o3
3349         add     %o3, %tie_lo10(foo), %o3
3350         ld      [%l7 + %o3], %o2, %tie_ld(foo)
3351         add     %g7, %o2, %o4, %tie_add(foo)
3352         sethi   %tle_hix22(foo), %l1
3353         xor     %l1, %tle_lox10(foo), %o5
3354         ld      [%g7 + %o5], %o1"
3355         ;;
3356   tilepro*-*-*)
3357       conftest_s='
3358         .section ".tdata","awT",@progbits
3359 foo:    .long   25
3360         .text
3361         addli   r0, zero, tls_gd(foo)
3362         auli    r0, zero, tls_gd_ha16(foo)
3363         addli   r0, r0, tls_gd_lo16(foo)
3364         jal     __tls_get_addr
3365         addli   r0, zero, tls_ie(foo)
3366         auli    r0, r0, tls_ie_ha16(foo)
3367         addli   r0, r0, tls_ie_lo16(foo)'
3368         tls_first_major=2
3369         tls_first_minor=22
3370         tls_as_opt="--fatal-warnings"
3371         ;;
3372   tilegx*-*-*)
3373       conftest_s='
3374         .section ".tdata","awT",@progbits
3375 foo:    .long   25
3376         .text
3377         shl16insli r0, zero, hw0_last_tls_gd(foo)
3378         shl16insli r0, zero, hw1_last_tls_gd(foo)
3379         shl16insli r0, r0,   hw0_tls_gd(foo)
3380         jal        __tls_get_addr
3381         shl16insli r0, zero, hw1_last_tls_ie(foo)
3382         shl16insli r0, r0,   hw0_tls_ie(foo)'
3383         tls_first_major=2
3384         tls_first_minor=22
3385         tls_as_opt="--fatal-warnings"
3386         ;;
3387   xtensa*-*-*)
3388     conftest_s='
3389         .section ".tdata","awT",@progbits
3390 foo:    .long   25
3391         .text
3392         movi    a8, foo@TLSFUNC
3393         movi    a10, foo@TLSARG
3394         callx8.tls a8, foo@TLSCALL'
3395         tls_first_major=2
3396         tls_first_minor=19
3397         ;;
3398 changequote([,])dnl
3399 esac
3400 set_have_as_tls=no
3401 if test "x$enable_tls" = xno ; then
3402   : # TLS explicitly disabled.
3403 elif test "x$enable_tls" = xyes ; then
3404   set_have_as_tls=yes # TLS explicitly enabled.
3405 elif test -z "$tls_first_major"; then
3406   : # If we don't have a check, assume no support.
3407 else
3408   gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
3409   [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
3410   [set_have_as_tls=yes])
3412 if test $set_have_as_tls = yes ; then
3413   AC_DEFINE(HAVE_AS_TLS, 1,
3414             [Define if your assembler and linker support thread-local storage.])
3417 # Target-specific assembler checks.
3419 AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
3420 gcc_cv_ld_static_dynamic=no
3421 gcc_cv_ld_static_option='-Bstatic'
3422 gcc_cv_ld_dynamic_option='-Bdynamic'
3423 if test $in_tree_ld = yes ; then
3424   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
3425     gcc_cv_ld_static_dynamic=yes
3426   fi
3427 elif test x$gcc_cv_ld != x; then
3428   # Check if linker supports -Bstatic/-Bdynamic option
3429   if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
3430      && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
3431       gcc_cv_ld_static_dynamic=yes
3432   else
3433     case "$target" in
3434       # AIX ld uses -b flags
3435       *-*-aix4.[[23]]* | *-*-aix[[5-9]]*)
3436         gcc_cv_ld_static_dynamic=yes
3437         gcc_cv_ld_static_option="-bstatic"
3438         gcc_cv_ld_dynamic_option="-bdynamic"
3439         ;;
3440       # HP-UX ld uses -a flags to select between shared and archive.
3441       *-*-hpux*)
3442         if test x"$gnu_ld" = xno; then
3443           gcc_cv_ld_static_dynamic=yes
3444           gcc_cv_ld_static_option="-aarchive_shared"
3445           gcc_cv_ld_dynamic_option="-adefault"
3446         fi
3447         ;;
3448       # Solaris 2 ld always supports -Bstatic/-Bdynamic.
3449       *-*-solaris2*)
3450         gcc_cv_ld_static_dynamic=yes
3451         ;;
3452     esac
3453   fi
3455 if test x"$gcc_cv_ld_static_dynamic" = xyes; then
3456         AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
3457 [Define if your linker supports -Bstatic/-Bdynamic or equivalent options.])
3458         AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option",
3459 [Define to the linker option to disable use of shared objects.])
3460         AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option",
3461 [Define to the linker option to enable use of shared objects.])
3463 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
3465 if test x"$demangler_in_ld" = xyes; then
3466   AC_MSG_CHECKING(linker --demangle support)
3467   gcc_cv_ld_demangle=no
3468   if test $in_tree_ld = yes; then
3469     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 \
3470       gcc_cv_ld_demangle=yes
3471     fi
3472   elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
3473     # Check if the GNU linker supports --demangle option
3474     if $gcc_cv_ld --help 2>/dev/null | grep no-demangle > /dev/null; then
3475       gcc_cv_ld_demangle=yes
3476     fi
3477   fi
3478   if test x"$gcc_cv_ld_demangle" = xyes; then
3479     AC_DEFINE(HAVE_LD_DEMANGLE, 1,
3480 [Define if your linker supports --demangle option.])
3481   fi
3482   AC_MSG_RESULT($gcc_cv_ld_demangle)
3485 AC_MSG_CHECKING(linker plugin support)
3486 gcc_cv_lto_plugin=0
3487 if test -f liblto_plugin.la; then
3488   save_ld_ver="$ld_ver"
3489   save_ld_vers_major="$ld_vers_major"
3490   save_ld_vers_minor="$ld_vers_minor"
3491   save_ld_is_gold="$ld_is_gold"
3493   ld_is_gold=no
3495   if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
3496     ld_ver="GNU ld"
3497     # FIXME: ld_is_gold?
3498     ld_vers_major="$gcc_cv_gld_major_version"
3499     ld_vers_minor="$gcc_cv_gld_minor_version"
3500   else
3501     # Determine plugin linker version.
3502     # FIXME: Partial duplicate from above, generalize.
3503 changequote(,)dnl
3504     ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q`
3505     if echo "$ld_ver" | grep GNU > /dev/null; then
3506       if echo "$ld_ver" | grep "GNU gold" > /dev/null; then
3507         ld_is_gold=yes
3508         ld_vers=`echo $ld_ver | sed -n \
3509             -e 's,^[^)]*[        ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
3510       else
3511         ld_vers=`echo $ld_ver | sed -n \
3512             -e 's,^.*[   ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
3513       fi
3514       ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
3515       ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
3516     fi
3517 changequote([,])dnl
3518   fi
3520   # Determine plugin support.
3521   if echo "$ld_ver" | grep GNU > /dev/null; then
3522     # Require GNU ld or gold 2.21+ for plugin support by default.
3523     if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then
3524       gcc_cv_lto_plugin=2
3525     # Allow -fuse-linker-plugin to enable plugin support in GNU gold 2.20.
3526     elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then
3527       gcc_cv_lto_plugin=1
3528     fi
3529   fi
3531   ld_ver="$save_ld_ver"
3532   ld_vers_major="$save_ld_vers_major"
3533   ld_vers_minor="$save_ld_vers_minor"
3534   ld_is_gold="$save_ld_is_gold"
3536 AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin,
3537   [Define to the level of your linker's plugin support.])
3538 AC_MSG_RESULT($gcc_cv_lto_plugin)
3540 case "$target" in
3541   aarch64*-*-*)
3542     gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,,
3543                           [-mabi=lp64], [.text],,,)
3544     if test x$gcc_cv_as_aarch64_mabi = xyes; then
3545       AC_DEFINE(HAVE_AS_MABI_OPTION, 1,
3546                 [Define if your assembler supports the -mabi option.])
3547     else
3548       if test x$with_abi = xilp32; then
3549         AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
3550                      Upgrade the Assembler.])
3551       fi
3552       if test x"$with_multilib_list" = xdefault; then
3553         TM_MULTILIB_CONFIG=lp64
3554       else
3555         aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
3556         for aarch64_multilib in ${aarch64_multilibs}; do
3557           case ${aarch64_multilib} in
3558             ilp32)
3559               AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
3560                             Upgrade the Assembler.])
3561               ;;
3562             *)
3563               ;;
3564           esac
3565         done
3566       fi
3567     fi
3568     # Check if we have binutils support for relocations types needed by -fpic
3569     gcc_GAS_CHECK_FEATURE([-fpic relocs], gcc_cv_as_aarch64_picreloc,,,
3570     [
3571         .text
3572         ldr     x0, [[x2, #:gotpage_lo15:globalsym]]
3573     ],,[AC_DEFINE(HAVE_AS_SMALL_PIC_RELOCS, 1,
3574         [Define if your assembler supports relocs needed by -fpic.])])
3575     # Enable default workaround for AArch64 Cortex-A53 erratum 835769.
3576     AC_ARG_ENABLE(fix-cortex-a53-835769,
3577     [
3578 AS_HELP_STRING([--enable-fix-cortex-a53-835769],
3579         [enable workaround for AArch64 Cortex-A53 erratum 835769 by default])
3580 AS_HELP_STRING([--disable-fix-cortex-a53-835769],
3581         [disable workaround for AArch64 Cortex-A53 erratum 835769 by default])
3582     ],
3583       [
3584         case $enableval in
3585           yes)
3586             tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1"
3587             ;;
3588           no)
3589             ;;
3590           *)
3591             AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\
3592   Valid choices are 'yes' and 'no'.])
3593             ;;
3595         esac
3596       ],
3597     [])
3598     # Enable default workaround for AArch64 Cortex-A53 erratum 843419.
3599     AC_ARG_ENABLE(fix-cortex-a53-843419,
3600     [
3601 AS_HELP_STRING([--enable-fix-cortex-a53-843419],
3602         [enable workaround for AArch64 Cortex-A53 erratum 843419 by default])
3603 AS_HELP_STRING([--disable-fix-cortex-a53-843419],
3604         [disable workaround for AArch64 Cortex-A53 erratum 843419 by default])
3605     ],
3606       [
3607         case $enableval in
3608           yes)
3609             tm_defines="${tm_defines} TARGET_FIX_ERR_A53_843419_DEFAULT=1"
3610             ;;
3611           no)
3612             ;;
3613           *)
3614             AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-843419.\
3615   Valid choices are 'yes' and 'no'.])
3616             ;;
3618         esac
3619       ],
3620     [])
3621     ;;
3623   # All TARGET_ABI_OSF targets.
3624   alpha*-*-linux* | alpha*-*-*bsd*)
3625     gcc_GAS_CHECK_FEATURE([explicit relocation support],
3626         gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
3627 [       .set nomacro
3628         .text
3629         extbl   $3, $2, $3      !lituse_bytoff!1
3630         ldq     $2, a($29)      !literal!1
3631         ldq     $4, b($29)      !literal!2
3632         ldq_u   $3, 0($2)       !lituse_base!1
3633         ldq     $27, f($29)     !literal!5
3634         jsr     $26, ($27), f   !lituse_jsr!5
3635         ldah    $29, 0($26)     !gpdisp!3
3636         lda     $0, c($29)      !gprel
3637         ldah    $1, d($29)      !gprelhigh
3638         lda     $1, d($1)       !gprellow
3639         lda     $29, 0($29)     !gpdisp!3],,
3640     [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
3641   [Define if your assembler supports explicit relocations.])])
3642     gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
3643         gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
3644 [       .set nomacro
3645         .text
3646         ldq     $27, a($29)     !literal!1
3647         jsr     $26, ($27), a   !lituse_jsrdirect!1],,
3648     [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
3649   [Define if your assembler supports the lituse_jsrdirect relocation.])])
3650     ;;
3652   avr-*-*)
3653     gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,,
3654       [--mlink-relax], [.text],,
3655       [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1,
3656                 [Define if your avr assembler supports --mlink-relax option.])])
3658     gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,,
3659       [-mrmw], [.text],,
3660       [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1,
3661                 [Define if your avr assembler supports -mrmw option.])])
3662     ;;
3664   cris-*-*)
3665     gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
3666       gcc_cv_as_cris_no_mul_bug,[2,15,91],
3667       [-no-mul-bug-abort], [.text],,
3668       [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
3669                 [Define if your assembler supports the -no-mul-bug-abort option.])])
3670     ;;
3672   sparc*-*-*)
3673     gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
3674       [.register %g2, #scratch],,
3675       [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
3676                 [Define if your assembler supports .register.])])
3678     gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,,
3679       [.section "nobits",#alloc,#write,#nobits
3680        .section "progbits",#alloc,#write,#progbits])
3681     AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS,
3682       [`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`],
3683       [Define to 1 if your assembler supports #nobits, 0 otherwise.])
3685     gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
3686       [-relax], [.text],,
3687       [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
3688                 [Define if your assembler supports -relax option.])])
3690     gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs],
3691       gcc_cv_as_sparc_gotdata_op,,
3692       [-K PIC],
3693 [.text
3694 .align 4
3695 foo:
3696         nop
3697 bar:
3698         sethi %gdop_hix22(foo), %g1
3699         xor    %g1, %gdop_lox10(foo), %g1
3700         ld    [[%l7 + %g1]], %g2, %gdop(foo)],
3701       [if test x$gcc_cv_ld != x \
3702        && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
3703          if test x$gcc_cv_objdump != x; then
3704            if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \
3705               | grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then
3706                gcc_cv_as_sparc_gotdata_op=no
3707            else
3708                gcc_cv_as_sparc_gotdata_op=yes
3709            fi
3710          fi
3711        fi
3712        rm -f conftest],
3713       [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1,
3714                 [Define if your assembler and linker support GOTDATA_OP relocs.])])
3716     gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
3717       gcc_cv_as_sparc_ua_pcrel,,
3718       [-K PIC],
3719 [.text
3720 foo:
3721         nop
3722 .data
3723 .align 4
3724 .byte 0
3725 .uaword %r_disp32(foo)],
3726       [if test x$gcc_cv_ld != x \
3727        && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
3728          gcc_cv_as_sparc_ua_pcrel=yes
3729        fi
3730        rm -f conftest],
3731       [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
3732                 [Define if your assembler and linker support unaligned PC relative relocs.])
3734       gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
3735         gcc_cv_as_sparc_ua_pcrel_hidden,,
3736         [-K PIC],
3737 [.data
3738 .align 4
3739 .byte 0x31
3740 .uaword %r_disp32(foo)
3741 .byte 0x32, 0x33, 0x34
3742 .global foo
3743 .hidden foo
3744 foo:
3745 .skip 4],
3746         [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
3747          && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
3748          && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
3749             | grep ' 31000000 07323334' > /dev/null 2>&1; then
3750             if $gcc_cv_objdump -R conftest 2> /dev/null \
3751                | grep 'DISP32' > /dev/null 2>&1; then
3752                 :
3753             else
3754                 gcc_cv_as_sparc_ua_pcrel_hidden=yes
3755             fi
3756          fi
3757          rm -f conftest],
3758          [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
3759                    [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
3760     ]) # unaligned pcrel relocs
3762     gcc_GAS_CHECK_FEATURE([offsetable %lo()],
3763       gcc_cv_as_sparc_offsetable_lo10,,
3764       [-xarch=v9],
3765 [.text
3766         or %g1, %lo(ab) + 12, %g1
3767         or %g1, %lo(ab + 12), %g1],
3768       [if test x$gcc_cv_objdump != x \
3769        && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
3770           | grep ' 82106000 82106000' > /dev/null 2>&1; then
3771          gcc_cv_as_sparc_offsetable_lo10=yes
3772        fi],
3773        [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
3774                  [Define if your assembler supports offsetable %lo().])])
3776     gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions],
3777       gcc_cv_as_sparc_fmaf,,
3778       [-xarch=v9d],
3779       [.text
3780        .register %g2, #scratch
3781        .register %g3, #scratch
3782        .align 4
3783        fmaddd %f0, %f2, %f4, %f6
3784        addxccc %g1, %g2, %g3
3785        fsrl32 %f2, %f4, %f8
3786        fnaddd %f10, %f12, %f14],,
3787       [AC_DEFINE(HAVE_AS_FMAF_HPC_VIS3, 1,
3788                 [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])])
3790     gcc_GAS_CHECK_FEATURE([SPARC4 instructions],
3791       gcc_cv_as_sparc_sparc4,,
3792       [-xarch=sparc4],
3793       [.text
3794        .register %g2, #scratch
3795        .register %g3, #scratch
3796        .align 4
3797        cxbe %g2, %g3, 1f
3798 1:     cwbneg %g2, %g3, 1f
3799 1:     sha1
3800        md5
3801        aes_kexpand0 %f4, %f6, %f8
3802        des_round %f38, %f40, %f42, %f44
3803        camellia_f %f54, %f56, %f58, %f60
3804        kasumi_fi_xor %f46, %f48, %f50, %f52],,
3805       [AC_DEFINE(HAVE_AS_SPARC4, 1,
3806                 [Define if your assembler supports SPARC4 instructions.])])
3808     gcc_GAS_CHECK_FEATURE([LEON instructions],
3809       gcc_cv_as_sparc_leon,,
3810       [-Aleon],
3811       [.text
3812        .register %g2, #scratch
3813        .register %g3, #scratch
3814        .align 4
3815        smac %g2, %g3, %g1
3816        umac %g2, %g3, %g1
3817        casa [[%g2]] 0xb, %g3, %g1],,
3818       [AC_DEFINE(HAVE_AS_LEON, 1,
3819                 [Define if your assembler supports LEON instructions.])])
3820     ;;
3822 changequote(,)dnl
3823   i[34567]86-*-* | x86_64-*-*)
3824 changequote([,])dnl
3825     case $target_os in
3826       cygwin*)
3827         # Full C++ conformance when using a shared libstdc++-v3 requires some
3828         # support from the Cygwin DLL, which in more recent versions exports
3829         # wrappers to aid in interposing and redirecting operators new, delete,
3830         # etc., as per n2800 #17.6.4.6 [replacement.functions].  Check if we
3831         # are configuring for a version of Cygwin that exports the wrappers.
3832         if test x$host = x$target && test x$host_cpu = xi686; then
3833           AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
3834         else
3835           # Can't check presence of libc functions during cross-compile, so
3836           # we just have to assume we're building for an up-to-date target.
3837           gcc_ac_cygwin_dll_wrappers=yes
3838         fi
3839         AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
3840           [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
3841           [Define if you want to generate code by default that assumes that the
3842            Cygwin DLL exports wrappers to support libstdc++ function replacement.])
3843     esac
3844     case $target_os in
3845       cygwin* | pe | mingw32* | interix*)
3846         # Recent binutils allows the three-operand form of ".comm" on PE.  This
3847         # definition is used unconditionally to initialise the default state of
3848         # the target option variable that governs usage of the feature.
3849         gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,
3850          [2,19,52],,[.comm foo,1,32])
3851         AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
3852           [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
3853           [Define if your assembler supports specifying the alignment
3854            of objects allocated using the GAS .comm command.])
3855         # Used for DWARF 2 in PE
3856         gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
3857           gcc_cv_as_ix86_pe_secrel32,
3858           [2,15,91],,
3859 [.text
3860 foo:    nop
3861 .data
3862         .secrel32 foo],
3863           [if test x$gcc_cv_ld != x \
3864            && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
3865              gcc_cv_as_ix86_pe_secrel32=yes
3866            fi
3867            rm -f conftest],
3868           [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
3869             [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
3870         # Test if the assembler supports the extended form of the .section
3871         # directive that specifies section alignment.  LTO support uses this,
3872         # but normally only after installation, so we warn but don't fail the
3873         # configure if LTO is enabled but the assembler does not support it.
3874         gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align,
3875           [2,20,1],-fatal-warnings,[.section lto_test,"dr0"])
3876         if test x$gcc_cv_as_section_has_align != xyes; then
3877           case ",$enable_languages," in
3878             *,lto,*)
3879               AC_MSG_WARN([LTO for $target requires binutils >= 2.20.1, but version found appears insufficient; LTO will not work until binutils is upgraded.])
3880               ;;
3881           esac
3882         fi
3883         ;;
3884     esac
3886     # Test if the assembler supports the section flag 'e' for specifying
3887     # an excluded section.
3888     gcc_GAS_CHECK_FEATURE([.section with e], gcc_cv_as_section_has_e,
3889       [2,22,51], [--fatal-warnings],
3890 [.section foo1,"e"
3891 .byte 0,0,0,0])
3892     AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
3893       [`if test $gcc_cv_as_section_has_e = yes; then echo 1; else echo 0; fi`],
3894       [Define if your assembler supports specifying the section flag e.])
3896     gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
3897        gcc_cv_as_ix86_filds,,,
3898        [filds (%ebp); fists (%ebp)],,
3899        [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
3900          [Define if your assembler uses filds and fists mnemonics.])])
3902     gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
3903        gcc_cv_as_ix86_fildq,,,
3904        [fildq (%ebp); fistpq (%ebp)],,
3905        [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
3906          [Define if your assembler uses fildq and fistq mnemonics.])])
3908     gcc_GAS_CHECK_FEATURE([cmov syntax],
3909       gcc_cv_as_ix86_cmov_sun_syntax,,,
3910       [cmovl.l %edx, %eax],,
3911       [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
3912         [Define if your assembler supports the Sun syntax for cmov.])])
3914     gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
3915       gcc_cv_as_ix86_ffreep,,,
3916       [ffreep %st(1)],,
3917       [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
3918         [Define if your assembler supports the ffreep mnemonic.])])
3920     gcc_GAS_CHECK_FEATURE([.quad directive],
3921       gcc_cv_as_ix86_quad,,,
3922       [.quad 0],,
3923       [AC_DEFINE(HAVE_AS_IX86_QUAD, 1,
3924         [Define if your assembler supports the .quad directive.])])
3926     gcc_GAS_CHECK_FEATURE([sahf mnemonic],
3927       gcc_cv_as_ix86_sahf,,,
3928       [.code64
3929        sahf],,
3930       [AC_DEFINE(HAVE_AS_IX86_SAHF, 1,
3931         [Define if your assembler supports the sahf mnemonic in 64bit mode.])])
3933     gcc_GAS_CHECK_FEATURE([interunit movq mnemonic],
3934       gcc_cv_as_ix86_interunit_movq,,,
3935       [.code64
3936        movq %mm0, %rax
3937        movq %rax, %xmm0])
3938     AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ,
3939       [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`],
3940       [Define if your assembler supports interunit movq mnemonic.])
3942     gcc_GAS_CHECK_FEATURE([hle prefixes],
3943       gcc_cv_as_ix86_hle,,,
3944       [lock xacquire cmpxchg %esi, (%ecx)],,
3945       [AC_DEFINE(HAVE_AS_IX86_HLE, 1,
3946         [Define if your assembler supports HLE prefixes.])])
3948     gcc_GAS_CHECK_FEATURE([swap suffix],
3949       gcc_cv_as_ix86_swap,,,
3950       [movl.s %esp, %ebp],,
3951       [AC_DEFINE(HAVE_AS_IX86_SWAP, 1,
3952         [Define if your assembler supports the swap suffix.])])
3954     gcc_GAS_CHECK_FEATURE([different section symbol subtraction],
3955       gcc_cv_as_ix86_diff_sect_delta,,,
3956       [.section .rodata
3957 .L1:
3958         .long .L2-.L1
3959         .long .L3-.L1
3960         .text
3961 .L3:    nop
3962 .L2:    nop],,
3963       [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1,
3964         [Define if your assembler supports the subtraction of symbols in different sections.])])
3966     # These two are used unconditionally by i386.[ch]; it is to be defined
3967     # to 1 if the feature is present, 0 otherwise.
3968     as_ix86_gotoff_in_data_opt=
3969     if test x$gas = xyes; then
3970       as_ix86_gotoff_in_data_opt="--32"
3971     fi
3972     gcc_GAS_CHECK_FEATURE([GOTOFF in data],
3973       gcc_cv_as_ix86_gotoff_in_data, [2,11,0],
3974       [$as_ix86_gotoff_in_data_opt],
3975 [       .text
3976 .L0:
3977         nop
3978         .data
3979         .long .L0@GOTOFF])
3980     AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
3981       [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
3982       [Define true if the assembler supports '.long foo@GOTOFF'.])
3984     gcc_GAS_CHECK_FEATURE([rep and lock prefix],
3985         gcc_cv_as_ix86_rep_lock_prefix,,,
3986         [rep movsl
3987          rep ret
3988          rep nop
3989          rep bsf %ecx, %eax
3990          rep bsr %ecx, %eax
3991          lock addl %edi, (%eax,%esi)
3992          lock orl $0, (%esp)],,
3993         [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1,
3994           [Define if the assembler supports 'rep <insn>, lock <insn>'.])])
3996     gcc_GAS_CHECK_FEATURE([ud2 mnemonic],
3997         gcc_cv_as_ix86_ud2,,,
3998         [ud2],,
3999       [AC_DEFINE(HAVE_AS_IX86_UD2, 1,
4000         [Define if your assembler supports the 'ud2' mnemonic.])])
4002     gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
4003         gcc_cv_as_ix86_tlsgdplt,,,
4004         [call    tls_gd@tlsgdplt],
4005         [if test x$gcc_cv_ld != x \
4006          && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
4007            gcc_cv_as_ix86_tlsgdplt=yes
4008          fi
4009          rm -f conftest],
4010       [AC_DEFINE(HAVE_AS_IX86_TLSGDPLT, 1,
4011         [Define if your assembler and linker support @tlsgdplt.])])
4013     conftest_s='
4014         .section .tdata,"aw'$tls_section_flag'",@progbits
4015 tls_ld:
4016         .section .text,"ax",@progbits
4017          call    tls_ld@tlsldmplt'
4018     gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc],
4019         gcc_cv_as_ix86_tlsldmplt,,,
4020         [$conftest_s],
4021         [if test x$gcc_cv_ld != x \
4022          && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
4023            gcc_cv_as_ix86_tlsldmplt=yes
4024          fi
4025          rm -f conftest])
4026     AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT,
4027       [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`],
4028       [Define to 1 if your assembler and linker support @tlsldmplt.])
4030     # Enforce 32-bit output with gas and gld.
4031     if test x$gas = xyes; then
4032       as_ix86_tls_ldm_opt="--32"
4033     fi
4034     if echo "$ld_ver" | grep GNU > /dev/null; then
4035       if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
4036         ld_ix86_tls_ldm_opt="-melf_i386_sol2"
4037       else
4038         ld_ix86_tls_ldm_opt="-melf_i386"
4039       fi
4040     fi
4041     conftest_s='
4042         .section .text,"ax",@progbits
4043         .globl  _start
4044         .type   _start, @function
4045 _start:      
4046         leal    value@tlsldm(%ebx), %eax
4047         call    ___tls_get_addr@plt
4049         .section .tdata,"aw'$tls_section_flag'",@progbits
4050         .type   value, @object
4051 value:'
4052     gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc],
4053         gcc_cv_as_ix86_tlsldm,,
4054         [$as_ix86_tls_ldm_opt],
4055         [$conftest_s],
4056         [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
4057             && $gcc_cv_ld $ld_ix86_tls_ldm_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then
4058            if $gcc_cv_objdump -d conftest 2>/dev/null | grep nop > /dev/null \
4059               || dis conftest 2>/dev/null | grep nop > /dev/null; then
4060              gcc_cv_as_ix86_tlsldm=yes
4061            fi
4062          fi
4063          rm -f conftest])
4064     AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDM,
4065       [`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`],
4066       [Define to 1 if your assembler and linker support @tlsldm.])
4068     ;;
4070   ia64*-*-*)
4071     gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
4072         gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
4073 [       .text
4074         addl r15 = @ltoffx(x#), gp
4075         ;;
4076         ld8.mov r16 = [[r15]], x#],,
4077     [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
4078           [Define if your assembler supports ltoffx and ldxmov relocations.])])
4080     ;;
4082   powerpc*-*-*)
4083     case $target in
4084       *-*-aix*) conftest_s='    .machine "pwr5"
4085         .csect .text[[PR]]
4086         mfcr 3,128';;
4087       *-*-darwin*)
4088         gcc_GAS_CHECK_FEATURE([.machine directive support],
4089           gcc_cv_as_machine_directive,,,
4090           [     .machine ppc7400])
4091         if test x$gcc_cv_as_machine_directive != xyes; then
4092           echo "*** This target requires an assembler supporting \".machine\"" >&2
4093           echo you can get it from: ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
4094           test x$build = x$target && exit 1
4095         fi
4096         conftest_s='    .text
4097         mfcr r3,128';;
4098       *) conftest_s='   .machine power4
4099         .text
4100         mfcr 3,128';;
4101     esac
4103     gcc_GAS_CHECK_FEATURE([mfcr field support],
4104       gcc_cv_as_powerpc_mfcrf, [2,14,0],,
4105       [$conftest_s],,
4106       [AC_DEFINE(HAVE_AS_MFCRF, 1,
4107           [Define if your assembler supports mfcr field.])])
4109     case $target in
4110       *-*-aix*) conftest_s='    .machine "pwr5"
4111         .csect .text[[PR]]
4112         popcntb 3,3';;
4113       *) conftest_s='   .machine power5
4114         .text
4115         popcntb 3,3';;
4116     esac
4118     gcc_GAS_CHECK_FEATURE([popcntb support],
4119       gcc_cv_as_powerpc_popcntb, [2,17,0],,
4120       [$conftest_s],,
4121       [AC_DEFINE(HAVE_AS_POPCNTB, 1,
4122           [Define if your assembler supports popcntb field.])])
4124     case $target in
4125       *-*-aix*) conftest_s='    .machine "pwr5x"
4126         .csect .text[[PR]]
4127         frin 1,1';;
4128       *) conftest_s='   .machine power5
4129         .text
4130         frin 1,1';;
4131     esac
4133     gcc_GAS_CHECK_FEATURE([fp round support],
4134       gcc_cv_as_powerpc_fprnd, [2,17,0],,
4135       [$conftest_s],,
4136       [AC_DEFINE(HAVE_AS_FPRND, 1,
4137           [Define if your assembler supports fprnd.])])
4139     case $target in
4140       *-*-aix*) conftest_s='    .machine "pwr6"
4141         .csect .text[[PR]]
4142         mffgpr 1,3';;
4143       *) conftest_s='   .machine power6
4144         .text
4145         mffgpr 1,3';;
4146     esac
4148     gcc_GAS_CHECK_FEATURE([move fp gpr support],
4149       gcc_cv_as_powerpc_mfpgpr, [2,19,2],,
4150       [$conftest_s],,
4151       [AC_DEFINE(HAVE_AS_MFPGPR, 1,
4152           [Define if your assembler supports mffgpr and mftgpr.])])
4154     case $target in
4155       *-*-aix*) conftest_s='    .csect .text[[PR]]
4156 LCF..0:
4157         addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
4158       *-*-darwin*)
4159         conftest_s='    .text
4160 LCF0:
4161         addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
4162       *) conftest_s='   .text
4163 .LCF0:
4164         addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
4165     esac
4167     gcc_GAS_CHECK_FEATURE([rel16 relocs],
4168       gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
4169       [$conftest_s],,
4170       [AC_DEFINE(HAVE_AS_REL16, 1,
4171           [Define if your assembler supports R_PPC_REL16 relocs.])])
4173     case $target in
4174       *-*-aix*) conftest_s='    .machine "pwr6"
4175         .csect .text[[PR]]
4176         cmpb 3,4,5';;
4177       *) conftest_s='   .machine power6
4178         .text
4179         cmpb 3,4,5';;
4180     esac
4182     gcc_GAS_CHECK_FEATURE([compare bytes support],
4183       gcc_cv_as_powerpc_cmpb, [2,19,2], -a32,
4184       [$conftest_s],,
4185       [AC_DEFINE(HAVE_AS_CMPB, 1,
4186           [Define if your assembler supports cmpb.])])
4188     case $target in
4189       *-*-aix*) conftest_s='    .machine "pwr6"
4190         .csect .text[[PR]]
4191         dadd 1,2,3';;
4192       *) conftest_s='   .machine power6
4193         .text
4194         dadd 1,2,3';;
4195     esac
4197     gcc_GAS_CHECK_FEATURE([decimal float support],
4198       gcc_cv_as_powerpc_dfp, [2,19,2], -a32,
4199       [$conftest_s],,
4200       [AC_DEFINE(HAVE_AS_DFP, 1,
4201           [Define if your assembler supports DFP instructions.])])
4203     case $target in
4204       *-*-aix*) conftest_s='    .machine "pwr7"
4205         .csect .text[[PR]]
4206         lxvd2x 1,2,3';;
4207       *) conftest_s='   .machine power7
4208         .text
4209         lxvd2x 1,2,3';;
4210     esac
4212     gcc_GAS_CHECK_FEATURE([vector-scalar support],
4213       gcc_cv_as_powerpc_vsx, [2,19,2], -a32,
4214       [$conftest_s],,
4215       [AC_DEFINE(HAVE_AS_VSX, 1,
4216           [Define if your assembler supports VSX instructions.])])
4218     case $target in
4219       *-*-aix*) conftest_s='    .machine "pwr7"
4220         .csect .text[[PR]]
4221         popcntd 3,3';;
4222       *) conftest_s='   .machine power7
4223         .text
4224         popcntd 3,3';;
4225     esac
4227     gcc_GAS_CHECK_FEATURE([popcntd support],
4228       gcc_cv_as_powerpc_popcntd, [2,19,2], -a32,
4229       [$conftest_s],,
4230       [AC_DEFINE(HAVE_AS_POPCNTD, 1,
4231           [Define if your assembler supports POPCNTD instructions.])])
4233     case $target in
4234       *-*-aix*) conftest_s='    .machine "pwr8"
4235         .csect .text[[PR]]';;
4236       *) conftest_s='   .machine power8
4237         .text';;
4238     esac
4240     gcc_GAS_CHECK_FEATURE([power8 support],
4241       gcc_cv_as_powerpc_power8, [2,19,2], -a32,
4242       [$conftest_s],,
4243       [AC_DEFINE(HAVE_AS_POWER8, 1,
4244           [Define if your assembler supports POWER8 instructions.])])
4246     case $target in
4247       *-*-aix*) conftest_s='    .csect .text[[PR]]
4248         lwsync';;
4249       *) conftest_s='   .text
4250         lwsync';;
4251     esac
4253     gcc_GAS_CHECK_FEATURE([lwsync support],
4254       gcc_cv_as_powerpc_lwsync, [2,19,2], -a32,
4255       [$conftest_s],,
4256       [AC_DEFINE(HAVE_AS_LWSYNC, 1,
4257           [Define if your assembler supports LWSYNC instructions.])])
4259     case $target in
4260       *-*-aix*) conftest_s='    .machine "476"
4261         .csect .text[[PR]]
4262         dci 0';;
4263       *) conftest_s='   .machine "476"
4264         .text
4265         dci 0';;
4266     esac
4268     gcc_GAS_CHECK_FEATURE([data cache invalidate support],
4269       gcc_cv_as_powerpc_dci, [9,99,0], -a32,
4270       [$conftest_s],,
4271       [AC_DEFINE(HAVE_AS_DCI, 1,
4272           [Define if your assembler supports the DCI/ICI instructions.])])
4274     gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
4275       gcc_cv_as_powerpc_gnu_attribute, [2,18,0],,
4276       [.gnu_attribute 4,1],,
4277       [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
4278           [Define if your assembler supports .gnu_attribute.])])
4280     gcc_GAS_CHECK_FEATURE([tls marker support],
4281       gcc_cv_as_powerpc_tls_markers, [2,20,0],,
4282       [ bl __tls_get_addr(x@tlsgd)],,
4283       [AC_DEFINE(HAVE_AS_TLS_MARKERS, 1,
4284           [Define if your assembler supports arg info for __tls_get_addr.])])
4286     case $target in
4287       *-*-aix*)
4288         gcc_GAS_CHECK_FEATURE([.ref support],
4289           gcc_cv_as_aix_ref, [2,21,0],,
4290           [     .csect stuff[[rw]]
4291              stuff:
4292                 .long 1
4293                 .extern sym
4294                 .ref sym
4295           ],,
4296           [AC_DEFINE(HAVE_AS_REF, 1,
4297             [Define if your assembler supports .ref])])
4298         ;;
4299     esac
4300     ;;
4302   mips*-*-*)
4303     gcc_GAS_CHECK_FEATURE([explicit relocation support],
4304       gcc_cv_as_mips_explicit_relocs, [2,14,0],,
4305 [       lw $4,%gp_rel(foo)($4)],,
4306       [if test x$target_cpu_default = x
4307        then target_cpu_default=MASK_EXPLICIT_RELOCS
4308        else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
4309        fi])
4310     gcc_GAS_CHECK_FEATURE([-mno-shared support],
4311       gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],,
4312       [AC_DEFINE(HAVE_AS_NO_SHARED, 1,
4313                  [Define if the assembler understands -mno-shared.])])
4315     gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
4316       gcc_cv_as_mips_gnu_attribute, [2,18,0],,
4317       [.gnu_attribute 4,1],,
4318       [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
4319           [Define if your assembler supports .gnu_attribute.])])
4321     gcc_GAS_CHECK_FEATURE([.module support],
4322       gcc_cv_as_mips_dot_module,,[-32],
4323       [.module mips2
4324        .module fp=xx],,
4325       [AC_DEFINE(HAVE_AS_DOT_MODULE, 1,
4326           [Define if your assembler supports .module.])])
4327     if test x$gcc_cv_as_mips_dot_module = xno \
4328        && test x$with_fp_32 != x; then
4329       AC_MSG_ERROR(
4330         [Requesting --with-fp-32= requires assembler support for .module.])
4331     fi
4333     gcc_GAS_CHECK_FEATURE([.micromips support],
4334       gcc_cv_as_micromips_support,,[--fatal-warnings],
4335       [.set micromips],,
4336       [AC_DEFINE(HAVE_GAS_MICROMIPS, 1,
4337           [Define if your assembler supports the .set micromips directive])])
4339     gcc_GAS_CHECK_FEATURE([.dtprelword support],
4340       gcc_cv_as_mips_dtprelword, [2,18,0],,
4341       [.section .tdata,"awT",@progbits
4343         .word 2
4344         .text
4345         .dtprelword x+0x8000],,
4346       [AC_DEFINE(HAVE_AS_DTPRELWORD, 1,
4347           [Define if your assembler supports .dtprelword.])])
4349     gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support],
4350       gcc_cv_as_mips_dspr1_mult,,,
4351 [       .set    mips32r2
4352         .set    nodspr2
4353         .set    dsp
4354         madd    $ac3,$4,$5
4355         maddu   $ac3,$4,$5
4356         msub    $ac3,$4,$5
4357         msubu   $ac3,$4,$5
4358         mult    $ac3,$4,$5
4359         multu   $ac3,$4,$5],,
4360       [AC_DEFINE(HAVE_AS_DSPR1_MULT, 1,
4361           [Define if your assembler supports DSPR1 mult.])])
4363     AC_MSG_CHECKING(assembler and linker for explicit JALR relocation)
4364     gcc_cv_as_ld_jalr_reloc=no
4365     if test $gcc_cv_as_mips_explicit_relocs = yes; then
4366       if test $in_tree_ld = yes ; then
4367         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 \
4368            && test $in_tree_ld_is_elf = yes; then
4369           gcc_cv_as_ld_jalr_reloc=yes
4370         fi
4371       elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then
4372         echo '  .ent x' > conftest.s
4373         echo 'x:        lw $2,%got_disp(y)($3)' >> conftest.s
4374         echo '  lw $25,%call16(y)($28)' >> conftest.s
4375         echo '  .reloc  1f,R_MIPS_JALR,y' >> conftest.s
4376         echo '1:        jalr $25' >> conftest.s
4377         echo '  .reloc  1f,R_MIPS_JALR,x' >> conftest.s
4378         echo '1:        jalr $25' >> conftest.s
4379         echo '  .end x' >> conftest.s
4380         if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \
4381            && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then
4382           if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null 2>&1 \
4383              && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null 2>&1; then
4384             gcc_cv_as_ld_jalr_reloc=yes
4385           fi
4386         fi
4387         rm -f conftest.*
4388       fi
4389     fi
4390     if test $gcc_cv_as_ld_jalr_reloc = yes; then
4391       if test x$target_cpu_default = x; then
4392         target_cpu_default=MASK_RELAX_PIC_CALLS
4393       else
4394         target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
4395       fi
4396     fi
4397     AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
4399     AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
4400       [gcc_cv_ld_mips_personality_relaxation],
4401       [gcc_cv_ld_mips_personality_relaxation=no
4402        if test $in_tree_ld = yes ; then
4403          if test "$gcc_cv_gld_major_version" -eq 2 \
4404                  -a "$gcc_cv_gld_minor_version" -ge 21 \
4405                  -o "$gcc_cv_gld_major_version" -gt 2; then
4406            gcc_cv_ld_mips_personality_relaxation=yes
4407          fi
4408        elif test x$gcc_cv_as != x \
4409                  -a x$gcc_cv_ld != x \
4410                  -a x$gcc_cv_readelf != x ; then
4411          cat > conftest.s <<EOF
4412         .cfi_startproc
4413         .cfi_personality 0x80,indirect_ptr
4414         .ent test
4415 test:
4416         nop
4417         .end test
4418         .cfi_endproc
4420         .section .data,"aw",@progbits
4421 indirect_ptr:
4422         .dc.a personality
4424          if $gcc_cv_as -KPIC -o conftest.o conftest.s > /dev/null 2>&1 \
4425             && $gcc_cv_ld -o conftest conftest.o -shared > /dev/null 2>&1; then
4426            if $gcc_cv_readelf -d conftest 2>&1 \
4427               | grep TEXTREL > /dev/null 2>&1; then
4428              :
4429            elif $gcc_cv_readelf --relocs conftest 2>&1 \
4430                 | grep 'R_MIPS_REL32 *$' > /dev/null 2>&1; then
4431              :
4432            else
4433              gcc_cv_ld_mips_personality_relaxation=yes
4434            fi
4435          fi
4436        fi
4437        rm -f conftest.s conftest.o conftest])
4438     if test x$gcc_cv_ld_mips_personality_relaxation = xyes; then
4439             AC_DEFINE(HAVE_LD_PERSONALITY_RELAXATION, 1,
4440       [Define if your linker can relax absolute .eh_frame personality
4441 pointers into PC-relative form.])
4442     fi
4444     gcc_GAS_CHECK_FEATURE([-mnan= support],
4445       gcc_cv_as_mips_nan,,
4446       [-mnan=2008],,,
4447       [AC_DEFINE(HAVE_AS_NAN, 1,
4448                  [Define if the assembler understands -mnan=.])])
4449     if test x$gcc_cv_as_mips_nan = xno \
4450        && test x$with_nan != x; then
4451       AC_MSG_ERROR(
4452         [Requesting --with-nan= requires assembler support for -mnan=])
4453     fi
4454     ;;
4455     s390*-*-*)
4456     gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
4457       gcc_cv_as_s390_gnu_attribute, [2,18,0],,
4458       [.gnu_attribute 8,1],,
4459       [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
4460           [Define if your assembler supports .gnu_attribute.])])
4461     ;;
4462 esac
4464 # Mips and HP-UX need the GNU assembler.
4465 # Linux on IA64 might be able to use the Intel assembler.
4467 case "$target" in
4468   mips*-*-* | *-*-hpux* )
4469     if test x$gas_flag = xyes \
4470        || test x"$host" != x"$build" \
4471        || test ! -x "$gcc_cv_as" \
4472        || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
4473       :
4474     else
4475       echo "*** This configuration requires the GNU assembler" >&2
4476       exit 1
4477     fi
4478     ;;
4479 esac
4481 # ??? Not all targets support dwarf2 debug_line, even within a version
4482 # of gas.  Moreover, we need to emit a valid instruction to trigger any
4483 # info to the output file.  So, as supported targets are added to gas 2.11,
4484 # add some instruction here to (also) show we expect this might work.
4485 # ??? Once 2.11 is released, probably need to add first known working
4486 # version to the per-target configury.
4487 case "$cpu_type" in
4488   aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \
4489   | mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \
4490   | visium | xstormy16 | xtensa)
4491     insn="nop"
4492     ;;
4493   ia64 | s390)
4494     insn="nop 0"
4495     ;;
4496   mmix)
4497     insn="swym 0"
4498     ;;
4499 esac
4500 if test x"$insn" != x; then
4501  conftest_s="\
4502         .file 1 \"conftest.s\"
4503         .loc 1 3 0
4504         $insn"
4505  gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
4506   gcc_cv_as_dwarf2_debug_line,
4507   [elf,2,11,0],, [$conftest_s],
4508   [if test x$gcc_cv_objdump != x \
4509    && $gcc_cv_objdump -h conftest.o 2> /dev/null \
4510       | grep debug_line > /dev/null 2>&1; then
4511      gcc_cv_as_dwarf2_debug_line=yes
4512    fi])
4514 # The .debug_line file table must be in the exact order that
4515 # we specified the files, since these indices are also used
4516 # by DW_AT_decl_file.  Approximate this test by testing if
4517 # the assembler bitches if the same index is assigned twice.
4518  gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
4519   gcc_cv_as_dwarf2_file_buggy,,,
4520 [       .file 1 "foo.s"
4521         .file 1 "bar.s"])
4523  if test $gcc_cv_as_dwarf2_debug_line = yes \
4524  && test $gcc_cv_as_dwarf2_file_buggy = no; then
4525         AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
4526   [Define if your assembler supports dwarf2 .file/.loc directives,
4527    and preserves file table indices exactly as given.])
4528  fi
4530  gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
4531   gcc_cv_as_gdwarf2_flag,
4532   [elf,2,11,0], [--gdwarf2], [$insn],,
4533   [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
4534 [Define if your assembler supports the --gdwarf2 option.])])
4536  gcc_GAS_CHECK_FEATURE([--gstabs option],
4537   gcc_cv_as_gstabs_flag,
4538   [elf,2,11,0], [--gstabs], [$insn],,
4539   [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
4540 [Define if your assembler supports the --gstabs option.])])
4542  gcc_GAS_CHECK_FEATURE([--debug-prefix-map option],
4543   gcc_cv_as_debug_prefix_map_flag,
4544   [2,18,0], [--debug-prefix-map /a=/b], [$insn],,
4545   [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1,
4546 [Define if your assembler supports the --debug-prefix-map option.])])
4549 gcc_GAS_CHECK_FEATURE([compressed debug sections],
4550   gcc_cv_as_compress_debug,,[--compress-debug-sections],,
4551   [# gas compiled without zlib cannot compress debug sections and warns
4552    # about it, but still exits successfully.  So check for this, too.
4553    if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null
4554    then
4555      gcc_cv_as_compress_debug=0
4556    elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1
4557    then
4558      gcc_cv_as_compress_debug=1
4559      gcc_cv_as_compress_debug_option="--compress-debug-sections"
4560      gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
4561    else
4562      gcc_cv_as_compress_debug=0
4563    # FIXME: Future gas versions will support ELF gABI style via
4564    # --compress-debug-sections[=type].
4565    fi])
4566 AC_DEFINE_UNQUOTED(HAVE_AS_COMPRESS_DEBUG, $gcc_cv_as_compress_debug,
4567 [Define to the level of your assembler's compressed debug section support.])
4568 AC_DEFINE_UNQUOTED(AS_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_compress_debug_option",
4569 [Define to the assembler option to enable compressed debug sections.])
4570 AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_option",
4571 [Define to the assembler option to disable compressed debug sections.])
4573 gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
4574  ,,
4575 [.lcomm bar,4,16],,
4576 [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
4577   [Define if your assembler supports .lcomm with an alignment field.])])
4579 if test x$with_sysroot = x && test x$host = x$target \
4580    && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
4581    && test "$prefix" != "NONE"; then
4582   AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
4583 [Define to PREFIX/include if cpp should also search that directory.])
4586 # Determine the version of glibc, if any, used on the target.
4587 AC_MSG_CHECKING([for target glibc version])
4588 AC_ARG_WITH([glibc-version],
4589   [AS_HELP_STRING([--with-glibc-version=M.N],
4590     [assume GCC used with glibc version M.N or later])], [
4591 if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then
4592   glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'`
4593   glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'`
4594 else
4595   AC_MSG_ERROR([option --with-glibc-version requires a version number M.N])
4596 fi], [
4597 glibc_version_major=0
4598 glibc_version_minor=0
4599 [if test -f $target_header_dir/features.h \
4600   && glibc_version_major_define=`$EGREP '^[     ]*#[    ]*define[       ]+__GLIBC__[    ]+[0-9]' $target_header_dir/features.h` \
4601   && glibc_version_minor_define=`$EGREP '^[     ]*#[    ]*define[       ]+__GLIBC_MINOR__[      ]+[0-9]' $target_header_dir/features.h`; then
4602   glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[      ]*//'`
4603   glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[        ]*//'`
4604 fi]])
4605 AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor])
4606 AC_DEFINE_UNQUOTED([TARGET_GLIBC_MAJOR], [$glibc_version_major],
4607 [GNU C Library major version number used on the target, or 0.])
4608 AC_DEFINE_UNQUOTED([TARGET_GLIBC_MINOR], [$glibc_version_minor],
4609 [GNU C Library minor version number used on the target, or 0.])
4611 AC_ARG_ENABLE(gnu-unique-object,
4612  [AS_HELP_STRING([--enable-gnu-unique-object],
4613    [enable the use of the @gnu_unique_object ELF extension on glibc systems])],
4614  [case $enable_gnu_unique_object in
4615     yes | no) ;;
4616     *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
4617 Valid choices are 'yes' and 'no'.]) ;;
4618   esac],
4619  [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
4620    [elf,2,19,52],,
4621    [.type foo, '$target_type_format_char'gnu_unique_object],,
4622 # We need to unquote above to to use the definition from config.gcc.
4623 # Also check for ld.so support, i.e. glibc 2.11 or higher.
4624    [GCC_GLIBC_VERSION_GTE_IFELSE([2], [11], [enable_gnu_unique_object=yes], )]
4625    )])
4626 if test x$enable_gnu_unique_object = xyes; then
4627   AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
4628    [Define if your assembler supports @gnu_unique_object.])
4631 AC_CACHE_CHECK([assembler for tolerance to line number 0],
4632  [gcc_cv_as_line_zero],
4633  [gcc_cv_as_line_zero=no
4634   if test $in_tree_gas = yes; then
4635     gcc_GAS_VERSION_GTE_IFELSE(2, 16, 91, [gcc_cv_as_line_zero=yes])
4636   elif test "x$gcc_cv_as" != x; then
4637     { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
4638     if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) &&
4639        test "x`cat conftest.out`" = x
4640     then
4641       gcc_cv_as_line_zero=yes
4642     else
4643       echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
4644       cat conftest.s >&AS_MESSAGE_LOG_FD
4645       echo "configure: error output was" >&AS_MESSAGE_LOG_FD
4646       cat conftest.out >&AS_MESSAGE_LOG_FD
4647     fi
4648     rm -f conftest.o conftest.s conftest.out
4649   fi])
4650 if test "x$gcc_cv_as_line_zero" = xyes; then
4651   AC_DEFINE([HAVE_AS_LINE_ZERO], 1,
4652 [Define if the assembler won't complain about a line such as # 0 "" 2.])
4655 AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
4656 gcc_cv_ld_eh_frame_hdr=no
4657 if test $in_tree_ld = yes ; then
4658   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 \
4659      && test $in_tree_ld_is_elf = yes; then
4660     gcc_cv_ld_eh_frame_hdr=yes
4661   fi
4662 elif test x$gcc_cv_ld != x; then
4663   if echo "$ld_ver" | grep GNU > /dev/null; then
4664     # Check if linker supports --eh-frame-hdr option
4665     if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
4666       gcc_cv_ld_eh_frame_hdr=yes
4667     fi
4668   else
4669     case "$target" in
4670       *-*-solaris2*)
4671         # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
4672         if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
4673           gcc_cv_ld_eh_frame_hdr=yes
4674         fi
4675         ;;
4676     esac
4677   fi
4679 GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
4680 if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
4681         AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
4682 [Define if your linker supports .eh_frame_hdr.])
4684 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
4686 AC_MSG_CHECKING(linker CIEv3 in .eh_frame support)
4687 gcc_cv_ld_eh_frame_ciev3=no
4688 if test $in_tree_ld = yes ; then
4689   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 \
4690      && test $in_tree_ld_is_elf = yes; then
4691     gcc_cv_ld_eh_frame_ciev3=yes
4692   fi
4693 elif test x$gcc_cv_ld != x; then
4694   if echo "$ld_ver" | grep GNU > /dev/null; then
4695     gcc_cv_ld_eh_frame_ciev3=yes
4696     if test 0"$ld_date" -lt 20040513; then
4697       if test -n "$ld_date"; then
4698         # If there was date string, but was earlier than 2004-05-13, fail
4699         gcc_cv_ld_eh_frame_ciev3=no
4700       elif test "$ld_vers_major" -lt 2; then
4701         gcc_cv_ld_eh_frame_ciev3=no
4702       elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
4703         gcc_cv_ld_eh_frame_ciev3=no
4704       fi
4705     fi
4706   else
4707     case "$target" in
4708       *-*-solaris2*)
4709         # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1.
4710         if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then
4711           gcc_cv_ld_eh_frame_ciev3=yes
4712         fi
4713         ;;
4714     esac
4715   fi
4717 AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3,
4718   [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`],
4719   [Define 0/1 if your linker supports CIE v3 in .eh_frame.])
4720 AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3)
4722 AC_MSG_CHECKING(linker position independent executable support)
4723 gcc_cv_ld_pie=no
4724 if test $in_tree_ld = yes ; then
4725   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 \
4726      && test $in_tree_ld_is_elf = yes; then
4727     gcc_cv_ld_pie=yes
4728   fi
4729 elif test x$gcc_cv_ld != x; then
4730         # Check if linker supports -pie option
4731         if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then
4732                 gcc_cv_ld_pie=yes
4733         fi
4735 if test x"$gcc_cv_ld_pie" = xyes; then
4736         AC_DEFINE(HAVE_LD_PIE, 1,
4737 [Define if your linker supports -pie option.])
4739 AC_MSG_RESULT($gcc_cv_ld_pie)
4741 AC_MSG_CHECKING(linker PIE support with copy reloc)
4742 gcc_cv_ld_pie_copyreloc=no
4743 if test $gcc_cv_ld_pie = yes ; then
4744   if test $in_tree_ld = yes ; then
4745     if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
4746       gcc_cv_ld_pie_copyreloc=yes
4747     fi
4748   elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
4749     # Check if linker supports -pie option with copy reloc
4750     case "$target" in
4751     i?86-*-linux* | x86_64-*-linux*)
4752       cat > conftest1.s <<EOF
4753         .globl  a_glob
4754         .data
4755         .type   a_glob, @object
4756         .size   a_glob, 4
4757 a_glob:
4758         .long   2
4760       cat > conftest2.s <<EOF
4761         .text
4762         .globl  main
4763         .type   main, @function
4764 main:
4765         movl    %eax, a_glob(%rip)
4766         .size   main, .-main
4767         .globl  ptr
4768         .section        .data.rel,"aw",@progbits
4769         .type   ptr, @object
4770 ptr:
4771         .quad   a_glob
4773       if $gcc_cv_as --64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
4774          && $gcc_cv_ld -shared -melf_x86_64 -o conftest1.so conftest1.o > /dev/null 2>&1 \
4775          && $gcc_cv_as --64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
4776          && $gcc_cv_ld -pie -melf_x86_64 -o conftest conftest2.o conftest1.so > /dev/null 2>&1; then
4777         gcc_cv_ld_pie_copyreloc=yes
4778       fi
4779       rm -f conftest conftest1.so conftest1.o conftest2.o conftest1.s conftest2.s
4780       ;;
4781     esac
4782   fi
4784 AC_DEFINE_UNQUOTED(HAVE_LD_PIE_COPYRELOC,
4785   [`if test x"$gcc_cv_ld_pie_copyreloc" = xyes; then echo 1; else echo 0; fi`],
4786   [Define 0/1 if your linker supports -pie option with copy reloc.])
4787 AC_MSG_RESULT($gcc_cv_ld_pie_copyreloc)
4789 AC_MSG_CHECKING(linker EH-compatible garbage collection of sections)
4790 gcc_cv_ld_eh_gc_sections=no
4791 if test $in_tree_ld = yes ; then
4792   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 \
4793      && test $in_tree_ld_is_elf = yes; then
4794     gcc_cv_ld_eh_gc_sections=yes
4795   fi
4796 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
4797   cat > conftest.s <<EOF
4798         .section        .text
4799 .globl _start
4800         .type _start, @function
4801 _start:
4802         .long foo
4803         .size _start, .-_start
4804         .section        .text.foo,"ax",@progbits
4805         .type foo, @function
4806 foo:
4807         .long 0
4808         .size foo, .-foo
4809         .section        .gcc_except_table.foo,"a",@progbits
4810 .L0:
4811         .long 0
4812         .section        .eh_frame,"a",@progbits
4813         .long .L0
4815   if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
4816     if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
4817          | grep "gc-sections option ignored" > /dev/null; then
4818       gcc_cv_ld_eh_gc_sections=no
4819     elif $gcc_cv_objdump -h conftest 2> /dev/null \
4820          | grep gcc_except_table > /dev/null; then
4821       gcc_cv_ld_eh_gc_sections=yes
4822       # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
4823       if test x$gcc_cv_as_comdat_group != xyes; then
4824         gcc_cv_ld_eh_gc_sections=no
4825         cat > conftest.s <<EOF
4826         .section        .text
4827 .globl _start
4828         .type _start, @function
4829 _start:
4830         .long foo
4831         .size _start, .-_start
4832         .section        .gnu.linkonce.t.foo,"ax",@progbits
4833         .type foo, @function
4834 foo:
4835         .long 0
4836         .size foo, .-foo
4837         .section        .gcc_except_table.foo,"a",@progbits
4838 .L0:
4839         .long 0
4840         .section        .eh_frame,"a",@progbits
4841         .long .L0
4843         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
4844           if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
4845                | grep "gc-sections option ignored" > /dev/null; then
4846             gcc_cv_ld_eh_gc_sections=no
4847           elif $gcc_cv_objdump -h conftest 2> /dev/null \
4848                | grep gcc_except_table > /dev/null; then
4849             gcc_cv_ld_eh_gc_sections=yes
4850           fi
4851         fi
4852       fi
4853     fi
4854   fi
4855   rm -f conftest.s conftest.o conftest
4857 case "$target" in
4858   hppa*-*-linux*)
4859     # ??? This apparently exposes a binutils bug with PC-relative relocations.
4860     gcc_cv_ld_eh_gc_sections=no
4861     ;;
4862 esac
4863 if test x$gcc_cv_ld_eh_gc_sections = xyes; then
4864         AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1,
4865   [Define if your linker supports garbage collection of
4866    sections in presence of EH frames.])
4868 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections)
4870 AC_MSG_CHECKING(linker EH garbage collection of sections bug)
4871 gcc_cv_ld_eh_gc_sections_bug=no
4872 if test $in_tree_ld = yes ; then
4873   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 \
4874      && test $in_tree_ld_is_elf = yes; then
4875     gcc_cv_ld_eh_gc_sections_bug=yes
4876   fi
4877 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
4878   gcc_cv_ld_eh_gc_sections_bug=yes
4879   cat > conftest.s <<EOF
4880         .section        .text
4881 .globl _start
4882         .type _start, @function
4883 _start:
4884         .long foo
4885         .size _start, .-_start
4886         .section        .text.startup.foo,"ax",@progbits
4887         .type foo, @function
4888 foo:
4889         .long 0
4890         .size foo, .-foo
4891         .section        .gcc_except_table.foo,"a",@progbits
4892 .L0:
4893         .long 0
4894         .section        .eh_frame,"a",@progbits
4895         .long .L0
4897   if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
4898     if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
4899          | grep "gc-sections option ignored" > /dev/null; then
4900       :
4901     elif $gcc_cv_objdump -h conftest 2> /dev/null \
4902          | grep gcc_except_table > /dev/null; then
4903       gcc_cv_ld_eh_gc_sections_bug=no
4904     fi
4905   fi
4906   rm -f conftest.s conftest.o conftest
4908 if test x$gcc_cv_ld_eh_gc_sections_bug = xyes; then
4909         AC_DEFINE(HAVE_LD_EH_GC_SECTIONS_BUG, 1,
4910   [Define if your linker has buggy garbage collection of
4911    sections support when .text.startup.foo like sections are used.])
4913 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug)
4915 AC_MSG_CHECKING(linker for compressed debug sections)
4916 # gold/gld support compressed debug sections since binutils 2.19/2.21
4917 if test $in_tree_ld = yes ; then
4918   gcc_cv_ld_compress_debug=0
4919   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 \
4920      && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then
4921     gcc_cv_ld_compress_debug=2
4922     gcc_cv_ld_compress_debug_option="--compress-debug-sections"
4923   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 \
4924      && test $in_tree_ld_is_elf = yes; then
4925     gcc_cv_ld_compress_debug=1
4926   fi
4927 elif echo "$ld_ver" | grep GNU > /dev/null; then
4928   gcc_cv_ld_compress_debug=1
4929   if test 0"$ld_date" -lt 20050308; then
4930     if test -n "$ld_date"; then
4931       # If there was date string, but was earlier than 2005-03-08, fail
4932       gcc_cv_ld_compress_debug=0
4933     elif test "$ld_vers_major" -lt 2; then
4934       gcc_cv_ld_compress_debug=0
4935     elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then
4936       gcc_cv_ld_compress_debug=0
4937     fi
4938   fi
4939   if test $ld_is_gold = yes; then
4940     gcc_cv_ld_compress_debug=2
4941     gcc_cv_ld_compress_debug_option="--compress-debug-sections"
4942   fi
4943 else
4944 changequote(,)dnl
4945   case "${target}" in
4946     *-*-solaris2*)
4947       # Introduced in Solaris 11.2.
4948       if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then
4949         gcc_cv_ld_compress_debug=3
4950         gcc_cv_ld_compress_debug_option="-z compress-sections"
4951       else
4952         gcc_cv_ld_compress_debug=0
4953       fi
4954       ;;
4955     *)
4956       # Assume linkers other than GNU ld don't support compessed debug
4957       # sections.
4958       gcc_cv_ld_compress_debug=0
4959       ;;
4960   esac
4961 changequote([,])dnl
4963 AC_DEFINE_UNQUOTED(HAVE_LD_COMPRESS_DEBUG, $gcc_cv_ld_compress_debug,
4964 [Define to the level of your linker's compressed debug section support.])
4965 AC_DEFINE_UNQUOTED(LD_COMPRESS_DEBUG_OPTION, "$gcc_cv_ld_compress_debug_option",
4966 [Define to the linker option to enable compressed debug sections.])
4967 AC_MSG_RESULT($gcc_cv_ld_compress_debug)
4969 # --------
4970 # UNSORTED
4971 # --------
4973 AC_CACHE_CHECK(linker --as-needed support,
4974 gcc_cv_ld_as_needed,
4975 [gcc_cv_ld_as_needed=no
4976 gcc_cv_ld_as_needed_option='--as-needed'
4977 gcc_cv_ld_no_as_needed_option='--no-as-needed'
4978 if test $in_tree_ld = yes ; then
4979   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 \
4980      && test $in_tree_ld_is_elf = yes; then
4981     gcc_cv_ld_as_needed=yes
4982   fi
4983 elif test x$gcc_cv_ld != x; then
4984         # Check if linker supports --as-needed and --no-as-needed options
4985         if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
4986                 gcc_cv_ld_as_needed=yes
4987         else
4988           case "$target" in
4989             # Solaris 2 ld always supports -z ignore/-z record.
4990             *-*-solaris2*)
4991               gcc_cv_ld_as_needed=yes
4992               gcc_cv_ld_as_needed_option="-z ignore"
4993               gcc_cv_ld_no_as_needed_option="-z record"
4994               ;;
4995           esac
4996         fi
4998 # --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
4999 # dl_iterate_phdr, i.e. since Solaris 11.
5000 case "$target" in
5001   *-*-solaris2.1[[1-9]]*)
5002     case "$target" in
5003     i?86-*-* | x86_64-*-*)
5004       if echo "$ld_ver" | grep GNU > /dev/null; then
5005         # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
5006         gcc_cv_ld_as_needed=no
5007       fi
5008       ;;
5009     esac
5010     ;;
5011   *-*-solaris2*)
5012     gcc_cv_ld_as_needed=no
5013     ;;
5014 esac
5016 if test x"$gcc_cv_ld_as_needed" = xyes; then
5017         AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
5018 [Define if your linker supports --as-needed/--no-as-needed or equivalent options.])
5019         AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option",
5020 [Define to the linker option to ignore unused dependencies.])
5021         AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option",
5022 [Define to the linker option to keep unused dependencies.])
5025 AC_MSG_CHECKING(linker mapfile support for clearing hardware capabilities)
5026 saved_LDFLAGS="$LDFLAGS"
5027 for clearcap_map in sol2-clearcapv2.map sol2-clearcap.map; do
5028   LDFLAGS="$saved_LDFLAGS -Wl,-M,${srcdir}/config/$clearcap_map"
5029   AC_LINK_IFELSE([int main(void) {return 0;}],
5030     [gcc_cv_ld_clearcap=yes; break], [gcc_cv_ld_clearcap=no])
5031 done
5032 LDFLAGS="$saved_LDFLAGS"
5033 if test "x$gcc_cv_ld_clearcap" = xyes; then
5034   AC_DEFINE([HAVE_LD_CLEARCAP], 1,
5035 [Define if the linker supports clearing hardware capabilities via mapfile.])
5036   AC_CONFIG_LINKS([clearcap.map:${srcdir}/config/$clearcap_map])
5038 AC_MSG_RESULT($gcc_cv_ld_clearcap)
5040 case "$target:$tm_file" in
5041   powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
5042   case "$target" in
5043      *le-*-linux*)
5044      emul_name="-melf64lppc"
5045       ;;
5046      *-*-linux*)
5047      emul_name="-melf64ppc"
5048       ;;
5049      *-*-freebsd*)
5050      emul_name="-melf64ppc_fbsd"
5051       ;;
5052   esac
5053     AC_CACHE_CHECK(linker support for omitting dot symbols,
5054     gcc_cv_ld_no_dot_syms,
5055     [gcc_cv_ld_no_dot_syms=no
5056     if test x"$ld_is_gold" = xyes; then
5057       gcc_cv_ld_no_dot_syms=yes
5058     elif test $in_tree_ld = yes ; then
5059       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
5060         gcc_cv_ld_no_dot_syms=yes
5061       fi
5062     elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
5063       cat > conftest1.s <<EOF
5064         .text
5065         bl .foo
5067       cat > conftest2.s <<EOF
5068         .section ".opd","aw"
5069         .align 3
5070         .globl foo
5071         .type foo,@function
5072 foo:
5073         .quad .LEfoo,.TOC.@tocbase,0
5074         .text
5075 .LEfoo:
5076         blr
5077         .size foo,.-.LEfoo
5079       if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
5080          && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
5081          && $gcc_cv_ld $emul_name -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
5082         gcc_cv_ld_no_dot_syms=yes
5083       fi
5084       rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
5085     fi
5086     ])
5087     if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
5088       AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
5089     [Define if your PowerPC64 linker only needs function descriptor syms.])
5090     fi
5092     AC_CACHE_CHECK(linker large toc support,
5093     gcc_cv_ld_large_toc,
5094     [gcc_cv_ld_large_toc=no
5095     if test x"$ld_is_gold" = xyes; then
5096       gcc_cv_ld_large_toc=yes
5097     elif test $in_tree_ld = yes ; then
5098       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
5099         gcc_cv_ld_large_toc=yes
5100       fi
5101     elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
5102       cat > conftest.s <<EOF
5103         .section ".tbss","awT",@nobits
5104         .align 3
5105 ie0:    .space 8
5106         .global _start
5107         .text
5108 _start:
5109         addis 9,13,ie0@got@tprel@ha
5110         ld 9,ie0@got@tprel@l(9)
5112       if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
5113          && $gcc_cv_ld $emul_name --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then
5114         gcc_cv_ld_large_toc=yes
5115       fi
5116       rm -f conftest conftest.o conftest.s
5117     fi
5118     ])
5119     if test x"$gcc_cv_ld_large_toc" = xyes; then
5120       AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
5121     [Define if your PowerPC64 linker supports a large TOC.])
5122     fi
5124     AC_CACHE_CHECK(linker toc pointer alignment,
5125     gcc_cv_ld_toc_align,
5126     [if test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_nm != x; then
5127       cat > conftest.s <<EOF
5128         .global _start
5129         .text
5130 _start:
5131         addis 9,2,x@got@ha
5132         .section .data.rel.ro,"aw",@progbits
5133         .p2align 16
5134         .space 32768
5135 x:      .quad .TOC.
5137       if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
5138          && $gcc_cv_ld $emul_name -o conftest conftest.o > /dev/null 2>&1; then
5139         gcc_cv_ld_toc_align=`$gcc_cv_nm conftest | ${AWK} '/\.TOC\./ { match ($0, "0[[[:xdigit:]]]*", a); print strtonum ("0x" substr(a[[0]], length(a[[0]])-3)) }'`
5140       fi
5141       rm -f conftest conftest.o conftest.s
5142     fi
5143     ])
5144     if test -n "$gcc_cv_ld_toc_align" && test $gcc_cv_ld_toc_align -gt 8; then
5145       AC_DEFINE_UNQUOTED(POWERPC64_TOC_POINTER_ALIGNMENT, $gcc_cv_ld_toc_align,
5146     [Define to .TOC. alignment forced by your linker.])
5147     fi
5148     ;;
5149 esac
5151 case "$target" in
5152   *-*-aix*)
5153     AC_CACHE_CHECK(linker large toc support,
5154     gcc_cv_ld_large_toc,
5155     [gcc_cv_ld_large_toc=no
5156     if test x$gcc_cv_as != x ; then
5157       cat > conftest.s <<EOF
5158         .toc
5159 LC..1:
5160         .tc a[[TC]],a[[RW]]
5161         .extern a[[RW]]
5162         .csect .text[[PR]]
5163 .largetoctest:
5164         addis 9,LC..1@u(2)
5165         ld 3,LC..1@l(9)
5167       if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then
5168         gcc_cv_ld_large_toc=yes
5169       fi
5170       rm -f conftest conftest.o conftest.s
5171     fi
5172     ])
5173     if test x"$gcc_cv_ld_large_toc" = xyes; then
5174       AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
5175     [Define if your PowerPC64 linker supports a large TOC.])
5176     fi
5177     ;;
5178 esac
5180 AC_CACHE_CHECK(linker --build-id support,
5181   gcc_cv_ld_buildid,
5182   [gcc_cv_ld_buildid=no
5183   if test $in_tree_ld = yes ; then
5184     if test "$gcc_cv_gld_major_version" -eq 2 -a \
5185        "$gcc_cv_gld_minor_version" -ge 18 -o \
5186        "$gcc_cv_gld_major_version" -gt 2 \
5187        && test $in_tree_ld_is_elf = yes; then
5188       gcc_cv_ld_buildid=yes
5189     fi
5190   elif test x$gcc_cv_ld != x; then
5191     if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
5192       gcc_cv_ld_buildid=yes
5193     fi
5194   fi])
5195 if test x"$gcc_cv_ld_buildid" = xyes; then
5196   AC_DEFINE(HAVE_LD_BUILDID, 1,
5197   [Define if your linker supports --build-id.])
5200 AC_ARG_ENABLE(linker-build-id,
5201 [AS_HELP_STRING([--enable-linker-build-id],
5202                 [compiler will always pass --build-id to linker])],
5204 enable_linker_build_id=no)
5206 if test x"$enable_linker_build_id" = xyes; then
5207   if test x"$gcc_cv_ld_buildid" = xyes; then
5208     AC_DEFINE(ENABLE_LD_BUILDID, 1,
5209     [Define if gcc should always pass --build-id to linker.])
5210   else
5211     AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
5212   fi
5215 # In binutils 2.21, GNU ld gained support for new emulations fully
5216 # supporting the Solaris 2 ABI.  Detect their presence in the linker used.
5217 AC_CACHE_CHECK(linker *_sol2 emulation support,
5218   gcc_cv_ld_sol2_emulation,
5219   [gcc_cv_ld_sol2_emulation=no
5220   if test $in_tree_ld = yes ; then
5221     if test "$gcc_cv_gld_major_version" -eq 2 -a \
5222        "$gcc_cv_gld_minor_version" -ge 21 -o \
5223        "$gcc_cv_gld_major_version" -gt 2 \
5224        && test $in_tree_ld_is_elf = yes; then
5225       gcc_cv_ld_sol2_emulation=yes
5226     fi
5227   elif test x$gcc_cv_ld != x; then
5228     if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \
5229        grep _sol2 > /dev/null; then
5230       gcc_cv_ld_sol2_emulation=yes
5231     fi
5232   fi])
5233 if test x"$gcc_cv_ld_sol2_emulation" = xyes; then
5234   AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1,
5235   [Define if your linker supports the *_sol2 emulations.])
5238 AC_CACHE_CHECK(linker --sysroot support,
5239   gcc_cv_ld_sysroot,
5240   [gcc_cv_ld_sysroot=no
5241   if test $in_tree_ld = yes ; then
5242       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
5243         gcc_cv_ld_sysroot=yes
5244       fi
5245   elif test x$gcc_cv_ld != x; then 
5246     if $gcc_cv_ld --help 2>/dev/null | grep sysroot > /dev/null; then
5247       gcc_cv_ld_sysroot=yes
5248     fi
5249   fi])
5250 if test x"$gcc_cv_ld_sysroot" = xyes; then
5251   AC_DEFINE(HAVE_LD_SYSROOT, 1,
5252   [Define if your linker supports --sysroot.])
5253 fi        
5255 # Test for stack protector support in target C library.
5256 AC_CACHE_CHECK(__stack_chk_fail in target C library,
5257       gcc_cv_libc_provides_ssp,
5258       [gcc_cv_libc_provides_ssp=no
5259     case "$target" in
5260        *-*-musl*)
5261          # All versions of musl provide stack protector
5262          gcc_cv_libc_provides_ssp=yes;;
5263        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
5264       # glibc 2.4 and later provides __stack_chk_fail and
5265       # either __stack_chk_guard, or TLS access to stack guard canary.
5266       GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_libc_provides_ssp=yes], [
5267       [if test -f $target_header_dir/features.h \
5268          && $EGREP '^[  ]*#[    ]*define[       ]+__GNU_LIBRARY__[      ]+([1-9][0-9]|[6-9])' \
5269             $target_header_dir/features.h > /dev/null; then
5270         if $EGREP '^[   ]*#[    ]*define[       ]+__UCLIBC__[   ]+1' \
5271              $target_header_dir/features.h > /dev/null && \
5272              test -f $target_header_dir/bits/uClibc_config.h && \
5273              $EGREP '^[         ]*#[    ]*define[       ]+__UCLIBC_HAS_SSP__[   ]+1' \
5274              $target_header_dir/bits/uClibc_config.h > /dev/null; then
5275           gcc_cv_libc_provides_ssp=yes
5276         fi
5277       # all versions of Bionic support stack protector
5278       elif test -f $target_header_dir/sys/cdefs.h \
5279         && $EGREP '^[  ]*#[    ]*define[       ]+__BIONIC__[   ]+1' \
5280            $target_header_dir/sys/cdefs.h > /dev/null; then
5281          gcc_cv_libc_provides_ssp=yes
5282       fi]])
5283         ;;
5284        *-*-gnu*)
5285          # Avoid complicated tests (see
5286          # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
5287          # simply assert that glibc does provide this, which is true for all
5288          # realistically usable GNU/Hurd configurations.
5289          # All supported versions of musl provide it as well
5290          gcc_cv_libc_provides_ssp=yes;;
5291        *-*-darwin* | *-*-freebsd*)
5292          AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
5293            [echo "no __stack_chk_fail on this target"])
5294         ;;
5295   *) gcc_cv_libc_provides_ssp=no ;;
5296     esac])
5298 if test x$gcc_cv_libc_provides_ssp = xyes; then
5299   AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
5300             [Define if your target C library provides stack protector support])
5303 # Test for <sys/sdt.h> on the target.
5304 GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
5305 AC_MSG_CHECKING(sys/sdt.h in the target C library)
5306 have_sys_sdt_h=no
5307 if test -f $target_header_dir/sys/sdt.h; then
5308   have_sys_sdt_h=yes
5309   AC_DEFINE(HAVE_SYS_SDT_H, 1,
5310             [Define if your target C library provides sys/sdt.h])
5312 AC_MSG_RESULT($have_sys_sdt_h)
5314 # Check if TFmode long double should be used by default or not.
5315 # Some glibc targets used DFmode long double, but with glibc 2.4
5316 # and later they can use TFmode.
5317 case "$target" in
5318   powerpc*-*-linux* | \
5319   sparc*-*-linux* | \
5320   s390*-*-linux* | \
5321   alpha*-*-linux*)
5322     AC_ARG_WITH(long-double-128,
5323       [AS_HELP_STRING([--with-long-double-128],
5324                       [use 128-bit long double by default])],
5325       gcc_cv_target_ldbl128="$with_long_double_128",
5326       [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
5327       [gcc_cv_target_ldbl128=no
5328       grep '^[  ]*#[    ]*define[       ][      ]*__LONG_DOUBLE_MATH_OPTIONAL' \
5329         $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
5330       && gcc_cv_target_ldbl128=yes
5331       ]])])
5332     ;;
5333 esac
5334 if test x$gcc_cv_target_ldbl128 = xyes; then
5335   AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
5336             [Define if TFmode long double should be the default])
5339 AC_MSG_CHECKING(dl_iterate_phdr in target C library)
5340 gcc_cv_target_dl_iterate_phdr=unknown
5341 case "$target" in
5342   # Restrict to Solaris 11+.  While most of the Solaris 11 linker changes
5343   # were backported to Solaris 10 Update 10, dl_iterate_phdr only lives in
5344   # libdl there, both complicating its use and breaking compatibility
5345   # between Solaris 10 updates.
5346   *-*-solaris2.1[[1-9]]*)
5347     # <link.h> needs both a dl_iterate_phdr declaration and support for
5348     # compilation with largefile support.
5349     if grep dl_iterate_phdr $target_header_dir/link.h > /dev/null 2>&1 \
5350       && grep 'large file capable' $target_header_dir/link.h > /dev/null 2>&1; then
5351       gcc_cv_target_dl_iterate_phdr=yes
5352     else
5353       gcc_cv_target_dl_iterate_phdr=no
5354     fi
5355     ;;
5356   *-*-dragonfly* | *-*-freebsd*)
5357     if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
5358       gcc_cv_target_dl_iterate_phdr=yes
5359     else
5360       gcc_cv_target_dl_iterate_phdr=no
5361     fi
5362     ;;
5363   *-linux-musl*)
5364     gcc_cv_target_dl_iterate_phdr=yes
5365     ;;
5366 esac
5367 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
5368 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
5369    AC_DEFINE(TARGET_DL_ITERATE_PHDR, 1,
5370 [Define if your target C library provides the `dl_iterate_phdr' function.])
5372 AC_MSG_RESULT($gcc_cv_target_dl_iterate_phdr)
5374 # We no longer support different GC mechanisms.  Emit an error if
5375 # the user configures with --with-gc.
5376 AC_ARG_WITH(gc,
5377 [AS_HELP_STRING([--with-gc={page,zone}],
5378                 [this option is not supported anymore.  It used to choose
5379                  the garbage collection mechanism to use with the compiler])],
5380 [AC_MSG_ERROR([Configure option --with-gc is only supported up to GCC 4.7.x])],
5383 # Libraries to use on the host.  This will normally be set by the top
5384 # level Makefile.  Here we simply capture the value for our Makefile.
5385 if test -z "${HOST_LIBS+set}"; then
5386   HOST_LIBS=
5388 AC_SUBST(HOST_LIBS)
5390 # Use the system's zlib library.
5391 AM_ZLIB
5393 dnl Very limited version of automake's enable-maintainer-mode
5395 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
5396   dnl maintainer-mode is disabled by default
5397   AC_ARG_ENABLE(maintainer-mode,
5398 [AS_HELP_STRING([--enable-maintainer-mode],
5399                 [enable make rules and dependencies not useful
5400                  (and sometimes confusing) to the casual installer])],
5401       maintainer_mode=$enableval,
5402       maintainer_mode=no)
5404 AC_MSG_RESULT($maintainer_mode)
5406 if test "$maintainer_mode" = "yes"; then
5407   MAINT=''
5408 else
5409   MAINT='#'
5411 AC_SUBST(MAINT)dnl
5413 dnl Whether to prevent multiple front-ends from linking at the same time
5415 AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once])
5416   AC_ARG_ENABLE(link-mutex,
5417 [AS_HELP_STRING([--enable-link-mutex],
5418                 [avoid linking multiple front-ends at once to avoid thrashing
5419                  on the build machine])],
5420       do_link_mutex=$enableval,
5421       do_link_mutex=no)
5422 AC_MSG_RESULT($do_link_mutex)
5424 if test "$do_link_mutex" = "yes"; then
5425    DO_LINK_MUTEX=true
5426 else
5427    DO_LINK_MUTEX=false
5429 AC_SUBST(DO_LINK_MUTEX)
5431 # --------------
5432 # Language hooks
5433 # --------------
5435 # Make empty files to contain the specs and options for each language.
5436 # Then add #include lines to for a compiler that has specs and/or options.
5438 subdirs=
5439 lang_opt_files=
5440 lang_specs_files=
5441 lang_tree_files=
5442 # These (without "all_") are set in each config-lang.in.
5443 # `language' must be a single word so is spelled singularly.
5444 all_languages=
5445 all_compilers=
5446 all_outputs='Makefile'
5447 # List of language makefile fragments.
5448 all_lang_makefrags=
5449 # Additional files for gengtype
5450 all_gtfiles="$target_gtfiles"
5452 # These are the languages that are set in --enable-languages,
5453 # and are available in the GCC tree.
5454 all_selected_languages=
5456 # Add the language fragments.
5457 # Languages are added via two mechanisms.  Some information must be
5458 # recorded in makefile variables, these are defined in config-lang.in.
5459 # We accumulate them and plug them into the main Makefile.
5460 # The other mechanism is a set of hooks for each of the main targets
5461 # like `clean', `install', etc.
5463 language_hooks="Make-hooks"
5465 for lang in ${srcdir}/*/config-lang.in
5467 changequote(,)dnl
5468         test "$lang" = "${srcdir}/*/config-lang.in" && continue
5470         lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^   ]*\).*$,\1,p' $lang`
5471         if test "x$lang_alias" = x
5472         then
5473               echo "$lang doesn't set \$language." 1>&2
5474               exit 1
5475         fi
5476         subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
5477         subdirs="$subdirs $subdir"
5479         # $gcc_subdir is where the gcc integration files are to be found
5480         # for a language, both for internal compiler purposes (compiler
5481         # sources implementing front-end to GCC tree converters), and for
5482         # build infrastructure purposes (Make-lang.in, etc.)
5483         #
5484         # This will be <subdir> (relative to $srcdir) if a line like 
5485         # gcc_subdir="<subdir>" or gcc_subdir=<subdir>
5486         # is found in <langdir>/config-lang.in, and will remain <langdir>
5487         # otherwise.
5488         #
5489         # Except for the language alias (fetched above), the regular
5490         # "config-lang.in" contents are always retrieved from $gcc_subdir,
5491         # so a <langdir>/config-lang.in setting gcc_subdir typically sets
5492         # only this and the language alias.
5494         gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^   ]*\).*$,\1,p' $lang`
5495         if [ "$gcc_subdir" = "" ]; then
5496            gcc_subdir="$subdir"
5497         fi
5499         case ",$enable_languages," in
5500         *,$lang_alias,*)
5501             all_selected_languages="$all_selected_languages $lang_alias"
5502             if test -f $srcdir/$gcc_subdir/lang-specs.h; then
5503                 lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h"
5504             fi
5505             ;;
5506         esac
5507 changequote([,])dnl
5509         language=
5510         boot_language=
5511         compilers=
5512         outputs=
5513         gtfiles=
5514         subdir_requires=
5515         . ${srcdir}/$gcc_subdir/config-lang.in
5516         if test "x$language" = x
5517         then
5518                 echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2
5519                 exit 1
5520         fi
5522         ok=:
5523         case ",$enable_languages," in
5524                 *,$lang_alias,*) ;;
5525                 *)
5526                         for i in $subdir_requires; do
5527                                 test -f "${srcdir}/$i/config-lang.in" && continue
5528                                 ok=false
5529                                 break
5530                         done
5531                 ;;
5532         esac
5533         $ok || continue
5535         all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in"
5536         if test -f $srcdir/$gcc_subdir/lang.opt; then
5537             lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
5538             all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt"
5539         fi
5540         if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then
5541             lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def"
5542         fi
5543         all_languages="$all_languages $language"
5544         all_compilers="$all_compilers $compilers"
5545         all_outputs="$all_outputs $outputs"
5546         all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles"
5547         case ",$enable_languages," in
5548                 *,lto,*)
5549                     AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.])
5550                     enable_lto=yes
5551                     AC_SUBST(enable_lto)
5552                     ;;
5553                 *) ;;
5554         esac
5555 done
5557 check_languages=
5558 for language in $all_selected_languages
5560         check_languages="$check_languages check-$language"
5561 done
5563 # We link each language in with a set of hooks, reached indirectly via
5564 # lang.${target}.  Only do so for selected languages.
5566 rm -f Make-hooks
5567 touch Make-hooks
5568 target_list="all.cross start.encap rest.encap tags \
5569         install-common install-man install-info install-pdf install-html dvi \
5570         pdf html uninstall info man srcextra srcman srcinfo \
5571         mostlyclean clean distclean maintainer-clean install-plugin"
5573 for t in $target_list
5575         x=
5576         for lang in $all_selected_languages
5577         do
5578                 x="$x $lang.$t"
5579         done
5580         echo "lang.$t: $x" >> Make-hooks
5581 done
5583 # --------
5584 # Option include files
5585 # --------
5587 ${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk
5588 option_includes="option-includes.mk"
5589 AC_SUBST_FILE(option_includes)
5591 # --------
5592 # UNSORTED
5593 # --------
5595 # Create .gdbinit.
5597 echo "dir ." > .gdbinit
5598 echo "dir ${srcdir}" >> .gdbinit
5599 if test x$gdb_needs_out_file_path = xyes
5600 then
5601         echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
5603 if test "x$subdirs" != x; then
5604         for s in $subdirs
5605         do
5606                 echo "dir ${srcdir}/$s" >> .gdbinit
5607         done
5609 echo "source ${srcdir}/gdbinit.in" >> .gdbinit
5610 echo "python import sys; sys.path.append('${srcdir}'); import gdbhooks" >> .gdbinit
5612 # Put a breakpoint on __asan_report_error to help with debugging buffer
5613 # overflow.
5614 case "$CFLAGS" in
5615 *-fsanitize=address*)
5616   echo "source ${srcdir}/gdbasan.in" >> .gdbinit
5617   ;;
5618 esac
5620 gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
5621 AC_SUBST(gcc_tooldir)
5622 AC_SUBST(dollar)
5624 # Find a directory in which to install a shared libgcc.
5626 AC_ARG_ENABLE(version-specific-runtime-libs,
5627 [AS_HELP_STRING([--enable-version-specific-runtime-libs],
5628                 [specify that runtime libraries should be
5629                  installed in a compiler-specific directory])])
5631 # Substitute configuration variables
5632 AC_SUBST(subdirs)
5633 AC_SUBST(srcdir)
5634 AC_SUBST(all_compilers)
5635 AC_SUBST(all_gtfiles)
5636 AC_SUBST(all_lang_makefrags)
5637 AC_SUBST(all_languages)
5638 AC_SUBST(all_selected_languages)
5639 AC_SUBST(build_exeext)
5640 AC_SUBST(build_install_headers_dir)
5641 AC_SUBST(build_xm_file_list)
5642 AC_SUBST(build_xm_include_list)
5643 AC_SUBST(build_xm_defines)
5644 AC_SUBST(build_file_translate)
5645 AC_SUBST(check_languages)
5646 AC_SUBST(cpp_install_dir)
5647 AC_SUBST(xmake_file)
5648 AC_SUBST(tmake_file)
5649 AC_SUBST(TM_ENDIAN_CONFIG)
5650 AC_SUBST(TM_MULTILIB_CONFIG)
5651 AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
5652 AC_SUBST(extra_gcc_objs)
5653 AC_SUBST(user_headers_inc_next_pre)
5654 AC_SUBST(user_headers_inc_next_post)
5655 AC_SUBST(extra_headers_list)
5656 AC_SUBST(extra_objs)
5657 AC_SUBST(extra_programs)
5658 AC_SUBST(float_h_file)
5659 AC_SUBST(gcc_config_arguments)
5660 AC_SUBST(gcc_gxx_include_dir)
5661 AC_SUBST(gcc_gxx_include_dir_add_sysroot)
5662 AC_SUBST(host_exeext)
5663 AC_SUBST(host_xm_file_list)
5664 AC_SUBST(host_xm_include_list)
5665 AC_SUBST(host_xm_defines)
5666 AC_SUBST(out_host_hook_obj)
5667 AC_SUBST(install)
5668 AC_SUBST(lang_opt_files)
5669 AC_SUBST(lang_specs_files)
5670 AC_SUBST(lang_tree_files)
5671 AC_SUBST(local_prefix)
5672 AC_SUBST(md_file)
5673 AC_SUBST(objc_boehm_gc)
5674 AC_SUBST(out_file)
5675 AC_SUBST(out_object_file)
5676 AC_SUBST(common_out_file)
5677 AC_SUBST(common_out_object_file)
5678 AC_SUBST(tm_file_list)
5679 AC_SUBST(tm_include_list)
5680 AC_SUBST(tm_defines)
5681 AC_SUBST(tm_p_file_list)
5682 AC_SUBST(tm_p_include_list)
5683 AC_SUBST(xm_file_list)
5684 AC_SUBST(xm_include_list)
5685 AC_SUBST(xm_defines)
5686 AC_SUBST(use_gcc_stdint)
5687 AC_SUBST(c_target_objs)
5688 AC_SUBST(cxx_target_objs)
5689 AC_SUBST(fortran_target_objs)
5690 AC_SUBST(target_cpu_default)
5692 AC_SUBST_FILE(language_hooks)
5694 # Echo link setup.
5695 if test x${build} = x${host} ; then
5696   if test x${host} = x${target} ; then
5697     echo "Links are now set up to build a native compiler for ${target}." 1>&2
5698   else
5699     echo "Links are now set up to build a cross-compiler" 1>&2
5700     echo " from ${host} to ${target}." 1>&2
5701   fi
5702 else
5703   if test x${host} = x${target} ; then
5704     echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
5705     echo " for ${target}." 1>&2
5706   else
5707     echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
5708     echo " from ${host} to ${target}." 1>&2
5709   fi
5712 AC_ARG_VAR(GMPLIBS,[How to link GMP])
5713 AC_ARG_VAR(GMPINC,[How to find GMP include files])
5715 AC_ARG_VAR(ISLLIBS,[How to link ISL])
5716 AC_ARG_VAR(ISLINC,[How to find ISL include files])
5717 if test "x${ISLLIBS}" != "x" ; then 
5718    AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
5721 # Check whether isl_schedule_constraints_compute_schedule is available;
5722 # it's new in ISL-0.13.
5723 # Check whether isl_options_set_schedule_serialize_sccs is available;
5724 # it's new in ISL-0.15.
5725 if test "x${ISLLIBS}" != "x" ; then
5726   saved_CXXFLAGS="$CXXFLAGS"
5727   CXXFLAGS="$CXXFLAGS $ISLINC"
5728   saved_LIBS="$LIBS"
5729   LIBS="$LIBS $ISLLIBS $GMPLIBS"
5731   AC_MSG_CHECKING([Checking for isl_schedule_constraints_compute_schedule])
5732   AC_TRY_LINK([#include <isl/schedule.h>],
5733               [isl_schedule_constraints_compute_schedule (NULL);],
5734               [ac_has_isl_schedule_constraints_compute_schedule=yes],
5735               [ac_has_isl_schedule_constraints_compute_schedule=no])
5736   AC_MSG_RESULT($ac_has_isl_schedule_constraints_compute_schedule)
5738   AC_MSG_CHECKING([Checking for isl_options_set_schedule_serialize_sccs])
5739   AC_TRY_LINK([#include <isl/schedule.h>],
5740               [isl_options_set_schedule_serialize_sccs (NULL, 0);],
5741               [ac_has_isl_options_set_schedule_serialize_sccs=yes],
5742               [ac_has_isl_options_set_schedule_serialize_sccs=no])
5743   AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs)
5745   LIBS="$saved_LIBS"
5746   CXXFLAGS="$saved_CXXFLAGS"
5748   if test x"$ac_has_isl_schedule_constraints_compute_schedule" = x"yes"; then
5749      AC_DEFINE(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE, 1,
5750                [Define if isl_schedule_constraints_compute_schedule exists.])
5751   fi
5753   if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
5754      AC_DEFINE(HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS, 1,
5755                [Define if isl_options_set_schedule_serialize_sccs exists.])
5756   fi
5759 GCC_ENABLE_PLUGINS
5760 AC_SUBST(pluginlibs)
5761 AC_SUBST(enable_plugin)
5762 if test x"$enable_plugin" = x"yes"; then
5763   AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
5767 # Enable --enable-host-shared
5768 AC_ARG_ENABLE(host-shared,
5769 [AS_HELP_STRING([--enable-host-shared],
5770                 [build host code as shared libraries])],
5771 [PICFLAG=-fPIC], [PICFLAG=])
5772 AC_SUBST(enable_host_shared)
5773 AC_SUBST(PICFLAG)
5776 AC_ARG_ENABLE(libquadmath-support,
5777 [AS_HELP_STRING([--disable-libquadmath-support],
5778   [disable libquadmath support for Fortran])],
5779 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
5780 ENABLE_LIBQUADMATH_SUPPORT=yes)
5781 if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then
5782   AC_DEFINE(ENABLE_LIBQUADMATH_SUPPORT, 1,
5783             [Define to 1 to enable libquadmath support])
5787 # Specify what hash style to use by default.
5788 AC_ARG_WITH([linker-hash-style],
5789 [AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
5790                 [specify the linker hash style])],
5791 [case x"$withval" in
5792    xsysv)
5793      LINKER_HASH_STYLE=sysv
5794      ;;
5795    xgnu)
5796      LINKER_HASH_STYLE=gnu
5797      ;;
5798    xboth)
5799      LINKER_HASH_STYLE=both
5800      ;;
5801    *)
5802      AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style])
5803      ;;
5804  esac],
5805 [LINKER_HASH_STYLE=''])
5806 if test x"${LINKER_HASH_STYLE}" != x; then
5807   AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE",
5808                                          [The linker hash style])
5811 # Specify what should be the default of -fdiagnostics-color option.
5812 AC_ARG_WITH([diagnostics-color],
5813 [AC_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}],
5814                 [specify the default of -fdiagnostics-color option
5815                  auto-if-env stands for -fdiagnostics-color=auto if
5816                  GCC_COLOR environment variable is present and
5817                  -fdiagnostics-color=never otherwise])],
5818 [case x"$withval" in
5819    xnever)
5820      DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO
5821      ;;
5822    xauto)
5823      DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO
5824      ;;
5825    xauto-if-env)
5826      DIAGNOSTICS_COLOR_DEFAULT=-1
5827      ;;
5828    xalways)
5829      DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES
5830      ;;
5831    *)
5832      AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-color])
5833      ;;
5834  esac],
5835 [DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO])
5836 AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, $DIAGNOSTICS_COLOR_DEFAULT,
5837                    [The default for -fdiagnostics-color option])
5839 # Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
5840 # of jit/jit-playback.c.
5841 cat > gcc-driver-name.h <<EOF
5842 #define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
5845 # Check whether --enable-default-pie was given.
5846 AC_ARG_ENABLE(default-pie,
5847 [AS_HELP_STRING([--enable-default-pie],
5848   [enable Position Independent Executable as default])],
5849 enable_default_pie=$enableval,
5850 enable_default_pie=no)
5851 if test x$enable_default_pie == xyes ; then
5852   AC_DEFINE(ENABLE_DEFAULT_PIE, 1,
5853       [Define if your target supports default PIE and it is enabled.])
5855 AC_SUBST([enable_default_pie])
5857 # Check if -fno-PIE works.
5858 AC_CACHE_CHECK([for -fno-PIE option],
5859   [gcc_cv_c_no_fpie],
5860   [saved_CXXFLAGS="$CXXFLAGS"
5861    CXXFLAGS="$CXXFLAGS -fno-PIE"
5862    AC_COMPILE_IFELSE([int main(void) {return 0;}],
5863      [gcc_cv_c_no_fpie=yes],
5864      [gcc_cv_c_no_fpie=no])
5865    CXXFLAGS="$saved_CXXFLAGS"])
5866 if test "$gcc_cv_c_no_fpie" = "yes"; then
5867   NO_PIE_CFLAGS="-fno-PIE"
5869 AC_SUBST([NO_PIE_CFLAGS])
5871 # Check if -no-pie works.
5872 AC_CACHE_CHECK([for -no-pie option],
5873   [gcc_cv_no_pie],
5874   [saved_LDFLAGS="$LDFLAGS"
5875    LDFLAGS="$LDFLAGS -no-pie"
5876    AC_LINK_IFELSE([int main(void) {return 0;}],
5877      [gcc_cv_no_pie=yes],
5878      [gcc_cv_no_pie=no])
5879    LDFLAGS="$saved_LDFLAGS"])
5880 if test "$gcc_cv_no_pie" = "yes"; then
5881   NO_PIE_FLAG="-no-pie"
5883 AC_SUBST([NO_PIE_FLAG])
5885 # Check linker supports '-z bndplt'
5886 ld_bndplt_support=no
5887 AC_MSG_CHECKING(linker -z bndplt option)
5888 if test x"$ld_is_gold" = xno; then
5889   if test $in_tree_ld = yes ; then
5890     if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
5891       ld_bndplt_support=yes
5892     fi
5893   elif test x$gcc_cv_ld != x; then
5894     # Check if linker supports -a bndplt option
5895     if $gcc_cv_ld --help 2>/dev/null | grep -- '-z bndplt' > /dev/null; then
5896       ld_bndplt_support=yes
5897     fi
5898   fi
5900 if test x"$ld_bndplt_support" = xyes; then
5901   AC_DEFINE(HAVE_LD_BNDPLT_SUPPORT, 1,
5902         [Define if your linker supports -z bndplt])
5904 AC_MSG_RESULT($ld_bndplt_support)
5906 # Configure the subdirectories
5907 # AC_CONFIG_SUBDIRS($subdirs)
5909 # Create the Makefile
5910 # and configure language subdirectories
5911 AC_CONFIG_FILES($all_outputs)
5913 AC_CONFIG_COMMANDS([default],
5915 case ${CONFIG_HEADERS} in
5916   *auto-host.h:config.in*)
5917   echo > cstamp-h ;;
5918 esac
5919 # Make sure all the subdirs exist.
5920 for d in $subdirs doc build common c-family
5922     test -d $d || mkdir $d
5923 done
5924 ], 
5925 [subdirs='$subdirs'])
5926 AC_OUTPUT