xref: /openbsd/gnu/usr.bin/binutils/configure.in (revision c074d1c9)
1*c074d1c9Sdrahn#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2*c074d1c9Sdrahn#   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3258b3869Sniklas#
4258b3869Sniklas# This file is free software; you can redistribute it and/or modify it
5258b3869Sniklas# under the terms of the GNU General Public License as published by
6258b3869Sniklas# the Free Software Foundation; either version 2 of the License, or
7258b3869Sniklas# (at your option) any later version.
8258b3869Sniklas#
9258b3869Sniklas# This program is distributed in the hope that it will be useful, but
10258b3869Sniklas# WITHOUT ANY WARRANTY; without even the implied warranty of
11258b3869Sniklas# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12258b3869Sniklas# General Public License for more details.
13258b3869Sniklas#
14258b3869Sniklas# You should have received a copy of the GNU General Public License
15258b3869Sniklas# along with this program; if not, write to the Free Software
16258b3869Sniklas# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17258b3869Sniklas
182159047fSniklas##############################################################################
19*c074d1c9Sdrahn### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
20*c074d1c9Sdrahn
21*c074d1c9SdrahnAC_INIT(move-if-change)
22*c074d1c9SdrahnAC_PREREQ(2.13)
23*c074d1c9SdrahnAC_CANONICAL_SYSTEM
24*c074d1c9SdrahnAC_ARG_PROGRAM
25*c074d1c9Sdrahn
26*c074d1c9Sdrahnsinclude(config/acx.m4)
27*c074d1c9Sdrahn
28*c074d1c9Sdrahn### we might need to use some other shell than /bin/sh for running subshells
29*c074d1c9Sdrahn### If we are on Windows, search for the shell.  This will permit people
30*c074d1c9Sdrahn### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
31*c074d1c9Sdrahn### without also having to set CONFIG_SHELL.  This code will work when
32*c074d1c9Sdrahn### using bash, which sets OSTYPE.
33*c074d1c9Sdrahncase "${OSTYPE}" in
34*c074d1c9Sdrahn*win32*)
35*c074d1c9Sdrahn  if test x${CONFIG_SHELL} = x ; then
36*c074d1c9Sdrahn    if test ! -f /bin/sh ; then
37*c074d1c9Sdrahn      if test x${SHELL} != x && test -f ${SHELL} ; then
38*c074d1c9Sdrahn	CONFIG_SHELL=${SHELL}
39*c074d1c9Sdrahn	export CONFIG_SHELL
40*c074d1c9Sdrahn      else
41*c074d1c9Sdrahn	for prog in sh sh.exe bash bash.exe; do
42*c074d1c9Sdrahn	  IFS="${IFS=	}"; save_ifs="$IFS"; IFS="${IFS}:"
43*c074d1c9Sdrahn	  for dir in $PATH; do
44*c074d1c9Sdrahn	    test -z "$dir" && dir=.
45*c074d1c9Sdrahn	    if test -f $dir/$prog; then
46*c074d1c9Sdrahn	      CONFIG_SHELL=$dir/$prog
47*c074d1c9Sdrahn	      export CONFIG_SHELL
48*c074d1c9Sdrahn	      break
49*c074d1c9Sdrahn	    fi
50*c074d1c9Sdrahn	  done
51*c074d1c9Sdrahn	  IFS="$save_ifs"
52*c074d1c9Sdrahn	  test -n "${CONFIG_SHELL}" && break
53*c074d1c9Sdrahn	done
54*c074d1c9Sdrahn      fi
55*c074d1c9Sdrahn    fi
56*c074d1c9Sdrahn  fi
57*c074d1c9Sdrahn  ;;
58*c074d1c9Sdrahnesac
59*c074d1c9Sdrahn
60*c074d1c9Sdrahnconfig_shell=${CONFIG_SHELL-/bin/sh}
61*c074d1c9Sdrahn
62*c074d1c9Sdrahnprogname=$0
63*c074d1c9Sdrahn# if PWD already has a value, it is probably wrong.
64*c074d1c9Sdrahnif test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
65*c074d1c9Sdrahn
66*c074d1c9Sdrahn# Export original configure arguments for use by sub-configures.
67*c074d1c9SdrahnTOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
68*c074d1c9SdrahnAC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
69*c074d1c9Sdrahn
70*c074d1c9Sdrahnmoveifchange=${srcdir}/move-if-change
71*c074d1c9Sdrahn
72*c074d1c9Sdrahn# Set srcdir to "." if that's what it is.
73*c074d1c9Sdrahn# This is important for multilib support.
74*c074d1c9Sdrahnpwd=`${PWDCMD-pwd}`
75*c074d1c9Sdrahnsrcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
76*c074d1c9Sdrahnif test "${pwd}" = "${srcpwd}" ; then
77*c074d1c9Sdrahn  srcdir=.
78*c074d1c9Sdrahnfi
79*c074d1c9Sdrahn
80*c074d1c9Sdrahntopsrcdir=$srcpwd
81*c074d1c9Sdrahn
82*c074d1c9Sdrahnextra_host_args=
83*c074d1c9Sdrahn# Define the trigger file to make sure configure will re-run whenever
84*c074d1c9Sdrahn# the gcc version number changes.
85*c074d1c9Sdrahnif test "${with_gcc_version_trigger+set}" = set ; then
86*c074d1c9Sdrahn  gcc_version_trigger="$with_gcc_version_trigger"
87*c074d1c9Sdrahn  gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
88*c074d1c9Sdrahnelse
89*c074d1c9Sdrahn  # If gcc's sources are available, define the trigger file.
90*c074d1c9Sdrahn  if test -f ${topsrcdir}/gcc/version.c ; then
91*c074d1c9Sdrahn    gcc_version_trigger=${topsrcdir}/gcc/version.c
92*c074d1c9Sdrahn    gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
93*c074d1c9Sdrahn    case "$ac_configure_args" in
94*c074d1c9Sdrahn      *--with-gcc-version-trigger=$gcc_version_trigger* )
95*c074d1c9Sdrahn        ;;
96*c074d1c9Sdrahn      * )
97*c074d1c9Sdrahn        # Add to all subconfigure arguments: build, host, and target.
98*c074d1c9Sdrahn        ac_configure_args="$ac_configure_args --with-gcc-version-trigger=$gcc_version_trigger"
99*c074d1c9Sdrahn        ;;
100*c074d1c9Sdrahn    esac
101*c074d1c9Sdrahn  fi
102*c074d1c9Sdrahnfi
1032159047fSniklas
1042159047fSniklas### To add a new directory to the tree, first choose whether it is a target
1052159047fSniklas### or a host dependent tool.  Then put it into the appropriate list
106*c074d1c9Sdrahn### (library or tools, host or target), doing a dependency sort.
1072159047fSniklas
108*c074d1c9Sdrahn# Subdirs will be configured in the order listed in build_configdirs,
109*c074d1c9Sdrahn# configdirs, or target_configdirs; see the serialization section below.
110*c074d1c9Sdrahn
111*c074d1c9Sdrahn# Dependency sorting is only needed when *configuration* must be done in
112*c074d1c9Sdrahn# a particular order.  In all cases a dependency should be specified in
113*c074d1c9Sdrahn# the Makefile, whether or not it's implicitly specified here.
114*c074d1c9Sdrahn
115*c074d1c9Sdrahn# Double entries in build_configdirs, configdirs, or target_configdirs may
116*c074d1c9Sdrahn# cause circular dependencies and break everything horribly.
1172159047fSniklas
1182159047fSniklas# these libraries are used by various programs built for the host environment
1192159047fSniklas#
120*c074d1c9Sdrahnhost_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib"
121b55d4692Sfgsch
1222159047fSniklas# these tools are built for the host environment
123b305b0f1Sespie# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
124b305b0f1Sespie# know that we are building the simulator.
125*c074d1c9Sdrahn# binutils, gas and ld appear in that order because it makes sense to run
126*c074d1c9Sdrahn# "make check" in that particular order.
127*c074d1c9Sdrahnhost_tools="byacc flex bison binutils gas ld 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"
128*c074d1c9Sdrahn
129*c074d1c9Sdrahn# libgcj represents the runtime libraries only used by gcj.
130*c074d1c9Sdrahnlibgcj="target-libffi \
131*c074d1c9Sdrahn	target-boehm-gc \
132*c074d1c9Sdrahn	target-zlib \
133*c074d1c9Sdrahn	target-qthreads \
134*c074d1c9Sdrahn	target-libjava"
1352159047fSniklas
1362159047fSniklas# these libraries are built for the target environment, and are built after
1372159047fSniklas# the host libraries and the host tools (which may be a cross compiler)
1382159047fSniklas#
139b305b0f1Sespietarget_libs="target-libiberty \
140b305b0f1Sespie		target-libgloss \
141b305b0f1Sespie		target-newlib \
142*c074d1c9Sdrahn		target-libstdc++-v3 \
143b55d4692Sfgsch		target-libf2c \
144*c074d1c9Sdrahn		${libgcj} \
145b55d4692Sfgsch		target-libobjc"
1462159047fSniklas
1472159047fSniklas# these tools are built using the target libs, and are intended to run only
1482159047fSniklas# in the target environment
1492159047fSniklas#
1502159047fSniklas# note: any program that *uses* libraries that are in the "target_libs"
1512159047fSniklas# list belongs in this list.  those programs are also very likely
1522159047fSniklas# candidates for the "native_only" list which follows
1532159047fSniklas#
154*c074d1c9Sdrahntarget_tools="target-examples target-groff target-gperf target-rda"
1552159047fSniklas
1562159047fSniklas################################################################################
1572159047fSniklas
1582159047fSniklas## All tools belong in one of the four categories, and are assigned above
1592159047fSniklas## We assign ${configdirs} this way to remove all embedded newlines.  This
1602159047fSniklas## is important because configure will choke if they ever get through.
1612159047fSniklas## ${configdirs} is directories we build using the host tools.
1622159047fSniklas## ${target_configdirs} is directories we build using the target tools.
1632159047fSniklas#
1642159047fSniklasconfigdirs=`echo ${host_libs} ${host_tools}`
1652159047fSniklastarget_configdirs=`echo ${target_libs} ${target_tools}`
1662159047fSniklas
1672159047fSniklas################################################################################
1682159047fSniklas
1692159047fSniklassrcname="gnu development package"
1702159047fSniklas
1712159047fSniklas# This gets set non-empty for some net releases of packages.
1722159047fSniklasappdirs=""
1732159047fSniklas
174*c074d1c9Sdrahn# Define is_cross_compiler to save on calls to 'test'.
1752159047fSniklasis_cross_compiler=
176*c074d1c9Sdrahnif test x"${host}" = x"${target}" ; then
1772159047fSniklas  is_cross_compiler=no
1782159047fSniklaselse
1792159047fSniklas  is_cross_compiler=yes
180b305b0f1Sespiefi
181b305b0f1Sespie
182b305b0f1Sespie# We always want to use the same name for this directory, so that dejagnu
183b305b0f1Sespie# can reliably find it.
1842159047fSniklastarget_subdir=${target_alias}
185b305b0f1Sespie
186*c074d1c9Sdrahnif test ! -d ${target_subdir} ; then
1872159047fSniklas  if mkdir ${target_subdir} ; then true
1882159047fSniklas  else
189*c074d1c9Sdrahn    echo "'*** could not make ${PWD=`${PWDCMD-pwd}`}/${target_subdir}" 1>&2
1902159047fSniklas    exit 1
1912159047fSniklas  fi
1922159047fSniklasfi
1932159047fSniklas
194*c074d1c9Sdrahnbuild_prefix=build-
195*c074d1c9Sdrahnbuild_subdir=${build_prefix}${build_alias}
196*c074d1c9Sdrahn
197*c074d1c9Sdrahnif test x"${build_alias}" != x"${host}" ; then
198*c074d1c9Sdrahn  if test ! -d ${build_subdir} ; then
199*c074d1c9Sdrahn    if mkdir ${build_subdir} ; then true
200*c074d1c9Sdrahn    else
201*c074d1c9Sdrahn      echo "'*** could not make ${PWD=`${PWDCMD-pwd}`}/${build_subdir}" 1>&2
202*c074d1c9Sdrahn      exit 1
203*c074d1c9Sdrahn    fi
204*c074d1c9Sdrahn  fi
205*c074d1c9Sdrahnfi
206*c074d1c9Sdrahn
207*c074d1c9Sdrahn# Skipdirs are removed silently.
208*c074d1c9Sdrahnskipdirs=
209*c074d1c9Sdrahn# Noconfigdirs are removed loudly.
210*c074d1c9Sdrahnnoconfigdirs=""
211*c074d1c9Sdrahn
212*c074d1c9Sdrahnuse_gnu_ld=
213*c074d1c9Sdrahn# Make sure we don't let GNU ld be added if we didn't want it.
214*c074d1c9Sdrahnif test x$with_gnu_ld = xno ; then
215*c074d1c9Sdrahn  use_gnu_ld=no
216*c074d1c9Sdrahn  noconfigdirs="$noconfigdirs ld"
217*c074d1c9Sdrahnfi
218*c074d1c9Sdrahn
219*c074d1c9Sdrahnuse_gnu_as=
220*c074d1c9Sdrahn# Make sure we don't let GNU as be added if we didn't want it.
221*c074d1c9Sdrahnif test x$with_gnu_as = xno ; then
222*c074d1c9Sdrahn  use_gnu_as=no
223*c074d1c9Sdrahn  noconfigdirs="$noconfigdirs gas"
224*c074d1c9Sdrahnfi
225*c074d1c9Sdrahn
226*c074d1c9Sdrahn# some tools are so dependent upon X11 that if we're not building with X,
227*c074d1c9Sdrahn# it's not even worth trying to configure, much less build, that tool.
228*c074d1c9Sdrahn
229*c074d1c9Sdrahncase ${with_x} in
230*c074d1c9Sdrahn  yes | "") ;; # the default value for this tree is that X11 is available
231*c074d1c9Sdrahn  no)
232*c074d1c9Sdrahn    skipdirs="${skipdirs} tk tix itcl libgui"
233*c074d1c9Sdrahn    # We won't be able to build gdbtk without X.
234*c074d1c9Sdrahn    enable_gdbtk=no
235*c074d1c9Sdrahn    ;;
236*c074d1c9Sdrahn  *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
237*c074d1c9Sdrahnesac
238*c074d1c9Sdrahn
239*c074d1c9Sdrahn# Some tools are only suitable for building in a "native" situation.
240*c074d1c9Sdrahn# Remove these if host!=target.
241*c074d1c9Sdrahnnative_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
242*c074d1c9Sdrahn
243*c074d1c9Sdrahn# Similarly, some are only suitable for cross toolchains.
244*c074d1c9Sdrahn# Remove these if host=target.
245*c074d1c9Sdrahncross_only="target-libgloss target-newlib target-opcodes"
246*c074d1c9Sdrahn
247*c074d1c9Sdrahncase $is_cross_compiler in
248*c074d1c9Sdrahn  no) skipdirs="${skipdirs} ${cross_only}" ;;
249*c074d1c9Sdrahn  yes) skipdirs="${skipdirs} ${native_only}" ;;
250*c074d1c9Sdrahnesac
251*c074d1c9Sdrahn
252*c074d1c9Sdrahn# If both --with-headers and --with-libs are specified, default to
253*c074d1c9Sdrahn# --without-newlib.
254*c074d1c9Sdrahnif test x"${with_headers}" != x && test x"${with_libs}" != x ; then
255*c074d1c9Sdrahn  if test x"${with_newlib}" = x ; then
256*c074d1c9Sdrahn    with_newlib=no
257*c074d1c9Sdrahn  fi
258*c074d1c9Sdrahnfi
259*c074d1c9Sdrahn
260*c074d1c9Sdrahn# Recognize --with-newlib/--without-newlib.
261*c074d1c9Sdrahncase ${with_newlib} in
262*c074d1c9Sdrahn  no) skipdirs="${skipdirs} target-newlib" ;;
263*c074d1c9Sdrahn  yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
264*c074d1c9Sdrahnesac
265*c074d1c9Sdrahn
266*c074d1c9Sdrahn# Configure extra directories which are host specific
267*c074d1c9Sdrahn
268*c074d1c9Sdrahncase "${host}" in
269*c074d1c9Sdrahn  *-cygwin*)
270*c074d1c9Sdrahn    configdirs="$configdirs libtermcap" ;;
271*c074d1c9Sdrahnesac
272*c074d1c9Sdrahn
273*c074d1c9Sdrahn# Remove more programs from consideration, based on the host or
274*c074d1c9Sdrahn# target this usually means that a port of the program doesn't
275*c074d1c9Sdrahn# exist yet.
276*c074d1c9Sdrahn
277*c074d1c9Sdrahncase "${host}" in
278*c074d1c9Sdrahn  hppa*64*-*-*)
279*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs byacc"
280*c074d1c9Sdrahn    ;;
281*c074d1c9Sdrahn  i[[3456]]86-*-vsta)
282*c074d1c9Sdrahn    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext"
283*c074d1c9Sdrahn    ;;
284*c074d1c9Sdrahn  i[[3456]]86-*-go32* | i[[3456]]86-*-msdosdjgpp*)
285*c074d1c9Sdrahn    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi"
286*c074d1c9Sdrahn    ;;
287*c074d1c9Sdrahn  i[[3456]]86-*-mingw32*)
288*c074d1c9Sdrahn    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv"
289*c074d1c9Sdrahn    noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool"
290*c074d1c9Sdrahn    ;;
291*c074d1c9Sdrahn  i[[3456]]86-*-beos*)
292*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs tk itcl tix libgui gdb"
293*c074d1c9Sdrahn    ;;
294*c074d1c9Sdrahn  *-*-cygwin*)
295*c074d1c9Sdrahn    noconfigdirs="autoconf automake send-pr rcs guile perl"
296*c074d1c9Sdrahn    ;;
297*c074d1c9Sdrahn  *-*-netbsd*)
298*c074d1c9Sdrahn    noconfigdirs="rcs"
299*c074d1c9Sdrahn    ;;
300*c074d1c9Sdrahn  ppc*-*-pe)
301*c074d1c9Sdrahn    noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv"
302*c074d1c9Sdrahn    ;;
303*c074d1c9Sdrahn  powerpc-*-beos*)
304*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
305*c074d1c9Sdrahn    ;;
306*c074d1c9Sdrahn  *-*-darwin*)
307*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs tk itcl tix libgui"
308*c074d1c9Sdrahn    ;;
309*c074d1c9Sdrahnesac
310*c074d1c9Sdrahn
311*c074d1c9Sdrahn# Save it here so that, even in case of --enable-libgcj, if the Java
312*c074d1c9Sdrahn# front-end isn't enabled, we still get libgcj disabled.
313*c074d1c9Sdrahnlibgcj_saved=$libgcj
314*c074d1c9Sdrahncase $enable_libgcj in
315*c074d1c9Sdrahnyes)
316*c074d1c9Sdrahn  # If we reset it here, it won't get added to noconfigdirs in the
317*c074d1c9Sdrahn  # target-specific build rules, so it will be forcibly enabled
318*c074d1c9Sdrahn  # (unless the Java language itself isn't enabled).
319*c074d1c9Sdrahn  libgcj=
320*c074d1c9Sdrahn  ;;
321*c074d1c9Sdrahnno)
322*c074d1c9Sdrahn  # Make sure we get it printed in the list of not supported target libs.
323*c074d1c9Sdrahn  noconfigdirs="$noconfigdirs ${libgcj}"
324*c074d1c9Sdrahn  ;;
325*c074d1c9Sdrahnesac
326*c074d1c9Sdrahn
327*c074d1c9Sdrahncase "${target}" in
328*c074d1c9Sdrahn  *-*-chorusos)
329*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
330*c074d1c9Sdrahn    ;;
331*c074d1c9Sdrahn  *-*-darwin*)
332*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
333*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libobjc ${libgcj}"
334*c074d1c9Sdrahn    ;;
335*c074d1c9Sdrahn  *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
336*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
337*c074d1c9Sdrahn    ;;
338*c074d1c9Sdrahn  *-*-kaos*)
339*c074d1c9Sdrahn    # Remove unsupported stuff on all kaOS configurations.
340*c074d1c9Sdrahn    skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-libf2c target-librx"
341*c074d1c9Sdrahn    skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf"
342*c074d1c9Sdrahn    skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib"
343*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss"
344*c074d1c9Sdrahn    ;;
345*c074d1c9Sdrahn  *-*-netbsd*)
346*c074d1c9Sdrahn    # Skip some stuff on all NetBSD configurations.
347*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
348*c074d1c9Sdrahn
349*c074d1c9Sdrahn    # Skip some stuff that's unsupported on some NetBSD configurations.
350*c074d1c9Sdrahn    case "${target}" in
351*c074d1c9Sdrahn      i*86-*-netbsdelf*) ;;
352*c074d1c9Sdrahn      arm*-*-netbsdelf*) ;;
353*c074d1c9Sdrahn      *)
354*c074d1c9Sdrahn	noconfigdirs="$noconfigdirs ${libgcj}"
355*c074d1c9Sdrahn	;;
356*c074d1c9Sdrahn    esac
357*c074d1c9Sdrahn    ;;
358*c074d1c9Sdrahn  *-*-netware)
359*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-newlib target-libiberty target-libgloss ${libgcj}"
360*c074d1c9Sdrahn    ;;
361*c074d1c9Sdrahn  *-*-rtems*)
362*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
363*c074d1c9Sdrahn    case ${target} in
364*c074d1c9Sdrahn	h8300*-*-* | h8500-*-*)
365*c074d1c9Sdrahn	  noconfigdirs="$noconfigdirs target-libf2c"
366*c074d1c9Sdrahn          ;;
367*c074d1c9Sdrahn        *) ;;
368*c074d1c9Sdrahn    esac
369*c074d1c9Sdrahn    ;;
370*c074d1c9Sdrahn  *-*-vxworks*)
371*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
372*c074d1c9Sdrahn    ;;
373*c074d1c9Sdrahn  alpha*-dec-osf*)
374*c074d1c9Sdrahn    # ld works, but does not support shared libraries.
375*c074d1c9Sdrahn    # newlib is not 64 bit ready.  I'm not sure about fileutils.
376*c074d1c9Sdrahn    # gas doesn't generate exception information.
377*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gas ld fileutils target-newlib target-libgloss"
378*c074d1c9Sdrahn    ;;
379*c074d1c9Sdrahn  alpha*-*-*vms*)
380*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss ${libgcj}"
381*c074d1c9Sdrahn    ;;
382*c074d1c9Sdrahn  alpha*-*-linux*)
383*c074d1c9Sdrahn    # newlib is not 64 bit ready
384*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
385*c074d1c9Sdrahn    ;;
386*c074d1c9Sdrahn  alpha*-*-freebsd*)
387*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
388*c074d1c9Sdrahn    ;;
389*c074d1c9Sdrahn  alpha*-*-*)
390*c074d1c9Sdrahn    # newlib is not 64 bit ready
391*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
392*c074d1c9Sdrahn    ;;
393*c074d1c9Sdrahn  sh-*-linux*)
394*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
395*c074d1c9Sdrahn    ;;
396*c074d1c9Sdrahn  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
397*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
398*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-examples"
399*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
400*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim"
401*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs expect dejagnu"
402*c074d1c9Sdrahn    # the C++ libraries don't build on top of CE's C libraries
403*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3"
404*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib"
405*c074d1c9Sdrahn    case "${host}" in
406*c074d1c9Sdrahn      *-*-cygwin*) ;; # keep gdb and readline
407*c074d1c9Sdrahn      *) noconfigdirs="$noconfigdirs gdb readline"
408*c074d1c9Sdrahn	 ;;
409*c074d1c9Sdrahn    esac
410*c074d1c9Sdrahn    ;;
411*c074d1c9Sdrahn  arc-*-*)
412*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
413*c074d1c9Sdrahn    ;;
414*c074d1c9Sdrahn  arm-*-coff | strongarm-*-coff | xscale-*-coff)
415*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
416*c074d1c9Sdrahn    ;;
417*c074d1c9Sdrahn  arm-*-elf* | strongarm-*-elf* | xscale-*-elf*)
418*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
419*c074d1c9Sdrahn    ;;
420*c074d1c9Sdrahn  arm-*-pe*)
421*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
422*c074d1c9Sdrahn    ;;
423*c074d1c9Sdrahn  arm-*-oabi*)
424*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
425*c074d1c9Sdrahn    ;;
426*c074d1c9Sdrahn  thumb-*-coff)
427*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
428*c074d1c9Sdrahn    ;;
429*c074d1c9Sdrahn  thumb-*-elf)
430*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
431*c074d1c9Sdrahn    ;;
432*c074d1c9Sdrahn  thumb-*-oabi)
433*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
434*c074d1c9Sdrahn    ;;
435*c074d1c9Sdrahn  thumb-*-pe)
436*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
437*c074d1c9Sdrahn    ;;
438*c074d1c9Sdrahn  arm-*-riscix*)
439*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
440*c074d1c9Sdrahn    ;;
441*c074d1c9Sdrahn  avr-*-*)
442*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
443*c074d1c9Sdrahn    ;;
444*c074d1c9Sdrahn  c4x-*-* | tic4x-*-*)
445*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
446*c074d1c9Sdrahn    ;;
447*c074d1c9Sdrahn  c54x*-*-* | tic54x-*-*)
448*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib"
449*c074d1c9Sdrahn    ;;
450*c074d1c9Sdrahn  cris-*-*)
451*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
452*c074d1c9Sdrahn    ;;
453*c074d1c9Sdrahn  d10v-*-*)
454*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
455*c074d1c9Sdrahn    ;;
456*c074d1c9Sdrahn  d30v-*-*)
457*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
458*c074d1c9Sdrahn    ;;
459*c074d1c9Sdrahn  fr30-*-elf*)
460*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
461*c074d1c9Sdrahn    ;;
462*c074d1c9Sdrahn  frv-*-*)
463*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
464*c074d1c9Sdrahn    ;;
465*c074d1c9Sdrahn  h8300*-*-*)
466*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss"
467*c074d1c9Sdrahn    ;;
468*c074d1c9Sdrahn  h8500-*-*)
469*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} target-libf2c"
470*c074d1c9Sdrahn    ;;
471*c074d1c9Sdrahn  hppa*64*-*-linux* | parisc*64*-*-linux*)
472*c074d1c9Sdrahn    # In this case, it's because the hppa64-linux target is for
473*c074d1c9Sdrahn    # the kernel only at this point and has no libc, and thus no
474*c074d1c9Sdrahn    # headers, crt*.o, etc., all of which are needed by these.
475*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-zlib"
476*c074d1c9Sdrahn    ;;
477*c074d1c9Sdrahn  hppa*-*-*elf* | \
478*c074d1c9Sdrahn  parisc*-*-linux* | hppa*-*-linux* | \
479*c074d1c9Sdrahn  hppa*-*-lites* | \
480*c074d1c9Sdrahn  hppa*-*-openbsd* | \
481*c074d1c9Sdrahn  hppa*64*-*-*)
482*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
483*c074d1c9Sdrahn    # Do configure ld/binutils/gas for this case.
484*c074d1c9Sdrahn    ;;
485*c074d1c9Sdrahn  hppa*-*-*)
486*c074d1c9Sdrahn    # According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
487*c074d1c9Sdrahn    # build on HP-UX 10.20.
488*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ld shellutils ${libgcj}"
489*c074d1c9Sdrahn    ;;
490*c074d1c9Sdrahn  ia64*-*-elf*)
491*c074d1c9Sdrahn    # No gdb support yet.
492*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
493*c074d1c9Sdrahn    ;;
494*c074d1c9Sdrahn  ia64*-**-hpux*)
495*c074d1c9Sdrahn    # No gdb or ld support yet.
496*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb ld"
497*c074d1c9Sdrahn    ;;
498*c074d1c9Sdrahn  i[[3456]]86-*-coff | i[[3456]]86-*-elf)
499*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
500*c074d1c9Sdrahn    ;;
501*c074d1c9Sdrahn  i[[34567]]86-*-freebsd*)
502*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
503*c074d1c9Sdrahn    ;;
504*c074d1c9Sdrahn  i[[3456]]86-*-linux*)
505*c074d1c9Sdrahn    # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
506*c074d1c9Sdrahn    # not build java stuff by default.
507*c074d1c9Sdrahn    case "${target}" in
508*c074d1c9Sdrahn      *-*-*libc1*)
509*c074d1c9Sdrahn	noconfigdirs="$noconfigdirs ${libgcj}";;
510*c074d1c9Sdrahn    esac
511*c074d1c9Sdrahn
512*c074d1c9Sdrahn    # This section makes it possible to build newlib natively on linux.
513*c074d1c9Sdrahn    # If we are using a cross compiler then don't configure newlib.
514*c074d1c9Sdrahn    if test x${is_cross_compiler} != xno ; then
515*c074d1c9Sdrahn      noconfigdirs="$noconfigdirs target-newlib"
516*c074d1c9Sdrahn    fi
517*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss"
518*c074d1c9Sdrahn    # If we are not using a cross compiler, do configure newlib.
519*c074d1c9Sdrahn    # Note however, that newlib will only be configured in this situation
520*c074d1c9Sdrahn    # if the --with-newlib option has been given, because otherwise
521*c074d1c9Sdrahn    # 'target-newlib' will appear in skipdirs.
522*c074d1c9Sdrahn    ;;
523*c074d1c9Sdrahn  i[[3456]]86-*-mingw32*)
524*c074d1c9Sdrahn    target_configdirs="$target_configdirs target-mingw"
525*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs expect target-libgloss ${libgcj}"
526*c074d1c9Sdrahn
527*c074d1c9Sdrahn    # Can't build gdb for mingw32 if not native.
528*c074d1c9Sdrahn    case "${host}" in
529*c074d1c9Sdrahn      i[[3456]]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
530*c074d1c9Sdrahn      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix gnuserv"
531*c074d1c9Sdrahn         ;;
532*c074d1c9Sdrahn    esac
533*c074d1c9Sdrahn    ;;
534*c074d1c9Sdrahn  *-*-cygwin*)
535*c074d1c9Sdrahn    target_configdirs="$target_configdirs target-libtermcap target-winsup"
536*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
537*c074d1c9Sdrahn    # always build newlib.
538*c074d1c9Sdrahn    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
539*c074d1c9Sdrahn
540*c074d1c9Sdrahn    # Can't build gdb for Cygwin if not native.
541*c074d1c9Sdrahn    case "${host}" in
542*c074d1c9Sdrahn      *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
543*c074d1c9Sdrahn      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui gnuserv"
544*c074d1c9Sdrahn         ;;
545*c074d1c9Sdrahn    esac
546*c074d1c9Sdrahn    ;;
547*c074d1c9Sdrahn  i[[3456]]86-*-pe)
548*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
549*c074d1c9Sdrahn    ;;
550*c074d1c9Sdrahn  i[[3456]]86-*-sco3.2v5*)
551*c074d1c9Sdrahn    # The linker does not yet know about weak symbols in COFF,
552*c074d1c9Sdrahn    # and is not configured to handle mixed ELF and COFF.
553*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
554*c074d1c9Sdrahn    ;;
555*c074d1c9Sdrahn  i[[3456]]86-*-sco*)
556*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
557*c074d1c9Sdrahn    ;;
558*c074d1c9Sdrahn  i[[3456]]86-*-solaris2*)
559*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss"
560*c074d1c9Sdrahn    ;;
561*c074d1c9Sdrahn  i[[3456]]86-*-sysv4*)
562*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
563*c074d1c9Sdrahn    ;;
564*c074d1c9Sdrahn  i[[3456]]86-*-beos*)
565*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
566*c074d1c9Sdrahn    ;;
567*c074d1c9Sdrahn  m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
568*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
569*c074d1c9Sdrahn    ;;
570*c074d1c9Sdrahn  m68k-*-elf*)
571*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
572*c074d1c9Sdrahn    ;;
573*c074d1c9Sdrahn  m68k-*-coff*)
574*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
575*c074d1c9Sdrahn    ;;
576*c074d1c9Sdrahn  mcore-*-pe*)
577*c074d1c9Sdrahn  # The EPOC C++ environment does not support exceptions or rtti,
578*c074d1c9Sdrahn  # and so building libstdc++-v3 tends not to always work.
579*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libstdc++-v3"
580*c074d1c9Sdrahn    ;;
581*c074d1c9Sdrahn  mmix-*-*)
582*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj} gdb libgloss"
583*c074d1c9Sdrahn    ;;
584*c074d1c9Sdrahn  mn10200-*-*)
585*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
586*c074d1c9Sdrahn    ;;
587*c074d1c9Sdrahn  mn10300-*-*)
588*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
589*c074d1c9Sdrahn    ;;
590*c074d1c9Sdrahn  powerpc-*-aix*)
591*c074d1c9Sdrahn    # copied from rs6000-*-* entry
592*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
593*c074d1c9Sdrahn    ;;
594*c074d1c9Sdrahn  powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
595*c074d1c9Sdrahn    target_configdirs="$target_configdirs target-winsup"
596*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix gnuserv ${libgcj}"
597*c074d1c9Sdrahn    # always build newlib.
598*c074d1c9Sdrahn    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
599*c074d1c9Sdrahn    ;;
600*c074d1c9Sdrahn    # This is temporary until we can link against shared libraries
601*c074d1c9Sdrahn  powerpcle-*-solaris*)
602*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix gnuserv ${libgcj}"
603*c074d1c9Sdrahn    ;;
604*c074d1c9Sdrahn  powerpc-*-beos*)
605*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
606*c074d1c9Sdrahn    ;;
607*c074d1c9Sdrahn  powerpc-*-eabi)
608*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
609*c074d1c9Sdrahn    ;;
610*c074d1c9Sdrahn  rs6000-*-lynxos*)
611*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}"
612*c074d1c9Sdrahn    ;;
613*c074d1c9Sdrahn  rs6000-*-aix*)
614*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof ${libgcj}"
615*c074d1c9Sdrahn    ;;
616*c074d1c9Sdrahn  rs6000-*-*)
617*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof ${libgcj}"
618*c074d1c9Sdrahn    ;;
619*c074d1c9Sdrahn  m68k-apollo-*)
620*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
621*c074d1c9Sdrahn    ;;
622*c074d1c9Sdrahn  mips*-*-irix5*)
623*c074d1c9Sdrahn    # The GNU linker does not support shared libraries.
624*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ld gprof target-libgloss ${libgcj}"
625*c074d1c9Sdrahn    ;;
626*c074d1c9Sdrahn  mips*-*-irix6*)
627*c074d1c9Sdrahn    # Linking libjava exceeds command-line length limits on at least
628*c074d1c9Sdrahn    # IRIX 6.2, but not on IRIX 6.5.
629*c074d1c9Sdrahn    # Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
630*c074d1c9Sdrahn    # <oldham@codesourcery.com>
631*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
632*c074d1c9Sdrahn    ;;
633*c074d1c9Sdrahn  mips*-dec-bsd*)
634*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
635*c074d1c9Sdrahn    ;;
636*c074d1c9Sdrahn  mips*-*-openbsd*)
637*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss target-libffi ${libgcj}"
638*c074d1c9Sdrahn    ;;
639*c074d1c9Sdrahn  mips*-*-bsd*)
640*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
641*c074d1c9Sdrahn    ;;
642*c074d1c9Sdrahn  mipstx39-*-*)
643*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof ${libgcj}"   # same as generic mips
644*c074d1c9Sdrahn    ;;
645*c074d1c9Sdrahn  mips*-*-linux*)
646*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
647*c074d1c9Sdrahn    ;;
648*c074d1c9Sdrahn  mips*-*-*)
649*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs gprof ${libgcj}"
650*c074d1c9Sdrahn    ;;
651*c074d1c9Sdrahn  romp-*-*)
652*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
653*c074d1c9Sdrahn    ;;
654*c074d1c9Sdrahn  sh-*-*)
655*c074d1c9Sdrahn    case "${host}" in
656*c074d1c9Sdrahn      i[[3456]]86-*-vsta) ;; # don't add gprof back in
657*c074d1c9Sdrahn      i[[3456]]86-*-go32*) ;; # don't add gprof back in
658*c074d1c9Sdrahn      i[[3456]]86-*-msdosdjgpp*) ;; # don't add gprof back in
659*c074d1c9Sdrahn      *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
660*c074d1c9Sdrahn    esac
661*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
662*c074d1c9Sdrahn    ;;
663*c074d1c9Sdrahn  sh64-*-*)
664*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
665*c074d1c9Sdrahn    ;;
666*c074d1c9Sdrahn  sparc-*-elf*)
667*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
668*c074d1c9Sdrahn    ;;
669*c074d1c9Sdrahn  sparc64-*-elf*)
670*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
671*c074d1c9Sdrahn    ;;
672*c074d1c9Sdrahn  sparclite-*-*)
673*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
674*c074d1c9Sdrahn    ;;
675*c074d1c9Sdrahn  sparc-*-sunos4*)
676*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
677*c074d1c9Sdrahn    if test x${is_cross_compiler} != xno ; then
678*c074d1c9Sdrahn           noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
679*c074d1c9Sdrahn    else
680*c074d1c9Sdrahn           use_gnu_ld=no
681*c074d1c9Sdrahn    fi
682*c074d1c9Sdrahn    ;;
683*c074d1c9Sdrahn  sparc-*-solaris* | sparc64-*-solaris* | sparcv9-*-solaris*)
684*c074d1c9Sdrahn    ;;
685*c074d1c9Sdrahn  v810-*-*)
686*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libstdc++-v3 opcodes target-libgloss ${libgcj}"
687*c074d1c9Sdrahn    ;;
688*c074d1c9Sdrahn  v850-*-*)
689*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
690*c074d1c9Sdrahn    ;;
691*c074d1c9Sdrahn  v850e-*-*)
692*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
693*c074d1c9Sdrahn    ;;
694*c074d1c9Sdrahn  v850ea-*-*)
695*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
696*c074d1c9Sdrahn    ;;
697*c074d1c9Sdrahn  vax-*-openbsd*)
698*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ld gas gprof ${libgcj}"
699*c074d1c9Sdrahn    ;;
700*c074d1c9Sdrahn  vax-*-vms)
701*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss ${libgcj}"
702*c074d1c9Sdrahn    ;;
703*c074d1c9Sdrahn  vax-*-*)
704*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
705*c074d1c9Sdrahn    ;;
706*c074d1c9Sdrahn  ip2k-*-*)
707*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
708*c074d1c9Sdrahn    ;;
709*c074d1c9Sdrahn  *-*-linux*)
710*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
711*c074d1c9Sdrahn    ;;
712*c074d1c9Sdrahn  *-*-lynxos*)
713*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
714*c074d1c9Sdrahn    ;;
715*c074d1c9Sdrahn  *-*-*)
716*c074d1c9Sdrahn    noconfigdirs="$noconfigdirs ${libgcj}"
717*c074d1c9Sdrahn    ;;
718*c074d1c9Sdrahnesac
719*c074d1c9Sdrahn
720*c074d1c9Sdrahn# If we aren't building newlib, then don't build libgloss, since libgloss
721*c074d1c9Sdrahn# depends upon some newlib header files.
722*c074d1c9Sdrahncase "${noconfigdirs}" in
723*c074d1c9Sdrahn  *target-libgloss*) ;;
724*c074d1c9Sdrahn  *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
725*c074d1c9Sdrahnesac
726*c074d1c9Sdrahn
727*c074d1c9Sdrahn# Figure out what language subdirectories are present.
728*c074d1c9Sdrahn# Look if the user specified --enable-languages="..."; if not, use
729*c074d1c9Sdrahn# the environment variable $LANGUAGES if defined. $LANGUAGES might
730*c074d1c9Sdrahn# go away some day.
731*c074d1c9Sdrahn# NB:  embedded tabs in this IF block -- do not untabify
732*c074d1c9Sdrahnif test x"${enable_languages+set}" != xset; then
733*c074d1c9Sdrahn  if test x"${LANGUAGES+set}" = xset; then
734*c074d1c9Sdrahn    enable_languages="${LANGUAGES}"
735*c074d1c9Sdrahn      echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
736*c074d1c9Sdrahn  else
737*c074d1c9Sdrahn    enable_languages=all
738*c074d1c9Sdrahn  fi
739*c074d1c9Sdrahnelse
740*c074d1c9Sdrahn  if test x"${enable_languages}" = x ||
741*c074d1c9Sdrahn     test x"${enable_languages}" = xyes;
742*c074d1c9Sdrahn     then
743*c074d1c9Sdrahn    echo configure.in: --enable-languages needs at least one language argument 1>&2
744*c074d1c9Sdrahn    exit 1
745*c074d1c9Sdrahn  fi
746*c074d1c9Sdrahnfi
747*c074d1c9Sdrahnenable_languages=`echo "${enable_languages}" | sed -e 's/[[ 	,]][[ 	,]]*/,/g' -e 's/,$//'`
748*c074d1c9Sdrahn
749*c074d1c9Sdrahn# First scan to see if an enabled language requires some other language.
750*c074d1c9Sdrahn# We assume that a given config-lang.in will list all the language
751*c074d1c9Sdrahn# front ends it requires, even if some are required indirectly.
752*c074d1c9Sdrahnfor lang in ${srcdir}/gcc/*/config-lang.in ..
753*c074d1c9Sdrahndo
754*c074d1c9Sdrahn  case $lang in
755*c074d1c9Sdrahn    ..) ;;
756*c074d1c9Sdrahn    # The odd quoting in the next line works around
757*c074d1c9Sdrahn    # an apparent bug in bash 1.12 on linux.
758*c074d1c9Sdrahn    ${srcdir}/gcc/[[*]]/config-lang.in) ;;
759*c074d1c9Sdrahn    *)
760*c074d1c9Sdrahn      lang_alias=`sed -n -e 's,^language=[['"'"'"'"]]\(.*\)[["'"'"'"']].*$,\1,p' -e 's,^language=\([[^ 	]]*\).*$,\1,p' $lang`
761*c074d1c9Sdrahn      this_lang_requires=`sed -n -e 's,^lang_requires=[['"'"'"'"]]\(.*\)[["'"'"'"']].*$,\1,p' -e 's,^lang_requires=\([[^ 	]]*\).*$,\1,p' $lang`
762*c074d1c9Sdrahn      for other in $this_lang_requires
763*c074d1c9Sdrahn      do
764*c074d1c9Sdrahn        case ,${enable_languages}, in
765*c074d1c9Sdrahn	  *,$other,*) ;;
766*c074d1c9Sdrahn	  *,all,*) ;;
767*c074d1c9Sdrahn	  *,$lang_alias,*)
768*c074d1c9Sdrahn	    echo " \`$other' language required by \`$lang_alias'; enabling" 1>&2
769*c074d1c9Sdrahn	    enable_languages="$enable_languages,$other"
770*c074d1c9Sdrahn	    ;;
771*c074d1c9Sdrahn	esac
772*c074d1c9Sdrahn      done
773*c074d1c9Sdrahn      ;;
774*c074d1c9Sdrahn  esac
775*c074d1c9Sdrahndone
776*c074d1c9Sdrahn
777*c074d1c9Sdrahnsubdirs=
778*c074d1c9Sdrahnfor lang in ${srcdir}/gcc/*/config-lang.in ..
779*c074d1c9Sdrahndo
780*c074d1c9Sdrahn  case $lang in
781*c074d1c9Sdrahn    ..) ;;
782*c074d1c9Sdrahn    # The odd quoting in the next line works around
783*c074d1c9Sdrahn    # an apparent bug in bash 1.12 on linux.
784*c074d1c9Sdrahn    ${srcdir}/gcc/[[*]]/config-lang.in) ;;
785*c074d1c9Sdrahn    *)
786*c074d1c9Sdrahn      lang_alias=`sed -n -e 's,^language=[['"'"'"'"]]\(.*\)[["'"'"'"']].*$,\1,p' -e 's,^language=\([[^ 	]]*\).*$,\1,p' $lang`
787*c074d1c9Sdrahn      this_lang_libs=`sed -n -e 's,^target_libs=[['"'"'"'"]]\(.*\)[["'"'"'"']].*$,\1,p' -e 's,^target_libs=\([[^ 	]]*\).*$,\1,p' $lang`
788*c074d1c9Sdrahn      this_lang_dirs=`sed -n -e 's,^lang_dirs=[['"'"'"'"]]\(.*\)[["'"'"'"']].*$,\1,p' -e 's,^lang_dirs=\([[^ 	]]*\).*$,\1,p' $lang`
789*c074d1c9Sdrahn      build_by_default=`sed -n -e 's,^build_by_default=[['"'"'"'"]]\(.*\)[["'"'"'"']].*$,\1,p' -e 's,^build_by_default=\([[^ 	]]*\).*$,\1,p' $lang`
790*c074d1c9Sdrahn      if test "x$lang_alias" = x
791*c074d1c9Sdrahn         then
792*c074d1c9Sdrahn        echo "$lang doesn't set \$language." 1>&2
793*c074d1c9Sdrahn        exit 1
794*c074d1c9Sdrahn      fi
795*c074d1c9Sdrahn      case ${build_by_default},${enable_languages}, in
796*c074d1c9Sdrahn        *,$lang_alias,*) add_this_lang=yes ;;
797*c074d1c9Sdrahn        no,*) add_this_lang=no ;;
798*c074d1c9Sdrahn        *,all,*) add_this_lang=yes ;;
799*c074d1c9Sdrahn        *) add_this_lang=no ;;
800*c074d1c9Sdrahn      esac
801*c074d1c9Sdrahn      if test x"${add_this_lang}" = xyes; then
802*c074d1c9Sdrahn        eval target_libs='"$target_libs "'\"$this_lang_libs\"
803*c074d1c9Sdrahn      else
804*c074d1c9Sdrahn        eval noconfigdirs='"$noconfigdirs "'\"$this_lang_libs $this_lang_dirs\"
805*c074d1c9Sdrahn      fi
806*c074d1c9Sdrahn      ;;
807*c074d1c9Sdrahn  esac
808*c074d1c9Sdrahndone
809*c074d1c9Sdrahn
810*c074d1c9Sdrahn# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
811*c074d1c9Sdrahn# $target_configdirs.
812*c074d1c9Sdrahn# If we have the source for $noconfigdirs entries, add them to $notsupp.
813*c074d1c9Sdrahn
814*c074d1c9Sdrahnnotsupp=""
815*c074d1c9Sdrahnfor dir in . $skipdirs $noconfigdirs ; do
816*c074d1c9Sdrahn  dirname=`echo $dir | sed -e s/target-//g`
817*c074d1c9Sdrahn  if test $dir != .  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
818*c074d1c9Sdrahn    configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
819*c074d1c9Sdrahn    if test -r $srcdir/$dirname/configure ; then
820*c074d1c9Sdrahn      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
821*c074d1c9Sdrahn	true
822*c074d1c9Sdrahn      else
823*c074d1c9Sdrahn	notsupp="$notsupp $dir"
824*c074d1c9Sdrahn      fi
825*c074d1c9Sdrahn    fi
826*c074d1c9Sdrahn  fi
827*c074d1c9Sdrahn  if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
828*c074d1c9Sdrahn    target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
829*c074d1c9Sdrahn    if test -r $srcdir/$dirname/configure ; then
830*c074d1c9Sdrahn      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
831*c074d1c9Sdrahn	true
832*c074d1c9Sdrahn      else
833*c074d1c9Sdrahn	notsupp="$notsupp $dir"
834*c074d1c9Sdrahn      fi
835*c074d1c9Sdrahn    fi
836*c074d1c9Sdrahn  fi
837*c074d1c9Sdrahndone
838*c074d1c9Sdrahn
839*c074d1c9Sdrahn# Sometimes the tools are distributed with libiberty but with no other
840*c074d1c9Sdrahn# libraries.  In that case, we don't want to build target-libiberty.
841*c074d1c9Sdrahnif test -n "${target_configdirs}" ; then
842*c074d1c9Sdrahn  others=
843*c074d1c9Sdrahn  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
844*c074d1c9Sdrahn    if test "$i" != "libiberty" ; then
845*c074d1c9Sdrahn      if test -r $srcdir/$i/configure ; then
846*c074d1c9Sdrahn	others=yes;
847*c074d1c9Sdrahn	break;
848*c074d1c9Sdrahn      fi
849*c074d1c9Sdrahn    fi
850*c074d1c9Sdrahn  done
851*c074d1c9Sdrahn  if test -z "${others}" ; then
852*c074d1c9Sdrahn    target_configdirs=
853*c074d1c9Sdrahn  fi
854*c074d1c9Sdrahnfi
855*c074d1c9Sdrahn
856*c074d1c9Sdrahn# Quietly strip out all directories which aren't configurable in this tree.
857*c074d1c9Sdrahn# This relies on all configurable subdirectories being autoconfiscated, which
858*c074d1c9Sdrahn# is now the case.
859*c074d1c9Sdrahnconfigdirs_all="$configdirs"
860*c074d1c9Sdrahnconfigdirs=
861*c074d1c9Sdrahnfor i in ${configdirs_all} ; do
862*c074d1c9Sdrahn  if test -f ${srcdir}/$i/configure ; then
863*c074d1c9Sdrahn    configdirs="${configdirs} $i"
864*c074d1c9Sdrahn  fi
865*c074d1c9Sdrahndone
866*c074d1c9Sdrahntarget_configdirs_all="$target_configdirs"
867*c074d1c9Sdrahntarget_configdirs=
868*c074d1c9Sdrahnfor i in ${target_configdirs_all} ; do
869*c074d1c9Sdrahn  j=`echo $i | sed -e s/target-//g`
870*c074d1c9Sdrahn  if test -f ${srcdir}/$j/configure ; then
871*c074d1c9Sdrahn    target_configdirs="${target_configdirs} $i"
872*c074d1c9Sdrahn  fi
873*c074d1c9Sdrahndone
874*c074d1c9Sdrahn
875*c074d1c9Sdrahn# Produce a warning message for the subdirs we can't configure.
876*c074d1c9Sdrahn# This isn't especially interesting in the Cygnus tree, but in the individual
877*c074d1c9Sdrahn# FSF releases, it's important to let people know when their machine isn't
878*c074d1c9Sdrahn# supported by the one or two programs in a package.
879*c074d1c9Sdrahn
880*c074d1c9Sdrahnif test -n "${notsupp}" && test -z "${norecursion}" ; then
881*c074d1c9Sdrahn  # If $appdirs is non-empty, at least one of those directories must still
882*c074d1c9Sdrahn  # be configured, or we error out.  (E.g., if the gas release supports a
883*c074d1c9Sdrahn  # specified target in some subdirs but not the gas subdir, we shouldn't
884*c074d1c9Sdrahn  # pretend that all is well.)
885*c074d1c9Sdrahn  if test -n "$appdirs" ; then
886*c074d1c9Sdrahn    for dir in $appdirs ; do
887*c074d1c9Sdrahn      if test -r $dir/Makefile.in ; then
888*c074d1c9Sdrahn	if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
889*c074d1c9Sdrahn	  appdirs=""
890*c074d1c9Sdrahn	  break
891*c074d1c9Sdrahn	fi
892*c074d1c9Sdrahn	if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
893*c074d1c9Sdrahn	  appdirs=""
894*c074d1c9Sdrahn	  break
895*c074d1c9Sdrahn	fi
896*c074d1c9Sdrahn      fi
897*c074d1c9Sdrahn    done
898*c074d1c9Sdrahn    if test -n "$appdirs" ; then
899*c074d1c9Sdrahn      echo "*** This configuration is not supported by this package." 1>&2
900*c074d1c9Sdrahn      exit 1
901*c074d1c9Sdrahn    fi
902*c074d1c9Sdrahn  fi
903*c074d1c9Sdrahn  # Okay, some application will build, or we don't care to check.  Still
904*c074d1c9Sdrahn  # notify of subdirs not getting built.
905*c074d1c9Sdrahn  echo "*** This configuration is not supported in the following subdirectories:" 1>&2
906*c074d1c9Sdrahn  echo "    ${notsupp}" 1>&2
907*c074d1c9Sdrahn  echo "    (Any other directories should still work fine.)" 1>&2
908*c074d1c9Sdrahnfi
909*c074d1c9Sdrahn
910*c074d1c9Sdrahncase "$host" in
911*c074d1c9Sdrahn  *msdosdjgpp*)
912*c074d1c9Sdrahn    enable_gdbtk=no ;;
913*c074d1c9Sdrahnesac
914*c074d1c9Sdrahn
9152159047fSniklascopy_dirs=
9162159047fSniklas
917*c074d1c9Sdrahn# Handle --with-headers=XXX.  If the value is not "yes", the contents of
918*c074d1c9Sdrahn# the named directory are copied to $(tooldir)/sys-include.
919*c074d1c9Sdrahnif test x"${with_headers}" != x ; then
920*c074d1c9Sdrahn  if test x${is_cross_compiler} = xno ; then
9212159047fSniklas    echo 1>&2 '***' --with-headers is only supported when cross compiling
9222159047fSniklas    exit 1
9232159047fSniklas  fi
924*c074d1c9Sdrahn  if test x"${with_headers}" != xyes ; then
9252159047fSniklas    case "${exec_prefixoption}" in
9262159047fSniklas    "") x=${prefix} ;;
9272159047fSniklas    *) x=${exec_prefix} ;;
9282159047fSniklas    esac
9292159047fSniklas    copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
9302159047fSniklas  fi
931*c074d1c9Sdrahnfi
9322159047fSniklas
933*c074d1c9Sdrahn# Handle --with-libs=XXX.  If the value is not "yes", the contents of
934*c074d1c9Sdrahn# the name directories are copied to $(tooldir)/lib.  Multiple directories
935*c074d1c9Sdrahn# are permitted.
936*c074d1c9Sdrahnif test x"${with_libs}" != x ; then
937*c074d1c9Sdrahn  if test x${is_cross_compiler} = xno ; then
9382159047fSniklas    echo 1>&2 '***' --with-libs is only supported when cross compiling
9392159047fSniklas    exit 1
9402159047fSniklas  fi
941*c074d1c9Sdrahn  if test x"${with_libs}" != xyes ; then
9422159047fSniklas    # Copy the libraries in reverse order, so that files in the first named
9432159047fSniklas    # library override files in subsequent libraries.
9442159047fSniklas    case "${exec_prefixoption}" in
9452159047fSniklas    "") x=${prefix} ;;
9462159047fSniklas    *) x=${exec_prefix} ;;
9472159047fSniklas    esac
9482159047fSniklas    for l in ${with_libs}; do
9492159047fSniklas      copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
9502159047fSniklas    done
9512159047fSniklas  fi
952092d8970Sniklasfi
953092d8970Sniklas
9542159047fSniklas# Handle ${copy_dirs}
9552159047fSniklasset fnord ${copy_dirs}
9562159047fSniklasshift
957*c074d1c9Sdrahnwhile test $# != 0 ; do
958*c074d1c9Sdrahn  if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
9592159047fSniklas    :
9602159047fSniklas  else
9612159047fSniklas    echo Copying $1 to $2
9622159047fSniklas
9632159047fSniklas    # Use the install script to create the directory and all required
9642159047fSniklas    # parent directories.
965*c074d1c9Sdrahn    if test -d $2 ; then
9662159047fSniklas      :
9672159047fSniklas    else
9682159047fSniklas      echo >config.temp
969b305b0f1Sespie      ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
9702159047fSniklas    fi
9712159047fSniklas
9722159047fSniklas    # Copy the directory, assuming we have tar.
9732159047fSniklas    # FIXME: Should we use B in the second tar?  Not all systems support it.
9742159047fSniklas    (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
9752159047fSniklas
9762159047fSniklas    # It is the responsibility of the user to correctly adjust all
9772159047fSniklas    # symlinks.  If somebody can figure out how to handle them correctly
9782159047fSniklas    # here, feel free to add the code.
9792159047fSniklas
9802159047fSniklas    echo $1 > $2/COPIED
9812159047fSniklas  fi
9822159047fSniklas  shift; shift
9832159047fSniklasdone
9842159047fSniklas
985*c074d1c9Sdrahn# Work in distributions that contain no compiler tools, like Autoconf.
986*c074d1c9Sdrahntentative_cc=""
987*c074d1c9Sdrahnhost_makefile_frag=/dev/null
988*c074d1c9Sdrahnif test -d ${srcdir}/config ; then
9892159047fSniklascase "${host}" in
990*c074d1c9Sdrahn  m68k-hp-hpux*)
991*c074d1c9Sdrahn    # Avoid "too much defining" errors from HPUX compiler.
992*c074d1c9Sdrahn    tentative_cc="cc -Wp,-H256000"
993*c074d1c9Sdrahn    # If "ar" in $PATH is GNU ar, the symbol table may need rebuilding.
994*c074d1c9Sdrahn    # If it's HP/UX ar, this should be harmless.
995*c074d1c9Sdrahn    RANLIB="ar ts"
996*c074d1c9Sdrahn    ;;
997*c074d1c9Sdrahn  m68k-apollo-sysv*)
998*c074d1c9Sdrahn    tentative_cc="cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG"
999*c074d1c9Sdrahn    ;;
1000*c074d1c9Sdrahn  m68k-apollo-bsd*)
1001*c074d1c9Sdrahn    #None of the Apollo compilers can compile gas or binutils.  The preprocessor
1002*c074d1c9Sdrahn    # chokes on bfd, the compiler won't let you assign integers to enums, and
1003*c074d1c9Sdrahn    # other problems.  Defining CC to gcc is a questionable way to say "don't use
1004*c074d1c9Sdrahn    # the apollo compiler" (the preferred version of GCC could be called cc,
1005*c074d1c9Sdrahn    # or whatever), but I'm not sure leaving CC as cc is any better...
1006*c074d1c9Sdrahn    #CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG
1007*c074d1c9Sdrahn    # Used to have BISON=yacc.
1008*c074d1c9Sdrahn    tentative_cc=gcc
1009*c074d1c9Sdrahn    ;;
1010*c074d1c9Sdrahn  m88k-dg-dgux*)
1011*c074d1c9Sdrahn    tentative_cc="gcc -Wall -ansi -D__using_DGUX"
1012*c074d1c9Sdrahn    ;;
1013*c074d1c9Sdrahn  m88k-harris-cxux*)
1014*c074d1c9Sdrahn    # Under CX/UX, we want to tell the compiler to use ANSI mode.
1015*c074d1c9Sdrahn    tentative_cc="cc -Xa"
1016*c074d1c9Sdrahn    host_makefile_frag="config/mh-cxux"
1017*c074d1c9Sdrahn    ;;
1018*c074d1c9Sdrahn  m88k-motorola-sysv*)
1019*c074d1c9Sdrahn    ;;
1020*c074d1c9Sdrahn  mips*-dec-ultrix*)
1021*c074d1c9Sdrahn    tentative_cc="cc -Wf,-XNg1000"
1022*c074d1c9Sdrahn    host_makefile_frag="config/mh-decstation"
1023*c074d1c9Sdrahn    ;;
1024*c074d1c9Sdrahn  mips*-nec-sysv4*)
1025*c074d1c9Sdrahn    # The C compiler on NEC MIPS SVR4 needs bigger tables.
1026*c074d1c9Sdrahn    tentative_cc="cc -ZXNd=5000 -ZXNg=1000"
1027*c074d1c9Sdrahn    host_makefile_frag="config/mh-necv4"
1028*c074d1c9Sdrahn    ;;
1029*c074d1c9Sdrahn  mips*-sgi-irix4*)
1030*c074d1c9Sdrahn    # Tell compiler to use K&R C.  We can't compile under the SGI Ansi
1031*c074d1c9Sdrahn    # environment.  Also bump switch table size so that cp-parse will
1032*c074d1c9Sdrahn    # compile.  Bump string length limit so linker builds.
1033*c074d1c9Sdrahn    tentative_cc="cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192"
1034*c074d1c9Sdrahn    ;;
1035*c074d1c9Sdrahn  mips*-*-sysv4*)
1036*c074d1c9Sdrahn    host_makefile_frag="config/mh-sysv4"
1037*c074d1c9Sdrahn    ;;
1038*c074d1c9Sdrahn  mips*-*-sysv*)
1039*c074d1c9Sdrahn    # This is for a MIPS running RISC/os 4.52C.
1040*c074d1c9Sdrahn
1041*c074d1c9Sdrahn    # This is needed for GDB, but needs to be in the top-level make because
1042*c074d1c9Sdrahn    # if a library is compiled with the bsd headers and gets linked with the
1043*c074d1c9Sdrahn    # sysv system libraries all hell can break loose (e.g. a jmp_buf might be
1044*c074d1c9Sdrahn    # a different size).
1045*c074d1c9Sdrahn    # ptrace(2) apparently has problems in the BSD environment.  No workaround is
1046*c074d1c9Sdrahn    # known except to select the sysv environment.  Could we use /proc instead?
1047*c074d1c9Sdrahn    # These "sysv environments" and "bsd environments" often end up being a pain.
1048*c074d1c9Sdrahn    #
1049*c074d1c9Sdrahn    # This is not part of CFLAGS because perhaps not all C compilers have this
1050*c074d1c9Sdrahn    # option.
1051*c074d1c9Sdrahn    tentative_cc="cc -systype sysv"
1052*c074d1c9Sdrahn    ;;
1053*c074d1c9Sdrahn  i370-ibm-opened*)
1054*c074d1c9Sdrahn    tentative_cc="c89"
1055*c074d1c9Sdrahn    ;;
1056*c074d1c9Sdrahn  i[[3456]]86-*-sysv5*)
1057*c074d1c9Sdrahn    host_makefile_frag="config/mh-sysv5"
1058*c074d1c9Sdrahn    ;;
1059*c074d1c9Sdrahn  i[[3456]]86-*-dgux*)
1060*c074d1c9Sdrahn    tentative_cc="gcc -Wall -ansi -D__using_DGUX"
1061*c074d1c9Sdrahn    host_makefile_frag="config/mh-dgux386"
1062*c074d1c9Sdrahn    ;;
1063*c074d1c9Sdrahn  i[[3456]]86-ncr-sysv4.3*)
1064*c074d1c9Sdrahn    # The MetaWare compiler will generate a copyright message unless you
1065*c074d1c9Sdrahn    # turn it off by adding the -Hnocopyr flag.
1066*c074d1c9Sdrahn    tentative_cc="cc -Hnocopyr"
1067*c074d1c9Sdrahn    ;;
1068*c074d1c9Sdrahn  i[[3456]]86-ncr-sysv4*)
1069*c074d1c9Sdrahn    # for an NCR 3000 (i486/SVR4) system.
1070*c074d1c9Sdrahn    # The NCR 3000 ships with a MetaWare compiler installed as /bin/cc.
1071*c074d1c9Sdrahn    # This compiler not only emits obnoxious copyright messages every time
1072*c074d1c9Sdrahn    # you run it, but it chokes and dies on a whole bunch of GNU source
1073*c074d1c9Sdrahn    # files.  Default to using the AT&T compiler installed in /usr/ccs/ATT/cc.
1074*c074d1c9Sdrahn    tentative_cc="/usr/ccs/ATT/cc"
1075*c074d1c9Sdrahn    host_makefile_frag="config/mh-ncr3000"
1076*c074d1c9Sdrahn    ;;
1077*c074d1c9Sdrahn  i[[3456]]86-*-sco3.2v5*)
1078*c074d1c9Sdrahn    ;;
1079*c074d1c9Sdrahn  i[[3456]]86-*-sco*)
1080*c074d1c9Sdrahn    # The native C compiler botches some simple uses of const.  Unfortunately,
1081*c074d1c9Sdrahn    # it doesn't defined anything like "__sco__" for us to test for in ansidecl.h.
1082*c074d1c9Sdrahn    tentative_cc="cc -Dconst="
1083*c074d1c9Sdrahn    host_makefile_frag="config/mh-sco"
1084*c074d1c9Sdrahn    ;;
1085*c074d1c9Sdrahn  i[[3456]]86-*-udk*)
1086*c074d1c9Sdrahn    host_makefile_frag="config/mh-sysv5"
1087*c074d1c9Sdrahn    ;;
1088*c074d1c9Sdrahn  i[[3456]]86-*-solaris2*)
1089*c074d1c9Sdrahn    host_makefile_frag="config/mh-sysv4"
1090*c074d1c9Sdrahn    ;;
1091*c074d1c9Sdrahn  i[[3456]]86-*-msdosdjgpp*)
1092*c074d1c9Sdrahn    host_makefile_frag="config/mh-djgpp"
1093*c074d1c9Sdrahn    ;;
1094b305b0f1Sespie  *-cygwin*)
1095*c074d1c9Sdrahn    host_makefile_frag="config/mh-cygwin"
10962159047fSniklas    ;;
1097*c074d1c9Sdrahn  *-mingw32*)
1098*c074d1c9Sdrahn    host_makefile_frag="config/mh-mingw32"
10992159047fSniklas    ;;
1100*c074d1c9Sdrahn  *-interix*)
1101*c074d1c9Sdrahn    host_makefile_frag="config/mh-interix"
1102092d8970Sniklas    ;;
1103*c074d1c9Sdrahn  vax-*-ultrix2*)
1104*c074d1c9Sdrahn    # The old BSD pcc isn't up to compiling parts of gdb so use gcc
1105*c074d1c9Sdrahn    tentative_cc=gcc
1106b305b0f1Sespie    ;;
1107*c074d1c9Sdrahn  *-*-solaris2*)
1108*c074d1c9Sdrahn    host_makefile_frag="config/mh-solaris"
1109b305b0f1Sespie    ;;
1110*c074d1c9Sdrahn  m68k-sun-sunos*)
1111*c074d1c9Sdrahn    # Sun's C compiler needs the -J flag to be able to compile cp-parse.c
1112*c074d1c9Sdrahn    # without overflowing the jump tables (-J says to use a 32 bit table)
1113*c074d1c9Sdrahn    tentative_cc="cc -J"
1114e93f7393Sniklas    ;;
1115*c074d1c9Sdrahn  *-hp-hpux*)
1116*c074d1c9Sdrahn    tentative_cc="cc -Wp,-H256000"
11172159047fSniklas    ;;
1118*c074d1c9Sdrahn  *-*-hiux*)
1119*c074d1c9Sdrahn    tentative_cc="cc -Wp,-H256000"
11202deff676Srahnds    ;;
11212159047fSniklas  rs6000-*-lynxos*)
1122*c074d1c9Sdrahn    # /bin/cc is less than useful for our purposes.  Always use GCC
1123*c074d1c9Sdrahn    tentative_cc="/usr/cygnus/progressive/bin/gcc"
1124*c074d1c9Sdrahn    host_makefile_frag="config/mh-lynxrs6k"
1125d6825d6bSmickey    ;;
11262159047fSniklas  *-*-lynxos*)
1127*c074d1c9Sdrahn    # /bin/cc is less than useful for our purposes.  Always use GCC
1128*c074d1c9Sdrahn    tentative_cc="/bin/gcc"
11292159047fSniklas    ;;
1130*c074d1c9Sdrahn  *-*-sysv4*)
1131*c074d1c9Sdrahn    host_makefile_frag="config/mh-sysv4"
1132*c074d1c9Sdrahn    ;;
1133*c074d1c9Sdrahnesac
1134*c074d1c9Sdrahnfi
1135*c074d1c9Sdrahn
1136*c074d1c9Sdrahnextra_arflags_for_target=
1137*c074d1c9Sdrahnextra_nmflags_for_target=
1138*c074d1c9Sdrahnextra_ranlibflags_for_target=
1139*c074d1c9Sdrahntarget_makefile_frag=/dev/null
1140*c074d1c9Sdrahncase "${target}" in
1141*c074d1c9Sdrahn  i[[3456]]86-*-netware*)
1142*c074d1c9Sdrahn    target_makefile_frag="config/mt-netware"
1143*c074d1c9Sdrahn    ;;
1144*c074d1c9Sdrahn  powerpc-*-netware*)
1145*c074d1c9Sdrahn    target_makefile_frag="config/mt-netware"
1146*c074d1c9Sdrahn    ;;
1147*c074d1c9Sdrahn  *-*-linux*)
1148*c074d1c9Sdrahn    target_makefile_frag="config/mt-linux"
1149*c074d1c9Sdrahn    ;;
1150*c074d1c9Sdrahn  *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
1151*c074d1c9Sdrahn    # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm
1152*c074d1c9Sdrahn    # commands to handle both 32-bit and 64-bit objects.  These flags are
1153*c074d1c9Sdrahn    # harmless if we're using GNU nm or ar.
1154*c074d1c9Sdrahn    extra_arflags_for_target=" -X32_64"
1155*c074d1c9Sdrahn    extra_nmflags_for_target=" -B -X32_64"
1156*c074d1c9Sdrahn    ;;
1157*c074d1c9Sdrahn  *-*-darwin*)
1158*c074d1c9Sdrahn    # ranlib from Darwin requires the -c flag to look at common symbols.
1159*c074d1c9Sdrahn    extra_ranlibflags_for_target=" -c"
1160*c074d1c9Sdrahn    ;;
1161*c074d1c9Sdrahn  mips*-*-pe | sh*-*-pe | *arm-wince-pe)
1162*c074d1c9Sdrahn    target_makefile_frag="config/mt-wince"
11632159047fSniklas    ;;
11642159047fSniklasesac
11652159047fSniklas
1166*c074d1c9Sdrahnalphaieee_frag=/dev/null
1167*c074d1c9Sdrahncase $target in
1168*c074d1c9Sdrahn  alpha*-*-*)
1169*c074d1c9Sdrahn    # This just makes sure to use the -mieee option to build target libs.
1170*c074d1c9Sdrahn    # This should probably be set individually by each library.
1171*c074d1c9Sdrahn    alphaieee_frag="config/mt-alphaieee"
1172*c074d1c9Sdrahn    ;;
1173092d8970Sniklasesac
1174092d8970Sniklas
1175*c074d1c9Sdrahn# If --enable-target-optspace always use -Os instead of -O2 to build
1176*c074d1c9Sdrahn# the target libraries, similarly if it is not specified, use -Os
1177*c074d1c9Sdrahn# on selected platforms.
1178*c074d1c9Sdrahnospace_frag=/dev/null
1179*c074d1c9Sdrahncase "${enable_target_optspace}:${target}" in
1180*c074d1c9Sdrahn  yes:*)
1181*c074d1c9Sdrahn    ospace_frag="config/mt-ospace"
1182*c074d1c9Sdrahn    ;;
1183*c074d1c9Sdrahn  :d30v-*)
1184*c074d1c9Sdrahn    ospace_frag="config/mt-d30v"
1185*c074d1c9Sdrahn    ;;
1186*c074d1c9Sdrahn  :m32r-* | :d10v-* | :fr30-*)
1187*c074d1c9Sdrahn    ospace_frag="config/mt-ospace"
1188*c074d1c9Sdrahn    ;;
1189*c074d1c9Sdrahn  no:* | :*)
1190*c074d1c9Sdrahn    ;;
1191b55d4692Sfgsch  *)
1192*c074d1c9Sdrahn    echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
1193b55d4692Sfgsch    ;;
1194b55d4692Sfgschesac
11952159047fSniklas
11962159047fSniklas# Set with_gnu_as and with_gnu_ld as appropriate.
11972159047fSniklas#
11982159047fSniklas# This is done by determining whether or not the appropriate directory
11992159047fSniklas# is available, and by checking whether or not specific configurations
12002159047fSniklas# have requested that this magic not happen.
12012159047fSniklas#
12022159047fSniklas# The command line options always override the explicit settings in
12032159047fSniklas# configure.in, and the settings in configure.in override this magic.
12042159047fSniklas#
12052159047fSniklas# If the default for a toolchain is to use GNU as and ld, and you don't
12062159047fSniklas# want to do that, then you should use the --without-gnu-as and
12072159047fSniklas# --without-gnu-ld options for the configure script.
12082159047fSniklas
1209*c074d1c9Sdrahnif test x${use_gnu_as} = x &&
1210*c074d1c9Sdrahn   echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
12112159047fSniklas  with_gnu_as=yes
1212*c074d1c9Sdrahn  extra_host_args="$extra_host_args --with-gnu-as"
12132159047fSniklasfi
12142159047fSniklas
1215*c074d1c9Sdrahnif test x${use_gnu_ld} = x &&
1216*c074d1c9Sdrahn   echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then
12172159047fSniklas  with_gnu_ld=yes
1218*c074d1c9Sdrahn  extra_host_args="$extra_host_args --with-gnu-ld"
12192159047fSniklasfi
12202159047fSniklas
1221*c074d1c9Sdrahn# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
1222e93f7393Sniklas# can detect this case.
1223e93f7393Sniklas
1224*c074d1c9Sdrahnif test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
1225e93f7393Sniklas  with_newlib=yes
1226*c074d1c9Sdrahn  extra_host_args="$extra_host_args --with-newlib"
1227e93f7393Sniklasfi
1228e93f7393Sniklas
1229*c074d1c9Sdrahn
1230*c074d1c9Sdrahn# Default to using --with-stabs for certain targets.
1231*c074d1c9Sdrahnif test x${with_stabs} = x ; then
12322159047fSniklas  case "${target}" in
1233*c074d1c9Sdrahn  mips*-*-irix6*o32)
1234*c074d1c9Sdrahn    with_stabs=yes;
1235*c074d1c9Sdrahn    extra_host_args="${extra_host_args} --with-stabs"
1236b305b0f1Sespie    ;;
1237*c074d1c9Sdrahn  mips*-*-irix6*)
1238b305b0f1Sespie    ;;
1239*c074d1c9Sdrahn  mips*-*-* | alpha*-*-osf*)
1240*c074d1c9Sdrahn    with_stabs=yes;
1241*c074d1c9Sdrahn    extra_host_args="${extra_host_args} --with-stabs"
1242b305b0f1Sespie    ;;
12432159047fSniklas  esac
12442159047fSniklasfi
12452159047fSniklas
1246*c074d1c9Sdrahn# hpux11 in 64bit mode has libraries in a weird place.  Arrange to find
1247*c074d1c9Sdrahn# them automatically.
1248*c074d1c9Sdrahncase "${host}" in
1249*c074d1c9Sdrahn  hppa*64*-*-hpux11*)
1250*c074d1c9Sdrahn    extra_host_args="$extra_host_args -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include"
1251*c074d1c9Sdrahn    ;;
1252*c074d1c9Sdrahnesac
1253*c074d1c9Sdrahn
1254*c074d1c9Sdrahn# If we aren't going to be using gcc, see if we can extract a definition
1255*c074d1c9Sdrahn# of CC from the fragment.
1256*c074d1c9Sdrahn# Actually, use the 'pre-extracted' version above.
1257*c074d1c9Sdrahnif test -z "${CC}" && test "${build}" = "${host}" ; then
1258*c074d1c9Sdrahn  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1259*c074d1c9Sdrahn  found=
1260*c074d1c9Sdrahn  for dir in $PATH; do
1261*c074d1c9Sdrahn    test -z "$dir" && dir=.
1262*c074d1c9Sdrahn    if test -f $dir/gcc; then
1263*c074d1c9Sdrahn      found=yes
1264*c074d1c9Sdrahn      break
1265*c074d1c9Sdrahn    fi
1266b305b0f1Sespie  done
1267*c074d1c9Sdrahn  IFS="$save_ifs"
1268*c074d1c9Sdrahn  if test -z "${found}" && test -n "${tentative_cc}" ; then
1269*c074d1c9Sdrahn    CC=$tentative_cc
1270*c074d1c9Sdrahn  fi
1271b305b0f1Sespiefi
1272b305b0f1Sespie
1273*c074d1c9Sdrahn# Some systems (e.g., one of the i386-aix systems the gas testers are
1274*c074d1c9Sdrahn# using) don't handle "\$" correctly, so don't use it here.
1275*c074d1c9Sdrahntooldir='$(exec_prefix)'/${target_alias}
1276*c074d1c9Sdrahnbuild_tooldir=${tooldir}
1277*c074d1c9Sdrahn
1278*c074d1c9Sdrahn# Generate a default definition for YACC.  This is used if the makefile can't
1279*c074d1c9Sdrahn# locate bison or byacc in objdir.
1280*c074d1c9Sdrahn
1281*c074d1c9Sdrahnfor prog in 'bison -y' byacc yacc
1282*c074d1c9Sdrahndo
1283*c074d1c9Sdrahn  set dummy $prog; tmp=$2
1284*c074d1c9Sdrahn  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1285*c074d1c9Sdrahn  for dir in $PATH; do
1286*c074d1c9Sdrahn    test -z "$dir" && dir=.
1287*c074d1c9Sdrahn    if test -f $dir/$tmp; then
1288*c074d1c9Sdrahn      DEFAULT_YACC="$prog"
1289*c074d1c9Sdrahn      break
1290*c074d1c9Sdrahn    fi
1291*c074d1c9Sdrahn  done
1292*c074d1c9Sdrahn  IFS="$save_ifs"
1293*c074d1c9Sdrahn
1294*c074d1c9Sdrahn  test -n "$DEFAULT_YACC" && break
1295*c074d1c9Sdrahndone
1296*c074d1c9Sdrahn
1297*c074d1c9Sdrahn# Generate a default definition for M4.  This is used if the makefile can't
1298*c074d1c9Sdrahn# locate m4 in objdir.
1299*c074d1c9Sdrahn
1300*c074d1c9Sdrahnfor prog in gm4 gnum4 m4
1301*c074d1c9Sdrahndo
1302*c074d1c9Sdrahn  set dummy $prog; tmp=$2
1303*c074d1c9Sdrahn  IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
1304*c074d1c9Sdrahn  for dir in $PATH; do
1305*c074d1c9Sdrahn    test -z "$dir" && dir=.
1306*c074d1c9Sdrahn    if test -f $dir/$tmp; then
1307*c074d1c9Sdrahn      DEFAULT_M4="$prog"
1308*c074d1c9Sdrahn      break
1309*c074d1c9Sdrahn    fi
1310*c074d1c9Sdrahn  done
1311*c074d1c9Sdrahn  IFS="$save_ifs"
1312*c074d1c9Sdrahn
1313*c074d1c9Sdrahn  test -n "$DEFAULT_M4" && break
1314*c074d1c9Sdrahndone
1315*c074d1c9Sdrahn
1316*c074d1c9Sdrahn# Generate a default definition for LEX.  This is used if the makefile can't
1317*c074d1c9Sdrahn# locate flex in objdir.
1318*c074d1c9Sdrahn
1319*c074d1c9Sdrahnfor prog in flex lex
1320*c074d1c9Sdrahndo
1321*c074d1c9Sdrahn  set dummy $prog; tmp=$2
1322*c074d1c9Sdrahn  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1323*c074d1c9Sdrahn  for dir in $PATH; do
1324*c074d1c9Sdrahn    test -z "$dir" && dir=.
1325*c074d1c9Sdrahn    if test -f $dir/$tmp; then
1326*c074d1c9Sdrahn      DEFAULT_LEX="$prog"
1327*c074d1c9Sdrahn      break
1328*c074d1c9Sdrahn    fi
1329*c074d1c9Sdrahn  done
1330*c074d1c9Sdrahn  IFS="$save_ifs"
1331*c074d1c9Sdrahn
1332*c074d1c9Sdrahn  test -n "$DEFAULT_LEX" && break
1333*c074d1c9Sdrahndone
1334*c074d1c9Sdrahn
1335*c074d1c9Sdrahnif test "${build}" != "${host}" ; then
1336*c074d1c9Sdrahn  # If we are doing a Canadian Cross, in which the host and build systems
1337*c074d1c9Sdrahn  # are not the same, we set reasonable default values for the tools.
1338*c074d1c9Sdrahn
1339*c074d1c9Sdrahn  BISON=${BISON-bison}
1340*c074d1c9Sdrahn  CC=${CC-${host_alias}-gcc}
1341*c074d1c9Sdrahn  CFLAGS=${CFLAGS-"-g -O2"}
1342*c074d1c9Sdrahn  CXX=${CXX-${host_alias}-c++}
1343*c074d1c9Sdrahn  CXXFLAGS=${CXXFLAGS-"-g -O2"}
1344*c074d1c9Sdrahn  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
1345*c074d1c9Sdrahn  CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
1346*c074d1c9Sdrahn  CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
1347*c074d1c9Sdrahn  GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
1348*c074d1c9Sdrahn  GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
1349*c074d1c9Sdrahn  BUILD_PREFIX=${build_alias}-
1350*c074d1c9Sdrahn  BUILD_PREFIX_1=${build_alias}-
1351*c074d1c9Sdrahn  MAKEINFO=${MAKEINFO-makeinfo}
1352*c074d1c9Sdrahn
1353*c074d1c9Sdrahn  if test -z "${YACC}" ; then
1354*c074d1c9Sdrahn    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1355*c074d1c9Sdrahn    for dir in $PATH; do
1356*c074d1c9Sdrahn      test -z "$dir" && dir=.
1357*c074d1c9Sdrahn      if test -f $dir/bison; then
1358*c074d1c9Sdrahn	YACC="bison -y"
1359*c074d1c9Sdrahn	break
1360*c074d1c9Sdrahn      fi
1361*c074d1c9Sdrahn      if test -f $dir/byacc; then
1362*c074d1c9Sdrahn	YACC=byacc
1363*c074d1c9Sdrahn	break
1364*c074d1c9Sdrahn      fi
1365*c074d1c9Sdrahn      if test -f $dir/yacc; then
1366*c074d1c9Sdrahn	YACC=yacc
1367*c074d1c9Sdrahn	break
1368*c074d1c9Sdrahn      fi
1369*c074d1c9Sdrahn    done
1370*c074d1c9Sdrahn    IFS="$save_ifs"
1371*c074d1c9Sdrahn    if test -z "${YACC}" ; then
1372*c074d1c9Sdrahn      YACC="bison -y"
1373*c074d1c9Sdrahn    fi
1374*c074d1c9Sdrahn  fi
1375*c074d1c9Sdrahn
1376*c074d1c9Sdrahn  if test -z "${LEX}" ; then
1377*c074d1c9Sdrahn    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1378*c074d1c9Sdrahn    for dir in $PATH; do
1379*c074d1c9Sdrahn      test -z "$dir" && dir=.
1380*c074d1c9Sdrahn      if test -f $dir/flex; then
1381*c074d1c9Sdrahn	LEX=flex
1382*c074d1c9Sdrahn	break
1383*c074d1c9Sdrahn      fi
1384*c074d1c9Sdrahn      if test -f $dir/lex; then
1385*c074d1c9Sdrahn	LEX=lex
1386*c074d1c9Sdrahn	break
1387*c074d1c9Sdrahn      fi
1388*c074d1c9Sdrahn    done
1389*c074d1c9Sdrahn    IFS="$save_ifs"
1390*c074d1c9Sdrahn    LEX=${LEX-flex}
1391*c074d1c9Sdrahn  fi
1392*c074d1c9Sdrahn
1393*c074d1c9Sdrahnelse
1394*c074d1c9Sdrahn  # Set reasonable default values for some tools even if not Canadian.
1395*c074d1c9Sdrahn  # Of course, these are different reasonable default values, originally
1396*c074d1c9Sdrahn  # specified directly in the Makefile.
1397*c074d1c9Sdrahn  # We don't export, so that autoconf can do its job.
1398*c074d1c9Sdrahn  # Note that all these settings are above the fragment inclusion point
1399*c074d1c9Sdrahn  # in Makefile.in, so can still be overridden by fragments.
1400*c074d1c9Sdrahn  # This is all going to change when we autoconfiscate...
1401*c074d1c9Sdrahn
1402*c074d1c9Sdrahn  BISON="\$(USUAL_BISON)"
1403*c074d1c9Sdrahn  CC_FOR_BUILD="\$(CC)"
1404*c074d1c9Sdrahn  GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)"
1405*c074d1c9Sdrahn  BUILD_PREFIX=
1406*c074d1c9Sdrahn  BUILD_PREFIX_1=loser-
1407*c074d1c9Sdrahn  MAKEINFO="\$(USUAL_MAKEINFO)"
1408*c074d1c9Sdrahn  LEX="\$(USUAL_LEX)"
1409*c074d1c9Sdrahn  YACC="\$(USUAL_YACC)"
1410*c074d1c9Sdrahn
1411*c074d1c9Sdrahn  # If CC is still not set, try to get gcc.
1412*c074d1c9Sdrahn  cc_prog_is_gcc=
1413*c074d1c9Sdrahn  if test -z "${CC}" ; then
1414*c074d1c9Sdrahn    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
1415*c074d1c9Sdrahn    for dir in $PATH; do
1416*c074d1c9Sdrahn      test -z "$dir" && dir=.
1417*c074d1c9Sdrahn      if test -f $dir/gcc; then
1418*c074d1c9Sdrahn	CC="gcc"
1419*c074d1c9Sdrahn	cc_prog_is_gcc=yes
1420*c074d1c9Sdrahn	echo 'void f(){}' > conftest.c
1421*c074d1c9Sdrahn	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1422*c074d1c9Sdrahn	  CFLAGS=${CFLAGS-"-g -O2"}
1423*c074d1c9Sdrahn	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
1424*c074d1c9Sdrahn	else
1425*c074d1c9Sdrahn	  CFLAGS=${CFLAGS-"-O2"}
1426*c074d1c9Sdrahn	  CXXFLAGS=${CXXFLAGS-"-O2"}
1427*c074d1c9Sdrahn	fi
1428*c074d1c9Sdrahn	rm -f conftest*
1429*c074d1c9Sdrahn	break
1430*c074d1c9Sdrahn      fi
1431*c074d1c9Sdrahn    done
1432*c074d1c9Sdrahn    IFS="$save_ifs"
1433*c074d1c9Sdrahn    CC=${CC-cc}
1434*c074d1c9Sdrahn  else
1435*c074d1c9Sdrahn    # Determine if we are using gcc.
1436*c074d1c9Sdrahn    cat > conftest.c <<EOF
1437*c074d1c9Sdrahn#ifdef __GNUC__
1438*c074d1c9Sdrahn  yes;
1439*c074d1c9Sdrahn#endif
1440*c074d1c9SdrahnEOF
1441*c074d1c9Sdrahn    if ${CC} -E conftest.c | grep yes >/dev/null 2>&1; then
1442*c074d1c9Sdrahn      cc_prog_is_gcc=yes
1443*c074d1c9Sdrahn    fi
1444*c074d1c9Sdrahn    rm -f conftest.c
1445*c074d1c9Sdrahn    if test -z "${CFLAGS}"; then
1446*c074d1c9Sdrahn      # Here CC is set but CFLAGS is not.  Use a quick hack to use -O2 if CC
1447*c074d1c9Sdrahn      # is set to a version of gcc.
1448*c074d1c9Sdrahn      if test "$cc_prog_is_gcc" = yes; then
1449*c074d1c9Sdrahn	echo 'void f(){}' > conftest.c
1450*c074d1c9Sdrahn	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1451*c074d1c9Sdrahn	  CFLAGS=${CFLAGS-"-g -O2"}
1452*c074d1c9Sdrahn	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
1453*c074d1c9Sdrahn	else
1454*c074d1c9Sdrahn	  CFLAGS=${CFLAGS-"-O2"}
1455*c074d1c9Sdrahn	  CXXFLAGS=${CXXFLAGS-"-O2"}
1456*c074d1c9Sdrahn	fi
1457*c074d1c9Sdrahn	rm -f conftest*
1458*c074d1c9Sdrahn      fi
1459*c074d1c9Sdrahn    fi
1460*c074d1c9Sdrahn  fi
1461*c074d1c9Sdrahn
1462*c074d1c9Sdrahn  # We must set the default linker to the linker used by gcc for the correct
1463*c074d1c9Sdrahn  # operation of libtool.  If LD is not defined and we are using gcc, try to
1464*c074d1c9Sdrahn  # set the LD default to the ld used by gcc.
1465*c074d1c9Sdrahn  if test -z "$LD"; then
1466*c074d1c9Sdrahn    if test "$cc_prog_is_gcc" = yes; then
1467*c074d1c9Sdrahn      case $build in
1468*c074d1c9Sdrahn      *-*-mingw*)
1469*c074d1c9Sdrahn	gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
1470*c074d1c9Sdrahn      *)
1471*c074d1c9Sdrahn	gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
1472*c074d1c9Sdrahn      esac
1473*c074d1c9Sdrahn      case $gcc_prog_ld in
1474*c074d1c9Sdrahn      # Accept absolute paths.
1475*c074d1c9Sdrahn      [[\\/]* | [A-Za-z]:[\\/]*)]
1476*c074d1c9Sdrahn        LD="$gcc_prog_ld" ;;
1477*c074d1c9Sdrahn      esac
1478*c074d1c9Sdrahn    fi
1479*c074d1c9Sdrahn  fi
1480*c074d1c9Sdrahn
1481*c074d1c9Sdrahn  CXX=${CXX-"c++"}
1482*c074d1c9Sdrahn  CFLAGS=${CFLAGS-"-g"}
1483*c074d1c9Sdrahn  CXXFLAGS=${CXXFLAGS-"-g -O2"}
1484*c074d1c9Sdrahnfi
1485*c074d1c9Sdrahn
1486*c074d1c9Sdrahn# FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1487*c074d1c9Sdrahn# Set up the list of links to be made.
1488*c074d1c9Sdrahn# ${links} is the list of link names, and ${files} is the list of names to link to.
1489*c074d1c9Sdrahn
1490*c074d1c9Sdrahn# Make the links.
1491*c074d1c9Sdrahnconfiglinks="${links}"
1492*c074d1c9Sdrahnif test -r ./config.status  ; then
1493*c074d1c9Sdrahn  mv -f ./config.status ./config.back
1494*c074d1c9Sdrahnfi
1495*c074d1c9Sdrahnwhile test -n "${files}" ; do
1496*c074d1c9Sdrahn  # set file to car of files, files to cdr of files
1497*c074d1c9Sdrahn  set ${files}; file=$1; shift; files=$*
1498*c074d1c9Sdrahn  set ${links}; link=$1; shift; links=$*
1499*c074d1c9Sdrahn
1500*c074d1c9Sdrahn  if test ! -r ${srcdir}/${file} ; then
1501*c074d1c9Sdrahn    if test ! -r ${file} ; then
1502*c074d1c9Sdrahn      echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1503*c074d1c9Sdrahn      echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1504*c074d1c9Sdrahn      exit 1
1505*c074d1c9Sdrahn    else
1506*c074d1c9Sdrahn      srcfile=${file}
1507*c074d1c9Sdrahn    fi
1508*c074d1c9Sdrahn  else
1509*c074d1c9Sdrahn    srcfile=${srcdir}/${file}
1510*c074d1c9Sdrahn  fi
1511*c074d1c9Sdrahn
1512*c074d1c9Sdrahn  ${remove} -f ${link}
1513*c074d1c9Sdrahn  # Make a symlink if possible, otherwise try a hard link
1514*c074d1c9Sdrahn  if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1515*c074d1c9Sdrahn    true
1516*c074d1c9Sdrahn  else
1517*c074d1c9Sdrahn    # We need to re-remove the file because Lynx leaves a
1518*c074d1c9Sdrahn    # very strange directory there when it fails an NFS symlink.
1519*c074d1c9Sdrahn    ${remove} -r -f ${link}
1520*c074d1c9Sdrahn    ${hard_link} ${srcfile} ${link}
1521*c074d1c9Sdrahn  fi
1522*c074d1c9Sdrahn  if test ! -r ${link} ; then
1523*c074d1c9Sdrahn    echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1524*c074d1c9Sdrahn    exit 1
1525*c074d1c9Sdrahn  fi
1526*c074d1c9Sdrahn
1527*c074d1c9Sdrahn  echo "Linked \"${link}\" to \"${srcfile}\"."
1528*c074d1c9Sdrahndone
1529*c074d1c9Sdrahn
1530*c074d1c9Sdrahn# Create a .gdbinit file which runs the one in srcdir
1531*c074d1c9Sdrahn# and tells GDB to look there for source files.
1532*c074d1c9Sdrahn
1533*c074d1c9Sdrahnif test -r ${srcdir}/.gdbinit ; then
1534*c074d1c9Sdrahn  case ${srcdir} in
1535*c074d1c9Sdrahn    .) ;;
1536*c074d1c9Sdrahn    *) cat > ./.gdbinit <<EOF
1537*c074d1c9Sdrahn# ${NO_EDIT}
1538*c074d1c9Sdrahndir ${srcdir}
1539*c074d1c9Sdrahndir .
1540*c074d1c9Sdrahnsource ${srcdir}/.gdbinit
1541*c074d1c9SdrahnEOF
1542*c074d1c9Sdrahn    ;;
1543*c074d1c9Sdrahn  esac
1544*c074d1c9Sdrahnfi
15452159047fSniklas
1546092d8970Sniklas# Make sure that the compiler is able to generate an executable.  If it
1547092d8970Sniklas# can't, we are probably in trouble.  We don't care whether we can run the
1548092d8970Sniklas# executable--we might be using a cross compiler--we only care whether it
1549092d8970Sniklas# can be created.  At this point the main configure script has set CC.
1550*c074d1c9Sdrahnwe_are_ok=no
1551092d8970Sniklasecho "int main () { return 0; }" > conftest.c
1552092d8970Sniklas${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
1553*c074d1c9Sdrahnif test $? = 0 ; then
1554*c074d1c9Sdrahn  if test -s conftest || test -s conftest.exe ; then
1555*c074d1c9Sdrahn    we_are_ok=yes
1556*c074d1c9Sdrahn  fi
1557*c074d1c9Sdrahnfi
1558*c074d1c9Sdrahncase $we_are_ok in
1559*c074d1c9Sdrahn  no)
1560092d8970Sniklas    echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
1561092d8970Sniklas    echo 1>&2 "*** You must set the environment variable CC to a working compiler."
1562092d8970Sniklas    rm -f conftest*
1563092d8970Sniklas    exit 1
1564*c074d1c9Sdrahn    ;;
1565*c074d1c9Sdrahnesac
1566092d8970Sniklasrm -f conftest*
1567092d8970Sniklas
1568092d8970Sniklas# The Solaris /usr/ucb/cc compiler does not appear to work.
1569092d8970Sniklascase "${host}" in
1570092d8970Sniklas  sparc-sun-solaris2*)
1571092d8970Sniklas      CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
1572*c074d1c9Sdrahn      if test "`type $CCBASE | sed 's/^[[^/]]*//'`" = "/usr/ucb/cc" ; then
1573092d8970Sniklas          could_use=
1574*c074d1c9Sdrahn          test -d /opt/SUNWspro/bin && could_use="/opt/SUNWspro/bin"
1575*c074d1c9Sdrahn          if test -d /opt/cygnus/bin ; then
1576*c074d1c9Sdrahn              if test "$could_use" = "" ; then
1577092d8970Sniklas                  could_use="/opt/cygnus/bin"
1578092d8970Sniklas              else
1579092d8970Sniklas                  could_use="$could_use or /opt/cygnus/bin"
1580092d8970Sniklas              fi
1581092d8970Sniklas          fi
1582*c074d1c9Sdrahn        if test "$could_use" = "" ; then
1583092d8970Sniklas            echo "Warning: compilation may fail because you're using"
1584092d8970Sniklas            echo "/usr/ucb/cc.  You should change your PATH or CC "
1585092d8970Sniklas            echo "variable and rerun configure."
1586092d8970Sniklas        else
1587092d8970Sniklas            echo "Warning: compilation may fail because you're using"
1588092d8970Sniklas            echo "/usr/ucb/cc, when you should use the C compiler from"
1589092d8970Sniklas            echo "$could_use.  You should change your"
1590092d8970Sniklas            echo "PATH or CC variable and rerun configure."
1591092d8970Sniklas        fi
1592092d8970Sniklas      fi
1593092d8970Sniklas  ;;
1594092d8970Sniklasesac
1595092d8970Sniklas
1596092d8970Sniklas# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
1597092d8970Sniklas# binutils tools will find libbfd.so.
1598*c074d1c9Sdrahncase "${enable_shared}" in
1599*c074d1c9Sdrahn  no | "") SET_LIB_PATH= ;;
1600*c074d1c9Sdrahn  *) SET_LIB_PATH="\$(REALLY_SET_LIB_PATH)" ;;
1601*c074d1c9Sdrahnesac
1602092d8970Sniklas
1603092d8970Sniklascase "${host}" in
1604*c074d1c9Sdrahn  *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
1605*c074d1c9Sdrahn  *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
1606092d8970Sniklasesac
1607*c074d1c9Sdrahn
1608*c074d1c9Sdrahn# Record target_configdirs and the configure arguments for target and
1609*c074d1c9Sdrahn# build configuration in Makefile.
1610*c074d1c9Sdrahntarget_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
1611*c074d1c9Sdrahn
1612*c074d1c9Sdrahn# This is the final value for target_configdirs.  configdirs already
1613*c074d1c9Sdrahn# has its final value.  It's time to create some lists of valid targets.
1614*c074d1c9Sdrahn
1615*c074d1c9Sdrahn# While at that, we remove Makefiles if we were started for recursive
1616*c074d1c9Sdrahn# configuration, such that the top-level Makefile reconfigures them,
1617*c074d1c9Sdrahn# like we used to do when configure itself was recursive.
1618*c074d1c9Sdrahn
1619*c074d1c9Sdrahnall_build_modules=
1620*c074d1c9Sdrahnconfigure_build_modules=
1621*c074d1c9Sdrahn# Only make build modules if build != host.
1622*c074d1c9Sdrahn# This should be done more generally, but at the moment it doesn't matter.
1623*c074d1c9Sdrahnif test ${host_alias} != ${build_alias} ; then
1624*c074d1c9Sdrahn  for module in libiberty ; do
1625*c074d1c9Sdrahn    all_build_modules=all-build-${module}
1626*c074d1c9Sdrahn    configure_build_modules=configure-build-${module}
1627*c074d1c9Sdrahn    if test -z "${no_recursion}" \
1628*c074d1c9Sdrahn       && test -f ${build_subdir}/${module}/Makefile; then
1629*c074d1c9Sdrahn      echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
1630*c074d1c9Sdrahn      rm -f ${build_subdir}/${module}/Makefile
1631*c074d1c9Sdrahn    fi
1632*c074d1c9Sdrahn  done
1633092d8970Sniklasfi
1634092d8970Sniklas
1635*c074d1c9Sdrahnall_host_modules=
1636*c074d1c9Sdrahncheck_host_modules=
1637*c074d1c9Sdrahninstall_host_modules=
1638*c074d1c9Sdrahnconfigure_host_modules=
1639*c074d1c9Sdrahnfor module in ${configdirs} ; do
1640*c074d1c9Sdrahn  all_host_modules="${all_host_modules} all-${module}"
1641*c074d1c9Sdrahn  check_host_modules="${check_host_modules} check-${module}"
1642*c074d1c9Sdrahn  install_host_modules="${install_host_modules} install-${module}"
1643*c074d1c9Sdrahn  configure_host_modules="${configure_host_modules} configure-${module}"
1644*c074d1c9Sdrahn  if test -z "${no_recursion}" \
1645*c074d1c9Sdrahn     && test -f ${module}/Makefile; then
1646*c074d1c9Sdrahn    echo 1>&2 "*** removing ${module}/Makefile to force reconfigure"
1647*c074d1c9Sdrahn    rm -f ${module}/Makefile
1648*c074d1c9Sdrahn  fi
1649*c074d1c9Sdrahndone
1650*c074d1c9Sdrahninstall_host_modules_nogcc=`echo "${install_host_modules}" | sed -e 's/install-gcc//g'`
1651*c074d1c9Sdrahn
1652*c074d1c9Sdrahnall_target_modules=
1653*c074d1c9Sdrahncheck_target_modules=
1654*c074d1c9Sdrahninstall_target_modules=
1655*c074d1c9Sdrahnconfigure_target_modules=
1656*c074d1c9Sdrahnfor module in ${target_configdirs} ; do
1657*c074d1c9Sdrahn  all_target_modules="${all_target_modules} all-target-${module}"
1658*c074d1c9Sdrahn  check_target_modules="${check_target_modules} check-target-${module}"
1659*c074d1c9Sdrahn  install_target_modules="${install_target_modules} install-target-${module}"
1660*c074d1c9Sdrahn  configure_target_modules="${configure_target_modules} configure-target-${module}"
1661*c074d1c9Sdrahn  if test -z "${no_recursion}" \
1662*c074d1c9Sdrahn     && test -f ${target_subdir}/${module}/Makefile; then
1663*c074d1c9Sdrahn    echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
1664*c074d1c9Sdrahn    rm -f ${target_subdir}/${module}/Makefile
1665*c074d1c9Sdrahn  fi
1666*c074d1c9Sdrahndone
1667*c074d1c9Sdrahn
1668*c074d1c9Sdrahn# Determine whether gdb needs tk/tcl or not.
1669*c074d1c9Sdrahn# Use 'maybe' since enable_gdbtk might be true even if tk isn't available
1670*c074d1c9Sdrahn# and in that case we want gdb to be built without tk.  Ugh!
1671*c074d1c9Sdrahn# In fact I believe gdb is the *only* package directly dependent on tk,
1672*c074d1c9Sdrahn# so we should be able to put the 'maybe's in unconditionally and
1673*c074d1c9Sdrahn# leave out the maybe dependencies when enable_gdbtk is false.  I'm not
1674*c074d1c9Sdrahn# 100% sure that that's safe though.
1675*c074d1c9Sdrahn
1676*c074d1c9Sdrahngdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-libgui"
1677*c074d1c9Sdrahncase "$enable_gdbtk" in
1678*c074d1c9Sdrahn  no)
1679*c074d1c9Sdrahn    GDB_TK="" ;;
1680*c074d1c9Sdrahn  yes)
1681*c074d1c9Sdrahn    GDB_TK="${gdb_tk}" ;;
1682*c074d1c9Sdrahn  *)
1683*c074d1c9Sdrahn    # Only add the dependency on gdbtk when GDBtk is part of the gdb
1684*c074d1c9Sdrahn    # distro.  Eventually someone will fix this and move Insight, nee
1685*c074d1c9Sdrahn    # gdbtk to a separate directory.
1686*c074d1c9Sdrahn    if test -d ${srcdir}/gdb/gdbtk ; then
1687*c074d1c9Sdrahn      GDB_TK="${gdb_tk}"
1688*c074d1c9Sdrahn    else
1689*c074d1c9Sdrahn      GDB_TK=""
1690*c074d1c9Sdrahn    fi
1691*c074d1c9Sdrahn    ;;
1692*c074d1c9Sdrahnesac
1693*c074d1c9Sdrahn
1694*c074d1c9Sdrahn# Create the 'maybe dependencies'.  This uses a temporary file.
1695*c074d1c9Sdrahnrm -f maybedep.tmp
1696*c074d1c9Sdrahnecho '# maybedep.tmp' > maybedep.tmp
1697*c074d1c9Sdrahnfor item in ${all_build_modules} ${all_host_modules} ${all_target_modules} \
1698*c074d1c9Sdrahn	${install_host_modules} ${install_target_modules} \
1699*c074d1c9Sdrahn	${configure_build_modules} ${configure_host_modules} ${configure_target_modules} \
1700*c074d1c9Sdrahn	; do
1701*c074d1c9Sdrahn  echo "maybe-${item}: ${item}" >> maybedep.tmp
1702*c074d1c9Sdrahndone
1703*c074d1c9Sdrahnmaybe_dependencies=maybedep.tmp
1704*c074d1c9SdrahnAC_SUBST_FILE(maybe_dependencies)
1705*c074d1c9Sdrahn
1706*c074d1c9Sdrahn# Create the serialization dependencies.  This uses a temporary file.
1707*c074d1c9Sdrahn
1708*c074d1c9SdrahnAC_ARG_ENABLE([serial-configure],
1709*c074d1c9Sdrahn[  --disable-serial-[{host,target,build}-]configure
1710*c074d1c9Sdrahn                          Don't force sequential configuration of
1711*c074d1c9Sdrahn                          sub-packages for the host, target or build
1712*c074d1c9Sdrahn			  machine, or of any sub-packages at all])
1713*c074d1c9Sdrahn
1714*c074d1c9Sdrahn# These force 'configure's to be done one at a time, to avoid problems
1715*c074d1c9Sdrahn# with contention over a shared config.cache.
1716*c074d1c9Sdrahnrm -f serdep.tmp
1717*c074d1c9Sdrahnecho '# serdep.tmp' > serdep.tmp
1718*c074d1c9Sdrahnolditem=
1719*c074d1c9Sdrahntest "x${enable_serial_configure}" = xno ||
1720*c074d1c9Sdrahntest "x${enable_serial_build_configure}" = xno ||
1721*c074d1c9Sdrahnfor item in ${build_configdirs} ; do
1722*c074d1c9Sdrahn  case ${olditem} in
1723*c074d1c9Sdrahn    "") ;;
1724*c074d1c9Sdrahn    *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
1725*c074d1c9Sdrahn  esac
1726*c074d1c9Sdrahn  olditem=${item}
1727*c074d1c9Sdrahndone
1728*c074d1c9Sdrahnolditem=
1729*c074d1c9Sdrahntest "x${enable_serial_configure}" = xno ||
1730*c074d1c9Sdrahntest "x${enable_serial_host_configure}" = xno ||
1731*c074d1c9Sdrahnfor item in ${configdirs} ; do
1732*c074d1c9Sdrahn  case ${olditem} in
1733*c074d1c9Sdrahn    "") ;;
1734*c074d1c9Sdrahn    *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
1735*c074d1c9Sdrahn  esac
1736*c074d1c9Sdrahn  olditem=${item}
1737*c074d1c9Sdrahndone
1738*c074d1c9Sdrahnolditem=
1739*c074d1c9Sdrahntest "x${enable_serial_configure}" = xno ||
1740*c074d1c9Sdrahntest "x${enable_serial_target_configure}" = xno ||
1741*c074d1c9Sdrahnfor item in ${target_configdirs} ; do
1742*c074d1c9Sdrahn  case ${olditem} in
1743*c074d1c9Sdrahn    "") ;;
1744*c074d1c9Sdrahn    *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
1745*c074d1c9Sdrahn  esac
1746*c074d1c9Sdrahn  olditem=${item}
1747*c074d1c9Sdrahndone
1748*c074d1c9Sdrahnserialization_dependencies=serdep.tmp
1749*c074d1c9Sdrahn# override on OpenBSD
1750*c074d1c9Sdrahnserialization_dependencies=/dev/null
1751*c074d1c9SdrahnAC_SUBST_FILE(serialization_dependencies)
1752*c074d1c9Sdrahn
1753*c074d1c9Sdrahn# Base args.  Strip norecursion, cache-file, srcdir, host, build,
1754*c074d1c9Sdrahn# target and nonopt.  These are the ones we might not want to pass
1755*c074d1c9Sdrahn# down to subconfigures.
1756*c074d1c9Sdrahnbaseargs=`echo " ${ac_configure_args} " | \
1757*c074d1c9Sdrahn	sed -e 's/ --no[[^ ]]* / /' \
1758*c074d1c9Sdrahn	    -e 's/ --c[[a-z-]]*[[= ]][[^ ]]* / /' \
1759*c074d1c9Sdrahn	    -e 's/ --sr[[a-z-]]*[[= ]][[^ ]]* / /' \
1760*c074d1c9Sdrahn	    -e 's/ --ho[[a-z-]]*[[= ]][[^ ]]* / /' \
1761*c074d1c9Sdrahn	    -e 's/ --bu[[a-z-]]*[[= ]][[^ ]]* / /' \
1762*c074d1c9Sdrahn	    -e 's/ --t[[a-z-]]*[[= ]][[^ ]]* / /' \
1763*c074d1c9Sdrahn	    -e 's/ -cache-file[[= ]][[^ ]]* / /' \
1764*c074d1c9Sdrahn	    -e 's/ -srcdir[[= ]][[^ ]]* / /' \
1765*c074d1c9Sdrahn	    -e 's/ -host[[= ]][[^ ]]* / /' \
1766*c074d1c9Sdrahn	    -e 's/ -build[[= ]][[^ ]]* / /' \
1767*c074d1c9Sdrahn	    -e 's/ -target[[= ]][[^ ]]* / /' \
1768*c074d1c9Sdrahn	    -e "s/ [[^' -][^ ]*] / /" \
1769*c074d1c9Sdrahn	    -e 's/^ *//;s/ *$//'`
1770*c074d1c9Sdrahn
1771*c074d1c9Sdrahn# For the build-side libraries, we just need to pretend we're native,
1772*c074d1c9Sdrahn# and not use the same cache file.  Multilibs are neither needed nor
1773*c074d1c9Sdrahn# desired.
1774*c074d1c9Sdrahnbuild_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${baseargs}"
1775*c074d1c9Sdrahn
1776*c074d1c9Sdrahn# For host modules, accept cache file option, or specification as blank.
1777*c074d1c9Sdrahncase "${cache_file}" in
1778*c074d1c9Sdrahn"") # empty
1779*c074d1c9Sdrahn  cache_file_option="" ;;
1780*c074d1c9Sdrahn/* | [[A-Za-z]]:[[\\/]]* ) # absolute path
1781*c074d1c9Sdrahn  cache_file_option="--cache-file=${cache_file}" ;;
1782*c074d1c9Sdrahn*) # relative path
1783*c074d1c9Sdrahn  cache_file_option="--cache-file=../${cache_file}" ;;
1784*c074d1c9Sdrahnesac
1785*c074d1c9Sdrahn
1786*c074d1c9Sdrahnhost_configargs="${cache_file_option} --build=${build_alias} --host=${host_alias} --target=${target_alias} ${extra_host_args} ${baseargs}"
1787*c074d1c9Sdrahn
1788*c074d1c9Sdrahntarget_configargs=${baseargs}
1789092d8970Sniklas
1790092d8970Sniklas# Passing a --with-cross-host argument lets the target libraries know
1791092d8970Sniklas# whether they are being built with a cross-compiler or being built
1792092d8970Sniklas# native.  However, it would be better to use other mechanisms to make the
1793092d8970Sniklas# sorts of decisions they want to make on this basis.  Please consider
1794092d8970Sniklas# this option to be deprecated.  FIXME.
1795*c074d1c9Sdrahnif test x${is_cross_compiler} = xyes ; then
1796*c074d1c9Sdrahn  target_configargs="--with-cross-host=${host_alias} ${target_configargs}"
1797092d8970Sniklasfi
1798092d8970Sniklas
1799b305b0f1Sespie# Default to --enable-multilib.
1800*c074d1c9Sdrahnif test x${enable_multilib} = x ; then
1801*c074d1c9Sdrahn  target_configargs="--enable-multilib ${target_configargs}"
1802b305b0f1Sespiefi
1803b305b0f1Sespie
1804b305b0f1Sespie# Pass --with-newlib if appropriate.  Note that target_configdirs has
1805b305b0f1Sespie# changed from the earlier setting of with_newlib.
1806*c074d1c9Sdrahnif test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
1807*c074d1c9Sdrahn  target_configargs="--with-newlib ${target_configargs}"
1808b305b0f1Sespiefi
1809b305b0f1Sespie
1810*c074d1c9Sdrahn# Pass the appropriate --host, --build, and --cache-file arguments.
1811*c074d1c9Sdrahntarget_configargs="--cache-file=../config.cache --host=${target_alias} --build=${build_alias} ${target_configargs}"
1812*c074d1c9Sdrahn
1813b305b0f1Sespie# provide a proper gxx_include_dir.
1814b305b0f1Sespie# Note, if you change the default, make sure to fix both here and in
1815*c074d1c9Sdrahn# the gcc and libstdc++-v3 subdirectories.
1816b305b0f1Sespie# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
1817b305b0f1Sespiecase "${with_gxx_include_dir}" in
1818b305b0f1Sespie  yes)
1819*c074d1c9Sdrahn    AC_MSG_ERROR([--with-gxx-include-dir=[[dir]] requires a directory])
1820b305b0f1Sespie    ;;
1821*c074d1c9Sdrahn  no | "")
1822*c074d1c9Sdrahn    case "${enable_version_specific_runtime_libs}" in
1823*c074d1c9Sdrahn      yes) gxx_include_dir='${libsubdir}/include/c++' ;;
1824b305b0f1Sespie      *)
1825*c074d1c9Sdrahn        . ${srcdir}/config.if
1826*c074d1c9Sdrahn        gxx_include_dir='${prefix}/include/'${libstdcxx_incdir} ;;
1827*c074d1c9Sdrahn    esac ;;
1828*c074d1c9Sdrahn  *) gxx_include_dir=${with_gxx_include_dir} ;;
1829b305b0f1Sespieesac
1830b305b0f1Sespie
1831b55d4692SfgschFLAGS_FOR_TARGET=
1832*c074d1c9Sdrahncase " $target_configdirs " in
1833*c074d1c9Sdrahn *" newlib "*)
1834*c074d1c9Sdrahn  case " $target_configargs " in
1835*c074d1c9Sdrahn  *" --with-newlib "*)
1836b55d4692Sfgsch   case "$target" in
1837b55d4692Sfgsch   *-cygwin*)
1838b55d4692Sfgsch     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 -isystem $$s/newlib/libc/sys/cygwin -isystem $$s/newlib/libc/sys/cygwin32' ;;
1839b55d4692Sfgsch   esac
1840b55d4692Sfgsch
1841b55d4692Sfgsch   # If we're not building GCC, don't discard standard headers.
1842*c074d1c9Sdrahn   if test -d ${srcdir}/gcc; then
1843b55d4692Sfgsch     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
1844b55d4692Sfgsch
1845b55d4692Sfgsch     if test "${build}" != "${host}"; then
1846b55d4692Sfgsch       # On Canadian crosses, CC_FOR_TARGET will have already been set
1847b55d4692Sfgsch       # by `configure', so we won't have an opportunity to add -Bgcc/
1848b55d4692Sfgsch       # to it.  This is right: we don't want to search that directory
1849b55d4692Sfgsch       # for binaries, but we want the header files in there, so add
1850b55d4692Sfgsch       # them explicitly.
1851b55d4692Sfgsch       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include'
1852b55d4692Sfgsch
1853b55d4692Sfgsch       # Someone might think of using the pre-installed headers on
1854b55d4692Sfgsch       # Canadian crosses, in case the installed compiler is not fully
1855b55d4692Sfgsch       # compatible with the compiler being built.  In this case, it
1856b55d4692Sfgsch       # would be better to flag an error than risking having
1857b55d4692Sfgsch       # incompatible object files being constructed.  We can't
1858b55d4692Sfgsch       # guarantee that an error will be flagged, but let's hope the
1859b55d4692Sfgsch       # compiler will do it, when presented with incompatible header
1860b55d4692Sfgsch       # files.
1861b55d4692Sfgsch     fi
1862b55d4692Sfgsch   fi
1863b55d4692Sfgsch
1864*c074d1c9Sdrahn   case "${target}-${is_cross_compiler}" in
1865*c074d1c9Sdrahn   i[[3456]]86-*-linux*-no)
1866*c074d1c9Sdrahn      # Here host == target, so we don't need to build gcc,
1867*c074d1c9Sdrahn      # so we don't want to discard standard headers.
1868*c074d1c9Sdrahn      FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
1869*c074d1c9Sdrahn      ;;
1870*c074d1c9Sdrahn   *)
1871b55d4692Sfgsch      # If we're building newlib, use its generic headers last, but search
1872b55d4692Sfgsch      # for any libc-related directories first (so make it the last -B
1873b55d4692Sfgsch      # switch).
1874b55d4692Sfgsch      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
1875b55d4692Sfgsch      ;;
1876b55d4692Sfgsch   esac
1877*c074d1c9Sdrahn   ;;
1878*c074d1c9Sdrahn  esac
1879*c074d1c9Sdrahn  ;;
1880*c074d1c9Sdrahnesac
1881b55d4692Sfgsch
1882b55d4692Sfgsch# On Canadian crosses, we'll be searching the right directories for
1883b55d4692Sfgsch# the previously-installed cross compiler, so don't bother to add
1884b55d4692Sfgsch# flags for directories within the install tree of the compiler
1885b55d4692Sfgsch# being built; programs in there won't even run.
1886*c074d1c9Sdrahnif test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
1887b55d4692Sfgsch  # Search for pre-installed headers if nothing else fits.
1888*c074d1c9Sdrahn  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
1889b55d4692Sfgschfi
1890b55d4692Sfgsch
1891*c074d1c9Sdrahnif test "x${use_gnu_ld}" = x &&
1892*c074d1c9Sdrahn   echo " ${configdirs} " | grep " ld " > /dev/null ; then
1893b55d4692Sfgsch  # Arrange for us to find uninstalled linker scripts.
1894b55d4692Sfgsch  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld'
1895b55d4692Sfgschfi
1896b55d4692Sfgsch
1897b55d4692Sfgschif test "x${CC_FOR_TARGET+set}" = xset; then
1898b55d4692Sfgsch  :
1899*c074d1c9Sdrahnelif test -d ${srcdir}/gcc; then
1900b55d4692Sfgsch  CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/'
1901b55d4692Sfgschelif test "$host" = "$target"; then
1902b55d4692Sfgsch  CC_FOR_TARGET='$(CC)'
1903b55d4692Sfgschelse
1904*c074d1c9Sdrahn  CC_FOR_TARGET=`echo gcc | sed "${program_transform_name}"`
1905b55d4692Sfgschfi
1906*c074d1c9SdrahnCC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)'
1907b55d4692Sfgsch
1908*c074d1c9Sdrahnif test "x${GCJ_FOR_TARGET+set}" = xset; then
1909b55d4692Sfgsch  :
1910*c074d1c9Sdrahnelif test -d ${srcdir}/gcc; then
1911*c074d1c9Sdrahn  GCJ_FOR_TARGET='$$r/gcc/gcj -B$$r/gcc/'
1912b55d4692Sfgschelif test "$host" = "$target"; then
1913*c074d1c9Sdrahn  GCJ_FOR_TARGET='gcj'
1914b55d4692Sfgschelse
1915*c074d1c9Sdrahn  GCJ_FOR_TARGET=`echo gcj | sed "${program_transform_name}"`
1916b55d4692Sfgschfi
1917*c074d1c9SdrahnGCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)'
1918*c074d1c9Sdrahn
1919*c074d1c9Sdrahn# Don't use libstdc++-v3's flags to configure/build itself.
1920*c074d1c9Sdrahnlibstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
1921*c074d1c9Sdrahnraw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
1922b55d4692Sfgsch
1923b55d4692Sfgschif test "x${CXX_FOR_TARGET+set}" = xset; then
1924b55d4692Sfgsch  :
1925*c074d1c9Sdrahnelif test -d ${srcdir}/gcc; then
1926*c074d1c9Sdrahn  # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead
1927*c074d1c9Sdrahn  # of g++ for linking C++ or Java, because g++ has -shared-libgcc by
1928*c074d1c9Sdrahn  # default whereas gcc does not.
1929*c074d1c9Sdrahn  # RAW_CXX_FOR_TARGET is for linking C++ or java; CXX_FOR_TARGET is for
1930*c074d1c9Sdrahn  # all other cases.
1931b55d4692Sfgsch  CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
1932*c074d1c9Sdrahn  RAW_CXX_FOR_TARGET='$$r/gcc/xgcc -shared-libgcc -B$$r/gcc/ -nostdinc++ '$raw_libstdcxx_flags
1933b55d4692Sfgschelif test "$host" = "$target"; then
1934b55d4692Sfgsch  CXX_FOR_TARGET='$(CXX)'
1935*c074d1c9Sdrahn  RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
1936b55d4692Sfgschelse
1937*c074d1c9Sdrahn  CXX_FOR_TARGET=`echo c++ | sed "${program_transform_name}"`
1938*c074d1c9Sdrahn  RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
1939b55d4692Sfgschfi
1940*c074d1c9SdrahnCXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)'
1941*c074d1c9SdrahnRAW_CXX_FOR_TARGET=$RAW_CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)'
1942b55d4692Sfgsch
1943*c074d1c9SdrahnqCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[[&%]],\\\&,g'`
1944*c074d1c9SdrahnqRAW_CXX_FOR_TARGET=`echo "$RAW_CXX_FOR_TARGET" | sed 's,[[&%]],\\\&,g'`
19452159047fSniklas
1946*c074d1c9Sdrahn# We want to defer the evaluation of `cmd`s and shell variables in
1947*c074d1c9Sdrahn# CXX_FOR_TARGET when recursing in the top-level Makefile, such as for
1948*c074d1c9Sdrahn# bootstrap.  We'll enclose CXX_FOR_TARGET_FOR_RECURSIVE_MAKE in single
1949*c074d1c9Sdrahn# quotes, but we still have to duplicate `$'s so that shell variables
1950*c074d1c9Sdrahn# can be expanded by the nested make as shell variables, not as make
1951*c074d1c9Sdrahn# macros.
1952*c074d1c9SdrahnqqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[[$]][[$]],$$$$,g'`
1953*c074d1c9SdrahnqqRAW_CXX_FOR_TARGET=`echo "$qRAW_CXX_FOR_TARGET" | sed -e 's,[[$]][[$]],$$$$,g'`
1954*c074d1c9Sdrahn
1955*c074d1c9Sdrahn# Wrap CC_FOR_TARGET and friends, for certain types of builds.
1956*c074d1c9SdrahnCC_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}"
1957*c074d1c9SdrahnGCJ_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}"
1958*c074d1c9SdrahnCXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}"
1959*c074d1c9SdrahnRAW_CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qRAW_CXX_FOR_TARGET}"
1960*c074d1c9SdrahnCXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}"
1961*c074d1c9SdrahnRAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqRAW_CXX_FOR_TARGET}"
1962*c074d1c9Sdrahn
1963*c074d1c9Sdrahn# Makefile fragments.
1964*c074d1c9Sdrahnhost_makefile_frag=${srcdir}/${host_makefile_frag}
1965*c074d1c9Sdrahntarget_makefile_frag=${srcdir}/${target_makefile_frag}
1966*c074d1c9Sdrahnalphaieee_frag=${srcdir}/${alphaieee_frag}
1967*c074d1c9Sdrahnospace_frag=${srcdir}/${ospace_frag}
1968*c074d1c9SdrahnAC_SUBST_FILE(host_makefile_frag)
1969*c074d1c9SdrahnAC_SUBST_FILE(target_makefile_frag)
1970*c074d1c9SdrahnAC_SUBST_FILE(alphaieee_frag)
1971*c074d1c9SdrahnAC_SUBST_FILE(ospace_frag)
1972*c074d1c9Sdrahn
1973*c074d1c9Sdrahn# Miscellanea: directories, flags, etc.
1974*c074d1c9SdrahnAC_SUBST(SET_LIB_PATH)
1975*c074d1c9SdrahnAC_SUBST(RPATH_ENVVAR)
1976*c074d1c9SdrahnAC_SUBST(BUILD_PREFIX)
1977*c074d1c9SdrahnAC_SUBST(BUILD_PREFIX_1)
1978*c074d1c9SdrahnAC_SUBST(configlinks)
1979*c074d1c9SdrahnAC_SUBST(gcc_version_trigger)
1980*c074d1c9SdrahnAC_SUBST(gcc_version)
1981*c074d1c9SdrahnAC_SUBST(tooldir)
1982*c074d1c9SdrahnAC_SUBST(build_tooldir)
1983*c074d1c9SdrahnAC_SUBST(GDB_TK)
1984*c074d1c9SdrahnAC_SUBST(gxx_include_dir)
1985*c074d1c9SdrahnAC_SUBST(libstdcxx_incdir)
1986*c074d1c9Sdrahn
1987*c074d1c9Sdrahn# Build module lists & subconfigure args.
1988*c074d1c9SdrahnAC_SUBST(build_subdir)
1989*c074d1c9SdrahnAC_SUBST(build_configargs)
1990*c074d1c9SdrahnAC_SUBST(configure_build_modules)
1991*c074d1c9SdrahnAC_SUBST(all_build_modules)
1992*c074d1c9Sdrahn
1993*c074d1c9Sdrahn# Host module lists & subconfigure args.
1994*c074d1c9SdrahnAC_SUBST(host_configargs)
1995*c074d1c9SdrahnAC_SUBST(configdirs)
1996*c074d1c9SdrahnAC_SUBST(configure_host_modules)
1997*c074d1c9SdrahnAC_SUBST(all_host_modules)
1998*c074d1c9SdrahnAC_SUBST(check_host_modules)
1999*c074d1c9SdrahnAC_SUBST(install_host_modules)
2000*c074d1c9SdrahnAC_SUBST(install_host_modules_nogcc)
2001*c074d1c9Sdrahn
2002*c074d1c9Sdrahn# Target module lists & subconfigure args.
2003*c074d1c9SdrahnAC_SUBST(target_subdir)
2004*c074d1c9SdrahnAC_SUBST(target_configargs)
2005*c074d1c9SdrahnAC_SUBST(target_configdirs)
2006*c074d1c9SdrahnAC_SUBST(configure_target_modules)
2007*c074d1c9SdrahnAC_SUBST(all_target_modules)
2008*c074d1c9SdrahnAC_SUBST(check_target_modules)
2009*c074d1c9SdrahnAC_SUBST(install_target_modules)
2010*c074d1c9Sdrahn
2011*c074d1c9Sdrahn# Build tools.
2012*c074d1c9SdrahnAC_SUBST(BISON)
2013*c074d1c9SdrahnAC_SUBST(CC_FOR_BUILD)
2014*c074d1c9SdrahnAC_SUBST(LEX)
2015*c074d1c9SdrahnAC_SUBST(MAKEINFO)
2016*c074d1c9SdrahnAC_SUBST(YACC)
2017*c074d1c9SdrahnAC_SUBST(config_shell)
2018*c074d1c9Sdrahn
2019*c074d1c9Sdrahn# Host tools.
2020*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(AR, ar)
2021*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(AS, as)
2022*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(DLLTOOL, dlltool)
2023*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(LD, ld)
2024*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(NM, nm)
2025*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(RANLIB, ranlib, :)
2026*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(WINDRES, windres)
2027*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(OBJCOPY, objcopy)
2028*c074d1c9SdrahnNCN_STRICT_CHECK_TOOL(OBJDUMP, objdump)
2029*c074d1c9SdrahnAC_SUBST(CC)
2030*c074d1c9SdrahnAC_SUBST(CXX)
2031*c074d1c9SdrahnAC_SUBST(CFLAGS)
2032*c074d1c9SdrahnAC_SUBST(CXXFLAGS)
2033*c074d1c9SdrahnAC_SUBST(DEFAULT_YACC)
2034*c074d1c9SdrahnAC_SUBST(DEFAULT_LEX)
2035*c074d1c9SdrahnAC_SUBST(DEFAULT_M4)
2036*c074d1c9Sdrahn
2037*c074d1c9Sdrahn# Target tools.
2038*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(AR_FOR_TARGET, ar)
2039*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(AS_FOR_TARGET, as)
2040*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
2041*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(LD_FOR_TARGET, ld)
2042*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(NM_FOR_TARGET, nm)
2043*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :)
2044*c074d1c9SdrahnNCN_STRICT_CHECK_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
2045*c074d1c9Sdrahn
2046*c074d1c9SdrahnAC_SUBST(GCC_FOR_TARGET)
2047*c074d1c9SdrahnAC_SUBST(FLAGS_FOR_TARGET)
2048*c074d1c9SdrahnAC_SUBST(CC_FOR_TARGET)
2049*c074d1c9SdrahnAC_SUBST(GCJ_FOR_TARGET)
2050*c074d1c9SdrahnAC_SUBST(CXX_FOR_TARGET)
2051*c074d1c9SdrahnAC_SUBST(RAW_CXX_FOR_TARGET)
2052*c074d1c9SdrahnAC_SUBST(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)
2053*c074d1c9SdrahnAC_SUBST(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)
2054*c074d1c9Sdrahn
2055*c074d1c9Sdrahn# Fix up target tools.
2056*c074d1c9Sdrahnif test "x${build}" = "x${host}" ; then
2057*c074d1c9Sdrahn  # In this case, the newly built tools can and should be used,
2058*c074d1c9Sdrahn  # so we override the results of the autoconf tests.
2059*c074d1c9Sdrahn  # This should really only happen when the tools are actually being built,
2060*c074d1c9Sdrahn  # but that's a further refinement.  The new build scheme, where
2061*c074d1c9Sdrahn  # tools are built into a structure paralleling where they're installed,
2062*c074d1c9Sdrahn  # should also eliminate all of this cleanly.
2063*c074d1c9Sdrahn  AR_FOR_TARGET="\$(USUAL_AR_FOR_TARGET)"
2064*c074d1c9Sdrahn  AS_FOR_TARGET="\$(USUAL_AS_FOR_TARGET)"
2065*c074d1c9Sdrahn  DLLTOOL_FOR_TARGET="\$(USUAL_DLLTOOL_FOR_TARGET)"
2066*c074d1c9Sdrahn  LD_FOR_TARGET="\$(USUAL_LD_FOR_TARGET)"
2067*c074d1c9Sdrahn  NM_FOR_TARGET="\$(USUAL_NM_FOR_TARGET)"
2068*c074d1c9Sdrahn  RANLIB_FOR_TARGET="\$(USUAL_RANLIB_FOR_TARGET)"
2069*c074d1c9Sdrahn  WINDRES_FOR_TARGET="\$(USUAL_WINDRES_FOR_TARGET)"
2070*c074d1c9Sdrahnfi
2071*c074d1c9Sdrahn# Certain tools may need extra flags.
2072*c074d1c9SdrahnAR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
2073*c074d1c9SdrahnRANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
2074*c074d1c9SdrahnNM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
2075*c074d1c9Sdrahn
2076*c074d1c9SdrahnAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2077*c074d1c9SdrahnAC_ARG_ENABLE(maintainer-mode,
2078*c074d1c9Sdrahn[  --enable-maintainer-mode enable make rules and dependencies not useful
2079*c074d1c9Sdrahn                          (and sometimes confusing) to the casual installer],
2080*c074d1c9Sdrahn      USE_MAINTAINER_MODE=$enableval,
2081*c074d1c9Sdrahn      USE_MAINTAINER_MODE=no)
2082*c074d1c9SdrahnAC_MSG_RESULT($USE_MAINTAINER_MODE)
2083*c074d1c9SdrahnAC_SUBST(MAINTAINER_MODE_TRUE)
2084*c074d1c9SdrahnAC_SUBST(MAINTAINER_MODE_FALSE)
2085*c074d1c9Sdrahnif test "$USE_MAINTAINER_MODE" = yes; then
2086*c074d1c9Sdrahn  MAINTAINER_MODE_TRUE=
2087*c074d1c9Sdrahn  MAINTAINER_MODE_FALSE='#'
2088*c074d1c9Sdrahnelse
2089*c074d1c9Sdrahn  MAINTAINER_MODE_TRUE='#'
2090*c074d1c9Sdrahn  MAINTAINER_MODE_FALSE=
2091*c074d1c9Sdrahnfi
2092*c074d1c9SdrahnMAINT=$MAINTAINER_MODE_TRUE
2093*c074d1c9SdrahnAC_SUBST(MAINT)dnl
2094*c074d1c9Sdrahn
2095*c074d1c9SdrahnAC_OUTPUT(Makefile)
2096