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