In configure{.in} {host|target}_makefile_frag should name a file
[platform/upstream/binutils.git] / configure
1 #!/bin/sh
2
3 # Configuration script
4 #   Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
5
6 #This file is part of GNU.
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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
21
22 # Please email any bugs, comments, and/or additions to this file to:
23 # configure@cygnus.com
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 # NOTE: This script contains support for a Cygnus experimental feature, called
35 # +subdirs, which is currently, tentatively, de-supported.
36
37 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
38
39 remove=rm
40 hard_link=ln
41 symbolic_link='ln -s'
42
43 #for Test
44 #remove="echo rm"
45 #hard_link="echo ln"
46 #symbolic_link="echo ln -s"
47
48 # clear some things potentially inherited from environment.
49
50 Makefile=Makefile
51 Makefile_in=Makefile.in
52 arguments=$*
53 commontargets=
54 configdirs=
55 datadir=
56 datadiroption=
57 defaulttargets=
58 fatal=
59 floating_point=default
60 gas=default
61 host_makefile_frag=
62 hosts=
63 next_host=
64 next_prefix=
65 next_site=
66 next_srcdir=
67 next_target=
68 next_tmpdir=
69 norecursion=
70 prefix=/usr/local
71 progname=
72 recurring=
73 removing=
74 site_makefile_frag=
75 srcdir=
76 srctrigger=
77 target=
78 target_makefile_frag=
79 targets=
80 undefinedargs=
81 verbose=
82 version="$Revision$"
83 x11=default
84
85 NO_EDIT="This file was generated automatically by configure.  Do not edit."
86
87 ## this is a little touchy and won't always work, but...
88 ##
89 ## if the argv[0] starts with a slash then it is an absolute name that can be
90 ## used as is.
91 ##
92 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
93 ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
94 ##
95 ## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
96 ## path.
97 ##
98
99 PWD=`pwd`
100
101 if echo $0 | grep '^/' > /dev/null ; then
102         progname=$0
103 elif echo $0 | grep '/' > /dev/null ; then
104         progname=${PWD}/$0
105 else
106         progname=$0
107         PATH=$PATH:${PWD} ; export PATH
108 fi
109
110 for arg in $*;
111 do
112         # handle things that might have args following as separate words
113         if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
114         elif [ -n "${next_datadir}" ] ; then datadir=${arg} ; datadiroption="-datadir=${datadir}" ; next_datadir=
115         elif [ -n "${next_site}" ] ; then site=${arg} ; next_site=
116         elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir=                
117         elif [ -n "${next_target}" ] ; then
118                 next_target=
119                 case "${targets}" in
120                 "")
121                         newtargets="${targets} ${arg}"
122                         targets="${newtargets}"
123                         ;;
124                 *)
125                         echo '***' Can only configure for one target at a time.
126                         fatal=yes
127                         ;;
128                 esac
129         elif [ -n "${next_tmpdir}" ] ; then
130                 next_tmpdir=
131                 tmpdiroption="--tmpdir=${arg}"
132                 TMPDIR=${arg}
133
134         else
135                 case ${arg} in
136                 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* | --da=* | --d=*)
137                         datadir=`echo ${arg} | sed 's/^[-a-z]*=//'`
138                         datadiroption=${arg}
139                         ;;
140                 -datadir | --datadir | --datadi | --datad | --data | --dat | --da | --d)
141                         next_datadir=yes
142                         ;;
143                 -gas | --g*)
144                         gas=yes
145                         ;;
146                 -help | --he*)
147                         fatal=true
148                         ;;
149                 -host=* | --host=* | --hos=* | --ho=*)
150                         case "${hosts}" in
151                         "")
152                                 newhosts="${hosts} `echo ${arg} | sed 's/^[-a-z]*=//'`"
153                                 hosts="${newhosts}"
154                                 ;;
155                         *)
156                                 echo '***' Can only configure for one host at a time.
157                                 fatal=yes
158                                 ;;
159                         esac
160                         ;;
161                 -nfp | --nf*)
162                         floating_point=no
163                         ;;
164                 -norecursion | --no*)
165                         norecursion=true
166                         ;;
167                 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
168                         prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
169                         prefixoption=${arg}
170                         ;;
171                 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
172                         next_prefix=yes
173                         ;;
174                 -recurring | --recurring | --recurrin | --recurri | --recurr | --recur | --recu | --rec | --re)
175                         recurring=true
176                         arguments=`echo ${arguments} | sed "s:${arg}::"`
177                         ;;
178                 -rm | --rm)
179                         removing=${arg}
180                         ;;
181                 -site=* | --site=* | --sit=* | --si=*)
182                         site=`echo ${arg} | sed 's/^[-a-z]*=//'`
183                         ;;
184                 -site | --site | --sit | --si)
185                         next_site=yes
186                         ;;
187                 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
188                         srcdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
189                         ;;
190                 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
191                         next_srcdir=yes
192                         ;;
193                 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
194                         case "${targets}" in
195                         "")
196                                 newtargets="${targets} `echo ${arg} | sed 's/^[-a-z]*=//'`"
197                                 targets="${newtargets}"
198                                 ;;
199                         *)
200                                 echo '***' Can only configure for one target at a time.
201                                 fatal=yes
202                                 ;;
203                         esac
204                         ;;
205                 -target | --target | --targe | --targ | --tar | --ta)
206                         next_target=yes
207                         ;;
208                 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
209                         tmpdiroption=${arg}
210                         TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
211                         ;;
212                 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
213                         next_tmpdir=yes
214                         ;;
215                 -v | -verbose | --v)
216                         verbose=${arg}
217                         ;;
218                 -version | -V | --version | --V)
219                         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
220                         exit 0
221                         ;;
222                 -x | --x) ;;
223                 -* | --*)
224                         (echo ;
225                         echo "Unrecognized option: \"${arg}\"". ;
226                         echo) 1>&2
227                         fatal=true
228                         ;;
229                 *)
230                         case "${undefs}" in
231                         "")
232                                 newundefs="${undefs} ${arg}"
233                                 undefs=${newundefs}
234                                 ;;
235                         *)
236                                 echo '***' Can only configure for one host and one target at a time.
237                                 fatal=yes
238                                 ;;
239                         esac
240                         ;;
241                 esac
242         fi
243 done
244
245 # process host and target
246 case "${fatal}" in
247 "")
248 #       # Complain if an arg is missing
249 #       if [ -z "${hosts}" ] ; then
250 #               (echo ;
251 #               echo "configure: No HOST specified." ;
252 #               echo) 1>&2
253 #               fatal=true
254 #       fi
255
256 ### This is a bit twisted.
257 ### * if all three are specified, this is an error.
258 ### * if we have neither hosts, nor unadorned args, this is an error.
259 ### * if no hosts are specified, then the unadorned args are hosts, but if
260 ### there were none, this is an error.
261 ### * if no targets are specified, then the unadorned args are targets, but if
262 ### there were no unadorned args, then the hosts are also targets.
263
264         if [ -n "${hosts}" -a -n "${targets}" -a -n "${undefs}" ] ; then
265                 echo '***' Can only configure for one host and one target at a time.
266                 fatal=yes
267         elif [ -z "${hosts}" -a -z "${undefs}" ] ; then
268                 echo '***' You must tell me for which host you want to configure.
269                 fatal=yes
270         else
271                 case "${hosts}" in
272                 "") hosts=${undefs} ;;
273                 *) ;;
274                 esac
275
276                 case "${targets}" in
277                 "")
278                         case "${undefs}" in
279                         "")     targets=${hosts} ;;
280                         *)      targets=${undefs} ;;
281                         esac
282                         ;;
283                 *) ;;
284                 esac
285         fi
286         ;;
287 *) ;;
288 esac
289
290 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
291         (echo "Usage: configure HOST" ;
292         echo ;
293         echo "Options: [defaults in brackets]" ;
294         echo " -datadir=MYDIR   configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
295         echo " -gas             configure the compilers for use with gas. [native as]" ;
296         echo " -help            print this message. [normal config]" ;
297         echo " -lang=LANG       configure to build LANG. [gcc]" ;
298         echo " -nfp             configure the compilers default to soft floating point. [hard float]" ;
299         echo " -norecursion     configure this directory only. [recurse]" ;
300         echo " -prefix=MYDIR    configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
301         echo " -rm              remove this configuration. [build a configuration]" ;
302         echo " -site            configure with site specific makefile" ;
303         echo " -srcdir=DIR      find the sources in DIR. [\".\" or \"..\"]" ;
304         echo " -target=TARGET   configure for TARGET.  [TARGET = HOST]" ;
305         echo " -tmpdir=TMPDIR   create temporary files in TMPDIR.  [ TMPDIR = \"/tmp\" ]" ;
306         echo ;
307         echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
308         ) 1>&2
309
310         if [ -r config.status ] ; then
311                 cat config.status
312         fi
313
314         exit 1
315 fi
316
317 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
318
319 if ${configsub} `echo ${hosts} | sed -e 's/ .*//'` >/dev/null 2>&1 ; then
320         true
321 else
322         echo '***' cannot find config.sub.
323         exit 1
324 fi
325
326 case "${srcdir}" in
327 "")
328         if [ -r configure.in ] ; then
329                 srcdir=.
330         else
331                 echo '***' "Can't find configure.in.  Try using -srcdir=some_dir"
332                 exit 1
333         fi
334         ;;
335 *) ;;
336 esac
337
338
339 # default datadir
340 case "${datadir}" in
341 "") datadir="$(prefix)/lib" ;;
342 *) ;;
343 esac
344
345 ### break up ${srcdir}/configure.in.
346 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
347 "")
348         echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
349         exit 1
350         ;;
351 *) ;;
352 esac
353
354 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
355 "")
356         echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
357         exit 1
358         ;;
359 *) ;;
360 esac
361
362 case "${TMPDIR}" in
363 "") TMPDIR=/tmp ; export TMPDIR ;;
364 *) ;;
365 esac
366
367 # keep this filename short for &%*%$*# 14 char file names
368 tmpfile=${TMPDIR}/cONf$$
369 trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
370
371 # split ${srcdir}/configure.in into common, per-host, per-target,
372 # and post-target parts.  Post-target is optional.
373 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
374 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
375 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
376   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
377   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
378 else
379   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
380   echo >${tmpfile}.pos
381 fi
382
383 ### do common part of configure.in
384
385 . ${tmpfile}.com
386
387 # some sanity checks on configure.in
388 case "${srctrigger}" in
389 "")
390         echo '***' srctrigger not set in ${PWD}/configure.in.
391         exit 1
392         ;;
393 *) ;;
394 esac
395
396 for host in ${hosts} ; do
397         # Default other arg
398         if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
399                 targets=${host}
400                 defaulttargets=true
401         fi
402
403         host_alias=${host}
404
405         result=`${configsub} ${host}`
406         host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
407         host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
408         host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
409         host=${host_cpu}-${host_vendor}-${host_os}
410
411         . ${tmpfile}.hst
412
413         for target in ${targets} ; do
414
415                 target_alias=${target}
416                 result=`${configsub} ${target}`
417                 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
418                 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
419                 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
420                 target=${target_cpu}-${target_vendor}-${target_os}
421
422                 . ${tmpfile}.tgt
423
424                 case "${host_alias}" in
425                 "${target_alias}")      subdirname=H-${host_alias} ;;
426                 *)                      subdirname=X-${host_alias}-${target_alias} ;;
427                 esac
428
429                 case "${namesubdir}" in
430                 "") ;;
431                 *) subdirname=${namesubdir} ;;
432                 esac
433
434                 case "${removing}" in
435                 "")
436                         # Find the source files, if location was not specified.
437                         case "${srcdir}" in
438                         "")
439                                 srcdirdefaulted=1
440                                 srcdir=.
441                                 if [ ! -r ${srctrigger} ] ; then
442                                         srcdir=..
443                                 fi
444                                 ;;
445                         *) ;;
446                         esac
447
448                         if [ ! -r ${srcdir}/${srctrigger} ] ; then
449                                 case "${srcdirdefaulted}" in
450                                 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
451                                 *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
452                                 esac
453
454                                 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
455                                 exit 1
456                         fi
457
458                         # Set up the list of links to be made.
459                         # ${links} is the list of link names, and ${files} is the list of names to link to.
460
461                         # Make the links.
462                         while [ -n "${files}" ] ; do
463                                 # set file to car of files, files to cdr of files
464                                 set ${files}; file=$1; shift; files=$*
465                                 set ${links}; link=$1; shift; links=$*
466
467                                 if [ ! -r ${srcdir}/${file} ] ; then
468                                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
469                                         echo '***' "since the file \"${file}\" does not exist." 1>&2
470                                         exit 1
471                                 fi
472
473                                 ${remove} -f ${link}
474                                 rm -f config.status
475                                 # Make a symlink if possible, otherwise try a hard link
476                                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
477
478                                 if [ ! -r ${link} ] ; then
479                                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
480                                         exit 1
481                                 fi
482
483                                 case "${verbose}" in
484                                 "") ;;
485                                 *)  echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
486                                 esac
487                         done
488
489                         # Create a .gdbinit file which runs the one in srcdir
490                         # and tells GDB to look there for source files.
491
492                         if [ -r ${srcdir}/.gdbinit ] ; then
493                                 case ${srcdir} in
494                                 .)
495                                         ;;
496                                 *) cat > .gdbinit <<EOF
497 # ${NO_EDIT} > .gdbinit
498 dir .
499 dir ${srcdir}
500 source ${srcdir}/.gdbinit
501 EOF
502                                         ;;
503                                 esac
504                         fi
505
506                         # Install a makefile, and make it set VPATH
507                         # if necessary so that the sources are found.
508                         # Also change its value of srcdir.
509                         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
510                         # been somewhat optimized and is perhaps a bit twisty.
511
512                         # code is order so as to try to sed the smallest input files we know.
513
514                         # the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site.
515                         # so do these separately because I don't trust the order of sed -e expressions.
516
517                         # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
518                         case "${site}" in
519                         "") cp ${srcdir}/${Makefile_in} Makefile.tem ;;
520                         *)
521                                 site_makefile_frag=${srcdir}/config/ms-${site}
522
523                                 if [ -f ${site_makefile_frag} ] ; then
524                                         sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \
525                                                 >> Makefile.tem
526                                 else
527                                         cp ${srcdir}/${Makefile_in} Makefile.tem
528                                         site_makefile_frag=
529                                 fi
530                                 ;;
531                         esac
532                         # working copy now in Makefile.tem
533
534                         # Conditionalize the makefile for this host.
535                         case "${host_makefile_frag}" in
536                         "") mv Makefile.tem ${Makefile} ;;
537                         *)
538                                 host_makefile_frag=${srcdir}/${host_makefile_frag}
539                                 if [ -f ${host_makefile_frag} ] ; then
540                                         sed -e "/^####/  r ${host_makefile_frag}" Makefile.tem > ${Makefile}
541                                 else
542                                         echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
543                                         echo '***' is missing in ${PWD}. 1>&2
544                                         mv Makefile.tem ${Makefile}
545                                 fi
546                         esac
547                         # working copy now in ${Makefile}
548
549                         # Conditionalize the makefile for this target.
550                         case "${target_makefile_frag}" in
551                         "") mv ${Makefile} Makefile.tem ;;
552                         *)
553                                 target_makefile_frag=${srcdir}/${target_makefile_frag}
554                                 if [ -f ${target_makefile_frag} ] ; then
555                                         sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} >> Makefile.tem
556                                 else
557                                         mv ${Makefile} Makefile.tem
558                                         target_makefile_frag=
559                                 fi
560                                 ;;
561                         esac
562                         # real copy now in Makefile.tem
563
564                         # prepend warning about editting, and a bunch of variables.
565                         # fixme-someday: remove the subdir/unsubdir lines.
566                         cat > ${Makefile} <<EOF
567 # ${NO_EDIT}
568 host_alias = ${host_alias}
569 host_cpu = ${host_cpu}
570 host_vendor = ${host_vendor}
571 host_os = ${host_os}
572 target_alias = ${target_alias}
573 target_cpu = ${target_cpu}
574 target_vendor = ${target_vendor}
575 target_os = ${target_os}
576 target_makefile_frag = ${target_makefile_frag}
577 host_makefile_frag = ${host_makefile_frag}
578 site_makefile_frag = ${site_makefile_frag}
579 VPATH = ${srcdir}
580 subdir =
581 unsubdir = .
582 EOF
583
584                         # fixme: this shouldn't be in configure.
585                         # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
586                         case "${host}" in
587                         "${target}") echo "ALL=all.internal" >> ${Makefile} ;;
588                         *)
589                                 echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
590                                 echo "ALL=all.cross" >> ${Makefile}
591                                 ;;
592                         esac
593
594                         # reset prefix, datadir, srcdir, SUBDIRS, NONSUBDIRS, remove any form
595                         # feeds.
596                         sed -e "s:^prefix[      ]*=.*$:prefix = ${prefix}:" \
597                                 -e "s:^datadir[         ]*=.*$:datadir = ${datadir}:" \
598                                 -e "s:^srcdir[  ]*=.*$:srcdir = ${srcdir}:" \
599                                 -e "s:^SUBDIRS[         ]*=.*$:SUBDIRS = ${configdirs}:" \
600                                 -e "s:^NONSUBDIRS[      ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
601                                 -e "s/\f//" Makefile.tem >> ${Makefile}
602                         # final copy now in ${Makefile}
603
604                         rm Makefile.tem
605
606                         if [ -n "${verbose}" -o -z "${recurring}" ] ; then
607                                 case "${host_makefile_frag}" in
608                                 "") using= ;;
609                                 *) using="and \"${host_makefile_frag}\"" ;;
610                                 esac
611
612                                 case "${target_makefile_frag}" in
613                                 "") ;;
614                                 *) using="${using} and \"${target_makefile_frag}\"" ;;
615                                 esac
616
617                                 case "${site_makefile_frag}" in
618                                 "") ;;
619                                 *) using="${using} and \"${site_makefile_frag}\"" ;;
620                                 esac
621
622                                 echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" | sed 's/and/using/'`
623                         fi
624
625                         . ${tmpfile}.pos
626
627                         # describe the chosen configuration in config.status.
628                         # Make that file a shellscript which will reestablish
629                         # the same configuration.  Used in Makefiles to rebuild
630                         # Makefiles.
631
632                         case "${norecursion}" in
633                         "") arguments="${arguments} -norecursion" ;;
634                         *) ;;
635                         esac
636
637                         echo "#!/bin/sh
638 # ${NO_EDIT}
639 # ${PWD} was configured as follows:
640 ${progname}" ${arguments}  "
641 # ${using}" > config.status
642                         chmod a+x config.status
643                         ;;
644                 *)      rm -f ${Makefile} config.status ${links} ;;
645                 esac
646
647                 # If there are subdirectories, then recur. 
648                 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
649                         for configdir in ${configdirs} ; do
650                                 case "${verbose}" in
651                                 "") ;;
652                                 *) echo Configuring ${configdir}... ;;
653                                 esac
654
655                                 if [ -d ${srcdir}/${configdir} ] ; then
656                                         case "${srcdir}" in
657                                         ".") ;;
658                                         *)
659                                                 if [ ! -d ./${configdir} ] ; then
660                                                         mkdir ./${configdir}
661                                                 fi
662                                                 ;;
663                                         esac
664
665                                         POPDIR=${PWD}
666                                         cd ${configdir} 
667
668 ### figure out what to do with srcdir & guest configure
669                                         case "${srcdir}" in
670                                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
671                                         /*) # absolute path
672                                                 newsrcdir=${srcdir}/${configdir}
673                                                 srcdiroption="-srcdir=${newsrcdir}"
674                                                 ;;
675                                         *) # otherwise relative
676                                                 newsrcdir=../${srcdir}/${configdir}
677                                                 srcdiroption="-srcdir=${newsrcdir}"
678                                                 ;;
679                                         esac
680
681 ### The recursion line is here.
682                                         if [ -f ${newsrcdir}/configure ] ; then
683                                                 recprog=${newsrcdir}/configure
684                                         else
685                                                 recprog=${progname}
686                                         fi
687
688                                         if ${recprog} -recurring ${host_alias} -target=${target_alias} \
689                                                 ${verbose} ${subdirs} ${removing} ${prefixoption} \
690                                                 ${tmpdiroption} ${namesubdiroption} ${datadiroption} \
691                                                 ${srcdiroption} ; then
692                                                 true
693                                         else
694                                                 exit 1
695                                         fi
696
697                                         cd ${POPDIR}
698                                 else
699                                         case "${verbose}" in
700                                         "") ;;
701                                         *) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
702                                         esac
703                                 fi
704                         done
705                 fi
706         done # for each target
707 done # for each host
708
709 ### clean up.
710
711 # trap cmd above handles this now:
712 #rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
713
714 exit 0
715
716 #
717 # Local Variables:
718 # fill-column: 131
719 # End:
720 #
721
722 # end of configure