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