OSDN Git Service

* fixinc/inclhack.def (solaris_widec): Include <wchar.h> in
[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, 1993, 1994, 1995, 1996, 1997, 1998,
18 #   1999, 2000, 2001, 2002 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 zlib"
46
47 if [ "${enable_gdbgui}" = "yes" ] ; then
48         host_libs="${host_libs} libgui"
49 fi
50
51 libstdcxx_version="target-libstdc++-v3"
52 # Don't use libstdc++-v3's flags to configure/build itself.
53 libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *) test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
54
55 # these tools are built for the host environment
56 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
57 # know that we are building the simulator.
58 host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip fastjar"
59
60 # libgcj represents the runtime libraries only used by gcj.
61 libgcj="target-libffi \
62         target-boehm-gc \
63         target-zlib \
64         target-qthreads \
65         target-libjava"
66
67 # these libraries are built for the target environment, and are built after
68 # the host libraries and the host tools (which may be a cross compiler)
69 #
70 target_libs="target-libiberty \
71                 target-libgloss \
72                 target-newlib \
73                 target-librx \
74                 ${libstdcxx_version} \
75                 target-libf2c \
76                 ${libgcj}
77                 target-libobjc"
78
79 # these tools are built using the target libs, and are intended to run only
80 # in the target environment
81 #
82 # note: any program that *uses* libraries that are in the "target_libs"
83 # list belongs in this list.  those programs are also very likely
84 # candidates for the "native_only" list which follows
85 #
86 target_tools="target-examples target-groff target-gperf"
87
88 ################################################################################
89
90 ## These two lists are of directories that are to be removed from the
91 ## ${configdirs} list for either cross-compilations or for native-
92 ## compilations.  For example, it doesn't make that much sense to
93 ## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
94 ## a native environment.  
95
96 # directories to be built in the native environment only
97 #
98 # This must be a single line because of the way it is searched by grep in
99 # the code below.
100 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"
101
102 # directories to be built in a cross environment only
103 #
104 cross_only="target-libgloss target-newlib target-cygmon target-opcodes target-libstub"
105
106 ## All tools belong in one of the four categories, and are assigned above
107 ## We assign ${configdirs} this way to remove all embedded newlines.  This
108 ## is important because configure will choke if they ever get through.
109 ## ${configdirs} is directories we build using the host tools.
110 ## ${target_configdirs} is directories we build using the target tools.
111 #
112 configdirs=`echo ${host_libs} ${host_tools}`
113 target_configdirs=`echo ${target_libs} ${target_tools}`
114
115 ################################################################################
116
117 srctrigger=move-if-change
118 srcname="gnu development package"
119
120 # This gets set non-empty for some net releases of packages.
121 appdirs=""
122
123 # per-host:
124
125 # Work in distributions that contain no compiler tools, like Autoconf.
126 tentative_cc=""
127 if [ -d ${srcdir}/config ]; then
128 case "${host}" in
129   m68k-hp-hpux*)
130     # Avoid "too much defining" errors from HPUX compiler.
131     tentative_cc="cc -Wp,-H256000"
132     host_makefile_frag="${host_makefile_frag} config/mh-hp300"
133     ;;
134   m68k-apollo-sysv*)
135     tentative_cc="cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG"
136     host_makefile_frag="${host_makefile_frag} config/mh-apollo68"
137     ;;
138   m68k-apollo-bsd*)
139     #None of the Apollo compilers can compile gas or binutils.  The preprocessor
140     # chokes on bfd, the compiler won't let you assign integers to enums, and
141     # other problems.  Defining CC to gcc is a questionable way to say "don't use
142     # the apollo compiler" (the preferred version of GCC could be called cc,
143     # or whatever), but I'm not sure leaving CC as cc is any better...
144     #CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG
145     tentative_cc=gcc
146     host_makefile_frag="${host_makefile_frag} config/mh-a68bsd"
147     ;;
148   m88k-dg-dgux*)
149     tentative_cc="gcc -Wall -ansi -D__using_DGUX"
150     host_makefile_frag="${host_makefile_frag} config/mh-dgux"
151     ;;
152   m88k-harris-cxux*)
153     # Under CX/UX, we want to tell the compiler to use ANSI mode.
154     tentative_cc="cc -Xa"
155     host_makefile_frag="${host_makefile_frag} config/mh-cxux"
156     ;;
157   m88k-motorola-sysv*)
158     host_makefile_frag="${host_makefile_frag} config/mh-delta88"
159     ;;
160   mips*-dec-ultrix*)
161     tentative_cc="cc -Wf,-XNg1000"
162     host_makefile_frag="${host_makefile_frag} config/mh-decstation"
163     ;;
164   mips*-nec-sysv4*)
165     # The C compiler on NEC MIPS SVR4 needs bigger tables.
166     tentative_cc="cc -ZXNd=5000 -ZXNg=1000"
167     host_makefile_frag="${host_makefile_frag} config/mh-necv4"
168     ;;
169   mips*-sgi-irix6*)
170     host_makefile_frag="${host_makefile_frag} config/mh-irix6"
171     ;;
172   mips*-sgi-irix5*)
173     host_makefile_frag="${host_makefile_frag} config/mh-irix5"
174     ;;
175   mips*-sgi-irix4*)
176     # Tell compiler to use K&R C.  We can't compile under the SGI Ansi
177     # environment.  Also bump switch table size so that cp-parse will
178     # compile.  Bump string length limit so linker builds.
179     tentative_cc="cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192"
180     host_makefile_frag="${host_makefile_frag} config/mh-irix4"
181     ;;
182   mips*-sgi-irix3*)
183     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
184     ;;
185   mips*-*-sysv4*)
186     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
187     ;;
188   mips*-*-sysv*)
189     # This is for a MIPS running RISC/os 4.52C.
190
191     # This is needed for GDB, but needs to be in the top-level make because
192     # if a library is compiled with the bsd headers and gets linked with the
193     # sysv system libraries all hell can break loose (e.g. a jmp_buf might be
194     # a different size).
195     # ptrace(2) apparently has problems in the BSD environment.  No workaround is
196     # known except to select the sysv environment.  Could we use /proc instead?
197     # These "sysv environments" and "bsd environments" often end up being a pain.
198     #
199     # This is not part of CFLAGS because perhaps not all C compilers have this
200     # option.
201     tentative_cc="cc -systype sysv"
202     host_makefile_frag="${host_makefile_frag} config/mh-riscos"
203     ;;
204   i370-ibm-opened*)
205     tentative_cc="c89"
206     host_makefile_frag="${host_makefile_frag} config/mh-openedition"
207     ;;
208   i[3456]86-*-sysv5*)
209     host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
210     ;;
211   i[3456]86-*-dgux*)
212     tentative_cc="gcc -Wall -ansi -D__using_DGUX"
213     host_makefile_frag="${host_makefile_frag} config/mh-dgux386"
214     ;;
215   i[3456]86-ncr-sysv4.3*)
216     # The MetaWare compiler will generate a copyright message unless you
217     # turn it off by adding the -Hnocopyr flag.
218     tentative_cc="cc -Hnocopyr"
219     host_makefile_frag="${host_makefile_frag} config/mh-ncrsvr43"
220     ;;
221   i[3456]86-ncr-sysv4*)
222     # for an NCR 3000 (i486/SVR4) system.
223     # The NCR 3000 ships with a MetaWare compiler installed as /bin/cc.
224     # This compiler not only emits obnoxious copyright messages every time
225     # you run it, but it chokes and dies on a whole bunch of GNU source
226     # files.  Default to using the AT&T compiler installed in /usr/ccs/ATT/cc.
227     tentative_cc="/usr/ccs/ATT/cc"
228     host_makefile_frag="${host_makefile_frag} config/mh-ncr3000"
229     ;;
230   i[3456]86-*-sco3.2v5*)
231     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
232     ;;
233   i[3456]86-*-sco*)
234     # The native C compiler botches some simple uses of const.  Unfortunately,
235     # it doesn't defined anything like "__sco__" for us to test for in ansidecl.h.
236     tentative_cc="cc -Dconst="
237     host_makefile_frag="${host_makefile_frag} config/mh-sco"
238     ;;
239   i[3456]86-*-udk*)
240     host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
241     ;;
242   i[3456]86-*-isc*)
243     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
244     ;;
245   i[3456]86-*-solaris2*)
246     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
247     ;;
248   i[3456]86-*-aix*)
249     host_makefile_frag="${host_makefile_frag} config/mh-aix386"
250     ;;
251   i[3456]86-*-msdosdjgpp*)
252     host_makefile_frag="${host_makefile_frag} config/mh-djgpp"
253     ;;
254   *-cygwin*)
255     host_makefile_frag="${host_makefile_frag} config/mh-cygwin"
256     ;;
257   *-mingw32*)
258     host_makefile_frag="${host_makefile_frag} config/mh-mingw32"
259     ;;
260   *-interix*)
261     host_makefile_frag="${host_makefile_frag} config/mh-interix"
262     ;;
263   *-windows*)
264     host_makefile_frag="${host_makefile_frag} config/mh-windows"
265     ;;
266   vax-*-ultrix2*)
267     # The old BSD pcc isn't up to compiling parts of gdb so use gcc
268     tentative_cc=gcc
269     ;;
270   *-*-solaris2*)
271     host_makefile_frag="${host_makefile_frag} config/mh-solaris"
272     ;;
273   m68k-sun-sunos*)
274     # Sun's C compiler needs the -J flag to be able to compile cp-parse.c
275     # without overflowing the jump tables (-J says to use a 32 bit table)
276     tentative_cc="cc -J"
277     ;;
278   *-hp-hpux[78]*)
279     tentative_cc="cc -Wp,-H256000"
280     host_makefile_frag="${host_makefile_frag} config/mh-hpux8"
281     ;;
282   *-hp-hpux*)
283     tentative_cc="cc -Wp,-H256000"
284     host_makefile_frag="${host_makefile_frag} config/mh-hpux"
285     ;;
286   *-*-hiux*)
287     tentative_cc="cc -Wp,-H256000"
288     host_makefile_frag="${host_makefile_frag} config/mh-hpux"
289     ;;
290   rs6000-*-lynxos*)
291     # /bin/cc is less than useful for our purposes.  Always use GCC
292     tentative_cc="/usr/cygnus/progressive/bin/gcc"
293     host_makefile_frag="${host_makefile_frag} config/mh-lynxrs6k"
294     ;;
295   *-*-lynxos*)
296     # /bin/cc is less than useful for our purposes.  Always use GCC
297     tentative_cc="/bin/gcc"
298     ;;
299   *-*-sysv4*)
300     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
301     ;;
302   *-*-sysv*)
303     host_makefile_frag="${host_makefile_frag} config/mh-sysv"
304     ;;
305 esac
306 fi
307
308 # If we aren't going to be using gcc, see if we can extract a definition
309 # of CC from the fragment.
310 # Actually, use the 'pre-extracted' version above.
311 if [ -z "${CC}" ] && [ "${build}" = "${host}" ]; then
312   IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
313   found=
314   for dir in $PATH; do
315     test -z "$dir" && dir=.
316     if test -f $dir/gcc; then
317       found=yes
318       break
319     fi
320   done
321   IFS="$save_ifs"
322   if [ -z "${found}" ] && [ -n "${tentative_cc}" ] ; then
323     CC=$tentative_cc
324   fi
325 fi
326
327 # We default to --with-shared on platforms where -fpic is meaningless.
328 # Well, we don't yet, but we will.
329 if false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
330   case "${target}" in
331     alpha*-dec-osf*)    enable_shared=yes ;;
332     alpha*-*-linux*)    enable_shared=yes ;;
333     mips-sgi-irix5*)    enable_shared=yes ;;
334     *)                  enable_shared=no ;;
335   esac
336 fi
337
338 # hpux11 in 64bit mode has libraries in a weird place.  Arrange to find
339 # them automatically.
340 case "${host}" in
341   hppa*64*-*-hpux11*)   
342     withoptions="$withoptions -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include"
343     ;;
344 esac
345
346 case "${enable_shared}" in
347   yes) shared=yes ;;
348   no) shared=no ;;
349   "") shared=no ;;
350   *) shared=yes ;;
351 esac
352
353 if [ x${shared} = xyes ]; then
354   case "${host}" in
355     alpha*-*-linux*)
356       host_makefile_frag="${host_makefile_frag} config/mh-elfalphapic"
357       ;;
358     arm*-*-*)
359       host_makefile_frag="${host_makefile_frag} config/mh-armpic"
360       ;;
361     parisc*-*-* | hppa*-*-*)
362       host_makefile_frag="${host_makefile_frag} config/mh-papic"
363       ;;
364     i[3456]86-*-cygwin*)
365       # We don't want -fPIC on Cygwin.
366       ;;
367     i[3456]86-*-*)
368       host_makefile_frag="${host_makefile_frag} config/mh-x86pic"
369       ;;
370     i370-*-*)
371       host_makefile_frag="${host_makefile_frag} config/mh-i370pic"
372       ;;
373     ia64-*-*)
374       host_makefile_frag="${host_makefile_frag} config/mh-ia64pic"
375       ;;
376     sparc64-*-*)
377       host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
378       ;;
379     powerpc*-*-aix*)
380       # We don't want -fPIC on AIX.
381       ;;
382     powerpc*-*-*)
383       host_makefile_frag="${host_makefile_frag} config/mh-ppcpic"
384       ;;
385     s390-* | s390x-*)
386       host_makefile_frag="${host_makefile_frag} config/mh-s390pic"
387       ;;
388     *-*-*)
389       if test -f ${srcdir}/config/mh-${host_cpu}pic; then
390         host_makefile_frag="${host_makefile_frag} config/mh-${host_cpu}pic"
391       fi
392       ;;
393   esac
394 fi
395
396 rm -f mh-frag
397 if [ -n "${host_makefile_frag}" ] ; then
398   for f in ${host_makefile_frag}
399   do
400     cat ${srcdir}/$f >> mh-frag
401   done
402   host_makefile_frag=mh-frag
403 fi
404
405 # per-target:
406
407 case "${target}" in
408   v810*)
409     target_makefile_frag="${target_makefile_frag} config/mt-v810"
410     ;;
411   i[3456]86-*-netware*)
412     target_makefile_frag="${target_makefile_frag} config/mt-netware"
413     ;;
414   powerpc-*-netware*)
415     target_makefile_frag="${target_makefile_frag} config/mt-netware"
416     ;;
417   alpha*-*-linux*)
418     target_makefile_frag="${target_makefile_frag} config/mt-linux"
419     target_makefile_frag="${target_makefile_frag} config/mt-alphaieee"
420     ;;
421   alpha*-*-*)
422     target_makefile_frag="${target_makefile_frag} config/mt-alphaieee"
423     ;;
424   *-*-linux*)
425     target_makefile_frag="${target_makefile_frag} config/mt-linux"
426     ;;
427   *-*-aix4.[3456789]* | *-*-aix[56789].*)
428     target_makefile_frag="${target_makefile_frag} config/mt-aix43"
429     ;;
430   mips*-*-pe | sh*-*-pe | *arm-wince-pe)
431     target_makefile_frag="${target_makefile_frag} config/mt-wince"
432     ;;
433 esac
434
435 # If --enable-target-optspace always use -Os instead of -O2 to build
436 # the target libraries, similarly if it is not specified, use -Os
437 # on selected platforms.
438 case "${enable_target_optspace}:${target}" in
439   yes:*)
440     target_makefile_frag="${target_makefile_frag} config/mt-ospace"
441     ;;
442   :d30v-*)
443     target_makefile_frag="${target_makefile_frag} config/mt-d30v"
444     ;;
445   :m32r-* | :d10v-* | :fr30-*)
446     target_makefile_frag="${target_makefile_frag} config/mt-ospace"
447     ;;
448   no:* | :*)
449     ;;
450   *)
451     echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
452     ;;
453 esac
454
455 skipdirs=
456 gasdir=gas
457 use_gnu_ld=
458 use_gnu_as=
459
460 # some tools are so dependent upon X11 that if we're not building with X, 
461 # it's not even worth trying to configure, much less build, that tool.
462
463 case ${with_x} in
464   yes | "")  # the default value for this tree is that X11 is available
465         ;;
466   no)
467         skipdirs="${skipdirs} tk libgui gash"
468         ;;
469   *)
470         echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2
471         ;;
472 esac
473
474 # Some tools are only suitable for building in a "native" situation.
475 # Those are added when we have a host==target configuration.  For cross
476 # toolchains, we add some directories that should only be useful in a
477 # cross-compiler.
478
479 is_cross_compiler=
480
481 if [ x"${host}" = x"${target}" ] ; then
482         # when doing a native toolchain, don't build the targets
483         # that are in the 'cross only' list
484         skipdirs="${skipdirs} ${cross_only}"
485         is_cross_compiler=no
486 else
487         # similarly, don't build the targets in the 'native only' 
488         # list when building a cross compiler
489         skipdirs="${skipdirs} ${native_only}"
490         is_cross_compiler=yes
491 fi      
492
493 # We always want to use the same name for this directory, so that dejagnu
494 # can reliably find it.
495 target_subdir=${target_alias}
496
497 if [ ! -d ${target_subdir} ] ; then
498   if mkdir ${target_subdir} ; then true
499   else
500     echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
501     exit 1
502   fi
503 fi
504
505 build_subdir=${build_alias}
506
507 if [ x"${build_alias}" != x"${host}" ] ; then
508   if [ ! -d ${build_subdir} ] ; then
509     if mkdir ${build_subdir} ; then true
510     else
511       echo "'*** could not make ${PWD=`pwd`}/${build_subdir}" 1>&2
512       exit 1
513     fi
514   fi
515 fi
516
517 copy_dirs=
518
519 # Handle --with-headers=XXX.  The contents of the named directory are
520 # copied to $(tooldir)/sys-include.
521 if [ x"${with_headers}" != x ]; then
522   if [ x${is_cross_compiler} = xno ]; then
523     echo 1>&2 '***' --with-headers is only supported when cross compiling
524     exit 1
525   fi
526   case "${exec_prefixoption}" in
527   "") x=${prefix} ;;
528   *) x=${exec_prefix} ;;
529   esac
530   copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
531 fi
532
533 # Handle --with-libs=XXX.  Multiple directories are permitted.  The
534 # contents are copied to $(tooldir)/lib.
535 if [ x"${with_libs}" != x ]; then
536   if [ x${is_cross_compiler} = xno ]; then
537     echo 1>&2 '***' --with-libs is only supported when cross compiling
538     exit 1
539   fi
540   # Copy the libraries in reverse order, so that files in the first named
541   # library override files in subsequent libraries.
542   case "${exec_prefixoption}" in
543   "") x=${prefix} ;;
544   *) x=${exec_prefix} ;;
545   esac
546   for l in ${with_libs}; do
547     copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
548   done
549 fi
550
551 # If both --with-headers and --with-libs are specified, default to
552 # --without-newlib.
553 if [ x"${with_headers}" != x ] && [ x"${with_libs}" != x ]; then
554   if [ x"${with_newlib}" = x ]; then
555     with_newlib=no
556   fi
557 fi
558
559 # Recognize --with-newlib/--without-newlib.
560 if [ x${with_newlib} = xno ]; then
561   skipdirs="${skipdirs} target-newlib"
562 elif [ x${with_newlib} = xyes ]; then
563   skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
564 fi
565
566 # Default to using --with-stabs for certain targets.
567 if [ x${with_stabs} = x ]; then
568   case "${target}" in
569   mips*-*-irix6*)
570     ;;
571   mips*-*-* | alpha*-*-osf*)
572     with_stabs=yes;
573     withoptions="${withoptions} --with-stabs"
574     ;;
575   esac
576 fi
577
578 # Handle ${copy_dirs}
579 set fnord ${copy_dirs}
580 shift
581 while [ $# != 0 ]; do
582   if [ -f $2/COPIED ] && [ x"`cat $2/COPIED`" = x"$1" ]; then
583     :
584   else
585     echo Copying $1 to $2
586
587     # Use the install script to create the directory and all required
588     # parent directories.
589     if [ -d $2 ]; then
590       :
591     else
592       echo >config.temp
593       ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
594     fi
595
596     # Copy the directory, assuming we have tar.
597     # FIXME: Should we use B in the second tar?  Not all systems support it.
598     (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
599
600     # It is the responsibility of the user to correctly adjust all
601     # symlinks.  If somebody can figure out how to handle them correctly
602     # here, feel free to add the code.
603
604     echo $1 > $2/COPIED
605   fi
606   shift; shift
607 done
608
609 # Configure extra directories which are host specific
610
611 case "${host}" in
612         i[3456]86-*-go32*)
613           configdirs="$configdirs dosrel" ;;
614         i[3456]86-*-mingw32*)
615           configdirs="$configdirs dosrel" ;;
616         *-cygwin*)
617           configdirs="$configdirs libtermcap dosrel" ;;
618 esac
619
620 # Remove more programs from consideration, based on the host or 
621 # target this usually means that a port of the program doesn't
622 # exist yet.
623
624 noconfigdirs=""
625
626 case "${host}" in
627   hppa*64*-*-*)
628     noconfigdirs="$noconfigdirs byacc"
629     ;;
630   i[3456]86-*-vsta)
631     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"
632     ;;
633   i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
634     noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile apache inet itcl tix db snavigator gnuserv libffi"
635         ;;
636   i[3456]86-*-mingw32*)
637     # 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"
638      noconfigdirs="expect dejagnu cvs autoconf automake send-pr rcs guile perl texinfo apache inet libtool"
639         ;;
640   i[3456]86-*-beos*)
641      noconfigdirs="$noconfigdirs tk itcl tix libgui gdb"
642      ;;
643   *-*-cygwin*)
644      noconfigdirs="autoconf automake send-pr rcs guile perl apache inet"
645     ;;
646   *-*-netbsd*)
647     noconfigdirs="rcs"
648     ;;
649   ppc*-*-pe)
650      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"
651     ;;
652   powerpc-*-beos*)
653     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
654     ;;
655 esac
656
657 # Save it here so that, even in case of --enable-libgcj, if the Java
658 # front-end isn't enabled, we still get libgcj disabled.
659 libgcj_saved=$libgcj
660 case $enable_libgcj in
661 yes)
662   # If we reset it here, it won't get added to noconfigdirs in the
663   # target-specific build rules, so it will be forcibly enabled
664   # (unless the Java language itself isn't enabled).
665   libgcj=
666   ;;
667 no)
668   # Make sure we get it printed in the list of not supported target libs.
669   noconfigdirs="$noconfigdirs ${libgcj}"
670   ;;
671 esac
672
673 case "${target}" in
674   *-*-chorusos)
675     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
676     ;;
677   *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
678     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
679     ;;
680   *-*-netbsd*)
681     # Skip some stuff on all NetBSD configurations.
682     skipdirs="$skipdirs target-newlib target-libiberty target-libgloss"
683
684     # Skip some stuff that's unsupported on some NetBSD configurations.
685     case "${target}" in
686       i*86-*-netbsdelf*) ;;
687       *)
688         noconfigdirs="$noconfigdirs ${libgcj}"
689         ;;
690     esac
691     ;;
692   *-*-netware)
693     noconfigdirs="$noconfigdirs ${libstdcxx_version} target-librx target-newlib target-libiberty target-libgloss ${libgcj}"
694     ;;
695   *-*-rtems*)
696     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
697     case ${target} in
698         h8300*-*-* | h8500-*-*)
699           noconfigdirs="$noconfigdirs target-libf2c"
700           ;;
701         *) ;;
702     esac
703     ;;
704   *-*-vxworks*)
705     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
706     ;;
707   alpha*-dec-osf*)
708     # ld works, but does not support shared libraries.  emacs doesn't
709     # work.  newlib is not 64 bit ready.  I'm not sure about fileutils.
710     # gas doesn't generate exception information.
711     noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss"
712     ;;
713   alpha*-*-*vms*)
714     noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss ${libgcj}"
715     ;;
716   alpha*-*-linux*)
717     # newlib is not 64 bit ready
718     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
719     # linux has rx in libc
720     skipdirs="$skipdirs target-librx"
721     ;;
722   alpha*-*-freebsd*)
723     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
724     ;;
725   alpha*-*-*)
726     # newlib is not 64 bit ready
727     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
728     ;;
729   sh-*-linux*)
730     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
731     # linux has rx in libc
732     skipdirs="$skipdirs target-librx"
733     ;;    
734   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
735     noconfigdirs="$noconfigdirs ${libgcj}"
736     noconfigdirs="$noconfigdirs target-examples"
737     noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
738     noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim"
739     noconfigdirs="$noconfigdirs expect dejagnu"
740     # the C++ libraries don't build on top of CE's C libraries
741     noconfigdirs="$noconfigdirs ${libstdcxx_version}"
742     skipdirs="$skipdirs target-newlib"
743     case "${host}" in
744       *-*-cygwin*) ;; # keep gdb and readline
745       *) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}"
746          ;;
747     esac
748     ;;
749   arc-*-*)
750     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
751     ;;
752   arm-*-pe*)
753     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
754     ;;
755   arm-*-oabi*)
756     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
757     ;;
758   thumb-*-coff)
759     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
760     ;;
761   thumb-*-elf)
762     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
763     ;;
764   thumb-*-oabi)
765     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
766     ;;
767   strongarm-*-elf)
768     noconfigdirs="$noconfigdirs ${libgcj}"
769     ;;
770   strongarm-*-coff)
771     noconfigdirs="$noconfigdirs ${libgcj}"
772     ;;
773   xscale-*-elf)
774     noconfigdirs="$noconfigdirs target-libffi target-qthreads"
775     ;;
776   xscale-*-coff)
777     noconfigdirs="$noconfigdirs ${libgcj}"
778     ;;
779   thumb-*-pe)
780     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
781     ;;
782   arm-*-riscix*)
783     noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
784     ;;
785   c4x-*-*)
786     noconfigdirs="$noconfigdirs ${libstdcxx_version} target-librx target-libgloss ${libgcj}"
787     ;;
788   c54x*-*-* | tic54x-*-*)
789     noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss ${libgcj} gcc gdb newlib"
790     ;;
791   cris-*-*)
792     noconfigdirs="$noconfigdirs ${libgcj}"
793     ;;
794   d10v-*-*)
795     noconfigdirs="$noconfigdirs target-librx ${libstdcxx_version} target-libgloss ${libgcj}"
796     ;;
797   d30v-*-*)
798     noconfigdirs="$noconfigdirs ${libgcj}"
799     ;;
800   fr30-*-elf*)
801     noconfigdirs="$noconfigdirs ${libgcj}"
802     if [ x${is_cross_compiler} != xno ] ; then
803            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
804     fi
805     ;;
806   h8300*-*-*)
807     noconfigdirs="$noconfigdirs target-libgloss"
808     ;;
809   h8500-*-*)
810     noconfigdirs="$noconfigdirs ${libstdcxx_version} target-librx target-libgloss ${libgcj} target-libf2c"
811     ;;
812   hppa*64*-*-linux* | parisc*64*-*-linux*)
813     # In this case, it's because the hppa64-linux target is for
814     # the kernel only at this point and has no libc, and thus no
815     # headers, crt*.o, etc., all of which are needed by these.
816     noconfigdirs="$noconfigdirs target-zlib"
817     ;;
818   hppa*-*-*elf* | \
819   parisc*-*-linux* | hppa*-*-linux* | \
820   hppa*-*-lites* | \
821   hppa*64*-*-*)
822     noconfigdirs="$noconfigdirs ${libgcj}"
823     # Do configure ld/binutils/gas for this case.
824     ;;
825   hppa*-*-*)
826     # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
827     # cc is gcc, and on any system a user should be able to link cc to
828     # whatever they want.  FIXME, emacs emacs19).
829     case "${CC}" in
830         "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
831         *) ;;
832     esac
833     # According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
834     # build on HP-UX 10.20.
835     noconfigdirs="$noconfigdirs ld shellutils ${libgcj}"
836     ;;
837   ia64*-*-elf*)
838     # No gdb support yet.
839     noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
840     ;;
841   ia64*-**-hpux*)
842     # No gdb or ld support yet.
843     noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb ld"
844     ;;
845   i[3456]86-*-coff | i[3456]86-*-elf)
846     noconfigdirs="$noconfigdirs ${libgcj}"
847     if [ x${is_cross_compiler} != xno ] ; then
848          target_configdirs="${target_configdirs} target-libstub target-cygmon"
849     fi
850     ;;
851   i[34567]86-*-freebsd*)
852     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
853     ;;
854   s390*-*-linux*)
855     # The libffi port is not yet in the GCC tree
856     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
857     # linux has rx in libc
858     skipdirs="$skipdirs target-librx"
859     ;;
860   *-*-linux*)
861     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
862     # linux has rx in libc
863     skipdirs="$skipdirs target-librx"
864     ;;
865   i[3456]86-*-mingw32*)
866     target_configdirs="$target_configdirs target-mingw"
867     noconfigdirs="$noconfigdirs expect target-libgloss ${libgcj}"
868
869     # Can't build gdb for mingw32 if not native.
870     case "${host}" in
871       i[3456]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
872       *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
873          ;;
874     esac
875     ;;    
876   *-*-cygwin*)
877     target_configdirs="$target_configdirs target-libtermcap target-winsup"
878     noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
879     # always build newlib.
880     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
881
882     # Can't build gdb for Cygwin if not native.
883     case "${host}" in
884       *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
885       *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
886          ;;
887     esac
888     ;;    
889   i[3456]86-*-pe)
890     noconfigdirs="$noconfigdirs ${libstdcxx_version} target-librx target-libgloss ${libgcj}"
891     ;;
892   i[3456]86-*-sco3.2v5*)
893     # The linker does not yet know about weak symbols in COFF,
894     # and is not configured to handle mixed ELF and COFF.
895     noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
896     ;;
897   i[3456]86-*-sco*)
898     noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
899     ;;
900   i[3456]86-*-solaris2*)
901     noconfigdirs="$noconfigdirs target-libgloss"
902     ;;
903   i[3456]86-*-sysv4*)
904     # The SYSV4 C compiler doesn't handle Emacs correctly
905     case "${CC}" in
906         "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
907         *) ;;
908     esac
909     # but that's okay since emacs doesn't work anyway
910     noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss ${libgcj}"
911     ;;
912   i[3456]86-*-beos*)
913      noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
914      ;;
915   m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
916     noconfigdirs="$noconfigdirs target-libiberty ${libstdcxx_version} ${libgcj}"
917     ;;
918   m68k-*-elf*)
919     noconfigdirs="$noconfigdirs ${libgcj}"
920     if [ x${is_cross_compiler} != xno ] ; then
921            target_configdirs="${target_configdirs} target-bsp target-cygmon"
922     fi
923     ;;
924   m68k-*-coff*)
925     noconfigdirs="$noconfigdirs ${libgcj}"
926     if [ x${is_cross_compiler} != xno ] ; then
927            target_configdirs="${target_configdirs} target-bsp target-cygmon"
928     fi
929     ;;
930   mcore-*-pe*)
931   # The EPOC C++ environment does not support exceptions or rtti,
932   # and so building libstdc++-v3 tends not to always work.
933     noconfigdirs="$noconfigdirs target-libstdc++-v3"
934     ;;
935   mmix-*-*)
936     noconfigdirs="$noconfigdirs ${libgcj}"
937     ;;
938   mn10200-*-*)
939     noconfigdirs="$noconfigdirs ${libgcj}"
940     if [ x${is_cross_compiler} != xno ] ; then
941            target_configdirs="${target_configdirs} target-libstub target-cygmon"
942     fi
943     ;;
944   mn10300-*-*)
945     noconfigdirs="$noconfigdirs ${libgcj}"
946     if [ x${is_cross_compiler} != xno ] ; then
947            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
948     fi
949     ;;
950   powerpc-*-aix*)
951     # copied from rs6000-*-* entry
952     noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss ${libgcj}"
953     use_gnu_ld=yes
954     ;;
955   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
956     target_configdirs="$target_configdirs target-winsup"
957     noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv ${libgcj}"
958     # always build newlib.
959     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
960     ;;
961     # This is temporary until we can link against shared libraries
962   powerpcle-*-solaris*)
963     noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv ${libgcj}"
964     ;;
965   powerpc-*-beos*)
966     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
967     ;;
968   powerpc-*-eabi)
969     noconfigdirs="$noconfigdirs ${libgcj}"
970     if [ x${is_cross_compiler} != xno ] ; then
971            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
972     fi
973     ;;
974   rs6000-*-lynxos*)
975     # The CVS server code doesn't work on the RS/6000
976     noconfigdirs="$noconfigdirs target-newlib gprof cvssrc ${libgcj}"
977     ;;
978   rs6000-*-aix*)
979     noconfigdirs="$noconfigdirs gprof ${libgcj}"
980     use_gnu_ld=yes
981     ;;
982   rs6000-*-*)
983     noconfigdirs="$noconfigdirs gprof ${libgcj}"
984     ;;
985   m68k-apollo-*)
986     noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
987     ;;
988   mips*-*-irix5*)
989     # The GNU linker does not support shared libraries.
990     # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
991     noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss ${libgcj}"
992     ;;
993   mips*-*-irix6*)
994     # The GNU assembler does not support IRIX 6.
995     # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
996     # Linking libjava exceeds command-line length limits on at least
997     # IRIX 6.2, but not on IRIX 6.5.
998     # Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
999     # <oldham@codesourcery.com>
1000     noconfigdirs="$noconfigdirs gas gprof emacs target-libgloss ${libgcj}"
1001     ;;
1002   mips*-dec-bsd*)
1003     noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
1004     ;;
1005   mips*-*-bsd*)
1006     noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
1007     ;;
1008   mipstx39-*-*)
1009     noconfigdirs="$noconfigdirs gprof ${libgcj}"   # same as generic mips
1010     target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
1011    ;;
1012   mips*-*-linux*)
1013     noconfigdirs="$noconfigdirs target-libffi"
1014     ;;
1015   mips*-*-*)
1016     noconfigdirs="$noconfigdirs gprof ${libgcj}"
1017     ;;
1018   romp-*-*)
1019     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
1020     ;;
1021   sh-*-*)
1022     case "${host}" in
1023       i[3456]86-*-vsta) ;; # don't add gprof back in
1024       i[3456]86-*-go32*) ;; # don't add gprof back in
1025       i[3456]86-*-msdosdjgpp*) ;; # don't add gprof back in
1026       *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
1027     esac
1028     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
1029     ;;
1030   sh64-*-*)
1031     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
1032     ;;
1033   sparc-*-elf*)
1034     if [ x${is_cross_compiler} != xno ] ; then
1035            target_configdirs="${target_configdirs} target-libstub target-cygmon"
1036     fi
1037     noconfigdirs="$noconfigdirs ${libgcj}"
1038     ;;
1039   sparc64-*-elf*)
1040     if [ x${is_cross_compiler} != xno ] ; then
1041            target_configdirs="${target_configdirs} target-libstub target-cygmon"
1042     fi
1043     noconfigdirs="$noconfigdirs ${libgcj}"
1044     ;;
1045   sparclite-*-*)
1046     if [ x${is_cross_compiler} != xno ] ; then
1047            target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
1048     fi
1049     noconfigdirs="$noconfigdirs ${libgcj}"
1050     ;;
1051   sparc-*-sunos4*)
1052     noconfigdirs="$noconfigdirs ${libgcj}"
1053     if [ x${is_cross_compiler} != xno ] ; then
1054            noconfigdirs="$noconfigdirs gdb gdbtest target-newlib target-libgloss"
1055     else
1056            use_gnu_ld=no
1057     fi
1058     ;;
1059   sparc-*-solaris*)
1060     ;;
1061   v810-*-*)
1062     noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld ${libstdcxx_version} opcodes target-libgloss ${libgcj}"
1063     ;;
1064   v850-*-*)
1065     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
1066     ;;
1067   v850e-*-*)
1068     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
1069     ;;
1070   v850ea-*-*)
1071     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
1072     ;;
1073   vax-*-vms)
1074     noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss ${libgcj}"
1075     ;;
1076   vax-*-*)
1077     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
1078     ;;
1079   *-*-lynxos*)
1080     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
1081     ;; 
1082   *-*-macos* | \
1083   *-*-mpw*)
1084     # Macs want a resource compiler.
1085     configdirs="$configdirs grez"
1086     noconfigdirs="$noconfigdirs ${libgcj}"
1087     ;;    
1088   *-*-*)
1089     noconfigdirs="$noconfigdirs ${libgcj}"
1090     ;;
1091 esac
1092
1093 # If we aren't building newlib, then don't build libgloss, since libgloss
1094 # depends upon some newlib header files.
1095 case "${noconfigdirs}" in
1096   *target-libgloss*) ;;
1097   *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
1098 esac
1099
1100 # Make sure we don't let GNU ld be added if we didn't want it.
1101 if [ x$with_gnu_ld = xno ]; then
1102   use_gnu_ld=no
1103   noconfigdirs="$noconfigdirs ld"
1104 fi
1105
1106 # Make sure we don't let GNU as be added if we didn't want it.
1107 if [ x$with_gnu_as = xno ]; then
1108   use_gnu_as=no
1109   noconfigdirs="$noconfigdirs gas"
1110 fi
1111
1112 # Figure out what language subdirectories are present.
1113 # Look if the user specified --enable-languages="..."; if not, use
1114 # the environment variable $LANGUAGES if defined. $LANGUAGES might
1115 # go away some day.
1116 # NB:  embedded tabs in this IF block -- do not untabify
1117 if test x"${enable_languages+set}" != xset; then
1118         if test x"${LANGUAGES+set}" = xset; then
1119                 enable_languages="${LANGUAGES}"
1120                 echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
1121         else
1122                 enable_languages=all
1123         fi
1124 else
1125         if test x"${enable_languages}" = x ||
1126            test x"${enable_languages}" = xyes;
1127         then
1128                 echo configure.in: --enable-languages needs at least one language argument 1>&2
1129                 exit 1
1130         fi
1131 fi
1132 enable_languages=`echo "${enable_languages}" | sed -e 's/[      ,][     ,]*/,/g' -e 's/,$//'`
1133
1134 # First scan to see if an enabled language requires some other language.
1135 # We assume that a given config-lang.in will list all the language
1136 # front ends it requires, even if some are required indirectly.
1137 for lang in ${srcdir}/gcc/*/config-lang.in ..
1138 do
1139    case $lang in
1140     ..)
1141        ;;
1142     # The odd quoting in the next line works around
1143     # an apparent bug in bash 1.12 on linux.
1144     ${srcdir}/gcc/[*]/config-lang.in)
1145        ;;
1146     *)
1147        lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^      ]*\).*$,\1,p' $lang`
1148        this_lang_requires=`sed -n -e 's,^lang_requires=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_requires=\([^    ]*\).*$,\1,p' $lang`
1149        for other in $this_lang_requires
1150        do
1151           case ,${enable_languages}, in
1152            *,$other,*)
1153               ;;
1154            *,all,*)
1155               ;;
1156            *,$lang_alias,*)
1157               echo " \`$other' language required by \`$lang_alias'; enabling" 1>&2
1158               enable_languages="$enable_languages,$other"
1159               ;;
1160           esac
1161        done
1162        ;;
1163    esac
1164 done
1165
1166 subdirs=
1167 for lang in ${srcdir}/gcc/*/config-lang.in ..
1168 do
1169         case $lang in
1170         ..) ;;
1171         # The odd quoting in the next line works around
1172         # an apparent bug in bash 1.12 on linux.
1173         ${srcdir}/gcc/[*]/config-lang.in) ;;
1174         *)
1175           lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^   ]*\).*$,\1,p' $lang`
1176           this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^         ]*\).*$,\1,p' $lang`
1177           this_lang_dirs=`sed -n -e 's,^lang_dirs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_dirs=\([^     ]*\).*$,\1,p' $lang`
1178           build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^     ]*\).*$,\1,p' $lang`
1179           if test "x$lang_alias" = x
1180           then
1181                 echo "$lang doesn't set \$language." 1>&2
1182                 exit 1
1183           fi
1184           case ${build_by_default},${enable_languages}, in
1185           *,$lang_alias,*) add_this_lang=yes ;;
1186           no,*) add_this_lang=no ;;
1187           *,all,*) add_this_lang=yes ;;
1188           *) add_this_lang=no ;;
1189           esac
1190           if test x"${add_this_lang}" = xyes; then
1191               eval target_libs='"$target_libs "'\"$this_lang_libs\"
1192           else
1193               eval noconfigdirs='"$noconfigdirs "'\"$this_lang_libs $this_lang_dirs\"
1194           fi
1195           ;;
1196         esac
1197 done
1198
1199 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
1200 # $target_configdirs.
1201 # If we have the source for $noconfigdirs entries, add them to $notsupp.
1202
1203 notsupp=""
1204 for dir in . $skipdirs $noconfigdirs ; do
1205   dirname=`echo $dir | sed -e s/target-//g`
1206   if [ $dir != . ]  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1207     configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
1208     if [ -r $srcdir/$dirname/configure ] \
1209         || [ -r $srcdir/$dirname/configure.in ]; then
1210       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1211         true
1212       else
1213         notsupp="$notsupp $dir"
1214       fi
1215     fi
1216   fi
1217   if [ $dir != . ]  && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1218     target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
1219     if [ -r $srcdir/$dirname/configure ] \
1220         || [ -r $srcdir/$dirname/configure.in ]; then
1221       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1222         true
1223       else
1224         notsupp="$notsupp $dir"
1225       fi
1226     fi
1227   fi
1228 done
1229
1230 # Sometimes the tools are distributed with libiberty but with no other
1231 # libraries.  In that case, we don't want to build target-libiberty.
1232 if [ -n "${target_configdirs}" ]; then
1233   others=
1234   for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
1235     if [ "$i" != "libiberty" ]; then
1236       if [ -r $srcdir/$i/configure ] || [ -r $srcdir/$i/configure.in ]; then
1237         others=yes;
1238         break;
1239       fi
1240     fi
1241   done
1242   if [ -z "${others}" ]; then
1243     target_configdirs=
1244   fi
1245 fi
1246
1247 # Deconfigure all subdirectories, in case we are changing the
1248 # configuration from one where a subdirectory is supported to one where it
1249 # is not.
1250 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ]; then
1251   for i in `echo ${configdirs} | sed -e s/target-//g` ; do
1252     rm -f $i/Makefile
1253   done
1254 fi
1255 if [ -z "${norecursion}" ] && [ -n "${target_configdirs}" ]; then
1256   for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
1257     rm -f ${target_subdir}/$i/Makefile
1258   done
1259 fi
1260
1261 # Quietly strip out all directories which aren't configurable in this tree.
1262 # This relies on all configurable subdirectories being autoconfiscated, which
1263 # is now the case.
1264 configdirs_all="$configdirs"
1265 configdirs=
1266 for i in ${configdirs_all} ; do
1267   if test -f ${srcdir}/$i/configure ; then
1268     configdirs="${configdirs} $i"
1269   fi
1270 done
1271 target_configdirs_all="$target_configdirs"
1272 target_configdirs=
1273 for i in ${target_configdirs_all} ; do
1274   j=`echo $i | sed -e s/target-//g` 
1275   if test -f ${srcdir}/$j/configure ; then
1276     target_configdirs="${target_configdirs} $i"
1277   fi
1278 done
1279
1280 # Produce a warning message for the subdirs we can't configure.
1281 # This isn't especially interesting in the Cygnus tree, but in the individual
1282 # FSF releases, it's important to let people know when their machine isn't
1283 # supported by the one or two programs in a package.
1284
1285 if [ -n "${notsupp}" ] && [ -z "${norecursion}" ]; then
1286   # If $appdirs is non-empty, at least one of those directories must still
1287   # be configured, or we error out.  (E.g., if the gas release supports a
1288   # specified target in some subdirs but not the gas subdir, we shouldn't
1289   # pretend that all is well.)
1290   if [ -n "$appdirs" ]; then
1291     for dir in $appdirs ; do
1292       if [ -r $dir/Makefile.in ]; then
1293         if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1294           appdirs=""
1295           break
1296         fi
1297         if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1298           appdirs=""
1299           break
1300         fi
1301       fi
1302     done
1303     if [ -n "$appdirs" ]; then
1304       echo "*** This configuration is not supported by this package." 1>&2
1305       exit 1
1306     fi
1307   fi
1308   # Okay, some application will build, or we don't care to check.  Still
1309   # notify of subdirs not getting built.
1310   echo "*** This configuration is not supported in the following subdirectories:" 1>&2
1311   echo "    ${notsupp}" 1>&2
1312   echo "    (Any other directories should still work fine.)" 1>&2
1313 fi
1314
1315 # Set with_gnu_as and with_gnu_ld as appropriate.
1316 #
1317 # This is done by determining whether or not the appropriate directory
1318 # is available, and by checking whether or not specific configurations
1319 # have requested that this magic not happen.
1320
1321 # The command line options always override the explicit settings in 
1322 # configure.in, and the settings in configure.in override this magic.
1323 #
1324 # If the default for a toolchain is to use GNU as and ld, and you don't 
1325 # want to do that, then you should use the --without-gnu-as and
1326 # --without-gnu-ld options for the configure script.
1327
1328 if [ x${use_gnu_as} = x ] ; then
1329   if [ x${with_gnu_as} != xno ] && echo " ${configdirs} " | grep " ${gasdir} " > /dev/null 2>&1 && [ -d ${srcdir}/${gasdir} ] ; then
1330     with_gnu_as=yes
1331     withoptions="$withoptions --with-gnu-as"
1332   fi
1333 fi
1334
1335 if [ x${use_gnu_ld} = x ] ; then
1336   if [ x${with_gnu_ld} != xno ] && echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 && [ -d ${srcdir}/ld ] ; then
1337     with_gnu_ld=yes
1338     withoptions="$withoptions --with-gnu-ld"
1339   fi
1340 fi
1341
1342 # If using newlib, add --with-newlib to the withoptions so that gcc/configure
1343 # can detect this case.
1344
1345 if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
1346   with_newlib=yes
1347   withoptions="$withoptions --with-newlib"
1348 fi
1349
1350 if [ x${shared} = xyes ]; then
1351   case "${target}" in
1352     hppa* | parisc*)
1353       target_makefile_frag="${target_makefile_frag} config/mt-papic"
1354       ;;
1355     i[3456]86-*)
1356       target_makefile_frag="${target_makefile_frag} config/mt-x86pic"
1357       ;;
1358     ia64-*)
1359       target_makefile_frag="${target_makefile_frag} config/mt-ia64pic"
1360       ;;
1361     powerpc*-*-aix*)
1362       # We don't want -fPIC on AIX.
1363       ;;
1364     powerpc*-*)
1365       target_makefile_frag="${target_makefile_frag} config/mt-ppcpic"
1366       ;;
1367     alpha*-*-linux*)
1368       target_makefile_frag="${target_makefile_frag} config/mt-elfalphapic"
1369       ;;
1370     *)
1371       if test -f ${srcdir}/config/mt-${target_cpu}pic; then
1372         target_makefile_frag="${target_makefile_frag} config/mt-${target_cpu}pic"
1373       fi
1374       ;;
1375   esac
1376 fi
1377
1378 rm -f mt-frag
1379 if [ -n "${target_makefile_frag}" ] ; then
1380   for f in ${target_makefile_frag}
1381   do
1382     cat ${srcdir}/$f >> mt-frag
1383   done
1384   target_makefile_frag=mt-frag
1385 fi
1386
1387 # post-target:
1388
1389 # Make sure that the compiler is able to generate an executable.  If it
1390 # can't, we are probably in trouble.  We don't care whether we can run the
1391 # executable--we might be using a cross compiler--we only care whether it
1392 # can be created.  At this point the main configure script has set CC.
1393 echo "int main () { return 0; }" > conftest.c
1394 ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
1395 if [ $? = 0 ] && [ -s conftest -o -s conftest.exe ]; then
1396   :
1397 else
1398   echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
1399   echo 1>&2 "*** You must set the environment variable CC to a working compiler."
1400   rm -f conftest*
1401   exit 1
1402 fi
1403 rm -f conftest*
1404
1405 # The Solaris /usr/ucb/cc compiler does not appear to work.
1406 case "${host}" in
1407   sparc-sun-solaris2*)
1408       CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
1409       if [ "`type $CCBASE | sed 's/^[^/]*//'`" = "/usr/ucb/cc" ] ; then
1410           could_use=
1411           [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
1412           if [ -d /opt/cygnus/bin ] ; then
1413               if [ "$could_use" = "" ] ; then
1414                   could_use="/opt/cygnus/bin"
1415               else
1416                   could_use="$could_use or /opt/cygnus/bin"
1417               fi
1418           fi
1419         if [ "$could_use" = "" ] ; then
1420             echo "Warning: compilation may fail because you're using"
1421             echo "/usr/ucb/cc.  You should change your PATH or CC "
1422             echo "variable and rerun configure."
1423         else
1424             echo "Warning: compilation may fail because you're using"
1425             echo "/usr/ucb/cc, when you should use the C compiler from"
1426             echo "$could_use.  You should change your"
1427             echo "PATH or CC variable and rerun configure."
1428         fi
1429       fi
1430   ;;
1431 esac
1432
1433 # If we're building libgcj and we're using the Solaris 2.8 linker,
1434 # then we check for a known problem.
1435 if test "x${libgcj}" = x && test "${with_gnu_ld}" != yes \
1436    && test "${is_cross_compiler}" = no; then
1437
1438    case "${host}" in
1439     sparc-*-solaris2.8)
1440        if test "$libdir" = '${exec_prefix}/lib';then
1441           if test "$exec_prefix" = '$(prefix)'; then
1442              tlibdir="$prefix/lib"
1443           else
1444              tlibdir="$exec_prefix/lib"
1445           fi
1446        else
1447           tlibdir="$libdir"
1448        fi
1449        if test -f $tlibdir/libgcj.la; then
1450           echo "*** You've already installed libgcj in $tlibdir." 1>&2
1451           echo "    This causes problems when rebuilding libgcj with the Solaris 2.8 linker." 1>&2
1452           echo "    Either disable the libgcj build, or remove the" 1>&2
1453           echo "    already-installed libgcj files." 1>&2
1454           exit 1
1455        fi
1456        ;;
1457    esac
1458 fi
1459
1460 # If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
1461 # binutils tools will find libbfd.so.
1462 if [ "${shared}" = "yes" ]; then
1463   sed -e 's/^SET_LIB_PATH[      ]*=.*$/SET_LIB_PATH = $(REALLY_SET_LIB_PATH)/' \
1464       Makefile > Makefile.tem
1465   rm -f Makefile
1466   mv -f Makefile.tem Makefile
1467
1468   case "${host}" in
1469   *-*-hpux*)
1470     sed -e 's/^RPATH_ENVVAR[    ]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
1471         Makefile > Makefile.tem
1472     rm -f Makefile
1473     mv -f Makefile.tem Makefile
1474     ;;
1475   esac
1476 fi
1477
1478 # Record target_configdirs and the configure arguments for target and
1479 # build configuration in Makefile.
1480 target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
1481 targargs=`echo "${arguments}" | \
1482         sed -e 's/--no[^        ]*//' \
1483             -e 's/--cache[a-z-]*=[^     ]*//' \
1484             -e 's/--ho[a-z-]*=[^        ]*//' \
1485             -e 's/--bu[a-z-]*=[^        ]*//' \
1486             -e 's/--ta[a-z-]*=[^        ]*//'`
1487
1488 # For the build-side libraries, we just need to pretend we're native,
1489 # and not use the same cache file.  Multilibs are neither needed nor
1490 # desired.
1491 buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${targargs}"
1492
1493 # Passing a --with-cross-host argument lets the target libraries know
1494 # whether they are being built with a cross-compiler or being built
1495 # native.  However, it would be better to use other mechanisms to make the
1496 # sorts of decisions they want to make on this basis.  Please consider
1497 # this option to be deprecated.  FIXME.
1498 if [ x${is_cross_compiler} = xyes ]; then
1499   targargs="--with-cross-host=${host_alias} ${targargs}"
1500 fi
1501
1502 # Default to --enable-multilib.
1503 if [ x${enable_multilib} = x ]; then
1504   targargs="--enable-multilib ${targargs}"
1505 fi
1506
1507 # Pass --with-newlib if appropriate.  Note that target_configdirs has
1508 # changed from the earlier setting of with_newlib.
1509 if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
1510   targargs="--with-newlib ${targargs}"
1511 fi
1512
1513 # Pass the appropriate --host, --build, and --cache-file arguments.
1514 targargs="--cache-file=../config.cache --host=${target_alias} --build=${build_alias} ${targargs}"
1515
1516 # provide a proper gxx_include_dir.
1517 # Note, if you change the default, make sure to fix both here and in
1518 # the gcc and libstdc++-v3 subdirectories.
1519 # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
1520 gxx_include_dir=
1521 if test -n "${with_gxx_include_dir}"; then
1522   case "${with_gxx_include_dir}" in
1523     yes )
1524       echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2
1525       exit 1
1526       ;;
1527     no )
1528       ;;
1529     * )
1530       gxx_include_dir=${with_gxx_include_dir}
1531       ;;
1532   esac
1533 fi
1534 if test x${gxx_include_dir} = x; then
1535   if test x${enable_version_specific_runtime_libs} = xyes; then
1536     gxx_include_dir='${libsubdir}/include/g++'
1537   else
1538     . ${topsrcdir}/config.if
1539     gxx_include_dir='${prefix}/include/${libstdcxx_incdir}'
1540   fi
1541 else
1542   gxx_include_dir=${gxx_include_dir}
1543 fi
1544
1545 FLAGS_FOR_TARGET=
1546 case " $skipdirs " in
1547 *" target-newlib "*) ;;
1548 *)
1549  case " $target_configdirs " in
1550  *" newlib "*)
1551   case " $targargs " in
1552   *" --with-newlib "*)
1553    case "$target" in
1554    *-cygwin*)
1555      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' ;;
1556    esac
1557
1558    # If we're not building GCC, don't discard standard headers.
1559    if test -d ${topsrcdir}/gcc; then
1560      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
1561
1562      if test "${build}" != "${host}"; then
1563        # On Canadian crosses, CC_FOR_TARGET will have already been set
1564        # by `configure', so we won't have an opportunity to add -Bgcc/
1565        # to it.  This is right: we don't want to search that directory
1566        # for binaries, but we want the header files in there, so add
1567        # them explicitly.
1568        FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include'
1569
1570        # Someone might think of using the pre-installed headers on
1571        # Canadian crosses, in case the installed compiler is not fully
1572        # compatible with the compiler being built.  In this case, it
1573        # would be better to flag an error than risking having
1574        # incompatible object files being constructed.  We can't
1575        # guarantee that an error will be flagged, but let's hope the
1576        # compiler will do it, when presented with incompatible header
1577        # files.
1578      fi
1579    fi
1580
1581    case "${target}-${is_cross_compiler}" in
1582    i[3456]86-pc-linux*-no)
1583       # Here host == target, so we don't need to build gcc,
1584       # so we don't want to discard standard headers.
1585       FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
1586       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/'
1587       ;;
1588    *)
1589       # If we're building newlib, use its generic headers last, but search
1590       # for any libc-related directories first (so make it the last -B
1591       # switch).
1592       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
1593       ;;
1594    esac
1595    ;;
1596   esac
1597   ;;
1598  esac
1599  ;;
1600 esac
1601
1602 # On Canadian crosses, we'll be searching the right directories for
1603 # the previously-installed cross compiler, so don't bother to add
1604 # flags for directories within the install tree of the compiler
1605 # being built; programs in there won't even run.
1606 if test "${build}" = "${host}" && test -d ${topsrcdir}/gcc; then
1607   # Search for pre-installed headers if nothing else fits.
1608   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
1609 fi
1610
1611 if test "x${use_gnu_ld}" = x && test "x${with_gnu_ld}" != xno &&
1612    echo " ${configdirs} " | grep " ld " > /dev/null &&
1613    test -d ${srcdir}/ld; then
1614   # Arrange for us to find uninstalled linker scripts.
1615   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld'
1616 fi
1617
1618 if test "x${CC_FOR_TARGET+set}" = xset; then
1619   :
1620 elif test -d ${topsrcdir}/gcc; then
1621   CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/'
1622 elif test "$host" = "$target"; then
1623   CC_FOR_TARGET='$(CC)'
1624 else
1625   CC_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
1626 fi
1627 # On Canadian crosses, configure reads CC_FOR_TARGET from Makefile,
1628 # if Makefile exists.  Prevent $(FLAGS_FOR_TARGET) from being duplicated.
1629 case $CC_FOR_TARGET in
1630 *' $(FLAGS_FOR_TARGET)') ;;
1631 *) CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
1632 esac
1633
1634 if test "x${GCJ_FOR_TARGET+set}" = xset; then
1635   :
1636 elif test -d ${topsrcdir}/gcc; then
1637   GCJ_FOR_TARGET='$$r/gcc/gcj -B$$r/gcc/'
1638 elif test "$host" = "$target"; then
1639   GCJ_FOR_TARGET='gcj'
1640 else
1641   GCJ_FOR_TARGET=`echo gcj | sed -e 's/x/x/' ${program_transform_name}`
1642 fi
1643 case $GCJ_FOR_TARGET in
1644 *' $(FLAGS_FOR_TARGET)') ;;
1645 *) GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
1646 esac
1647
1648 if test "x${CXX_FOR_TARGET+set}" = xset; then
1649   :
1650 elif test -d ${topsrcdir}/gcc; then
1651   # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead
1652   # of g++ for linking C++ or Java, because g++ has -shared-libgcc by
1653   # default whereas gcc does not.
1654   CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3 | libjava) echo xgcc -shared-libgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
1655 elif test "$host" = "$target"; then
1656   CXX_FOR_TARGET='$(CXX)'
1657 else
1658   CXX_FOR_TARGET=`echo c++ | sed -e 's/x/x/' ${program_transform_name}`
1659 fi
1660 case $CXX_FOR_TARGET in
1661 *' $(FLAGS_FOR_TARGET)') ;;
1662 *) CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
1663 esac
1664 qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'`
1665
1666 # We want to defer the evaluation of `cmd`s and shell variables in
1667 # CXX_FOR_TARGET when recursing in the top-level Makefile, such as for
1668 # bootstrap.  We'll enclose CXX_FOR_TARGET_FOR_RECURSIVE_MAKE in single
1669 # quotes, but we still have to duplicate `$'s so that shell variables
1670 # can be expanded by the nested make as shell variables, not as make
1671 # macros.
1672 qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
1673
1674 sedtemp=sed.$$
1675 cat >$sedtemp <<EOF
1676 s:^TARGET_CONFIGDIRS[   ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:
1677 s%^TARGET_CONFIGARGS[   ]*=.*$%TARGET_CONFIGARGS = ${targargs}%
1678 s%^FLAGS_FOR_TARGET[    ]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}%
1679 s%^CC_FOR_TARGET[       ]*=.*$%CC_FOR_TARGET = ${CC_FOR_TARGET}%
1680 s%^GCJ_FOR_TARGET[      ]*=.*$%GCJ_FOR_TARGET = ${GCJ_FOR_TARGET}%
1681 s%^CXX_FOR_TARGET[      ]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%
1682 s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[   ]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = ${qqCXX_FOR_TARGET}%
1683 s%^TARGET_SUBDIR[       ]*=.*$%TARGET_SUBDIR = ${target_subdir}%
1684 s%^BUILD_SUBDIR[        ]*=.*$%BUILD_SUBDIR = ${build_subdir}%
1685 s%^BUILD_CONFIGARGS[    ]*=.*$%BUILD_CONFIGARGS = ${buildargs}%
1686 s%^gxx_include_dir[     ]*=.*$%gxx_include_dir=${gxx_include_dir}%
1687 EOF
1688 sed -f $sedtemp Makefile > Makefile.tem
1689 rm -f Makefile $sedtemp
1690 mv -f Makefile.tem Makefile
1691
1692 #
1693 # Local Variables:
1694 # fill-column: 131
1695 # End:
1696 #