Enable dumping of alias graphs.
[official-gcc/Ramakrishna.git] / gcc / configure.ac
blob6cc94d883448887353910e3a1b19287b2aa2e586
1 # configure.ac for GCC
2 # Process this file with autoconf to generate a configuration script.
4 # Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
5 # 2007, 2008, 2009 Free Software Foundation, Inc.
7 #This file is part of GCC.
9 #GCC is free software; you can redistribute it and/or modify it under
10 #the terms of the GNU General Public License as published by the Free
11 #Software Foundation; either version 3, or (at your option) any later
12 #version.
14 #GCC is distributed in the hope that it will be useful, but WITHOUT
15 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 #FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 #for more details.
19 #You should have received a copy of the GNU General Public License
20 #along with GCC; see the file COPYING3.  If not see
21 #<http://www.gnu.org/licenses/>.
23 # --------------------------------
24 # Initialization and sanity checks
25 # --------------------------------
27 AC_PREREQ(2.64)
28 AC_INIT
29 AC_CONFIG_SRCDIR(tree.c)
30 AC_CONFIG_HEADER(auto-host.h:config.in)
32 gcc_version=`cat $srcdir/BASE-VER`
34 # Determine the host, build, and target systems
35 AC_CANONICAL_BUILD
36 AC_CANONICAL_HOST
37 AC_CANONICAL_TARGET
39 # Determine the noncanonical target name, for directory use.
40 ACX_NONCANONICAL_TARGET
42 # Determine the target- and build-specific subdirectories
43 GCC_TOPLEV_SUBDIRS
45 # Set program_transform_name
46 AC_ARG_PROGRAM
48 # Check for bogus environment variables.
49 # Test if LIBRARY_PATH contains the notation for the current directory
50 # since this would lead to problems installing/building glibc.
51 # LIBRARY_PATH contains the current directory if one of the following
52 # is true:
53 # - one of the terminals (":" and ";") is the first or last sign
54 # - two terminals occur directly after each other
55 # - the path contains an element with a dot in it
56 AC_MSG_CHECKING(LIBRARY_PATH variable)
57 changequote(,)dnl
58 case ${LIBRARY_PATH} in
59   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
60     library_path_setting="contains current directory"
61     ;;
62   *)
63     library_path_setting="ok"
64     ;;
65 esac
66 changequote([,])dnl
67 AC_MSG_RESULT($library_path_setting)
68 if test "$library_path_setting" != "ok"; then
69 AC_MSG_ERROR([
70 *** LIBRARY_PATH shouldn't contain the current directory when
71 *** building gcc. Please change the environment variable
72 *** and run configure again.])
75 # Test if GCC_EXEC_PREFIX contains the notation for the current directory
76 # since this would lead to problems installing/building glibc.
77 # GCC_EXEC_PREFIX contains the current directory if one of the following
78 # is true:
79 # - one of the terminals (":" and ";") is the first or last sign
80 # - two terminals occur directly after each other
81 # - the path contains an element with a dot in it
82 AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
83 changequote(,)dnl
84 case ${GCC_EXEC_PREFIX} in
85   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
86     gcc_exec_prefix_setting="contains current directory"
87     ;;
88   *)
89     gcc_exec_prefix_setting="ok"
90     ;;
91 esac
92 changequote([,])dnl
93 AC_MSG_RESULT($gcc_exec_prefix_setting)
94 if test "$gcc_exec_prefix_setting" != "ok"; then
95 AC_MSG_ERROR([
96 *** GCC_EXEC_PREFIX shouldn't contain the current directory when
97 *** building gcc. Please change the environment variable
98 *** and run configure again.])
101 # -----------
102 # Directories
103 # -----------
105 # Specify the local prefix
106 local_prefix=
107 AC_ARG_WITH(local-prefix,
108 [  --with-local-prefix=DIR specifies directory to put local include],
109 [case "${withval}" in
110 yes)    AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
111 no)     ;;
112 *)      local_prefix=$with_local_prefix ;;
113 esac])
115 # Default local prefix if it is empty
116 if test x$local_prefix = x; then
117         local_prefix=/usr/local
120 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
121 # passed in by the toplevel make and thus we'd get different behavior
122 # depending on where we built the sources.
123 gcc_gxx_include_dir=
124 # Specify the g++ header file directory
125 AC_ARG_WITH(gxx-include-dir,
126 [  --with-gxx-include-dir=DIR
127                           specifies directory to put g++ header files],
128 [case "${withval}" in
129 yes)    AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
130 no)     ;;
131 *)      gcc_gxx_include_dir=$with_gxx_include_dir ;;
132 esac])
134 # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
135 if test x${gcc_gxx_include_dir} = x; then
136   if test x${enable_version_specific_runtime_libs} = xyes; then
137     gcc_gxx_include_dir='${libsubdir}/include/c++'
138   else
139     libstdcxx_incdir='include/c++/$(version)'
140     if test x$host != x$target; then
141        libstdcxx_incdir="$target_alias/$libstdcxx_incdir"
142     fi
143     gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
144   fi
147 AC_ARG_WITH(cpp_install_dir,
148 [  --with-cpp-install-dir=DIR
149                           install the user visible C preprocessor in DIR
150                           (relative to PREFIX) as well as PREFIX/bin],
151 [if test x$withval = xyes; then
152   AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
153 elif test x$withval != xno; then
154   cpp_install_dir=$withval
155 fi])
157 # We would like to our source tree to be readonly.  However when releases or
158 # pre-releases are generated, the flex/bison generated files as well as the 
159 # various formats of manuals need to be included along with the rest of the
160 # sources.  Therefore we have --enable-generated-files-in-srcdir to do 
161 # just that.
163 AC_MSG_CHECKING([whether to place generated files in the source directory])
164   dnl generated-files-in-srcdir is disabled by default
165   AC_ARG_ENABLE(generated-files-in-srcdir, 
166 [  --enable-generated-files-in-srcdir
167                           put copies of generated files in source dir
168                           intended for creating source tarballs for users
169                           without texinfo bison or flex.],
170       generated_files_in_srcdir=$enableval,
171       generated_files_in_srcdir=no)
173 AC_MSG_RESULT($generated_files_in_srcdir)
175 if test "$generated_files_in_srcdir" = "yes"; then
176   GENINSRC=''
177 else
178   GENINSRC='#'
180 AC_SUBST(GENINSRC)
182 # -------------------
183 # Find default linker
184 # -------------------
186 # With GNU ld
187 AC_ARG_WITH(gnu-ld,
188 [  --with-gnu-ld           arrange to work with GNU ld.],
189 gnu_ld_flag="$with_gnu_ld",
190 gnu_ld_flag=no)
192 # With pre-defined ld
193 AC_ARG_WITH(ld,
194 [  --with-ld               arrange to use the specified ld (full pathname)],
195 DEFAULT_LINKER="$with_ld")
196 if test x"${DEFAULT_LINKER+set}" = x"set"; then
197   if test ! -x "$DEFAULT_LINKER"; then
198     AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
199   elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
200     gnu_ld_flag=yes
201   fi
202   AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
203         [Define to enable the use of a default linker.])
206 gnu_ld=`if test x"$gnu_ld_flag" = x"yes"; then echo 1; else echo 0; fi`
207 AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld, [Define if using GNU ld.])
209 AC_MSG_CHECKING([whether a default linker was specified])
210 if test x"${DEFAULT_LINKER+set}" = x"set"; then
211   if test x"$gnu_ld_flag" = x"no"; then
212     AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
213   else
214     AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
215   fi
216 else
217   AC_MSG_RESULT(no)
220 # With demangler in GNU ld
221 AC_ARG_WITH(demangler-in-ld,
222 [  --with-demangler-in-ld  try to use demangler in GNU ld.],
223 demangler_in_ld="$with_demangler_in_ld",
224 demangler_in_ld=no)
226 # ----------------------
227 # Find default assembler
228 # ----------------------
230 # With GNU as
231 AC_ARG_WITH(gnu-as,
232 [  --with-gnu-as           arrange to work with GNU as],
233 gas_flag="$with_gnu_as",
234 gas_flag=no)
236 AC_ARG_WITH(as,
237 [  --with-as               arrange to use the specified as (full pathname)],
238 DEFAULT_ASSEMBLER="$with_as")
239 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
240   if test ! -x "$DEFAULT_ASSEMBLER"; then
241     AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
242   elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
243     gas_flag=yes
244   fi
245   AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
246         [Define to enable the use of a default assembler.])
249 gnu_as=`if test x"$gas_flag" = x"yes"; then echo 1; else echo 0; fi`
250 AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as, [Define if using GNU as.])
252 AC_MSG_CHECKING([whether a default assembler was specified])
253 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
254   if test x"$gas_flag" = x"no"; then
255     AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
256   else
257     AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
258   fi
259 else
260   AC_MSG_RESULT(no)
263 # ---------------
264 # Find C compiler
265 # ---------------
267 # If a non-executable a.out is present (e.g. created by GNU as above even if
268 # invoked with -v only), the IRIX 6 native ld just overwrites the existing
269 # file, even when creating an executable, so an execution test fails.
270 # Remove possible default executable files to avoid this.
272 # FIXME: This really belongs into AC_PROG_CC and can be removed once
273 # Autoconf includes it.
274 rm -f a.out a.exe b.out
276 # Find the native compiler
277 AC_PROG_CC
278 AM_PROG_CC_C_O
279 AC_PROG_CXX
280 ACX_PROG_GNAT([-I"$srcdir"/ada])
282 # autoconf is lame and doesn't give us any substitution variable for this.
283 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
284   NO_MINUS_C_MINUS_O=yes
285 else
286   OUTPUT_OPTION='-o $@'
288 AC_SUBST(NO_MINUS_C_MINUS_O)
289 AC_SUBST(OUTPUT_OPTION)
291 # Remove the -O2: for historical reasons, unless bootstrapping we prefer
292 # optimizations to be activated explicitly by the toplevel.
293 case "$CC" in
294   */prev-gcc/xgcc*) ;;
295   *) CFLAGS=`echo $CFLAGS | sed "s/-O[[s0-9]]* *//" ` ;;
296 esac
297 AC_SUBST(CFLAGS)
299 # -------------------------
300 # Check C compiler features
301 # -------------------------
303 AC_USE_SYSTEM_EXTENSIONS
304 AC_PROG_CPP
305 AC_C_INLINE
307 # sizeof(char) is 1 by definition.
308 AC_CHECK_SIZEOF(void *)
309 AC_CHECK_SIZEOF(short)
310 AC_CHECK_SIZEOF(int)
311 AC_CHECK_SIZEOF(long)
312 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
313 AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)])
315 # ---------------------
316 # Warnings and checking
317 # ---------------------
319 # Check $CC warning features (if it's GCC).
320 # We want to use -pedantic, but we don't want warnings about
321 # * 'long long'
322 # * variadic macros
323 # * overlong strings
324 # So, we only use -pedantic if we can disable those warnings.
326 ACX_PROG_CC_WARNING_OPTS(
327         m4_quote(m4_do([-W -Wall -Wwrite-strings -Wcast-qual])), [loose_warn])
328 ACX_PROG_CC_WARNING_OPTS(
329         m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])),
330         [c_loose_warn])
331 ACX_PROG_CC_WARNING_OPTS(
332         m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
333 ACX_PROG_CC_WARNING_OPTS(
334         m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
335 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
336         m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ], 
337                        [-Wno-overlength-strings])), [strict_warn])
338 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn])
340 # The above macros do nothing if the compiler is not GCC.  However, the
341 # Makefile has more goo to add other flags, so these variables are used
342 # to enable warnings only for GCC.
343 warn_cflags=
344 warn_cxxflags=
345 if test "x$GCC" = "xyes"; then
346   warn_cflags='$(GCC_WARN_CFLAGS)'
347   warn_cxxflags='$(GCC_WARN_CXXFLAGS)'
349 AC_SUBST(warn_cflags)
350 AC_SUBST(warn_cxxflags)
352 # Enable expensive internal checks
353 is_release=
354 if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
355   is_release=yes
358 AC_ARG_ENABLE(checking,
359 [  --enable-checking[=LIST]
360                           enable expensive run-time checks.  With LIST,
361                           enable only specific categories of checks.
362                           Categories are: yes,no,all,none,release.
363                           Flags are: assert,df,fold,gc,gcac,gimple,misc,
364                           rtlflag,rtl,runtime,tree,valgrind,types.],
365 [ac_checking_flags="${enableval}"],[
366 # Determine the default checks.
367 if test x$is_release = x ; then
368   ac_checking_flags=yes
369 else
370   ac_checking_flags=release
371 fi])
372 IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
373 for check in release $ac_checking_flags
375         case $check in
376         # these set all the flags to specific states
377         yes)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
378                         ac_fold_checking= ; ac_gc_checking=1 ;
379                         ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
380                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
381                         ac_tree_checking=1 ; ac_valgrind_checking= ;
382                         ac_types_checking=1 ;;
383         no|none)        ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
384                         ac_fold_checking= ; ac_gc_checking= ;
385                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
386                         ac_rtlflag_checking= ; ac_runtime_checking= ;
387                         ac_tree_checking= ; ac_valgrind_checking= ;
388                         ac_types_checking= ;;
389         all)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
390                         ac_fold_checking=1 ; ac_gc_checking=1 ;
391                         ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
392                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
393                         ac_tree_checking=1 ; ac_valgrind_checking= ;
394                         ac_types_checking=1 ;;
395         release)        ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
396                         ac_fold_checking= ; ac_gc_checking= ;
397                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
398                         ac_rtlflag_checking= ; ac_runtime_checking=1 ;
399                         ac_tree_checking= ; ac_valgrind_checking= ;
400                         ac_types_checking= ;;
401         # these enable particular checks
402         assert)         ac_assert_checking=1 ;;
403         df)             ac_df_checking=1 ;;
404         fold)           ac_fold_checking=1 ;;
405         gc)             ac_gc_checking=1 ;;
406         gcac)           ac_gc_always_collect=1 ;;
407         gimple)         ac_gimple_checking=1 ;;
408         misc)           ac_checking=1 ;;
409         rtl)            ac_rtl_checking=1 ;;
410         rtlflag)        ac_rtlflag_checking=1 ;;
411         runtime)        ac_runtime_checking=1 ;;
412         tree)           ac_tree_checking=1 ;;
413         types)          ac_types_checking=1 ;;
414         valgrind)       ac_valgrind_checking=1 ;;
415         *)      AC_MSG_ERROR(unknown check category $check) ;;
416         esac
417 done
418 IFS="$ac_save_IFS"
420 nocommon_flag=""
421 if test x$ac_checking != x ; then
422   AC_DEFINE(ENABLE_CHECKING, 1,
423 [Define if you want more run-time sanity checks.  This one gets a grab
424    bag of miscellaneous but relatively cheap checks.])
425   nocommon_flag=-fno-common
427 AC_SUBST(nocommon_flag)
428 if test x$ac_df_checking != x ; then
429   AC_DEFINE(ENABLE_DF_CHECKING, 1,
430 [Define if you want more run-time sanity checks for dataflow.])
432 if test x$ac_assert_checking != x ; then
433   AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
434 [Define if you want assertions enabled.  This is a cheap check.])
436 if test x$ac_gimple_checking != x ; then
437   AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1,
438 [Define if you want operations on GIMPLE (the basic data structure of
439 the high-level optimizers) to be checked for dynamic type safety at
440 runtime.  This is moderately expensive.])
442 GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
443 if test x$ac_runtime_checking != x ; then
444   AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
445 [Define if you want runtime assertions enabled.  This is a cheap check.])
447 if test x$ac_tree_checking != x ; then
448   AC_DEFINE(ENABLE_TREE_CHECKING, 1,
449 [Define if you want all operations on trees (the basic data
450    structure of the front ends) to be checked for dynamic type safety
451    at runtime.  This is moderately expensive.  The tree browser debugging
452    routines will also be enabled by this option.
453    ])
454   TREEBROWSER=tree-browser.o
456 if test x$ac_types_checking != x ; then
457   AC_DEFINE(ENABLE_TYPES_CHECKING, 1,
458 [Define if you want all gimple types to be verified after gimplifiation.
459    This is cheap.
460    ])
462 AC_SUBST(TREEBROWSER)
463 if test x$ac_rtl_checking != x ; then
464   AC_DEFINE(ENABLE_RTL_CHECKING, 1,
465 [Define if you want all operations on RTL (the basic data structure
466    of the optimizer and back end) to be checked for dynamic type safety
467    at runtime.  This is quite expensive.])
469 if test x$ac_rtlflag_checking != x ; then
470   AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
471 [Define if you want RTL flag accesses to be checked against the RTL
472    codes that are supported for each access macro.  This is relatively
473    cheap.])
475 if test x$ac_gc_checking != x ; then
476   AC_DEFINE(ENABLE_GC_CHECKING, 1,
477 [Define if you want the garbage collector to do object poisoning and
478    other memory allocation checks.  This is quite expensive.])
480 if test x$ac_gc_always_collect != x ; then
481   AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
482 [Define if you want the garbage collector to operate in maximally
483    paranoid mode, validating the entire heap and collecting garbage at
484    every opportunity.  This is extremely expensive.])
486 if test x$ac_fold_checking != x ; then
487   AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
488 [Define if you want fold checked that it never destructs its argument.
489    This is quite expensive.])
491 valgrind_path_defines=
492 valgrind_command=
494 dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
495 dnl # an if statement.  This was the source of very frustrating bugs
496 dnl # in converting to autoconf 2.5x!
497 AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
499 if test x$ac_valgrind_checking != x ; then
500   # It is certainly possible that there's valgrind but no valgrind.h.
501   # GCC relies on making annotations so we must have both.
502   AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>)
503   AC_PREPROC_IFELSE([AC_LANG_SOURCE(
504     [[#include <valgrind/memcheck.h>
505 #ifndef VALGRIND_DISCARD
506 #error VALGRIND_DISCARD not defined
507 #endif]])],
508   [gcc_cv_header_valgrind_memcheck_h=yes],
509   [gcc_cv_header_valgrind_memcheck_h=no])
510   AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
511   AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
512   AC_PREPROC_IFELSE([AC_LANG_SOURCE(
513     [[#include <memcheck.h>
514 #ifndef VALGRIND_DISCARD
515 #error VALGRIND_DISCARD not defined
516 #endif]])],
517   [gcc_cv_header_memcheck_h=yes],
518   [gcc_cv_header_memcheck_h=no])
519   AC_MSG_RESULT($gcc_cv_header_memcheck_h)
520   AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
521         [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
522   if test "x$valgrind_path" = "x" \
523     || (test $have_valgrind_h = no \
524         && test $gcc_cv_header_memcheck_h = no \
525         && test $gcc_cv_header_valgrind_memcheck_h = no); then
526         AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
527   fi
528   valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
529   valgrind_command="$valgrind_path -q"
530   AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
531 [Define if you want to run subprograms and generated programs
532    through valgrind (a memory checker).  This is extremely expensive.])
533   if test $gcc_cv_header_valgrind_memcheck_h = yes; then
534     AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
535         [Define if valgrind's valgrind/memcheck.h header is installed.])
536   fi
537   if test $gcc_cv_header_memcheck_h = yes; then
538     AC_DEFINE(HAVE_MEMCHECK_H, 1,
539         [Define if valgrind's memcheck.h header is installed.])
540   fi
542 AC_SUBST(valgrind_path_defines)
543 AC_SUBST(valgrind_command)
545 # Enable code coverage collection
546 AC_ARG_ENABLE(coverage,
547 [  --enable-coverage[=LEVEL]
548                           enable compiler's code coverage collection.
549                           Use to measure compiler performance and locate
550                           unused parts of the compiler. With LEVEL, specify
551                           optimization. Values are opt, noopt,
552                           default is noopt],
553 [case "${enableval}" in
554   yes|noopt)
555     coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
556     ;;
557   opt)
558     coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
559     ;;
560   no)
561     # a.k.a. --disable-coverage
562     coverage_flags=""
563     ;;
564   *)
565     AC_MSG_ERROR(unknown coverage setting $enableval)
566     ;;
567 esac],
568 [coverage_flags=""])
569 AC_SUBST(coverage_flags)
571 AC_ARG_ENABLE(gather-detailed-mem-stats, 
572 [  --enable-gather-detailed-mem-stats         enable detailed memory allocation stats gathering], [],
573 [enable_gather_detailed_mem_stats=no])
574 if test x$enable_gather_detailed_mem_stats = xyes ; then
575   AC_DEFINE(GATHER_STATISTICS, 1,
576         [Define to enable detailed memory allocation stats gathering.])
579 # -------------------------------
580 # Miscenalleous configure options
581 # -------------------------------
583 # See if we are building gcc with C++.
584 AC_ARG_ENABLE(build-with-cxx,
585 [  --enable-build-with-cxx build with C++ compiler instead of C compiler],
586 ENABLE_BUILD_WITH_CXX=$enableval,
587 ENABLE_BUILD_WITH_CXX=no)
588 AC_SUBST(ENABLE_BUILD_WITH_CXX)
590 # With stabs
591 AC_ARG_WITH(stabs,
592 [  --with-stabs            arrange to use stabs instead of host debug format],
593 stabs="$with_stabs",
594 stabs=no)
596 # Determine whether or not multilibs are enabled.
597 AC_ARG_ENABLE(multilib,
598 [  --enable-multilib       enable library support for multiple ABIs],
599 [], [enable_multilib=yes])
600 AC_SUBST(enable_multilib)
602 # Enable __cxa_atexit for C++.
603 AC_ARG_ENABLE(__cxa_atexit,
604 [  --enable-__cxa_atexit   enable __cxa_atexit for C++],
605 [], [])
607 # Enable C extension for decimal float if target supports it.
608 AC_ARG_ENABLE(decimal-float,
609 [  --enable-decimal-float={no,yes,bid,dpd}
610                         enable decimal float extension to C.  Selecting 'bid'
611                         or 'dpd' choses which decimal floating point format
612                         to use],
614   case $enable_decimal_float in
615     yes | no | bid | dpd) ;;
616     *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float.
617 Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
618   esac
621   case $target in
622     powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*)
623       enable_decimal_float=yes
624       ;;
625     *)
626       AC_MSG_WARN(decimal float is not supported for this target, ignored)
627       enable_decimal_float=no
628       ;;
629   esac
632 dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi`
633 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
634 [Define to 1 to enable decimal float extension to C.])
636 # x86's use BID format instead of DPD
637 case x$enable_decimal_float in
638   xyes)
639     case $target in
640       i?86*-*-linux* | x86_64*-*-linux*)
641         enable_decimal_float=bid
642         ;;
643       *)
644         enable_decimal_float=dpd
645         ;;
646     esac
647     ;;
648   xno)
649     # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper
650     # dependency on libdecnumber.
651     enable_decimal_float=dpd
652     ;;
653 esac
654 AC_SUBST(enable_decimal_float)
656 bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi`
657 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid,
658 [Define to 1 to specify that we are using the BID decimal floating
659 point format instead of DPD])
661 # Enable C extension for fixed-point arithmetic.
662 AC_ARG_ENABLE(fixed-point,
663 [  --enable-fixed-point    enable fixed-point arithmetic extension to C],
667   case $target in
668     mips*-*-*)
669       case $host in
670         mips*-sgi-irix*)
671           AC_MSG_WARN(fixed-point is not supported on IRIX, ignored)
672           enable_fixed_point=no
673           ;;
674         *)
675           enable_fixed_point=yes
676           ;;
677       esac
678       ;;
679     *)
680       AC_MSG_WARN(fixed-point is not supported for this target, ignored)
681       enable_fixed_point=no
682       ;;
683   esac
685 AC_SUBST(enable_fixed_point)
687 fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi`
688 AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint,
689 [Define to 1 to enable fixed-point arithmetic extension to C.])
691 # Enable threads
692 # Pass with no value to take the default
693 # Pass with a value to specify a thread package
694 AC_ARG_ENABLE(threads,
695 [  --enable-threads        enable thread usage for target GCC
696   --enable-threads=LIB    use LIB thread package for target GCC],,
697 [enable_threads=''])
699 AC_ARG_ENABLE(tls,
700 [  --enable-tls            enable or disable generation of tls code
701                           overriding the assembler check for tls support],
703   case $enable_tls in
704     yes | no) ;;
705     *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
706 Valid choices are 'yes' and 'no'.]) ;;
707   esac
708 ], [enable_tls=''])
710 AC_ARG_ENABLE(objc-gc,
711 [  --enable-objc-gc       enable the use of Boehm's garbage collector with
712                           the GNU Objective-C runtime],
713 if test x$enable_objc_gc = xno; then
714         objc_boehm_gc=''
715 else
716         objc_boehm_gc=1
718 objc_boehm_gc='')
720 AC_ARG_WITH(dwarf2,
721 [  --with-dwarf2           force the default debug format to be DWARF 2],
722 dwarf2="$with_dwarf2",
723 dwarf2=no)
725 AC_ARG_ENABLE(shared,
726 [  --disable-shared        don't provide a shared libgcc],
728   case $enable_shared in
729   yes | no) ;;
730   *)
731     enable_shared=no
732     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
733     for pkg in $enableval; do
734       if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
735         enable_shared=yes
736       fi
737     done
738     IFS="$ac_save_ifs"
739     ;;
740   esac
741 ], [enable_shared=yes])
742 AC_SUBST(enable_shared)
744 AC_ARG_WITH(build-sysroot, 
745   [  --with-build-sysroot=sysroot
746                           use sysroot as the system root during the build])
748 AC_ARG_WITH(sysroot,
749 [  --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
751  case ${with_sysroot} in
752  yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
753  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
754  esac
755    
756  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
757  CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
758         
759  if test "x$prefix" = xNONE; then
760   test_prefix=/usr/local
761  else
762   test_prefix=$prefix
763  fi
764  if test "x$exec_prefix" = xNONE; then
765   test_exec_prefix=$test_prefix
766  else
767   test_exec_prefix=$exec_prefix
768  fi
769  case ${TARGET_SYSTEM_ROOT} in
770  "${test_prefix}"|"${test_prefix}/"*|\
771  "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
772  '${prefix}'|'${prefix}/'*|\
773  '${exec_prefix}'|'${exec_prefix}/'*)
774    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
775    TARGET_SYSTEM_ROOT_DEFINE="$t"
776    ;;
777  esac
778 ], [
779  TARGET_SYSTEM_ROOT=
780  TARGET_SYSTEM_ROOT_DEFINE=
781  CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
783 AC_SUBST(TARGET_SYSTEM_ROOT)
784 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
785 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
787 # Build with intermodule optimisations
788 AC_ARG_ENABLE(intermodule,
789 [  --enable-intermodule    build the compiler in one step],
790 [case ${enable_intermodule} in
791   yes) onestep="-onestep";;
792   *) onestep="";;
793 esac],
794 [onestep=""])
795 AC_SUBST(onestep)
797 ACX_PKGVERSION([GCC])
798 ACX_BUGURL([http://gcc.gnu.org/bugs.html])
800 # Sanity check enable_languages in case someone does not run the toplevel
801 # configure # script.
802 AC_ARG_ENABLE(languages,
803 [  --enable-languages=LIST specify which front-ends to build],
804 [case ,${enable_languages}, in
805        ,,|,yes,)
806                 # go safe -- we cannot be much sure without the toplevel
807                 # configure's
808                 # analysis of which target libs are present and usable
809                 enable_languages=c
810                 ;;
811          *,all,*)
812                 AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
813                 ;;
814         *,c,*)
815                 ;;
816         *)
817                 enable_languages=c,${enable_languages}
818                 ;;
819 esac],
820 [enable_languages=c])
822 AC_ARG_WITH(multilib-list,
823 [  --with-multilib-list    Select multilibs (SH only)],
825 with_multilib_list=default)
827 # -------------------------
828 # Checks for other programs
829 # -------------------------
831 AC_PROG_MAKE_SET
833 # Find some useful tools
834 AC_PROG_AWK
835 # We need awk to create options.c and options.h.
836 # Bail out if it's missing.
837 case ${AWK} in
838   "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
839 esac
841 gcc_AC_PROG_LN_S
842 ACX_PROG_LN($LN_S)
843 AC_PROG_RANLIB
844 case "${host}" in
845 *-*-darwin*)
846   # By default, the Darwin ranlib will not treat common symbols as
847   # definitions when  building the archive table of contents.  Other 
848   # ranlibs do that; pass an option to the Darwin ranlib that makes
849   # it behave similarly.
850   ranlib_flags="-c" 
851   ;;
853   ranlib_flags=""
854 esac
855 AC_SUBST(ranlib_flags)
856      
857 gcc_AC_PROG_INSTALL
859 # See if cmp has --ignore-initial.
860 gcc_AC_PROG_CMP_IGNORE_INITIAL
862 # See if we have the mktemp command.
863 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
865 # See if makeinfo has been installed and is modern enough
866 # that we can use it.
867 ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
868   [GNU texinfo.* \([0-9][0-9.]*\)],
869   [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
870 if test $gcc_cv_prog_makeinfo_modern = no; then
871   AC_MSG_WARN([
872 *** Makeinfo is missing or too old.
873 *** Info documentation will not be built.])
874   BUILD_INFO=
875 else
876   BUILD_INFO=info
878 AC_SUBST(BUILD_INFO)
880 # Is pod2man recent enough to regenerate manpages?
881 AC_MSG_CHECKING([for recent Pod::Man])
882 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
883   AC_MSG_RESULT(yes)
884   GENERATED_MANPAGES=generated-manpages
885 else
886   AC_MSG_RESULT(no)
887   GENERATED_MANPAGES=
889 AC_SUBST(GENERATED_MANPAGES)
891 MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
893 # How about lex?
894 dnl Don't use AC_PROG_LEX; we insist on flex.
895 dnl LEXLIB is not useful in gcc.
896 AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
898 # Bison?
899 AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
901 # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
902 # check for build == host before using them.
904 # NM
905 if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
906   && test -d ../binutils ; then
907   NM='$(objdir)/../binutils/nm-new'
908 else
909   AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
912 # AR
913 if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
914   && test -d ../binutils ; then
915   AR='$(objdir)/../binutils/ar'
916 else
917   AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
921 # --------------------
922 # Checks for C headers
923 # --------------------
925 # Need to reject headers which give warnings, so that the -Werror bootstrap
926 # works later. *sigh*  This needs to come before all header checks.
927 AC_PROG_CPP_WERROR
929 AC_HEADER_STDC
930 AC_HEADER_TIME
931 ACX_HEADER_STRING
932 AC_HEADER_SYS_WAIT
933 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
934                  fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
935                  sys/resource.h sys/param.h sys/times.h sys/stat.h \
936                  direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
938 # Check for thread headers.
939 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
940 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
942 # These tests can't be done till we know if we have limits.h.
943 gcc_AC_C_CHAR_BIT
944 AC_C_BIGENDIAN
946 # --------
947 # UNSORTED
948 # --------
951 # These libraries may be used by collect2.
952 # We may need a special search path to get them linked.
953 AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
954 [save_LIBS="$LIBS"
955 for libs in '' -lld -lmld \
956                 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
957                 '-L/usr/lib/cmplrs/cc3.11 -lmld'
959         LIBS="$libs"
960         AC_TRY_LINK_FUNC(ldopen,
961                 [gcc_cv_collect2_libs="$libs"; break])
962 done
963 LIBS="$save_LIBS"
964 test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
965 case $gcc_cv_collect2_libs in
966         "none required")        ;;
967         *)      COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
968 esac
969 AC_SUBST(COLLECT2_LIBS)
971 # When building Ada code on Alpha, we need exc_resume which is usually in
972 # -lexc.  So test for it.
973 save_LIBS="$LIBS"
974 LIBS=
975 AC_SEARCH_LIBS(exc_resume, exc)
976 GNAT_LIBEXC="$LIBS"
977 LIBS="$save_LIBS"
978 AC_SUBST(GNAT_LIBEXC)
980 # Some systems put ldexp and frexp in libm instead of libc; assume
981 # they're both in the same place.  jcf-dump needs them.
982 save_LIBS="$LIBS"
983 LIBS=
984 AC_SEARCH_LIBS(ldexp, m)
985 LDEXP_LIB="$LIBS"
986 LIBS="$save_LIBS"
987 AC_SUBST(LDEXP_LIB)
989 # Use <inttypes.h> only if it exists,
990 # doesn't clash with <sys/types.h>, and declares intmax_t.
991 AC_MSG_CHECKING(for inttypes.h)
992 AC_CACHE_VAL(gcc_cv_header_inttypes_h,
993 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
994 [[#include <sys/types.h>
995 #include <inttypes.h>]],
996   [[intmax_t i = -1;]])],
997   [gcc_cv_header_inttypes_h=yes],
998   [gcc_cv_header_inttypes_h=no])])
999 AC_MSG_RESULT($gcc_cv_header_inttypes_h)
1000 if test $gcc_cv_header_inttypes_h = yes; then
1001   AC_DEFINE(HAVE_INTTYPES_H, 1,
1002         [Define if you have a working <inttypes.h> header file.])
1005 dnl Disabled until we have a complete test for buggy enum bitfields.
1006 dnl gcc_AC_C_ENUM_BF_UNSIGNED
1008 define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1009   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1010   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1011   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1012   putchar_unlocked putc_unlocked)
1013 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
1014         sysconf strsignal getrusage nl_langinfo \
1015         gettimeofday mbstowcs wcswidth mmap mincore setlocale \
1016         gcc_UNLOCKED_FUNCS)
1018 if test x$ac_cv_func_mbstowcs = xyes; then
1019   AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
1020 [    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
1021 int main()
1023   mbstowcs(0, "", 0);
1024   return 0;
1025 }]])],
1026     [gcc_cv_func_mbstowcs_works=yes],
1027     [gcc_cv_func_mbstowcs_works=no],
1028     [gcc_cv_func_mbstowcs_works=yes])])
1029   if test x$gcc_cv_func_mbstowcs_works = xyes; then
1030     AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1031   [Define this macro if mbstowcs does not crash when its
1032    first argument is NULL.])
1033   fi
1036 AC_CHECK_TYPE(ssize_t, int)
1037 AC_CHECK_TYPE(caddr_t, char *)
1039 gcc_AC_FUNC_MMAP_BLACKLIST
1041 case "${host}" in
1042 *-*-*vms*)
1043   # Under VMS, vfork works very differently than on Unix. The standard test 
1044   # won't work, and it isn't easily adaptable. It makes more sense to
1045   # just force it.
1046   ac_cv_func_vfork_works=yes
1047   ;;
1048 esac
1049 AC_FUNC_FORK
1051 AM_ICONV
1052 # Until we have in-tree GNU iconv:
1053 LIBICONV_DEP=
1054 AC_SUBST(LIBICONV_DEP)
1056 AM_LC_MESSAGES
1058 AM_LANGINFO_CODESET
1060 # We will need to find libiberty.h and ansidecl.h
1061 saved_CFLAGS="$CFLAGS"
1062 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
1063 gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
1064         strsignal strstr strverscmp \
1065         errno snprintf vsnprintf vasprintf malloc realloc calloc \
1066         free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
1067 #include "ansidecl.h"
1068 #include "system.h"])
1070 gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
1071 #include "ansidecl.h"
1072 #include "system.h"
1073 #ifdef HAVE_SYS_RESOURCE_H
1074 #include <sys/resource.h>
1075 #endif
1078 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1079 #include "ansidecl.h"
1080 #include "system.h"
1081 #ifdef HAVE_SYS_RESOURCE_H
1082 #include <sys/resource.h>
1083 #endif
1084 ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
1085 [Define to `long' if <sys/resource.h> doesn't define.])])
1087 # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
1088 # FREAD and FWRITE macros.  Fortunately, for GCC's single usage of ldgetname
1089 # in collect2.c, <fcntl.h> isn't visible, but the configure test below needs
1090 # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
1091 gcc_AC_CHECK_DECLS(ldgetname, , ,[
1092 #include "ansidecl.h"
1093 #include "system.h"
1094 #ifdef HAVE_LDFCN_H
1095 #undef FREAD
1096 #undef FWRITE
1097 #include <ldfcn.h>
1098 #endif
1101 gcc_AC_CHECK_DECLS(times, , ,[
1102 #include "ansidecl.h"
1103 #include "system.h"
1104 #ifdef HAVE_SYS_TIMES_H
1105 #include <sys/times.h>
1106 #endif
1109 gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1110 #include "ansidecl.h"
1111 #include "system.h"
1112 #include <signal.h>
1115 # More time-related stuff.
1116 AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
1117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1118 #include "ansidecl.h"
1119 #include "system.h"
1120 #ifdef HAVE_SYS_TIMES_H
1121 #include <sys/times.h>
1122 #endif
1123 ]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
1124 if test $ac_cv_struct_tms = yes; then
1125   AC_DEFINE(HAVE_STRUCT_TMS, 1,
1126   [Define if <sys/times.h> defines struct tms.])
1129 # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1130 # revisit after autoconf 2.50.
1131 AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
1132 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1133 #include "ansidecl.h"
1134 #include "system.h"
1135 ]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
1136 if test $gcc_cv_type_clock_t = yes; then
1137   AC_DEFINE(HAVE_CLOCK_T, 1,
1138   [Define if <time.h> defines clock_t.])
1141 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
1142 CFLAGS="$saved_CFLAGS"
1144 gcc_AC_INITFINI_ARRAY
1146 # mkdir takes a single argument on some systems. 
1147 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
1149 # File extensions
1150 manext='.1'
1151 objext='.o'
1152 AC_SUBST(manext)
1153 AC_SUBST(objext)
1155 # With Setjmp/Longjmp based exception handling.
1156 AC_ARG_ENABLE(sjlj-exceptions,
1157 [  --enable-sjlj-exceptions
1158                           arrange to use setjmp/longjmp exception handling],
1159 [case $target in
1160   *-*-hpux10*)
1161     if test $enableval != yes; then
1162       AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced])
1163       enableval=yes
1164     fi
1165     ;;
1166 esac
1167 force_sjlj_exceptions=yes],
1168 [case $target in
1169   *-*-hpux10*)
1170     force_sjlj_exceptions=yes
1171     enableval=yes
1172     ;;
1173   *)
1174     force_sjlj_exceptions=no
1175     ;;
1176 esac])
1177 if test $force_sjlj_exceptions = yes; then
1178   sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1179   AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1180     [Define 0/1 to force the choice for exception handling model.])
1183 # For platforms with the unwind ABI which includes an unwind library,
1184 # libunwind, we can choose to use the system libunwind.
1185 # config.gcc also contains tests of with_system_libunwind.
1186 GCC_CHECK_UNWIND_GETIPINFO
1188 # --------------------------------------------------------
1189 # Build, host, and target specific configuration fragments
1190 # --------------------------------------------------------
1192 # Collect build-machine-specific information.
1193 . ${srcdir}/config.build
1195 # Collect host-machine-specific information.
1196 . ${srcdir}/config.host
1198 target_gtfiles=
1200 # Collect target-machine-specific information.
1201 . ${srcdir}/config.gcc
1203 extra_objs="${host_extra_objs} ${extra_objs}"
1204 extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
1206 # Default the target-machine variables that were not explicitly set.
1207 if test x"$tm_file" = x
1208 then tm_file=$cpu_type/$cpu_type.h; fi
1210 if test x"$extra_headers" = x
1211 then extra_headers=; fi
1213 if test x$md_file = x
1214 then md_file=$cpu_type/$cpu_type.md; fi
1216 if test x$out_file = x
1217 then out_file=$cpu_type/$cpu_type.c; fi
1219 if test x"$tmake_file" = x
1220 then tmake_file=$cpu_type/t-$cpu_type
1223 if test x"$dwarf2" = xyes
1224 then tm_file="$tm_file tm-dwarf2.h"
1227 # Say what files are being used for the output code and MD file.
1228 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
1229 echo "Using \`$srcdir/config/$md_file' as machine description file."
1231 # If any of the xm_file variables contain nonexistent files, warn
1232 # about them and drop them.
1235 for x in $build_xm_file; do
1236   if    test -f $srcdir/config/$x
1237   then      bx="$bx $x"
1238   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1239   fi
1240 done
1241 build_xm_file="$bx"
1244 for x in $host_xm_file; do
1245   if    test -f $srcdir/config/$x
1246   then      hx="$hx $x"
1247   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1248   fi
1249 done
1250 host_xm_file="$hx"
1253 for x in $xm_file; do
1254   if    test -f $srcdir/config/$x
1255   then      tx="$tx $x"
1256   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1257   fi
1258 done
1259 xm_file="$tx"
1261 count=a
1262 for f in $tm_file; do
1263         count=${count}x
1264 done
1265 if test $count = ax; then
1266         echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1267 else
1268         echo "Using the following target machine macro files:"
1269         for f in $tm_file; do
1270                 echo "  $srcdir/config/$f"
1271         done
1274 if test x$need_64bit_hwint = xyes; then
1275         AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1,
1276 [Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).])
1279 if test x$use_long_long_for_widest_fast_int = xyes; then
1280         AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
1281 [Define to 1 if the 'long long' (or '__int64') is wider than 'long' but still
1282 efficiently supported by the host hardware.])
1285 count=a
1286 for f in $host_xm_file; do
1287         count=${count}x
1288 done
1289 if test $count = a; then
1290         :
1291 elif test $count = ax; then
1292         echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1293 else
1294         echo "Using the following host machine macro files:"
1295         for f in $host_xm_file; do
1296                 echo "  $srcdir/config/$f"
1297         done
1299 echo "Using ${out_host_hook_obj} for host machine hooks."
1301 if test "$host_xm_file" != "$build_xm_file"; then
1302         count=a
1303         for f in $build_xm_file; do
1304                 count=${count}x
1305         done
1306         if test $count = a; then
1307                 :
1308         elif test $count = ax; then
1309                 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1310         else
1311                 echo "Using the following build machine macro files:"
1312                 for f in $build_xm_file; do
1313                         echo "  $srcdir/config/$f"
1314                 done
1315         fi
1318 case ${host} in
1319   powerpc*-*-darwin*)
1320     AC_CACHE_CHECK([whether mcontext_t fields have underscores],
1321       gcc_cv_mcontext_underscores,
1322       AC_COMPILE_IFELSE([
1323 #include <sys/cdefs.h>
1324 #include <sys/signal.h>
1325 #include <ucontext.h>
1326 int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
1328         gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
1329       if test $gcc_cv_mcontext_underscores = yes; then
1330         AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
1331           [mcontext_t fields start with __])
1332       fi
1333     ;;
1334 esac
1336 # ---------
1337 # Threading
1338 # ---------
1340 # Check if a valid thread package
1341 case ${enable_threads} in
1342   "" | no)
1343     # No threads
1344     target_thread_file='single'
1345     ;;
1346   yes)
1347     # default
1348     target_thread_file='single'
1349     ;;
1350   aix | dce | gnat | irix | posix | posix95 | rtems | \
1351   single | solaris | vxworks | win32 | mipssde)
1352     target_thread_file=${enable_threads}
1353     ;;
1354   *)
1355     echo "${enable_threads} is an unknown thread package" 1>&2
1356     exit 1
1357     ;;
1358 esac
1360 if test x${thread_file} = x; then
1361   # No thread file set by target-specific clauses in config.gcc,
1362   # so use file chosen by default logic above
1363   thread_file=${target_thread_file}
1366 # Make gthr-default.h if we have a thread file.
1367 gthread_flags=
1368 if test $thread_file != single; then
1369   echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h-t
1370   if diff gthr-default.h-t gthr-default.h 2>/dev/null; then
1371     rm -f gthr-default.h-t
1372   else
1373     mv -f gthr-default.h-t gthr-default.h
1374   fi
1375   gthread_flags=-DHAVE_GTHR_DEFAULT
1377 AC_SUBST(gthread_flags)
1379 # --------
1380 # UNSORTED
1381 # --------
1383 use_cxa_atexit=no
1384 if test x$enable___cxa_atexit = xyes || \
1385    test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
1386   if test x$host = x$target; then
1387     case $host in
1388       # mingw32 doesn't have __cxa_atexit but uses atexit registration
1389       # keyed to flag_use_cxa_atexit
1390       *-*-mingw32*)
1391         use_cxa_atexit=yes
1392         ;;
1393       *)
1394         AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
1395           [echo "__cxa_atexit can't be enabled on this target"])
1396         ;;
1397     esac
1398   else
1399     # We can't check for __cxa_atexit when building a cross, so assume
1400     # it is available 
1401     use_cxa_atexit=yes
1402   fi
1403   if test x$use_cxa_atexit = xyes; then
1404     AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
1405       [Define if you want to use __cxa_atexit, rather than atexit, to
1406       register C++ destructors for local statics and global objects.
1407       This is essential for fully standards-compliant handling of
1408       destructors, but requires __cxa_atexit in libc.])
1409   fi
1412 # Look for a file containing extra machine modes.
1413 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
1414   extra_modes_file='$(srcdir)'/config/${extra_modes}
1415   AC_SUBST(extra_modes_file)
1416   AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
1417   [Define to the name of a file containing a list of extra machine modes
1418    for this architecture.])
1421 # Convert extra_options into a form suitable for Makefile use.
1422 extra_opt_files=
1423 for f in $extra_options; do
1424   extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
1425 done
1426 AC_SUBST(extra_opt_files)
1428 # auto-host.h is the file containing items generated by autoconf and is
1429 # the first file included by config.h.
1430 # If host=build, it is correct to have bconfig include auto-host.h
1431 # as well.  If host!=build, we are in error and need to do more 
1432 # work to find out the build config parameters.
1433 if test x$host = x$build
1434 then
1435         build_auto=auto-host.h
1436 else
1437         # We create a subdir, then run autoconf in the subdir.
1438         # To prevent recursion we set host and build for the new
1439         # invocation of configure to the build for this invocation
1440         # of configure. 
1441         tempdir=build.$$
1442         rm -rf $tempdir
1443         mkdir $tempdir
1444         cd $tempdir
1445         case ${srcdir} in
1446         /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
1447         *) realsrcdir=../${srcdir};;
1448         esac
1449         saved_CFLAGS="${CFLAGS}"
1450         CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
1451         LDFLAGS="${LDFLAGS_FOR_BUILD}" \
1452         ${realsrcdir}/configure \
1453                 --enable-languages=${enable_languages-all} \
1454                 --target=$target_alias --host=$build_alias --build=$build_alias
1455         CFLAGS="${saved_CFLAGS}"
1457         # We just finished tests for the build machine, so rename
1458         # the file auto-build.h in the gcc directory.
1459         mv auto-host.h ../auto-build.h
1460         cd ..
1461         rm -rf $tempdir
1462         build_auto=auto-build.h
1464 AC_SUBST(build_subdir)
1466 tm_file="${tm_file} defaults.h"
1467 tm_p_file="${tm_p_file} tm-preds.h"
1468 host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1469 build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
1470 # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
1471 # put this back in temporarily.
1472 xm_file="auto-host.h ansidecl.h ${xm_file}"
1474 # --------
1475 # UNSORTED
1476 # --------
1478 changequote(,)dnl
1479 # Compile in configure arguments.
1480 if test -f configargs.h ; then
1481         # Being re-configured.
1482         gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
1483         gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1484 else
1485         gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1488 # Double all backslashes and backslash all quotes to turn
1489 # gcc_config_arguments into a C string.
1490 sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
1491 $gcc_config_arguments
1493 gcc_config_arguments_str=`cat conftest.out`
1494 rm -f conftest.out
1496 cat > configargs.h <<EOF
1497 /* Generated automatically. */
1498 static const char configuration_arguments[] = "$gcc_config_arguments_str";
1499 static const char thread_model[] = "$thread_file";
1501 static const struct {
1502   const char *name, *value;
1503 } configure_default_options[] = $configure_default_options;
1505 changequote([,])dnl
1507 changequote(,)dnl
1508 gcc_BASEVER=`cat $srcdir/BASE-VER`
1509 gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
1510 gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
1511 if test -f $srcdir/REVISION ; then
1512         gcc_REVISION=`cat $srcdir/REVISION`
1513 else
1514         gcc_REVISION=""
1516 cat > plugin-version.h <<EOF
1517 #include "configargs.h"
1519 static char basever[] = "$gcc_BASEVER";
1520 static char datestamp[] = "$gcc_DATESTAMP";
1521 static char devphase[] = "$gcc_DEVPHASE";
1522 static char revision[] = "$gcc_REVISION";
1524 /* FIXME plugins: We should make the version information more precise.
1525    One way to do is to add a checksum. */
1527 static struct plugin_gcc_version gcc_version = {basever, datestamp,
1528                                                 devphase, revision,
1529                                                 configuration_arguments};
1531 changequote([,])dnl
1533 # Internationalization
1534 ZW_GNU_GETTEXT_SISTER_DIR
1536 # If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
1537 # -liconv on the link line twice.
1538 case "$LIBINTL" in *$LIBICONV*)
1539         LIBICONV= ;;
1540 esac
1542 AC_ARG_ENABLE(secureplt,
1543 [  --enable-secureplt      enable -msecure-plt by default for PowerPC],
1544 [], [])
1546 AC_ARG_ENABLE(cld,
1547 [  --enable-cld            enable -mcld by default for 32bit x86], [],
1548 [enable_cld=no])
1550 # Windows32 Registry support for specifying GCC installation paths.
1551 AC_ARG_ENABLE(win32-registry,
1552 [  --disable-win32-registry
1553                           disable lookup of installation paths in the
1554                           Registry on Windows hosts
1555   --enable-win32-registry enable registry lookup (default)
1556   --enable-win32-registry=KEY
1557                           use KEY instead of GCC version as the last portion
1558                           of the registry key],,)
1560 case $host_os in
1561   win32 | pe | cygwin* | mingw32* | uwin*)
1562     if test "x$enable_win32_registry" != xno; then
1563       AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
1564     fi
1566     if test "x$enable_win32_registry" != xno; then
1567       AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1568   [Define to 1 if installation paths should be looked up in the Windows
1569    Registry. Ignored on non-Windows hosts.])
1571       if test "x$enable_win32_registry" != xyes \
1572          && test "x$enable_win32_registry" != x; then
1573         AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
1574   [Define to be the last component of the Windows registry key under which
1575    to look for installation paths.  The full key used will be 
1576    HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
1577    The default is the GCC version number.])
1578       fi
1579     fi
1580   ;;
1581 esac
1583 # Get an absolute path to the GCC top-level source directory
1584 holddir=`${PWDCMD-pwd}`
1585 cd $srcdir
1586 topdir=`${PWDCMD-pwd}`
1587 cd $holddir
1589 # Conditionalize the makefile for this host machine.
1590 xmake_file=
1591 for f in ${host_xmake_file}
1593         if test -f ${srcdir}/config/$f
1594         then
1595                 xmake_file="${xmake_file} \$(srcdir)/config/$f"
1596         fi
1597 done
1599 # Conditionalize the makefile for this target machine.
1600 tmake_file_=
1601 for f in ${tmake_file}
1603         if test -f ${srcdir}/config/$f
1604         then
1605                 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
1606         fi
1607 done
1608 tmake_file="${tmake_file_}"
1610 out_object_file=`basename $out_file .c`.o
1612 tm_file_list="options.h"
1613 tm_include_list="options.h"
1614 for f in $tm_file; do
1615   case $f in
1616     ./* )
1617        f=`echo $f | sed 's/^..//'`
1618        tm_file_list="${tm_file_list} $f"
1619        tm_include_list="${tm_include_list} $f"
1620        ;;
1621     defaults.h )
1622        tm_file_list="${tm_file_list} \$(srcdir)/$f"
1623        tm_include_list="${tm_include_list} $f"
1624        ;;
1625     * )
1626        tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
1627        tm_include_list="${tm_include_list} config/$f"
1628        ;;
1629   esac
1630 done
1632 tm_p_file_list=
1633 tm_p_include_list=
1634 for f in $tm_p_file; do
1635   case $f in
1636     tm-preds.h )
1637        tm_p_file_list="${tm_p_file_list} $f"
1638        tm_p_include_list="${tm_p_include_list} $f"
1639        ;;
1640     * )
1641        tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
1642        tm_p_include_list="${tm_p_include_list} config/$f"
1643   esac
1644 done
1646 xm_file_list=
1647 xm_include_list=
1648 for f in $xm_file; do
1649   case $f in
1650     ansidecl.h )
1651        xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
1652        xm_include_list="${xm_include_list} $f"
1653        ;;
1654     auto-host.h )
1655        xm_file_list="${xm_file_list} $f"
1656        xm_include_list="${xm_include_list} $f"
1657        ;;
1658     * )
1659        xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
1660        xm_include_list="${xm_include_list} config/$f"
1661        ;;
1662   esac
1663 done
1665 host_xm_file_list=
1666 host_xm_include_list=
1667 for f in $host_xm_file; do
1668   case $f in
1669     ansidecl.h )
1670        host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
1671        host_xm_include_list="${host_xm_include_list} $f"
1672        ;;
1673     auto-host.h )
1674        host_xm_file_list="${host_xm_file_list} $f"
1675        host_xm_include_list="${host_xm_include_list} $f"
1676        ;;
1677     * )
1678        host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
1679        host_xm_include_list="${host_xm_include_list} config/$f"
1680        ;;
1681   esac
1682 done
1684 build_xm_file_list=
1685 for f in $build_xm_file; do
1686   case $f in
1687     ansidecl.h )
1688        build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
1689        build_xm_include_list="${build_xm_include_list} $f"
1690        ;;
1691     auto-build.h | auto-host.h )
1692        build_xm_file_list="${build_xm_file_list} $f"
1693        build_xm_include_list="${build_xm_include_list} $f"
1694        ;;
1695     * )
1696        build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
1697        build_xm_include_list="${build_xm_include_list} config/$f"
1698        ;;
1699   esac
1700 done
1702 # Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
1703 # cross-compiler which does not use the native headers and libraries.
1704 # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1705 CROSS=                                          AC_SUBST(CROSS)
1706 ALL=all.internal                                AC_SUBST(ALL)
1707 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
1709 if test "x$with_build_sysroot" != x; then
1710   build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
1711 else
1712   # This value is used, even on a native system, because 
1713   # CROSS_SYSTEM_HEADER_DIR is just 
1714   # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR).
1715   build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
1718 if test x$host != x$target
1719 then
1720         CROSS="-DCROSS_DIRECTORY_STRUCTURE"
1721         ALL=all.cross
1722         SYSTEM_HEADER_DIR=$build_system_header_dir
1723         case "$host","$target" in
1724         # Darwin crosses can use the host system's libraries and headers,
1725         # because of the fat library support.  Of course, it must be the
1726         # same version of Darwin on both sides.  Allow the user to
1727         # just say --target=foo-darwin without a version number to mean
1728         # "the version on this system".
1729             *-*-darwin*,*-*-darwin*)
1730                 hostos=`echo $host | sed 's/.*-darwin/darwin/'`
1731                 targetos=`echo $target | sed 's/.*-darwin/darwin/'`
1732                 if test $hostos = $targetos -o $targetos = darwin ; then
1733                     CROSS=
1734                     SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
1735                     with_headers=yes
1736                 fi
1737                 ;;
1739             i?86-*-*,x86_64-*-* \
1740             | powerpc*-*-*,powerpc64*-*-*)
1741                 CROSS="$CROSS -DNATIVE_CROSS" ;;
1742         esac
1743 elif test "x$TARGET_SYSTEM_ROOT" != x; then
1744         SYSTEM_HEADER_DIR=$build_system_header_dir 
1747 # If this is a cross-compiler that does not
1748 # have its own set of headers then define
1749 # inhibit_libc
1751 # If this is using newlib, without having the headers available now,
1752 # then define inhibit_libc in LIBGCC2_CFLAGS.
1753 # This prevents libgcc2 from containing any code which requires libc
1754 # support.
1755 : ${inhibit_libc=false}
1756 if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
1757        test x$with_newlib = xyes ; } &&
1758      { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
1759        inhibit_libc=true
1761 AC_SUBST(inhibit_libc)
1763 # When building gcc with a cross-compiler, we need to adjust things so
1764 # that the generator programs are still built with the native compiler.
1765 # Also, we cannot run fixincludes.
1767 # These are the normal (build=host) settings:
1768 CC_FOR_BUILD='$(CC)'            AC_SUBST(CC_FOR_BUILD)
1769 BUILD_CFLAGS='$(ALL_CFLAGS)'    AC_SUBST(BUILD_CFLAGS)
1770 BUILD_LDFLAGS='$(LDFLAGS)'      AC_SUBST(BUILD_LDFLAGS)
1771 STMP_FIXINC=stmp-fixinc         AC_SUBST(STMP_FIXINC)
1773 # And these apply if build != host, or we are generating coverage data
1774 if test x$build != x$host || test "x$coverage_flags" != x
1775 then
1776     BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
1777     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
1780 # Expand extra_headers to include complete path.
1781 # This substitutes for lots of t-* files.
1782 extra_headers_list=
1783 # Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
1784 for file in ${extra_headers} ; do
1785   extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
1786 done
1788 # If use_gcc_tgmath is set, append ginclude/tgmath.h.
1789 if test x"$use_gcc_tgmath" = xyes
1790 then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
1793 # Define collect2 in Makefile.
1794 case $host_can_use_collect2 in
1795   no) collect2= ;;
1796   *) collect2='collect2$(exeext)' ;;
1797 esac
1798 AC_SUBST([collect2])
1800 # Add a definition of USE_COLLECT2 if system wants one.
1801 case $use_collect2 in
1802   no) use_collect2= ;;
1803   "") ;;
1804   *) 
1805     host_xm_defines="${host_xm_defines} USE_COLLECT2"
1806     xm_defines="${xm_defines} USE_COLLECT2"
1807     case $host_can_use_collect2 in
1808       no)
1809         AC_MSG_ERROR([collect2 is required but cannot be built on this system])
1810         ;;
1811     esac
1812     ;;
1813 esac
1815 # ---------------------------
1816 # Assembler & linker features
1817 # ---------------------------
1819 # During stage 2, ld is actually gcc/collect-ld, which is a small script to
1820 # discern between when to use prev-ld/ld-new and when to use ld/ld-new.
1821 # However when ld-new is first executed from the build tree, libtool will
1822 # relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers
1823 # to the build tree.  While doing this we need to use the previous-stage
1824 # linker, or we have an infinite loop.  The presence of a shell script as
1825 # ld/ld-new, and the fact that the script *uses ld itself*, is what confuses
1826 # the gcc/collect-ld script.  So we need to know how libtool works, or
1827 # exec-tool will fail.
1829 m4_defun([_LT_CONFIG_COMMANDS], [])
1830 AC_PROG_LIBTOOL
1831 AC_SUBST(objdir)
1832 AC_SUBST(enable_fast_install)
1834 # Identify the assembler which will work hand-in-glove with the newly
1835 # built GCC, so that we can examine its features.  This is the assembler
1836 # which will be driven by the driver program.
1838 # If build != host, and we aren't building gas in-tree, we identify a
1839 # build->target assembler and hope that it will have the same features
1840 # as the host->target assembler we'll be using.
1841 gcc_cv_gas_major_version=
1842 gcc_cv_gas_minor_version=
1843 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
1845 m4_pattern_allow([AS_FOR_TARGET])dnl
1846 AS_VAR_SET_IF(gcc_cv_as,, [
1847 if test -x "$DEFAULT_ASSEMBLER"; then
1848         gcc_cv_as="$DEFAULT_ASSEMBLER"
1849 elif test -f $gcc_cv_as_gas_srcdir/configure.in \
1850      && test -f ../gas/Makefile \
1851      && test x$build = x$host; then
1852         gcc_cv_as=../gas/as-new$build_exeext
1853 elif test -x as$build_exeext; then
1854         # Build using assembler in the current directory.
1855         gcc_cv_as=./as$build_exeext
1856 elif test -x $AS_FOR_TARGET; then
1857         gcc_cv_as="$AS_FOR_TARGET"
1858 else
1859         AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
1860 fi])
1862 ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
1863 AC_SUBST(ORIGINAL_AS_FOR_TARGET)
1864 case "$ORIGINAL_AS_FOR_TARGET" in
1865   ./as | ./as$build_exeext) ;;
1866   *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
1867 esac 
1869 AC_MSG_CHECKING(what assembler to use)
1870 if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then
1871   # Single tree build which includes gas.  We want to prefer it
1872   # over whatever linker top-level may have detected, since
1873   # we'll use what we're building after installation anyway.
1874   AC_MSG_RESULT(newly built gas)
1875   in_tree_gas=yes
1876   _gcc_COMPUTE_GAS_VERSION
1877   in_tree_gas_is_elf=no
1878   if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
1879      || (grep 'obj_format = multi' ../gas/Makefile \
1880          && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
1881   then
1882     in_tree_gas_is_elf=yes
1883   fi
1884 else
1885   AC_MSG_RESULT($gcc_cv_as)
1886   in_tree_gas=no
1889 # Identify the linker which will work hand-in-glove with the newly
1890 # built GCC, so that we can examine its features.  This is the linker
1891 # which will be driven by the driver program.
1893 # If build != host, and we aren't building gas in-tree, we identify a
1894 # build->target linker and hope that it will have the same features
1895 # as the host->target linker we'll be using.
1896 gcc_cv_gld_major_version=
1897 gcc_cv_gld_minor_version=
1898 gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
1899 gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1901 AS_VAR_SET_IF(gcc_cv_ld,, [
1902 if test -x "$DEFAULT_LINKER"; then
1903         gcc_cv_ld="$DEFAULT_LINKER"
1904 elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
1905      && test -f ../ld/Makefile \
1906      && test x$build = x$host; then
1907         gcc_cv_ld=../ld/ld-new$build_exeext
1908 elif test -x collect-ld$build_exeext; then
1909         # Build using linker in the current directory.
1910         gcc_cv_ld=./collect-ld$build_exeext
1911 elif test -x $LD_FOR_TARGET; then
1912         gcc_cv_ld="$LD_FOR_TARGET"
1913 else
1914         AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
1915 fi])
1917 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
1918 AC_SUBST(ORIGINAL_LD_FOR_TARGET)
1919 case "$ORIGINAL_LD_FOR_TARGET" in
1920   ./collect-ld | ./collect-ld$build_exeext) ;;
1921   *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
1922 esac 
1924 AC_MSG_CHECKING(what linker to use)
1925 if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext; then
1926         # Single tree build which includes ld.  We want to prefer it
1927         # over whatever linker top-level may have detected, since
1928         # we'll use what we're building after installation anyway.
1929         AC_MSG_RESULT(newly built ld)
1930         in_tree_ld=yes
1931         in_tree_ld_is_elf=no
1932         if (grep 'EMUL = .*elf' ../ld/Makefile \
1933             || grep 'EMUL = .*linux' ../ld/Makefile \
1934             || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
1935           in_tree_ld_is_elf=yes
1936         fi
1937         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
1938         do
1939 changequote(,)dnl
1940                 gcc_cv_gld_version=`sed -n -e 's/^[     ]*\(VERSION=[0-9]*\.[0-9]*.*\)/\1/p' < $f`
1941                 if test x$gcc_cv_gld_version != x; then
1942                         break
1943                 fi
1944         done
1945         gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
1946         gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1947 changequote([,])dnl
1948 else
1949         AC_MSG_RESULT($gcc_cv_ld)
1950         in_tree_ld=no
1953 # Figure out what nm we will be using.
1954 gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
1955 AS_VAR_SET_IF(gcc_cv_nm,, [
1956 if test -f $gcc_cv_binutils_srcdir/configure.in \
1957      && test -f ../binutils/Makefile \
1958      && test x$build = x$host; then
1959         gcc_cv_nm=../binutils/nm-new$build_exeext
1960 elif test -x nm$build_exeext; then
1961         gcc_cv_nm=./nm$build_exeext
1962 elif test -x $NM_FOR_TARGET; then
1963         gcc_cv_nm="$NM_FOR_TARGET"
1964 else
1965         AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
1966 fi])
1968 AC_MSG_CHECKING(what nm to use)
1969 if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
1970         # Single tree build which includes binutils.
1971         AC_MSG_RESULT(newly built nm)
1972         in_tree_nm=yes
1973 else
1974         AC_MSG_RESULT($gcc_cv_nm)
1975         in_tree_nm=no
1978 ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
1979 AC_SUBST(ORIGINAL_NM_FOR_TARGET)
1980 case "$ORIGINAL_NM_FOR_TARGET" in
1981   ./nm | ./nm$build_exeext) ;;
1982   *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;;
1983 esac
1986 # Figure out what objdump we will be using.
1987 AS_VAR_SET_IF(gcc_cv_objdump,, [
1988 if test -f $gcc_cv_binutils_srcdir/configure.in \
1989      && test -f ../binutils/Makefile \
1990      && test x$build = x$host; then
1991         # Single tree build which includes binutils.
1992         gcc_cv_objdump=../binutils/objdump$build_exeext
1993 elif test -x objdump$build_exeext; then
1994         gcc_cv_objdump=./objdump$build_exeext
1995 elif test -x $OBJDUMP_FOR_TARGET; then
1996         gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
1997 else
1998         AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
1999 fi])
2001 AC_MSG_CHECKING(what objdump to use)
2002 if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
2003         # Single tree build which includes binutils.
2004         AC_MSG_RESULT(newly built objdump)
2005 elif test x$gcc_cv_objdump = x; then
2006         AC_MSG_RESULT(not found)
2007 else
2008         AC_MSG_RESULT($gcc_cv_objdump)
2011 # Figure out what readelf we will be using.
2012 AS_VAR_SET_IF(gcc_cv_readelf,, [
2013 if test -f $gcc_cv_binutils_srcdir/configure.in \
2014      && test -f ../binutils/Makefile \
2015      && test x$build = x$host; then
2016         # Single tree build which includes binutils.
2017         gcc_cv_readelf=../binutils/readelf$build_exeext
2018 elif test -x readelf$build_exeext; then
2019         gcc_cv_readelf=./readelf$build_exeext
2020 else
2021         AC_PATH_PROG(gcc_cv_readelf, readelf)
2022 fi])
2024 AC_MSG_CHECKING(what readelf to use)
2025 if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
2026         # Single tree build which includes binutils.
2027         AC_MSG_RESULT(newly built readelf)
2028 elif test x$gcc_cv_readelf = x; then
2029         AC_MSG_RESULT(not found)
2030 else
2031         AC_MSG_RESULT($gcc_cv_readelf)
2034 # Figure out what assembler alignment features are present.
2035 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
2036  [2,6,0],,
2037 [.balign 4
2038 .p2align 2],,
2039 [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
2040   [Define if your assembler supports .balign and .p2align.])])
2042 gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
2043  [2,8,0],,
2044  [.p2align 4,,7],,
2045 [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
2046   [Define if your assembler supports specifying the maximum number
2047    of bytes to skip when using the GAS .p2align command.])])
2049 gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,
2050  [2,8,0],,
2051  [.literal16],,
2052 [AC_DEFINE(HAVE_GAS_LITERAL16, 1,
2053   [Define if your assembler supports .literal16.])])
2055 gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
2056  [elf,2,9,0],,
2057  [conftest_label1: .word 0
2058 .subsection -1
2059 conftest_label2: .word 0
2060 .previous],
2061  [if test x$gcc_cv_nm != x; then
2062     $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
2063     $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
2064     if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
2065     then :
2066     else gcc_cv_as_subsection_m1=yes
2067     fi
2068     rm -f conftest.nm1 conftest.nm2
2069   fi],
2070  [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
2071   [Define if your assembler supports .subsection and .subsection -1 starts
2072    emitting at the beginning of your section.])])
2074 gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
2075  [2,2,0],,
2076  [      .weak foobar],,
2077 [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
2079 gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
2080  [2,17,0],,
2081  [      .weakref foobar, barfnot],,
2082 [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
2084 gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
2085  [2,15,91],,
2086  [      .SPACE $TEXT$
2087         .NSUBSPA $CODE$,COMDAT],,
2088 [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
2090 # .hidden needs to be supported in both the assembler and the linker,
2091 # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
2092 # This is irritatingly difficult to feature test for; we have to check the
2093 # date string after the version number.  If we've got an in-tree
2094 # ld, we don't know its patchlevel version, so we set the baseline at 2.13
2095 # to be safe.
2096 # The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
2097 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
2098  [elf,2,13,0],,
2099 [       .hidden foobar
2100 foobar:])
2102 AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
2103 [if test $in_tree_ld = yes ; then
2104   gcc_cv_ld_hidden=no
2105   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 \
2106      && test $in_tree_ld_is_elf = yes; then
2107      gcc_cv_ld_hidden=yes
2108   fi
2109 else
2110 changequote(,)dnl
2111   gcc_cv_ld_hidden=yes
2112   ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
2113   if echo "$ld_ver" | grep GNU > /dev/null; then
2114     ld_vers=`echo $ld_ver | sed -n \
2115         -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
2116     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'`
2117     ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2118     ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2119     ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
2120     if test 0"$ld_date" -lt 20020404; then
2121       if test -n "$ld_date"; then
2122         # If there was date string, but was earlier than 2002-04-04, fail
2123         gcc_cv_ld_hidden=no
2124       elif test -z "$ld_vers"; then
2125         # If there was no date string nor ld version number, something is wrong
2126         gcc_cv_ld_hidden=no
2127       else
2128         test -z "$ld_vers_patch" && ld_vers_patch=0
2129         if test "$ld_vers_major" -lt 2; then
2130           gcc_cv_ld_hidden=no
2131         elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
2132           gcc_cv_ld_hidden="no"
2133         elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
2134           gcc_cv_ld_hidden=no
2135         fi
2136       fi
2137     fi
2138   else
2139     case "${target}" in
2140       hppa64*-*-hpux* | ia64*-*-hpux*)
2141         gcc_cv_ld_hidden=yes
2142         ;;
2143       *-*-solaris2.9* | *-*-solaris2.1[0-9]*)
2144         gcc_cv_ld_hidden=yes
2145         ;;
2146       *)
2147         gcc_cv_ld_hidden=no
2148         ;;
2149     esac
2150   fi
2151 changequote([,])dnl
2152 fi])
2153 libgcc_visibility=no
2154 AC_SUBST(libgcc_visibility)
2155 GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
2156 if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
2157   libgcc_visibility=yes
2158   AC_DEFINE(HAVE_GAS_HIDDEN, 1,
2159   [Define if your assembler and linker support .hidden.])
2162 AC_MSG_CHECKING(linker read-only and read-write section mixing)
2163 gcc_cv_ld_ro_rw_mix=unknown
2164 if test $in_tree_ld = yes ; then
2165   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 \
2166      && test $in_tree_ld_is_elf = yes; then
2167     gcc_cv_ld_ro_rw_mix=read-write
2168   fi
2169 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
2170   echo '.section myfoosect, "a"' > conftest1.s
2171   echo '.section myfoosect, "aw"' > conftest2.s
2172   echo '.byte 1' >> conftest2.s
2173   echo '.section myfoosect, "a"' > conftest3.s
2174   echo '.byte 0' >> conftest3.s
2175   if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
2176      && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
2177      && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
2178      && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
2179         conftest2.o conftest3.o > /dev/null 2>&1; then
2180     gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
2181                          | sed -e '/myfoosect/!d' -e N`
2182     if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
2183       if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
2184         gcc_cv_ld_ro_rw_mix=read-only
2185       else
2186         gcc_cv_ld_ro_rw_mix=read-write
2187       fi
2188     fi
2189   fi
2190 changequote(,)dnl
2191   rm -f conftest.* conftest[123].*
2192 changequote([,])dnl
2194 if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
2195         AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
2196   [Define if your linker links a mix of read-only
2197    and read-write sections into a read-write section.])
2199 AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
2201 # Check if we have .[us]leb128, and support symbol arithmetic with it.
2202 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
2203   [elf,2,11,0],,
2204 [       .data
2205         .uleb128 L2 - L1
2207         .uleb128 1280
2208         .sleb128 -1010
2209 L2:],
2210  [# GAS versions before 2.11 do not support uleb128,
2211   # despite appearing to.
2212   # ??? There exists an elf-specific test that will crash
2213   # the assembler.  Perhaps it's better to figure out whether
2214   # arbitrary sections are supported and try the test.
2215   as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
2216   if echo "$as_ver" | grep GNU > /dev/null; then
2217 changequote(,)dnl
2218     as_vers=`echo $as_ver | sed -n \
2219         -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
2220     as_major=`expr "$as_vers" : '\([0-9]*\)'`
2221     as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'`
2222 changequote([,])dnl
2223     if test $as_major -eq 2 && test $as_minor -lt 11
2224     then :
2225     else gcc_cv_as_leb128=yes
2226     fi
2227   fi],
2228   [AC_DEFINE(HAVE_AS_LEB128, 1,
2229     [Define if your assembler supports .sleb128 and .uleb128.])])
2231 # Check if we have assembler support for unwind directives.
2232 gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
2233   ,,
2234 [       .text
2235         .cfi_startproc
2236         .cfi_offset 0, 0
2237         .cfi_same_value 1
2238         .cfi_def_cfa 1, 2
2239         .cfi_escape 1, 2, 3, 4, 5
2240         .cfi_endproc],
2241 [case "$target" in
2242   *-*-solaris*)
2243     # If the linker used on Solaris (like Sun ld) isn't capable of merging
2244     # read-only and read-write sections, we need to make sure that the
2245     # assembler used emits read-write .eh_frame sections.
2246     if test "x$gcc_cv_ld_ro_rw_mix" != xread-write; then
2247       if test "x$gcc_cv_objdump" != x; then
2248         if $gcc_cv_objdump -h conftest.o 2>/dev/null | \
2249                 sed -e /.eh_frame/!d -e N | grep READONLY > /dev/null; then
2250           gcc_cv_as_cfi_directive=no
2251         else
2252           gcc_cv_as_cfi_directive=yes
2253         fi
2254       else
2255         # no objdump, err on the side of caution
2256         gcc_cv_as_cfi_directive=no
2257       fi
2258     else
2259       gcc_cv_as_cfi_directive=yes
2260     fi
2261     ;;
2262   *-*-*)
2263     gcc_cv_as_cfi_directive=yes
2264     ;;
2265 esac])
2266 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_readelf != x; then
2267 gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
2268   ,,
2269 [       .text
2270         .cfi_startproc
2271         .cfi_adjust_cfa_offset 64
2272         .skip 512, 0
2273         .cfi_adjust_cfa_offset 128
2274         .cfi_endproc],
2276 changequote(,)dnl
2277 if $gcc_cv_readelf -wf conftest.o 2>/dev/null \
2278     | grep 'DW_CFA_advance_loc[12]:[    ][      ]*512[  ]' >/dev/null; then
2279    gcc_cv_as_cfi_advance_working=yes
2281 changequote([,])dnl
2283 else
2284   # no readelf, err on the side of caution
2285   gcc_cv_as_cfi_advance_working=no
2287 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
2288   [`if test $gcc_cv_as_cfi_directive = yes \
2289        && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`],
2290   [Define 0/1 if your assembler supports CFI directives.])
2292 gcc_GAS_CHECK_FEATURE([cfi personality directive],
2293   gcc_cv_as_cfi_personality_directive, ,,
2294 [       .text
2295         .cfi_startproc
2296         .cfi_personality 0, symbol
2297         .cfi_endproc])
2298 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
2299   [`if test $gcc_cv_as_cfi_personality_directive = yes;
2300     then echo 1; else echo 0; fi`],
2301   [Define 0/1 if your assembler supports .cfi_personality.])
2303 # GAS versions up to and including 2.11.0 may mis-optimize
2304 # .eh_frame data.
2305 gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
2306   [elf,2,12,0],,
2307 [       .text
2308 .LFB1:
2309         .4byte  0
2310 .L1:
2311         .4byte  0
2312 .LFE1:
2313         .section        .eh_frame,"aw",@progbits
2314 __FRAME_BEGIN__:
2315         .4byte  .LECIE1-.LSCIE1
2316 .LSCIE1:
2317         .4byte  0x0
2318         .byte   0x1
2319         .ascii "z\0"
2320         .byte   0x1
2321         .byte   0x78
2322         .byte   0x1a
2323         .byte   0x0
2324         .byte   0x4
2325         .4byte  1
2326         .p2align 1
2327 .LECIE1:
2328 .LSFDE1:
2329         .4byte  .LEFDE1-.LASFDE1
2330 .LASFDE1:
2331         .4byte  .LASFDE1-__FRAME_BEGIN__
2332         .4byte  .LFB1
2333         .4byte  .LFE1-.LFB1
2334         .byte   0x4
2335         .4byte  .LFE1-.LFB1
2336         .byte   0x4
2337         .4byte  .L1-.LFB1
2338 .LEFDE1:],
2339 [  dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
2340 cat > conftest.lit <<EOF
2341  0000 10000000 00000000 017a0001 781a0004  .........z..x...
2342  0010 01000000 12000000 18000000 00000000  ................
2343  0020 08000000 04080000 0044               .........D      @&t@
2345 cat > conftest.big <<EOF
2346  0000 00000010 00000000 017a0001 781a0004  .........z..x...
2347  0010 00000001 00000012 00000018 00000000  ................
2348  0020 00000008 04000000 0844               .........D      @&t@
2350   # If the assembler didn't choke, and we can objdump,
2351   # and we got the correct data, then succeed.
2352   # The text in the here-document typically retains its unix-style line
2353   # endings, while the output of objdump will use host line endings.
2354   # Therefore, use diff -b for the comparisons.
2355   if test x$gcc_cv_objdump != x \
2356   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
2357      | tail -3 > conftest.got \
2358   && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \
2359     || diff -b conftest.big conftest.got > /dev/null 2>&1; }
2360   then
2361     gcc_cv_as_eh_frame=yes
2362   elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
2363     gcc_cv_as_eh_frame=buggy
2364   else
2365     # Uh oh, what do we do now?
2366     gcc_cv_as_eh_frame=no
2367   fi])
2369 if test $gcc_cv_as_eh_frame = buggy; then
2370   AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
2371   [Define if your assembler mis-optimizes .eh_frame data.])
2374 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2375  [elf,2,12,0], [--fatal-warnings],
2376  [.section .rodata.str, "aMS", @progbits, 1])
2377 if test $gcc_cv_as_shf_merge = no; then
2378   gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2379     [elf,2,12,0], [--fatal-warnings],
2380     [.section .rodata.str, "aMS", %progbits, 1])
2382 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2383   [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2384 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
2386 gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
2387  [elf,2,16,0], [--fatal-warnings],
2388  [.section .text,"axG",@progbits,.foo,comdat])
2389 if test $gcc_cv_as_comdat_group = yes; then
2390   gcc_cv_as_comdat_group_percent=no
2391 else
2392  gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
2393    [elf,2,16,0], [--fatal-warnings],
2394    [.section .text,"axG",%progbits,.foo,comdat])
2396 if test $in_tree_ld = yes ; then
2397   comdat_group=no
2398   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 \
2399      && test $in_tree_ld_is_elf = yes; then
2400      comdat_group=yes
2401   fi
2402 elif test x"$ld_vers" != x; then
2403   comdat_group=yes
2404   if test 0"$ld_date" -lt 20050308; then
2405     if test -n "$ld_date"; then
2406       # If there was date string, but was earlier than 2005-03-08, fail
2407       comdat_group=no
2408     elif test "$ld_vers_major" -lt 2; then
2409       comdat_group=no
2410     elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
2411       comdat_group=no
2412     fi
2413   fi
2414 else
2415   # assume linkers other than GNU ld don't support COMDAT group
2416   comdat_group=no
2418 if test $comdat_group = no; then
2419   gcc_cv_as_comdat_group=no
2420   gcc_cv_as_comdat_group_percent=no
2422 AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
2423   [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
2424 [Define 0/1 if your assembler and linker support COMDAT groups.])
2426 gcc_GAS_CHECK_FEATURE([line table discriminator support],
2427  gcc_cv_as_discriminator,
2428  [2,19,51],,
2429 [       .text
2430         .file 1 "conf.c"
2431         .loc 1 1 0 discriminator 1],,
2432 [AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1,
2433   [Define if your assembler supports the .loc discriminator sub-directive.])])
2435 # Thread-local storage - the check is heavily parameterized.
2436 conftest_s=
2437 tls_first_major=
2438 tls_first_minor=
2439 tls_as_opt=
2440 case "$target" in
2441 changequote(,)dnl
2442   alpha*-*-*)
2443     conftest_s='
2444         .section ".tdata","awT",@progbits
2445 foo:    .long   25
2446         .text
2447         ldq     $27,__tls_get_addr($29)         !literal!1
2448         lda     $16,foo($29)                    !tlsgd!1
2449         jsr     $26,($27),__tls_get_addr        !lituse_tlsgd!1
2450         ldq     $27,__tls_get_addr($29)         !literal!2
2451         lda     $16,foo($29)                    !tlsldm!2
2452         jsr     $26,($27),__tls_get_addr        !lituse_tlsldm!2
2453         ldq     $1,foo($29)                     !gotdtprel
2454         ldah    $2,foo($29)                     !dtprelhi
2455         lda     $3,foo($2)                      !dtprello
2456         lda     $4,foo($29)                     !dtprel
2457         ldq     $1,foo($29)                     !gottprel
2458         ldah    $2,foo($29)                     !tprelhi
2459         lda     $3,foo($2)                      !tprello
2460         lda     $4,foo($29)                     !tprel'
2461         tls_first_major=2
2462         tls_first_minor=13
2463         tls_as_opt=--fatal-warnings
2464         ;;
2465   cris-*-*|crisv32-*-*)
2466     conftest_s='
2467         .section ".tdata","awT",@progbits
2468 x:      .long   25
2469         .text
2470         move.d x:IE,$r10
2471         nop'
2472         tls_first_major=2
2473         tls_first_minor=20
2474         tls_as_opt=--fatal-warnings
2475         ;;
2476   frv*-*-*)
2477     conftest_s='
2478         .section ".tdata","awT",@progbits
2479 x:      .long   25
2480         .text
2481         call    #gettlsoff(x)'
2482         tls_first_major=2
2483         tls_first_minor=14
2484         ;;
2485   hppa*-*-linux*)
2486     conftest_s='
2487 t1:     .reg    %r20
2488 t2:     .reg    %r21
2489 gp:     .reg    %r19
2490         .section ".tdata","awT",@progbits
2491 foo:    .long   25
2492         .text
2493         .align  4
2494         addil LT%foo-$tls_gdidx$,gp
2495         ldo RT%foo-$tls_gdidx$(%r1),%arg0
2496         b __tls_get_addr
2497         nop             
2498         addil LT%foo-$tls_ldidx$,gp
2499         b __tls_get_addr
2500         ldo RT%foo-$tls_ldidx$(%r1),%arg0
2501         addil LR%foo-$tls_dtpoff$,%ret0
2502         ldo RR%foo-$tls_dtpoff$(%r1),%t1
2503         mfctl %cr27,%t1                 
2504         addil LT%foo-$tls_ieoff$,gp
2505         ldw RT%foo-$tls_ieoff$(%r1),%t2
2506         add %t1,%t2,%t3                 
2507         mfctl %cr27,%t1                 
2508         addil LR%foo-$tls_leoff$,%t1
2509         ldo RR%foo-$tls_leoff$(%r1),%t2'
2510         tls_first_major=2
2511         tls_first_minor=15
2512         tls_as_opt=--fatal-warnings
2513         ;;
2514   arm*-*-*)
2515     conftest_s='
2516         .section ".tdata","awT",%progbits
2517 foo:    .long   25
2518         .text
2519 .word foo(gottpoff)
2520 .word foo(tpoff)
2521 .word foo(tlsgd)
2522 .word foo(tlsldm)
2523 .word foo(tlsldo)'
2524         tls_first_major=2
2525         tls_first_minor=17
2526         ;;
2527   i[34567]86-*-*)
2528     conftest_s='
2529         .section ".tdata","awT",@progbits
2530 foo:    .long   25
2531         .text
2532         movl    %gs:0, %eax
2533         leal    foo@TLSGD(,%ebx,1), %eax
2534         leal    foo@TLSLDM(%ebx), %eax
2535         leal    foo@DTPOFF(%eax), %edx
2536         movl    foo@GOTTPOFF(%ebx), %eax
2537         subl    foo@GOTTPOFF(%ebx), %eax
2538         addl    foo@GOTNTPOFF(%ebx), %eax
2539         movl    foo@INDNTPOFF, %eax
2540         movl    $foo@TPOFF, %eax
2541         subl    $foo@TPOFF, %eax
2542         leal    foo@NTPOFF(%ecx), %eax'
2543         tls_first_major=2
2544         tls_first_minor=14
2545         tls_as_opt=--fatal-warnings
2546         ;;
2547   x86_64-*-*)
2548     conftest_s='
2549         .section ".tdata","awT",@progbits
2550 foo:    .long   25
2551         .text
2552         movq    %fs:0, %rax
2553         leaq    foo@TLSGD(%rip), %rdi
2554         leaq    foo@TLSLD(%rip), %rdi
2555         leaq    foo@DTPOFF(%rax), %rdx
2556         movq    foo@GOTTPOFF(%rip), %rax
2557         movq    $foo@TPOFF, %rax'
2558         tls_first_major=2
2559         tls_first_minor=14
2560         tls_as_opt=--fatal-warnings
2561         ;;
2562   ia64-*-*)
2563     conftest_s='
2564         .section ".tdata","awT",@progbits
2565 foo:    data8   25
2566         .text
2567         addl    r16 = @ltoff(@dtpmod(foo#)), gp
2568         addl    r17 = @ltoff(@dtprel(foo#)), gp
2569         addl    r18 = @ltoff(@tprel(foo#)), gp
2570         addl    r19 = @dtprel(foo#), gp
2571         adds    r21 = @dtprel(foo#), r13
2572         movl    r23 = @dtprel(foo#)
2573         addl    r20 = @tprel(foo#), gp
2574         adds    r22 = @tprel(foo#), r13
2575         movl    r24 = @tprel(foo#)'
2576         tls_first_major=2
2577         tls_first_minor=13
2578         tls_as_opt=--fatal-warnings
2579         ;;
2580   mips*-*-*)
2581     conftest_s='
2582         .section .tdata,"awT",@progbits
2584         .word 2
2585         .text
2586         addiu $4, $28, %tlsgd(x)
2587         addiu $4, $28, %tlsldm(x)
2588         lui $4, %dtprel_hi(x)
2589         addiu $4, $4, %dtprel_lo(x)
2590         lw $4, %gottprel(x)($28)
2591         lui $4, %tprel_hi(x)
2592         addiu $4, $4, %tprel_lo(x)'
2593         tls_first_major=2
2594         tls_first_minor=16
2595         tls_as_opt='-32 --fatal-warnings'
2596         ;;
2597   m68k-*-*)
2598     conftest_s='
2599         .section .tdata,"awT",@progbits
2601         .word 2
2602         .text
2603 foo:
2604         move.l x@TLSGD(%a5),%a0
2605         move.l x@TLSLDM(%a5),%a0
2606         move.l x@TLSLDO(%a5),%a0
2607         move.l x@TLSIE(%a5),%a0
2608         move.l x@TLSLE(%a5),%a0'
2609         tls_first_major=2
2610         tls_first_minor=19
2611         tls_as_opt='--fatal-warnings'
2612         ;;
2613   powerpc-*-*)
2614     conftest_s='
2615         .section ".tdata","awT",@progbits
2616         .align 2
2617 ld0:    .space 4
2618 ld1:    .space 4
2619 x1:     .space 4
2620 x2:     .space 4
2621 x3:     .space 4
2622         .text
2623         addi 3,31,ld0@got@tlsgd
2624         bl __tls_get_addr
2625         addi 3,31,x1@got@tlsld
2626         bl __tls_get_addr
2627         addi 9,3,x1@dtprel
2628         addis 9,3,x2@dtprel@ha
2629         addi 9,9,x2@dtprel@l
2630         lwz 9,x3@got@tprel(31)
2631         add 9,9,x@tls
2632         addi 9,2,x1@tprel
2633         addis 9,2,x2@tprel@ha
2634         addi 9,9,x2@tprel@l'
2635         tls_first_major=2
2636         tls_first_minor=14
2637         tls_as_opt="-a32 --fatal-warnings"
2638         ;;
2639   powerpc64-*-*)
2640     conftest_s='
2641         .section ".tdata","awT",@progbits
2642         .align 3
2643 ld0:    .space 8
2644 ld1:    .space 8
2645 x1:     .space 8
2646 x2:     .space 8
2647 x3:     .space 8
2648         .text
2649         addi 3,2,ld0@got@tlsgd
2650         bl .__tls_get_addr
2651         nop
2652         addi 3,2,ld1@toc
2653         bl .__tls_get_addr
2654         nop
2655         addi 3,2,x1@got@tlsld
2656         bl .__tls_get_addr
2657         nop
2658         addi 9,3,x1@dtprel
2659         bl .__tls_get_addr
2660         nop
2661         addis 9,3,x2@dtprel@ha
2662         addi 9,9,x2@dtprel@l
2663         bl .__tls_get_addr
2664         nop
2665         ld 9,x3@got@dtprel(2)
2666         add 9,9,3
2667         bl .__tls_get_addr
2668         nop'
2669         tls_first_major=2
2670         tls_first_minor=14
2671         tls_as_opt="-a64 --fatal-warnings"
2672         ;;
2673   s390-*-*)
2674     conftest_s='
2675         .section ".tdata","awT",@progbits
2676 foo:    .long   25
2677         .text
2678         .long   foo@TLSGD
2679         .long   foo@TLSLDM
2680         .long   foo@DTPOFF
2681         .long   foo@NTPOFF
2682         .long   foo@GOTNTPOFF
2683         .long   foo@INDNTPOFF
2684         l       %r1,foo@GOTNTPOFF(%r12)
2685         l       %r1,0(%r1):tls_load:foo
2686         bas     %r14,0(%r1,%r13):tls_gdcall:foo
2687         bas     %r14,0(%r1,%r13):tls_ldcall:foo'
2688         tls_first_major=2
2689         tls_first_minor=14
2690         tls_as_opt="-m31 --fatal-warnings"
2691         ;;
2692   s390x-*-*)
2693     conftest_s='
2694         .section ".tdata","awT",@progbits
2695 foo:    .long   25
2696         .text
2697         .quad   foo@TLSGD
2698         .quad   foo@TLSLDM
2699         .quad   foo@DTPOFF
2700         .quad   foo@NTPOFF
2701         .quad   foo@GOTNTPOFF
2702         lg      %r1,foo@GOTNTPOFF(%r12)
2703         larl    %r1,foo@INDNTPOFF
2704         brasl   %r14,__tls_get_offset@PLT:tls_gdcall:foo
2705         brasl   %r14,__tls_get_offset@PLT:tls_ldcall:foo'
2706         tls_first_major=2
2707         tls_first_minor=14
2708         tls_as_opt="-m64 -Aesame --fatal-warnings"
2709         ;;
2710   sh-*-* | sh[34]-*-*)
2711     conftest_s='
2712         .section ".tdata","awT",@progbits
2713 foo:    .long   25
2714         .text
2715         .long   foo@TLSGD
2716         .long   foo@TLSLDM
2717         .long   foo@DTPOFF
2718         .long   foo@GOTTPOFF
2719         .long   foo@TPOFF'
2720         tls_first_major=2
2721         tls_first_minor=13
2722         tls_as_opt=--fatal-warnings
2723         ;;
2724   sparc*-*-*)
2725     case "$target" in
2726       sparc*-sun-solaris2.[56789]*)
2727         # TLS was introduced in the Solaris 9 4/04 release but
2728         # we do not enable it by default on Solaris 9 either.
2729         if test "x$enable_tls" = xyes ; then
2730           on_solaris=yes
2731         else
2732           enable_tls=no;
2733         fi
2734         ;;
2735       sparc*-sun-solaris2.*)
2736         on_solaris=yes
2737         ;;
2738       *)
2739         on_solaris=no
2740         ;;
2741     esac
2742     if test x$on_solaris = xyes && test x$gas_flag = xno; then
2743       conftest_s='
2744         .section ".tdata",#alloc,#write,#tls
2745 foo:    .long   25
2746         .text
2747         sethi   %tgd_hi22(foo), %o0
2748         add     %o0, %tgd_lo10(foo), %o1
2749         add     %l7, %o1, %o0, %tgd_add(foo)
2750         call    __tls_get_addr, %tgd_call(foo)
2751         sethi   %tldm_hi22(foo), %l1
2752         add     %l1, %tldm_lo10(foo), %l2
2753         add     %l7, %l2, %o0, %tldm_add(foo)
2754         call    __tls_get_addr, %tldm_call(foo)
2755         sethi   %tldo_hix22(foo), %l3
2756         xor     %l3, %tldo_lox10(foo), %l4
2757         add     %o0, %l4, %l5, %tldo_add(foo)
2758         sethi   %tie_hi22(foo), %o3
2759         add     %o3, %tie_lo10(foo), %o3
2760         ld      [%l7 + %o3], %o2, %tie_ld(foo)
2761         add     %g7, %o2, %o4, %tie_add(foo)
2762         sethi   %tle_hix22(foo), %l1
2763         xor     %l1, %tle_lox10(foo), %o5
2764         ld      [%g7 + %o5], %o1'
2765         tls_first_major=0
2766         tls_first_minor=0
2767     else
2768       conftest_s='
2769         .section ".tdata","awT",@progbits
2770 foo:    .long   25
2771         .text
2772         sethi   %tgd_hi22(foo), %o0
2773         add     %o0, %tgd_lo10(foo), %o1
2774         add     %l7, %o1, %o0, %tgd_add(foo)
2775         call    __tls_get_addr, %tgd_call(foo)
2776         sethi   %tldm_hi22(foo), %l1
2777         add     %l1, %tldm_lo10(foo), %l2
2778         add     %l7, %l2, %o0, %tldm_add(foo)
2779         call    __tls_get_addr, %tldm_call(foo)
2780         sethi   %tldo_hix22(foo), %l3
2781         xor     %l3, %tldo_lox10(foo), %l4
2782         add     %o0, %l4, %l5, %tldo_add(foo)
2783         sethi   %tie_hi22(foo), %o3
2784         add     %o3, %tie_lo10(foo), %o3
2785         ld      [%l7 + %o3], %o2, %tie_ld(foo)
2786         add     %g7, %o2, %o4, %tie_add(foo)
2787         sethi   %tle_hix22(foo), %l1
2788         xor     %l1, %tle_lox10(foo), %o5
2789         ld      [%g7 + %o5], %o1'
2790         tls_first_major=2
2791         tls_first_minor=14
2792         tls_as_opt="-32 --fatal-warnings"
2793       fi
2794         ;;
2795   xtensa*-*-*)
2796     conftest_s='
2797         .section ".tdata","awT",@progbits
2798 foo:    .long   25
2799         .text
2800         movi    a8, foo@TLSFUNC
2801         movi    a10, foo@TLSARG
2802         callx8.tls a8, foo@TLSCALL'
2803         tls_first_major=2
2804         tls_first_minor=19
2805         ;;
2806 changequote([,])dnl
2807 esac
2808 set_have_as_tls=no
2809 if test "x$enable_tls" = xno ; then
2810   : # TLS explicitly disabled.
2811 elif test "x$enable_tls" = xyes ; then
2812   set_have_as_tls=yes # TLS explicitly enabled.
2813 elif test -z "$tls_first_major"; then
2814   : # If we don't have a check, assume no support.
2815 else
2816   gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
2817   [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
2818   [set_have_as_tls=yes])
2820 if test $set_have_as_tls = yes ; then
2821   AC_DEFINE(HAVE_AS_TLS, 1,
2822             [Define if your assembler supports thread-local storage.])
2825 # Target-specific assembler checks.
2827 AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
2828 gcc_cv_ld_static_dynamic=no
2829 if test $in_tree_ld = yes ; then
2830   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
2831     gcc_cv_ld_static_dynamic=yes
2832   fi
2833 elif test x$gcc_cv_ld != x; then
2834         # Check if linker supports -Bstatic/-Bdynamic option
2835         if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
2836           && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
2837                 gcc_cv_ld_static_dynamic=yes
2838         fi
2840 if test x"$gcc_cv_ld_static_dynamic" = xyes; then
2841         AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
2842 [Define if your linker supports -Bstatic/-Bdynamic option.])
2844 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
2846 if test x"$demangler_in_ld" = xyes; then
2847   AC_MSG_CHECKING(linker --demangle support)
2848   gcc_cv_ld_demangle=no
2849   if test $in_tree_ld = yes; then
2850     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 \
2851       gcc_cv_ld_demangle=yes
2852     fi
2853   elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
2854     # Check if the GNU linker supports --demangle option
2855     if $gcc_cv_ld --help 2>/dev/null | grep no-demangle > /dev/null; then
2856       gcc_cv_ld_demangle=yes
2857     fi
2858   fi
2859   if test x"$gcc_cv_ld_demangle" = xyes; then
2860     AC_DEFINE(HAVE_LD_DEMANGLE, 1,
2861 [Define if your linker supports --demangle option.])
2862   fi
2863   AC_MSG_RESULT($gcc_cv_ld_demangle)
2866 case "$target" in
2867   # All TARGET_ABI_OSF targets.
2868   alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
2869     gcc_GAS_CHECK_FEATURE([explicit relocation support],
2870         gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
2871 [       .set nomacro
2872         .text
2873         extbl   $3, $2, $3      !lituse_bytoff!1
2874         ldq     $2, a($29)      !literal!1
2875         ldq     $4, b($29)      !literal!2
2876         ldq_u   $3, 0($2)       !lituse_base!1
2877         ldq     $27, f($29)     !literal!5
2878         jsr     $26, ($27), f   !lituse_jsr!5
2879         ldah    $29, 0($26)     !gpdisp!3
2880         lda     $0, c($29)      !gprel
2881         ldah    $1, d($29)      !gprelhigh
2882         lda     $1, d($1)       !gprellow
2883         lda     $29, 0($29)     !gpdisp!3],,
2884     [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
2885   [Define if your assembler supports explicit relocations.])])
2886     gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
2887         gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
2888 [       .set nomacro
2889         .text
2890         ldq     $27, a($29)     !literal!1
2891         jsr     $26, ($27), a   !lituse_jsrdirect!1],,
2892     [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
2893   [Define if your assembler supports the lituse_jsrdirect relocation.])])
2894     ;;
2896   cris-*-*)
2897     gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
2898       gcc_cv_as_cris_no_mul_bug,[2,15,91],
2899       [-no-mul-bug-abort], [.text],,
2900       [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
2901                 [Define if your assembler supports the -no-mul-bug-abort option.])])
2902     ;;
2904   sparc*-*-*)
2905     gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
2906       [.register %g2, #scratch],,
2907       [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
2908                 [Define if your assembler supports .register.])])
2910     gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
2911       [-relax], [.text],,
2912       [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
2913                 [Define if your assembler supports -relax option.])])
2915     gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
2916       gcc_cv_as_sparc_ua_pcrel,,
2917       [-K PIC],
2918 [.text
2919 foo:
2920         nop
2921 .data
2922 .align 4
2923 .byte 0
2924 .uaword %r_disp32(foo)],
2925       [if test x$gcc_cv_ld != x \
2926        && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
2927          gcc_cv_as_sparc_ua_pcrel=yes
2928        fi
2929        rm -f conftest],
2930       [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
2931                 [Define if your assembler and linker support unaligned PC relative relocs.])
2933       gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
2934         gcc_cv_as_sparc_ua_pcrel_hidden,,
2935         [-K PIC],
2936 [.data
2937 .align 4
2938 .byte 0x31
2939 .uaword %r_disp32(foo)
2940 .byte 0x32, 0x33, 0x34
2941 .global foo
2942 .hidden foo
2943 foo:
2944 .skip 4],
2945         [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
2946          && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
2947          && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
2948             | grep ' 31000000 07323334' > /dev/null 2>&1; then
2949             if $gcc_cv_objdump -R conftest 2> /dev/null \
2950                | grep 'DISP32' > /dev/null 2>&1; then
2951                 :
2952             else
2953                 gcc_cv_as_sparc_ua_pcrel_hidden=yes
2954             fi
2955          fi
2956          rm -f conftest],
2957          [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
2958                    [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
2959     ]) # unaligned pcrel relocs
2961     gcc_GAS_CHECK_FEATURE([offsetable %lo()],
2962       gcc_cv_as_sparc_offsetable_lo10,,
2963       [-xarch=v9],
2964 [.text
2965         or %g1, %lo(ab) + 12, %g1
2966         or %g1, %lo(ab + 12), %g1],
2967       [if test x$gcc_cv_objdump != x \
2968        && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
2969           | grep ' 82106000 82106000' > /dev/null 2>&1; then
2970          gcc_cv_as_sparc_offsetable_lo10=yes
2971        fi],
2972        [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
2973                  [Define if your assembler supports offsetable %lo().])])
2974     ;;
2976 changequote(,)dnl
2977   i[34567]86-*-* | x86_64-*-*)
2978 changequote([,])dnl
2979     case $target_os in
2980       cygwin* | pe | mingw32*)
2981         # Recent binutils allows the three-operand form of ".comm" on PE.  This
2982         # definition is used unconditionally to initialise the default state of
2983         # the target option variable that governs usage of the feature.
2984         gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,
2985          [2,19,52],,[.comm foo,1,32])
2986         AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
2987           [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
2988           [Define if your assembler supports specifying the alignment
2989            of objects allocated using the GAS .comm command.])
2990         # Used for DWARF 2 in PE
2991         gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
2992           gcc_cv_as_ix86_pe_secrel32,
2993           [2,15,91],,
2994 [.text
2995 foo:    nop
2996 .data
2997         .secrel32 foo],
2998           [if test x$gcc_cv_ld != x \
2999            && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
3000              gcc_cv_as_ix86_pe_secrel32=yes
3001            fi
3002            rm -f conftest],
3003           [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
3004             [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
3005         ;;
3006     esac
3008     gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
3009        gcc_cv_as_ix86_filds,,,
3010        [filds mem; fists mem],,
3011        [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
3012          [Define if your assembler uses filds and fists mnemonics.])])
3014     gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
3015        gcc_cv_as_ix86_fildq,,,
3016        [fildq mem; fistpq mem],,
3017        [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
3018          [Define if your assembler uses fildq and fistq mnemonics.])])
3020     gcc_GAS_CHECK_FEATURE([cmov syntax],
3021       gcc_cv_as_ix86_cmov_sun_syntax,,,
3022       [cmovl.l %edx, %eax],,
3023       [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
3024         [Define if your assembler supports the Sun syntax for cmov.])])
3026     gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
3027       gcc_cv_as_ix86_ffreep,,,
3028       [ffreep %st(1)],,
3029       [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
3030         [Define if your assembler supports the ffreep mnemonic.])])
3032     gcc_GAS_CHECK_FEATURE([sahf mnemonic],
3033       gcc_cv_as_ix86_sahf,,,
3034       [sahf],,
3035       [AC_DEFINE(HAVE_AS_IX86_SAHF, 1,
3036         [Define if your assembler supports the sahf mnemonic.])])
3038     gcc_GAS_CHECK_FEATURE([different section symbol subtraction],
3039       gcc_cv_as_ix86_diff_sect_delta,,,
3040       [.section .rodata
3041 .L1:
3042         .long .L2-.L1
3043         .long .L3-.L1
3044         .text
3045 .L3:    nop
3046 .L2:    nop],,
3047       [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1,
3048         [Define if your assembler supports the subtraction of symbols in different sections.])])
3050     # This one is used unconditionally by i386.[ch]; it is to be defined
3051     # to 1 if the feature is present, 0 otherwise.
3052     gcc_GAS_CHECK_FEATURE([GOTOFF in data],
3053         gcc_cv_as_ix86_gotoff_in_data, [2,11,0],,
3054 [       .text
3055 .L0:
3056         nop
3057         .data
3058         .long .L0@GOTOFF])
3059     AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
3060       [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
3061       [Define true if the assembler supports '.long foo@GOTOFF'.])
3062     ;;
3064   ia64*-*-*)
3065     gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
3066         gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
3067 [       .text
3068         addl r15 = @ltoffx(x#), gp
3069         ;;
3070         ld8.mov r16 = [[r15]], x#],,
3071     [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
3072           [Define if your assembler supports ltoffx and ldxmov relocations.])])
3074     ;;
3076   powerpc*-*-*)
3077     case $target in
3078       *-*-aix*) conftest_s='    .machine "pwr5"
3079         .csect .text[[PR]]
3080         mfcr 3,128';;
3081       *-*-darwin*)
3082         gcc_GAS_CHECK_FEATURE([.machine directive support],
3083           gcc_cv_as_machine_directive,,,
3084           [     .machine ppc7400])
3085         if test x$gcc_cv_as_machine_directive != xyes; then
3086           echo "*** This target requires an assembler supporting \".machine\"" >&2
3087           echo you can get it from: ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
3088           test x$build = x$target && exit 1
3089         fi
3090         conftest_s='    .text
3091         mfcr r3,128';;
3092       *) conftest_s='   .machine power4
3093         .text
3094         mfcr 3,128';;
3095     esac
3097     gcc_GAS_CHECK_FEATURE([mfcr field support],
3098       gcc_cv_as_powerpc_mfcrf, [2,14,0],,
3099       [$conftest_s],,
3100       [AC_DEFINE(HAVE_AS_MFCRF, 1,
3101           [Define if your assembler supports mfcr field.])])
3103     case $target in
3104       *-*-aix*) conftest_s='    .machine "pwr5"
3105         .csect .text[[PR]]
3106         popcntb 3,3';;
3107       *) conftest_s='   .machine power5
3108         .text
3109         popcntb 3,3';;
3110     esac
3112     gcc_GAS_CHECK_FEATURE([popcntb support],
3113       gcc_cv_as_powerpc_popcntb, [2,17,0],,
3114       [$conftest_s],,
3115       [AC_DEFINE(HAVE_AS_POPCNTB, 1,
3116           [Define if your assembler supports popcntb field.])])
3118     case $target in
3119       *-*-aix*) conftest_s='    .machine "pwr5x"
3120         .csect .text[[PR]]
3121         frin 1,1';;
3122       *) conftest_s='   .machine power5
3123         .text
3124         frin 1,1';;
3125     esac
3127     gcc_GAS_CHECK_FEATURE([fp round support],
3128       gcc_cv_as_powerpc_fprnd, [2,17,0],,
3129       [$conftest_s],,
3130       [AC_DEFINE(HAVE_AS_FPRND, 1,
3131           [Define if your assembler supports fprnd.])])
3133     case $target in
3134       *-*-aix*) conftest_s='    .machine "pwr6"
3135         .csect .text[[PR]]
3136         mffgpr 1,3';;
3137       *) conftest_s='   .machine power6
3138         .text
3139         mffgpr 1,3';;
3140     esac
3142     gcc_GAS_CHECK_FEATURE([move fp gpr support],
3143       gcc_cv_as_powerpc_mfpgpr, [2,19,2],,
3144       [$conftest_s],,
3145       [AC_DEFINE(HAVE_AS_MFPGPR, 1,
3146           [Define if your assembler supports mffgpr and mftgpr.])])
3148     case $target in
3149       *-*-aix*) conftest_s='    .csect .text[[PR]]
3150 LCF..0:
3151         addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
3152       *-*-darwin*)
3153         conftest_s='    .text
3154 LCF0:
3155         addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
3156       *) conftest_s='   .text
3157 .LCF0:
3158         addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
3159     esac
3161     gcc_GAS_CHECK_FEATURE([rel16 relocs],
3162       gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
3163       [$conftest_s],,
3164       [AC_DEFINE(HAVE_AS_REL16, 1,
3165           [Define if your assembler supports R_PPC_REL16 relocs.])])
3167     case $target in
3168       *-*-aix*) conftest_s='    .machine "pwr6"
3169         .csect .text[[PR]]
3170         cmpb 3,4,5';;
3171       *) conftest_s='   .machine power6
3172         .text
3173         cmpb 3,4,5';;
3174     esac
3176     gcc_GAS_CHECK_FEATURE([compare bytes support],
3177       gcc_cv_as_powerpc_cmpb, [2,19,2], -a32,
3178       [$conftest_s],,
3179       [AC_DEFINE(HAVE_AS_CMPB, 1,
3180           [Define if your assembler supports cmpb.])])
3182     case $target in
3183       *-*-aix*) conftest_s='    .machine "pwr6"
3184         .csect .text[[PR]]
3185         dadd 1,2,3';;
3186       *) conftest_s='   .machine power6
3187         .text
3188         dadd 1,2,3';;
3189     esac
3191     gcc_GAS_CHECK_FEATURE([decimal float support],
3192       gcc_cv_as_powerpc_dfp, [2,19,2], -a32,
3193       [$conftest_s],,
3194       [AC_DEFINE(HAVE_AS_DFP, 1,
3195           [Define if your assembler supports DFP instructions.])])
3197     case $target in
3198       *-*-aix*) conftest_s='    .machine "pwr7"
3199         .csect .text[[PR]]
3200         lxvd2x 1,2,3';;
3201       *) conftest_s='   .machine power7
3202         .text
3203         lxvd2x 1,2,3';;
3204     esac
3206     gcc_GAS_CHECK_FEATURE([vector-scalar support],
3207       gcc_cv_as_powerpc_vsx, [2,19,2], -a32,
3208       [$conftest_s],,
3209       [AC_DEFINE(HAVE_AS_VSX, 1,
3210           [Define if your assembler supports VSX instructions.])])
3212     case $target in
3213       *-*-aix*) conftest_s='    .machine "pwr7"
3214         .csect .text[[PR]]
3215         popcntd 3,3';;
3216       *) conftest_s='   .machine power7
3217         .text
3218         popcntd 3,3';;
3219     esac
3221     gcc_GAS_CHECK_FEATURE([popcntd support],
3222       gcc_cv_as_powerpc_popcntd, [2,19,2], -a32,
3223       [$conftest_s],,
3224       [AC_DEFINE(HAVE_AS_POPCNTD, 1,
3225           [Define if your assembler supports POPCNTD instructions.])])
3227     case $target in
3228       *-*-aix*) conftest_s='    .csect .text[[PR]]
3229         lwsync';;
3230       *) conftest_s='   .text
3231         lwsync';;
3232     esac
3234     gcc_GAS_CHECK_FEATURE([lwsync support],
3235       gcc_cv_as_powerpc_lwsync, [2,19,2], -a32,
3236       [$conftest_s],,
3237       [AC_DEFINE(HAVE_AS_LWSYNC, 1,
3238           [Define if your assembler supports LWSYNC instructions.])])
3240     gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
3241       gcc_cv_as_powerpc_gnu_attribute, [2,18,0],,
3242       [.gnu_attribute 4,1],,
3243       [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
3244           [Define if your assembler supports .gnu_attribute.])])
3246     gcc_GAS_CHECK_FEATURE([tls marker support],
3247       gcc_cv_as_powerpc_tls_markers, [2,20,0],,
3248       [ bl __tls_get_addr(x@tlsgd)],,
3249       [AC_DEFINE(HAVE_AS_TLS_MARKERS, 1,
3250           [Define if your assembler supports arg info for __tls_get_addr.])])
3251     ;;
3253   mips*-*-*)
3254     gcc_GAS_CHECK_FEATURE([explicit relocation support],
3255       gcc_cv_as_mips_explicit_relocs, [2,14,0],,
3256 [       lw $4,%gp_rel(foo)($4)],,
3257       [if test x$target_cpu_default = x
3258        then target_cpu_default=MASK_EXPLICIT_RELOCS
3259        else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
3260        fi])
3261     gcc_GAS_CHECK_FEATURE([-mno-shared support],
3262       gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],,
3263       [AC_DEFINE(HAVE_AS_NO_SHARED, 1,
3264                  [Define if the assembler understands -mno-shared.])])
3266     gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
3267       gcc_cv_as_mips_gnu_attribute, [2,18,0],,
3268       [.gnu_attribute 4,1],,
3269       [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
3270           [Define if your assembler supports .gnu_attribute.])])
3272     gcc_GAS_CHECK_FEATURE([.dtprelword support],
3273       gcc_cv_as_mips_dtprelword, [2,18,0],,
3274       [.section .tdata,"awT",@progbits
3276         .word 2
3277         .text
3278         .dtprelword x+0x8000],,
3279       [AC_DEFINE(HAVE_AS_DTPRELWORD, 1,
3280           [Define if your assembler supports .dtprelword.])])
3281     ;;
3282 esac
3284 # Mips and HP-UX need the GNU assembler.
3285 # Linux on IA64 might be able to use the Intel assembler.
3287 case "$target" in
3288   mips*-*-* | *-*-hpux* )
3289     if test x$gas_flag = xyes \
3290        || test x"$host" != x"$build" \
3291        || test ! -x "$gcc_cv_as" \
3292        || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
3293       :
3294     else
3295       echo "*** This configuration requires the GNU assembler" >&2
3296       exit 1
3297     fi
3298     ;;
3299 esac
3301 # ??? Not all targets support dwarf2 debug_line, even within a version
3302 # of gas.  Moreover, we need to emit a valid instruction to trigger any
3303 # info to the output file.  So, as supported targets are added to gas 2.11,
3304 # add some instruction here to (also) show we expect this might work.
3305 # ??? Once 2.11 is released, probably need to add first known working
3306 # version to the per-target configury.
3307 case "$target" in
3308   i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
3309   | x86_64*-*-* | hppa*-*-* | arm*-*-* \
3310   | xstormy16*-*-* | cris-*-* | crisv32-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \
3311   | spu-*-* | fido*-*-* | m32c-*-*)
3312     insn="nop"
3313     ;;
3314   ia64*-*-* | s390*-*-*)
3315     insn="nop 0"
3316     ;;
3317   mmix-*-*)
3318     insn="swym 0"
3319     ;;
3320 esac
3321 if test x"$insn" != x; then
3322  conftest_s="\
3323         .file 1 \"conftest.s\"
3324         .loc 1 3 0
3325         $insn"
3326  gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
3327   gcc_cv_as_dwarf2_debug_line,
3328   [elf,2,11,0],, [$conftest_s],
3329   [if test x$gcc_cv_objdump != x \
3330    && $gcc_cv_objdump -h conftest.o 2> /dev/null \
3331       | grep debug_line > /dev/null 2>&1; then
3332      gcc_cv_as_dwarf2_debug_line=yes
3333    fi])
3335 # The .debug_line file table must be in the exact order that
3336 # we specified the files, since these indices are also used
3337 # by DW_AT_decl_file.  Approximate this test by testing if
3338 # the assembler bitches if the same index is assigned twice.
3339  gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
3340   gcc_cv_as_dwarf2_file_buggy,,,
3341 [       .file 1 "foo.s"
3342         .file 1 "bar.s"])
3344  if test $gcc_cv_as_dwarf2_debug_line = yes \
3345  && test $gcc_cv_as_dwarf2_file_buggy = no; then
3346         AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
3347   [Define if your assembler supports dwarf2 .file/.loc directives,
3348    and preserves file table indices exactly as given.])
3349  fi
3351  gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
3352   gcc_cv_as_gdwarf2_flag,
3353   [elf,2,11,0], [--gdwarf2], [$insn],,
3354   [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
3355 [Define if your assembler supports the --gdwarf2 option.])])
3357  gcc_GAS_CHECK_FEATURE([--gstabs option],
3358   gcc_cv_as_gstabs_flag,
3359   [elf,2,11,0], [--gstabs], [$insn],
3360   [# The native Solaris 9/Intel assembler doesn't understand --gstabs
3361    # and warns about it, but still exits successfully.  So check for
3362    # this.
3363    if AC_TRY_COMMAND([$gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null])
3364    then :
3365    else gcc_cv_as_gstabs_flag=yes
3366    fi],
3367   [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
3368 [Define if your assembler supports the --gstabs option.])])
3370  gcc_GAS_CHECK_FEATURE([--debug-prefix-map option],
3371   gcc_cv_as_debug_prefix_map_flag,
3372   [2,18,0], [--debug-prefix-map /a=/b], [$insn],,
3373   [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1,
3374 [Define if your assembler supports the --debug-prefix-map option.])])
3377 gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
3378  ,,
3379 [.lcomm bar,4,16],,
3380 [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
3381   [Define if your assembler supports .lcomm with an alignment field.])])
3383 AC_ARG_ENABLE(gnu-unique-object,
3384  [  --enable-gnu-unique-object  enable the use of the @gnu_unique_object ELF extension on
3385                                 glibc systems],
3386  [case $enable_gnu_unique_object in
3387     yes | no) ;;
3388     *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
3389 Valid choices are 'yes' and 'no'.]) ;;
3390   esac],
3391  [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
3392    [elf,2,19,52],,
3393    [.type foo, @gnu_unique_object],
3394 # Also check for ld.so support, i.e. glibc 2.11 or higher.
3395    [if test x$host = x$build -a x$host = x$target &&
3396        glibcver=`ldd --version 2>/dev/null`; then
3397       glibcmajor=`expr "$glibcver" : "ldd (GNU libc) \([[0-9]]*\)"`
3398       glibcminor=`expr "$glibcver" : "ldd (GNU libc) [[0-9]]*\.\([[0-9]]*\)"`
3399       glibcnum=`expr $glibcmajor \* 1000 + $glibcminor`
3400       if test "$glibcnum" -ge 2011 ; then
3401         gcc_cv_as_gnu_unique_object=yes
3402       fi
3403     fi],
3404    [enable_gnu_unique_object=yes])])
3405 if test x$enable_gnu_unique_object = xyes; then
3406   AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
3407    [Define if your assembler supports @gnu_unique_object.])
3410 AC_CACHE_CHECK([assembler for tolerance to line number 0],
3411  [gcc_cv_as_line_zero],
3412  [gcc_cv_as_line_zero=no
3413   if test $in_tree_gas = yes; then
3414     gcc_GAS_VERSION_GTE_IFELSE(2, 16, 91, [gcc_cv_as_line_zero=yes])
3415   elif test "x$gcc_cv_as" != x; then
3416     { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
3417     if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) &&
3418        test "x`cat conftest.out`" = x
3419     then
3420       gcc_cv_as_line_zero=yes
3421     else
3422       echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
3423       cat conftest.s >&AS_MESSAGE_LOG_FD
3424       echo "configure: error output was" >&AS_MESSAGE_LOG_FD
3425       cat conftest.out >&AS_MESSAGE_LOG_FD
3426     fi
3427     rm -f conftest.o conftest.s conftest.out
3428   fi])
3429 if test "x$gcc_cv_as_line_zero" = xyes; then
3430   AC_DEFINE([HAVE_AS_LINE_ZERO], 1,
3431 [Define if the assembler won't complain about a line such as # 0 "" 2.])
3434 AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
3435 gcc_cv_ld_eh_frame_hdr=no
3436 if test $in_tree_ld = yes ; then
3437   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 \
3438      && test $in_tree_ld_is_elf = yes; then
3439     gcc_cv_ld_eh_frame_hdr=yes
3440   fi
3441 elif test x$gcc_cv_ld != x; then
3442         # Check if linker supports --eh-frame-hdr option
3443         if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
3444                 gcc_cv_ld_eh_frame_hdr=yes
3445         fi
3447 GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
3448 if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
3449         AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
3450 [Define if your linker supports --eh-frame-hdr option.])
3452 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
3454 AC_MSG_CHECKING(linker position independent executable support)
3455 gcc_cv_ld_pie=no
3456 if test $in_tree_ld = yes ; then
3457   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 \
3458      && test $in_tree_ld_is_elf = yes; then
3459     gcc_cv_ld_pie=yes
3460   fi
3461 elif test x$gcc_cv_ld != x; then
3462         # Check if linker supports -pie option
3463         if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then
3464                 gcc_cv_ld_pie=yes
3465         fi
3467 if test x"$gcc_cv_ld_pie" = xyes; then
3468         AC_DEFINE(HAVE_LD_PIE, 1,
3469 [Define if your linker supports -pie option.])
3471 AC_MSG_RESULT($gcc_cv_ld_pie)
3473 AC_MSG_CHECKING(linker EH-compatible garbage collection of sections)
3474 gcc_cv_ld_eh_gc_sections=no
3475 if test $in_tree_ld = yes ; then
3476   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 \
3477      && test $in_tree_ld_is_elf = yes; then
3478     gcc_cv_ld_eh_gc_sections=yes
3479   fi
3480 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
3481   cat > conftest.s <<EOF
3482         .section        .text
3483 .globl _start
3484         .type _start, @function
3485 _start:
3486         .long foo
3487         .size _start, .-_start
3488         .section        .text.foo,"ax",@progbits
3489         .type foo, @function
3490 foo:
3491         .long 0
3492         .size foo, .-foo
3493         .section        .gcc_except_table.foo,"a",@progbits
3494 .L0:
3495         .long 0
3496         .section        .eh_frame,"a",@progbits
3497         .long .L0
3499   if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
3500     if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
3501          | grep "gc-sections option ignored" > /dev/null; then
3502       gcc_cv_ld_eh_gc_sections=no
3503     elif $gcc_cv_objdump -h conftest | grep gcc_except_table > /dev/null; then
3504       gcc_cv_ld_eh_gc_sections=yes
3505       # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
3506       if test x$gcc_cv_as_comdat_group != xyes; then
3507         gcc_cv_ld_eh_gc_sections=no
3508         cat > conftest.s <<EOF
3509         .section        .text
3510 .globl _start
3511         .type _start, @function
3512 _start:
3513         .long foo
3514         .size _start, .-_start
3515         .section        .gnu.linkonce.t.foo,"ax",@progbits
3516         .type foo, @function
3517 foo:
3518         .long 0
3519         .size foo, .-foo
3520         .section        .gcc_except_table.foo,"a",@progbits
3521 .L0:
3522         .long 0
3523         .section        .eh_frame,"a",@progbits
3524         .long .L0
3526         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
3527           if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
3528                | grep "gc-sections option ignored" > /dev/null; then
3529             gcc_cv_ld_eh_gc_sections=no
3530           elif $gcc_cv_objdump -h conftest | grep gcc_except_table > /dev/null; then
3531             gcc_cv_ld_eh_gc_sections=yes
3532           fi
3533         fi
3534       fi
3535     fi
3536   fi
3537   rm -f conftest.s conftest.o conftest
3539 case "$target" in
3540   hppa*-*-linux*)
3541     # ??? This apparently exposes a binutils bug with PC-relative relocations.
3542     gcc_cv_ld_eh_gc_sections=no
3543     ;;
3544 esac
3545 if test x$gcc_cv_ld_eh_gc_sections = xyes; then
3546         AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1,
3547   [Define if your linker supports garbage collection of
3548    sections in presence of EH frames.])
3550 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections)
3552 # --------
3553 # UNSORTED
3554 # --------
3556 AC_CACHE_CHECK(linker --as-needed support,
3557 gcc_cv_ld_as_needed,
3558 [gcc_cv_ld_as_needed=no
3559 if test $in_tree_ld = yes ; then
3560   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 \
3561      && test $in_tree_ld_is_elf = yes; then
3562     gcc_cv_ld_as_needed=yes
3563   fi
3564 elif test x$gcc_cv_ld != x; then
3565         # Check if linker supports --as-needed and --no-as-needed options
3566         if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
3567                 gcc_cv_ld_as_needed=yes
3568         fi
3571 if test x"$gcc_cv_ld_as_needed" = xyes; then
3572         AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
3573 [Define if your linker supports --as-needed and --no-as-needed options.])
3576 case "$target:$tm_file" in
3577   powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
3578     AC_CACHE_CHECK(linker support for omitting dot symbols,
3579     gcc_cv_ld_no_dot_syms,
3580     [gcc_cv_ld_no_dot_syms=no
3581     if test $in_tree_ld = yes ; then
3582       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
3583         gcc_cv_ld_no_dot_syms=yes
3584       fi
3585     elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
3586       cat > conftest1.s <<EOF
3587         .text
3588         bl .foo
3590       cat > conftest2.s <<EOF
3591         .section ".opd","aw"
3592         .align 3
3593         .globl foo
3594         .type foo,@function
3595 foo:
3596         .quad .LEfoo,.TOC.@tocbase,0
3597         .text
3598 .LEfoo:
3599         blr
3600         .size foo,.-.LEfoo
3602       if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
3603          && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
3604          && $gcc_cv_ld -melf64ppc -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
3605         gcc_cv_ld_no_dot_syms=yes
3606       fi
3607       rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
3608     fi
3609     ])
3610     if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
3611       AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
3612     [Define if your PowerPC64 linker only needs function descriptor syms.])
3613     fi
3614     ;;
3615 esac
3617 AC_CACHE_CHECK(linker --build-id support,
3618   gcc_cv_ld_buildid,
3619   [gcc_cv_ld_buildid=no
3620   if test $in_tree_ld = yes ; then
3621     if test "$gcc_cv_gld_major_version" -eq 2 -a \
3622        "$gcc_cv_gld_minor_version" -ge 18 -o \
3623        "$gcc_cv_gld_major_version" -gt 2 \
3624        && test $in_tree_ld_is_elf = yes; then
3625       gcc_cv_ld_buildid=yes
3626     fi
3627   elif test x$gcc_cv_ld != x; then
3628     if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
3629       gcc_cv_ld_buildid=yes
3630     fi
3631   fi])
3632 if test x"$gcc_cv_ld_buildid" = xyes; then
3633   AC_DEFINE(HAVE_LD_BUILDID, 1,
3634   [Define if your linker supports --build-id.])
3637 AC_ARG_ENABLE(linker-build-id,
3638 [  --enable-linker-build-id
3639                           compiler will always pass --build-id to linker],
3641 enable_linker_build_id=no)
3643 if test x"$enable_linker_build_id" = xyes; then
3644   if test x"$gcc_cv_ld_buildid" = xyes; then
3645     AC_DEFINE(ENABLE_LD_BUILDID, 1,
3646     [Define if gcc should always pass --build-id to linker.])
3647   else
3648     AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
3649   fi
3652 AC_CACHE_CHECK(linker --sysroot support,
3653   gcc_cv_ld_sysroot,
3654   [gcc_cv_ld_sysroot=no
3655   if test $in_tree_ld = yes ; then
3656       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
3657         gcc_cv_ld_sysroot=yes
3658       fi
3659   elif test x$gcc_cv_ld != x; then 
3660     if $gcc_cv_ld --help 2>/dev/null | grep sysroot > /dev/null; then
3661       gcc_cv_ld_sysroot=yes
3662     fi
3663   fi])
3664 if test x"$gcc_cv_ld_sysroot" = xyes; then
3665   AC_DEFINE(HAVE_LD_SYSROOT, 1,
3666   [Define if your linker supports --sysroot.])
3667 fi        
3669 if test x$with_sysroot = x && test x$host = x$target \
3670    && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
3671    && test "$prefix" != "NONE"; then
3672   AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
3673 [Define to PREFIX/include if cpp should also search that directory.])
3676 # Test for stack protector support in target C library.
3677 AC_CACHE_CHECK(__stack_chk_fail in target C library,
3678       gcc_cv_libc_provides_ssp,
3679       [gcc_cv_libc_provides_ssp=no
3680     case "$target" in
3681        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
3682       if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
3683         if test "x$with_sysroot" = x; then
3684           glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
3685         elif test "x$with_build_sysroot" != "x"; then
3686           glibc_header_dir="${with_build_sysroot}/usr/include"
3687         elif test "x$with_sysroot" = xyes; then
3688           glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
3689         else
3690           glibc_header_dir="${with_sysroot}/usr/include"
3691         fi
3692       else
3693         glibc_header_dir=/usr/include
3694       fi
3695       # glibc 2.4 and later provides __stack_chk_fail and
3696       # either __stack_chk_guard, or TLS access to stack guard canary.
3697       if test -f $glibc_header_dir/features.h \
3698          && $EGREP '^@<:@       @:>@*#[         ]*define[       ]+__GNU_LIBRARY__[      ]+([1-9][0-9]|[6-9])' \
3699             $glibc_header_dir/features.h > /dev/null; then
3700         if $EGREP '^@<:@        @:>@*#[         ]*define[       ]+__GLIBC__[    ]+([1-9][0-9]|[3-9])' \
3701            $glibc_header_dir/features.h > /dev/null; then
3702           gcc_cv_libc_provides_ssp=yes
3703         elif $EGREP '^@<:@      @:>@*#[         ]*define[       ]+__GLIBC__[    ]+2' \
3704              $glibc_header_dir/features.h > /dev/null \
3705              && $EGREP '^@<:@   @:>@*#[         ]*define[       ]+__GLIBC_MINOR__[      ]+([1-9][0-9]|[4-9])' \
3706              $glibc_header_dir/features.h > /dev/null; then
3707           gcc_cv_libc_provides_ssp=yes
3708         elif $EGREP '^@<:@      @:>@*#[         ]*define[       ]+__UCLIBC__[   ]+1' \
3709              $glibc_header_dir/features.h > /dev/null && \
3710              test -f $glibc_header_dir/bits/uClibc_config.h && \
3711              $EGREP '^@<:@      @:>@*#[         ]*define[       ]+__UCLIBC_HAS_SSP__[   ]+1' \
3712              $glibc_header_dir/bits/uClibc_config.h > /dev/null; then
3713           gcc_cv_libc_provides_ssp=yes
3714         fi
3715       fi
3716         ;;
3717        *-*-gnu*)
3718          # Avoid complicated tests (see
3719          # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
3720          # simply assert that glibc does provide this, which is true for all
3721          # realistically usable GNU/Hurd configurations.
3722          gcc_cv_libc_provides_ssp=yes;;
3723        *-*-darwin*)
3724          AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
3725            [echo "no __stack_chk_fail on this target"])
3726         ;;
3727   *) gcc_cv_libc_provides_ssp=no ;;
3728     esac])
3730 if test x$gcc_cv_libc_provides_ssp = xyes; then
3731   AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
3732             [Define if your target C library provides stack protector support])
3735 # Check if TFmode long double should be used by default or not.
3736 # Some glibc targets used DFmode long double, but with glibc 2.4
3737 # and later they can use TFmode.
3738 case "$target" in
3739   powerpc*-*-linux* | \
3740   powerpc*-*-gnu* | \
3741   sparc*-*-linux* | \
3742   s390*-*-linux* | \
3743   alpha*-*-linux*)
3744     AC_ARG_WITH(long-double-128,
3745 [  --with-long-double-128  Use 128-bit long double by default.],
3746       gcc_cv_target_ldbl128="$with_long_double_128",
3747       [gcc_cv_target_ldbl128=no
3748       if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
3749         if test "x$with_sysroot" = x; then
3750           glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
3751         elif test "x$with_build_sysroot" != "x"; then
3752           glibc_header_dir="${with_build_sysroot}/usr/include"
3753         elif test "x$with_sysroot" = xyes; then
3754           glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
3755         else
3756           glibc_header_dir="${with_sysroot}/usr/include"
3757         fi
3758       else
3759         glibc_header_dir=/usr/include
3760       fi
3761 changequote(,)dnl
3762       grep '^[  ]*#[    ]*define[       ][      ]*__LONG_DOUBLE_MATH_OPTIONAL' \
3763         $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
3764       && gcc_cv_target_ldbl128=yes
3765 changequote([,])dnl
3766       ])
3767     ;;
3768 esac
3769 if test x$gcc_cv_target_ldbl128 = xyes; then
3770   AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
3771             [Define if TFmode long double should be the default])
3774 # Find out what GC implementation we want, or may, use.
3775 AC_ARG_WITH(gc,
3776 [  --with-gc={page,zone}   choose the garbage collection mechanism to use
3777                           with the compiler],
3778 [case "$withval" in
3779   page)
3780     GGC=ggc-$withval
3781     ;;
3782   zone)
3783     GGC=ggc-$withval
3784     AC_DEFINE(GGC_ZONE, 1, [Define if the zone collector is in use])
3785     ;;
3786   *)
3787     AC_MSG_ERROR([$withval is an invalid option to --with-gc])
3788     ;;
3789 esac],
3790 [GGC=ggc-page])
3791 AC_SUBST(GGC)
3792 echo "Using $GGC for garbage collection."
3794 # Libraries to use on the host.  This will normally be set by the top
3795 # level Makefile.  Here we simply capture the value for our Makefile.
3796 if test -z "${HOST_LIBS+set}"; then
3797   HOST_LIBS=
3799 AC_SUBST(HOST_LIBS)
3801 # Use the system's zlib library.
3802 zlibdir=-L../zlib
3803 zlibinc="-I\$(srcdir)/../zlib"
3804 AC_ARG_WITH(system-zlib,
3805 [  --with-system-zlib      use installed libz],
3806 zlibdir=
3807 zlibinc=
3809 AC_SUBST(zlibdir)
3810 AC_SUBST(zlibinc)
3812 dnl Very limited version of automake's enable-maintainer-mode
3814 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3815   dnl maintainer-mode is disabled by default
3816   AC_ARG_ENABLE(maintainer-mode,
3817 [  --enable-maintainer-mode
3818                           enable make rules and dependencies not useful
3819                           (and sometimes confusing) to the casual installer],
3820       maintainer_mode=$enableval,
3821       maintainer_mode=no)
3823 AC_MSG_RESULT($maintainer_mode)
3825 if test "$maintainer_mode" = "yes"; then
3826   MAINT=''
3827 else
3828   MAINT='#'
3830 AC_SUBST(MAINT)dnl
3832 # --------------
3833 # Language hooks
3834 # --------------
3836 # Make empty files to contain the specs and options for each language.
3837 # Then add #include lines to for a compiler that has specs and/or options.
3839 subdirs=
3840 lang_opt_files=
3841 lang_specs_files=
3842 lang_tree_files=
3843 # These (without "all_") are set in each config-lang.in.
3844 # `language' must be a single word so is spelled singularly.
3845 all_languages=
3846 all_compilers=
3847 all_outputs='Makefile gccbug'
3848 # List of language makefile fragments.
3849 all_lang_makefrags=
3850 # List of language subdirectory makefiles.  Deprecated.
3851 all_lang_makefiles=
3852 # Additional files for gengtype
3853 all_gtfiles="$target_gtfiles"
3855 # These are the languages that are set in --enable-languages,
3856 # and are available in the GCC tree.
3857 all_selected_languages=
3859 # Add the language fragments.
3860 # Languages are added via two mechanisms.  Some information must be
3861 # recorded in makefile variables, these are defined in config-lang.in.
3862 # We accumulate them and plug them into the main Makefile.
3863 # The other mechanism is a set of hooks for each of the main targets
3864 # like `clean', `install', etc.
3866 language_hooks="Make-hooks"
3868 for lang in ${srcdir}/*/config-lang.in
3870 changequote(,)dnl
3871         test "$lang" = "${srcdir}/*/config-lang.in" && continue
3873         lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^   ]*\).*$,\1,p' $lang`
3874         if test "x$lang_alias" = x
3875         then
3876               echo "$lang doesn't set \$language." 1>&2
3877               exit 1
3878         fi
3879         subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
3880         subdirs="$subdirs $subdir"
3882         # $gcc_subdir is where the gcc integration files are to be found
3883         # for a language, both for internal compiler purposes (compiler
3884         # sources implementing front-end to GCC tree converters), and for
3885         # build infrastructure purposes (Make-lang.in, etc.)
3886         #
3887         # This will be <subdir> (relative to $srcdir) if a line like 
3888         # gcc_subdir="<subdir>" or gcc_subdir=<subdir>
3889         # is found in <langdir>/config-lang.in, and will remain <langdir>
3890         # otherwise.
3891         #
3892         # Except for the language alias (fetched above), the regular
3893         # "config-lang.in" contents are always retrieved from $gcc_subdir,
3894         # so a <langdir>/config-lang.in setting gcc_subdir typically sets
3895         # only this and the language alias.
3897         gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^   ]*\).*$,\1,p' $lang`
3898         if [ "$gcc_subdir" = "" ]; then
3899            gcc_subdir="$subdir"
3900         fi
3902         case ",$enable_languages," in
3903         *,$lang_alias,*)
3904             all_selected_languages="$all_selected_languages $lang_alias"
3905             if test -f $srcdir/$gcc_subdir/lang-specs.h; then
3906                 lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h"
3907             fi
3908             ;;
3909         esac
3910 changequote([,])dnl
3912         language=
3913         boot_language=
3914         compilers=
3915         outputs=
3916         gtfiles=
3917         subdir_requires=
3918         . ${srcdir}/$gcc_subdir/config-lang.in
3919         if test "x$language" = x
3920         then
3921                 echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2
3922                 exit 1
3923         fi
3925         ok=:
3926         case ",$enable_languages," in
3927                 *,$lang_alias,*) ;;
3928                 *)
3929                         for i in $subdir_requires; do
3930                                 test -f "${srcdir}/$i/config-lang.in" && continue
3931                                 ok=false
3932                                 break
3933                         done
3934                 ;;
3935         esac
3936         $ok || continue
3938         all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in"
3939         if test -f $srcdir/$gcc_subdir/lang.opt; then
3940             lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
3941         fi
3942         if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then
3943             lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def"
3944         fi
3945         if test -f ${srcdir}/$gcc_subdir/Makefile.in
3946                 then all_lang_makefiles="$gcc_subdir/Makefile"
3947         fi
3948         all_languages="$all_languages $language"
3949         all_compilers="$all_compilers $compilers"
3950         all_outputs="$all_outputs $outputs"
3951         all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles"
3952 done
3954 # Pick up gtfiles for c
3955 gtfiles=
3956 . ${srcdir}/c-config-lang.in
3957 all_gtfiles="$all_gtfiles [[c]] $gtfiles"
3959 check_languages=
3960 for language in $all_selected_languages
3962         check_languages="$check_languages check-$language"
3963 done
3965 # We link each language in with a set of hooks, reached indirectly via
3966 # lang.${target}.  Only do so for selected languages.
3968 rm -f Make-hooks
3969 touch Make-hooks
3970 target_list="all.cross start.encap rest.encap tags \
3971         install-common install-man install-info install-pdf dvi pdf \
3972         html uninstall info man srcextra srcman srcinfo \
3973         mostlyclean clean distclean maintainer-clean install-plugin"
3975 for t in $target_list
3977         x=
3978         for lang in $all_selected_languages
3979         do
3980                 x="$x $lang.$t"
3981         done
3982         echo "lang.$t: $x" >> Make-hooks
3983 done
3985 # --------
3986 # UNSORTED
3987 # --------
3989 # Create .gdbinit.
3991 echo "dir ." > .gdbinit
3992 echo "dir ${srcdir}" >> .gdbinit
3993 if test x$gdb_needs_out_file_path = xyes
3994 then
3995         echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
3997 if test "x$subdirs" != x; then
3998         for s in $subdirs
3999         do
4000                 echo "dir ${srcdir}/$s" >> .gdbinit
4001         done
4003 echo "source ${srcdir}/gdbinit.in" >> .gdbinit
4005 gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
4006 AC_SUBST(gcc_tooldir)
4007 AC_SUBST(dollar)
4009 # Find a directory in which to install a shared libgcc.
4011 AC_ARG_ENABLE(version-specific-runtime-libs,
4012 [  --enable-version-specific-runtime-libs
4013                           specify that runtime libraries should be
4014                           installed in a compiler-specific directory])
4016 AC_ARG_WITH(slibdir,
4017 [  --with-slibdir=DIR      shared libraries in DIR [[LIBDIR]]],
4018 slibdir="$with_slibdir",
4019 if test "${enable_version_specific_runtime_libs+set}" = set; then
4020   slibdir='$(libsubdir)'
4021 elif test "$host" != "$target"; then
4022   slibdir='$(build_tooldir)/lib'
4023 else
4024   slibdir='$(libdir)'
4026 AC_SUBST(slibdir)
4028 # Substitute configuration variables
4029 AC_SUBST(subdirs)
4030 AC_SUBST(srcdir)
4031 AC_SUBST(all_compilers)
4032 AC_SUBST(all_gtfiles)
4033 AC_SUBST(all_lang_makefrags)
4034 AC_SUBST(all_lang_makefiles)
4035 AC_SUBST(all_languages)
4036 AC_SUBST(all_selected_languages)
4037 AC_SUBST(build_exeext)
4038 AC_SUBST(build_install_headers_dir)
4039 AC_SUBST(build_xm_file_list)
4040 AC_SUBST(build_xm_include_list)
4041 AC_SUBST(build_xm_defines)
4042 AC_SUBST(build_file_translate)
4043 AC_SUBST(check_languages)
4044 AC_SUBST(cpp_install_dir)
4045 AC_SUBST(xmake_file)
4046 AC_SUBST(tmake_file)
4047 AC_SUBST(TM_ENDIAN_CONFIG)
4048 AC_SUBST(TM_MULTILIB_CONFIG)
4049 AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
4050 AC_SUBST(extra_gcc_objs)
4051 AC_SUBST(extra_headers_list)
4052 AC_SUBST(extra_objs)
4053 AC_SUBST(extra_parts)
4054 AC_SUBST(extra_passes)
4055 AC_SUBST(extra_programs)
4056 AC_SUBST(float_h_file)
4057 AC_SUBST(gcc_config_arguments)
4058 AC_SUBST(gcc_gxx_include_dir)
4059 AC_SUBST(host_exeext)
4060 AC_SUBST(host_xm_file_list)
4061 AC_SUBST(host_xm_include_list)
4062 AC_SUBST(host_xm_defines)
4063 AC_SUBST(out_host_hook_obj)
4064 AC_SUBST(install)
4065 AC_SUBST(lang_opt_files)
4066 AC_SUBST(lang_specs_files)
4067 AC_SUBST(lang_tree_files)
4068 AC_SUBST(local_prefix)
4069 AC_SUBST(md_file)
4070 AC_SUBST(objc_boehm_gc)
4071 AC_SUBST(out_file)
4072 AC_SUBST(out_object_file)
4073 AC_SUBST(thread_file)
4074 AC_SUBST(tm_file_list)
4075 AC_SUBST(tm_include_list)
4076 AC_SUBST(tm_defines)
4077 AC_SUBST(tm_p_file_list)
4078 AC_SUBST(tm_p_include_list)
4079 AC_SUBST(xm_file_list)
4080 AC_SUBST(xm_include_list)
4081 AC_SUBST(xm_defines)
4082 AC_SUBST(use_gcc_stdint)
4083 AC_SUBST(c_target_objs)
4084 AC_SUBST(cxx_target_objs)
4085 AC_SUBST(fortran_target_objs)
4086 AC_SUBST(target_cpu_default)
4088 AC_SUBST_FILE(language_hooks)
4090 # Echo link setup.
4091 if test x${build} = x${host} ; then
4092   if test x${host} = x${target} ; then
4093     echo "Links are now set up to build a native compiler for ${target}." 1>&2
4094   else
4095     echo "Links are now set up to build a cross-compiler" 1>&2
4096     echo " from ${host} to ${target}." 1>&2
4097   fi
4098 else
4099   if test x${host} = x${target} ; then
4100     echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
4101     echo " for ${target}." 1>&2
4102   else
4103     echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
4104     echo " from ${host} to ${target}." 1>&2
4105   fi
4108 AC_ARG_VAR(GMPLIBS,[How to link GMP])
4109 AC_ARG_VAR(GMPINC,[How to find GMP include files])
4111 case "${GMPLIBS}" in
4112   *-lmpc*) AC_DEFINE(HAVE_mpc, 1, [Define if mpc is in use.]) ;;
4113 esac
4115 AC_ARG_VAR(PPLLIBS,[How to link PPL])
4116 AC_ARG_VAR(PPLINC,[How to find PPL include files])
4118 AC_ARG_VAR(CLOOGLIBS,[How to link CLOOG])
4119 AC_ARG_VAR(CLOOGINC,[How to find CLOOG include files])
4120 if test "x${CLOOGLIBS}" != "x" ; then 
4121    AC_DEFINE(HAVE_cloog, 1, [Define if cloog is in use.])
4124 # Check for plugin support
4125 AC_ARG_ENABLE(plugin,
4126 [  --enable-plugin         enable plugin support],
4127 enable_plugin=$enableval,
4128 enable_plugin=yes; default_plugin=yes)
4130 pluginlibs=
4131 if test x"$enable_plugin" = x"yes"; then
4132   # Check that the host supports -rdynamic and -ldl
4133   have_rdynamic=no
4134   have_dl=no
4135   saved_LDFLAGS="$LDFLAGS"
4136   saved_LIBS="$LIBS"
4137   LIBS=
4139   # Check -rdynamic
4140   LDFLAGS="$LDFLAGS -rdynamic"
4141   AC_MSG_CHECKING([for -rdynamic])
4142   AC_TRY_LINK([],[return 0;],
4143     [AC_MSG_RESULT([yes]); have_rdynamic=yes],
4144     [AC_MSG_RESULT([no])])
4145   if test x"$have_rdynamic" = x"yes" ; then
4146     pluginlibs="-rdynamic"
4147   fi
4149   # Check -ldl
4150   LDFLAGS="$LDFLAGS -ldl"
4151   AC_MSG_CHECKING([for -ldl])
4152   AC_TRY_LINK(
4153     [#include <dlfcn.h>],
4154     [volatile int f = 0; if (f) dlopen ("dummy", 0);],
4155     [AC_MSG_RESULT([yes]); have_dl=yes],
4156     [AC_MSG_RESULT([no])])
4157   if test x"$have_dl" = x"yes"; then
4158     pluginlibs="$pluginlibs -ldl"
4159   fi
4161   # Check that we can build shared objects with -fPIC -shared
4162   LDFLAGS="$LDFLAGS -fPIC -shared"
4163   AC_MSG_CHECKING([for -fPIC -shared])
4164   AC_TRY_LINK(
4165     [extern int X;],[return X == 0;],
4166     [AC_MSG_RESULT([yes]); have_pic_shared=yes],
4167     [AC_MSG_RESULT([no]); have_pic_shared=no])
4168   if test x"$have_pic_shared" != x"yes"; then
4169     pluginlibs=
4170     enable_plugin=no
4171   fi
4173   # If plugin support had been requested but not available, fail.
4174   if test x"$enable_plugin" = x"no" ; then
4175     if test x"$default_plugin" != x"yes"; then
4176       AC_MSG_ERROR([
4177 Building GCC with plugin support requires a host that supports
4178 -fPIC, -shared, -ldl and -rdynamic.])
4179     fi
4180   fi
4182   LDFLAGS="$saved_LDFLAGS"
4183   LIBS="$saved_LIBS"
4186 AC_SUBST(pluginlibs)
4187 AC_SUBST(enable_plugin)
4188 if test x"$enable_plugin" = x"yes"; then
4189   AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
4192 # Configure the subdirectories
4193 # AC_CONFIG_SUBDIRS($subdirs)
4195 # Create the Makefile
4196 # and configure language subdirectories
4197 AC_CONFIG_FILES($all_outputs)
4199 AC_CONFIG_COMMANDS([default],
4201 case ${CONFIG_HEADERS} in
4202   *auto-host.h:config.in*)
4203   echo > cstamp-h ;;
4204 esac
4205 # Make sure all the subdirs exist.
4206 for d in $subdirs doc build
4208     test -d $d || mkdir $d
4209 done
4210 ], 
4211 [subdirs='$subdirs'])
4212 AC_OUTPUT