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