1214571Sdim#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2214571Sdim#   2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
3214571Sdim#
4214571Sdim# This file is free software; you can redistribute it and/or modify it
5214571Sdim# under the terms of the GNU General Public License as published by
6214571Sdim# the Free Software Foundation; either version 2 of the License, or
7214571Sdim# (at your option) any later version.
8214571Sdim#
9214571Sdim# This program is distributed in the hope that it will be useful, but
10214571Sdim# WITHOUT ANY WARRANTY; without even the implied warranty of
11214571Sdim# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12214571Sdim# General Public License for more details.
13214571Sdim#
14214571Sdim# You should have received a copy of the GNU General Public License
15214571Sdim# along with this program; if not, write to the Free Software
16214571Sdim# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17214571Sdim
18214571Sdim##############################################################################
19214571Sdim### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
20214571Sdim
21214571Sdimsinclude(config/acx.m4)
22214571Sdim
23214571SdimAC_INIT(move-if-change)
24214571SdimAC_PREREQ(2.59)
25214571Sdim
26214571Sdim# Find the build, host, and target systems.
27214571SdimACX_NONCANONICAL_BUILD
28214571SdimACX_NONCANONICAL_HOST
29214571SdimACX_NONCANONICAL_TARGET
30214571Sdim
31214571Sdimdnl Autoconf 2.5x and later will set a default program prefix if
32214571Sdimdnl --target was used, even if it was the same as --host.  Disable
33214571Sdimdnl that behavior.  This must be done before AC_CANONICAL_SYSTEM
34214571Sdimdnl to take effect.
35214571Sdimtest "$host_noncanonical" = "$target_noncanonical" &&
36214571Sdim  test "$program_prefix$program_suffix$program_transform_name" = \
37214571Sdim    NONENONEs,x,x, &&
38214571Sdim  program_transform_name=s,y,y,
39214571Sdim
40214571SdimAC_CANONICAL_SYSTEM
41214571SdimAC_ARG_PROGRAM
42214571Sdim
43214571Sdimm4_pattern_allow([^AS_FOR_TARGET$])dnl
44214571Sdim
45214571Sdim# Get 'install' or 'install-sh' and its variants.
46214571SdimAC_PROG_INSTALL
47214571SdimACX_PROG_LN
48214571SdimAC_PROG_LN_S
49214571Sdim
50214571Sdim### we might need to use some other shell than /bin/sh for running subshells
51214571Sdim### If we are on Windows, search for the shell.  This will permit people
52214571Sdim### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
53214571Sdim### without also having to set CONFIG_SHELL.  This code will work when
54214571Sdim### using bash, which sets OSTYPE.
55214571Sdimcase "${OSTYPE}" in
56214571Sdim*win32*)
57214571Sdim  if test x${CONFIG_SHELL} = x ; then
58214571Sdim    if test ! -f /bin/sh ; then
59214571Sdim      if test x${SHELL} != x && test -f ${SHELL} ; then
60214571Sdim	CONFIG_SHELL=${SHELL}
61214571Sdim	export CONFIG_SHELL
62214571Sdim      else
63214571Sdim	for prog in sh sh.exe bash bash.exe; do
64214571Sdim	  IFS="${IFS=	}"; save_ifs="$IFS"; IFS="${IFS}:"
65214571Sdim	  for dir in $PATH; do
66214571Sdim	    test -z "$dir" && dir=.
67214571Sdim	    if test -f $dir/$prog; then
68214571Sdim	      CONFIG_SHELL=$dir/$prog
69214571Sdim	      export CONFIG_SHELL
70214571Sdim	      break
71214571Sdim	    fi
72214571Sdim	  done
73214571Sdim	  IFS="$save_ifs"
74214571Sdim	  test -n "${CONFIG_SHELL}" && break
75214571Sdim	done
76214571Sdim      fi
77214571Sdim    fi
78214571Sdim  fi
79214571Sdim  ;;
80214571Sdimesac
81214571Sdim
82214571Sdimconfig_shell=${CONFIG_SHELL-/bin/sh}
83214571Sdim
84214571Sdimprogname=$0
85214571Sdim# if PWD already has a value, it is probably wrong.
86214571Sdimif test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
87214571Sdim
88214571Sdim# Export original configure arguments for use by sub-configures.
89214571Sdim# Quote arguments with shell meta charatcers.
90214571SdimTOPLEVEL_CONFIGURE_ARGUMENTS=
91214571Sdimset -- "$progname" "$@"
92214571Sdimfor ac_arg
93214571Sdimdo
94214571Sdim  case "$ac_arg" in
95214571Sdim  *" "*|*"	"*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
96214571Sdim    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
97214571Sdim    # if the argument is of the form -foo=baz, quote the baz part only
98214571Sdim    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
99214571Sdim  *) ;;
100214571Sdim  esac
101214571Sdim  # Add the quoted argument to the list.
102214571Sdim  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
103214571Sdimdone
104214571Sdim# Remove the initial space we just introduced and, as these will be
105214571Sdim# expanded by make, quote '$'.
106214571SdimTOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
107214571SdimAC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
108214571Sdim
109214571Sdimmoveifchange=${srcdir}/move-if-change
110214571Sdim
111214571Sdimsrcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
112214571Sdim
113214571Sdim# We pass INSTALL explicitly to sub-makes.  Make sure that it is not
114214571Sdim# a relative path.
115214571Sdimif test "$INSTALL" = "${srcdir}/install-sh -c"; then
116214571Sdim  INSTALL="${srcpwd}/install-sh -c"
117214571Sdimfi
118214571Sdim
119214571Sdim# Set srcdir to "." if that's what it is.
120214571Sdim# This is important for multilib support.
121214571Sdimpwd=`${PWDCMD-pwd}`
122214571Sdimif test "${pwd}" = "${srcpwd}" ; then
123214571Sdim  srcdir=.
124214571Sdimfi
125214571Sdim
126214571Sdimtopsrcdir=$srcpwd
127214571Sdim
128214571Sdimextra_host_args=
129214571Sdim
130214571Sdim### To add a new directory to the tree, first choose whether it is a target
131214571Sdim### or a host dependent tool.  Then put it into the appropriate list
132214571Sdim### (library or tools, host or target), doing a dependency sort.
133214571Sdim
134214571Sdim# Subdirs will be configured in the order listed in build_configdirs, 
135214571Sdim# configdirs, or target_configdirs; see the serialization section below.
136214571Sdim
137214571Sdim# Dependency sorting is only needed when *configuration* must be done in 
138214571Sdim# a particular order.  In all cases a dependency should be specified in 
139214571Sdim# the Makefile, whether or not it's implicitly specified here.
140214571Sdim
141214571Sdim# Double entries in build_configdirs, configdirs, or target_configdirs may
142214571Sdim# cause circular dependencies and break everything horribly.
143214571Sdim
144214571Sdim# these library is used by various programs built for the build
145214571Sdim# environment
146214571Sdim#
147214571Sdimbuild_libs="build-libiberty"
148214571Sdim
149214571Sdim# these tools are built for the build environment
150214571Sdimbuild_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fixincludes"
151214571Sdim
152214571Sdim# these libraries are used by various programs built for the host environment
153214571Sdim#
154214571Sdimhost_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr"
155214571Sdim
156214571Sdim# these tools are built for the host environment
157214571Sdim# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
158214571Sdim# know that we are building the simulator.
159214571Sdim# binutils, gas and ld appear in that order because it makes sense to run
160214571Sdim# "make check" in that particular order.
161214571Sdimhost_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc 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"
162214571Sdim
163214571Sdim# libgcj represents the runtime libraries only used by gcj.
164214571Sdimlibgcj="target-libffi \
165214571Sdim	target-zlib \
166214571Sdim	target-qthreads \
167214571Sdim	target-libjava"
168214571Sdim
169214571Sdim# these libraries are built for the target environment, and are built after
170214571Sdim# the host libraries and the host tools (which may be a cross compiler)
171214571Sdim#
172214571Sdimtarget_libraries="target-libgcc \
173214571Sdim		target-libiberty \
174214571Sdim		target-libgloss \
175214571Sdim		target-newlib \
176214571Sdim		target-libstdc++-v3 \
177214571Sdim		target-libmudflap \
178214571Sdim		target-libssp \
179214571Sdim		target-libgfortran \
180214571Sdim		target-boehm-gc \
181214571Sdim		${libgcj} \
182214571Sdim		target-libobjc \
183214571Sdim		target-libada \
184214571Sdim		target-libgomp"
185214571Sdim
186214571Sdim# these tools are built using the target libraries, and are intended to
187214571Sdim# run only in the target environment
188214571Sdim#
189214571Sdim# note: any program that *uses* libraries that are in the "target_libraries"
190214571Sdim# list belongs in this list.  those programs are also very likely
191214571Sdim# candidates for the "native_only" list which follows
192214571Sdim#
193214571Sdimtarget_tools="target-examples target-groff target-gperf target-rda"
194214571Sdim
195214571Sdim################################################################################
196214571Sdim
197214571Sdim## All tools belong in one of the four categories, and are assigned above
198214571Sdim## We assign ${configdirs} this way to remove all embedded newlines.  This
199214571Sdim## is important because configure will choke if they ever get through.
200214571Sdim## ${configdirs} is directories we build using the host tools.
201214571Sdim## ${target_configdirs} is directories we build using the target tools.
202214571Sdimconfigdirs=`echo ${host_libs} ${host_tools}`
203214571Sdimtarget_configdirs=`echo ${target_libraries} ${target_tools}`
204214571Sdimbuild_configdirs=`echo ${build_libs} ${build_tools}`
205214571Sdim
206214571Sdim################################################################################
207214571Sdim
208214571Sdimsrcname="gnu development package"
209214571Sdim
210214571Sdim# This gets set non-empty for some net releases of packages.
211214571Sdimappdirs=""
212214571Sdim
213214571Sdim# Define is_cross_compiler to save on calls to 'test'.
214214571Sdimis_cross_compiler=
215214571Sdimif test x"${host}" = x"${target}" ; then
216214571Sdim  is_cross_compiler=no
217214571Sdimelse
218214571Sdim  is_cross_compiler=yes
219214571Sdimfi	
220214571Sdim
221214571Sdim# Find the build and target subdir names.
222214571SdimGCC_TOPLEV_SUBDIRS
223214571Sdim
224214571Sdim# Skipdirs are removed silently.
225214571Sdimskipdirs=
226214571Sdim# Noconfigdirs are removed loudly.
227214571Sdimnoconfigdirs=""
228214571Sdim
229214571Sdimuse_gnu_ld=
230214571Sdim# Make sure we don't let GNU ld be added if we didn't want it.
231214571Sdimif test x$with_gnu_ld = xno ; then
232214571Sdim  use_gnu_ld=no
233214571Sdim  noconfigdirs="$noconfigdirs ld"
234214571Sdimfi
235214571Sdim
236214571Sdimuse_gnu_as=
237214571Sdim# Make sure we don't let GNU as be added if we didn't want it.
238214571Sdimif test x$with_gnu_as = xno ; then
239214571Sdim  use_gnu_as=no
240214571Sdim  noconfigdirs="$noconfigdirs gas"
241214571Sdimfi
242214571Sdim
243214571Sdim# some tools are so dependent upon X11 that if we're not building with X, 
244214571Sdim# it's not even worth trying to configure, much less build, that tool.
245214571Sdim
246214571Sdimcase ${with_x} in
247214571Sdim  yes | "") ;; # the default value for this tree is that X11 is available
248214571Sdim  no)
249214571Sdim    skipdirs="${skipdirs} tk itcl libgui"
250214571Sdim    # We won't be able to build gdbtk without X.
251214571Sdim    enable_gdbtk=no 
252214571Sdim    ;;
253214571Sdim  *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
254214571Sdimesac
255214571Sdim
256214571Sdim# Some tools are only suitable for building in a "native" situation.
257214571Sdim# Remove these if host!=target.  
258214571Sdimnative_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"
259214571Sdim
260214571Sdim# Similarly, some are only suitable for cross toolchains.
261214571Sdim# Remove these if host=target.
262214571Sdimcross_only="target-libgloss target-newlib target-opcodes"
263214571Sdim
264214571Sdimcase $is_cross_compiler in
265214571Sdim  no) skipdirs="${skipdirs} ${cross_only}" ;;
266214571Sdim  yes) skipdirs="${skipdirs} ${native_only}" ;;
267214571Sdimesac
268214571Sdim
269214571Sdim# If both --with-headers and --with-libs are specified, default to
270214571Sdim# --without-newlib.
271214571Sdimif test x"${with_headers}" != x && test x"${with_headers}" != xno \
272214571Sdim   && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
273214571Sdim  if test x"${with_newlib}" = x ; then
274214571Sdim    with_newlib=no
275214571Sdim  fi
276214571Sdimfi
277214571Sdim
278214571Sdim# Recognize --with-newlib/--without-newlib.
279214571Sdimcase ${with_newlib} in
280214571Sdim  no) skipdirs="${skipdirs} target-newlib" ;;
281214571Sdim  yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
282214571Sdimesac
283214571Sdim
284214571Sdim# Configure extra directories which are host specific
285214571Sdim
286214571Sdimcase "${host}" in
287214571Sdim  *-cygwin*)
288214571Sdim    configdirs="$configdirs libtermcap" ;;
289214571Sdimesac
290214571Sdim
291214571Sdim# A target can indicate whether a language isn't supported for some reason.
292214571Sdim# Only spaces may be used in this macro; not newlines or tabs.
293214571Sdimunsupported_languages=
294214571Sdim
295214571Sdim# Remove more programs from consideration, based on the host or 
296214571Sdim# target this usually means that a port of the program doesn't
297214571Sdim# exist yet.
298214571Sdim
299214571Sdimcase "${host}" in
300214571Sdim  hppa*64*-*-*)
301214571Sdim    noconfigdirs="$noconfigdirs byacc"
302214571Sdim    ;;
303214571Sdim  i[[3456789]]86-*-vsta)
304214571Sdim    noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl gnuserv gettext"
305214571Sdim    ;;
306214571Sdim  i[[3456789]]86-*-go32* | i[[3456789]]86-*-msdosdjgpp*)
307214571Sdim    noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl gnuserv libffi"
308214571Sdim    ;;
309214571Sdim  x86_64-*-mingw*)
310214571Sdim    noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool newlib"
311214571Sdim    ;;
312214571Sdim  i[[3456789]]86-*-mingw32*)
313214571Sdim    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl gnuserv"
314214571Sdim    noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool newlib"
315214571Sdim    ;;
316214571Sdim  i[[3456789]]86-*-beos*)
317214571Sdim    noconfigdirs="$noconfigdirs tk itcl libgui gdb"
318214571Sdim    ;;
319214571Sdim  *-*-cygwin*)
320214571Sdim    noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl"
321214571Sdim    ;;
322214571Sdim  *-*-netbsd*)
323214571Sdim    noconfigdirs="$noconfigdirs rcs"
324214571Sdim    ;;
325214571Sdim  ppc*-*-pe)
326214571Sdim    noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl gnuserv"
327214571Sdim    ;;
328214571Sdim  powerpc-*-beos*)
329214571Sdim    noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline"
330214571Sdim    ;;
331214571Sdimesac
332214571Sdim
333214571Sdim
334214571SdimAC_ARG_ENABLE(libada,
335214571Sdim[  --enable-libada        Builds libada directory],
336214571SdimENABLE_LIBADA=$enableval,
337214571SdimENABLE_LIBADA=yes)
338214571Sdimif test "${ENABLE_LIBADA}" != "yes" ; then
339214571Sdim  noconfigdirs="$noconfigdirs gnattools"
340214571Sdimfi
341214571Sdim
342214571SdimAC_ARG_ENABLE(libssp,
343214571Sdim[  --enable-libssp        Builds libssp directory],
344214571SdimENABLE_LIBSSP=$enableval,
345214571SdimENABLE_LIBSSP=yes)
346214571Sdim
347214571Sdim# Save it here so that, even in case of --enable-libgcj, if the Java
348214571Sdim# front-end isn't enabled, we still get libgcj disabled.
349214571Sdimlibgcj_saved=$libgcj
350214571Sdimcase $enable_libgcj in
351214571Sdimyes)
352214571Sdim  # If we reset it here, it won't get added to noconfigdirs in the
353214571Sdim  # target-specific build rules, so it will be forcibly enabled
354214571Sdim  # (unless the Java language itself isn't enabled).
355214571Sdim  libgcj=
356214571Sdim  ;;
357214571Sdimno)
358214571Sdim  # Make sure we get it printed in the list of not supported target libs.
359214571Sdim  noconfigdirs="$noconfigdirs ${libgcj}"
360214571Sdim  ;;
361214571Sdimesac
362214571Sdim
363214571Sdim
364214571Sdim# Disable libmudflap on some systems.
365214571Sdimif test x$enable_libmudflap = x ; then
366214571Sdim    case "${target}" in
367214571Sdim    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc* | *-*-uclinux*)
368214571Sdim        # Enable libmudflap by default in GNU and friends.
369214571Sdim	;;
370214571Sdim    *-*-freebsd*)
371214571Sdim        # Enable libmudflap by default in FreeBSD.
372214571Sdim	;;
373214571Sdim    *)
374214571Sdim        # Disable it by default everywhere else.
375214571Sdim	noconfigdirs="$noconfigdirs target-libmudflap"
376214571Sdim	;;
377214571Sdim    esac
378214571Sdimfi
379214571Sdim
380214571Sdim# Disable libgomp on non POSIX hosted systems.
381214571Sdimif test x$enable_libgomp = x ; then
382214571Sdim    # Enable libgomp by default on hosted POSIX systems.
383214571Sdim    case "${target}" in
384214571Sdim    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
385214571Sdim	;;
386214571Sdim    *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
387214571Sdim	;;
388214571Sdim    *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
389214571Sdim	;;
390214571Sdim    *-*-darwin* | *-*-aix*)
391214571Sdim	;;
392214571Sdim    *)
393214571Sdim	noconfigdirs="$noconfigdirs target-libgomp"
394214571Sdim	;;
395214571Sdim    esac
396214571Sdimfi
397214571Sdim
398214571Sdim
399214571Sdimcase "${target}" in
400214571Sdim  *-*-chorusos)
401214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
402214571Sdim    ;;
403214571Sdim  powerpc-*-darwin* | i[[3456789]]86-*-darwin*)
404214571Sdim    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
405214571Sdim    noconfigdirs="$noconfigdirs sim target-rda"
406214571Sdim    ;;
407214571Sdim  *-*-darwin*)
408214571Sdim    noconfigdirs="$noconfigdirs ld gas gdb gprof"
409214571Sdim    noconfigdirs="$noconfigdirs sim target-rda"
410214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
411214571Sdim    ;;
412214571Sdim  *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
413214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
414214571Sdim    ;;
415214571Sdim  *-*-freebsd*)
416214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
417214571Sdim    if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \
418214571Sdim	&& test -f /usr/local/include/gmp.h; then
419214571Sdim      with_gmp=/usr/local
420214571Sdim    fi
421214571Sdim
422214571Sdim    # Skip some stuff that's unsupported on some FreeBSD configurations.
423214571Sdim    case "${target}" in
424214571Sdim      i*86-*-*) ;;
425214571Sdim      alpha*-*-*) ;;
426214571Sdim      *)
427214571Sdim	noconfigdirs="$noconfigdirs ${libgcj}"
428214571Sdim	;;
429214571Sdim    esac
430214571Sdim    ;;
431214571Sdim  *-*-kaos*)
432214571Sdim    # Remove unsupported stuff on all kaOS configurations.
433214571Sdim    skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-librx"
434214571Sdim    skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf"
435214571Sdim    skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib"
436214571Sdim    noconfigdirs="$noconfigdirs target-libgloss"
437214571Sdim    ;;
438214571Sdim  *-*-netbsd*)
439214571Sdim    # Skip some stuff on all NetBSD configurations.
440214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
441214571Sdim
442214571Sdim    # Skip some stuff that's unsupported on some NetBSD configurations.
443214571Sdim    case "${target}" in
444214571Sdim      i*86-*-netbsdelf*) ;;
445214571Sdim      arm*-*-netbsdelf*) ;;
446214571Sdim      *)
447214571Sdim	noconfigdirs="$noconfigdirs ${libgcj}"
448214571Sdim	;;
449214571Sdim    esac
450214571Sdim    ;;
451214571Sdim  *-*-netware*)
452214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss ${libgcj} target-libmudflap"
453214571Sdim    ;;
454214571Sdim  *-*-rtems*)
455214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
456214571Sdim    ;;
457214571Sdim    # The tpf target doesn't support gdb yet.
458214571Sdim  *-*-tpf*)
459214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj} target-libmudflap gdb tcl tk libgui itcl"
460214571Sdim    ;;
461214571Sdim  *-*-uclinux*)
462214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
463214571Sdim    ;;
464214571Sdim  *-*-vxworks*)
465214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
466214571Sdim    ;;
467214571Sdim  alpha*-dec-osf*)
468214571Sdim    # ld works, but does not support shared libraries.
469214571Sdim    # newlib is not 64 bit ready.  I'm not sure about fileutils.
470214571Sdim    # gas doesn't generate exception information.
471214571Sdim    noconfigdirs="$noconfigdirs gas ld fileutils target-newlib target-libgloss"
472214571Sdim    ;;
473214571Sdim  alpha*-*-*vms*)
474214571Sdim    noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss ${libgcj}"
475214571Sdim    ;;
476214571Sdim  alpha*-*-linux*)
477214571Sdim    # newlib is not 64 bit ready
478214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
479214571Sdim    ;;
480214571Sdim  alpha*-*-*)
481214571Sdim    # newlib is not 64 bit ready
482214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
483214571Sdim    ;;
484214571Sdim  am33_2.0-*-linux*)
485214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
486214571Sdim    ;;
487214571Sdim  sh-*-linux*)
488214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
489214571Sdim    ;;    
490214571Sdim  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
491214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
492214571Sdim    noconfigdirs="$noconfigdirs target-examples"
493214571Sdim    noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
494214571Sdim    noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
495214571Sdim    noconfigdirs="$noconfigdirs expect dejagnu"
496214571Sdim    # the C++ libraries don't build on top of CE's C libraries
497214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3"
498214571Sdim    noconfigdirs="$noconfigdirs target-newlib"
499214571Sdim    case "${host}" in
500214571Sdim      *-*-cygwin*) ;; # keep gdb and readline
501214571Sdim      *) noconfigdirs="$noconfigdirs gdb readline"
502214571Sdim	 ;;
503214571Sdim    esac
504214571Sdim    ;;
505214571Sdim  arc-*-*)
506214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
507214571Sdim    ;;
508214571Sdim  arm-semi-aof )
509214571Sdim    ;;
510214571Sdim  arm-*-coff | strongarm-*-coff | xscale-*-coff)
511214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
512214571Sdim    ;;
513214571Sdim  arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
514214571Sdim    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
515214571Sdim    ;;
516214571Sdim  arm*-*-linux-gnueabi)
517214571Sdim    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
518214571Sdim    noconfigdirs="$noconfigdirs target-libjava target-libobjc"
519214571Sdim    case ${with_newlib} in
520214571Sdim      no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
521214571Sdim    esac
522214571Sdim    ;;
523214571Sdim  arm*-*-symbianelf*)
524214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} target-libiberty"
525214571Sdim    ;;
526214571Sdim  arm-*-pe*)
527214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
528214571Sdim    ;;
529214571Sdim  thumb-*-coff)
530214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
531214571Sdim    ;;
532214571Sdim  thumb-*-elf)
533214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
534214571Sdim    ;;
535214571Sdim  thumb-*-pe)
536214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
537214571Sdim    ;;
538214571Sdim  arm-*-riscix*)
539214571Sdim    noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
540214571Sdim    ;;
541214571Sdim  avr-*-*)
542214571Sdim    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
543214571Sdim    ;;
544214571Sdim  bfin-*-*)
545214571Sdim    noconfigdirs="$noconfigdirs gdb"
546214571Sdim    if test x${is_cross_compiler} != xno ; then
547214571Sdim      target_configdirs="${target_configdirs} target-bsp target-cygmon"
548214571Sdim    fi
549214571Sdim    ;;
550214571Sdim  c4x-*-* | tic4x-*-*)
551214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
552214571Sdim    ;;
553214571Sdim  c54x*-*-* | tic54x-*-*)
554214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib"
555214571Sdim    ;;
556214571Sdim  cris-*-* | crisv32-*-*)
557214571Sdim    unsupported_languages="$unsupported_languages java"
558214571Sdim    case "${target}" in
559214571Sdim      *-*-aout)
560214571Sdim	unsupported_languages="$unsupported_languages fortran"
561214571Sdim	noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";;
562214571Sdim      *-*-elf)
563214571Sdim	unsupported_languages="$unsupported_languages fortran"
564214571Sdim	noconfigdirs="$noconfigdirs target-boehm-gc";;
565214571Sdim      *-*-linux*)
566214571Sdim	noconfigdirs="$noconfigdirs target-newlib target-libgloss";;
567214571Sdim      *)
568214571Sdim	unsupported_languages="$unsupported_languages fortran"
569214571Sdim	noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss";;
570214571Sdim    esac
571214571Sdim    ;;
572214571Sdim  crx-*-*)
573214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}"
574214571Sdim    ;;
575214571Sdim  d10v-*-*)
576214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
577214571Sdim    ;;
578214571Sdim  d30v-*-*)
579214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} gdb"
580214571Sdim    ;;
581214571Sdim  fr30-*-elf*)
582214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} gdb"
583214571Sdim    ;;
584214571Sdim  frv-*-*)
585214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
586214571Sdim    ;;
587214571Sdim  h8300*-*-*)
588214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
589214571Sdim    ;;
590214571Sdim  h8500-*-*)
591214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
592214571Sdim    ;;
593214571Sdim  hppa1.1-*-osf* | hppa1.1-*-bsd* )
594214571Sdim    ;;
595214571Sdim  hppa*64*-*-linux* | parisc*64*-*-linux*)
596214571Sdim    # In this case, it's because the hppa64-linux target is for
597214571Sdim    # the kernel only at this point and has no libc, and thus no
598214571Sdim    # headers, crt*.o, etc., all of which are needed by these.
599214571Sdim    noconfigdirs="$noconfigdirs target-zlib"
600214571Sdim    ;;
601214571Sdim  parisc*-*-linux* | hppa*-*-linux*)
602214571Sdim    ;;
603214571Sdim  hppa*-*-*elf* | \
604214571Sdim  hppa*-*-lites* | \
605214571Sdim  hppa*-*-openbsd* | \
606214571Sdim  hppa*64*-*-*)
607214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
608214571Sdim    ;;
609214571Sdim  hppa*-hp-hpux11*)
610214571Sdim    noconfigdirs="$noconfigdirs ld shellutils"
611214571Sdim    ;;
612214571Sdim  hppa*-*-*)
613214571Sdim    # According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
614214571Sdim    # build on HP-UX 10.20.
615214571Sdim    noconfigdirs="$noconfigdirs ld shellutils ${libgcj}"
616214571Sdim    ;;
617214571Sdim  i960-*-*)
618214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} gdb"
619214571Sdim    ;;
620214571Sdim  ia64*-*-elf*)
621214571Sdim    # No gdb support yet.
622214571Sdim    noconfigdirs="$noconfigdirs readline mmalloc libgui itcl gdb"
623214571Sdim    ;;
624214571Sdim  ia64*-**-hpux*)
625214571Sdim    # No gdb or ld support yet.
626214571Sdim    noconfigdirs="$noconfigdirs ${libgcj} readline mmalloc libgui itcl gdb ld"
627214571Sdim    ;;
628214571Sdim  i370-*-opened*)
629214571Sdim    ;;
630214571Sdim  i[[3456789]]86-*-coff | i[[3456789]]86-*-elf)
631214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
632214571Sdim    ;;
633214571Sdim  i[[3456789]]86-*-linux*)
634214571Sdim    # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
635214571Sdim    # not build java stuff by default.
636214571Sdim    case "${target}" in
637214571Sdim      *-*-*libc1*)
638214571Sdim	noconfigdirs="$noconfigdirs ${libgcj}";;
639214571Sdim    esac
640214571Sdim
641214571Sdim    # This section makes it possible to build newlib natively on linux.
642214571Sdim    # If we are using a cross compiler then don't configure newlib.
643214571Sdim    if test x${is_cross_compiler} != xno ; then
644214571Sdim      noconfigdirs="$noconfigdirs target-newlib"
645214571Sdim    fi
646214571Sdim    noconfigdirs="$noconfigdirs target-libgloss"
647214571Sdim    # If we are not using a cross compiler, do configure newlib.
648214571Sdim    # Note however, that newlib will only be configured in this situation
649214571Sdim    # if the --with-newlib option has been given, because otherwise
650214571Sdim    # 'target-newlib' will appear in skipdirs.
651214571Sdim    ;;
652214571Sdim  i[[3456789]]86-*-mingw32*)
653214571Sdim    target_configdirs="$target_configdirs target-winsup"
654214571Sdim    noconfigdirs="$noconfigdirs expect target-libgloss target-newlib ${libgcj}"
655214571Sdim    ;;    
656214571Sdim  x86_64-*-mingw*)
657214571Sdim    target_configdirs="$target_configdirs target-winsup"
658214571Sdim    noconfigdirs="$noconfigdirs expect target-libgloss target-newlib ${libgcj}"
659214571Sdim    ;;    
660214571Sdim  *-*-cygwin*)
661214571Sdim    target_configdirs="$target_configdirs target-libtermcap target-winsup"
662214571Sdim    noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
663214571Sdim    # always build newlib if winsup directory is present.
664214571Sdim    if test -d "$srcdir/winsup/cygwin"; then
665214571Sdim      skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
666214571Sdim    elif test -d "$srcdir/newlib"; then
667214571Sdim      echo "Warning: winsup/cygwin is missing so newlib can't be built."
668214571Sdim    fi
669214571Sdim    ;;    
670214571Sdim  i[[3456789]]86-moss-msdos | i[[3456789]]86-*-moss* | \
671214571Sdim  i[[3456789]]86-*-uwin* | i[[3456789]]86-*-interix* )
672214571Sdim    ;;
673214571Sdim  i[[3456789]]86-*-pe)
674214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
675214571Sdim    ;;
676214571Sdim  i[[3456789]]86-*-sco3.2v5*)
677214571Sdim    # The linker does not yet know about weak symbols in COFF,
678214571Sdim    # and is not configured to handle mixed ELF and COFF.
679214571Sdim    noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
680214571Sdim    ;;
681214571Sdim  i[[3456789]]86-*-sco*)
682214571Sdim    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
683214571Sdim    ;;
684214571Sdim  i[[3456789]]86-*-solaris2*)
685214571Sdim    noconfigdirs="$noconfigdirs target-libgloss"
686214571Sdim    ;;
687214571Sdim  i[[3456789]]86-*-sysv4*)
688214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
689214571Sdim    ;;
690214571Sdim  i[[3456789]]86-*-beos*)
691214571Sdim    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
692214571Sdim    ;;
693214571Sdim  i[[3456789]]86-*-rdos*)
694214571Sdim    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
695214571Sdim    ;;
696214571Sdim  m32r-*-*)
697214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
698214571Sdim    ;;
699214571Sdim  m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
700214571Sdim    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
701214571Sdim    ;;
702214571Sdim  m68k-*-elf*)
703214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
704214571Sdim    ;;
705214571Sdim  m68k-*-coff*)
706214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
707214571Sdim    ;;
708214571Sdim  mcore-*-pe*)
709214571Sdim  # The EPOC C++ environment does not support exceptions or rtti,
710214571Sdim  # and so building libstdc++-v3 tends not to always work.
711214571Sdim    noconfigdirs="$noconfigdirs target-libstdc++-v3"
712214571Sdim    ;;
713214571Sdim  mmix-*-*)
714214571Sdim    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb libgloss"
715214571Sdim    unsupported_languages="$unsupported_languages fortran java"
716214571Sdim    ;;
717214571Sdim  mn10200-*-*)
718214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
719214571Sdim    ;;
720214571Sdim  mn10300-*-*)
721214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
722214571Sdim    ;;
723214571Sdim  mt-*-*)
724214571Sdim    noconfigdirs="$noconfigdirs sim"
725214571Sdim    ;;
726214571Sdim  powerpc-*-aix*)
727214571Sdim    # copied from rs6000-*-* entry
728214571Sdim    noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}"
729214571Sdim    ;;
730214571Sdim  powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
731214571Sdim    target_configdirs="$target_configdirs target-winsup"
732214571Sdim    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl gnuserv ${libgcj}"
733214571Sdim    # always build newlib.
734214571Sdim    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
735214571Sdim    ;;
736214571Sdim    # This is temporary until we can link against shared libraries
737214571Sdim  powerpcle-*-solaris*)
738214571Sdim    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl gnuserv ${libgcj}"
739214571Sdim    ;;
740214571Sdim  powerpc-*-beos*)
741214571Sdim    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
742214571Sdim    ;;
743214571Sdim  powerpc-*-eabi)
744214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
745214571Sdim    ;;
746214571Sdim  powerpc-*-eabi* | powerpcle-*-eabi* | powerpc-*-rtems* )
747214571Sdim    ;;
748214571Sdim  rs6000-*-lynxos*)
749214571Sdim    noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}"
750214571Sdim    ;;
751214571Sdim  rs6000-*-aix*)
752214571Sdim    noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}"
753214571Sdim    ;;
754214571Sdim  rs6000-*-*)
755214571Sdim    noconfigdirs="$noconfigdirs gprof ${libgcj}"
756214571Sdim    ;;
757214571Sdim  m68k-apollo-*)
758214571Sdim    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
759214571Sdim    ;;
760214571Sdim  mips*-*-irix5*)
761214571Sdim    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
762214571Sdim    ;;
763214571Sdim  mips*-*-irix6*)
764214571Sdim    # Linking libjava exceeds command-line length limits on at least
765214571Sdim    # IRIX 6.2, but not on IRIX 6.5.
766214571Sdim    # Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
767214571Sdim    # <oldham@codesourcery.com>
768214571Sdim    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
769214571Sdim    ;;
770214571Sdim  mips*-*-bsd*)
771214571Sdim    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
772214571Sdim    ;;
773214571Sdim  mips64*-*-linux*)
774214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
775214571Sdim    ;;
776214571Sdim  mips*-*-linux*)
777214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
778214571Sdim    ;;
779214571Sdim  mips*-*-*)
780214571Sdim    noconfigdirs="$noconfigdirs gprof ${libgcj}"
781214571Sdim    ;;
782214571Sdim  romp-*-*)
783214571Sdim    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
784214571Sdim    ;;
785214571Sdim  sh-*-* | sh64-*-*)
786214571Sdim    case "${host}" in
787214571Sdim      i[[3456789]]86-*-vsta) ;; # don't add gprof back in
788214571Sdim      i[[3456789]]86-*-go32*) ;; # don't add gprof back in
789214571Sdim      i[[3456789]]86-*-msdosdjgpp*) ;; # don't add gprof back in
790214571Sdim      *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
791214571Sdim    esac
792214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
793214571Sdim    ;;
794214571Sdim  sparc-*-elf*)
795214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
796214571Sdim    ;;
797214571Sdim  sparc64-*-elf*)
798214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
799214571Sdim    ;;
800214571Sdim  sparclite-*-*)
801214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
802214571Sdim    ;;
803214571Sdim  sparc-*-sunos4*)
804214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
805214571Sdim    if test x${is_cross_compiler} != xno ; then
806214571Sdim           noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
807214571Sdim    else
808214571Sdim           use_gnu_ld=no
809214571Sdim    fi
810214571Sdim    ;;
811214571Sdim  sparc-*-solaris2.[[0-6]] | sparc-*-solaris2.[[0-6]].*)
812214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
813214571Sdim    ;;
814214571Sdim  sparc-*-solaris* | sparc64-*-solaris* | sparcv9-*-solaris*)
815214571Sdim    ;;
816214571Sdim  spu-*-*)
817214571Sdim    skipdirs="target-libssp"
818214571Sdim    ;;
819214571Sdim  v810-*-*)
820214571Sdim    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libstdc++-v3 opcodes target-libgloss ${libgcj}"
821214571Sdim    ;;
822214571Sdim  v850-*-*)
823214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
824214571Sdim    ;;
825214571Sdim  v850e-*-*)
826214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
827214571Sdim    ;;
828214571Sdim  v850ea-*-*)
829214571Sdim    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
830214571Sdim    ;;
831214571Sdim  vax-*-vms)
832214571Sdim    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss ${libgcj}"
833214571Sdim    ;;
834214571Sdim  vax-*-*)
835214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
836214571Sdim    ;;
837214571Sdim  xtensa-*-*)
838214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
839214571Sdim    ;;
840214571Sdim  ip2k-*-*)
841214571Sdim    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
842214571Sdim    ;;
843214571Sdim  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
844214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
845214571Sdim    ;;
846214571Sdim  *-*-lynxos*)
847214571Sdim    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
848214571Sdim    ;; 
849214571Sdim  *-*-*)
850214571Sdim    noconfigdirs="$noconfigdirs ${libgcj}"
851214571Sdim    ;;
852214571Sdimesac
853214571Sdim
854214571Sdim# If we aren't building newlib, then don't build libgloss, since libgloss
855214571Sdim# depends upon some newlib header files.
856214571Sdimcase "${noconfigdirs}" in
857214571Sdim  *target-libgloss*) ;;
858214571Sdim  *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
859214571Sdimesac
860214571Sdim
861214571Sdim# Work in distributions that contain no compiler tools, like Autoconf.
862214571Sdimtentative_cc=""
863214571Sdimhost_makefile_frag=/dev/null
864214571Sdimif test -d ${srcdir}/config ; then
865214571Sdimcase "${host}" in
866214571Sdim  m68k-hp-hpux*)
867214571Sdim    # Avoid "too much defining" errors from HPUX compiler.
868214571Sdim    tentative_cc="cc -Wp,-H256000"
869214571Sdim    # If "ar" in $PATH is GNU ar, the symbol table may need rebuilding.
870214571Sdim    # If it's HP/UX ar, this should be harmless.
871214571Sdim    RANLIB="ar ts"
872214571Sdim    ;;
873214571Sdim  m68k-apollo-sysv*)
874214571Sdim    tentative_cc="cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG"
875214571Sdim    ;;
876214571Sdim  m68k-apollo-bsd*)
877214571Sdim    #None of the Apollo compilers can compile gas or binutils.  The preprocessor
878214571Sdim    # chokes on bfd, the compiler won't let you assign integers to enums, and
879214571Sdim    # other problems.  Defining CC to gcc is a questionable way to say "don't use
880214571Sdim    # the apollo compiler" (the preferred version of GCC could be called cc,
881214571Sdim    # or whatever), but I'm not sure leaving CC as cc is any better...
882214571Sdim    #CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG
883214571Sdim    # Used to have BISON=yacc.
884214571Sdim    tentative_cc=gcc
885214571Sdim    ;;
886214571Sdim  m88k-dg-dgux*)
887214571Sdim    tentative_cc="gcc -Wall -ansi -D__using_DGUX"
888214571Sdim    ;;
889214571Sdim  m88k-harris-cxux*)
890214571Sdim    # Under CX/UX, we want to tell the compiler to use ANSI mode.
891214571Sdim    tentative_cc="cc -Xa"
892214571Sdim    host_makefile_frag="config/mh-cxux"
893214571Sdim    ;;
894214571Sdim  m88k-motorola-sysv*)
895214571Sdim    ;;
896214571Sdim  mips*-dec-ultrix*)
897214571Sdim    tentative_cc="cc -Wf,-XNg1000"
898214571Sdim    host_makefile_frag="config/mh-decstation"
899214571Sdim    ;;
900214571Sdim  mips*-nec-sysv4*)
901214571Sdim    # The C compiler on NEC MIPS SVR4 needs bigger tables.
902214571Sdim    tentative_cc="cc -ZXNd=5000 -ZXNg=1000"
903214571Sdim    host_makefile_frag="config/mh-necv4"
904214571Sdim    ;;
905214571Sdim  mips*-sgi-irix4*)
906214571Sdim    # Tell compiler to use K&R C.  We can't compile under the SGI Ansi
907214571Sdim    # environment.  Also bump switch table size so that cp-parse will
908214571Sdim    # compile.  Bump string length limit so linker builds.
909214571Sdim    tentative_cc="cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192"
910214571Sdim    ;;
911214571Sdim  mips*-*-sysv4*)
912214571Sdim    host_makefile_frag="config/mh-sysv4"
913214571Sdim    ;;
914214571Sdim  mips*-*-sysv*)
915214571Sdim    # This is for a MIPS running RISC/os 4.52C.
916214571Sdim
917214571Sdim    # This is needed for GDB, but needs to be in the top-level make because
918214571Sdim    # if a library is compiled with the bsd headers and gets linked with the
919214571Sdim    # sysv system libraries all hell can break loose (e.g. a jmp_buf might be
920214571Sdim    # a different size).
921214571Sdim    # ptrace(2) apparently has problems in the BSD environment.  No workaround is
922214571Sdim    # known except to select the sysv environment.  Could we use /proc instead?
923214571Sdim    # These "sysv environments" and "bsd environments" often end up being a pain.
924214571Sdim    #
925214571Sdim    # This is not part of CFLAGS because perhaps not all C compilers have this
926214571Sdim    # option.
927214571Sdim    tentative_cc="cc -systype sysv"
928214571Sdim    ;;
929214571Sdim  i370-ibm-opened*)
930214571Sdim    tentative_cc="c89"
931214571Sdim    ;;
932214571Sdim  i[[3456789]]86-*-sysv5*)
933214571Sdim    host_makefile_frag="config/mh-sysv5"
934214571Sdim    ;;
935214571Sdim  i[[3456789]]86-*-dgux*)
936214571Sdim    tentative_cc="gcc -Wall -ansi -D__using_DGUX"
937214571Sdim    host_makefile_frag="config/mh-dgux386"
938214571Sdim    ;;
939214571Sdim  i[[3456789]]86-ncr-sysv4.3*)
940214571Sdim    # The MetaWare compiler will generate a copyright message unless you
941214571Sdim    # turn it off by adding the -Hnocopyr flag.
942214571Sdim    tentative_cc="cc -Hnocopyr"
943214571Sdim    ;;
944214571Sdim  i[[3456789]]86-ncr-sysv4*)
945214571Sdim    # for an NCR 3000 (i486/SVR4) system.
946214571Sdim    # The NCR 3000 ships with a MetaWare compiler installed as /bin/cc.
947214571Sdim    # This compiler not only emits obnoxious copyright messages every time
948214571Sdim    # you run it, but it chokes and dies on a whole bunch of GNU source
949214571Sdim    # files.  Default to using the AT&T compiler installed in /usr/ccs/ATT/cc.
950214571Sdim    tentative_cc="/usr/ccs/ATT/cc"
951214571Sdim    host_makefile_frag="config/mh-ncr3000"
952214571Sdim    ;;
953214571Sdim  i[[3456789]]86-*-sco3.2v5*)
954214571Sdim    ;;
955214571Sdim  i[[3456789]]86-*-sco*)
956214571Sdim    # The native C compiler botches some simple uses of const.  Unfortunately,
957214571Sdim    # it doesn't defined anything like "__sco__" for us to test for in ansidecl.h.
958214571Sdim    tentative_cc="cc -Dconst="
959214571Sdim    host_makefile_frag="config/mh-sco"
960214571Sdim    ;;
961214571Sdim  i[[3456789]]86-*-udk*)
962214571Sdim    host_makefile_frag="config/mh-sysv5"
963214571Sdim    ;;
964214571Sdim  i[[3456789]]86-*-solaris2*)
965214571Sdim    host_makefile_frag="config/mh-sysv4"
966214571Sdim    ;;
967214571Sdim  i[[3456789]]86-*-msdosdjgpp*)
968214571Sdim    host_makefile_frag="config/mh-djgpp"
969214571Sdim    ;;
970214571Sdim  *-cygwin*)
971214571Sdim    host_makefile_frag="config/mh-cygwin"
972214571Sdim    ;;
973214571Sdim  *-mingw32*)
974214571Sdim    ;;
975214571Sdim  *-mingw64*)
976214571Sdim    ;;
977214571Sdim  *-interix*)
978214571Sdim    host_makefile_frag="config/mh-interix"
979214571Sdim    ;;
980214571Sdim  vax-*-ultrix2*)
981214571Sdim    # The old BSD pcc isn't up to compiling parts of gdb so use gcc
982214571Sdim    tentative_cc=gcc
983214571Sdim    ;;
984214571Sdim  *-*-solaris2*)
985214571Sdim    host_makefile_frag="config/mh-solaris"
986214571Sdim    ;;
987214571Sdim  m68k-sun-sunos*)
988214571Sdim    # Sun's C compiler needs the -J flag to be able to compile cp-parse.c
989214571Sdim    # without overflowing the jump tables (-J says to use a 32 bit table)
990214571Sdim    tentative_cc="cc -J"
991214571Sdim    ;;
992214571Sdim  *-hp-hpux*)
993214571Sdim    tentative_cc="cc -Wp,-H256000"
994214571Sdim    ;;
995214571Sdim  *-*-hiux*)
996214571Sdim    tentative_cc="cc -Wp,-H256000"
997214571Sdim    ;;
998214571Sdim  rs6000-*-lynxos*)
999214571Sdim    # /bin/cc is less than useful for our purposes.  Always use GCC
1000214571Sdim    tentative_cc="/usr/cygnus/progressive/bin/gcc"
1001214571Sdim    host_makefile_frag="config/mh-lynxrs6k"
1002214571Sdim    ;;
1003214571Sdim  powerpc-*-darwin*)
1004214571Sdim    host_makefile_frag="config/mh-ppc-darwin"
1005214571Sdim    ;;
1006214571Sdim  powerpc-*-aix*)
1007214571Sdim    host_makefile_frag="config/mh-ppc-aix"
1008214571Sdim    ;;
1009214571Sdim  rs6000-*-aix*)
1010214571Sdim    host_makefile_frag="config/mh-ppc-aix"
1011214571Sdim    ;;
1012214571Sdim  *-*-lynxos*)
1013214571Sdim    # /bin/cc is less than useful for our purposes.  Always use GCC
1014214571Sdim    tentative_cc="/bin/gcc"
1015214571Sdim    ;;
1016214571Sdim  *-*-sysv4*)
1017214571Sdim    host_makefile_frag="config/mh-sysv4"
1018214571Sdim    ;;
1019214571Sdim  # This is placed last to prevent interfering with the cases above.
1020214571Sdim  i[[3456789]]86-*-*)
1021214571Sdim    # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
1022214571Sdim    host_makefile_frag="config/mh-x86omitfp"
1023214571Sdim    ;;
1024214571Sdimesac
1025214571Sdimfi
1026214571Sdim
1027214571Sdim# If we aren't going to be using gcc, see if we can extract a definition
1028214571Sdim# of CC from the fragment.
1029214571Sdim# Actually, use the 'pre-extracted' version above.
1030214571Sdimif test -z "${CC}" && test "${build}" = "${host}" ; then
1031214571Sdim  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1032214571Sdim  found=
1033214571Sdim  for dir in $PATH; do
1034214571Sdim    test -z "$dir" && dir=.
1035214571Sdim    if test -f $dir/gcc; then
1036214571Sdim      found=yes
1037214571Sdim      break
1038214571Sdim    fi
1039214571Sdim  done
1040214571Sdim  IFS="$save_ifs"
1041214571Sdim  if test -z "${found}" && test -n "${tentative_cc}" ; then
1042214571Sdim    CC=$tentative_cc
1043214571Sdim  fi
1044214571Sdimfi
1045214571Sdim
1046214571Sdimif test "${build}" != "${host}" ; then
1047214571Sdim  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
1048214571Sdimelse
1049214571Sdim  CC_FOR_BUILD="\$(CC)"
1050214571Sdimfi
1051214571Sdim
1052214571SdimAC_PROG_CC
1053214571SdimAC_PROG_CXX
1054214571Sdim
1055214571Sdim# We must set the default linker to the linker used by gcc for the correct
1056214571Sdim# operation of libtool.  If LD is not defined and we are using gcc, try to
1057214571Sdim# set the LD default to the ld used by gcc.
1058214571Sdimif test -z "$LD"; then
1059214571Sdim  if test "$GCC" = yes; then
1060214571Sdim    case $build in
1061214571Sdim    *-*-mingw*)
1062214571Sdim      gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
1063214571Sdim    *)
1064214571Sdim      gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
1065214571Sdim    esac
1066214571Sdim    case $gcc_prog_ld in
1067214571Sdim    # Accept absolute paths.
1068214571Sdim    [[\\/]* | [A-Za-z]:[\\/]*)]
1069214571Sdim      LD="$gcc_prog_ld" ;;
1070214571Sdim    esac
1071214571Sdim  fi
1072214571Sdimfi
1073214571Sdim
1074214571SdimACX_PROG_GNAT
1075214571SdimACX_PROG_CMP_IGNORE_INITIAL
1076214571Sdim
1077214571Sdim# Check for GMP and MPFR
1078214571Sdimgmplibs="-lmpfr -lgmp"
1079214571Sdimgmpinc=
1080214571Sdimhave_gmp=no
1081214571Sdim
1082214571Sdim# Specify a location for mpfr
1083214571Sdim# check for this first so it ends up on the link line before gmp.
1084214571SdimAC_ARG_WITH(mpfr-dir, [  --with-mpfr-dir=PATH    This option has been REMOVED],
1085214571Sdim  AC_MSG_ERROR([The --with-mpfr-dir=PATH option has been removed.
1086214571SdimUse --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH]))
1087214571Sdim
1088214571SdimAC_ARG_WITH(mpfr, [  --with-mpfr=PATH        Specify prefix directory for installed MPFR package
1089214571Sdim                          Equivalent to --with-mpfr-include=PATH/include
1090214571Sdim                          plus --with-mpfr-lib=PATH/lib])
1091214571SdimAC_ARG_WITH(mpfr_include, [  --with-mpfr-include=PATH
1092214571Sdim                          Specify directory for installed MPFR include files])
1093214571SdimAC_ARG_WITH(mpfr_lib, [  --with-mpfr-lib=PATH    Specify the directory for the installed MPFR library])
1094214571Sdim
1095214571Sdimif test "x$with_mpfr" != x; then
1096214571Sdim  gmplibs="-L$with_mpfr/lib $gmplibs"
1097214571Sdim  gmpinc="-I$with_mpfr/include"
1098214571Sdimfi
1099214571Sdimif test "x$with_mpfr_include" != x; then
1100214571Sdim  gmpinc="-I$with_mpfr_include"
1101214571Sdimfi
1102214571Sdimif test "x$with_mpfr_lib" != x; then
1103214571Sdim  gmplibs="-L$with_mpfr_lib $gmplibs"
1104214571Sdimfi
1105214571Sdimif test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
1106214571Sdim  gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/.libs -L$$r/$(HOST_SUBDIR)/mpfr/_libs '"$gmplibs"
1107214571Sdim  gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr -I$$s/mpfr '"$gmpinc"
1108214571Sdim  # Do not test the mpfr version.  Assume that it is sufficient, since
1109214571Sdim  # it is in the source tree, and the library has not been built yet
1110214571Sdim  # but it would be included on the link line in the version check below
1111214571Sdim  # hence making the test fail.
1112214571Sdim  have_gmp=yes
1113214571Sdimfi
1114214571Sdim
1115214571Sdim# Specify a location for gmp
1116214571SdimAC_ARG_WITH(gmp-dir, [  --with-gmp-dir=PATH     This option has been REMOVED],
1117214571Sdim  AC_MSG_ERROR([The --with-gmp-dir=PATH option has been removed.
1118214571SdimUse --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH]))
1119214571Sdim
1120214571SdimAC_ARG_WITH(gmp, [  --with-gmp=PATH         Specify prefix directory for the installed GMP package
1121214571Sdim                          Equivalent to --with-gmp-include=PATH/include
1122214571Sdim                          plus --with-gmp-lib=PATH/lib])
1123214571SdimAC_ARG_WITH(gmp_include, [  --with-gmp-include=PATH Specify directory for installed GMP include files])
1124214571SdimAC_ARG_WITH(gmp_lib, [  --with-gmp-lib=PATH     Specify the directory for the installed GMP library])
1125214571Sdim
1126214571Sdim
1127214571Sdimif test "x$with_gmp" != x; then
1128214571Sdim  gmplibs="-L$with_gmp/lib $gmplibs"
1129214571Sdim  gmpinc="-I$with_gmp/include $gmpinc"
1130214571Sdimfi
1131214571Sdimif test "x$with_gmp_include" != x; then
1132214571Sdim  gmpinc="-I$with_gmp_include $gmpinc"
1133214571Sdimfi
1134214571Sdimif test "x$with_gmp_lib" != x; then
1135214571Sdim  gmplibs="-L$with_gmp_lib $gmplibs"
1136214571Sdimfi
1137214571Sdimif test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
1138214571Sdim  gmplibs='-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/gmp/_libs '"$gmplibs"
1139214571Sdim  gmpinc='-I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp '"$gmpinc"
1140214571Sdim  # Do not test the gmp version.  Assume that it is sufficient, since
1141214571Sdim  # it is in the source tree, and the library has not been built yet
1142214571Sdim  # but it would be included on the link line in the version check below
1143214571Sdim  # hence making the test fail.
1144214571Sdim  have_gmp=yes
1145214571Sdimfi
1146214571Sdim
1147214571Sdimif test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
1148214571Sdim  have_gmp=yes
1149214571Sdim  saved_CFLAGS="$CFLAGS"
1150214571Sdim  CFLAGS="$CFLAGS $gmpinc"
1151214571Sdim  # Check GMP actually works
1152214571Sdim  AC_MSG_CHECKING([for correct version of gmp.h])
1153214571Sdim  AC_TRY_COMPILE([#include "gmp.h"],[
1154214571Sdim  #if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1)
1155214571Sdim  choke me
1156214571Sdim  #endif
1157214571Sdim  ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
1158214571Sdim
1159214571Sdim  if test x"$have_gmp" = xyes; then
1160214571Sdim    saved_LIBS="$LIBS"
1161214571Sdim    LIBS="$LIBS $gmplibs"
1162214571Sdim    dnl MPFR 2.2.0 is acceptable but buggy, MPFR 2.2.1 is better.
1163214571Sdim    AC_MSG_CHECKING([for correct version of mpfr.h])
1164214571Sdim    AC_TRY_LINK([#include <gmp.h>
1165214571Sdim    #include <mpfr.h>],[
1166214571Sdim    #if MPFR_VERSION < MPFR_VERSION_NUM(2,2,0)
1167214571Sdim    choke me
1168214571Sdim    #endif
1169214571Sdim    mpfr_t n;
1170214571Sdim    mpfr_t x;
1171214571Sdim    int t;
1172214571Sdim    mpfr_init (n);
1173214571Sdim    mpfr_init (x);
1174214571Sdim    mpfr_atan2 (n, n, x, GMP_RNDN);
1175214571Sdim    mpfr_erfc (n, x, GMP_RNDN);
1176214571Sdim    mpfr_subnormalize (x, t, GMP_RNDN);
1177214571Sdim    ], [AC_TRY_LINK([#include <gmp.h>
1178214571Sdim    #include <mpfr.h>],[
1179214571Sdim    #if MPFR_VERSION < MPFR_VERSION_NUM(2,2,1)
1180214571Sdim    choke me
1181214571Sdim    #endif
1182214571Sdim    mpfr_t n; mpfr_init(n);
1183214571Sdim    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
1184214571Sdim     [AC_MSG_RESULT([no]); have_gmp=no])
1185214571Sdim      LIBS="$saved_LIBS"
1186214571Sdim  fi
1187214571Sdim  CFLAGS="$saved_CFLAGS"
1188214571Sdim
1189214571Sdim  if test x$have_gmp != xyes; then
1190214571Sdim    AC_MSG_ERROR([Building GCC requires GMP 4.1+ and MPFR 2.2.1+.
1191214571SdimTry the --with-gmp and/or --with-mpfr options to specify their locations.
1192214571SdimCopies of these libraries' source code can be found at their respective
1193214571Sdimhosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
1194214571SdimSee also http://gcc.gnu.org/install/prerequisites.html for additional info.
1195214571SdimIf you obtained GMP and/or MPFR from a vendor distribution package, make
1196214571Sdimsure that you have installed both the libraries and the header files.
1197214571SdimThey may be located in separate packages.])
1198214571Sdim  fi
1199214571Sdimfi
1200214571Sdim
1201214571Sdim# Flags needed for both GMP and/or MPFR
1202214571SdimAC_SUBST(gmplibs)
1203214571SdimAC_SUBST(gmpinc)
1204214571Sdim
1205214571Sdim# By default, C is the only stage 1 language.
1206214571Sdimstage1_languages=,c,
1207214571Sdim
1208214571Sdim# Figure out what language subdirectories are present.
1209214571Sdim# Look if the user specified --enable-languages="..."; if not, use
1210214571Sdim# the environment variable $LANGUAGES if defined. $LANGUAGES might
1211214571Sdim# go away some day.
1212214571Sdim# NB:  embedded tabs in this IF block -- do not untabify
1213214571Sdimif test -d ${srcdir}/gcc; then
1214214571Sdim  if test x"${enable_languages+set}" != xset; then
1215214571Sdim    if test x"${LANGUAGES+set}" = xset; then
1216214571Sdim      enable_languages="${LANGUAGES}"
1217214571Sdim        echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
1218214571Sdim    else
1219214571Sdim      enable_languages=all
1220214571Sdim    fi
1221214571Sdim  else
1222214571Sdim    if test x"${enable_languages}" = x ||
1223214571Sdim       test x"${enable_languages}" = xyes;
1224214571Sdim       then
1225214571Sdim      echo configure.in: --enable-languages needs at least one language argument 1>&2
1226214571Sdim      exit 1
1227214571Sdim    fi
1228214571Sdim  fi
1229214571Sdim  enable_languages=`echo "${enable_languages}" | sed -e 's/[[ 	,]][[ 	,]]*/,/g' -e 's/,$//'`
1230214571Sdim
1231214571Sdim  # 'f95' is the old name for the 'fortran' language. We issue a warning
1232214571Sdim  # and make the substitution.
1233214571Sdim  case ,${enable_languages}, in
1234214571Sdim    *,f95,*)
1235214571Sdim      echo configure.in: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
1236214571Sdim      enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
1237214571Sdim      ;;
1238214571Sdim  esac
1239214571Sdim
1240214571Sdim  # First scan to see if an enabled language requires some other language.
1241214571Sdim  # We assume that a given config-lang.in will list all the language
1242214571Sdim  # front ends it requires, even if some are required indirectly.
1243214571Sdim  for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1244214571Sdim    case ${lang_frag} in
1245214571Sdim      ..) ;;
1246214571Sdim      # The odd quoting in the next line works around
1247214571Sdim      # an apparent bug in bash 1.12 on linux.
1248214571Sdim      ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1249214571Sdim      *)
1250214571Sdim        # From the config-lang.in, get $language, $lang_requires
1251214571Sdim        language=
1252214571Sdim        lang_requires=
1253214571Sdim        . ${lang_frag}
1254214571Sdim        for other in ${lang_requires} ; do
1255214571Sdim          case ,${enable_languages}, in
1256214571Sdim	    *,$other,*) ;;
1257214571Sdim	    *,all,*) ;;
1258214571Sdim	    *,$language,*)
1259214571Sdim	      echo " \`$other' language required by \`$language'; enabling" 1>&2
1260214571Sdim	      enable_languages="${enable_languages},${other}"
1261214571Sdim	      ;;
1262214571Sdim	  esac
1263214571Sdim        done
1264214571Sdim        ;;
1265214571Sdim    esac
1266214571Sdim  done
1267214571Sdim
1268214571Sdim  new_enable_languages=,c,
1269214571Sdim  missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ `
1270214571Sdim  potential_languages=,c,
1271214571Sdim
1272214571Sdim  for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1273214571Sdim    case ${lang_frag} in
1274214571Sdim      ..) ;;
1275214571Sdim      # The odd quoting in the next line works around
1276214571Sdim      # an apparent bug in bash 1.12 on linux.
1277214571Sdim      ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1278214571Sdim      *)
1279214571Sdim        # From the config-lang.in, get $language, $target_libs, 
1280214571Sdim        # $lang_dirs, $boot_language, and $build_by_default
1281214571Sdim        language=
1282214571Sdim        target_libs=
1283214571Sdim        lang_dirs=
1284214571Sdim        subdir_requires=
1285214571Sdim        boot_language=no
1286214571Sdim        build_by_default=yes
1287214571Sdim        . ${lang_frag}
1288214571Sdim        if test x${language} = x; then
1289214571Sdim          echo "${lang_frag} doesn't set \$language." 1>&2
1290214571Sdim          exit 1
1291214571Sdim        fi
1292214571Sdim
1293214571Sdim        case ,${enable_languages}, in
1294214571Sdim          *,${language},*)
1295214571Sdim            # Language was explicitly selected; include it.
1296214571Sdim            add_this_lang=yes
1297214571Sdim            ;;
1298214571Sdim          *,all,*)
1299214571Sdim            # 'all' was selected, select it if it is a default language
1300214571Sdim            add_this_lang=${build_by_default}
1301214571Sdim            ;;
1302214571Sdim          *)
1303214571Sdim            add_this_lang=no
1304214571Sdim            ;;
1305214571Sdim        esac
1306214571Sdim
1307214571Sdim        # Disable languages that need other directories if these aren't available.
1308214571Sdim	for i in $subdir_requires; do
1309214571Sdim	  test -f "$srcdir/gcc/$i/config-lang.in" && continue
1310214571Sdim	  case ,${enable_languages}, in
1311214571Sdim            *,${language},*)
1312214571Sdim              # Specifically requested language; tell them.
1313214571Sdim              AC_MSG_ERROR([The gcc/$i directory contains parts of $language but is missing])
1314214571Sdim              ;;
1315214571Sdim            *)
1316214571Sdim              # Silently disable.
1317214571Sdim              add_this_lang=unsupported
1318214571Sdim              ;;
1319214571Sdim          esac
1320214571Sdim	done
1321214571Sdim
1322214571Sdim        # Disable Ada if no preexisting GNAT is available.
1323214571Sdim        case ,${enable_languages},:${language}:${have_gnat} in
1324214571Sdim          *,${language},*:ada:no)
1325214571Sdim            # Specifically requested language; tell them.
1326214571Sdim            AC_MSG_ERROR([GNAT is required to build $language])
1327214571Sdim            ;;
1328214571Sdim          *:ada:no)
1329214571Sdim            # Silently disable.
1330214571Sdim            add_this_lang=unsupported
1331214571Sdim            ;;
1332214571Sdim        esac
1333214571Sdim
1334214571Sdim	# Disable a language that is unsupported by the target.
1335214571Sdim	case " $unsupported_languages " in
1336214571Sdim	  *" $language "*)
1337214571Sdim	    add_this_lang=unsupported
1338214571Sdim	    ;;
1339214571Sdim	esac
1340214571Sdim
1341214571Sdim	case $add_this_lang in
1342214571Sdim	  unsupported)
1343214571Sdim            # Remove language-dependent dirs.
1344214571Sdim            eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\"
1345214571Sdim	    ;;
1346214571Sdim	  no)
1347214571Sdim            # Remove language-dependent dirs; still show language as supported.
1348214571Sdim            eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\"
1349214571Sdim            potential_languages="${potential_languages}${language},"
1350214571Sdim	    ;;
1351214571Sdim          yes)
1352214571Sdim	    new_enable_languages="${new_enable_languages}${language},"
1353214571Sdim            potential_languages="${potential_languages}${language},"
1354214571Sdim	    missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
1355214571Sdim	    case ${boot_language} in
1356214571Sdim	      yes)
1357214571Sdim		# Add to (comma-separated) list of stage 1 languages.
1358214571Sdim		stage1_languages="${stage1_languages}${language},"
1359214571Sdim		;;
1360214571Sdim	    esac
1361214571Sdim	    ;;
1362214571Sdim        esac
1363214571Sdim        ;;
1364214571Sdim    esac
1365214571Sdim  done
1366214571Sdim
1367214571Sdim  AC_ARG_ENABLE(stage1-languages,
1368214571Sdim[  --enable-stage1-languages[=all]   choose additional languages to build during
1369214571Sdim                          stage1.  Mostly useful for compiler development.],
1370214571Sdim  [case ,${enable_stage1_languages}, in
1371214571Sdim    ,no,|,,)
1372214571Sdim      # Set it to something that will have no effect in the loop below
1373214571Sdim      enable_stage1_languages=c ;;
1374214571Sdim    ,yes,)
1375214571Sdim      enable_stage1_languages=`echo $new_enable_languages | \
1376214571Sdim	sed -e "s/^,//" -e "s/,$//" ` ;;
1377214571Sdim    *,all,*)
1378214571Sdim      enable_stage1_languages=`echo ,$enable_stage1_languages, | \
1379214571Sdim	sed -e "s/,all,/$new_enable_languages/" -e "s/^,//" -e "s/,$//" ` ;;
1380214571Sdim  esac
1381214571Sdim
1382214571Sdim  # Add "good" languages from enable_stage1_languages to stage1_languages,
1383214571Sdim  # while "bad" languages go in missing_languages.  Leave no duplicates.
1384214571Sdim  for i in `echo $enable_stage1_languages | sed 's/,/ /g' `; do
1385214571Sdim    case $potential_languages in
1386214571Sdim      *,$i,*)
1387214571Sdim        case $stage1_languages in
1388214571Sdim          *,$i,*) ;;
1389214571Sdim          *) stage1_languages="$stage1_languages$i," ;;
1390214571Sdim        esac ;;
1391214571Sdim      *)
1392214571Sdim        case $missing_languages in
1393214571Sdim          *,$i,*) ;;
1394214571Sdim          *) missing_languages="$missing_languages$i," ;;
1395214571Sdim        esac ;;
1396214571Sdim     esac
1397214571Sdim  done])
1398214571Sdim
1399214571Sdim  # Remove leading/trailing commas that were added for simplicity
1400214571Sdim  potential_languages=`echo "$potential_languages" | sed -e "s/^,//" -e "s/,$//"`
1401214571Sdim  missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
1402214571Sdim  stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"`
1403214571Sdim  new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"`
1404214571Sdim
1405214571Sdim  if test "x$missing_languages" != x; then
1406214571Sdim    AC_MSG_ERROR([
1407214571SdimThe following requested languages could not be built: ${missing_languages}
1408214571SdimSupported languages are: ${potential_languages}])
1409214571Sdim  fi
1410214571Sdim  if test "x$new_enable_languages" != "x$enable_languages"; then
1411214571Sdim    echo The following languages will be built: ${new_enable_languages}
1412214571Sdim    enable_languages="$new_enable_languages"
1413214571Sdim  fi
1414214571Sdim
1415214571Sdim  AC_SUBST(stage1_languages)
1416214571Sdim  ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
1417214571Sdimfi
1418214571Sdim
1419214571Sdim# Handle --disable-<component> generically.
1420214571Sdimfor dir in $configdirs $build_configdirs $target_configdirs ; do
1421214571Sdim  dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
1422214571Sdim  if eval test x\${enable_${dirname}} "=" xno ; then
1423214571Sdim    noconfigdirs="$noconfigdirs $dir"
1424214571Sdim  fi
1425214571Sdimdone
1426214571Sdim
1427214571Sdim# Check for Boehm's garbage collector
1428214571SdimAC_ARG_ENABLE(objc-gc,
1429214571Sdim[  --enable-objc-gc       enable the use of Boehm's garbage collector with
1430214571Sdim                          the GNU Objective-C runtime.],
1431214571Sdim[case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in
1432214571Sdim  *,objc,*:*:yes:*target-boehm-gc*)
1433214571Sdim    AC_MSG_ERROR([Boehm's garbage collector was requested yet not supported in this configuration])
1434214571Sdim    ;;
1435214571Sdimesac])
1436214571Sdim
1437214571Sdim# Make sure we only build Boehm's garbage collector if required.
1438214571Sdimcase ,${enable_languages},:${enable_objc_gc} in
1439214571Sdim  *,objc,*:yes)
1440214571Sdim    # Keep target-boehm-gc if requested for Objective-C.
1441214571Sdim    ;;
1442214571Sdim  *)
1443214571Sdim    # Otherwise remove target-boehm-gc depending on target-libjava.
1444214571Sdim    if echo " ${noconfigdirs} " | grep "target-libjava" >/dev/null 2>&1; then
1445214571Sdim      noconfigdirs="$noconfigdirs target-boehm-gc"
1446214571Sdim    fi
1447214571Sdim    ;;
1448214571Sdimesac
1449214571Sdim
1450214571Sdim# Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
1451214571Sdim# $build_configdirs and $target_configdirs.
1452214571Sdim# If we have the source for $noconfigdirs entries, add them to $notsupp.
1453214571Sdim
1454214571Sdimnotsupp=""
1455214571Sdimfor dir in . $skipdirs $noconfigdirs ; do
1456214571Sdim  dirname=`echo $dir | sed -e s/target-//g -e s/build-//g`
1457214571Sdim  if test $dir != .  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1458214571Sdim    configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
1459214571Sdim    if test -r $srcdir/$dirname/configure ; then
1460214571Sdim      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1461214571Sdim	true
1462214571Sdim      else
1463214571Sdim	notsupp="$notsupp $dir"
1464214571Sdim      fi
1465214571Sdim    fi
1466214571Sdim  fi
1467214571Sdim  if test $dir != .  && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1468214571Sdim    build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"`
1469214571Sdim    if test -r $srcdir/$dirname/configure ; then
1470214571Sdim      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1471214571Sdim	true
1472214571Sdim      else
1473214571Sdim	notsupp="$notsupp $dir"
1474214571Sdim      fi
1475214571Sdim    fi
1476214571Sdim  fi
1477214571Sdim  if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1478214571Sdim    target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
1479214571Sdim    if test -r $srcdir/$dirname/configure ; then
1480214571Sdim      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1481214571Sdim	true
1482214571Sdim      else
1483214571Sdim	notsupp="$notsupp $dir"
1484214571Sdim      fi
1485214571Sdim    fi
1486214571Sdim  fi
1487214571Sdimdone
1488214571Sdim
1489214571Sdim# Sometimes the tools are distributed with libiberty but with no other
1490214571Sdim# libraries.  In that case, we don't want to build target-libiberty.
1491214571Sdim# Don't let libgcc imply libiberty either.
1492214571Sdimif test -n "${target_configdirs}" ; then
1493214571Sdim  libgcc=
1494214571Sdim  others=
1495214571Sdim  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
1496214571Sdim    if test "$i" = "libgcc"; then
1497214571Sdim      libgcc=target-libgcc
1498214571Sdim    elif test "$i" != "libiberty" ; then
1499214571Sdim      if test -r $srcdir/$i/configure ; then
1500214571Sdim	others=yes;
1501214571Sdim	break;
1502214571Sdim      fi
1503214571Sdim    fi
1504214571Sdim  done
1505214571Sdim  if test -z "${others}" ; then
1506214571Sdim    target_configdirs=$libgcc
1507214571Sdim  fi
1508214571Sdimfi
1509214571Sdim
1510214571Sdim# Quietly strip out all directories which aren't configurable in this tree.
1511214571Sdim# This relies on all configurable subdirectories being autoconfiscated, which
1512214571Sdim# is now the case.
1513214571Sdimbuild_configdirs_all="$build_configdirs"
1514214571Sdimbuild_configdirs=
1515214571Sdimfor i in ${build_configdirs_all} ; do
1516214571Sdim  j=`echo $i | sed -e s/build-//g` 
1517214571Sdim  if test -f ${srcdir}/$j/configure ; then
1518214571Sdim    build_configdirs="${build_configdirs} $i"
1519214571Sdim  fi
1520214571Sdimdone
1521214571Sdim
1522214571Sdimconfigdirs_all="$configdirs"
1523214571Sdimconfigdirs=
1524214571Sdimfor i in ${configdirs_all} ; do
1525214571Sdim  if test -f ${srcdir}/$i/configure ; then
1526214571Sdim    configdirs="${configdirs} $i"
1527214571Sdim  fi
1528214571Sdimdone
1529214571Sdim
1530214571Sdimtarget_configdirs_all="$target_configdirs"
1531214571Sdimtarget_configdirs=
1532214571Sdimfor i in ${target_configdirs_all} ; do
1533214571Sdim  j=`echo $i | sed -e s/target-//g` 
1534214571Sdim  if test -f ${srcdir}/$j/configure ; then
1535214571Sdim    target_configdirs="${target_configdirs} $i"
1536214571Sdim  fi
1537214571Sdimdone
1538214571Sdim
1539214571Sdim# Produce a warning message for the subdirs we can't configure.
1540214571Sdim# This isn't especially interesting in the Cygnus tree, but in the individual
1541214571Sdim# FSF releases, it's important to let people know when their machine isn't
1542214571Sdim# supported by the one or two programs in a package.
1543214571Sdim
1544214571Sdimif test -n "${notsupp}" && test -z "${norecursion}" ; then
1545214571Sdim  # If $appdirs is non-empty, at least one of those directories must still
1546214571Sdim  # be configured, or we error out.  (E.g., if the gas release supports a
1547214571Sdim  # specified target in some subdirs but not the gas subdir, we shouldn't
1548214571Sdim  # pretend that all is well.)
1549214571Sdim  if test -n "$appdirs" ; then
1550214571Sdim    for dir in $appdirs ; do
1551214571Sdim      if test -r $dir/Makefile.in ; then
1552214571Sdim	if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1553214571Sdim	  appdirs=""
1554214571Sdim	  break
1555214571Sdim	fi
1556214571Sdim	if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then
1557214571Sdim	  appdirs=""
1558214571Sdim	  break
1559214571Sdim	fi
1560214571Sdim      fi
1561214571Sdim    done
1562214571Sdim    if test -n "$appdirs" ; then
1563214571Sdim      echo "*** This configuration is not supported by this package." 1>&2
1564214571Sdim      exit 1
1565214571Sdim    fi
1566214571Sdim  fi
1567214571Sdim  # Okay, some application will build, or we don't care to check.  Still
1568214571Sdim  # notify of subdirs not getting built.
1569214571Sdim  echo "*** This configuration is not supported in the following subdirectories:" 1>&2
1570214571Sdim  echo "    ${notsupp}" 1>&2
1571214571Sdim  echo "    (Any other directories should still work fine.)" 1>&2
1572214571Sdimfi
1573214571Sdim
1574214571Sdimcase "$host" in
1575214571Sdim  *msdosdjgpp*)
1576214571Sdim    enable_gdbtk=no ;;
1577214571Sdimesac
1578214571Sdim
1579214571Sdim# To find our prefix, in gcc_cv_tool_prefix.
1580214571SdimACX_TOOL_DIRS
1581214571Sdim
1582214571Sdimcopy_dirs=
1583214571Sdim
1584214571SdimAC_ARG_WITH([build-sysroot], 
1585214571Sdim  [  --with-build-sysroot=sysroot
1586214571Sdim                          use sysroot as the system root during the build],
1587214571Sdim  [if test x"$withval" != x ; then
1588214571Sdim     SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
1589214571Sdim   fi],
1590214571Sdim  [SYSROOT_CFLAGS_FOR_TARGET=])
1591214571SdimAC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
1592214571Sdim
1593214571Sdim# Handle --with-headers=XXX.  If the value is not "yes", the contents of
1594214571Sdim# the named directory are copied to $(tooldir)/sys-include.
1595214571Sdimif test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
1596214571Sdim  if test x${is_cross_compiler} = xno ; then
1597214571Sdim    echo 1>&2 '***' --with-headers is only supported when cross compiling
1598214571Sdim    exit 1
1599214571Sdim  fi
1600214571Sdim  if test x"${with_headers}" != xyes ; then
1601214571Sdim    x=${gcc_cv_tool_prefix}
1602214571Sdim    copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
1603214571Sdim  fi
1604214571Sdimfi
1605214571Sdim
1606214571Sdim# Handle --with-libs=XXX.  If the value is not "yes", the contents of
1607214571Sdim# the name directories are copied to $(tooldir)/lib.  Multiple directories
1608214571Sdim# are permitted.
1609214571Sdimif test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
1610214571Sdim  if test x${is_cross_compiler} = xno ; then
1611214571Sdim    echo 1>&2 '***' --with-libs is only supported when cross compiling
1612214571Sdim    exit 1
1613214571Sdim  fi
1614214571Sdim  if test x"${with_libs}" != xyes ; then
1615214571Sdim    # Copy the libraries in reverse order, so that files in the first named
1616214571Sdim    # library override files in subsequent libraries.
1617214571Sdim    x=${gcc_cv_tool_prefix}
1618214571Sdim    for l in ${with_libs}; do
1619214571Sdim      copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
1620214571Sdim    done
1621214571Sdim  fi
1622214571Sdimfi
1623214571Sdim
1624214571Sdim# Set with_gnu_as and with_gnu_ld as appropriate.
1625214571Sdim#
1626214571Sdim# This is done by determining whether or not the appropriate directory
1627214571Sdim# is available, and by checking whether or not specific configurations
1628214571Sdim# have requested that this magic not happen.
1629214571Sdim# 
1630214571Sdim# The command line options always override the explicit settings in 
1631214571Sdim# configure.in, and the settings in configure.in override this magic.
1632214571Sdim#
1633214571Sdim# If the default for a toolchain is to use GNU as and ld, and you don't 
1634214571Sdim# want to do that, then you should use the --without-gnu-as and
1635214571Sdim# --without-gnu-ld options for the configure script.
1636214571Sdim
1637214571Sdimif test x${use_gnu_as} = x &&
1638214571Sdim   echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
1639214571Sdim  with_gnu_as=yes
1640214571Sdim  extra_host_args="$extra_host_args --with-gnu-as"
1641214571Sdimfi
1642214571Sdim
1643214571Sdimif test x${use_gnu_ld} = x &&
1644214571Sdim   echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then
1645214571Sdim  with_gnu_ld=yes
1646214571Sdim  extra_host_args="$extra_host_args --with-gnu-ld"
1647214571Sdimfi
1648214571Sdim
1649214571Sdim# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
1650214571Sdim# can detect this case.
1651214571Sdim
1652214571Sdimif test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
1653214571Sdim  with_newlib=yes
1654214571Sdim  extra_host_args="$extra_host_args --with-newlib"
1655214571Sdimfi
1656214571Sdim
1657214571Sdim# Handle ${copy_dirs}
1658214571Sdimset fnord ${copy_dirs}
1659214571Sdimshift
1660214571Sdimwhile test $# != 0 ; do
1661214571Sdim  if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
1662214571Sdim    :
1663214571Sdim  else
1664214571Sdim    echo Copying $1 to $2
1665214571Sdim
1666214571Sdim    # Use the install script to create the directory and all required
1667214571Sdim    # parent directories.
1668214571Sdim    if test -d $2 ; then
1669214571Sdim      :
1670214571Sdim    else
1671214571Sdim      echo >config.temp
1672214571Sdim      ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
1673214571Sdim    fi
1674214571Sdim
1675214571Sdim    # Copy the directory, assuming we have tar.
1676214571Sdim    # FIXME: Should we use B in the second tar?  Not all systems support it.
1677214571Sdim    (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
1678214571Sdim
1679214571Sdim    # It is the responsibility of the user to correctly adjust all
1680214571Sdim    # symlinks.  If somebody can figure out how to handle them correctly
1681214571Sdim    # here, feel free to add the code.
1682214571Sdim
1683214571Sdim    echo $1 > $2/COPIED
1684214571Sdim  fi
1685214571Sdim  shift; shift
1686214571Sdimdone
1687214571Sdim
1688214571Sdim# Determine a target-dependent exec_prefix that the installed
1689214571Sdim# gcc will search in.  Keep this list sorted by triplet, with
1690214571Sdim# the *-*-osname triplets last.
1691214571Sdimmd_exec_prefix=
1692214571Sdimcase "${target}" in
1693214571Sdim  alpha*-*-*vms*)
1694214571Sdim    md_exec_prefix=/gnu/lib/gcc-lib
1695214571Sdim    ;;
1696214571Sdim  i[34567]86-pc-msdosdjgpp*)
1697214571Sdim    md_exec_prefix=/dev/env/DJDIR/bin
1698214571Sdim    ;;
1699214571Sdim  i[34567]86-*-sco3.2v5*)
1700214571Sdim    if test $with_gnu_as = yes; then
1701214571Sdim      md_exec_prefix=/usr/gnu/bin
1702214571Sdim    else
1703214571Sdim      md_exec_prefix=/usr/ccs/bin/elf
1704214571Sdim    fi
1705214571Sdim    ;;
1706214571Sdim
1707214571Sdim  mn10300-*-* | \
1708214571Sdim  powerpc-*-chorusos* | \
1709214571Sdim  powerpc*-*-eabi* | \
1710214571Sdim  powerpc*-*-sysv* | \
1711214571Sdim  powerpc*-*-kaos* | \
1712214571Sdim  s390x-ibm-tpf*)
1713214571Sdim    md_exec_prefix=/usr/ccs/bin
1714214571Sdim    ;;
1715214571Sdim  sparc64-*-elf*)
1716214571Sdim    ;;
1717214571Sdim  v850*-*-*)
1718214571Sdim    md_exec_prefix=/usr/ccs/bin
1719214571Sdim    ;;
1720214571Sdim  xtensa-*-elf*)
1721214571Sdim    ;;
1722214571Sdim
1723214571Sdim  *-*-beos* | \
1724214571Sdim  *-*-elf* | \
1725214571Sdim  *-*-hpux* | \
1726214571Sdim  *-*-netware* | \
1727214571Sdim  *-*-nto-qnx* | \
1728214571Sdim  *-*-rtems* | \
1729214571Sdim  *-*-solaris2* | \
1730214571Sdim  *-*-sysv[45]* | \
1731214571Sdim  *-*-vxworks* | \
1732214571Sdim  *-wrs-windiss)
1733214571Sdim    md_exec_prefix=/usr/ccs/bin
1734214571Sdim    ;;
1735214571Sdimesac
1736214571Sdim
1737214571Sdimextra_arflags_for_target=
1738214571Sdimextra_nmflags_for_target=
1739214571Sdimextra_ranlibflags_for_target=
1740214571Sdimtarget_makefile_frag=/dev/null
1741214571Sdimcase "${target}" in
1742214571Sdim  mep*-*-*)
1743214571Sdim    target_makefile_frag="config/mt-mep"
1744214571Sdim    ;;
1745214571Sdim  spu-*-*)
1746214571Sdim    target_makefile_frag="config/mt-spu"
1747214571Sdim    ;;
1748214571Sdim  *-*-netware*)
1749214571Sdim    target_makefile_frag="config/mt-netware"
1750214571Sdim    ;;
1751214571Sdim  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
1752214571Sdim    target_makefile_frag="config/mt-gnu"
1753214571Sdim    ;;
1754214571Sdim  *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
1755214571Sdim    # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm 
1756214571Sdim    # commands to handle both 32-bit and 64-bit objects.  These flags are
1757214571Sdim    # harmless if we're using GNU nm or ar.
1758214571Sdim    extra_arflags_for_target=" -X32_64"
1759214571Sdim    extra_nmflags_for_target=" -B -X32_64"
1760214571Sdim    ;;
1761214571Sdim  *-*-darwin*)
1762214571Sdim    # ranlib from Darwin requires the -c flag to look at common symbols.
1763214571Sdim    extra_ranlibflags_for_target=" -c"
1764214571Sdim    ;;
1765214571Sdim  mips*-*-pe | sh*-*-pe | *arm-wince-pe)
1766214571Sdim    target_makefile_frag="config/mt-wince"
1767214571Sdim    ;;
1768214571Sdimesac
1769214571Sdim
1770214571Sdimalphaieee_frag=/dev/null
1771214571Sdimcase $target in
1772214571Sdim  alpha*-*-*)
1773214571Sdim    # This just makes sure to use the -mieee option to build target libs.
1774214571Sdim    # This should probably be set individually by each library.
1775214571Sdim    alphaieee_frag="config/mt-alphaieee"
1776214571Sdim    ;;
1777214571Sdimesac
1778214571Sdim
1779214571Sdim# If --enable-target-optspace always use -Os instead of -O2 to build
1780214571Sdim# the target libraries, similarly if it is not specified, use -Os
1781214571Sdim# on selected platforms.
1782214571Sdimospace_frag=/dev/null
1783214571Sdimcase "${enable_target_optspace}:${target}" in
1784214571Sdim  yes:*)
1785214571Sdim    ospace_frag="config/mt-ospace"
1786214571Sdim    ;;
1787214571Sdim  :d30v-*)
1788214571Sdim    ospace_frag="config/mt-d30v"
1789214571Sdim    ;;
1790214571Sdim  :m32r-* | :d10v-* | :fr30-*)
1791214571Sdim    ospace_frag="config/mt-ospace"
1792214571Sdim    ;;
1793214571Sdim  no:* | :*)
1794214571Sdim    ;;
1795214571Sdim  *)
1796214571Sdim    echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
1797214571Sdim    ;;
1798214571Sdimesac
1799214571Sdim
1800214571Sdim# Default to using --with-stabs for certain targets.
1801214571Sdimif test x${with_stabs} = x ; then
1802214571Sdim  case "${target}" in
1803214571Sdim  mips*-*-irix[[56]]*)
1804214571Sdim    ;;
1805214571Sdim  mips*-*-* | alpha*-*-osf*)
1806214571Sdim    with_stabs=yes;
1807214571Sdim    extra_host_args="${extra_host_args} --with-stabs"
1808214571Sdim    ;;
1809214571Sdim  esac
1810214571Sdimfi
1811214571Sdim
1812214571Sdim# hpux11 in 64bit mode has libraries in a weird place.  Arrange to find
1813214571Sdim# them automatically.
1814214571Sdimcase "${host}" in
1815214571Sdim  hppa*64*-*-hpux11*)	
1816214571Sdim    extra_host_args="$extra_host_args -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include"
1817214571Sdim    ;;
1818214571Sdimesac
1819214571Sdim
1820214571Sdim# Some systems (e.g., one of the i386-aix systems the gas testers are
1821214571Sdim# using) don't handle "\$" correctly, so don't use it here.
1822214571Sdimtooldir='${exec_prefix}'/${target_noncanonical}
1823214571Sdimbuild_tooldir=${tooldir}
1824214571Sdim
1825214571Sdim# Create a .gdbinit file which runs the one in srcdir
1826214571Sdim# and tells GDB to look there for source files.
1827214571Sdim
1828214571Sdimif test -r ${srcdir}/.gdbinit ; then
1829214571Sdim  case ${srcdir} in
1830214571Sdim    .) ;;
1831214571Sdim    *) cat > ./.gdbinit <<EOF
1832214571Sdim# ${NO_EDIT}
1833214571Sdimdir ${srcdir}
1834214571Sdimdir .
1835214571Sdimsource ${srcdir}/.gdbinit
1836214571SdimEOF
1837214571Sdim    ;;
1838214571Sdim  esac
1839214571Sdimfi
1840214571Sdim
1841214571Sdim# Make sure that the compiler is able to generate an executable.  If it
1842214571Sdim# can't, we are probably in trouble.  We don't care whether we can run the
1843214571Sdim# executable--we might be using a cross compiler--we only care whether it
1844214571Sdim# can be created.  At this point the main configure script has set CC.
1845214571Sdimwe_are_ok=no
1846214571Sdimecho "int main () { return 0; }" > conftest.c
1847214571Sdim${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
1848214571Sdimif test $? = 0 ; then
1849214571Sdim  if test -s conftest || test -s conftest.exe ; then
1850214571Sdim    we_are_ok=yes
1851214571Sdim  fi
1852214571Sdimfi 
1853214571Sdimcase $we_are_ok in
1854214571Sdim  no)
1855214571Sdim    echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
1856214571Sdim    echo 1>&2 "*** You must set the environment variable CC to a working compiler."
1857214571Sdim    rm -f conftest*
1858214571Sdim    exit 1
1859214571Sdim    ;;
1860214571Sdimesac
1861214571Sdimrm -f conftest*
1862214571Sdim
1863214571Sdim# The Solaris /usr/ucb/cc compiler does not appear to work.
1864214571Sdimcase "${host}" in
1865214571Sdim  sparc-sun-solaris2*)
1866214571Sdim      CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
1867214571Sdim      if test "`type $CCBASE | sed 's/^[[^/]]*//'`" = "/usr/ucb/cc" ; then
1868214571Sdim          could_use=
1869214571Sdim          test -d /opt/SUNWspro/bin && could_use="/opt/SUNWspro/bin"
1870214571Sdim          if test -d /opt/cygnus/bin ; then
1871214571Sdim              if test "$could_use" = "" ; then
1872214571Sdim                  could_use="/opt/cygnus/bin"
1873214571Sdim              else
1874214571Sdim                  could_use="$could_use or /opt/cygnus/bin"
1875214571Sdim              fi
1876214571Sdim          fi
1877214571Sdim        if test "$could_use" = "" ; then
1878214571Sdim            echo "Warning: compilation may fail because you're using"
1879214571Sdim            echo "/usr/ucb/cc.  You should change your PATH or CC "
1880214571Sdim            echo "variable and rerun configure."
1881214571Sdim        else
1882214571Sdim            echo "Warning: compilation may fail because you're using"
1883214571Sdim            echo "/usr/ucb/cc, when you should use the C compiler from"
1884214571Sdim            echo "$could_use.  You should change your"
1885214571Sdim            echo "PATH or CC variable and rerun configure."
1886214571Sdim        fi
1887214571Sdim      fi
1888214571Sdim  ;;
1889214571Sdimesac
1890214571Sdim
1891214571Sdimcase "${host}" in
1892214571Sdim  *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
1893214571Sdim  *-*-darwin* | *-*-rhapsody* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
1894214571Sdim  *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
1895214571Sdimesac
1896214571Sdim
1897214571Sdim# Record target_configdirs and the configure arguments for target and
1898214571Sdim# build configuration in Makefile.
1899214571Sdimtarget_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
1900214571Sdimbuild_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
1901214571Sdim
1902214571Sdim# Determine whether gdb needs tk/tcl or not.
1903214571Sdim# Use 'maybe' since enable_gdbtk might be true even if tk isn't available
1904214571Sdim# and in that case we want gdb to be built without tk.  Ugh!
1905214571Sdim# In fact I believe gdb is the *only* package directly dependent on tk,
1906214571Sdim# so we should be able to put the 'maybe's in unconditionally and
1907214571Sdim# leave out the maybe dependencies when enable_gdbtk is false.  I'm not
1908214571Sdim# 100% sure that that's safe though.
1909214571Sdim
1910214571Sdimgdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
1911214571Sdimcase "$enable_gdbtk" in
1912214571Sdim  no)
1913214571Sdim    GDB_TK="" ;;
1914214571Sdim  yes)
1915214571Sdim    GDB_TK="${gdb_tk}" ;;
1916214571Sdim  *)
1917214571Sdim    # Only add the dependency on gdbtk when GDBtk is part of the gdb
1918214571Sdim    # distro.  Eventually someone will fix this and move Insight, nee
1919214571Sdim    # gdbtk to a separate directory.
1920214571Sdim    if test -d ${srcdir}/gdb/gdbtk ; then
1921214571Sdim      GDB_TK="${gdb_tk}"
1922214571Sdim    else
1923214571Sdim      GDB_TK=""
1924214571Sdim    fi
1925214571Sdim    ;;
1926214571Sdimesac
1927214571SdimCONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
1928214571SdimINSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
1929214571Sdim
1930214571Sdim# Strip out unwanted targets.
1931214571Sdim
1932214571Sdim# While at that, we remove Makefiles if we were started for recursive
1933214571Sdim# configuration, so that the top-level Makefile reconfigures them,
1934214571Sdim# like we used to do when configure itself was recursive.
1935214571Sdim
1936214571Sdim# Loop over modules.  $extrasub must be used with care, limiting as
1937214571Sdim# much as possible the usage of range addresses.  That's because autoconf
1938214571Sdim# splits the sed script to overcome limits in the number of commands,
1939214571Sdim# and relying on carefully-timed sed passes may turn out to be very hard
1940214571Sdim# to maintain later.  In this particular case, you just have to be careful
1941214571Sdim# not to nest @if/@endif pairs, because configure will not warn you at all.
1942214571Sdim
1943214571SdimAC_ARG_ENABLE([bootstrap],
1944214571Sdim[  --enable-bootstrap           Enable bootstrapping [yes if native build]],,
1945214571Sdimenable_bootstrap=default)
1946214571Sdim
1947214571Sdim# Issue errors and warnings for invalid/strange bootstrap combinations.
1948214571Sdimcase "$configdirs" in
1949214571Sdim  *gcc*) have_compiler=yes ;;
1950214571Sdim  *) have_compiler=no ;;
1951214571Sdimesac
1952214571Sdim
1953214571Sdimcase "$have_compiler:$host:$target:$enable_bootstrap" in
1954214571Sdim  *:*:*:no) ;;
1955214571Sdim
1956214571Sdim  # Default behavior.  Enable bootstrap if we have a compiler
1957214571Sdim  # and we are in a native configuration.
1958214571Sdim  yes:$build:$build:default)
1959214571Sdim    enable_bootstrap=yes ;;
1960214571Sdim
1961214571Sdim  *:*:*:default)
1962214571Sdim    enable_bootstrap=no ;;
1963214571Sdim
1964214571Sdim  # We have a compiler and we are in a native configuration, bootstrap is ok
1965214571Sdim  yes:$build:$build:yes)
1966214571Sdim    ;;
1967214571Sdim
1968214571Sdim  # Other configurations, but we have a compiler.  Assume the user knows
1969214571Sdim  # what he's doing.
1970214571Sdim  yes:*:*:yes)
1971214571Sdim    AC_MSG_WARN([trying to bootstrap a cross compiler])
1972214571Sdim    ;;
1973214571Sdim
1974214571Sdim  # No compiler: if they passed --enable-bootstrap explicitly, fail
1975214571Sdim  no:*:*:yes)
1976214571Sdim    AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
1977214571Sdim
1978214571Sdim  # Fail if wrong command line
1979214571Sdim  *)
1980214571Sdim    AC_MSG_ERROR([invalid option for --enable-bootstrap])
1981214571Sdim    ;;
1982214571Sdimesac
1983214571Sdim
1984214571Sdim# Adjust the toplevel makefile according to whether bootstrap was selected.
1985214571Sdimcase "$enable_bootstrap" in
1986214571Sdim  yes)
1987214571Sdim    bootstrap_suffix=bootstrap ;;
1988214571Sdim  no)
1989214571Sdim    bootstrap_suffix=no-bootstrap ;;
1990214571Sdimesac
1991214571Sdim
1992214571Sdimfor module in ${build_configdirs} ; do
1993214571Sdim  if test -z "${no_recursion}" \
1994214571Sdim     && test -f ${build_subdir}/${module}/Makefile; then
1995214571Sdim    echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
1996214571Sdim    rm -f ${build_subdir}/${module}/Makefile
1997214571Sdim  fi
1998214571Sdim  extrasub="$extrasub
1999214571Sdim/^@if build-$module\$/d
2000214571Sdim/^@endif build-$module\$/d
2001214571Sdim/^@if build-$module-$bootstrap_suffix\$/d
2002214571Sdim/^@endif build-$module-$bootstrap_suffix\$/d"
2003214571Sdimdone
2004214571Sdimfor module in ${configdirs} ; do
2005214571Sdim  if test -z "${no_recursion}"; then
2006214571Sdim    for file in stage*-${module}/Makefile prev-${module}/Makefile ${module}/Makefile; do
2007214571Sdim      if test -f ${file}; then
2008214571Sdim	echo 1>&2 "*** removing ${file} to force reconfigure"
2009214571Sdim	rm -f ${file}
2010214571Sdim      fi
2011214571Sdim    done
2012214571Sdim  fi
2013214571Sdim  extrasub="$extrasub
2014214571Sdim/^@if $module\$/d
2015214571Sdim/^@endif $module\$/d
2016214571Sdim/^@if $module-$bootstrap_suffix\$/d
2017214571Sdim/^@endif $module-$bootstrap_suffix\$/d"
2018214571Sdimdone
2019214571Sdimfor module in ${target_configdirs} ; do
2020214571Sdim  if test -z "${no_recursion}" \
2021214571Sdim     && test -f ${target_subdir}/${module}/Makefile; then
2022214571Sdim    echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
2023214571Sdim    rm -f ${target_subdir}/${module}/Makefile
2024214571Sdim  fi
2025214571Sdim  extrasub="$extrasub
2026214571Sdim/^@if target-$module\$/d
2027214571Sdim/^@endif target-$module\$/d
2028214571Sdim/^@if target-$module-$bootstrap_suffix\$/d
2029214571Sdim/^@endif target-$module-$bootstrap_suffix\$/d"
2030214571Sdimdone
2031214571Sdim
2032214571Sdimextrasub="$extrasub
2033214571Sdim/^@if /,/^@endif /d"
2034214571Sdim
2035214571Sdim# Create the serialization dependencies.  This uses a temporary file.
2036214571Sdim
2037214571SdimAC_ARG_ENABLE([serial-configure],
2038214571Sdim[  --enable-serial-[{host,target,build}-]configure
2039214571Sdim                          Force sequential configuration of
2040214571Sdim                          sub-packages for the host, target or build
2041214571Sdim			  machine, or all sub-packages])
2042214571Sdim
2043214571Sdimcase ${enable_serial_configure} in
2044214571Sdim  yes)
2045214571Sdim    enable_serial_build_configure=yes
2046214571Sdim    enable_serial_host_configure=yes
2047214571Sdim    enable_serial_target_configure=yes
2048214571Sdim    ;;
2049214571Sdimesac
2050214571Sdim
2051214571Sdim# These force 'configure's to be done one at a time, to avoid problems
2052214571Sdim# with contention over a shared config.cache.
2053214571Sdimrm -f serdep.tmp
2054214571Sdimecho '# serdep.tmp' > serdep.tmp
2055214571Sdimolditem=
2056214571Sdimtest "x${enable_serial_build_configure}" = xyes &&
2057214571Sdimfor item in ${build_configdirs} ; do
2058214571Sdim  case ${olditem} in
2059214571Sdim    "") ;;
2060214571Sdim    *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
2061214571Sdim  esac
2062214571Sdim  olditem=${item}
2063214571Sdimdone
2064214571Sdimolditem=
2065214571Sdimtest "x${enable_serial_host_configure}" = xyes &&
2066214571Sdimfor item in ${configdirs} ; do
2067214571Sdim  case ${olditem} in
2068214571Sdim    "") ;;
2069214571Sdim    *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
2070214571Sdim  esac
2071214571Sdim  olditem=${item}
2072214571Sdimdone
2073214571Sdimolditem=
2074214571Sdimtest "x${enable_serial_target_configure}" = xyes &&
2075214571Sdimfor item in ${target_configdirs} ; do
2076214571Sdim  case ${olditem} in
2077214571Sdim    "") ;;
2078214571Sdim    *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
2079214571Sdim  esac
2080214571Sdim  olditem=${item}
2081214571Sdimdone
2082214571Sdimserialization_dependencies=serdep.tmp
2083214571SdimAC_SUBST_FILE(serialization_dependencies)
2084214571Sdim
2085214571Sdim# Base args.  Strip norecursion, cache-file, srcdir, host, build,
2086214571Sdim# target, nonopt, and variable assignments.  These are the ones we
2087214571Sdim# might not want to pass down to subconfigures.  Also strip
2088214571Sdim# program-prefix, program-suffix, and program-transform-name, so that
2089214571Sdim# we can pass down a consistent program-transform-name.
2090214571Sdimbaseargs=
2091214571Sdimkeep_next=no
2092214571Sdimskip_next=no
2093214571Sdimeval "set -- $ac_configure_args"
2094214571Sdimfor ac_arg
2095214571Sdimdo
2096214571Sdim  if test X"$skip_next" = X"yes"; then
2097214571Sdim    skip_next=no
2098214571Sdim    continue
2099214571Sdim  fi
2100214571Sdim  if test X"$keep_next" = X"yes"; then
2101214571Sdim    case $ac_arg in
2102214571Sdim      *\'*)
2103214571Sdim	ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2104214571Sdim    esac
2105214571Sdim    baseargs="$baseargs '$ac_arg'"
2106214571Sdim    keep_next=no
2107214571Sdim    continue
2108214571Sdim  fi
2109214571Sdim
2110214571Sdim  # Handle separated arguments.  Based on the logic generated by
2111214571Sdim  # autoconf 2.59.
2112214571Sdim  case $ac_arg in
2113214571Sdim    *=* | --config-cache | -C | -disable-* | --disable-* \
2114214571Sdim      | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
2115214571Sdim      | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
2116214571Sdim      | -with-* | --with-* | -without-* | --without-* | --x)
2117214571Sdim      separate_arg=no
2118214571Sdim      ;;
2119214571Sdim    -*)
2120214571Sdim      separate_arg=yes
2121214571Sdim      ;;
2122214571Sdim    *)
2123214571Sdim      separate_arg=no
2124214571Sdim      ;;
2125214571Sdim  esac
2126214571Sdim
2127214571Sdim  case "$ac_arg" in
2128214571Sdim    --no*)
2129214571Sdim      continue
2130214571Sdim      ;;
2131214571Sdim    --c* | \
2132214571Sdim    --sr* | \
2133214571Sdim    --ho* | \
2134214571Sdim    --bu* | \
2135214571Sdim    --t* | \
2136214571Sdim    --program-* | \
2137214571Sdim    -cache_file* | \
2138214571Sdim    -srcdir* | \
2139214571Sdim    -host* | \
2140214571Sdim    -build* | \
2141214571Sdim    -target* | \
2142214571Sdim    -program-prefix* | \
2143214571Sdim    -program-suffix* | \
2144214571Sdim    -program-transform-name* )
2145214571Sdim      skip_next=$separate_arg
2146214571Sdim      continue
2147214571Sdim      ;;
2148214571Sdim    -*)
2149214571Sdim      # An option.  Add it.
2150214571Sdim      case $ac_arg in
2151214571Sdim	*\'*)
2152214571Sdim	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2153214571Sdim      esac
2154214571Sdim      baseargs="$baseargs '$ac_arg'"
2155214571Sdim      keep_next=$separate_arg
2156214571Sdim      ;;
2157214571Sdim    *)
2158214571Sdim      # Either a variable assignment, or a nonopt (triplet).  Don't
2159214571Sdim      # pass it down; let the Makefile handle this.
2160214571Sdim      continue
2161214571Sdim      ;;
2162214571Sdim  esac
2163214571Sdimdone
2164214571Sdim# Remove the initial space we just introduced and, as these will be
2165214571Sdim# expanded by make, quote '$'.
2166214571Sdimbaseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
2167214571Sdim
2168214571Sdim# Add in --program-transform-name, after --program-prefix and
2169214571Sdim# --program-suffix have been applied to it.  Autoconf has already
2170214571Sdim# doubled dollar signs and backslashes in program_transform_name; we want
2171214571Sdim# the backslashes un-doubled, and then the entire thing wrapped in single
2172214571Sdim# quotes, because this will be expanded first by make and then by the shell. 
2173214571Sdim# Also, because we want to override the logic in subdir configure scripts to
2174214571Sdim# choose program_transform_name, replace any s,x,x, with s,y,y,.
2175214571Sdimsed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
2176214571Sdim${program_transform_name}
2177214571SdimEOF_SED
2178214571Sdimgcc_transform_name=`cat conftestsed.out`
2179214571Sdimrm -f conftestsed.out
2180214571Sdimbaseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
2181214571Sdim
2182214571Sdim# For the build-side libraries, we just need to pretend we're native,
2183214571Sdim# and not use the same cache file.  Multilibs are neither needed nor
2184214571Sdim# desired.
2185214571Sdimbuild_configargs="--cache-file=../config.cache ${baseargs}"
2186214571Sdim
2187214571Sdim# For host modules, accept cache file option, or specification as blank.
2188214571Sdimcase "${cache_file}" in
2189214571Sdim"") # empty
2190214571Sdim  cache_file_option="" ;;
2191214571Sdim/* | [[A-Za-z]]:[[\\/]]* ) # absolute path
2192214571Sdim  cache_file_option="--cache-file=${cache_file}" ;;
2193214571Sdim*) # relative path
2194214571Sdim  cache_file_option="--cache-file=../${cache_file}" ;;
2195214571Sdimesac
2196214571Sdim
2197214571Sdim# Host dirs don't like to share a cache file either, horribly enough.
2198214571Sdim# This seems to be due to autoconf 2.5x stupidity.
2199214571Sdimhost_configargs="--cache-file=./config.cache ${extra_host_args} ${baseargs}"
2200214571Sdim
2201214571Sdimtarget_configargs=${baseargs}
2202214571Sdim
2203214571Sdim# Passing a --with-cross-host argument lets the target libraries know
2204214571Sdim# whether they are being built with a cross-compiler or being built
2205214571Sdim# native.  However, it would be better to use other mechanisms to make the
2206214571Sdim# sorts of decisions they want to make on this basis.  Please consider
2207214571Sdim# this option to be deprecated.  FIXME.
2208214571Sdimif test x${is_cross_compiler} = xyes ; then
2209214571Sdim  target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
2210214571Sdimfi
2211214571Sdim
2212214571Sdim# Default to --enable-multilib.
2213214571Sdimif test x${enable_multilib} = x ; then
2214214571Sdim  target_configargs="--enable-multilib ${target_configargs}"
2215214571Sdimfi
2216214571Sdim
2217214571Sdim# Pass --with-newlib if appropriate.  Note that target_configdirs has
2218214571Sdim# changed from the earlier setting of with_newlib.
2219214571Sdimif test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
2220214571Sdim  target_configargs="--with-newlib ${target_configargs}"
2221214571Sdimfi
2222214571Sdim
2223214571Sdim# Different target subdirs use different values of certain variables
2224214571Sdim# (notably CXX).  Worse, multilibs use *lots* of different values.
2225214571Sdim# Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
2226214571Sdim# it doesn't automatically accept command-line overrides of them.
2227214571Sdim# This means it's not safe for target subdirs to share a cache file,
2228214571Sdim# which is disgusting, but there you have it.  Hopefully this can be
2229214571Sdim# fixed in future.  It's still worthwhile to use a cache file for each
2230214571Sdim# directory.  I think.
2231214571Sdim
2232214571Sdim# Pass the appropriate --build, --host, --target and --cache-file arguments.
2233214571Sdim# We need to pass --target, as newer autoconf's requires consistency
2234214571Sdim# for target_alias and gcc doesn't manage it consistently.
2235214571Sdimtarget_configargs="--cache-file=./config.cache ${target_configargs}"
2236214571Sdim
2237214571SdimFLAGS_FOR_TARGET=
2238214571Sdimcase " $target_configdirs " in
2239214571Sdim *" newlib "*)
2240214571Sdim  case " $target_configargs " in
2241214571Sdim  *" --with-newlib "*)
2242214571Sdim   case "$target" in
2243214571Sdim   *-cygwin*)
2244214571Sdim     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' ;;
2245214571Sdim   esac
2246214571Sdim
2247214571Sdim   # If we're not building GCC, don't discard standard headers.
2248214571Sdim   if test -d ${srcdir}/gcc; then
2249214571Sdim     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
2250214571Sdim
2251214571Sdim     if test "${build}" != "${host}"; then
2252214571Sdim       # On Canadian crosses, CC_FOR_TARGET will have already been set
2253214571Sdim       # by `configure', so we won't have an opportunity to add -Bgcc/
2254214571Sdim       # to it.  This is right: we don't want to search that directory
2255214571Sdim       # for binaries, but we want the header files in there, so add
2256214571Sdim       # them explicitly.
2257214571Sdim       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include'
2258214571Sdim
2259214571Sdim       # Someone might think of using the pre-installed headers on
2260214571Sdim       # Canadian crosses, in case the installed compiler is not fully
2261214571Sdim       # compatible with the compiler being built.  In this case, it
2262214571Sdim       # would be better to flag an error than risking having
2263214571Sdim       # incompatible object files being constructed.  We can't
2264214571Sdim       # guarantee that an error will be flagged, but let's hope the
2265214571Sdim       # compiler will do it, when presented with incompatible header
2266214571Sdim       # files.
2267214571Sdim     fi
2268214571Sdim   fi
2269214571Sdim
2270214571Sdim   case "${target}-${is_cross_compiler}" in
2271214571Sdim   i[[3456789]]86-*-linux*-no)
2272214571Sdim      # Here host == target, so we don't need to build gcc,
2273214571Sdim      # so we don't want to discard standard headers.
2274214571Sdim      FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
2275214571Sdim      ;;
2276214571Sdim   *)
2277214571Sdim      # If we're building newlib, use its generic headers last, but search
2278214571Sdim      # for any libc-related directories first (so make it the last -B
2279214571Sdim      # switch).
2280214571Sdim      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
2281214571Sdim      ;;
2282214571Sdim   esac
2283214571Sdim   ;;
2284214571Sdim  esac
2285214571Sdim  ;;
2286214571Sdimesac
2287214571Sdimcase "$target" in
2288214571Sdim*-mingw*)
2289214571Sdim  # Can't be handled as Cygwin above since Mingw does not use newlib.
2290214571Sdim  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' ;;
2291214571Sdimesac
2292214571Sdim
2293214571Sdim# Allow the user to override the flags for
2294214571Sdim# our build compiler if desired.
2295214571SdimCFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
2296214571Sdim
2297214571Sdim# On Canadian crosses, we'll be searching the right directories for
2298214571Sdim# the previously-installed cross compiler, so don't bother to add
2299214571Sdim# flags for directories within the install tree of the compiler
2300214571Sdim# being built; programs in there won't even run.
2301214571Sdimif test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
2302214571Sdim  # Search for pre-installed headers if nothing else fits.
2303214571Sdim  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
2304214571Sdimfi
2305214571Sdim
2306214571Sdimif test "x${use_gnu_ld}" = x &&
2307214571Sdim   echo " ${configdirs} " | grep " ld " > /dev/null ; then
2308214571Sdim  # Arrange for us to find uninstalled linker scripts.
2309214571Sdim  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
2310214571Sdimfi
2311214571Sdim
2312214571Sdim# Search for other target-specific linker scripts and such.
2313214571Sdimcase "${target}" in
2314214571Sdim  m32c-*-* )
2315214571Sdim    if test -d ${srcdir}/libgloss/m32c; then
2316214571Sdim      # This is for crt0.o
2317214571Sdim      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/m32c'
2318214571Sdim      # This is for r8c.ld
2319214571Sdim      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/m32c'
2320214571Sdim      # This is for libnosys.a
2321214571Sdim      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
2322214571Sdim    fi
2323214571Sdim    ;;
2324214571Sdim  mep*)
2325214571Sdim    FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
2326214571Sdim    ;;
2327214571Sdimesac
2328214571Sdim
2329214571Sdim# Makefile fragments.
2330214571Sdimfor frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
2331214571Sdimdo
2332214571Sdim  eval fragval=\$$frag
2333214571Sdim  if test $fragval != /dev/null; then
2334214571Sdim    eval $frag=${srcdir}/$fragval
2335214571Sdim  fi
2336214571Sdimdone
2337214571SdimAC_SUBST_FILE(host_makefile_frag)
2338214571SdimAC_SUBST_FILE(target_makefile_frag)
2339214571SdimAC_SUBST_FILE(alphaieee_frag)
2340214571SdimAC_SUBST_FILE(ospace_frag)
2341214571Sdim
2342214571Sdim# Miscellanea: directories, flags, etc.
2343214571SdimAC_SUBST(RPATH_ENVVAR)
2344214571SdimAC_SUBST(tooldir)
2345214571SdimAC_SUBST(build_tooldir)
2346214571SdimAC_SUBST(CONFIGURE_GDB_TK)
2347214571SdimAC_SUBST(GDB_TK)
2348214571SdimAC_SUBST(INSTALL_GDB_TK)
2349214571Sdim
2350214571Sdim# Build module lists & subconfigure args.
2351214571SdimAC_SUBST(build_configargs)
2352214571SdimAC_SUBST(build_configdirs)
2353214571Sdim
2354214571Sdim# Host module lists & subconfigure args.
2355214571SdimAC_SUBST(host_configargs)
2356214571SdimAC_SUBST(configdirs)
2357214571Sdim
2358214571Sdim# Target module lists & subconfigure args.
2359214571SdimAC_SUBST(target_configargs)
2360214571Sdim
2361214571Sdim
2362214571Sdim# Build tools.
2363214571SdimAC_SUBST(CC_FOR_BUILD)
2364214571SdimAC_SUBST(config_shell)
2365214571Sdim
2366214571Sdim# Generate default definitions for YACC, M4, LEX and other programs that run
2367214571Sdim# on the build machine.  These are used if the Makefile can't locate these
2368214571Sdim# programs in objdir.
2369214571SdimMISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
2370214571Sdim
2371214571SdimAC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
2372214571Sdimcase " $build_configdirs " in
2373214571Sdim  *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
2374214571Sdim  *" byacc "*) YACC='$$r/$(BUILD_SUBDIR)/byacc/byacc' ;;
2375214571Sdimesac
2376214571Sdim
2377214571SdimAC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
2378214571Sdimcase " $build_configdirs " in
2379214571Sdim  *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
2380214571Sdimesac
2381214571Sdim
2382214571SdimAC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
2383214571Sdimcase " $build_configdirs " in
2384214571Sdim  *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
2385214571Sdimesac
2386214571Sdim
2387214571SdimAC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
2388214571Sdimcase " $build_configdirs " in
2389214571Sdim  *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
2390214571Sdim  *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
2391214571Sdimesac
2392214571Sdim
2393214571SdimAC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
2394214571Sdimcase " $build_configdirs " in
2395214571Sdim  *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
2396214571Sdimesac
2397214571Sdim
2398214571SdimAC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
2399214571Sdimcase " $build_configdirs " in
2400214571Sdim  *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
2401214571Sdim  *)
2402214571Sdimchangequote(,)
2403214571Sdim    # For an installed makeinfo, we require it to be from texinfo 4.4 or
2404214571Sdim    # higher, else we use the "missing" dummy.
2405214571Sdim    if ${MAKEINFO} --version \
2406214571Sdim       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
2407214571Sdim      :
2408214571Sdim    else
2409214571Sdim      MAKEINFO="$MISSING makeinfo"
2410214571Sdim    fi
2411214571Sdim    ;;
2412214571Sdimchangequote([,])
2413214571Sdimesac
2414214571Sdim
2415214571Sdim# FIXME: expect and dejagnu may become build tools?
2416214571Sdim
2417214571SdimAC_CHECK_PROGS(EXPECT, expect, expect)
2418214571Sdimcase " $configdirs " in
2419214571Sdim  *" expect "*)
2420214571Sdim    test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
2421214571Sdim    ;;
2422214571Sdimesac
2423214571Sdim
2424214571SdimAC_CHECK_PROGS(RUNTEST, runtest, runtest)
2425214571Sdimcase " $configdirs " in
2426214571Sdim  *" dejagnu "*)
2427214571Sdim    test $host = $build && RUNTEST='$$s/$(HOST_SUBDIR)/dejagnu/runtest'
2428214571Sdim    ;;
2429214571Sdimesac
2430214571Sdim
2431214571Sdim
2432214571Sdim# Host tools.
2433214571SdimNCN_STRICT_CHECK_TOOLS(AR, ar)
2434214571SdimNCN_STRICT_CHECK_TOOLS(AS, as)
2435214571SdimNCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
2436214571SdimNCN_STRICT_CHECK_TOOLS(LD, ld)
2437214571SdimNCN_STRICT_CHECK_TOOLS(LIPO, lipo)
2438214571SdimNCN_STRICT_CHECK_TOOLS(NM, nm)
2439214571SdimNCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, :)
2440214571SdimNCN_STRICT_CHECK_TOOLS(STRIP, strip, :)
2441214571SdimNCN_STRICT_CHECK_TOOLS(WINDRES, windres)
2442214571SdimNCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
2443214571SdimNCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
2444214571SdimAC_SUBST(CC)
2445214571SdimAC_SUBST(CXX)
2446214571SdimAC_SUBST(CFLAGS)
2447214571SdimAC_SUBST(CFLAGS_FOR_BUILD)
2448214571SdimAC_SUBST(CXXFLAGS)
2449214571Sdim
2450214571Sdim# Target tools.
2451214571SdimAC_ARG_WITH([build-time-tools], 
2452214571Sdim  [  --with-build-time-tools=path
2453214571Sdim                          use given path to find target tools during the build],
2454214571Sdim  [case x"$withval" in
2455214571Sdim     x/*) ;;
2456214571Sdim     *)
2457214571Sdim       with_build_time_tools=
2458214571Sdim       AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
2459214571Sdim       ;;
2460214571Sdim   esac],
2461214571Sdim  [with_build_time_tools=])
2462214571Sdim
2463214571SdimNCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
2464214571SdimNCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
2465214571SdimNCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
2466214571SdimNCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj)
2467214571SdimNCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
2468214571Sdim
2469214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
2470214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
2471214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
2472214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
2473214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
2474214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
2475214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
2476214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :)
2477214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
2478214571SdimACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
2479214571Sdim
2480214571SdimRAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
2481214571Sdim
2482214571SdimGCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
2483214571SdimGCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
2484214571SdimGCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
2485214571SdimGCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
2486214571Sdim		[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],
2487214571Sdim		c++)
2488214571SdimGCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
2489214571Sdim		[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],
2490214571Sdim		c++)
2491214571SdimGCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
2492214571SdimGCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
2493214571SdimGCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ,
2494214571Sdim		[gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java)
2495214571SdimGCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
2496214571Sdim		[gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
2497214571SdimGCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
2498214571SdimGCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
2499214571SdimGCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
2500214571SdimGCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
2501214571SdimGCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
2502214571SdimGCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip])
2503214571SdimGCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
2504214571Sdim
2505214571SdimAC_SUBST(FLAGS_FOR_TARGET)
2506214571SdimAC_SUBST(RAW_CXX_FOR_TARGET)
2507214571Sdim
2508214571Sdim# Certain tools may need extra flags.
2509214571SdimAR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
2510214571SdimRANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
2511214571SdimNM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
2512214571Sdim
2513214571Sdim# When building target libraries, except in a Canadian cross, we use
2514214571Sdim# the same toolchain as the compiler we just built.
2515214571SdimCOMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
2516214571SdimCOMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
2517214571SdimCOMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
2518214571Sdimif test $host = $build; then
2519214571Sdim  case " $configdirs " in
2520214571Sdim    *" gcc "*)
2521214571Sdim      COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
2522214571Sdim      COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
2523214571Sdim      COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
2524214571Sdim      ;;
2525214571Sdim  esac
2526214571Sdimfi
2527214571Sdim
2528214571SdimAC_SUBST(COMPILER_AS_FOR_TARGET)
2529214571SdimAC_SUBST(COMPILER_LD_FOR_TARGET)
2530214571SdimAC_SUBST(COMPILER_NM_FOR_TARGET)
2531214571Sdim
2532214571SdimAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2533214571SdimAC_ARG_ENABLE(maintainer-mode,
2534214571Sdim[  --enable-maintainer-mode enable make rules and dependencies not useful
2535214571Sdim                          (and sometimes confusing) to the casual installer],
2536214571Sdim      USE_MAINTAINER_MODE=$enableval,
2537214571Sdim      USE_MAINTAINER_MODE=no)
2538214571SdimAC_MSG_RESULT($USE_MAINTAINER_MODE)
2539214571SdimAC_SUBST(MAINTAINER_MODE_TRUE)
2540214571SdimAC_SUBST(MAINTAINER_MODE_FALSE)
2541214571Sdimif test "$USE_MAINTAINER_MODE" = yes; then
2542214571Sdim  MAINTAINER_MODE_TRUE=
2543214571Sdim  MAINTAINER_MODE_FALSE='#'
2544214571Sdimelse
2545214571Sdim  MAINTAINER_MODE_TRUE='#'
2546214571Sdim  MAINTAINER_MODE_FALSE=
2547214571Sdimfi	
2548214571SdimMAINT=$MAINTAINER_MODE_TRUE
2549214571SdimAC_SUBST(MAINT)dnl
2550214571Sdim
2551214571Sdim# ---------------------
2552214571Sdim# GCC bootstrap support
2553214571Sdim# ---------------------
2554214571Sdim
2555214571Sdim# Stage specific cflags for build.
2556214571Sdimstage1_cflags="-g"
2557214571Sdimcase $build in
2558214571Sdim  vax-*-*)
2559214571Sdim    case ${GCC} in
2560214571Sdim      yes) stage1_cflags="-g -Wa,-J" ;;
2561214571Sdim      *) stage1_cflags="-g -J" ;;
2562214571Sdim    esac ;;
2563214571Sdimesac
2564214571Sdim
2565214571Sdim# This is aimed to mimic bootstrap with a non-GCC compiler to catch problems.
2566214571Sdimif test "$GCC" = yes; then
2567214571Sdim  saved_CFLAGS="$CFLAGS"
2568214571Sdim
2569214571Sdim  # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
2570214571Sdim  CFLAGS="$CFLAGS -fkeep-inline-functions"
2571214571Sdim  AC_MSG_CHECKING([whether -fkeep-inline-functions is supported])
2572214571Sdim  AC_TRY_COMPILE([
2573214571Sdim#if (__GNUC__ < 3) \
2574214571Sdim    || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
2575214571Sdim			  || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
2576214571Sdim#error http://gcc.gnu.org/PR29382
2577214571Sdim#endif
2578214571Sdim    ],,
2579214571Sdim    [AC_MSG_RESULT([yes]); stage1_cflags="$stage1_cflags -fkeep-inline-functions"],
2580214571Sdim    [AC_MSG_RESULT([no])])
2581214571Sdim
2582214571Sdim  CFLAGS="$saved_CFLAGS"
2583214571Sdimfi
2584214571Sdim
2585214571SdimAC_SUBST(stage1_cflags)
2586214571Sdim
2587214571Sdim# Enable --enable-checking in stage1 of the compiler.
2588214571SdimAC_ARG_ENABLE(stage1-checking,
2589214571Sdim[  --enable-stage1-checking[=all]   choose additional checking for stage1
2590214571Sdim                          of the compiler.],
2591214571Sdim[stage1_checking=--enable-checking=${enable_stage1_checking}],
2592214571Sdim[if test "x$enable_checking" = xno; then
2593214571Sdim  stage1_checking=--enable-checking
2594214571Sdimelse
2595214571Sdim  stage1_checking=--enable-checking${enable_checking+=}$enable_checking
2596214571Sdimfi])
2597214571SdimAC_SUBST(stage1_checking)
2598214571Sdim
2599214571Sdim# Enable -Werror in bootstrap stage2 and later.
2600214571SdimAC_ARG_ENABLE(werror,
2601214571Sdim[  --enable-werror         enable -Werror in bootstrap stage2 and later], [],
2602214571Sdim[if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; then
2603214571Sdim  enable_werror=yes
2604214571Sdimelse
2605214571Sdim  enable_werror=no
2606214571Sdimfi])
2607214571Sdimcase ${enable_werror} in
2608214571Sdim  yes) stage2_werror_flag="--enable-werror-always" ;;
2609214571Sdim  *) stage2_werror_flag="" ;;
2610214571Sdimesac
2611214571SdimAC_SUBST(stage2_werror_flag)
2612214571Sdim
2613214571Sdim# Flags needed to enable html installing and building
2614214571SdimAC_ARG_WITH(datarootdir,
2615214571Sdim[  --with-datarootdir	Use datarootdir as the data root directory.],
2616214571Sdim[datarootdir="\${prefix}/${withval}"],
2617214571Sdim[datarootdir="\${prefix}/share"])
2618214571Sdim
2619214571SdimAC_ARG_WITH(docdir,
2620214571Sdim[  --with-docdir	Install documentation in this directory.],
2621214571Sdim[docdir="\${prefix}/${withval}"],
2622214571Sdim[docdir="\${datarootdir}/doc"])
2623214571Sdim
2624214571SdimAC_ARG_WITH(pdfdir,
2625214571Sdim[  --with-pdfdir	Install pdf in this directory.],
2626214571Sdim[pdfdir="\${prefix}/${withval}"],
2627214571Sdim[pdfdir="\${docdir}"])
2628214571Sdim
2629214571SdimAC_ARG_WITH(htmldir,
2630214571Sdim[  --with-htmldir	Install html in this directory.],
2631214571Sdim[htmldir="\${prefix}/${withval}"],
2632214571Sdim[htmldir="\${docdir}"])
2633214571Sdim
2634214571SdimAC_SUBST(datarootdir)
2635214571SdimAC_SUBST(docdir)
2636214571SdimAC_SUBST(pdfdir)
2637214571SdimAC_SUBST(htmldir)
2638214571Sdim
2639214571SdimAC_OUTPUT(Makefile)
2640