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 | |
3bb089aa | 117 | arguments=`echo ${arguments} | sed "s:${arg}::"` |
bc58b41d | 118 | ;; |
46766962 | 119 | -rm | +rm) |
ec342d7d | 120 | removing=${arg} |
131a3881 | 121 | ;; |
7875b07f RP |
122 | -site=* | +site=* | +sit=* | +si=*) |
123 | site=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` | |
124 | ;; | |
125 | # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=*) | |
0df06ca0 RP |
126 | # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` |
127 | # ;; | |
6f8ac2d9 | 128 | -subdirs | +su*) |
991643f5 RP |
129 | subdirs=${arg} |
130 | ;; | |
9fddf5af | 131 | -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) |
0df06ca0 | 132 | if [ -n "${targets}" ] ; then |
991643f5 | 133 | subdirs="+subdirs" |
0df06ca0 RP |
134 | fi |
135 | ||
136 | newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" | |
137 | targets="${newtargets}" | |
131a3881 | 138 | ;; |
49b10446 RP |
139 | -tmpdir=* | +tmpdir=* | +tmpdi=* | +tmpd=* | +tmp=* | +tm=*) |
140 | tmpdiroption=${arg} | |
141 | TMPDIR=`echo ${arg} | sed 's/[+-]t[a-z]*=//'` | |
142 | ;; | |
bc58b41d | 143 | -v | -verbose | +v*) |
0df06ca0 RP |
144 | verbose=${arg} |
145 | ;; | |
146 | -* | +*) | |
147 | (echo ; | |
148 | echo "Unrecognized option: \"${arg}\"". ; | |
149 | echo) 1>&2 | |
150 | fatal=true | |
151 | ;; | |
eb02fd64 | 152 | *) |
0df06ca0 | 153 | if [ -n "${hosts}" ] ; then |
991643f5 | 154 | subdirs="+subdirs" |
0df06ca0 RP |
155 | fi |
156 | ||
157 | newhosts="${hosts} ${arg}" | |
158 | hosts=${newhosts} | |
eb02fd64 RP |
159 | ;; |
160 | esac | |
161 | done | |
162 | ||
0df06ca0 | 163 | if [ -n "${verbose}" ] ; then |
49b10446 | 164 | echo $0 $* |
0df06ca0 RP |
165 | fi |
166 | ||
49b10446 RP |
167 | ## this is a little touchy and won't always work, but... |
168 | ## | |
169 | ## if the argv[0] starts with a slash then it is an absolute name that can be | |
170 | ## used as is. | |
171 | ## | |
172 | ## otherwise, if argv[0] has no slash in it, we can assume that it is on the | |
173 | ## path. Since PATH might include "." we also add `pwd` to the end of PATH. | |
174 | ## | |
175 | ## otherwise we prepend `pwd` to $0 and hope that will give us an absolute | |
176 | ## path. | |
177 | ## | |
178 | ||
179 | if (echo $0 | grep '^/' > /dev/null) ; then | |
180 | progname=$0 | |
49b10446 RP |
181 | else |
182 | if (echo $0 | grep '/' > /dev/null) ; then | |
183 | progname=`pwd`/$0 | |
49b10446 RP |
184 | else |
185 | progname=$0 | |
49b10446 RP |
186 | PATH=$PATH:`pwd` ; export PATH |
187 | fi | |
188 | fi | |
189 | ||
c5ae5678 | 190 | configsub=`echo ${progname} | sed 's/configure$/config.sub/'` |
bdb73134 | 191 | |
c5ae5678 RP |
192 | if ${configsub} none >/dev/null 2>&1 ; then |
193 | true | |
194 | else | |
bdb73134 JW |
195 | echo '***' cannot find config.sub. |
196 | echo 1 | |
197 | fi | |
49b10446 | 198 | |
c297d71e RP |
199 | # process host and target only if not removing. |
200 | if [ -z "${removing}" -a -z "${fatal}" ] ; then | |
eb02fd64 | 201 | # Complain if an arg is missing |
0df06ca0 RP |
202 | if [ -z "${hosts}" ] ; then |
203 | (echo ; | |
204 | echo "configure: No HOST specified." ; | |
bc58b41d | 205 | echo) 1>&2 |
0df06ca0 | 206 | fatal=true |
eb02fd64 | 207 | fi |
131a3881 | 208 | fi |
eb02fd64 | 209 | |
0df06ca0 RP |
210 | if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then |
211 | (echo "Usage: configure HOST" ; | |
212 | echo ; | |
213 | echo "Options: [defaults in brackets]" ; | |
214 | echo " +ansi configure w/ANSI library. [no ansi lib]" ; | |
28f3b094 RP |
215 | echo " +ddestdir=MYDIR configure for installation host dependent files" ; |
216 | echo " into MYDIR. [\"/usr/local\"]" ; | |
217 | echo " +idestdir=MYDIR configure for installation host independent files" ; | |
218 | echo " into MYDIR. [\"/usr/local\"]" ; | |
219 | echo " +destdir=MYDIR configure for installation of both host dependent and" ; | |
220 | echo " host independent files into MYDIR. [\"/usr/local\"]" ; | |
0df06ca0 | 221 | echo " +gas configure the compilers for use with gas. [native as]" ; |
49b10446 RP |
222 | echo " +help print this message. [normal config]" ; |
223 | echo " +lang=LANG configure to build LANG. [gcc]" ; | |
0df06ca0 | 224 | echo " +nfp configure the compilers default to soft floating point. [hard float]" ; |
46766962 | 225 | echo " +norecursion configure this directory only. [recurse]" ; |
49b10446 | 226 | echo " +objdir=ODIR configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ; |
0df06ca0 | 227 | echo " +rm remove this configuration. [build a configuration]" ; |
639665de RP |
228 | echo " +site configure with site specific makefile" ; |
229 | # This is correctly aligned in the output, even though it isn't here. | |
230 | echo " +subdirs configure in subdirectories. [in source directories]" ; | |
0df06ca0 | 231 | echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ; |
49b10446 | 232 | echo " +tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ; |
0df06ca0 RP |
233 | echo ; |
234 | echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; | |
991643f5 | 235 | echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; |
0df06ca0 RP |
236 | echo "options given will apply to all targets.") 1>&2 |
237 | ||
238 | if [ -r config.status ] ; then | |
239 | cat config.status | |
240 | fi | |
241 | ||
242 | exit 1 | |
eb02fd64 RP |
243 | fi |
244 | ||
c297d71e RP |
245 | ### break up configure.in. |
246 | if [ -r configure.in ] ; then | |
247 | if [ -z "`grep '^# per\-host:' configure.in`" ] ; then | |
248 | echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 | |
eb02fd64 RP |
249 | exit 1 |
250 | fi | |
251 | ||
c297d71e RP |
252 | if [ -z "`grep '^# per\-target:' configure.in`" ] ; then |
253 | echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 | |
254 | exit 1 | |
bc58b41d RP |
255 | fi |
256 | ||
49b10446 RP |
257 | if [ -z "${TMPDIR}" ] ; then |
258 | TMPDIR=/tmp ; export TMPDIR | |
259 | fi | |
260 | ||
c5ae5678 RP |
261 | # keep this filename short for &%*%$*# 14 char file names |
262 | tmpfile=${TMPDIR}/cONf$$ | |
263 | ||
c297d71e RP |
264 | # split configure.in into common, per-host, per-target, |
265 | # and post-target parts. Post-target is optional. | |
c5ae5678 RP |
266 | sed -e '/^# per\-host:/,$d' configure.in > ${tmpfile}.com |
267 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > ${tmpfile}.hst | |
268 | if grep '^# post-target:' configure.in >/dev/null ; then | |
269 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > ${tmpfile}.tgt | |
270 | sed -e '1,/^# post\-target:/d' configure.in > ${tmpfile}.pos | |
c297d71e | 271 | else |
c5ae5678 RP |
272 | sed -e '1,/^# per\-target:/d' configure.in > ${tmpfile}.tgt |
273 | echo >${tmpfile}.pos | |
bc58b41d | 274 | fi |
eb02fd64 | 275 | |
c297d71e RP |
276 | else |
277 | echo '***' No configure.in in `pwd` | |
278 | exit 1 | |
279 | fi | |
eb02fd64 | 280 | |
c297d71e | 281 | ### do common part of configure.in |
eb02fd64 | 282 | |
c5ae5678 | 283 | . ${tmpfile}.com |
eb02fd64 | 284 | |
ec342d7d | 285 | # some sanity checks on configure.in |
0df06ca0 | 286 | if [ -z "${srctrigger}" ] ; then |
c297d71e | 287 | echo '***' srctrigger not set in `pwd`/configure.in. |
ec342d7d RP |
288 | exit 1 |
289 | fi | |
290 | ||
0df06ca0 RP |
291 | for host in ${hosts} ; do |
292 | # Default other arg | |
293 | if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then | |
294 | targets=${host} | |
295 | defaulttargets=true | |
296 | fi | |
eb02fd64 | 297 | |
b8f8fddc RP |
298 | host_alias=${host} |
299 | ||
50ac10c1 | 300 | result=`${configsub} ${host}` |
bc58b41d RP |
301 | host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
302 | host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
303 | host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
304 | host=${host_cpu}-${host_vendor}-${host_os} | |
ee8f0bd7 | 305 | host_makefile_frag=config/mh-${host} |
ba04ec6e HS |
306 | if [ ! -f ${host_makefile_frag} ] |
307 | then | |
ee8f0bd7 | 308 | host_makefile_frag=config/mh-${host_alias} |
ba04ec6e | 309 | fi |
6c18e393 | 310 | |
c5ae5678 | 311 | . ${tmpfile}.hst |
eb02fd64 | 312 | |
0df06ca0 | 313 | for target in ${targets} ; do |
eb02fd64 | 314 | |
b8f8fddc | 315 | target_alias=${target} |
50ac10c1 | 316 | result=`${configsub} ${target}` |
bc58b41d RP |
317 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
318 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
319 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
320 | target=${target_cpu}-${target_vendor}-${target_os} | |
ee8f0bd7 | 321 | target_makefile_frag=config/mt-${target} |
ba04ec6e HS |
322 | if [ ! -f ${target_makefile_frag} ] |
323 | then | |
ee8f0bd7 | 324 | target_makefile_frag=config/mt-${target_alias} |
ba04ec6e | 325 | fi |
6408afba | 326 | |
c5ae5678 | 327 | . ${tmpfile}.tgt |
0df06ca0 | 328 | |
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} \ |
3bb089aa | 613 | ${verbose} ${subdirs} ${removing} +ddestdir=${ddestdir} +idestdir=${idestdir} \ |
5420feaa | 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$ | |
3bb089aa RP |
670 | # Revision 1.68 1991/11/09 11:34:52 rich |
671 | # correct a comment | |
672 | # | |
673 | # Revision 1.67 1991/11/06 22:28:08 rich | |
674 | # pass +idestdir and +ddestdir | |
675 | # | |
676 | # Revision 1.66 1991/11/05 04:02:14 rich | |
677 | # don't allow +recurring to reach config.status | |
678 | # | |
679 | # Revision 1.65 1991/11/01 00:25:28 rich | |
28f3b094 RP |
680 | # new install theme |
681 | # | |
682 | # Revision 1.64 1991/10/30 06:55:25 rich | |
683 | # suck in site makefile frags first | |
684 | # | |
685 | # Revision 1.63 1991/10/25 02:07:18 steve | |
ee8f0bd7 SC |
686 | # More name changing |
687 | # | |
688 | # Revision 1.62 1991/10/24 11:59:03 rich | |
689 | # add null definitions for makefile_frag_foo | |
690 | # | |
691 | # Revision 1.61 1991/10/24 00:23:59 hgs | |
ba04ec6e HS |
692 | # Allow for using tmake-sun4 |
693 | # | |
694 | # Revision 1.60 1991/10/23 21:48:28 rich | |
c5ae5678 RP |
695 | # Makefiles should include the makefile frag names even if the makefile |
696 | # frag doesn't exist in *this* directory. Otherwise we inherit the | |
697 | # variable setting from our parent Makefile. | |
698 | # | |
699 | # Revision 1.59 1991/10/16 19:53:31 gnu | |
700 | # Update for SCO problems. | |
701 | # | |
702 | # * Fix "Larry Wall kludge" line so it works. If this script is run by csh, | |
703 | # it will complain, feed itself to sh, and complain some more. But will work. | |
704 | # | |
705 | # * Use <14 char file names in /tmp. | |
706 | # | |
707 | # Revision 1.58 1991/10/16 06:12:52 rich | |
708 | # Two small bugs. First, single quoted sed line doesn't need to quote | |
709 | # '$'. Second, use quotes around the hereis document trigger in order | |
710 | # to quote the entire contents of the hereis document. | |
711 | # | |
712 | # Revision 1.57 1991/10/11 05:31:05 gnu | |
713 | # Simplify "Using" message code. Put the message that configure prints | |
714 | # (or suppresses) into the config.status file as a comment. | |
715 | # | |
716 | # Revision 1.56 1991/10/10 05:01:47 rich | |
717 | # Remove the set -e but protect the recusion call. | |
718 | # | |
719 | # Revision 1.55 1991/10/10 04:57:23 rich | |
5420feaa RP |
720 | # * Die when sub-configure's do. |
721 | # * get the makefile building message line correct. | |
722 | # * set -e | |
723 | # | |
724 | # Revision 1.54 1991/10/10 01:04:42 rich | |
50ac10c1 RP |
725 | # Backed out the "/bin/sh config.sub" change. Fails when config.sub was |
726 | # on PATH. | |
727 | # | |
728 | # Revision 1.53 1991/10/10 00:38:08 rich | |
dafcb8be RP |
729 | # Call config.sub as "/bin/sh config.sub" instead of directly. This |
730 | # protects us from the case where config.sub isn't executable. | |
731 | # | |
732 | # Revision 1.52 1991/10/09 00:48:26 rich | |
639665de RP |
733 | # Another patch from jim. |
734 | # | |
735 | # Revision 1.51 1991/10/08 06:07:58 wilson | |
bdb73134 JW |
736 | # Fix bug in smake- file code. |
737 | # | |
738 | # Revision 1.50 1991/10/04 23:49:37 rich | |
739 | # Per's patch for my config.sub botch. | |
740 | # | |
741 | # Revision 1.49 1991/10/04 22:52:09 rich | |
49b10446 RP |
742 | # Use john's heuristic for finding ourselves. kinda like hare krishna. |
743 | # | |
744 | # Revision 1.48 1991/10/02 13:17:28 rich | |
745 | # take out the set -e for now | |
746 | # | |
747 | # Revision 1.47 1991/10/02 10:02:23 rich | |
748 | # * temporary files in TMPDIR | |
749 | # * +objdir | |
750 | # | |
751 | # Revision 1.46 1991/10/02 06:29:53 rich | |
7875b07f RP |
752 | # Added +site=foo option for naming site specific Makefile fragments. |
753 | # | |
754 | # Revision 1.45 1991/10/02 06:15:13 rich | |
6f8ac2d9 RP |
755 | # Removed +f option. Used to stand for +forcesubdirs which is now |
756 | # called +subdirs. | |
757 | # | |
758 | # Revision 1.44 1991/10/02 06:02:35 rich | |
213195dd RP |
759 | # Added rcs log line. |
760 | # | |
761 | # | |
762 | # | |
763 | ||
0df06ca0 RP |
764 | # |
765 | # Local Variables: | |
766 | # fill-column: 131 | |
767 | # End: | |
768 | # | |
74cc5508 | 769 | |
46f3c7cd | 770 | # end of configure |