2 # Please do not edit this file. It is generated automatically from
3 # configure.in and a configure template.
8 # Configuration script template
9 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
11 #This file is part of GNU.
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.
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.
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. */
30 # Shell script to create proper links to machine-dependent files in
31 # preparation for compilation.
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.
45 #symbolic_link="echo ln -s"
49 # clear some things potentially inherited from environment.
56 Makefile_in=Makefile.in
73 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
74 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
76 -languages=* | +languages=* | +language=* | +languag=* \
77 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
79 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
96 # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
97 # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
99 -subdirs | +f* | +su*)
102 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
103 if [ -n "${targets}" ] ; then
107 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
108 targets="${newtargets}"
110 -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
111 template=`echo ${arg} | sed 's/[+-]template=//'`
118 echo "Unrecognized option: \"${arg}\"". ;
123 if [ -n "${hosts}" ] ; then
127 newhosts="${hosts} ${arg}"
133 if [ -n "${verbose}" ] ; then
134 echo `pwd`/configure $*
135 echo targets=\"${targets}\"
138 # process host and target only if not rebuilding configure itself or removing.
139 if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
140 # Complain if an arg is missing
141 if [ -z "${hosts}" ] ; then
143 echo "configure: No HOST specified." ;
149 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
150 (echo "Usage: configure HOST" ;
152 echo "Options: [defaults in brackets]" ;
153 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
154 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
155 echo " +subdirs configure in subdirectories. [in source directories]" ;
156 echo " +lang=LANG configure to build LANG. [gcc]" ;
157 echo " +help print this message. [normal config]" ;
158 echo " +gas configure the compilers for use with gas. [native as]" ;
159 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
160 echo " +norecurse configure this directory only. [recurse]" ;
161 echo " +rm remove this configuration. [build a configuration]" ;
162 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
163 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
165 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
166 echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
167 echo "options given will apply to all targets.") 1>&2
169 if [ -r config.status ] ; then
176 #### configure.in common parts come in here.
177 # This file is a shell script that supplies the information necessary
178 # to tailor a template configure script into the configure script
179 # appropriate for this directory. For more information, check any
180 # existing configure script.
186 ## end of common part.
188 # are we rebuilding config itself?
189 if [ -n "${template}" ] ; then
190 if [ ! -r ${template} ] ; then
191 echo "Can't find template ${template}."
196 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
197 #### configure.in common parts come in here.\
198 ## end of common part.' \
199 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
200 #### configure.in per-host parts come in here.\
201 ## end of per-host part.' \
202 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
203 #### configure.in per-target parts come in here.\
204 ## end of per-target part.' \
205 -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
206 #### configure.in post-target parts come in here.\
207 ## end of post-target part.' \
208 < ${template} > template.new
210 if [ -r configure.in ] ; then
211 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
212 echo `pwd`/configure.in has no "per-host:" line.
216 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
217 echo `pwd`/configure.in has no "per-target:" line.
221 # split configure.in into common, per-host, per-target,
222 # and post-target parts. Post-target is optional.
223 sed -e '/^# per\-host:/,$d' configure.in > configure.com
224 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
225 if grep -s '^# post-target:' configure.in ; then
226 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
227 sed -e '1,/^# post\-target:/d' configure.in > configure.pos
229 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
234 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
235 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
236 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
237 -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
238 template.new > configure.new
240 rm -f configure.com configure.tgt configure.hst configure.pos
242 echo Warning: no configure.in in `pwd`
243 cat ${template} >> configure
246 chmod a+x configure.new
248 # mv configure configure.old
249 mv configure.new configure
250 echo Rebuilt configure in `pwd`
252 if [ -z "${norecurse}" ] ; then
253 # If template is relative path, make it absolute for recursing.
254 if echo "${template}" | grep -s '^/' ; then
257 template=`pwd`/${template}
260 while [ -n "${configdirs}" ] ; do
261 # set configdir to car of configdirs, configdirs to cdr of configdirs
262 set ${configdirs}; configdir=$1; shift; configdirs=$*
264 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
265 targetspecificdirs=${configdir}.*
270 for i in ${configdir} ${targetspecificdirs} ; do
272 if [ -r $i/configure ] ; then
274 ./configure +template=${template} ${verbose})
276 echo No configure script in `pwd`/$i
279 echo Warning: directory $i is missing.
288 # some sanity checks on configure.in
289 if [ -z "${srctrigger}" ] ; then
290 echo srctrigger not set in configure.in. `pwd` not configured.
294 for host in ${hosts} ; do
296 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
301 host_makefile_frag=config/hmake-${host}
303 #### configure.in per-host parts come in here.
305 if [ ! -f config/hmake-${host} ] ; then
306 echo No such host available: ${host}
310 ## end of per-host part.
313 for target in ${targets} ; do
315 if [ -n "${verbose}" ] ; then
316 echo " target=\"${target}\""
319 target_makefile_frag=config/tmake-${target}
321 #### configure.in per-target parts come in here.
323 if [ ! -f config/tmake-${target} ] ; then
324 echo No such target available: ${target}
330 ## end of per-target part.
332 # Temporarily, we support only direct subdir builds.
333 hostsubdir=Host-${host}
334 targetsubdir=Target-${target}
336 if [ -n "${removing}" ] ; then
337 if [ -n "${subdirs}" ] ; then
338 if [ -d "${hostsubdir}" ] ; then
339 rm -rf ${hostsubdir}/${targetsubdir}
341 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
345 echo Warning: no `pwd`/${hostsubdir} to remove.
348 rm -f ${Makefile} config.status ${links}
351 if [ -n "${subdirs}" ] ; then
352 # check for existing status before allowing forced subdirs.
353 if [ -f ${Makefile} ] ; then
354 echo "${Makefile} already exists in source directory. `pwd` not configured."
358 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
361 if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi
366 # if not subdir builds, then make sure none exist.
367 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
368 echo "Configured subdirs exist. `pwd` not configured."
373 # Find the source files, if location was not specified.
374 if [ -z "${srcdir}" ] ; then
377 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
382 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
383 if [ -z "${srcdirdefaulted}" ] ; then
384 echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
386 echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
389 echo \(At least ${srctrigger} is missing.\) 1>&2
393 # Set up the list of links to be made.
394 # ${links} is the list of link names, and ${files} is the list of names to link to.
397 while [ -n "${files}" ] ; do
398 # set file to car of files, files to cdr of files
399 set ${files}; file=$1; shift; files=$*
400 set ${links}; link=$1; shift; links=$*
402 if [ ! -r ${srcdir}/${file} ] ; then
403 echo "${progname}: cannot create a link \"${link}\"," 1>&2
404 echo "since the file \"${file}\" does not exist." 1>&2
410 # Make a symlink if possible, otherwise try a hard link
411 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
413 if [ ! -r ${link} ] ; then
414 echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
417 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
420 # Create a .gdbinit file which runs the one in srcdir
421 # and tells GDB to look there for source files.
427 echo "dir ." > .gdbinit
428 echo "dir ${srcdir}" >> .gdbinit
429 echo "source ${srcdir}/.gdbinit" >> .gdbinit
433 # Install a makefile, and make it set VPATH
434 # if necessary so that the sources are found.
435 # Also change its value of srcdir.
437 # FIXME-someday: This business of always writing to .tem and mv back
438 # is so that I don't screw things up while developing. Once this
439 # template is stable, these should be optimized. xoxorich.
441 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
442 if [ "${host}" != "${target}" ] ; then
443 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
444 echo "ALL=start.encap" >> ${Makefile}
446 echo "ALL=all.internal" > ${Makefile}
449 # set target, host, VPATH
450 echo "host = ${host}" >> ${Makefile}
451 echo "target = ${target}" >> ${Makefile}
453 if [ -n "${subdirs}" ] ; then
454 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
456 echo "subdir =" >> ${Makefile}
459 # echo "workdir = `pwd`" >> ${Makefile}
460 echo "VPATH = ${srcdir}" >> ${Makefile}
462 # add "Makefile.in" (or whatever it's called)
463 cat ${srcdir}/${Makefile_in} >> ${Makefile}
465 # Conditionalize the makefile for this host.
466 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
467 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile} > Makefile.tem
468 mv Makefile.tem ${Makefile}
471 # Conditionalize the makefile for this target.
472 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
473 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile} > Makefile.tem
474 mv Makefile.tem ${Makefile}
478 sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
479 mv Makefile.tem ${Makefile}
482 if [ -n "${destdir}" ] ; then
483 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
484 mv Makefile.tem ${Makefile}
488 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
489 mv Makefile.tem ${Makefile}
492 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
493 mv Makefile.tem ${Makefile}
496 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
497 using=" using \"${host_makefile_frag}\""
500 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
501 if [ -z "${using}" ] ; then
502 andusing=" using \"${target_makefile_frag}\""
504 andusing="${using} and \"${target_makefile_frag}\""
510 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
512 #### configure.in post-target parts come in here.
514 ## end of post-target part.
516 if [ "${host}" = "${target}" ] ; then
517 echo "Links are now set up for use with a ${target}." \
519 # | tee ${srcdir}/config.status
521 echo "Links are now set up for host ${host} and target ${target}." \
523 # | tee ${srcdir}/config.status
529 done # for each target
531 # Now build a Makefile for this host.
532 if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
534 cat > GNUmakefile << E!O!F
535 # Makefile generated by configure for host ${host}.
537 ALL := $(shell ls -d Target-*)
540 $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
548 # If there are subdirectories, then recurse.
550 if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi
552 # configdirs is not null
553 for configdir in ${configdirs} ; do
554 echo Configuring ${configdir}...
558 if [ -n "${defaulttargets}" ] ; then
559 for host in ${hosts} ; do
560 if [ -d ${configdir}.${host} ] ; then
561 newspecifics="${specifics} ${host}"
562 specifics=${newspecifics}
564 newcommons="${commons} ${host}"
565 commons=${newcommons}
566 fi # if target specific
569 if [ -n "${commons}" ] ; then
570 if [ -d ${configdir} ] ; then
572 ./configure ${commons} ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
575 echo Warning: directory \"${configdir}\" is missing.
577 fi # if any common hosts
579 if [ -n "${specifics}" ] ; then
580 for host in ${specifics} ; do
581 echo Configuring target specific directory ${configdir}.${host}...
582 (cd ${configdir}.${host} ;
583 ./configure ${host} ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
585 done # for host in specifics
586 fi # if there are any specifics
589 for target in ${targets} ; do
590 if [ -d ${configdir}.${target} ] ; then
591 newspecifics="${specifics} ${target}"
592 specifics=${newspecifics}
594 newcommons="${commons} +target=${target}"
595 commons=${newcommons}
598 done # check for target specific dir override
600 if [ -n "${verbose}" ] ; then
601 echo " "commons=\"${commons}\"
602 echo " "specifics=\"${specifics}\"
605 if [ -n "${commons}" ] ; then
606 if [ -d ${configdir} ] ; then
608 ./configure ${hosts} ${verbose} ${subdirs} ${removing} \
609 ${commons} +destdir=${destdir}) \
612 echo Warning: directory \"${configdir}\" is missing.
616 if [ -n "${specifics}" ] ; then
617 for target in ${specifics} ; do
618 echo Configuring target specific directory ${configdir}.${target}...
619 (cd ${configdir}.${target} ;
620 ./configure ${hosts} ${verbose} ${subdirs} ${removing} \
621 "+target=${target}" +destdir=${destdir}) \
624 fi # if any specifics
625 fi # not default targets
632 # Revision 1.19 1991/08/14 22:10:10 rich
633 # Added fatal checks for missing host and target makefile fragments.
635 # Revision 1.18 1991/08/08 01:11:33 rich
636 # allow +f to stand in for +subdirs
638 # Revision 1.26 1991/08/07 19:21:32 rich
639 # +forcesubdirs -> +subdirs
641 # Revision 1.25 1991/08/07 07:05:30 rich
644 # Revision 1.24 1991/08/06 19:26:01 rich
645 # revised option parsing.
647 # Revision 1.23 1991/08/06 19:12:32 rich
648 # Host-level GNUmakefiles.
650 # Revision 1.22 1991/07/20 01:22:30 rich
651 # propogate gdb changes and destdir fix
653 # Revision 1.21 1991/07/20 00:55:20 gnu
654 # Roll in new configure that handles GDB. Make sure that the "configure"
655 # that is checked-in reflects the latest "configure.in", which includes gdb.
657 # Revision 1.9 1991/07/06 04:35:51 gnu
658 # Fix bug in configure when iterating targets.
659 # Depend on alldeps.mak, not ${srcdir}/alldeps.mak, so it can be found
662 # Revision 1.8 1991/07/05 00:04:58 gnu
663 # Thu Jul 4 14:47:06 1991 John Gilmore (gnu at cygint.cygnus.com)
665 # * configure.in, Makefile.in: Avoid rebuilding "depend" as much.
666 # Avoid declaring Makefile dependencies, because GNU Make stupidly
667 # tries to update it if we do.
669 # * coffread.c: Revise for minor changes to bfd internal coff
672 # * configure: If -template= is given a relative path, make it
673 # absolute before recurring in subdirectories.
675 # Revision 1.7 1991/07/04 15:59:46 gnu
676 # Make gdb work with configure. Only thing that doesn't work is the -list
677 # option (as far as I know).
679 # Revision 1.6 1991/06/04 07:28:16 gnu
680 # Change GDB over to GNU General Public License version 2.
682 # Revision 1.5 1991/05/19 07:26:54 rich
683 # configure changes and -opcode.h movement.
685 # Revision 1.4 1991/05/19 00:16:45 rich
688 # Revision 1.10 1991/05/04 00:58:38 rich
689 # Fix program name bug.
691 # Revision 1.9 1991/05/03 19:14:18 rich
692 # Changed getopt to libiberty, commented out an aborted attempt at host
693 # level Makefiles because it caused errors on +rm, add a warning for
694 # directories expected to be removed on +rm but that don't exist.
696 # Revision 1.8 1991/04/24 16:50:59 rich
697 # Three staging checkpoint.
699 # Revision 1.7 1991/04/17 01:34:47 rich
700 # Added getopt for binutils, fixed problem with host dependancies in
701 # configure.template.
703 # Revision 1.6 1991/04/16 00:18:44 rich
704 # Now handles multiple hosts and targets.
706 # Revision 1.5 1991/04/15 23:43:44 rich
707 # Now handles multiple hosts and targets.
709 # Revision 1.4 1991/04/13 02:11:03 rich
710 # Config cut 3. We now almost install a29k.
712 # Revision 1.3 1991/04/11 02:41:54 rich
713 # Cut 2 config. Subdirs.
724 # end of configure.template