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 | |
49b10446 RP |
168 | else |
169 | if (echo $0 | grep '/' > /dev/null) ; then | |
170 | progname=`pwd`/$0 | |
49b10446 RP |
171 | else |
172 | progname=$0 | |
49b10446 RP |
173 | PATH=$PATH:`pwd` ; export PATH |
174 | fi | |
175 | fi | |
176 | ||
bdb73134 JW |
177 | configsub=`echo ${progname} | sed 's/configure\$/config.sub/'` |
178 | ||
179 | if [ ! -f ${configsub} ] ; then | |
180 | echo '***' cannot find config.sub. | |
181 | echo 1 | |
182 | fi | |
49b10446 | 183 | |
c297d71e RP |
184 | # process host and target only if not removing. |
185 | if [ -z "${removing}" -a -z "${fatal}" ] ; then | |
eb02fd64 | 186 | # Complain if an arg is missing |
0df06ca0 RP |
187 | if [ -z "${hosts}" ] ; then |
188 | (echo ; | |
189 | echo "configure: No HOST specified." ; | |
bc58b41d | 190 | echo) 1>&2 |
0df06ca0 | 191 | fatal=true |
eb02fd64 | 192 | fi |
131a3881 | 193 | fi |
eb02fd64 | 194 | |
0df06ca0 RP |
195 | if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then |
196 | (echo "Usage: configure HOST" ; | |
197 | echo ; | |
198 | echo "Options: [defaults in brackets]" ; | |
199 | echo " +ansi configure w/ANSI library. [no ansi lib]" ; | |
49b10446 | 200 | echo " +destdir=MYDIR configure for installation into MYDIR. [\"/usr/local\"]" ; |
0df06ca0 | 201 | echo " +gas configure the compilers for use with gas. [native as]" ; |
49b10446 RP |
202 | echo " +help print this message. [normal config]" ; |
203 | echo " +lang=LANG configure to build LANG. [gcc]" ; | |
0df06ca0 | 204 | echo " +nfp configure the compilers default to soft floating point. [hard float]" ; |
46766962 | 205 | echo " +norecursion configure this directory only. [recurse]" ; |
49b10446 | 206 | echo " +objdir=ODIR configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ; |
0df06ca0 | 207 | echo " +rm remove this configuration. [build a configuration]" ; |
639665de RP |
208 | echo " +site configure with site specific makefile" ; |
209 | # This is correctly aligned in the output, even though it isn't here. | |
210 | echo " +subdirs configure in subdirectories. [in source directories]" ; | |
0df06ca0 | 211 | echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ; |
49b10446 | 212 | echo " +tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ; |
0df06ca0 RP |
213 | echo ; |
214 | echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; | |
991643f5 | 215 | echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; |
0df06ca0 RP |
216 | echo "options given will apply to all targets.") 1>&2 |
217 | ||
218 | if [ -r config.status ] ; then | |
219 | cat config.status | |
220 | fi | |
221 | ||
222 | exit 1 | |
eb02fd64 RP |
223 | fi |
224 | ||
c297d71e RP |
225 | ### break up configure.in. |
226 | if [ -r configure.in ] ; then | |
227 | if [ -z "`grep '^# per\-host:' configure.in`" ] ; then | |
228 | echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 | |
eb02fd64 RP |
229 | exit 1 |
230 | fi | |
231 | ||
c297d71e RP |
232 | if [ -z "`grep '^# per\-target:' configure.in`" ] ; then |
233 | echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 | |
234 | exit 1 | |
bc58b41d RP |
235 | fi |
236 | ||
49b10446 RP |
237 | if [ -z "${TMPDIR}" ] ; then |
238 | TMPDIR=/tmp ; export TMPDIR | |
239 | fi | |
240 | ||
c297d71e RP |
241 | # split configure.in into common, per-host, per-target, |
242 | # and post-target parts. Post-target is optional. | |
49b10446 RP |
243 | sed -e '/^# per\-host:/,$d' configure.in > ${TMPDIR}/configure.$$.com |
244 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > ${TMPDIR}/configure.$$.hst | |
c297d71e | 245 | if grep -s '^# post-target:' configure.in ; then |
49b10446 RP |
246 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > ${TMPDIR}/configure.$$.tgt |
247 | sed -e '1,/^# post\-target:/d' configure.in > ${TMPDIR}/configure.$$.pos | |
c297d71e | 248 | else |
49b10446 RP |
249 | sed -e '1,/^# per\-target:/d' configure.in > ${TMPDIR}/configure.$$.tgt |
250 | echo >${TMPDIR}/configure.$$.pos | |
bc58b41d | 251 | fi |
eb02fd64 | 252 | |
c297d71e RP |
253 | else |
254 | echo '***' No configure.in in `pwd` | |
255 | exit 1 | |
256 | fi | |
eb02fd64 | 257 | |
c297d71e | 258 | ### do common part of configure.in |
eb02fd64 | 259 | |
49b10446 | 260 | . ${TMPDIR}/configure.$$.com |
eb02fd64 | 261 | |
ec342d7d | 262 | # some sanity checks on configure.in |
0df06ca0 | 263 | if [ -z "${srctrigger}" ] ; then |
c297d71e | 264 | echo '***' srctrigger not set in `pwd`/configure.in. |
ec342d7d RP |
265 | exit 1 |
266 | fi | |
267 | ||
0df06ca0 RP |
268 | for host in ${hosts} ; do |
269 | # Default other arg | |
270 | if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then | |
271 | targets=${host} | |
272 | defaulttargets=true | |
273 | fi | |
eb02fd64 | 274 | |
b8f8fddc RP |
275 | host_alias=${host} |
276 | ||
49b10446 | 277 | result=`${configsub} ${host}` |
bc58b41d RP |
278 | host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
279 | host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
280 | host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
281 | host=${host_cpu}-${host_vendor}-${host_os} | |
6c18e393 RP |
282 | host_makefile_frag=config/hmake-${host} |
283 | ||
49b10446 | 284 | . ${TMPDIR}/configure.$$.hst |
eb02fd64 | 285 | |
0df06ca0 | 286 | for target in ${targets} ; do |
eb02fd64 | 287 | |
b8f8fddc | 288 | target_alias=${target} |
49b10446 | 289 | result=`${configsub} ${target}` |
bc58b41d RP |
290 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
291 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
292 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
293 | target=${target_cpu}-${target_vendor}-${target_os} | |
6c18e393 | 294 | target_makefile_frag=config/tmake-${target} |
6408afba | 295 | |
49b10446 | 296 | . ${TMPDIR}/configure.$$.tgt |
0df06ca0 RP |
297 | |
298 | # Temporarily, we support only direct subdir builds. | |
b8f8fddc RP |
299 | hostsubdir=H-${host_alias} |
300 | targetsubdir=T-${target_alias} | |
0df06ca0 RP |
301 | |
302 | if [ -n "${removing}" ] ; then | |
49b10446 RP |
303 | if [ -n "${objdir}" ] ; then |
304 | echo '***' +rm not supported for +objdir. Just \"rm -rf ${objdir}\" by hand. | |
305 | exit 1 | |
306 | fi | |
307 | ||
991643f5 | 308 | if [ -n "${subdirs}" ] ; then |
67ca110d RP |
309 | if [ -d "${hostsubdir}" ] ; then |
310 | rm -rf ${hostsubdir}/${targetsubdir} | |
0df06ca0 | 311 | |
c297d71e | 312 | if [ -z "`(ls ${hostsubdir}) 2>&1 | grep T- | grep -v T-independent`" ] ; then |
67ca110d RP |
313 | rm -rf ${hostsubdir} |
314 | fi | |
315 | else | |
316 | echo Warning: no `pwd`/${hostsubdir} to remove. | |
0df06ca0 RP |
317 | fi |
318 | else | |
063efd10 | 319 | rm -f ${Makefile} config.status ${links} |
0df06ca0 | 320 | fi |
74cc5508 | 321 | else |
49b10446 RP |
322 | if [ -n "${objdir}" ]; then |
323 | srcdir=`pwd` | |
324 | cd ${objdir} | |
325 | fi | |
326 | ||
991643f5 | 327 | if [ -n "${subdirs}" ] ; then |
0df06ca0 | 328 | # check for existing status before allowing forced subdirs. |
063efd10 | 329 | if [ -f ${Makefile} ] ; then |
bc58b41d | 330 | echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2 |
0df06ca0 RP |
331 | exit 1 |
332 | fi | |
eb02fd64 | 333 | |
0df06ca0 RP |
334 | if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi |
335 | cd ${hostsubdir} | |
eb02fd64 | 336 | |
bc58b41d RP |
337 | if [ ! -d ${targetsubdir} ] ; then |
338 | if [ -z "${commontargets}" ] ; then | |
339 | mkdir ${targetsubdir} | |
340 | else | |
c297d71e RP |
341 | if [ ! -d T-independent ] ; then |
342 | mkdir T-independent | |
bc58b41d RP |
343 | fi |
344 | ||
c297d71e | 345 | ${symbolic_link} T-independent ${targetsubdir} |
bc58b41d RP |
346 | fi # if target independent |
347 | fi # if no target dir yet | |
348 | ||
0df06ca0 | 349 | cd ${targetsubdir} |
eb02fd64 | 350 | |
49b10446 RP |
351 | if [ -z "${srcdir}" ] ; then |
352 | srcdir=../.. | |
353 | fi | |
0df06ca0 RP |
354 | else |
355 | # if not subdir builds, then make sure none exist. | |
c297d71e | 356 | if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then |
bc58b41d | 357 | echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2 |
0df06ca0 | 358 | exit 1 |
c297d71e RP |
359 | else |
360 | true | |
0df06ca0 RP |
361 | fi |
362 | fi | |
eb02fd64 | 363 | |
0df06ca0 RP |
364 | # Find the source files, if location was not specified. |
365 | if [ -z "${srcdir}" ] ; then | |
366 | srcdirdefaulted=1 | |
367 | srcdir=. | |
368 | if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then | |
369 | srcdir=.. | |
370 | fi | |
371 | fi | |
eb02fd64 | 372 | |
0df06ca0 RP |
373 | if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then |
374 | if [ -z "${srcdirdefaulted}" ] ; then | |
bc58b41d | 375 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 |
0df06ca0 | 376 | else |
bc58b41d | 377 | echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 |
0df06ca0 | 378 | fi |
eb02fd64 | 379 | |
bc58b41d | 380 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 |
0df06ca0 RP |
381 | exit 1 |
382 | fi | |
131a3881 | 383 | |
0df06ca0 RP |
384 | # Set up the list of links to be made. |
385 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
eb02fd64 | 386 | |
0df06ca0 RP |
387 | # Make the links. |
388 | while [ -n "${files}" ] ; do | |
389 | # set file to car of files, files to cdr of files | |
390 | set ${files}; file=$1; shift; files=$* | |
391 | set ${links}; link=$1; shift; links=$* | |
131a3881 | 392 | |
0df06ca0 | 393 | if [ ! -r ${srcdir}/${file} ] ; then |
bc58b41d RP |
394 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 |
395 | echo '***' "since the file \"${file}\" does not exist." 1>&2 | |
0df06ca0 RP |
396 | exit 1 |
397 | fi | |
131a3881 | 398 | |
0df06ca0 RP |
399 | ${remove} -f ${link} |
400 | rm -f config.status | |
401 | # Make a symlink if possible, otherwise try a hard link | |
402 | ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} | |
131a3881 | 403 | |
0df06ca0 | 404 | if [ ! -r ${link} ] ; then |
bc58b41d | 405 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 |
0df06ca0 RP |
406 | exit 1 |
407 | fi | |
bc58b41d RP |
408 | |
409 | if [ -n "${verbose}" ] ; then | |
410 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
411 | fi | |
0df06ca0 | 412 | done |
131a3881 | 413 | |
0df06ca0 RP |
414 | # Create a .gdbinit file which runs the one in srcdir |
415 | # and tells GDB to look there for source files. | |
416 | ||
417 | case ${srcdir} in | |
418 | .) | |
419 | ;; | |
420 | *) | |
421 | echo "dir ." > .gdbinit | |
422 | echo "dir ${srcdir}" >> .gdbinit | |
423 | echo "source ${srcdir}/.gdbinit" >> .gdbinit | |
424 | ;; | |
425 | esac | |
426 | ||
427 | # Install a makefile, and make it set VPATH | |
428 | # if necessary so that the sources are found. | |
429 | # Also change its value of srcdir. | |
430 | ||
431 | # FIXME-someday: This business of always writing to .tem and mv back | |
432 | # is so that I don't screw things up while developing. Once this | |
433 | # template is stable, these should be optimized. xoxorich. | |
434 | ||
435 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
436 | if [ "${host}" != "${target}" ] ; then | |
063efd10 JG |
437 | echo "CROSS=-DCROSS_COMPILE" > ${Makefile} |
438 | echo "ALL=start.encap" >> ${Makefile} | |
0df06ca0 | 439 | else |
063efd10 | 440 | echo "ALL=all.internal" > ${Makefile} |
0df06ca0 | 441 | fi |
131a3881 | 442 | |
0df06ca0 | 443 | # set target, host, VPATH |
b8f8fddc RP |
444 | echo "host_alias = ${host_alias}" >> ${Makefile} |
445 | echo "host_cpu = ${host_cpu}" >> ${Makefile} | |
446 | echo "host_vendor = ${host_vendor}" >> ${Makefile} | |
447 | echo "host_os = ${host_os}" >> ${Makefile} | |
448 | ||
449 | echo "target_alias = ${target_alias}" >> ${Makefile} | |
450 | echo "target_cpu = ${target_cpu}" >> ${Makefile} | |
451 | echo "target_vendor = ${target_vendor}" >> ${Makefile} | |
452 | echo "target_os = ${target_os}" >> ${Makefile} | |
131a3881 | 453 | |
991643f5 | 454 | if [ -n "${subdirs}" ] ; then |
49b10446 RP |
455 | (echo "subdir = /${hostsubdir}/${targetsubdir}" ; |
456 | echo "unsubdir = ../..") >> ${Makefile} | |
0df06ca0 | 457 | else |
49b10446 RP |
458 | (echo "subdir =" ; |
459 | echo "unsubdir = .") >> ${Makefile} | |
0df06ca0 | 460 | fi |
131a3881 | 461 | |
063efd10 JG |
462 | # echo "workdir = `pwd`" >> ${Makefile} |
463 | echo "VPATH = ${srcdir}" >> ${Makefile} | |
eb02fd64 | 464 | |
063efd10 JG |
465 | # add "Makefile.in" (or whatever it's called) |
466 | cat ${srcdir}/${Makefile_in} >> ${Makefile} | |
eb02fd64 | 467 | |
0df06ca0 | 468 | # Conditionalize the makefile for this host. |
9d1e053b | 469 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
b8f8fddc RP |
470 | (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ; |
471 | sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem | |
063efd10 | 472 | mv Makefile.tem ${Makefile} |
0df06ca0 | 473 | fi |
131a3881 | 474 | |
0df06ca0 | 475 | # Conditionalize the makefile for this target. |
9d1e053b | 476 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
b8f8fddc RP |
477 | (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; |
478 | sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem | |
063efd10 | 479 | mv Makefile.tem ${Makefile} |
0df06ca0 | 480 | fi |
ec342d7d | 481 | |
7875b07f RP |
482 | # Conditionalize the makefile for this site. |
483 | if [ -n "${site}" ] ; then | |
484 | site_makefile_frag=smake-${site} | |
485 | ||
486 | if [ -f ${srcdir}/${site_makefile_frag} ] ; then | |
487 | (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ; | |
bdb73134 | 488 | sed -e "/^####/ r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem |
7875b07f RP |
489 | mv Makefile.tem ${Makefile} |
490 | fi | |
491 | fi | |
492 | ||
0df06ca0 | 493 | # set srcdir |
063efd10 JG |
494 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem |
495 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 496 | |
0df06ca0 RP |
497 | # set destdir |
498 | if [ -n "${destdir}" ] ; then | |
063efd10 JG |
499 | sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem |
500 | mv Makefile.tem ${Makefile} | |
0df06ca0 | 501 | fi |
eb02fd64 | 502 | |
0df06ca0 | 503 | # reset SUBDIRS |
063efd10 JG |
504 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem |
505 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 506 | |
0df06ca0 | 507 | # reset NONSUBDIRS |
063efd10 JG |
508 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem |
509 | mv Makefile.tem ${Makefile} | |
eb02fd64 | 510 | |
7875b07f RP |
511 | # remove any form feeds. |
512 | sed -e "s/\f//" ${Makefile} > Makefile.tem | |
513 | mv Makefile.tem ${Makefile} | |
514 | ||
0df06ca0 | 515 | using= |
9d1e053b RP |
516 | if [ -f ${srcdir}/${host_makefile_frag} ] ; then |
517 | using=" using \"${host_makefile_frag}\"" | |
0df06ca0 | 518 | fi |
eb02fd64 | 519 | |
9d1e053b | 520 | if [ -f ${srcdir}/${target_makefile_frag} ] ; then |
0df06ca0 | 521 | if [ -z "${using}" ] ; then |
9d1e053b | 522 | andusing=" using \"${target_makefile_frag}\"" |
0df06ca0 | 523 | else |
9d1e053b | 524 | andusing="${using} and \"${target_makefile_frag}\"" |
0df06ca0 RP |
525 | fi |
526 | else | |
527 | andusing=${using} | |
528 | fi | |
eb02fd64 | 529 | |
7875b07f RP |
530 | if [ -f ${srcdir}/${site_makefile_frag} ] ; then |
531 | if [ -z "${andusing}" ] ; then | |
532 | andandusing=" using \"${site_makefile_frag}\"" | |
533 | else | |
534 | andandusing="${andusing} and \"${site_makefile_frag}\"" | |
535 | fi | |
536 | else | |
537 | andandusing=${using} | |
538 | fi | |
539 | ||
46766962 | 540 | if [ -n "${verbose}" -o -z "${recurring}" ] ; then |
7875b07f | 541 | echo "Created \"${Makefile}\"" in `pwd`${andandusing}. |
bc58b41d | 542 | fi |
063efd10 | 543 | |
49b10446 RP |
544 | if [ -f ${TMPDIR}/configure.$$.pos ] ; then |
545 | . ${TMPDIR}/configure.$$.pos | |
c297d71e | 546 | fi |
eb02fd64 | 547 | |
b8f8fddc RP |
548 | # describe the chosen configuration in config.status. |
549 | # Make that file a shellscript which will reestablish | |
550 | # the same configuration. Used in Makefiles to rebuild | |
551 | # Makefiles. | |
552 | ||
553 | echo "#!/bin/sh | |
49b10446 RP |
554 | # `pwd` was configured as follows: |
555 | (cd ${srcdir} ; ${progname}" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` ")" > config.status | |
b8f8fddc | 556 | chmod a+x config.status |
0df06ca0 RP |
557 | |
558 | originaldir=`pwd` | |
559 | cd ${srcdir} | |
560 | fi | |
bc58b41d RP |
561 | |
562 | # If there are subdirectories, then recurse. | |
46766962 | 563 | if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then |
bc58b41d RP |
564 | for configdir in ${configdirs} ; do |
565 | if [ -n "${verbose}" ] ; then | |
566 | echo Configuring ${configdir}... | |
567 | fi | |
568 | ||
569 | if [ -d ${configdir} ] ; then | |
49b10446 RP |
570 | if [ -n "${objdir}" ] ; then |
571 | if [ ! -d ${objdir}/${configdir} ] ; then | |
572 | mkdir ${objdir}/${configdir} | |
573 | fi | |
574 | fi | |
575 | ||
bc58b41d | 576 | (cd ${configdir} ; |
49b10446 RP |
577 | ${progname} +recurring ${host_alias} +target=${target_alias} \ |
578 | ${verbose} ${subdirs} ${removing} +destdir=${destdir} \ | |
579 | `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \ | |
580 | ${tmpdiroption}) \ | |
bc58b41d RP |
581 | | sed 's/^/ /' |
582 | else | |
583 | if [ -n "${verbose}" ] ; then | |
584 | echo Warning: directory \"${configdir}\" is missing. | |
585 | fi | |
586 | fi | |
587 | done | |
588 | fi | |
67ca110d RP |
589 | done # for each target |
590 | ||
4101d868 | 591 | # Now build a Makefile for this host. |
991643f5 | 592 | if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then |
49b10446 RP |
593 | push=`pwd` |
594 | ||
595 | if [ -n "${objdir}" ] ; then | |
596 | cd ${objdir} | |
597 | fi | |
598 | ||
4101d868 RP |
599 | cd ${hostsubdir} |
600 | cat > GNUmakefile << E!O!F | |
b8f8fddc | 601 | # Makefile generated by configure for host ${host_alias}. |
4101d868 | 602 | |
c297d71e | 603 | ALL := $(shell ls -d T-*) |
4101d868 RP |
604 | |
605 | %: | |
606 | $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true | |
607 | ||
608 | all: | |
609 | E!O!F | |
49b10446 | 610 | cd ${push} |
4101d868 | 611 | fi |
67ca110d | 612 | done # for each host |
eb02fd64 | 613 | |
c297d71e RP |
614 | ### clean up. |
615 | ||
49b10446 | 616 | rm -f ${TMPDIR}/configure.$$.com ${TMPDIR}/configure.$$.tgt ${TMPDIR}/configure.$$.hst ${TMPDIR}/configure.$$.pos |
c297d71e | 617 | |
eb02fd64 | 618 | exit 0 |
74cc5508 | 619 | |
213195dd RP |
620 | # |
621 | # | |
622 | # $Log$ | |
639665de RP |
623 | # Revision 1.52 1991/10/09 00:48:26 rich |
624 | # Another patch from jim. | |
625 | # | |
626 | # Revision 1.51 1991/10/08 06:07:58 wilson | |
bdb73134 JW |
627 | # Fix bug in smake- file code. |
628 | # | |
629 | # Revision 1.50 1991/10/04 23:49:37 rich | |
630 | # Per's patch for my config.sub botch. | |
631 | # | |
632 | # Revision 1.49 1991/10/04 22:52:09 rich | |
49b10446 RP |
633 | # Use john's heuristic for finding ourselves. kinda like hare krishna. |
634 | # | |
635 | # Revision 1.48 1991/10/02 13:17:28 rich | |
636 | # take out the set -e for now | |
637 | # | |
638 | # Revision 1.47 1991/10/02 10:02:23 rich | |
639 | # * temporary files in TMPDIR | |
640 | # * +objdir | |
641 | # | |
642 | # Revision 1.46 1991/10/02 06:29:53 rich | |
7875b07f RP |
643 | # Added +site=foo option for naming site specific Makefile fragments. |
644 | # | |
645 | # Revision 1.45 1991/10/02 06:15:13 rich | |
6f8ac2d9 RP |
646 | # Removed +f option. Used to stand for +forcesubdirs which is now |
647 | # called +subdirs. | |
648 | # | |
649 | # Revision 1.44 1991/10/02 06:02:35 rich | |
213195dd RP |
650 | # Added rcs log line. |
651 | # | |
652 | # | |
653 | # | |
654 | ||
0df06ca0 RP |
655 | # |
656 | # Local Variables: | |
657 | # fill-column: 131 | |
658 | # End: | |
659 | # | |
74cc5508 | 660 | |
46f3c7cd | 661 | # end of configure |