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