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