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