xref: /openbsd/gnu/usr.bin/binutils/configure.in (revision 2159047f)
1*2159047fSniklas##############################################################################
2*2159047fSniklas
3*2159047fSniklas## This file is a shell script fragment that supplies the information
4*2159047fSniklas## necessary to tailor a template configure script into the configure
5*2159047fSniklas## script appropriate for this directory.  For more information, check
6*2159047fSniklas## any existing configure script.
7*2159047fSniklas
8*2159047fSniklas## Be warned, there are two types of configure.in files.  There are those
9*2159047fSniklas## used by Autoconf, which are macros which are expanded into a configure
10*2159047fSniklas## script by autoconf.  The other sort, of which this is one, is executed
11*2159047fSniklas## by Cygnus configure.
12*2159047fSniklas
13*2159047fSniklas## For more information on these two systems, check out the documentation
14*2159047fSniklas## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi).
15*2159047fSniklas
16*2159047fSniklas##############################################################################
17*2159047fSniklas
18*2159047fSniklas### To add a new directory to the tree, first choose whether it is a target
19*2159047fSniklas### or a host dependent tool.  Then put it into the appropriate list
20*2159047fSniklas### (library or tools, host or target), doing a dependency sort.  For
21*2159047fSniklas### example, gdb requires that byacc (or bison) be built first, so it is in
22*2159047fSniklas### the ${host_tools} list after byacc and bison.
23*2159047fSniklas
24*2159047fSniklas
25*2159047fSniklas# these libraries are used by various programs built for the host environment
26*2159047fSniklas#
27*2159047fSniklashost_libs="mmalloc libiberty opcodes bfd readline gash tcl tk tclX"
28*2159047fSniklas
29*2159047fSniklasif [ "${enable_gdbgui}" = "yes" ] ; then
30*2159047fSniklas	host_libs="${host_libs} libgui"
31*2159047fSniklasfi
32*2159047fSniklas
33*2159047fSniklas# these tools are built for the host environment
34*2159047fSniklas#
35*2159047fSniklashost_tools="byacc flex bison binutils ld gas gcc gdb make patch
36*2159047fSniklas	    prms send-pr gprof gdbtest tgas etc expect dejagnu sim
37*2159047fSniklas            m4 autoconf ispell grep diff rcs cvs fileutils shellutils
38*2159047fSniklas	    textutils wdiff find emacs emacs19 uudecode hello tar gzip indent
39*2159047fSniklas	    recode release sed utils"
40*2159047fSniklas
41*2159047fSniklas
42*2159047fSniklas# these libraries are built for the target environment, and are built after
43*2159047fSniklas# the host libraries and the host tools (which may be a cross compiler)
44*2159047fSniklas#
45*2159047fSniklastarget_libs="target-libiberty target-libgloss target-newlib target-libio target-librx target-libstdc++ target-libg++ target-winsup"
46*2159047fSniklas
47*2159047fSniklas
48*2159047fSniklas# these tools are built using the target libs, and are intended to run only
49*2159047fSniklas# in the target environment
50*2159047fSniklas#
51*2159047fSniklas# note: any program that *uses* libraries that are in the "target_libs"
52*2159047fSniklas# list belongs in this list.  those programs are also very likely
53*2159047fSniklas# candidates for the "native_only" list which follows
54*2159047fSniklas#
55*2159047fSniklastarget_tools="target-examples target-groff"
56*2159047fSniklas
57*2159047fSniklas################################################################################
58*2159047fSniklas
59*2159047fSniklas## These two lists are of directories that are to be removed from the
60*2159047fSniklas## ${configdirs} list for either cross-compilations or for native-
61*2159047fSniklas## compilations.  For example, it doesn't make that much sense to
62*2159047fSniklas## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
63*2159047fSniklas## a native environment.
64*2159047fSniklas
65*2159047fSniklas# directories to be built in the native environment only
66*2159047fSniklas#
67*2159047fSniklasnative_only="autoconf cvs emacs emacs19 fileutils find grep gzip hello
68*2159047fSniklas	     indent ispell m4 rcs recode sed shellutils tar textutils gash
69*2159047fSniklas	     uudecode wdiff gprof target-groff"
70*2159047fSniklas
71*2159047fSniklas# directories to be built in a cross environment only
72*2159047fSniklas#
73*2159047fSniklascross_only="target-libiberty target-libgloss target-newlib"
74*2159047fSniklas
75*2159047fSniklas## All tools belong in one of the four categories, and are assigned above
76*2159047fSniklas## We assign ${configdirs} this way to remove all embedded newlines.  This
77*2159047fSniklas## is important because configure will choke if they ever get through.
78*2159047fSniklas## ${configdirs} is directories we build using the host tools.
79*2159047fSniklas## ${target_configdirs} is directories we build using the target tools.
80*2159047fSniklas#
81*2159047fSniklasconfigdirs=`echo ${host_libs} ${host_tools}`
82*2159047fSniklastarget_configdirs=`echo ${target_libs} ${target_tools}`
83*2159047fSniklas
84*2159047fSniklas################################################################################
85*2159047fSniklas
86*2159047fSniklassrctrigger=move-if-change
87*2159047fSniklassrcname="gnu development package"
88*2159047fSniklas
89*2159047fSniklas# This gets set non-empty for some net releases of packages.
90*2159047fSniklasappdirs=""
91*2159047fSniklas
92*2159047fSniklas# per-host:
93*2159047fSniklas
94*2159047fSniklas# Work in distributions that contain no compiler tools, like Autoconf.
95*2159047fSniklasif [ -d ${srcdir}/config ]; then
96*2159047fSniklascase "${host}" in
97*2159047fSniklas  m68k-hp-hpux*)	  host_makefile_frag=config/mh-hp300 ;;
98*2159047fSniklas  m68k-apollo-sysv*)      host_makefile_frag=config/mh-apollo68 ;;
99*2159047fSniklas  m68k-apollo-bsd*)       host_makefile_frag=config/mh-a68bsd ;;
100*2159047fSniklas  m88k-dg-dgux*)	  host_makefile_frag=config/mh-dgux ;;
101*2159047fSniklas  m88k-harris-cxux*)	  host_makefile_frag=config/mh-cxux ;;
102*2159047fSniklas  m88k-motorola-sysv*)    host_makefile_frag=config/mh-delta88;;
103*2159047fSniklas  mips*-dec-ultrix*)      host_makefile_frag=config/mh-decstation ;;
104*2159047fSniklas  mips*-sgi-irix[56]*)    host_makefile_frag=config/mh-irix5 ;;
105*2159047fSniklas  mips*-sgi-irix4*)       host_makefile_frag=config/mh-irix4 ;;
106*2159047fSniklas  mips*-sgi-irix3*)       host_makefile_frag=config/mh-sysv ;;
107*2159047fSniklas  mips*-*-sysv4*)	  host_makefile_frag=config/mh-sysv4 ;;
108*2159047fSniklas  mips*-*-sysv*)	  host_makefile_frag=config/mh-riscos ;;
109*2159047fSniklas  i[345]86-ncr-sysv4.3)   host_makefile_frag=config/mh-ncrsvr43 ;;
110*2159047fSniklas  i[345]86-ncr-sysv4*)    host_makefile_frag=config/mh-ncr3000 ;;
111*2159047fSniklas  i[345]86-*-sco*)        host_makefile_frag=config/mh-sco ;;
112*2159047fSniklas  i[345]86-*-isc*)	  host_makefile_frag=config/mh-sysv ;;
113*2159047fSniklas  i[345]86-*-linux*)      host_makefile_frag=config/mh-linux ;;
114*2159047fSniklas  i[345]86-*-solaris2*)   host_makefile_frag=config/mh-sysv4 ;;
115*2159047fSniklas  i[345]86-*-aix*)	  host_makefile_frag=config/mh-aix386 ;;
116*2159047fSniklas  i[345]86-*-go32*)	  host_makefile_frag=config/mh-go32 ;;
117*2159047fSniklas  i[345]86-*-win32)	  host_makefile_frag=config/mh-i386win32 ;;
118*2159047fSniklas  vax-*-ultrix2*)         host_makefile_frag=config/mh-vaxult2 ;;
119*2159047fSniklas  *-*-solaris2*)          host_makefile_frag=config/mh-solaris ;;
120*2159047fSniklas  m68k-sun-sunos*)	  host_makefile_frag=config/mh-sun3 ;;
121*2159047fSniklas  *-hp-hpux[78]*)         host_makefile_frag=config/mh-hpux8 ;;
122*2159047fSniklas  *-hp-hpux*)             host_makefile_frag=config/mh-hpux ;;
123*2159047fSniklas  *-*-hiux*)              host_makefile_frag=config/mh-hpux ;;
124*2159047fSniklas  rs6000-*-lynxos*)	  host_makefile_frag=config/mh-lynxrs6k ;;
125*2159047fSniklas  *-*-lynxos*)	  	  host_makefile_frag=config/mh-lynxos ;;
126*2159047fSniklas  *-*-sysv4*)             host_makefile_frag=config/mh-sysv4 ;;
127*2159047fSniklas  *-*-sysv*)              host_makefile_frag=config/mh-sysv ;;
128*2159047fSniklasesac
129*2159047fSniklasfi
130*2159047fSniklas
131*2159047fSniklas# See if we can extract a definition of CC from the fragment.
132*2159047fSniklasif [ -z "${CC}" ]; then
133*2159047fSniklas  if [ -n "${host_makefile_frag}" -a -f "${srcdir}/${host_makefile_frag}" ]; then
134*2159047fSniklas    xx=`sed -n -e 's/^[ 	]*CC[ 	]*=[ 	]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
135*2159047fSniklas    if [ -n "${xx}" ] ; then
136*2159047fSniklas      CC=$xx
137*2159047fSniklas    fi
138*2159047fSniklas  fi
139*2159047fSniklasfi
140*2159047fSniklas
141*2159047fSniklas# The Solaris /usr/ucb/cc compiler does not appear to work.
142*2159047fSniklascase "${host}" in
143*2159047fSniklas  sparc-sun-solaris2*)
144*2159047fSniklas      if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
145*2159047fSniklas          could_use=
146*2159047fSniklas          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
147*2159047fSniklas          if [ -d /opt/cygnus/bin ] ; then
148*2159047fSniklas              if [ "$could_use" = "" ] ; then
149*2159047fSniklas                  could_use="/opt/cygnus/bin"
150*2159047fSniklas              else
151*2159047fSniklas                  could_use="$could_use or /opt/cygnus/bin"
152*2159047fSniklas              fi
153*2159047fSniklas          fi
154*2159047fSniklas        if [ "$could_use" = "" ] ; then
155*2159047fSniklas            echo "Warning: compilation may fail because you're using"
156*2159047fSniklas            echo "/usr/ucb/cc.  You should change your PATH or CC "
157*2159047fSniklas            echo "variable and rerun configure."
158*2159047fSniklas        else
159*2159047fSniklas            echo "Warning: compilation may fail because you're using"
160*2159047fSniklas            echo "/usr/ucb/cc, when you should use the C compiler from"
161*2159047fSniklas            echo "$could_use.  You should change your"
162*2159047fSniklas            echo "PATH or CC variable and rerun configure."
163*2159047fSniklas        fi
164*2159047fSniklas      fi
165*2159047fSniklas  ;;
166*2159047fSniklasesac
167*2159047fSniklas
168*2159047fSniklas# We default to --with-shared on platforms where -fpic is meaningless.
169*2159047fSniklas# Well, we don't yet, but we will.
170*2159047fSniklasif false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
171*2159047fSniklas  case "${target}" in
172*2159047fSniklas    alpha-dec-osf*)	enable_shared=yes ;;
173*2159047fSniklas    mips-sgi-irix5*)	enable_shared=yes ;;
174*2159047fSniklas    *)			enable_shared=no ;;
175*2159047fSniklas  esac
176*2159047fSniklasfi
177*2159047fSniklas
178*2159047fSniklasif [ x${enable_shared} = xyes ]; then
179*2159047fSniklas  waugh=
180*2159047fSniklas  case "${host}" in
181*2159047fSniklas    hppa*)		waugh=config/mh-papic ;;
182*2159047fSniklas    i[345]86-*)		waugh=config/mh-x86pic ;;
183*2159047fSniklas    *)			waugh=config/mh-${host_cpu}pic ;;
184*2159047fSniklas  esac
185*2159047fSniklas  if [ -f ${srcdir}/${waugh} ]; then
186*2159047fSniklas    if [ -n "${host_makefile_frag}" ] ; then
187*2159047fSniklas      cat ${srcdir}/${host_makefile_frag} > mh-frag
188*2159047fSniklas      cat ${srcdir}/${waugh} >> mh-frag
189*2159047fSniklas      host_makefile_frag=mh-frag
190*2159047fSniklas    else
191*2159047fSniklas      host_makefile_frag=${waugh}
192*2159047fSniklas    fi
193*2159047fSniklas  fi
194*2159047fSniklasfi
195*2159047fSniklas
196*2159047fSniklas# per-target:
197*2159047fSniklas
198*2159047fSniklascase "${target}" in
199*2159047fSniklas  v810*)		target_makefile_frag=config/mt-v810 ;;
200*2159047fSniklas  i[345]86-*-netware*)  target_makefile_frag=config/mt-netware ;;
201*2159047fSniklas  powerpc-*-netware*)   target_makefile_frag=config/mt-netware ;;
202*2159047fSniklasesac
203*2159047fSniklas
204*2159047fSniklasskipdirs=
205*2159047fSniklasgasdir=gas
206*2159047fSniklasuse_gnu_ld=
207*2159047fSniklasuse_gnu_as=
208*2159047fSniklas
209*2159047fSniklas# some tools are so dependent upon X11 that if we're not building with X,
210*2159047fSniklas# it's not even worth trying to configure, much less build, that tool.
211*2159047fSniklas
212*2159047fSniklascase ${with_x} in
213*2159047fSniklas  yes | "")  # the default value for this tree is that X11 is available
214*2159047fSniklas	;;
215*2159047fSniklas  no)
216*2159047fSniklas	skipdirs="${skipdirs} tk gash"
217*2159047fSniklas	;;
218*2159047fSniklas  *)
219*2159047fSniklas    	echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2
220*2159047fSniklas    	;;
221*2159047fSniklasesac
222*2159047fSniklas
223*2159047fSniklas# Some tools are only suitable for building in a "native" situation.
224*2159047fSniklas# Those are added when we have a host==target configuration.  For cross
225*2159047fSniklas# toolchains, we add some directories that should only be useful in a
226*2159047fSniklas# cross-compiler.
227*2159047fSniklas
228*2159047fSniklasis_cross_compiler=
229*2159047fSniklas
230*2159047fSniklasif [ x"${host}" = x"${target}" ] ; then
231*2159047fSniklas	# when doing a native toolchain, don't build the targets
232*2159047fSniklas	# that are in the 'cross only' list
233*2159047fSniklas	skipdirs="${skipdirs} ${cross_only}"
234*2159047fSniklas	is_cross_compiler=no
235*2159047fSniklas	target_subdir=.
236*2159047fSniklaselse
237*2159047fSniklas	# similarly, don't build the targets in the 'native only'
238*2159047fSniklas	# list when building a cross compiler
239*2159047fSniklas	skipdirs="${skipdirs} ${native_only}"
240*2159047fSniklas	is_cross_compiler=yes
241*2159047fSniklas	target_subdir=${target_alias}
242*2159047fSniklas	if [ ! -d ${target_subdir} ] ; then
243*2159047fSniklas	    if mkdir ${target_subdir} ; then true
244*2159047fSniklas	    else
245*2159047fSniklas		echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
246*2159047fSniklas                exit 1
247*2159047fSniklas	    fi
248*2159047fSniklas	fi
249*2159047fSniklasfi
250*2159047fSniklas
251*2159047fSniklascopy_dirs=
252*2159047fSniklas
253*2159047fSniklas# Handle --with-headers=XXX.  The contents of the named directory are
254*2159047fSniklas# copied to $(tooldir)/sys-include.
255*2159047fSniklasif [ x"${with_headers}" != x ]; then
256*2159047fSniklas  if [ x${is_cross_compiler} = xno ]; then
257*2159047fSniklas    echo 1>&2 '***' --with-headers is only supported when cross compiling
258*2159047fSniklas    exit 1
259*2159047fSniklas  fi
260*2159047fSniklas  case "${exec_prefixoption}" in
261*2159047fSniklas  "") x=${prefix} ;;
262*2159047fSniklas  *) x=${exec_prefix} ;;
263*2159047fSniklas  esac
264*2159047fSniklas  copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
265*2159047fSniklasfi
266*2159047fSniklas
267*2159047fSniklas# Handle --with-libs=XXX.  Multiple directories are permitted.  The
268*2159047fSniklas# contents are copied to $(tooldir)/lib.
269*2159047fSniklasif [ x"${with_libs}" != x ]; then
270*2159047fSniklas  if [ x${is_cross_compiler} = xno ]; then
271*2159047fSniklas    echo 1>&2 '***' --with-libs is only supported when cross compiling
272*2159047fSniklas    exit 1
273*2159047fSniklas  fi
274*2159047fSniklas  # Copy the libraries in reverse order, so that files in the first named
275*2159047fSniklas  # library override files in subsequent libraries.
276*2159047fSniklas  case "${exec_prefixoption}" in
277*2159047fSniklas  "") x=${prefix} ;;
278*2159047fSniklas  *) x=${exec_prefix} ;;
279*2159047fSniklas  esac
280*2159047fSniklas  for l in ${with_libs}; do
281*2159047fSniklas    copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
282*2159047fSniklas  done
283*2159047fSniklasfi
284*2159047fSniklas
285*2159047fSniklas# If both --with-headers and --with-libs are specified, default to
286*2159047fSniklas# --without-newlib.
287*2159047fSniklasif [ x"${with_headers}" != x ] && [ x"${with_libs}" != x ]; then
288*2159047fSniklas  if [ x"${with_newlib}" = x ]; then
289*2159047fSniklas    with_newlib=no
290*2159047fSniklas  fi
291*2159047fSniklasfi
292*2159047fSniklas
293*2159047fSniklas# Recognize --with-newlib/--without-newlib.
294*2159047fSniklasif [ x${with_newlib} = xno ]; then
295*2159047fSniklas  skipdirs="${skipdirs} target-newlib"
296*2159047fSniklaselif [ x${with_newlib} = xyes ]; then
297*2159047fSniklas  skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
298*2159047fSniklasfi
299*2159047fSniklas
300*2159047fSniklas# Handle ${copy_dirs}
301*2159047fSniklasset fnord ${copy_dirs}
302*2159047fSniklasshift
303*2159047fSniklaswhile [ $# != 0 ]; do
304*2159047fSniklas  if [ -f $2/COPIED ] && [ x"`cat $2/COPIED`" = x"$1" ]; then
305*2159047fSniklas    :
306*2159047fSniklas  else
307*2159047fSniklas    echo Copying $1 to $2
308*2159047fSniklas
309*2159047fSniklas    # Use the install script to create the directory and all required
310*2159047fSniklas    # parent directories.
311*2159047fSniklas    if [ -d $2 ]; then
312*2159047fSniklas      :
313*2159047fSniklas    else
314*2159047fSniklas      echo >config.temp
315*2159047fSniklas      ${srcdir}/install.sh -c -m 644 config.temp $2/COPIED
316*2159047fSniklas    fi
317*2159047fSniklas
318*2159047fSniklas    # Copy the directory, assuming we have tar.
319*2159047fSniklas    # FIXME: Should we use B in the second tar?  Not all systems support it.
320*2159047fSniklas    (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
321*2159047fSniklas
322*2159047fSniklas    # It is the responsibility of the user to correctly adjust all
323*2159047fSniklas    # symlinks.  If somebody can figure out how to handle them correctly
324*2159047fSniklas    # here, feel free to add the code.
325*2159047fSniklas
326*2159047fSniklas    echo $1 > $2/COPIED
327*2159047fSniklas  fi
328*2159047fSniklas  shift; shift
329*2159047fSniklasdone
330*2159047fSniklas
331*2159047fSniklas# Configure extra directories which are host specific
332*2159047fSniklas
333*2159047fSniklascase "${host}" in
334*2159047fSniklas  i[345]86-*-win32* | i[345]86-*-go32*)
335*2159047fSniklas	  configdirs="$configdirs dosrel" ;;
336*2159047fSniklasesac
337*2159047fSniklas
338*2159047fSniklas# Remove more programs from consideration, based on the host or
339*2159047fSniklas# target this usually means that a port of the program doesn't
340*2159047fSniklas# exist yet.
341*2159047fSniklas
342*2159047fSniklasnoconfigdirs=""
343*2159047fSniklas
344*2159047fSniklascase "${host}" in
345*2159047fSniklas  i[345]86-*-vsta)
346*2159047fSniklas    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff"
347*2159047fSniklas    ;;
348*2159047fSniklas  i[345]86-*-go32)
349*2159047fSniklas    noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff"
350*2159047fSniklas	;;
351*2159047fSniklas  i[345]86-*-win32)
352*2159047fSniklas     noconfigdirs="patch diff flex make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs"
353*2159047fSniklas    ;;
354*2159047fSniklasesac
355*2159047fSniklas
356*2159047fSniklas
357*2159047fSniklascase "${target}" in
358*2159047fSniklas  *-*-netware)
359*2159047fSniklas    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty"
360*2159047fSniklas    ;;
361*2159047fSniklas  *-*-vxworks5.1)
362*2159047fSniklas    noconfigdirs="$noconfigdirs target-newlib"
363*2159047fSniklas    ;;
364*2159047fSniklas  alpha-dec-osf*)
365*2159047fSniklas    # ld works, but does not support shared libraries.  emacs doesn't
366*2159047fSniklas    # work.  newlib is not 64 bit ready.  I'm not sure about fileutils or grep.
367*2159047fSniklas    noconfigdirs="$noconfigdirs ld emacs fileutils grep target-newlib"
368*2159047fSniklas    ;;
369*2159047fSniklas  alpha*-*-*)
370*2159047fSniklas    # newlib is not 64 bit ready
371*2159047fSniklas    noconfigdirs="$noconfigdirs target-newlib"
372*2159047fSniklas    ;;
373*2159047fSniklas  arm-*-riscix*)
374*2159047fSniklas    noconfigdirs="$noconfigdirs ld"
375*2159047fSniklas    ;;
376*2159047fSniklas  h8300*-*-* | \
377*2159047fSniklas  h8500-*-*)
378*2159047fSniklas    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx"
379*2159047fSniklas    ;;
380*2159047fSniklas  hppa*-*-*elf* | \
381*2159047fSniklas  hppa*-*-lites*)
382*2159047fSniklas    # Do configure ld/binutils/gas for this case.
383*2159047fSniklas    ;;
384*2159047fSniklas  hppa*-*-*)
385*2159047fSniklas    # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
386*2159047fSniklas    # cc is gcc, and on any system a user should be able to link cc to
387*2159047fSniklas    # whatever they want.  FIXME, emacs emacs19).
388*2159047fSniklas    case "${CC}" in
389*2159047fSniklas	"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
390*2159047fSniklas        *) ;;
391*2159047fSniklas    esac
392*2159047fSniklas    noconfigdirs="$noconfigdirs ld shellutils"
393*2159047fSniklas    ;;
394*2159047fSniklas  i[345]86-*-go32)
395*2159047fSniklas    # but don't build gdb
396*2159047fSniklas    noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
397*2159047fSniklas    ;;
398*2159047fSniklas
399*2159047fSniklas  i[345]86-*-win32)
400*2159047fSniklas    # Can't build gdb for win32 if not native.
401*2159047fSniklas    # make/glob's configure uses some AC_TRY_RUN type tests
402*2159047fSniklas    if [ x${is_cross_compiler} = xyes ]; then
403*2159047fSniklas	    noconfigdirs="$noconfigdirs gdb tk make"
404*2159047fSniklas    fi
405*2159047fSniklas    # always build newlib.
406*2159047fSniklas    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
407*2159047fSniklas    ;;
408*2159047fSniklas  i[345]86-*-pe)
409*2159047fSniklas    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx"
410*2159047fSniklas    ;;
411*2159047fSniklas  i[345]86-*-sco*)
412*2159047fSniklas    noconfigdirs="$noconfigdirs gprof"
413*2159047fSniklas    ;;
414*2159047fSniklas  i[345]86-*-solaris2*)
415*2159047fSniklas    # The linker does static linking correctly, but the Solaris C library
416*2159047fSniklas    # has bugs such that some important functions won't work when statically
417*2159047fSniklas    # linked.  (See man pages for getpwuid, for example.)
418*2159047fSniklas    noconfigdirs="$noconfigdirs ld"
419*2159047fSniklas    ;;
420*2159047fSniklas  i[345]86-*-sysv4*)
421*2159047fSniklas    # The SYSV4 C compiler doesn't handle Emacs correctly
422*2159047fSniklas    case "${CC}" in
423*2159047fSniklas	"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
424*2159047fSniklas        *) ;;
425*2159047fSniklas    esac
426*2159047fSniklas    # but that's okay since emacs doesn't work anyway
427*2159047fSniklas    noconfigdirs="$noconfigdirs emacs emacs19"
428*2159047fSniklas    ;;
429*2159047fSniklas  powerpc-*-aix*)
430*2159047fSniklas    # copied from rs6000-*-* entry
431*2159047fSniklas    noconfigdirs="$noconfigdirs gprof cvs"
432*2159047fSniklas    ;;
433*2159047fSniklas  powerpc*-*-winnt* | powerpc*-*-pe*)
434*2159047fSniklas    noconfigdirs="$noconfigdirs gdb"
435*2159047fSniklas    ;;
436*2159047fSniklas  rs6000-*-lynxos*)
437*2159047fSniklas    # The CVS server code doesn't work on the RS/6000
438*2159047fSniklas    # Newlib makes problems for libg++ in crosses.
439*2159047fSniklas    noconfigdirs="$noconfigdirs target-newlib gprof cvs"
440*2159047fSniklas    ;;
441*2159047fSniklas  rs6000-*-*)
442*2159047fSniklas    noconfigdirs="$noconfigdirs gprof"
443*2159047fSniklas    ;;
444*2159047fSniklas  m68k-*-netbsd*)
445*2159047fSniklas    noconfigdirs="$noconfigdirs gdb"
446*2159047fSniklas    ;;
447*2159047fSniklas  m68k-apollo-*)
448*2159047fSniklas    noconfigdirs="$noconfigdirs ld binutils gprof"
449*2159047fSniklas    ;;
450*2159047fSniklas  mips*-*-irix5*)
451*2159047fSniklas    # The GNU linker does not support shared libraries.
452*2159047fSniklas    # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
453*2159047fSniklas    noconfigdirs="$noconfigdirs ld gprof emacs"
454*2159047fSniklas    ;;
455*2159047fSniklas  mips*-dec-bsd*)
456*2159047fSniklas    noconfigdirs="$noconfigdirs gprof"
457*2159047fSniklas    ;;
458*2159047fSniklas  mips*-*-bsd*)
459*2159047fSniklas    noconfigdirs="$noconfigdirs gprof"
460*2159047fSniklas    ;;
461*2159047fSniklas  mips*-*-*)
462*2159047fSniklas    noconfigdirs="$noconfigdirs gprof"
463*2159047fSniklas    ;;
464*2159047fSniklas  romp-*-*)
465*2159047fSniklas    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes"
466*2159047fSniklas    ;;
467*2159047fSniklas  sh-*-*)
468*2159047fSniklas    case "${host}" in
469*2159047fSniklas      i[345]86-*-vsta) ;; # don't add gprof back in
470*2159047fSniklas      i[345]86-*-go32) ;; # don't add gprof back in
471*2159047fSniklas      *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
472*2159047fSniklas    esac
473*2159047fSniklas    ;;
474*2159047fSniklas  sparc-*-sunos4*)
475*2159047fSniklas    if [ x${is_cross_compiler} != xno ] ; then
476*2159047fSniklas           noconfigdirs="$noconfigdirs gdb gdbtest target-newlib"
477*2159047fSniklas    else
478*2159047fSniklas           use_gnu_ld=no
479*2159047fSniklas    fi
480*2159047fSniklas    ;;
481*2159047fSniklas  v810-*-*)
482*2159047fSniklas    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libg++ target-libstdc++ opcodes"
483*2159047fSniklas    ;;
484*2159047fSniklas  vax-*-vms)
485*2159047fSniklas    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes"
486*2159047fSniklas    ;;
487*2159047fSniklas  vax-*-*)
488*2159047fSniklas    noconfigdirs="$noconfigdirs target-newlib"
489*2159047fSniklas    ;;
490*2159047fSniklas  *-*-lynxos*)
491*2159047fSniklas    # Newlib makes problems for libg++ in crosses.
492*2159047fSniklas    noconfigdirs="$noconfigdirs target-newlib"
493*2159047fSniklas    ;;
494*2159047fSniklas  *-*-macos* | \
495*2159047fSniklas  *-*-mpw*)
496*2159047fSniklas    # Macs want a resource compiler.
497*2159047fSniklas    configdirs="$configdirs grez"
498*2159047fSniklas    ;;
499*2159047fSniklasesac
500*2159047fSniklas
501*2159047fSniklas# If we are building a Canadian Cross, discard tools that can not be built
502*2159047fSniklas# using a cross compiler.  FIXME: These tools should be fixed.
503*2159047fSniklasif [ "${build}" != "${host}" ]; then
504*2159047fSniklas  noconfigdirs="$noconfigdirs expect dejagnu make texinfo diff"
505*2159047fSniklasfi
506*2159047fSniklas
507*2159047fSniklas# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
508*2159047fSniklas# $target_configdirs.
509*2159047fSniklas# If we have the source for $noconfigdirs entries, add them to $notsupp.
510*2159047fSniklas
511*2159047fSniklasnotsupp=""
512*2159047fSniklasfor dir in . $skipdirs $noconfigdirs ; do
513*2159047fSniklas  dirname=`echo $dir | sed -e s/target-//g`
514*2159047fSniklas  if [ $dir != . ]  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
515*2159047fSniklas    configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
516*2159047fSniklas    if [ -r $srcdir/$dirname/configure ] \
517*2159047fSniklas	|| [ -r $srcdir/$dirname/configure.in ]; then
518*2159047fSniklas      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
519*2159047fSniklas	true
520*2159047fSniklas      else
521*2159047fSniklas	notsupp="$notsupp $dir"
522*2159047fSniklas      fi
523*2159047fSniklas    fi
524*2159047fSniklas  fi
525*2159047fSniklas  if [ $dir != . ]  && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
526*2159047fSniklas    target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
527*2159047fSniklas    if [ -r $srcdir/$dirname/configure ] \
528*2159047fSniklas	|| [ -r $srcdir/$dirname/configure.in ]; then
529*2159047fSniklas      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
530*2159047fSniklas	true
531*2159047fSniklas      else
532*2159047fSniklas	notsupp="$notsupp $dir"
533*2159047fSniklas      fi
534*2159047fSniklas    fi
535*2159047fSniklas  fi
536*2159047fSniklasdone
537*2159047fSniklas
538*2159047fSniklas# Sometimes the tools are distributed with libiberty but with no other
539*2159047fSniklas# libraries.  In that case, we don't want to build target-libiberty.
540*2159047fSniklasif [ -n "${target_configdirs}" ]; then
541*2159047fSniklas  others=
542*2159047fSniklas  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
543*2159047fSniklas    if [ "$i" != "libiberty" ]; then
544*2159047fSniklas      if [ -r $srcdir/$i/configure ] || [ -r $srcdir/$i/configure.in ]; then
545*2159047fSniklas	others=yes;
546*2159047fSniklas	break;
547*2159047fSniklas      fi
548*2159047fSniklas    fi
549*2159047fSniklas  done
550*2159047fSniklas  if [ -z "${others}" ]; then
551*2159047fSniklas    target_configdirs=
552*2159047fSniklas  fi
553*2159047fSniklasfi
554*2159047fSniklas
555*2159047fSniklas# Deconfigure all subdirectories, in case we are changing the
556*2159047fSniklas# configuration from one where a subdirectory is supported to one where it
557*2159047fSniklas# is not.
558*2159047fSniklasif [ -z "${norecursion}" -a -n "${configdirs}" ]; then
559*2159047fSniklas  for i in `echo ${configdirs} | sed -e s/target-//g` ; do
560*2159047fSniklas    rm -f $i/Makefile
561*2159047fSniklas  done
562*2159047fSniklasfi
563*2159047fSniklasif [ -z "${norecursion}" -a -n "${target_configdirs}" ]; then
564*2159047fSniklas  for i in `echo ${target_configdirs} | sed -e s/target-//` ; do
565*2159047fSniklas    rm -f ${target_subdir}/$i/Makefile
566*2159047fSniklas  done
567*2159047fSniklasfi
568*2159047fSniklas
569*2159047fSniklas# Produce a warning message for the subdirs we can't configure.
570*2159047fSniklas# This isn't especially interesting in the Cygnus tree, but in the individual
571*2159047fSniklas# FSF releases, it's important to let people know when their machine isn't
572*2159047fSniklas# supported by the one or two programs in a package.
573*2159047fSniklas
574*2159047fSniklasif [ -n "${notsupp}" ] && [ -z "${norecursion}" ]; then
575*2159047fSniklas  # If $appdirs is non-empty, at least one of those directories must still
576*2159047fSniklas  # be configured, or we error out.  (E.g., if the gas release supports a
577*2159047fSniklas  # specified target in some subdirs but not the gas subdir, we shouldn't
578*2159047fSniklas  # pretend that all is well.)
579*2159047fSniklas  if [ -n "$appdirs" ]; then
580*2159047fSniklas    for dir in $appdirs ; do
581*2159047fSniklas      if [ -r $dir/Makefile.in ]; then
582*2159047fSniklas	if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
583*2159047fSniklas	  appdirs=""
584*2159047fSniklas	  break
585*2159047fSniklas	fi
586*2159047fSniklas	if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
587*2159047fSniklas	  appdirs=""
588*2159047fSniklas	  break
589*2159047fSniklas	fi
590*2159047fSniklas      fi
591*2159047fSniklas    done
592*2159047fSniklas    if [ -n "$appdirs" ]; then
593*2159047fSniklas      echo "*** This configuration is not supported by this package." 1>&2
594*2159047fSniklas      exit 1
595*2159047fSniklas    fi
596*2159047fSniklas  fi
597*2159047fSniklas  # Okay, some application will build, or we don't care to check.  Still
598*2159047fSniklas  # notify of subdirs not getting built.
599*2159047fSniklas  echo "*** This configuration is not supported in the following subdirectories:" 1>&2
600*2159047fSniklas  echo "    ${notsupp}" 1>&2
601*2159047fSniklas  echo "    (Any other directories should still work fine.)" 1>&2
602*2159047fSniklasfi
603*2159047fSniklas
604*2159047fSniklas# Set with_gnu_as and with_gnu_ld as appropriate.
605*2159047fSniklas#
606*2159047fSniklas# This is done by determining whether or not the appropriate directory
607*2159047fSniklas# is available, and by checking whether or not specific configurations
608*2159047fSniklas# have requested that this magic not happen.
609*2159047fSniklas#
610*2159047fSniklas# The command line options always override the explicit settings in
611*2159047fSniklas# configure.in, and the settings in configure.in override this magic.
612*2159047fSniklas#
613*2159047fSniklas# If the default for a toolchain is to use GNU as and ld, and you don't
614*2159047fSniklas# want to do that, then you should use the --without-gnu-as and
615*2159047fSniklas# --without-gnu-ld options for the configure script.
616*2159047fSniklas
617*2159047fSniklasif [ x${use_gnu_as} = x ] ; then
618*2159047fSniklas  if [ x${with_gnu_as} != xno ] && echo " ${configdirs} " | grep " ${gasdir} " > /dev/null 2>&1 && [ -d ${srcdir}/${gasdir} ] ; then
619*2159047fSniklas    with_gnu_as=yes
620*2159047fSniklas    withoptions="$withoptions --with-gnu-as"
621*2159047fSniklas  fi
622*2159047fSniklasfi
623*2159047fSniklas
624*2159047fSniklasif [ x${use_gnu_ld} = x ] ; then
625*2159047fSniklas  if [ x${with_gnu_ld} != xno ] && echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 && [ -d ${srcdir}/ld ] ; then
626*2159047fSniklas    with_gnu_ld=yes
627*2159047fSniklas    withoptions="$withoptions --with-gnu-ld"
628*2159047fSniklas  fi
629*2159047fSniklasfi
630*2159047fSniklas
631*2159047fSniklasif [ x${enable_shared} = xyes ]; then
632*2159047fSniklas  case "${target}" in
633*2159047fSniklas    hppa*)		target_makefile_frag=config/mt-papic ;;
634*2159047fSniklas    i[345]86-*)		target_makefile_frag=config/mt-x86pic ;;
635*2159047fSniklas    *)			target_makefile_frag=config/mt-${target_cpu}pic ;;
636*2159047fSniklas  esac
637*2159047fSniklasfi
638*2159047fSniklas
639*2159047fSniklas# post-target:
640*2159047fSniklas
641*2159047fSniklas# Record target_configdirs and the configure arguments in Makefile.
642*2159047fSniklastarget_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
643*2159047fSniklastargargs=`echo "${arguments}" | \
644*2159047fSniklas	sed -e 's/--*norecursion//' \
645*2159047fSniklas	    -e 's/--*cache[a-z-]*=[^ 	]*//' \
646*2159047fSniklas	    -e 's/--*cache[a-z-]*[ 	][ 	]*[^ 	]*//'`
647*2159047fSniklassed -e "s:^TARGET_CONFIGDIRS[ 	]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
648*2159047fSniklas    -e "s%^CONFIG_ARGUMENTS[ 	]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
649*2159047fSniklas    -e "s%^TARGET_SUBDIR[ 	]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
650*2159047fSniklas       Makefile > Makefile.tem
651*2159047fSniklasrm -f Makefile
652*2159047fSniklasmv -f Makefile.tem Makefile
653*2159047fSniklas
654*2159047fSniklas#
655*2159047fSniklas# Local Variables:
656*2159047fSniklas# fill-column: 131
657*2159047fSniklas# End:
658*2159047fSniklas#
659