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