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