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