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 | ||
49b10446 RP |
24 | # Please email any bugs, comments, and/or additions to this file to: |
25 | # configure@cygnus.com | |
26 | ||
eb02fd64 RP |
27 | # |
28 | # Shell script to create proper links to machine-dependent files in | |
0df06ca0 | 29 | # preparation for compilation. |
eb02fd64 RP |
30 | # |
31 | # If configure succeeds, it leaves its status in config.status. | |
32 | # If configure fails after disturbing the status quo, | |
33 | # config.status is removed. | |
34 | # | |
35 | ||
c5ae5678 RP |
36 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$) |
37 | ||
38 | #set -e | |
c297d71e | 39 | |
eb02fd64 RP |
40 | remove=rm |
41 | hard_link=ln | |
42 | symbolic_link='ln -s' | |
43 | ||
44 | #for Test | |
45 | #remove="echo rm" | |
46 | #hard_link="echo ln" | |
47 | #symbolic_link="echo ln -s" | |
48 | ||
49 | # clear some things potentially inherited from environment. | |
6f8ac2d9 RP |
50 | |
51 | Makefile=Makefile | |
52 | Makefile_in=Makefile.in | |
eb02fd64 | 53 | ansi= |
b8f8fddc | 54 | arguments=$* |
6f8ac2d9 RP |
55 | commontargets= |
56 | configdirs= | |
0df06ca0 | 57 | defaulttargets= |
ec342d7d | 58 | destdir= |
0df06ca0 | 59 | fatal= |
131a3881 | 60 | hostsubdir= |
46766962 | 61 | norecursion= |
49b10446 RP |
62 | objdir= |
63 | objdiroption= | |
64 | progname= | |
46766962 | 65 | recurring= |
131a3881 | 66 | removing= |
74cc5508 | 67 | srcdir= |
ec342d7d | 68 | srctrigger= |
131a3881 | 69 | target= |
0df06ca0 | 70 | targets= |
131a3881 | 71 | targetsubdir= |
0df06ca0 | 72 | verbose= |
eb02fd64 RP |
73 | |
74 | for arg in $*; | |
75 | do | |
ec342d7d | 76 | case ${arg} in |
9fddf5af | 77 | -ansi | +a*) |
eb02fd64 | 78 | ansi=true |
bc58b41d | 79 | clib=clib |
eb02fd64 | 80 | ;; |
ec342d7d RP |
81 | -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*) |
82 | destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'` | |
83 | ;; | |
74cc5508 RP |
84 | -languages=* | +languages=* | +language=* | +languag=* \ |
85 | | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ | |
86 | | +l=*) | |
ec342d7d | 87 | languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`" |
eb02fd64 | 88 | ;; |
bc58b41d | 89 | -gas | +g*) |
eb02fd64 RP |
90 | gas=yes |
91 | ;; | |
9fddf5af | 92 | -help | +h*) |
0df06ca0 RP |
93 | fatal=true |
94 | ;; | |
9fddf5af | 95 | -nfp | +nf*) |
eb02fd64 RP |
96 | nfp=yes |
97 | ;; | |
46766962 RP |
98 | -norecursion | +no*) |
99 | norecursion=true | |
131a3881 | 100 | ;; |
49b10446 RP |
101 | -objdir=* | +objdir=* | +objdi=* | +objd=* | +obj=* | +ob=* | +o=*) |
102 | objdiroption=${arg} | |
103 | objdir=`echo ${arg} | sed 's/[+-]o[a-z]*=//'` | |
104 | ;; | |
46766962 RP |
105 | -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re) |
106 | recurring=true | |
bc58b41d | 107 | ;; |
46766962 | 108 | -rm | +rm) |
ec342d7d | 109 | removing=${arg} |
131a3881 | 110 | ;; |
7875b07f RP |
111 | -site=* | +site=* | +sit=* | +si=*) |
112 | site=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` | |
113 | ;; | |
114 | # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=*) | |
0df06ca0 RP |
115 | # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` |
116 | # ;; | |
6f8ac2d9 | 117 | -subdirs | +su*) |
991643f5 RP |
118 | subdirs=${arg} |
119 | ;; | |
9fddf5af | 120 | -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) |
0df06ca0 | 121 | if [ -n "${targets}" ] ; then |
991643f5 | 122 | subdirs="+subdirs" |
0df06ca0 RP |
123 | fi |
124 | ||
125 | newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" | |
126 | targets="${newtargets}" | |
131a3881 | 127 | ;; |
49b10446 RP |
128 | -tmpdir=* | +tmpdir=* | +tmpdi=* | +tmpd=* | +tmp=* | +tm=*) |
129 | tmpdiroption=${arg} | |
130 | TMPDIR=`echo ${arg} | sed 's/[+-]t[a-z]*=//'` | |
131 | ;; | |
bc58b41d | 132 | -v | -verbose | +v*) |
0df06ca0 RP |
133 | verbose=${arg} |
134 | ;; | |
135 | -* | +*) | |
136 | (echo ; | |
137 | echo "Unrecognized option: \"${arg}\"". ; | |
138 | echo) 1>&2 | |
139 | fatal=true | |
140 | ;; | |
eb02fd64 | 141 | *) |
0df06ca0 | 142 | if [ -n "${hosts}" ] ; then |
991643f5 | 143 | subdirs="+subdirs" |
0df06ca0 RP |
144 | fi |
145 | ||
146 | newhosts="${hosts} ${arg}" | |
147 | hosts=${newhosts} | |
eb02fd64 RP |
148 | ;; |
149 | esac | |
150 | done | |
151 | ||
0df06ca0 | 152 | if [ -n "${verbose}" ] ; then |
49b10446 | 153 | echo $0 $* |
0df06ca0 RP |
154 | fi |
155 | ||
49b10446 RP |
156 | ## this is a little touchy and won't always work, but... |
157 | ## | |
158 | ## if the argv[0] starts with a slash then it is an absolute name that can be | |
159 | ## used as is. | |
160 | ## | |
161 | ## otherwise, if argv[0] has no slash in it, we can assume that it is on the | |
162 | ## path. Since PATH might include "." we also add `pwd` to the end of PATH. | |
163 | ## | |
164 | ## otherwise we prepend `pwd` to $0 and hope that will give us an absolute | |
165 | ## path. | |
166 | ## | |
167 | ||
168 | if (echo $0 | grep '^/' > /dev/null) ; then | |
169 | progname=$0 | |
49b10446 RP |
170 | else |
171 | if (echo $0 | grep '/' > /dev/null) ; then | |
172 | progname=`pwd`/$0 | |
49b10446 RP |
173 | else |
174 | progname=$0 | |
49b10446 RP |
175 | PATH=$PATH:`pwd` ; export PATH |
176 | fi | |
177 | fi | |
178 | ||
c5ae5678 | 179 | configsub=`echo ${progname} | sed 's/configure$/config.sub/'` |
bdb73134 | 180 | |
c5ae5678 RP |
181 | if ${configsub} none >/dev/null 2>&1 ; then |
182 | true | |
183 | else | |
bdb73134 JW |
184 | echo '***' cannot find config.sub. |
185 | echo 1 | |
186 | fi | |
49b10446 | 187 | |
c297d71e RP |
188 | # process host and target only if not removing. |
189 | if [ -z "${removing}" -a -z "${fatal}" ] ; then | |
eb02fd64 | 190 | # Complain if an arg is missing |
0df06ca0 RP |
191 | if [ -z "${hosts}" ] ; then |
192 | (echo ; | |
193 | echo "configure: No HOST specified." ; | |
bc58b41d | 194 | echo) 1>&2 |
0df06ca0 | 195 | fatal=true |
eb02fd64 | 196 | fi |
131a3881 | 197 | fi |
eb02fd64 | 198 | |
0df06ca0 RP |
199 | if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then |
200 | (echo "Usage: configure HOST" ; | |
201 | echo ; | |
202 | echo "Options: [defaults in brackets]" ; | |
203 | echo " +ansi configure w/ANSI library. [no ansi lib]" ; | |
49b10446 | 204 | echo " +destdir=MYDIR configure for installation into MYDIR. [\"/usr/local\"]" ; |
0df06ca0 | 205 | echo " +gas configure the compilers for use with gas. [native as]" ; |
49b10446 RP |
206 | echo " +help print this message. [normal config]" ; |
207 | echo " +lang=LANG configure to build LANG. [gcc]" ; | |
0df06ca0 | 208 | echo " +nfp configure the compilers default to soft floating point. [hard float]" ; |
46766962 | 209 | echo " +norecursion configure this directory only. [recurse]" ; |
49b10446 | 210 | echo " +objdir=ODIR configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ; |
0df06ca0 | 211 | echo " +rm remove this configuration. [build a configuration]" ; |
639665de RP |
212 | echo " +site configure with site specific makefile" ; |
213 | # This is correctly aligned in the output, even though it isn't here. | |
214 | echo " +subdirs configure in subdirectories. [in source directories]" ; | |
0df06ca0 | 215 | echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ; |
49b10446 | 216 | echo " +tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ; |
0df06ca0 RP |
217 | echo ; |
218 | echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; | |
991643f5 | 219 | echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; |
0df06ca0 RP |
220 | echo "options given will apply to all targets.") 1>&2 |
221 | ||
222 | if [ -r config.status ] ; then | |
223 | cat config.status | |
224 | fi | |
225 | ||
226 | exit 1 | |
eb02fd64 RP |
227 | fi |
228 | ||
c297d71e RP |
229 | ### break up configure.in. |
230 | if [ -r configure.in ] ; then | |
231 | if [ -z "`grep '^# per\-host:' configure.in`" ] ; then | |
232 | echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 | |
eb02fd64 RP |
233 | exit 1 |
234 | fi | |
235 | ||
c297d71e RP |
236 | if [ -z "`grep '^# per\-target:' configure.in`" ] ; then |
237 | echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 | |
238 | exit 1 | |
bc58b41d RP |
239 | fi |
240 | ||
49b10446 RP |
241 | if [ -z "${TMPDIR}" ] ; then |
242 | TMPDIR=/tmp ; export TMPDIR | |
243 | fi | |
244 | ||
c5ae5678 RP |
245 | # keep this filename short for &%*%$*# 14 char file names |
246 | tmpfile=${TMPDIR}/cONf$$ | |
247 | ||
c297d71e RP |
248 | # split configure.in into common, per-host, per-target, |
249 | # and post-target parts. Post-target is optional. | |
c5ae5678 RP |
250 | sed -e '/^# per\-host:/,$d' configure.in > ${tmpfile}.com |
251 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > ${tmpfile}.hst | |
252 | if grep '^# post-target:' configure.in >/dev/null ; then | |
253 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > ${tmpfile}.tgt | |
254 | sed -e '1,/^# post\-target:/d' configure.in > ${tmpfile}.pos | |
c297d71e | 255 | else |
c5ae5678 RP |
256 | sed -e '1,/^# per\-target:/d' configure.in > ${tmpfile}.tgt |
257 | echo >${tmpfile}.pos | |
bc58b41d | 258 | fi |
eb02fd64 | 259 | |
c297d71e RP |
260 | else |
261 | echo '***' No configure.in in `pwd` | |
262 | exit 1 | |
263 | fi | |
eb02fd64 | 264 | |
c297d71e | 265 | ### do common part of configure.in |
eb02fd64 | 266 | |
c5ae5678 | 267 | . ${tmpfile}.com |
eb02fd64 | 268 | |
ec342d7d | 269 | # some sanity checks on configure.in |
0df06ca0 | 270 | if [ -z "${srctrigger}" ] ; then |
c297d71e | 271 | echo '***' srctrigger not set in `pwd`/configure.in. |
ec342d7d RP |
272 | exit 1 |
273 | fi | |
274 | ||
0df06ca0 RP |
275 | for host in ${hosts} ; do |
276 | # Default other arg | |
277 | if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then | |
278 | targets=${host} | |
279 | defaulttargets=true | |
280 | fi | |
eb02fd64 | 281 | |
b8f8fddc RP |
282 | host_alias=${host} |
283 | ||
50ac10c1 | 284 | result=`${configsub} ${host}` |
bc58b41d RP |
285 | host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
286 | host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
287 | host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
288 | host=${host_cpu}-${host_vendor}-${host_os} | |
6c18e393 | 289 | host_makefile_frag=config/hmake-${host} |
ba04ec6e HS |
290 | if [ ! -f ${host_makefile_frag} ] |
291 | then | |
292 | host_makefile_frag=config/hmake-${host_alias} | |
293 | fi | |
6c18e393 | 294 | |
c5ae5678 | 295 | . ${tmpfile}.hst |
eb02fd64 | 296 | |
0df06ca0 | 297 | for target in ${targets} ; do |
eb02fd64 | 298 | |
b8f8fddc | 299 | target_alias=${target} |
50ac10c1 | 300 | result=`${configsub} ${target}` |
bc58b41d RP |
301 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
302 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
303 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
304 | target=${target_cpu}-${target_vendor}-${target_os} | |
6c18e393 | 305 | target_makefile_frag=config/tmake-${target} |
ba04ec6e HS |
306 | if [ ! -f ${target_makefile_frag} ] |
307 | then | |
308 | target_makefile_frag=config/tmake-${target_alias} | |
309 | fi | |
6408afba | 310 | |
c5ae5678 | 311 | . ${tmpfile}.tgt |
0df06ca0 RP |
312 | |
313 | # Temporarily, we support only direct subdir builds. | |
b8f8fddc RP |
314 | hostsubdir=H-${host_alias} |
315 | targetsubdir=T-${target_alias} | |
0df06ca0 RP |
316 | |
317 | if [ -n "${removing}" ] ; then | |
49b10446 RP |
318 | if [ -n "${objdir}" ] ; then |
319 | echo '***' +rm not supported for +objdir. Just \"rm -rf ${objdir}\" by hand. | |
320 | exit 1 | |
321 | fi | |
322 | ||
991643f5 | 323 | if [ -n "${subdirs}" ] ; then |
67ca110d RP |
324 | if [ -d "${hostsubdir}" ] ; then |
325 | rm -rf ${hostsubdir}/${targetsubdir} | |
0df06ca0 | 326 | |
c297d71e | 327 | if [ -z "`(ls ${hostsubdir}) 2>&1 | grep T- | grep -v T-independent`" ] ; then |
67ca110d RP |
328 | rm -rf ${hostsubdir} |
329 | fi | |
330 | else | |
331 | echo Warning: no `pwd`/${hostsubdir} to remove. | |
0df06ca0 RP |
332 | fi |
333 | else | |
063efd10 | 334 | rm -f ${Makefile} config.status ${links} |
0df06ca0 | 335 | fi |
74cc5508 | 336 | else |
49b10446 RP |
337 | if [ -n "${objdir}" ]; then |
338 | srcdir=`pwd` | |
339 | cd ${objdir} | |
340 | fi | |
341 | ||
991643f5 | 342 | if [ -n "${subdirs}" ] ; then |
0df06ca0 | 343 | # check for existing status before allowing forced subdirs. |
063efd10 | 344 | if [ -f ${Makefile} ] ; then |
bc58b41d | 345 | echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2 |
0df06ca0 RP |
346 | exit 1 |
347 | fi | |
eb02fd64 | 348 | |
0df06ca0 RP |
349 | if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi |
350 | cd ${hostsubdir} | |
eb02fd64 | 351 | |
bc58b41d RP |
352 | if [ ! -d ${targetsubdir} ] ; then |
353 | if [ -z "${commontargets}" ] ; then | |
354 | mkdir ${targetsubdir} | |
355 | else | |
c297d71e RP |
356 | if [ ! -d T-independent ] ; then |
357 | mkdir T-independent | |
bc58b41d RP |
358 | fi |
359 | ||
c297d71e | 360 | ${symbolic_link} T-independent ${targetsubdir} |
bc58b41d RP |
361 | fi # if target independent |
362 | fi # if no target dir yet | |
363 | ||
0df06ca0 | 364 | cd ${targetsubdir} |
eb02fd64 | 365 | |
49b10446 RP |
366 | if [ -z "${srcdir}" ] ; then |
367 | srcdir=../.. | |
368 | fi | |
0df06ca0 RP |
369 | else |
370 | # if not subdir builds, then make sure none exist. | |
c297d71e | 371 | if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then |
bc58b41d | 372 | echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2 |
0df06ca0 | 373 | exit 1 |
c297d71e RP |
374 | else |
375 | true | |
0df06ca0 RP |
376 | fi |
377 | fi | |
eb02fd64 | 378 | |
0df06ca0 RP |
379 | # Find the source files, if location was not specified. |
380 | if [ -z "${srcdir}" ] ; then | |
381 | srcdirdefaulted=1 | |
382 | srcdir=. | |
383 | if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then | |
384 | srcdir=.. | |
385 | fi | |
386 | fi | |
eb02fd64 | 387 | |
0df06ca0 RP |
388 | if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then |
389 | if [ -z "${srcdirdefaulted}" ] ; then | |
bc58b41d | 390 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 |
0df06ca0 | 391 | else |
bc58b41d | 392 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 |
0df06ca0 | 393 | fi |
eb02fd64 | 394 | |
bc58b41d | 395 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 |
0df06ca0 RP |
396 | exit 1 |
397 | fi | |
131a3881 | 398 | |
0df06ca0 RP |
399 | # Set up the list of links to be made. |
400 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
eb02fd64 | 401 | |
0df06ca0 RP |
402 | # Make the links. |
403 | while [ -n "${files}" ] ; do | |
404 | # set file to car of files, files to cdr of files | |
405 | set ${files}; file=$1; shift; files=$* | |
406 | set ${links}; link=$1; shift; links=$* | |
131a3881 | 407 | |
0df06ca0 | 408 | if [ ! -r ${srcdir}/${file} ] ; then |
bc58b41d RP |
409 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 |
410 | echo '***' "since the file \"${file}\" does not exist." 1>&2 | |
0df06ca0 RP |
411 | exit 1 |
412 | fi | |
131a3881 | 413 | |
0df06ca0 RP |
414 | ${remove} -f ${link} |
415 | rm -f config.status | |
416 | # Make a symlink if possible, otherwise try a hard link | |
417 | ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} | |
131a3881 | 418 | |
0df06ca0 | 419 | if [ ! -r ${link} ] ; then |
bc58b41d | 420 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 |
0df06ca0 RP |
421 | exit 1 |
422 | fi | |
bc58b41d RP |
423 | |
424 | if [ -n "${verbose}" ] ; then | |
425 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
426 | fi | |
0df06ca0 | 427 | done |
131a3881 | 428 | |
0df06ca0 RP |
429 | # Create a .gdbinit file which runs the one in srcdir |
430 | # and tells GDB to look there for source files. | |
431 | ||
432 | case ${srcdir} in | |
433 | .) | |
434 | ;; | |
435 | *) | |
436 | echo "dir ." > .gdbinit | |
437 | echo "dir ${srcdir}" >> .gdbinit | |
438 | echo "source ${srcdir}/.gdbinit" >> .gdbinit | |
439 | ;; | |
440 | esac | |
441 | ||
442 | # Install a makefile, and make it set VPATH | |
443 | # if necessary so that the sources are found. | |
444 | # Also change its value of srcdir. | |
445 | ||
446 | # FIXME-someday: This business of always writing to .tem and mv back | |
447 | # is so that I don't screw things up while developing. Once this | |
448 | # template is stable, these should be optimized. xoxorich. | |
449 | ||
450 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
451 | if [ "${host}" != "${target}" ] ; then | |
063efd10 JG |
452 | echo "CROSS=-DCROSS_COMPILE" > ${Makefile} |
453 | echo "ALL=start.encap" >> ${Makefile} | |
0df06ca0 | 454 | else |
063efd10 | 455 | echo "ALL=all.internal" > ${Makefile} |
0df06ca0 | 456 | fi |
131a3881 | 457 | |
0df06ca0 | 458 | # set target, host, VPATH |
b8f8fddc RP |
459 | echo "host_alias = ${host_alias}" >> ${Makefile} |
460 | echo "host_cpu = ${host_cpu}" >> ${Makefile} | |
461 | echo "host_vendor = ${host_vendor}" >> ${Makefile} | |
462 | echo "host_os = ${host_os}" >> ${Makefile} | |
463 | ||
464 | echo "target_alias = ${target_alias}" >> ${Makefile} | |
465 | echo "target_cpu = ${target_cpu}" >> ${Makefile} | |
466 | echo "target_vendor = ${target_vendor}" >> ${Makefile} | |
467 | echo "target_os = ${target_os}" >> ${Makefile} | |
131a3881 | 468 | |
991643f5 | 469 | if [ -n "${subdirs}" ] ; then |
49b10446 RP |
470 | (echo "subdir = /${hostsubdir}/${targetsubdir}" ; |
471 | echo "unsubdir = ../..") >> ${Makefile} | |
0df06ca0 | 472 | else |
49b10446 RP |
473 | (echo "subdir =" ; |
474 | echo "unsubdir = .") >> ${Makefile} | |
0df06ca0 | 475 | fi |
131a3881 | 476 | |
063efd10 JG |
477 | # echo "workdir = `pwd`" >> ${Makefile} |
478 | echo "VPATH = ${srcdir}" >> ${Makefile} | |
eb02fd64 | 479 | |
063efd10 JG |
480 | # add "Makefile.in" (or whatever it's called) |
481 | cat ${srcdir}/${Makefile_in} >> ${Makefile} | |
eb02fd64 | 482 | |
0df06ca0 | 483 | # Conditionalize the makefile for this host. |
c5ae5678 RP |
484 | (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ; |
485 | sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem | |
486 | mv Makefile.tem ${Makefile} | |
131a3881 | 487 | |
0df06ca0 | 488 | # Conditionalize the makefile for this target. |
c5ae5678 RP |
489 | (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; |
490 | sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem | |
491 | mv Makefile.tem ${Makefile} | |
ec342d7d | 492 | |
7875b07f RP |
493 | # Conditionalize the makefile for this site. |
494 | if [ -n "${site}" ] ; then | |
ba04ec6e | 495 | site_makefile_frag=config/smake-${site} |
7875b07f | 496 | |
c5ae5678 RP |
497 | (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ; |
498 | sed -e "/^####/ r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem | |
499 | mv Makefile.tem ${Makefile} | |
7875b07f RP |
500 | fi |
501 | ||
0df06ca0 | 502 | # set srcdir |
063efd10 JG |
503 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem |
504 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 505 | |
0df06ca0 RP |
506 | # set destdir |
507 | if [ -n "${destdir}" ] ; then | |
063efd10 JG |
508 | sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem |
509 | mv Makefile.tem ${Makefile} | |
0df06ca0 | 510 | fi |
eb02fd64 | 511 | |
0df06ca0 | 512 | # reset SUBDIRS |
063efd10 JG |
513 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem |
514 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 515 | |
0df06ca0 | 516 | # reset NONSUBDIRS |
063efd10 JG |
517 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem |
518 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 519 | |
7875b07f RP |
520 | # remove any form feeds. |
521 | sed -e "s/\f//" ${Makefile} > Makefile.tem | |
522 | mv Makefile.tem ${Makefile} | |
523 | ||
0df06ca0 | 524 | using= |
9d1e053b | 525 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
c5ae5678 | 526 | using="${using} and \"${host_makefile_frag}\"" |
0df06ca0 | 527 | fi |
9d1e053b | 528 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
c5ae5678 | 529 | using="${using} and \"${target_makefile_frag}\"" |
0df06ca0 | 530 | fi |
c5ae5678 RP |
531 | if [ -n "${site}" -a \ |
532 | -f ${srcdir}/${site_makefile_frag} ] ; then | |
533 | using="${using} and \"${site_makefile_frag}\"" | |
7875b07f | 534 | fi |
c5ae5678 RP |
535 | using=`echo "${using}" | sed 's/and/using/'` |
536 | using="Created \"${Makefile}\" in `pwd`${using}." | |
7875b07f | 537 | |
46766962 | 538 | if [ -n "${verbose}" -o -z "${recurring}" ] ; then |
c5ae5678 | 539 | echo ${using} |
bc58b41d | 540 | fi |
063efd10 | 541 | |
c5ae5678 | 542 | . ${tmpfile}.pos |
eb02fd64 | 543 | |
b8f8fddc RP |
544 | # describe the chosen configuration in config.status. |
545 | # Make that file a shellscript which will reestablish | |
546 | # the same configuration. Used in Makefiles to rebuild | |
547 | # Makefiles. | |
548 | ||
549 | echo "#!/bin/sh | |
49b10446 | 550 | # `pwd` was configured as follows: |
c5ae5678 RP |
551 | (cd ${srcdir} ; ${progname}" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` ") |
552 | # ${using}" > config.status | |
b8f8fddc | 553 | chmod a+x config.status |
0df06ca0 RP |
554 | |
555 | originaldir=`pwd` | |
556 | cd ${srcdir} | |
557 | fi | |
bc58b41d RP |
558 | |
559 | # If there are subdirectories, then recurse. | |
46766962 | 560 | if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then |
bc58b41d RP |
561 | for configdir in ${configdirs} ; do |
562 | if [ -n "${verbose}" ] ; then | |
563 | echo Configuring ${configdir}... | |
564 | fi | |
565 | ||
566 | if [ -d ${configdir} ] ; then | |
49b10446 RP |
567 | if [ -n "${objdir}" ] ; then |
568 | if [ ! -d ${objdir}/${configdir} ] ; then | |
569 | mkdir ${objdir}/${configdir} | |
570 | fi | |
571 | fi | |
572 | ||
5420feaa RP |
573 | POPDIR=`pwd` |
574 | cd ${configdir} | |
575 | ||
c5ae5678 | 576 | if (${progname} +recurring ${host_alias} +target=${target_alias} \ |
5420feaa RP |
577 | ${verbose} ${subdirs} ${removing} +destdir=${destdir} \ |
578 | `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \ | |
c5ae5678 RP |
579 | ${tmpdiroption}) ; then |
580 | true | |
581 | else | |
582 | exit 1 | |
583 | fi | |
5420feaa RP |
584 | |
585 | cd ${POPDIR} | |
586 | ||
587 | # (cd ${configdir} ; | |
588 | # if (${progname} +recurring ${host_alias} +target=${target_alias} \ | |
589 | # ${verbose} ${subdirs} ${removing} +destdir=${destdir} \ | |
590 | # `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \ | |
591 | # ${tmpdiroption}) ; then true ; else exit 1 ; fi) \ | |
592 | # | sed 's/^/ /' | |
bc58b41d RP |
593 | else |
594 | if [ -n "${verbose}" ] ; then | |
595 | echo Warning: directory \"${configdir}\" is missing. | |
596 | fi | |
597 | fi | |
598 | done | |
599 | fi | |
67ca110d RP |
600 | done # for each target |
601 | ||
4101d868 | 602 | # Now build a Makefile for this host. |
991643f5 | 603 | if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then |
49b10446 RP |
604 | push=`pwd` |
605 | ||
606 | if [ -n "${objdir}" ] ; then | |
607 | cd ${objdir} | |
608 | fi | |
609 | ||
4101d868 | 610 | cd ${hostsubdir} |
c5ae5678 | 611 | cat > GNUmakefile << 'E!O!F' |
b8f8fddc | 612 | # Makefile generated by configure for host ${host_alias}. |
4101d868 | 613 | |
c297d71e | 614 | ALL := $(shell ls -d T-*) |
4101d868 RP |
615 | |
616 | %: | |
617 | $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true | |
618 | ||
619 | all: | |
620 | E!O!F | |
49b10446 | 621 | cd ${push} |
4101d868 | 622 | fi |
67ca110d | 623 | done # for each host |
eb02fd64 | 624 | |
c297d71e RP |
625 | ### clean up. |
626 | ||
c5ae5678 | 627 | rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos |
c297d71e | 628 | |
eb02fd64 | 629 | exit 0 |
74cc5508 | 630 | |
213195dd RP |
631 | # |
632 | # | |
633 | # $Log$ | |
ba04ec6e HS |
634 | # Revision 1.61 1991/10/24 00:23:59 hgs |
635 | # Allow for using tmake-sun4 | |
636 | # | |
637 | # Revision 1.60 1991/10/23 21:48:28 rich | |
c5ae5678 RP |
638 | # Makefiles should include the makefile frag names even if the makefile |
639 | # frag doesn't exist in *this* directory. Otherwise we inherit the | |
640 | # variable setting from our parent Makefile. | |
641 | # | |
642 | # Revision 1.59 1991/10/16 19:53:31 gnu | |
643 | # Update for SCO problems. | |
644 | # | |
645 | # * Fix "Larry Wall kludge" line so it works. If this script is run by csh, | |
646 | # it will complain, feed itself to sh, and complain some more. But will work. | |
647 | # | |
648 | # * Use <14 char file names in /tmp. | |
649 | # | |
650 | # Revision 1.58 1991/10/16 06:12:52 rich | |
651 | # Two small bugs. First, single quoted sed line doesn't need to quote | |
652 | # '$'. Second, use quotes around the hereis document trigger in order | |
653 | # to quote the entire contents of the hereis document. | |
654 | # | |
655 | # Revision 1.57 1991/10/11 05:31:05 gnu | |
656 | # Simplify "Using" message code. Put the message that configure prints | |
657 | # (or suppresses) into the config.status file as a comment. | |
658 | # | |
659 | # Revision 1.56 1991/10/10 05:01:47 rich | |
660 | # Remove the set -e but protect the recusion call. | |
661 | # | |
662 | # Revision 1.55 1991/10/10 04:57:23 rich | |
5420feaa RP |
663 | # * Die when sub-configure's do. |
664 | # * get the makefile building message line correct. | |
665 | # * set -e | |
666 | # | |
667 | # Revision 1.54 1991/10/10 01:04:42 rich | |
50ac10c1 RP |
668 | # Backed out the "/bin/sh config.sub" change. Fails when config.sub was |
669 | # on PATH. | |
670 | # | |
671 | # Revision 1.53 1991/10/10 00:38:08 rich | |
dafcb8be RP |
672 | # Call config.sub as "/bin/sh config.sub" instead of directly. This |
673 | # protects us from the case where config.sub isn't executable. | |
674 | # | |
675 | # Revision 1.52 1991/10/09 00:48:26 rich | |
639665de RP |
676 | # Another patch from jim. |
677 | # | |
678 | # Revision 1.51 1991/10/08 06:07:58 wilson | |
bdb73134 JW |
679 | # Fix bug in smake- file code. |
680 | # | |
681 | # Revision 1.50 1991/10/04 23:49:37 rich | |
682 | # Per's patch for my config.sub botch. | |
683 | # | |
684 | # Revision 1.49 1991/10/04 22:52:09 rich | |
49b10446 RP |
685 | # Use john's heuristic for finding ourselves. kinda like hare krishna. |
686 | # | |
687 | # Revision 1.48 1991/10/02 13:17:28 rich | |
688 | # take out the set -e for now | |
689 | # | |
690 | # Revision 1.47 1991/10/02 10:02:23 rich | |
691 | # * temporary files in TMPDIR | |
692 | # * +objdir | |
693 | # | |
694 | # Revision 1.46 1991/10/02 06:29:53 rich | |
7875b07f RP |
695 | # Added +site=foo option for naming site specific Makefile fragments. |
696 | # | |
697 | # Revision 1.45 1991/10/02 06:15:13 rich | |
6f8ac2d9 RP |
698 | # Removed +f option. Used to stand for +forcesubdirs which is now |
699 | # called +subdirs. | |
700 | # | |
701 | # Revision 1.44 1991/10/02 06:02:35 rich | |
213195dd RP |
702 | # Added rcs log line. |
703 | # | |
704 | # | |
705 | # | |
706 | ||
0df06ca0 RP |
707 | # |
708 | # Local Variables: | |
709 | # fill-column: 131 | |
710 | # End: | |
711 | # | |
74cc5508 | 712 | |
46f3c7cd | 713 | # end of configure |