61c0dc915c5d1bd04ba0dbeeb55f9f0668bbe152
[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         elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir=
112         elif [ -n "${next_program_prefix}" ] ; then
113                 program_prefix=${arg}
114                 program_prefixoption="-program_prefix=${program_prefix}"
115                 next_program_prefix=
116         elif [ -n "${next_target}" ] ; then
117                 next_target=
118                 case "${target_alias}" in
119                 "")
120                         target_alias="${arg}"
121                         ;;
122                 *)
123                         echo '***' Can only configure for one target at a time.
124                         fatal=yes
125                         ;;
126                 esac
127         elif [ -n "${next_tmpdir}" ] ; then
128                 next_tmpdir=
129                 tmpdiroption="--tmpdir=${arg}"
130                 TMPDIR=${arg}
131
132         else
133                 case ${arg} in
134                 -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
135                         exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
136                         exec_prefixoption=${arg}
137                         ;;
138                 -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
139                         next_exec_prefix=yes
140                         ;;
141                 -gas | --g*)
142                         gas=yes
143                         ;;
144                 -help | --he*)
145                         fatal=true
146                         ;;
147                 -host=* | --host=* | --hos=* | --ho=*)
148                         case "${host_alias}" in
149                         "")
150                                 host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
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=*)
165                         prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
166                         prefixoption=${arg}
167                         ;;
168                 -prefix | --prefix | --prefi | --pref | --pre)
169                         next_prefix=yes
170                         ;;
171                 -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | --program_=* | --program=* | --progra=* | --progr=* | --prog=* | --pro=*)
172                         program_prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
173                         program_prefixoption=${arg}
174                         ;;
175                 -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | --program_ | --program | --progra | --progr | --prog | --pro)
176                         next_program_prefix=yes
177                         ;;
178                 -s | -silent | --silent | --silen | --sile | --sil)
179                         silent=true
180                         arguments=`echo ${arguments} | sed "s:${arg}::"`
181                         ;;
182                 -site=* | --site=* | --sit=* | --si=*)
183                         site=`echo ${arg} | sed 's/^[-a-z]*=//'`
184                         ;;
185                 -site | --site | --sit)
186                         next_site=yes
187                         ;;
188                 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
189                         srcdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
190                         ;;
191                 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
192                         next_srcdir=yes
193                         ;;
194                 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
195                         case "${target_alias}" in
196                         "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
197                         *)
198                                 echo '***' Can only configure for one target at a time.
199                                 fatal=yes
200                                 ;;
201                         esac
202                         ;;
203                 -target | --target | --targe | --targ | --tar | --ta)
204                         next_target=yes
205                         ;;
206                 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
207                         tmpdiroption=${arg}
208                         TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
209                         ;;
210                 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
211                         next_tmpdir=yes
212                         ;;
213                 -v | -verbose | --v)
214                         verbose=${arg}
215                         ;;
216                 -version | -V | --version | --V)
217                         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
218                         exit 0
219                         ;;
220                 -x | --x) ;;
221                 -* | --*)
222                         (echo ;
223                         echo "Unrecognized option: \"${arg}\"". ;
224                         echo) 1>&2
225                         fatal=true
226                         ;;
227                 *)
228                         case "${undefs}" in
229                         "")
230                                 undefs="${arg}"
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 "${host_alias}" ] ; 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 "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ] ; then
262                 echo '***' Can only configure for one host and one target at a time.
263                 fatal=yes
264         elif [ -z "${host_alias}" -a -z "${undefs}" ] ; then
265                 echo '***' You must tell me for which host you want to configure.
266                 fatal=yes
267         else
268                 case "${host_alias}" in
269                 "") host_alias=${undefs} ;;
270                 *) ;;
271                 esac
272
273                 case "${target_alias}" in
274                 "")
275                         case "${undefs}" in
276                         "")     target_alias=${host_alias} ;;
277                         *)      target_alias=${undefs} ;;
278                         esac
279                         ;;
280                 *) ;;
281                 esac
282         fi
283         ;;
284 *) ;;
285 esac
286
287 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
288         (echo "Usage: configure HOST" ;
289         echo ;
290         echo "Options: [defaults in brackets]" ;
291         echo " -exec_prefix=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 " -program_prefix=FOO      install programs with FOO prepended to their names. [ \"\" ]" ;
299         echo " -site=SITE               configure with site specific makefile for SITE" ;
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 ${host_alias} | 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                 if [ -r ${progname}.in ] ; then
329                         srcdir=`echo ${progname} | sed 's:/configure$::'`
330                 else
331                         echo '***' "Can't find configure.in.  Try using -srcdir=some_dir"
332                         exit 1
333                 fi
334         fi
335         ;;
336 *) ;;
337 esac
338
339
340 # default exec_prefix
341 case "${exec_prefix}" in
342 "") exec_prefix="${prefix}" ;;
343 *) ;;
344 esac
345
346 ### break up ${srcdir}/configure.in.
347 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
348 "")
349         echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
350         exit 1
351         ;;
352 *) ;;
353 esac
354
355 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
356 "")
357         echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
358         exit 1
359         ;;
360 *) ;;
361 esac
362
363 case "${TMPDIR}" in
364 "") TMPDIR=/tmp ; export TMPDIR ;;
365 *) ;;
366 esac
367
368 # keep this filename short for &%*%$*# 14 char file names
369 tmpfile=${TMPDIR}/cONf$$
370 trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
371
372 # split ${srcdir}/configure.in into common, per-host, per-target,
373 # and post-target parts.  Post-target is optional.
374 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
375 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
376 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
377   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
378   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
379 else
380   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
381   echo >${tmpfile}.pos
382 fi
383
384 ### do common part of configure.in
385
386 . ${tmpfile}.com
387
388 # some sanity checks on configure.in
389 case "${srctrigger}" in
390 "")
391         echo '***' srctrigger not set in ${PWD}/configure.in.
392         exit 1
393         ;;
394 *) ;;
395 esac
396
397 result=`${configsub} ${host_alias}`
398 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
399 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
400 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
401 host=${host_cpu}-${host_vendor}-${host_os}
402
403 . ${tmpfile}.hst
404
405 result=`${configsub} ${target_alias}`
406 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
407 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
408 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
409 target=${target_cpu}-${target_vendor}-${target_os}
410
411 . ${tmpfile}.tgt
412
413 # Find the source files, if location was not specified.
414 case "${srcdir}" in
415 "")
416         srcdirdefaulted=1
417         srcdir=.
418         if [ ! -r ${srctrigger} ] ; then
419                 srcdir=..
420         fi
421         ;;
422 *) ;;
423 esac
424
425 if [ ! -r ${srcdir}/${srctrigger} ] ; then
426         case "${srcdirdefaulted}" in
427         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
428         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
429         esac
430
431         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
432         exit 1
433 fi
434
435 # Set up the list of links to be made.
436 # ${links} is the list of link names, and ${files} is the list of names to link to.
437
438 # Make the links.
439 configlinks="${links}"
440 while [ -n "${files}" ] ; do
441         # set file to car of files, files to cdr of files
442         set ${files}; file=$1; shift; files=$*
443         set ${links}; link=$1; shift; links=$*
444
445         if [ ! -r ${srcdir}/${file} ] ; then
446                 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
447                 echo '***' "since the file \"${file}\" does not exist." 1>&2
448                 exit 1
449         fi
450
451         ${remove} -f ${link}
452         rm -f config.status
453         # Make a symlink if possible, otherwise try a hard link
454         ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
455
456         if [ ! -r ${link} ] ; then
457                 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
458                 exit 1
459         fi
460
461         case "${verbose}" in
462         "") ;;
463         *)  echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
464         esac
465 done
466
467 # Create a .gdbinit file which runs the one in srcdir
468 # and tells GDB to look there for source files.
469
470 if [ -r ${srcdir}/.gdbinit ] ; then
471         case ${srcdir} in
472         .)
473                 ;;
474         *) cat > .gdbinit <<EOF
475 # ${NO_EDIT} > .gdbinit
476 dir .
477 dir ${srcdir}
478 source ${srcdir}/.gdbinit
479 EOF
480                 ;;
481         esac
482 fi
483
484 # Install a makefile, and make it set VPATH
485 # if necessary so that the sources are found.
486 # Also change its value of srcdir.
487 # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
488 # been somewhat optimized and is perhaps a bit twisty.
489
490 # code is order so as to try to sed the smallest input files we know.
491
492 # the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site.
493 # so do these separately because I don't trust the order of sed -e expressions.
494
495 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
496 case "${site}" in
497 "") cp ${srcdir}/${Makefile_in} Makefile.tem ;;
498 *)
499         site_makefile_frag=${srcdir}/config/ms-${site}
500
501         if [ -f ${site_makefile_frag} ] ; then
502                 sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \
503                         > Makefile.tem
504         else
505                 cp ${srcdir}/${Makefile_in} Makefile.tem
506                 site_makefile_frag=
507         fi
508         ;;
509 esac
510 # working copy now in Makefile.tem
511
512 # Conditionalize the makefile for this host.
513 case "${host_makefile_frag}" in
514 "") mv Makefile.tem ${Makefile} ;;
515 *)
516         host_makefile_frag=${srcdir}/${host_makefile_frag}
517         if [ -f ${host_makefile_frag} ] ; then
518                 sed -e "/^####/  r ${host_makefile_frag}" Makefile.tem > ${Makefile}
519         else
520                 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
521                 echo '***' is missing in ${PWD}. 1>&2
522                 mv Makefile.tem ${Makefile}
523         fi
524 esac
525 # working copy now in ${Makefile}
526
527 # Conditionalize the makefile for this target.
528 case "${target_makefile_frag}" in
529 "") mv ${Makefile} Makefile.tem ;;
530 *)
531         target_makefile_frag=${srcdir}/${target_makefile_frag}
532         if [ -f ${target_makefile_frag} ] ; then
533                 sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > Makefile.tem
534         else
535                 mv ${Makefile} Makefile.tem
536                 target_makefile_frag=
537         fi
538         ;;
539 esac
540 # real copy now in Makefile.tem
541
542 # prepend warning about editting, and a bunch of variables.
543 cat > ${Makefile} <<EOF
544 # ${NO_EDIT}
545 host_alias = ${host_alias}
546 host_cpu = ${host_cpu}
547 host_vendor = ${host_vendor}
548 host_os = ${host_os}
549 target_alias = ${target_alias}
550 target_cpu = ${target_cpu}
551 target_vendor = ${target_vendor}
552 target_os = ${target_os}
553 target_makefile_frag = ${target_makefile_frag}
554 host_makefile_frag = ${host_makefile_frag}
555 site_makefile_frag = ${site_makefile_frag}
556 links = ${configlinks}
557 VPATH = ${srcdir}
558 EOF
559
560 # fixme: this shouldn't be in configure.
561 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
562 case "${host_alias}" in
563 "${target_alias}")
564         tooldir="$(libdir)"
565         echo "ALL=all.internal" >> ${Makefile}
566         ;;
567 *)
568         echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
569         echo "ALL=all.cross" >> ${Makefile}
570         case "${program_prefix}" in
571         "")     program_prefix=${target_alias}- ;;
572         *)      ;;
573         esac
574
575         tooldir="$(libdir)/${target_alias}"
576         ;;
577 esac
578
579 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS, remove any form
580 # feeds.
581 sed -e "s:^prefix[      ]*=.*$:prefix = ${prefix}:" \
582         -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
583         -e "s:^srcdir[  ]*=.*$:srcdir = ${srcdir}:" \
584         -e "s:^SUBDIRS[         ]*=.*$:SUBDIRS = ${configdirs}:" \
585         -e "s:^NONSUBDIRS[      ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
586         -e "s/\f//" \
587         -e "s:^program_prefix[  ]*=.*$:program_prefix = ${program_prefix}:" \
588         -e "s:^tooldir[         ]*=.*$:tooldir = ${tooldir}:" \
589         Makefile.tem >> ${Makefile}
590 # final copy now in ${Makefile}
591
592 rm Makefile.tem
593
594 if [ -n "${verbose}" -o -z "${silent}" ] ; then
595         case "${host_makefile_frag}" in
596         "") using= ;;
597         *) using="and \"${host_makefile_frag}\"" ;;
598         esac
599
600         case "${target_makefile_frag}" in
601         "") ;;
602         *) using="${using} and \"${target_makefile_frag}\"" ;;
603         esac
604
605         case "${site_makefile_frag}" in
606         "") ;;
607         *) using="${using} and \"${site_makefile_frag}\"" ;;
608         esac
609
610         echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" | sed 's/and/using/'`
611 fi
612
613 . ${tmpfile}.pos
614
615 # describe the chosen configuration in config.status.
616 # Make that file a shellscript which will reestablish
617 # the same configuration.  Used in Makefiles to rebuild
618 # Makefiles.
619
620 case "${norecursion}" in
621 "") arguments="${arguments} -norecursion" ;;
622 *) ;;
623 esac
624
625 echo "#!/bin/sh
626 # ${NO_EDIT}
627 # ${PWD} was configured as follows:
628 ${progname}" ${arguments}  "
629 # ${using}" > config.status
630 chmod a+x config.status
631
632 # If there are subdirectories, then recur. 
633 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
634         for configdir in ${configdirs} ; do
635                 case "${verbose}" in
636                 "") ;;
637                 *) echo Configuring ${configdir}... ;;
638                 esac
639
640                 if [ -d ${srcdir}/${configdir} ] ; then
641                         case "${srcdir}" in
642                         ".") ;;
643                         *)
644                                 if [ ! -d ./${configdir} ] ; then
645                                         mkdir ./${configdir}
646                                 fi
647                                 ;;
648                         esac
649
650                         POPDIR=${PWD}
651                         cd ${configdir} 
652
653 ### figure out what to do with srcdir
654                         case "${srcdir}" in
655                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
656                         /*) # absolute path
657                                 newsrcdir=${srcdir}/${configdir}
658                                 srcdiroption="-srcdir=${newsrcdir}"
659                                 ;;
660                         *) # otherwise relative
661                                 newsrcdir=../${srcdir}/${configdir}
662                                 srcdiroption="-srcdir=${newsrcdir}"
663                                 ;;
664                         esac
665
666 ### check for guested configure, otherwise fix possibly relative progname
667                         if [ -f ${newsrcdir}/configure ] ; then
668                                 recprog=${newsrcdir}/configure
669                         else
670                                 case "${progname}" in
671                                 /*)     recprog=${progname} ;;
672                                 *)      recprog=../${progname} ;;
673                                 esac
674                         fi
675
676 ### The recursion line is here.
677                         if ${recprog} -s ${host_alias} -target=${target_alias} \
678                                 ${verbose} ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
679                                 ${srcdiroption} ${program_prefixoption} ; then
680                                 true
681                         else
682                                 exit 1
683                         fi
684
685                         cd ${POPDIR}
686                 else
687                         case "${verbose}" in
688                         "") ;;
689                         *) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
690                         esac
691                 fi
692         done
693 fi
694
695 ### clean up.
696
697 # trap cmd above handles this now:
698 #rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
699
700 exit 0
701
702 #
703 # Local Variables:
704 # fill-column: 131
705 # End:
706 #
707
708 # end of configure