]>
Commit | Line | Data |
---|---|---|
eb02fd64 | 1 | #!/bin/sh |
eb02fd64 | 2 | |
46f3c7cd | 3 | # Configuration script |
eb02fd64 RP |
4 | # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc. |
5 | ||
6 | #This file is part of GNU. | |
7 | ||
063efd10 JG |
8 | # This program is free software; you can redistribute it and/or modify |
9 | # it under the terms of the GNU General Public License as published by | |
10 | # the Free Software Foundation; either version 2 of the License, or | |
11 | # (at your option) any later version. | |
12 | # | |
13 | # This program is distributed in the hope that it will be useful, | |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
17 | # | |
18 | # You should have received a copy of the GNU General Public License | |
19 | # along with this program; if not, write to the Free Software | |
20 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
eb02fd64 | 21 | |
74cc5508 RP |
22 | # $Id$ |
23 | ||
eb02fd64 RP |
24 | # |
25 | # Shell script to create proper links to machine-dependent files in | |
0df06ca0 | 26 | # preparation for compilation. |
eb02fd64 RP |
27 | # |
28 | # If configure succeeds, it leaves its status in config.status. | |
29 | # If configure fails after disturbing the status quo, | |
30 | # config.status is removed. | |
31 | # | |
32 | ||
eb02fd64 RP |
33 | remove=rm |
34 | hard_link=ln | |
35 | symbolic_link='ln -s' | |
36 | ||
37 | #for Test | |
38 | #remove="echo rm" | |
39 | #hard_link="echo ln" | |
40 | #symbolic_link="echo ln -s" | |
41 | ||
7df72310 RP |
42 | progname=$0 |
43 | ||
eb02fd64 | 44 | # clear some things potentially inherited from environment. |
eb02fd64 | 45 | ansi= |
b8f8fddc | 46 | arguments=$* |
0df06ca0 | 47 | defaulttargets= |
ec342d7d | 48 | destdir= |
0df06ca0 | 49 | fatal= |
131a3881 | 50 | hostsubdir= |
063efd10 JG |
51 | Makefile=Makefile |
52 | Makefile_in=Makefile.in | |
46766962 RP |
53 | norecursion= |
54 | recurring= | |
131a3881 | 55 | removing= |
74cc5508 | 56 | srcdir= |
ec342d7d | 57 | srctrigger= |
131a3881 | 58 | target= |
0df06ca0 | 59 | targets= |
bc58b41d | 60 | commontargets= |
46f3c7cd | 61 | configdirs= |
131a3881 RP |
62 | targetsubdir= |
63 | template= | |
0df06ca0 | 64 | verbose= |
eb02fd64 RP |
65 | |
66 | for arg in $*; | |
67 | do | |
ec342d7d | 68 | case ${arg} in |
9fddf5af | 69 | -ansi | +a*) |
eb02fd64 | 70 | ansi=true |
bc58b41d | 71 | clib=clib |
eb02fd64 | 72 | ;; |
ec342d7d RP |
73 | -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*) |
74 | destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'` | |
75 | ;; | |
74cc5508 RP |
76 | -languages=* | +languages=* | +language=* | +languag=* \ |
77 | | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ | |
78 | | +l=*) | |
ec342d7d | 79 | languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`" |
eb02fd64 | 80 | ;; |
bc58b41d | 81 | -gas | +g*) |
eb02fd64 RP |
82 | gas=yes |
83 | ;; | |
9fddf5af | 84 | -help | +h*) |
0df06ca0 RP |
85 | fatal=true |
86 | ;; | |
9fddf5af | 87 | -nfp | +nf*) |
eb02fd64 RP |
88 | nfp=yes |
89 | ;; | |
46766962 RP |
90 | -norecursion | +no*) |
91 | norecursion=true | |
131a3881 | 92 | ;; |
46766962 RP |
93 | -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re) |
94 | recurring=true | |
bc58b41d | 95 | ;; |
46766962 | 96 | -rm | +rm) |
ec342d7d | 97 | removing=${arg} |
131a3881 | 98 | ;; |
0df06ca0 RP |
99 | # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) |
100 | # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` | |
101 | # ;; | |
bc58b41d | 102 | -subdirs | +f* | +su*) |
991643f5 RP |
103 | subdirs=${arg} |
104 | ;; | |
9fddf5af | 105 | -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) |
0df06ca0 | 106 | if [ -n "${targets}" ] ; then |
991643f5 | 107 | subdirs="+subdirs" |
0df06ca0 RP |
108 | fi |
109 | ||
110 | newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" | |
111 | targets="${newtargets}" | |
131a3881 | 112 | ;; |
9fddf5af | 113 | -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*) |
ec342d7d | 114 | template=`echo ${arg} | sed 's/[+-]template=//'` |
131a3881 | 115 | ;; |
bc58b41d | 116 | -v | -verbose | +v*) |
0df06ca0 RP |
117 | verbose=${arg} |
118 | ;; | |
119 | -* | +*) | |
120 | (echo ; | |
121 | echo "Unrecognized option: \"${arg}\"". ; | |
122 | echo) 1>&2 | |
123 | fatal=true | |
124 | ;; | |
eb02fd64 | 125 | *) |
0df06ca0 | 126 | if [ -n "${hosts}" ] ; then |
991643f5 | 127 | subdirs="+subdirs" |
0df06ca0 RP |
128 | fi |
129 | ||
130 | newhosts="${hosts} ${arg}" | |
131 | hosts=${newhosts} | |
eb02fd64 RP |
132 | ;; |
133 | esac | |
134 | done | |
135 | ||
0df06ca0 RP |
136 | if [ -n "${verbose}" ] ; then |
137 | echo `pwd`/configure $* | |
0df06ca0 RP |
138 | fi |
139 | ||
131a3881 | 140 | # process host and target only if not rebuilding configure itself or removing. |
0df06ca0 | 141 | if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then |
eb02fd64 | 142 | # Complain if an arg is missing |
0df06ca0 RP |
143 | if [ -z "${hosts}" ] ; then |
144 | (echo ; | |
145 | echo "configure: No HOST specified." ; | |
bc58b41d | 146 | echo) 1>&2 |
0df06ca0 | 147 | fatal=true |
eb02fd64 | 148 | fi |
131a3881 | 149 | fi |
eb02fd64 | 150 | |
0df06ca0 RP |
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]" ; | |
991643f5 | 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]" ; | |
46766962 | 162 | echo " +norecursion configure this directory only. [recurse]" ; |
0df06ca0 RP |
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." ; | |
991643f5 | 168 | echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; |
0df06ca0 RP |
169 | echo "options given will apply to all targets.") 1>&2 |
170 | ||
171 | if [ -r config.status ] ; then | |
172 | cat config.status | |
173 | fi | |
174 | ||
175 | exit 1 | |
eb02fd64 RP |
176 | fi |
177 | ||
0df06ca0 | 178 | #### configure.in common parts come in here. |
eb02fd64 RP |
179 | # This file is a shell script fragment that supplies the information |
180 | # necessary to tailor a template configure script into the configure | |
181 | # script appropriate for this directory. For more information, check | |
182 | # any existing configure script. | |
183 | ||
46766962 | 184 | configdirs="libiberty bfd binutils bison gcc readline ld gas gnulib ${clib} gdb emacs make grep diff rcs gdbm cvs prms" |
131a3881 | 185 | srctrigger=README.configure |
eb02fd64 | 186 | srcname="gnu development package" |
0df06ca0 | 187 | |
7df72310 | 188 | ## end of common part. |
eb02fd64 RP |
189 | |
190 | # are we rebuilding config itself? | |
0df06ca0 RP |
191 | if [ -n "${template}" ] ; then |
192 | if [ ! -r ${template} ] ; then | |
bc58b41d | 193 | echo '***' "Can't find template ${template}." 1>&2 |
eb02fd64 RP |
194 | exit 1 |
195 | fi | |
196 | ||
7df72310 RP |
197 | # prep the template |
198 | sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\ | |
199 | #### configure.in common parts come in here.\ | |
200 | ## end of common part.' \ | |
201 | -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\ | |
202 | #### configure.in per-host parts come in here.\ | |
203 | ## end of per-host part.' \ | |
204 | -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\ | |
205 | #### configure.in per-target parts come in here.\ | |
206 | ## end of per-target part.' \ | |
063efd10 JG |
207 | -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\ |
208 | #### configure.in post-target parts come in here.\ | |
209 | ## end of post-target part.' \ | |
7df72310 | 210 | < ${template} > template.new |
eb02fd64 | 211 | |
0df06ca0 RP |
212 | if [ -r configure.in ] ; then |
213 | if [ -z "`grep '^# per\-host:' configure.in`" ] ; then | |
bc58b41d | 214 | echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 |
0df06ca0 RP |
215 | exit 1 |
216 | fi | |
217 | ||
218 | if [ -z "`grep '^# per\-target:' configure.in`" ] ; then | |
bc58b41d | 219 | echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 |
0df06ca0 RP |
220 | exit 1 |
221 | fi | |
222 | ||
063efd10 JG |
223 | # split configure.in into common, per-host, per-target, |
224 | # and post-target parts. Post-target is optional. | |
2b34da49 RP |
225 | sed -e '/^# per\-host:/,$d' configure.in > configure.com |
226 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst | |
063efd10 JG |
227 | if grep -s '^# post-target:' configure.in ; then |
228 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt | |
229 | sed -e '1,/^# post\-target:/d' configure.in > configure.pos | |
230 | else | |
231 | sed -e '1,/^# per\-target:/d' configure.in > configure.tgt | |
232 | echo >configure.pos | |
233 | fi | |
0df06ca0 | 234 | |
2b34da49 | 235 | # and insert them |
7df72310 RP |
236 | sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \ |
237 | -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \ | |
238 | -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \ | |
063efd10 | 239 | -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \ |
7df72310 | 240 | template.new > configure.new |
0df06ca0 | 241 | |
063efd10 | 242 | rm -f configure.com configure.tgt configure.hst configure.pos |
eb02fd64 | 243 | else |
ec342d7d RP |
244 | echo Warning: no configure.in in `pwd` |
245 | cat ${template} >> configure | |
eb02fd64 RP |
246 | fi |
247 | ||
7df72310 RP |
248 | chmod a+x configure.new |
249 | rm template.new | |
250 | # mv configure configure.old | |
251 | mv configure.new configure | |
bc58b41d RP |
252 | |
253 | if [ -n "${verbose}" ] ; then | |
254 | echo Rebuilt configure in `pwd` | |
255 | fi | |
256 | ||
257 | # Now update config.sub from the template directory. | |
258 | if echo "$template" | grep -s 'configure$' ; then | |
259 | cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new | |
260 | # mv config.sub config.sub.old | |
261 | mv config.sub.new config.sub | |
262 | ||
263 | if [ -n "${verbose}" ] ; then | |
264 | echo Rebuilt config.sub in `pwd` | |
265 | fi | |
266 | fi | |
eb02fd64 | 267 | |
46766962 RP |
268 | if [ -z "${norecursion}" ] ; then |
269 | # If template is relative path, make it absolute for recurring. | |
063efd10 JG |
270 | if echo "${template}" | grep -s '^/' ; then |
271 | true | |
272 | else | |
273 | template=`pwd`/${template} | |
274 | fi | |
275 | ||
0df06ca0 | 276 | while [ -n "${configdirs}" ] ; do |
eb02fd64 | 277 | # set configdir to car of configdirs, configdirs to cdr of configdirs |
ec342d7d | 278 | set ${configdirs}; configdir=$1; shift; configdirs=$* |
eb02fd64 | 279 | |
0df06ca0 | 280 | if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then |
eb02fd64 RP |
281 | targetspecificdirs=${configdir}.* |
282 | else | |
283 | targetspecificdirs= | |
284 | fi | |
285 | ||
0df06ca0 | 286 | for i in ${configdir} ${targetspecificdirs} ; do |
9d1e053b RP |
287 | if [ -d $i ] ; then |
288 | if [ -r $i/configure ] ; then | |
289 | (cd $i ; | |
290 | ./configure +template=${template} ${verbose}) | |
291 | else | |
bc58b41d | 292 | echo Warning: No configure script in `pwd`/$i |
9d1e053b | 293 | fi |
eb02fd64 | 294 | else |
bc58b41d RP |
295 | if [ -n "${verbose}" ] ; then |
296 | echo Warning: directory $i is missing. | |
297 | fi | |
eb02fd64 RP |
298 | fi |
299 | done | |
300 | done | |
301 | fi | |
302 | ||
303 | exit 0 | |
304 | fi | |
305 | ||
ec342d7d | 306 | # some sanity checks on configure.in |
0df06ca0 | 307 | if [ -z "${srctrigger}" ] ; then |
bc58b41d | 308 | echo Warning: srctrigger not set in configure.in. `pwd` not configured. |
ec342d7d RP |
309 | exit 1 |
310 | fi | |
311 | ||
0df06ca0 RP |
312 | for host in ${hosts} ; do |
313 | # Default other arg | |
314 | if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then | |
315 | targets=${host} | |
316 | defaulttargets=true | |
317 | fi | |
eb02fd64 | 318 | |
b8f8fddc RP |
319 | host_alias=${host} |
320 | ||
bc58b41d 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 | ||
0df06ca0 | 328 | #### configure.in per-host parts come in here. |
6408afba | 329 | |
46f3c7cd RP |
330 | # XXX - FIXME there needs to be a case for hmake-dgux |
331 | ||
332 | case "${host_os}" in | |
333 | sysv* | irix*) host_makefile_frag=config/hmake-sysv ;; | |
334 | esac | |
335 | ||
7df72310 | 336 | ## end of per-host part. |
eb02fd64 | 337 | |
0df06ca0 | 338 | for target in ${targets} ; do |
eb02fd64 | 339 | |
b8f8fddc | 340 | target_alias=${target} |
bc58b41d RP |
341 | result=`/bin/sh ./config.sub ${target}` |
342 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` | |
343 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
344 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
345 | target=${target_cpu}-${target_vendor}-${target_os} | |
6c18e393 | 346 | target_makefile_frag=config/tmake-${target} |
6408afba | 347 | |
6c18e393 | 348 | #### configure.in per-target parts come in here. |
bc58b41d | 349 | |
46f3c7cd RP |
350 | # XXX - FIXME there needs to be a case for tmake-a29k |
351 | ||
bc58b41d RP |
352 | # |
353 | # Local Variables: | |
354 | # fill-column: 131 | |
355 | # End: | |
356 | # | |
7df72310 | 357 | ## end of per-target part. |
0df06ca0 RP |
358 | |
359 | # Temporarily, we support only direct subdir builds. | |
b8f8fddc RP |
360 | hostsubdir=H-${host_alias} |
361 | targetsubdir=T-${target_alias} | |
0df06ca0 RP |
362 | |
363 | if [ -n "${removing}" ] ; then | |
991643f5 | 364 | if [ -n "${subdirs}" ] ; then |
67ca110d RP |
365 | if [ -d "${hostsubdir}" ] ; then |
366 | rm -rf ${hostsubdir}/${targetsubdir} | |
0df06ca0 | 367 | |
bc58b41d | 368 | if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then |
67ca110d RP |
369 | rm -rf ${hostsubdir} |
370 | fi | |
371 | else | |
372 | echo Warning: no `pwd`/${hostsubdir} to remove. | |
0df06ca0 RP |
373 | fi |
374 | else | |
063efd10 | 375 | rm -f ${Makefile} config.status ${links} |
0df06ca0 | 376 | fi |
74cc5508 | 377 | else |
991643f5 | 378 | if [ -n "${subdirs}" ] ; then |
0df06ca0 | 379 | # check for existing status before allowing forced subdirs. |
063efd10 | 380 | if [ -f ${Makefile} ] ; then |
bc58b41d | 381 | echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2 |
0df06ca0 RP |
382 | exit 1 |
383 | fi | |
eb02fd64 | 384 | |
0df06ca0 RP |
385 | if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi |
386 | cd ${hostsubdir} | |
eb02fd64 | 387 | |
bc58b41d 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 | 400 | cd ${targetsubdir} |
eb02fd64 | 401 | |
0df06ca0 RP |
402 | srcdir=../.. |
403 | else | |
404 | # if not subdir builds, then make sure none exist. | |
405 | if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then | |
bc58b41d | 406 | echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2 |
0df06ca0 RP |
407 | exit 1 |
408 | fi | |
409 | fi | |
eb02fd64 | 410 | |
0df06ca0 RP |
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 | |
eb02fd64 | 419 | |
0df06ca0 RP |
420 | if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then |
421 | if [ -z "${srcdirdefaulted}" ] ; then | |
bc58b41d | 422 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 |
0df06ca0 | 423 | else |
bc58b41d | 424 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 |
0df06ca0 | 425 | fi |
eb02fd64 | 426 | |
bc58b41d | 427 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 |
0df06ca0 RP |
428 | exit 1 |
429 | fi | |
131a3881 | 430 | |
0df06ca0 RP |
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. | |
eb02fd64 | 433 | |
0df06ca0 RP |
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=$* | |
131a3881 | 439 | |
0df06ca0 | 440 | if [ ! -r ${srcdir}/${file} ] ; then |
bc58b41d RP |
441 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 |
442 | echo '***' "since the file \"${file}\" does not exist." 1>&2 | |
0df06ca0 RP |
443 | exit 1 |
444 | fi | |
131a3881 | 445 | |
0df06ca0 RP |
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} | |
131a3881 | 450 | |
0df06ca0 | 451 | if [ ! -r ${link} ] ; then |
bc58b41d | 452 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 |
0df06ca0 RP |
453 | exit 1 |
454 | fi | |
bc58b41d RP |
455 | |
456 | if [ -n "${verbose}" ] ; then | |
457 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
458 | fi | |
0df06ca0 | 459 | done |
131a3881 | 460 | |
0df06ca0 RP |
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 | |
063efd10 JG |
484 | echo "CROSS=-DCROSS_COMPILE" > ${Makefile} |
485 | echo "ALL=start.encap" >> ${Makefile} | |
0df06ca0 | 486 | else |
063efd10 | 487 | echo "ALL=all.internal" > ${Makefile} |
0df06ca0 | 488 | fi |
131a3881 | 489 | |
0df06ca0 | 490 | # set target, host, VPATH |
b8f8fddc RP |
491 | echo "host_alias = ${host_alias}" >> ${Makefile} |
492 | echo "host_cpu = ${host_cpu}" >> ${Makefile} | |
493 | echo "host_vendor = ${host_vendor}" >> ${Makefile} | |
494 | echo "host_os = ${host_os}" >> ${Makefile} | |
495 | ||
496 | echo "target_alias = ${target_alias}" >> ${Makefile} | |
497 | echo "target_cpu = ${target_cpu}" >> ${Makefile} | |
498 | echo "target_vendor = ${target_vendor}" >> ${Makefile} | |
499 | echo "target_os = ${target_os}" >> ${Makefile} | |
131a3881 | 500 | |
991643f5 | 501 | if [ -n "${subdirs}" ] ; then |
063efd10 | 502 | echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile} |
0df06ca0 | 503 | else |
063efd10 | 504 | echo "subdir =" >> ${Makefile} |
0df06ca0 | 505 | fi |
131a3881 | 506 | |
063efd10 JG |
507 | # echo "workdir = `pwd`" >> ${Makefile} |
508 | echo "VPATH = ${srcdir}" >> ${Makefile} | |
eb02fd64 | 509 | |
063efd10 JG |
510 | # add "Makefile.in" (or whatever it's called) |
511 | cat ${srcdir}/${Makefile_in} >> ${Makefile} | |
eb02fd64 | 512 | |
0df06ca0 | 513 | # Conditionalize the makefile for this host. |
9d1e053b | 514 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
b8f8fddc RP |
515 | (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ; |
516 | sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem | |
063efd10 | 517 | mv Makefile.tem ${Makefile} |
0df06ca0 | 518 | fi |
131a3881 | 519 | |
0df06ca0 | 520 | # Conditionalize the makefile for this target. |
9d1e053b | 521 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
b8f8fddc RP |
522 | (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; |
523 | sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem | |
063efd10 | 524 | mv Makefile.tem ${Makefile} |
0df06ca0 | 525 | fi |
ec342d7d | 526 | |
0df06ca0 | 527 | # set srcdir |
063efd10 JG |
528 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem |
529 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 530 | |
0df06ca0 RP |
531 | # set destdir |
532 | if [ -n "${destdir}" ] ; then | |
063efd10 JG |
533 | sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem |
534 | mv Makefile.tem ${Makefile} | |
0df06ca0 | 535 | fi |
eb02fd64 | 536 | |
0df06ca0 | 537 | # reset SUBDIRS |
063efd10 JG |
538 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem |
539 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 540 | |
0df06ca0 | 541 | # reset NONSUBDIRS |
063efd10 JG |
542 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem |
543 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 544 | |
0df06ca0 | 545 | using= |
9d1e053b RP |
546 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
547 | using=" using \"${host_makefile_frag}\"" | |
0df06ca0 | 548 | fi |
eb02fd64 | 549 | |
b8f8fddc RP |
550 | # remove any form feeds. |
551 | sed -e "s/\f//" ${Makefile} > Makefile.tem | |
552 | mv Makefile.tem ${Makefile} | |
553 | ||
9d1e053b | 554 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
0df06ca0 | 555 | if [ -z "${using}" ] ; then |
9d1e053b | 556 | andusing=" using \"${target_makefile_frag}\"" |
0df06ca0 | 557 | else |
9d1e053b | 558 | andusing="${using} and \"${target_makefile_frag}\"" |
0df06ca0 RP |
559 | fi |
560 | else | |
561 | andusing=${using} | |
562 | fi | |
eb02fd64 | 563 | |
46766962 | 564 | if [ -n "${verbose}" -o -z "${recurring}" ] ; then |
bc58b41d RP |
565 | echo "Created \"${Makefile}\"" in `pwd`${andusing}. |
566 | fi | |
063efd10 JG |
567 | |
568 | #### configure.in post-target parts come in here. | |
569 | ||
570 | ## end of post-target part. | |
eb02fd64 | 571 | |
b8f8fddc RP |
572 | # describe the chosen configuration in config.status. |
573 | # Make that file a shellscript which will reestablish | |
574 | # the same configuration. Used in Makefiles to rebuild | |
575 | # Makefiles. | |
576 | ||
577 | echo "#!/bin/sh | |
578 | # ${srcname} was configured as follows: | |
579 | ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status | |
580 | chmod a+x config.status | |
0df06ca0 RP |
581 | |
582 | originaldir=`pwd` | |
583 | cd ${srcdir} | |
584 | fi | |
bc58b41d RP |
585 | |
586 | # If there are subdirectories, then recurse. | |
46766962 | 587 | if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then |
bc58b41d RP |
588 | for configdir in ${configdirs} ; do |
589 | if [ -n "${verbose}" ] ; then | |
590 | echo Configuring ${configdir}... | |
591 | fi | |
592 | ||
593 | if [ -d ${configdir} ] ; then | |
594 | (cd ${configdir} ; | |
46766962 | 595 | ./configure +recurring ${host_alias} +target=${target_alias} \ |
bc58b41d RP |
596 | ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \ |
597 | | sed 's/^/ /' | |
598 | else | |
599 | if [ -n "${verbose}" ] ; then | |
600 | echo Warning: directory \"${configdir}\" is missing. | |
601 | fi | |
602 | fi | |
603 | done | |
604 | fi | |
67ca110d RP |
605 | done # for each target |
606 | ||
4101d868 | 607 | # Now build a Makefile for this host. |
991643f5 | 608 | if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then |
4101d868 RP |
609 | cd ${hostsubdir} |
610 | cat > GNUmakefile << E!O!F | |
b8f8fddc | 611 | # Makefile generated by configure for host ${host_alias}. |
4101d868 RP |
612 | |
613 | ALL := $(shell ls -d Target-*) | |
614 | ||
615 | %: | |
616 | $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true | |
617 | ||
618 | all: | |
619 | E!O!F | |
620 | cd .. | |
621 | fi | |
67ca110d | 622 | done # for each host |
eb02fd64 | 623 | |
eb02fd64 | 624 | exit 0 |
74cc5508 RP |
625 | |
626 | # | |
627 | # $Log$ | |
46f3c7cd RP |
628 | # Revision 1.41 1991/10/01 03:11:29 rich |
629 | # Trivial cleanup. | |
630 | # | |
631 | # Revision 1.40 1991/10/01 02:44:32 rich | |
b8f8fddc RP |
632 | # * use aliases as directory names. |
633 | # * put aliases AND parsed triples into Makefiles. | |
634 | # * config.status is a shell script. | |
635 | # * remove formfeeds from resulting Makefile. | |
46766962 RP |
636 | # |
637 | # Revision 1.36 1991/08/31 03:54:36 rich | |
638 | # Welcome emacs to the mess. | |
639 | # | |
640 | # Revision 1.35 1991/08/26 04:29:31 rich | |
641 | # Welcome cvs to the big time. | |
642 | # | |
643 | # Revision 1.34 1991/08/25 23:40:23 rich | |
3c8735af RP |
644 | # rcs enters the soup. |
645 | # | |
646 | # Revision 1.33 1991/08/25 21:48:38 rich | |
5781b1ba RP |
647 | # Adding diff to the fray. |
648 | # | |
649 | # Revision 1.32 1991/08/25 20:18:20 rich | |
bc58b41d RP |
650 | # Adding grep to the fray. |
651 | # | |
652 | # Revision 1.31 1991/08/23 04:50:57 rich | |
653 | # Minor config polish. | |
654 | # | |
655 | # Revision 1.22 1991/08/23 03:31:43 rich | |
656 | # Minor polish & config mapping. | |
657 | # | |
ec342d7d RP |
658 | # |
659 | # Revision 1.3 1991/04/11 02:41:54 rich | |
131a3881 | 660 | # Cut 2 config. Subdirs. |
74cc5508 RP |
661 | # |
662 | # | |
74cc5508 | 663 | |
0df06ca0 RP |
664 | # |
665 | # Local Variables: | |
666 | # fill-column: 131 | |
667 | # End: | |
668 | # | |
74cc5508 | 669 | |
46f3c7cd | 670 | # end of configure |