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