092f3147a3dcada470528eba514533120c8c02d9
4 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
6 #This file is part of GNU.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
24 # Please email any bugs, comments, and/or additions to this file to:
25 # configure@cygnus.com
28 # Shell script to create proper links to machine-dependent files in
29 # preparation for compilation.
31 # If configure succeeds, it leaves its status in config.status.
32 # If configure fails after disturbing the status quo,
33 # config.status is removed.
36 export PATH ||
(echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh
$0 $argv; kill $$
)
47 #symbolic_link="echo ln -s"
49 # clear some things potentially inherited from environment.
52 Makefile_in
=Makefile.
in
83 -ddestdir=* |
+ddestdir
=* |
+ddestdi
=* |
+ddestd
=* |
+ddest
=* |
+ddes
=* |
+dde
=* |
+dd=*)
84 ddestdir
=`echo ${arg} | sed 's/[+-]dd[a-z]*=//'`
86 -destdir=* |
+destdir
=* |
+destdi
=* |
+destd
=* |
+dest
=* |
+des
=* |
+de
=*)
87 destdir
=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
97 -idestdir=* |
+idestdir
=* |
+idestdi
=* |
+idestd
=* |
+idest
=* |
+ides
=* |
+ide
=* |
+id
=*)
98 idestdir
=`echo ${arg} | sed 's/[+-]id[a-z]*=//'`
100 -languages=* |
+languages
=* |
+language
=* |
+languag
=* \
101 |
+langua
=* |
+langu
=* |
+lang
=* |
+lan
=* |
+la
=* \
103 languages
="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
111 -objdir=* |
+objdir
=* |
+objdi
=* |
+objd
=* |
+obj
=* |
+ob
=* |
+o
=*)
113 objdir
=`echo ${arg} | sed 's/[+-]o[a-z]*=//'`
115 -recurring |
+recurring |
+recurrin |
+recurri |
+recurr |
+recur |
+recu |
+rec |
+re
)
121 -site=* |
+site
=* |
+sit
=* |
+si
=*)
122 site
=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
124 # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=*)
125 # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
130 -target=* |
+target
=* |
+targe
=* |
+targ
=* |
+tar=* |
+ta
=*)
131 if [ -n "${targets}" ] ; then
135 newtargets
="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
136 targets
="${newtargets}"
138 -tmpdir=* |
+tmpdir
=* |
+tmpdi
=* |
+tmpd
=* |
+tmp
=* |
+tm
=*)
140 TMPDIR
=`echo ${arg} | sed 's/[+-]t[a-z]*=//'`
147 echo "Unrecognized option: \"${arg}\"".
;
152 if [ -n "${hosts}" ] ; then
156 newhosts
="${hosts} ${arg}"
162 if [ -n "${verbose}" ] ; then
166 ## this is a little touchy and won't always work, but...
168 ## if the argv[0] starts with a slash then it is an absolute name that can be
171 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
172 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
174 ## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
178 if (echo $0 |
grep '^/' > /dev
/null
) ; then
181 if (echo $0 |
grep '/' > /dev
/null
) ; then
185 PATH
=$PATH:`pwd` ; export PATH
189 configsub
=`echo ${progname} | sed 's/configure$/config.sub/'`
191 if ${configsub} none
>/dev
/null
2>&1 ; then
194 echo '***' cannot
find config.sub.
198 # process host and target only if not removing.
199 if [ -z "${removing}" -a -z "${fatal}" ] ; then
200 # Complain if an arg is missing
201 if [ -z "${hosts}" ] ; then
203 echo "configure: No HOST specified." ;
209 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
210 (echo "Usage: configure HOST" ;
212 echo "Options: [defaults in brackets]" ;
213 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
214 echo " +ddestdir=MYDIR configure for installation host dependent files" ;
215 echo " into MYDIR. [\"/usr/local\"]" ;
216 echo " +idestdir=MYDIR configure for installation host independent files" ;
217 echo " into MYDIR. [\"/usr/local\"]" ;
218 echo " +destdir=MYDIR configure for installation of both host dependent and" ;
219 echo " host independent files into MYDIR. [\"/usr/local\"]" ;
220 echo " +gas configure the compilers for use with gas. [native as]" ;
221 echo " +help print this message. [normal config]" ;
222 echo " +lang=LANG configure to build LANG. [gcc]" ;
223 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
224 echo " +norecursion configure this directory only. [recurse]" ;
225 echo " +objdir=ODIR configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ;
226 echo " +rm remove this configuration. [build a configuration]" ;
227 echo " +site configure with site specific makefile" ;
228 # This is correctly aligned in the output, even though it isn't here.
229 echo " +subdirs configure in subdirectories. [in source directories]" ;
230 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
231 echo " +tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
233 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
234 echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
235 echo "options given will apply to all targets.") 1>&2
237 if [ -r config.status
] ; then
244 ### break up configure.in.
245 if [ -r configure.
in ] ; then
246 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
247 echo '***' `pwd`/configure.
in has no
"per-host:" line.
1>&2
251 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
252 echo '***' `pwd`/configure.
in has no
"per-target:" line.
1>&2
256 if [ -z "${TMPDIR}" ] ; then
257 TMPDIR
=/tmp
; export TMPDIR
260 # keep this filename short for &%*%$*# 14 char file names
261 tmpfile
=${TMPDIR}/cONf$$
263 # split configure.in into common, per-host, per-target,
264 # and post-target parts. Post-target is optional.
265 sed -e '/^# per\-host:/,$d' configure.
in > ${tmpfile}.com
266 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.
in > ${tmpfile}.hst
267 if grep '^# post-target:' configure.
in >/dev
/null
; then
268 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.
in > ${tmpfile}.tgt
269 sed -e '1,/^# post\-target:/d' configure.
in > ${tmpfile}.pos
271 sed -e '1,/^# per\-target:/d' configure.
in > ${tmpfile}.tgt
276 echo '***' No configure.
in in `pwd`
280 ### do common part of configure.in
284 # some sanity checks on configure.in
285 if [ -z "${srctrigger}" ] ; then
286 echo '***' srctrigger not
set in `pwd`/configure.
in.
290 for host in ${hosts} ; do
292 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
299 result
=`${configsub} ${host}`
300 host_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
301 host_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
302 host_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
303 host=${host_cpu}-${host_vendor}-${host_os}
304 host_makefile_frag
=config
/mh-
${host}
305 if [ ! -f ${host_makefile_frag} ]
307 host_makefile_frag
=config
/mh-
${host_alias}
312 for target
in ${targets} ; do
314 target_alias
=${target}
315 result
=`${configsub} ${target}`
316 target_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
317 target_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
318 target_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
319 target
=${target_cpu}-${target_vendor}-${target_os}
320 target_makefile_frag
=config
/mt-
${target}
321 if [ ! -f ${target_makefile_frag} ]
323 target_makefile_frag
=config
/mt-
${target_alias}
328 # Temporarily, we support only direct subdir builds.
329 hostsubdir
=H-
${host_alias}
330 targetsubdir
=T-
${target_alias}
332 if [ -n "${removing}" ] ; then
333 if [ -n "${objdir}" ] ; then
334 echo '***' +rm not supported
for +objdir. Just
\"rm -rf ${objdir}\" by hand.
338 if [ -n "${subdirs}" ] ; then
339 if [ -d "${hostsubdir}" ] ; then
340 rm -rf ${hostsubdir}/${targetsubdir}
342 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep T- | grep -v T-independent`" ] ; then
346 echo Warning
: no
`pwd`/${hostsubdir} to remove.
349 rm -f ${Makefile} config.status
${links}
352 if [ -n "${objdir}" ]; then
357 if [ -n "${subdirs}" ] ; then
358 # check for existing status before allowing forced subdirs.
359 if [ -f ${Makefile} ] ; then
360 echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2
364 if [ ! -d ${hostsubdir} ] ; then mkdir
${hostsubdir} ; fi
367 if [ ! -d ${targetsubdir} ] ; then
368 if [ -z "${commontargets}" ] ; then
369 mkdir
${targetsubdir}
371 if [ ! -d T-independent
] ; then
375 ${symbolic_link} T-independent
${targetsubdir}
376 fi # if target independent
377 fi # if no target dir yet
381 if [ -z "${srcdir}" ] ; then
385 # if not subdir builds, then make sure none exist.
386 if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then
387 echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
394 # Find the source files, if location was not specified.
395 if [ -z "${srcdir}" ] ; then
398 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
403 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
404 if [ -z "${srcdirdefaulted}" ] ; then
405 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
407 echo '***' "${progname}: Can
't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
410 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
414 # Set up the list of links to be made.
415 # ${links} is the list of link names, and ${files} is the list of names to link to.
418 while [ -n "${files}" ] ; do
419 # set file to car of files, files to cdr of files
420 set ${files}; file=$1; shift; files=$*
421 set ${links}; link=$1; shift; links=$*
423 if [ ! -r ${srcdir}/${file} ] ; then
424 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
425 echo '***' "since the file \"${file}\" does not exist." 1>&2
431 # Make a symlink if possible, otherwise try a hard link
432 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
434 if [ ! -r ${link} ] ; then
435 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
439 if [ -n "${verbose}" ] ; then
440 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
444 # Create a .gdbinit file which runs the one in srcdir
445 # and tells GDB to look there for source files.
451 echo "dir ." > .gdbinit
452 echo "dir ${srcdir}" >> .gdbinit
453 echo "source ${srcdir}/.gdbinit" >> .gdbinit
457 # Install a makefile, and make it set VPATH
458 # if necessary so that the sources are found.
459 # Also change its value of srcdir.
461 # FIXME-someday: This business of always writing to .tem and mv back
462 # is so that I don't screw things up
while developing. Once this
463 # template is stable, these should be optimized. xoxorich.
465 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
466 if [ "${host}" != "${target}" ] ; then
467 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
468 echo "ALL=start.encap" >> ${Makefile}
470 echo "ALL=all.internal" > ${Makefile}
473 # set target, host, VPATH
474 echo "host_alias = ${host_alias}" >> ${Makefile}
475 echo "host_cpu = ${host_cpu}" >> ${Makefile}
476 echo "host_vendor = ${host_vendor}" >> ${Makefile}
477 echo "host_os = ${host_os}" >> ${Makefile}
479 echo "target_alias = ${target_alias}" >> ${Makefile}
480 echo "target_cpu = ${target_cpu}" >> ${Makefile}
481 echo "target_vendor = ${target_vendor}" >> ${Makefile}
482 echo "target_os = ${target_os}" >> ${Makefile}
484 if [ -n "${subdirs}" ] ; then
485 (echo "subdir = /${hostsubdir}/${targetsubdir}" ;
486 echo "unsubdir = ../..") >> ${Makefile}
489 echo "unsubdir = .") >> ${Makefile}
492 # echo "workdir = `pwd`" >> ${Makefile}
493 echo "VPATH = ${srcdir}" >> ${Makefile}
495 # add "Makefile.in" (or whatever it's called)
496 cat ${srcdir}/${Makefile_in} >> ${Makefile}
498 # Conditionalize the makefile for this site.
499 if [ -n "${site}" ] ; then
500 site_makefile_frag
=config
/ms-
${site}
502 if [ -f ${srcdir}/${site_makefile_frag} ] ; then
503 (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ;
504 sed -e "/^####/ r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem
506 (echo "site_makefile_frag
=" ;
507 cat ${Makefile}) > Makefile.tem
509 mv Makefile.tem ${Makefile}
512 # Conditionalize the makefile for this host.
513 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
514 (echo "host_makefile_frag
= ${srcdir}/${host_makefile_frag}" ;
515 sed -e "/^
####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
517 (echo "host_makefile_frag =" ;
518 cat ${Makefile}) > Makefile.tem
520 mv Makefile.tem
${Makefile}
522 # Conditionalize the makefile for this target.
523 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
524 (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
525 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
527 (echo "target_makefile_frag
=" ;
528 cat ${Makefile}) > Makefile.tem
530 mv Makefile.tem ${Makefile}
533 sed "s@^srcdir
= \.@srcdir
= ${srcdir}@
" ${Makefile} > Makefile.tem
534 mv Makefile.tem ${Makefile}
537 if [ -n "${ddestdir}" ] ; then
538 sed "s
:^ddestdir
=.
*$
:ddestdir
= ${ddestdir}:" ${Makefile} > Makefile.tem
539 mv Makefile.tem ${Makefile}
543 if [ -n "${idestdir}" ] ; then
544 sed "s
:^idestdir
=.
*$
:idestdir
= ${idestdir}:" ${Makefile} > Makefile.tem
545 mv Makefile.tem ${Makefile}
549 sed "s
:^SUBDIRS
=.
*$
:SUBDIRS
= ${configdirs}:" ${Makefile} > Makefile.tem
550 mv Makefile.tem ${Makefile}
553 sed "s
:^NONSUBDIRS
=.
*$
:NONSUBDIRS
= ${noconfigdirs}:" ${Makefile} > Makefile.tem
554 mv Makefile.tem ${Makefile}
556 # remove any form feeds.
557 sed -e "s
/\f//" ${Makefile} > Makefile.tem
558 mv Makefile.tem ${Makefile}
561 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
562 using="${using} and
\"${host_makefile_frag}\""
564 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
565 using="${using} and
\"${target_makefile_frag}\""
567 if [ -n "${site}" -a \
568 -f ${srcdir}/${site_makefile_frag} ] ; then
569 using="${using} and
\"${site_makefile_frag}\""
571 using=`echo "${using}" | sed 's/and/using/'`
572 using="Created
\"${Makefile}\" in `pwd`${using}.
"
574 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
580 # describe the chosen configuration in config.status.
581 # Make that file a shellscript which will reestablish
582 # the same configuration. Used in Makefiles to rebuild
586 # `pwd` was configured as follows:
587 (cd ${srcdir} ; ${progname}" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` ")
588 # ${using}" > config.status
589 chmod a
+x config.status
595 # If there are subdirectories, then recurse.
596 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
597 for configdir
in ${configdirs} ; do
598 if [ -n "${verbose}" ] ; then
599 echo Configuring
${configdir}...
602 if [ -d ${configdir} ] ; then
603 if [ -n "${objdir}" ] ; then
604 if [ ! -d ${objdir}/${configdir} ] ; then
605 mkdir
${objdir}/${configdir}
612 if (${progname} +recurring ${host_alias} +target=${target_alias} \
613 ${verbose} ${subdirs} ${removing} +destdir=${destdir} \
614 `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
615 ${tmpdiroption}) ; then
624 # if (${progname} +recurring ${host_alias} +target=${target_alias} \
625 # ${verbose} ${subdirs} ${removing} +destdir=${destdir} \
626 # `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
627 # ${tmpdiroption}) ; then true ; else exit 1 ; fi) \
630 if [ -n "${verbose}" ] ; then
631 echo Warning
: directory
\"${configdir}\" is missing.
636 done # for each target
638 # Now build a Makefile for this host.
639 if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
642 if [ -n "${objdir}" ] ; then
647 cat > GNUmakefile
<< 'E!O!F'
648 # Makefile generated by configure for host ${host_alias}.
650 ALL
:= $
(shell
ls -d T-
*)
653 $
(foreach subdir
,$
(ALL
),$
(MAKE
) -C $
(subdir
) \$@
&&) true
663 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
670 # Revision 1.65 1991/11/01 00:25:28 rich
673 # Revision 1.64 1991/10/30 06:55:25 rich
674 # suck in site makefile frags first
676 # Revision 1.63 1991/10/25 02:07:18 steve
679 # Revision 1.62 1991/10/24 11:59:03 rich
680 # add null definitions for makefile_frag_foo
682 # Revision 1.61 1991/10/24 00:23:59 hgs
683 # Allow for using tmake-sun4
685 # Revision 1.60 1991/10/23 21:48:28 rich
686 # Makefiles should include the makefile frag names even if the makefile
687 # frag doesn't exist in *this* directory. Otherwise we inherit the
688 # variable setting from our parent Makefile.
690 # Revision 1.59 1991/10/16 19:53:31 gnu
691 # Update for SCO problems.
693 # * Fix "Larry Wall kludge" line so it works. If this script is run by csh,
694 # it will complain, feed itself to sh, and complain some more. But will work.
696 # * Use <14 char file names in /tmp.
698 # Revision 1.58 1991/10/16 06:12:52 rich
699 # Two small bugs. First, single quoted sed line doesn't need to quote
700 # '$'. Second, use quotes around the hereis document trigger in order
701 # to quote the entire contents of the hereis document.
703 # Revision 1.57 1991/10/11 05:31:05 gnu
704 # Simplify "Using" message code. Put the message that configure prints
705 # (or suppresses) into the config.status file as a comment.
707 # Revision 1.56 1991/10/10 05:01:47 rich
708 # Remove the set -e but protect the recusion call.
710 # Revision 1.55 1991/10/10 04:57:23 rich
711 # * Die when sub-configure's do.
712 # * get the makefile building message line correct.
715 # Revision 1.54 1991/10/10 01:04:42 rich
716 # Backed out the "/bin/sh config.sub" change. Fails when config.sub was
719 # Revision 1.53 1991/10/10 00:38:08 rich
720 # Call config.sub as "/bin/sh config.sub" instead of directly. This
721 # protects us from the case where config.sub isn't executable.
723 # Revision 1.52 1991/10/09 00:48:26 rich
724 # Another patch from jim.
726 # Revision 1.51 1991/10/08 06:07:58 wilson
727 # Fix bug in smake- file code.
729 # Revision 1.50 1991/10/04 23:49:37 rich
730 # Per's patch for my config.sub botch.
732 # Revision 1.49 1991/10/04 22:52:09 rich
733 # Use john's heuristic for finding ourselves. kinda like hare krishna.
735 # Revision 1.48 1991/10/02 13:17:28 rich
736 # take out the set -e for now
738 # Revision 1.47 1991/10/02 10:02:23 rich
739 # * temporary files in TMPDIR
742 # Revision 1.46 1991/10/02 06:29:53 rich
743 # Added +site=foo option for naming site specific Makefile fragments.
745 # Revision 1.45 1991/10/02 06:15:13 rich
746 # Removed +f option. Used to stand for +forcesubdirs which is now
749 # Revision 1.44 1991/10/02 06:02:35 rich
750 # Added rcs log line.
This page took 0.045517 seconds and 4 git commands to generate.