]>
Commit | Line | Data |
---|---|---|
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 | # | |
25 | # Shell script to create proper links to machine-dependent files in | |
26 | # preparation for compilation. | |
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 | ||
33 | remove=rm | |
34 | hard_link=ln | |
35 | symbolic_link='ln -s' | |
36 | ||
37 | #for Test | |
38 | #remove="echo rm" | |
39 | #hard_link="echo ln" | |
40 | #symbolic_link="echo ln -s" | |
41 | ||
42 | progname=$0 | |
43 | ||
44 | # clear some things potentially inherited from environment. | |
45 | ansi= | |
46 | arguments=$* | |
47 | defaulttargets= | |
48 | destdir= | |
49 | fatal= | |
50 | hostsubdir= | |
51 | Makefile=Makefile | |
52 | Makefile_in=Makefile.in | |
53 | norecursion= | |
54 | recurring= | |
55 | removing= | |
56 | srcdir= | |
57 | srctrigger= | |
58 | target= | |
59 | targets= | |
60 | commontargets= | |
61 | configdirs= | |
62 | targetsubdir= | |
63 | template= | |
64 | verbose= | |
65 | ||
66 | for arg in $*; | |
67 | do | |
68 | case ${arg} in | |
69 | -ansi | +a*) | |
70 | ansi=true | |
71 | clib=clib | |
72 | ;; | |
73 | -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*) | |
74 | destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'` | |
75 | ;; | |
76 | -languages=* | +languages=* | +language=* | +languag=* \ | |
77 | | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ | |
78 | | +l=*) | |
79 | languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`" | |
80 | ;; | |
81 | -gas | +g*) | |
82 | gas=yes | |
83 | ;; | |
84 | -help | +h*) | |
85 | fatal=true | |
86 | ;; | |
87 | -nfp | +nf*) | |
88 | nfp=yes | |
89 | ;; | |
90 | -norecursion | +no*) | |
91 | norecursion=true | |
92 | ;; | |
93 | -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re) | |
94 | recurring=true | |
95 | ;; | |
96 | -rm | +rm) | |
97 | removing=${arg} | |
98 | ;; | |
99 | # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) | |
100 | # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` | |
101 | # ;; | |
102 | -subdirs | +f* | +su*) | |
103 | subdirs=${arg} | |
104 | ;; | |
105 | -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) | |
106 | if [ -n "${targets}" ] ; then | |
107 | subdirs="+subdirs" | |
108 | fi | |
109 | ||
110 | newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" | |
111 | targets="${newtargets}" | |
112 | ;; | |
113 | -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*) | |
114 | template=`echo ${arg} | sed 's/[+-]template=//'` | |
115 | ;; | |
116 | -v | -verbose | +v*) | |
117 | verbose=${arg} | |
118 | ;; | |
119 | -* | +*) | |
120 | (echo ; | |
121 | echo "Unrecognized option: \"${arg}\"". ; | |
122 | echo) 1>&2 | |
123 | fatal=true | |
124 | ;; | |
125 | *) | |
126 | if [ -n "${hosts}" ] ; then | |
127 | subdirs="+subdirs" | |
128 | fi | |
129 | ||
130 | newhosts="${hosts} ${arg}" | |
131 | hosts=${newhosts} | |
132 | ;; | |
133 | esac | |
134 | done | |
135 | ||
136 | if [ -n "${verbose}" ] ; then | |
137 | echo `pwd`/configure $* | |
138 | fi | |
139 | ||
140 | # process host and target only if not rebuilding configure itself or removing. | |
141 | if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then | |
142 | # Complain if an arg is missing | |
143 | if [ -z "${hosts}" ] ; then | |
144 | (echo ; | |
145 | echo "configure: No HOST specified." ; | |
146 | echo) 1>&2 | |
147 | fatal=true | |
148 | fi | |
149 | fi | |
150 | ||
151 | if [ -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]" ; | |
157 | echo " +subdirs configure in subdirectories. [in source directories]" ; | |
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]" ; | |
162 | echo " +norecursion configure this directory only. [recurse]" ; | |
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." ; | |
168 | echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; | |
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 | |
176 | fi | |
177 | ||
178 | #### configure.in common parts come in here. | |
179 | # This file is a shell script that supplies the information necessary | |
180 | # to tailor a template configure script into the configure script | |
181 | # appropriate for this directory. For more information, check any | |
182 | # existing configure script. | |
183 | ||
184 | srctrigger=ar.c | |
185 | srcname="binutils" | |
186 | ||
187 | ## end of common part. | |
188 | ||
189 | # are we rebuilding config itself? | |
190 | if [ -n "${template}" ] ; then | |
191 | if [ ! -r ${template} ] ; then | |
192 | echo '***' "Can't find template ${template}." 1>&2 | |
193 | exit 1 | |
194 | fi | |
195 | ||
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.' \ | |
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.' \ | |
209 | < ${template} > template.new | |
210 | ||
211 | if [ -r configure.in ] ; then | |
212 | if [ -z "`grep '^# per\-host:' configure.in`" ] ; then | |
213 | echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 | |
214 | exit 1 | |
215 | fi | |
216 | ||
217 | if [ -z "`grep '^# per\-target:' configure.in`" ] ; then | |
218 | echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 | |
219 | exit 1 | |
220 | fi | |
221 | ||
222 | # split configure.in into common, per-host, per-target, | |
223 | # and post-target parts. Post-target is optional. | |
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 | |
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 | |
233 | ||
234 | # and insert them | |
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' \ | |
238 | -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \ | |
239 | template.new > configure.new | |
240 | ||
241 | rm -f configure.com configure.tgt configure.hst configure.pos | |
242 | else | |
243 | echo Warning: no configure.in in `pwd` | |
244 | cat ${template} >> configure | |
245 | fi | |
246 | ||
247 | chmod a+x configure.new | |
248 | rm template.new | |
249 | # mv configure configure.old | |
250 | mv configure.new configure | |
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 | |
266 | ||
267 | if [ -z "${norecursion}" ] ; then | |
268 | # If template is relative path, make it absolute for recurring. | |
269 | if echo "${template}" | grep -s '^/' ; then | |
270 | true | |
271 | else | |
272 | template=`pwd`/${template} | |
273 | fi | |
274 | ||
275 | while [ -n "${configdirs}" ] ; do | |
276 | # set configdir to car of configdirs, configdirs to cdr of configdirs | |
277 | set ${configdirs}; configdir=$1; shift; configdirs=$* | |
278 | ||
279 | if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then | |
280 | targetspecificdirs=${configdir}.* | |
281 | else | |
282 | targetspecificdirs= | |
283 | fi | |
284 | ||
285 | for i in ${configdir} ${targetspecificdirs} ; do | |
286 | if [ -d $i ] ; then | |
287 | if [ -r $i/configure ] ; then | |
288 | (cd $i ; | |
289 | ./configure +template=${template} ${verbose}) | |
290 | else | |
291 | echo Warning: No configure script in `pwd`/$i | |
292 | fi | |
293 | else | |
294 | if [ -n "${verbose}" ] ; then | |
295 | echo Warning: directory $i is missing. | |
296 | fi | |
297 | fi | |
298 | done | |
299 | done | |
300 | fi | |
301 | ||
302 | exit 0 | |
303 | fi | |
304 | ||
305 | # some sanity checks on configure.in | |
306 | if [ -z "${srctrigger}" ] ; then | |
307 | echo Warning: srctrigger not set in configure.in. `pwd` not configured. | |
308 | exit 1 | |
309 | fi | |
310 | ||
311 | for host in ${hosts} ; do | |
312 | # Default other arg | |
313 | if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then | |
314 | targets=${host} | |
315 | defaulttargets=true | |
316 | fi | |
317 | ||
318 | host_alias=${host} | |
319 | ||
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} | |
325 | host_makefile_frag=config/hmake-${host} | |
326 | ||
327 | #### configure.in per-host parts come in here. | |
328 | ||
329 | if [ "${host_os}" = "posix" ] ; then | |
330 | my_host=posix | |
331 | else | |
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 | ;; | |
348 | ||
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 | ;; | |
356 | ||
357 | i386) | |
358 | case "${host_vendor}" in | |
359 | *) | |
360 | case "${host_os}" in | |
361 | sysv) my_host=i386v ;; | |
362 | esac | |
363 | ;; | |
364 | esac | |
365 | ;; | |
366 | ||
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 | |
376 | fi | |
377 | ||
378 | if [ ! -f config/hmake-${my_host} ] ; then | |
379 | echo '***' Binutils do not support host ${host} | |
380 | exit 1 | |
381 | fi | |
382 | ||
383 | host_makefile_frag=config/hmake-${my_host} | |
384 | ||
385 | ## end of per-host part. | |
386 | ||
387 | for target in ${targets} ; do | |
388 | ||
389 | target_alias=${target} | |
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} | |
395 | target_makefile_frag=config/tmake-${target} | |
396 | ||
397 | #### configure.in per-target parts come in here. | |
398 | ||
399 | files= | |
400 | links= | |
401 | ## end of per-target part. | |
402 | ||
403 | # Temporarily, we support only direct subdir builds. | |
404 | hostsubdir=H-${host_alias} | |
405 | targetsubdir=T-${target_alias} | |
406 | ||
407 | if [ -n "${removing}" ] ; then | |
408 | if [ -n "${subdirs}" ] ; then | |
409 | if [ -d "${hostsubdir}" ] ; then | |
410 | rm -rf ${hostsubdir}/${targetsubdir} | |
411 | ||
412 | if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then | |
413 | rm -rf ${hostsubdir} | |
414 | fi | |
415 | else | |
416 | echo Warning: no `pwd`/${hostsubdir} to remove. | |
417 | fi | |
418 | else | |
419 | rm -f ${Makefile} config.status ${links} | |
420 | fi | |
421 | else | |
422 | if [ -n "${subdirs}" ] ; then | |
423 | # check for existing status before allowing forced subdirs. | |
424 | if [ -f ${Makefile} ] ; then | |
425 | echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2 | |
426 | exit 1 | |
427 | fi | |
428 | ||
429 | if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi | |
430 | cd ${hostsubdir} | |
431 | ||
432 | if [ ! -d ${targetsubdir} ] ; then | |
433 | if [ -z "${commontargets}" ] ; then | |
434 | mkdir ${targetsubdir} | |
435 | else | |
436 | if [ ! -d Target-independent ] ; then | |
437 | mkdir Target-independent | |
438 | fi | |
439 | ||
440 | ${symbolic_link} Target-independent ${targetsubdir} | |
441 | fi # if target independent | |
442 | fi # if no target dir yet | |
443 | ||
444 | cd ${targetsubdir} | |
445 | ||
446 | srcdir=../.. | |
447 | else | |
448 | # if not subdir builds, then make sure none exist. | |
449 | if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then | |
450 | echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2 | |
451 | exit 1 | |
452 | fi | |
453 | fi | |
454 | ||
455 | # Find the source files, if location was not specified. | |
456 | if [ -z "${srcdir}" ] ; then | |
457 | srcdirdefaulted=1 | |
458 | srcdir=. | |
459 | if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then | |
460 | srcdir=.. | |
461 | fi | |
462 | fi | |
463 | ||
464 | if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then | |
465 | if [ -z "${srcdirdefaulted}" ] ; then | |
466 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 | |
467 | else | |
468 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 | |
469 | fi | |
470 | ||
471 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 | |
472 | exit 1 | |
473 | fi | |
474 | ||
475 | # Set up the list of links to be made. | |
476 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
477 | ||
478 | # Make the links. | |
479 | while [ -n "${files}" ] ; do | |
480 | # set file to car of files, files to cdr of files | |
481 | set ${files}; file=$1; shift; files=$* | |
482 | set ${links}; link=$1; shift; links=$* | |
483 | ||
484 | if [ ! -r ${srcdir}/${file} ] ; then | |
485 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 | |
486 | echo '***' "since the file \"${file}\" does not exist." 1>&2 | |
487 | exit 1 | |
488 | fi | |
489 | ||
490 | ${remove} -f ${link} | |
491 | rm -f config.status | |
492 | # Make a symlink if possible, otherwise try a hard link | |
493 | ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} | |
494 | ||
495 | if [ ! -r ${link} ] ; then | |
496 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 | |
497 | exit 1 | |
498 | fi | |
499 | ||
500 | if [ -n "${verbose}" ] ; then | |
501 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
502 | fi | |
503 | done | |
504 | ||
505 | # Create a .gdbinit file which runs the one in srcdir | |
506 | # and tells GDB to look there for source files. | |
507 | ||
508 | case ${srcdir} in | |
509 | .) | |
510 | ;; | |
511 | *) | |
512 | echo "dir ." > .gdbinit | |
513 | echo "dir ${srcdir}" >> .gdbinit | |
514 | echo "source ${srcdir}/.gdbinit" >> .gdbinit | |
515 | ;; | |
516 | esac | |
517 | ||
518 | # Install a makefile, and make it set VPATH | |
519 | # if necessary so that the sources are found. | |
520 | # Also change its value of srcdir. | |
521 | ||
522 | # FIXME-someday: This business of always writing to .tem and mv back | |
523 | # is so that I don't screw things up while developing. Once this | |
524 | # template is stable, these should be optimized. xoxorich. | |
525 | ||
526 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
527 | if [ "${host}" != "${target}" ] ; then | |
528 | echo "CROSS=-DCROSS_COMPILE" > ${Makefile} | |
529 | echo "ALL=start.encap" >> ${Makefile} | |
530 | else | |
531 | echo "ALL=all.internal" > ${Makefile} | |
532 | fi | |
533 | ||
534 | # set target, host, VPATH | |
535 | echo "host_alias = ${host_alias}" >> ${Makefile} | |
536 | echo "host_cpu = ${host_cpu}" >> ${Makefile} | |
537 | echo "host_vendor = ${host_vendor}" >> ${Makefile} | |
538 | echo "host_os = ${host_os}" >> ${Makefile} | |
539 | ||
540 | echo "target_alias = ${target_alias}" >> ${Makefile} | |
541 | echo "target_cpu = ${target_cpu}" >> ${Makefile} | |
542 | echo "target_vendor = ${target_vendor}" >> ${Makefile} | |
543 | echo "target_os = ${target_os}" >> ${Makefile} | |
544 | ||
545 | if [ -n "${subdirs}" ] ; then | |
546 | echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile} | |
547 | else | |
548 | echo "subdir =" >> ${Makefile} | |
549 | fi | |
550 | ||
551 | # echo "workdir = `pwd`" >> ${Makefile} | |
552 | echo "VPATH = ${srcdir}" >> ${Makefile} | |
553 | ||
554 | # add "Makefile.in" (or whatever it's called) | |
555 | cat ${srcdir}/${Makefile_in} >> ${Makefile} | |
556 | ||
557 | # Conditionalize the makefile for this host. | |
558 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then | |
559 | (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ; | |
560 | sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem | |
561 | mv Makefile.tem ${Makefile} | |
562 | fi | |
563 | ||
564 | # Conditionalize the makefile for this target. | |
565 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then | |
566 | (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; | |
567 | sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem | |
568 | mv Makefile.tem ${Makefile} | |
569 | fi | |
570 | ||
571 | # set srcdir | |
572 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem | |
573 | mv Makefile.tem ${Makefile} | |
574 | ||
575 | # set destdir | |
576 | if [ -n "${destdir}" ] ; then | |
577 | sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem | |
578 | mv Makefile.tem ${Makefile} | |
579 | fi | |
580 | ||
581 | # reset SUBDIRS | |
582 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem | |
583 | mv Makefile.tem ${Makefile} | |
584 | ||
585 | # reset NONSUBDIRS | |
586 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem | |
587 | mv Makefile.tem ${Makefile} | |
588 | ||
589 | using= | |
590 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then | |
591 | using=" using \"${host_makefile_frag}\"" | |
592 | fi | |
593 | ||
594 | # remove any form feeds. | |
595 | sed -e "s/\f//" ${Makefile} > Makefile.tem | |
596 | mv Makefile.tem ${Makefile} | |
597 | ||
598 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then | |
599 | if [ -z "${using}" ] ; then | |
600 | andusing=" using \"${target_makefile_frag}\"" | |
601 | else | |
602 | andusing="${using} and \"${target_makefile_frag}\"" | |
603 | fi | |
604 | else | |
605 | andusing=${using} | |
606 | fi | |
607 | ||
608 | if [ -n "${verbose}" -o -z "${recurring}" ] ; then | |
609 | echo "Created \"${Makefile}\"" in `pwd`${andusing}. | |
610 | fi | |
611 | ||
612 | #### configure.in post-target parts come in here. | |
613 | ||
614 | ## end of post-target part. | |
615 | ||
616 | # describe the chosen configuration in config.status. | |
617 | # Make that file a shellscript which will reestablish | |
618 | # the same configuration. Used in Makefiles to rebuild | |
619 | # Makefiles. | |
620 | ||
621 | echo "#!/bin/sh | |
622 | # ${srcname} was configured as follows: | |
623 | ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status | |
624 | chmod a+x config.status | |
625 | ||
626 | originaldir=`pwd` | |
627 | cd ${srcdir} | |
628 | fi | |
629 | ||
630 | # If there are subdirectories, then recurse. | |
631 | if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then | |
632 | for configdir in ${configdirs} ; do | |
633 | if [ -n "${verbose}" ] ; then | |
634 | echo Configuring ${configdir}... | |
635 | fi | |
636 | ||
637 | if [ -d ${configdir} ] ; then | |
638 | (cd ${configdir} ; | |
639 | ./configure +recurring ${host_alias} +target=${target_alias} \ | |
640 | ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \ | |
641 | | sed 's/^/ /' | |
642 | else | |
643 | if [ -n "${verbose}" ] ; then | |
644 | echo Warning: directory \"${configdir}\" is missing. | |
645 | fi | |
646 | fi | |
647 | done | |
648 | fi | |
649 | done # for each target | |
650 | ||
651 | # Now build a Makefile for this host. | |
652 | if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then | |
653 | cd ${hostsubdir} | |
654 | cat > GNUmakefile << E!O!F | |
655 | # Makefile generated by configure for host ${host_alias}. | |
656 | ||
657 | ALL := $(shell ls -d Target-*) | |
658 | ||
659 | %: | |
660 | $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true | |
661 | ||
662 | all: | |
663 | E!O!F | |
664 | cd .. | |
665 | fi | |
666 | done # for each host | |
667 | ||
668 | exit 0 | |
669 | ||
670 | # | |
671 | # Local Variables: | |
672 | # fill-column: 131 | |
673 | # End: | |
674 | # | |
675 | ||
676 | # end of configure |