OSDN Git Service

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