Thu Jun 4 11:34:02 1992 Mark Eichin (eichin at cygnus.com)
[deliverable/binutils-gdb.git] / gprof / configure
CommitLineData
c98f0ae5
SEF
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# the debugger.
7#set -x
8
9#!/bin/sh
10
11# Configuration script template
12# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
13
14#This file is part of GNU.
15
16#GNU CC is free software; you can redistribute it and/or modify
17#it under the terms of the GNU General Public License as published by
18#the Free Software Foundation; either version 1, or (at your option)
19#any later version.
20
21#GNU CC is distributed in the hope that it will be useful,
22#but WITHOUT ANY WARRANTY; without even the implied warranty of
23#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24#GNU General Public License for more details.
25
26#You should have received a copy of the GNU General Public License
27#along with GNU CC; see the file COPYING. If not, write to
28#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29
30# $Id$
31
32#
33# Shell script to create proper links to machine-dependent files in
34# preparation for compilation.
35#
36# If configure succeeds, it leaves its status in config.status.
37# If configure fails after disturbing the status quo,
38# config.status is removed.
39#
40
41remove=rm
42hard_link=ln
43symbolic_link='ln -s'
44
45#for Test
46#remove="echo rm"
47#hard_link="echo ln"
48#symbolic_link="echo ln -s"
49
50progname=$0
51
52# clear some things potentially inherited from environment.
53
54ansi=
55clib=
56defaulttargets=
57destdir=
58fatal=
59hostsubdir=
60norecurse=
61removing=
62srcdir=
63srctrigger=
64target=
65targets=
66targetsubdir=
67template=
68verbose=
69
70for arg in $*;
71do
72 case ${arg} in
73 -ansi | +ansi)
74 ansi=true
75 ;;
76 -clib | +c*)
77 clib=clib
78 ;;
79 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
80 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
81 ;;
82 -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
83 | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
84 forcesubdirs=${arg}
85 ;;
86 -languages=* | +languages=* | +language=* | +languag=* \
87 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
88 | +l=*)
89 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
90 ;;
91 -gas | +gas | +ga | +g)
92 gas=yes
93 ;;
94 -help | +h | +help)
95 fatal=true
96 ;;
97 -nfp | +nfp | +nf | +n)
98 nfp=yes
99 ;;
100 -norecurse | +norecurse)
101 norecurse=true
102 ;;
103 -rm | +rm)
104 removing=${arg}
105 ;;
106# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
107# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
108# ;;
109 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=* | +t=*)
110 if [ -n "${targets}" ] ; then
111 forcesubdirs="+forcesubdirs"
112 fi
113
114 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
115 targets="${newtargets}"
116 ;;
117 -template=* | +template=*)
118 template=`echo ${arg} | sed 's/[+-]template=//'`
119 ;;
120 +verbose | +verbos | +verbo | +verb | +ver | +ve | +v)
121 verbose=${arg}
122 ;;
123 -* | +*)
124 (echo ;
125 echo "Unrecognized option: \"${arg}\"". ;
126 echo) 1>&2
127 fatal=true
128 ;;
129 *)
130 if [ -n "${hosts}" ] ; then
131 forcesubdirs="+forcesubdirs"
132 fi
133
134 newhosts="${hosts} ${arg}"
135 hosts=${newhosts}
136 ;;
137 esac
138done
139
140if [ -n "${verbose}" ] ; then
141 echo `pwd`/configure $*
142 echo targets=\"${targets}\"
143fi
144
145# process host and target only if not rebuilding configure itself or removing.
146if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
147 # Complain if an arg is missing
148 if [ -z "${hosts}" ] ; then
149 (echo ;
150 echo "configure: No HOST specified." ;
151 echo) 2>&1
152 fatal=true
153 fi
154fi
155
156if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
157 (echo "Usage: configure HOST" ;
158 echo ;
159 echo "Options: [defaults in brackets]" ;
160 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
161 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
162 echo " +forcesubdirs configure in subdirectories. [in source directories]" ;
163 echo " +lang=LANG configure to build LANG. [gcc]" ;
164 echo " +help print this message. [normal config]" ;
165 echo " +gas configure the compilers for use with gas. [native as]" ;
166 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
167 echo " +norecurse configure this directory only. [recurse]" ;
168 echo " +rm remove this configuration. [build a configuration]" ;
169 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
170 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
171 echo ;
172 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
173 echo "Asking for more than one \"+target\" implies \"+forcesubdirs\". Any other" ;
174 echo "options given will apply to all targets.") 1>&2
175
176 if [ -r config.status ] ; then
177 cat config.status
178 fi
179
180 exit 1
181fi
182
183#### configure.in common parts come in here.
184# This file is a shell script that supplies the information necessary
185# to tailor a template configure script into the configure script
186# appropriate for this directory. For more information, check any
187# existing configure script.
188
189srctrigger=gprof.c
190srcname="gprof"
191
192## end of common part.
193
194# are we rebuilding config itself?
195if [ -n "${template}" ] ; then
196 if [ ! -r ${template} ] ; then
197 echo "Can't find template ${template}."
198 exit 1
199 fi
200
201# prep the template
202 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
203#### configure.in common parts come in here.\
204## end of common part.' \
205 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
206#### configure.in per-host parts come in here.\
207## end of per-host part.' \
208 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
209#### configure.in per-target parts come in here.\
210## end of per-target part.' \
211 < ${template} > template.new
212
213 if [ -r configure.in ] ; then
214 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
215 echo `pwd`/configure.in has no "per-host:" line.
216 exit 1
217 fi
218
219 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
220 echo `pwd`/configure.in has no "per-target:" line.
221 exit 1
222 fi
223
224 # split configure.in into common, per-host, and per-target parts
225 sed -e '/^# per\-host:/,$d' configure.in > configure.com
226 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
227 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
228
229 # and insert them
230 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
231 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
232 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
233 template.new > configure.new
234
235 rm -f configure.com configure.tgt configure.hst
236 else
237 echo Warning: no configure.in in `pwd`
238 cat ${template} >> configure
239 fi
240
241 chmod a+x configure.new
242 rm template.new
243# mv configure configure.old
244 mv configure.new configure
245 echo Rebuilt configure in `pwd`
246
247 if [ -z "${norecurse}" ] ; then
248 while [ -n "${configdirs}" ] ; do
249 # set configdir to car of configdirs, configdirs to cdr of configdirs
250 set ${configdirs}; configdir=$1; shift; configdirs=$*
251
252 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
253 targetspecificdirs=${configdir}.*
254 else
255 targetspecificdirs=
256 fi
257
258 for i in ${configdir} ${targetspecificdirs} ; do
259 if [ -d $i ] ; then
260 if [ -r $i/configure ] ; then
261 (cd $i ;
262 ./configure +template=${template} ${verbose})
263 else
264 echo No configure script in `pwd`/$i
265 fi
266 else
267 echo Warning: directory $i is missing.
268 fi
269 done
270 done
271 fi
272
273 exit 0
274fi
275
276# some sanity checks on configure.in
277if [ -z "${srctrigger}" ] ; then
278 echo srctrigger not set in configure.in. `pwd` not configured.
279 exit 1
280fi
281
282for host in ${hosts} ; do
283 # Default other arg
284 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
285 targets=${host}
286 defaulttargets=true
287 fi
288
289 host_makefile_frag=config/hmake-${host}
290
291#### configure.in per-host parts come in here.
292
293## end of per-host part.
294
295
296 for target in ${targets} ; do
297
298 if [ -n "${verbose}" ] ; then
299 echo host \= \"${host}\", target \= \"${target}\".
300 fi
301
302 target_makefile_frag=config/tmake-${target}
303
304#### configure.in per-target parts come in here.
305
306files=
307links=
308## end of per-target part.
309
310 # Temporarily, we support only direct subdir builds.
311 hostsubdir=Host-${host}
312 targetsubdir=Target-${target}
313
314 if [ -n "${removing}" ] ; then
315 if [ -n "${forcesubdirs}" ] ; then
316 if [ -d "${hostsubdir}" ] ; then
317 rm -rf ${hostsubdir}/${targetsubdir}
318
319 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
320 rm -rf ${hostsubdir}
321 fi
322 else
323 echo Warning: no `pwd`/${hostsubdir} to remove.
324 fi
325 else
326 rm -f Makefile config.status ${links}
327 fi
328 else
329 if [ -n "${forcesubdirs}" ] ; then
330 # check for existing status before allowing forced subdirs.
331 if [ -f Makefile ] ; then
332 echo "Makefile already exists in source directory. `pwd` not configured."
333 exit 1
334 fi
335
336 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
337 cd ${hostsubdir}
338
339 if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi
340 cd ${targetsubdir}
341
342 srcdir=../..
343 else
344 # if not subdir builds, then make sure none exist.
345 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
346 echo "Configured subdirs exist. `pwd` not configured."
347 exit 1
348 fi
349 fi
350
351 # Find the source files, if location was not specified.
352 if [ -z "${srcdir}" ] ; then
353 srcdirdefaulted=1
354 srcdir=.
355 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
356 srcdir=..
357 fi
358 fi
359
360 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
361 if [ -z "${srcdirdefaulted}" ] ; then
362 echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
363 else
364 echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
365 fi
366
367 echo \(At least ${srctrigger} is missing.\) 1>&2
368 exit 1
369 fi
370
371 # Set up the list of links to be made.
372 # ${links} is the list of link names, and ${files} is the list of names to link to.
373
374 # Make the links.
375 while [ -n "${files}" ] ; do
376 # set file to car of files, files to cdr of files
377 set ${files}; file=$1; shift; files=$*
378 set ${links}; link=$1; shift; links=$*
379
380 if [ ! -r ${srcdir}/${file} ] ; then
381 echo "${progname}: cannot create a link \"${link}\"," 1>&2
382 echo "since the file \"${file}\" does not exist." 1>&2
383 exit 1
384 fi
385
386 ${remove} -f ${link}
387 rm -f config.status
388 # Make a symlink if possible, otherwise try a hard link
389 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
390
391 if [ ! -r ${link} ] ; then
392 echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
393 exit 1
394 fi
395 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
396 done
397
398 # Create a .gdbinit file which runs the one in srcdir
399 # and tells GDB to look there for source files.
400
401 case ${srcdir} in
402 .)
403 ;;
404 *)
405 echo "dir ." > .gdbinit
406 echo "dir ${srcdir}" >> .gdbinit
407 echo "source ${srcdir}/.gdbinit" >> .gdbinit
408 ;;
409 esac
410
411 # Install a makefile, and make it set VPATH
412 # if necessary so that the sources are found.
413 # Also change its value of srcdir.
414
415 # FIXME-someday: This business of always writing to .tem and mv back
416 # is so that I don't screw things up while developing. Once this
417 # template is stable, these should be optimized. xoxorich.
418
419 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
420 if [ "${host}" != "${target}" ] ; then
421 echo "CROSS=-DCROSS_COMPILE" > Makefile
422 echo "ALL=start.encap" >> Makefile
423 else
424 echo "ALL=all.internal" > Makefile
425 fi
426
427 # set target, host, VPATH
428 echo "host = ${host}" >> Makefile
429 echo "target = ${target}" >> Makefile
430
431 if [ -n "${forcesubdirs}" ] ; then
432 echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile
433 else
434 echo "subdir =" >> Makefile
435 fi
436
437 # echo "workdir = `pwd`" >> Makefile
438 echo "VPATH = ${srcdir}" >> Makefile
439
440 # add Makefile.in
441 cat ${srcdir}/Makefile.in >> Makefile
442
443 # and shake thoroughly.
444 # Conditionalize the makefile for this host.
445 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
446 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" Makefile > Makefile.tem
447 mv Makefile.tem Makefile
448 fi
449
450 # Conditionalize the makefile for this target.
451 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
452 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" Makefile > Makefile.tem
453 mv Makefile.tem Makefile
454 fi
455
456 # set srcdir
457 sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem
458 mv Makefile.tem Makefile
459
460 # set destdir
461 if [ -n "${destdir}" ] ; then
462 sed "s:^destdir =.*$:destdir = ${destdir}:" Makefile > Makefile.tem
463 mv Makefile.tem Makefile
464 fi
465
466 # Remove all formfeeds, since some Makes get confused by them.
467 sed "s/\f//" Makefile >> Makefile.tem
468 mv Makefile.tem Makefile
469
470 # reset SUBDIRS
471 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem
472 mv Makefile.tem Makefile
473
474 # reset NONSUBDIRS
475 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem
476 mv Makefile.tem Makefile
477
478 using=
479 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
480 using=" using \"${host_makefile_frag}\""
481 fi
482
483 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
484 if [ -z "${using}" ] ; then
485 andusing=" using \"${target_makefile_frag}\""
486 else
487 andusing="${using} and \"${target_makefile_frag}\""
488 fi
489 else
490 andusing=${using}
491 fi
492
493 echo "Created \"Makefile\"" in `pwd`${andusing}.
494
495 if [ "${host}" = "${target}" ] ; then
496 echo "Links are now set up for use with a ${target}." \
497 > config.status
498 # | tee ${srcdir}/config.status
499 else
500 echo "Links are now set up for host ${host} and target ${target}." \
501 > config.status
502 # | tee ${srcdir}/config.status
503 fi
504
505 originaldir=`pwd`
506 cd ${srcdir}
507 fi
508 done # for each target
509
510# # Now build a Makefile for this host.
511# if [ -n "${forcesubdirs}" ] ; then
512# cd ${hostsubdir}
513# cat > GNUmakefile << E!O!F
514## Makefile generated by configure for host ${host}.
515#
516#%:
517# for i in ${targets} ; do \
518# $(MAKE) -C Target-\$i \$@
519#
520#all clean stage1 stage2 stage3 stage4etags tags TAGS
521#E!O!F
522# fi
523done # for each host
524
525# If there are subdirectories, then recurse.
526
527if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi
528
529# configdirs is not null
530for configdir in ${configdirs} ; do
531 echo Configuring ${configdir}...
532 specifics=
533 commons=
534
535 if [ -n "${defaulttargets}" ] ; then
536 for host in ${hosts} ; do
537 if [ -d ${configdir}.${host} ] ; then
538 newspecifics="${specifics} ${host}"
539 specifics=${newspecifics}
540 else
541 newcommons="${commons} ${host}"
542 commons=${newcommons}
543 fi # if target specific
544 done # for each host
545
546 if [ -n "${commons}" ] ; then
547 if [ -d ${configdir} ] ; then
548 (cd ${configdir} ;
549 ./configure ${commons} ${verbose} ${forcesubdirs} ${removing} "+destdir=${destdir}") \
550 | sed 's/^/ /'
551 else
552 echo Warning: directory \"${configdir}\" is missing.
553 fi
554 fi # if any common hosts
555
556 if [ -n "${specifics}" ] ; then
557 for host in ${specifics} ; do
558 echo Configuring target specific directory ${configdir}.${host}...
559 (cd ${configdir}.${host} ;
560 ./configure ${host} ${verbose} ${forcesubdirs} ${removing} "+destdir=${destdir}") \
561 | sed 's/^/ /'
562 done # for host in specifics
563 fi # if there are any specifics
564 else
565
566 for target in ${targets} ; do
567 if [ -d ${configdir}.${target} ] ; then
568 newspecifics="${specifics} ${target}"
569 specifics=${newspecifics}
570 else
571 newcommons="${commons} +target=${target}"
572 commons=${newcommons}
573 fi
574
575 done # check for target specific dir override
576
577 if [ -n "${verbose}" ] ; then
578 echo " "commons=\"${commons}\"
579 echo " "specifics=\"${specifics}\"
580 fi # if verbose
581
582 if [ -n "${commons}" ] ; then
583 if [ -d ${configdir} ] ; then
584 (cd ${configdir} ;
585 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons} "+destdir=${destdir}") \
586 | sed 's/^/ /'
587 else
588 echo Warning: directory \"${configdir}\" is missing.
589 fi
590 fi # if any commons
591
592 if [ -n "${specifics}" ] ; then
593 for target in ${specifics} ; do
594 echo Configuring target specific directory ${configdir}.${target}...
595 (cd ${configdir}.${target} ;
596 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}" "+destdir=${destdir}") \
597 | sed 's/^/ /'
598 done
599 fi # if any specifics
600 fi # not default targets
601done
602
603exit 0
604
605#
606# $Log$
607# Revision 1.1 1991/07/23 19:09:21 sef
608# Initial revision
609#
610# Revision 1.20 1991/06/18 15:30:33 rich
611# Added prms.
612#
613# Revision 1.19 1991/06/13 04:21:14 rich
614# Re-arrange so that gcc, which creates directories, gets installed
615# first.
616#
617# Revision 1.18 1991/06/12 21:23:05 rich
618# correctly propogate destdir
619#
620# Revision 1.17 1991/06/09 20:39:58 rich
621# Added +clib option.
622#
623# Revision 1.16 1991/05/27 21:04:21 rich
624# Removed clib for now.
625#
626# Revision 1.15 1991/05/27 20:54:24 rich
627# fixed a bug in multiple targets
628#
629# Revision 1.14 1991/05/22 01:44:04 rich
630# remove gdb until config issues resolve.
631#
632# Revision 1.13 1991/05/19 08:00:09 rich
633# Added gdb.
634#
635# Revision 1.12 1991/05/19 00:32:13 rich
636# Changes to deal with missing subdirs gracefully, and changes dictated
637# from dropping configure over gdb.
638#
639# Revision 1.4 1991/05/19 00:16:45 rich
640# Configure for gdb.
641#
642# Revision 1.10 1991/05/04 00:58:38 rich
643# Fix program name bug.
644#
645# Revision 1.9 1991/05/03 19:14:18 rich
646# Changed getopt to libiberty, commented out an aborted attempt at host
647# level Makefiles because it caused errors on +rm, add a warning for
648# directories expected to be removed on +rm but that don't exist.
649#
650# Revision 1.8 1991/04/24 16:50:59 rich
651# Three staging checkpoint.
652#
653# Revision 1.7 1991/04/17 01:34:47 rich
654# Added getopt for binutils, fixed problem with host dependancies in
655# configure.template.
656#
657# Revision 1.6 1991/04/16 00:18:44 rich
658# Now handles multiple hosts and targets.
659#
660# Revision 1.5 1991/04/15 23:43:44 rich
661# Now handles multiple hosts and targets.
662#
663# Revision 1.4 1991/04/13 02:11:03 rich
664# Config cut 3. We now almost install a29k.
665#
666# Revision 1.3 1991/04/11 02:41:54 rich
667# Cut 2 config. Subdirs.
668#
669#
670#
671
672#
673# Local Variables:
674# fill-column: 131
675# End:
676#
677
678# end of configure.template
This page took 0.061853 seconds and 4 git commands to generate.