Output hex with local_hex_string for Modula-2 support.
[deliverable/binutils-gdb.git] / gdb / configure
CommitLineData
0df06ca0
RP
1#!/bin/sh
2# Please do not edit this file. It is generated automatically from
3# configure.in and a configure template.
4configdirs=
5
6#!/bin/sh
7
8# Configuration script template
9# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
10
11#This file is part of GNU.
12
bdf3621b
JG
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
0df06ca0
RP
26
27# $Id$
28
29#
30# Shell script to create proper links to machine-dependent files in
31# preparation for compilation.
32#
33# If configure succeeds, it leaves its status in config.status.
34# If configure fails after disturbing the status quo,
35# config.status is removed.
36#
37
38remove=rm
39hard_link=ln
40symbolic_link='ln -s'
41
42#for Test
43#remove="echo rm"
44#hard_link="echo ln"
45#symbolic_link="echo ln -s"
46
c4220303
RP
47progname=$0
48
0df06ca0
RP
49# clear some things potentially inherited from environment.
50ansi=
c4220303 51defaulttargets=
0df06ca0
RP
52destdir=
53fatal=
54hostsubdir=
bdf3621b
JG
55Makefile=Makefile
56Makefile_in=Makefile.in
0df06ca0 57norecurse=
625453dc 58recursing=
0df06ca0
RP
59removing=
60srcdir=
61srctrigger=
62target=
63targets=
f0b9c976 64commontargets=
0df06ca0
RP
65targetsubdir=
66template=
67verbose=
68
69for arg in $*;
70do
71 case ${arg} in
f0b9c976 72 -ansi | +a*)
0df06ca0 73 ansi=true
f0b9c976 74 clib=clib
0df06ca0
RP
75 ;;
76 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
77 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
78 ;;
0df06ca0
RP
79 -languages=* | +languages=* | +language=* | +languag=* \
80 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
81 | +l=*)
82 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
83 ;;
f0b9c976 84 -gas | +g*)
0df06ca0
RP
85 gas=yes
86 ;;
f0b9c976 87 -help | +h*)
0df06ca0
RP
88 fatal=true
89 ;;
f0b9c976 90 -nfp | +nf*)
0df06ca0
RP
91 nfp=yes
92 ;;
f0b9c976 93 -norecurse | +no*)
0df06ca0
RP
94 norecurse=true
95 ;;
625453dc
SG
96 -recursing)
97 recursing=true
98 ;;
f0b9c976 99 -rm | +r*)
0df06ca0
RP
100 removing=${arg}
101 ;;
102# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
103# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
104# ;;
f0b9c976
RP
105 -subdirs | +f* | +su*)
106 subdirs=${arg}
107 ;;
108 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
0df06ca0 109 if [ -n "${targets}" ] ; then
f0b9c976 110 subdirs="+subdirs"
0df06ca0
RP
111 fi
112
113 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
114 targets="${newtargets}"
115 ;;
f0b9c976 116 -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
0df06ca0
RP
117 template=`echo ${arg} | sed 's/[+-]template=//'`
118 ;;
f0b9c976 119 -v | -verbose | +v*)
0df06ca0
RP
120 verbose=${arg}
121 ;;
122 -* | +*)
123 (echo ;
124 echo "Unrecognized option: \"${arg}\"". ;
625453dc 125 echo) 1>&2
0df06ca0
RP
126 fatal=true
127 ;;
128 *)
129 if [ -n "${hosts}" ] ; then
f0b9c976 130 subdirs="+subdirs"
0df06ca0
RP
131 fi
132
133 newhosts="${hosts} ${arg}"
134 hosts=${newhosts}
135 ;;
136 esac
137done
138
139if [ -n "${verbose}" ] ; then
140 echo `pwd`/configure $*
0df06ca0
RP
141fi
142
143# process host and target only if not rebuilding configure itself or removing.
144if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
145 # Complain if an arg is missing
146 if [ -z "${hosts}" ] ; then
147 (echo ;
148 echo "configure: No HOST specified." ;
625453dc 149 echo) 1>&2
0df06ca0
RP
150 fatal=true
151 fi
152fi
153
154if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
155 (echo "Usage: configure HOST" ;
156 echo ;
157 echo "Options: [defaults in brackets]" ;
158 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
159 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
f0b9c976 160 echo " +subdirs configure in subdirectories. [in source directories]" ;
0df06ca0
RP
161 echo " +lang=LANG configure to build LANG. [gcc]" ;
162 echo " +help print this message. [normal config]" ;
163 echo " +gas configure the compilers for use with gas. [native as]" ;
164 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
165 echo " +norecurse configure this directory only. [recurse]" ;
166 echo " +rm remove this configuration. [build a configuration]" ;
167 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
168 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
169 echo ;
170 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
f0b9c976 171 echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
625453dc 172 echo "options given will apply to all targets.") 1>&2
0df06ca0
RP
173
174 if [ -r config.status ] ; then
175 cat config.status
176 fi
177
178 exit 1
179fi
180
181#### configure.in common parts come in here.
912e0732
RP
182srcname="GDB"
183srctrigger=main.c
0df06ca0 184
c4220303 185## end of common part.
0df06ca0
RP
186
187# are we rebuilding config itself?
188if [ -n "${template}" ] ; then
189 if [ ! -r ${template} ] ; then
625453dc 190 echo '***' "Can't find template ${template}." 1>&2
0df06ca0
RP
191 exit 1
192 fi
193
c4220303
RP
194# prep the template
195 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
196#### configure.in common parts come in here.\
197## end of common part.' \
198 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
199#### configure.in per-host parts come in here.\
200## end of per-host part.' \
201 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
202#### configure.in per-target parts come in here.\
203## end of per-target part.' \
bdf3621b
JG
204 -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
205#### configure.in post-target parts come in here.\
206## end of post-target part.' \
c4220303 207 < ${template} > template.new
0df06ca0
RP
208
209 if [ -r configure.in ] ; then
210 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
625453dc 211 echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
0df06ca0
RP
212 exit 1
213 fi
214
215 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
625453dc 216 echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
0df06ca0
RP
217 exit 1
218 fi
219
bdf3621b
JG
220 # split configure.in into common, per-host, per-target,
221 # and post-target parts. Post-target is optional.
c4220303
RP
222 sed -e '/^# per\-host:/,$d' configure.in > configure.com
223 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
bdf3621b
JG
224 if grep -s '^# post-target:' configure.in ; then
225 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
226 sed -e '1,/^# post\-target:/d' configure.in > configure.pos
227 else
228 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
229 echo >configure.pos
230 fi
0df06ca0 231
c4220303
RP
232 # and insert them
233 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
234 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
235 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
bdf3621b 236 -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
c4220303 237 template.new > configure.new
0df06ca0 238
bdf3621b 239 rm -f configure.com configure.tgt configure.hst configure.pos
0df06ca0
RP
240 else
241 echo Warning: no configure.in in `pwd`
242 cat ${template} >> configure
243 fi
244
c4220303
RP
245 chmod a+x configure.new
246 rm template.new
247# mv configure configure.old
248 mv configure.new configure
f0b9c976
RP
249
250 if [ -n "${verbose}" ] ; then
251 echo Rebuilt configure in `pwd`
252 fi
0df06ca0 253
625453dc
SG
254 # Now update config.sub from the template directory.
255 if echo "$template" | grep -s 'configure$' ; then
256 cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
257 # mv config.sub config.sub.old
258 mv config.sub.new config.sub
259
260 if [ -n "${verbose}" ] ; then
261 echo Rebuilt config.sub in `pwd`
262 fi
263 fi
264
0df06ca0 265 if [ -z "${norecurse}" ] ; then
6988f5c0
JG
266 # If template is relative path, make it absolute for recursing.
267 if echo "${template}" | grep -s '^/' ; then
268 true
269 else
270 template=`pwd`/${template}
271 fi
272
0df06ca0
RP
273 while [ -n "${configdirs}" ] ; do
274 # set configdir to car of configdirs, configdirs to cdr of configdirs
275 set ${configdirs}; configdir=$1; shift; configdirs=$*
276
277 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
278 targetspecificdirs=${configdir}.*
279 else
280 targetspecificdirs=
281 fi
282
283 for i in ${configdir} ${targetspecificdirs} ; do
912e0732
RP
284 if [ -d $i ] ; then
285 if [ -r $i/configure ] ; then
286 (cd $i ;
287 ./configure +template=${template} ${verbose})
288 else
f0b9c976 289 echo Warning: No configure script in `pwd`/$i
912e0732 290 fi
0df06ca0 291 else
625453dc
SG
292 if [ -n "${verbose}" ] ; then
293 echo Warning: directory $i is missing.
294 fi
0df06ca0
RP
295 fi
296 done
297 done
298 fi
299
300 exit 0
301fi
302
303# some sanity checks on configure.in
304if [ -z "${srctrigger}" ] ; then
f0b9c976 305 echo Warning: srctrigger not set in configure.in. `pwd` not configured.
0df06ca0
RP
306 exit 1
307fi
308
309for host in ${hosts} ; do
310 # Default other arg
c4220303 311 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
0df06ca0 312 targets=${host}
c4220303 313 defaulttargets=true
0df06ca0
RP
314 fi
315
625453dc
SG
316 result=`/bin/sh ./config.sub ${host}`
317 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
318 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
319 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
320 host=${host_cpu}-${host_vendor}-${host_os}
391e5612
JG
321 host_makefile_frag=config/hmake-${host}
322
0df06ca0 323#### configure.in per-host parts come in here.
c4220303 324
625453dc
SG
325# map host info into gdb names.
326
327case "${host_cpu}" in
328
329m68k)
330 case "${host_vendor}" in
331 att) gdb_host=3b1 ;;
332 altos)
333 case "${host_os}" in
334 gas) gdb_host=altosgas ;;
335 *) gdb_host=altos ;;
336 esac
337 ;;
338 hp)
339 case ${host_os} in
340 hpux) gdb_host=hp300hpux ;;
341 bsd) gdb_host=hp300bsd ;;
342 esac
343 ;;
344
345 isi) gdb_host=isi ;;
346 sony) gdb_host=news ;;
347 sun)
348 case "${host_os}" in
349 sunos3) gdb_host=sun3os3 ;;
350 sunos4) gdb_host=sun3os4 ;;
351 *) gdb_host=sun3 ;;
352 esac
353 ;;
354 esac
355 ;;
356
357m68000)
358 case "${host_vendor}" in
359 sun)
360 case "${host_os}" in
361 sunos3) gdb_host=sun2os3 ;;
362 sunos4) gdb_host=sun2os4 ;;
363 *) gdb_host=sun2 ;;
364 esac
365 esac
366 ;;
367
368sparc)
369 case "${host_os}" in
370 sunos3) gdb_host=sun4os3 ;;
371 sunos4) gdb_host=sun4os4 ;;
372 *) gdb_host=sun4 ;;
373 esac
374 ;;
375
376m68030)
377 case "${host_vendor}" in
378 sony) gdb_host=news1000 ;;
379 esac
380 ;;
381
382mips)
383 case "${host_vendor}" in
384 sony) gdb_host=bigmips ;;
385 dec) gdb_host=dec3100 ;;
386 little) gdb_host=littlemips ;;
387 sgi) gdb_host=irix3 ;;
388 esac
389 ;;
390
391i386)
392 case "${host_vendor}" in
393 sun) gdb_host=sun386 ;;
394 sco) gdb_host=i386sco ;;
395 sequent) gdb_host=symmetry ;;
396 *)
397 case "${host_os}" in
398 sysv) gdb_host=i386v ;;
399 sysv32) gdb_host=i386v32 ;;
400 esac
401 ;;
402 esac
403 ;;
404
405c1 | c2) gdb_host=convex ;;
406
407ns32k)
408 case "${host_vendor}" in
409 umax) gdb_host=umax ;;
410 esac
411 ;;
412
413arm | vax | m88k | merlin | none | np1 | pn | pyramid | tahoe) gdb_host=${host_cpu} ;;
414
415### unhandled hosts
416#altosgas
417#i386v-g
418#i386v32-g
419
420esac
421
422if [ ! -f xconfig/${gdb_host} ]; then
423 echo '***' "Gdb does not support host ${host}" 1>&2
912e0732
RP
424 exit 1
425fi
426
bdf3621b 427# We really shouldn't depend on there being a space after XM_FILE= ...
625453dc 428hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <xconfig/${gdb_host}`
912e0732 429
c4220303 430## end of per-host part.
0df06ca0 431
0df06ca0
RP
432 for target in ${targets} ; do
433
625453dc
SG
434 result=`/bin/sh ./config.sub ${target}`
435 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
436 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
437 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
438 target=${target_cpu}-${target_vendor}-${target_os}
391e5612
JG
439 target_makefile_frag=config/tmake-${target}
440
0df06ca0 441#### configure.in per-target parts come in here.
c4220303 442
625453dc
SG
443case "${target_cpu}" in
444
445m68k)
446 case "${target_vendor}" in
447 att) gdb_target=3b1 ;;
448 altos) gdb_target=altos ;;
449 hp)
450 case "${target_os}" in
451 bsd) gdb_target=hp300bsd ;;
452 hpux) gdb_target=hp300hpux ;;
453 esac
454 ;;
455 sun)
456 case "${target_os}" in
457 sunos3) gdb_target=sun3os3 ;;
458 sunos4) gdb_target=sun3os4 ;;
459 *) gdb_target=sun3 ;;
460 esac
461 ;;
462 wrs) gdb_target=vxworks68 ;;
463 isi) gdb_target=isi ;;
464 sony) gdb_target=news ;;
465 esac
466 ;;
467
468m68000)
469 case "${target_vendor}" in
470 sun)
471 case "${target_os}" in
472 sunos3) gdb_target=sun2os3 ;;
473 sunos4) gdb_target=sun2os4 ;;
474 *) gdb_target=sun2 ;;
475 esac
476 esac
477 ;;
478
479m68030)
480 case "${target_vendor}" in
481 sony) gdb_target=news1000 ;;
482 esac
483 ;;
484
485none | tahoe | vax | np1 | pn | np1 | pn | pyramid | merlin | m88k)
486 gdb_target=${target_cpu} ;;
487a29k) gdb_target=am29k ;;
488arm) gdb_target=${target_cpu} ;;
489
490mips)
491 case "${target_vendor}" in
492 sony) gdb_target=bigmips ;;
493 dec) gdb_target=dec3100 ;;
494 little) gdb_target=littlemips ;;
495 sgi) gdb_target=irix3 ;;
496 esac
497 ;;
498
499c1 | c2) gdb_target=convex ;;
500
501sparc)
502 case "${target_vendor}" in
503 sun)
504 case "${target_os}" in
505 sunos3) gdb_target=sun4os3 ;;
506 sunos4) gdb_target=sun4os4 ;;
507 *) gdb_target=sun4 ;;
508 esac
509 ;;
510 esac
511 ;;
512
513
514i386)
515 case "${target_vendor}" in
516 sco) gdb_target=i386sco ;;
517 sun) gdb_target=sun386 ;;
518 sequent) gdb_target=symmetry ;;
519 coff) gdb_target=i386v ;;
520 aout) gdb_target=i386v ;;
521 *)
522 case "${target_os}" in
523 sysv) gdb_target=i386v ;;
524 sysv32) gdb_target=i386v32 ;;
525 esac
526 esac
527 ;;
528
529i960)
530 case "${target_vendor}" in
531 bout | wrs) gdb_target=vxworks960 ;;
532 coff | intel) gdb_target=nindy960 ;;
533 esac
534 ;;
535
536ns32k)
537 case "${target_vendor}" in
538 utek) gdb_target=umax ;;
539 esac
540 ;;
541
542### unhandled targets
543# altosgas
544# i386v-g
545# i386v32-g
546
547esac
548
549if [ ! -f tconfig/${gdb_target} ]; then
550 echo '***' "Gdb does not support target ${target}" 1>&2
912e0732
RP
551 exit 1
552fi
553
554if [ -z "${removing}" ] ; then
625453dc 555 cat xconfig/${gdb_host} tconfig/${gdb_target} | awk '$1 == "#msg" {
912e0732
RP
556 print substr($0,6)}'
557fi
558
bdf3621b 559# We really shouldn't depend on there being a space after TM_FILE= ...
625453dc 560targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <tconfig/${gdb_target}`
912e0732 561
625453dc
SG
562host_makefile_frag=xconfig/${gdb_host}
563target_makefile_frag=tconfig/${gdb_target}
912e0732 564
bdf3621b 565# If hostfile (XM_FILE) and/or targetfile (TM_FILE) is not set in the
4101d868
RP
566# ?config/* file, we don't make the corresponding links. But we have
567# to remove the xm.h files and tm.h files anyway, e.g. when switching
568# from "configure host" to "configure none".
bdf3621b
JG
569files=
570links=
4101d868 571rm -f xm.h
bdf3621b
JG
572if [ "${hostfile}" != "" ]; then
573 files="${files} ${hostfile}"
574 links="${links} xm.h"
575fi
4101d868 576rm -f tm.h
bdf3621b
JG
577if [ "${targetfile}" != "" ]; then
578 files="${files} ${targetfile}"
579 links="${links} tm.h"
580fi
912e0732 581
c4220303 582## end of per-target part.
0df06ca0
RP
583
584 # Temporarily, we support only direct subdir builds.
585 hostsubdir=Host-${host}
586 targetsubdir=Target-${target}
587
588 if [ -n "${removing}" ] ; then
f0b9c976 589 if [ -n "${subdirs}" ] ; then
c4220303
RP
590 if [ -d "${hostsubdir}" ] ; then
591 rm -rf ${hostsubdir}/${targetsubdir}
0df06ca0 592
f0b9c976 593 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
c4220303
RP
594 rm -rf ${hostsubdir}
595 fi
596 else
597 echo Warning: no `pwd`/${hostsubdir} to remove.
0df06ca0
RP
598 fi
599 else
bdf3621b 600 rm -f ${Makefile} config.status ${links}
0df06ca0
RP
601 fi
602 else
f0b9c976 603 if [ -n "${subdirs}" ] ; then
0df06ca0 604 # check for existing status before allowing forced subdirs.
bdf3621b 605 if [ -f ${Makefile} ] ; then
625453dc 606 echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2
0df06ca0
RP
607 exit 1
608 fi
609
610 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
611 cd ${hostsubdir}
612
f0b9c976
RP
613 if [ ! -d ${targetsubdir} ] ; then
614 if [ -z "${commontargets}" ] ; then
615 mkdir ${targetsubdir}
616 else
617 if [ ! -d Target-independent ] ; then
618 mkdir Target-independent
619 fi
620
621 ${symbolic_link} Target-independent ${targetsubdir}
622 fi # if target independent
623 fi # if no target dir yet
624
0df06ca0
RP
625 cd ${targetsubdir}
626
627 srcdir=../..
628 else
629 # if not subdir builds, then make sure none exist.
630 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
625453dc 631 echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
0df06ca0
RP
632 exit 1
633 fi
634 fi
635
636 # Find the source files, if location was not specified.
637 if [ -z "${srcdir}" ] ; then
638 srcdirdefaulted=1
639 srcdir=.
640 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
641 srcdir=..
642 fi
643 fi
644
645 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
646 if [ -z "${srcdirdefaulted}" ] ; then
625453dc 647 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
0df06ca0 648 else
625453dc 649 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
0df06ca0
RP
650 fi
651
625453dc 652 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
0df06ca0
RP
653 exit 1
654 fi
655
656 # Set up the list of links to be made.
657 # ${links} is the list of link names, and ${files} is the list of names to link to.
658
659 # Make the links.
660 while [ -n "${files}" ] ; do
661 # set file to car of files, files to cdr of files
662 set ${files}; file=$1; shift; files=$*
663 set ${links}; link=$1; shift; links=$*
664
665 if [ ! -r ${srcdir}/${file} ] ; then
625453dc
SG
666 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
667 echo '***' "since the file \"${file}\" does not exist." 1>&2
0df06ca0
RP
668 exit 1
669 fi
670
671 ${remove} -f ${link}
672 rm -f config.status
673 # Make a symlink if possible, otherwise try a hard link
674 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
675
676 if [ ! -r ${link} ] ; then
625453dc 677 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
0df06ca0
RP
678 exit 1
679 fi
f0b9c976
RP
680
681 if [ -n "${verbose}" ] ; then
682 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
683 fi
0df06ca0
RP
684 done
685
686 # Create a .gdbinit file which runs the one in srcdir
687 # and tells GDB to look there for source files.
688
689 case ${srcdir} in
690 .)
691 ;;
692 *)
693 echo "dir ." > .gdbinit
694 echo "dir ${srcdir}" >> .gdbinit
695 echo "source ${srcdir}/.gdbinit" >> .gdbinit
696 ;;
697 esac
698
699 # Install a makefile, and make it set VPATH
700 # if necessary so that the sources are found.
701 # Also change its value of srcdir.
702
703 # FIXME-someday: This business of always writing to .tem and mv back
704 # is so that I don't screw things up while developing. Once this
705 # template is stable, these should be optimized. xoxorich.
706
707 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
708 if [ "${host}" != "${target}" ] ; then
bdf3621b
JG
709 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
710 echo "ALL=start.encap" >> ${Makefile}
0df06ca0 711 else
bdf3621b 712 echo "ALL=all.internal" > ${Makefile}
0df06ca0
RP
713 fi
714
715 # set target, host, VPATH
bdf3621b
JG
716 echo "host = ${host}" >> ${Makefile}
717 echo "target = ${target}" >> ${Makefile}
0df06ca0 718
f0b9c976 719 if [ -n "${subdirs}" ] ; then
bdf3621b 720 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
0df06ca0 721 else
bdf3621b 722 echo "subdir =" >> ${Makefile}
0df06ca0
RP
723 fi
724
bdf3621b
JG
725 # echo "workdir = `pwd`" >> ${Makefile}
726 echo "VPATH = ${srcdir}" >> ${Makefile}
0df06ca0 727
bdf3621b
JG
728 # add "Makefile.in" (or whatever it's called)
729 cat ${srcdir}/${Makefile_in} >> ${Makefile}
0df06ca0 730
0df06ca0 731 # Conditionalize the makefile for this host.
912e0732 732 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
bdf3621b
JG
733 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile} > Makefile.tem
734 mv Makefile.tem ${Makefile}
0df06ca0
RP
735 fi
736
737 # Conditionalize the makefile for this target.
912e0732 738 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
bdf3621b
JG
739 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile} > Makefile.tem
740 mv Makefile.tem ${Makefile}
0df06ca0
RP
741 fi
742
743 # set srcdir
bdf3621b
JG
744 sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
745 mv Makefile.tem ${Makefile}
0df06ca0
RP
746
747 # set destdir
748 if [ -n "${destdir}" ] ; then
bdf3621b
JG
749 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
750 mv Makefile.tem ${Makefile}
0df06ca0
RP
751 fi
752
0df06ca0 753 # reset SUBDIRS
bdf3621b
JG
754 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
755 mv Makefile.tem ${Makefile}
0df06ca0
RP
756
757 # reset NONSUBDIRS
bdf3621b
JG
758 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
759 mv Makefile.tem ${Makefile}
0df06ca0
RP
760
761 using=
912e0732
RP
762 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
763 using=" using \"${host_makefile_frag}\""
0df06ca0
RP
764 fi
765
912e0732 766 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
0df06ca0 767 if [ -z "${using}" ] ; then
912e0732 768 andusing=" using \"${target_makefile_frag}\""
0df06ca0 769 else
912e0732 770 andusing="${using} and \"${target_makefile_frag}\""
0df06ca0
RP
771 fi
772 else
773 andusing=${using}
774 fi
775
625453dc 776 if [ -n "${verbose}" -o -z "${recursing}" ] ; then
f0b9c976
RP
777 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
778 fi
bdf3621b
JG
779
780#### configure.in post-target parts come in here.
781
782case ${srcdir} in
783 .)
784 ;;
785 *)
786 grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \
787 echo "source ${srcdir}/.gdbinit" >> .gdbinit
788esac
789
4101d868 790cat ${srcdir}/alldeps.mak ${srcdir}/depend >>Makefile
bdf3621b 791## end of post-target part.
0df06ca0
RP
792
793 if [ "${host}" = "${target}" ] ; then
794 echo "Links are now set up for use with a ${target}." \
795 > config.status
796 # | tee ${srcdir}/config.status
797 else
798 echo "Links are now set up for host ${host} and target ${target}." \
799 > config.status
800 # | tee ${srcdir}/config.status
801 fi
802
803 originaldir=`pwd`
804 cd ${srcdir}
805 fi
625453dc
SG
806
807 # If there are subdirectories, then recurse.
808 if [ -z "${norecurse}" -a -n "${configdirs}" ] ; then
809 for configdir in ${configdirs} ; do
810 if [ -n "${verbose}" ] ; then
811 echo Configuring ${configdir}...
812 fi
813
814 if [ -d ${configdir} ] ; then
815 (cd ${configdir} ;
816 ./configure -recursing ${host} +target=${target} \
817 ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
818 | sed 's/^/ /'
819 else
820 if [ -n "${verbose}" ] ; then
821 echo Warning: directory \"${configdir}\" is missing.
822 fi
823 fi
824 done
825 fi
c4220303
RP
826 done # for each target
827
4101d868 828 # Now build a Makefile for this host.
f0b9c976 829 if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
4101d868
RP
830 cd ${hostsubdir}
831 cat > GNUmakefile << E!O!F
832# Makefile generated by configure for host ${host}.
833
834ALL := $(shell ls -d Target-*)
835
836%:
837 $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
838
839all:
840E!O!F
841 cd ..
842 fi
c4220303 843done # for each host
0df06ca0 844
0df06ca0
RP
845exit 0
846
847#
848# $Log$
625453dc
SG
849# Revision 1.19 1991/08/31 00:23:49 grossman
850# Merge in irix support.
851#
852# Revision 1.18 1991/08/23 04:50:17 rich
853# Minor config polish.
854#
855# Revision 1.22 1991/08/23 03:31:43 rich
856# Minor polish & config mapping.
857#
858# Revision 1.30 1991/08/22 07:15:51 rich
859# Three part names, etc.
860#
861# Revision 1.29 1991/08/20 04:56:51 rich
f0b9c976
RP
862# revisiting error messages
863#
864# Revision 1.28 1991/08/16 19:22:17 rich
865# This is the commontargets change and should be considered
866# experimental.
867#
868# Revision 1.27 1991/08/08 01:14:13 rich
869# allow +f to stand in for +subdirs
870#
871# Revision 1.26 1991/08/07 19:21:32 rich
872# +forcesubdirs -> +subdirs
873#
874# Revision 1.25 1991/08/07 07:05:30 rich
875# Added make.
876#
877# Revision 1.24 1991/08/06 19:26:01 rich
878# revised option parsing.
879#
880# Revision 1.23 1991/08/06 19:12:32 rich
4101d868
RP
881# Host-level GNUmakefiles.
882#
883# Revision 1.22 1991/07/20 01:22:30 rich
884# propogate gdb changes and destdir fix
885#
886# Revision 1.21 1991/07/20 00:55:20 gnu
887# Roll in new configure that handles GDB. Make sure that the "configure"
888# that is checked-in reflects the latest "configure.in", which includes gdb.
889#
890# Revision 1.9 1991/07/06 04:35:51 gnu
391e5612
JG
891# Fix bug in configure when iterating targets.
892# Depend on alldeps.mak, not ${srcdir}/alldeps.mak, so it can be found
893# in either spot.
894#
895# Revision 1.8 1991/07/05 00:04:58 gnu
6988f5c0
JG
896# Thu Jul 4 14:47:06 1991 John Gilmore (gnu at cygint.cygnus.com)
897#
898# * configure.in, Makefile.in: Avoid rebuilding "depend" as much.
899# Avoid declaring Makefile dependencies, because GNU Make stupidly
900# tries to update it if we do.
901#
902# * coffread.c: Revise for minor changes to bfd internal coff
903# indexes.
904#
905# * configure: If -template= is given a relative path, make it
906# absolute before recurring in subdirectories.
907#
908# Revision 1.7 1991/07/04 15:59:46 gnu
bdf3621b
JG
909# Make gdb work with configure. Only thing that doesn't work is the -list
910# option (as far as I know).
911#
912# Revision 1.6 1991/06/04 07:28:16 gnu
913# Change GDB over to GNU General Public License version 2.
914#
915# Revision 1.5 1991/05/19 07:26:54 rich
916# configure changes and -opcode.h movement.
917#
918# Revision 1.4 1991/05/19 00:16:45 rich
912e0732 919# Configure for gdb.
c4220303
RP
920#
921# Revision 1.10 1991/05/04 00:58:38 rich
922# Fix program name bug.
923#
924# Revision 1.9 1991/05/03 19:14:18 rich
925# Changed getopt to libiberty, commented out an aborted attempt at host
926# level Makefiles because it caused errors on +rm, add a warning for
927# directories expected to be removed on +rm but that don't exist.
928#
929# Revision 1.8 1991/04/24 16:50:59 rich
930# Three staging checkpoint.
931#
932# Revision 1.7 1991/04/17 01:34:47 rich
933# Added getopt for binutils, fixed problem with host dependancies in
934# configure.template.
935#
936# Revision 1.6 1991/04/16 00:18:44 rich
937# Now handles multiple hosts and targets.
938#
939# Revision 1.5 1991/04/15 23:43:44 rich
0df06ca0
RP
940# Now handles multiple hosts and targets.
941#
942# Revision 1.4 1991/04/13 02:11:03 rich
943# Config cut 3. We now almost install a29k.
944#
945# Revision 1.3 1991/04/11 02:41:54 rich
946# Cut 2 config. Subdirs.
947#
948#
949#
950
951#
952# Local Variables:
953# fill-column: 131
954# End:
955#
956
957# end of configure.template
This page took 0.071212 seconds and 4 git commands to generate.