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