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