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