2 # Please do not edit this file. It is generated automatically from
3 # configure.in and a configure template.
11 # Configuration script template
12 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
14 #This file is part of GNU.
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)
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.
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.
33 # Shell script to create proper links to machine-dependent files in
34 # preparation for compilation.
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.
48 #symbolic_link="echo ln -s"
52 # clear some things potentially inherited from environment.
79 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
80 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
82 -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
83 | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
86 -languages=* | +languages=* | +language=* | +languag=* \
87 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
89 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
91 -gas | +gas | +ga | +g)
97 -nfp | +nfp | +nf | +n)
100 -norecurse | +norecurse)
106 # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
107 # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
109 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=* | +t=*)
110 if [ -n "${targets}" ] ; then
111 forcesubdirs="+forcesubdirs"
114 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
115 targets="${newtargets}"
117 -template=* | +template=*)
118 template=`echo ${arg} | sed 's/[+-]template=//'`
120 +verbose | +verbos | +verbo | +verb | +ver | +ve | +v)
125 echo "Unrecognized option: \"${arg}\"". ;
130 if [ -n "${hosts}" ] ; then
131 forcesubdirs="+forcesubdirs"
134 newhosts="${hosts} ${arg}"
140 if [ -n "${verbose}" ] ; then
141 echo `pwd`/configure $*
142 echo targets=\"${targets}\"
145 # process host and target only if not rebuilding configure itself or removing.
146 if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
147 # Complain if an arg is missing
148 if [ -z "${hosts}" ] ; then
150 echo "configure: No HOST specified." ;
156 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
157 (echo "Usage: configure HOST" ;
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]" ;
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
176 if [ -r config.status ] ; then
183 #### configure.in common parts come in here.
184 # This file is a shell script fragment that supplies the information
185 # necessary to tailor a template configure script into the configure
186 # script appropriate for this directory. For more information, check
187 # any existing configure script.
193 ## end of common part.
195 # are we rebuilding config itself?
196 if [ -n "${template}" ] ; then
197 if [ ! -r ${template} ] ; then
198 echo "Can't find template ${template}."
203 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
204 #### configure.in common parts come in here.\
205 ## end of common part.' \
206 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
207 #### configure.in per-host parts come in here.\
208 ## end of per-host part.' \
209 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
210 #### configure.in per-target parts come in here.\
211 ## end of per-target part.' \
212 < ${template} > template.new
214 if [ -r configure.in ] ; then
215 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
216 echo `pwd`/configure.in has no "per-host:" line.
220 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
221 echo `pwd`/configure.in has no "per-target:" line.
225 # split configure.in into common, per-host, and per-target parts
226 sed -e '/^# per\-host:/,$d' configure.in > configure.com
227 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
228 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
231 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
232 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
233 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
234 template.new > configure.new
236 rm -f configure.com configure.tgt configure.hst
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 while [ -n "${configdirs}" ] ; do
250 # set configdir to car of configdirs, configdirs to cdr of configdirs
251 set ${configdirs}; configdir=$1; shift; configdirs=$*
253 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
254 targetspecificdirs=${configdir}.*
259 for i in ${configdir} ${targetspecificdirs} ; do
261 if [ -r $i/configure ] ; then
263 ./configure +template=${template} ${verbose})
265 echo No configure script in `pwd`/$i
268 echo Warning: directory $i is missing.
277 # some sanity checks on configure.in
278 if [ -z "${srctrigger}" ] ; then
279 echo srctrigger not set in configure.in. `pwd` not configured.
283 for host in ${hosts} ; do
285 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
290 host_makefile_frag=config/hmake-${host}
292 #### configure.in per-host parts come in here.
294 ## end of per-host part.
297 for target in ${targets} ; do
299 if [ -n "${verbose}" ] ; then
300 echo host \= \"${host}\", target \= \"${target}\".
303 target_makefile_frag=config/tmake-${target}
305 #### configure.in per-target parts come in here.
307 ## end of per-target part.
309 # Temporarily, we support only direct subdir builds.
310 hostsubdir=Host-${host}
311 targetsubdir=Target-${target}
313 if [ -n "${removing}" ] ; then
314 if [ -n "${forcesubdirs}" ] ; then
315 if [ -d "${hostsubdir}" ] ; then
316 rm -rf ${hostsubdir}/${targetsubdir}
318 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
322 echo Warning: no `pwd`/${hostsubdir} to remove.
325 rm -f Makefile config.status ${links}
328 if [ -n "${forcesubdirs}" ] ; then
329 # check for existing status before allowing forced subdirs.
330 if [ -f Makefile ] ; then
331 echo "Makefile already exists in source directory. `pwd` not configured."
335 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
338 if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi
343 # if not subdir builds, then make sure none exist.
344 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
345 echo "Configured subdirs exist. `pwd` not configured."
350 # Find the source files, if location was not specified.
351 if [ -z "${srcdir}" ] ; then
354 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
359 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
360 if [ -z "${srcdirdefaulted}" ] ; then
361 echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
363 echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
366 echo \(At least ${srctrigger} is missing.\) 1>&2
370 # Set up the list of links to be made.
371 # ${links} is the list of link names, and ${files} is the list of names to link to.
374 while [ -n "${files}" ] ; do
375 # set file to car of files, files to cdr of files
376 set ${files}; file=$1; shift; files=$*
377 set ${links}; link=$1; shift; links=$*
379 if [ ! -r ${srcdir}/${file} ] ; then
380 echo "${progname}: cannot create a link \"${link}\"," 1>&2
381 echo "since the file \"${file}\" does not exist." 1>&2
387 # Make a symlink if possible, otherwise try a hard link
388 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
390 if [ ! -r ${link} ] ; then
391 echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
394 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
397 # Create a .gdbinit file which runs the one in srcdir
398 # and tells GDB to look there for source files.
404 echo "dir ." > .gdbinit
405 echo "dir ${srcdir}" >> .gdbinit
406 echo "source ${srcdir}/.gdbinit" >> .gdbinit
410 # Install a makefile, and make it set VPATH
411 # if necessary so that the sources are found.
412 # Also change its value of srcdir.
414 # FIXME-someday: This business of always writing to .tem and mv back
415 # is so that I don't screw things up while developing. Once this
416 # template is stable, these should be optimized. xoxorich.
418 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
419 if [ "${host}" != "${target}" ] ; then
420 echo "CROSS=-DCROSS_COMPILE" > Makefile
421 echo "ALL=start.encap" >> Makefile
423 echo "ALL=all.internal" > Makefile
426 # set target, host, VPATH
427 echo "host = ${host}" >> Makefile
428 echo "target = ${target}" >> Makefile
430 if [ -n "${forcesubdirs}" ] ; then
431 echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile
433 echo "subdir =" >> Makefile
436 # echo "workdir = `pwd`" >> Makefile
437 echo "VPATH = ${srcdir}" >> Makefile
440 cat ${srcdir}/Makefile.in >> Makefile
442 # and shake thoroughly.
443 # Conditionalize the makefile for this host.
444 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
445 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" Makefile > Makefile.tem
446 mv Makefile.tem Makefile
449 # Conditionalize the makefile for this target.
450 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
451 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" Makefile > Makefile.tem
452 mv Makefile.tem Makefile
456 sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem
457 mv Makefile.tem Makefile
460 if [ -n "${destdir}" ] ; then
461 sed "s:^destdir =.*$:destdir = ${destdir}:" Makefile > Makefile.tem
462 mv Makefile.tem Makefile
465 # Remove all formfeeds, since some Makes get confused by them.
466 sed "s/
\f//" Makefile >> Makefile.tem
467 mv Makefile.tem Makefile
470 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem
471 mv Makefile.tem Makefile
474 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem
475 mv Makefile.tem Makefile
478 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
479 using=" using \"${host_makefile_frag}\""
482 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
483 if [ -z "${using}" ] ; then
484 andusing=" using \"${target_makefile_frag}\""
486 andusing="${using} and \"${target_makefile_frag}\""
492 echo "Created \"Makefile\"" in `pwd`${andusing}.
494 if [ "${host}" = "${target}" ] ; then
495 echo "Links are now set up for use with a ${target}." \
497 # | tee ${srcdir}/config.status
499 echo "Links are now set up for host ${host} and target ${target}." \
501 # | tee ${srcdir}/config.status
507 done # for each target
509 # # Now build a Makefile for this host.
510 # if [ -n "${forcesubdirs}" ] ; then
512 # cat > GNUmakefile << E!O!F
513 ## Makefile generated by configure for host ${host}.
516 # for i in ${targets} ; do \
517 # $(MAKE) -C Target-\$i \$@
519 #all clean stage1 stage2 stage3 stage4etags tags TAGS
524 # If there are subdirectories, then recurse.
526 if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi
528 # configdirs is not null
529 for configdir in ${configdirs} ; do
530 echo Configuring ${configdir}...
534 if [ -n "${defaulttargets}" ] ; then
535 for host in ${hosts} ; do
536 if [ -d ${configdir}.${host} ] ; then
537 newspecifics="${specifics} ${host}"
538 specifics=${newspecifics}
540 newcommons="${commons} ${host}"
541 commons=${newcommons}
542 fi # if target specific
545 if [ -n "${commons}" ] ; then
546 if [ -d ${configdir} ] ; then
548 ./configure ${commons} ${verbose} ${forcesubdirs} ${removing} "+destdir=${destdir}") \
551 echo Warning: directory \"${configdir}\" is missing.
553 fi # if any common hosts
555 if [ -n "${specifics}" ] ; then
556 for host in ${specifics} ; do
557 echo Configuring target specific directory ${configdir}.${host}...
558 (cd ${configdir}.${host} ;
559 ./configure ${host} ${verbose} ${forcesubdirs} ${removing} "+destdir=${destdir}") \
561 done # for host in specifics
562 fi # if there are any specifics
565 for target in ${targets} ; do
566 if [ -d ${configdir}.${target} ] ; then
567 newspecifics="${specifics} ${target}"
568 specifics=${newspecifics}
570 newcommons="${commons} +target=${target}"
571 commons=${newcommons}
574 done # check for target specific dir override
576 if [ -n "${verbose}" ] ; then
577 echo " "commons=\"${commons}\"
578 echo " "specifics=\"${specifics}\"
581 if [ -n "${commons}" ] ; then
582 if [ -d ${configdir} ] ; then
584 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons} "+destdir=${destdir}") \
587 echo Warning: directory \"${configdir}\" is missing.
591 if [ -n "${specifics}" ] ; then
592 for target in ${specifics} ; do
593 echo Configuring target specific directory ${configdir}.${target}...
594 (cd ${configdir}.${target} ;
595 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}" "+destdir=${destdir}") \
598 fi # if any specifics
599 fi # not default targets
606 # Revision 1.14 1991/07/15 23:43:20 steve
607 # Fixed a few bugs, added 29k coff support.
609 # Revision 1.13 1991/06/12 21:24:30 rich
610 # correctly propogate destdir
612 # Revision 1.17 1991/06/09 20:39:58 rich
613 # Added +clib option.
615 # Revision 1.16 1991/05/27 21:04:21 rich
616 # Removed clib for now.
618 # Revision 1.15 1991/05/27 20:54:24 rich
619 # fixed a bug in multiple targets
621 # Revision 1.14 1991/05/22 01:44:04 rich
622 # remove gdb until config issues resolve.
624 # Revision 1.13 1991/05/19 08:00:09 rich
627 # Revision 1.12 1991/05/19 00:32:13 rich
628 # Changes to deal with missing subdirs gracefully, and changes dictated
629 # from dropping configure over gdb.
631 # Revision 1.4 1991/05/19 00:16:45 rich
634 # Revision 1.10 1991/05/04 00:58:38 rich
635 # Fix program name bug.
637 # Revision 1.9 1991/05/03 19:14:18 rich
638 # Changed getopt to libiberty, commented out an aborted attempt at host
639 # level Makefiles because it caused errors on +rm, add a warning for
640 # directories expected to be removed on +rm but that don't exist.
642 # Revision 1.8 1991/04/24 16:50:59 rich
643 # Three staging checkpoint.
645 # Revision 1.7 1991/04/17 01:34:47 rich
646 # Added getopt for binutils, fixed problem with host dependancies in
647 # configure.template.
649 # Revision 1.6 1991/04/16 00:18:44 rich
650 # Now handles multiple hosts and targets.
652 # Revision 1.5 1991/04/15 23:43:44 rich
653 # Now handles multiple hosts and targets.
655 # Revision 1.4 1991/04/13 02:11:03 rich
656 # Config cut 3. We now almost install a29k.
658 # Revision 1.3 1991/04/11 02:41:54 rich
659 # Cut 2 config. Subdirs.
670 # end of configure.template