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