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