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