The first a bug in pax and should be commited to FBSD, too.
[dragonfly.git] / contrib / gdb / configure.in
1 #! /bin/bash
2 ##############################################################################
3
4 ## This file is a shell script fragment that supplies the information
5 ## necessary to tailor a template configure script into the configure
6 ## script appropriate for this directory.  For more information, check
7 ## any existing configure script.  
8
9 ## Be warned, there are two types of configure.in files.  There are those
10 ## used by Autoconf, which are macros which are expanded into a configure
11 ## script by autoconf.  The other sort, of which this is one, is executed
12 ## by Cygnus configure.  
13
14 ## For more information on these two systems, check out the documentation
15 ## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi).  
16
17 #   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
18 #   Free Software Foundation, Inc.
19 #
20 # This file is free software; you can redistribute it and/or modify it
21 # under the terms of the GNU General Public License as published by
22 # the Free Software Foundation; either version 2 of the License, or
23 # (at your option) any later version.
24 #
25 # This program is distributed in the hope that it will be useful, but
26 # WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
28 # General Public License for more details.
29 #
30 # You should have received a copy of the GNU General Public License
31 # along with this program; if not, write to the Free Software
32 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33
34 ##############################################################################
35
36 ### To add a new directory to the tree, first choose whether it is a target
37 ### or a host dependent tool.  Then put it into the appropriate list
38 ### (library or tools, host or target), doing a dependency sort.  For
39 ### example, gdb requires that byacc (or bison) be built first, so it is in
40 ### the ${host_tools} list after byacc and bison.  
41
42
43 # these libraries are used by various programs built for the host environment
44 #
45 host_libs="intl mmalloc libiberty opcodes bfd readline gash db tcl tk tcl8.1 tk8.1 tclX itcl tix libgui"
46
47 if [ "${enable_gdbgui}" = "yes" ] ; then
48         host_libs="${host_libs} libgui"
49 fi
50
51 # these tools are built for the host environment
52 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
53 # know that we are building the simulator.
54 host_tools="byacc flex bison binutils ld gas gcc 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"
55
56 # these libraries are built for the target environment, and are built after
57 # the host libraries and the host tools (which may be a cross compiler)
58 #
59 target_libs="target-libiberty \
60                 target-libgloss \
61                 target-newlib \
62                 target-libio \
63                 target-librx \
64                 target-libstdc++ \
65                 target-libg++"
66
67 # these tools are built using the target libs, and are intended to run only
68 # in the target environment
69 #
70 # note: any program that *uses* libraries that are in the "target_libs"
71 # list belongs in this list.  those programs are also very likely
72 # candidates for the "native_only" list which follows
73 #
74 target_tools="target-examples target-groff target-gperf"
75
76 ################################################################################
77
78 ## These two lists are of directories that are to be removed from the
79 ## ${configdirs} list for either cross-compilations or for native-
80 ## compilations.  For example, it doesn't make that much sense to
81 ## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
82 ## a native environment.  
83
84 # directories to be built in the native environment only
85 #
86 # This must be a single line because of the way it is searched by grep in
87 # the code below.
88 native_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"
89
90 # directories to be built in a cross environment only
91 #
92 cross_only="target-libgloss target-newlib target-cygmon target-opcodes target-libstub"
93
94 ## All tools belong in one of the four categories, and are assigned above
95 ## We assign ${configdirs} this way to remove all embedded newlines.  This
96 ## is important because configure will choke if they ever get through.
97 ## ${configdirs} is directories we build using the host tools.
98 ## ${target_configdirs} is directories we build using the target tools.
99 #
100 configdirs=`echo ${host_libs} ${host_tools}`
101 target_configdirs=`echo ${target_libs} ${target_tools}`
102
103 ################################################################################
104
105 srctrigger=move-if-change
106 srcname="gnu development package"
107
108 # This gets set non-empty for some net releases of packages.
109 appdirs=""
110
111 # per-host:
112
113 # Work in distributions that contain no compiler tools, like Autoconf.
114 if [ -d ${srcdir}/config ]; then
115 case "${host}" in
116   m68k-hp-hpux*)
117     host_makefile_frag="${host_makefile_frag} config/mh-hp300"
118     ;;
119   m68k-apollo-sysv*)
120     host_makefile_frag="${host_makefile_frag} config/mh-apollo68"
121     ;;
122   m68k-apollo-bsd*)
123     host_makefile_frag="${host_makefile_frag} config/mh-a68bsd"
124     ;;
125   m88k-dg-dgux*)
126     host_makefile_frag="${host_makefile_frag} config/mh-dgux"
127     ;;
128   m88k-harris-cxux*)
129     host_makefile_frag="${host_makefile_frag} config/mh-cxux"
130     ;;
131   m88k-motorola-sysv*)
132     host_makefile_frag="${host_makefile_frag} config/mh-delta88"
133     ;;
134   mips*-dec-ultrix*)
135     host_makefile_frag="${host_makefile_frag} config/mh-decstation"
136     ;;
137   mips*-nec-sysv4*)
138     host_makefile_frag="${host_makefile_frag} config/mh-necv4"
139     ;;
140   mips*-sgi-irix6*)
141     host_makefile_frag="${host_makefile_frag} config/mh-irix6"
142     ;;
143   mips*-sgi-irix5*)
144     host_makefile_frag="${host_makefile_frag} config/mh-irix5"
145     ;;
146   mips*-sgi-irix4*)
147     host_makefile_frag="${host_makefile_frag} config/mh-irix4"
148     ;;
149   mips*-sgi-irix3*)
150     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
151     ;;
152   mips*-*-sysv4*)
153     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
154     ;;
155   mips*-*-sysv*)
156     host_makefile_frag="${host_makefile_frag} config/mh-riscos"
157     ;;
158   i[3456]86-*-sysv5*)
159     host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
160     ;;
161   i[3456]86-*-dgux*)
162     host_makefile_frag="${host_makefile_frag} config/mh-dgux386"
163     ;;
164   i[3456]86-ncr-sysv4.3*)
165     host_makefile_frag="${host_makefile_frag} config/mh-ncrsvr43"
166     ;;
167   i[3456]86-ncr-sysv4*)
168     host_makefile_frag="${host_makefile_frag} config/mh-ncr3000"
169     ;;
170   i[3456]86-*-sco3.2v5*)
171     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
172     ;;
173   i[3456]86-*-sco*)
174     host_makefile_frag="${host_makefile_frag} config/mh-sco"
175     ;;
176   i[3456]86-*-udk*)
177     host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
178     ;;
179   i[3456]86-*-isc*)
180     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
181     ;;
182   i[3456]86-*-solaris2*)
183     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
184     ;;
185   i[3456]86-*-aix*)
186     host_makefile_frag="${host_makefile_frag} config/mh-aix386"
187     ;;
188   i[3456]86-*-go32*)
189     host_makefile_frag="${host_makefile_frag} config/mh-go32"
190     ;;
191   i[3456]86-*-msdosdjgpp*)
192     host_makefile_frag="${host_makefile_frag} config/mh-go32"
193     ;;
194   *-cygwin*)
195     host_makefile_frag="${host_makefile_frag} config/mh-cygwin"
196     ;;
197   *-mingw32*)
198     host_makefile_frag="${host_makefile_frag} config/mh-mingw32"
199     ;;
200   *-windows*)
201     host_makefile_frag="${host_makefile_frag} config/mh-windows"
202     ;;
203   vax-*-ultrix2*)
204     host_makefile_frag="${host_makefile_frag} config/mh-vaxult2"
205     ;;
206   *-*-solaris2*)
207     host_makefile_frag="${host_makefile_frag} config/mh-solaris"
208     ;;
209   m68k-sun-sunos*)
210     host_makefile_frag="${host_makefile_frag} config/mh-sun3"
211     ;;
212   *-hp-hpux[78]*)
213     host_makefile_frag="${host_makefile_frag} config/mh-hpux8"
214     ;;
215   *-hp-hpux*)
216     host_makefile_frag="${host_makefile_frag} config/mh-hpux"
217     ;;
218   *-*-hiux*)
219     host_makefile_frag="${host_makefile_frag} config/mh-hpux"
220     ;;
221   rs6000-*-lynxos*)
222     host_makefile_frag="${host_makefile_frag} config/mh-lynxrs6k"
223     ;;
224   *-*-lynxos*)
225     host_makefile_frag="${host_makefile_frag} config/mh-lynxos"
226     ;;
227   *-*-aix4.[3456789]* | *-*-aix[56789].*)
228     host_makefile_frag="${host_makefile_frag} config/mh-aix43"
229     ;;
230   *-*-sysv4*)
231     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
232     ;;
233   *-*-sysv*)
234     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
235     ;;
236 esac
237 fi
238
239 # If we aren't going to be using gcc, see if we can extract a definition
240 # of CC from the fragment.
241 if [ -z "${CC}" ] && [ "${build}" = "${host}" ]; then
242   IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
243   found=
244   for dir in $PATH; do
245     test -z "$dir" && dir=.
246     if test -f $dir/gcc; then
247       found=yes
248       break
249     fi
250   done
251   IFS="$save_ifs"
252   if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] && [ -f "${srcdir}/${host_makefile_frag}" ]; then
253     xx=`sed -n -e 's/^[         ]*CC[   ]*=[    ]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
254     if [ -n "${xx}" ] ; then
255       CC=$xx
256     fi
257   fi
258 fi
259
260 # We default to --with-shared on platforms where -fpic is meaningless.
261 # Well, we don't yet, but we will.
262 if false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
263   case "${target}" in
264     alpha*-dec-osf*)    enable_shared=yes ;;
265     alpha*-*-linux*)    enable_shared=yes ;;
266     mips-sgi-irix5*)    enable_shared=yes ;;
267     *)                  enable_shared=no ;;
268   esac
269 fi
270
271 case "${enable_shared}" in
272   yes) shared=yes ;;
273   no) shared=no ;;
274   "") shared=no ;;
275   *) shared=yes ;;
276 esac
277
278 if [ x${shared} = xyes ]; then
279   case "${host}" in
280     hppa*)
281       host_makefile_frag="${host_makefile_frag} config/mh-papic"
282       ;;
283     i[3456]86-*-cygwin*)
284       # We don't want -fPIC on Cygwin.
285       ;;
286     i[3456]86-*)
287       host_makefile_frag="${host_makefile_frag} config/mh-x86pic"
288       ;;
289     sparc64-*)
290       host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
291       ;;
292     powerpc*-*)
293       host_makefile_frag="${host_makefile_frag} config/mh-ppcpic"
294       ;;
295     alpha*-*-linux*)
296       host_makefile_frag="${host_makefile_frag} config/mh-elfalphapic"
297       ;;
298     *)
299       if test -f ${srcdir}/config/mh-${host_cpu}pic; then
300         host_makefile_frag="${host_makefile_frag} config/mh-${host_cpu}pic"
301       fi
302       ;;
303   esac
304 fi
305
306 rm -f mh-frag
307 if [ -n "${host_makefile_frag}" ] ; then
308   for f in ${host_makefile_frag}
309   do
310     cat ${srcdir}/$f >> mh-frag
311   done
312   host_makefile_frag=mh-frag
313 fi
314
315 # per-target:
316
317 case "${target}" in
318   v810*)
319     target_makefile_frag="${target_makefile_frag} config/mt-v810"
320     ;;
321   i[3456]86-*-netware*)
322     target_makefile_frag="${target_makefile_frag} config/mt-netware"
323     ;;
324   powerpc-*-netware*)
325     target_makefile_frag="${target_makefile_frag} config/mt-netware"
326     ;;
327   *-*-linux-gnu)
328     target_makefile_frag="${target_makefile_frag} config/mt-linux"
329     ;;
330 esac
331
332 # If --enable-target-optspace always use -Os instead of -O2 to build
333 # the target libraries, similarly if it is not specified, use -Os
334 # on selected platforms.
335 case "${enable_target_optspace}:${target}" in
336   yes:*)
337     target_makefile_frag="${target_makefile_frag} config/mt-ospace"
338     ;;
339   # CYGNUS LOCAL d10v, d30v, fr30
340   :m32r-* | :d10v-* | :d30v-* | :fr30-*)
341     target_makefile_frag="${target_makefile_frag} config/mt-ospace"
342     ;;
343   no:* | :*)
344     ;;
345   *)
346     echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
347     ;;
348 esac
349
350 skipdirs=
351 gasdir=gas
352 use_gnu_ld=
353 use_gnu_as=
354
355 # some tools are so dependent upon X11 that if we're not building with X, 
356 # it's not even worth trying to configure, much less build, that tool.
357
358 case ${with_x} in
359   yes | "")  # the default value for this tree is that X11 is available
360         ;;
361   no)
362         skipdirs="${skipdirs} tk libgui gash"
363         ;;
364   *)
365         echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2
366         ;;
367 esac
368
369 # Some tools are only suitable for building in a "native" situation.
370 # Those are added when we have a host==target configuration.  For cross
371 # toolchains, we add some directories that should only be useful in a
372 # cross-compiler.
373
374 is_cross_compiler=
375
376 if [ x"${host}" = x"${target}" ] ; then
377         # when doing a native toolchain, don't build the targets
378         # that are in the 'cross only' list
379         skipdirs="${skipdirs} ${cross_only}"
380         is_cross_compiler=no
381 else
382         # similarly, don't build the targets in the 'native only' 
383         # list when building a cross compiler
384         skipdirs="${skipdirs} ${native_only}"
385         is_cross_compiler=yes
386 fi      
387
388 # We always want to use the same name for this directory, so that dejagnu
389 # can reliably find it.
390 target_subdir=${target_alias}
391
392 if [ ! -d ${target_subdir} ] ; then
393   if mkdir ${target_subdir} ; then true
394   else
395     echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
396     exit 1
397   fi
398 fi
399
400 copy_dirs=
401
402 # Handle --with-headers=XXX.  The contents of the named directory are
403 # copied to $(tooldir)/sys-include.
404 if [ x"${with_headers}" != x ]; then
405   if [ x${is_cross_compiler} = xno ]; then
406     echo 1>&2 '***' --with-headers is only supported when cross compiling
407     exit 1
408   fi
409   case "${exec_prefixoption}" in
410   "") x=${prefix} ;;
411   *) x=${exec_prefix} ;;
412   esac
413   copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
414 fi
415
416 # Handle --with-libs=XXX.  Multiple directories are permitted.  The
417 # contents are copied to $(tooldir)/lib.
418 if [ x"${with_libs}" != x ]; then
419   if [ x${is_cross_compiler} = xno ]; then
420     echo 1>&2 '***' --with-libs is only supported when cross compiling
421     exit 1
422   fi
423   # Copy the libraries in reverse order, so that files in the first named
424   # library override files in subsequent libraries.
425   case "${exec_prefixoption}" in
426   "") x=${prefix} ;;
427   *) x=${exec_prefix} ;;
428   esac
429   for l in ${with_libs}; do
430     copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
431   done
432 fi
433
434 # If both --with-headers and --with-libs are specified, default to
435 # --without-newlib.
436 if [ x"${with_headers}" != x ] && [ x"${with_libs}" != x ]; then
437   if [ x"${with_newlib}" = x ]; then
438     with_newlib=no
439   fi
440 fi
441
442 # Recognize --with-newlib/--without-newlib.
443 if [ x${with_newlib} = xno ]; then
444   skipdirs="${skipdirs} target-newlib"
445 elif [ x${with_newlib} = xyes ]; then
446   skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
447 fi
448
449 # Default to using --with-stabs for certain targets.
450 if [ x${with_stabs} = x ]; then
451   case "${target}" in
452   mips*-*-irix6*)
453     ;;
454   mips*-*-* | alpha*-*-osf*)
455     with_stabs=yes;
456     withoptions="${withoptions} --with-stabs"
457     ;;
458   esac
459 fi
460
461 # Handle ${copy_dirs}
462 set fnord ${copy_dirs}
463 shift
464 while [ $# != 0 ]; do
465   if [ -f $2/COPIED ] && [ x"`cat $2/COPIED`" = x"$1" ]; then
466     :
467   else
468     echo Copying $1 to $2
469
470     # Use the install script to create the directory and all required
471     # parent directories.
472     if [ -d $2 ]; then
473       :
474     else
475       echo >config.temp
476       ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
477     fi
478
479     # Copy the directory, assuming we have tar.
480     # FIXME: Should we use B in the second tar?  Not all systems support it.
481     (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
482
483     # It is the responsibility of the user to correctly adjust all
484     # symlinks.  If somebody can figure out how to handle them correctly
485     # here, feel free to add the code.
486
487     echo $1 > $2/COPIED
488   fi
489   shift; shift
490 done
491
492 # Configure extra directories which are host specific
493
494 case "${host}" in
495         i[3456]86-*-go32*)
496           configdirs="$configdirs dosrel" ;;
497         i[3456]86-*-mingw32*)
498           configdirs="$configdirs dosrel" ;;
499         *-cygwin*)
500           configdirs="$configdirs libtermcap dosrel" ;;
501 esac
502
503 # Remove more programs from consideration, based on the host or 
504 # target this usually means that a port of the program doesn't
505 # exist yet.
506
507 noconfigdirs=""
508
509 case "${host}" in
510   i[3456]86-*-vsta)
511     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"
512     ;;
513   i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
514     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"
515         ;;
516   i[3456]86-*-mingw32*)
517     # 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"
518      noconfigdirs="expect dejagnu cvs autoconf automake send-pr gprof rcs guile perl texinfo apache inet libtool"
519         ;;
520   *-*-cygwin*)
521      noconfigdirs="autoconf automake send-pr gprof rcs guile perl texinfo apache inet"
522     ;;
523   *-*-windows*)
524 # This is only used to build WinGDB...
525 # note that powerpc-eabi depends on sim configured before gdb.
526      configdirs="bfd libiberty opcodes readline sim gdb"
527      target_configdirs=
528     ;;
529   *-*-netbsd*)
530     noconfigdirs="rcs"
531     ;;
532   ppc*-*-pe)
533      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"
534     ;;
535 esac
536
537
538 case "${target}" in
539   *-*-netware)
540     noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty target-libgloss"
541     ;;
542   *-*-rtems*)
543     noconfigdirs="$noconfigdirs target-libgloss"
544     ;;
545   *-*-vxworks*)
546     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
547     ;;
548   alpha*-dec-osf*)
549     # ld works, but does not support shared libraries.  emacs doesn't
550     # work.  newlib is not 64 bit ready.  I'm not sure about fileutils.
551     # gas doesn't generate exception information.
552     noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss"
553     ;;
554   alpha*-*-*vms*)
555     noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss"
556     ;;
557   alpha*-*-linux*)
558     # newlib is not 64 bit ready
559     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
560     # linux has rx in libc
561     skipdirs="$skipdirs target-librx"
562     ;;
563   alpha*-*-*)
564     # newlib is not 64 bit ready
565     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
566     ;;
567   arc-*-*)
568     noconfigdirs="$noconfigdirs target-libgloss"
569     ;;
570   arm-*-pe*)
571     noconfigdirs="$noconfigdirs target-libgloss"
572     ;;
573   arm-*-coff*)
574     noconfigdirs="$noconfigdirs target-libgloss"
575     ;;
576   arm-*-elf*)
577     noconfigdirs="$noconfigdirs target-libgloss"
578     if [ x${is_cross_compiler} != xno ] ; then
579            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
580     fi
581     ;;
582   arm-*-oabi*)
583     noconfigdirs="$noconfigdirs target-libgloss"
584     if [ x${is_cross_compiler} != xno ] ; then
585            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
586     fi
587     ;;
588   c4x-*-*)
589     noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
590     ;;
591   thumb-*-coff)
592     noconfigdirs="$noconfigdirs target-libgloss"
593     ;;
594 # CYGNUS LOCAL clm/arm-elf
595   thumb-*-elf)
596     noconfigdirs="$noconfigdirs target-libgloss"
597     ;;
598   thumb-*-oabi)
599     noconfigdirs="$noconfigdirs target-libgloss"
600     ;;
601 # END CYGNUS LOCAL
602 # CYGNUS LOCAL nickc/strongarm
603   strongarm-*-elf)
604     noconfigdirs="$noconfigdirs target-libgloss"
605     if [ x${is_cross_compiler} != xno ] ; then
606            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
607     fi
608     ;;
609   strongarm-*-coff)
610     noconfigdirs="$noconfigdirs target-libgloss"
611     ;;
612 # END CYGNUS LOCAL
613   thumb-*-pe) # CYGNUS LOCAL nickc/thumb
614     noconfigdirs="$noconfigdirs target-libgloss"
615     ;;
616   arm-*-riscix*)
617     noconfigdirs="$noconfigdirs ld target-libgloss"
618     ;;
619   d10v-*-*)
620     noconfigdirs="$noconfigdirs target-librx target-libg++ target-libstdc++ target-libio target-libgloss"
621     ;;
622 # CYGNUS LOCAL d30v
623   d30v-*-*)
624     ;;
625 # END CYGNUS LOCAL
626 # CYGNUS LOCAL fr30
627   fr30-*-elf*)
628     if [ x${is_cross_compiler} != xno ] ; then
629            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
630     fi
631     ;;
632 # END CYGNUS LOCAL
633   h8300*-*-* | \
634   h8500-*-*)
635     noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
636     ;;
637   hppa*-*-*elf* | \
638   hppa*-*-lites*)
639     # Do configure ld/binutils/gas for this case.
640     ;;
641   hppa*-*-*)
642     # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
643     # cc is gcc, and on any system a user should be able to link cc to
644     # whatever they want.  FIXME, emacs emacs19).
645     case "${CC}" in
646         "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
647         *) ;;
648     esac
649     noconfigdirs="$noconfigdirs ld shellutils"
650     ;;
651   i[3456]86-*-coff | i[3456]86-*-elf)
652     if [ x${is_cross_compiler} != xno ] ; then
653          target_configdirs="${target_configdirs} target-libstub target-cygmon"
654     fi
655     ;;
656   i[3456]86-*-go32* | i[3456]-*-msdosdjgpp*)
657     # but don't build gdb
658     noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
659     ;;
660   *-*-linux*)
661     # linux has rx in libc
662     skipdirs="$skipdirs target-librx"
663     ;;
664   i[3456]86-*-mingw32*)
665     target_configdirs="$target_configdirs target-mingw"
666     noconfigdirs="$noconfigdirs expect target-libgloss"
667
668     # Can't build gdb for mingw32 if not native.
669     case "${host}" in
670       i[3456]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
671       *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
672          ;;
673     esac
674     ;;    
675   *-*-cygwin*)
676     target_configdirs="$target_configdirs target-libtermcap target-winsup"
677     noconfigdirs="$noconfigdirs target-libgloss"
678     # always build newlib.
679     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
680
681     # Can't build gdb for Cygwin if not native.
682     case "${host}" in
683       *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
684       *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
685          ;;
686     esac
687     ;;    
688   i[3456]86-*-pe)
689     noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
690     ;;
691   i[3456]86-*-sco3.2v5*)
692     # The linker does not yet know about weak symbols in COFF,
693     # and is not configured to handle mixed ELF and COFF.
694     noconfigdirs="$noconfigdirs ld target-libgloss"
695     ;;
696   i[3456]86-*-sco*)
697     noconfigdirs="$noconfigdirs gprof target-libgloss"
698     ;;
699   i[3456]86-*-solaris2*)
700     noconfigdirs="$noconfigdirs target-libgloss"
701     ;;
702   i[3456]86-*-sysv4*)
703     # The SYSV4 C compiler doesn't handle Emacs correctly
704     case "${CC}" in
705         "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
706         *) ;;
707     esac
708     # but that's okay since emacs doesn't work anyway
709     noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss"
710     ;;
711   m68k-*-*)
712     if [ x${is_cross_compiler} != xno ] ; then
713            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
714     fi
715     ;;
716   mn10200-*-*)
717     noconfigdirs="$noconfigdirs"
718     if [ x${is_cross_compiler} != xno ] ; then
719            target_configdirs="${target_configdirs} target-libstub target-cygmon"
720     fi
721     ;;
722   mn10300-*-*)
723     noconfigdirs="$noconfigdirs"
724     if [ x${is_cross_compiler} != xno ] ; then
725            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
726     fi
727     ;;
728   powerpc-*-aix*)
729     # copied from rs6000-*-* entry
730     noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss"
731     # This is needed until gcc and ld are fixed to work together.
732     use_gnu_ld=no
733     ;;
734   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
735     target_configdirs="$target_configdirs target-winsup"
736     noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv"
737     # always build newlib.
738     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
739     ;;
740     # This is temporary until we can link against shared libraries
741   powerpcle-*-solaris*)
742     noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv"
743     ;;
744   powerpc-*-eabi)
745     if [ x${is_cross_compiler} != xno ] ; then
746            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
747     fi
748     ;;
749   rs6000-*-lynxos*)
750     # The CVS server code doesn't work on the RS/6000
751     # Newlib makes problems for libg++ in crosses.
752     noconfigdirs="$noconfigdirs target-newlib gprof cvssrc"
753     ;;
754   rs6000-*-aix*)
755     noconfigdirs="$noconfigdirs gprof"
756     # This is needed until gcc and ld are fixed to work together.
757     use_gnu_ld=no
758     ;;
759   rs6000-*-*)
760     noconfigdirs="$noconfigdirs gprof"
761     ;;
762   m68k-apollo-*)
763     noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
764     ;;
765   mips*-*-irix5*)
766     # The GNU linker does not support shared libraries.
767     # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
768     noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss"
769     ;;
770   mips*-*-irix6*)
771     # The GNU assembler and linker do not support IRIX 6.
772     # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
773     noconfigdirs="$noconfigdirs ld gas gprof emacs target-libgloss"
774     ;;
775   mips*-dec-bsd*)
776     noconfigdirs="$noconfigdirs gprof target-libgloss"
777     ;;
778   mips*-*-bsd*)
779     noconfigdirs="$noconfigdirs gprof target-libgloss"
780     ;;
781   mipstx39-*-*)
782     noconfigdirs="$noconfigdirs gprof"   # same as generic mips
783     target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
784    ;;
785   mips*-*-*)
786     noconfigdirs="$noconfigdirs gprof"
787     ;;
788   romp-*-*)
789     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss"
790     ;;
791   sh-*-*)
792     case "${host}" in
793       i[3456]86-*-vsta) ;; # don't add gprof back in
794       i[3456]86-*-go32*) ;; # don't add gprof back in
795       i[3456]86-*-msdosdjgpp*) ;; # don't add gprof back in
796       *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
797     esac
798     noconfigdirs="$noconfigdirs target-libgloss"
799     ;;
800   sparc-*-elf*)
801     if [ x${is_cross_compiler} != xno ] ; then
802            target_configdirs="${target_configdirs} target-libstub target-cygmon"
803     fi
804     ;;
805   sparc64-*-elf*)
806     if [ x${is_cross_compiler} != xno ] ; then
807            target_configdirs="${target_configdirs} target-libstub target-cygmon"
808     fi
809     ;;
810   sparclite-*-*)
811     if [ x${is_cross_compiler} != xno ] ; then
812            target_configdirs="${target_configdirs} target-libstub target-cygmon"
813     fi
814     ;;
815   sparc-*-sunos4*)
816     if [ x${is_cross_compiler} != xno ] ; then
817            noconfigdirs="$noconfigdirs gdb gdbtest target-newlib target-libgloss"
818     else
819            use_gnu_ld=no
820     fi
821     ;;
822   v810-*-*)
823     noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libio target-libg++ target-libstdc++ opcodes target-libgloss"
824     ;;
825   v850-*-*)
826     noconfigdirs="$noconfigdirs target-libgloss"
827     ;;
828   v850e-*-*) # CYGNUS LOCAL v850e
829     noconfigdirs="$noconfigdirs target-libgloss"
830     ;;
831   v850ea-*-*)
832     noconfigdirs="$noconfigdirs target-libgloss"
833     ;;       # END CYGNUS LOCAL
834   vax-*-vms)
835     noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss"
836     ;;
837   vax-*-*)
838     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
839     ;;
840   *-*-lynxos*)
841     # Newlib makes problems for libg++ in crosses.
842     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
843     ;; 
844   *-*-macos* | \
845   *-*-mpw*)
846     # Macs want a resource compiler.
847     configdirs="$configdirs grez"
848     ;;    
849 esac
850
851 # If we aren't building newlib, then don't build libgloss, since libgloss
852 # depends upon some newlib header files.
853 case "${noconfigdirs}" in
854   *target-libgloss*) ;;
855   *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
856 esac
857
858 # Make sure we don't let GNU ld be added if we didn't want it.
859 if [ x$with_gnu_ld = xno ]; then
860   use_gnu_ld=no
861   noconfigdirs="$noconfigdirs ld"
862 fi
863
864 # Make sure we don't let GNU as be added if we didn't want it.
865 if [ x$with_gnu_as = xno ]; then
866   use_gnu_as=no
867   noconfigdirs="$noconfigdirs gas"
868 fi
869
870 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
871 # $target_configdirs.
872 # If we have the source for $noconfigdirs entries, add them to $notsupp.
873
874 notsupp=""
875 for dir in . $skipdirs $noconfigdirs ; do
876   dirname=`echo $dir | sed -e s/target-//g`
877   if [ $dir != . ]  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
878     configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
879     if [ -r $srcdir/$dirname/configure ] \
880         || [ -r $srcdir/$dirname/configure.in ]; then
881       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
882         true
883       else
884         notsupp="$notsupp $dir"
885       fi
886     fi
887   fi
888   if [ $dir != . ]  && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
889     target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
890     if [ -r $srcdir/$dirname/configure ] \
891         || [ -r $srcdir/$dirname/configure.in ]; then
892       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
893         true
894       else
895         notsupp="$notsupp $dir"
896       fi
897     fi
898   fi
899 done
900
901 # Sometimes the tools are distributed with libiberty but with no other
902 # libraries.  In that case, we don't want to build target-libiberty.
903 if [ -n "${target_configdirs}" ]; then
904   others=
905   for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
906     if [ "$i" != "libiberty" ]; then
907       if [ -r $srcdir/$i/configure ] || [ -r $srcdir/$i/configure.in ]; then
908         others=yes;
909         break;
910       fi
911     fi
912   done
913   if [ -z "${others}" ]; then
914     target_configdirs=
915   fi
916 fi
917
918 # Deconfigure all subdirectories, in case we are changing the
919 # configuration from one where a subdirectory is supported to one where it
920 # is not.
921 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ]; then
922   for i in `echo ${configdirs} | sed -e s/target-//g` ; do
923     rm -f $i/Makefile
924   done
925 fi
926 if [ -z "${norecursion}" ] && [ -n "${target_configdirs}" ]; then
927   for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
928     rm -f ${target_subdir}/$i/Makefile
929   done
930 fi
931
932 # Produce a warning message for the subdirs we can't configure.
933 # This isn't especially interesting in the Cygnus tree, but in the individual
934 # FSF releases, it's important to let people know when their machine isn't
935 # supported by the one or two programs in a package.
936
937 if [ -n "${notsupp}" ] && [ -z "${norecursion}" ]; then
938   # If $appdirs is non-empty, at least one of those directories must still
939   # be configured, or we error out.  (E.g., if the gas release supports a
940   # specified target in some subdirs but not the gas subdir, we shouldn't
941   # pretend that all is well.)
942   if [ -n "$appdirs" ]; then
943     for dir in $appdirs ; do
944       if [ -r $dir/Makefile.in ]; then
945         if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
946           appdirs=""
947           break
948         fi
949         if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
950           appdirs=""
951           break
952         fi
953       fi
954     done
955     if [ -n "$appdirs" ]; then
956       echo "*** This configuration is not supported by this package." 1>&2
957       exit 1
958     fi
959   fi
960   # Okay, some application will build, or we don't care to check.  Still
961   # notify of subdirs not getting built.
962   echo "*** This configuration is not supported in the following subdirectories:" 1>&2
963   echo "    ${notsupp}" 1>&2
964   echo "    (Any other directories should still work fine.)" 1>&2
965 fi
966
967 # Set with_gnu_as and with_gnu_ld as appropriate.
968 #
969 # This is done by determining whether or not the appropriate directory
970 # is available, and by checking whether or not specific configurations
971 # have requested that this magic not happen.
972
973 # The command line options always override the explicit settings in 
974 # configure.in, and the settings in configure.in override this magic.
975 #
976 # If the default for a toolchain is to use GNU as and ld, and you don't 
977 # want to do that, then you should use the --without-gnu-as and
978 # --without-gnu-ld options for the configure script.
979
980 if [ x${use_gnu_as} = x ] ; then
981   if [ x${with_gnu_as} != xno ] && echo " ${configdirs} " | grep " ${gasdir} " > /dev/null 2>&1 && [ -d ${srcdir}/${gasdir} ] ; then
982     with_gnu_as=yes
983     withoptions="$withoptions --with-gnu-as"
984   fi
985 fi
986
987 if [ x${use_gnu_ld} = x ] ; then
988   if [ x${with_gnu_ld} != xno ] && echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 && [ -d ${srcdir}/ld ] ; then
989     with_gnu_ld=yes
990     withoptions="$withoptions --with-gnu-ld"
991   fi
992 fi
993
994 # If using newlib, add --with-newlib to the withoptions so that gcc/configure
995 # can detect this case.
996
997 if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
998   with_newlib=yes
999   withoptions="$withoptions --with-newlib"
1000 fi
1001
1002 if [ x${shared} = xyes ]; then
1003   case "${target}" in
1004     hppa*)
1005       target_makefile_frag="${target_makefile_frag} config/mt-papic"
1006       ;;
1007     i[3456]86-*)
1008       target_makefile_frag="${target_makefile_frag} config/mt-x86pic"
1009       ;;
1010     powerpc*-*)
1011       target_makefile_frag="${target_makefile_frag} config/mt-ppcpic"
1012       ;;
1013     alpha*-*-linux*)
1014       target_makefile_frag="${target_makefile_frag} config/mt-elfalphapic"
1015       ;;
1016     *)
1017       if test -f ${srcdir}/config/mt-${target_cpu}pic; then
1018         target_makefile_frag="${target_makefile_frag} config/mt-${target_cpu}pic"
1019       fi
1020       ;;
1021   esac
1022 fi
1023
1024 rm -f mt-frag
1025 if [ -n "${target_makefile_frag}" ] ; then
1026   for f in ${target_makefile_frag}
1027   do
1028     cat ${srcdir}/$f >> mt-frag
1029   done
1030   target_makefile_frag=mt-frag
1031 fi
1032
1033 # post-target:
1034
1035 # Make sure that the compiler is able to generate an executable.  If it
1036 # can't, we are probably in trouble.  We don't care whether we can run the
1037 # executable--we might be using a cross compiler--we only care whether it
1038 # can be created.  At this point the main configure script has set CC.
1039 echo "int main () { return 0; }" > conftest.c
1040 ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
1041 if [ $? = 0 ] && [ -s conftest -o -s conftest.exe ]; then
1042   :
1043 else
1044   echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
1045   echo 1>&2 "*** You must set the environment variable CC to a working compiler."
1046   rm -f conftest*
1047   exit 1
1048 fi
1049 rm -f conftest*
1050
1051 # The Solaris /usr/ucb/cc compiler does not appear to work.
1052 case "${host}" in
1053   sparc-sun-solaris2*)
1054       CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
1055       if [ "`/usr/bin/which $CCBASE`" = "/usr/ucb/cc" ] ; then
1056           could_use=
1057           [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
1058           if [ -d /opt/cygnus/bin ] ; then
1059               if [ "$could_use" = "" ] ; then
1060                   could_use="/opt/cygnus/bin"
1061               else
1062                   could_use="$could_use or /opt/cygnus/bin"
1063               fi
1064           fi
1065         if [ "$could_use" = "" ] ; then
1066             echo "Warning: compilation may fail because you're using"
1067             echo "/usr/ucb/cc.  You should change your PATH or CC "
1068             echo "variable and rerun configure."
1069         else
1070             echo "Warning: compilation may fail because you're using"
1071             echo "/usr/ucb/cc, when you should use the C compiler from"
1072             echo "$could_use.  You should change your"
1073             echo "PATH or CC variable and rerun configure."
1074         fi
1075       fi
1076   ;;
1077 esac
1078
1079 # If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
1080 # binutils tools will find libbfd.so.
1081 if [ "${shared}" = "yes" ]; then
1082   sed -e 's/^SET_LIB_PATH[      ]*=.*$/SET_LIB_PATH = $(REALLY_SET_LIB_PATH)/' \
1083       Makefile > Makefile.tem
1084   rm -f Makefile
1085   mv -f Makefile.tem Makefile
1086
1087   case "${host}" in
1088   *-*-hpux*)
1089     sed -e 's/^RPATH_ENVVAR[    ]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
1090         Makefile > Makefile.tem
1091     rm -f Makefile
1092     mv -f Makefile.tem Makefile
1093     ;;
1094   esac
1095 fi
1096
1097 # Record target_configdirs and the configure arguments in Makefile.
1098 target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
1099 targargs=`echo "${arguments}" | \
1100         sed -e 's/--no[^        ]*//' \
1101             -e 's/--cache[a-z-]*=[^     ]*//' \
1102             -e 's/--ho[a-z-]*=[^        ]*//' \
1103             -e 's/--bu[a-z-]*=[^        ]*//' \
1104             -e 's/--ta[a-z-]*=[^        ]*//'`
1105
1106 # Passing a --with-cross-host argument lets the target libraries know
1107 # whether they are being built with a cross-compiler or being built
1108 # native.  However, it would be better to use other mechanisms to make the
1109 # sorts of decisions they want to make on this basis.  Please consider
1110 # this option to be deprecated.  FIXME.
1111 if [ x${is_cross_compiler} = xyes ]; then
1112   targargs="--with-cross-host=${host_alias} ${targargs}"
1113 fi
1114
1115 # Default to --enable-multilib.
1116 if [ x${enable_multilib} = x ]; then
1117   targargs="--enable-multilib ${targargs}"
1118 fi
1119
1120 # Pass --with-newlib if appropriate.  Note that target_configdirs has
1121 # changed from the earlier setting of with_newlib.
1122 if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
1123   targargs="--with-newlib ${targargs}"
1124 fi
1125
1126 targargs="--host=${target_alias} --build=${build_alias} ${targargs}"
1127 sed -e "s:^TARGET_CONFIGDIRS[   ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
1128     -e "s%^CONFIG_ARGUMENTS[    ]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
1129     -e "s%^TARGET_SUBDIR[       ]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
1130        Makefile > Makefile.tem
1131 rm -f Makefile
1132 mv -f Makefile.tem Makefile
1133
1134 #
1135 # Local Variables:
1136 # fill-column: 131
1137 # End:
1138 #