OSDN Git Service

d
[pf3gnuchains/gcc-fork.git] / configure
1 #!/bin/sh
2
3 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
4
5 # Configuration script
6 # Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
7 # Free Software Foundation, Inc.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 # This file was originally written by K. Richard Pixley.
24
25 #
26 # Shell script to create proper links to machine-dependent files in
27 # preparation for compilation.
28 #
29 # If configure succeeds, it leaves its status in config.status.
30 # If configure fails after disturbing the status quo, 
31 #       config.status is removed.
32 #
33
34 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
35
36 remove=rm
37 hard_link=ln
38 symbolic_link='ln -s'
39
40 #for Test
41 #remove="echo rm"
42 #hard_link="echo ln"
43 #symbolic_link="echo ln -s"
44
45 # clear some things potentially inherited from environment.
46
47 Makefile=Makefile
48 Makefile_in=Makefile.in
49 arguments=
50 build_alias=
51 cache_file=config.cache
52 cache_file_option=
53 configdirs=
54 exec_prefix=
55 exec_prefixoption=
56 fatal=
57 floating_point=default
58 gas=default
59 gcc_version=
60 gcc_version_trigger=
61 host_alias=NOHOST
62 host_makefile_frag=
63 moveifchange=
64 norecursion=
65 other_options=
66 package_makefile_frag=
67 package_makefile_rules_frag=
68 prefix=/usr/local
69 progname=
70 program_prefix=
71 program_prefixoption=
72 program_suffix=
73 program_suffixoption=
74 program_transform_name=
75 program_transform_nameoption=
76 redirect=">/dev/null"
77 removing=
78 site=
79 site_makefile_frag=
80 site_option=
81 srcdir=
82 srctrigger=
83 subdirs=
84 target_alias=NOTARGET
85 target_makefile_frag=
86 undefs=NOUNDEFS
87 version="$Revision: 1.22 $"
88 x11=default
89
90 ### we might need to use some other shell than /bin/sh for running subshells
91
92 ### If we are on Windows, search for the shell.  This will permit people
93 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
94 ### without also having to set CONFIG_SHELL.  This code will work when
95 ### using bash, which sets OSTYPE.
96 case "${OSTYPE}" in
97 *win32*)
98   if [ x${CONFIG_SHELL} = x ]; then
99     if [ ! -f /bin/sh ]; then
100       if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
101         CONFIG_SHELL=${SHELL}
102         export CONFIG_SHELL
103       else
104         for prog in sh sh.exe bash bash.exe; do
105           IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
106           for dir in $PATH; do
107             test -z "$dir" && dir=.
108             if test -f $dir/$prog; then
109               CONFIG_SHELL=$dir/$prog
110               export CONFIG_SHELL
111               break
112             fi
113           done
114           IFS="$save_ifs"
115           test -n "${CONFIG_SHELL}" && break
116         done
117       fi
118     fi
119   fi
120   ;;
121 esac
122
123 config_shell=${CONFIG_SHELL-/bin/sh}
124
125 NO_EDIT="This file was generated automatically by configure.  Do not edit."
126
127 ## this is a little touchy and won't always work, but...
128 ##
129 ## if the argv[0] starts with a slash then it is an absolute name that can (and
130 ## must) be used as is.
131 ##
132 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
133 ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
134 ##
135
136 progname=$0
137 # if PWD already has a value, it is probably wrong.
138 if [ -n "$PWD" ]; then PWD=`pwd`; fi
139
140 case "${progname}" in
141 /*) ;;
142 */*) ;;
143 *)
144         PATH=$PATH:${PWD=`pwd`} ; export PATH
145         ;;
146 esac
147
148 # Loop over all args
149
150 while :
151 do
152
153 # Break out if there are no more args
154         case $# in
155         0)
156                 break
157                 ;;
158         esac
159
160 # Get the first arg, and shuffle
161         option=$1
162         shift
163
164 # Make all options have two hyphens
165         orig_option=$option     # Save original for error messages
166         case $option in
167         --*) ;;
168         -*) option=-$option ;;
169         esac
170                 
171 # Split out the argument for options that take them
172         case $option in
173         --*=*)
174                 optarg=`echo $option | sed -e 's/^[^=]*=//'`
175                 arguments="$arguments $option"
176                 ;;
177 # These options have mandatory values.  Since we didn't find an = sign,
178 # the value must be in the next argument
179         --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
180                 optarg=$1
181                 shift
182                 arguments="$arguments $option=$optarg"
183                 ;;
184         --v)
185                 arguments="$arguments -v"
186                 ;;
187         --*)
188                 arguments="$arguments $option"
189                 ;;
190         esac
191
192 # Now, process the options
193         case $option in
194
195         --build* | --bu*)
196                 case "$build_alias" in
197                 "") build_alias=$optarg ;;
198                 *) echo '***' Can only configure for one build machine at a time.  1>&2
199                    fatal=yes
200                    ;;
201                 esac
202                 ;;
203         --cache*)
204                 cache_file=$optarg
205                 ;;
206         --disable-*)
207                 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
208                 eval $enableopt=no
209                 disableoptions="$disableoptions $option"
210                 ;;
211         --enable-*)
212                 case "$option" in
213                 *=*)    ;;
214                 *)      optarg=yes ;;
215                 esac
216
217                 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
218                 eval "$enableopt='$optarg'"
219                 enableoptions="$enableoptions '$option'"
220                 ;;
221         --exec-prefix* | --ex*)
222                 exec_prefix=$optarg
223                 exec_prefixoption="--exec-prefix=$optarg"
224                 ;;
225         --gas | --g*)
226                 gas=yes
227                 ;;
228         --help | --he*)
229                 fatal=yes
230                 ;;
231         --host* | --ho*)
232                 case $host_alias in
233                 NOHOST) host_alias=$optarg ;;
234                 *) echo '***' Can only configure for one host at a time.  1>&2
235                    fatal=yes
236                    ;;
237                 esac
238                 ;;
239         --nfp | --nf*)
240                 floating_point=no
241                 floating_pointoption="--nfp"
242                 ;;
243         --norecursion | --no*)
244                 norecursion=yes
245                 ;;
246         --prefix* | --pre*)
247                 prefix=$optarg
248                 prefixoption="--prefix=$optarg"
249                 ;;
250         --program-prefix* | --program-p*)
251                 program_prefix=$optarg
252                 program_prefixoption="--program-prefix=$optarg"
253                 ;;
254         --program-suffix* | --program-s*)
255                 program_suffix=$optarg
256                 program_suffixoption="--program-suffix=$optarg"
257                 ;;
258         --program-transform-name* | --program-t*)
259                 # Double any backslashes or dollar signs in the argument
260                 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
261                 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
262                 ;;
263         --rm)
264                 removing=--rm
265                 ;;
266         --silent | --sil* | --quiet | --q*)
267                 redirect=">/dev/null"
268                 verbose=--silent
269                 ;;
270         --site* | --sit*)
271                 site=$optarg
272                 site_option="--site=$optarg"
273                 ;;
274         --srcdir*/ | --sr*/)
275                 # Remove trailing slashes.  Otherwise, when the file name gets
276                 # bolted into an object file as debug info, it has two slashes
277                 # in it.  Ordinarily this is ok, but emacs takes double slash
278                 # to mean "forget the first part".
279                 srcdir=`echo $optarg | sed -e 's:/$::'`
280                 ;;
281         --srcdir* | --sr*)
282                 srcdir=$optarg
283                 ;;
284         --target* | --ta*)
285                 case $target_alias in
286                 NOTARGET) target_alias=$optarg ;;
287                 *) echo '***' Can only configure for one target at a time.  1>&2
288                    fatal=yes
289                    ;;
290                 esac
291                 ;;
292         --tmpdir* | --tm*)
293                 TMPDIR=$optarg
294                 tmpdiroption="--tmpdir=$optarg"
295                 ;;
296         --verbose | --v | --verb*)
297                 redirect=
298                 verbose=--verbose
299                 ;;
300         --version | --V | --vers*)
301                 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
302                 exit 0
303                 ;;
304         --with-*)
305                 case "$option" in
306                 *=*)    ;;
307                 *)      optarg=yes ;;
308                 esac
309
310                 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
311                 eval $withopt="$optarg"
312                 withoptions="$withoptions $option"
313                 ;;
314         --without-*)
315                 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
316                 eval $withopt=no
317                 withoutoptions="$withoutoptions $option"
318                 ;;
319         --x)    with_x=yes
320                 withoptions="$withoptions --with-x"
321                 ;;
322         --x-i* | --x-l*) other_options="$other_options $orig_option"
323                 ;;
324         --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
325                 # These options were added to autoconf for emacs.
326                 ;;
327         --*)
328                 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
329                 exit 1
330                 ;;
331         *)
332                 case $undefs in
333                 NOUNDEFS) undefs=$option ;;
334                 *) echo '***' Can only configure for one host and one target at a time.  1>&2
335                    fatal=yes
336                    ;;
337                 esac
338                 ;;
339         esac
340 done
341
342 # process host and target
343
344 # Do some error checking and defaulting for the host and target type.
345 # The inputs are:
346 #    configure --host=HOST --target=TARGET UNDEFS
347 #
348 # The rules are:
349 # 1. You aren't allowed to specify --host, --target, and undefs at the
350 #    same time.
351 # 2. Host defaults to undefs.
352 # 3. If undefs is not specified, then host defaults to the current host,
353 #    as determined by config.guess.
354 # 4. Target defaults to undefs.
355 # 5. If undefs is not specified, then target defaults to host.
356
357 case "${fatal}" in
358 "")
359         # Make sure that host, target & undefs aren't all specified at the
360         # same time.
361         case $host_alias---$target_alias---$undefs in
362         NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
363                 ;;
364         *) echo '***' Can only configure for one host and one target at a time.  1>&2
365            fatal=yes
366            break 2
367                 ;;
368         esac
369
370         # Now, do defaulting for host.
371         case $host_alias in
372         NOHOST)
373                 case $undefs in
374                 NOUNDEFS)
375                         # Neither --host option nor undefs were present.
376                         # Call config.guess.
377                         guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
378                         if host_alias=`${config_shell} ${guesssys}`
379                         then
380                                 # If the string we are going to use for
381                                 # the target is a prefix of the string
382                                 # we just guessed for the host, then
383                                 # assume we are running native, and force
384                                 # the same string for both target and host.
385                                 case $target_alias in
386                                 NOTARGET) ;;
387                                 *)
388                                         if expr $host_alias : $target_alias >/dev/null
389                                         then
390                                                 host_alias=$target_alias
391                                         fi
392                                         ;;
393                                 esac
394                                 echo "Configuring for a ${host_alias} host." 1>&2
395                                 arguments="--host=$host_alias $arguments"
396                         else
397                                 echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
398                                 fatal=yes
399                         fi
400                         ;;
401                 *)
402                         host_alias=$undefs
403                         arguments="--host=$host_alias $arguments"
404                         undefs=NOUNDEFS
405                         ;;
406                 esac
407         esac
408
409         # Do defaulting for target.  If --target option isn't present, default
410         # to undefs.  If undefs isn't present, default to host.
411         case $target_alias in
412         NOTARGET)
413                 case $undefs in
414                 NOUNDEFS)
415                         target_alias=$host_alias
416                         ;;
417                 *)
418                         target_alias=$undefs
419                         arguments="--target=$target_alias $arguments"
420                         ;;
421                 esac
422         esac
423         ;;
424 *) ;;
425 esac
426
427 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
428         exec 1>&2
429         echo Usage: configure [OPTIONS] [HOST]
430         echo
431         echo Options: [defaults in brackets]
432         echo ' --prefix=MYDIR            install into MYDIR [/usr/local]'
433         echo ' --exec-prefix=MYDIR       install host-dependent files into MYDIR [/usr/local]'
434         echo ' --help                    print this message [normal config]'
435         echo ' --build=BUILD             configure for building on BUILD [BUILD=HOST]'
436         echo ' --host=HOST               configure for HOST [determined via config.guess]'
437         echo ' --norecursion             configure this directory only [recurse]'
438         echo ' --program-prefix=FOO      prepend FOO to installed program names [""]'
439         echo ' --program-suffix=FOO      append FOO to installed program names [""]'
440         echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
441         echo ' --site=SITE               configure with site-specific makefile for SITE'
442         echo ' --srcdir=DIR              find the sources in DIR [. or ..]'
443         echo ' --target=TARGET   configure for TARGET [TARGET=HOST]'
444         echo ' --tmpdir=TMPDIR   create temporary files in TMPDIR [/tmp]'
445         echo ' --nfp                     configure for software floating point [hard float]'
446         echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
447         echo ' --without-FOO             package FOO is NOT available'
448         echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
449         echo ' --disable-FOO             do not include feature FOO'
450         echo
451         echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
452         echo
453         if [ -r config.status ] ; then
454                 cat config.status
455         fi
456
457         exit 1
458 fi
459
460 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
461 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
462 topsrcdir=`cd \`dirname ${progname}\`; pwd`
463
464 # this is a hack.  sun4 must always be a valid host alias or this will fail.
465 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
466         true
467 else
468         echo '***' cannot find config.sub.  1>&2
469         exit 1
470 fi
471
472 touch config.junk
473 if ${config_shell} ${moveifchange} config.junk config.trash ; then
474         true
475 else
476         echo '***' cannot find move-if-change.  1>&2
477         exit 1
478 fi
479 rm -f config.junk config.trash
480
481 case "${srcdir}" in
482 "")
483         if [ -r configure.in ] ; then
484                 srcdir=.
485         else
486                 if [ -r ${progname}.in ] ; then
487                         srcdir=`echo ${progname} | sed 's:/configure$::'`
488                 else
489                         echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
490                         exit 1
491                 fi
492         fi
493         ;;
494 *)
495         # Set srcdir to "." if that's what it is.
496         # This is important for multilib support.
497         if [ ! -d ${srcdir} ] ; then
498                 echo "Invalid source directory ${srcdir}" >&2
499                 exit 1
500         fi
501         pwd=`pwd`
502         srcpwd=`cd ${srcdir} ; pwd`
503         if [ "${pwd}" = "${srcpwd}" ] ; then
504                 srcdir=.
505         fi
506 esac
507
508 ### warn about some conflicting configurations.
509
510 case "${srcdir}" in
511 ".") ;;
512 *)
513         if [ -f ${srcdir}/config.status ] ; then
514                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
515                 exit 1
516         fi
517 esac
518
519 # default exec_prefix
520 case "${exec_prefixoption}" in
521 "") exec_prefix="\$(prefix)" ;;
522 *) ;;
523 esac
524
525 # Define the trigger file to make sure configure will re-run whenever
526 # the gcc version number changes.
527 if [ "${with_gcc_version_trigger+set}" = set ]; then
528     gcc_version_trigger="$with_gcc_version_trigger"
529     gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${with_gcc_version_trigger}`
530 else
531     # If gcc's sources are available, define the trigger file.
532     if [ -f ${topsrcdir}/gcc/version.c ] ; then
533         gcc_version_trigger=${topsrcdir}/gcc/version.c
534         gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}`
535         case "$arguments" in
536           *--with-gcc-version-trigger=$gcc_version_trigger* )
537             ;;
538           * )
539             # Make sure configure.in knows about this.
540             arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
541             ;;
542         esac
543         withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
544     fi
545 fi
546
547 ### break up ${srcdir}/configure.in.
548 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
549 "")
550         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
551         # Check for a directory that's been converted to use autoconf since
552         # it was last configured.
553         if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
554           echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
555           if [ -r ${srcdir}/configure ] ; then
556             echo '***' Running the local configure script. 1>&2
557             case "${cache_file}" in
558             "") cache_file_option= ;;
559             *)  cache_file_option="--cache-file=${cache_file}" ;;
560             esac
561             srcdiroption="--srcdir=${srcdir}"
562             case "${build_alias}" in
563             "") buildopt= ;;
564             *)  buildopt="--build=${build_alias}" ;;
565             esac
566             eval exec ${config_shell} ${srcdir}/configure ${verbose} \
567                 ${buildopt} --host=${host_alias} --target=${target_alias} \
568                 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
569                 ${srcdiroption} \
570                 ${program_prefixoption} ${program_suffixoption} \
571                 ${program_transform_nameoption} ${site_option} \
572                 ${withoptions} ${withoutoptions} \
573                 ${enableoptions} ${disableoptions} ${floating_pointoption} \
574                 ${cache_file_option} ${removing} ${other_options} ${redirect}
575           else
576             echo '***' There is no configure script present though. 1>&2
577           fi
578         fi
579         exit 1
580         ;;
581 *) ;;
582 esac
583
584 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
585 "")
586         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
587         exit 1
588         ;;
589 *) ;;
590 esac
591
592 case "${TMPDIR}" in
593 "") TMPDIR=/tmp ; export TMPDIR ;;
594 *) ;;
595 esac
596
597 # keep this filename short for &%*%$*# 14 char file names
598 tmpfile=${TMPDIR}/cONf$$
599 # Note that under many versions of sh a trap handler for 0 will *override* any
600 # exit status you explicitly specify!  At this point, the only non-error exit
601 # is at the end of the script; these actions are duplicated there, minus
602 # the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
603 # trap handler, or you'll lose.
604 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
605
606 # split ${srcdir}/configure.in into common, per-host, per-target,
607 # and post-target parts.  Post-target is optional.
608 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
609 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
610 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
611   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
612   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
613 else
614   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
615   echo >${tmpfile}.pos
616 fi
617
618 ### do common part of configure.in
619
620 . ${tmpfile}.com
621
622 # some sanity checks on configure.in
623 case "${srctrigger}" in
624 "")
625         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
626         exit 1
627         ;;
628 *) ;;
629 esac
630
631 case "${build_alias}" in
632 "")
633         if result=`${config_shell} ${configsub} ${host_alias}` ; then
634             build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
635             build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
636             build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
637             build=${build_cpu}-${build_vendor}-${build_os}
638             build_alias=${host_alias}
639         fi
640         ;;
641 *)
642         if result=`${config_shell} ${configsub} ${build_alias}` ; then
643             buildopt="--build=${build_alias}"
644             build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
645             build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
646             build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
647             build=${build_cpu}-${build_vendor}-${build_os}
648         else
649             echo "Unrecognized build system name ${build_alias}." 1>&2
650             exit 1
651         fi
652         ;;
653 esac
654
655 if result=`${config_shell} ${configsub} ${host_alias}` ; then
656     true
657 else
658     echo "Unrecognized host system name ${host_alias}." 1>&2
659     exit 1
660 fi
661 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
662 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
663 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
664 host=${host_cpu}-${host_vendor}-${host_os}
665
666 . ${tmpfile}.hst
667
668 if result=`${config_shell} ${configsub} ${target_alias}` ; then
669     true
670 else
671     echo "Unrecognized target system name ${target_alias}." 1>&2
672     exit 1
673 fi
674 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
675 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
676 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
677 target=${target_cpu}-${target_vendor}-${target_os}
678
679 . ${tmpfile}.tgt
680
681 # Find the source files, if location was not specified.
682 case "${srcdir}" in
683 "")
684         srcdirdefaulted=1
685         srcdir=.
686         if [ ! -r ${srctrigger} ] ; then
687                 srcdir=..
688         fi
689         ;;
690 *) ;;
691 esac
692
693 if [ ! -r ${srcdir}/${srctrigger} ] ; then
694         case "${srcdirdefaulted}" in
695         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
696         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
697         esac
698
699         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
700         exit 1
701 fi
702
703 # Some systems (e.g., one of the i386-aix systems the gas testers are
704 # using) don't handle "\$" correctly, so don't use it here.
705 tooldir='$(exec_prefix)'/${target_alias}
706
707 if [ "${host_alias}" != "${target_alias}" ] ; then
708     if [ "${program_prefixoption}" = "" ] ; then
709         if [ "${program_suffixoption}" = "" ] ; then 
710             if [ "${program_transform_nameoption}" = "" ] ; then
711                 program_prefix=${target_alias}- ;
712             fi
713         fi
714     fi
715 fi
716
717 # Merge program_prefix and program_suffix onto program_transform_name.
718 # (program_suffix used to use $, but it's hard to preserve $ through both
719 # make and sh.)
720 if [ "${program_suffix}" != "" ] ; then
721     program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
722 fi
723
724 if [ "${program_prefix}" != "" ] ; then
725     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
726 fi
727
728 # If CC and CXX are not set in the environment, and the Makefile
729 # exists, try to extract them from it.  This is to handle running
730 # ./config.status by hand.
731 if [ -z "${CC}" -a -r Makefile ]; then
732   sed -n -e ':loop
733 /\\$/ N
734 s/\\\n//g
735 t loop
736 /^CC[   ]*=/ s/CC[      ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
737   CC=`tail -1 Makefile.cc`
738   rm -f Makefile.cc
739 fi
740
741 if [ -z "${CFLAGS}" -a -r Makefile ]; then
742   sed -n -e ':loop
743 /\\$/ N
744 s/\\\n//g
745 t loop
746 /^CFLAGS[       ]*=/ s/CFLAGS[  ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
747   CFLAGS=`tail -1 Makefile.cc`
748   rm -f Makefile.cc
749 fi
750
751 if [ -z "${CXX}" -a -r Makefile ]; then
752   sed -n -e ':loop
753 /\\$/ N
754 s/\\\n//g
755 t loop
756 /^CXX[  ]*=/ s/CXX[     ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
757   CXX=`tail -1 Makefile.cc`
758   rm -f Makefile.cc
759 fi
760
761 if [ -z "${CXXFLAGS}" -a -r Makefile ]; then
762   sed -n -e ':loop
763 /\\$/ N
764 s/\\\n//g
765 t loop
766 /^CXXFLAGS[     ]*=/ s/CXXFLAGS[        ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
767   CXXFLAGS=`tail -1 Makefile.cc`
768   rm -f Makefile.cc
769 fi
770
771 # Generate a default definition for YACC.  This is used if the makefile can't
772 # locate bison or byacc in objdir.
773
774 for prog in 'bison -y' byacc yacc
775 do
776   set dummy $prog; tmp=$2
777   IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
778   for dir in $PATH; do
779     test -z "$dir" && dir=.
780     if test -f $dir/$tmp; then
781       DEFAULT_YACC="$prog"
782       break
783     fi
784   done
785   IFS="$save_ifs"
786
787   test -n "$DEFAULT_YACC" && break
788 done
789
790 # Generate a default definition for M4.  This is used if the makefile can't
791 # locate m4 in objdir.
792
793 for prog in gm4 gnum4 m4
794 do
795   set dummy $prog; tmp=$2
796   IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
797   for dir in $PATH; do
798     test -z "$dir" && dir=.
799     if test -f $dir/$tmp; then
800       DEFAULT_M4="$prog"
801       break
802     fi
803   done
804   IFS="$save_ifs"
805
806   test -n "$DEFAULT_M4" && break
807 done
808
809 # Generate a default definition for LEX.  This is used if the makefile can't
810 # locate flex in objdir.
811
812 for prog in flex lex
813 do
814   set dummy $prog; tmp=$2
815   IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
816   for dir in $PATH; do
817     test -z "$dir" && dir=.
818     if test -f $dir/$tmp; then
819       DEFAULT_LEX="$prog"
820       break
821     fi
822   done
823   IFS="$save_ifs"
824
825   test -n "$DEFAULT_LEX" && break
826 done
827
828 if [ "${build}" != "${host}" ]; then
829   # If we are doing a Canadian Cross, in which the host and build systems
830   # are not the same, we set reasonable default values for the tools.
831
832   tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
833   tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
834   tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
835   tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
836   tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
837   tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
838
839   for var in ${tools}; do
840     if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
841       sed -n -e ':loop
842 /\\$/ N
843 s/\\\n//g
844 t loop
845 /^'"${var}"'[   ]*=/ s/'"${var}"'[      ]*=[    ]*\(.*\)/\1/p' \
846         < Makefile > Makefile.v
847       t=`tail -1 Makefile.v`
848       if [ -n "${t}" ]; then
849         eval "${var}='${t}'"
850       fi
851       rm -f Makefile.v
852     fi
853   done
854
855   AR=${AR-${host_alias}-ar}
856   AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
857   AS=${AS-${host_alias}-as}
858   AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
859   BISON=${BISON-bison}
860   CC=${CC-${host_alias}-gcc}
861   CFLAGS=${CFLAGS-"-g -O2"}
862   CXX=${CXX-${host_alias}-c++}
863   CXXFLAGS=${CXXFLAGS-"-g -O2"}
864   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
865   CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
866   CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
867   DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
868   DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
869   GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
870   HOST_PREFIX=${build_alias}-
871   HOST_PREFIX_1=${build_alias}-
872   LD=${LD-${host_alias}-ld}
873   LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
874   MAKEINFO=${MAKEINFO-makeinfo}
875   NM=${NM-${host_alias}-nm}
876   NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
877   RANLIB=${RANLIB-${host_alias}-ranlib}
878   RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
879   WINDRES=${WINDRES-${host_alias}-windres}
880   WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
881
882   if [ -z "${YACC}" ]; then
883     IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
884     for dir in $PATH; do
885       test -z "$dir" && dir=.
886       if test -f $dir/bison; then
887         YACC="bison -y"
888         break
889       fi
890       if test -f $dir/byacc; then
891         YACC=byacc
892         break
893       fi
894       if test -f $dir/yacc; then
895         YACC=yacc
896         break
897       fi
898     done
899     IFS="$save_ifs"
900     if [ -z "${YACC}" ]; then
901       YACC="bison -y"
902     fi
903   fi
904
905   if [ -z "${LEX}" ]; then
906     IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
907     for dir in $PATH; do
908       test -z "$dir" && dir=.
909       if test -f $dir/flex; then
910         LEX=flex
911         break
912       fi
913       if test -f $dir/lex; then
914         LEX=lex
915         break
916       fi
917     done
918     IFS="$save_ifs"
919     LEX=${LEX-flex}
920   fi
921
922   # Export variables which autoconf might try to set.
923   export AS
924   export AR
925   export CC_FOR_BUILD
926   export DLLTOOL
927   export LD
928   export NM
929   export RANLIB
930   export WINDRES
931 else
932   # If CC is still not set, try to get gcc.
933   if [ -z "${CC}" ]; then
934     IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
935     for dir in $PATH; do
936       test -z "$dir" && dir=.
937       if test -f $dir/gcc; then
938         CC="gcc"
939         echo 'void f(){}' > conftest.c
940         if test -z "`${CC} -g -c conftest.c 2>&1`"; then
941           CFLAGS=${CFLAGS-"-g -O2"}
942           CXXFLAGS=${CXXFLAGS-"-g -O2"}
943         else
944           CFLAGS=${CFLAGS-"-O2"}
945           CXXFLAGS=${CXXFLAGS-"-O2"}
946         fi
947         rm -f conftest*
948         break
949       fi
950     done
951     IFS="$save_ifs"
952     CC=${CC-cc}
953   fi
954
955   CXX=${CXX-"c++"}
956   CFLAGS=${CFLAGS-"-g"}
957   CXXFLAGS=${CXXFLAGS-"-g -O2"}
958 fi
959
960 export CC
961 export CXX
962 export CFLAGS
963 export CXXFLAGS
964
965 # FIXME: This should be in configure.in, not configure
966 case "$host" in
967         *go32*)
968             enable_gdbtk=no ;;
969         *msdosdjgpp*)
970             enable_gdbtk=no ;;
971         *cygwin32*)
972             enable_gdbtk=no ;;
973 esac
974
975 # FIXME: This should be in configure.in, not configure
976 # Determine whether gdb needs tk/tcl or not.
977 if [ "$enable_gdbtk" != "no" ]; then
978         GDB_TK="all-tcl all-tk all-itcl all-tix"
979 else
980         GDB_TK=""
981 fi
982
983 for subdir in . ${subdirs} ; do
984
985     # ${subdir} is relative path from . to the directory we're currently
986     # configuring.
987     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
988     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
989
990     ### figure out what to do with srcdir
991     case "${srcdir}" in
992         ".")  # no -srcdir option.  We're building in place.
993                 makesrcdir=. ;;
994         /*) # absolute path
995                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
996                 ;;
997         *) # otherwise relative
998                 case "${subdir}" in
999                 .) makesrcdir=${srcdir} ;;
1000                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1001                 esac
1002                 ;;
1003     esac
1004
1005     if [ "${subdir}/" != "./" ] ; then
1006         Makefile=${subdir}/Makefile
1007     fi
1008
1009     if [ ! -d ${subdir} ] ; then
1010         if mkdir ${subdir} ; then
1011                 true
1012         else
1013                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1014                 exit 1
1015         fi
1016     fi
1017
1018     case "${removing}" in
1019     "")
1020         case "${subdir}" in
1021         .) ;;
1022         *) eval echo Building in ${subdir} ${redirect} ;;
1023         esac
1024
1025         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1026         # Set up the list of links to be made.
1027         # ${links} is the list of link names, and ${files} is the list of names to link to.
1028
1029         # Make the links.
1030         configlinks="${links}"
1031         if [ -r ${subdir}/config.status ] ; then
1032                 mv -f ${subdir}/config.status ${subdir}/config.back
1033         fi
1034         while [ -n "${files}" ] ; do
1035                 # set file to car of files, files to cdr of files
1036                 set ${files}; file=$1; shift; files=$*
1037                 set ${links}; link=$1; shift; links=$*
1038
1039                 if [ ! -r ${srcdir}/${file} ] ; then
1040                   if [ ! -r ${file} ] ; then
1041                     
1042                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1043                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1044                         exit 1
1045                   else
1046                         srcfile=${file}
1047                   fi
1048                 else
1049                         srcfile=${srcdir}/${file}
1050                 fi
1051
1052                 ${remove} -f ${link}
1053                 # Make a symlink if possible, otherwise try a hard link
1054                 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1055                         true
1056                 else
1057                         # We need to re-remove the file because Lynx leaves a 
1058                         # very strange directory there when it fails an NFS symlink.
1059                         ${remove} -r -f ${link}
1060                         ${hard_link} ${srcfile} ${link}
1061                 fi
1062                 if [ ! -r ${link} ] ; then
1063                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1064                         exit 1
1065                 fi
1066
1067                 echo "Linked \"${link}\" to \"${srcfile}\"."
1068         done
1069
1070         # Create a .gdbinit file which runs the one in srcdir
1071         # and tells GDB to look there for source files.
1072
1073         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1074                 case ${srcdir} in
1075                 .) ;;
1076                 *) cat > ${subdir}/.gdbinit <<EOF
1077 # ${NO_EDIT}
1078 dir ${makesrcdir}
1079 dir .
1080 source ${makesrcdir}/.gdbinit
1081 EOF
1082                         ;;
1083                 esac
1084         fi
1085
1086         # Install a makefile, and make it set VPATH
1087         # if necessary so that the sources are found.
1088         # Also change its value of srcdir.
1089         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
1090         # been somewhat optimized and is perhaps a bit twisty.
1091
1092         # code is order so as to try to sed the smallest input files we know.
1093         # so do these separately because I don't trust the order of sed -e expressions.
1094
1095         # the five makefile fragments MUST end up in the resulting Makefile in this order: 
1096         # package macros, target, host, site, and package rules.
1097
1098         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1099
1100             # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1101             rm -f ${subdir}/${Makefile}.tem
1102             case "${package_makefile_rules_frag}" in
1103               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1104               *)
1105                       if [ ! -f ${package_makefile_rules_frag} ] ; then
1106                               package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1107                       fi
1108                       if [ -f ${package_makefile_rules_frag} ] ; then
1109                               sed -e "/^####/  r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1110                       else
1111                               echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1112                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
1113                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1114                       fi
1115             esac
1116             # working copy now in ${Makefile}.tem
1117
1118             # Conditionalize for this site.
1119             rm -f ${Makefile}
1120               case "${site}" in
1121               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1122               *)
1123                       site_makefile_frag=${srcdir}/config/ms-${site}
1124
1125                       if [ -f ${site_makefile_frag} ] ; then
1126                               sed -e "/^####/  r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1127                                       > ${Makefile}
1128                       else
1129                               mv ${subdir}/Makefile.tem ${Makefile}
1130                               site_makefile_frag=
1131                       fi
1132                       ;;
1133             esac
1134             # working copy now in ${Makefile}
1135
1136             # Conditionalize the makefile for this host.
1137             rm -f ${subdir}/Makefile.tem
1138             case "${host_makefile_frag}" in
1139               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1140               *)
1141                       if [ ! -f ${host_makefile_frag} ] ; then
1142                               host_makefile_frag=${srcdir}/${host_makefile_frag}
1143                       fi
1144                       if [ -f ${host_makefile_frag} ] ; then
1145                               sed -e "/^####/  r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1146                       else
1147                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1148                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
1149                               mv ${Makefile} ${subdir}/Makefile.tem
1150                       fi
1151             esac
1152             # working copy now in ${subdir)/Makefile.tem
1153
1154             # Conditionalize the makefile for this target.
1155             rm -f ${Makefile}
1156             case "${target_makefile_frag}" in
1157               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1158               *)
1159                       if [ ! -f ${target_makefile_frag} ] ; then
1160                               target_makefile_frag=${srcdir}/${target_makefile_frag}
1161                       fi
1162                       if [ -f ${target_makefile_frag} ] ; then
1163                               sed -e "/^####/  r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1164                       else
1165                               mv ${subdir}/Makefile.tem ${Makefile}
1166                               target_makefile_frag=
1167                       fi
1168                       ;;
1169             esac
1170             # working copy now in ${Makefile}
1171
1172             # Emit the default values of this package's macros.
1173             rm -f ${subdir}/Makefile.tem
1174             case "${package_makefile_frag}" in
1175               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1176               *)
1177                       if [ ! -f ${package_makefile_frag} ] ; then
1178                               package_makefile_frag=${srcdir}/${package_makefile_frag}
1179                       fi
1180                       if [ -f ${package_makefile_frag} ] ; then
1181                               sed -e "/^####/  r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1182                       else
1183                               echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1184                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
1185                               mv ${Makefile} ${subdir}/Makefile.tem
1186                       fi
1187             esac
1188             # real copy now in ${subdir}/Makefile.tem
1189
1190             # prepend warning about editting, and a bunch of variables.
1191             rm -f ${Makefile}
1192             cat > ${Makefile} <<EOF
1193 # ${NO_EDIT}
1194 VPATH = ${makesrcdir}
1195 links = ${configlinks}
1196 host_alias = ${host_alias}
1197 host_cpu = ${host_cpu}
1198 host_vendor = ${host_vendor}
1199 host_os = ${host_os}
1200 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1201 target_alias = ${target_alias}
1202 target_cpu = ${target_cpu}
1203 target_vendor = ${target_vendor}
1204 target_os = ${target_os}
1205 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1206 EOF
1207             case "${build}" in
1208               "") ;;
1209               *)  cat >> ${Makefile} << EOF
1210 build_alias = ${build_alias}
1211 build_cpu = ${build_cpu}
1212 build_vendor = ${build_vendor}
1213 build_os = ${build_os}
1214 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1215 EOF
1216             esac
1217
1218             case "${package_makefile_frag}" in
1219               "") ;;
1220               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1221               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1222             esac
1223
1224             case "${target_makefile_frag}" in
1225               "") ;;
1226               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1227               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1228             esac
1229
1230             case "${host_makefile_frag}" in
1231               "") ;;
1232               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1233               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1234             esac
1235
1236             if [ "${site_makefile_frag}" != "" ] ; then
1237                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1238             fi 
1239
1240             # provide a proper gxx_include_dir to all subdirs.
1241             # Note, if you change the default, make sure to fix both here
1242             # and in the gcc subdirectory.
1243             if test -z "${with_gxx_include_dir}"; then
1244                 if test x${enable_version_specific_runtime_libs} = xyes; then
1245                     echo gxx_include_dir = '${libsubdir}/include/g++' >> ${Makefile}
1246                 else
1247                     echo gxx_include_dir = '${prefix}/include/g++' >> ${Makefile}
1248                 fi
1249             else
1250                 echo gxx_include_dir = ${with_gxx_include_dir} >> ${Makefile}
1251             fi
1252
1253             # record if we want to build shared libs.
1254             if test -z "${enable_shared}"; then
1255                 echo enable_shared = no >> ${Makefile}
1256             else
1257                 echo enable_shared = ${enable_shared} >> ${Makefile}
1258             fi
1259             # record if we want to rumtime library stuff installed in libsubdir.
1260             if test -z "${enable_version_specific_runtime_libs}"; then
1261                 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1262             else
1263                 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1264             fi
1265
1266             # Emit a macro which describes the file containing gcc's
1267             # version number.
1268             echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1269             # And emit a macro defining gcc's version number.
1270             echo gcc_version = ${gcc_version} >> ${Makefile}
1271
1272             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1273             # remove any form feeds.
1274             if [ -z "${subdirs}" ]; then
1275                 rm -f ${subdir}/Makefile.tm2
1276                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
1277                     -e "s:^NONSUBDIRS[  ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1278                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1279                 rm -f ${subdir}/Makefile.tem
1280                 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1281             fi
1282             sed     -e "s|^prefix[      ]*=.*$|prefix = ${prefix}|" \
1283                     -e "s|^exec_prefix[         ]*=.*$|exec_prefix = ${exec_prefix}|" \
1284                     -e "/^CC[   ]*=/{
1285                         :loop1
1286                         /\\\\$/ N
1287                         s/\\\\\\n//g
1288                         t loop1
1289                         s%^CC[  ]*=.*$%CC = ${CC}%
1290                         }" \
1291                     -e "/^CXX[  ]*=/{
1292                         :loop2
1293                         /\\\\$/ N
1294                         s/\\\\\\n//g
1295                         t loop2
1296                         s%^CXX[         ]*=.*$%CXX = ${CXX}%
1297                         }" \
1298                     -e "/^CFLAGS[       ]*=/{
1299                         :loop3
1300                         /\\\\$/ N
1301                         s/\\\\\\n//g
1302                         t loop3
1303                         s%^CFLAGS[      ]*=.*$%CFLAGS = ${CFLAGS}%
1304                         }" \
1305                     -e "/^CXXFLAGS[     ]*=/{
1306                         :loop4
1307                         /\\\\$/ N
1308                         s/\\\\\\n//g
1309                         t loop4
1310                         s%^CXXFLAGS[    ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1311                         }" \
1312                     -e "s|^SHELL[        ]*=.*$|SHELL = ${config_shell}|" \
1313                     -e "s:^GDB_TK[       ]*=.*$:GDB_TK = ${GDB_TK}:" \
1314                     -e "s|^srcdir[      ]*=.*$|srcdir = ${makesrcdir}|" \
1315                     -e "s/\f//" \
1316                     -e "s:^program_prefix[      ]*=.*$:program_prefix = ${program_prefix}:" \
1317                     -e "s:^program_suffix[      ]*=.*$:program_suffix = ${program_suffix}:" \
1318                     -e "s:^program_transform_name[      ]*=.*$:program_transform_name = ${program_transform_name}:" \
1319                     -e "s|^tooldir[     ]*=.*$|tooldir = ${tooldir}|" \
1320                     -e "s:^DEFAULT_YACC[         ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1321                     -e "s:^DEFAULT_LEX[  ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1322                     -e "s:^DEFAULT_M4[  ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
1323                     ${subdir}/Makefile.tem >> ${Makefile}
1324
1325             # If this is a Canadian Cross, preset the values of many more
1326             # tools.
1327             if [ "${build}" != "${host}" ]; then
1328                 for var in ${tools}; do
1329                     val=`eval 'echo $'"${var}"`
1330                     sed -e "/^${var}[   ]*=/{
1331                            :loop1
1332                            /\\\\$/ N
1333                            /\\\\$/ b loop1
1334                            s/\\\\\\n//g
1335                            s%^${var}[   ]*=.*$%${var} = ${val}%
1336                            }" ${Makefile} > ${Makefile}.tem
1337                     mv -f ${Makefile}.tem ${Makefile}
1338                 done
1339             fi
1340
1341             # final copy now in ${Makefile}
1342
1343         else
1344            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1345         fi
1346
1347         rm -f ${subdir}/Makefile.tem
1348
1349         case "${host_makefile_frag}" in
1350         "") using= ;;
1351         *) using="and \"${host_makefile_frag}\"" ;;
1352         esac
1353
1354         case "${target_makefile_frag}" in
1355         "") ;;
1356         *) using="${using} and \"${target_makefile_frag}\"" ;;
1357         esac
1358
1359         case "${site_makefile_frag}" in
1360         "") ;;
1361         *) using="${using} and \"${site_makefile_frag}\"" ;;
1362         esac
1363
1364         newusing=`echo "${using}" | sed 's/and/using/'`
1365         using=${newusing}
1366         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1367
1368         . ${tmpfile}.pos
1369
1370         # describe the chosen configuration in config.status.
1371         # Make that file a shellscript which will reestablish
1372         # the same configuration.  Used in Makefiles to rebuild
1373         # Makefiles.
1374
1375         case "${norecursion}" in
1376         "") arguments="${arguments} --norecursion" ;;
1377         *) ;;
1378         esac
1379
1380         if [ ${subdir} = . ] ; then
1381             echo "#!/bin/sh
1382 # ${NO_EDIT}
1383 # This directory was configured as follows:
1384 ${progname}" ${arguments}  "
1385 # ${using}" > ${subdir}/config.new
1386         else
1387             echo "#!/bin/sh
1388 # ${NO_EDIT}
1389 # This directory was configured as follows:
1390 cd ${invsubdir}
1391 ${progname}" ${arguments}  "
1392 # ${using}" > ${subdir}/config.new
1393         fi
1394         chmod a+x ${subdir}/config.new
1395         if [ -r ${subdir}/config.back ] ; then
1396                 mv -f ${subdir}/config.back ${subdir}/config.status
1397         fi
1398         ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1399         ;;
1400
1401     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1402     esac
1403 done
1404
1405 # If there are subdirectories, then recur.
1406 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
1407         for configdir in ${configdirs} ; do
1408
1409                 if [ -d ${srcdir}/${configdir} ] ; then
1410                         eval echo Configuring ${configdir}... ${redirect}
1411                         case "${srcdir}" in
1412                         ".") ;;
1413                         *)
1414                                 if [ ! -d ./${configdir} ] ; then
1415                                         if mkdir ./${configdir} ; then
1416                                                 true
1417                                         else
1418                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1419                                                 exit 1
1420                                         fi
1421                                 fi
1422                                 ;;
1423                         esac
1424
1425                         POPDIR=${PWD=`pwd`}
1426                         cd ${configdir} 
1427
1428 ### figure out what to do with srcdir
1429                         case "${srcdir}" in
1430                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
1431                         /*) # absolute path
1432                                 newsrcdir=${srcdir}/${configdir}
1433                                 srcdiroption="--srcdir=${newsrcdir}"
1434                                 ;;
1435                         ?:*) # absolute path on win32
1436                                 newsrcdir=${srcdir}/${configdir}
1437                                 srcdiroption="--srcdir=${newsrcdir}"
1438                                 ;;
1439                         *) # otherwise relative
1440                                 newsrcdir=../${srcdir}/${configdir}
1441                                 srcdiroption="--srcdir=${newsrcdir}"
1442                                 ;;
1443                         esac
1444
1445                         # Handle --cache-file=../XXX
1446                         case "${cache_file}" in
1447                         "") # empty
1448                                 ;;
1449                         /*) # absolute path
1450                                 cache_file_option="--cache-file=${cache_file}"
1451                                 ;;
1452                         ?:*) # absolute path on win32
1453                                 cache_file_option="--cache-file=${cache_file}"
1454                                 ;;
1455                         *) # relative path
1456                                 cache_file_option="--cache-file=../${cache_file}"
1457                                 ;;
1458                         esac
1459
1460 ### check for guested configure, otherwise fix possibly relative progname
1461                         if [ -f ${newsrcdir}/configure ] ; then
1462                                 recprog=${newsrcdir}/configure
1463                         elif [ -f ${newsrcdir}/configure.in ] ; then
1464                                 case "${progname}" in
1465                                 /*)     recprog=${progname} ;;
1466                                 ?:*)    recprog=${progname} ;;
1467                                 *)      recprog=../${progname} ;;
1468                                 esac
1469                         else
1470                                 eval echo No configuration information in ${configdir} ${redirect}
1471                                 recprog=
1472                         fi
1473
1474 ### The recursion line is here.
1475                         if [ ! -z "${recprog}" ] ; then
1476                                 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1477                                         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1478                                         ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1479                                         true
1480                                 else
1481                                         echo Configure in `pwd` failed, exiting. 1>&2
1482                                         exit 1
1483                                 fi
1484                         fi
1485
1486                         cd ${POPDIR}
1487                 fi
1488         done
1489 fi
1490
1491 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1492 # and reset the trap handler.
1493 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1494 trap 0
1495
1496 exit 0
1497
1498 #
1499 # Local Variables:
1500 # fill-column: 131
1501 # End:
1502 #
1503
1504 # end of configure