The +noversion flag will make an installation happen to the machine/..
[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 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
37
38 #set -e
39
40 remove=rm
41 hard_link=ln
42 symbolic_link='ln -s'
43
44 #for Test
45 #remove="echo rm"
46 #hard_link="echo ln"
47 #symbolic_link="echo ln -s"
48
49 # clear some things potentially inherited from environment.
50
51 Makefile=Makefile
52 Makefile_in=Makefile.in
53 ansi=
54 arguments=$*
55 commontargets=
56 configdirs=
57 ddestdir=
58 defaulttargets=
59 destdir=
60 fatal=
61 hostsubdir=
62 idestdir=
63 next_ddestdir=
64 next_destdir=
65 next_idestdir=
66 next_objdir=
67 next_site=
68 next_target=
69 next_tmpdir=
70 norecursion=
71 objdir=
72 objdiroption=
73 progname=
74 recurring=
75 removing=
76 srcdir=
77 srctrigger=
78 target=
79 targets=
80 targetsubdir=
81 verbose=
82 version_path="yes"
83 for arg in $*;
84 do
85         # handle things that might have args following as separate words
86         if [ -n "${next_ddestdir}" ] ; then ddestdir=${arg} ; next_ddestdir=
87         elif [ -n "${next_destdir}" ] ; then destdir=${arg} ; next_destdir= ; ddestdir=${destdir} ; idestdir=${destdir}
88         elif [ -n "${next_idestdir}" ] ; then idestdir=${arg} ; next_idestdir=
89         elif [ -n "${next_objdir}" ] ; then objdir=${arg} ; next_objdir=
90         elif [ -n "${next_site}" ] ; then site=${arg} ; next_site=
91         elif [ -n "${next_target}" ] ; then
92                 next_target=
93                 if [ -n "${targets}" ] ; then
94                         subdirs="+subdirs"
95                 fi
96
97                 newtargets="${targets} ${arg}"
98                 targets="${newtargets}"
99
100         elif [ -n "${next_tmpdir}" ] ; then
101                 next_tmpdir=
102                 tmpdiroption="+tmpdir=${arg}"
103                 TMPDIR=${arg}
104
105         else
106                 case ${arg} in
107                 -ansi | +a*)
108                         ansi=true
109                         clib=clib
110                         ;;
111                 -noversion | +noversion)
112                         version_path="no"
113                         ;;
114                 -ddestdir=* | +ddestdir=* | +ddestdi=* | +ddestd=* | +ddest=* | +ddes=* | +dde=* | +dd=*)
115                         ddestdir=`echo ${arg} | sed 's/[+-]dd[a-z]*=//'`
116                         ;;
117                 -ddestdir | +ddestdir | +ddestdi | +ddestd | +ddest | +ddes | +dde | +dd)
118                         next_ddestdir=yes
119                         ;;
120                 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=*)
121                         destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
122                         ddestdir=${destdir}
123                         idestdir=${destdir}
124                         ;;
125                 -destdir | +destdir | +destdi | +destd | +dest | +des | +de)
126                         next_destdir=yes
127                         ;;
128                 -gas | +g*)
129                         gas=yes
130                         ;;
131                 -help | +h*)
132                         fatal=true
133                         ;;
134                 -idestdir=* | +idestdir=* | +idestdi=* | +idestd=* | +idest=* | +ides=* | +ide=* | +id=*)
135                         idestdir=`echo ${arg} | sed 's/[+-]id[a-z]*=//'`
136                         ;;
137                 -idestdir | +idestdir | +idestdi | +idestd | +idest | +ides | +ide | +id)
138                         next_idestdir=yes
139                         ;;
140                 -languages=* | +languages=* | +language=* | +languag=* \
141                         | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
142                         | +l=*)
143                         languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
144                         ;;
145                 -nfp | +nf*)
146                         nfp=yes
147                         ;;
148                 -norecursion | +no*)
149                         norecursion=true
150                         ;;
151                 -objdir=* | +objdir=* | +objdi=* | +objd=* | +obj=* | +ob=* | +o=*)
152                         objdiroption=${arg}
153                         objdir=`echo ${arg} | sed 's/[+-]o[a-z]*=//'`
154                         ;;
155                 -objdir | +objdir | +objdi | +objd | +obj | +ob | +o)
156                         next_objdir=yes
157                         ;;
158                 -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
159                         recurring=true
160                         arguments=`echo ${arguments} | sed "s:${arg}::"`
161                         ;;
162                 -rm | +rm)
163                         removing=${arg}
164                         ;;
165                 -site=* | +site=* | +sit=* | +si=*)
166                         site=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
167                         ;;
168                 -site | +site | +sit | +si)
169                         next_site=yes
170                         ;;
171         #       -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=*)
172         #               srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
173         #               ;;
174                 -subdirs | +su*)
175                         subdirs=${arg}
176                         ;;
177                 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
178                         if [ -n "${targets}" ] ; then
179                                 subdirs="+subdirs"
180                         fi
181
182                         newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
183                         targets="${newtargets}"
184                         ;;
185                 -target | +target | +targe | +targ | +tar | +ta)
186                         next_target=yes
187                         ;;
188                 -tmpdir=* | +tmpdir=* | +tmpdi=* | +tmpd=* | +tmp=* | +tm=*)
189                         tmpdiroption=${arg}
190                         TMPDIR=`echo ${arg} | sed 's/[+-]t[a-z]*=//'`
191                         ;;
192                 -tmpdir | +tmpdir | +tmpdi | +tmpd | +tmp | +tm)
193                         next_tmpdir=yes
194                         ;;
195                 -v | -verbose | +v*)
196                         verbose=${arg}
197                         ;;
198                 -* | +*)
199                         (echo ;
200                         echo "Unrecognized option: \"${arg}\"". ;
201                         echo) 1>&2
202                         fatal=true
203                         ;;
204                 *)
205                         if [ -n "${hosts}" ] ; then
206                                 subdirs="+subdirs"
207                         fi
208
209                         newhosts="${hosts} ${arg}"
210                         hosts=${newhosts}
211                         ;;
212                 esac
213         fi
214 done
215
216 if [ -n "${verbose}" ] ; then
217         echo $0 $*
218 fi
219
220 ## this is a little touchy and won't always work, but...
221 ##
222 ## if the argv[0] starts with a slash then it is an absolute name that can be
223 ## used as is.
224 ##
225 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
226 ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
227 ##
228 ## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
229 ## path.
230 ##
231
232 if (echo $0 | grep '^/' > /dev/null) ; then
233         progname=$0
234 else
235         if (echo $0 | grep '/' > /dev/null) ; then
236                 progname=`pwd`/$0
237         else
238                 progname=$0
239                 PATH=$PATH:`pwd` ; export PATH
240         fi
241 fi
242
243 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
244
245 if ${configsub} none >/dev/null 2>&1 ; then
246         true
247 else
248         echo '***' cannot find config.sub.
249         echo 1
250 fi
251
252 # process host and target only if not removing.
253 if [ -z "${removing}" -a -z "${fatal}" ] ; then
254         # Complain if an arg is missing
255         if [ -z "${hosts}" ] ; then
256                 (echo ;
257                 echo "configure: No HOST specified." ;
258                 echo) 1>&2
259                 fatal=true
260         fi
261 fi
262
263 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
264         (echo "Usage: configure HOST" ;
265         echo ;
266         echo "Options: [defaults in brackets]" ;
267         echo " +ansi            configure w/ANSI library. [no ansi lib]" ;
268         echo " +ddestdir=MYDIR  configure for installation host dependent files" ;
269         echo "                  into MYDIR. [\"/usr/local\"]" ;
270         echo " +idestdir=MYDIR  configure for installation host independent files" ;
271         echo "                  into MYDIR. [\"/usr/local\"]" ;
272         echo " +destdir=MYDIR   configure for installation of both host dependent and" ;
273         echo "                  host independent files into MYDIR. [\"/usr/local\"]" ;
274         echo " +gas             configure the compilers for use with gas. [native as]" ;
275         echo " +help            print this message. [normal config]" ;
276         echo " +lang=LANG       configure to build LANG. [gcc]" ;
277         echo " +nfp             configure the compilers default to soft floating point. [hard float]" ;
278         echo " +norecursion     configure this directory only. [recurse]" ;
279         echo " +objdir=ODIR     configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ;
280         echo " +rm              remove this configuration. [build a configuration]" ;
281         echo " +site            configure with site specific makefile" ;
282 # This is correctly aligned in the output, even though it isn't here.
283         echo " +subdirs configure in subdirectories.  [in source directories]" ;
284         echo " +target=TARGET   configure for TARGET.  [TARGET = HOST]" ;
285         echo " +tmpdir=TMPDIR   create temporary files in TMPDIR.  [ TMPDIR = \"/tmp\" ]" ;
286         echo ;
287         echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
288         echo "Asking for more than one \"+target\" implies \"+subdirs\".  Any other" ;
289         echo "options given will apply to all targets.") 1>&2
290
291         if [ -r config.status ] ; then
292                 cat config.status
293         fi
294
295         exit 1
296 fi
297
298 ### break up configure.in.
299 if [ -r configure.in ] ; then
300         if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
301                 echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
302                 exit 1
303         fi
304
305         if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
306                 echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
307                 exit 1
308         fi
309
310         if [ -z "${TMPDIR}" ] ; then
311                 TMPDIR=/tmp ; export TMPDIR
312         fi
313
314         # keep this filename short for &%*%$*# 14 char file names
315         tmpfile=${TMPDIR}/cONf$$
316
317         # split configure.in into common, per-host, per-target,
318         # and post-target parts.  Post-target is optional.
319         sed -e '/^# per\-host:/,$d' configure.in > ${tmpfile}.com
320         sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > ${tmpfile}.hst
321         if grep '^# post-target:' configure.in >/dev/null ; then
322           sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > ${tmpfile}.tgt
323           sed -e '1,/^# post\-target:/d' configure.in > ${tmpfile}.pos
324         else
325           sed -e '1,/^# per\-target:/d' configure.in > ${tmpfile}.tgt
326           echo >${tmpfile}.pos
327         fi
328
329 else
330         echo '***' No configure.in in `pwd`
331         exit 1
332 fi
333
334 ### do common part of configure.in
335
336 . ${tmpfile}.com
337
338 # some sanity checks on configure.in
339 if [ -z "${srctrigger}" ] ; then
340         echo '***' srctrigger not set in `pwd`/configure.in.
341         exit 1
342 fi
343
344 for host in ${hosts} ; do
345         # Default other arg
346         if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
347                 targets=${host}
348                 defaulttargets=true
349         fi
350
351         host_alias=${host}
352
353         result=`${configsub} ${host}`
354         host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
355         host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
356         host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
357         host=${host_cpu}-${host_vendor}-${host_os}
358         host_makefile_frag=config/mh-${host}
359         if [ ! -f ${host_makefile_frag} ]
360         then
361                 host_makefile_frag=config/mh-${host_alias}
362         fi
363
364         . ${tmpfile}.hst
365
366         for target in ${targets} ; do
367
368                 target_alias=${target}
369                 result=`${configsub} ${target}`
370                 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
371                 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
372                 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
373                 target=${target_cpu}-${target_vendor}-${target_os}
374                 target_makefile_frag=config/mt-${target}
375                 if [ ! -f ${target_makefile_frag} ]
376                 then
377                         target_makefile_frag=config/mt-${target_alias}
378                 fi
379
380                 . ${tmpfile}.tgt
381
382                 hostsubdir=H-${host_alias}
383                 targetsubdir=T-${target_alias}
384
385                 if [ -n "${removing}" ] ; then
386                         if [ -n "${objdir}" ] ; then
387                                 echo '***' +rm not supported for +objdir.  Just \"rm -rf ${objdir}\" by hand.
388                                 exit 1
389                         fi
390
391                         if [ -n "${subdirs}" ] ; then
392                                 if [ -d "${hostsubdir}" ] ; then
393                                         rm -rf ${hostsubdir}/${targetsubdir}
394
395                                         if [ -z "`(ls ${hostsubdir}) 2>&1 | grep T- | grep -v T-independent`" ] ; then
396                                                 rm -rf ${hostsubdir}
397                                         fi
398                                 else
399                                         echo Warning: no `pwd`/${hostsubdir} to remove.
400                                 fi
401                         else
402                                 rm -f ${Makefile} config.status ${links}
403                         fi
404                 else
405                         if [ -n "${objdir}" ]; then
406                                 srcdir=`pwd`
407                                 cd ${objdir}
408                         fi
409
410                         if [ -n "${subdirs}" ] ; then
411                                 # check for existing status before allowing forced subdirs.
412                                 if [ -f ${Makefile} ] ; then
413                                         echo '***' "${Makefile} already exists in source directory.  `pwd` not configured." 1>&2
414                                         exit 1
415                                 fi
416
417                                 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
418                                 cd ${hostsubdir}
419
420                                 if [ ! -d ${targetsubdir} ] ; then
421                                         if [ -z "${commontargets}" ] ; then
422                                                 mkdir ${targetsubdir}
423                                         else
424                                                 if [ ! -d T-independent ] ; then
425                                                         mkdir T-independent
426                                                 fi
427
428                                                 ${symbolic_link} T-independent ${targetsubdir}
429                                         fi # if target independent
430                                 fi # if no target dir yet
431
432                                 cd ${targetsubdir}
433
434                                 if [ -z "${srcdir}" ] ; then
435                                         srcdir=../..
436                                 fi
437                         else
438                                 # if not subdir builds, then make sure none exist.
439                                 if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then
440                                         echo '***' "Configured subdirs exist.  `pwd` not configured." 1>&2
441                                         exit 1
442                                 else
443                                         true
444                                 fi
445                         fi
446
447                         # Find the source files, if location was not specified.
448                         if [ -z "${srcdir}" ] ; then
449                                 srcdirdefaulted=1
450                                 srcdir=.
451                                 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
452                                         srcdir=..
453                                 fi
454                         fi
455
456                         if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
457                                 if [ -z "${srcdirdefaulted}" ] ; then
458                                         echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
459                                 else
460                                         echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
461                                 fi
462
463                                 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
464                                 exit 1
465                         fi
466
467                         # Set up the list of links to be made.
468                         # ${links} is the list of link names, and ${files} is the list of names to link to.
469
470                         # Make the links.
471                         while [ -n "${files}" ] ; do
472                                 # set file to car of files, files to cdr of files
473                                 set ${files}; file=$1; shift; files=$*
474                                 set ${links}; link=$1; shift; links=$*
475
476                                 if [ ! -r ${srcdir}/${file} ] ; then
477                                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
478                                         echo '***' "since the file \"${file}\" does not exist." 1>&2
479                                         exit 1
480                                 fi
481
482                                 ${remove} -f ${link}
483                                 rm -f config.status
484                                 # Make a symlink if possible, otherwise try a hard link
485                                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
486
487                                 if [ ! -r ${link} ] ; then
488                                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
489                                         exit 1
490                                 fi
491
492                                 if [ -n "${verbose}" ] ; then
493                                         echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
494                                 fi
495                         done
496
497                         # Create a .gdbinit file which runs the one in srcdir
498                         # and tells GDB to look there for source files.
499
500                         case ${srcdir} in
501                         .)
502                                 ;;
503                         *)
504                                 echo "dir ." > .gdbinit
505                                 echo "dir ${srcdir}" >> .gdbinit
506                                 echo "source ${srcdir}/.gdbinit" >> .gdbinit
507                                 ;;
508                         esac
509
510                         # Install a makefile, and make it set VPATH
511                         # if necessary so that the sources are found.
512                         # Also change its value of srcdir.
513
514                 # FIXME-someday: This business of always writing to .tem and mv back
515                 # is so that I don't screw things up while developing.  Once this
516                 # template is stable, these should be optimized. xoxorich.
517
518                         # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
519                         if [ "${host}" != "${target}" ] ; then
520                                 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
521                                 echo "ALL=start.encap" >> ${Makefile}
522                         else
523                                 echo "ALL=all.internal" > ${Makefile}
524                         fi
525
526                         # set target, host, VPATH
527                         echo "host_alias = ${host_alias}" >> ${Makefile}
528                         echo "host_cpu = ${host_cpu}" >> ${Makefile}
529                         echo "host_vendor = ${host_vendor}" >> ${Makefile}
530                         echo "host_os = ${host_os}" >> ${Makefile}
531
532                         echo "target_alias = ${target_alias}" >> ${Makefile}
533                         echo "target_cpu = ${target_cpu}" >> ${Makefile}
534                         echo "target_vendor = ${target_vendor}" >> ${Makefile}
535                         echo "target_os = ${target_os}" >> ${Makefile}
536
537                         if [ -n "${subdirs}" ] ; then
538                                 (echo "subdir = /${hostsubdir}/${targetsubdir}" ;
539                                         echo "unsubdir = ../..") >> ${Makefile}
540                         else
541                                 (echo "subdir =" ;
542                                         echo "unsubdir = .") >> ${Makefile}
543                         fi
544
545                 #       echo "workdir = `pwd`" >> ${Makefile}
546                         echo "VPATH = ${srcdir}" >> ${Makefile}
547
548                         # add "Makefile.in" (or whatever it's called)
549                         cat ${srcdir}/${Makefile_in} >> ${Makefile}
550
551                         # Conditionalize the makefile for this site.
552                         if [ -n "${site}" ] ; then
553                                 site_makefile_frag=config/ms-${site}
554
555                                 if [ -f ${srcdir}/${site_makefile_frag} ] ; then
556                                         (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ; 
557                                                 sed -e "/^####/  r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem
558                                 else
559                                         (echo "site_makefile_frag =" ; 
560                                                 cat ${Makefile}) > Makefile.tem
561                                 fi
562                                 mv Makefile.tem ${Makefile}
563                         fi
564
565                         # Conditionalize the makefile for this host.
566                         if [ -f ${srcdir}/${host_makefile_frag} ] ; then
567                                 (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
568                                         sed -e "/^####/  r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
569                         else
570                                 (echo "host_makefile_frag =" ;
571                                         cat ${Makefile}) > Makefile.tem
572                         fi
573                         mv Makefile.tem ${Makefile}
574
575                         # Conditionalize the makefile for this target.
576                         if [ -f ${srcdir}/${target_makefile_frag} ] ; then
577                                 (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; 
578                                         sed -e "/^####/  r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
579                         else
580                                 (echo "target_makefile_frag =" ; 
581                                         cat ${Makefile}) > Makefile.tem
582                         fi
583                         mv Makefile.tem ${Makefile}
584
585                         # set srcdir
586                         sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
587                         mv Makefile.tem ${Makefile}
588
589                         # set ddestdir
590                         if [ -n "${ddestdir}" ] ; then
591                                 sed "s:^ddestdir =.*$:ddestdir = ${ddestdir}:" ${Makefile} > Makefile.tem
592                                 mv Makefile.tem ${Makefile}
593                         fi
594
595                         # set idestdir
596                         if [ -n "${idestdir}" ] ; then
597                                 sed "s:^idestdir =.*$:idestdir = ${idestdir}:" ${Makefile} > Makefile.tem
598                                 mv Makefile.tem ${Makefile}
599                         fi
600
601                         # reset SUBDIRS
602                         sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
603                         mv Makefile.tem ${Makefile}
604
605                         # reset NONSUBDIRS
606                         sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
607                         mv Makefile.tem ${Makefile}
608
609                         # remove any form feeds.
610                         sed -e "s/\f//" ${Makefile} > Makefile.tem
611                         mv Makefile.tem ${Makefile}
612
613                         using=
614                         if [ -f ${srcdir}/${host_makefile_frag} ] ; then
615                                 using="${using} and \"${host_makefile_frag}\""
616                         fi
617                         if [ -f ${srcdir}/${target_makefile_frag} ] ; then
618                                 using="${using} and \"${target_makefile_frag}\""
619                         fi
620                         if [ -n "${site}" -a \
621                              -f ${srcdir}/${site_makefile_frag} ] ; then
622                                 using="${using} and \"${site_makefile_frag}\""
623                         fi
624                         using=`echo "${using}" | sed 's/and/using/'`
625                         using="Created \"${Makefile}\" in `pwd`${using}."
626
627                         if [ -n "${verbose}" -o -z "${recurring}" ] ; then
628                                 echo ${using}
629                         fi
630
631                         . ${tmpfile}.pos
632
633                         # describe the chosen configuration in config.status.
634                         # Make that file a shellscript which will reestablish
635                         # the same configuration.  Used in Makefiles to rebuild
636                         # Makefiles.
637
638                         echo "#!/bin/sh
639 # `pwd` was configured as follows:
640 (cd ${srcdir} ; ${progname}" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` ")
641 # ${using}" > config.status
642                         chmod a+x config.status
643
644                         originaldir=`pwd`
645                         cd ${srcdir}
646                 fi
647
648                 # If there are subdirectories, then recurse. 
649                 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
650                         for configdir in ${configdirs} ; do
651                                 if [ -n "${verbose}" ] ; then
652                                         echo Configuring ${configdir}...
653                                 fi
654
655                                 if [ -d ${configdir} ] ; then
656                                         if [ -n "${objdir}" ] ; then
657                                                 if [ ! -d ${objdir}/${configdir} ] ; then
658                                                         mkdir ${objdir}/${configdir}
659                                                 fi
660                                         fi
661
662                                         POPDIR=`pwd`
663                                         cd ${configdir} 
664
665                                         if (${progname} +recurring ${host_alias} +target=${target_alias} \
666                                                 ${verbose} ${subdirs} ${removing} +ddestdir=${ddestdir} +idestdir=${idestdir} \
667                                                 `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
668                                                 ${tmpdiroption}) ; then
669                                                 true
670                                         else
671                                                 exit 1
672                                         fi
673
674                                         cd ${POPDIR}
675
676 #                                       (cd ${configdir} ;
677 #                                               if (${progname} +recurring ${host_alias} +target=${target_alias} \
678 #                                                       ${verbose} ${subdirs} ${removing} +destdir=${destdir} \
679 #                                                       `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
680 #                                                       ${tmpdiroption}) ; then true ; else exit 1 ; fi) \
681 #                                               | sed 's/^/     /'
682                                 else
683                                         if [ -n "${verbose}" ] ; then
684                                                 echo Warning: directory \"${configdir}\" is missing.
685                                         fi
686                                 fi
687                         done
688                 fi
689         done # for each target
690
691         # Now build a Makefile for this host.
692         if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
693                 push=`pwd`
694
695                 if [ -n "${objdir}" ] ; then
696                         cd ${objdir}
697                 fi
698
699                 cd ${hostsubdir}
700                 cat > GNUmakefile << 'E!O!F'
701 # Makefile generated by configure for host ${host_alias}.
702
703 ALL := $(shell ls -d T-*)
704
705 %:
706         $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
707
708 all:
709 E!O!F
710                 cd ${push}
711         fi
712 done # for each host
713
714 ### clean up.
715
716 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
717
718 exit 0
719
720 #
721 #
722 # $Log$
723 # Revision 1.70  1991/11/13 19:49:17  sac
724 # The +noversion flag will make an installation happen to the machine/..
725 # directory rather than the machine/version/.. directory.
726 #
727 # Steve
728 #
729 # Revision 1.69  1991/11/12  04:41:21  rich
730 # allow +foo bar options.  stolen from texinfo configure
731 #
732 # Revision 1.68  1991/11/09  11:34:52  rich
733 # correct a comment
734 #
735 # Revision 1.67  1991/11/06  22:28:08  rich
736 # pass +idestdir and +ddestdir
737 #
738 # Revision 1.66  1991/11/05  04:02:14  rich
739 # don't allow +recurring to reach config.status
740 #
741 # Revision 1.65  1991/11/01  00:25:28  rich
742 # new install theme
743 #
744 # Revision 1.64  1991/10/30  06:55:25  rich
745 # suck in site makefile frags first
746 #
747 # Revision 1.63  1991/10/25  02:07:18  steve
748 # More name changing
749 #
750 # Revision 1.62  1991/10/24  11:59:03  rich
751 # add null definitions for makefile_frag_foo
752 #
753 # Revision 1.61  1991/10/24  00:23:59  hgs
754 # Allow for using tmake-sun4
755 #
756 # Revision 1.60  1991/10/23  21:48:28  rich
757 # Makefiles should include the makefile frag names even if the makefile
758 # frag doesn't exist in *this* directory.  Otherwise we inherit the
759 # variable setting from our parent Makefile.
760 #
761 # Revision 1.59  1991/10/16  19:53:31  gnu
762 # Update for SCO problems.
763 #
764 # * Fix "Larry Wall kludge" line so it works.  If this script is run by csh,
765 # it will complain, feed itself to sh, and complain some more.  But will work.
766 #
767 # * Use <14 char file names in /tmp.
768 #
769 # Revision 1.58  1991/10/16  06:12:52  rich
770 # Two small bugs.  First, single quoted sed line doesn't need to quote
771 # '$'.  Second, use quotes around the hereis document trigger in order
772 # to quote the entire contents of the hereis document.
773 #
774 # Revision 1.57  1991/10/11  05:31:05  gnu
775 # Simplify "Using" message code.  Put the message that configure prints
776 # (or suppresses) into the config.status file as a comment.
777 #
778 # Revision 1.56  1991/10/10  05:01:47  rich
779 # Remove the set -e but protect the recusion call.
780 #
781 # Revision 1.55  1991/10/10  04:57:23  rich
782 # * Die when sub-configure's do.
783 # * get the makefile building message line correct.
784 # * set -e
785 #
786 # Revision 1.54  1991/10/10  01:04:42  rich
787 # Backed out the "/bin/sh config.sub" change.  Fails when config.sub was
788 # on PATH.
789 #
790 # Revision 1.53  1991/10/10  00:38:08  rich
791 # Call config.sub as "/bin/sh config.sub" instead of directly.  This
792 # protects us from the case where config.sub isn't executable.
793 #
794 # Revision 1.52  1991/10/09  00:48:26  rich
795 # Another patch from jim.
796 #
797 # Revision 1.51  1991/10/08  06:07:58  wilson
798 # Fix bug in smake- file code.
799 #
800 # Revision 1.50  1991/10/04  23:49:37  rich
801 # Per's patch for my config.sub botch.
802 #
803 # Revision 1.49  1991/10/04  22:52:09  rich
804 # Use john's heuristic for finding ourselves.  kinda like hare krishna.
805 #
806 # Revision 1.48  1991/10/02  13:17:28  rich
807 # take out the set -e for now
808 #
809 # Revision 1.47  1991/10/02  10:02:23  rich
810 # * temporary files in TMPDIR
811 # * +objdir
812 #
813 # Revision 1.46  1991/10/02  06:29:53  rich
814 # Added +site=foo option for naming site specific Makefile fragments.
815 #
816 # Revision 1.45  1991/10/02  06:15:13  rich
817 # Removed +f option.  Used to stand for +forcesubdirs which is now
818 # called +subdirs.
819 #
820 # Revision 1.44  1991/10/02  06:02:35  rich
821 # Added rcs log line.
822 #
823 #
824 #
825
826 #
827 # Local Variables:
828 # fill-column: 131
829 # End:
830 #
831
832 # end of configure