OSDN Git Service

* configure.in: FORBUILD when build!=host changed from
[pf3gnuchains/gcc-fork.git] / gcc / configure.in
1 # configure.in for GCC
2 # Process this file with autoconf to generate a configuration script.
3
4 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6 #This file is part of GCC.
7
8 #GCC is free software; you can redistribute it and/or modify it under
9 #the terms of the GNU General Public License as published by the Free
10 #Software Foundation; either version 2, or (at your option) any later
11 #version.
12
13 #GCC is distributed in the hope that it will be useful, but WITHOUT
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 #for more details.
17
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING.  If not, write to the Free
20 #Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 #02111-1307, USA.
22
23 # Initialization and defaults
24 AC_PREREQ(2.13)
25 AC_INIT(tree.c)
26 AC_CONFIG_HEADER(auto-host.h:config.in)
27
28 remove=rm
29 hard_link=ln
30 symbolic_link='ln -s'
31 copy=cp
32
33 # Check for bogus environment variables.
34 # Test if LIBRARY_PATH contains the notation for the current directory
35 # since this would lead to problems installing/building glibc.
36 # LIBRARY_PATH contains the current directory if one of the following
37 # is true:
38 # - one of the terminals (":" and ";") is the first or last sign
39 # - two terminals occur directly after each other
40 # - the path contains an element with a dot in it
41 AC_MSG_CHECKING(LIBRARY_PATH variable)
42 changequote(,)dnl
43 case ${LIBRARY_PATH} in
44   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
45     library_path_setting="contains current directory"
46     ;;
47   *)
48     library_path_setting="ok"
49     ;;
50 esac
51 changequote([,])dnl
52 AC_MSG_RESULT($library_path_setting)
53 if test "$library_path_setting" != "ok"; then
54 AC_MSG_ERROR([
55 *** LIBRARY_PATH shouldn't contain the current directory when
56 *** building gcc. Please change the environment variable
57 *** and run configure again.])
58 fi
59
60 # Test if GCC_EXEC_PREFIX contains the notation for the current directory
61 # since this would lead to problems installing/building glibc.
62 # GCC_EXEC_PREFIX contains the current directory if one of the following
63 # is true:
64 # - one of the terminals (":" and ";") is the first or last sign
65 # - two terminals occur directly after each other
66 # - the path contains an element with a dot in it
67 AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
68 changequote(,)dnl
69 case ${GCC_EXEC_PREFIX} in
70   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
71     gcc_exec_prefix_setting="contains current directory"
72     ;;
73   *)
74     gcc_exec_prefix_setting="ok"
75     ;;
76 esac
77 changequote([,])dnl
78 AC_MSG_RESULT($gcc_exec_prefix_setting)
79 if test "$gcc_exec_prefix_setting" != "ok"; then
80 AC_MSG_ERROR([
81 *** GCC_EXEC_PREFIX shouldn't contain the current directory when
82 *** building gcc. Please change the environment variable
83 *** and run configure again.])
84 fi
85
86 # Check for additional parameters
87
88 # With GNU ld
89 AC_ARG_WITH(gnu-ld,
90 [  --with-gnu-ld           arrange to work with GNU ld.],
91 gnu_ld_flag="$with_gnu_ld",
92 gnu_ld_flag=no)
93
94 # With pre-defined ld
95 AC_ARG_WITH(ld,
96 [  --with-ld               arrange to use the specified ld (full pathname)],
97 DEFAULT_LINKER="$with_ld")
98 if test x"${DEFAULT_LINKER+set}" = x"set"; then
99   if test ! -x "$DEFAULT_LINKER"; then
100     AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
101   elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
102     gnu_ld_flag=yes
103   fi
104   AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
105         [Define to enable the use of a default linker.])
106 fi
107
108 # With GNU as
109 AC_ARG_WITH(gnu-as,
110 [  --with-gnu-as           arrange to work with GNU as],
111 gas_flag="$with_gnu_as",
112 gas_flag=no)
113
114 AC_ARG_WITH(as,
115 [  --with-as               arrange to use the specified as (full pathname)],
116 DEFAULT_ASSEMBLER="$with_as")
117 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
118   if test ! -x "$DEFAULT_ASSEMBLER"; then
119     AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
120   elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
121     gas_flag=yes
122   fi
123   AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
124         [Define to enable the use of a default assembler.])
125 fi
126
127 # With stabs
128 AC_ARG_WITH(stabs,
129 [  --with-stabs            arrange to use stabs instead of host debug format],
130 stabs="$with_stabs",
131 stabs=no)
132
133 # With ELF
134 AC_ARG_WITH(elf,
135 [  --with-elf              arrange to use ELF instead of host debug format],
136 elf="$with_elf",
137 elf=no)
138
139 # Specify the local prefix
140 local_prefix=
141 AC_ARG_WITH(local-prefix,
142 [  --with-local-prefix=DIR specifies directory to put local include],
143 [case "${withval}" in
144 yes)    AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
145 no)     ;;
146 *)      local_prefix=$with_local_prefix ;;
147 esac])
148
149 # Default local prefix if it is empty
150 if test x$local_prefix = x; then
151         local_prefix=/usr/local
152 fi
153
154 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
155 # passed in by the toplevel make and thus we'd get different behavior
156 # depending on where we built the sources.
157 gcc_gxx_include_dir=
158 # Specify the g++ header file directory
159 AC_ARG_WITH(gxx-include-dir,
160 [  --with-gxx-include-dir=DIR
161                           specifies directory to put g++ header files],
162 [case "${withval}" in
163 yes)    AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
164 no)     ;;
165 *)      gcc_gxx_include_dir=$with_gxx_include_dir ;;
166 esac])
167
168 if test x${gcc_gxx_include_dir} = x; then
169   if test x${enable_version_specific_runtime_libs} = xyes; then
170     gcc_gxx_include_dir='${libsubdir}/include/c++'
171   else
172     topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
173 changequote(<<, >>)dnl
174     gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir}
175 changequote([, ])dnl
176   fi
177 fi
178
179 # Determine the host, build, and target systems
180 AC_CANONICAL_SYSTEM
181
182 # Set program_transform_name
183 AC_ARG_PROGRAM
184
185 # Find the native compiler
186 AC_PROG_CC
187 AC_PROG_CC_C_O
188 # autoconf is lame and doesn't give us any substitution variable for this.
189 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
190   NO_MINUS_C_MINUS_O=yes
191 else
192   OUTPUT_OPTION='-o $@'
193 fi
194 AC_SUBST(NO_MINUS_C_MINUS_O)
195 AC_SUBST(OUTPUT_OPTION)
196
197 # See if GNAT has been installed
198 gcc_AC_PROG_GNAT
199
200 AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
201 ac_cv_prog_cc_no_long_long,
202 [save_CFLAGS="$CFLAGS"
203 CFLAGS="-Wno-long-long"
204 AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
205                ac_cv_prog_cc_no_long_long=no)
206 CFLAGS="$save_CFLAGS"])
207
208 if test x$have_gnat != xno ; then 
209 AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
210 ac_cv_prog_adac_no_long_long,
211 [cat >conftest.adb <<EOF
212 procedure conftest is begin null; end conftest;
213 EOF
214 if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
215   ac_cv_prog_adac_no_long_long=yes
216 else
217   ac_cv_prog_adac_no_long_long=no
218 fi
219 rm -f conftest*])
220 else
221   ac_cv_prog_adac_no_long_long=yes
222 fi
223
224 strict1_warn=
225 if test $ac_cv_prog_cc_no_long_long = yes && \
226     test $ac_cv_prog_adac_no_long_long = yes ; then
227   strict1_warn="-pedantic -Wno-long-long"
228 fi
229 AC_SUBST(strict1_warn)
230
231 AC_PROG_CPP
232 AC_C_INLINE
233 gcc_AC_C_VOLATILE
234
235 gcc_AC_C_LONG_DOUBLE
236 gcc_AC_C_LONG_LONG
237 gcc_AC_C__BOOL
238
239 # sizeof(char) is 1 by definition.
240 AC_COMPILE_CHECK_SIZEOF(short)
241 AC_COMPILE_CHECK_SIZEOF(int)
242 AC_COMPILE_CHECK_SIZEOF(long)
243 if test $ac_cv_c_long_long = yes; then
244   AC_COMPILE_CHECK_SIZEOF(long long)
245 fi
246 if test $ac_cv_c___int64 = yes; then
247   AC_COMPILE_CHECK_SIZEOF(__int64)
248 fi
249
250 gcc_AC_C_CHARSET
251
252 # If the native compiler is GCC, we can enable warnings even in stage1.  
253 # That's useful for people building cross-compilers, or just running a
254 # quick `make'.
255 warn_cflags=
256 if test "x$GCC" = "xyes"; then
257   warn_cflags='$(GCC_WARN_CFLAGS)'
258 fi
259 AC_SUBST(warn_cflags)
260
261 # Determine whether or not multilibs are enabled.
262 AC_ARG_ENABLE(multilib,
263 [  --enable-multilib       enable library support for multiple ABIs],
264 [], [enable_multilib=yes])
265 AC_SUBST(enable_multilib)
266
267 # Enable expensive internal checks
268 AC_ARG_ENABLE(checking,
269 [  --enable-checking[=LIST]
270                           enable expensive run-time checks.  With LIST,
271                           enable only specific categories of checks.
272                           Categories are: misc,tree,rtl,rtlflag,gc,gcac;
273                           default is misc,tree,gc,rtlflag],
274 [ac_checking=
275 ac_tree_checking=
276 ac_rtl_checking=
277 ac_rtlflag_checking=
278 ac_gc_checking=
279 ac_gc_always_collect=
280 case "${enableval}" in
281 yes)    ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;
282         ac_rtlflag_checking=1 ;;
283 no)     ;;
284 *)      IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
285         set fnord $enableval; shift
286         IFS="$ac_save_IFS"
287         for check
288         do
289                 case $check in
290                 misc)   ac_checking=1 ;;
291                 tree)   ac_tree_checking=1 ;;
292                 rtlflag)        ac_rtlflag_checking=1 ;;
293                 rtl)    ac_rtl_checking=1 ;;
294                 gc)     ac_gc_checking=1 ;;
295                 gcac)   ac_gc_always_collect=1 ;;
296                 valgrind)       ac_checking_valgrind=1 ;;
297                 *)      AC_MSG_ERROR(unknown check category $check) ;;
298                 esac
299         done
300         ;;
301 esac
302 ], 
303 # Enable some checks by default for development versions of GCC
304 [ac_checking=1; ac_tree_checking=1; ac_gc_checking=1; ac_rtlflag_checking=1;])
305 nocommon_flag=""
306 if test x$ac_checking != x ; then
307   AC_DEFINE(ENABLE_CHECKING, 1,
308 [Define if you want more run-time sanity checks.  This one gets a grab
309    bag of miscellaneous but relatively cheap checks.])
310   nocommon_flag=-fno-common
311 fi
312 AC_SUBST(nocommon_flag)
313 if test x$ac_tree_checking != x ; then
314   AC_DEFINE(ENABLE_TREE_CHECKING, 1,
315 [Define if you want all operations on trees (the basic data
316    structure of the front ends) to be checked for dynamic type safety
317    at runtime.  This is moderately expensive.])
318 fi
319 if test x$ac_rtl_checking != x ; then
320   AC_DEFINE(ENABLE_RTL_CHECKING, 1,
321 [Define if you want all operations on RTL (the basic data structure
322    of the optimizer and back end) to be checked for dynamic type safety
323    at runtime.  This is quite expensive.])
324 fi
325 if test x$ac_rtlflag_checking != x ; then
326   AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
327 [Define if you want RTL flag accesses to be checked against the RTL
328    codes that are supported for each access macro.  This is relatively
329    cheap.])
330 fi
331 if test x$ac_gc_checking != x ; then
332   AC_DEFINE(ENABLE_GC_CHECKING, 1,
333 [Define if you want the garbage collector to do object poisoning and
334    other memory allocation checks.  This is quite expensive.])
335 fi
336 if test x$ac_gc_always_collect != x ; then
337   AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
338 [Define if you want the garbage collector to operate in maximally
339    paranoid mode, validating the entire heap and collecting garbage at
340    every opportunity.  This is extremely expensive.])
341 fi
342 valgrind_path_defines=
343 valgrind_command=
344 if test x$ac_checking_valgrind != x ; then
345   # It is certainly possible that there's valgrind but no valgrind.h.
346   # GCC relies on making annotations so we must have both.
347   AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
348   AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
349         [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
350   if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then
351         AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h])
352   fi
353   valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
354   valgrind_command="$valgrind_path -q"
355   AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
356 [Define if you want to run subprograms and generated programs
357    through valgrind (a memory checker).  This is extremely expensive.])
358 fi
359 AC_SUBST(valgrind_path_defines)
360 AC_SUBST(valgrind_command)
361
362 # Enable code coverage collection
363 AC_ARG_ENABLE(coverage,
364 [  --enable-coverage[=LEVEL]
365                           enable compiler\'s code coverage collection.
366                           Use to measure compiler performance and locate
367                           unused parts of the compiler. With LEVEL, specificy
368                           optimization. Values are opt, noopt,
369                           default is noopt],
370 [case "${enableval}" in
371 yes|noopt)
372         coverage_flags="-fprofile-arcs -ftest-coverage -O0"
373         ;;
374 opt)
375         coverage_flags="-fprofile-arcs -ftest-coverage -O2"
376         ;;
377 *)
378         AC_MSG_ERROR(unknown coverage setting $enableval)
379         ;;
380 esac],
381 [coverage_flags=""])
382 AC_SUBST(coverage_flags)
383
384 AC_ARG_WITH(cpp_install_dir,
385 [  --with-cpp-install-dir=DIR
386                           install the user visible C preprocessor in DIR
387                           (relative to PREFIX) as well as PREFIX/bin],
388 [if test x$withval = xyes; then
389   AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
390 elif test x$withval != xno; then
391   cpp_install_dir=$withval
392 fi])
393
394 # Enable __cxa_atexit for C++.
395 AC_ARG_ENABLE(__cxa_atexit,
396 [  --enable-__cxa_atexit   enable __cxa_atexit for C++],
397 [], [])
398 if test x$enable___cxa_atexit = xyes; then
399   AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1,
400   [Define if you want to use __cxa_atexit, rather than atexit, to
401    register C++ destructors for local statics and global objects.
402    This is essential for fully standards-compliant handling of
403    destructors, but requires __cxa_atexit in libc.])
404 fi
405   
406 # Enable Multibyte Characters for C/C++
407 AC_ARG_ENABLE(c-mbchar,
408 [  --enable-c-mbchar       enable multibyte characters for C and C++],
409 if test x$enable_c_mbchar != xno; then
410   AC_DEFINE(MULTIBYTE_CHARS, 1,
411   [Define if you want the C and C++ compilers to support multibyte
412    character sets for source code.])
413 fi)
414   
415 # Enable threads
416 # Pass with no value to take the default
417 # Pass with a value to specify a thread package
418 AC_ARG_ENABLE(threads,
419 [  --enable-threads        enable thread usage for target GCC
420   --enable-threads=LIB    use LIB thread package for target GCC],,
421 enable_threads='')
422
423 enable_threads_flag=$enable_threads
424 # Check if a valid thread package
425 case x${enable_threads_flag} in
426         x | xno)
427                 # No threads
428                 target_thread_file='single'
429                 ;;
430         xyes)
431                 # default
432                 target_thread_file=''
433                 ;;
434         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
435         xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix)
436                 target_thread_file=$enable_threads_flag
437                 ;;
438         *)
439                 echo "$enable_threads is an unknown thread package" 1>&2
440                 exit 1
441                 ;;
442 esac
443
444 AC_ARG_ENABLE(objc-gc,
445 [  --enable-objc-gc       enable the use of Boehm's garbage collector with
446                           the GNU Objective-C runtime],
447 if test x$enable_objc_gc = xno; then
448         objc_boehm_gc=''
449 else
450         objc_boehm_gc=1
451 fi,
452 objc_boehm_gc='')
453
454 AC_ARG_WITH(dwarf2,
455 [  --with-dwarf2           force the default debug format to be DWARF 2],
456 dwarf2="$with_dwarf2",
457 dwarf2=no)
458
459 AC_ARG_ENABLE(shared,
460 [  --disable-shared        don't provide a shared libgcc],
461 [
462   case $enable_shared in
463   yes | no) ;;
464   *)
465     enable_shared=no
466     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
467     for pkg in $enableval; do
468       if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
469         enable_shared=yes
470       fi
471     done
472     IFS="$ac_save_ifs"
473     ;;
474   esac
475 ], [enable_shared=yes])
476 AC_SUBST(enable_shared)
477
478 AC_ARG_WITH(sysroot,
479 [  --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
480 [
481  case ${with_sysroot} in
482  yes) TARGET_SYSTEM_ROOT='${gcc_tooldir}/sys-root' ;;
483  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
484  esac
485    
486  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
487  CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
488 ], [
489  TARGET_SYSTEM_ROOT=
490  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
491  CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
492 ])
493 AC_SUBST(TARGET_SYSTEM_ROOT)
494 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
495 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
496
497 # Stage specific cflags for build.
498 stage1_cflags=
499 case $build in
500 vax-*-*)
501   if test x$GCC = xyes
502   then
503     stage1_cflags="-Wa,-J"
504   else
505     stage1_cflags="-J"
506   fi
507   ;;
508 powerpc-*-darwin*)
509   # The spiffy cpp-precomp chokes on some legitimate constructs in GCC
510   # sources; use -no-cpp-precomp to get to GNU cpp.
511   # Apple's GCC has bugs in designated initializer handling, so disable
512   # that too.
513   stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
514   ;;
515 esac
516 AC_SUBST(stage1_cflags)
517
518 AC_PROG_MAKE_SET
519
520 AC_MSG_CHECKING([whether a default assembler was specified])
521 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
522     if test x"$gas_flag" = x"no"; then
523         AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
524     else
525         AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
526     fi
527 else
528     AC_MSG_RESULT(no)
529 fi
530
531 AC_MSG_CHECKING([whether a default linker was specified])
532 if test x"${DEFAULT_LINKER+set}" = x"set"; then
533     if test x"$gnu_ld_flag" = x"no"; then
534         AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
535     else
536         AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
537     fi
538 else
539     AC_MSG_RESULT(no)
540 fi
541
542 AC_MSG_CHECKING(for GNU C library)
543 AC_CACHE_VAL(gcc_cv_glibc,
544 [AC_TRY_COMPILE(
545   [#include <features.h>],[
546 #if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
547 #error Not a GNU C library system
548 #endif], 
549   [gcc_cv_glibc=yes], 
550   gcc_cv_glibc=no)])
551 AC_MSG_RESULT($gcc_cv_glibc)
552 if test $gcc_cv_glibc = yes; then
553   AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
554 fi
555
556 # Find some useful tools
557 AC_PROG_AWK
558 gcc_AC_PROG_LN
559 gcc_AC_PROG_LN_S
560 AC_PROG_RANLIB
561 gcc_AC_PROG_INSTALL
562
563 AC_HEADER_STDC
564 AC_HEADER_TIME
565 gcc_AC_HEADER_STDBOOL
566 gcc_AC_HEADER_STRING
567 AC_HEADER_SYS_WAIT
568 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
569                  fcntl.h unistd.h sys/file.h sys/time.h \
570                  sys/resource.h sys/param.h sys/times.h sys/stat.h \
571                  direct.h malloc.h langinfo.h)
572
573 # Check for thread headers.
574 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
575 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
576
577 # These tests can't be done till we know if we have limits.h.
578 gcc_AC_C_CHAR_BIT
579 AC_C_BIGENDIAN_CROSS
580 gcc_AC_C_FLOAT_FORMAT
581
582 # See if we have the mktemp command.
583 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
584
585 # Do we have a single-tree copy of texinfo?
586 if test -f $srcdir/../texinfo/Makefile.in; then
587   MAKEINFO='$(objdir)/../texinfo/makeinfo/makeinfo'
588   gcc_cv_prog_makeinfo_modern=yes
589   AC_MSG_RESULT([Using makeinfo from the unified source tree.])
590 else
591   # See if makeinfo has been installed and is modern enough
592   # that we can use it.
593   gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
594   [GNU texinfo.* \([0-9][0-9.]*\)],
595   [4.[1-9]*])
596 fi
597
598 if test $gcc_cv_prog_makeinfo_modern = no; then
599   AC_MSG_WARN([
600 *** Makeinfo is missing or too old.
601 *** Info documentation will not be built.])
602   BUILD_INFO=
603 else
604   BUILD_INFO=info               AC_SUBST(BUILD_INFO)
605 fi
606
607 # Is pod2man recent enough to regenerate manpages?
608 AC_MSG_CHECKING([for recent Pod::Man])
609 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
610   AC_MSG_RESULT(yes)
611   GENERATED_MANPAGES=generated-manpages         AC_SUBST(GENERATED_MANPAGES)
612 else
613   AC_MSG_RESULT(no)
614   GENERATED_MANPAGES=
615 fi
616
617 # How about lex?
618 dnl Don't use AC_PROG_LEX; we insist on flex.
619 dnl LEXLIB is not useful in gcc.
620 if test -f $srcdir/../flex/skel.c; then
621   FLEX='$(objdir)/../flex/flex'
622 else
623   AC_CHECK_PROG(FLEX, flex, flex, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing flex)
624 fi
625
626 # Bison?
627 # The -L switch is so bison can find its skeleton file.
628 if test -f $srcdir/../bison/bison.simple; then
629   BISON='$(objdir)/../bison/bison -L $(srcdir)/../bison/'
630 else
631   AC_CHECK_PROG(BISON, bison, bison, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison)
632 fi
633
634 # These libraries may be used by collect2.
635 # We may need a special search path to get them linked.
636 AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
637 [save_LIBS="$LIBS"
638 for libs in '' -lld -lmld \
639                 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
640                 '-L/usr/lib/cmplrs/cc3.11 -lmld'
641 do
642         LIBS="$libs"
643         AC_TRY_LINK_FUNC(ldopen,
644                 [gcc_cv_collect2_libs="$libs"; break])
645 done
646 LIBS="$save_LIBS"
647 test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
648 case $gcc_cv_collect2_libs in
649         "none required")        ;;
650         *)      COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
651 esac
652 AC_SUBST(COLLECT2_LIBS)
653
654 # When building Ada code on Alpha, we need exc_resume which is usually in
655 # -lexc.  So test for it.
656 save_LIBS="$LIBS"
657 LIBS=
658 AC_SEARCH_LIBS(exc_resume, exc)
659 GNAT_LIBEXC="$LIBS"
660 LIBS="$save_LIBS"
661 AC_SUBST(GNAT_LIBEXC)
662
663 # See if the stage1 system preprocessor understands the ANSI C
664 # preprocessor stringification operator.  (Used by symcat.h.)
665 AC_C_STRINGIZE
666
667 # Use <inttypes.h> only if it exists,
668 # doesn't clash with <sys/types.h>, and declares intmax_t.
669 AC_MSG_CHECKING(for inttypes.h)
670 AC_CACHE_VAL(gcc_cv_header_inttypes_h,
671 [AC_TRY_COMPILE(
672   [#include <sys/types.h>
673 #include <inttypes.h>],
674   [intmax_t i = -1;],
675   [gcc_cv_header_inttypes_h=yes],
676   gcc_cv_header_inttypes_h=no)])
677 AC_MSG_RESULT($gcc_cv_header_inttypes_h)
678 if test $gcc_cv_header_inttypes_h = yes; then
679   AC_DEFINE(HAVE_INTTYPES_H, 1,
680         [Define if you have a working <inttypes.h> header file.])
681 fi
682
683 dnl Disabled until we have a complete test for buggy enum bitfields.
684 dnl gcc_AC_C_ENUM_BF_UNSIGNED
685
686 AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \
687         sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
688         fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
689         scandir alphasort)
690
691 AC_CHECK_TYPE(ssize_t, int)
692
693 # Try to determine the array type of the second argument of getgroups
694 # for the target system (int or gid_t).
695 AC_TYPE_GETGROUPS
696 if test "${target}" = "${build}"; then
697   TARGET_GETGROUPS_T=$ac_cv_type_getgroups
698 else
699   case "${target}" in
700         # This condition may need some tweaking.  It should include all
701         # targets where the array type of the second argument of getgroups
702         # is int and the type of gid_t is not equivalent to int.
703         *-*-sunos* | *-*-ultrix*)
704                 TARGET_GETGROUPS_T=int
705                 ;;
706         *)
707                 TARGET_GETGROUPS_T=gid_t
708                 ;;
709   esac
710 fi
711 AC_SUBST(TARGET_GETGROUPS_T)
712
713 gcc_AC_FUNC_PRINTF_PTR
714
715 case "${host}" in
716 *-*-uwin*)
717   AC_MSG_ERROR([
718 *** UWIN may not be used as a host platform because
719 *** linking with posix.dll is not allowed by the GNU GPL])
720   ;;
721 *-*-*vms*)
722   # Under VMS, vfork works very different than on Unix. The standard test 
723   # won't work, and it isn't easily adaptable. It makes more sense to
724   # just force it.
725   ac_cv_func_vfork_works=yes
726   ;;
727 esac
728 AC_FUNC_VFORK
729 AC_FUNC_MMAP_ANYWHERE
730 AC_FUNC_MMAP_FILE
731
732 AM_ICONV
733
734 # We will need to find libiberty.h and ansidecl.h
735 saved_CFLAGS="$CFLAGS"
736 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
737 gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \
738         strsignal putc_unlocked fputs_unlocked fwrite_unlocked \
739         fprintf_unlocked strstr errno vasprintf \
740         malloc realloc calloc free basename getopt clock, , ,[
741 #include "ansidecl.h"
742 #include "system.h"])
743
744 gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
745 #include "ansidecl.h"
746 #include "system.h"
747 #ifdef HAVE_SYS_RESOURCE_H
748 #include <sys/resource.h>
749 #endif
750 ])
751
752 gcc_AC_CHECK_DECLS(times, , ,[
753 #include "ansidecl.h"
754 #include "system.h"
755 #ifdef HAVE_SYS_TIMES_H
756 #include <sys/times.h>
757 #endif
758 ])
759
760 # More time-related stuff.
761 AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
762 AC_TRY_COMPILE([
763 #include "ansidecl.h"
764 #include "system.h"
765 #ifdef HAVE_SYS_TIMES_H
766 #include <sys/times.h>
767 #endif
768 ], [struct tms tms;], ac_cv_struct_tms=yes, ac_cv_struct_tms=no)])
769 if test $ac_cv_struct_tms = yes; then
770   AC_DEFINE(HAVE_STRUCT_TMS, 1,
771   [Define if <sys/times.h> defines struct tms.])
772 fi
773
774 # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
775 # revisit after autoconf 2.50.
776 AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
777 AC_TRY_COMPILE([
778 #include "ansidecl.h"
779 #include "system.h"
780 ], [clock_t x;], gcc_cv_type_clock_t=yes, gcc_cv_type_clock_t=no)])
781 if test $gcc_cv_type_clock_t = yes; then
782   AC_DEFINE(HAVE_CLOCK_T, 1,
783   [Define if <time.h> defines clock_t.])
784 fi
785
786 AC_ARG_ENABLE(initfini-array,
787         [  --enable-initfini-array      use .init_array/.fini_array sections],
788         gcc_cv_initfinit_array=$enableval, [gcc_AC_INITFINI_ARRAY])
789
790 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
791 CFLAGS="$saved_CFLAGS"
792
793 # mkdir takes a single argument on some systems. 
794 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
795
796 # File extensions
797 manext='.1'
798 objext='.o'
799 AC_SUBST(manext)
800 AC_SUBST(objext)
801
802 # With Setjmp/Longjmp based exception handling.
803 AC_ARG_ENABLE(sjlj-exceptions,
804 [  --enable-sjlj-exceptions
805                           arrange to use setjmp/longjmp exception handling],
806 [sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
807 AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
808   [Define 0/1 to force the choice for exception handling model.])])
809
810 AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no)
811 # Use libunwind based exception handling.
812 AC_ARG_ENABLE(libunwind-exceptions,
813 [  --enable-libunwind-exceptions  force use libunwind for exceptions],
814 use_libunwind_exceptions=$enableval,
815 use_libunwind_exceptions=$use_libunwind_default)
816 if test x"$use_libunwind_exceptions" = xyes; then
817    AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1,
818         [Define if gcc should use -lunwind.])
819 fi
820
821 target_gtfiles=
822 build_xm_file=
823 build_xm_defines=
824 build_install_headers_dir=install-headers-tar
825 build_exeext=
826 host_xm_file=
827 host_xm_defines=
828 host_xmake_file=
829 host_truncate_target=
830 host_exeext=
831
832 # Decode the host machine, then the target machine.
833 # For the host machine, we save the xm_file variable as host_xm_file;
834 # then we decode the target machine and forget everything else
835 # that came from the host machine.
836 for machine in $build $host $target; do
837         . ${srcdir}/config.gcc
838 done
839
840 extra_objs="${host_extra_objs} ${extra_objs}"
841
842 # Default the target-machine variables that were not explicitly set.
843 if test x"$tm_file" = x
844 then tm_file=$cpu_type/$cpu_type.h; fi
845
846 if test x"$extra_headers" = x
847 then extra_headers=; fi
848
849 if test x$md_file = x
850 then md_file=$cpu_type/$cpu_type.md; fi
851
852 if test x$out_file = x
853 then out_file=$cpu_type/$cpu_type.c; fi
854
855 if test x"$tmake_file" = x
856 then tmake_file=$cpu_type/t-$cpu_type
857 fi
858
859 if test x"$dwarf2" = xyes
860 then tm_file="$tm_file tm-dwarf2.h"
861 fi
862
863 # Say what files are being used for the output code and MD file.
864 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
865 echo "Using \`$srcdir/config/$md_file' as machine description file."
866
867 # If any of the xm_file variables contain nonexistent files, warn
868 # about them and drop them.
869
870 bx=
871 for x in $build_xm_file; do
872   if    test -f $srcdir/config/$x
873   then      bx="$bx $x"
874   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
875   fi
876 done
877 build_xm_file="$bx"
878
879 hx=
880 for x in $host_xm_file; do
881   if    test -f $srcdir/config/$x
882   then      hx="$hx $x"
883   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
884   fi
885 done
886 host_xm_file="$hx"
887
888 tx=
889 for x in $xm_file; do
890   if    test -f $srcdir/config/$x
891   then      tx="$tx $x"
892   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
893   fi
894 done
895 xm_file="$tx"
896
897 count=a
898 for f in $tm_file; do
899         count=${count}x
900 done
901 if test $count = ax; then
902         echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
903 else
904         echo "Using the following target machine macro files:"
905         for f in $tm_file; do
906                 echo "  $srcdir/config/$f"
907         done
908 fi
909
910 if test x$need_64bit_hwint = xyes; then
911         AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1,
912 [Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).])
913 fi
914
915 count=a
916 for f in $host_xm_file; do
917         count=${count}x
918 done
919 if test $count = a; then
920         :
921 elif test $count = ax; then
922         echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
923 else
924         echo "Using the following host machine macro files:"
925         for f in $host_xm_file; do
926                 echo "  $srcdir/config/$f"
927         done
928 fi
929
930 if test "$host_xm_file" != "$build_xm_file"; then
931         count=a
932         for f in $build_xm_file; do
933                 count=${count}x
934         done
935         if test $count = a; then
936                 :
937         elif test $count = ax; then
938                 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
939         else
940                 echo "Using the following build machine macro files:"
941                 for f in $build_xm_file; do
942                         echo "  $srcdir/config/$f"
943                 done
944         fi
945 fi
946
947 if test x$thread_file = x; then
948         if test x$target_thread_file != x; then
949                 thread_file=$target_thread_file
950         else
951                 thread_file='single'
952         fi
953 fi
954
955 # Look for a file containing extra machine modes.
956 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
957   extra_modes_file='$(srcdir)'/config/${extra_modes}
958   AC_SUBST(extra_modes_file)
959   AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "$extra_modes",
960   [Define to the name of a file containing a list of extra machine modes
961    for this architecture.])
962   AC_DEFINE(EXTRA_CC_MODES, 1,
963   [Define if the target architecture needs extra machine modes to represent
964    the results of comparisons.])
965 fi
966
967 # auto-host.h is the file containing items generated by autoconf and is
968 # the first file included by config.h.
969 # If host=build, it is correct to have bconfig include auto-host.h
970 # as well.  If host!=build, we are in error and need to do more 
971 # work to find out the build config parameters.
972 if test x$host = x$build
973 then
974         build_auto=auto-host.h
975         FORBUILD=..
976 else
977         # We create a subdir, then run autoconf in the subdir.
978         # To prevent recursion we set host and build for the new
979         # invocation of configure to the build for this invocation
980         # of configure. 
981         tempdir=build.$$
982         rm -rf $tempdir
983         mkdir $tempdir
984         cd $tempdir
985         case ${srcdir} in
986         /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
987         *) realsrcdir=../${srcdir};;
988         esac
989         saved_CFLAGS="${CFLAGS}"
990         CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
991         ${realsrcdir}/configure \
992                 --target=$target_alias --host=$build_alias --build=$build_alias
993         CFLAGS="${saved_CFLAGS}"
994
995         # We just finished tests for the build machine, so rename
996         # the file auto-build.h in the gcc directory.
997         mv auto-host.h ../auto-build.h
998         cd ..
999         rm -rf $tempdir
1000         build_auto=auto-build.h
1001         FORBUILD=../build-$build_alias
1002 fi
1003 AC_SUBST(FORBUILD)
1004
1005 tm_file="${tm_file} defaults.h"
1006 tm_p_file="${tm_p_file} tm-preds.h"
1007 host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1008 build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
1009 xm_file="ansidecl.h ${xm_file}"
1010
1011 # Truncate the target if necessary
1012 if test x$host_truncate_target != x; then
1013         target=`echo $target | sed -e 's/\(..............\).*/\1/'`
1014 fi
1015
1016 # Get the version trigger filename from the toplevel
1017 if test "${with_gcc_version_trigger+set}" = set; then
1018         gcc_version_trigger=$with_gcc_version_trigger
1019 else
1020         gcc_version_trigger=${srcdir}/version.c
1021 fi
1022 changequote(,)dnl
1023 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'`
1024 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1025
1026 # Compile in configure arguments.
1027 if test -f configargs.h ; then
1028         # Being re-configured.
1029         gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
1030         gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1031 else
1032         gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1033 fi
1034 cat > configargs.h <<EOF
1035 /* Generated automatically. */
1036 static const char configuration_arguments[] = "$gcc_config_arguments";
1037 static const char thread_model[] = "$thread_file";
1038 EOF
1039 changequote([,])dnl
1040
1041 # Internationalization
1042 PACKAGE=gcc
1043 VERSION="$gcc_version"
1044 AC_SUBST(PACKAGE)
1045 AC_SUBST(VERSION)
1046
1047 # Enable NLS support by default
1048 AC_ARG_ENABLE(nls,
1049   [  --enable-nls            use Native Language Support (default)],
1050   , enable_nls=yes)
1051
1052 # if cross compiling, disable NLS support.
1053 # It's not worth the trouble, at least for now.
1054
1055 if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then
1056   AC_MSG_WARN(Disabling NLS support for canadian cross compiler.)
1057   enable_nls=no
1058 fi
1059
1060 AM_GNU_GETTEXT
1061
1062 # Windows32 Registry support for specifying GCC installation paths.
1063 AC_ARG_ENABLE(win32-registry,
1064 [  --disable-win32-registry
1065                           disable lookup of installation paths in the
1066                           Registry on Windows hosts
1067   --enable-win32-registry enable registry lookup (default)
1068   --enable-win32-registry=KEY
1069                           use KEY instead of GCC version as the last portion
1070                           of the registry key],,)
1071 case $host_os in
1072         win32 | pe | cygwin* | mingw32* | uwin*)
1073 AC_MSG_CHECKING(whether windows registry support is requested)
1074 if test "x$enable_win32_registry" != xno; then
1075   AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1076 [Define to 1 if installation paths should be looked up in Windows32
1077    Registry. Ignored on non windows32 hosts.])
1078   AC_MSG_RESULT(yes)
1079   AC_SEARCH_LIBS(RegOpenKeyExA, advapi32)
1080 else
1081   AC_MSG_RESULT(no)
1082 fi
1083
1084 # Check if user specified a different registry key.
1085 case "x${enable_win32_registry}" in
1086 x | xyes)
1087   # default.
1088   gcc_cv_win32_registry_key="$VERSION"
1089   ;;
1090 xno)
1091   # no registry lookup.
1092   gcc_cv_win32_registry_key=''
1093   ;;
1094 *)
1095   # user-specified key.
1096   gcc_cv_win32_registry_key="$enable_win32_registry"
1097   ;;
1098 esac
1099
1100 if test "x$enable_win32_registry" != xno; then
1101   AC_MSG_CHECKING(registry key on windows hosts)
1102   AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$gcc_cv_win32_registry_key",
1103         [Define to be the last portion of registry key on windows hosts.])
1104   AC_MSG_RESULT($gcc_cv_win32_registry_key)
1105 fi
1106 ;;
1107 esac
1108
1109 # Get an absolute path to the GCC top-level source directory
1110 holddir=`${PWDCMD-pwd}`
1111 cd $srcdir
1112 topdir=`${PWDCMD-pwd}`
1113 cd $holddir
1114
1115 # Conditionalize the makefile for this host machine.
1116 # Make-host contains the concatenation of all host makefile fragments
1117 # [there can be more than one].  This file is built by configure.frag.
1118 host_overrides=Make-host
1119 dep_host_xmake_file=
1120 for f in .. ${host_xmake_file}
1121 do
1122         if test -f ${srcdir}/config/$f
1123         then
1124                 dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f"
1125         fi
1126 done
1127
1128 # Conditionalize the makefile for this target machine.
1129 # Make-target contains the concatenation of all host makefile fragments
1130 # [there can be more than one].  This file is built by configure.frag.
1131 target_overrides=Make-target
1132 dep_tmake_file=
1133 for f in .. ${tmake_file}
1134 do
1135         if test -f ${srcdir}/config/$f
1136         then
1137                 dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f"
1138         fi
1139 done
1140
1141 # If the host doesn't support symlinks, modify CC in
1142 # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
1143 # Otherwise, we can use "CC=$(CC)".
1144 rm -f symtest.tem
1145 if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null
1146 then
1147         cc_set_by_configure="\$(CC)"
1148         quoted_cc_set_by_configure="\$(CC)"
1149         stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
1150         quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
1151 else
1152         rm -f symtest.tem
1153         if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null
1154         then
1155                 symbolic_link="cp -p"
1156         else
1157                 symbolic_link="cp"
1158         fi
1159         cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
1160         quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
1161         stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
1162         quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
1163 fi
1164 rm -f symtest.tem
1165
1166 out_object_file=`basename $out_file .c`.o
1167
1168 tm_file_list=
1169 for f in $tm_file; do
1170   case $f in
1171     ansidecl.h )
1172        tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
1173     defaults.h )
1174        tm_file_list="${tm_file_list} \$(srcdir)/$f" ;;
1175     *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;;
1176   esac
1177 done
1178
1179 tm_p_file_list=
1180 for f in $tm_p_file; do
1181   case $f in
1182     tm-preds.h )
1183        tm_p_file_list="${tm_p_file_list} $f" ;;
1184     *) tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" ;;
1185   esac
1186 done
1187
1188 host_xm_file_list=
1189 for f in $host_xm_file; do
1190   case $f in
1191     ansidecl.h )
1192        host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
1193     auto-host.h )
1194        host_xm_file_list="${host_xm_file_list} $f" ;;
1195     defaults.h )
1196        host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;;
1197     *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;;
1198   esac
1199 done
1200
1201 build_xm_file_list=
1202 for f in $build_xm_file; do
1203   case $f in
1204     ansidecl.h )
1205        build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
1206     auto-build.h | auto-host.h )
1207        build_xm_file_list="${build_xm_file_list} $f" ;;
1208     defaults.h )
1209        host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;;
1210     *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;;
1211   esac
1212 done
1213
1214 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
1215 # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1216 CROSS=                                          AC_SUBST(CROSS)
1217 ALL=all.internal                                AC_SUBST(ALL)
1218 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
1219 if test x$host != x$target
1220 then
1221         CROSS="-DCROSS_COMPILE"
1222         ALL=all.cross
1223         SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
1224         case "$host","$target" in
1225             i?86-*-*,x86_64-*-* \
1226             | powerpc*-*-*,powerpc64*-*-*)
1227                 CROSS="$CROSS -DNATIVE_CROSS" ;;
1228         esac
1229 fi
1230
1231 # If this is a cross-compiler that does not
1232 # have its own set of headers then define
1233 # inhibit_libc
1234
1235 # If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS.
1236 # This prevents libgcc2 from containing any code which requires libc
1237 # support.
1238 inhibit_libc=
1239 if { test x$host != x$target && test "x$with_headers" = x &&
1240      test "x$with_sysroot" = x ; } || test x$with_newlib = xyes ; then
1241        inhibit_libc=-Dinhibit_libc
1242 fi
1243 AC_SUBST(inhibit_libc)
1244
1245 # When building gcc with a cross-compiler, we need to adjust things so
1246 # that the generator programs are still built with the native compiler.
1247 # Also, we cannot run fixincludes or fix-header.
1248
1249 # These are the normal (build=host) settings:
1250 BUILD_PREFIX=                   AC_SUBST(BUILD_PREFIX)
1251 BUILD_PREFIX_1=ignore-          AC_SUBST(BUILD_PREFIX_1)
1252 BUILD_CC='$(CC)'                AC_SUBST(BUILD_CC)
1253 BUILD_CFLAGS='$(ALL_CFLAGS)'    AC_SUBST(BUILD_CFLAGS)
1254
1255 STMP_FIXINC=stmp-fixinc         AC_SUBST(STMP_FIXINC)
1256 STMP_FIXPROTO=stmp-fixproto     AC_SUBST(STMP_FIXPROTO)
1257
1258 # And these apply if build != host.
1259 if test x$build != x$host
1260 then
1261     BUILD_PREFIX=build-
1262     BUILD_PREFIX_1=build-
1263     BUILD_CC='$(CC_FOR_BUILD)'
1264     BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
1265
1266     STMP_FIXINC=
1267     STMP_FIXPROTO=
1268 fi
1269
1270 # Expand extra_headers to include complete path.
1271 # This substitutes for lots of t-* files.
1272 extra_headers_list=
1273 if test "x$extra_headers" = x
1274 then true
1275 else
1276         # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers.
1277         for file in $extra_headers;
1278         do
1279                 extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
1280         done
1281 fi
1282
1283 if test x$use_collect2 = xno; then
1284         use_collect2=
1285 fi
1286
1287 # Add a definition of USE_COLLECT2 if system wants one.
1288 if test x$use_collect2 != x
1289 then
1290         host_xm_defines="${host_xm_defines} USE_COLLECT2"
1291         xm_defines="${xm_defines} USE_COLLECT2"
1292 fi
1293
1294 # If we have gas in the build tree, make a link to it.
1295 if test -f ../gas/Makefile; then
1296         rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
1297 fi
1298
1299 # If we have nm and objdump in the build tree, make a link to them.
1300 if test -f ../binutils/Makefile; then
1301         rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
1302         rm -f objdump; $symbolic_link ../binutils/objdump$host_exeext objdump$host_exeext 2>/dev/null
1303 fi
1304
1305 # If we have ld in the build tree, make a link to it.
1306 if test -f ../ld/Makefile; then
1307         rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
1308 fi
1309
1310 # Figure out what assembler we will be using.
1311 AC_MSG_CHECKING(what assembler to use)
1312 gcc_cv_as=
1313 gcc_cv_gas_major_version=
1314 gcc_cv_gas_minor_version=
1315 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
1316 gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1317 if test -x "$DEFAULT_ASSEMBLER"; then
1318         gcc_cv_as="$DEFAULT_ASSEMBLER"
1319 elif test -x "$AS"; then
1320         gcc_cv_as="$AS"
1321 elif test -x as$host_exeext; then
1322         # Build using assembler in the current directory.
1323         gcc_cv_as=./as$host_exeext
1324 elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then
1325         # Single tree build which includes gas.
1326         for f in $gcc_cv_as_bfd_srcdir/configure $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
1327         do
1328 changequote(,)dnl
1329                 gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
1330 changequote([,])dnl
1331                 if test x$gcc_cv_gas_version != x; then
1332                         break
1333                 fi
1334         done
1335 changequote(,)dnl
1336         gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
1337         gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1338         gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"`
1339 changequote([,])dnl
1340 fi
1341
1342 if test "x$gcc_cv_as" = x; then
1343         # Search the same directories that the installed compiler will
1344         # search.  Else we may find the wrong assembler and lose.  If we
1345         # do not find a suitable assembler binary, then try the user's
1346         # path.
1347         #
1348         # Also note we have to check MD_EXEC_PREFIX before checking the
1349         # user's path.  Unfortunately, there is no good way to get at the
1350         # value of MD_EXEC_PREFIX here.  So we do a brute force search
1351         # through all the known MD_EXEC_PREFIX values.  Ugh.  This needs
1352         # to be fixed as part of the make/configure rewrite too.
1353
1354         if test "x$exec_prefix" = xNONE; then
1355                 if test "x$prefix" = xNONE; then
1356                         test_prefix=/usr/local
1357                 else
1358                         test_prefix=$prefix
1359                 fi
1360         else
1361                 test_prefix=$exec_prefix
1362         fi
1363
1364         # If the loop below does not find an assembler, then use whatever
1365         # one we can find in the users's path.
1366         # user's path.
1367         if test "x$program_prefix" != xNONE; then
1368                 gcc_cv_as=${program_prefix}as$host_exeext
1369         else
1370                 gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext
1371         fi
1372
1373         test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
1374                    $test_prefix/lib/gcc-lib/$target_alias \
1375                    /usr/lib/gcc/$target_alias/$gcc_version \
1376                    /usr/lib/gcc/$target_alias \
1377                    $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
1378                    $test_prefix/$target_alias/bin"
1379
1380         if test x$host = x$target; then
1381             test_dirs="$test_dirs \
1382                    /usr/libexec \
1383                    /usr/ccs/gcc \
1384                    /usr/ccs/bin \
1385                    /udk/usr/ccs/bin \
1386                    /bsd43/usr/lib/cmplrs/cc \
1387                    /usr/cross64/usr/bin \
1388                    /usr/lib/cmplrs/cc \
1389                    /sysv/usr/lib/cmplrs/cc \
1390                    /svr4/usr/lib/cmplrs/cc \
1391                    /usr/bin"
1392         fi
1393
1394         for dir in $test_dirs; do
1395                 if test -x $dir/as$host_exeext; then
1396                         gcc_cv_as=$dir/as$host_exeext
1397                         break;
1398                 fi
1399         done
1400 fi
1401 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1402   AC_MSG_RESULT("newly built gas")
1403 else
1404   AC_MSG_RESULT($gcc_cv_as)
1405 fi
1406
1407 # Figure out what linker we will be using.
1408 AC_MSG_CHECKING(what linker to use)
1409 gcc_cv_ld=
1410 gcc_cv_gld_major_version=
1411 gcc_cv_gld_minor_version=
1412 gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
1413 gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1414 if test -x "$DEFAULT_LINKER"; then
1415         gcc_cv_ld="$DEFAULT_LINKER"
1416 elif test -x "$LD"; then
1417         gcc_cv_ld="$LD"
1418 elif test -x ld$host_exeext; then
1419         # Build using linker in the current directory.
1420         gcc_cv_ld=./ld$host_exeext
1421 elif test -f $gcc_cv_ld_gld_srcdir/configure.in -a -f ../ld/Makefile; then
1422         # Single tree build which includes ld.
1423         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
1424         do
1425 changequote(,)dnl
1426                 gcc_cv_gld_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
1427 changequote([,])dnl
1428                 if test x$gcc_cv_gld_version != x; then
1429                         break
1430                 fi
1431         done
1432 changequote(,)dnl
1433         gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
1434         gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1435 changequote([,])dnl
1436 fi
1437
1438 if test "x$gcc_cv_ld" = x; then
1439         # Search the same directories that the installed compiler will
1440         # search.  Else we may find the wrong linker and lose.  If we
1441         # do not find a suitable linker binary, then try the user's
1442         # path.
1443         #
1444         # Also note we have to check MD_EXEC_PREFIX before checking the
1445         # user's path.  Unfortunately, there is no good way to get at the
1446         # value of MD_EXEC_PREFIX here.  So we do a brute force search
1447         # through all the known MD_EXEC_PREFIX values.  Ugh.  This needs
1448         # to be fixed as part of the make/configure rewrite too.
1449
1450         if test "x$exec_prefix" = xNONE; then
1451                 if test "x$prefix" = xNONE; then
1452                         test_prefix=/usr/local
1453                 else
1454                         test_prefix=$prefix
1455                 fi
1456         else
1457                 test_prefix=$exec_prefix
1458         fi
1459
1460         # If the loop below does not find an linker, then use whatever
1461         # one we can find in the users's path.
1462         # user's path.
1463         if test "x$program_prefix" != xNONE; then
1464                 gcc_cv_ld=${program_prefix}ld$host_exeext
1465         else
1466                 gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext
1467         fi
1468
1469         test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
1470                    $test_prefix/lib/gcc-lib/$target_alias \
1471                    /usr/lib/gcc/$target_alias/$gcc_version \
1472                    /usr/lib/gcc/$target_alias \
1473                    $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
1474                    $test_prefix/$target_alias/bin"
1475
1476         if test x$host = x$target; then
1477             test_dirs="$test_dirs \
1478                    /usr/libexec \
1479                    /usr/ccs/gcc \
1480                    /usr/ccs/bin \
1481                    /udk/usr/ccs/bin \
1482                    /bsd43/usr/lib/cmplrs/cc \
1483                    /usr/cross64/usr/bin \
1484                    /usr/lib/cmplrs/cc \
1485                    /sysv/usr/lib/cmplrs/cc \
1486                    /svr4/usr/lib/cmplrs/cc \
1487                    /usr/bin"
1488         fi
1489
1490         for dir in $test_dirs; do
1491                 if test -x $dir/ld$host_exeext; then
1492                         gcc_cv_ld=$dir/ld$host_exeext
1493                         break;
1494                 fi
1495         done
1496 fi
1497 if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
1498   AC_MSG_RESULT("newly built ld")
1499 else
1500   AC_MSG_RESULT($gcc_cv_ld)
1501 fi
1502
1503 # Figure out what nm we will be using.
1504 AC_MSG_CHECKING(what nm to use)
1505 if test -x nm$host_exeext; then
1506         gcc_cv_nm=./nm$host_exeext
1507 elif test "x$program_prefix" != xNONE; then
1508         gcc_cv_nm=${program_prefix}nm$host_exeext
1509 else
1510         gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext
1511 fi
1512 AC_MSG_RESULT($gcc_cv_nm)
1513
1514 # Figure out what objdump we will be using.
1515 AC_MSG_CHECKING(what objdump to use)
1516 if test -x objdump$host_exeext; then
1517         gcc_cv_objdump=./objdump$host_exeext
1518 elif test "x$program_prefix" != xNONE; then
1519         gcc_cv_objdump=${program_prefix}objdump$host_exeext
1520 else
1521         gcc_cv_objdump=`echo objdump | sed ${program_transform_name}`$host_exeext
1522 fi
1523 AC_MSG_RESULT($gcc_cv_objdump)
1524
1525 # Figure out what assembler alignment features are present.
1526 AC_MSG_CHECKING(assembler alignment features)
1527 gcc_cv_as_alignment_features=none
1528 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1529         # Gas version 2.6 and later support for .balign and .p2align.
1530         # bytes to skip when using .p2align.
1531         if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then
1532                 gcc_cv_as_alignment_features=".balign and .p2align"
1533                 AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
1534         fi
1535         # Gas version 2.8 and later support specifying the maximum
1536         # bytes to skip when using .p2align.
1537         if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then
1538                 gcc_cv_as_alignment_features=".p2align including maximum skip"
1539                 AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
1540         fi
1541 elif test x$gcc_cv_as != x; then
1542         # Check if we have .balign and .p2align
1543         echo ".balign  4" > conftest.s
1544         echo ".p2align  2" >> conftest.s
1545         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1546                 gcc_cv_as_alignment_features=".balign and .p2align"
1547                 AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
1548         fi
1549         rm -f conftest.s conftest.o
1550         # Check if specifying the maximum bytes to skip when
1551         # using .p2align is supported.
1552         echo ".p2align 4,,7" > conftest.s
1553         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1554                 gcc_cv_as_alignment_features=".p2align including maximum skip"
1555                 AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
1556         fi
1557         rm -f conftest.s conftest.o
1558 fi
1559 AC_MSG_RESULT($gcc_cv_as_alignment_features)
1560
1561 AC_MSG_CHECKING(assembler subsection support)
1562 gcc_cv_as_subsections=no
1563 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1564   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1565     gcc_cv_as_subsections="working .subsection -1"
1566   fi
1567 elif test x$gcc_cv_as != x; then
1568         # Check if we have .subsection
1569         echo ".subsection 1" > conftest.s
1570         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1571                 gcc_cv_as_subsections=".subsection"
1572                 if test x$gcc_cv_nm != x; then
1573                         cat > conftest.s <<EOF
1574 conftest_label1: .word 0
1575 .subsection -1
1576 conftest_label2: .word 0
1577 .previous
1578 EOF
1579                         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1580                                 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
1581                                 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
1582                                 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then
1583                                         :
1584                                 else
1585                                         gcc_cv_as_subsections="working .subsection -1"
1586                                 fi
1587                         fi
1588                 fi
1589         fi
1590         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1591 fi
1592 if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then
1593         AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
1594 [Define if your assembler supports .subsection and .subsection -1 starts
1595    emitting at the beginning of your section.])
1596 fi
1597 AC_MSG_RESULT($gcc_cv_as_subsections)
1598
1599 AC_MSG_CHECKING(assembler weak support)
1600 gcc_cv_as_weak=no
1601 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1602   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
1603     gcc_cv_as_weak="yes"
1604   fi
1605 elif test x$gcc_cv_as != x; then
1606         # Check if we have .weak
1607         echo "  .weak foobar" > conftest.s
1608         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1609                 gcc_cv_as_weak="yes"
1610         fi
1611         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1612 fi
1613 if test x"$gcc_cv_as_weak" = xyes; then
1614         AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])
1615 fi
1616 AC_MSG_RESULT($gcc_cv_as_weak)
1617
1618 AC_MSG_CHECKING(assembler hidden support)
1619 gcc_cv_as_hidden=no
1620 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1621   if test "$gcc_cv_gas_major_version" -eq 2     \
1622           -a "$gcc_cv_gas_minor_version" -eq 12 \
1623           -a "$gcc_cv_gas_patch_version" -ge 1  \
1624           -o "$gcc_cv_gas_major_version" -eq 2  \
1625           -a "$gcc_cv_gas_minor_version" -gt 12 \
1626           -o "$gcc_cv_gas_major_version" -gt 2  \
1627     && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1628     gcc_cv_as_hidden="yes"
1629   fi
1630 elif test x$gcc_cv_as != x; then
1631         # Check if we have .hidden
1632         echo "  .hidden foobar" > conftest.s
1633         echo "foobar:" >> conftest.s
1634         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1635                 gcc_cv_as_hidden="yes"
1636         fi
1637         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1638
1639         # GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
1640         # This is irritatingly difficult to feature test for.  Look for 
1641         # the date string after the version number.
1642         ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1`
1643         if echo "$ld_ver" | grep GNU > /dev/null; then
1644 changequote(,)dnl
1645                 ld_vers=`echo $ld_ver | sed -n 's,^.*[  ]\([0-9][0-9]*\.[0-9][0-9]*\(\|\.[0-9][0-9]*\)\)\([     ].*\|\)$,\1,p'`
1646                 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'`
1647                 if test 0"$ld_date" -lt 20020404; then
1648                         if test -n "$ld_date"; then
1649                                 # If there was date string, but was earlier than 2002-04-04, fail
1650                                 gcc_cv_as_hidden="no"
1651                         elif test -z "$ld_vers"; then
1652                                 # If there was no date string nor ld version number, something is wrong
1653                                 gcc_cv_as_hidden="no"
1654                         else
1655                                 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
1656                                 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
1657                                 ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
1658                                 test -z "$ld_vers_patch" && ld_vers_patch=0
1659                                 if test "$ld_vers_major" -lt 2; then
1660                                         gcc_cv_as_hidden="no"
1661                                 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
1662                                         gcc_cv_as_hidden="no"
1663                                 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 \
1664                                           -a "$ld_vers_patch" -eq 0; then
1665                                         gcc_cv_as_hidden="no"
1666                                 fi
1667                         fi
1668                 fi
1669 changequote([,])dnl
1670         fi
1671 fi
1672 if test x"$gcc_cv_as_hidden" = xyes; then
1673         AC_DEFINE(HAVE_GAS_HIDDEN, 1,
1674                 [Define if your assembler supports .hidden.])
1675 fi
1676 AC_MSG_RESULT($gcc_cv_as_hidden)
1677 libgcc_visibility=$gcc_cv_as_hidden
1678 case "$target" in
1679   mips-sgi-irix6*o32)
1680     if test x"$gnu_ld_flag" = x"no"; then
1681       # Even if using gas with .hidden support, the resulting object files
1682       # cannot be linked with the IRIX 6 O32 linker.
1683       libgcc_visibility=no
1684     fi
1685     ;;
1686 esac
1687 AC_SUBST(libgcc_visibility)
1688
1689 AC_MSG_CHECKING(assembler leb128 support)
1690 gcc_cv_as_leb128=no
1691 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1692   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1693     gcc_cv_as_leb128="yes"
1694   fi
1695 elif test x$gcc_cv_as != x; then
1696         # Check if we have .[us]leb128, and support symbol arithmetic with it.
1697         cat > conftest.s <<EOF
1698         .data
1699         .uleb128 L2 - L1
1700 L1:
1701         .uleb128 1280
1702         .sleb128 -1010
1703 L2:
1704 EOF
1705         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1706                 gcc_cv_as_leb128="yes"
1707
1708                 # GAS versions before 2.11 do not support uleb128,
1709                 # despite appearing to.
1710                 # ??? There exists an elf-specific test that will crash
1711                 # the assembler.  Perhaps it's better to figure out whether
1712                 # arbitrary sections are supported and try the test.
1713                 as_ver=`$gcc_cv_as --version 2>/dev/null | head -1`
1714                 if echo "$as_ver" | grep GNU > /dev/null; then
1715 changequote(,)dnl
1716                         as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
1717                         as_major=`echo $as_ver | sed 's/\..*//'`
1718                         as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
1719 changequote([,])dnl
1720                         if test $as_major -eq 2 -a $as_minor -lt 11; then
1721                                 gcc_cv_as_leb128="no"
1722                         fi
1723                 fi
1724         fi
1725         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1726 fi
1727 if test x"$gcc_cv_as_leb128" = xyes; then
1728         AC_DEFINE(HAVE_AS_LEB128, 1,
1729                 [Define if your assembler supports .uleb128.])
1730 fi
1731 AC_MSG_RESULT($gcc_cv_as_leb128)
1732
1733 AC_MSG_CHECKING(assembler eh_frame optimization)
1734 gcc_cv_as_eh_frame=no
1735 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1736   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1737     gcc_cv_as_eh_frame="yes"
1738   fi
1739 elif test x$gcc_cv_as != x; then
1740         # Check if this is GAS.
1741         as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1`
1742         rm -f a.out 2> /dev/null
1743         if echo "$as_ver" | grep GNU > /dev/null; then
1744                 # Versions up to and including 2.11.0 may mis-optimize
1745                 # .eh_frame data.  Try something.
1746                 cat > conftest.s <<EOF
1747         .text
1748 .LFB1:
1749         .4byte  0
1750 .L1:
1751         .4byte  0
1752 .LFE1:
1753         .section        .eh_frame,"aw",@progbits
1754 __FRAME_BEGIN__:
1755         .4byte  .LECIE1-.LSCIE1
1756 .LSCIE1:
1757         .4byte  0x0
1758         .byte   0x1
1759         .ascii "z\0"
1760         .byte   0x1
1761         .byte   0x78
1762         .byte   0x1a
1763         .byte   0x0
1764         .byte   0x4
1765         .4byte  1
1766         .p2align 1
1767 .LECIE1:
1768 .LSFDE1:
1769         .4byte  .LEFDE1-.LASFDE1
1770 .LASFDE1:
1771         .4byte  .LASFDE1-__FRAME_BEGIN__
1772         .4byte  .LFB1
1773         .4byte  .LFE1-.LFB1
1774         .byte   0x4
1775         .4byte  .LFE1-.LFB1
1776         .byte   0x4
1777         .4byte  .L1-.LFB1
1778 .LEFDE1:
1779 EOF
1780                 cat > conftest.lit <<EOF
1781  0000 10000000 00000000 017a0001 781a0004  .........z..x...
1782  0010 01000000 12000000 18000000 00000000  ................
1783  0020 08000000 04080000 0044               .........D      
1784 EOF
1785                 cat > conftest.big <<EOF
1786  0000 00000010 00000000 017a0001 781a0004  .........z..x...
1787  0010 00000001 00000012 00000018 00000000  ................
1788  0020 00000008 04000000 0844               .........D      
1789 EOF
1790                 # If the assembler didn't choke, and we can objdump,
1791                 # and we got the correct data, then succeed.
1792                 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
1793                    && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
1794                       | tail -3 > conftest.got \
1795                    && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
1796                         || cmp conftest.big conftest.got > /dev/null 2>&1; }
1797                 then
1798                         gcc_cv_as_eh_frame="yes"
1799                 else
1800                         gcc_cv_as_eh_frame="bad"
1801                         if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then
1802                                 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
1803         [Define if your assembler mis-optimizes .eh_frame data.])
1804                         fi
1805                 fi
1806         fi
1807         rm -f conftest.*
1808 fi
1809 AC_MSG_RESULT($gcc_cv_as_eh_frame)
1810
1811 AC_MSG_CHECKING(assembler section merging support)
1812 gcc_cv_as_shf_merge=no
1813 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1814   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1815     gcc_cv_as_shf_merge=yes
1816   fi
1817 elif test x$gcc_cv_as != x; then
1818         # Check if we support SHF_MERGE sections
1819         echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s
1820         if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1; then
1821                 gcc_cv_as_shf_merge=yes
1822         fi
1823         rm -f conftest.s conftest.o
1824 fi
1825 if test x"$gcc_cv_as_shf_merge" = xyes; then
1826         AC_DEFINE(HAVE_GAS_SHF_MERGE, 1,
1827 [Define if your assembler supports marking sections with SHF_MERGE flag.])
1828 fi
1829 AC_MSG_RESULT($gcc_cv_as_shf_merge)
1830
1831 AC_MSG_CHECKING(assembler thread-local storage support)
1832 gcc_cv_as_tls=no
1833 conftest_s=
1834 tls_first_major=
1835 tls_first_minor=
1836 case "$target" in
1837 changequote(,)dnl
1838   alpha*-*-*)
1839     conftest_s='
1840         .section ".tdata","awT",@progbits
1841 foo:    .long   25
1842         .text
1843         ldq     $27,__tls_get_addr($29)         !literal!1
1844         lda     $16,foo($29)                    !tlsgd!1
1845         jsr     $26,($27),__tls_get_addr        !lituse_tlsgd!1
1846         ldq     $27,__tls_get_addr($29)         !literal!2
1847         lda     $16,foo($29)                    !tlsldm!2
1848         jsr     $26,($27),__tls_get_addr        !lituse_tlsldm!2
1849         ldq     $1,foo($29)                     !gotdtprel
1850         ldah    $2,foo($29)                     !dtprelhi
1851         lda     $3,foo($2)                      !dtprello
1852         lda     $4,foo($29)                     !dtprel
1853         ldq     $1,foo($29)                     !gottprel
1854         ldah    $2,foo($29)                     !tprelhi
1855         lda     $3,foo($2)                      !tprello
1856         lda     $4,foo($29)                     !tprel'
1857         tls_first_major=2
1858         tls_first_minor=13
1859         ;;
1860   i[34567]86-*-*)
1861 changequote([,])dnl
1862     conftest_s='
1863         .section ".tdata","awT",@progbits
1864 foo:    .long   25
1865         .text
1866         movl    %gs:0, %eax
1867         leal    foo@TLSGD(,%ebx,1), %eax
1868         leal    foo@TLSLDM(%ebx), %eax
1869         leal    foo@DTPOFF(%eax), %edx
1870         movl    foo@GOTTPOFF(%ebx), %eax
1871         subl    foo@GOTTPOFF(%ebx), %eax
1872         addl    foo@GOTNTPOFF(%ebx), %eax
1873         movl    foo@INDNTPOFF, %eax
1874         movl    $foo@TPOFF, %eax
1875         subl    $foo@TPOFF, %eax
1876         leal    foo@NTPOFF(%ecx), %eax'
1877         tls_first_major=2
1878         tls_first_minor=14
1879         ;;
1880   x86_64-*-*)
1881     conftest_s='
1882         .section ".tdata","awT",@progbits
1883 foo:    .long   25
1884         .text
1885         movq    %fs:0, %rax
1886         leaq    foo@TLSGD(%rip), %rdi
1887         leaq    foo@TLSLD(%rip), %rdi
1888         leaq    foo@DTPOFF(%rax), %rdx
1889         movq    foo@GOTTPOFF(%rip), %rax
1890         movq    $foo@TPOFF, %rax'
1891         tls_first_major=2
1892         tls_first_minor=14
1893         ;;
1894   ia64-*-*)
1895     conftest_s='
1896         .section ".tdata","awT",@progbits
1897 foo:    data8   25
1898         .text
1899         addl    r16 = @ltoff(@dtpmod(foo#)), gp
1900         addl    r17 = @ltoff(@dtprel(foo#)), gp
1901         addl    r18 = @ltoff(@tprel(foo#)), gp
1902         addl    r19 = @dtprel(foo#), gp
1903         adds    r21 = @dtprel(foo#), r13
1904         movl    r23 = @dtprel(foo#)
1905         addl    r20 = @tprel(foo#), gp
1906         adds    r22 = @tprel(foo#), r13
1907         movl    r24 = @tprel(foo#)'
1908         tls_first_major=2
1909         tls_first_minor=13
1910         ;;
1911 esac
1912 if test -z "$tls_first_major"; then
1913   :
1914 elif test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x
1915 then
1916   if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \
1917           -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \
1918           -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then
1919     gcc_cv_as_tls=yes
1920   fi
1921 elif test x$gcc_cv_as != x; then
1922   echo "$conftest_s" > conftest.s
1923   if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1
1924   then
1925     gcc_cv_as_tls=yes
1926   fi
1927   rm -f conftest.s conftest.o
1928 fi
1929 if test "$gcc_cv_as_tls" = yes; then
1930   AC_DEFINE(HAVE_AS_TLS, 1,
1931             [Define if your assembler supports thread-local storage.])
1932 fi
1933 AC_MSG_RESULT($gcc_cv_as_tls)
1934
1935 case "$target" in
1936   # All TARGET_ABI_OSF targets.
1937   alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
1938     AC_CACHE_CHECK([assembler supports explicit relocations],
1939         gcc_cv_as_explicit_relocs, [
1940         gcc_cv_as_explicit_relocs=unknown
1941         if test x$gcc_cv_gas_major_version != x \
1942                 -a x$gcc_cv_gas_minor_version != x
1943         then
1944            if test "$gcc_cv_gas_major_version" -eq 2 \
1945                    -a "$gcc_cv_gas_minor_version" -ge 12 \
1946                    -o "$gcc_cv_gas_major_version" -gt 2; then
1947               gcc_cv_as_explicit_relocs=yes
1948            fi
1949         elif test x$gcc_cv_as != x; then
1950             cat > conftest.s << 'EOF'
1951         .set nomacro
1952         .text
1953         extbl   $3, $2, $3      !lituse_bytoff!1
1954         ldq     $2, a($29)      !literal!1
1955         ldq     $4, b($29)      !literal!2
1956         ldq_u   $3, 0($2)       !lituse_base!1
1957         ldq     $27, f($29)     !literal!5
1958         jsr     $26, ($27), f   !lituse_jsr!5
1959         ldah    $29, 0($26)     !gpdisp!3
1960         lda     $0, c($29)      !gprel
1961         ldah    $1, d($29)      !gprelhigh
1962         lda     $1, d($1)       !gprellow
1963         lda     $29, 0($29)     !gpdisp!3
1964 EOF
1965             if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1966                 gcc_cv_as_explicit_relocs=yes
1967             else
1968                 gcc_cv_as_explicit_relocs=no
1969             fi
1970             rm -f conftest.s conftest.o
1971         fi
1972     ])
1973     if test "x$gcc_cv_as_explicit_relocs" = xyes; then
1974         AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
1975                 [Define if your assembler supports explicit relocations.])
1976     fi
1977     ;;
1978   sparc*-*-*)
1979     AC_CACHE_CHECK([assembler .register pseudo-op support],
1980         gcc_cv_as_register_pseudo_op, [
1981         gcc_cv_as_register_pseudo_op=unknown
1982         if test x$gcc_cv_as != x; then
1983             # Check if we have .register
1984             echo ".register %g2, #scratch" > conftest.s
1985             if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1986                 gcc_cv_as_register_pseudo_op=yes
1987             else
1988                 gcc_cv_as_register_pseudo_op=no
1989             fi
1990             rm -f conftest.s conftest.o
1991         fi
1992     ])
1993     if test "x$gcc_cv_as_register_pseudo_op" = xyes; then
1994         AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
1995                 [Define if your assembler supports .register.])
1996     fi
1997
1998     AC_CACHE_CHECK([assembler supports -relax],
1999         gcc_cv_as_relax_opt, [
2000         gcc_cv_as_relax_opt=unknown
2001         if test x$gcc_cv_as != x; then
2002             # Check if gas supports -relax
2003             echo ".text" > conftest.s
2004             if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then
2005                 gcc_cv_as_relax_opt=yes
2006             else
2007                 gcc_cv_as_relax_opt=no
2008             fi
2009             rm -f conftest.s conftest.o
2010         fi
2011     ])
2012     if test "x$gcc_cv_as_relax_opt" = xyes; then
2013         AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
2014                 [Define if your assembler supports -relax option.])
2015     fi
2016
2017     AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
2018         gcc_cv_as_sparc_ua_pcrel, [
2019         gcc_cv_as_sparc_ua_pcrel=unknown
2020         if test x$gcc_cv_as != x -a x$gcc_cv_ld != x; then
2021             gcc_cv_as_sparc_ua_pcrel=no
2022             echo ".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo)" > conftest.s
2023             if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \
2024                && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
2025                 gcc_cv_as_sparc_ua_pcrel=yes
2026             fi
2027             rm -f conftest.s conftest.o conftest
2028         fi
2029     ])
2030     if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then
2031         AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
2032                 [Define if your assembler and linker support unaligned PC relative relocs.])
2033     fi
2034
2035     AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs against hidden symbols],
2036         gcc_cv_as_sparc_ua_pcrel_hidden, [
2037         if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then
2038             gcc_cv_as_sparc_ua_pcrel_hidden=unknown
2039             if test x$gcc_cv_objdump != x; then
2040                 gcc_cv_as_sparc_ua_pcrel_hidden=no
2041                 echo ".data; .align 4; .byte 0x31; .uaword %r_disp32(foo)" > conftest.s
2042                 echo ".byte 0x32, 0x33, 0x34; .global foo; .hidden foo" >> conftest.s
2043                 echo "foo: .skip 4" >> conftest.s
2044                 if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \
2045                    && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
2046                    && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
2047                       | grep ' 31000000 07323334' > /dev/null 2>&1; then
2048                     if $gcc_cv_objdump -R conftest 2> /dev/null \
2049                        | grep 'DISP32' > /dev/null 2>&1; then
2050                         :
2051                     else
2052                         gcc_cv_as_sparc_ua_pcrel_hidden=yes
2053                     fi
2054                 fi
2055             fi
2056             rm -f conftest.s conftest.o conftest
2057         else
2058             gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel"
2059         fi
2060     ])
2061     if test "x$gcc_cv_as_sparc_ua_pcrel_hidden" = xyes; then
2062         AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
2063                 [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])
2064     fi
2065
2066     AC_CACHE_CHECK([for assembler offsetable %lo() support],
2067         gcc_cv_as_offsetable_lo10, [
2068         gcc_cv_as_offsetable_lo10=unknown
2069         if test "x$gcc_cv_as" != x; then
2070             # Check if assembler has offsetable %lo()
2071             echo "or %g1, %lo(ab) + 12, %g1" > conftest.s
2072             echo "or %g1, %lo(ab + 12), %g1" > conftest1.s
2073             if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \
2074                     > /dev/null 2>&1 &&
2075                $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \
2076                     > /dev/null 2>&1; then
2077                 if cmp conftest.o conftest1.o > /dev/null 2>&1; then
2078                     gcc_cv_as_offsetable_lo10=no
2079                 else
2080                     gcc_cv_as_offsetable_lo10=yes
2081                 fi
2082             else
2083                 gcc_cv_as_offsetable_lo10=no
2084             fi
2085             rm -f conftest.s conftest.o conftest1.s conftest1.o
2086         fi
2087     ])
2088     if test "x$gcc_cv_as_offsetable_lo10" = xyes; then
2089         AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
2090             [Define if your assembler supports offsetable %lo().])
2091     fi
2092
2093     ;;
2094
2095 changequote(,)dnl
2096   i[34567]86-*-* | x86_64-*-*)
2097 changequote([,])dnl
2098     AC_MSG_CHECKING(assembler instructions)
2099     gcc_cv_as_instructions=
2100     if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
2101       if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then
2102         gcc_cv_as_instructions="filds fists"
2103       fi
2104     elif test x$gcc_cv_as != x; then
2105         set "filds fists" "filds mem; fists mem"
2106         while test $# -gt 0
2107         do
2108                 echo "$2" > conftest.s
2109                 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
2110                         gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" "
2111                 fi
2112                 shift 2
2113         done
2114         rm -f conftest.s conftest.o
2115     fi
2116     if test x"$gcc_cv_as_instructions" != x; then
2117         AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | sed -e 's/ $//' | tr '[a-z ]' '[A-Z_]'`)
2118     fi
2119     AC_MSG_RESULT($gcc_cv_as_instructions)
2120
2121     AC_MSG_CHECKING(assembler GOTOFF in data directives)
2122     gcc_cv_as_gotoff_in_data=no
2123     if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x
2124     then
2125       if test "$gcc_cv_gas_major_version" -eq 2 \
2126          -a "$gcc_cv_gas_minor_version" -ge 11 \
2127          -o "$gcc_cv_gas_major_version" -gt 2; then
2128         gcc_cv_as_gotoff_in_data=yes
2129       fi
2130     elif test x$gcc_cv_as != x; then
2131         cat > conftest.s <<EOF
2132         .text
2133 .L0:
2134         nop
2135         .data
2136         .long .L0@GOTOFF
2137 EOF
2138         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
2139           gcc_cv_as_gotoff_in_data=yes
2140         fi
2141     fi
2142     AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
2143       [`if test $gcc_cv_as_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
2144       [Define true if the assembler supports '.long foo@GOTOFF'.])
2145     AC_MSG_RESULT($gcc_cv_as_gotoff_in_data)
2146     ;;
2147 esac
2148
2149 AC_MSG_CHECKING(assembler dwarf2 debug_line support)
2150 gcc_cv_as_dwarf2_debug_line=no
2151 # ??? Not all targets support dwarf2 debug_line, even within a version
2152 # of gas.  Moreover, we need to emit a valid instruction to trigger any
2153 # info to the output file.  So, as supported targets are added to gas 2.11,
2154 # add some instruction here to (also) show we expect this might work.
2155 # ??? Once 2.11 is released, probably need to add first known working
2156 # version to the per-target configury.
2157 case "$target" in
2158   i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
2159   | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-*)
2160     insn="nop"
2161     ;;
2162   ia64*-*-*)
2163     insn="nop 0"
2164     ;;
2165   esac
2166 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
2167 then
2168   if test "$gcc_cv_gas_major_version" -eq 2 \
2169         -a "$gcc_cv_gas_minor_version" -ge 11 \
2170         -o "$gcc_cv_gas_major_version" -gt 2 \
2171      && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2172      && test x"$insn" != x ; then
2173     gcc_cv_as_dwarf2_debug_line="yes"
2174   fi
2175 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
2176         echo '  .file 1 "conftest.s"' > conftest.s
2177         echo '  .loc 1 3 0' >> conftest.s
2178         echo "  $insn" >> conftest.s
2179         # ??? This fails with non-gnu grep.
2180         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
2181            && grep debug_line conftest.o > /dev/null 2>&1 ; then
2182                 # The .debug_line file table must be in the exact order that
2183                 # we specified the files, since these indices are also used
2184                 # by DW_AT_decl_file.  Approximate this test by testing if
2185                 # the assembler bitches if the same index is assigned twice.
2186                 echo '  .file 1 "foo.s"' > conftest.s
2187                 echo '  .file 1 "bar.s"' >> conftest.s
2188                 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1
2189                 then
2190                   gcc_cv_as_dwarf2_debug_line="no"
2191                 else
2192                   gcc_cv_as_dwarf2_debug_line="yes"
2193                 fi
2194         fi
2195         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
2196 fi
2197 if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then
2198         AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
2199 [Define if your assembler supports dwarf2 .file/.loc directives,
2200    and preserves file table indices exactly as given.])
2201 fi
2202 AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
2203
2204 AC_MSG_CHECKING(assembler --gdwarf2 support)
2205 gcc_cv_as_gdwarf2_flag=no
2206 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
2207 then
2208   if test "$gcc_cv_gas_major_version" -eq 2 \
2209         -a "$gcc_cv_gas_minor_version" -ge 11 \
2210         -o "$gcc_cv_gas_major_version" -gt 2 \
2211      && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2212      && test x"$insn" != x ; then
2213     gcc_cv_as_gdwarf2_flag="yes"
2214   fi
2215 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
2216         echo '' > conftest.s
2217         # ??? This fails with non-gnu grep.
2218         if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1
2219           then
2220           gcc_cv_as_gdwarf2_flag="yes"
2221         fi
2222         rm -f conftest.s conftest.o
2223 fi
2224 if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then
2225         AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
2226 [Define if your assembler supports the --gdwarf2 option.])
2227 fi
2228 AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag)
2229
2230 AC_MSG_CHECKING(assembler --gstabs support)
2231 gcc_cv_as_gstabs_flag=no
2232 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
2233 then
2234   if test "$gcc_cv_gas_major_version" -eq 2 \
2235         -a "$gcc_cv_gas_minor_version" -ge 11 \
2236         -o "$gcc_cv_gas_major_version" -gt 2 \
2237      && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2238      && test x"$insn" != x ; then
2239     gcc_cv_as_gstabs_flag="yes"
2240   fi
2241 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
2242         echo '' > conftest.s
2243         # ??? This fails with non-gnu grep.
2244         if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then
2245           gcc_cv_as_gstabs_flag="yes"
2246         fi
2247         rm -f conftest.s conftest.o
2248 fi
2249 if test x"$gcc_cv_as_gstabs_flag" = xyes; then
2250         AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
2251 [Define if your assembler supports the --gstabs option.])
2252 fi
2253 AC_MSG_RESULT($gcc_cv_as_gstabs_flag)
2254
2255 AC_MSG_CHECKING(linker read-only and read-write section mixing)
2256 gcc_cv_ld_ro_rw_mix=unknown
2257 if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
2258   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 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
2259     gcc_cv_ld_ro_rw_mix=read-write
2260   fi
2261 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
2262   echo '.section "myfoosect", "a"' > conftest1.s
2263   echo '.section "myfoosect", "aw"' > conftest2.s
2264   echo '.byte 1' >> conftest2.s
2265   echo '.section "myfoosect", "a"' > conftest3.s
2266   echo '.byte 0' >> conftest3.s
2267   if $gcc_cv_as -o conftest1.o conftest1.s \
2268      && $gcc_cv_as -o conftest2.o conftest2.s \
2269      && $gcc_cv_as -o conftest3.o conftest3.s \
2270      && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
2271         conftest2.o conftest3.o; then
2272     gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
2273                          | grep -A1 myfoosect`
2274     if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
2275       if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
2276         gcc_cv_ld_ro_rw_mix=read-only
2277       else
2278         gcc_cv_ld_ro_rw_mix=read-write
2279       fi
2280     fi
2281   fi
2282 changequote(,)dnl
2283   rm -f conftest.* conftest[123].*
2284 changequote([,])dnl
2285 fi
2286 if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
2287         AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
2288   [Define if your linker links a mix of read-only
2289    and read-write sections into a read-write section.])
2290 fi
2291 AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
2292
2293 AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
2294 gcc_cv_ld_eh_frame_hdr=no
2295 if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
2296   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 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
2297     gcc_cv_ld_eh_frame_hdr=yes
2298   fi
2299 elif test x$gcc_cv_ld != x; then
2300         # Check if linker supports --eh-frame-hdr option
2301         if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
2302                 gcc_cv_ld_eh_frame_hdr=yes
2303         fi
2304 fi
2305 if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
2306         AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
2307 [Define if your linker supports --eh-frame-hdr option.])
2308 fi
2309 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
2310
2311 # Miscellaneous target-specific checks.
2312 case "$target" in
2313   mips*-*-*)
2314     AC_MSG_CHECKING(whether libgloss uses STARTUP directives consistently)
2315     gcc_cv_mips_libgloss_startup=no
2316     gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss
2317     if test "x$exec_prefix" = xNONE; then
2318       if test "x$prefix" = xNONE; then
2319         test_prefix=/usr/local
2320       else
2321         test_prefix=$prefix
2322       fi
2323     else
2324       test_prefix=$exec_prefix
2325     fi
2326     for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld
2327     do
2328       if grep '^STARTUP' $f > /dev/null 2>&1; then
2329         gcc_cv_mips_libgloss_startup=yes
2330         break
2331       fi
2332     done
2333     if test x"$gcc_cv_mips_libgloss_startup" = xyes; then
2334       AC_DEFINE(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES, 1,
2335         [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.])
2336     fi
2337     AC_MSG_RESULT($gcc_cv_mips_libgloss_startup)
2338     ;;
2339 esac
2340
2341 if test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
2342   AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
2343 fi
2344
2345 # Figure out what language subdirectories are present.
2346 # Look if the user specified --enable-languages="..."; if not, use
2347 # the environment variable $LANGUAGES if defined. $LANGUAGES might
2348 # go away some day.
2349 # NB:  embedded tabs in this IF block -- do not untabify
2350 if test x"${enable_languages+set}" != xset; then
2351         if test x"${LANGUAGES+set}" = xset; then
2352                 enable_languages="${LANGUAGES}"
2353                 AC_MSG_WARN([setting LANGUAGES is deprecated, use --enable-languages instead])
2354
2355         else
2356                 enable_languages=all
2357         fi
2358 else
2359         if test x"${enable_languages}" = x \
2360         || test x"${enable_languages}" = xyes;
2361         then
2362                 AC_MSG_ERROR([--enable-languages needs at least one language argument])
2363         fi
2364 fi
2365 enable_languages=`echo "${enable_languages}" | sed -e 's/[[     ,]][[   ,]]*/,/g' -e 's/,$//'`
2366
2367 # First scan to see if an enabled language requires some other language.
2368 # We assume that a given config-lang.in will list all the language
2369 # front ends it requires, even if some are required indirectly.
2370 for lang in ${srcdir}/*/config-lang.in ..
2371 do
2372    case $lang in
2373     ..)
2374        ;;
2375     # The odd quoting in the next line works around
2376     # an apparent bug in bash 1.12 on linux.
2377 changequote(,)dnl
2378     ${srcdir}/[*]/config-lang.in)
2379        ;;
2380     *)
2381        lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^      ]*\).*$,\1,p' $lang`
2382        this_lang_requires=`sed -n -e 's,^lang_requires=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_requires=\([^    ]*\).*$,\1,p' $lang`
2383        for other in $this_lang_requires
2384        do
2385           case ,${enable_languages}, in
2386            *,$other,*)
2387               ;;
2388            *,all,*)
2389               ;;
2390            *,$lang_alias,*)
2391               enable_languages="$enable_languages,$other"
2392               ;;
2393           esac
2394        done
2395        ;;
2396 changequote([,])dnl
2397    esac
2398 done
2399
2400 expected_languages=`echo ,${enable_languages}, | sed -e 's:,: :g' -e 's:  *: :g' -e 's:  *: :g' -e 's:^ ::' -e 's: $::'`
2401 found_languages=
2402 subdirs=
2403 for lang in ${srcdir}/*/config-lang.in ..
2404 do
2405         case $lang in
2406         ..) ;;
2407         # The odd quoting in the next line works around
2408         # an apparent bug in bash 1.12 on linux.
2409 changequote(,)dnl
2410         ${srcdir}/[*]/config-lang.in) ;;
2411         *)
2412           lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^   ]*\).*$,\1,p' $lang`
2413           this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^         ]*\).*$,\1,p' $lang`
2414           build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^     ]*\).*$,\1,p' $lang`
2415           if test "x$lang_alias" = x
2416           then
2417                 echo "$lang doesn't set \$language." 1>&2
2418                 exit 1
2419           fi
2420           case ${build_by_default},${enable_languages}, in
2421           *,$lang_alias,*) add_this_lang=yes ;;
2422           no,*) add_this_lang=no ;;
2423           *,all,*) add_this_lang=yes ;;
2424           *) add_this_lang=no ;;
2425           esac
2426           found_languages="${found_languages} ${lang_alias}"
2427           if test x"${add_this_lang}" = xyes; then
2428                 case $lang in
2429                     ${srcdir}/ada/config-lang.in)
2430                         if test x$have_gnat = xyes ; then
2431                                 subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
2432                         fi
2433                         ;;
2434                     *)
2435                         subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
2436                         ;;
2437                 esac
2438           fi
2439           ;;
2440 changequote([,])dnl
2441         esac
2442 done
2443
2444 missing_languages=
2445 for expected_language in ${expected_languages} ..
2446 do 
2447     if test "${expected_language}" != ..; then
2448         missing_language="${expected_language}"
2449         if test "${expected_language}" = "c" \
2450            || test "${expected_language}" = "all"; then
2451                 missing_language=
2452         fi
2453         for found_language in ${found_languages} ..
2454         do 
2455             if test "${found_language}" != ..; then
2456                 if test "${expected_language}" = "${found_language}"; then
2457                     missing_language=
2458                 fi
2459             fi
2460         done
2461         if test "x${missing_language}" != x; then
2462            missing_languages="${missing_languages} ${missing_language}"
2463         fi
2464     fi
2465 done
2466
2467 if test "x$missing_languages" != x; then
2468   AC_MSG_ERROR([
2469 The following requested languages were not found:${missing_languages}
2470 The following languages were available: c${found_languages}])
2471 fi
2472
2473 # Make gthr-default.h if we have a thread file.
2474 gthread_flags=
2475 if test $thread_file != single; then
2476     rm -f gthr-default.h
2477     echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
2478     gthread_flags=-DHAVE_GTHR_DEFAULT
2479 fi
2480 AC_SUBST(gthread_flags)
2481
2482 # Find out what GC implementation we want, or may, use.
2483 AC_ARG_WITH(gc,
2484 [  --with-gc={simple,page} choose the garbage collection mechanism to use
2485                           with the compiler],
2486 [case "$withval" in
2487   simple | page)
2488     GGC=ggc-$withval
2489     ;;
2490   *)
2491     AC_MSG_ERROR([$withval is an invalid option to --with-gc])
2492     ;;
2493 esac],
2494 [GGC=ggc-page])
2495 AC_SUBST(GGC)
2496 echo "Using $GGC for garbage collection."
2497
2498 # Use the system's zlib library.
2499 zlibdir=-L../zlib
2500 zlibinc="-I\$(srcdir)/../zlib"
2501 AC_ARG_WITH(system-zlib,
2502 [  --with-system-zlib      use installed libz],
2503 zlibdir=
2504 zlibinc=
2505 )
2506 AC_SUBST(zlibdir)
2507 AC_SUBST(zlibinc)
2508
2509 dnl Very limited version of automake's enable-maintainer-mode
2510
2511 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2512   dnl maintainer-mode is disabled by default
2513   AC_ARG_ENABLE(maintainer-mode,
2514 [  --enable-maintainer-mode
2515                           enable make rules and dependencies not useful
2516                           (and sometimes confusing) to the casual installer],
2517       maintainer_mode=$enableval,
2518       maintainer_mode=no)
2519
2520 AC_MSG_RESULT($maintainer_mode)
2521
2522 if test "$maintainer_mode" = "yes"; then
2523   MAINT=''
2524 else
2525   MAINT='#'
2526 fi
2527 AC_SUBST(MAINT)dnl
2528
2529 # Make empty files to contain the specs and options for each language.
2530 # Then add #include lines to for a compiler that has specs and/or options.
2531
2532 lang_specs_files=
2533 lang_options_files=
2534 lang_tree_files=
2535 for subdir in . $subdirs
2536 do
2537         if test -f $srcdir/$subdir/lang-specs.h; then
2538             lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
2539         fi
2540         if test -f $srcdir/$subdir/lang-options.h; then
2541             lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h"
2542         fi
2543         if test -f $srcdir/$subdir/$subdir-tree.def; then
2544             lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
2545         fi
2546 done
2547
2548 # These (without "all_") are set in each config-lang.in.
2549 # `language' must be a single word so is spelled singularly.
2550 all_languages=
2551 all_boot_languages=
2552 all_compilers=
2553 all_stagestuff=
2554 all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc mkheaders'
2555 # List of language makefile fragments.
2556 all_lang_makefiles=
2557 # Files for gengtype
2558 all_gtfiles="$target_gtfiles"
2559 # Files for gengtype with language
2560 all_gtfiles_files_langs=
2561 all_gtfiles_files_files=
2562
2563 # Add the language fragments.
2564 # Languages are added via two mechanisms.  Some information must be
2565 # recorded in makefile variables, these are defined in config-lang.in.
2566 # We accumulate them and plug them into the main Makefile.
2567 # The other mechanism is a set of hooks for each of the main targets
2568 # like `clean', `install', etc.
2569
2570 language_fragments="Make-lang"
2571 language_hooks="Make-hooks"
2572
2573 for s in .. $subdirs
2574 do
2575         if test $s != ".."
2576         then
2577                 language=
2578                 boot_language=
2579                 compilers=
2580                 stagestuff=
2581                 outputs=
2582                 gtfiles=
2583                 . ${srcdir}/$s/config-lang.in
2584                 if test "x$language" = x
2585                 then
2586                         echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2
2587                         exit 1
2588                 fi
2589                 all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in"
2590                 if test -f ${srcdir}/$s/Makefile.in
2591                 then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in"
2592                 fi
2593                 all_languages="$all_languages $language"
2594                 if test "x$boot_language" = xyes
2595                 then
2596                         all_boot_languages="$all_boot_languages $language"
2597                 fi
2598                 all_compilers="$all_compilers $compilers"
2599                 all_stagestuff="$all_stagestuff $stagestuff"
2600                 all_outputs="$all_outputs $outputs"
2601                 all_gtfiles="$all_gtfiles $gtfiles"
2602                 for f in .. $gtfiles
2603                 do
2604                      if test $f != ".."
2605                      then
2606                          all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} "
2607                          all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
2608                      fi
2609                 done
2610         fi
2611 done
2612
2613 # Pick up gtfiles for c
2614 gtfiles=
2615 s="c"
2616 . ${srcdir}/c-config-lang.in
2617 all_gtfiles="$all_gtfiles $gtfiles"
2618 for f in .. $gtfiles
2619 do
2620      if test $f != ".."
2621      then
2622         all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} "
2623         all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
2624      fi
2625 done
2626
2627 check_languages=
2628 for language in .. $all_languages
2629 do
2630         if test $language != ".."
2631         then
2632                 check_languages="$check_languages check-$language"
2633         fi
2634 done
2635
2636 # Since we can't use `::' targets, we link each language in
2637 # with a set of hooks, reached indirectly via lang.${target}.
2638
2639 rm -f Make-hooks
2640 touch Make-hooks
2641 target_list="all.build all.cross start.encap rest.encap \
2642         info dvi generated-manpages \
2643         install-normal install-common install-info install-man \
2644         uninstall \
2645         mostlyclean clean distclean extraclean maintainer-clean \
2646         stage1 stage2 stage3 stage4"
2647 for t in $target_list
2648 do
2649         x=
2650         for lang in .. $all_languages
2651         do
2652                 if test $lang != ".."; then
2653                         x="$x $lang.$t"
2654                 fi
2655         done
2656         echo "lang.$t: $x" >> Make-hooks
2657 done
2658
2659 # Create .gdbinit.
2660
2661 echo "dir ." > .gdbinit
2662 echo "dir ${srcdir}" >> .gdbinit
2663 if test x$gdb_needs_out_file_path = xyes
2664 then
2665         echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
2666 fi
2667 if test "x$subdirs" != x; then
2668         for s in $subdirs
2669         do
2670                 echo "dir ${srcdir}/$s" >> .gdbinit
2671         done
2672 fi
2673 echo "source ${srcdir}/gdbinit.in" >> .gdbinit
2674
2675 # Define variables host_canonical and build_canonical
2676 # because some Cygnus local changes in the Makefile depend on them.
2677 build_canonical=${build}
2678 host_canonical=${host}
2679 target_subdir=
2680 if test "${host}" != "${target}" ; then
2681     target_subdir=${target_alias}/
2682 fi
2683 AC_SUBST(build_canonical)
2684 AC_SUBST(host_canonical)
2685 AC_SUBST(target_subdir)
2686         
2687 # If $(exec_prefix) exists and is not the same as $(prefix), then compute an
2688 # absolute path for gcc_tooldir based on inserting the number of up-directory
2689 # movements required to get from $(exec_prefix) to $(prefix) into the basic
2690 # $(libsubdir)/@(unlibsubdir) based path.
2691 # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
2692 # make and thus we'd get different behavior depending on where we built the
2693 # sources.
2694 if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
2695     gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
2696 else
2697 changequote(<<, >>)dnl
2698 # An explanation of the sed strings:
2699 #  -e 's|^\$(prefix)||'   matches and eliminates 'prefix' from 'exec_prefix'
2700 #  -e 's|/$||'            match a trailing forward slash and eliminates it
2701 #  -e 's|^[^/]|/|'        forces the string to start with a forward slash (*)
2702 #  -e 's|/[^/]*|../|g'    replaces each occurrence of /<directory> with ../
2703 #
2704 # (*) Note this pattern overwrites the first character of the string
2705 # with a forward slash if one is not already present.  This is not a
2706 # problem because the exact names of the sub-directories concerned is
2707 # unimportant, just the number of them matters.
2708 #
2709 # The practical upshot of these patterns is like this:
2710 #
2711 #  prefix     exec_prefix        result
2712 #  ------     -----------        ------
2713 #   /foo        /foo/bar          ../
2714 #   /foo/       /foo/bar          ../
2715 #   /foo        /foo/bar/         ../
2716 #   /foo/       /foo/bar/         ../
2717 #   /foo        /foo/bar/ugg      ../../
2718 #
2719     dollar='$$'
2720     gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)"
2721 changequote([, ])dnl
2722 fi
2723 AC_SUBST(gcc_tooldir)
2724 AC_SUBST(dollar)
2725
2726 # Find a directory in which to install a shared libgcc.
2727
2728 AC_ARG_ENABLE(version-specific-runtime-libs,
2729 [  --enable-version-specific-runtime-libs
2730                           specify that runtime libraries should be
2731                           installed in a compiler-specific directory])
2732
2733 AC_ARG_WITH(slibdir,
2734 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
2735 slibdir="$with_slibdir",
2736 if test "${enable_version_specific_runtime_libs+set}" = set; then
2737   slibdir='$(libsubdir)'
2738 elif test "$host" != "$target"; then
2739   slibdir='$(build_tooldir)/lib'
2740 else
2741   slibdir='$(libdir)'
2742 fi)
2743 AC_SUBST(slibdir)
2744
2745 objdir=`${PWDCMD-pwd}`
2746 AC_SUBST(objdir)
2747
2748 # Process the language and host/target makefile fragments.
2749 ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file"
2750
2751 # Substitute configuration variables
2752 AC_SUBST(subdirs)
2753 AC_SUBST(srcdir)
2754 AC_SUBST(all_boot_languages)
2755 AC_SUBST(all_compilers)
2756 AC_SUBST(all_gtfiles)
2757 AC_SUBST(all_gtfiles_files_langs)
2758 AC_SUBST(all_gtfiles_files_files)
2759 AC_SUBST(all_lang_makefiles)
2760 AC_SUBST(all_languages)
2761 AC_SUBST(all_stagestuff)
2762 AC_SUBST(build_exeext)
2763 AC_SUBST(build_install_headers_dir)
2764 AC_SUBST(build_xm_file_list)
2765 AC_SUBST(build_xm_file)
2766 AC_SUBST(build_xm_defines)
2767 AC_SUBST(check_languages)
2768 AC_SUBST(cc_set_by_configure)
2769 AC_SUBST(quoted_cc_set_by_configure)
2770 AC_SUBST(cpp_install_dir)
2771 AC_SUBST(dep_host_xmake_file)
2772 AC_SUBST(dep_tmake_file)
2773 AC_SUBST(extra_headers_list)
2774 AC_SUBST(extra_objs)
2775 AC_SUBST(extra_parts)
2776 AC_SUBST(extra_passes)
2777 AC_SUBST(extra_programs)
2778 AC_SUBST(float_h_file)
2779 AC_SUBST(gcc_config_arguments)
2780 AC_SUBST(gcc_gxx_include_dir)
2781 AC_SUBST(libstdcxx_incdir)
2782 AC_SUBST(gcc_version)
2783 AC_SUBST(gcc_version_full)
2784 AC_SUBST(gcc_version_trigger)
2785 AC_SUBST(host_exeext)
2786 AC_SUBST(host_extra_gcc_objs)
2787 AC_SUBST(host_xm_file_list)
2788 AC_SUBST(host_xm_file)
2789 AC_SUBST(host_xm_defines)
2790 AC_SUBST(install)
2791 AC_SUBST(lang_options_files)
2792 AC_SUBST(lang_specs_files)
2793 AC_SUBST(lang_tree_files)
2794 AC_SUBST(local_prefix)
2795 AC_SUBST(md_file)
2796 AC_SUBST(objc_boehm_gc)
2797 AC_SUBST(out_file)
2798 AC_SUBST(out_object_file)
2799 AC_SUBST(stage_prefix_set_by_configure)
2800 AC_SUBST(quoted_stage_prefix_set_by_configure)
2801 AC_SUBST(symbolic_link)
2802 AC_SUBST(thread_file)
2803 AC_SUBST(tm_file_list)
2804 AC_SUBST(tm_file)
2805 AC_SUBST(tm_defines)
2806 AC_SUBST(tm_p_file_list)
2807 AC_SUBST(tm_p_file)
2808 AC_SUBST(xm_file)
2809 AC_SUBST(xm_defines)
2810 AC_SUBST(target_alias)
2811 AC_SUBST(c_target_objs)
2812 AC_SUBST(cxx_target_objs)
2813 AC_SUBST(target_cpu_default)
2814
2815 AC_SUBST_FILE(target_overrides)
2816 AC_SUBST_FILE(host_overrides)
2817 AC_SUBST_FILE(language_fragments)
2818 AC_SUBST_FILE(language_hooks)
2819
2820 # Echo that links are built
2821 if test x$host = x$target
2822 then
2823         str1="native "
2824 else
2825         str1="cross-"
2826         str2=" from $host"
2827 fi
2828
2829 if test x$host != x$build
2830 then
2831         str3=" on a $build system"
2832 fi
2833
2834 if test "x$str2" != x || test "x$str3" != x
2835 then
2836         str4=
2837 fi
2838
2839 echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2
2840
2841 if test "x$str2" != x || test "x$str3" != x
2842 then
2843         echo " ${str2}${str3}." 1>&2
2844 fi
2845
2846 # Truncate the target if necessary
2847 if test x$host_truncate_target != x; then
2848         target=`echo $target | sed -e 's/\(..............\).*/\1/'`
2849 fi
2850
2851 # Configure the subdirectories
2852 # AC_CONFIG_SUBDIRS($subdirs)
2853
2854 # Create the Makefile
2855 # and configure language subdirectories
2856 AC_OUTPUT($all_outputs,
2857 [
2858 case x$CONFIG_HEADERS in
2859 xauto-host.h:config.in)
2860 echo > cstamp-h ;;
2861 esac
2862 # If the host supports symlinks, point stage[1234] at ../stage[1234] so
2863 # bootstrapping and the installation procedure can still use
2864 # CC="stage1/xgcc -Bstage1/".  If the host doesn't support symlinks,
2865 # FLAGS_TO_PASS has been modified to solve the problem there.
2866 # This is virtually a duplicate of what happens in configure.lang; we do
2867 # an extra check to make sure this only happens if ln -s can be used.
2868 if test "$symbolic_link" = "ln -s"; then
2869  for d in .. ${subdirs} fixinc ; do
2870    if test $d != ..; then
2871         STARTDIR=`${PWDCMD-pwd}`
2872         cd $d
2873         for t in stage1 stage2 stage3 stage4 include
2874         do
2875                 rm -f $t
2876                 $symbolic_link ../$t $t 2>/dev/null
2877         done
2878         cd $STARTDIR
2879    fi
2880  done
2881 else true ; fi
2882 # Avoid having to add intl to our include paths.
2883 if test -f intl/libintl.h; then
2884   echo creating libintl.h
2885   echo '#include "intl/libintl.h"' >libintl.h
2886 fi
2887 ], 
2888 [subdirs='$subdirs'
2889 symbolic_link='$symbolic_link'
2890 ])