* ecofflink.c (bfd_ecoff_debug_externals): If a small undefined
[external/binutils.git] / configure
1 #!/bin/sh
2
3 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
4
5 # Configuration script
6 #   Copyright (C) 1988, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 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 # This file was written by K. Richard Pixley.
26
27 #
28 # Shell script to create proper links to machine-dependent files in
29 # preparation for compilation.
30 #
31 # If configure succeeds, it leaves its status in config.status.
32 # If configure fails after disturbing the status quo, 
33 #       config.status is removed.
34 #
35
36 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
37
38 remove=rm
39 hard_link=ln
40 symbolic_link='ln -s'
41
42 #for Test
43 #remove="echo rm"
44 #hard_link="echo ln"
45 #symbolic_link="echo ln -s"
46
47 # clear some things potentially inherited from environment.
48
49 Makefile=Makefile
50 Makefile_in=Makefile.in
51 arguments=$*
52 build_alias=
53 configdirs=
54 exec_prefix=
55 exec_prefixoption=
56 fatal=
57 floating_point=default
58 gas=default
59 host_alias=NOHOST
60 host_makefile_frag=
61 moveifchange=
62 norecursion=
63 package_makefile_frag=
64 prefix=/usr/local
65 progname=
66 program_prefix=
67 program_prefixoption=
68 program_suffix=
69 program_suffixoption=
70 program_transform_name=
71 program_transform_nameoption=
72 redirect=">/dev/null"
73 removing=
74 site=
75 site_makefile_frag=
76 site_option=
77 srcdir=
78 srctrigger=
79 subdirs=
80 target_alias=NOTARGET
81 target_makefile_frag=
82 undefs=NOUNDEFS
83 version="$Revision$"
84 x11=default
85
86 ### we might need to use some other shell than /bin/sh for running subshells
87 #
88 config_shell=${CONFIG_SHELL-/bin/sh}
89
90 NO_EDIT="This file was generated automatically by configure.  Do not edit."
91
92 ## this is a little touchy and won't always work, but...
93 ##
94 ## if the argv[0] starts with a slash then it is an absolute name that can (and
95 ## must) be used as is.
96 ##
97 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
98 ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
99 ##
100
101 progname=$0
102 # if PWD already has a value, it is probably wrong.
103 if [ -n "$PWD" ]; then PWD=`pwd`; fi
104
105 case "${progname}" in
106 /*) ;;
107 */*) ;;
108 *)
109         PATH=$PATH:${PWD=`pwd`} ; export PATH
110         ;;
111 esac
112
113 # Loop over all args
114
115 while :
116 do
117
118 # Break out if there are no more args
119         case $# in
120         0)
121                 break 2
122                 ;;
123         esac
124
125 # Get the first arg, and shuffle
126         option=$1
127         shift
128
129 # Make all options have two hyphens
130         orig_option=$option     # Save original for error messages
131         case $option in
132         --*) ;;
133         -*) option=-$option ;;
134         esac
135                 
136 # Split out the argument for options that take them
137         case $option in
138         --*=*)
139                 optarg=`echo $option | sed -e 's/^[^=]*=//'`
140                 ;;
141 # These options have mandatory values.  Since we didn't find an = sign,
142 # the value must be in the next argument
143         --b* | --e* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm*)
144                 optarg=$1
145                 shift
146                 ;;
147         esac
148
149 # Now, process the options
150         case $option in
151
152         --build* | --b*)
153                 case "$build_alias" in
154                 "") build_alias=$optarg ;;
155                 *) echo '***' Can only configure for one build machine at a time.  1>&2
156                    fatal=yes
157                    ;;
158                 esac
159                 ;;
160         --exec-prefix* | --e*)
161                 exec_prefix=$optarg
162                 exec_prefixoption="--exec-prefix=$optarg"
163                 ;;
164         --gas | --g*)
165                 gas=yes
166                 ;;
167         --help | --he*)
168                 fatal=true
169                 ;;
170         --host* | --ho*)
171                 case $host_alias in
172                 NOHOST) host_alias=$optarg ;;
173                 *) echo '***' Can only configure for one host at a time.  1>&2
174                    fatal=yes
175                    ;;
176                 esac
177                 ;;
178         --nfp | --nf*)
179                 floating_point=no
180                 ;;
181         --norecursion | --no*)
182                 norecursion=true
183                 ;;
184         --prefix* | --pre*)
185                 prefix=$optarg
186                 prefixoption="--prefix=$optarg"
187                 ;;
188         --program-prefix* | --program-p*)
189                 program_prefix=$optarg
190                 program_prefixoption="--program-prefix=$optarg"
191                 ;;
192         --program-suffix* | --program-s*)
193                 program_suffix=$optarg
194                 program_suffixoption="--program-suffix=$optarg"
195                 ;;
196         --program-transform-name* | --program-t*)
197                 # Double any backslashes or dollar signs in the argument
198                 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
199                 program_transform_nameoption="--program-transform-nameoption='$optarg'"
200                 ;;
201         --rm)
202                 removing=--rm
203                 ;;
204         --site* | --si*)
205                 site=$optarg
206                 site_option="--site=$optarg"
207                 ;;
208         --srcdir*/ | --sr*/)
209                 # Remove trailing slashes.  Otherwise, when the file name gets
210                 # bolted into an object file as debug info, it has two slashes in
211                 # it.  Ordinarily this is ok, but emacs takes double slash to
212                 # mean "forget the first part".
213                 srcdir=`echo $optarg | sed -e 's:/$::'`
214                 ;;
215         --srcdir* | --sr*)
216                 srcdir=$optarg
217                 ;;
218         --target* | --ta*)
219                 case $target_alias in
220                 NOTARGET) target_alias=$optarg ;;
221                 *) echo '***' Can only configure for one target at a time.  1>&2
222                    fatal=yes
223                    ;;
224                 esac
225                 ;;
226         --tmpdir* | --tm*)
227                 TMPDIR=$optarg
228                 tmpdiroption="--tmpdir=$optarg"
229                 ;;
230         --verbose | --v | --verb*)
231                 redirect=
232                 verbose=--verbose
233                 ;;
234         --version | --V | --vers*)
235                 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
236                 exit 0
237                 ;;
238         --with-*)
239                 case "$option" in
240                 *=*)    ;;
241                 *)      optarg=yes ;;
242                 esac
243
244                 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
245                 eval $withopt="$optarg"
246                 withoptions="$withoptions $option"
247                 ;;
248         --without-*)
249                 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`                
250                 eval $withopt=no
251                 withoutoptions="$withoutoptions $option"
252                 ;;
253         --x)    ;;
254         --*)
255                 exec 1>&2
256                 echo
257                 echo "Unrecognized option: \"$orig_option\"".
258                 echo
259                 fatal=true
260                 ;;
261         *)
262                 case $undefs in
263                 NOUNDEFS) undefs=$option ;;
264                 *) echo '***' Can only configure for one host and one target at a time.  1>&2
265                    fatal=yes
266                    ;;
267                 esac
268                 ;;
269         esac
270 done
271
272 # process host and target
273
274 # The following section does some error checking, and then does defaulting for
275 # the host and target.  The inputs are host, which comes from the --host
276 # option, target, which comes from the --target options, and undefs, which is
277 # an argument that isn't an option (cuz it doesn't start with --).  Ie:
278 #       configure --host HOST --target TARGET --opt1 UNDEFS --opt2 --opt3 ...
279 #
280 # The first rule is that you aren't allowed to specify --host, --target and
281 # undefs at the same time.  After that, we do defaulting.  The host defaults to
282 # undefs.  Ie:
283 #       configure --target TARGET --opt1 HOST --opt2
284 #
285 # If there are no undefs, the host defaults to the current host (as determined
286 # by config.guess).
287 #
288 # Target defaults to undefs.  If undefs wasn't specified, then it defaults to
289 # host.
290
291 case "${fatal}" in
292 "")
293         # Make sure that host, target & undefs aren't all specified at the
294         # same time.
295         case $host_alias---$target_alias---$undefs in
296         NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
297                 ;;
298         *) echo '***' Can only configure for one host and one target at a time.  1>&2
299            fatal=yes
300            break 2
301                 ;;
302         esac
303
304         # Now, do defaulting for host.
305         case $host_alias in
306         NOHOST)
307                 case $undefs in
308                 NOUNDEFS)
309                         # Neither --host option nor undefs were present.
310                         # Call config.guess.
311                         guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
312                         if host_alias=`${guesssys}`
313                         then
314                                 echo "Configuring for a ${host_alias} host." 1>&2
315                                 arguments="--host=$host_alias $arguments"
316                         else
317                                 echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
318                                 fatal=yes
319                         fi
320                         ;;
321                 *)
322                         host_alias=$undefs
323                         ;;
324                 esac
325         esac
326
327         # Do defaulting for target.  If --target option isn't present, default
328         # to undefs.  If undefs isn't present, default to host.
329         case $target_alias in
330         NOTARGET)
331                 case $undefs in
332                 NOUNDEFS)
333                         target_alias=$host_alias
334                         ;;
335                 *)
336                         target_alias=$undefs
337                         ;;
338                 esac
339         esac
340         ;;
341 *) ;;
342 esac
343
344 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
345         exec 1>&2
346         echo Usage: configure HOST
347         echo
348         echo Options: [defaults in brackets]
349         echo ' --prefix=MYDIR            configure for installation of host dependent files into MYDIR. ["/usr/local"]'
350         echo ' --exec-prefix=MYDIR       configure for installation of host dependent files into MYDIR. ["/usr/local"]'
351         echo ' --help                    print this message. [normal config]'
352         echo ' --build=BUILD             configure for building on BUILD.  [BUILD=HOST]'
353         echo ' --host=HOST               configure for HOST.  [determined via config.guess]'
354         echo ' --norecursion             configure this directory only. [recurse]'
355         echo ' --program-prefix=FOO      install programs with FOO prepended to their names. [ "" ]'
356         echo ' --program-suffix=FOO      install programs with FOO appended to their names. [ "" ]'
357         echo ' --program-transform-name=FOO install programs with names transformed by sed pattern FOO. [ "" ]'
358         echo ' --site=SITE               configure with site specific makefile for SITE'
359         echo ' --srcdir=DIR              find the sources in DIR. ["." or ".."]'
360         echo ' --target=TARGET   configure for TARGET.  [TARGET = HOST]'
361         echo ' --tmpdir=TMPDIR   create temporary files in TMPDIR.  [ TMPDIR = "/tmp" ]'
362         echo ' --nfp                     configure the compilers default to soft floating point. [hard float]'
363         echo ' --with-FOO, --with-FOO=BAR specify that FOO is available'
364         echo ' --without-FOO             specify that FOO is NOT available'
365         echo
366         echo 'Where HOST and TARGET are something like "vax", "sun3", "encore", etc.'
367         echo
368         if [ -r config.status ] ; then
369                 cat config.status
370         fi
371
372         exit 1
373 fi
374
375 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
376 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
377
378 # this is a hack.  sun4 must always be a valid host alias or this will fail.
379 if ${configsub} sun4 >/dev/null 2>&1 ; then
380         true
381 else
382         echo '***' cannot find config.sub.  1>&2
383         exit 1
384 fi
385
386 touch config.junk
387 if ${moveifchange} config.junk config.trash ; then
388         true
389 else
390         echo '***' cannot find move-if-change.  1>&2
391         exit 1
392 fi
393 rm -f config.junk config.trash
394
395 case "${srcdir}" in
396 "")
397         if [ -r configure.in ] ; then
398                 srcdir=.
399         else
400                 if [ -r ${progname}.in ] ; then
401                         srcdir=`echo ${progname} | sed 's:/configure$::'`
402                 else
403                         echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
404                         exit 1
405                 fi
406         fi
407         ;;
408 *) ;;
409 esac
410
411 ### warn about some conflicting configurations.
412
413 case "${srcdir}" in
414 ".") ;;
415 *)
416         if [ -f ${srcdir}/config.status ] ; then
417                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
418                 exit 1
419         fi
420 esac
421
422 # default exec_prefix
423 case "${exec_prefix}" in
424 "") exec_prefix="\$(prefix)" ;;
425 *) ;;
426 esac
427
428 ### break up ${srcdir}/configure.in.
429 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
430 "")
431         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
432         exit 1
433         ;;
434 *) ;;
435 esac
436
437 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
438 "")
439         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
440         exit 1
441         ;;
442 *) ;;
443 esac
444
445 case "${TMPDIR}" in
446 "") TMPDIR=/tmp ; export TMPDIR ;;
447 *) ;;
448 esac
449
450 # keep this filename short for &%*%$*# 14 char file names
451 tmpfile=${TMPDIR}/cONf$$
452 trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
453
454 # split ${srcdir}/configure.in into common, per-host, per-target,
455 # and post-target parts.  Post-target is optional.
456 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
457 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
458 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
459   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
460   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
461 else
462   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
463   echo >${tmpfile}.pos
464 fi
465
466 ### do common part of configure.in
467
468 . ${tmpfile}.com
469
470 # some sanity checks on configure.in
471 case "${srctrigger}" in
472 "")
473         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
474         exit 1
475         ;;
476 *) ;;
477 esac
478
479 case "${build_alias}" in
480 "")     ;;
481 *)
482         result=`${configsub} ${build_alias}`
483         buildopt="--build=${build_alias}"
484         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
485         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
486         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
487         build=${build_cpu}-${build_vendor}-${build_os}
488         ;;
489 esac
490
491 result=`${configsub} ${host_alias}`
492 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
493 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
494 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
495 host=${host_cpu}-${host_vendor}-${host_os}
496
497 . ${tmpfile}.hst
498
499 result=`${configsub} ${target_alias}`
500 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
501 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
502 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
503 target=${target_cpu}-${target_vendor}-${target_os}
504
505 . ${tmpfile}.tgt
506
507 # Find the source files, if location was not specified.
508 case "${srcdir}" in
509 "")
510         srcdirdefaulted=1
511         srcdir=.
512         if [ ! -r ${srctrigger} ] ; then
513                 srcdir=..
514         fi
515         ;;
516 *) ;;
517 esac
518
519 if [ ! -r ${srcdir}/${srctrigger} ] ; then
520         case "${srcdirdefaulted}" in
521         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
522         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
523         esac
524
525         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
526         exit 1
527 fi
528
529 # Some systems (e.g., one of the i386-aix systems the gas testers are
530 # using) don't handle "\$" correctly, so don't use it here.
531 tooldir='$(exec_prefix)'/${target_alias}
532
533 if [ "${host_alias}" != "${target_alias}" ] ; then
534     if [ "${program_prefixoption}" = "" ] ; then
535         if [ "${program_suffixoption}" = "" ] ; then 
536             if [ "${program_transform_nameoption}" = "" ] ; then
537                 program_prefix=${target_alias}- ;
538             fi
539         fi
540     fi
541 fi
542
543 # Merge program_prefix and program_suffix onto program_transform_name
544 # Use a double $ so that make ignores it
545 if [ "${program_suffix}" != "" ] ; then
546     program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
547 fi
548
549 if [ "${program_prefix}" != "" ] ; then
550     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
551 fi
552
553 for subdir in . ${subdirs} ; do
554
555     # ${subdir} is relative path from . to the directory we're currently
556     # configuring.
557     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
558     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
559
560     ### figure out what to do with srcdir
561     case "${srcdir}" in
562         ".")  # no -srcdir option.  We're building in place.
563                 makesrcdir=. ;;
564         /*) # absolute path
565                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
566                 ;;
567         *) # otherwise relative
568                 case "${subdir}" in
569                 .) makesrcdir=${srcdir} ;;
570                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
571                 esac
572                 ;;
573     esac
574
575     if [ "${subdir}/" != "./" ] ; then
576         Makefile=${subdir}/Makefile
577     fi
578
579     if [ ! -d ${subdir} ] ; then
580         if mkdir ${subdir} ; then
581                 true
582         else
583                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
584                 exit 1
585         fi
586     fi
587
588     case "${removing}" in
589     "")
590         case "${subdir}" in
591         .) ;;
592         *) eval echo Building in ${subdir} ${redirect} ;;
593         esac
594
595         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
596         # Set up the list of links to be made.
597         # ${links} is the list of link names, and ${files} is the list of names to link to.
598
599         # Make the links.
600         configlinks="${links}"
601         if [ -r ${subdir}/config.status ] ; then
602                 mv -f ${subdir}/config.status ${subdir}/config.back
603         fi
604         while [ -n "${files}" ] ; do
605                 # set file to car of files, files to cdr of files
606                 set ${files}; file=$1; shift; files=$*
607                 set ${links}; link=$1; shift; links=$*
608
609                 if [ ! -r ${srcdir}/${file} ] ; then
610                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
611                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
612                         exit 1
613                 fi
614
615                 ${remove} -f ${link}
616                 # Make a symlink if possible, otherwise try a hard link
617                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
618
619                 if [ ! -r ${link} ] ; then
620                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
621                         exit 1
622                 fi
623
624                 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
625         done
626
627         # Create a .gdbinit file which runs the one in srcdir
628         # and tells GDB to look there for source files.
629
630         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
631                 case ${srcdir} in
632                 .) ;;
633                 *) cat > ${subdir}/.gdbinit <<EOF
634 # ${NO_EDIT}
635 dir .
636 dir ${makesrcdir}
637 source ${makesrcdir}/.gdbinit
638 EOF
639                         ;;
640                 esac
641         fi
642
643         # Install a makefile, and make it set VPATH
644         # if necessary so that the sources are found.
645         # Also change its value of srcdir.
646         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
647         # been somewhat optimized and is perhaps a bit twisty.
648
649         # code is order so as to try to sed the smallest input files we know.
650
651         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
652         # package, target, host, and site.  so do these separately because I don't trust the
653         #  order of sed -e expressions.
654
655         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
656
657             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
658             rm -f ${subdir}/Makefile.tem
659               case "${site}" in
660               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
661               *)
662                       site_makefile_frag=${srcdir}/config/ms-${site}
663
664                       if [ -f ${site_makefile_frag} ] ; then
665                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
666                                       > ${subdir}/Makefile.tem
667                       else
668                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
669                               site_makefile_frag=
670                       fi
671                       ;;
672             esac
673             # working copy now in ${subdir}/Makefile.tem
674
675             # Conditionalize the makefile for this host.
676             rm -f ${Makefile}
677             case "${host_makefile_frag}" in
678               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
679               *)
680                       if [ ! -f ${host_makefile_frag} ] ; then
681                               host_makefile_frag=${srcdir}/${host_makefile_frag}
682                       fi
683                       if [ -f ${host_makefile_frag} ] ; then
684                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
685                       else
686                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
687                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
688                               mv ${subdir}/Makefile.tem ${Makefile}
689                       fi
690             esac
691             # working copy now in ${Makefile}
692
693             # Conditionalize the makefile for this target.
694             rm -f ${subdir}/Makefile.tem
695             case "${target_makefile_frag}" in
696               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
697               *)
698                       if [ ! -f ${target_makefile_frag} ] ; then
699                               target_makefile_frag=${srcdir}/${target_makefile_frag}
700                       fi
701                       if [ -f ${target_makefile_frag} ] ; then
702                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
703                       else
704                               mv ${Makefile} ${subdir}/Makefile.tem
705                               target_makefile_frag=
706                       fi
707                       ;;
708             esac
709             # real copy now in ${subdir}/Makefile.tem
710
711             # Conditionalize the makefile for this package.
712             rm -f ${Makefile}
713             case "${package_makefile_frag}" in
714               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
715               *)
716                       if [ ! -f ${package_makefile_frag} ] ; then
717                               package_makefile_frag=${srcdir}/${package_makefile_frag}
718                       fi
719                       if [ -f ${package_makefile_frag} ] ; then
720                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
721                       else
722                               echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
723                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
724                               mv ${subdir}/Makefile.tem ${Makefile}
725                       fi
726             esac
727             # working copy now in ${Makefile}
728
729             mv ${Makefile} ${subdir}/Makefile.tem
730
731             # real copy now in ${subdir}/Makefile.tem
732
733             # prepend warning about editting, and a bunch of variables.
734             rm -f ${Makefile}
735             cat > ${Makefile} <<EOF
736 # ${NO_EDIT}
737 VPATH = ${makesrcdir}
738 links = ${configlinks}
739 host_alias = ${host_alias}
740 host_cpu = ${host_cpu}
741 host_vendor = ${host_vendor}
742 host_os = ${host_os}
743 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
744 target_alias = ${target_alias}
745 target_cpu = ${target_cpu}
746 target_vendor = ${target_vendor}
747 target_os = ${target_os}
748 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
749 EOF
750             case "${build}" in
751               "") ;;
752               *)  cat >> ${Makefile} << EOF
753 build_alias = ${build_alias}
754 build_cpu = ${build_cpu}
755 build_vendor = ${build_vendor}
756 build_os = ${build_os}
757 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
758 EOF
759             esac
760
761             case "${package_makefile_frag}" in
762               "") ;;
763               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
764               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
765             esac
766
767             case "${target_makefile_frag}" in
768               "") ;;
769               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
770               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
771             esac
772
773             case "${host_makefile_frag}" in
774               "") ;;
775               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
776               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
777             esac
778
779             if [ "${site_makefile_frag}" != "" ] ; then
780                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
781             fi 
782
783             # make sure that some sort of reasonable default exists for these 
784             # two variables
785             CXX=${CXX-"g++ -O"}
786             CC=${CC-cc}
787
788             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
789             # remove any form feeds.
790             if [ -z "${subdirs}" ]; then
791                 rm -f ${subdir}/Makefile.tem2
792                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
793                     -e "s:^NONSUBDIRS[  ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
794                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
795                 rm -f ${subdir}/Makefile.tem
796                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
797             fi
798             sed -e "s:^prefix[  ]*=.*$:prefix = ${prefix}:" \
799                     -e "s:^exec_prefix[         ]*=.*$:exec_prefix = ${exec_prefix}:" \
800                     -e "s:^SHELL[        ]*=.*$:SHELL = ${config_shell}:" \
801                     -e "s:^srcdir[      ]*=.*$:srcdir = ${makesrcdir}:" \
802                     -e "s/\f//" \
803                     -e "s:^program_prefix[      ]*=.*$:program_prefix = ${program_prefix}:" \
804                     -e "s:^program_suffix[      ]*=.*$:program_suffix = ${program_suffix}:" \
805                     -e "s:^program_transform_name[      ]*=.*$:program_transform_name = ${program_transform_name}:" \
806                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
807                     ${subdir}/Makefile.tem >> ${Makefile}
808             # final copy now in ${Makefile}
809
810         else
811            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
812         fi
813
814         rm -f ${subdir}/Makefile.tem
815
816         case "${host_makefile_frag}" in
817         "") using= ;;
818         *) using="and \"${host_makefile_frag}\"" ;;
819         esac
820
821         case "${target_makefile_frag}" in
822         "") ;;
823         *) using="${using} and \"${target_makefile_frag}\"" ;;
824         esac
825
826         case "${site_makefile_frag}" in
827         "") ;;
828         *) using="${using} and \"${site_makefile_frag}\"" ;;
829         esac
830
831         newusing=`echo "${using}" | sed 's/and/using/'`
832         using=${newusing}
833         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
834
835         . ${tmpfile}.pos
836
837         # describe the chosen configuration in config.status.
838         # Make that file a shellscript which will reestablish
839         # the same configuration.  Used in Makefiles to rebuild
840         # Makefiles.
841
842         case "${norecursion}" in
843         "") arguments="${arguments} --norecursion" ;;
844         *) ;;
845         esac
846
847         if [ ${subdir} = . ] ; then
848             echo "#!/bin/sh
849 # ${NO_EDIT}
850 # This directory was configured as follows:
851 ${progname}" ${arguments}  "
852 # ${using}" > ${subdir}/config.new
853         else
854             echo "#!/bin/sh
855 # ${NO_EDIT}
856 # This directory was configured as follows:
857 cd ${invsubdir}
858 ${progname}" ${arguments}  "
859 # ${using}" > ${subdir}/config.new
860         fi
861         chmod a+x ${subdir}/config.new
862         if [ -r ${subdir}/config.back ] ; then
863                 mv -f ${subdir}/config.back ${subdir}/config.status
864         fi
865         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
866         ;;
867
868     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
869     esac
870 done
871
872 # If there are subdirectories, then recur. 
873 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
874         for configdir in ${configdirs} ; do
875
876                 if [ -d ${srcdir}/${configdir} ] ; then
877                         eval echo Configuring ${configdir}... ${redirect}
878                         case "${srcdir}" in
879                         ".") ;;
880                         *)
881                                 if [ ! -d ./${configdir} ] ; then
882                                         if mkdir ./${configdir} ; then
883                                                 true
884                                         else
885                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
886                                                 exit 1
887                                         fi
888                                 fi
889                                 ;;
890                         esac
891
892                         POPDIR=${PWD=`pwd`}
893                         cd ${configdir} 
894
895 ### figure out what to do with srcdir
896                         case "${srcdir}" in
897                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
898                         /*) # absolute path
899                                 newsrcdir=${srcdir}/${configdir}
900                                 srcdiroption="--srcdir=${newsrcdir}"
901                                 ;;
902                         *) # otherwise relative
903                                 newsrcdir=../${srcdir}/${configdir}
904                                 srcdiroption="--srcdir=${newsrcdir}"
905                                 ;;
906                         esac
907
908 ### check for guested configure, otherwise fix possibly relative progname
909                         if [ -f ${newsrcdir}/configure ] ; then
910                                 recprog=${newsrcdir}/configure
911                         elif [ -f ${newsrcdir}/configure.in ] ; then
912                                 case "${progname}" in
913                                 /*)     recprog=${progname} ;;
914                                 *)      recprog=../${progname} ;;
915                                 esac
916                         else
917                                 eval echo No configuration information in ${configdir} ${redirect}
918                                 recprog=
919                         fi
920
921 ### The recursion line is here.
922                         if [ ! -z "${recprog}" ] ; then
923                                 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
924                                         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
925                                         ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${removing} ${redirect} ; then
926                                         true
927                                 else
928                                         exit 1
929                                 fi
930                         fi
931
932                         cd ${POPDIR}
933                 fi
934         done
935 fi
936
937 exit 0
938
939 #
940 # Local Variables:
941 # fill-column: 131
942 # End:
943 #
944
945 # end of configure