Update version
[official-gcc.git] / gcc / configure.in
blob3f94f4d927c56290689ec53433f4ed0132495c6c
1 # configure.in for GNU CC
2 # Process this file with autoconf to generate a configuration script.
4 # Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
6 #This file is part of GNU CC.
8 #GNU CC is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 2, or (at your option)
11 #any later version.
13 #GNU CC is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #GNU General Public License for more details.
18 #You should have received a copy of the GNU General Public License
19 #along with GNU CC; see the file COPYING.  If not, write to
20 #the Free Software Foundation, 59 Temple Place - Suite 330,
21 #Boston, MA 02111-1307, USA.
23 # Initialization and defaults
24 AC_PREREQ(2.13)
25 AC_INIT(tree.c)
26 AC_CONFIG_HEADER(auto-host.h:config.in)
28 remove=rm
29 hard_link=ln
30 symbolic_link='ln -s'
31 copy=cp
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.])
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.])
86 # Check for additional parameters
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)
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.])
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)
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.])
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)
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)
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])
149 # Default local prefix if it is empty
150 if test x$local_prefix = x; then
151         local_prefix=/usr/local
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])
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/g++'
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
179 # Determine whether or not multilibs are enabled.
180 AC_ARG_ENABLE(multilib,
181 [  --enable-multilib       enable library support for multiple ABIs],
182 [], [enable_multilib=yes])
183 AC_SUBST(enable_multilib)
185 # Enable expensive internal checks
186 AC_ARG_ENABLE(checking,
187 [  --enable-checking[=LIST]
188                           enable expensive run-time checks.  With LIST,
189                           enable only specific categories of checks.
190                           Categories are: misc,tree,rtl,gc,gcac; default
191                           is no checking],
192 [ac_checking=
193 ac_tree_checking=
194 ac_rtl_checking=
195 ac_gc_checking=
196 ac_gc_always_collect=
197 case "${enableval}" in
198 yes)    ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;;
199 no)     ;;
200 *)      IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
201         set fnord $enableval; shift
202         IFS="$ac_save_IFS"
203         for check
204         do
205                 case $check in
206                 misc)   ac_checking=1 ;;
207                 tree)   ac_tree_checking=1 ;;
208                 rtl)    ac_rtl_checking=1 ;;
209                 gc)     ac_gc_checking=1 ;;
210                 gcac)   ac_gc_always_collect=1 ;;
211                 *)      AC_MSG_ERROR(unknown check category $check) ;;
212                 esac
213         done
214         ;;
215 esac
216 ], 
218 if test x$ac_checking != x ; then
219   AC_DEFINE(ENABLE_CHECKING, 1,
220 [Define if you want more run-time sanity checks.  This one gets a grab
221    bag of miscellaneous but relatively cheap checks.])
223 if test x$ac_tree_checking != x ; then
224   AC_DEFINE(ENABLE_TREE_CHECKING, 1,
225 [Define if you want all operations on trees (the basic data
226    structure of the front ends) to be checked for dynamic type safety
227    at runtime.  This is moderately expensive.])
229 if test x$ac_rtl_checking != x ; then
230   AC_DEFINE(ENABLE_RTL_CHECKING, 1,
231 [Define if you want all operations on RTL (the basic data structure
232    of the optimizer and back end) to be checked for dynamic type safety
233    at runtime.  This is quite expensive.])
235 if test x$ac_gc_checking != x ; then
236   AC_DEFINE(ENABLE_GC_CHECKING, 1,
237 [Define if you want the garbage collector to do object poisoning and
238    other memory allocation checks.  This is quite expensive.])
240 if test x$ac_gc_always_collect != x ; then
241   AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
242 [Define if you want the garbage collector to operate in maximally
243    paranoid mode, validating the entire heap and collecting garbage at
244    every opportunity.  This is extremely expensive.])
248 AC_ARG_ENABLE(cpp,
249 [  --disable-cpp           don't provide a user-visible C preprocessor],
250 [], [enable_cpp=yes])
252 AC_ARG_WITH(cpp_install_dir,
253 [  --with-cpp-install-dir=DIR
254                           install the user visible C preprocessor in DIR
255                           (relative to PREFIX) as well as PREFIX/bin],
256 [if test x$withval = xyes; then
257   AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
258 elif test x$withval != xno; then
259   cpp_install_dir=$withval
260 fi])
262 # Enable Multibyte Characters for C/C++
263 AC_ARG_ENABLE(c-mbchar,
264 [  --enable-c-mbchar       enable multibyte characters for C and C++],
265 if test x$enable_c_mbchar != xno; then
266   AC_DEFINE(MULTIBYTE_CHARS, 1,
267   [Define if you want the C and C++ compilers to support multibyte
268    character sets for source code.])
270   
271 # Enable threads
272 # Pass with no value to take the default
273 # Pass with a value to specify a thread package
274 AC_ARG_ENABLE(threads,
275 [  --enable-threads        enable thread usage for target GCC
276   --enable-threads=LIB    use LIB thread package for target GCC],,
277 enable_threads='')
279 enable_threads_flag=$enable_threads
280 # Check if a valid thread package
281 case x${enable_threads_flag} in
282         x | xno)
283                 # No threads
284                 target_thread_file='single'
285                 ;;
286         xyes)
287                 # default
288                 target_thread_file=''
289                 ;;
290         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
291         xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix)
292                 target_thread_file=$enable_threads_flag
293                 ;;
294         *)
295                 echo "$enable_threads is an unknown thread package" 1>&2
296                 exit 1
297                 ;;
298 esac
300 AC_ARG_ENABLE(objc-gc,
301 [  --enable-objc-gc       enable the use of Boehm's garbage collector with
302                           the GNU Objective-C runtime],
303 if test x$enable_objc_gc = xno; then
304         objc_boehm_gc=''
305 else
306         objc_boehm_gc=1
308 objc_boehm_gc='')
310 AC_ARG_WITH(dwarf2,
311 [  --with-dwarf2           force the default debug format to be DWARF 2],
312 dwarf2="$with_dwarf2",
313 dwarf2=no)
315 AC_ARG_ENABLE(shared,
316 [  --disable-shared        don't provide a shared libgcc],
318   case $enable_shared in
319   yes | no) ;;
320   *)
321     enable_shared=no
322     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
323     for pkg in $enableval; do
324       if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
325         enable_shared=yes
326       fi
327     done
328     IFS="$ac_save_ifs"
329     ;;
330   esac
331 ], [enable_shared=yes])
332 AC_SUBST(enable_shared)
334 # Determine the host, build, and target systems
335 AC_CANONICAL_SYSTEM
337 # Find the native compiler
338 AC_PROG_CC
339 AC_PROG_CC_C_O
340 # autoconf is lame and doesn't give us any substitution variable for this.
341 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
342   NO_MINUS_C_MINUS_O=yes
343 else
344   OUTPUT_OPTION='-o $@'
346 AC_SUBST(NO_MINUS_C_MINUS_O)
347 AC_SUBST(OUTPUT_OPTION)
349 gcc_AC_C_LONG_DOUBLE
350 gcc_AC_C__BOOL
352 AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
353 ac_cv_prog_cc_no_long_long,
354 [save_CFLAGS="$CFLAGS"
355 CFLAGS="-Wno-long-long"
356 AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
357                ac_cv_prog_cc_no_long_long=no)
358 CFLAGS="$save_CFLAGS"])
359 strict1_warn=
360 if test $ac_cv_prog_cc_no_long_long = yes; then
361   strict1_warn="-pedantic -Wno-long-long"
363 AC_SUBST(strict1_warn)
365 # If the native compiler is GCC, we can enable warnings even in stage1.  
366 # That's useful for people building cross-compilers, or just running a
367 # quick `make'.
368 warn_cflags=
369 if test "x$GCC" = "xyes"; then
370   warn_cflags='$(GCC_WARN_CFLAGS)'
372 AC_SUBST(warn_cflags)
374 # Stage specific cflags for build.
375 stage1_cflags=
376 case $build in
377 vax-*-*)
378   if test x$GCC = xyes
379   then
380     stage1_cflags="-Wa,-J"
381   else
382     stage1_cflags="-J"
383   fi
384   ;;
385 esac
386 AC_SUBST(stage1_cflags)
388 AC_PROG_MAKE_SET
390 AC_MSG_CHECKING([whether a default assembler was specified])
391 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
392     if test x"$gas_flag" = x"no"; then
393         AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
394     else
395         AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
396     fi
397 else
398     AC_MSG_RESULT(no)
401 AC_MSG_CHECKING([whether a default linker was specified])
402 if test x"${DEFAULT_LINKER+set}" = x"set"; then
403     if test x"$gnu_ld_flag" = x"no"; then
404         AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
405     else
406         AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
407     fi
408 else
409     AC_MSG_RESULT(no)
412 AC_MSG_CHECKING(for GNU C library)
413 AC_CACHE_VAL(gcc_cv_glibc,
414 [AC_TRY_COMPILE(
415   [#include <features.h>],[
416 #if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
417 #error Not a GNU C library system
418 #endif], 
419   [gcc_cv_glibc=yes], 
420   gcc_cv_glibc=no)])
421 AC_MSG_RESULT($gcc_cv_glibc)
422 if test $gcc_cv_glibc = yes; then
423   AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
426 AC_C_INLINE
428 # Find some useful tools
429 AC_PROG_AWK
430 gcc_AC_PROG_LN
431 gcc_AC_PROG_LN_S
432 gcc_AC_C_VOLATILE
433 AC_PROG_RANLIB
434 gcc_AC_PROG_INSTALL
436 AC_HEADER_STDC
437 AC_HEADER_TIME
438 gcc_AC_HEADER_STDBOOL
439 gcc_AC_HEADER_STRING
440 AC_HEADER_SYS_WAIT
441 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
442                  fcntl.h unistd.h stab.h sys/file.h sys/time.h \
443                  sys/resource.h sys/param.h sys/times.h sys/stat.h \
444                  direct.h malloc.h langinfo.h)
446 # Check for thread headers.
447 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
448 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
450 # See if GNAT has been installed
451 AC_CHECK_PROG(gnat, gnatbind, yes, no)
453 # See if we have the mktemp command.
454 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
456 # Do we have a single-tree copy of texinfo?
457 if test -f $srcdir/../texinfo/Makefile.in; then
458   MAKEINFO='$(objdir)/../texinfo/makeinfo/makeinfo'
459   gcc_cv_prog_makeinfo_modern=yes
460   AC_MSG_RESULT([Using makeinfo from the unified source tree.])
461 else
462   # See if makeinfo has been installed and is modern enough
463   # that we can use it.
464   gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
465   [GNU texinfo.* \([0-9][0-9.]*\)],
466   [4.*])
469 if test $gcc_cv_prog_makeinfo_modern = no; then
470   AC_MSG_WARN([
471 *** Makeinfo is missing or too old.
472 *** Info documentation will not be built.])
473   BUILD_INFO=
474 else
475   BUILD_INFO=info               AC_SUBST(BUILD_INFO)
478 # Is pod2man recent enough to regenerate manpages?
479 AC_MSG_CHECKING([for recent Pod::Man])
480 if perl -e 'use 1.10 Pod::Man' >/dev/null 2>&1; then
481   AC_MSG_RESULT(yes)
482   GENERATED_MANPAGES=generated-manpages         AC_SUBST(GENERATED_MANPAGES)
483 else
484   AC_MSG_RESULT(no)
485   GENERATED_MANPAGES=
488 # How about lex?
489 dnl Don't use AC_PROG_LEX; we insist on flex.
490 dnl LEXLIB is not useful in gcc.
491 if test -f $srcdir/../flex/skel.c; then
492   FLEX='$(objdir)/../flex/flex'
493 else
494   AC_CHECK_PROG(FLEX, flex, flex, false)
497 # Bison?
498 # The -L switch is so bison can find its skeleton file.
499 if test -f $srcdir/../bison/bison.simple; then
500   BISON='$(objdir)/../bison/bison -L $(srcdir)/../bison/'
501 else
502   AC_CHECK_PROG(BISON, bison, bison, false)
505 # See if the stage1 system preprocessor understands the ANSI C
506 # preprocessor stringification operator.
507 AC_C_STRINGIZE
509 # Use <inttypes.h> only if it exists,
510 # doesn't clash with <sys/types.h>, and declares intmax_t.
511 AC_MSG_CHECKING(for inttypes.h)
512 AC_CACHE_VAL(gcc_cv_header_inttypes_h,
513 [AC_TRY_COMPILE(
514   [#include <sys/types.h>
515 #include <inttypes.h>],
516   [intmax_t i = -1;],
517   [gcc_cv_header_inttypes_h=yes],
518   gcc_cv_header_inttypes_h=no)])
519 AC_MSG_RESULT($gcc_cv_header_inttypes_h)
520 if test $gcc_cv_header_inttypes_h = yes; then
521   AC_DEFINE(HAVE_INTTYPES_H, 1,
522         [Define if you have a working <inttypes.h> header file.])
526 # Determine if enumerated bitfields are unsigned.   ISO C says they can 
527 # be either signed or unsigned.
529 AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
530 [AC_TRY_RUN(#include <stdlib.h>
531 enum t { BLAH = 128 } ;
532 struct s_t { enum t member : 8; } s ;
533 int main(void)
534 {            
535         s.member = BLAH;
536         if (s.member < 0) exit(1);
537         exit(0);
539 }, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
540 if test $gcc_cv_enum_bf_unsigned = yes; then
541   AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
542     [Define if enumerated bitfields are treated as unsigned values.])
545 AC_CHECK_FUNCS(strtoul bsearch putenv popen bcopy \
546         strchr strrchr kill getrlimit setrlimit atoll atoq \
547         sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
548         fputs_unlocked getrusage nl_langinfo lstat)
550 AC_CHECK_TYPE(ssize_t, int)
552 # Try to determine the array type of the second argument of getgroups
553 # for the target system (int or gid_t).
554 AC_TYPE_GETGROUPS
555 if test "${target}" = "${build}"; then
556   TARGET_GETGROUPS_T=$ac_cv_type_getgroups
557 else
558   case "${target}" in
559         # This condition may need some tweaking.  It should include all
560         # targets where the array type of the second argument of getgroups
561         # is int and the type of gid_t is not equivalent to int.
562         *-*-sunos* | *-*-ultrix*)
563                 TARGET_GETGROUPS_T=int
564                 ;;
565         *)
566                 TARGET_GETGROUPS_T=gid_t
567                 ;;
568   esac
570 AC_SUBST(TARGET_GETGROUPS_T)
572 gcc_AC_FUNC_VFPRINTF_DOPRNT
573 gcc_AC_FUNC_STRSTR
574 gcc_AC_FUNC_PRINTF_PTR
576 case "${host}" in
577 *-*-uwin*)
578   AC_MSG_ERROR([
579 *** UWIN may not be used as a host platform because
580 *** linking with posix.dll is not allowed by the GNU GPL])
581   ;;
582 esac
583 AC_FUNC_VFORK
584 AC_FUNC_MMAP_ANYWHERE
585 AC_FUNC_MMAP_FILE
587 AM_ICONV
589 # We will need to find libiberty.h and ansidecl.h
590 saved_CFLAGS="$CFLAGS"
591 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
592 gcc_AC_CHECK_DECLS(bcopy \
593         getenv atol sbrk abort atof getcwd getwd \
594         strsignal putc_unlocked fputs_unlocked strstr environ \
595         malloc realloc calloc free basename getopt, , ,[
596 #include "gansidecl.h"
597 #include "system.h"])
599 gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
600 #include "gansidecl.h"
601 #include "system.h"
602 #ifdef HAVE_SYS_RESOURCE_H
603 #include <sys/resource.h>
604 #endif
607 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
608 CFLAGS="$saved_CFLAGS"
610 # mkdir takes a single argument on some systems. 
611 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
613 # File extensions
614 manext='.1'
615 objext='.o'
616 AC_SUBST(manext)
617 AC_SUBST(objext)
619 build_xm_file=
620 build_xm_defines=
621 build_install_headers_dir=install-headers-tar
622 build_exeext=
623 host_xm_file=
624 host_xm_defines=
625 host_xmake_file=
626 host_truncate_target=
627 host_exeext=
629 # Decode the host machine, then the target machine.
630 # For the host machine, we save the xm_file variable as host_xm_file;
631 # then we decode the target machine and forget everything else
632 # that came from the host machine.
633 for machine in $build $host $target; do
634         . ${srcdir}/config.gcc
635 done
637 extra_objs="${host_extra_objs} ${extra_objs}"
639 # Default the target-machine variables that were not explicitly set.
640 if test x"$tm_file" = x
641 then tm_file=$cpu_type/$cpu_type.h; fi
643 if test x"$extra_headers" = x
644 then extra_headers=; fi
646 if test x"$xm_file" = x
647 then xm_file=$cpu_type/xm-$cpu_type.h; fi
649 if test x$md_file = x
650 then md_file=$cpu_type/$cpu_type.md; fi
652 if test x$out_file = x
653 then out_file=$cpu_type/$cpu_type.c; fi
655 if test x"$tmake_file" = x
656 then tmake_file=$cpu_type/t-$cpu_type
659 if test x"$dwarf2" = xyes
660 then tm_file="$tm_file tm-dwarf2.h"
663 if test x$float_format = x
664 then float_format=i64
667 if test $float_format = none
668 then float_h_file=Makefile.in
669 else float_h_file=float-$float_format.h
672 # Handle cpp installation.
673 if test x$enable_cpp != xno
674 then
675   tmake_file="$tmake_file t-install-cpp"
678 # Say what files are being used for the output code and MD file.
679 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
680 echo "Using \`$srcdir/config/$md_file' as machine description file."
682 # If any of the xm_file variables contain nonexistent files, warn
683 # about them and drop them.  But $cpu/xm-$cpu.h is allowed not to
684 # exist, if we have nothing for it to do.
687 for x in $build_xm_file; do
688   if    test -f $srcdir/config/$x
689   then      bx="$bx $x"
690   elif  echo $x | grep '\([a-z0-9][a-z0-9]*\)/xm-\1\.h' >/dev/null
691   then      :
692   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
693   fi
694 done
695 build_xm_file="$bx"
698 for x in $host_xm_file; do
699   if    test -f $srcdir/config/$x
700   then      hx="$hx $x"
701   elif  echo $x | grep '\([a-z0-9][a-z0-9]*\)/xm-\1\.h' >/dev/null
702   then      :
703   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
704   fi
705 done
706 host_xm_file="$hx"
709 for x in $xm_file; do
710   if    test -f $srcdir/config/$x
711   then      tx="$tx $x"
712   elif  echo $x | grep '\([a-z0-9][a-z0-9]*\)/xm-\1\.h' >/dev/null
713   then      :
714   else      AC_MSG_WARN($srcdir/config/$x does not exist.)
715   fi
716 done
717 xm_file="$tx"
719 count=a
720 for f in $tm_file; do
721         count=${count}x
722 done
723 if test $count = ax; then
724         echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
725 else
726         echo "Using the following target machine macro files:"
727         for f in $tm_file; do
728                 echo "  $srcdir/config/$f"
729         done
732 count=a
733 for f in $host_xm_file; do
734         count=${count}x
735 done
736 if test $count = a; then
737         :
738 elif test $count = ax; then
739         echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
740 else
741         echo "Using the following host machine macro files:"
742         for f in $host_xm_file; do
743                 echo "  $srcdir/config/$f"
744         done
747 if test "$host_xm_file" != "$build_xm_file"; then
748         count=a
749         for f in $build_xm_file; do
750                 count=${count}x
751         done
752         if test $count = a; then
753                 :
754         elif test $count = ax; then
755                 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
756         else
757                 echo "Using the following build machine macro files:"
758                 for f in $build_xm_file; do
759                         echo "  $srcdir/config/$f"
760                 done
761         fi
764 if test x$thread_file = x; then
765         if test x$target_thread_file != x; then
766                 thread_file=$target_thread_file
767         else
768                 thread_file='single'
769         fi
772 # auto-host.h is the file containing items generated by autoconf and is
773 # the first file included by config.h.
774 host_xm_file="auto-host.h gansidecl.h ${host_xm_file} defaults.h hwint.h"
776 # If host=build, it is correct to have hconfig include auto-host.h
777 # as well.  If host!=build, we are in error and need to do more 
778 # work to find out the build config parameters.
779 if test x$host = x$build
780 then
781         build_xm_file="auto-host.h gansidecl.h ${build_xm_file} defaults.h hwint.h"
782 else
783         # We create a subdir, then run autoconf in the subdir.
784         # To prevent recursion we set host and build for the new
785         # invocation of configure to the build for this invocation
786         # of configure. 
787         tempdir=build.$$
788         rm -rf $tempdir
789         mkdir $tempdir
790         cd $tempdir
791         case ${srcdir} in
792         /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
793         *) realsrcdir=../${srcdir};;
794         esac
795         CC=${CC_FOR_BUILD} ${realsrcdir}/configure \
796                 --target=$target --host=$build --build=$build
798         # We just finished tests for the build machine, so rename
799         # the file auto-build.h in the gcc directory.
800         mv auto-host.h ../auto-build.h
801         cd ..
802         rm -rf $tempdir
803         build_xm_file="auto-build.h gansidecl.h ${build_xm_file} defaults.h hwint.h"
806 xm_file="gansidecl.h ${xm_file} defaults.h"
807 tm_file="gansidecl.h ${tm_file} defaults.h"
809 # Truncate the target if necessary
810 if test x$host_truncate_target != x; then
811         target=`echo $target | sed -e 's/\(..............\).*/\1/'`
814 # Get the version trigger filename from the toplevel
815 if test "${with_gcc_version_trigger+set}" = set; then
816         gcc_version_trigger=$with_gcc_version_trigger
817 else
818         gcc_version_trigger=${srcdir}/version.c
820 changequote(,)dnl
821 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'`
822 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
824 # Compile in configure arguments.
825 if test -f configargs.h ; then
826         # Being re-configured.
827         gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
828         gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
829 else
830         gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
832 cat > configargs.h <<EOF
833 /* Generated automatically. */
834 static const char configuration_arguments[] = "$gcc_config_arguments";
835 static const char thread_model[] = "$thread_file";
837 changequote([,])dnl
839 # Internationalization
840 PACKAGE=gcc
841 VERSION="$gcc_version"
842 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",
843         [Define to the name of the distribution.])
844 AC_DEFINE_UNQUOTED(VERSION, "$VERSION",
845         [Define to the version of the distribution.])
846 AC_SUBST(PACKAGE)
847 AC_SUBST(VERSION)
849 ALL_LINGUAS=
851 # Enable NLS support by default
852 AC_ARG_ENABLE(nls,
853   [  --enable-nls            use Native Language Support (default)],
854   , enable_nls=yes)
856 # if cross compiling, disable NLS support.
857 # It's not worth the trouble, at least for now.
859 if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then
860   AC_MSG_WARN(Disabling NLS support for canadian cross compiler.)
861   enable_nls=no
864 # if NLS is enabled, also enable check in po subdir
865 if test $enable_nls = yes; then
866   CHECK_PO=check-po
867 else
868   CHECK_PO=""
871 AC_SUBST(CHECK_PO)
873 AM_GNU_GETTEXT
874 XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
876 # Windows32 Registry support for specifying GCC installation paths.
877 AC_ARG_ENABLE(win32-registry,
878 [  --disable-win32-registry
879                           disable lookup of installation paths in the
880                           Registry on Windows hosts
881   --enable-win32-registry enable registry lookup (default)
882   --enable-win32-registry=KEY
883                           use KEY instead of GCC version as the last portion
884                           of the registry key],,)
886 AC_MSG_CHECKING(whether windows registry support is requested)
887 if test x$enable_win32_registry != xno; then
888   AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
889 [Define to 1 if installation paths should be looked up in Windows32
890    Registry. Ignored on non windows32 hosts.])
891   AC_MSG_RESULT(yes)
892 else
893   AC_MSG_RESULT(no)
896 # Check if user specified a different registry key.
897 case x${enable_win32_registry} in
898 x | xyes)
899   # default.
900   gcc_cv_win32_registry_key="$VERSION"
901   ;;
902 xno)
903   # no registry lookup.
904   gcc_cv_win32_registry_key=''
905   ;;
907   # user-specified key.
908   gcc_cv_win32_registry_key="$enable_win32_registry"
909   ;;
910 esac
912 if test x$enable_win32_registry != xno; then
913   AC_MSG_CHECKING(registry key on windows hosts)
914   AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$gcc_cv_win32_registry_key",
915         [Define to be the last portion of registry key on windows hosts.])
916   AC_MSG_RESULT($gcc_cv_win32_registry_key)
919 # Get an absolute path to the GCC top-level source directory
920 holddir=`pwd`
921 cd $srcdir
922 topdir=`pwd`
923 cd $holddir
925 # Conditionalize the makefile for this host machine.
926 # Make-host contains the concatenation of all host makefile fragments
927 # [there can be more than one].  This file is built by configure.frag.
928 host_overrides=Make-host
929 dep_host_xmake_file=
930 for f in .. ${host_xmake_file}
932         if test -f ${srcdir}/config/$f
933         then
934                 dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f"
935         fi
936 done
938 # Conditionalize the makefile for this target machine.
939 # Make-target contains the concatenation of all host makefile fragments
940 # [there can be more than one].  This file is built by configure.frag.
941 target_overrides=Make-target
942 dep_tmake_file=
943 for f in .. ${tmake_file}
945         if test -f ${srcdir}/config/$f
946         then
947                 dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f"
948         fi
949 done
951 # If the host doesn't support symlinks, modify CC in
952 # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
953 # Otherwise, we can use "CC=$(CC)".
954 rm -f symtest.tem
955 if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null
956 then
957         cc_set_by_configure="\$(CC)"
958         quoted_cc_set_by_configure="\$(CC)"
959         stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
960 else
961         rm -f symtest.tem
962         if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null
963         then
964                 symbolic_link="cp -p"
965         else
966                 symbolic_link="cp"
967         fi
968         cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
969         quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
970         stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
972 rm -f symtest.tem
974 out_object_file=`basename $out_file .c`.o
976 tm_file_list=
977 for f in $tm_file; do
978   case $f in
979     gansidecl.h | defaults.h )
980        tm_file_list="${tm_file_list} $f" ;;
981     *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;;
982   esac
983 done
985 tm_p_file_list=
986 for f in $tm_p_file; do
987     tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
988 done
990 host_xm_file_list=
991 for f in $host_xm_file; do
992   case $f in
993     auto-host.h | gansidecl.h | defaults.h | hwint.h )
994        host_xm_file_list="${host_xm_file_list} $f" ;;
995     *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;;
996   esac
997 done
999 build_xm_file_list=
1000 for f in $build_xm_file; do
1001   case $f in
1002     auto-build.h | auto-host.h | gansidecl.h | defaults.h | hwint.h )
1003        build_xm_file_list="${build_xm_file_list} $f" ;;
1004     *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;;
1005   esac
1006 done
1008 # Define macro CROSS_COMPILE in compilation
1009 # if this is a cross-compiler.
1010 # Also use all.cross instead of all.internal
1011 # and add cross-make to Makefile.
1012 cross_overrides="/dev/null"
1013 if test x$host != x$target
1014 then
1015         cross_defines="CROSS=-DCROSS_COMPILE"
1016         cross_overrides="${topdir}/cross-make"
1019 # If this is a cross-compiler that does not
1020 # have its own set of headers then define
1021 # inhibit_libc
1023 # If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS.
1024 # This prevents libgcc2 from containing any code which requires libc
1025 # support.
1026 inhibit_libc=
1027 if [test x$host != x$target] && [test x$with_headers = x]; then
1028        inhibit_libc=-Dinhibit_libc
1029 else
1030        if [test x$with_newlib = xyes]; then
1031                inhibit_libc=-Dinhibit_libc
1032        fi
1034 AC_SUBST(inhibit_libc)
1036 # When building gcc with a cross-compiler, we need to fix a few things.
1037 # This must come after cross-make as we want all.build to override
1038 # all.cross.
1039 build_overrides="/dev/null"
1040 if test x$build != x$host
1041 then
1042         build_overrides="${topdir}/build-make"
1045 # Expand extra_headers to include complete path.
1046 # This substitutes for lots of t-* files.
1047 extra_headers_list=
1048 if test "x$extra_headers" = x
1049 then true
1050 else
1051         # Prepend ${srcdir}/ginclude/ to every entry in extra_headers.
1052         for file in $extra_headers;
1053         do
1054                 extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/${file}"
1055         done
1058 if test x$use_collect2 = xno; then
1059         use_collect2=
1062 # Add a definition of USE_COLLECT2 if system wants one.
1063 # Also tell toplev.c what to do.
1064 # This substitutes for lots of t-* files.
1065 if test x$use_collect2 = x
1066 then
1067         will_use_collect2=
1068         maybe_use_collect2=
1069 else
1070         will_use_collect2="collect2"
1071         maybe_use_collect2="-DUSE_COLLECT2"
1074 # If we have gas in the build tree, make a link to it.
1075 if test -f ../gas/Makefile; then
1076         rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
1079 # If we have nm in the build tree, make a link to it.
1080 if test -f ../binutils/Makefile; then
1081         rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
1084 # If we have ld in the build tree, make a link to it.
1085 if test -f ../ld/Makefile; then
1086 #       if test x$use_collect2 = x; then
1087 #               rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null
1088 #       else
1089                 rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
1090 #       fi
1093 # Figure out what assembler we will be using.
1094 AC_MSG_CHECKING(what assembler to use)
1095 gcc_cv_as=
1096 gcc_cv_gas_major_version=
1097 gcc_cv_gas_minor_version=
1098 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
1099 if test -x "$DEFAULT_ASSEMBLER"; then
1100         gcc_cv_as="$DEFAULT_ASSEMBLER"
1101 elif test -x "$AS"; then
1102         gcc_cv_as="$AS"
1103 elif test -x as$host_exeext; then
1104         # Build using assembler in the current directory.
1105         gcc_cv_as=./as$host_exeext
1106 elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then
1107         # Single tree build which includes gas.
1108         for f in $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
1109         do
1110 changequote(,)dnl
1111                 gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
1112 changequote([,])dnl
1113                 if test x$gcc_cv_gas_version != x; then
1114                         break
1115                 fi
1116         done
1117 changequote(,)dnl
1118         gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
1119         gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1120 changequote([,])dnl
1123 if test "x$gcc_cv_as" = x -a x$host = x$target; then
1124         # Native build.
1125         # Search the same directories that the installed compiler will
1126         # search.  Else we may find the wrong assembler and lose.  If we
1127         # do not find a suitable assembler binary, then try the user's
1128         # path.
1129         #
1130         # Also note we have to check MD_EXEC_PREFIX before checking the
1131         # user's path.  Unfortunately, there is no good way to get at the
1132         # value of MD_EXEC_PREFIX here.  So we do a brute force search
1133         # through all the known MD_EXEC_PREFIX values.  Ugh.  This needs
1134         # to be fixed as part of the make/configure rewrite too.
1136         if test "x$exec_prefix" = xNONE; then
1137                 if test "x$prefix" = xNONE; then
1138                         test_prefix=/usr/local
1139                 else
1140                         test_prefix=$prefix
1141                 fi
1142         else
1143                 test_prefix=$exec_prefix
1144         fi
1146         # If the loop below does not find an assembler, then use whatever
1147         # one we can find in the users's path.
1148         # user's path.
1149         gcc_cv_as=as$host_exeext
1151         test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
1152                    $test_prefix/lib/gcc-lib/$target \
1153                    /usr/lib/gcc/$target/$gcc_version \
1154                    /usr/lib/gcc/$target \
1155                    $test_prefix/$target/bin/$target/$gcc_version \
1156                    $test_prefix/$target/bin \
1157                    /usr/libexec \
1158                    /usr/ccs/gcc \
1159                    /usr/ccs/bin \
1160                    /udk/usr/ccs/bin \
1161                    /bsd43/usr/lib/cmplrs/cc \
1162                    /usr/cross64/usr/bin \
1163                    /usr/lib/cmplrs/cc \
1164                    /sysv/usr/lib/cmplrs/cc \
1165                    /svr4/usr/lib/cmplrs/cc \
1166                    /usr/bin"
1168         for dir in $test_dirs; do
1169                 if test -f $dir/as$host_exeext; then
1170                         gcc_cv_as=$dir/as$host_exeext
1171                         break;
1172                 fi
1173         done
1175 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1176   AC_MSG_RESULT("newly built gas")
1177 else
1178   AC_MSG_RESULT($gcc_cv_as)
1181 # Figure out what nm we will be using.
1182 AC_MSG_CHECKING(what nm to use)
1183 if test -x nm$host_exeext; then
1184         gcc_cv_nm=./nm$host_exeext
1185 elif test x$host = x$target; then
1186         # Native build.
1187         gcc_cv_nm=nm$host_exeext
1189 AC_MSG_RESULT($gcc_cv_nm)
1191 # Figure out what assembler alignment features are present.
1192 AC_MSG_CHECKING(assembler alignment features)
1193 gcc_cv_as_alignment_features=none
1194 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1195         # Gas version 2.6 and later support for .balign and .p2align.
1196         # bytes to skip when using .p2align.
1197         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
1198                 gcc_cv_as_alignment_features=".balign and .p2align"
1199                 AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
1200         fi
1201         # Gas version 2.8 and later support specifying the maximum
1202         # bytes to skip when using .p2align.
1203         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
1204                 gcc_cv_as_alignment_features=".p2align including maximum skip"
1205                 AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
1206         fi
1207 elif test x$gcc_cv_as != x; then
1208         # Check if we have .balign and .p2align
1209         echo ".balign  4" > conftest.s
1210         echo ".p2align  2" >> conftest.s
1211         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1212                 gcc_cv_as_alignment_features=".balign and .p2align"
1213                 AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
1214         fi
1215         rm -f conftest.s conftest.o
1216         # Check if specifying the maximum bytes to skip when
1217         # using .p2align is supported.
1218         echo ".p2align 4,,7" > conftest.s
1219         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1220                 gcc_cv_as_alignment_features=".p2align including maximum skip"
1221                 AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
1222         fi
1223         rm -f conftest.s conftest.o
1225 AC_MSG_RESULT($gcc_cv_as_alignment_features)
1227 AC_MSG_CHECKING(assembler subsection support)
1228 gcc_cv_as_subsections=no
1229 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1230   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
1231     gcc_cv_as_subsections="working .subsection -1"
1232   fi
1233 elif test x$gcc_cv_as != x; then
1234         # Check if we have .subsection
1235         echo ".subsection 1" > conftest.s
1236         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1237                 gcc_cv_as_subsections=".subsection"
1238                 if test x$gcc_cv_nm != x; then
1239                         cat > conftest.s <<EOF
1240 conftest_label1: .word 0
1241 .subsection -1
1242 conftest_label2: .word 0
1243 .previous
1245                         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1246                                 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
1247                                 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
1248                                 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then
1249                                         :
1250                                 else
1251                                         gcc_cv_as_subsections="working .subsection -1"
1252                                 fi
1253                         fi
1254                 fi
1255         fi
1256         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1258 if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then
1259         AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
1260 [Define if your assembler supports .subsection and .subsection -1 starts
1261    emitting at the beginning of your section.])
1263 AC_MSG_RESULT($gcc_cv_as_subsections)
1265 AC_MSG_CHECKING(assembler weak support)
1266 gcc_cv_as_weak=no
1267 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1268   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
1269     gcc_cv_as_weak="yes"
1270   fi
1271 elif test x$gcc_cv_as != x; then
1272         # Check if we have .weak
1273         echo "  .weak foobar" > conftest.s
1274         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1275                 gcc_cv_as_weak="yes"
1276         fi
1277         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1279 if test x"$gcc_cv_as_weak" = xyes; then
1280         AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])
1282 AC_MSG_RESULT($gcc_cv_as_weak)
1284 AC_MSG_CHECKING(assembler hidden support)
1285 gcc_cv_as_hidden=no
1286 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1287   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1288     gcc_cv_as_hidden="yes"
1289   fi
1290 elif test x$gcc_cv_as != x; then
1291         # Check if we have .hidden
1292         echo "  .hidden foobar" > conftest.s
1293         echo "foobar:" >> conftest.s
1294         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1295                 gcc_cv_as_hidden="yes"
1296         fi
1297         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1299 if test x"$gcc_cv_as_hidden" = xyes; then
1300         AC_DEFINE(HAVE_GAS_HIDDEN, 1,
1301                 [Define if your assembler supports .hidden.])
1303 AC_MSG_RESULT($gcc_cv_as_hidden)
1305 AC_MSG_CHECKING(assembler leb128 support)
1306 gcc_cv_as_leb128=no
1307 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1308   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
1309     gcc_cv_as_leb128="yes"
1310   fi
1311 elif test x$gcc_cv_as != x; then
1312         # Check if we have .[us]leb128, and support symbol arithmetic with it.
1313         cat > conftest.s <<EOF
1314         .data
1315         .uleb128 L2 - L1
1317         .uleb128 1280
1318         .sleb128 -1010
1321         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1322                 gcc_cv_as_leb128="yes"
1324                 # GAS versions before 2.11 do not support uleb128,
1325                 # despite appearing to.
1326                 # ??? There exists an elf-specific test that will crash
1327                 # the assembler.  Perhaps it's better to figure out whether
1328                 # arbitrary sections are supported and try the test.
1329                 as_ver=`$gcc_cv_as --version 2>/dev/null | head -1`
1330                 if echo "$as_ver" | grep GNU > /dev/null; then
1331                         as_ver=`echo $as_ver | sed -e 's/.* //'`
1332                         as_major=`echo $as_ver | sed 's/\..*//'`
1333 changequote(,)dnl
1334                         as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
1335 changequote([,])dnl
1336                         if test $as_major -eq 2 -a $as_minor -lt 11; then
1337                                 gcc_cv_as_leb128="no"
1338                         fi
1339                 fi
1340         fi
1341         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1343 if test x"$gcc_cv_as_leb128" = xyes; then
1344         AC_DEFINE(HAVE_AS_LEB128, 1,
1345                 [Define if your assembler supports .uleb128.])
1347 AC_MSG_RESULT($gcc_cv_as_leb128)
1349 AC_MSG_CHECKING(assembler eh_frame optimization)
1350 gcc_cv_as_eh_frame=no
1351 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1352   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
1353     gcc_cv_as_eh_frame="yes"
1354   fi
1355 elif test x$gcc_cv_as != x; then
1356         # Check if this is GAS.
1357         as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1`
1358         rm -f a.out 2> /dev/null
1359         if echo "$as_ver" | grep GNU > /dev/null; then
1360                 # Versions up to and including 2.11.0 may mis-optimize
1361                 # .eh_frame data.  Try something.
1362                 cat > conftest.s <<EOF
1363         .text
1364 .LFB1:
1365         .4byte  0
1366 .L1:
1367         .4byte  0
1368 .LFE1:
1369         .section        .eh_frame,"aw",@progbits
1370 __FRAME_BEGIN__:
1371         .4byte  .LECIE1-.LSCIE1
1372 .LSCIE1:
1373         .4byte  0x0
1374         .byte   0x1
1375         .ascii "z\0"
1376         .byte   0x1
1377         .byte   0x78
1378         .byte   0x1a
1379         .byte   0x0
1380         .byte   0x4
1381         .4byte  1
1382         .p2align 1
1383 .LECIE1:
1384 .LSFDE1:
1385         .4byte  .LEFDE1-.LASFDE1
1386 .LASFDE1:
1387         .4byte  .LASFDE1-__FRAME_BEGIN__
1388         .4byte  .LFB1
1389         .4byte  .LFE1-.LFB1
1390         .byte   0x4
1391         .4byte  .LFE1-.LFB1
1392         .byte   0x4
1393         .4byte  .L1-.LFB1
1394 .LEFDE1:
1396                 cat > conftest.lit <<EOF
1397  0000 10000000 00000000 017a0001 781a0004  .........z..x...
1398  0010 01000000 12000000 18000000 00000000  ................
1399  0020 08000000 04080000 0044               .........D      
1401                 cat > conftest.big <<EOF
1402  0000 00000010 00000000 017a0001 781a0004  .........z..x...
1403  0010 00000001 00000012 00000018 00000000  ................
1404  0020 00000008 04000000 0844               .........D      
1406                 # If the assembler didn't choke, and we can objdump,
1407                 # and we got the correct data, then succeed.
1408                 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
1409                    && objdump -s -j .eh_frame conftest.o 2>/dev/null \
1410                       | tail -3 > conftest.got \
1411                    && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
1412                         || cmp conftest.big conftest.got > /dev/null 2>&1; }
1413                 then
1414                         gcc_cv_as_eh_frame="yes"
1415                 else
1416                         gcc_cv_as_eh_frame="bad"
1417                         if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then
1418                                 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
1419         [Define if your assembler mis-optimizes .eh_frame data.])
1420                         fi
1421                 fi
1422         fi
1423         rm -f conftest.*
1425 AC_MSG_RESULT($gcc_cv_as_eh_frame)
1427 case "$target" in 
1428   sparc*-*-*)
1429     AC_CACHE_CHECK([assembler .register pseudo-op support],
1430         gcc_cv_as_register_pseudo_op, [
1431         gcc_cv_as_register_pseudo_op=unknown
1432         if test x$gcc_cv_as != x; then
1433             # Check if we have .register
1434             echo ".register %g2, #scratch" > conftest.s
1435             if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1436                 gcc_cv_as_register_pseudo_op=yes
1437             else
1438                 gcc_cv_as_register_pseudo_op=no
1439             fi
1440             rm -f conftest.s conftest.o
1441         fi
1442     ])
1443     if test "x$gcc_cv_as_register_pseudo_op" = xyes; then
1444         AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
1445                 [Define if your assembler supports .register.])
1446     fi
1448     AC_CACHE_CHECK([assembler supports -relax],
1449         gcc_cv_as_relax_opt, [
1450         gcc_cv_as_relax_opt=unknown
1451         if test x$gcc_cv_as != x; then
1452             # Check if gas supports -relax
1453             echo ".text" > conftest.s
1454             if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then
1455                 gcc_cv_as_relax_opt=yes
1456             else
1457                 gcc_cv_as_relax_opt=no
1458             fi
1459             rm -f conftest.s conftest.o
1460         fi
1461     ])
1462     if test "x$gcc_cv_as_relax_opt" = xyes; then
1463         AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
1464                 [Define if your assembler supports -relax option.])
1465     fi
1467     case "$tm_file" in
1468     *64*)
1469         AC_CACHE_CHECK([for 64 bit support in assembler ($gcc_cv_as)],
1470             gcc_cv_as_flags64, [
1471                 if test -n "$gcc_cv_as"; then
1472                     echo ".xword foo" > conftest.s
1473                     gcc_cv_as_flags64=no
1474                     for flag in "-xarch=v9" "-64 -Av9"; do
1475                         if $gcc_cv_as $flag -o conftest.o conftest.s \
1476                             > /dev/null 2>&1; then
1477                             gcc_cv_as_flags64=$flag
1478                             break
1479                         fi
1480                     done
1481                     rm -f conftest.s conftest.o
1482                 else
1483                     if test "$gas" = yes; then
1484                         gcc_cv_as_flags64="-64 -Av9"
1485                     else
1486                         gcc_cv_as_flags64="-xarch=v9"
1487                     fi
1488                 fi
1489         ])
1490         if test "x$gcc_cv_as_flags64" = xno; then
1491 changequote(, )
1492             tmake_file=`echo " $tmake_file " | sed -e 's, sparc/t-sol2-64 , ,' -e 's,^ ,,' -e 's, $,,'`
1493             dep_tmake_file=`echo " $dep_tmake_file " | sed -e 's, [^ ]*/config/sparc/t-sol2-64 , ,' -e 's,^ ,,' -e 's, $,,'`
1494 changequote([, ])
1495         else
1496             AC_DEFINE_UNQUOTED(AS_SPARC64_FLAG, "$gcc_cv_as_flags64",
1497                         [Define if the assembler supports 64bit sparc.])
1498         fi
1499         ;;
1500     *) gcc_cv_as_flags64=${gcc_cv_as_flags64-no}
1501         ;;
1502     esac
1504     if test "x$gcc_cv_as_flags64" != xno; then
1505         AC_CACHE_CHECK([for assembler offsetable %lo() support],
1506             gcc_cv_as_offsetable_lo10, [
1507             gcc_cv_as_offsetable_lo10=unknown
1508             if test "x$gcc_cv_as" != x; then
1509                 # Check if assembler has offsetable %lo()
1510                 echo "or %g1, %lo(ab) + 12, %g1" > conftest.s
1511                 echo "or %g1, %lo(ab + 12), %g1" > conftest1.s
1512                 if $gcc_cv_as $gcc_cv_as_flags64 -o conftest.o conftest.s \
1513                         > /dev/null 2>&1 &&
1514                    $gcc_cv_as $gcc_cv_as_flags64 -o conftest1.o conftest1.s \
1515                         > /dev/null 2>&1; then
1516                     if cmp conftest.o conftest1.o > /dev/null 2>&1; then
1517                         gcc_cv_as_offsetable_lo10=no
1518                     else
1519                         gcc_cv_as_offsetable_lo10=yes
1520                     fi
1521                 else
1522                     gcc_cv_as_offsetable_lo10=no
1523                 fi
1524                 rm -f conftest.s conftest.o conftest1.s conftest1.o
1525             fi
1526         ])
1527         if test "x$gcc_cv_as_offsetable_lo10" = xyes; then
1528             AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
1529                 [Define if your assembler supports offsetable %lo().])
1530         fi
1531     fi
1533     ;;
1535 changequote(,)dnl
1536   i[34567]86-*-*)
1537 changequote([,])dnl
1538     AC_MSG_CHECKING(assembler instructions)
1539     gcc_cv_as_instructions=
1540     if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
1541       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
1542         gcc_cv_as_instructions="filds fists"
1543       fi
1544     elif test x$gcc_cv_as != x; then
1545         set "filds fists" "filds mem; fists mem"
1546         while test $# -gt 0
1547         do
1548                 echo "$2" > conftest.s
1549                 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1550                         gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" "
1551                 fi
1552                 shift 2
1553         done
1554         rm -f conftest.s conftest.o
1555     fi
1556     if test x"$gcc_cv_as_instructions" != x; then
1557         AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | sed -e 's/ $//' | tr '[a-z ]' '[A-Z_]'`)
1558     fi
1559     AC_MSG_RESULT($gcc_cv_as_instructions)
1560     ;;
1561 esac
1563 AC_MSG_CHECKING(assembler dwarf2 debug_line support)
1564 gcc_cv_as_dwarf2_debug_line=no
1565 # ??? Not all targets support dwarf2 debug_line, even within a version
1566 # of gas.  Moreover, we need to emit a valid instruction to trigger any
1567 # info to the output file.  So, as supported targets are added to gas 2.11,
1568 # add some instruction here to (also) show we expect this might work.
1569 # ??? Once 2.11 is released, probably need to add first known working
1570 # version to the per-target configury.
1571 case "$target" in
1572   i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-*)
1573     insn="nop"
1574     ;;
1575   ia64*-*-*)
1576     insn="nop 0"
1577     ;;
1578   esac
1579 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
1580 then
1581   if test "$gcc_cv_gas_major_version" -eq 2 \
1582         -a "$gcc_cv_gas_minor_version" -ge 11 \
1583         -o "$gcc_cv_gas_major_version" -gt 2 \
1584      && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
1585      && test x"$insn" != x ; then
1586     gcc_cv_as_dwarf2_debug_line="yes"
1587   fi
1588 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
1589         echo '  .file 1 "conftest.s"' > conftest.s
1590         echo '  .loc 1 3 0' >> conftest.s
1591         echo "  $insn" >> conftest.s
1592         if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
1593            && grep debug_line conftest.o > /dev/null 2>&1 ; then
1594                 # The .debug_line file table must be in the exact order that
1595                 # we specified the files, since these indicies are also used
1596                 # by DW_AT_decl_file.  Approximate this test by testing if
1597                 # the assembler bitches if the same index is assigned twice.
1598                 echo '  .file 1 "foo.s"' > conftest.s
1599                 echo '  .file 1 "bar.s"' >> conftest.s
1600                 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1
1601                 then
1602                   gcc_cv_as_dwarf2_debug_line="no"
1603                 else
1604                   gcc_cv_as_dwarf2_debug_line="yes"
1605                 fi
1606         fi
1607         rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1609 if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then
1610         AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
1611           [Define if your assembler supports dwarf2 .file/.loc directives.])
1613 AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
1615 # Figure out what language subdirectories are present.
1616 # Look if the user specified --enable-languages="..."; if not, use
1617 # the environment variable $LANGUAGES if defined. $LANGUAGES might
1618 # go away some day.
1619 if test x"${enable_languages+set}" != xset; then
1620         if test x"${LANGUAGES+set}" = xset; then
1621                 enable_languages="`echo ${LANGUAGES} | tr ' ' ','`"
1622         else
1623                 enable_languages=all
1624         fi
1625 else
1626         if test x"${enable_languages}" = x; then
1627                 AC_MSG_ERROR([--enable-languages needs at least one argument])
1628         fi
1631 # First scan to see if an enabled language requires some other language.
1632 # We assume that a given config-lang.in will list all the language
1633 # front ends it requires, even if some are required indirectly.
1634 for lang in ${srcdir}/*/config-lang.in ..
1636    case $lang in
1637     ..)
1638        ;;
1639     # The odd quoting in the next line works around
1640     # an apparent bug in bash 1.12 on linux.
1641 changequote(,)dnl
1642     ${srcdir}/[*]/config-lang.in)
1643        ;;
1644     *)
1645        lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^      ]*\).*$,\1,p' $lang`
1646        this_lang_requires=`sed -n -e 's,^lang_requires=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_requires=\([^    ]*\).*$,\1,p' $lang`
1647        for other in $this_lang_requires
1648        do
1649           case ,${enable_languages}, in
1650            *,$other,*)
1651               ;;
1652            *,all,*)
1653               ;;
1654            *,$lang_alias,*)
1655               enable_languages="$enable_languages,$other"
1656               ;;
1657           esac
1658        done
1659        ;;
1660 changequote([,])dnl
1661    esac
1662 done
1664 subdirs=
1665 for lang in ${srcdir}/*/config-lang.in ..
1667         case $lang in
1668         ..) ;;
1669         # The odd quoting in the next line works around
1670         # an apparent bug in bash 1.12 on linux.
1671 changequote(,)dnl
1672         ${srcdir}/[*]/config-lang.in) ;;
1673         *)
1674           lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^   ]*\).*$,\1,p' $lang`
1675           this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^         ]*\).*$,\1,p' $lang`
1676           build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^     ]*\).*$,\1,p' $lang`
1677           if test "x$lang_alias" = x
1678           then
1679                 echo "$lang doesn't set \$language." 1>&2
1680                 exit 1
1681           fi
1682           case ${build_by_default},${enable_languages}, in
1683           *,$lang_alias,*) add_this_lang=yes ;;
1684           no,*) add_this_lang=no ;;
1685           *,all,*) add_this_lang=yes ;;
1686           *) add_this_lang=no ;;
1687           esac
1688           if test x"${add_this_lang}" = xyes; then
1689                 case $lang in
1690                     ${srcdir}/ada/config-lang.in)
1691                         if test x$gnat = xyes ; then
1692                                 subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
1693                         fi
1694                         ;;
1695                     *)
1696                         subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
1697                         ;;
1698                 esac
1699           fi
1700           ;;
1701 changequote([,])dnl
1702         esac
1703 done
1705 # Make gthr-default.h if we have a thread file.
1706 gthread_flags=
1707 if test $thread_file != single; then
1708     rm -f gthr-default.h
1709     echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
1710     gthread_flags=-DHAVE_GTHR_DEFAULT
1712 AC_SUBST(gthread_flags)
1714 # Find out what GC implementation we want, or may, use.
1715 AC_ARG_WITH(gc,
1716 [  --with-gc={simple,page} choose the garbage collection mechanism to use
1717                           with the compiler],
1718 [case "$withval" in
1719   simple | page)
1720     GGC=ggc-$withval
1721     ;;
1722   *)
1723     AC_MSG_ERROR([$withval is an invalid option to --with-gc])
1724     ;;
1725 esac],
1726 [GGC=ggc-page])
1727 AC_SUBST(GGC)
1728 echo "Using $GGC for garbage collection."
1730 # Use the system's zlib library.
1731 zlibdir=-L../zlib
1732 zlibinc="-I\$(srcdir)/../zlib"
1733 AC_ARG_WITH(system-zlib,
1734 [  --with-system-zlib      use installed libz],
1735 zlibdir=
1736 zlibinc=
1738 AC_SUBST(zlibdir)
1739 AC_SUBST(zlibinc)
1741 AC_DEFINE_UNQUOTED(ENABLE_STD_NAMESPACE, 1,
1742   [Define to 1 if you want to enable namespaces (-fhonor-std) by default.])
1744 dnl Very limited version of automake's enable-maintainer-mode
1746 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1747   dnl maintainer-mode is disabled by default
1748   AC_ARG_ENABLE(maintainer-mode,
1749 [  --enable-maintainer-mode
1750                           enable make rules and dependencies not useful
1751                           (and sometimes confusing) to the casual installer],
1752       maintainer_mode=$enableval,
1753       maintainer_mode=no)
1755 AC_MSG_RESULT($maintainer_mode)
1757 if test "$maintainer_mode" = "yes"; then
1758   MAINT=''
1759 else
1760   MAINT='#'
1762 AC_SUBST(MAINT)dnl
1764 # With Setjmp/Longjmp based exception handling.
1765 AC_ARG_ENABLE(sjlj-exceptions,
1766 [  --enable-sjlj-exceptions
1767                           arrange to use setjmp/longjmp exception handling],
1768 [sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1769 AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1770   [Define 0/1 to force the choice for exception handling model.])])
1772 # Make empty files to contain the specs and options for each language.
1773 # Then add #include lines to for a compiler that has specs and/or options.
1775 lang_specs_files=
1776 lang_options_files=
1777 lang_tree_files=
1778 rm -f specs.h options.h gencheck.h
1779 touch specs.h options.h gencheck.h
1780 for subdir in . $subdirs
1782         if test -f $srcdir/$subdir/lang-specs.h; then
1783                 echo "#include \"$subdir/lang-specs.h\"" >>specs.h
1784                 lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
1785         fi
1786         if test -f $srcdir/$subdir/lang-options.h; then
1787                 echo "#include \"$subdir/lang-options.h\"" >>options.h
1788                 lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h"
1789         fi
1790         if test -f $srcdir/$subdir/$subdir-tree.def; then
1791                 echo "#include \"$subdir/$subdir-tree.def\"" >>gencheck.h
1792                 lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
1793         fi
1794 done
1796 # These (without "all_") are set in each config-lang.in.
1797 # `language' must be a single word so is spelled singularly.
1798 all_languages=
1799 all_boot_languages=
1800 all_compilers=
1801 all_stagestuff=
1802 all_diff_excludes=
1803 all_outputs='Makefile intl/Makefile po/Makefile.in fixinc/Makefile gccbug mklibgcc'
1804 # List of language makefile fragments.
1805 all_lang_makefiles=
1806 all_headers=
1807 all_lib2funcs=
1809 # Add the language fragments.
1810 # Languages are added via two mechanisms.  Some information must be
1811 # recorded in makefile variables, these are defined in config-lang.in.
1812 # We accumulate them and plug them into the main Makefile.
1813 # The other mechanism is a set of hooks for each of the main targets
1814 # like `clean', `install', etc.
1816 language_fragments="Make-lang"
1817 language_hooks="Make-hooks"
1819 for s in .. $subdirs
1821         if test $s != ".."
1822         then
1823                 language=
1824                 boot_language=
1825                 compilers=
1826                 stagestuff=
1827                 diff_excludes=
1828                 headers=
1829                 outputs=
1830                 lib2funcs=
1831                 . ${srcdir}/$s/config-lang.in
1832                 if test "x$language" = x
1833                 then
1834                         echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2
1835                         exit 1
1836                 fi
1837                 all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in"
1838                 if test -f ${srcdir}/$s/Makefile.in
1839                 then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in"
1840                 fi
1841                 all_languages="$all_languages $language"
1842                 if test "x$boot_language" = xyes
1843                 then
1844                         all_boot_languages="$all_boot_languages $language"
1845                 fi
1846                 all_compilers="$all_compilers $compilers"
1847                 all_stagestuff="$all_stagestuff $stagestuff"
1848                 all_diff_excludes="$all_diff_excludes $diff_excludes"
1849                 all_headers="$all_headers $headers"
1850                 all_outputs="$all_outputs $outputs"
1851                 all_lib2funcs="$all_lib2funcs $lib2funcs"
1852         fi
1853 done
1855 # Since we can't use `::' targets, we link each language in
1856 # with a set of hooks, reached indirectly via lang.${target}.
1858 rm -f Make-hooks
1859 touch Make-hooks
1860 target_list="all.build all.cross start.encap rest.encap \
1861         info dvi \
1862         install-normal install-common install-info install-man \
1863         uninstall \
1864         mostlyclean clean distclean extraclean maintainer-clean \
1865         stage1 stage2 stage3 stage4"
1866 for t in $target_list
1868         x=
1869         for lang in .. $all_languages
1870         do
1871                 if test $lang != ".."; then
1872                         x="$x $lang.$t"
1873                 fi
1874         done
1875         echo "lang.$t: $x" >> Make-hooks
1876 done
1878 # If we're not building in srcdir, create .gdbinit.
1880 if test ! -f Makefile.in; then
1881         echo "dir ." > .gdbinit
1882         echo "dir ${srcdir}" >> .gdbinit
1883         if test x$gdb_needs_out_file_path = xyes
1884         then
1885                 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
1886         fi
1887         if test "x$subdirs" != x; then
1888                 for s in $subdirs
1889                 do
1890                         echo "dir ${srcdir}/$s" >> .gdbinit
1891                 done
1892         fi
1893         echo "source ${srcdir}/.gdbinit" >> .gdbinit
1896 # Define variables host_canonical and build_canonical
1897 # because some Cygnus local changes in the Makefile depend on them.
1898 build_canonical=${build}
1899 host_canonical=${host}
1900 target_subdir=
1901 if test "${host}" != "${target}" ; then
1902     target_subdir=${target_alias}/
1904 AC_SUBST(build_canonical)
1905 AC_SUBST(host_canonical)
1906 AC_SUBST(target_subdir)
1907         
1908 # If $(exec_prefix) exists and is not the same as $(prefix), then compute an
1909 # absolute path for gcc_tooldir based on inserting the number of up-directory
1910 # movements required to get from $(exec_prefix) to $(prefix) into the basic
1911 # $(libsubdir)/@(unlibsubdir) based path.
1912 # Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
1913 # make and thus we'd get different behavior depending on where we built the
1914 # sources.
1915 if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
1916     gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
1917 else
1918 changequote(<<, >>)dnl
1919 # An explanation of the sed strings:
1920 #  -e 's|^\$(prefix)||'   matches and eliminates 'prefix' from 'exec_prefix'
1921 #  -e 's|/$||'            match a trailing forward slash and eliminates it
1922 #  -e 's|^[^/]|/|'        forces the string to start with a forward slash (*)
1923 #  -e 's|/[^/]*|../|g'    replaces each occurance of /<directory> with ../
1925 # (*) Note this pattern overwrites the first character of the string
1926 # with a forward slash if one is not already present.  This is not a
1927 # problem because the exact names of the sub-directories concerned is
1928 # unimportant, just the number of them matters.
1930 # The practical upshot of these patterns is like this:
1932 #  prefix     exec_prefix        result
1933 #  ------     -----------        ------
1934 #   /foo        /foo/bar          ../
1935 #   /foo/       /foo/bar          ../
1936 #   /foo        /foo/bar/         ../
1937 #   /foo/       /foo/bar/         ../
1938 #   /foo        /foo/bar/ugg      ../../
1940     dollar='$$'
1941     gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)"
1942 changequote([, ])dnl
1944 AC_SUBST(gcc_tooldir)
1945 AC_SUBST(dollar)
1947 # Find a directory in which to install a shared libgcc.
1949 AC_ARG_ENABLE(version-specific-runtime-libs,
1950 [  --enable-version-specific-runtime-libs
1951                           specify that runtime libraries should be
1952                           installed in a compiler-specific directory])
1954 AC_ARG_WITH(slibdir,
1955 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
1956 slibdir="$with_slibdir",
1957 if test "${enable_version_specific_runtime_libs+set}" = set; then
1958   slibdir='$(libsubdir)'
1959 elif test "$host" != "$target"; then
1960   slibdir='$(build_tooldir)/lib'
1961 else
1962   slibdir='$(libdir)'
1964 AC_SUBST(slibdir)
1966 # Nothing to do for FLOAT_H, float_format already handled.
1967 objdir=`pwd`
1968 AC_SUBST(objdir)
1970 # Process the language and host/target makefile fragments.
1971 ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file"
1973 # Substitute configuration variables
1974 AC_SUBST(subdirs)
1975 AC_SUBST(all_boot_languages)
1976 AC_SUBST(all_compilers)
1977 AC_SUBST(all_diff_excludes)
1978 AC_SUBST(all_headers)
1979 AC_SUBST(all_lang_makefiles)
1980 AC_SUBST(all_languages)
1981 AC_SUBST(all_lib2funcs)
1982 AC_SUBST(all_stagestuff)
1983 AC_SUBST(build_exeext)
1984 AC_SUBST(build_install_headers_dir)
1985 AC_SUBST(build_xm_file_list)
1986 AC_SUBST(build_xm_file)
1987 AC_SUBST(build_xm_defines)
1988 AC_SUBST(cc_set_by_configure)
1989 AC_SUBST(quoted_cc_set_by_configure)
1990 AC_SUBST(cpp_install_dir)
1991 AC_SUBST(dep_host_xmake_file)
1992 AC_SUBST(dep_tmake_file)
1993 AC_SUBST(extra_c_flags)
1994 AC_SUBST(extra_headers_list)
1995 AC_SUBST(extra_objs)
1996 AC_SUBST(extra_parts)
1997 AC_SUBST(extra_passes)
1998 AC_SUBST(extra_programs)
1999 AC_SUBST(float_h_file)
2000 AC_SUBST(gcc_config_arguments)
2001 AC_SUBST(gcc_gxx_include_dir)
2002 AC_SUBST(libstdcxx_incdir)
2003 AC_SUBST(gcc_version)
2004 AC_SUBST(gcc_version_full)
2005 AC_SUBST(gcc_version_trigger)
2006 AC_SUBST(host_exeext)
2007 AC_SUBST(host_extra_gcc_objs)
2008 AC_SUBST(host_xm_file_list)
2009 AC_SUBST(host_xm_file)
2010 AC_SUBST(host_xm_defines)
2011 AC_SUBST(install)
2012 AC_SUBST(lang_options_files)
2013 AC_SUBST(lang_specs_files)
2014 AC_SUBST(lang_tree_files)
2015 AC_SUBST(local_prefix)
2016 AC_SUBST(maybe_use_collect2)
2017 AC_SUBST(md_file)
2018 AC_SUBST(objc_boehm_gc)
2019 AC_SUBST(out_file)
2020 AC_SUBST(out_object_file)
2021 AC_SUBST(stage_prefix_set_by_configure)
2022 AC_SUBST(symbolic_link)
2023 AC_SUBST(thread_file)
2024 AC_SUBST(tm_file_list)
2025 AC_SUBST(tm_file)
2026 AC_SUBST(tm_p_file_list)
2027 AC_SUBST(tm_p_file)
2028 AC_SUBST(xm_file)
2029 AC_SUBST(will_use_collect2)
2030 AC_SUBST(c_target_objs)
2031 AC_SUBST(cxx_target_objs)
2032 AC_SUBST(target_cpu_default)
2034 AC_SUBST_FILE(target_overrides)
2035 AC_SUBST_FILE(host_overrides)
2036 AC_SUBST(cross_defines)
2037 AC_SUBST_FILE(cross_overrides)
2038 AC_SUBST_FILE(build_overrides)
2039 AC_SUBST_FILE(language_fragments)
2040 AC_SUBST_FILE(language_hooks)
2042 # Echo that links are built
2043 if test x$host = x$target
2044 then
2045         str1="native "
2046 else
2047         str1="cross-"
2048         str2=" from $host"
2051 if test x$host != x$build
2052 then
2053         str3=" on a $build system"
2056 if test "x$str2" != x || test "x$str3" != x
2057 then
2058         str4=
2061 echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2
2063 if test "x$str2" != x || test "x$str3" != x
2064 then
2065         echo " ${str2}${str3}." 1>&2
2068 # Truncate the target if necessary
2069 if test x$host_truncate_target != x; then
2070         target=`echo $target | sed -e 's/\(..............\).*/\1/'`
2073 # Configure the subdirectories
2074 # AC_CONFIG_SUBDIRS($subdirs)
2076 # Create the Makefile
2077 # and configure language subdirectories
2078 AC_OUTPUT($all_outputs,
2080 case x$CONFIG_HEADERS in
2081 xauto-host.h:config.in)
2082 echo > cstamp-h ;;
2083 esac
2084 # If the host supports symlinks, point stage[1234] at ../stage[1234] so
2085 # bootstrapping and the installation procedure can still use
2086 # CC="stage1/xgcc -Bstage1/".  If the host doesn't support symlinks,
2087 # FLAGS_TO_PASS has been modified to solve the problem there.
2088 # This is virtually a duplicate of what happens in configure.lang; we do
2089 # an extra check to make sure this only happens if ln -s can be used.
2090 if test "$symbolic_link" = "ln -s"; then
2091  for d in .. ${subdirs} ; do
2092    if test $d != ..; then
2093         STARTDIR=`pwd`
2094         cd $d
2095         for t in stage1 stage2 stage3 stage4 include
2096         do
2097                 rm -f $t
2098                 $symbolic_link ../$t $t 2>/dev/null
2099         done
2100         cd $STARTDIR
2101    fi
2102  done
2103 else true ; fi
2104 # Avoid having to add intl to our include paths.
2105 if test -f intl/libintl.h; then
2106   echo creating libintl.h
2107   echo '#include "intl/libintl.h"' >libintl.h
2111 host='${host}'
2112 build='${build}'
2113 target='${target}'
2114 target_alias='${target_alias}'
2115 srcdir='${srcdir}'
2116 subdirs='${subdirs}'
2117 symbolic_link='${symbolic_link}'
2118 program_transform_set='${program_transform_set}'
2119 program_transform_name='${program_transform_name}'
2120 dep_host_xmake_file='${dep_host_xmake_file}'
2121 host_xmake_file='${host_xmake_file}'
2122 dep_tmake_file='${dep_tmake_file}'
2123 tmake_file='${tmake_file}'
2124 thread_file='${thread_file}'
2125 gcc_config_arguments='${gcc_config_arguments}'
2126 gcc_version='${gcc_version}'
2127 gcc_version_full='${gcc_version_full}'
2128 gcc_version_trigger='${gcc_version_trigger}'
2129 local_prefix='${local_prefix}'
2130 build_install_headers_dir='${build_install_headers_dir}'
2131 build_exeext='${build_exeext}'
2132 host_exeext='${host_exeext}'
2133 out_file='${out_file}'
2134 gdb_needs_out_file_path='${gdb_needs_out_file_path}'
2135 SET_MAKE='${SET_MAKE}'
2136 target_list='${target_list}'
2137 target_overrides='${target_overrides}'
2138 host_overrides='${host_overrides}'
2139 cross_defines='${cross_defines}'
2140 cross_overrides='${cross_overrides}'
2141 build_overrides='${build_overrides}'
2142 cpp_install_dir='${cpp_install_dir}'