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