OSDN Git Service

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