]>
Commit | Line | Data |
---|---|---|
99a42820 | 1 | #!/bin/sh |
a9c7e163 RP |
2 | # Please do not edit this file. It is generated automatically from |
3 | # configure.in and a configure template. | |
99a42820 RP |
4 | configdirs= |
5 | ||
6 | #!/bin/sh | |
99a42820 RP |
7 | |
8 | # Configuration script template | |
9 | # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc. | |
10 | ||
11 | #This file is part of GNU. | |
12 | ||
21a56d6d JG |
13 | # This program is free software; you can redistribute it and/or modify |
14 | # it under the terms of the GNU General Public License as published by | |
15 | # the Free Software Foundation; either version 2 of the License, or | |
16 | # (at your option) any later version. | |
17 | # | |
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. | |
22 | # | |
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
99a42820 | 26 | |
a9c7e163 RP |
27 | # $Id$ |
28 | ||
99a42820 RP |
29 | # |
30 | # Shell script to create proper links to machine-dependent files in | |
b5132a6b | 31 | # preparation for compilation. |
99a42820 RP |
32 | # |
33 | # If configure succeeds, it leaves its status in config.status. | |
34 | # If configure fails after disturbing the status quo, | |
35 | # config.status is removed. | |
36 | # | |
37 | ||
99a42820 RP |
38 | remove=rm |
39 | hard_link=ln | |
40 | symbolic_link='ln -s' | |
41 | ||
42 | #for Test | |
43 | #remove="echo rm" | |
44 | #hard_link="echo ln" | |
45 | #symbolic_link="echo ln -s" | |
46 | ||
c4220303 RP |
47 | progname=$0 |
48 | ||
99a42820 | 49 | # clear some things potentially inherited from environment. |
99a42820 | 50 | ansi= |
b5132a6b | 51 | defaulttargets= |
ec342d7d | 52 | destdir= |
b5132a6b | 53 | fatal= |
f2e91404 | 54 | hostsubdir= |
21a56d6d JG |
55 | Makefile=Makefile |
56 | Makefile_in=Makefile.in | |
f2e91404 RP |
57 | norecurse= |
58 | removing= | |
a9c7e163 | 59 | srcdir= |
ec342d7d | 60 | srctrigger= |
f2e91404 | 61 | target= |
b5132a6b | 62 | targets= |
f2e91404 RP |
63 | targetsubdir= |
64 | template= | |
b5132a6b | 65 | verbose= |
99a42820 RP |
66 | |
67 | for arg in $*; | |
68 | do | |
ec342d7d | 69 | case ${arg} in |
21c9f626 | 70 | -ansi | +a*) |
99a42820 RP |
71 | ansi=true |
72 | ;; | |
ec342d7d RP |
73 | -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*) |
74 | destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'` | |
75 | ;; | |
a9c7e163 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]*=//'`" |
99a42820 | 80 | ;; |
21c9f626 | 81 | -gas | +g*) |
99a42820 RP |
82 | gas=yes |
83 | ;; | |
21c9f626 | 84 | -help | +h*) |
b5132a6b RP |
85 | fatal=true |
86 | ;; | |
21c9f626 | 87 | -nfp | +nf*) |
99a42820 RP |
88 | nfp=yes |
89 | ;; | |
21c9f626 | 90 | -norecurse | +no*) |
f2e91404 RP |
91 | norecurse=true |
92 | ;; | |
21c9f626 | 93 | -rm | +r*) |
ec342d7d | 94 | removing=${arg} |
f2e91404 | 95 | ;; |
b5132a6b RP |
96 | # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) |
97 | # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` | |
98 | # ;; | |
21c9f626 RP |
99 | -subdirs | +f* | +su*) |
100 | subdirs=${arg} | |
101 | ;; | |
102 | -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) | |
b5132a6b | 103 | if [ -n "${targets}" ] ; then |
21c9f626 | 104 | subdirs="+subdirs" |
b5132a6b RP |
105 | fi |
106 | ||
107 | newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" | |
108 | targets="${newtargets}" | |
f2e91404 | 109 | ;; |
21c9f626 | 110 | -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*) |
ec342d7d | 111 | template=`echo ${arg} | sed 's/[+-]template=//'` |
f2e91404 | 112 | ;; |
21c9f626 | 113 | -verbose | +v*) |
b5132a6b RP |
114 | verbose=${arg} |
115 | ;; | |
116 | -* | +*) | |
117 | (echo ; | |
118 | echo "Unrecognized option: \"${arg}\"". ; | |
119 | echo) 1>&2 | |
120 | fatal=true | |
121 | ;; | |
99a42820 | 122 | *) |
b5132a6b | 123 | if [ -n "${hosts}" ] ; then |
21c9f626 | 124 | subdirs="+subdirs" |
b5132a6b RP |
125 | fi |
126 | ||
127 | newhosts="${hosts} ${arg}" | |
128 | hosts=${newhosts} | |
99a42820 RP |
129 | ;; |
130 | esac | |
131 | done | |
132 | ||
b5132a6b RP |
133 | if [ -n "${verbose}" ] ; then |
134 | echo `pwd`/configure $* | |
135 | echo targets=\"${targets}\" | |
136 | fi | |
137 | ||
f2e91404 | 138 | # process host and target only if not rebuilding configure itself or removing. |
b5132a6b | 139 | if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then |
99a42820 | 140 | # Complain if an arg is missing |
b5132a6b RP |
141 | if [ -z "${hosts}" ] ; then |
142 | (echo ; | |
143 | echo "configure: No HOST specified." ; | |
144 | echo) 2>&1 | |
145 | fatal=true | |
99a42820 | 146 | fi |
f2e91404 | 147 | fi |
99a42820 | 148 | |
b5132a6b RP |
149 | if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then |
150 | (echo "Usage: configure HOST" ; | |
151 | echo ; | |
152 | echo "Options: [defaults in brackets]" ; | |
153 | echo " +ansi configure w/ANSI library. [no ansi lib]" ; | |
154 | echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ; | |
21c9f626 | 155 | echo " +subdirs configure in subdirectories. [in source directories]" ; |
b5132a6b RP |
156 | echo " +lang=LANG configure to build LANG. [gcc]" ; |
157 | echo " +help print this message. [normal config]" ; | |
158 | echo " +gas configure the compilers for use with gas. [native as]" ; | |
159 | echo " +nfp configure the compilers default to soft floating point. [hard float]" ; | |
160 | echo " +norecurse configure this directory only. [recurse]" ; | |
161 | echo " +rm remove this configuration. [build a configuration]" ; | |
162 | echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ; | |
163 | echo " +template=TEM rebuild configure using TEM. [normal config]" ; | |
164 | echo ; | |
165 | echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; | |
21c9f626 | 166 | echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; |
b5132a6b RP |
167 | echo "options given will apply to all targets.") 1>&2 |
168 | ||
169 | if [ -r config.status ] ; then | |
170 | cat config.status | |
171 | fi | |
172 | ||
173 | exit 1 | |
99a42820 RP |
174 | fi |
175 | ||
b5132a6b | 176 | #### configure.in common parts come in here. |
a9c7e163 RP |
177 | # This file is a shell script that supplies the information necessary |
178 | # to tailor a template configure script into the configure script | |
179 | # appropriate for this directory. For more information, check any | |
180 | # existing configure script. | |
181 | ||
182 | srctrigger=libbfd.c | |
183 | srcname="bfd" | |
21c9f626 | 184 | commontargets=true |
b5132a6b | 185 | |
c4220303 | 186 | ## end of common part. |
99a42820 RP |
187 | |
188 | # are we rebuilding config itself? | |
b5132a6b RP |
189 | if [ -n "${template}" ] ; then |
190 | if [ ! -r ${template} ] ; then | |
99a42820 RP |
191 | echo "Can't find template ${template}." |
192 | exit 1 | |
193 | fi | |
194 | ||
c4220303 RP |
195 | # prep the template |
196 | sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\ | |
197 | #### configure.in common parts come in here.\ | |
198 | ## end of common part.' \ | |
199 | -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\ | |
200 | #### configure.in per-host parts come in here.\ | |
201 | ## end of per-host part.' \ | |
202 | -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\ | |
203 | #### configure.in per-target parts come in here.\ | |
204 | ## end of per-target part.' \ | |
21a56d6d JG |
205 | -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\ |
206 | #### configure.in post-target parts come in here.\ | |
207 | ## end of post-target part.' \ | |
c4220303 | 208 | < ${template} > template.new |
99a42820 | 209 | |
b5132a6b RP |
210 | if [ -r configure.in ] ; then |
211 | if [ -z "`grep '^# per\-host:' configure.in`" ] ; then | |
212 | echo `pwd`/configure.in has no "per-host:" line. | |
213 | exit 1 | |
214 | fi | |
215 | ||
216 | if [ -z "`grep '^# per\-target:' configure.in`" ] ; then | |
217 | echo `pwd`/configure.in has no "per-target:" line. | |
218 | exit 1 | |
219 | fi | |
220 | ||
21a56d6d JG |
221 | # split configure.in into common, per-host, per-target, |
222 | # and post-target parts. Post-target is optional. | |
04dc1a62 RP |
223 | sed -e '/^# per\-host:/,$d' configure.in > configure.com |
224 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst | |
21a56d6d JG |
225 | if grep -s '^# post-target:' configure.in ; then |
226 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt | |
227 | sed -e '1,/^# post\-target:/d' configure.in > configure.pos | |
228 | else | |
229 | sed -e '1,/^# per\-target:/d' configure.in > configure.tgt | |
230 | echo >configure.pos | |
231 | fi | |
b5132a6b | 232 | |
04dc1a62 | 233 | # and insert them |
c4220303 RP |
234 | sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \ |
235 | -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \ | |
236 | -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \ | |
21a56d6d | 237 | -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \ |
c4220303 | 238 | template.new > configure.new |
b5132a6b | 239 | |
21a56d6d | 240 | rm -f configure.com configure.tgt configure.hst configure.pos |
99a42820 | 241 | else |
ec342d7d RP |
242 | echo Warning: no configure.in in `pwd` |
243 | cat ${template} >> configure | |
99a42820 RP |
244 | fi |
245 | ||
c4220303 RP |
246 | chmod a+x configure.new |
247 | rm template.new | |
248 | # mv configure configure.old | |
249 | mv configure.new configure | |
99a42820 RP |
250 | echo Rebuilt configure in `pwd` |
251 | ||
b5132a6b | 252 | if [ -z "${norecurse}" ] ; then |
21a56d6d JG |
253 | # If template is relative path, make it absolute for recursing. |
254 | if echo "${template}" | grep -s '^/' ; then | |
255 | true | |
256 | else | |
257 | template=`pwd`/${template} | |
258 | fi | |
259 | ||
b5132a6b | 260 | while [ -n "${configdirs}" ] ; do |
99a42820 | 261 | # set configdir to car of configdirs, configdirs to cdr of configdirs |
ec342d7d | 262 | set ${configdirs}; configdir=$1; shift; configdirs=$* |
99a42820 | 263 | |
b5132a6b | 264 | if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then |
99a42820 RP |
265 | targetspecificdirs=${configdir}.* |
266 | else | |
267 | targetspecificdirs= | |
268 | fi | |
269 | ||
b5132a6b | 270 | for i in ${configdir} ${targetspecificdirs} ; do |
6c18e393 RP |
271 | if [ -d $i ] ; then |
272 | if [ -r $i/configure ] ; then | |
273 | (cd $i ; | |
274 | ./configure +template=${template} ${verbose}) | |
275 | else | |
276 | echo No configure script in `pwd`/$i | |
277 | fi | |
99a42820 | 278 | else |
6c18e393 | 279 | echo Warning: directory $i is missing. |
99a42820 RP |
280 | fi |
281 | done | |
282 | done | |
283 | fi | |
284 | ||
285 | exit 0 | |
286 | fi | |
287 | ||
ec342d7d | 288 | # some sanity checks on configure.in |
b5132a6b | 289 | if [ -z "${srctrigger}" ] ; then |
ec342d7d RP |
290 | echo srctrigger not set in configure.in. `pwd` not configured. |
291 | exit 1 | |
292 | fi | |
293 | ||
b5132a6b RP |
294 | for host in ${hosts} ; do |
295 | # Default other arg | |
296 | if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then | |
297 | targets=${host} | |
298 | defaulttargets=true | |
299 | fi | |
99a42820 | 300 | |
6c18e393 RP |
301 | host_makefile_frag=config/hmake-${host} |
302 | ||
b5132a6b | 303 | #### configure.in per-host parts come in here. |
99a42820 | 304 | |
21c9f626 RP |
305 | if [ ! -f config/hmake-${host} ] ; then |
306 | echo No such host available: ${host} | |
307 | exit 1 | |
308 | fi | |
309 | ||
c4220303 | 310 | ## end of per-host part. |
f2e91404 | 311 | |
99a42820 | 312 | |
b5132a6b RP |
313 | for target in ${targets} ; do |
314 | ||
315 | if [ -n "${verbose}" ] ; then | |
21a56d6d | 316 | echo " target=\"${target}\"" |
a9c7e163 | 317 | fi |
b5132a6b | 318 | |
6c18e393 RP |
319 | target_makefile_frag=config/tmake-${target} |
320 | ||
b5132a6b RP |
321 | #### configure.in per-target parts come in here. |
322 | ||
21c9f626 RP |
323 | if [ ! -f config/tmake-${target} ] ; then |
324 | echo No such target available: ${target} | |
325 | exit 1 | |
326 | fi | |
327 | ||
b5132a6b RP |
328 | files= |
329 | links= | |
c4220303 | 330 | ## end of per-target part. |
b5132a6b RP |
331 | |
332 | # Temporarily, we support only direct subdir builds. | |
333 | hostsubdir=Host-${host} | |
334 | targetsubdir=Target-${target} | |
335 | ||
336 | if [ -n "${removing}" ] ; then | |
21c9f626 | 337 | if [ -n "${subdirs}" ] ; then |
c4220303 RP |
338 | if [ -d "${hostsubdir}" ] ; then |
339 | rm -rf ${hostsubdir}/${targetsubdir} | |
b5132a6b | 340 | |
c4220303 RP |
341 | if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then |
342 | rm -rf ${hostsubdir} | |
343 | fi | |
344 | else | |
345 | echo Warning: no `pwd`/${hostsubdir} to remove. | |
b5132a6b RP |
346 | fi |
347 | else | |
21a56d6d | 348 | rm -f ${Makefile} config.status ${links} |
b5132a6b | 349 | fi |
a9c7e163 | 350 | else |
21c9f626 | 351 | if [ -n "${subdirs}" ] ; then |
b5132a6b | 352 | # check for existing status before allowing forced subdirs. |
21a56d6d JG |
353 | if [ -f ${Makefile} ] ; then |
354 | echo "${Makefile} already exists in source directory. `pwd` not configured." | |
b5132a6b RP |
355 | exit 1 |
356 | fi | |
99a42820 | 357 | |
b5132a6b RP |
358 | if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi |
359 | cd ${hostsubdir} | |
99a42820 | 360 | |
b5132a6b RP |
361 | if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi |
362 | cd ${targetsubdir} | |
99a42820 | 363 | |
b5132a6b RP |
364 | srcdir=../.. |
365 | else | |
366 | # if not subdir builds, then make sure none exist. | |
367 | if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then | |
368 | echo "Configured subdirs exist. `pwd` not configured." | |
369 | exit 1 | |
370 | fi | |
371 | fi | |
99a42820 | 372 | |
b5132a6b RP |
373 | # Find the source files, if location was not specified. |
374 | if [ -z "${srcdir}" ] ; then | |
375 | srcdirdefaulted=1 | |
376 | srcdir=. | |
377 | if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then | |
378 | srcdir=.. | |
379 | fi | |
380 | fi | |
99a42820 | 381 | |
b5132a6b RP |
382 | if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then |
383 | if [ -z "${srcdirdefaulted}" ] ; then | |
c4220303 | 384 | echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 |
b5132a6b | 385 | else |
c4220303 | 386 | echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 |
b5132a6b | 387 | fi |
99a42820 | 388 | |
c4220303 | 389 | echo \(At least ${srctrigger} is missing.\) 1>&2 |
b5132a6b RP |
390 | exit 1 |
391 | fi | |
f2e91404 | 392 | |
b5132a6b RP |
393 | # Set up the list of links to be made. |
394 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
99a42820 | 395 | |
b5132a6b RP |
396 | # Make the links. |
397 | while [ -n "${files}" ] ; do | |
398 | # set file to car of files, files to cdr of files | |
399 | set ${files}; file=$1; shift; files=$* | |
400 | set ${links}; link=$1; shift; links=$* | |
f2e91404 | 401 | |
b5132a6b RP |
402 | if [ ! -r ${srcdir}/${file} ] ; then |
403 | echo "${progname}: cannot create a link \"${link}\"," 1>&2 | |
404 | echo "since the file \"${file}\" does not exist." 1>&2 | |
405 | exit 1 | |
406 | fi | |
f2e91404 | 407 | |
b5132a6b RP |
408 | ${remove} -f ${link} |
409 | rm -f config.status | |
410 | # Make a symlink if possible, otherwise try a hard link | |
411 | ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} | |
f2e91404 | 412 | |
b5132a6b RP |
413 | if [ ! -r ${link} ] ; then |
414 | echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 | |
415 | exit 1 | |
416 | fi | |
417 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
418 | done | |
f2e91404 | 419 | |
b5132a6b RP |
420 | # Create a .gdbinit file which runs the one in srcdir |
421 | # and tells GDB to look there for source files. | |
422 | ||
423 | case ${srcdir} in | |
424 | .) | |
425 | ;; | |
426 | *) | |
427 | echo "dir ." > .gdbinit | |
428 | echo "dir ${srcdir}" >> .gdbinit | |
429 | echo "source ${srcdir}/.gdbinit" >> .gdbinit | |
430 | ;; | |
431 | esac | |
432 | ||
433 | # Install a makefile, and make it set VPATH | |
434 | # if necessary so that the sources are found. | |
435 | # Also change its value of srcdir. | |
436 | ||
437 | # FIXME-someday: This business of always writing to .tem and mv back | |
438 | # is so that I don't screw things up while developing. Once this | |
439 | # template is stable, these should be optimized. xoxorich. | |
440 | ||
441 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
442 | if [ "${host}" != "${target}" ] ; then | |
21a56d6d JG |
443 | echo "CROSS=-DCROSS_COMPILE" > ${Makefile} |
444 | echo "ALL=start.encap" >> ${Makefile} | |
b5132a6b | 445 | else |
21a56d6d | 446 | echo "ALL=all.internal" > ${Makefile} |
b5132a6b | 447 | fi |
f2e91404 | 448 | |
b5132a6b | 449 | # set target, host, VPATH |
21a56d6d JG |
450 | echo "host = ${host}" >> ${Makefile} |
451 | echo "target = ${target}" >> ${Makefile} | |
f2e91404 | 452 | |
21c9f626 | 453 | if [ -n "${subdirs}" ] ; then |
21a56d6d | 454 | echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile} |
b5132a6b | 455 | else |
21a56d6d | 456 | echo "subdir =" >> ${Makefile} |
b5132a6b | 457 | fi |
f2e91404 | 458 | |
21a56d6d JG |
459 | # echo "workdir = `pwd`" >> ${Makefile} |
460 | echo "VPATH = ${srcdir}" >> ${Makefile} | |
99a42820 | 461 | |
21a56d6d JG |
462 | # add "Makefile.in" (or whatever it's called) |
463 | cat ${srcdir}/${Makefile_in} >> ${Makefile} | |
99a42820 | 464 | |
b5132a6b | 465 | # Conditionalize the makefile for this host. |
6c18e393 | 466 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
21a56d6d JG |
467 | sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile} > Makefile.tem |
468 | mv Makefile.tem ${Makefile} | |
b5132a6b | 469 | fi |
f2e91404 | 470 | |
b5132a6b | 471 | # Conditionalize the makefile for this target. |
6c18e393 | 472 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
21a56d6d JG |
473 | sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile} > Makefile.tem |
474 | mv Makefile.tem ${Makefile} | |
b5132a6b | 475 | fi |
ec342d7d | 476 | |
b5132a6b | 477 | # set srcdir |
21a56d6d JG |
478 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem |
479 | mv Makefile.tem ${Makefile} | |
99a42820 | 480 | |
b5132a6b RP |
481 | # set destdir |
482 | if [ -n "${destdir}" ] ; then | |
21a56d6d JG |
483 | sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem |
484 | mv Makefile.tem ${Makefile} | |
b5132a6b | 485 | fi |
99a42820 | 486 | |
b5132a6b | 487 | # reset SUBDIRS |
21a56d6d JG |
488 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem |
489 | mv Makefile.tem ${Makefile} | |
99a42820 | 490 | |
b5132a6b | 491 | # reset NONSUBDIRS |
21a56d6d JG |
492 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem |
493 | mv Makefile.tem ${Makefile} | |
99a42820 | 494 | |
b5132a6b | 495 | using= |
6c18e393 RP |
496 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
497 | using=" using \"${host_makefile_frag}\"" | |
b5132a6b | 498 | fi |
99a42820 | 499 | |
6c18e393 | 500 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
b5132a6b | 501 | if [ -z "${using}" ] ; then |
6c18e393 | 502 | andusing=" using \"${target_makefile_frag}\"" |
b5132a6b | 503 | else |
6c18e393 | 504 | andusing="${using} and \"${target_makefile_frag}\"" |
b5132a6b RP |
505 | fi |
506 | else | |
507 | andusing=${using} | |
508 | fi | |
99a42820 | 509 | |
21a56d6d JG |
510 | echo "Created \"${Makefile}\"" in `pwd`${andusing}. |
511 | ||
512 | #### configure.in post-target parts come in here. | |
513 | ||
514 | ## end of post-target part. | |
99a42820 | 515 | |
b5132a6b RP |
516 | if [ "${host}" = "${target}" ] ; then |
517 | echo "Links are now set up for use with a ${target}." \ | |
518 | > config.status | |
519 | # | tee ${srcdir}/config.status | |
520 | else | |
521 | echo "Links are now set up for host ${host} and target ${target}." \ | |
522 | > config.status | |
523 | # | tee ${srcdir}/config.status | |
524 | fi | |
525 | ||
526 | originaldir=`pwd` | |
527 | cd ${srcdir} | |
528 | fi | |
c4220303 RP |
529 | done # for each target |
530 | ||
4101d868 | 531 | # Now build a Makefile for this host. |
21c9f626 | 532 | if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then |
4101d868 RP |
533 | cd ${hostsubdir} |
534 | cat > GNUmakefile << E!O!F | |
535 | # Makefile generated by configure for host ${host}. | |
536 | ||
537 | ALL := $(shell ls -d Target-*) | |
538 | ||
539 | %: | |
540 | $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true | |
541 | ||
542 | all: | |
543 | E!O!F | |
544 | cd .. | |
545 | fi | |
c4220303 | 546 | done # for each host |
99a42820 | 547 | |
b5132a6b | 548 | # If there are subdirectories, then recurse. |
99a42820 | 549 | |
b5132a6b | 550 | if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi |
99a42820 | 551 | |
b5132a6b RP |
552 | # configdirs is not null |
553 | for configdir in ${configdirs} ; do | |
99a42820 | 554 | echo Configuring ${configdir}... |
b5132a6b RP |
555 | specifics= |
556 | commons= | |
557 | ||
558 | if [ -n "${defaulttargets}" ] ; then | |
559 | for host in ${hosts} ; do | |
560 | if [ -d ${configdir}.${host} ] ; then | |
561 | newspecifics="${specifics} ${host}" | |
562 | specifics=${newspecifics} | |
563 | else | |
564 | newcommons="${commons} ${host}" | |
565 | commons=${newcommons} | |
566 | fi # if target specific | |
567 | done # for each host | |
568 | ||
569 | if [ -n "${commons}" ] ; then | |
6c18e393 RP |
570 | if [ -d ${configdir} ] ; then |
571 | (cd ${configdir} ; | |
21c9f626 | 572 | ./configure ${commons} ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \ |
6c18e393 RP |
573 | | sed 's/^/ /' |
574 | else | |
575 | echo Warning: directory \"${configdir}\" is missing. | |
576 | fi | |
b5132a6b RP |
577 | fi # if any common hosts |
578 | ||
579 | if [ -n "${specifics}" ] ; then | |
580 | for host in ${specifics} ; do | |
581 | echo Configuring target specific directory ${configdir}.${host}... | |
582 | (cd ${configdir}.${host} ; | |
21c9f626 | 583 | ./configure ${host} ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \ |
b5132a6b RP |
584 | | sed 's/^/ /' |
585 | done # for host in specifics | |
586 | fi # if there are any specifics | |
587 | else | |
588 | ||
589 | for target in ${targets} ; do | |
590 | if [ -d ${configdir}.${target} ] ; then | |
591 | newspecifics="${specifics} ${target}" | |
592 | specifics=${newspecifics} | |
593 | else | |
594 | newcommons="${commons} +target=${target}" | |
595 | commons=${newcommons} | |
596 | fi | |
597 | ||
598 | done # check for target specific dir override | |
599 | ||
600 | if [ -n "${verbose}" ] ; then | |
601 | echo " "commons=\"${commons}\" | |
602 | echo " "specifics=\"${specifics}\" | |
603 | fi # if verbose | |
604 | ||
605 | if [ -n "${commons}" ] ; then | |
6c18e393 RP |
606 | if [ -d ${configdir} ] ; then |
607 | (cd ${configdir} ; | |
21c9f626 | 608 | ./configure ${hosts} ${verbose} ${subdirs} ${removing} \ |
4101d868 | 609 | ${commons} +destdir=${destdir}) \ |
6c18e393 RP |
610 | | sed 's/^/ /' |
611 | else | |
612 | echo Warning: directory \"${configdir}\" is missing. | |
613 | fi | |
b5132a6b RP |
614 | fi # if any commons |
615 | ||
616 | if [ -n "${specifics}" ] ; then | |
617 | for target in ${specifics} ; do | |
618 | echo Configuring target specific directory ${configdir}.${target}... | |
619 | (cd ${configdir}.${target} ; | |
21c9f626 | 620 | ./configure ${hosts} ${verbose} ${subdirs} ${removing} \ |
4101d868 | 621 | "+target=${target}" +destdir=${destdir}) \ |
b5132a6b RP |
622 | | sed 's/^/ /' |
623 | done | |
624 | fi # if any specifics | |
625 | fi # not default targets | |
99a42820 RP |
626 | done |
627 | ||
628 | exit 0 | |
a9c7e163 RP |
629 | |
630 | # | |
631 | # $Log$ | |
21c9f626 RP |
632 | # Revision 1.19 1991/08/14 22:10:10 rich |
633 | # Added fatal checks for missing host and target makefile fragments. | |
634 | # | |
635 | # Revision 1.18 1991/08/08 01:11:33 rich | |
636 | # allow +f to stand in for +subdirs | |
637 | # | |
638 | # Revision 1.26 1991/08/07 19:21:32 rich | |
639 | # +forcesubdirs -> +subdirs | |
640 | # | |
641 | # Revision 1.25 1991/08/07 07:05:30 rich | |
642 | # Added make. | |
643 | # | |
644 | # Revision 1.24 1991/08/06 19:26:01 rich | |
645 | # revised option parsing. | |
646 | # | |
647 | # Revision 1.23 1991/08/06 19:12:32 rich | |
4101d868 RP |
648 | # Host-level GNUmakefiles. |
649 | # | |
650 | # Revision 1.22 1991/07/20 01:22:30 rich | |
651 | # propogate gdb changes and destdir fix | |
652 | # | |
653 | # Revision 1.21 1991/07/20 00:55:20 gnu | |
654 | # Roll in new configure that handles GDB. Make sure that the "configure" | |
655 | # that is checked-in reflects the latest "configure.in", which includes gdb. | |
21a56d6d JG |
656 | # |
657 | # Revision 1.9 1991/07/06 04:35:51 gnu | |
658 | # Fix bug in configure when iterating targets. | |
659 | # Depend on alldeps.mak, not ${srcdir}/alldeps.mak, so it can be found | |
660 | # in either spot. | |
661 | # | |
662 | # Revision 1.8 1991/07/05 00:04:58 gnu | |
663 | # Thu Jul 4 14:47:06 1991 John Gilmore (gnu at cygint.cygnus.com) | |
664 | # | |
665 | # * configure.in, Makefile.in: Avoid rebuilding "depend" as much. | |
666 | # Avoid declaring Makefile dependencies, because GNU Make stupidly | |
667 | # tries to update it if we do. | |
668 | # | |
669 | # * coffread.c: Revise for minor changes to bfd internal coff | |
670 | # indexes. | |
671 | # | |
672 | # * configure: If -template= is given a relative path, make it | |
673 | # absolute before recurring in subdirectories. | |
6c18e393 | 674 | # |
21a56d6d JG |
675 | # Revision 1.7 1991/07/04 15:59:46 gnu |
676 | # Make gdb work with configure. Only thing that doesn't work is the -list | |
677 | # option (as far as I know). | |
6c18e393 | 678 | # |
21a56d6d JG |
679 | # Revision 1.6 1991/06/04 07:28:16 gnu |
680 | # Change GDB over to GNU General Public License version 2. | |
6c18e393 | 681 | # |
21a56d6d JG |
682 | # Revision 1.5 1991/05/19 07:26:54 rich |
683 | # configure changes and -opcode.h movement. | |
6c18e393 RP |
684 | # |
685 | # Revision 1.4 1991/05/19 00:16:45 rich | |
686 | # Configure for gdb. | |
c4220303 RP |
687 | # |
688 | # Revision 1.10 1991/05/04 00:58:38 rich | |
689 | # Fix program name bug. | |
690 | # | |
691 | # Revision 1.9 1991/05/03 19:14:18 rich | |
692 | # Changed getopt to libiberty, commented out an aborted attempt at host | |
693 | # level Makefiles because it caused errors on +rm, add a warning for | |
694 | # directories expected to be removed on +rm but that don't exist. | |
695 | # | |
696 | # Revision 1.8 1991/04/24 16:50:59 rich | |
697 | # Three staging checkpoint. | |
698 | # | |
699 | # Revision 1.7 1991/04/17 01:34:47 rich | |
700 | # Added getopt for binutils, fixed problem with host dependancies in | |
701 | # configure.template. | |
04dc1a62 RP |
702 | # |
703 | # Revision 1.6 1991/04/16 00:18:44 rich | |
b5132a6b RP |
704 | # Now handles multiple hosts and targets. |
705 | # | |
706 | # Revision 1.5 1991/04/15 23:43:44 rich | |
707 | # Now handles multiple hosts and targets. | |
708 | # | |
709 | # Revision 1.4 1991/04/13 02:11:03 rich | |
ec342d7d RP |
710 | # Config cut 3. We now almost install a29k. |
711 | # | |
712 | # Revision 1.3 1991/04/11 02:41:54 rich | |
713 | # Cut 2 config. Subdirs. | |
a9c7e163 RP |
714 | # |
715 | # | |
716 | # | |
717 | ||
b5132a6b RP |
718 | # |
719 | # Local Variables: | |
720 | # fill-column: 131 | |
721 | # End: | |
722 | # | |
a9c7e163 RP |
723 | |
724 | # end of configure.template |