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