Tue Jan 25 19:54:19 1994 Stan Shebs (shebs@andros.cygnus.com)
[deliverable/binutils-gdb.git] / ld / configure
CommitLineData
eb02fd64 1#!/bin/sh
eb02fd64 2
5a168a17 3# Configuration script
eb02fd64
RP
4# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
5
6#This file is part of GNU.
7
4101d868
RP
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. */
eb02fd64 21
2ee11735
RP
22# $Id$
23
eb02fd64
RP
24#
25# Shell script to create proper links to machine-dependent files in
8c32cf6e 26# preparation for compilation.
eb02fd64
RP
27#
28# If configure succeeds, it leaves its status in config.status.
29# If configure fails after disturbing the status quo,
30# config.status is removed.
31#
32
eb02fd64
RP
33remove=rm
34hard_link=ln
35symbolic_link='ln -s'
36
37#for Test
38#remove="echo rm"
39#hard_link="echo ln"
40#symbolic_link="echo ln -s"
41
c4220303
RP
42progname=$0
43
eb02fd64 44# clear some things potentially inherited from environment.
eb02fd64 45ansi=
5a168a17 46arguments=$*
8c32cf6e 47defaulttargets=
ec342d7d 48destdir=
8c32cf6e 49fatal=
f2e91404 50hostsubdir=
4101d868
RP
51Makefile=Makefile
52Makefile_in=Makefile.in
5a168a17
RP
53norecursion=
54recurring=
f2e91404 55removing=
2ee11735 56srcdir=
ec342d7d 57srctrigger=
f2e91404 58target=
8c32cf6e 59targets=
c0b47bae 60commontargets=
5a168a17 61configdirs=
f2e91404
RP
62targetsubdir=
63template=
8c32cf6e 64verbose=
eb02fd64
RP
65
66for arg in $*;
67do
ec342d7d 68 case ${arg} in
c0b47bae 69 -ansi | +a*)
eb02fd64 70 ansi=true
c0b47bae 71 clib=clib
eb02fd64 72 ;;
ec342d7d
RP
73 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
74 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
75 ;;
2ee11735
RP
76 -languages=* | +languages=* | +language=* | +languag=* \
77 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
78 | +l=*)
ec342d7d 79 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
eb02fd64 80 ;;
c0b47bae 81 -gas | +g*)
eb02fd64
RP
82 gas=yes
83 ;;
c0b47bae 84 -help | +h*)
8c32cf6e
RP
85 fatal=true
86 ;;
c0b47bae 87 -nfp | +nf*)
eb02fd64
RP
88 nfp=yes
89 ;;
5a168a17
RP
90 -norecursion | +no*)
91 norecursion=true
f2e91404 92 ;;
5a168a17
RP
93 -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
94 recurring=true
c0b47bae 95 ;;
5a168a17 96 -rm | +rm)
ec342d7d 97 removing=${arg}
f2e91404 98 ;;
8c32cf6e
RP
99# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
100# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
101# ;;
c0b47bae
RP
102 -subdirs | +f* | +su*)
103 subdirs=${arg}
104 ;;
105 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
8c32cf6e 106 if [ -n "${targets}" ] ; then
c0b47bae 107 subdirs="+subdirs"
8c32cf6e
RP
108 fi
109
110 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
111 targets="${newtargets}"
f2e91404 112 ;;
c0b47bae 113 -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
ec342d7d 114 template=`echo ${arg} | sed 's/[+-]template=//'`
f2e91404 115 ;;
c0b47bae 116 -v | -verbose | +v*)
8c32cf6e
RP
117 verbose=${arg}
118 ;;
119 -* | +*)
120 (echo ;
121 echo "Unrecognized option: \"${arg}\"". ;
122 echo) 1>&2
123 fatal=true
124 ;;
eb02fd64 125 *)
8c32cf6e 126 if [ -n "${hosts}" ] ; then
c0b47bae 127 subdirs="+subdirs"
8c32cf6e
RP
128 fi
129
130 newhosts="${hosts} ${arg}"
131 hosts=${newhosts}
eb02fd64
RP
132 ;;
133 esac
134done
135
8c32cf6e
RP
136if [ -n "${verbose}" ] ; then
137 echo `pwd`/configure $*
8c32cf6e
RP
138fi
139
f2e91404 140# process host and target only if not rebuilding configure itself or removing.
8c32cf6e 141if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
eb02fd64 142 # Complain if an arg is missing
8c32cf6e
RP
143 if [ -z "${hosts}" ] ; then
144 (echo ;
145 echo "configure: No HOST specified." ;
c0b47bae 146 echo) 1>&2
8c32cf6e 147 fatal=true
eb02fd64 148 fi
f2e91404 149fi
eb02fd64 150
8c32cf6e
RP
151if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
152 (echo "Usage: configure HOST" ;
153 echo ;
154 echo "Options: [defaults in brackets]" ;
155 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
156 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
c0b47bae 157 echo " +subdirs configure in subdirectories. [in source directories]" ;
8c32cf6e
RP
158 echo " +lang=LANG configure to build LANG. [gcc]" ;
159 echo " +help print this message. [normal config]" ;
160 echo " +gas configure the compilers for use with gas. [native as]" ;
161 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
5a168a17 162 echo " +norecursion configure this directory only. [recurse]" ;
8c32cf6e
RP
163 echo " +rm remove this configuration. [build a configuration]" ;
164 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
165 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
166 echo ;
167 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
c0b47bae 168 echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
8c32cf6e
RP
169 echo "options given will apply to all targets.") 1>&2
170
171 if [ -r config.status ] ; then
172 cat config.status
173 fi
174
175 exit 1
2ee11735 176fi
eb02fd64 177
8c32cf6e
RP
178#### configure.in common parts come in here.
179# This file is a shell script fragment that supplies the information
180# necessary to tailor a template configure script into the configure
181# script appropriate for this directory. For more information, check
182# any existing configure script.
eb02fd64 183
4101d868 184srctrigger=ldmain.c
2ee11735 185srcname="linker"
eb02fd64 186
c4220303 187## end of common part.
eb02fd64
RP
188
189# are we rebuilding config itself?
8c32cf6e
RP
190if [ -n "${template}" ] ; then
191 if [ ! -r ${template} ] ; then
c0b47bae 192 echo '***' "Can't find template ${template}." 1>&2
eb02fd64
RP
193 exit 1
194 fi
195
c4220303
RP
196# prep the template
197 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
198#### configure.in common parts come in here.\
199## end of common part.' \
200 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
201#### configure.in per-host parts come in here.\
202## end of per-host part.' \
203 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
204#### configure.in per-target parts come in here.\
205## end of per-target part.' \
4101d868
RP
206 -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
207#### configure.in post-target parts come in here.\
208## end of post-target part.' \
c4220303 209 < ${template} > template.new
eb02fd64 210
8c32cf6e
RP
211 if [ -r configure.in ] ; then
212 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
c0b47bae 213 echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
8c32cf6e
RP
214 exit 1
215 fi
216
217 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
c0b47bae 218 echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
8c32cf6e
RP
219 exit 1
220 fi
221
4101d868
RP
222 # split configure.in into common, per-host, per-target,
223 # and post-target parts. Post-target is optional.
04dc1a62
RP
224 sed -e '/^# per\-host:/,$d' configure.in > configure.com
225 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
4101d868
RP
226 if grep -s '^# post-target:' configure.in ; then
227 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
228 sed -e '1,/^# post\-target:/d' configure.in > configure.pos
229 else
230 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
231 echo >configure.pos
232 fi
8c32cf6e 233
04dc1a62 234 # and insert them
c4220303
RP
235 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
236 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
237 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
4101d868 238 -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
c4220303 239 template.new > configure.new
8c32cf6e 240
4101d868 241 rm -f configure.com configure.tgt configure.hst configure.pos
eb02fd64 242 else
ec342d7d
RP
243 echo Warning: no configure.in in `pwd`
244 cat ${template} >> configure
eb02fd64
RP
245 fi
246
c4220303
RP
247 chmod a+x configure.new
248 rm template.new
249# mv configure configure.old
250 mv configure.new configure
c0b47bae
RP
251
252 if [ -n "${verbose}" ] ; then
253 echo Rebuilt configure in `pwd`
254 fi
255
256 # Now update config.sub from the template directory.
257 if echo "$template" | grep -s 'configure$' ; then
258 cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
259 # mv config.sub config.sub.old
260 mv config.sub.new config.sub
261
262 if [ -n "${verbose}" ] ; then
263 echo Rebuilt config.sub in `pwd`
264 fi
265 fi
eb02fd64 266
5a168a17
RP
267 if [ -z "${norecursion}" ] ; then
268 # If template is relative path, make it absolute for recurring.
4101d868
RP
269 if echo "${template}" | grep -s '^/' ; then
270 true
271 else
272 template=`pwd`/${template}
273 fi
274
8c32cf6e 275 while [ -n "${configdirs}" ] ; do
eb02fd64 276 # set configdir to car of configdirs, configdirs to cdr of configdirs
ec342d7d 277 set ${configdirs}; configdir=$1; shift; configdirs=$*
eb02fd64 278
8c32cf6e 279 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
eb02fd64
RP
280 targetspecificdirs=${configdir}.*
281 else
282 targetspecificdirs=
283 fi
284
8c32cf6e 285 for i in ${configdir} ${targetspecificdirs} ; do
6c18e393
RP
286 if [ -d $i ] ; then
287 if [ -r $i/configure ] ; then
288 (cd $i ;
289 ./configure +template=${template} ${verbose})
290 else
c0b47bae 291 echo Warning: No configure script in `pwd`/$i
6c18e393 292 fi
eb02fd64 293 else
c0b47bae
RP
294 if [ -n "${verbose}" ] ; then
295 echo Warning: directory $i is missing.
296 fi
eb02fd64
RP
297 fi
298 done
299 done
300 fi
301
302 exit 0
303fi
304
ec342d7d 305# some sanity checks on configure.in
8c32cf6e 306if [ -z "${srctrigger}" ] ; then
c0b47bae 307 echo Warning: srctrigger not set in configure.in. `pwd` not configured.
ec342d7d
RP
308 exit 1
309fi
310
8c32cf6e
RP
311for host in ${hosts} ; do
312 # Default other arg
313 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
314 targets=${host}
315 defaulttargets=true
316 fi
eb02fd64 317
5a168a17
RP
318 host_alias=${host}
319
c0b47bae
RP
320 result=`/bin/sh ./config.sub ${host}`
321 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
322 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
323 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
324 host=${host_cpu}-${host_vendor}-${host_os}
6c18e393
RP
325 host_makefile_frag=config/hmake-${host}
326
8c32cf6e 327#### configure.in per-host parts come in here.
3d6f0983 328
c0b47bae
RP
329if [ "${host_os}" = "posix" ] ; then
330 my_host=posix
331else
332 case "${host_cpu}" in
333 rs6000) my_host=aix ;;
334 mips)
335 case "${host_vendor}" in
336 dec) my_host=dec3100 ;;
337 esac
338 ;;
339 m88k)
340 case "${host_vendor}" in
341 *)
342 case "${host_os}" in
343 dgux) my_host=dgux ;;
344 esac
345 ;;
346 esac
347 ;;
eb02fd64 348
c0b47bae
RP
349 m68k)
350 case "${host_vendor}" in
351 hp) my_host=hp9000 ;;
352 sony) my_host=news ;;
353 sun) my_host=sun3 ;;
354 esac
355 ;;
f2e91404 356
c0b47bae
RP
357 i386)
358 case "${host_vendor}" in
359 *)
360 case "${host_os}" in
361 sysv) my_host=i386v ;;
362 esac
363 ;;
364 esac
365 ;;
eb02fd64 366
c0b47bae
RP
367 sparc)
368 case "${host_vendor}" in
369 sun) my_host=sun4 ;;
370 esac
371 ;;
372
373 rtpc) my_host=rtbsd ;;
374 tahoe | vax) my_host=${host_cpu} ;;
375 esac
376fi
377
5a168a17
RP
378if [ ! -f config/h-${my_host} ] ; then
379 echo '***' The linker do not support host ${host}
c0b47bae
RP
380 exit 1
381fi
8c32cf6e 382
5a168a17 383host_makefile_frag=config/h-${my_host}
c0b47bae
RP
384
385## end of per-host part.
386
387 for target in ${targets} ; do
388
5a168a17 389 target_alias=${target}
c0b47bae
RP
390 result=`/bin/sh ./config.sub ${target}`
391 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
392 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
393 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
394 target=${target_cpu}-${target_vendor}-${target_os}
6c18e393
RP
395 target_makefile_frag=config/tmake-${target}
396
8c32cf6e 397#### configure.in per-target parts come in here.
3d6f0983 398
c0b47bae
RP
399case ${target_cpu} in
400sparc)
401 case ${target_vendor} in
402 sun) my_target=sun4 ;;
403 esac
404 ;;
405m88k) my_target=m88k-bcs ;;
406a29k) my_target=coff-a29k ;;
5a168a17
RP
407m68k)
408 case ${target_vendor} in
409 sun) my_target=sun3 ;;
410 sony) my_target=news;;
411 *) echo "Unknown 68k target vendor:" ${target_vendor} ;;
412 esac
c0b47bae
RP
413esac
414
5a168a17 415target_makefile_frag=config/t-${my_target}
c0b47bae
RP
416
417files=
418links=
c4220303 419## end of per-target part.
8c32cf6e
RP
420
421 # Temporarily, we support only direct subdir builds.
5a168a17
RP
422 hostsubdir=H-${host_alias}
423 targetsubdir=T-${target_alias}
8c32cf6e
RP
424
425 if [ -n "${removing}" ] ; then
c0b47bae 426 if [ -n "${subdirs}" ] ; then
c4220303
RP
427 if [ -d "${hostsubdir}" ] ; then
428 rm -rf ${hostsubdir}/${targetsubdir}
8c32cf6e 429
c0b47bae 430 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
c4220303
RP
431 rm -rf ${hostsubdir}
432 fi
433 else
434 echo Warning: no `pwd`/${hostsubdir} to remove.
8c32cf6e
RP
435 fi
436 else
4101d868 437 rm -f ${Makefile} config.status ${links}
8c32cf6e 438 fi
2ee11735 439 else
c0b47bae 440 if [ -n "${subdirs}" ] ; then
8c32cf6e 441 # check for existing status before allowing forced subdirs.
4101d868 442 if [ -f ${Makefile} ] ; then
c0b47bae 443 echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2
8c32cf6e
RP
444 exit 1
445 fi
eb02fd64 446
8c32cf6e
RP
447 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
448 cd ${hostsubdir}
eb02fd64 449
c0b47bae
RP
450 if [ ! -d ${targetsubdir} ] ; then
451 if [ -z "${commontargets}" ] ; then
452 mkdir ${targetsubdir}
453 else
454 if [ ! -d Target-independent ] ; then
455 mkdir Target-independent
456 fi
457
458 ${symbolic_link} Target-independent ${targetsubdir}
459 fi # if target independent
460 fi # if no target dir yet
461
8c32cf6e 462 cd ${targetsubdir}
eb02fd64 463
8c32cf6e
RP
464 srcdir=../..
465 else
466 # if not subdir builds, then make sure none exist.
467 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
c0b47bae 468 echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
8c32cf6e
RP
469 exit 1
470 fi
471 fi
eb02fd64 472
8c32cf6e
RP
473 # Find the source files, if location was not specified.
474 if [ -z "${srcdir}" ] ; then
475 srcdirdefaulted=1
476 srcdir=.
477 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
478 srcdir=..
479 fi
480 fi
eb02fd64 481
8c32cf6e
RP
482 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
483 if [ -z "${srcdirdefaulted}" ] ; then
c0b47bae 484 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
8c32cf6e 485 else
c0b47bae 486 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
8c32cf6e 487 fi
eb02fd64 488
c0b47bae 489 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
8c32cf6e
RP
490 exit 1
491 fi
f2e91404 492
8c32cf6e
RP
493 # Set up the list of links to be made.
494 # ${links} is the list of link names, and ${files} is the list of names to link to.
eb02fd64 495
8c32cf6e
RP
496 # Make the links.
497 while [ -n "${files}" ] ; do
498 # set file to car of files, files to cdr of files
499 set ${files}; file=$1; shift; files=$*
500 set ${links}; link=$1; shift; links=$*
f2e91404 501
8c32cf6e 502 if [ ! -r ${srcdir}/${file} ] ; then
c0b47bae
RP
503 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
504 echo '***' "since the file \"${file}\" does not exist." 1>&2
8c32cf6e
RP
505 exit 1
506 fi
f2e91404 507
8c32cf6e
RP
508 ${remove} -f ${link}
509 rm -f config.status
510 # Make a symlink if possible, otherwise try a hard link
511 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
f2e91404 512
8c32cf6e 513 if [ ! -r ${link} ] ; then
c0b47bae 514 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
8c32cf6e
RP
515 exit 1
516 fi
c0b47bae
RP
517
518 if [ -n "${verbose}" ] ; then
519 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
520 fi
8c32cf6e 521 done
f2e91404 522
8c32cf6e
RP
523 # Create a .gdbinit file which runs the one in srcdir
524 # and tells GDB to look there for source files.
525
526 case ${srcdir} in
527 .)
528 ;;
529 *)
530 echo "dir ." > .gdbinit
531 echo "dir ${srcdir}" >> .gdbinit
532 echo "source ${srcdir}/.gdbinit" >> .gdbinit
533 ;;
534 esac
535
536 # Install a makefile, and make it set VPATH
537 # if necessary so that the sources are found.
538 # Also change its value of srcdir.
539
540 # FIXME-someday: This business of always writing to .tem and mv back
541 # is so that I don't screw things up while developing. Once this
542 # template is stable, these should be optimized. xoxorich.
543
544 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
545 if [ "${host}" != "${target}" ] ; then
4101d868
RP
546 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
547 echo "ALL=start.encap" >> ${Makefile}
8c32cf6e 548 else
4101d868 549 echo "ALL=all.internal" > ${Makefile}
8c32cf6e 550 fi
f2e91404 551
8c32cf6e 552 # set target, host, VPATH
5a168a17
RP
553 echo "host_alias = ${host_alias}" >> ${Makefile}
554 echo "host_cpu = ${host_cpu}" >> ${Makefile}
555 echo "host_vendor = ${host_vendor}" >> ${Makefile}
556 echo "host_os = ${host_os}" >> ${Makefile}
557
558 echo "target_alias = ${target_alias}" >> ${Makefile}
559 echo "target_cpu = ${target_cpu}" >> ${Makefile}
560 echo "target_vendor = ${target_vendor}" >> ${Makefile}
561 echo "target_os = ${target_os}" >> ${Makefile}
f2e91404 562
c0b47bae 563 if [ -n "${subdirs}" ] ; then
4101d868 564 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
8c32cf6e 565 else
4101d868 566 echo "subdir =" >> ${Makefile}
8c32cf6e 567 fi
f2e91404 568
4101d868
RP
569 # echo "workdir = `pwd`" >> ${Makefile}
570 echo "VPATH = ${srcdir}" >> ${Makefile}
eb02fd64 571
4101d868
RP
572 # add "Makefile.in" (or whatever it's called)
573 cat ${srcdir}/${Makefile_in} >> ${Makefile}
eb02fd64 574
8c32cf6e 575 # Conditionalize the makefile for this host.
6c18e393 576 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
5a168a17
RP
577 (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
578 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
4101d868 579 mv Makefile.tem ${Makefile}
8c32cf6e 580 fi
f2e91404 581
8c32cf6e 582 # Conditionalize the makefile for this target.
6c18e393 583 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
5a168a17
RP
584 (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
585 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
4101d868 586 mv Makefile.tem ${Makefile}
8c32cf6e 587 fi
ec342d7d 588
8c32cf6e 589 # set srcdir
4101d868
RP
590 sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
591 mv Makefile.tem ${Makefile}
eb02fd64 592
8c32cf6e
RP
593 # set destdir
594 if [ -n "${destdir}" ] ; then
4101d868
RP
595 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
596 mv Makefile.tem ${Makefile}
8c32cf6e 597 fi
eb02fd64 598
8c32cf6e 599 # reset SUBDIRS
4101d868
RP
600 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
601 mv Makefile.tem ${Makefile}
eb02fd64 602
8c32cf6e 603 # reset NONSUBDIRS
4101d868
RP
604 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
605 mv Makefile.tem ${Makefile}
eb02fd64 606
8c32cf6e 607 using=
6c18e393
RP
608 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
609 using=" using \"${host_makefile_frag}\""
8c32cf6e 610 fi
eb02fd64 611
5a168a17
RP
612 # remove any form feeds.
613 sed -e "s/\f//" ${Makefile} > Makefile.tem
614 mv Makefile.tem ${Makefile}
615
6c18e393 616 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
8c32cf6e 617 if [ -z "${using}" ] ; then
6c18e393 618 andusing=" using \"${target_makefile_frag}\""
8c32cf6e 619 else
6c18e393 620 andusing="${using} and \"${target_makefile_frag}\""
8c32cf6e
RP
621 fi
622 else
623 andusing=${using}
624 fi
eb02fd64 625
5a168a17 626 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
c0b47bae
RP
627 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
628 fi
4101d868
RP
629
630#### configure.in post-target parts come in here.
631
632## end of post-target part.
eb02fd64 633
5a168a17
RP
634 # describe the chosen configuration in config.status.
635 # Make that file a shellscript which will reestablish
636 # the same configuration. Used in Makefiles to rebuild
637 # Makefiles.
638
639 echo "#!/bin/sh
640# ${srcname} was configured as follows:
641${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status
642 chmod a+x config.status
8c32cf6e
RP
643
644 originaldir=`pwd`
645 cd ${srcdir}
646 fi
c0b47bae
RP
647
648 # If there are subdirectories, then recurse.
5a168a17 649 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
c0b47bae
RP
650 for configdir in ${configdirs} ; do
651 if [ -n "${verbose}" ] ; then
652 echo Configuring ${configdir}...
653 fi
654
655 if [ -d ${configdir} ] ; then
656 (cd ${configdir} ;
5a168a17 657 ./configure +recurring ${host_alias} +target=${target_alias} \
c0b47bae
RP
658 ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
659 | sed 's/^/ /'
660 else
661 if [ -n "${verbose}" ] ; then
662 echo Warning: directory \"${configdir}\" is missing.
663 fi
664 fi
665 done
666 fi
c4220303
RP
667 done # for each target
668
4101d868 669 # Now build a Makefile for this host.
c0b47bae 670 if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
4101d868
RP
671 cd ${hostsubdir}
672 cat > GNUmakefile << E!O!F
5a168a17 673# Makefile generated by configure for host ${host_alias}.
4101d868
RP
674
675ALL := $(shell ls -d Target-*)
676
677%:
678 $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
679
680all:
681E!O!F
682 cd ..
683 fi
c4220303 684done # for each host
eb02fd64 685
eb02fd64 686exit 0
2ee11735 687
8c32cf6e
RP
688#
689# Local Variables:
690# fill-column: 131
691# End:
692#
2ee11735 693
5a168a17 694# end of configure
This page took 0.142136 seconds and 4 git commands to generate.