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