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