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 -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
77 | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
80 -languages=* | +languages=* | +language=* | +languag=* \
81 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
83 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
85 -gas | +gas | +ga | +g)
91 -nfp | +nfp | +nf | +n)
94 -norecurse | +norecurse)
100 # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
101 # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
103 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=* | +t=*)
104 if [ -n "${targets}" ] ; then
105 forcesubdirs="+forcesubdirs"
108 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
109 targets="${newtargets}"
111 -template=* | +template=*)
112 template=`echo ${arg} | sed 's/[+-]template=//'`
114 +verbose | +verbos | +verbo | +verb | +ver | +ve | +v)
119 echo "Unrecognized option: \"${arg}\"". ;
124 if [ -n "${hosts}" ] ; then
125 forcesubdirs="+forcesubdirs"
128 newhosts="${hosts} ${arg}"
134 if [ -n "${verbose}" ] ; then
135 echo `pwd`/configure $*
136 echo targets=\"${targets}\"
139 # process host and target only if not rebuilding configure itself or removing.
140 if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
141 # Complain if an arg is missing
142 if [ -z "${hosts}" ] ; then
144 echo "configure: No HOST specified." ;
150 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
151 (echo "Usage: configure HOST" ;
153 echo "Options: [defaults in brackets]" ;
154 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
155 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
156 echo " +forcesubdirs configure in subdirectories. [in source directories]" ;
157 echo " +lang=LANG configure to build LANG. [gcc]" ;
158 echo " +help print this message. [normal config]" ;
159 echo " +gas configure the compilers for use with gas. [native as]" ;
160 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
161 echo " +norecurse configure this directory only. [recurse]" ;
162 echo " +rm remove this configuration. [build a configuration]" ;
163 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
164 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
166 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
167 echo "Asking for more than one \"+target\" implies \"+forcesubdirs\". Any other" ;
168 echo "options given will apply to all targets.") 1>&2
170 if [ -r config.status ] ; then
177 #### configure.in common parts come in here.
180 Makefile=Makefile.conf
182 ## end of common part.
184 # are we rebuilding config itself?
185 if [ -n "${template}" ] ; then
186 if [ ! -r ${template} ] ; then
187 echo "Can't find template ${template}."
192 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
193 #### configure.in common parts come in here.\
194 ## end of common part.' \
195 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
196 #### configure.in per-host parts come in here.\
197 ## end of per-host part.' \
198 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
199 #### configure.in per-target parts come in here.\
200 ## end of per-target part.' \
201 -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
202 #### configure.in post-target parts come in here.\
203 ## end of post-target part.' \
204 < ${template} > template.new
206 if [ -r configure.in ] ; then
207 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
208 echo `pwd`/configure.in has no "per-host:" line.
212 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
213 echo `pwd`/configure.in has no "per-target:" line.
217 # split configure.in into common, per-host, per-target,
218 # and post-target parts. Post-target is optional.
219 sed -e '/^# per\-host:/,$d' configure.in > configure.com
220 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
221 if grep -s '^# post-target:' configure.in ; then
222 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
223 sed -e '1,/^# post\-target:/d' configure.in > configure.pos
225 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
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 -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
234 template.new > configure.new
236 rm -f configure.com configure.tgt configure.hst configure.pos
238 echo Warning: no configure.in in `pwd`
239 cat ${template} >> configure
242 chmod a+x configure.new
244 # mv configure configure.old
245 mv configure.new configure
246 echo Rebuilt configure in `pwd`
248 if [ -z "${norecurse}" ] ; then
249 # If template is relative path, make it absolute for recursing.
250 if echo "${template}" | grep -s '^/' ; then
253 template=`pwd`/${template}
256 while [ -n "${configdirs}" ] ; do
257 # set configdir to car of configdirs, configdirs to cdr of configdirs
258 set ${configdirs}; configdir=$1; shift; configdirs=$*
260 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
261 targetspecificdirs=${configdir}.*
266 for i in ${configdir} ${targetspecificdirs} ; do
268 if [ -r $i/configure ] ; then
270 ./configure +template=${template} ${verbose})
272 echo No configure script in `pwd`/$i
275 echo Warning: directory $i is missing.
284 # some sanity checks on configure.in
285 if [ -z "${srctrigger}" ] ; then
286 echo srctrigger not set in configure.in. `pwd` not configured.
290 for host in ${hosts} ; do
292 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
297 #### configure.in per-host parts come in here.
299 if [ ! -f xconfig/${host} ]; then
300 echo "No such host ${host}"
304 # We really shouldn't depend on there being a space after XM_FILE= ...
305 hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <xconfig/$host`
307 ## end of per-host part.
310 for target in ${targets} ; do
312 if [ -n "${verbose}" ] ; then
313 echo " target=\"${target}\""
316 #### configure.in per-target parts come in here.
318 if [ ! -f tconfig/${target} ]; then
319 echo "No such target ${target}"
323 if [ -z "${removing}" ] ; then
324 cat xconfig/${host} tconfig/${target} | awk '$1 == "#msg" {
328 # We really shouldn't depend on there being a space after TM_FILE= ...
329 targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <tconfig/$target`
331 host_makefile_frag=xconfig/${host}
332 target_makefile_frag=tconfig/${target}
334 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) is not set in the
335 # ?config/* file, we don't make the corresponding links.
338 if [ "${hostfile}" != "" ]; then
339 files="${files} ${hostfile}"
340 links="${links} xm.h"
342 if [ "${targetfile}" != "" ]; then
343 files="${files} ${targetfile}"
344 links="${links} tm.h"
347 ## end of per-target part.
349 # Temporarily, we support only direct subdir builds.
350 hostsubdir=Host-${host}
351 targetsubdir=Target-${target}
353 if [ -n "${removing}" ] ; then
354 if [ -n "${forcesubdirs}" ] ; then
355 if [ -d "${hostsubdir}" ] ; then
356 rm -rf ${hostsubdir}/${targetsubdir}
358 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
362 echo Warning: no `pwd`/${hostsubdir} to remove.
365 rm -f ${Makefile} config.status ${links}
368 if [ -n "${forcesubdirs}" ] ; then
369 # check for existing status before allowing forced subdirs.
370 if [ -f ${Makefile} ] ; then
371 echo "${Makefile} already exists in source directory. `pwd` not configured."
375 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
378 if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi
383 # if not subdir builds, then make sure none exist.
384 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
385 echo "Configured subdirs exist. `pwd` not configured."
390 # Find the source files, if location was not specified.
391 if [ -z "${srcdir}" ] ; then
394 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
399 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
400 if [ -z "${srcdirdefaulted}" ] ; then
401 echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
403 echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
406 echo \(At least ${srctrigger} is missing.\) 1>&2
410 # Set up the list of links to be made.
411 # ${links} is the list of link names, and ${files} is the list of names to link to.
414 while [ -n "${files}" ] ; do
415 # set file to car of files, files to cdr of files
416 set ${files}; file=$1; shift; files=$*
417 set ${links}; link=$1; shift; links=$*
419 if [ ! -r ${srcdir}/${file} ] ; then
420 echo "${progname}: cannot create a link \"${link}\"," 1>&2
421 echo "since the file \"${file}\" does not exist." 1>&2
427 # Make a symlink if possible, otherwise try a hard link
428 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
430 if [ ! -r ${link} ] ; then
431 echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
434 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
437 # Create a .gdbinit file which runs the one in srcdir
438 # and tells GDB to look there for source files.
444 echo "dir ." > .gdbinit
445 echo "dir ${srcdir}" >> .gdbinit
446 echo "source ${srcdir}/.gdbinit" >> .gdbinit
450 # Install a makefile, and make it set VPATH
451 # if necessary so that the sources are found.
452 # Also change its value of srcdir.
454 # FIXME-someday: This business of always writing to .tem and mv back
455 # is so that I don't screw things up while developing. Once this
456 # template is stable, these should be optimized. xoxorich.
458 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
459 if [ "${host}" != "${target}" ] ; then
460 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
461 echo "ALL=start.encap" >> ${Makefile}
463 echo "ALL=all.internal" > ${Makefile}
466 # set target, host, VPATH
467 echo "host = ${host}" >> ${Makefile}
468 echo "target = ${target}" >> ${Makefile}
470 if [ -n "${forcesubdirs}" ] ; then
471 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
473 echo "subdir =" >> ${Makefile}
476 # echo "workdir = `pwd`" >> ${Makefile}
477 echo "VPATH = ${srcdir}" >> ${Makefile}
479 # add "Makefile.in" (or whatever it's called)
480 cat ${srcdir}/${Makefile_in} >> ${Makefile}
482 # and shake thoroughly.
483 if [ -z "${host_makefile_frag}" ] ; then
484 host_makefile_frag=config/hmake-${host}
487 if [ -z "${target_makefile_frag}" ] ; then
488 target_makefile_frag=config/tmake-${target}
491 # Conditionalize the makefile for this host.
492 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
493 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile} > Makefile.tem
494 mv Makefile.tem ${Makefile}
497 # Conditionalize the makefile for this target.
498 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
499 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile} > Makefile.tem
500 mv Makefile.tem ${Makefile}
504 sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
505 mv Makefile.tem ${Makefile}
508 if [ -n "${destdir}" ] ; then
509 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
510 mv Makefile.tem ${Makefile}
513 # Remove all formfeeds, since some Makes get confused by them.
514 sed "s/
\f//" ${Makefile} >> Makefile.tem
515 mv Makefile.tem ${Makefile}
518 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
519 mv Makefile.tem ${Makefile}
522 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
523 mv Makefile.tem ${Makefile}
526 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
527 using=" using \"${host_makefile_frag}\""
530 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
531 if [ -z "${using}" ] ; then
532 andusing=" using \"${target_makefile_frag}\""
534 andusing="${using} and \"${target_makefile_frag}\""
540 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
542 #### configure.in post-target parts come in here.
548 grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \
549 echo "source ${srcdir}/.gdbinit" >> .gdbinit
553 if [ ! -f ${srcdir}/depend ]; then
554 make -f Makefile.conf make-depend
556 make -f Makefile.conf make-Makefile
557 ## end of post-target part.
559 if [ "${host}" = "${target}" ] ; then
560 echo "Links are now set up for use with a ${target}." \
562 # | tee ${srcdir}/config.status
564 echo "Links are now set up for host ${host} and target ${target}." \
566 # | tee ${srcdir}/config.status
572 done # for each target
574 # # Now build a Makefile for this host.
575 # if [ -n "${forcesubdirs}" ] ; then
577 # cat > GNUmakefile << E!O!F
578 ## Makefile generated by configure for host ${host}.
581 # for i in ${targets} ; do \
582 # $(MAKE) -C Target-\$i \$@
584 #all clean stage1 stage2 stage3 stage4etags tags TAGS
589 # If there are subdirectories, then recurse.
591 if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi
593 # configdirs is not null
594 for configdir in ${configdirs} ; do
595 echo Configuring ${configdir}...
599 if [ -n "${defaulttargets}" ] ; then
600 for host in ${hosts} ; do
601 if [ -d ${configdir}.${host} ] ; then
602 newspecifics="${specifics} ${host}"
603 specifics=${newspecifics}
605 newcommons="${commons} ${host}"
606 commons=${newcommons}
607 fi # if target specific
610 if [ -n "${commons}" ] ; then
611 if [ -d ${configdir} ] ; then
613 ./configure ${commons} ${verbose} ${forcesubdirs} ${removing}) \
616 echo Warning: directory \"${configdir}\" is missing.
618 fi # if any common hosts
620 if [ -n "${specifics}" ] ; then
621 for host in ${specifics} ; do
622 echo Configuring target specific directory ${configdir}.${host}...
623 (cd ${configdir}.${host} ;
624 ./configure ${host} ${verbose} ${forcesubdirs} ${removing}) \
626 done # for host in specifics
627 fi # if there are any specifics
630 for target in ${targets} ; do
631 if [ -d ${configdir}.${target} ] ; then
632 newspecifics="${specifics} ${target}"
633 specifics=${newspecifics}
635 newcommons="${commons} +target=${target}"
636 commons=${newcommons}
639 done # check for target specific dir override
641 if [ -n "${verbose}" ] ; then
642 echo " "commons=\"${commons}\"
643 echo " "specifics=\"${specifics}\"
646 if [ -n "${commons}" ] ; then
647 if [ -d ${configdir} ] ; then
649 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons}) \
652 echo Warning: directory \"${configdir}\" is missing.
656 if [ -n "${specifics}" ] ; then
657 for target in ${specifics} ; do
658 echo Configuring target specific directory ${configdir}.${target}...
659 (cd ${configdir}.${target} ;
660 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}") \
663 fi # if any specifics
664 fi # not default targets
671 # Revision 1.8 1991/07/05 00:04:58 gnu
672 # Thu Jul 4 14:47:06 1991 John Gilmore (gnu at cygint.cygnus.com)
674 # * configure.in, Makefile.in: Avoid rebuilding "depend" as much.
675 # Avoid declaring Makefile dependencies, because GNU Make stupidly
676 # tries to update it if we do.
678 # * coffread.c: Revise for minor changes to bfd internal coff
681 # * configure: If -template= is given a relative path, make it
682 # absolute before recurring in subdirectories.
684 # Revision 1.7 1991/07/04 15:59:46 gnu
685 # Make gdb work with configure. Only thing that doesn't work is the -list
686 # option (as far as I know).
688 # Revision 1.6 1991/06/04 07:28:16 gnu
689 # Change GDB over to GNU General Public License version 2.
691 # Revision 1.5 1991/05/19 07:26:54 rich
692 # configure changes and -opcode.h movement.
694 # Revision 1.4 1991/05/19 00:16:45 rich
697 # Revision 1.10 1991/05/04 00:58:38 rich
698 # Fix program name bug.
700 # Revision 1.9 1991/05/03 19:14:18 rich
701 # Changed getopt to libiberty, commented out an aborted attempt at host
702 # level Makefiles because it caused errors on +rm, add a warning for
703 # directories expected to be removed on +rm but that don't exist.
705 # Revision 1.8 1991/04/24 16:50:59 rich
706 # Three staging checkpoint.
708 # Revision 1.7 1991/04/17 01:34:47 rich
709 # Added getopt for binutils, fixed problem with host dependancies in
710 # configure.template.
712 # Revision 1.6 1991/04/16 00:18:44 rich
713 # Now handles multiple hosts and targets.
715 # Revision 1.5 1991/04/15 23:43:44 rich
716 # Now handles multiple hosts and targets.
718 # Revision 1.4 1991/04/13 02:11:03 rich
719 # Config cut 3. We now almost install a29k.
721 # Revision 1.3 1991/04/11 02:41:54 rich
722 # Cut 2 config. Subdirs.
733 # end of configure.template