GCCPY:
[official-gcc.git] / configure.ac
blobbea9b4794d5a6db38092a21f77afa44e56d111e2
1 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2 #   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 #   Free Software Foundation, Inc.
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3.  If not see
17 # <http://www.gnu.org/licenses/>.
19 ##############################################################################
20 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
22 m4_include(config/acx.m4)
23 m4_include(config/override.m4)
24 m4_include(config/proginstall.m4)
25 m4_include(config/elf.m4)
26 m4_include([libtool.m4])
27 m4_include([ltoptions.m4])
28 m4_include([ltsugar.m4])
29 m4_include([ltversion.m4])
30 m4_include([lt~obsolete.m4])
31 m4_include([config/isl.m4])
32 m4_include([config/cloog.m4])
34 AC_INIT(move-if-change)
35 AC_PREREQ(2.64)
36 AC_DISABLE_OPTION_CHECKING
38 progname=$0
39 # if PWD already has a value, it is probably wrong.
40 if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
42 # Export original configure arguments for use by sub-configures.
43 # Quote arguments with shell meta charatcers.
44 TOPLEVEL_CONFIGURE_ARGUMENTS=
45 set -- "$progname" "$@"
46 for ac_arg
48   case "$ac_arg" in
49   *" "*|*"      "*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
50     ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
51     # if the argument is of the form -foo=baz, quote the baz part only
52     ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
53   *) ;;
54   esac
55   # Add the quoted argument to the list.
56   TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
57 done
58 if test "$silent" = yes; then
59   TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
61 # Remove the initial space we just introduced and, as these will be
62 # expanded by make, quote '$'.
63 TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
64 AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
66 # Find the build, host, and target systems.
67 ACX_NONCANONICAL_BUILD
68 ACX_NONCANONICAL_HOST
69 ACX_NONCANONICAL_TARGET
71 dnl Autoconf 2.5x and later will set a default program prefix if
72 dnl --target was used, even if it was the same as --host.  Disable
73 dnl that behavior.  This must be done before AC_CANONICAL_SYSTEM
74 dnl to take effect.
75 test "$host_noncanonical" = "$target_noncanonical" &&
76   test "$program_prefix$program_suffix$program_transform_name" = \
77     NONENONEs,x,x, &&
78   program_transform_name=s,y,y,
80 AC_CANONICAL_SYSTEM
81 AC_ARG_PROGRAM
83 m4_pattern_allow([^AS_FOR_TARGET$])dnl
84 m4_pattern_allow([^AS_FOR_BUILD$])dnl
86 # Get 'install' or 'install-sh' and its variants.
87 AC_PROG_INSTALL
88 ACX_PROG_LN
89 AC_PROG_LN_S
90 AC_PROG_SED
91 AC_PROG_AWK
93 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
95 # We pass INSTALL explicitly to sub-makes.  Make sure that it is not
96 # a relative path.
97 if test "$INSTALL" = "${srcdir}/install-sh -c"; then
98   INSTALL="${srcpwd}/install-sh -c"
101 # Set srcdir to "." if that's what it is.
102 # This is important for multilib support.
103 pwd=`${PWDCMD-pwd}`
104 if test "${pwd}" = "${srcpwd}" ; then
105   srcdir=.
108 topsrcdir=$srcpwd
110 extra_host_args=
112 ### To add a new directory to the tree, first choose whether it is a target
113 ### or a host dependent tool.  Then put it into the appropriate list
114 ### (library or tools, host or target), doing a dependency sort.
116 # Subdirs will be configured in the order listed in build_configdirs, 
117 # configdirs, or target_configdirs; see the serialization section below.
119 # Dependency sorting is only needed when *configuration* must be done in 
120 # a particular order.  In all cases a dependency should be specified in 
121 # the Makefile, whether or not it's implicitly specified here.
123 # Double entries in build_configdirs, configdirs, or target_configdirs may
124 # cause circular dependencies and break everything horribly.
126 # these library is used by various programs built for the build
127 # environment
129 build_libs="build-libiberty"
131 # these tools are built for the build environment
132 build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
134 # these libraries are used by various programs built for the host environment
136 host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl cloog libelf libiconv"
138 # these tools are built for the host environment
139 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
140 # know that we are building the simulator.
141 # binutils, gas and ld appear in that order because it makes sense to run
142 # "make check" in that particular order.
143 # If --enable-gold is used, "gold" may replace "ld".
144 host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools"
146 # libgcj represents the runtime libraries only used by gcj.
147 libgcj="target-libffi \
148         target-zlib \
149         target-libjava"
151 # these libraries are built for the target environment, and are built after
152 # the host libraries and the host tools (which may be a cross compiler)
153 # Note that libiberty is not a target library.
154 target_libraries="target-libgcc \
155                 target-libbacktrace \
156                 target-libgloss \
157                 target-newlib \
158                 target-libgomp \
159                 target-libatomic \
160                 target-libitm \
161                 target-libstdc++-v3 \
162                 target-libmudflap \
163                 target-libsanitizer \
164                 target-libssp \
165                 target-libquadmath \
166                 target-libgfortran \
167                 target-boehm-gc \
168                 ${libgcj} \
169                 target-libobjc \
170                 target-libada \
171                 target-libgo \
172                 target-libgpython"
174 # these tools are built using the target libraries, and are intended to
175 # run only in the target environment
177 # note: any program that *uses* libraries that are in the "target_libraries"
178 # list belongs in this list.
180 target_tools="target-rda"
182 ################################################################################
184 ## All tools belong in one of the four categories, and are assigned above
185 ## We assign ${configdirs} this way to remove all embedded newlines.  This
186 ## is important because configure will choke if they ever get through.
187 ## ${configdirs} is directories we build using the host tools.
188 ## ${target_configdirs} is directories we build using the target tools.
189 configdirs=`echo ${host_libs} ${host_tools}`
190 target_configdirs=`echo ${target_libraries} ${target_tools}`
191 build_configdirs=`echo ${build_libs} ${build_tools}`
193 m4_divert_text([PARSE_ARGS],
194 [case $srcdir in
195   *" "*)
196 m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
197     AC_MSG_ERROR([path to source, $srcdir, contains spaces])
198 m4_popdef([AS_MESSAGE_LOG_FD])dnl
199     ;;
200 esac
201 ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
204 ################################################################################
206 srcname="gnu development package"
208 # This gets set non-empty for some net releases of packages.
209 appdirs=""
211 # Define is_cross_compiler to save on calls to 'test'.
212 is_cross_compiler=
213 if test x"${host}" = x"${target}" ; then
214   is_cross_compiler=no
215 else
216   is_cross_compiler=yes
217 fi      
219 # Find the build and target subdir names.
220 GCC_TOPLEV_SUBDIRS
221 # Be sure to cover against remnants of an in-tree build.
222 if test $srcdir != .  && test -d $srcdir/host-${host_noncanonical}; then
223   AC_MSG_ERROR([building out of tree but $srcdir contains host-${host_noncanonical}.
224 Use a pristine source tree when building in a separate tree])
227 # Skipdirs are removed silently.
228 skipdirs=
229 # Noconfigdirs are removed loudly.
230 noconfigdirs=""
232 use_gnu_ld=
233 # Make sure we don't let GNU ld be added if we didn't want it.
234 if test x$with_gnu_ld = xno ; then
235   use_gnu_ld=no
236   noconfigdirs="$noconfigdirs ld gold"
239 use_gnu_as=
240 # Make sure we don't let GNU as be added if we didn't want it.
241 if test x$with_gnu_as = xno ; then
242   use_gnu_as=no
243   noconfigdirs="$noconfigdirs gas"
246 use_included_zlib=
247 # Make sure we don't let ZLIB be added if we didn't want it.
248 if test x$with_system_zlib = xyes ; then
249   use_included_zlib=no
250   noconfigdirs="$noconfigdirs zlib"
253 # some tools are so dependent upon X11 that if we're not building with X, 
254 # it's not even worth trying to configure, much less build, that tool.
256 case ${with_x} in
257   yes | "") ;; # the default value for this tree is that X11 is available
258   no)
259     skipdirs="${skipdirs} tk itcl libgui"
260     # We won't be able to build gdbtk without X.
261     enable_gdbtk=no 
262     ;;
263   *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
264 esac
266 # Some are only suitable for cross toolchains.
267 # Remove these if host=target.
268 cross_only="target-libgloss target-newlib target-opcodes"
270 case $is_cross_compiler in
271   no) skipdirs="${skipdirs} ${cross_only}" ;;
272 esac
274 # If both --with-headers and --with-libs are specified, default to
275 # --without-newlib.
276 if test x"${with_headers}" != x && test x"${with_headers}" != xno \
277    && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
278   if test x"${with_newlib}" = x ; then
279     with_newlib=no
280   fi
283 # Recognize --with-newlib/--without-newlib.
284 case ${with_newlib} in
285   no) skipdirs="${skipdirs} target-newlib" ;;
286   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
287 esac
289 # Handle --enable-gold, --enable-ld.
290 # --disable-gold [--enable-ld]
291 #     Build only ld.  Default option.
292 # --enable-gold [--enable-ld]
293 #     Build both gold and ld.  Install gold as "ld.gold", install ld
294 #     as "ld.bfd" and "ld".
295 # --enable-gold=default [--enable-ld]
296 #     Build both gold and ld.  Install gold as "ld.gold" and "ld",
297 #     install ld as "ld.bfd".
298 # --enable-gold[=default] --disable-ld
299 #     Build only gold, which is then installed as both "ld.gold" and "ld".
300 # --enable-gold --enable-ld=default
301 #     Build both gold (installed as "ld.gold") and ld (installed as "ld"
302 #     and ld.bfd).
303 #     In other words, ld is default
304 # --enable-gold=default --enable-ld=default
305 #     Error.
307 default_ld=
308 AC_ARG_ENABLE(gold,
309 [AS_HELP_STRING([[--enable-gold[=ARG]]],
310                 [build gold @<:@ARG={default,yes,no}@:>@])],
311 ENABLE_GOLD=$enableval,
312 ENABLE_GOLD=no)
313 case "${ENABLE_GOLD}" in
314   yes|default)
315     # Check for ELF target.
316     is_elf=no
317     case "${target}" in
318       *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
319       | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
320       | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
321       | *-*-solaris2* | *-*-nto* | *-*-nacl*)
322         case "${target}" in
323           *-*-linux*aout* | *-*-linux*oldld*)
324             ;;
325           *)
326             is_elf=yes
327             ;;
328         esac
329     esac
331     if test "$is_elf" = "yes"; then
332       # Check for target supported by gold.
333       case "${target}" in
334         i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* | tilegx*-*-*)
335           configdirs="$configdirs gold"
336           if test x${ENABLE_GOLD} = xdefault; then
337             default_ld=gold
338           fi
339           ENABLE_GOLD=yes
340           ;;
341       esac
342     fi
343     ;;
344   no)
345     ;;
346   *)
347     AC_MSG_ERROR([invalid --enable-gold argument])
348     ;;
349 esac
351 AC_ARG_ENABLE(ld,
352 [AS_HELP_STRING([[--enable-ld[=ARG]]],
353                 [build ld @<:@ARG={default,yes,no}@:>@])],
354 ENABLE_LD=$enableval,
355 ENABLE_LD=yes)
357 case "${ENABLE_LD}" in
358   default)
359     if test x${default_ld} != x; then
360       AC_MSG_ERROR([either gold or ld can be the default ld])
361     fi
362     ;;
363   yes)
364     ;;
365   no)
366     if test x${ENABLE_GOLD} != xyes; then
367       AC_MSG_WARN([neither ld nor gold are enabled])
368     fi
369     configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
370     ;;
371   *)
372     AC_MSG_ERROR([invalid --enable-ld argument])
373     ;;
374 esac
376 # Configure extra directories which are host specific
378 case "${host}" in
379   *-cygwin*)
380     configdirs="$configdirs libtermcap" ;;
381 esac
383 # A target can indicate whether a language isn't supported for some reason.
384 # Only spaces may be used in this macro; not newlines or tabs.
385 unsupported_languages=
387 # Remove more programs from consideration, based on the host or 
388 # target this usually means that a port of the program doesn't
389 # exist yet.
391 case "${host}" in
392   i[[3456789]]86-*-msdosdjgpp*)
393     noconfigdirs="$noconfigdirs tcl tk itcl"
394     ;;
395 esac
398 AC_ARG_ENABLE(libquadmath,
399 AS_HELP_STRING([--disable-libquadmath],
400   [do not build libquadmath directory]),
401 ENABLE_LIBQUADMATH=$enableval,
402 ENABLE_LIBQUADMATH=yes)
403 if test "${ENABLE_LIBQUADMATH}" = "no" ; then
404   noconfigdirs="$noconfigdirs target-libquadmath"
408 AC_ARG_ENABLE(libquadmath-support,
409 AS_HELP_STRING([--disable-libquadmath-support],
410   [disable libquadmath support for Fortran]),
411 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
412 ENABLE_LIBQUADMATH_SUPPORT=yes)
413 enable_libquadmath_support=
414 if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
415   enable_libquadmath_support=no
419 AC_ARG_ENABLE(libada,
420 [AS_HELP_STRING([--enable-libada], [build libada directory])],
421 ENABLE_LIBADA=$enableval,
422 ENABLE_LIBADA=yes)
423 if test "${ENABLE_LIBADA}" != "yes" ; then
424   noconfigdirs="$noconfigdirs gnattools"
427 AC_ARG_ENABLE(libssp,
428 [AS_HELP_STRING([--enable-libssp], [build libssp directory])],
429 ENABLE_LIBSSP=$enableval,
430 ENABLE_LIBSSP=yes)
432 AC_ARG_ENABLE(libstdcxx,
433 AS_HELP_STRING([--disable-libstdcxx],
434   [do not build libstdc++-v3 directory]),
435 ENABLE_LIBSTDCXX=$enableval,
436 ENABLE_LIBSTDCXX=default)
437 [if test "${ENABLE_LIBSTDCXX}" = "no" ; then
438   noconfigdirs="$noconfigdirs libstdc++-v3"
441 # Save it here so that, even in case of --enable-libgcj, if the Java
442 # front-end isn't enabled, we still get libgcj disabled.
443 libgcj_saved=$libgcj
444 case $enable_libgcj in
445 yes)
446   # If we reset it here, it won't get added to noconfigdirs in the
447   # target-specific build rules, so it will be forcibly enabled
448   # (unless the Java language itself isn't enabled).
449   libgcj=
450   ;;
452   # Make sure we get it printed in the list of not supported target libs.
453   # Don't disable libffi, though, other languages use it.
454   noconfigdirs="$noconfigdirs `echo ${libgcj} | sed -e 's/target-libffi//'`"
455   # Clear libgcj_saved so that even if java is enabled libffi won't be
456   # built.
457   libgcj_saved=
458   ;;
459 esac
461 AC_ARG_ENABLE(static-libjava,
462 [AS_HELP_STRING([[--enable-static-libjava[=ARG]]],
463                 [build static libjava @<:@default=no@:>@])],
464 ENABLE_STATIC_LIBJAVA=$enableval,
465 ENABLE_STATIC_LIBJAVA=no)
466 enable_static_libjava=
467 if test "${ENABLE_STATIC_LIBJAVA}" = "yes" ; then
468   enable_static_libjava=yes
471 if test x$enable_static_libjava != xyes ; then
472   EXTRA_CONFIGARGS_LIBJAVA=--disable-static
474 AC_SUBST(EXTRA_CONFIGARGS_LIBJAVA)
476 # Disable libmudflap on some systems.
477 if test x$enable_libmudflap = x ; then
478     case "${target}" in
479     *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | bfin*-*-uclinux* | *-*-kopensolaris*-gnu)
480         # Enable libmudflap by default in GNU and friends.
481         ;;
482     *-*-freebsd*)
483         # Enable libmudflap by default in FreeBSD.
484         ;;
485     *)
486         # Disable it by default everywhere else.
487         noconfigdirs="$noconfigdirs target-libmudflap"
488         ;;
489     esac
492 # Disable libgomp on non POSIX hosted systems.
493 if test x$enable_libgomp = x ; then
494     # Enable libgomp by default on hosted POSIX systems.
495     case "${target}" in
496     *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
497         ;;
498     *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
499         ;;
500     *-*-solaris2* | *-*-hpux11*)
501         ;;
502     *-*-darwin* | *-*-aix*)
503         ;;
504     *)
505         noconfigdirs="$noconfigdirs target-libgomp"
506         ;;
507     esac
510 # Disable libatomic on unsupported systems.
511 if test -d ${srcdir}/libatomic; then
512     if test x$enable_libatomic = x; then
513         AC_MSG_CHECKING([for libatomic support])
514         if (srcdir=${srcdir}/libatomic; \
515                 . ${srcdir}/configure.tgt; \
516                 test -n "$UNSUPPORTED")
517         then
518             AC_MSG_RESULT([no])
519             noconfigdirs="$noconfigdirs target-libatomic"
520         else
521             AC_MSG_RESULT([yes])
522         fi
523     fi
526 # Disable libitm on unsupported systems.
527 if test -d ${srcdir}/libitm; then
528     if test x$enable_libitm = x; then
529         AC_MSG_CHECKING([for libitm support])
530         if (srcdir=${srcdir}/libitm; \
531                 . ${srcdir}/configure.tgt; \
532                 test -n "$UNSUPPORTED")
533         then
534             AC_MSG_RESULT([no])
535             noconfigdirs="$noconfigdirs target-libitm"
536         else
537             AC_MSG_RESULT([yes])
538         fi
539     fi
542 # Disable libsanitizer on unsupported systems.
543 if test -d ${srcdir}/libsanitizer; then
544     if test x$enable_libsanitizer = x; then
545         AC_MSG_CHECKING([for libsanitizer support])
546         if (srcdir=${srcdir}/libsanitizer; \
547                 . ${srcdir}/configure.tgt; \
548                 test -n "$UNSUPPORTED")
549         then
550             AC_MSG_RESULT([no])
551             noconfigdirs="$noconfigdirs target-libsanitizer"
552         else
553             AC_MSG_RESULT([yes])
554         fi
555     fi
558 # Disable libquadmath for some systems.
559 case "${target}" in
560   avr-*-*)
561     noconfigdirs="$noconfigdirs target-libquadmath"
562     ;;
563   # libquadmath is unused on AIX and libquadmath build process use of
564   # LD_LIBRARY_PATH can break AIX bootstrap.
565   powerpc-*-aix* | rs6000-*-aix*)
566     noconfigdirs="$noconfigdirs target-libquadmath"
567     ;;
568 esac
570 # Disable libssp for some systems.
571 case "${target}" in
572   avr-*-*)
573     # No hosted I/O support.
574     noconfigdirs="$noconfigdirs target-libssp"
575     ;;
576   powerpc-*-aix* | rs6000-*-aix*)
577     noconfigdirs="$noconfigdirs target-libssp"
578     ;;
579   rl78-*-*)
580     # libssp uses a misaligned load to trigger a fault, but the RL78
581     # doesn't fault for those - instead, it gives a build-time error
582     # for explicit misaligned loads.
583     noconfigdirs="$noconfigdirs target-libssp"
584     ;;
585 esac
587 # Disable libstdc++-v3 for some systems.
588 # Allow user to override this if they pass --enable-libstdc++-v3
589 if test "${ENABLE_LIBSTDCXX}" = "default" ; then
590   case "${target}" in
591     *-*-vxworks*)
592       # VxWorks uses the Dinkumware C++ library.
593       noconfigdirs="$noconfigdirs target-libstdc++-v3"
594       ;;
595     arm*-wince-pe*)
596       # the C++ libraries don't build on top of CE's C libraries
597       noconfigdirs="$noconfigdirs target-libstdc++-v3"
598       ;;
599     avr-*-*)
600       noconfigdirs="$noconfigdirs target-libstdc++-v3"
601       ;;
602   esac
605 # Disable Fortran for some systems.
606 case "${target}" in
607   mmix-*-*)
608     # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
609     unsupported_languages="$unsupported_languages fortran"
610     ;;
611 esac
613 # Disable Java if libffi is not supported.
614 case "${target}" in
615   alpha*-*-*)
616     ;;
617   arm*-*-*)
618     ;;
619   cris-*-*)
620     ;;
621   frv-*-*)
622     ;;
623   hppa*-*-linux*)
624     ;;
625   hppa*-*-hpux*)
626     ;;
627   i?86-*-*)
628     ;;
629   ia64*-*-*)
630     ;;
631   m32r*-*-*)
632     ;;
633   m68k-*-*)
634     ;;
635   mips*-*-rtems*)
636     ;;
637   mips*-*-linux*)
638     ;;
639   powerpc*-*-linux*)
640     ;;
641   powerpc-*-darwin*)
642     ;;
643   powerpc-*-aix* | rs6000-*-aix*)
644     ;;
645   powerpc-*-freebsd*)
646     ;;
647   powerpc64-*-freebsd*)
648     ;;
649   powerpc*-*-rtems*)
650     ;;
651   s390-*-* | s390x-*-*)
652     ;;
653   sh-*-* | sh[[34]]*-*-*)
654     ;;
655   sh64-*-* | sh5*-*-*)
656     ;;
657   sparc*-*-*)
658     ;;
659   x86_64-*-*)
660     ;;
661   *-*-*)
662     unsupported_languages="$unsupported_languages java"
663     ;;
664 esac
666 # Disable Java, libgcj or related libraries for some systems.
667 case "${target}" in
668   powerpc-*-darwin*)
669     ;;
670   i[[3456789]]86-*-darwin*)
671     ;;
672   x86_64-*-darwin[[912]]*)
673     ;;
674   *-*-darwin*)
675     noconfigdirs="$noconfigdirs ${libgcj}"
676     ;;
677   *-*-netware*)
678     noconfigdirs="$noconfigdirs ${libgcj}"
679     ;;
680   *-*-rtems*)
681     noconfigdirs="$noconfigdirs ${libgcj}"
682     ;;
683   *-*-tpf*)
684     noconfigdirs="$noconfigdirs ${libgcj}"
685     ;;
686   *-*-uclinux*)
687     noconfigdirs="$noconfigdirs ${libgcj}"
688     ;;
689   *-*-vxworks*)
690     noconfigdirs="$noconfigdirs ${libgcj}"
691     ;;
692   alpha*-*-*vms*)
693     noconfigdirs="$noconfigdirs ${libgcj}"
694     ;;
695   arm-wince-pe)
696     noconfigdirs="$noconfigdirs ${libgcj}"
697     ;;
698   arm*-*-symbianelf*)
699     noconfigdirs="$noconfigdirs ${libgcj}"
700     ;;
701   bfin-*-*)
702     noconfigdirs="$noconfigdirs target-boehm-gc"
703     ;;
704   cris-*-* | crisv32-*-*)
705     unsupported_languages="$unsupported_languages java"
706     case "${target}" in
707       *-*-linux*)
708         ;;
709       *) # See PR46792 regarding target-libffi.
710         noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";;
711     esac
712     ;;
713   hppa*64*-*-linux*)
714     # In this case, it's because the hppa64-linux target is for
715     # the kernel only at this point and has no libc, and thus no
716     # headers, crt*.o, etc., all of which are needed by these.
717     unsupported_languages="$unsupported_languages java"
718     ;;
719   hppa*64*-*-hpux*)
720     noconfigdirs="$noconfigdirs ${libgcj}"
721     ;;
722   hppa*-hp-hpux11*)
723     ;;
724   hppa*-*-hpux*)
725     # According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
726     # build on HP-UX 10.20.
727     noconfigdirs="$noconfigdirs ${libgcj}"
728     ;;
729   ia64*-*-*vms*)
730     noconfigdirs="$noconfigdirs ${libgcj}"
731     ;;
732   i[[3456789]]86-w64-mingw*)
733     noconfigdirs="$noconfigdirs ${libgcj}"
734     ;;
735   i[[3456789]]86-*-mingw*)
736     noconfigdirs="$noconfigdirs ${libgcj}"
737     ;;
738   x86_64-*-mingw*)
739     noconfigdirs="$noconfigdirs ${libgcj}"
740     ;;
741   mmix-*-*)
742     noconfigdirs="$noconfigdirs target-libffi target-boehm-gc"
743     ;;
744   powerpc-*-aix*)
745     # copied from rs6000-*-* entry
746     noconfigdirs="$noconfigdirs ${libgcj}"
747     ;;
748   rs6000-*-aix*)
749     noconfigdirs="$noconfigdirs ${libgcj}"
750     ;;
751   *-*-lynxos*)
752     noconfigdirs="$noconfigdirs ${libgcj}"
753     ;; 
754 esac
756 # Disable libgo for some systems where it is known to not work.
757 # For testing, you can easily override this with --enable-libgo.
758 if test x$enable_libgo = x; then
759     case "${target}" in
760     *-*-darwin*)
761         # PR 46986
762         noconfigdirs="$noconfigdirs target-libgo"
763         ;;
764     *-*-cygwin* | *-*-mingw*)
765         noconfigdirs="$noconfigdirs target-libgo"
766         ;;
767     *-*-aix*)
768         noconfigdirs="$noconfigdirs target-libgo"
769         ;;
770     esac
773 # Default libgloss CPU subdirectory.
774 libgloss_dir="$target_cpu"
776 case "${target}" in
777   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
778     libgloss_dir=wince
779     ;;
780   aarch64*-*-* )
781     libgloss_dir=aarch64
782     ;;
783   arm*-*-*)
784     libgloss_dir=arm
785     ;;
786   cris-*-* | crisv32-*-*)
787     libgloss_dir=cris
788     ;;
789   hppa*-*-*)
790     libgloss_dir=pa
791     ;;
792   i[[3456789]]86-*-*)
793     libgloss_dir=i386
794     ;;
795   m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
796     libgloss_dir=m68hc11
797     ;;
798   m68*-*-* | fido-*-*)
799     libgloss_dir=m68k
800     ;;
801   mips*-*-*)
802     libgloss_dir=mips
803     ;;
804   powerpc*-*-*)
805     libgloss_dir=rs6000
806     ;;
807   sparc*-*-*)
808     libgloss_dir=sparc
809     ;;
810 esac
812 # Disable newlib and libgloss for various target OSes.
813 case "${target}" in
814   alpha*-dec-osf*)
815     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
816     ;;
817   i[[3456789]]86-*-linux*)
818     # This section makes it possible to build newlib natively on linux.
819     # If we are using a cross compiler then don't configure newlib.
820     if test x${is_cross_compiler} != xno ; then
821       noconfigdirs="$noconfigdirs target-newlib"
822     fi
823     noconfigdirs="$noconfigdirs target-libgloss"
824     # If we are not using a cross compiler, do configure newlib.
825     # Note however, that newlib will only be configured in this situation
826     # if the --with-newlib option has been given, because otherwise
827     # 'target-newlib' will appear in skipdirs.
828     ;;
829   i[[3456789]]86-*-rdos*)
830     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
831     ;;
832   sh*-*-pe|mips*-*-pe|arm-wince-pe)
833     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
834     ;;
835   sparc-*-sunos4*)
836     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
837     ;;
838   *-*-aix*)
839     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
840     ;;
841   *-*-beos*)
842     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
843     ;;
844   *-*-chorusos)
845     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
846     ;;
847   *-*-dragonfly*)
848     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
849     ;;
850   *-*-freebsd*)
851     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
852     ;;
853   *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
854     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
855     ;;
856   *-*-lynxos*)
857     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
858     ;; 
859   *-*-mingw*)
860     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
861     ;;
862   *-*-netbsd*)
863     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
864     ;;
865   *-*-netware*)
866     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
867     ;;
868   *-*-tpf*)
869     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
870     ;;
871   *-*-uclinux*)
872     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
873     ;;
874   *-*-vxworks*)
875     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
876     ;;
877 esac
879 case "${target}" in
880   *-*-chorusos)
881     ;;
882   powerpc-*-darwin*)
883     noconfigdirs="$noconfigdirs ld gas gdb gprof"
884     noconfigdirs="$noconfigdirs sim target-rda"
885     ;;
886   i[[3456789]]86-*-darwin*)
887     noconfigdirs="$noconfigdirs ld gprof"
888     noconfigdirs="$noconfigdirs sim target-rda"
889     ;;
890   x86_64-*-darwin[[912]]*)
891     noconfigdirs="$noconfigdirs ld gas gprof"
892     noconfigdirs="$noconfigdirs sim target-rda"
893     ;;
894   *-*-darwin*)
895     noconfigdirs="$noconfigdirs ld gas gdb gprof"
896     noconfigdirs="$noconfigdirs sim target-rda"
897     ;;
898   *-*-dragonfly*)
899     ;;
900   *-*-freebsd*)
901     if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \
902         && test -f /usr/local/include/gmp.h; then
903       with_gmp=/usr/local
904     fi
905     ;;
906   *-*-kaos*)
907     # Remove unsupported stuff on all kaOS configurations.
908     noconfigdirs="$noconfigdirs target-libgloss"
909     ;;
910   *-*-netbsd*)
911     ;;
912   *-*-netware*)
913     ;;
914   *-*-rtems*)
915     noconfigdirs="$noconfigdirs target-libgloss"
916     ;;
917     # The tpf target doesn't support gdb yet.
918   *-*-tpf*)
919     noconfigdirs="$noconfigdirs gdb tcl tk libgui itcl"
920     ;;
921   *-*-uclinux*)
922     noconfigdirs="$noconfigdirs target-rda"
923     ;;
924   *-*-vxworks*)
925     ;;
926   alpha*-dec-osf*)
927     # ld works, but does not support shared libraries.
928     # gas doesn't generate exception information.
929     noconfigdirs="$noconfigdirs gas ld"
930     ;;
931   alpha*-*-*vms*)
932     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
933     ;;
934   alpha*-*-*)
935     # newlib is not 64 bit ready
936     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
937     ;;
938   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
939     noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
940     ;;
941   arc-*-*)
942     noconfigdirs="$noconfigdirs target-libgloss"
943     ;;
944   arm-*-pe*)
945     noconfigdirs="$noconfigdirs target-libgloss"
946     ;;
947   arm-*-riscix*)
948     noconfigdirs="$noconfigdirs ld target-libgloss"
949     ;;
950   avr-*-rtems*)
951     ;;
952   avr-*-*)
953     if test x${with_avrlibc} != xno; then
954       noconfigdirs="$noconfigdirs target-newlib target-libgloss"
955     fi
956     ;;
957   c4x-*-* | tic4x-*-*)
958     noconfigdirs="$noconfigdirs target-libgloss"
959     ;;
960   tic54x-*-*)
961     noconfigdirs="$noconfigdirs target-libgloss gdb"
962     ;;
963   d10v-*-*)
964     noconfigdirs="$noconfigdirs target-libgloss"
965     ;;
966   d30v-*-*)
967     noconfigdirs="$noconfigdirs gdb"
968     ;;
969   fr30-*-elf*)
970     noconfigdirs="$noconfigdirs gdb"
971     ;;
972   moxie-*-*)
973     noconfigdirs="$noconfigdirs gprof"
974     ;;
975   h8300*-*-*)
976     noconfigdirs="$noconfigdirs target-libgloss"
977     ;;
978   h8500-*-*)
979     noconfigdirs="$noconfigdirs target-libgloss"
980     ;;
981   hppa1.1-*-osf* | hppa1.1-*-bsd* )
982     ;;
983   hppa*64*-*-linux*)
984     ;;
985   hppa*-*-linux*)
986     ;;
987   hppa*-*-*elf* | \
988   hppa*-*-lites* | \
989   hppa*-*-openbsd* | \
990   hppa*64*-*-*)
991     ;;
992   hppa*-hp-hpux11*)
993     noconfigdirs="$noconfigdirs ld"
994     ;;
995   hppa*-*-pro*)
996     ;;
997   hppa*-*-*)
998     noconfigdirs="$noconfigdirs ld"
999     ;;
1000   i960-*-*)
1001     noconfigdirs="$noconfigdirs gdb"
1002     ;;
1003   ia64*-*-elf*)
1004     # No gdb support yet.
1005     noconfigdirs="$noconfigdirs readline libgui itcl gdb"
1006     ;;
1007   ia64*-**-hpux*)
1008     # No ld support yet.
1009     noconfigdirs="$noconfigdirs libgui itcl ld"
1010     ;;
1011   ia64*-*-*vms*)
1012     # No ld support yet.
1013     noconfigdirs="$noconfigdirs libgui itcl ld"
1014     ;;
1015   i[[3456789]]86-w64-mingw*)
1016     ;;
1017   i[[3456789]]86-*-mingw*)
1018     target_configdirs="$target_configdirs target-winsup"
1019     ;;
1020   *-*-cygwin*)
1021     target_configdirs="$target_configdirs target-libtermcap target-winsup"
1022     noconfigdirs="$noconfigdirs target-libgloss"
1023     # always build newlib if winsup directory is present.
1024     if test -d "$srcdir/winsup/cygwin"; then
1025       skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
1026     elif test -d "$srcdir/newlib"; then
1027       echo "Warning: winsup/cygwin is missing so newlib can't be built."
1028     fi
1029     ;;
1030   i[[3456789]]86-*-pe)
1031     noconfigdirs="$noconfigdirs target-libgloss"
1032     ;;
1033   i[[3456789]]86-*-sco3.2v5*)
1034     # The linker does not yet know about weak symbols in COFF,
1035     # and is not configured to handle mixed ELF and COFF.
1036     noconfigdirs="$noconfigdirs ld target-libgloss"
1037     ;;
1038   i[[3456789]]86-*-sco*)
1039     noconfigdirs="$noconfigdirs gprof target-libgloss"
1040     ;;
1041   i[[3456789]]86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
1042     noconfigdirs="$noconfigdirs target-libgloss"
1043     ;;
1044   i[[3456789]]86-*-sysv4*)
1045     noconfigdirs="$noconfigdirs target-libgloss"
1046     ;;
1047   i[[3456789]]86-*-beos*)
1048     noconfigdirs="$noconfigdirs gdb"
1049     ;;
1050   i[[3456789]]86-*-rdos*)
1051     noconfigdirs="$noconfigdirs gdb"
1052     ;;
1053   mmix-*-*)
1054     noconfigdirs="$noconfigdirs gdb"
1055     ;;
1056   mt-*-*)
1057     noconfigdirs="$noconfigdirs sim"
1058     ;;
1059   powerpc-*-aix*)
1060     # copied from rs6000-*-* entry
1061     noconfigdirs="$noconfigdirs gprof"
1062     ;;
1063   powerpc*-*-winnt* | powerpc*-*-pe*)
1064     target_configdirs="$target_configdirs target-winsup"
1065     noconfigdirs="$noconfigdirs gdb tcl tk target-libgloss itcl"
1066     # always build newlib.
1067     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
1068     ;;
1069     # This is temporary until we can link against shared libraries
1070   powerpcle-*-solaris*)
1071     noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
1072     ;;
1073   powerpc-*-beos*)
1074     noconfigdirs="$noconfigdirs gdb"
1075     ;;
1076   rs6000-*-lynxos*)
1077     noconfigdirs="$noconfigdirs gprof"
1078     ;;
1079   rs6000-*-aix*)
1080     noconfigdirs="$noconfigdirs gprof"
1081     ;;
1082   rs6000-*-*)
1083     noconfigdirs="$noconfigdirs gprof"
1084     ;;
1085   m68k-apollo-*)
1086     noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
1087     ;;
1088   microblaze*)
1089     noconfigdirs="$noconfigdirs gprof"
1090     ;;
1091   mips*-sde-elf* | mips*-mti-elf*)
1092     if test x$with_newlib = xyes; then
1093       noconfigdirs="$noconfigdirs gprof"
1094     fi
1095     ;;
1096   mips*-*-irix5*)
1097     noconfigdirs="$noconfigdirs gprof target-libgloss"
1098     ;;
1099   mips*-*-irix6*)
1100     noconfigdirs="$noconfigdirs gprof target-libgloss"
1101     ;;
1102   mips*-*-bsd*)
1103     noconfigdirs="$noconfigdirs gprof target-libgloss"
1104     ;;
1105   mips*-*-linux*)
1106     ;;
1107   mips*-*-*)
1108     noconfigdirs="$noconfigdirs gprof"
1109     ;;
1110   sh-*-* | sh64-*-*)
1111     case "${target}" in
1112       sh*-*-elf)
1113          ;;
1114       *)
1115          noconfigdirs="$noconfigdirs target-libgloss" ;;
1116     esac
1117     ;;
1118   sparc-*-sunos4*)
1119     if test x${is_cross_compiler} = xno ; then
1120            use_gnu_ld=no
1121     fi
1122     ;;
1123   tic6x-*-*)
1124     noconfigdirs="$noconfigdirs sim"
1125     ;;
1126   tilepro-*-* | tilegx-*-*)
1127     noconfigdirs="$noconfigdirs sim"
1128     ;;
1129   v810-*-*)
1130     noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss"
1131     ;;
1132   vax-*-*)
1133     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
1134     ;;
1135 esac
1137 # If we aren't building newlib, then don't build libgloss, since libgloss
1138 # depends upon some newlib header files.
1139 case "${noconfigdirs}" in
1140   *target-libgloss*) ;;
1141   *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
1142 esac
1144 # Work in distributions that contain no compiler tools, like Autoconf.
1145 host_makefile_frag=/dev/null
1146 if test -d ${srcdir}/config ; then
1147 case "${host}" in
1148   i[[3456789]]86-*-msdosdjgpp*)
1149     host_makefile_frag="config/mh-djgpp"
1150     ;;
1151   *-cygwin*)
1152     ACX_CHECK_CYGWIN_CAT_WORKS
1153     host_makefile_frag="config/mh-cygwin"
1154     ;;
1155   *-mingw*)
1156     host_makefile_frag="config/mh-mingw"
1157     ;;
1158   hppa*-hp-hpux10*)
1159     host_makefile_frag="config/mh-pa-hpux10"
1160     ;;
1161   hppa*-hp-hpux*)
1162     host_makefile_frag="config/mh-pa"
1163     ;;
1164   hppa*-*)      
1165     host_makefile_frag="config/mh-pa"
1166     ;;
1167   *-*-darwin*)
1168     host_makefile_frag="config/mh-darwin"
1169     ;;
1170   powerpc-*-aix*)
1171     host_makefile_frag="config/mh-ppc-aix"
1172     ;;
1173   rs6000-*-aix*)
1174     host_makefile_frag="config/mh-ppc-aix"
1175     ;;
1176 esac
1179 if test "${build}" != "${host}" ; then
1180   AR_FOR_BUILD=${AR_FOR_BUILD-ar}
1181   AS_FOR_BUILD=${AS_FOR_BUILD-as}
1182   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
1183   CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
1184   GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj}
1185   GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
1186   GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
1187   DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
1188   LD_FOR_BUILD=${LD_FOR_BUILD-ld}
1189   NM_FOR_BUILD=${NM_FOR_BUILD-nm}
1190   RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
1191   WINDRES_FOR_BUILD=${WINDRES_FOR_BUILD-windres}
1192   WINDMC_FOR_BUILD=${WINDMC_FOR_BUILD-windmc}
1193 else
1194   AR_FOR_BUILD="\$(AR)"
1195   AS_FOR_BUILD="\$(AS)"
1196   CC_FOR_BUILD="\$(CC)"
1197   CXX_FOR_BUILD="\$(CXX)"
1198   GCJ_FOR_BUILD="\$(GCJ)"
1199   GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
1200   GOC_FOR_BUILD="\$(GOC)"
1201   DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
1202   LD_FOR_BUILD="\$(LD)"
1203   NM_FOR_BUILD="\$(NM)"
1204   RANLIB_FOR_BUILD="\$(RANLIB)"
1205   WINDRES_FOR_BUILD="\$(WINDRES)"
1206   WINDMC_FOR_BUILD="\$(WINDMC)"
1209 AC_PROG_CC
1210 AC_PROG_CXX
1212 # We must set the default linker to the linker used by gcc for the correct
1213 # operation of libtool.  If LD is not defined and we are using gcc, try to
1214 # set the LD default to the ld used by gcc.
1215 if test -z "$LD"; then
1216   if test "$GCC" = yes; then
1217     case $build in
1218     *-*-mingw*)
1219       gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
1220     *)
1221       gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
1222     esac
1223     case $gcc_prog_ld in
1224     # Accept absolute paths.
1225     [[\\/]* | [A-Za-z]:[\\/]*)]
1226       LD="$gcc_prog_ld" ;;
1227     esac
1228   fi
1231 # Check whether -static-libstdc++ -static-libgcc is supported.
1232 have_static_libs=no
1233 if test "$GCC" = yes; then
1234   saved_LDFLAGS="$LDFLAGS"
1236   LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
1237   AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
1238   AC_LANG_PUSH(C++)
1239   AC_LINK_IFELSE([
1240 #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
1241 #error -static-libstdc++ not implemented
1242 #endif
1243 int main() {}],
1244     [AC_MSG_RESULT([yes]); have_static_libs=yes],
1245     [AC_MSG_RESULT([no])])
1246   AC_LANG_POP(C++)
1248   LDFLAGS="$saved_LDFLAGS"
1251 ACX_PROG_GNAT
1252 ACX_PROG_CMP_IGNORE_INITIAL
1254 AC_ARG_ENABLE([bootstrap],
1255 [AS_HELP_STRING([--enable-bootstrap],
1256                 [enable bootstrapping @<:@yes if native build@:>@])],,
1257 enable_bootstrap=default)
1259 # Issue errors and warnings for invalid/strange bootstrap combinations.
1260 if test -r $srcdir/gcc/configure; then
1261   have_compiler=yes
1262 else
1263   have_compiler=no
1266 case "$have_compiler:$host:$target:$enable_bootstrap" in
1267   *:*:*:no) ;;
1269   # Default behavior.  Enable bootstrap if we have a compiler
1270   # and we are in a native configuration.
1271   yes:$build:$build:default)
1272     enable_bootstrap=yes ;;
1274   *:*:*:default)
1275     enable_bootstrap=no ;;
1277   # We have a compiler and we are in a native configuration, bootstrap is ok
1278   yes:$build:$build:yes)
1279     ;;
1281   # Other configurations, but we have a compiler.  Assume the user knows
1282   # what he's doing.
1283   yes:*:*:yes)
1284     AC_MSG_WARN([trying to bootstrap a cross compiler])
1285     ;;
1287   # No compiler: if they passed --enable-bootstrap explicitly, fail
1288   no:*:*:yes)
1289     AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
1291   # Fail if wrong command line
1292   *)
1293     AC_MSG_ERROR([invalid option for --enable-bootstrap])
1294     ;;
1295 esac
1297 # Used for setting $lt_cv_objdir
1298 _LT_CHECK_OBJDIR
1300 # Check for GMP, MPFR and MPC
1301 gmplibs="-lmpc -lmpfr -lgmp"
1302 gmpinc=
1303 have_gmp=no
1305 # Specify a location for mpc
1306 # check for this first so it ends up on the link line before mpfr.
1307 AC_ARG_WITH(mpc,
1308 [AS_HELP_STRING([--with-mpc=PATH],
1309                 [specify prefix directory for installed MPC package.
1310                  Equivalent to --with-mpc-include=PATH/include
1311                  plus --with-mpc-lib=PATH/lib])])
1312 AC_ARG_WITH(mpc-include,
1313 [AS_HELP_STRING([--with-mpc-include=PATH],
1314                 [specify directory for installed MPC include files])])
1315 AC_ARG_WITH(mpc-lib,
1316 [AS_HELP_STRING([--with-mpc-lib=PATH],
1317                 [specify directory for the installed MPC library])])
1319 if test "x$with_mpc" != x; then
1320   gmplibs="-L$with_mpc/lib $gmplibs"
1321   gmpinc="-I$with_mpc/include $gmpinc"
1323 if test "x$with_mpc_include" != x; then
1324   gmpinc="-I$with_mpc_include $gmpinc"
1326 if test "x$with_mpc_lib" != x; then
1327   gmplibs="-L$with_mpc_lib $gmplibs"
1329 if test "x$with_mpc$with_mpc_include$with_mpc_lib" = x && test -d ${srcdir}/mpc; then
1330   gmplibs='-L$$r/$(HOST_SUBDIR)/mpc/src/'"$lt_cv_objdir $gmplibs"
1331   gmpinc='-I$$s/mpc/src '"$gmpinc"
1332   # Do not test the mpc version.  Assume that it is sufficient, since
1333   # it is in the source tree, and the library has not been built yet
1334   # but it would be included on the link line in the version check below
1335   # hence making the test fail.
1336   have_gmp=yes
1339 # Specify a location for mpfr
1340 # check for this first so it ends up on the link line before gmp.
1341 AC_ARG_WITH(mpfr-dir,
1342 [AS_HELP_STRING([--with-mpfr-dir=PATH], [this option has been REMOVED])],
1343 [AC_MSG_ERROR([The --with-mpfr-dir=PATH option has been removed.
1344 Use --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH])])
1346 AC_ARG_WITH(mpfr,
1347 [AS_HELP_STRING([--with-mpfr=PATH],
1348                 [specify prefix directory for installed MPFR package.
1349                  Equivalent to --with-mpfr-include=PATH/include
1350                  plus --with-mpfr-lib=PATH/lib])])
1351 AC_ARG_WITH(mpfr-include,
1352 [AS_HELP_STRING([--with-mpfr-include=PATH],
1353                 [specify directory for installed MPFR include files])])
1354 AC_ARG_WITH(mpfr-lib,
1355 [AS_HELP_STRING([--with-mpfr-lib=PATH],
1356                 [specify directory for the installed MPFR library])])
1358 if test "x$with_mpfr" != x; then
1359   gmplibs="-L$with_mpfr/lib $gmplibs"
1360   gmpinc="-I$with_mpfr/include $gmpinc"
1362 if test "x$with_mpfr_include" != x; then
1363   gmpinc="-I$with_mpfr_include $gmpinc"
1365 if test "x$with_mpfr_lib" != x; then
1366   gmplibs="-L$with_mpfr_lib $gmplibs"
1368 if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
1369   # MPFR v3.1.0 moved the sources into a src sub-directory.
1370   if test -d ${srcdir}/mpfr/src; then
1371     gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir $gmplibs"
1372     gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr/src -I$$s/mpfr/src '"$gmpinc"
1373     extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir"
1374   else
1375     gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/'"$lt_cv_objdir $gmplibs"
1376     gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr -I$$s/mpfr '"$gmpinc"
1377     extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/'"$lt_cv_objdir"
1378   fi
1379   # Do not test the mpfr version.  Assume that it is sufficient, since
1380   # it is in the source tree, and the library has not been built yet
1381   # but it would be included on the link line in the version check below
1382   # hence making the test fail.
1383   have_gmp=yes
1386 # Specify a location for gmp
1387 AC_ARG_WITH(gmp-dir,
1388 [AS_HELP_STRING([--with-gmp-dir=PATH], [this option has been REMOVED])],
1389 [AC_MSG_ERROR([The --with-gmp-dir=PATH option has been removed.
1390 Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH])])
1392 AC_ARG_WITH(gmp,
1393 [AS_HELP_STRING([--with-gmp=PATH],
1394                 [specify prefix directory for the installed GMP package.
1395                  Equivalent to --with-gmp-include=PATH/include
1396                  plus --with-gmp-lib=PATH/lib])])
1397 AC_ARG_WITH(gmp-include,
1398 [AS_HELP_STRING([--with-gmp-include=PATH],
1399                 [specify directory for installed GMP include files])])
1400 AC_ARG_WITH(gmp-lib,
1401 [AS_HELP_STRING([--with-gmp-lib=PATH],
1402                 [specify directory for the installed GMP library])])
1405 if test "x$with_gmp" != x; then
1406   gmplibs="-L$with_gmp/lib $gmplibs"
1407   gmpinc="-I$with_gmp/include $gmpinc"
1409 if test "x$with_gmp_include" != x; then
1410   gmpinc="-I$with_gmp_include $gmpinc"
1412 if test "x$with_gmp_lib" != x; then
1413   gmplibs="-L$with_gmp_lib $gmplibs"
1415 if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
1416   gmplibs='-L$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir $gmplibs"
1417   gmpinc='-I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp '"$gmpinc"
1418   extra_mpfr_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
1419   extra_mpc_gmp_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
1420   extra_isl_gmp_configure_flags='--with-gmp-builddir=$$r/$(HOST_SUBDIR)/gmp'
1421   # Do not test the gmp version.  Assume that it is sufficient, since
1422   # it is in the source tree, and the library has not been built yet
1423   # but it would be included on the link line in the version check below
1424   # hence making the test fail.
1425   have_gmp=yes
1428 if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
1429   have_gmp=yes
1430   saved_CFLAGS="$CFLAGS"
1431   CFLAGS="$CFLAGS $gmpinc"
1432   # Check for the recommended and required versions of GMP.
1433   AC_MSG_CHECKING([for the correct version of gmp.h])
1434   AC_TRY_COMPILE([#include "gmp.h"],[
1435   #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1436   #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
1437   #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
1438   choke me
1439   #endif
1440   ], [AC_TRY_COMPILE([#include <gmp.h>],[
1441   #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1442   #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
1443   #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
1444   choke me
1445   #endif
1446   ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
1447    [AC_MSG_RESULT([no]); have_gmp=no])
1449   # If we have GMP, check the MPFR version.
1450   if test x"$have_gmp" = xyes; then
1451     # Check for the recommended and required versions of MPFR.
1452     AC_MSG_CHECKING([for the correct version of mpfr.h])
1453     AC_TRY_COMPILE([#include <gmp.h>
1454     #include <mpfr.h>],[
1455     #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
1456     choke me
1457     #endif
1458     ], [AC_TRY_COMPILE([#include <gmp.h>
1459     #include <mpfr.h>],[
1460     #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2)
1461     choke me
1462     #endif
1463     ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
1464      [AC_MSG_RESULT([no]); have_gmp=no])
1465   fi
1467   # Check for the MPC header version.
1468   if test x"$have_gmp" = xyes ; then
1469     # Check for the recommended and required versions of MPC.
1470     AC_MSG_CHECKING([for the correct version of mpc.h])
1471     AC_TRY_COMPILE([#include <mpc.h>],[
1472     #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
1473     choke me
1474     #endif
1475     ], [AC_TRY_COMPILE([#include <mpc.h>],[
1476     #if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
1477     choke me
1478     #endif
1479     ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
1480      [AC_MSG_RESULT([no]); have_gmp=no])
1481   fi
1483   # Now check the MPFR library.
1484   if test x"$have_gmp" = xyes; then
1485     saved_LIBS="$LIBS"
1486     LIBS="$LIBS $gmplibs"
1487     AC_MSG_CHECKING([for the correct version of the gmp/mpfr/mpc libraries])
1488     AC_TRY_LINK([#include <mpc.h>],[
1489     mpfr_t n;
1490     mpfr_t x;
1491     mpc_t c;
1492     int t;
1493     mpfr_init (n);
1494     mpfr_init (x);
1495     mpfr_atan2 (n, n, x, GMP_RNDN);
1496     mpfr_erfc (n, x, GMP_RNDN);
1497     mpfr_subnormalize (x, t, GMP_RNDN);
1498     mpfr_clear(n);
1499     mpfr_clear(x);
1500     mpc_init2 (c, 53);
1501     mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
1502     mpc_cosh (c, c, MPC_RNDNN);
1503     mpc_pow (c, c, c, MPC_RNDNN);
1504     mpc_acosh (c, c, MPC_RNDNN);
1505     mpc_clear (c);
1506     ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
1507     LIBS="$saved_LIBS"
1508   fi
1510   CFLAGS="$saved_CFLAGS"
1512 # The library versions listed in the error message below should match
1513 # the HARD-minimums enforced above.
1514   if test x$have_gmp != xyes; then
1515     AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
1516 Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
1517 their locations.  Source code for these libraries can be found at
1518 their respective hosting sites as well as at
1519 ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
1520 http://gcc.gnu.org/install/prerequisites.html for additional info.  If
1521 you obtained GMP, MPFR and/or MPC from a vendor distribution package,
1522 make sure that you have installed both the libraries and the header
1523 files.  They may be located in separate packages.])
1524   fi
1527 # Flags needed for both GMP, MPFR and/or MPC.
1528 AC_SUBST(gmplibs)
1529 AC_SUBST(gmpinc)
1530 AC_SUBST(extra_mpfr_configure_flags)
1531 AC_SUBST(extra_mpc_gmp_configure_flags)
1532 AC_SUBST(extra_mpc_mpfr_configure_flags)
1533 AC_SUBST(extra_isl_gmp_configure_flags)
1535 # Allow host libstdc++ to be specified for static linking with PPL.
1536 AC_ARG_WITH(host-libstdcxx,
1537 [AS_HELP_STRING([--with-host-libstdcxx=L],
1538                 [use linker arguments L to link with libstdc++
1539                  when linking with PPL])])
1541 case $with_host_libstdcxx in
1542   no|yes)
1543     AC_MSG_ERROR([-with-host-libstdcxx needs an argument])
1544     ;;
1545 esac
1547 # Libraries to use for stage1 or when not bootstrapping.
1548 AC_ARG_WITH(stage1-libs,
1549 [AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
1550 [if test "$withval" = "no" -o "$withval" = "yes"; then
1551    stage1_libs=
1552  else
1553    stage1_libs=$withval
1554  fi],
1555 [stage1_libs=$with_host_libstdcxx])
1556 AC_SUBST(stage1_libs)
1558 # Linker flags to use for stage1 or when not bootstrapping.
1559 AC_ARG_WITH(stage1-ldflags,
1560 [AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
1561 [if test "$withval" = "no" -o "$withval" = "yes"; then
1562    stage1_ldflags=
1563  else
1564    stage1_ldflags=$withval
1565  fi],
1566 [stage1_ldflags=
1567  # In stage 1, default to linking libstdc++ and libgcc statically with GCC
1568  # if supported.  But if the user explicitly specified the libraries to use,
1569  # trust that they are doing what they want.
1570  if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
1571    stage1_ldflags="-static-libstdc++ -static-libgcc"
1572  fi])
1573 AC_SUBST(stage1_ldflags)
1575 # Libraries to use for stage2 and later builds.  This defaults to the
1576 # argument passed to --with-host-libstdcxx.
1577 AC_ARG_WITH(boot-libs,
1578 [AS_HELP_STRING([--with-boot-libs=LIBS], [libraries for stage2 and later])],
1579 [if test "$withval" = "no" -o "$withval" = "yes"; then
1580    poststage1_libs=
1581  else
1582    poststage1_libs=$withval
1583  fi],
1584 [poststage1_libs=$with_host_libstdcxx])
1585 AC_SUBST(poststage1_libs)
1587 # Linker flags to use for stage2 and later builds.
1588 AC_ARG_WITH(boot-ldflags,
1589 [AS_HELP_STRING([--with-boot-ldflags=FLAGS],
1590                 [linker flags for stage2 and later])],
1591 [if test "$withval" = "no" -o "$withval" = "yes"; then
1592    poststage1_ldflags=
1593  else
1594    poststage1_ldflags=$withval
1595  fi],
1596 [poststage1_ldflags=
1597  # In stages 2 and 3, default to linking libstdc++ and libgcc
1598  # statically.  But if the user explicitly specified the libraries to
1599  # use, trust that they are doing what they want.
1600  if test "$poststage1_libs" = ""; then
1601    poststage1_ldflags="-static-libstdc++ -static-libgcc"
1602  fi])
1603 AC_SUBST(poststage1_ldflags)
1605 # GCC GRAPHITE dependences, ISL and CLOOG which in turn requires ISL.
1606 # Basic setup is inlined here, actual checks are in config/cloog.m4 and
1607 # config/isl.m4
1609 AC_ARG_WITH(cloog,
1610   [AS_HELP_STRING(
1611     [--with-cloog=PATH],
1612     [Specify prefix directory for the installed CLooG-ISL package.
1613      Equivalent to --with-cloog-include=PATH/include
1614      plus --with-cloog-lib=PATH/lib])])
1615 AC_ARG_WITH(isl,
1616   [AS_HELP_STRING(
1617    [--with-isl=PATH],
1618    [Specify prefix directory for the installed ISL package.
1619     Equivalent to --with-isl-include=PATH/include
1620     plus --with-isl-lib=PATH/lib])])
1622 # Treat either --without-cloog or --without-isl as a request to disable
1623 # GRAPHITE support and skip all following checks.
1624 if test "x$with_isl" != "xno" &&
1625    test "x$with_cloog" != "xno"; then
1626   # Check for ISL
1627   dnl Provide configure switches and initialize islinc & isllibs
1628   dnl with user input.
1629   ISL_INIT_FLAGS
1630   dnl The versions of ISL that work for Graphite
1631   ISL_CHECK_VERSION(0,10)
1632   if test "${gcc_cv_isl}" = no ; then
1633     ISL_CHECK_VERSION(0,11)
1634   fi
1635   dnl Only execute fail-action, if ISL has been requested.
1636   ISL_IF_FAILED([
1637     AC_MSG_ERROR([Unable to find a usable ISL.  See config.log for details.])])
1639   if test "x$gcc_cv_isl" != "xno"; then
1640     # Check for CLOOG
1641     dnl Provide configure switches and initialize clooginc & clooglibs
1642     dnl with user input.
1643     CLOOG_INIT_FLAGS
1644     dnl The versions of CLooG that work for Graphite.
1645     CLOOG_CHECK_VERSION(0,17,0)
1646     if test "${gcc_cv_cloog}" = no ; then
1647       CLOOG_CHECK_VERSION(0,18,0)
1648     fi
1650     dnl Only execute fail-action, if CLooG has been requested.
1651     CLOOG_IF_FAILED([
1652       AC_MSG_ERROR([Unable to find a usable CLooG.  See config.log for details.])])
1653   fi
1656 # If either the ISL or the CLooG check failed, disable builds of in-tree
1657 # variants of both
1658 if test "x$with_isl" = xno ||
1659    test "x$with_cloog" = xno ||
1660    test "x$gcc_cv_cloog" = xno ||
1661    test "x$gcc_cv_isl" = xno; then
1662   noconfigdirs="$noconfigdirs cloog isl"
1663   islinc=
1664   clooginc=
1665   clooglibs=
1668 AC_SUBST(islinc)
1669 AC_SUBST(clooglibs)
1670 AC_SUBST(clooginc)
1673 # Check for LTO support.
1674 AC_ARG_ENABLE(lto,
1675 [AS_HELP_STRING([--enable-lto], [enable link time optimization support])],
1676 enable_lto=$enableval,
1677 enable_lto=yes; default_enable_lto=yes)
1679 ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
1680   build_lto_plugin=yes
1681 ],[if test x"$default_enable_lto" = x"yes" ; then
1682     case $target in
1683       *-apple-darwin9* | *-cygwin* | *-mingw*) ;;
1684       # On other non-ELF platforms, LTO has yet to be validated.
1685       *) enable_lto=no ;;
1686     esac
1687   else
1688   # Apart from ELF platforms, only Windows and Darwin support LTO so far.
1689   # It would also be nice to check the binutils support, but we don't
1690   # have gcc_GAS_CHECK_FEATURE available here.  For now, we'll just
1691   # warn during gcc/ subconfigure; unless you're bootstrapping with
1692   # -flto it won't be needed until after installation anyway.
1693     case $target in
1694       *-cygwin* | *-mingw* | *-apple-darwin*) ;;
1695       *) if test x"$enable_lto" = x"yes"; then
1696         AC_MSG_ERROR([LTO support is not enabled for this target.])
1697         fi
1698       ;;
1699     esac
1700   fi
1701   # Among non-ELF, only Windows platforms support the lto-plugin so far.
1702   # Build it unless LTO was explicitly disabled.
1703   case $target in
1704     *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
1705     *) ;;
1706   esac
1710 # By default, C and C++ are the only stage 1 languages.
1711 stage1_languages=,c,
1713 # Target libraries that we bootstrap.
1714 bootstrap_target_libs=,target-libgcc,
1716 # Figure out what language subdirectories are present.
1717 # Look if the user specified --enable-languages="..."; if not, use
1718 # the environment variable $LANGUAGES if defined. $LANGUAGES might
1719 # go away some day.
1720 # NB:  embedded tabs in this IF block -- do not untabify
1721 if test -d ${srcdir}/gcc; then
1722   if test x"${enable_languages+set}" != xset; then
1723     if test x"${LANGUAGES+set}" = xset; then
1724       enable_languages="${LANGUAGES}"
1725         echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
1726     else
1727       enable_languages=all
1728     fi
1729   else
1730     if test x"${enable_languages}" = x ||
1731        test x"${enable_languages}" = xyes;
1732        then
1733       echo configure.in: --enable-languages needs at least one language argument 1>&2
1734       exit 1
1735     fi
1736   fi
1737   enable_languages=`echo "${enable_languages}" | sed -e 's/[[   ,]][[   ,]]*/,/g' -e 's/,$//'`
1739   # 'f95' is the old name for the 'fortran' language. We issue a warning
1740   # and make the substitution.
1741   case ,${enable_languages}, in
1742     *,f95,*)
1743       echo configure.in: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
1744       enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
1745       ;;
1746   esac
1748   # If bootstrapping, C++ must be enabled.
1749   case ",$enable_languages,:$enable_bootstrap" in
1750     *,c++,*:*) ;;
1751     *:yes)
1752       if test -f ${srcdir}/gcc/cp/config-lang.in; then
1753         enable_languages="${enable_languages},c++"
1754       else
1755         AC_MSG_ERROR([bootstrapping requires c++ sources])
1756       fi
1757       ;;
1758   esac
1760   # First scan to see if an enabled language requires some other language.
1761   # We assume that a given config-lang.in will list all the language
1762   # front ends it requires, even if some are required indirectly.
1763   for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1764     case ${lang_frag} in
1765       ..) ;;
1766       # The odd quoting in the next line works around
1767       # an apparent bug in bash 1.12 on linux.
1768       ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1769       *)
1770         # From the config-lang.in, get $language, $lang_requires, and
1771         # $lang_requires_boot_languages.
1772         language=
1773         lang_requires=
1774         lang_requires_boot_languages=
1775         . ${lang_frag}
1776         for other in ${lang_requires} ${lang_requires_boot_languages}; do
1777           case ,${enable_languages}, in
1778             *,$other,*) ;;
1779             *,all,*) ;;
1780             *,$language,*)
1781               echo " \`$other' language required by \`$language'; enabling" 1>&2
1782               enable_languages="${enable_languages},${other}"
1783               ;;
1784           esac
1785         done
1786         for other in ${lang_requires_boot_languages} ; do
1787           if test "$other" != "c"; then
1788             case ,${enable_stage1_languages}, in
1789               *,$other,*) ;;
1790               *,all,*) ;;
1791               *)
1792                 case ,${enable_languages}, in
1793                   *,$language,*)
1794                     echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
1795                     enable_stage1_languages="$enable_stage1_languages,${other}"
1796                     ;;
1797                 esac
1798                 ;;
1799             esac
1800           fi
1801         done
1802         ;;
1803     esac
1804   done
1806   new_enable_languages=,c,
1808   # If LTO is enabled, add the LTO front end.
1809   extra_host_libiberty_configure_flags=
1810   if test "$enable_lto" = "yes" ; then
1811     case ,${enable_languages}, in
1812       *,lto,*) ;;
1813       *) enable_languages="${enable_languages},lto" ;;
1814     esac
1815     if test "${build_lto_plugin}" = "yes" ; then
1816       configdirs="$configdirs lto-plugin"
1817       extra_host_libiberty_configure_flags=--enable-shared
1818     fi
1819   fi
1820   AC_SUBST(extra_host_libiberty_configure_flags)
1822   missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ `
1823   potential_languages=,c,
1825   enabled_target_libs=
1826   disabled_target_libs=
1828   for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1829     case ${lang_frag} in
1830       ..) ;;
1831       # The odd quoting in the next line works around
1832       # an apparent bug in bash 1.12 on linux.
1833       ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1834       *)
1835         # From the config-lang.in, get $language, $target_libs, 
1836         # $lang_dirs, $boot_language, and $build_by_default
1837         language=
1838         target_libs=
1839         lang_dirs=
1840         subdir_requires=
1841         boot_language=no
1842         build_by_default=yes
1843         . ${lang_frag}
1844         if test x${language} = x; then
1845           echo "${lang_frag} doesn't set \$language." 1>&2
1846           exit 1
1847         fi
1849         if test "$language" = "c++"; then
1850           boot_language=yes
1851         fi
1853         add_this_lang=no
1854         case ,${enable_languages}, in
1855           *,${language},*)
1856             # Language was explicitly selected; include it
1857             # unless it is C, which is enabled by default.
1858             if test "$language" != "c"; then
1859               add_this_lang=yes
1860             fi
1861             ;;
1862           *,all,*)
1863             # 'all' was selected, select it if it is a default language
1864             if test "$language" != "c"; then
1865               add_this_lang=${build_by_default}
1866             fi
1867             ;;
1868         esac
1870         # Disable languages that need other directories if these aren't available.
1871         for i in $subdir_requires; do
1872           test -f "$srcdir/gcc/$i/config-lang.in" && continue
1873           case ,${enable_languages}, in
1874             *,${language},*)
1875               # Specifically requested language; tell them.
1876               AC_MSG_ERROR([The gcc/$i directory contains parts of $language but is missing])
1877               ;;
1878             *)
1879               # Silently disable.
1880               add_this_lang=unsupported
1881               ;;
1882           esac
1883         done
1885         # Disable Ada if no preexisting GNAT is available.
1886         case ,${enable_languages},:${language}:${have_gnat} in
1887           *,${language},*:ada:no)
1888             # Specifically requested language; tell them.
1889             AC_MSG_ERROR([GNAT is required to build $language])
1890             ;;
1891           *:ada:no)
1892             # Silently disable.
1893             add_this_lang=unsupported
1894             ;;
1895         esac
1897         # Disable a language that is unsupported by the target.
1898         case " $unsupported_languages " in
1899           *" $language "*)
1900             add_this_lang=unsupported
1901             ;;
1902         esac
1904         case $add_this_lang in
1905           unsupported)
1906             # Remove language-dependent dirs.
1907             disabled_target_libs="$disabled_target_libs $target_libs"
1908             noconfigdirs="$noconfigdirs $lang_dirs"
1909             ;;
1910           no)
1911             # Remove language-dependent dirs; still show language as supported.
1912             disabled_target_libs="$disabled_target_libs $target_libs"
1913             noconfigdirs="$noconfigdirs $lang_dirs"
1914             potential_languages="${potential_languages}${language},"
1915             ;;
1916           yes)
1917             new_enable_languages="${new_enable_languages}${language},"
1918             potential_languages="${potential_languages}${language},"
1919             missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
1920             enabled_target_libs="$enabled_target_libs $target_libs"
1921             case "${boot_language}:,$enable_stage1_languages," in
1922               yes:* | *:*,$language,* | *:*,yes, | *:*,all,)
1923                 # Add to (comma-separated) list of stage 1 languages.
1924                 case ",$stage1_languages," in
1925                   *,$language,* | ,yes, | ,all,) ;;
1926                   *) stage1_languages="${stage1_languages}${language}," ;;
1927                 esac
1928                 # We need to bootstrap any supporting libraries.
1929                 bootstrap_target_libs="${bootstrap_target_libs}${target_libs},"
1930                 ;;
1931             esac
1932             ;;
1933         esac
1934         ;;
1935     esac
1936   done
1938   # Add target libraries which are only needed for disabled languages
1939   # to noconfigdirs.
1940   if test -n "$disabled_target_libs"; then
1941     for dir in $disabled_target_libs; do
1942       case " $enabled_target_libs " in
1943       *" ${dir} "*) ;;
1944       *) noconfigdirs="$noconfigdirs $dir" ;;
1945       esac
1946     done
1947   fi
1949   AC_ARG_ENABLE(stage1-languages,
1950   [AS_HELP_STRING([[--enable-stage1-languages[=all]]],
1951                   [choose additional languages to build during
1952                   stage1.  Mostly useful for compiler development])],
1953   [case ,${enable_stage1_languages}, in
1954     ,no,|,,)
1955       # Set it to something that will have no effect in the loop below
1956       enable_stage1_languages=c ;;
1957     ,yes,)
1958       enable_stage1_languages=`echo $new_enable_languages | \
1959         sed -e "s/^,//" -e "s/,$//" ` ;;
1960     *,all,*)
1961       enable_stage1_languages=`echo ,$enable_stage1_languages, | \
1962         sed -e "s/,all,/$new_enable_languages/" -e "s/^,//" -e "s/,$//" ` ;;
1963   esac
1965   # Add "good" languages from enable_stage1_languages to stage1_languages,
1966   # while "bad" languages go in missing_languages.  Leave no duplicates.
1967   for i in `echo $enable_stage1_languages | sed 's/,/ /g' `; do
1968     case $potential_languages in
1969       *,$i,*)
1970         case $stage1_languages in
1971           *,$i,*) ;;
1972           *) stage1_languages="$stage1_languages$i," ;;
1973         esac ;;
1974       *)
1975         case $missing_languages in
1976           *,$i,*) ;;
1977           *) missing_languages="$missing_languages$i," ;;
1978         esac ;;
1979      esac
1980   done])
1982   # Remove leading/trailing commas that were added for simplicity
1983   potential_languages=`echo "$potential_languages" | sed -e "s/^,//" -e "s/,$//"`
1984   missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
1985   stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"`
1986   new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"`
1988   if test "x$missing_languages" != x; then
1989     AC_MSG_ERROR([
1990 The following requested languages could not be built: ${missing_languages}
1991 Supported languages are: ${potential_languages}])
1992   fi
1993   if test "x$new_enable_languages" != "x$enable_languages"; then
1994     echo The following languages will be built: ${new_enable_languages}
1995     enable_languages="$new_enable_languages"
1996   fi
1998   AC_SUBST(stage1_languages)
1999   ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
2002 # Handle --disable-<component> generically.
2003 for dir in $configdirs $build_configdirs $target_configdirs ; do
2004   dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
2005   varname=`echo $dirname | sed -e s/+/_/g`
2006   if eval test x\${enable_${varname}} "=" xno ; then
2007     noconfigdirs="$noconfigdirs $dir"
2008   fi
2009 done
2011 # Check for Boehm's garbage collector
2012 AC_ARG_ENABLE(objc-gc,
2013 [AS_HELP_STRING([--enable-objc-gc],
2014                 [enable use of Boehm's garbage collector with the
2015                  GNU Objective-C runtime])],
2016 [case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in
2017   *,objc,*:*:yes:*target-boehm-gc*)
2018     AC_MSG_ERROR([Boehm's garbage collector was requested yet not supported in this configuration])
2019     ;;
2020 esac])
2022 # Make sure we only build Boehm's garbage collector if required.
2023 case ,${enable_languages},:${enable_objc_gc} in
2024   *,objc,*:yes)
2025     # Keep target-boehm-gc if requested for Objective-C.
2026     ;;
2027   *)
2028     # Otherwise remove target-boehm-gc depending on target-libjava.
2029     if echo " ${noconfigdirs} " | grep "target-libjava" >/dev/null 2>&1; then
2030       noconfigdirs="$noconfigdirs target-boehm-gc"
2031     fi
2032     ;;
2033 esac
2035 # Disable libitm and libsanitizer if we're not building C++
2036 case ,${enable_languages}, in
2037   *,c++,*) ;;
2038   *)
2039     noconfigdirs="$noconfigdirs target-libitm target-libsanitizer"
2040     ;;
2041 esac
2043 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
2044 # $build_configdirs and $target_configdirs.
2045 # If we have the source for $noconfigdirs entries, add them to $notsupp.
2047 notsupp=""
2048 for dir in . $skipdirs $noconfigdirs ; do
2049   dirname=`echo $dir | sed -e s/target-//g -e s/build-//g`
2050   if test $dir != .  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2051     configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
2052     if test -r $srcdir/$dirname/configure ; then
2053       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2054         true
2055       else
2056         notsupp="$notsupp $dir"
2057       fi
2058     fi
2059   fi
2060   if test $dir != .  && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2061     build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"`
2062     if test -r $srcdir/$dirname/configure ; then
2063       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2064         true
2065       else
2066         notsupp="$notsupp $dir"
2067       fi
2068     fi
2069   fi
2070   if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2071     target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
2072     if test -r $srcdir/$dirname/configure ; then
2073       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2074         true
2075       else
2076         notsupp="$notsupp $dir"
2077       fi
2078     fi
2079   fi
2080 done
2082 # Quietly strip out all directories which aren't configurable in this tree.
2083 # This relies on all configurable subdirectories being autoconfiscated, which
2084 # is now the case.
2085 build_configdirs_all="$build_configdirs"
2086 build_configdirs=
2087 for i in ${build_configdirs_all} ; do
2088   j=`echo $i | sed -e s/build-//g` 
2089   if test -f ${srcdir}/$j/configure ; then
2090     build_configdirs="${build_configdirs} $i"
2091   fi
2092 done
2094 configdirs_all="$configdirs"
2095 configdirs=
2096 for i in ${configdirs_all} ; do
2097   if test -f ${srcdir}/$i/configure ; then
2098     configdirs="${configdirs} $i"
2099   fi
2100 done
2102 target_configdirs_all="$target_configdirs"
2103 target_configdirs=
2104 for i in ${target_configdirs_all} ; do
2105   j=`echo $i | sed -e s/target-//g` 
2106   if test -f ${srcdir}/$j/configure ; then
2107     target_configdirs="${target_configdirs} $i"
2108   fi
2109 done
2111 # Produce a warning message for the subdirs we can't configure.
2112 # This isn't especially interesting in the Cygnus tree, but in the individual
2113 # FSF releases, it's important to let people know when their machine isn't
2114 # supported by the one or two programs in a package.
2116 if test -n "${notsupp}" && test -z "${norecursion}" ; then
2117   # If $appdirs is non-empty, at least one of those directories must still
2118   # be configured, or we error out.  (E.g., if the gas release supports a
2119   # specified target in some subdirs but not the gas subdir, we shouldn't
2120   # pretend that all is well.)
2121   if test -n "$appdirs" ; then
2122     for dir in $appdirs ; do
2123       if test -r $dir/Makefile.in ; then
2124         if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2125           appdirs=""
2126           break
2127         fi
2128         if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then
2129           appdirs=""
2130           break
2131         fi
2132       fi
2133     done
2134     if test -n "$appdirs" ; then
2135       echo "*** This configuration is not supported by this package." 1>&2
2136       exit 1
2137     fi
2138   fi
2139   # Okay, some application will build, or we don't care to check.  Still
2140   # notify of subdirs not getting built.
2141   echo "*** This configuration is not supported in the following subdirectories:" 1>&2
2142   echo "    ${notsupp}" 1>&2
2143   echo "    (Any other directories should still work fine.)" 1>&2
2146 case "$host" in
2147   *msdosdjgpp*)
2148     enable_gdbtk=no ;;
2149 esac
2151 # To find our prefix, in gcc_cv_tool_prefix.
2152 ACX_TOOL_DIRS
2154 copy_dirs=
2156 AC_ARG_WITH([build-sysroot], 
2157   [AS_HELP_STRING([--with-build-sysroot=SYSROOT],
2158                   [use sysroot as the system root during the build])],
2159   [if test x"$withval" != x ; then
2160      SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
2161    fi],
2162   [SYSROOT_CFLAGS_FOR_TARGET=])
2163 AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
2165 AC_ARG_WITH([debug-prefix-map],
2166   [AS_HELP_STRING([--with-debug-prefix-map='A=B C=D ...'],
2167                   [map A to B, C to D ... in debug information])],
2168   [if test x"$withval" != x; then
2169      DEBUG_PREFIX_CFLAGS_FOR_TARGET=
2170      for debug_map in $withval; do
2171        DEBUG_PREFIX_CFLAGS_FOR_TARGET="$DEBUG_PREFIX_CFLAGS_FOR_TARGET -fdebug-prefix-map=$debug_map"
2172      done
2173    fi],
2174   [DEBUG_PREFIX_CFLAGS_FOR_TARGET=])
2175 AC_SUBST(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
2177 # During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
2178 # might be empty or "-g".  We don't require a C++ compiler, so CXXFLAGS
2179 # might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
2180 # We want to ensure that TARGET libraries (which we know are built with
2181 # gcc) are built with "-O2 -g", so include those options when setting
2182 # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
2183 if test "x$CFLAGS_FOR_TARGET" = x; then
2184   CFLAGS_FOR_TARGET=$CFLAGS
2185   case " $CFLAGS " in
2186     *" -O2 "*) ;;
2187     *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;;
2188   esac
2189   case " $CFLAGS " in
2190     *" -g "* | *" -g3 "*) ;;
2191     *) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;;
2192   esac
2194 AC_SUBST(CFLAGS_FOR_TARGET)
2196 if test "x$CXXFLAGS_FOR_TARGET" = x; then
2197   CXXFLAGS_FOR_TARGET=$CXXFLAGS
2198   case " $CXXFLAGS " in
2199     *" -O2 "*) ;;
2200     *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;;
2201   esac
2202   case " $CXXFLAGS " in
2203     *" -g "* | *" -g3 "*) ;;
2204     *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;;
2205   esac
2207 AC_SUBST(CXXFLAGS_FOR_TARGET)
2209 AC_SUBST(LDFLAGS_FOR_TARGET)
2211 # Handle --with-headers=XXX.  If the value is not "yes", the contents of
2212 # the named directory are copied to $(tooldir)/sys-include.
2213 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
2214   if test x${is_cross_compiler} = xno ; then
2215     echo 1>&2 '***' --with-headers is only supported when cross compiling
2216     exit 1
2217   fi
2218   if test x"${with_headers}" != xyes ; then
2219     x=${gcc_cv_tool_prefix}
2220     copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
2221   fi
2224 # Handle --with-libs=XXX.  If the value is not "yes", the contents of
2225 # the name directories are copied to $(tooldir)/lib.  Multiple directories
2226 # are permitted.
2227 if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
2228   if test x${is_cross_compiler} = xno ; then
2229     echo 1>&2 '***' --with-libs is only supported when cross compiling
2230     exit 1
2231   fi
2232   if test x"${with_libs}" != xyes ; then
2233     # Copy the libraries in reverse order, so that files in the first named
2234     # library override files in subsequent libraries.
2235     x=${gcc_cv_tool_prefix}
2236     for l in ${with_libs}; do
2237       copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
2238     done
2239   fi
2242 # Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate.
2244 # This is done by determining whether or not the appropriate directory
2245 # is available, and by checking whether or not specific configurations
2246 # have requested that this magic not happen.
2248 # The command line options always override the explicit settings in 
2249 # configure.in, and the settings in configure.in override this magic.
2251 # If the default for a toolchain is to use GNU as and ld, and you don't 
2252 # want to do that, then you should use the --without-gnu-as and
2253 # --without-gnu-ld options for the configure script.  Similarly, if
2254 # the default is to use the included zlib and you don't want to do that,
2255 # you should use the --with-system-zlib option for the configure script.
2257 if test x${use_gnu_as} = x &&
2258    echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
2259   with_gnu_as=yes
2260   extra_host_args="$extra_host_args --with-gnu-as"
2263 if test x${use_gnu_ld} = x &&
2264    echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
2265   with_gnu_ld=yes
2266   extra_host_args="$extra_host_args --with-gnu-ld"
2269 if test x${use_included_zlib} = x &&
2270    echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then
2271   :
2272 else
2273   with_system_zlib=yes
2274   extra_host_args="$extra_host_args --with-system-zlib"
2277 # If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
2278 # can detect this case.
2280 if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
2281   with_newlib=yes
2282   extra_host_args="$extra_host_args --with-newlib"
2285 # Handle ${copy_dirs}
2286 set fnord ${copy_dirs}
2287 shift
2288 while test $# != 0 ; do
2289   if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
2290     :
2291   else
2292     echo Copying $1 to $2
2294     # Use the install script to create the directory and all required
2295     # parent directories.
2296     if test -d $2 ; then
2297       :
2298     else
2299       echo >config.temp
2300       ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
2301     fi
2303     # Copy the directory, assuming we have tar.
2304     # FIXME: Should we use B in the second tar?  Not all systems support it.
2305     (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
2307     # It is the responsibility of the user to correctly adjust all
2308     # symlinks.  If somebody can figure out how to handle them correctly
2309     # here, feel free to add the code.
2311     echo $1 > $2/COPIED
2312   fi
2313   shift; shift
2314 done
2316 # Determine a target-dependent exec_prefix that the installed
2317 # gcc will search in.  Keep this list sorted by triplet, with
2318 # the *-*-osname triplets last.
2319 md_exec_prefix=
2320 case "${target}" in
2321   i[[34567]]86-pc-msdosdjgpp*)
2322     md_exec_prefix=/dev/env/DJDIR/bin
2323     ;;
2324   *-*-hpux* | \
2325   *-*-nto-qnx* | \
2326   *-*-solaris2*)
2327     md_exec_prefix=/usr/ccs/bin
2328     ;;
2329 esac
2331 extra_arflags_for_target=
2332 extra_nmflags_for_target=
2333 extra_ranlibflags_for_target=
2334 target_makefile_frag=/dev/null
2335 case "${target}" in
2336   spu-*-*)
2337     target_makefile_frag="config/mt-spu"
2338     ;;
2339   mips*-sde-elf* | mips*-mti-elf*)
2340     target_makefile_frag="config/mt-sde"
2341     ;;
2342   mipsisa*-*-elfoabi*)
2343     target_makefile_frag="config/mt-mips-elfoabi"
2344     ;;
2345   mips*-*-*linux* | mips*-*-gnu*)
2346     target_makefile_frag="config/mt-mips-gnu"
2347     ;;
2348   *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
2349     target_makefile_frag="config/mt-gnu"
2350     ;;
2351   *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
2352     # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm 
2353     # commands to handle both 32-bit and 64-bit objects.  These flags are
2354     # harmless if we're using GNU nm or ar.
2355     extra_arflags_for_target=" -X32_64"
2356     extra_nmflags_for_target=" -B -X32_64"
2357     ;;
2358 esac
2360 alphaieee_frag=/dev/null
2361 case $target in
2362   alpha*-*-*)
2363     # This just makes sure to use the -mieee option to build target libs.
2364     # This should probably be set individually by each library.
2365     alphaieee_frag="config/mt-alphaieee"
2366     ;;
2367 esac
2369 # If --enable-target-optspace always use -Os instead of -O2 to build
2370 # the target libraries, similarly if it is not specified, use -Os
2371 # on selected platforms.
2372 ospace_frag=/dev/null
2373 case "${enable_target_optspace}:${target}" in
2374   yes:*)
2375     ospace_frag="config/mt-ospace"
2376     ;;
2377   :d30v-*)
2378     ospace_frag="config/mt-d30v"
2379     ;;
2380   :m32r-* | :d10v-* | :fr30-*)
2381     ospace_frag="config/mt-ospace"
2382     ;;
2383   no:* | :*)
2384     ;;
2385   *)
2386     echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
2387     ;;
2388 esac
2390 # Some systems (e.g., one of the i386-aix systems the gas testers are
2391 # using) don't handle "\$" correctly, so don't use it here.
2392 tooldir='${exec_prefix}'/${target_noncanonical}
2393 build_tooldir=${tooldir}
2395 # Create a .gdbinit file which runs the one in srcdir
2396 # and tells GDB to look there for source files.
2398 if test -r ${srcdir}/.gdbinit ; then
2399   case ${srcdir} in
2400     .) ;;
2401     *) cat > ./.gdbinit <<EOF
2402 # ${NO_EDIT}
2403 dir ${srcdir}
2404 dir .
2405 source ${srcdir}/.gdbinit
2407     ;;
2408   esac
2411 # Make sure that the compiler is able to generate an executable.  If it
2412 # can't, we are probably in trouble.  We don't care whether we can run the
2413 # executable--we might be using a cross compiler--we only care whether it
2414 # can be created.  At this point the main configure script has set CC.
2415 we_are_ok=no
2416 echo "int main () { return 0; }" > conftest.c
2417 ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
2418 if test $? = 0 ; then
2419   if test -s conftest || test -s conftest.exe ; then
2420     we_are_ok=yes
2421   fi
2422 fi 
2423 case $we_are_ok in
2424   no)
2425     echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
2426     echo 1>&2 "*** You must set the environment variable CC to a working compiler."
2427     rm -f conftest*
2428     exit 1
2429     ;;
2430 esac
2431 rm -f conftest*
2433 # Decide which environment variable is used to find dynamic libraries.
2434 case "${host}" in
2435   *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
2436   *-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
2437   *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
2438   *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
2439 esac
2441 # On systems where the dynamic library environment variable is PATH,
2442 # gcc/ will put dynamic libraries into a subdirectory to avoid adding
2443 # built executables to PATH.
2444 if test "$RPATH_ENVVAR" = PATH; then
2445   GCC_SHLIB_SUBDIR=/shlib
2446 else
2447   GCC_SHLIB_SUBDIR=
2450 # Record target_configdirs and the configure arguments for target and
2451 # build configuration in Makefile.
2452 target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
2453 build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
2455 # If we are building libgomp, bootstrap it.
2456 if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
2457   bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
2460 # If we are building libsanitizer, bootstrap it.
2461 if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1 ; then
2462   bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
2465 # Determine whether gdb needs tk/tcl or not.
2466 # Use 'maybe' since enable_gdbtk might be true even if tk isn't available
2467 # and in that case we want gdb to be built without tk.  Ugh!
2468 # In fact I believe gdb is the *only* package directly dependent on tk,
2469 # so we should be able to put the 'maybe's in unconditionally and
2470 # leave out the maybe dependencies when enable_gdbtk is false.  I'm not
2471 # 100% sure that that's safe though.
2473 gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
2474 case "$enable_gdbtk" in
2475   no)
2476     GDB_TK="" ;;
2477   yes)
2478     GDB_TK="${gdb_tk}" ;;
2479   *)
2480     # Only add the dependency on gdbtk when GDBtk is part of the gdb
2481     # distro.  Eventually someone will fix this and move Insight, nee
2482     # gdbtk to a separate directory.
2483     if test -d ${srcdir}/gdb/gdbtk ; then
2484       GDB_TK="${gdb_tk}"
2485     else
2486       GDB_TK=""
2487     fi
2488     ;;
2489 esac
2490 CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
2491 INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
2493 # Strip out unwanted targets.
2495 # While at that, we remove Makefiles if we were started for recursive
2496 # configuration, so that the top-level Makefile reconfigures them,
2497 # like we used to do when configure itself was recursive.
2499 # Loop over modules.  We used to use the "$extrasub" feature from Autoconf
2500 # but now we're fixing up the Makefile ourselves with the additional
2501 # commands passed to AC_CONFIG_FILES.  Use separate variables
2502 # extrasub-{build,host,target} not because there is any reason to split
2503 # the substitutions up that way, but only to remain below the limit of
2504 # 99 commands in a script, for HP-UX sed.
2505 # Do not nest @if/@endif pairs, because configure will not warn you at all.
2507 case "$enable_bootstrap:$ENABLE_GOLD: $configdirs :,$stage1_languages," in
2508   yes:yes:*\ gold\ *:*,c++,*) ;;
2509   yes:yes:*\ gold\ *:*)
2510     AC_MSG_ERROR([in a combined tree, bootstrapping with --enable-gold requires c++ in stage1_languages])
2511     ;;
2512 esac
2514 # Adjust the toplevel makefile according to whether bootstrap was selected.
2515 case $enable_bootstrap in
2516   yes)
2517     bootstrap_suffix=bootstrap
2518     BUILD_CONFIG=bootstrap-debug
2519     ;;
2520   no)
2521     bootstrap_suffix=no-bootstrap
2522     BUILD_CONFIG=
2523     ;;
2524 esac
2526 AC_MSG_CHECKING(for default BUILD_CONFIG)
2528 AC_ARG_WITH([build-config],
2529   [AS_HELP_STRING([--with-build-config='NAME NAME2...'],
2530                   [use config/NAME.mk build configuration])],
2531   [case $with_build_config in
2532    yes) with_build_config= ;;
2533    no) with_build_config= BUILD_CONFIG= ;;
2534    esac])
2536 if test "x${with_build_config}" != x; then
2537   BUILD_CONFIG=$with_build_config
2538 else
2539   case $BUILD_CONFIG in
2540   bootstrap-debug)
2541     if echo "int f (void) { return 0; }" > conftest.c &&
2542        ${CC} -c conftest.c &&
2543        mv conftest.o conftest.o.g0 &&
2544        ${CC} -c -g conftest.c &&
2545        mv conftest.o conftest.o.g &&
2546        ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g > /dev/null 2>&1; then
2547       :
2548     else
2549       BUILD_CONFIG=
2550     fi
2551     rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g
2552     ;;
2553   esac
2555 AC_MSG_RESULT($BUILD_CONFIG)
2556 AC_SUBST(BUILD_CONFIG)
2558 extrasub_build=
2559 for module in ${build_configdirs} ; do
2560   if test -z "${no_recursion}" \
2561      && test -f ${build_subdir}/${module}/Makefile; then
2562     echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
2563     rm -f ${build_subdir}/${module}/Makefile
2564   fi
2565   extrasub_build="$extrasub_build
2566 /^@if build-$module\$/d
2567 /^@endif build-$module\$/d
2568 /^@if build-$module-$bootstrap_suffix\$/d
2569 /^@endif build-$module-$bootstrap_suffix\$/d"
2570 done
2571 extrasub_host=
2572 for module in ${configdirs} ; do
2573   if test -z "${no_recursion}"; then
2574     for file in stage*-${module}/Makefile prev-${module}/Makefile ${module}/Makefile; do
2575       if test -f ${file}; then
2576         echo 1>&2 "*** removing ${file} to force reconfigure"
2577         rm -f ${file}
2578       fi
2579     done
2580   fi
2581   extrasub_host="$extrasub_host
2582 /^@if $module\$/d
2583 /^@endif $module\$/d
2584 /^@if $module-$bootstrap_suffix\$/d
2585 /^@endif $module-$bootstrap_suffix\$/d"
2586 done
2587 extrasub_target=
2588 for module in ${target_configdirs} ; do
2589   if test -z "${no_recursion}" \
2590      && test -f ${target_subdir}/${module}/Makefile; then
2591     echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
2592     rm -f ${target_subdir}/${module}/Makefile
2593   fi
2595   # We only bootstrap target libraries listed in bootstrap_target_libs.
2596   case $bootstrap_target_libs in
2597     *,target-$module,*) target_bootstrap_suffix=$bootstrap_suffix ;;
2598     *) target_bootstrap_suffix=no-bootstrap ;;
2599   esac
2601   extrasub_target="$extrasub_target
2602 /^@if target-$module\$/d
2603 /^@endif target-$module\$/d
2604 /^@if target-$module-$target_bootstrap_suffix\$/d
2605 /^@endif target-$module-$target_bootstrap_suffix\$/d"
2606 done
2608 # Do the final fixup along with target modules.
2609 extrasub_target="$extrasub_target
2610 /^@if /,/^@endif /d"
2612 # Create the serialization dependencies.  This uses a temporary file.
2614 AC_ARG_ENABLE([serial-configure],
2615 [AS_HELP_STRING([[--enable-serial-[{host,target,build}-]configure]],
2616                 [force sequential configuration of
2617                  sub-packages for the host, target or build
2618                  machine, or all sub-packages])])
2620 case ${enable_serial_configure} in
2621   yes)
2622     enable_serial_build_configure=yes
2623     enable_serial_host_configure=yes
2624     enable_serial_target_configure=yes
2625     ;;
2626 esac
2628 # These force 'configure's to be done one at a time, to avoid problems
2629 # with contention over a shared config.cache.
2630 rm -f serdep.tmp
2631 echo '# serdep.tmp' > serdep.tmp
2632 olditem=
2633 test "x${enable_serial_build_configure}" = xyes &&
2634 for item in ${build_configdirs} ; do
2635   case ${olditem} in
2636     "") ;;
2637     *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
2638   esac
2639   olditem=${item}
2640 done
2641 olditem=
2642 test "x${enable_serial_host_configure}" = xyes &&
2643 for item in ${configdirs} ; do
2644   case ${olditem} in
2645     "") ;;
2646     *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
2647   esac
2648   olditem=${item}
2649 done
2650 olditem=
2651 test "x${enable_serial_target_configure}" = xyes &&
2652 for item in ${target_configdirs} ; do
2653   case ${olditem} in
2654     "") ;;
2655     *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
2656   esac
2657   olditem=${item}
2658 done
2659 serialization_dependencies=serdep.tmp
2660 AC_SUBST_FILE(serialization_dependencies)
2662 # Base args.  Strip norecursion, cache-file, srcdir, host, build,
2663 # target, nonopt, and variable assignments.  These are the ones we
2664 # might not want to pass down to subconfigures.  The exception being
2665 # --cache-file=/dev/null, which is used to turn off the use of cache
2666 # files altogether, and which should be passed on to subconfigures.
2667 # Also strip program-prefix, program-suffix, and program-transform-name,
2668 # so that we can pass down a consistent program-transform-name.
2669 baseargs=
2670 tbaseargs=
2671 keep_next=no
2672 skip_next=no
2673 eval "set -- $ac_configure_args"
2674 for ac_arg
2676   if test X"$skip_next" = X"yes"; then
2677     skip_next=no
2678     continue
2679   fi
2680   if test X"$keep_next" = X"yes"; then
2681     case $ac_arg in
2682       *\'*)
2683         ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2684     esac
2685     baseargs="$baseargs '$ac_arg'"
2686     tbaseargs="$tbaseargs '$ac_arg'"
2687     keep_next=no
2688     continue
2689   fi
2691   # Handle separated arguments.  Based on the logic generated by
2692   # autoconf 2.59.
2693   case $ac_arg in
2694     *=* | --config-cache | -C | -disable-* | --disable-* \
2695       | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
2696       | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
2697       | -with-* | --with-* | -without-* | --without-* | --x)
2698       separate_arg=no
2699       ;;
2700     -*)
2701       separate_arg=yes
2702       ;;
2703     *)
2704       separate_arg=no
2705       ;;
2706   esac
2708   skip_targ=no
2709   case $ac_arg in
2710 changequote(,)
2711   --with-* | --without-*)
2712     libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
2714     case $libopt in
2715     *[-_]include)
2716       lib=`echo "$libopt" | sed 's,[-_]include$,,'`
2717       ;;
2718     *[-_]lib)
2719       lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
2720       ;;
2721     *)
2722       lib=$libopt
2723       ;;
2724     esac
2725 changequote([,])
2727     case $lib in
2728     mpc | mpfr | gmp | cloog)
2729       # If we're processing --with-$lib, --with-$lib-include or
2730       # --with-$lib-lib, for one of the libs above, and target is
2731       # different from host, don't pass the current argument to any
2732       # target library's configure.
2733       if test x$is_cross_compiler = xyes; then
2734         skip_targ=yes
2735       fi
2736       ;;
2737     esac
2738     ;;
2739   esac
2741   case "$ac_arg" in
2742     --cache-file=/dev/null | \
2743     -cache-file=/dev/null )
2744       # Handled here to avoid the test to skip args below.
2745       baseargs="$baseargs '$ac_arg'"
2746       tbaseargs="$tbaseargs '$ac_arg'"
2747       # Assert: $separate_arg should always be no.
2748       keep_next=$separate_arg
2749       ;;
2750     --no*)
2751       continue
2752       ;;
2753     --c* | \
2754     --sr* | \
2755     --ho* | \
2756     --bu* | \
2757     --t* | \
2758     --program-* | \
2759     -cache_file* | \
2760     -srcdir* | \
2761     -host* | \
2762     -build* | \
2763     -target* | \
2764     -program-prefix* | \
2765     -program-suffix* | \
2766     -program-transform-name* )
2767       skip_next=$separate_arg
2768       continue
2769       ;;
2770     -*)
2771       # An option.  Add it.
2772       case $ac_arg in
2773         *\'*)
2774           ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2775       esac
2776       baseargs="$baseargs '$ac_arg'"
2777       if test X"$skip_targ" = Xno; then
2778         tbaseargs="$tbaseargs '$ac_arg'"
2779       fi
2780       keep_next=$separate_arg
2781       ;;
2782     *)
2783       # Either a variable assignment, or a nonopt (triplet).  Don't
2784       # pass it down; let the Makefile handle this.
2785       continue
2786       ;;
2787   esac
2788 done
2789 # Remove the initial space we just introduced and, as these will be
2790 # expanded by make, quote '$'.
2791 baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
2793 # Add in --program-transform-name, after --program-prefix and
2794 # --program-suffix have been applied to it.  Autoconf has already
2795 # doubled dollar signs and backslashes in program_transform_name; we want
2796 # the backslashes un-doubled, and then the entire thing wrapped in single
2797 # quotes, because this will be expanded first by make and then by the shell. 
2798 # Also, because we want to override the logic in subdir configure scripts to
2799 # choose program_transform_name, replace any s,x,x, with s,y,y,.
2800 sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
2801 ${program_transform_name}
2802 EOF_SED
2803 gcc_transform_name=`cat conftestsed.out`
2804 rm -f conftestsed.out
2805 baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
2806 tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
2807 if test "$silent" = yes; then
2808   baseargs="$baseargs --silent"
2809   tbaseargs="$tbaseargs --silent"
2811 baseargs="$baseargs --disable-option-checking"
2812 tbaseargs="$tbaseargs --disable-option-checking"
2814 # Record and document user additions to sub configure arguments.
2815 AC_ARG_VAR([build_configargs],
2816            [additional configure arguments for build directories])
2817 AC_ARG_VAR([host_configargs],
2818            [additional configure arguments for host directories])
2819 AC_ARG_VAR([target_configargs],
2820            [additional configure arguments for target directories])
2822 # For the build-side libraries, we just need to pretend we're native,
2823 # and not use the same cache file.  Multilibs are neither needed nor
2824 # desired.
2825 build_configargs="$build_configargs --cache-file=../config.cache ${baseargs}"
2827 # For host modules, accept cache file option, or specification as blank.
2828 case "${cache_file}" in
2829 "") # empty
2830   cache_file_option="" ;;
2831 /* | [[A-Za-z]]:[[\\/]]* ) # absolute path
2832   cache_file_option="--cache-file=${cache_file}" ;;
2833 *) # relative path
2834   cache_file_option="--cache-file=../${cache_file}" ;;
2835 esac
2837 # Host dirs don't like to share a cache file either, horribly enough.
2838 # This seems to be due to autoconf 2.5x stupidity.
2839 host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}"
2841 target_configargs="$target_configargs ${tbaseargs}"
2843 # Passing a --with-cross-host argument lets the target libraries know
2844 # whether they are being built with a cross-compiler or being built
2845 # native.  However, it would be better to use other mechanisms to make the
2846 # sorts of decisions they want to make on this basis.  Please consider
2847 # this option to be deprecated.  FIXME.
2848 if test x${is_cross_compiler} = xyes ; then
2849   target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
2852 # Default to --enable-multilib.
2853 if test x${enable_multilib} = x ; then
2854   target_configargs="--enable-multilib ${target_configargs}"
2857 # Pass --with-newlib if appropriate.  Note that target_configdirs has
2858 # changed from the earlier setting of with_newlib.
2859 if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
2860   target_configargs="--with-newlib ${target_configargs}"
2863 # Different target subdirs use different values of certain variables
2864 # (notably CXX).  Worse, multilibs use *lots* of different values.
2865 # Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
2866 # it doesn't automatically accept command-line overrides of them.
2867 # This means it's not safe for target subdirs to share a cache file,
2868 # which is disgusting, but there you have it.  Hopefully this can be
2869 # fixed in future.  It's still worthwhile to use a cache file for each
2870 # directory.  I think.
2872 # Pass the appropriate --build, --host, --target and --cache-file arguments.
2873 # We need to pass --target, as newer autoconf's requires consistency
2874 # for target_alias and gcc doesn't manage it consistently.
2875 target_configargs="--cache-file=./config.cache ${target_configargs}"
2877 FLAGS_FOR_TARGET=
2878 case " $target_configdirs " in
2879  *" newlib "*)
2880   case " $target_configargs " in
2881   *" --with-newlib "*)
2882    case "$target" in
2883     *-cygwin*)
2884       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
2885       ;;
2886    esac
2888    # If we're not building GCC, don't discard standard headers.
2889    if test -d ${srcdir}/gcc; then
2890      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
2892      if test "${build}" != "${host}"; then
2893        # On Canadian crosses, CC_FOR_TARGET will have already been set
2894        # by `configure', so we won't have an opportunity to add -Bgcc/
2895        # to it.  This is right: we don't want to search that directory
2896        # for binaries, but we want the header files in there, so add
2897        # them explicitly.
2898        FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include -isystem $$r/$(HOST_SUBDIR)/gcc/include-fixed'
2900        # Someone might think of using the pre-installed headers on
2901        # Canadian crosses, in case the installed compiler is not fully
2902        # compatible with the compiler being built.  In this case, it
2903        # would be better to flag an error than risking having
2904        # incompatible object files being constructed.  We can't
2905        # guarantee that an error will be flagged, but let's hope the
2906        # compiler will do it, when presented with incompatible header
2907        # files.
2908      fi
2909    fi
2911    case "${target}-${is_cross_compiler}" in
2912    i[[3456789]]86-*-linux*-no)
2913       # Here host == target, so we don't need to build gcc,
2914       # so we don't want to discard standard headers.
2915       FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
2916       ;;
2917    *)
2918       # If we're building newlib, use its generic headers last, but search
2919       # for any libc-related directories first (so make it the last -B
2920       # switch).
2921       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
2923       # If we're building libgloss, find the startup file, simulator library
2924       # and linker script.
2925       case " $target_configdirs " in
2926         *" libgloss "*)
2927         # Look for startup file, simulator library and maybe linker script.
2928         FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/'"$libgloss_dir"
2929         # Look for libnosys.a in case the target needs it.
2930         FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
2931         # Most targets have the linker script in the source directory.
2932         FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$s/libgloss/'"$libgloss_dir"
2933         ;;
2934       esac
2935       ;;
2936    esac
2937    ;;
2938   esac
2939   ;;
2940 esac
2942 case "$target" in
2943   x86_64-*mingw* | *-w64-mingw*)
2944   # MinGW-w64 does not use newlib, nor does it use winsup. It may,
2945   # however, use a symlink named 'mingw' in ${prefix} .
2946     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include'
2947     ;;
2948   *-mingw*)
2949   # MinGW can't be handled as Cygwin above since it does not use newlib.
2950     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/mingw -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/mingw/include -isystem $$s/winsup/w32api/include'
2951     ;;
2952 esac
2954 # Allow the user to override the flags for
2955 # our build compiler if desired.
2956 if test x"${build}" = x"${host}" ; then
2957   CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
2958   CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
2959   LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
2962 # On Canadian crosses, we'll be searching the right directories for
2963 # the previously-installed cross compiler, so don't bother to add
2964 # flags for directories within the install tree of the compiler
2965 # being built; programs in there won't even run.
2966 if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
2967   # Search for pre-installed headers if nothing else fits.
2968   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
2971 if test "x${use_gnu_ld}" = x &&
2972    echo " ${configdirs} " | grep " ld " > /dev/null ; then
2973   # Arrange for us to find uninstalled linker scripts.
2974   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
2977 # Search for other target-specific linker scripts and such.
2978 case "${target}" in
2979   mep*)
2980     FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
2981     ;;
2982 esac
2984 # Makefile fragments.
2985 for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
2987   eval fragval=\$$frag
2988   if test $fragval != /dev/null; then
2989     eval $frag=${srcdir}/$fragval
2990   fi
2991 done
2992 AC_SUBST_FILE(host_makefile_frag)
2993 AC_SUBST_FILE(target_makefile_frag)
2994 AC_SUBST_FILE(alphaieee_frag)
2995 AC_SUBST_FILE(ospace_frag)
2997 # Miscellanea: directories, flags, etc.
2998 AC_SUBST(RPATH_ENVVAR)
2999 AC_SUBST(GCC_SHLIB_SUBDIR)
3000 AC_SUBST(tooldir)
3001 AC_SUBST(build_tooldir)
3002 AC_SUBST(CONFIGURE_GDB_TK)
3003 AC_SUBST(GDB_TK)
3004 AC_SUBST(INSTALL_GDB_TK)
3006 # Build module lists & subconfigure args.
3007 AC_SUBST(build_configargs)
3008 AC_SUBST(build_configdirs)
3010 # Host module lists & subconfigure args.
3011 AC_SUBST(host_configargs)
3012 AC_SUBST(configdirs)
3013 AC_SUBST(target_configdirs)
3015 # Target module lists & subconfigure args.
3016 AC_SUBST(target_configargs)
3019 # Build tools.
3020 AC_SUBST(AR_FOR_BUILD)
3021 AC_SUBST(AS_FOR_BUILD)
3022 AC_SUBST(CC_FOR_BUILD)
3023 AC_SUBST(CFLAGS_FOR_BUILD)
3024 AC_SUBST(CXXFLAGS_FOR_BUILD)
3025 AC_SUBST(CXX_FOR_BUILD)
3026 AC_SUBST(DLLTOOL_FOR_BUILD)
3027 AC_SUBST(GCJ_FOR_BUILD)
3028 AC_SUBST(GFORTRAN_FOR_BUILD)
3029 AC_SUBST(GOC_FOR_BUILD)
3030 AC_SUBST(LDFLAGS_FOR_BUILD)
3031 AC_SUBST(LD_FOR_BUILD)
3032 AC_SUBST(NM_FOR_BUILD)
3033 AC_SUBST(RANLIB_FOR_BUILD)
3034 AC_SUBST(WINDMC_FOR_BUILD)
3035 AC_SUBST(WINDRES_FOR_BUILD)
3037 # Generate default definitions for YACC, M4, LEX and other programs that run
3038 # on the build machine.  These are used if the Makefile can't locate these
3039 # programs in objdir.
3040 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
3042 AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
3043 case " $build_configdirs " in
3044   *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
3045 esac
3047 AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
3048 case " $build_configdirs " in
3049   *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
3050 esac
3052 AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
3053 case " $build_configdirs " in
3054   *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
3055 esac
3057 AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
3058 case " $build_configdirs " in
3059   *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
3060   *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
3061 esac
3063 AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
3064 case " $build_configdirs " in
3065   *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
3066 esac
3068 AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
3069 case " $build_configdirs " in
3070   *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
3071   *)
3072 changequote(,)
3073     # For an installed makeinfo, we require it to be from texinfo 4.7 or
3074     # higher, else we use the "missing" dummy.
3075     if ${MAKEINFO} --version \
3076        | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
3077       :
3078     else
3079       MAKEINFO="$MISSING makeinfo"
3080     fi
3081     ;;
3082 changequote([,])
3083 esac
3085 # FIXME: expect and dejagnu may become build tools?
3087 AC_CHECK_PROGS(EXPECT, expect, expect)
3088 case " $configdirs " in
3089   *" expect "*)
3090     test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
3091     ;;
3092 esac
3094 AC_CHECK_PROGS(RUNTEST, runtest, runtest)
3095 case " $configdirs " in
3096   *" dejagnu "*)
3097     test $host = $build && RUNTEST='$$s/$(HOST_SUBDIR)/dejagnu/runtest'
3098     ;;
3099 esac
3102 # Host tools.
3103 NCN_STRICT_CHECK_TOOLS(AR, ar)
3104 NCN_STRICT_CHECK_TOOLS(AS, as)
3105 NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
3106 NCN_STRICT_CHECK_TOOLS(LD, ld)
3107 NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
3108 NCN_STRICT_CHECK_TOOLS(NM, nm)
3109 NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, true)
3110 NCN_STRICT_CHECK_TOOLS(STRIP, strip, true)
3111 NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
3112 NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
3113 NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
3114 NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
3115 NCN_STRICT_CHECK_TOOLS(READELF, readelf)
3116 AC_SUBST(CC)
3117 AC_SUBST(CXX)
3118 AC_SUBST(CFLAGS)
3119 AC_SUBST(CXXFLAGS)
3121 # Target tools.
3122 AC_ARG_WITH([build-time-tools], 
3123   [AS_HELP_STRING([--with-build-time-tools=PATH],
3124                   [use given path to find target tools during the build])],
3125   [case x"$withval" in
3126      x/*) ;;
3127      *)
3128        with_build_time_tools=
3129        AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
3130        ;;
3131    esac],
3132   [with_build_time_tools=])
3134 NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
3135 NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
3136 NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
3137 NCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj)
3138 NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
3139 NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
3141 ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
3142 ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
3143 ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
3144 ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
3145 ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
3146 ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
3147 ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
3148 ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
3149 ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
3150 ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
3151 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
3152 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
3154 RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
3156 GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
3157 GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
3158 GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
3159 dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS
3160 GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
3161                 [gcc/xg++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
3162                 c++)
3163 GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
3164                 [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
3165                 c++)
3166 GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
3167 GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
3168 GCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ,
3169                 [gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java)
3170 GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
3171                 [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
3172 GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
3173                 [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
3174 GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
3175 GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
3176 GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
3177 GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
3178 GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
3179 GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
3180 GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
3181 GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
3182 GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])
3184 AC_SUBST(FLAGS_FOR_TARGET)
3185 AC_SUBST(RAW_CXX_FOR_TARGET)
3187 # Certain tools may need extra flags.
3188 AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
3189 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
3190 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
3192 # When building target libraries, except in a Canadian cross, we use
3193 # the same toolchain as the compiler we just built.
3194 COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
3195 COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
3196 COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
3197 if test $host = $build; then
3198   case " $configdirs " in
3199     *" gcc "*)
3200       COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
3201       COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
3202       COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
3203       ;;
3204   esac
3207 AC_SUBST(COMPILER_AS_FOR_TARGET)
3208 AC_SUBST(COMPILER_LD_FOR_TARGET)
3209 AC_SUBST(COMPILER_NM_FOR_TARGET)
3211 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3212 AC_ARG_ENABLE(maintainer-mode,
3213 [AS_HELP_STRING([--enable-maintainer-mode],
3214                 [enable make rules and dependencies not useful
3215                  (and sometimes confusing) to the casual installer])],
3216       USE_MAINTAINER_MODE=$enableval,
3217       USE_MAINTAINER_MODE=no)
3218 AC_MSG_RESULT($USE_MAINTAINER_MODE)
3219 AC_SUBST(MAINTAINER_MODE_TRUE)
3220 AC_SUBST(MAINTAINER_MODE_FALSE)
3221 if test "$USE_MAINTAINER_MODE" = yes; then
3222   MAINTAINER_MODE_TRUE=
3223   MAINTAINER_MODE_FALSE='#'
3224 else
3225   MAINTAINER_MODE_TRUE='#'
3226   MAINTAINER_MODE_FALSE=
3227 fi      
3228 MAINT=$MAINTAINER_MODE_TRUE
3229 AC_SUBST(MAINT)dnl
3231 # ---------------------
3232 # GCC bootstrap support
3233 # ---------------------
3235 # Stage specific cflags for build.
3236 stage1_cflags="-g"
3237 case $build in
3238   vax-*-*)
3239     case ${GCC} in
3240       yes) stage1_cflags="-g -Wa,-J" ;;
3241       *) stage1_cflags="-g -J" ;;
3242     esac ;;
3243 esac
3245 AC_SUBST(stage1_cflags)
3247 # Enable --enable-checking in stage1 of the compiler.
3248 AC_ARG_ENABLE(stage1-checking,
3249 [AS_HELP_STRING([[--enable-stage1-checking[=all]]],
3250                 [choose additional checking for stage1 of the compiler])],
3251 [stage1_checking=--enable-checking=${enable_stage1_checking}],
3252 [if test "x$enable_checking" = xno || test "x$enable_checking" = x; then
3253   stage1_checking=--enable-checking=yes,types
3254 else
3255   stage1_checking=--enable-checking=$enable_checking,types
3256 fi])
3257 AC_SUBST(stage1_checking)
3259 # Enable -Werror in bootstrap stage2 and later.
3260 AC_ARG_ENABLE(werror,
3261 [AS_HELP_STRING([--enable-werror],
3262                 [enable -Werror in bootstrap stage2 and later])], [],
3263 [if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; then
3264   enable_werror=yes
3265 else
3266   enable_werror=no
3267 fi])
3268 case ${enable_werror} in
3269   yes) stage2_werror_flag="--enable-werror-always" ;;
3270   *) stage2_werror_flag="" ;;
3271 esac
3272 AC_SUBST(stage2_werror_flag)
3274 # Specify what files to not compare during bootstrap.
3276 compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
3277 case "$target" in
3278   hppa*64*-*-hpux*) ;;
3279   hppa*-*-hpux*) compare_exclusions="gcc/cc*-checksum\$(objext) | */libgcc/lib2funcs* | gcc/ada/*tools/*" ;;
3280   powerpc*-ibm-aix*) compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/* | *libgomp*\$(objext)" ;;
3281 esac
3282 AC_SUBST(compare_exclusions)
3284 AC_CONFIG_FILES([Makefile],
3285   [sed "$extrasub_build" Makefile |
3286    sed "$extrasub_host" |
3287    sed "$extrasub_target" > mf$$
3288    mv -f mf$$ Makefile],
3289   [extrasub_build="$extrasub_build"
3290    extrasub_host="$extrasub_host"
3291    extrasub_target="$extrasub_target"])
3292 AC_OUTPUT