OSDN Git Service

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