xref: /openbsd/gnu/usr.bin/binutils/configure.in (revision b55d4692)
1092d8970Sniklas#! /bin/bash
22159047fSniklas##############################################################################
32159047fSniklas
42159047fSniklas## This file is a shell script fragment that supplies the information
52159047fSniklas## necessary to tailor a template configure script into the configure
62159047fSniklas## script appropriate for this directory.  For more information, check
72159047fSniklas## any existing configure script.
82159047fSniklas
92159047fSniklas## Be warned, there are two types of configure.in files.  There are those
102159047fSniklas## used by Autoconf, which are macros which are expanded into a configure
112159047fSniklas## script by autoconf.  The other sort, of which this is one, is executed
122159047fSniklas## by Cygnus configure.
132159047fSniklas
142159047fSniklas## For more information on these two systems, check out the documentation
152159047fSniklas## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi).
162159047fSniklas
17b305b0f1Sespie#   Copyright (C) 1992-99, 2000 Free Software Foundation, Inc.
18258b3869Sniklas#
19258b3869Sniklas# This file is free software; you can redistribute it and/or modify it
20258b3869Sniklas# under the terms of the GNU General Public License as published by
21258b3869Sniklas# the Free Software Foundation; either version 2 of the License, or
22258b3869Sniklas# (at your option) any later version.
23258b3869Sniklas#
24258b3869Sniklas# This program is distributed in the hope that it will be useful, but
25258b3869Sniklas# WITHOUT ANY WARRANTY; without even the implied warranty of
26258b3869Sniklas# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27258b3869Sniklas# General Public License for more details.
28258b3869Sniklas#
29258b3869Sniklas# You should have received a copy of the GNU General Public License
30258b3869Sniklas# along with this program; if not, write to the Free Software
31258b3869Sniklas# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32258b3869Sniklas
332159047fSniklas##############################################################################
342159047fSniklas
352159047fSniklas### To add a new directory to the tree, first choose whether it is a target
362159047fSniklas### or a host dependent tool.  Then put it into the appropriate list
372159047fSniklas### (library or tools, host or target), doing a dependency sort.  For
382159047fSniklas### example, gdb requires that byacc (or bison) be built first, so it is in
392159047fSniklas### the ${host_tools} list after byacc and bison.
402159047fSniklas
412159047fSniklas
422159047fSniklas# these libraries are used by various programs built for the host environment
432159047fSniklas#
44b305b0f1Sespiehost_libs="intl mmalloc libiberty opcodes bfd readline gash db tcl tk tcl8.1 tk8.1 tclX itcl tix libgui"
452159047fSniklas
462159047fSniklasif [ "${enable_gdbgui}" = "yes" ] ; then
472159047fSniklas	host_libs="${host_libs} libgui"
482159047fSniklasfi
492159047fSniklas
50*b55d4692Sfgsch# Set up configure/Makefile variables if libstdc++-v3 is to be built.
51*b55d4692Sfgschif [ "${enable_libstdcxx_v3}" = "yes" ] && test -d $srcdir/libstdc++-v3; then
52*b55d4692Sfgsch        libstdcxx_version="target-libstdc++-v3"
53*b55d4692Sfgsch	# Don't use libstdc++-v3's flags to configure/build itself.
54*b55d4692Sfgsch	libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src/.libs'
55*b55d4692Sfgschelse
56*b55d4692Sfgsch        libstdcxx_version="target-libio target-libstdc++"
57*b55d4692Sfgsch        libstdcxx_flags='-isystem $$s/libstdc++ -isystem $$s/libstdc++/std -isystem $$s/libstdc++/stl -isystem $$s/libio/ -isystem $$s/libio/stdio -L$$r/$(TARGET_SUBDIR)/libstdc++'
58*b55d4692Sfgschfi
59*b55d4692Sfgsch
602159047fSniklas# these tools are built for the host environment
61b305b0f1Sespie# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
62b305b0f1Sespie# know that we are building the simulator.
63*b55d4692Sfgschhost_tools="byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip"
642159047fSniklas
652159047fSniklas# these libraries are built for the target environment, and are built after
662159047fSniklas# the host libraries and the host tools (which may be a cross compiler)
672159047fSniklas#
68b305b0f1Sespietarget_libs="target-libiberty \
69b305b0f1Sespie		target-libgloss \
70b305b0f1Sespie		target-newlib \
71*b55d4692Sfgsch		${libstdcxx_version} \
72*b55d4692Sfgsch		target-libf2c \
73*b55d4692Sfgsch		target-libchill \
74*b55d4692Sfgsch		target-libffi \
75*b55d4692Sfgsch		target-libjava \
76*b55d4692Sfgsch		target-zlib \
77*b55d4692Sfgsch		target-boehm-gc \
78*b55d4692Sfgsch		target-qthreads \
79*b55d4692Sfgsch		target-libobjc"
802159047fSniklas
812159047fSniklas# these tools are built using the target libs, and are intended to run only
822159047fSniklas# in the target environment
832159047fSniklas#
842159047fSniklas# note: any program that *uses* libraries that are in the "target_libs"
852159047fSniklas# list belongs in this list.  those programs are also very likely
862159047fSniklas# candidates for the "native_only" list which follows
872159047fSniklas#
88b305b0f1Sespietarget_tools="target-examples target-groff target-gperf"
892159047fSniklas
902159047fSniklas################################################################################
912159047fSniklas
922159047fSniklas## These two lists are of directories that are to be removed from the
932159047fSniklas## ${configdirs} list for either cross-compilations or for native-
942159047fSniklas## compilations.  For example, it doesn't make that much sense to
952159047fSniklas## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
962159047fSniklas## a native environment.
972159047fSniklas
982159047fSniklas# directories to be built in the native environment only
992159047fSniklas#
100e93f7393Sniklas# This must be a single line because of the way it is searched by grep in
101e93f7393Sniklas# the code below.
102b305b0f1Sespienative_only="autoconf automake libtool cvssrc emacs emacs19 fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils gash uudecode wdiff gprof target-groff guile perl apache inet time ash bash bzip2 prms snavigator gnuserv target-gperf"
1032159047fSniklas
1042159047fSniklas# directories to be built in a cross environment only
1052159047fSniklas#
106b305b0f1Sespiecross_only="target-libgloss target-newlib target-cygmon target-opcodes target-libstub"
1072159047fSniklas
1082159047fSniklas## All tools belong in one of the four categories, and are assigned above
1092159047fSniklas## We assign ${configdirs} this way to remove all embedded newlines.  This
1102159047fSniklas## is important because configure will choke if they ever get through.
1112159047fSniklas## ${configdirs} is directories we build using the host tools.
1122159047fSniklas## ${target_configdirs} is directories we build using the target tools.
1132159047fSniklas#
1142159047fSniklasconfigdirs=`echo ${host_libs} ${host_tools}`
1152159047fSniklastarget_configdirs=`echo ${target_libs} ${target_tools}`
1162159047fSniklas
1172159047fSniklas################################################################################
1182159047fSniklas
1192159047fSniklassrctrigger=move-if-change
1202159047fSniklassrcname="gnu development package"
1212159047fSniklas
1222159047fSniklas# This gets set non-empty for some net releases of packages.
1232159047fSniklasappdirs=""
1242159047fSniklas
1252159047fSniklas# per-host:
1262159047fSniklas
1272159047fSniklas# Work in distributions that contain no compiler tools, like Autoconf.
1282159047fSniklasif [ -d ${srcdir}/config ]; then
1292159047fSniklascase "${host}" in
130b305b0f1Sespie  m68k-hp-hpux*)
131b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-hp300"
132b305b0f1Sespie    ;;
133b305b0f1Sespie  m68k-apollo-sysv*)
134b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-apollo68"
135b305b0f1Sespie    ;;
136b305b0f1Sespie  m68k-apollo-bsd*)
137b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-a68bsd"
138b305b0f1Sespie    ;;
139b305b0f1Sespie  m88k-dg-dgux*)
140b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-dgux"
141b305b0f1Sespie    ;;
142b305b0f1Sespie  m88k-harris-cxux*)
143b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-cxux"
144b305b0f1Sespie    ;;
145b305b0f1Sespie  m88k-motorola-sysv*)
146b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-delta88"
147b305b0f1Sespie    ;;
148b305b0f1Sespie  mips*-dec-ultrix*)
149b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-decstation"
150b305b0f1Sespie    ;;
151b305b0f1Sespie  mips*-nec-sysv4*)
152b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-necv4"
153b305b0f1Sespie    ;;
154b305b0f1Sespie  mips*-sgi-irix6*)
155b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-irix6"
156b305b0f1Sespie    ;;
157b305b0f1Sespie  mips*-sgi-irix5*)
158b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-irix5"
159b305b0f1Sespie    ;;
160b305b0f1Sespie  mips*-sgi-irix4*)
161b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-irix4"
162b305b0f1Sespie    ;;
163b305b0f1Sespie  mips*-sgi-irix3*)
164b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv"
165b305b0f1Sespie    ;;
166b305b0f1Sespie  mips*-*-sysv4*)
167b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
168b305b0f1Sespie    ;;
169b305b0f1Sespie  mips*-*-sysv*)
170b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-riscos"
171b305b0f1Sespie    ;;
172*b55d4692Sfgsch  i370-ibm-opened*)
173*b55d4692Sfgsch    host_makefile_frag="${host_makefile_frag} config/mh-openedition"
174*b55d4692Sfgsch    ;;
175b305b0f1Sespie  i[3456]86-*-sysv5*)
176b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
177b305b0f1Sespie    ;;
178b305b0f1Sespie  i[3456]86-*-dgux*)
179b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-dgux386"
180b305b0f1Sespie    ;;
181b305b0f1Sespie  i[3456]86-ncr-sysv4.3*)
182b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-ncrsvr43"
183b305b0f1Sespie    ;;
184b305b0f1Sespie  i[3456]86-ncr-sysv4*)
185b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-ncr3000"
186b305b0f1Sespie    ;;
187b305b0f1Sespie  i[3456]86-*-sco3.2v5*)
188b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv"
189b305b0f1Sespie    ;;
190b305b0f1Sespie  i[3456]86-*-sco*)
191b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sco"
192b305b0f1Sespie    ;;
193b305b0f1Sespie  i[3456]86-*-udk*)
194b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
195b305b0f1Sespie    ;;
196b305b0f1Sespie  i[3456]86-*-isc*)
197b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv"
198b305b0f1Sespie    ;;
199b305b0f1Sespie  i[3456]86-*-solaris2*)
200b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
201b305b0f1Sespie    ;;
202b305b0f1Sespie  i[3456]86-*-aix*)
203b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-aix386"
204b305b0f1Sespie    ;;
205b305b0f1Sespie  i[3456]86-*-msdosdjgpp*)
206b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-djgpp"
207b305b0f1Sespie    ;;
208b305b0f1Sespie  *-cygwin*)
209b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-cygwin"
210b305b0f1Sespie    ;;
211b305b0f1Sespie  *-mingw32*)
212b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-mingw32"
213b305b0f1Sespie    ;;
214b305b0f1Sespie  *-interix*)
215b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-interix"
216b305b0f1Sespie    ;;
217b305b0f1Sespie  *-windows*)
218b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-windows"
219b305b0f1Sespie    ;;
220b305b0f1Sespie  vax-*-ultrix2*)
221b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-vaxult2"
222b305b0f1Sespie    ;;
223b305b0f1Sespie  *-*-solaris2*)
224b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-solaris"
225b305b0f1Sespie    ;;
226b305b0f1Sespie  m68k-sun-sunos*)
227b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sun3"
228b305b0f1Sespie    ;;
229b305b0f1Sespie  *-hp-hpux[78]*)
230b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-hpux8"
231b305b0f1Sespie    ;;
232b305b0f1Sespie  *-hp-hpux*)
233b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-hpux"
234b305b0f1Sespie    ;;
235b305b0f1Sespie  *-*-hiux*)
236b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-hpux"
237b305b0f1Sespie    ;;
238b305b0f1Sespie  rs6000-*-lynxos*)
239b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-lynxrs6k"
240b305b0f1Sespie    ;;
241b305b0f1Sespie  *-*-lynxos*)
242b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-lynxos"
243b305b0f1Sespie    ;;
244b305b0f1Sespie  *-*-sysv4*)
245b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
246b305b0f1Sespie    ;;
247b305b0f1Sespie  *-*-sysv*)
248b305b0f1Sespie    host_makefile_frag="${host_makefile_frag} config/mh-sysv"
249b305b0f1Sespie    ;;
2502159047fSniklasesac
2512159047fSniklasfi
2522159047fSniklas
253092d8970Sniklas# If we aren't going to be using gcc, see if we can extract a definition
254092d8970Sniklas# of CC from the fragment.
255b305b0f1Sespieif [ -z "${CC}" ] && [ "${build}" = "${host}" ]; then
256092d8970Sniklas  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
257092d8970Sniklas  found=
258092d8970Sniklas  for dir in $PATH; do
259092d8970Sniklas    test -z "$dir" && dir=.
260092d8970Sniklas    if test -f $dir/gcc; then
261092d8970Sniklas      found=yes
262092d8970Sniklas      break
263092d8970Sniklas    fi
264092d8970Sniklas  done
265092d8970Sniklas  IFS="$save_ifs"
266b305b0f1Sespie  if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] && [ -f "${srcdir}/${host_makefile_frag}" ]; then
2672159047fSniklas    xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
2682159047fSniklas    if [ -n "${xx}" ] ; then
2692159047fSniklas      CC=$xx
2702159047fSniklas    fi
2712159047fSniklas  fi
2722159047fSniklasfi
2732159047fSniklas
2742159047fSniklas# We default to --with-shared on platforms where -fpic is meaningless.
2752159047fSniklas# Well, we don't yet, but we will.
2762159047fSniklasif false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
2772159047fSniklas  case "${target}" in
278b305b0f1Sespie    alpha*-dec-osf*)	enable_shared=yes ;;
279b305b0f1Sespie    alpha*-*-linux*)	enable_shared=yes ;;
2802159047fSniklas    mips-sgi-irix5*)	enable_shared=yes ;;
2812159047fSniklas    *)			enable_shared=no ;;
2822159047fSniklas  esac
2832159047fSniklasfi
2842159047fSniklas
285092d8970Sniklascase "${enable_shared}" in
286092d8970Sniklas  yes) shared=yes ;;
287092d8970Sniklas  no) shared=no ;;
288092d8970Sniklas  "") shared=no ;;
289092d8970Sniklas  *) shared=yes ;;
290092d8970Sniklasesac
291092d8970Sniklas
292092d8970Sniklasif [ x${shared} = xyes ]; then
2932159047fSniklas  case "${host}" in
294b305b0f1Sespie    alpha*-*-linux*)
295b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-elfalphapic"
296b305b0f1Sespie      ;;
297b305b0f1Sespie    arm*-*-*)
298b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-armpic"
299b305b0f1Sespie      ;;
300b305b0f1Sespie    hppa*-*-*)
301b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-papic"
302b305b0f1Sespie      ;;
303b305b0f1Sespie    i[3456]86-*-cygwin*)
304b305b0f1Sespie      # We don't want -fPIC on Cygwin.
305b305b0f1Sespie      ;;
306b305b0f1Sespie    i[3456]86-*-*)
307b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-x86pic"
308b305b0f1Sespie      ;;
309b305b0f1Sespie    i370-*-*)
310b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-i370pic"
311b305b0f1Sespie      ;;
312*b55d4692Sfgsch    ia64-*-*)
313*b55d4692Sfgsch      host_makefile_frag="${host_makefile_frag} config/mh-ia64pic"
314*b55d4692Sfgsch      ;;
315b305b0f1Sespie    sparc64-*-*)
316b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
317b305b0f1Sespie      ;;
318b305b0f1Sespie    powerpc*-*-aix*)
319b305b0f1Sespie      # We don't want -fPIC on AIX.
320b305b0f1Sespie      ;;
321b305b0f1Sespie    powerpc*-*-*)
322b305b0f1Sespie      host_makefile_frag="${host_makefile_frag} config/mh-ppcpic"
323b305b0f1Sespie      ;;
324b305b0f1Sespie    *-*-*)
325b305b0f1Sespie      if test -f ${srcdir}/config/mh-${host_cpu}pic; then
326b305b0f1Sespie        host_makefile_frag="${host_makefile_frag} config/mh-${host_cpu}pic"
327b305b0f1Sespie      fi
328b305b0f1Sespie      ;;
3292159047fSniklas  esac
330b305b0f1Sespiefi
331b305b0f1Sespie
332b305b0f1Sespierm -f mh-frag
3332159047fSniklasif [ -n "${host_makefile_frag}" ] ; then
334b305b0f1Sespie  for f in ${host_makefile_frag}
335b305b0f1Sespie  do
336b305b0f1Sespie    cat ${srcdir}/$f >> mh-frag
337b305b0f1Sespie  done
3382159047fSniklas  host_makefile_frag=mh-frag
3392159047fSniklasfi
3402159047fSniklas
3412159047fSniklas# per-target:
3422159047fSniklas
3432159047fSniklascase "${target}" in
344b305b0f1Sespie  v810*)
345b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-v810"
346b305b0f1Sespie    ;;
347b305b0f1Sespie  i[3456]86-*-netware*)
348b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-netware"
349b305b0f1Sespie    ;;
350b305b0f1Sespie  powerpc-*-netware*)
351b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-netware"
352b305b0f1Sespie    ;;
353b305b0f1Sespie  *-*-linux-gnu*)
354b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-linux"
355b305b0f1Sespie    ;;
356b305b0f1Sespie  *-*-aix4.[3456789]* | *-*-aix[56789].*)
357b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-aix43"
358b305b0f1Sespie    ;;
359b305b0f1Sespie  mips*-*-pe | sh*-*-pe | *arm-wince-pe)
360b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-wince"
361b305b0f1Sespie    ;;
362b305b0f1Sespieesac
363b305b0f1Sespie
364b305b0f1Sespie# If --enable-target-optspace always use -Os instead of -O2 to build
365b305b0f1Sespie# the target libraries, similarly if it is not specified, use -Os
366b305b0f1Sespie# on selected platforms.
367b305b0f1Sespiecase "${enable_target_optspace}:${target}" in
368b305b0f1Sespie  yes:*)
369b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-ospace"
370b305b0f1Sespie    ;;
371b305b0f1Sespie  :d30v-*)
372b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-d30v"
373b305b0f1Sespie    ;;
374b305b0f1Sespie  :m32r-* | :d10v-* | :fr30-*)
375b305b0f1Sespie    target_makefile_frag="${target_makefile_frag} config/mt-ospace"
376b305b0f1Sespie    ;;
377b305b0f1Sespie  no:* | :*)
378b305b0f1Sespie    ;;
379b305b0f1Sespie  *)
380b305b0f1Sespie    echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
381b305b0f1Sespie    ;;
3822159047fSniklasesac
3832159047fSniklas
3842159047fSniklasskipdirs=
3852159047fSniklasgasdir=gas
3862159047fSniklasuse_gnu_ld=
3872159047fSniklasuse_gnu_as=
3882159047fSniklas
3892159047fSniklas# some tools are so dependent upon X11 that if we're not building with X,
3902159047fSniklas# it's not even worth trying to configure, much less build, that tool.
3912159047fSniklas
3922159047fSniklascase ${with_x} in
3932159047fSniklas  yes | "")  # the default value for this tree is that X11 is available
3942159047fSniklas	;;
3952159047fSniklas  no)
396b305b0f1Sespie	skipdirs="${skipdirs} tk libgui gash"
3972159047fSniklas	;;
3982159047fSniklas  *)
3992159047fSniklas    	echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2
4002159047fSniklas    	;;
4012159047fSniklasesac
4022159047fSniklas
4032159047fSniklas# Some tools are only suitable for building in a "native" situation.
4042159047fSniklas# Those are added when we have a host==target configuration.  For cross
4052159047fSniklas# toolchains, we add some directories that should only be useful in a
4062159047fSniklas# cross-compiler.
4072159047fSniklas
4082159047fSniklasis_cross_compiler=
4092159047fSniklas
4102159047fSniklasif [ x"${host}" = x"${target}" ] ; then
4112159047fSniklas	# when doing a native toolchain, don't build the targets
4122159047fSniklas	# that are in the 'cross only' list
4132159047fSniklas	skipdirs="${skipdirs} ${cross_only}"
4142159047fSniklas	is_cross_compiler=no
4152159047fSniklaselse
4162159047fSniklas	# similarly, don't build the targets in the 'native only'
4172159047fSniklas	# list when building a cross compiler
4182159047fSniklas	skipdirs="${skipdirs} ${native_only}"
4192159047fSniklas	is_cross_compiler=yes
420b305b0f1Sespiefi
421b305b0f1Sespie
422b305b0f1Sespie# We always want to use the same name for this directory, so that dejagnu
423b305b0f1Sespie# can reliably find it.
4242159047fSniklastarget_subdir=${target_alias}
425b305b0f1Sespie
4262159047fSniklasif [ ! -d ${target_subdir} ] ; then
4272159047fSniklas  if mkdir ${target_subdir} ; then true
4282159047fSniklas  else
4292159047fSniklas    echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
4302159047fSniklas    exit 1
4312159047fSniklas  fi
4322159047fSniklasfi
4332159047fSniklas
4342159047fSniklascopy_dirs=
4352159047fSniklas
4362159047fSniklas# Handle --with-headers=XXX.  The contents of the named directory are
4372159047fSniklas# copied to $(tooldir)/sys-include.
4382159047fSniklasif [ x"${with_headers}" != x ]; then
4392159047fSniklas  if [ x${is_cross_compiler} = xno ]; then
4402159047fSniklas    echo 1>&2 '***' --with-headers is only supported when cross compiling
4412159047fSniklas    exit 1
4422159047fSniklas  fi
4432159047fSniklas  case "${exec_prefixoption}" in
4442159047fSniklas  "") x=${prefix} ;;
4452159047fSniklas  *) x=${exec_prefix} ;;
4462159047fSniklas  esac
4472159047fSniklas  copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
4482159047fSniklasfi
4492159047fSniklas
4502159047fSniklas# Handle --with-libs=XXX.  Multiple directories are permitted.  The
4512159047fSniklas# contents are copied to $(tooldir)/lib.
4522159047fSniklasif [ x"${with_libs}" != x ]; then
4532159047fSniklas  if [ x${is_cross_compiler} = xno ]; then
4542159047fSniklas    echo 1>&2 '***' --with-libs is only supported when cross compiling
4552159047fSniklas    exit 1
4562159047fSniklas  fi
4572159047fSniklas  # Copy the libraries in reverse order, so that files in the first named
4582159047fSniklas  # library override files in subsequent libraries.
4592159047fSniklas  case "${exec_prefixoption}" in
4602159047fSniklas  "") x=${prefix} ;;
4612159047fSniklas  *) x=${exec_prefix} ;;
4622159047fSniklas  esac
4632159047fSniklas  for l in ${with_libs}; do
4642159047fSniklas    copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
4652159047fSniklas  done
4662159047fSniklasfi
4672159047fSniklas
4682159047fSniklas# If both --with-headers and --with-libs are specified, default to
4692159047fSniklas# --without-newlib.
4702159047fSniklasif [ x"${with_headers}" != x ] && [ x"${with_libs}" != x ]; then
4712159047fSniklas  if [ x"${with_newlib}" = x ]; then
4722159047fSniklas    with_newlib=no
4732159047fSniklas  fi
4742159047fSniklasfi
4752159047fSniklas
4762159047fSniklas# Recognize --with-newlib/--without-newlib.
4772159047fSniklasif [ x${with_newlib} = xno ]; then
4782159047fSniklas  skipdirs="${skipdirs} target-newlib"
4792159047fSniklaselif [ x${with_newlib} = xyes ]; then
4802159047fSniklas  skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
4812159047fSniklasfi
4822159047fSniklas
483092d8970Sniklas# Default to using --with-stabs for certain targets.
484092d8970Sniklasif [ x${with_stabs} = x ]; then
485092d8970Sniklas  case "${target}" in
486b305b0f1Sespie  mips*-*-irix6*)
487b305b0f1Sespie    ;;
488b305b0f1Sespie  mips*-*-* | alpha*-*-osf*)
489092d8970Sniklas    with_stabs=yes;
490092d8970Sniklas    withoptions="${withoptions} --with-stabs"
491092d8970Sniklas    ;;
492092d8970Sniklas  esac
493092d8970Sniklasfi
494092d8970Sniklas
4952159047fSniklas# Handle ${copy_dirs}
4962159047fSniklasset fnord ${copy_dirs}
4972159047fSniklasshift
4982159047fSniklaswhile [ $# != 0 ]; do
4992159047fSniklas  if [ -f $2/COPIED ] && [ x"`cat $2/COPIED`" = x"$1" ]; then
5002159047fSniklas    :
5012159047fSniklas  else
5022159047fSniklas    echo Copying $1 to $2
5032159047fSniklas
5042159047fSniklas    # Use the install script to create the directory and all required
5052159047fSniklas    # parent directories.
5062159047fSniklas    if [ -d $2 ]; then
5072159047fSniklas      :
5082159047fSniklas    else
5092159047fSniklas      echo >config.temp
510b305b0f1Sespie      ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
5112159047fSniklas    fi
5122159047fSniklas
5132159047fSniklas    # Copy the directory, assuming we have tar.
5142159047fSniklas    # FIXME: Should we use B in the second tar?  Not all systems support it.
5152159047fSniklas    (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
5162159047fSniklas
5172159047fSniklas    # It is the responsibility of the user to correctly adjust all
5182159047fSniklas    # symlinks.  If somebody can figure out how to handle them correctly
5192159047fSniklas    # here, feel free to add the code.
5202159047fSniklas
5212159047fSniklas    echo $1 > $2/COPIED
5222159047fSniklas  fi
5232159047fSniklas  shift; shift
5242159047fSniklasdone
5252159047fSniklas
5262159047fSniklas# Configure extra directories which are host specific
5272159047fSniklas
5282159047fSniklascase "${host}" in
5290c6d0228Sniklas	i[3456]86-*-go32*)
5300c6d0228Sniklas	  configdirs="$configdirs dosrel" ;;
531b305b0f1Sespie	i[3456]86-*-mingw32*)
5322159047fSniklas	  configdirs="$configdirs dosrel" ;;
533b305b0f1Sespie	*-cygwin*)
534b305b0f1Sespie	  configdirs="$configdirs libtermcap dosrel" ;;
5352159047fSniklasesac
5362159047fSniklas
5372159047fSniklas# Remove more programs from consideration, based on the host or
5382159047fSniklas# target this usually means that a port of the program doesn't
5392159047fSniklas# exist yet.
5402159047fSniklas
5412159047fSniklasnoconfigdirs=""
5422159047fSniklas
5432159047fSniklascase "${host}" in
5440c6d0228Sniklas  i[3456]86-*-vsta)
545b305b0f1Sespie    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext"
5462159047fSniklas    ;;
547b305b0f1Sespie  i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
548*b55d4692Sfgsch    noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext libffi"
5492159047fSniklas	;;
550b305b0f1Sespie  i[3456]86-*-mingw32*)
551b305b0f1Sespie    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv"
552b305b0f1Sespie     noconfigdirs="expect dejagnu cvs autoconf automake send-pr rcs guile perl texinfo apache inet libtool"
553092d8970Sniklas	;;
554b305b0f1Sespie  i[3456]86-*-beos*)
555b305b0f1Sespie     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb"
556b305b0f1Sespie     ;;
557b305b0f1Sespie  *-*-cygwin*)
558b305b0f1Sespie     noconfigdirs="autoconf automake send-pr rcs guile perl texinfo apache inet"
559b305b0f1Sespie    ;;
560b305b0f1Sespie  *-*-netbsd*)
561b305b0f1Sespie    noconfigdirs="rcs"
562e93f7393Sniklas    ;;
563092d8970Sniklas  ppc*-*-pe)
564b305b0f1Sespie     noconfigdirs="patch diff make tk tcl expect dejagnu cvssrc autoconf automake texinfo bison send-pr gprof rcs guile perl apache inet itcl tix db snavigator gnuserv"
5652159047fSniklas    ;;
566*b55d4692Sfgsch  powerpc-*-beos*)
567*b55d4692Sfgsch    noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
568*b55d4692Sfgsch    ;;
5692159047fSniklasesac
5702159047fSniklas
5712159047fSniklas
5722159047fSniklascase "${target}" in
5732159047fSniklas  *-*-netware)
574*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-newlib target-libiberty target-libgloss target-libffi"
5752159047fSniklas    ;;
576b305b0f1Sespie  *-*-rtems*)
577*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
578b305b0f1Sespie    ;;
579092d8970Sniklas  *-*-vxworks*)
580*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
581092d8970Sniklas    ;;
582b305b0f1Sespie  alpha*-dec-osf*)
5832159047fSniklas    # ld works, but does not support shared libraries.  emacs doesn't
584b305b0f1Sespie    # work.  newlib is not 64 bit ready.  I'm not sure about fileutils.
585092d8970Sniklas    # gas doesn't generate exception information.
586b305b0f1Sespie    noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss"
5872159047fSniklas    ;;
5880c6d0228Sniklas  alpha*-*-*vms*)
589*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss target-libffi"
59089a6079fSniklas    ;;
5912159047fSniklas  alpha*-*-*)
5922159047fSniklas    # newlib is not 64 bit ready
593092d8970Sniklas    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
594092d8970Sniklas    ;;
595b305b0f1Sespie  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
596b305b0f1Sespie    noconfigdirs="$noconfigdirs target-libjava target-libffi target-zlib"
597b305b0f1Sespie    noconfigdirs="$noconfigdirs target-boehm-gc target-qthreads target-examples"
598*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
599b305b0f1Sespie    noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim"
600b305b0f1Sespie    noconfigdirs="$noconfigdirs expect dejagnu"
601b305b0f1Sespie    # the C++ libraries don't build on top of CE's C libraries
602*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version}"
603b305b0f1Sespie    skipdirs="$skipdirs target-newlib"
604b305b0f1Sespie    case "${host}" in
605b305b0f1Sespie      *-*-cygwin*) ;; # keep gdb and readline
606*b55d4692Sfgsch      *) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}"
607b305b0f1Sespie	 ;;
608b305b0f1Sespie    esac
609b305b0f1Sespie    ;;
610b305b0f1Sespie  arc-*-*)
611*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
612b305b0f1Sespie    ;;
613092d8970Sniklas  arm-*-pe*)
614092d8970Sniklas    noconfigdirs="$noconfigdirs target-libgloss"
6152159047fSniklas    ;;
616e93f7393Sniklas  arm-*-coff*)
617e93f7393Sniklas    noconfigdirs="$noconfigdirs target-libgloss"
618b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
619b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
620b305b0f1Sespie    fi
621b305b0f1Sespie    ;;
622b305b0f1Sespie  arm-*-elf*)
623b305b0f1Sespie    noconfigdirs="$noconfigdirs target-libgloss"
624b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
625b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
626b305b0f1Sespie    fi
627b305b0f1Sespie    ;;
628b305b0f1Sespie  arm-*-oabi*)
629*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
630b305b0f1Sespie    ;;
631b305b0f1Sespie  thumb-*-coff)
632*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
633b305b0f1Sespie    ;;
634b305b0f1Sespie  thumb-*-elf)
635*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
636b305b0f1Sespie    ;;
637b305b0f1Sespie  thumb-*-oabi)
638*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
639b305b0f1Sespie    ;;
640b305b0f1Sespie  strongarm-*-elf)
641*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
642b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
643b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
644b305b0f1Sespie    fi
645b305b0f1Sespie    ;;
646b305b0f1Sespie  strongarm-*-coff)
647*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
648*b55d4692Sfgsch    if [ x${is_cross_compiler} != xno ] ; then
649*b55d4692Sfgsch	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
650*b55d4692Sfgsch    fi
651*b55d4692Sfgsch    ;;
652*b55d4692Sfgsch  xscale-*-elf)
653*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
654*b55d4692Sfgsch    if [ x${is_cross_compiler} != xno ] ; then
655*b55d4692Sfgsch	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
656*b55d4692Sfgsch    fi
657*b55d4692Sfgsch    ;;
658*b55d4692Sfgsch  xscale-*-coff)
659*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
660b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
661b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
662b305b0f1Sespie    fi
663b305b0f1Sespie    ;;
664b305b0f1Sespie  thumb-*-pe)
665*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
666e93f7393Sniklas    ;;
6672159047fSniklas  arm-*-riscix*)
668*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ld target-libgloss target-libffi"
669*b55d4692Sfgsch    ;;
670*b55d4692Sfgsch  c4x-*-*)
671*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
672*b55d4692Sfgsch    ;;
673*b55d4692Sfgsch  c54x*-*-* | tic54x-*-*)
674*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi gcc gdb newlib"
6752159047fSniklas    ;;
676b305b0f1Sespie  d10v-*-*)
677*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
678b305b0f1Sespie    ;;
679b305b0f1Sespie  d30v-*-*)
680b305b0f1Sespie    ;;
681b305b0f1Sespie  fr30-*-elf*)
682b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
683b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
684b305b0f1Sespie    fi
685b305b0f1Sespie    ;;
6862159047fSniklas  h8300*-*-* | \
6872159047fSniklas  h8500-*-*)
688*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
6892159047fSniklas    ;;
6902159047fSniklas  hppa*-*-*elf* | \
691b305b0f1Sespie  hppa*-*-linux-gnu* | \
692*b55d4692Sfgsch  hppa*-*-lites* | \
693*b55d4692Sfgsch  hppa*64*-*-*)
694*b55d4692Sfgsch    # Do configure ld/binutils/gas for this case.
6952159047fSniklas    ;;
6962159047fSniklas  hppa*-*-*)
6972159047fSniklas    # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
6982159047fSniklas    # cc is gcc, and on any system a user should be able to link cc to
6992159047fSniklas    # whatever they want.  FIXME, emacs emacs19).
7002159047fSniklas    case "${CC}" in
7012159047fSniklas	"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
7022159047fSniklas        *) ;;
7032159047fSniklas    esac
7042159047fSniklas    noconfigdirs="$noconfigdirs ld shellutils"
7052159047fSniklas    ;;
706*b55d4692Sfgsch  ia64*-*-elf*)
707*b55d4692Sfgsch    # No gdb support yet.
708*b55d4692Sfgsch    noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
709*b55d4692Sfgsch    ;;
710b305b0f1Sespie  i[3456]86-*-coff | i[3456]86-*-elf)
711b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
712b305b0f1Sespie         target_configdirs="${target_configdirs} target-libstub target-cygmon"
713b305b0f1Sespie    fi
714b305b0f1Sespie    ;;
715b305b0f1Sespie  i[3456]86-*-go32* | i[3456]-*-msdosdjgpp*)
7162159047fSniklas    # but don't build gdb
717*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gdb ${libstdcxx_version} target-libffi"
7182159047fSniklas    ;;
719b305b0f1Sespie  i[3456]86-*-mingw32*)
720b305b0f1Sespie    target_configdirs="$target_configdirs target-mingw"
721*b55d4692Sfgsch    noconfigdirs="$noconfigdirs expect target-libgloss target-libffi"
722b305b0f1Sespie
723b305b0f1Sespie    # Can't build gdb for mingw32 if not native.
724b305b0f1Sespie    case "${host}" in
725b305b0f1Sespie      i[3456]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
726b305b0f1Sespie      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
727b305b0f1Sespie         ;;
728b305b0f1Sespie    esac
729b305b0f1Sespie    ;;
730b305b0f1Sespie  *-*-cygwin*)
731b305b0f1Sespie    target_configdirs="$target_configdirs target-libtermcap target-winsup"
732*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-gperf target-libgloss target-libffi"
7332159047fSniklas    # always build newlib.
7342159047fSniklas    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
735092d8970Sniklas
736b305b0f1Sespie    # Can't build gdb for Cygwin if not native.
7370c6d0228Sniklas    case "${host}" in
738b305b0f1Sespie      *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
739b305b0f1Sespie      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
740b305b0f1Sespie         ;;
741092d8970Sniklas    esac
7422159047fSniklas    ;;
7430c6d0228Sniklas  i[3456]86-*-pe)
744*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
745092d8970Sniklas    ;;
7460c6d0228Sniklas  i[3456]86-*-sco3.2v5*)
747092d8970Sniklas    # The linker does not yet know about weak symbols in COFF,
748092d8970Sniklas    # and is not configured to handle mixed ELF and COFF.
749*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ld target-libgloss target-libffi"
7502159047fSniklas    ;;
7510c6d0228Sniklas  i[3456]86-*-sco*)
752*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
7532159047fSniklas    ;;
7540c6d0228Sniklas  i[3456]86-*-solaris2*)
755b305b0f1Sespie    noconfigdirs="$noconfigdirs target-libgloss"
7562159047fSniklas    ;;
7570c6d0228Sniklas  i[3456]86-*-sysv4*)
7582159047fSniklas    # The SYSV4 C compiler doesn't handle Emacs correctly
7592159047fSniklas    case "${CC}" in
7602159047fSniklas	"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
7612159047fSniklas        *) ;;
7622159047fSniklas    esac
7632159047fSniklas    # but that's okay since emacs doesn't work anyway
764*b55d4692Sfgsch    noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss target-libffi"
7652159047fSniklas    ;;
766b305b0f1Sespie  i[3456]86-*-beos*)
767b305b0f1Sespie     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
768b305b0f1Sespie     ;;
769*b55d4692Sfgsch m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
770*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libiberty target-librx target-libg++ target-libstdc++ target-libio target-libf2c target-libchill target-zlib target-libobjc"
771*b55d4692Sfgsch    ;;
772b305b0f1Sespie m68k-*-elf*)
773b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
774b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
775b305b0f1Sespie    fi
776b305b0f1Sespie    ;;
777b305b0f1Sespie  m68k-*-coff*)
778b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
779b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
780b305b0f1Sespie    fi
781b305b0f1Sespie    ;;
782e93f7393Sniklas  mn10200-*-*)
783*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libffi"
784b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
785b305b0f1Sespie	   target_configdirs="${target_configdirs} target-libstub target-cygmon"
786b305b0f1Sespie    fi
787e93f7393Sniklas    ;;
788e93f7393Sniklas  mn10300-*-*)
789*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libffi"
790b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
791b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
792b305b0f1Sespie    fi
793e93f7393Sniklas    ;;
7942159047fSniklas  powerpc-*-aix*)
7952159047fSniklas    # copied from rs6000-*-* entry
796b305b0f1Sespie    # The configure and build of ld are currently disabled because
797b305b0f1Sespie    # GNU ld is known to be broken for AIX 4.2 and 4.3 (at least)
798b305b0f1Sespie    # The symptom is that GDBtk 4.18 fails at startup with a segfault
799b305b0f1Sespie    # if linked by GNU ld, but not if linked by the native ld.
800*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss target-libffi ld"
801092d8970Sniklas    use_gnu_ld=no
8022159047fSniklas    ;;
803092d8970Sniklas  powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
804092d8970Sniklas    target_configdirs="$target_configdirs target-winsup"
805*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv target-libffi"
806092d8970Sniklas    # always build newlib.
807092d8970Sniklas    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
808092d8970Sniklas    ;;
809092d8970Sniklas    # This is temporary until we can link against shared libraries
810092d8970Sniklas  powerpcle-*-solaris*)
811*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv target-libffi"
812*b55d4692Sfgsch    ;;
813*b55d4692Sfgsch  powerpc-*-beos*)
814*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
8152159047fSniklas    ;;
816b305b0f1Sespie  powerpc-*-eabi)
817b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
818b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
819b305b0f1Sespie    fi
8202deff676Srahnds    ;;
8212159047fSniklas  rs6000-*-lynxos*)
8222159047fSniklas    # The CVS server code doesn't work on the RS/6000
823*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-newlib gprof cvssrc target-libffi"
8242159047fSniklas    ;;
825092d8970Sniklas  rs6000-*-aix*)
826b305b0f1Sespie    # The configure and build of ld are currently disabled because
827b305b0f1Sespie    # GNU ld is known to be broken for AIX 4.2 and 4.3 (at least)
828b305b0f1Sespie    # The symptom is that GDBtk 4.18 fails at startup with a segfault
829b305b0f1Sespie    # if linked by GNU ld, but not if linked by the native ld.
830*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libffi ld"
831092d8970Sniklas    use_gnu_ld=no
832092d8970Sniklas    ;;
8332159047fSniklas  rs6000-*-*)
834*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libffi"
8352159047fSniklas    ;;
8362159047fSniklas  m68k-apollo-*)
837*b55d4692Sfgsch    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss target-libffi"
8382159047fSniklas    ;;
8392159047fSniklas  mips*-*-irix5*)
8402159047fSniklas    # The GNU linker does not support shared libraries.
8412159047fSniklas    # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
842092d8970Sniklas    noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss"
8432159047fSniklas    ;;
8440c6d0228Sniklas  mips*-*-irix6*)
845b305b0f1Sespie    # The GNU assembler does not support IRIX 6.
8460c6d0228Sniklas    # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
847b305b0f1Sespie    noconfigdirs="$noconfigdirs gas gprof emacs target-libgloss"
848b305b0f1Sespie    ;;
8492159047fSniklas  mips*-dec-bsd*)
850*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
8512159047fSniklas    ;;
8522159047fSniklas  mips*-*-bsd*)
853*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
8542159047fSniklas    ;;
855b305b0f1Sespie  mipstx39-*-*)
856*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libffi"   # same as generic mips
857b305b0f1Sespie    target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
85889a6079fSniklas   ;;
859d532eef0Smiod  mips*-*-openbsd*)
860d532eef0Smiod    ;;
8612159047fSniklas  mips*-*-*)
862*b55d4692Sfgsch    noconfigdirs="$noconfigdirs gprof target-libffi"
8632159047fSniklas    ;;
8642159047fSniklas  romp-*-*)
865*b55d4692Sfgsch    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss target-libffi"
8662159047fSniklas    ;;
8672159047fSniklas  sh-*-*)
8682159047fSniklas    case "${host}" in
8690c6d0228Sniklas      i[3456]86-*-vsta) ;; # don't add gprof back in
870b305b0f1Sespie      i[3456]86-*-go32*) ;; # don't add gprof back in
871b305b0f1Sespie      i[3456]86-*-msdosdjgpp*) ;; # don't add gprof back in
8722159047fSniklas      *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
8732159047fSniklas    esac
874*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
8752159047fSniklas    ;;
876b305b0f1Sespie  sparc-*-elf*)
877b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
878b305b0f1Sespie	   target_configdirs="${target_configdirs} target-libstub target-cygmon"
879b305b0f1Sespie    fi
880b305b0f1Sespie    ;;
881b305b0f1Sespie  sparc64-*-elf*)
882b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
883b305b0f1Sespie	   target_configdirs="${target_configdirs} target-libstub target-cygmon"
884b305b0f1Sespie    fi
885*b55d4692Sfgsch    noconfigdirs="target-libffi"
886b305b0f1Sespie    ;;
887b305b0f1Sespie  sparclite-*-*)
888b305b0f1Sespie    if [ x${is_cross_compiler} != xno ] ; then
889b305b0f1Sespie	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
890b305b0f1Sespie    fi
891*b55d4692Sfgsch    noconfigdirs="target-libffi"
892b305b0f1Sespie    ;;
8932159047fSniklas  sparc-*-sunos4*)
8942159047fSniklas    if [ x${is_cross_compiler} != xno ] ; then
895092d8970Sniklas           noconfigdirs="$noconfigdirs gdb gdbtest target-newlib target-libgloss"
8962159047fSniklas    else
8972159047fSniklas           use_gnu_ld=no
8982159047fSniklas    fi
8992159047fSniklas    ;;
9002159047fSniklas  v810-*-*)
901*b55d4692Sfgsch    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld ${libstdcxx_version} opcodes target-libgloss target-libffi"
9022159047fSniklas    ;;
903b305b0f1Sespie  v850-*-*)
904*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
905b305b0f1Sespie    ;;
906b305b0f1Sespie  v850e-*-*)
907*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
908b305b0f1Sespie    ;;
909b305b0f1Sespie  v850ea-*-*)
910*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
911b305b0f1Sespie    ;;
9122159047fSniklas  vax-*-vms)
913*b55d4692Sfgsch    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss target-libffi"
9142159047fSniklas    ;;
915a76be976Shugh  vax-*-openbsd*)
916a76be976Shugh    noconfigdirs="$noconfigdirs ld gas gprof"
917a76be976Shugh    ;;
9182159047fSniklas  vax-*-*)
919*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
920b305b0f1Sespie    ;;
9212159047fSniklas  *-*-lynxos*)
922*b55d4692Sfgsch    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
9232159047fSniklas    ;;
9242159047fSniklas  *-*-macos* | \
9252159047fSniklas  *-*-mpw*)
9262159047fSniklas    # Macs want a resource compiler.
9272159047fSniklas    configdirs="$configdirs grez"
928*b55d4692Sfgsch    noconfigdirs="target-libffi"
9292159047fSniklas    ;;
9302159047fSniklasesac
9312159047fSniklas
932092d8970Sniklas# If we aren't building newlib, then don't build libgloss, since libgloss
933092d8970Sniklas# depends upon some newlib header files.
934092d8970Sniklascase "${noconfigdirs}" in
935092d8970Sniklas  *target-libgloss*) ;;
936092d8970Sniklas  *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
937092d8970Sniklasesac
938092d8970Sniklas
939092d8970Sniklas# Make sure we don't let GNU ld be added if we didn't want it.
940092d8970Sniklasif [ x$with_gnu_ld = xno ]; then
941092d8970Sniklas  use_gnu_ld=no
942092d8970Sniklas  noconfigdirs="$noconfigdirs ld"
943092d8970Sniklasfi
944092d8970Sniklas
945092d8970Sniklas# Make sure we don't let GNU as be added if we didn't want it.
946092d8970Sniklasif [ x$with_gnu_as = xno ]; then
947092d8970Sniklas  use_gnu_as=no
948092d8970Sniklas  noconfigdirs="$noconfigdirs gas"
949092d8970Sniklasfi
950092d8970Sniklas
951*b55d4692Sfgsch# Figure out what language subdirectories are present.
952*b55d4692Sfgsch# Look if the user specified --enable-languages="..."; if not, use
953*b55d4692Sfgsch# the environment variable $LANGUAGES if defined. $LANGUAGES might
954*b55d4692Sfgsch# go away some day.
955*b55d4692Sfgschif test x"${enable_languages+set}" != xset; then
956*b55d4692Sfgsch	if test x"${LANGUAGES+set}" = xset; then
957*b55d4692Sfgsch		enable_languages="`echo ${LANGUAGES} | tr ' ' ','`"
958*b55d4692Sfgsch	else
959*b55d4692Sfgsch		enable_languages=all
960*b55d4692Sfgsch	fi
961*b55d4692Sfgschelse
962*b55d4692Sfgsch	if test x"${enable_languages}" = x; then
963*b55d4692Sfgsch		echo configure.in: --enable-languages needs at least one argument 1>&2
964*b55d4692Sfgsch		exit 1
965*b55d4692Sfgsch	fi
966*b55d4692Sfgschfi
967*b55d4692Sfgschsubdirs=
968*b55d4692Sfgschfor lang in ${srcdir}/gcc/*/config-lang.in ..
969*b55d4692Sfgschdo
970*b55d4692Sfgsch	case $lang in
971*b55d4692Sfgsch	..) ;;
972*b55d4692Sfgsch	# The odd quoting in the next line works around
973*b55d4692Sfgsch	# an apparent bug in bash 1.12 on linux.
974*b55d4692Sfgsch	${srcdir}/gcc/[*]/config-lang.in) ;;
975*b55d4692Sfgsch	*)
976*b55d4692Sfgsch	  lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ 	]*\).*$,\1,p' $lang`
977*b55d4692Sfgsch	  this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ 	]*\).*$,\1,p' $lang`
978*b55d4692Sfgsch	  build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ 	]*\).*$,\1,p' $lang`
979*b55d4692Sfgsch	  if test "x$lang_alias" = x
980*b55d4692Sfgsch	  then
981*b55d4692Sfgsch		echo "$lang doesn't set \$language." 1>&2
982*b55d4692Sfgsch		exit 1
983*b55d4692Sfgsch	  fi
984*b55d4692Sfgsch	  case ${build_by_default},${enable_languages}, in
985*b55d4692Sfgsch	  *,$lang_alias,*) add_this_lang=yes ;;
986*b55d4692Sfgsch	  no,*) add_this_lang=no ;;
987*b55d4692Sfgsch	  *,all,*) add_this_lang=yes ;;
988*b55d4692Sfgsch	  *) add_this_lang=no ;;
989*b55d4692Sfgsch	  esac
990*b55d4692Sfgsch	  if test x"${add_this_lang}" = xyes; then
991*b55d4692Sfgsch	      eval target_libs='"$target_libs "'\"$this_lang_libs\"
992*b55d4692Sfgsch	  else
993*b55d4692Sfgsch	      eval noconfigdirs='"$noconfigdirs "'\"$this_lang_libs\"
994*b55d4692Sfgsch	  fi
995*b55d4692Sfgsch	  ;;
996*b55d4692Sfgsch	esac
997*b55d4692Sfgschdone
998*b55d4692Sfgsch
999*b55d4692Sfgsch
10002159047fSniklas# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
10012159047fSniklas# $target_configdirs.
10022159047fSniklas# If we have the source for $noconfigdirs entries, add them to $notsupp.
10032159047fSniklas
10042159047fSniklasnotsupp=""
10052159047fSniklasfor dir in . $skipdirs $noconfigdirs ; do
10062159047fSniklas  dirname=`echo $dir | sed -e s/target-//g`
10072159047fSniklas  if [ $dir != . ]  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
10082159047fSniklas    configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
10092159047fSniklas    if [ -r $srcdir/$dirname/configure ] \
10102159047fSniklas	|| [ -r $srcdir/$dirname/configure.in ]; then
10112159047fSniklas      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
10122159047fSniklas	true
10132159047fSniklas      else
10142159047fSniklas	notsupp="$notsupp $dir"
10152159047fSniklas      fi
10162159047fSniklas    fi
10172159047fSniklas  fi
10182159047fSniklas  if [ $dir != . ]  && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
10192159047fSniklas    target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
10202159047fSniklas    if [ -r $srcdir/$dirname/configure ] \
10212159047fSniklas	|| [ -r $srcdir/$dirname/configure.in ]; then
10222159047fSniklas      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
10232159047fSniklas	true
10242159047fSniklas      else
10252159047fSniklas	notsupp="$notsupp $dir"
10262159047fSniklas      fi
10272159047fSniklas    fi
10282159047fSniklas  fi
10292159047fSniklasdone
10302159047fSniklas
10312159047fSniklas# Sometimes the tools are distributed with libiberty but with no other
10322159047fSniklas# libraries.  In that case, we don't want to build target-libiberty.
10332159047fSniklasif [ -n "${target_configdirs}" ]; then
10342159047fSniklas  others=
10352159047fSniklas  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
10362159047fSniklas    if [ "$i" != "libiberty" ]; then
10372159047fSniklas      if [ -r $srcdir/$i/configure ] || [ -r $srcdir/$i/configure.in ]; then
10382159047fSniklas	others=yes;
10392159047fSniklas	break;
10402159047fSniklas      fi
10412159047fSniklas    fi
10422159047fSniklas  done
10432159047fSniklas  if [ -z "${others}" ]; then
10442159047fSniklas    target_configdirs=
10452159047fSniklas  fi
10462159047fSniklasfi
10472159047fSniklas
10482159047fSniklas# Deconfigure all subdirectories, in case we are changing the
10492159047fSniklas# configuration from one where a subdirectory is supported to one where it
10502159047fSniklas# is not.
1051b305b0f1Sespieif [ -z "${norecursion}" ] && [ -n "${configdirs}" ]; then
10522159047fSniklas  for i in `echo ${configdirs} | sed -e s/target-//g` ; do
10532159047fSniklas    rm -f $i/Makefile
10542159047fSniklas  done
10552159047fSniklasfi
1056b305b0f1Sespieif [ -z "${norecursion}" ] && [ -n "${target_configdirs}" ]; then
1057092d8970Sniklas  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
10582159047fSniklas    rm -f ${target_subdir}/$i/Makefile
10592159047fSniklas  done
10602159047fSniklasfi
10612159047fSniklas
10622159047fSniklas# Produce a warning message for the subdirs we can't configure.
10632159047fSniklas# This isn't especially interesting in the Cygnus tree, but in the individual
10642159047fSniklas# FSF releases, it's important to let people know when their machine isn't
10652159047fSniklas# supported by the one or two programs in a package.
10662159047fSniklas
10672159047fSniklasif [ -n "${notsupp}" ] && [ -z "${norecursion}" ]; then
10682159047fSniklas  # If $appdirs is non-empty, at least one of those directories must still
10692159047fSniklas  # be configured, or we error out.  (E.g., if the gas release supports a
10702159047fSniklas  # specified target in some subdirs but not the gas subdir, we shouldn't
10712159047fSniklas  # pretend that all is well.)
10722159047fSniklas  if [ -n "$appdirs" ]; then
10732159047fSniklas    for dir in $appdirs ; do
10742159047fSniklas      if [ -r $dir/Makefile.in ]; then
10752159047fSniklas	if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
10762159047fSniklas	  appdirs=""
10772159047fSniklas	  break
10782159047fSniklas	fi
10792159047fSniklas	if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
10802159047fSniklas	  appdirs=""
10812159047fSniklas	  break
10822159047fSniklas	fi
10832159047fSniklas      fi
10842159047fSniklas    done
10852159047fSniklas    if [ -n "$appdirs" ]; then
10862159047fSniklas      echo "*** This configuration is not supported by this package." 1>&2
10872159047fSniklas      exit 1
10882159047fSniklas    fi
10892159047fSniklas  fi
10902159047fSniklas  # Okay, some application will build, or we don't care to check.  Still
10912159047fSniklas  # notify of subdirs not getting built.
10922159047fSniklas  echo "*** This configuration is not supported in the following subdirectories:" 1>&2
10932159047fSniklas  echo "    ${notsupp}" 1>&2
10942159047fSniklas  echo "    (Any other directories should still work fine.)" 1>&2
10952159047fSniklasfi
10962159047fSniklas
10972159047fSniklas# Set with_gnu_as and with_gnu_ld as appropriate.
10982159047fSniklas#
10992159047fSniklas# This is done by determining whether or not the appropriate directory
11002159047fSniklas# is available, and by checking whether or not specific configurations
11012159047fSniklas# have requested that this magic not happen.
11022159047fSniklas#
11032159047fSniklas# The command line options always override the explicit settings in
11042159047fSniklas# configure.in, and the settings in configure.in override this magic.
11052159047fSniklas#
11062159047fSniklas# If the default for a toolchain is to use GNU as and ld, and you don't
11072159047fSniklas# want to do that, then you should use the --without-gnu-as and
11082159047fSniklas# --without-gnu-ld options for the configure script.
11092159047fSniklas
11102159047fSniklasif [ x${use_gnu_as} = x ] ; then
11112159047fSniklas  if [ x${with_gnu_as} != xno ] && echo " ${configdirs} " | grep " ${gasdir} " > /dev/null 2>&1 && [ -d ${srcdir}/${gasdir} ] ; then
11122159047fSniklas    with_gnu_as=yes
11132159047fSniklas    withoptions="$withoptions --with-gnu-as"
11142159047fSniklas  fi
11152159047fSniklasfi
11162159047fSniklas
11172159047fSniklasif [ x${use_gnu_ld} = x ] ; then
11182159047fSniklas  if [ x${with_gnu_ld} != xno ] && echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 && [ -d ${srcdir}/ld ] ; then
11192159047fSniklas    with_gnu_ld=yes
11202159047fSniklas    withoptions="$withoptions --with-gnu-ld"
11212159047fSniklas  fi
11222159047fSniklasfi
11232159047fSniklas
1124e93f7393Sniklas# If using newlib, add --with-newlib to the withoptions so that gcc/configure
1125e93f7393Sniklas# can detect this case.
1126e93f7393Sniklas
1127e93f7393Sniklasif [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
1128e93f7393Sniklas  with_newlib=yes
1129e93f7393Sniklas  withoptions="$withoptions --with-newlib"
1130e93f7393Sniklasfi
1131e93f7393Sniklas
1132092d8970Sniklasif [ x${shared} = xyes ]; then
11332159047fSniklas  case "${target}" in
1134b305b0f1Sespie    hppa*)
1135b305b0f1Sespie      target_makefile_frag="${target_makefile_frag} config/mt-papic"
1136b305b0f1Sespie      ;;
1137b305b0f1Sespie    i[3456]86-*)
1138b305b0f1Sespie      target_makefile_frag="${target_makefile_frag} config/mt-x86pic"
1139b305b0f1Sespie      ;;
1140*b55d4692Sfgsch    ia64-*)
1141*b55d4692Sfgsch      target_makefile_frag="${target_makefile_frag} config/mt-ia64pic"
1142*b55d4692Sfgsch      ;;
1143*b55d4692Sfgsch    powerpc*-*-aix*)
1144*b55d4692Sfgsch      # We don't want -fPIC on AIX.
1145*b55d4692Sfgsch      ;;
1146b305b0f1Sespie    powerpc*-*)
1147b305b0f1Sespie      target_makefile_frag="${target_makefile_frag} config/mt-ppcpic"
1148b305b0f1Sespie      ;;
1149b305b0f1Sespie    alpha*-*-linux*)
1150b305b0f1Sespie      target_makefile_frag="${target_makefile_frag} config/mt-elfalphapic"
1151b305b0f1Sespie      ;;
1152b305b0f1Sespie    *)
1153b305b0f1Sespie      if test -f ${srcdir}/config/mt-${target_cpu}pic; then
1154b305b0f1Sespie        target_makefile_frag="${target_makefile_frag} config/mt-${target_cpu}pic"
1155b305b0f1Sespie      fi
1156b305b0f1Sespie      ;;
11572159047fSniklas  esac
11582159047fSniklasfi
11592159047fSniklas
1160b305b0f1Sespierm -f mt-frag
1161b305b0f1Sespieif [ -n "${target_makefile_frag}" ] ; then
1162b305b0f1Sespie  for f in ${target_makefile_frag}
1163b305b0f1Sespie  do
1164b305b0f1Sespie    cat ${srcdir}/$f >> mt-frag
1165b305b0f1Sespie  done
1166b305b0f1Sespie  target_makefile_frag=mt-frag
1167b305b0f1Sespiefi
1168b305b0f1Sespie
11692159047fSniklas# post-target:
11702159047fSniklas
1171092d8970Sniklas# Make sure that the compiler is able to generate an executable.  If it
1172092d8970Sniklas# can't, we are probably in trouble.  We don't care whether we can run the
1173092d8970Sniklas# executable--we might be using a cross compiler--we only care whether it
1174092d8970Sniklas# can be created.  At this point the main configure script has set CC.
1175092d8970Sniklasecho "int main () { return 0; }" > conftest.c
1176092d8970Sniklas${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
1177b305b0f1Sespieif [ $? = 0 ] && [ -s conftest -o -s conftest.exe ]; then
1178092d8970Sniklas  :
1179092d8970Sniklaselse
1180092d8970Sniklas  echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
1181092d8970Sniklas  echo 1>&2 "*** You must set the environment variable CC to a working compiler."
1182092d8970Sniklas  rm -f conftest*
1183092d8970Sniklas  exit 1
1184092d8970Sniklasfi
1185092d8970Sniklasrm -f conftest*
1186092d8970Sniklas
1187092d8970Sniklas# The Solaris /usr/ucb/cc compiler does not appear to work.
1188092d8970Sniklascase "${host}" in
1189092d8970Sniklas  sparc-sun-solaris2*)
1190092d8970Sniklas      CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
1191092d8970Sniklas      if [ "`/usr/bin/which $CCBASE`" = "/usr/ucb/cc" ] ; then
1192092d8970Sniklas          could_use=
1193092d8970Sniklas          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
1194092d8970Sniklas          if [ -d /opt/cygnus/bin ] ; then
1195092d8970Sniklas              if [ "$could_use" = "" ] ; then
1196092d8970Sniklas                  could_use="/opt/cygnus/bin"
1197092d8970Sniklas              else
1198092d8970Sniklas                  could_use="$could_use or /opt/cygnus/bin"
1199092d8970Sniklas              fi
1200092d8970Sniklas          fi
1201092d8970Sniklas        if [ "$could_use" = "" ] ; then
1202092d8970Sniklas            echo "Warning: compilation may fail because you're using"
1203092d8970Sniklas            echo "/usr/ucb/cc.  You should change your PATH or CC "
1204092d8970Sniklas            echo "variable and rerun configure."
1205092d8970Sniklas        else
1206092d8970Sniklas            echo "Warning: compilation may fail because you're using"
1207092d8970Sniklas            echo "/usr/ucb/cc, when you should use the C compiler from"
1208092d8970Sniklas            echo "$could_use.  You should change your"
1209092d8970Sniklas            echo "PATH or CC variable and rerun configure."
1210092d8970Sniklas        fi
1211092d8970Sniklas      fi
1212092d8970Sniklas  ;;
1213092d8970Sniklasesac
1214092d8970Sniklas
1215092d8970Sniklas# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
1216092d8970Sniklas# binutils tools will find libbfd.so.
1217092d8970Sniklasif [ "${shared}" = "yes" ]; then
1218092d8970Sniklas  sed -e 's/^SET_LIB_PATH[ 	]*=.*$/SET_LIB_PATH = $(REALLY_SET_LIB_PATH)/' \
1219092d8970Sniklas      Makefile > Makefile.tem
1220092d8970Sniklas  rm -f Makefile
1221092d8970Sniklas  mv -f Makefile.tem Makefile
1222092d8970Sniklas
1223092d8970Sniklas  case "${host}" in
1224092d8970Sniklas  *-*-hpux*)
1225b305b0f1Sespie    sed -e 's/^RPATH_ENVVAR[ 	]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
1226092d8970Sniklas	Makefile > Makefile.tem
1227092d8970Sniklas    rm -f Makefile
1228092d8970Sniklas    mv -f Makefile.tem Makefile
1229092d8970Sniklas    ;;
1230092d8970Sniklas  esac
1231092d8970Sniklasfi
1232092d8970Sniklas
12332159047fSniklas# Record target_configdirs and the configure arguments in Makefile.
12342159047fSniklastarget_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
12352159047fSniklastargargs=`echo "${arguments}" | \
1236b305b0f1Sespie	sed -e 's/--no[^ 	]*//' \
1237092d8970Sniklas	    -e 's/--cache[a-z-]*=[^ 	]*//' \
1238092d8970Sniklas	    -e 's/--ho[a-z-]*=[^ 	]*//' \
1239b305b0f1Sespie	    -e 's/--bu[a-z-]*=[^ 	]*//' \
1240092d8970Sniklas	    -e 's/--ta[a-z-]*=[^ 	]*//'`
1241092d8970Sniklas
1242092d8970Sniklas# Passing a --with-cross-host argument lets the target libraries know
1243092d8970Sniklas# whether they are being built with a cross-compiler or being built
1244092d8970Sniklas# native.  However, it would be better to use other mechanisms to make the
1245092d8970Sniklas# sorts of decisions they want to make on this basis.  Please consider
1246092d8970Sniklas# this option to be deprecated.  FIXME.
1247092d8970Sniklasif [ x${is_cross_compiler} = xyes ]; then
1248092d8970Sniklas  targargs="--with-cross-host=${host_alias} ${targargs}"
1249092d8970Sniklasfi
1250092d8970Sniklas
1251b305b0f1Sespie# Default to --enable-multilib.
1252b305b0f1Sespieif [ x${enable_multilib} = x ]; then
1253b305b0f1Sespie  targargs="--enable-multilib ${targargs}"
1254b305b0f1Sespiefi
1255b305b0f1Sespie
1256b305b0f1Sespie# Pass --with-newlib if appropriate.  Note that target_configdirs has
1257b305b0f1Sespie# changed from the earlier setting of with_newlib.
1258b305b0f1Sespieif [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
1259b305b0f1Sespie  targargs="--with-newlib ${targargs}"
1260b305b0f1Sespiefi
1261b305b0f1Sespie
1262b305b0f1Sespie# provide a proper gxx_include_dir.
1263b305b0f1Sespie# Note, if you change the default, make sure to fix both here and in
1264*b55d4692Sfgsch# the gcc, libio, and libstdc++ subdirectories.
1265b305b0f1Sespie# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
1266b305b0f1Sespiegxx_include_dir=
1267b305b0f1Sespieif test -n "${with_gxx_include_dir}"; then
1268b305b0f1Sespie  case "${with_gxx_include_dir}" in
1269b305b0f1Sespie    yes )
1270b305b0f1Sespie      echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2
1271b305b0f1Sespie      exit 1
1272b305b0f1Sespie      ;;
1273b305b0f1Sespie    no )
1274b305b0f1Sespie      ;;
1275b305b0f1Sespie    * )
1276b305b0f1Sespie      gxx_include_dir=${with_gxx_include_dir}
1277b305b0f1Sespie      ;;
1278b305b0f1Sespie  esac
1279b305b0f1Sespiefi
1280b305b0f1Sespieif test x${gxx_include_dir} = x; then
1281b305b0f1Sespie  if test x${enable_version_specific_runtime_libs} = xyes; then
1282b305b0f1Sespie    gxx_include_dir='${libsubdir}/include/g++'
1283b305b0f1Sespie  else
1284b305b0f1Sespie    . ${topsrcdir}/config.if
1285b305b0f1Sespie    gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface}
1286b305b0f1Sespie  fi
1287b305b0f1Sespieelse
1288b305b0f1Sespie  gxx_include_dir=${gxx_include_dir}
1289b305b0f1Sespiefi
1290b305b0f1Sespie
1291*b55d4692SfgschFLAGS_FOR_TARGET=
1292*b55d4692Sfgschcase " $skipdirs " in
1293*b55d4692Sfgsch*" target-newlib "*) ;;
1294*b55d4692Sfgsch*)
1295*b55d4692Sfgsch   case "$target" in
1296*b55d4692Sfgsch   *-cygwin*)
1297*b55d4692Sfgsch     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' ;;
1298*b55d4692Sfgsch   esac
1299*b55d4692Sfgsch
1300*b55d4692Sfgsch   # If we're not building GCC, don't discard standard headers.
1301*b55d4692Sfgsch   if test -d ${topsrcdir}/gcc; then
1302*b55d4692Sfgsch     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
1303*b55d4692Sfgsch
1304*b55d4692Sfgsch     if test "${build}" != "${host}"; then
1305*b55d4692Sfgsch       # On Canadian crosses, CC_FOR_TARGET will have already been set
1306*b55d4692Sfgsch       # by `configure', so we won't have an opportunity to add -Bgcc/
1307*b55d4692Sfgsch       # to it.  This is right: we don't want to search that directory
1308*b55d4692Sfgsch       # for binaries, but we want the header files in there, so add
1309*b55d4692Sfgsch       # them explicitly.
1310*b55d4692Sfgsch       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include'
1311*b55d4692Sfgsch
1312*b55d4692Sfgsch       # Someone might think of using the pre-installed headers on
1313*b55d4692Sfgsch       # Canadian crosses, in case the installed compiler is not fully
1314*b55d4692Sfgsch       # compatible with the compiler being built.  In this case, it
1315*b55d4692Sfgsch       # would be better to flag an error than risking having
1316*b55d4692Sfgsch       # incompatible object files being constructed.  We can't
1317*b55d4692Sfgsch       # guarantee that an error will be flagged, but let's hope the
1318*b55d4692Sfgsch       # compiler will do it, when presented with incompatible header
1319*b55d4692Sfgsch       # files.
1320*b55d4692Sfgsch     fi
1321*b55d4692Sfgsch   fi
1322*b55d4692Sfgsch
1323*b55d4692Sfgsch   # If we're building newlib, use its generic headers last, but search
1324*b55d4692Sfgsch   # for any libc-related directories first (so make it the last -B
1325*b55d4692Sfgsch   # switch).
1326*b55d4692Sfgsch   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
1327*b55d4692Sfgsch   ;;
1328*b55d4692Sfgschesac
1329*b55d4692Sfgsch
1330*b55d4692Sfgsch# On Canadian crosses, we'll be searching the right directories for
1331*b55d4692Sfgsch# the previously-installed cross compiler, so don't bother to add
1332*b55d4692Sfgsch# flags for directories within the install tree of the compiler
1333*b55d4692Sfgsch# being built; programs in there won't even run.
1334*b55d4692Sfgschif test "${build}" = "${host}" && test -d ${topsrcdir}/gcc; then
1335*b55d4692Sfgsch  # Search for pre-installed headers if nothing else fits.
1336*b55d4692Sfgsch  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
1337*b55d4692Sfgschfi
1338*b55d4692Sfgsch
1339*b55d4692Sfgschif test "x${use_gnu_ld}" = x && test "x${with_gnu_ld}" != xno &&
1340*b55d4692Sfgsch   echo " ${configdirs} " | grep " ld " > /dev/null &&
1341*b55d4692Sfgsch   test -d ${srcdir}/ld; then
1342*b55d4692Sfgsch  # Arrange for us to find uninstalled linker scripts.
1343*b55d4692Sfgsch  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld'
1344*b55d4692Sfgschfi
1345*b55d4692Sfgsch
1346*b55d4692Sfgschif test "x${CC_FOR_TARGET+set}" = xset; then
1347*b55d4692Sfgsch  :
1348*b55d4692Sfgschelif test -d ${topsrcdir}/gcc; then
1349*b55d4692Sfgsch  CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/'
1350*b55d4692Sfgschelif test "$host" = "$target"; then
1351*b55d4692Sfgsch  CC_FOR_TARGET='$(CC)'
1352*b55d4692Sfgschelse
1353*b55d4692Sfgsch  CC_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
1354*b55d4692Sfgschfi
1355*b55d4692Sfgsch# On Canadian crosses, configure reads CC_FOR_TARGET from Makefile,
1356*b55d4692Sfgsch# if Makefile exists.  Prevent $(FLAGS_FOR_TARGET) from being duplicated.
1357*b55d4692Sfgschcase $CC_FOR_TARGET in
1358*b55d4692Sfgsch*' $(FLAGS_FOR_TARGET)') ;;
1359*b55d4692Sfgsch*) CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
1360*b55d4692Sfgschesac
1361*b55d4692Sfgsch
1362*b55d4692Sfgschif test "x${CHILL_FOR_TARGET+set}" = xset; then
1363*b55d4692Sfgsch  :
1364*b55d4692Sfgschelif test -d ${topsrcdir}/gcc; then
1365*b55d4692Sfgsch  CHILL_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/ -L$$r/gcc/ch/runtime/'
1366*b55d4692Sfgschelif test "$host" = "$target"; then
1367*b55d4692Sfgsch  CHILL_FOR_TARGET='$(CC)'
1368*b55d4692Sfgschelse
1369*b55d4692Sfgsch  CHILL_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
1370*b55d4692Sfgschfi
1371*b55d4692Sfgschcase $CHILL_FOR_TARGET in
1372*b55d4692Sfgsch*' $(FLAGS_FOR_TARGET)') ;;
1373*b55d4692Sfgsch*) CHILL_FOR_TARGET=$CHILL_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
1374*b55d4692Sfgschesac
1375*b55d4692Sfgsch
1376*b55d4692Sfgschif test "x${CXX_FOR_TARGET+set}" = xset; then
1377*b55d4692Sfgsch  :
1378*b55d4692Sfgschelif test -d ${topsrcdir}/gcc; then
1379*b55d4692Sfgsch  CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
1380*b55d4692Sfgschelif test "$host" = "$target"; then
1381*b55d4692Sfgsch  CXX_FOR_TARGET='$(CXX)'
1382*b55d4692Sfgschelse
1383*b55d4692Sfgsch  CXX_FOR_TARGET=`echo c++ | sed -e 's/x/x/' ${program_transform_name}`
1384*b55d4692Sfgschfi
1385*b55d4692Sfgschcase $CXX_FOR_TARGET in
1386*b55d4692Sfgsch*' $(FLAGS_FOR_TARGET)') ;;
1387*b55d4692Sfgsch*) CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
1388*b55d4692Sfgschesac
1389*b55d4692SfgschqCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,&,\\\&,g'`
1390*b55d4692Sfgsch
1391*b55d4692Sfgschtargargs="--cache-file=../config.cache --host=${target_alias} --build=${build_alias} ${targargs}"
13922159047fSniklassed -e "s:^TARGET_CONFIGDIRS[ 	]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
13932159047fSniklas    -e "s%^CONFIG_ARGUMENTS[ 	]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
1394*b55d4692Sfgsch    -e "s%^FLAGS_FOR_TARGET[ 	]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}%" \
1395*b55d4692Sfgsch    -e "s%^CC_FOR_TARGET[ 	]*=.*$%CC_FOR_TARGET = ${CC_FOR_TARGET}%" \
1396*b55d4692Sfgsch    -e "s%^CHILL_FOR_TARGET[ 	]*=.*$%CHILL_FOR_TARGET = ${CHILL_FOR_TARGET}%" \
1397*b55d4692Sfgsch    -e "s%^CXX_FOR_TARGET[ 	]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%" \
13982159047fSniklas    -e "s%^TARGET_SUBDIR[ 	]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
1399b305b0f1Sespie    -e "s%^gxx_include_dir[ 	]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
14002159047fSniklas       Makefile > Makefile.tem
14012159047fSniklasrm -f Makefile
14022159047fSniklasmv -f Makefile.tem Makefile
14032159047fSniklas
14042159047fSniklas#
14052159047fSniklas# Local Variables:
14062159047fSniklas# fill-column: 131
14072159047fSniklas# End:
14082159047fSniklas#
1409