3 ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
6 # Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # This file was originally written by K. Richard Pixley.
25 # Shell script to create proper links to machine-dependent files in
26 # preparation for compilation.
28 # If configure succeeds, it leaves its status in config.status.
29 # If configure fails after disturbing the status quo,
30 # config.status is removed.
33 export PATH ||
(echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh
$0 $argv; kill $$
)
42 #symbolic_link="echo ln -s"
44 # clear some things potentially inherited from environment.
47 Makefile_in
=Makefile.
in
56 floating_point
=default
63 package_makefile_frag
=
70 program_transform_name
=
71 program_transform_nameoption
=
86 ### we might need to use some other shell than /bin/sh for running subshells
88 config_shell
=${CONFIG_SHELL-/bin/sh}
90 NO_EDIT
="This file was generated automatically by configure. Do not edit."
92 ## this is a little touchy and won't always work, but...
94 ## if the argv[0] starts with a slash then it is an absolute name that can (and
95 ## must) be used as is.
97 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
98 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
102 # if PWD already has a value, it is probably wrong.
103 if [ -n "$PWD" ]; then PWD
=`pwd`; fi
105 case "${progname}" in
109 PATH
=$PATH:${PWD=`pwd`} ; export PATH
118 # Break out if there are no more args
125 # Get the first arg, and shuffle
129 # Make all options have two hyphens
130 orig_option
=$option # Save original for error messages
133 -*) option
=-$option ;;
136 # Split out the argument for options that take them
139 optarg
=`echo $option | sed -e 's/^[^=]*=//'`
140 arguments
="$arguments $option"
142 # These options have mandatory values. Since we didn't find an = sign,
143 # the value must be in the next argument
144 --b* |
--cache* |
--ex* |
--ho* |
--pre* |
--program-p* |
--program-s* |
--program-t* |
--si* |
--sr* |
--ta* |
--tm* |
--x-*)
147 arguments
="$arguments $option=$optarg"
150 arguments
="$arguments -v"
153 arguments
="$arguments $option"
157 # Now, process the options
161 case "$build_alias" in
162 "") build_alias
=$optarg ;;
163 *) echo '***' Can only configure
for one build machine
at a
time.
1>&2
172 enableopt
=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
174 disableoptions
="$disableoptions $option"
182 enableopt
=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
183 eval $enableopt="$optarg"
184 enableoptions
="$enableoptions $option"
186 --exec-prefix* |
--ex*)
188 exec_prefixoption
="--exec-prefix=$optarg"
198 NOHOST
) host_alias
=$optarg ;;
199 *) echo '***' Can only configure
for one
host at a
time.
1>&2
207 --norecursion |
--no*)
212 prefixoption
="--prefix=$optarg"
214 --program-prefix* |
--program-p*)
215 program_prefix
=$optarg
216 program_prefixoption
="--program-prefix=$optarg"
218 --program-suffix* |
--program-s*)
219 program_suffix
=$optarg
220 program_suffixoption
="--program-suffix=$optarg"
222 --program-transform-name* |
--program-t*)
223 # Double any backslashes or dollar signs in the argument
224 program_transform_name
="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
225 program_transform_nameoption
="${program_transform_nameoption} --program-transform-name='$optarg'"
230 --silent |
--sil* |
--quiet |
--q*)
231 redirect
=">/dev/null"
236 site_option
="--site=$optarg"
239 # Remove trailing slashes. Otherwise, when the file name gets
240 # bolted into an object file as debug info, it has two slashes
241 # in it. Ordinarily this is ok, but emacs takes double slash
242 # to mean "forget the first part".
243 srcdir
=`echo $optarg | sed -e 's:/$::'`
249 case $target_alias in
250 NOTARGET
) target_alias
=$optarg ;;
251 *) echo '***' Can only configure
for one target
at a
time.
1>&2
258 tmpdiroption
="--tmpdir=$optarg"
260 --verbose |
--v |
--verb*)
264 --version |
--V |
--vers*)
265 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
274 withopt
=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
275 eval $withopt="$optarg"
276 withoptions
="$withoptions $option"
279 withopt
=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
281 withoutoptions
="$withoutoptions $option"
284 withoptions
="$withoptions --with-x"
286 --x-i* |
--x-l*) other_options
="$other_options $orig_option"
289 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
294 NOUNDEFS
) undefs
=$option ;;
295 *) echo '***' Can only configure
for one
host and one target
at a
time.
1>&2
303 # process host and target
305 # Do some error checking and defaulting for the host and target type.
307 # configure --host=HOST --target=TARGET UNDEFS
310 # 1. You aren't allowed to specify --host, --target, and undefs at the
312 # 2. Host defaults to undefs.
313 # 3. If undefs is not specified, then host defaults to the current host,
314 # as determined by config.guess.
315 # 4. Target defaults to undefs.
316 # 5. If undefs is not specified, then target defaults to host.
320 # Make sure that host, target & undefs aren't all specified at the
322 case $host_alias---$target_alias---$undefs in
323 NOHOST---
*---* |
*---NOTARGET---* |
*---*---NOUNDEFS)
325 *) echo '***' Can only configure
for one
host and one target
at a
time.
1>&2
331 # Now, do defaulting for host.
336 # Neither --host option nor undefs were present.
338 guesssys
=`echo ${progname} | sed 's/configure$/config.guess/'`
339 if host_alias
=`${guesssys}`
341 # If the string we are going to use for
342 # the target is a prefix of the string
343 # we just guessed for the host, then
344 # assume we are running native, and force
345 # the same string for both target and host.
346 case $target_alias in
349 if expr $host_alias : $target_alias >/dev
/null
351 host_alias
=$target_alias
355 echo "Configuring for a ${host_alias} host." 1>&2
356 arguments
="--host=$host_alias $arguments"
358 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
364 arguments
="--host=$host_alias $arguments"
370 # Do defaulting for target. If --target option isn't present, default
371 # to undefs. If undefs isn't present, default to host.
372 case $target_alias in
376 target_alias
=$host_alias
380 arguments
="--target=$target_alias $arguments"
388 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
390 echo Usage
: configure
[OPTIONS
] [HOST
]
392 echo Options
: [defaults
in brackets
]
393 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
394 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
395 echo ' --help print this message [normal config]'
396 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
397 echo ' --host=HOST configure for HOST [determined via config.guess]'
398 echo ' --norecursion configure this directory only [recurse]'
399 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
400 echo ' --program-suffix=FOO append FOO to installed program names [""]'
401 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
402 echo ' --site=SITE configure with site-specific makefile for SITE'
403 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
404 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
405 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
406 echo ' --nfp configure for software floating point [hard float]'
407 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
408 echo ' --without-FOO package FOO is NOT available'
409 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
410 echo ' --disable-FOO do not include feature FOO'
412 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
414 if [ -r config.status
] ; then
421 configsub
=`echo ${progname} | sed 's/configure$/config.sub/'`
422 moveifchange
=`echo ${progname} | sed 's/configure$/move-if-change/'`
424 # this is a hack. sun4 must always be a valid host alias or this will fail.
425 if ${configsub} sun4
>/dev
/null
2>&1 ; then
428 echo '***' cannot
find config.sub.
1>&2
433 if ${moveifchange} config.junk config.trash
; then
436 echo '***' cannot
find move-if-change.
1>&2
439 rm -f config.junk config.trash
443 if [ -r configure.
in ] ; then
446 if [ -r ${progname}.
in ] ; then
447 srcdir
=`echo ${progname} | sed 's:/configure$::'`
449 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
455 # Set srcdir to "." if that's what it is.
456 # This is important for multilib support.
457 if [ ! -d ${srcdir} ] ; then
458 echo "Invalid source directory ${srcdir}" >&2
462 srcpwd
=`cd ${srcdir} ; pwd`
463 if [ "${pwd}" = "${srcpwd}" ] ; then
468 ### warn about some conflicting configurations.
473 if [ -f ${srcdir}/config.status
] ; then
474 echo '***' Cannot configure here
in \"${PWD=`pwd`}\" when
\"${srcdir}\" is currently configured.
1>&2
479 # default exec_prefix
480 case "${exec_prefixoption}" in
481 "") exec_prefix
="\$(prefix)" ;;
485 ### break up ${srcdir}/configure.in.
486 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
488 echo '***' ${srcdir}/configure.
in has no
\"per-host
:\" line.
1>&2
489 # Check for a directory that's been converted to use autoconf since
490 # it was last configured.
491 if grep AC_OUTPUT
${srcdir}/configure.
in >/dev
/null
; then
492 echo '***' Hmm
, looks like this directory has been autoconfiscated.
1>&2
493 if [ -r ${srcdir}/configure
] ; then
494 echo '***' Running the
local configure
script.
1>&2
495 case "${cache_file}" in
496 "") cache_file_option
= ;;
497 *) cache_file_option
="--cache-file=${cache_file}" ;;
499 srcdiroption
="--srcdir=${srcdir}"
500 case "${build_alias}" in
502 *) buildopt
="--build=${build_alias}" ;;
504 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
505 ${buildopt} --host=${host_alias} --target=${target_alias} \
506 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
508 ${program_prefixoption} ${program_suffixoption} \
509 ${program_transform_nameoption} ${site_option} \
510 ${withoptions} ${withoutoptions} \
511 ${enableoptions} ${disableoptions} \
512 ${cache_file_option} ${removing} ${other_options} ${redirect}
514 echo '***' There is no configure
script present though.
1>&2
522 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
524 echo '***' ${srcdir}/configure.
in has no
\"per-target
:\" line.
1>&2
531 "") TMPDIR
=/tmp
; export TMPDIR
;;
535 # keep this filename short for &%*%$*# 14 char file names
536 tmpfile
=${TMPDIR}/cONf$$
537 # Note that under many versions of sh a trap handler for 0 will *override* any
538 # exit status you explicitly specify! At this point, the only non-error exit
539 # is at the end of the script; these actions are duplicated there, minus
540 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
541 # trap handler, or you'll lose.
542 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
544 # split ${srcdir}/configure.in into common, per-host, per-target,
545 # and post-target parts. Post-target is optional.
546 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.
in > ${tmpfile}.com
547 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.
in > ${tmpfile}.hst
548 if grep '^# post-target:' ${srcdir}/configure.
in >/dev
/null
; then
549 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.
in > ${tmpfile}.tgt
550 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.
in > ${tmpfile}.pos
552 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.
in > ${tmpfile}.tgt
556 ### do common part of configure.in
560 # some sanity checks on configure.in
561 case "${srctrigger}" in
563 echo '***' srctrigger not
set in ${PWD=`pwd`}/configure.
in.
1>&2
569 case "${build_alias}" in
571 if result
=`${config_shell} ${configsub} ${host_alias}` ; then
572 build_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
573 build_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
574 build_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
575 build
=${build_cpu}-${build_vendor}-${build_os}
576 build_alias
=${host_alias}
580 if result
=`${config_shell} ${configsub} ${build_alias}` ; then
581 buildopt
="--build=${build_alias}"
582 build_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
583 build_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
584 build_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
585 build
=${build_cpu}-${build_vendor}-${build_os}
587 echo "Unrecognized build system name ${build_alias}." 1>&2
593 if result
=`${config_shell} ${configsub} ${host_alias}` ; then
596 echo "Unrecognized host system name ${host_alias}." 1>&2
599 host_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
600 host_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
601 host_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
602 host=${host_cpu}-${host_vendor}-${host_os}
606 if result
=`${config_shell} ${configsub} ${target_alias}` ; then
609 echo "Unrecognized target system name ${target_alias}." 1>&2
612 target_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
613 target_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
614 target_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
615 target
=${target_cpu}-${target_vendor}-${target_os}
619 # Find the source files, if location was not specified.
624 if [ ! -r ${srctrigger} ] ; then
631 if [ ! -r ${srcdir}/${srctrigger} ] ; then
632 case "${srcdirdefaulted}" in
633 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
634 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
637 echo '***' \
(At least
${srctrigger} is missing.\
) 1>&2
641 # Some systems (e.g., one of the i386-aix systems the gas testers are
642 # using) don't handle "\$" correctly, so don't use it here.
643 tooldir
='$(exec_prefix)'/${target_alias}
645 if [ "${host_alias}" != "${target_alias}" ] ; then
646 if [ "${program_prefixoption}" = "" ] ; then
647 if [ "${program_suffixoption}" = "" ] ; then
648 if [ "${program_transform_nameoption}" = "" ] ; then
649 program_prefix
=${target_alias}- ;
655 # Merge program_prefix and program_suffix onto program_transform_name.
656 # (program_suffix used to use $, but it's hard to preserve $ through both
658 if [ "${program_suffix}" != "" ] ; then
659 program_transform_name
="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
662 if [ "${program_prefix}" != "" ] ; then
663 program_transform_name
="-e s,^,${program_prefix}, ${program_transform_name}"
666 # If CC and CXX are not set in the environment, and the Makefile
667 # exists, try to extract them from it. This is to handle running
668 # ./config.status by hand.
669 if [ -z "${CC}" -a -r Makefile
]; then
674 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile
> Makefile.cc
675 CC
=`tail -1 Makefile.cc`
679 if [ -z "${CXX}" -a -r Makefile
]; then
684 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile
> Makefile.cc
685 CXX
=`tail -1 Makefile.cc`
689 if [ "${build}" != "${host}" ]; then
690 # If we are doing a Canadian Cross, in which the host and build systems
691 # are not the same, we set reasonable default values for the tools.
693 tools
="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
694 tools
="${tools} CC_FOR_TARGET CXX_FOR_TARGET HOST_PREFIX"
695 tools
="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
696 tools
="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
698 for var
in ${tools}; do
699 if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile
]; then
704 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
705 < Makefile
> Makefile.v
706 t
=`tail -1 Makefile.v`
707 if [ -n "${t}" ]; then
714 AR
=${AR-${host_alias}-ar}
715 AR_FOR_TARGET
=${AR_FOR_TARGET-${target_alias}-ar}
716 AS
=${AS-${host_alias}-as}
717 AS_FOR_TARGET
=${AS_FOR_TARGET-${target_alias}-as}
718 CC
=${CC-${host_alias}-gcc}
719 CXX
=${CXX-${host_alias}-gcc}
720 CC_FOR_BUILD
=${CC_FOR_BUILD-gcc}
721 CC_FOR_TARGET
=${CC_FOR_TARGET-${target_alias}-gcc}
722 CXX_FOR_TARGET
=${CXX_FOR_TARGET-${target_alias}-gcc}
723 HOST_PREFIX
=${build_alias}-
724 HOST_PREFIX_1
=${build_alias}-
725 LD
=${LD-${host_alias}-ld}
726 LD_FOR_TARGET
=${LD_FOR_TARGET-${target_alias}-ld}
727 MAKEINFO
=${MAKEINFO-makeinfo}
728 NM
=${NM-${host_alias}-nm}
729 NM_FOR_TARGET
=${NM_FOR_TARGET-${target_alias}-nm}
730 RANLIB
=${RANLIB-${host_alias}-ranlib}
731 RANLIB_FOR_TARGET
=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
733 if [ -z "${BISON}" ]; then
734 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
736 test -z "$dir" && dir
=.
737 if test -f $dir/byacc
; then
741 if test -f $dir/bison
; then
745 if test -f $dir/yacc; then
754 if [ -z "${LEX}" ]; then
755 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
757 test -z "$dir" && dir
=.
758 if test -f $dir/flex
; then
762 if test -f $dir/lex; then
771 # Export variables which autoconf might try to set.
779 # If CC is still not set, try to get gcc.
780 if [ -z "${CC}" ]; then
781 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
783 test -z "$dir" && dir
=.
784 if test -f $dir/gcc
; then
799 for subdir
in .
${subdirs} ; do
801 # ${subdir} is relative path from . to the directory we're currently
803 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
804 invsubdir
=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
806 ### figure out what to do with srcdir
808 ".") # no -srcdir option. We're building in place.
811 makesrcdir
=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
813 *) # otherwise relative
815 .
) makesrcdir
=${srcdir} ;;
816 *) makesrcdir
=${invsubdir}${srcdir}/${subdir} ;;
821 if [ "${subdir}/" != "./" ] ; then
822 Makefile
=${subdir}/Makefile
825 if [ ! -d ${subdir} ] ; then
826 if mkdir
${subdir} ; then
829 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
834 case "${removing}" in
838 *) eval echo Building
in ${subdir} ${redirect} ;;
841 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
842 # Set up the list of links to be made.
843 # ${links} is the list of link names, and ${files} is the list of names to link to.
846 configlinks
="${links}"
847 if [ -r ${subdir}/config.status
] ; then
848 mv -f ${subdir}/config.status
${subdir}/config.back
850 while [ -n "${files}" ] ; do
851 # set file to car of files, files to cdr of files
852 set ${files}; file=$1; shift; files
=$
*
853 set ${links}; link
=$1; shift; links
=$
*
855 if [ ! -r ${srcdir}/${file} ] ; then
856 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
857 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
862 # Make a symlink if possible, otherwise try a hard link
863 if ${symbolic_link} ${srcdir}/${file} ${link} >/dev
/null
2>&1 ; then
866 # We need to re-remove the file because Lynx leaves a
867 # very strange directory there when it fails an NFS symlink.
868 ${remove} -r -f ${link}
869 ${hard_link} ${srcdir}/${file} ${link}
871 if [ ! -r ${link} ] ; then
872 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
876 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
879 # Create a .gdbinit file which runs the one in srcdir
880 # and tells GDB to look there for source files.
882 if [ -r ${srcdir}/${subdir}/.gdbinit
] ; then
885 *) cat > ${subdir}/.gdbinit
<<EOF
889 source ${makesrcdir}/.gdbinit
895 # Install a makefile, and make it set VPATH
896 # if necessary so that the sources are found.
897 # Also change its value of srcdir.
898 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
899 # been somewhat optimized and is perhaps a bit twisty.
901 # code is order so as to try to sed the smallest input files we know.
903 # the four makefile fragments MUST end up in the resulting Makefile in this order:
904 # package, target, host, and site. so do these separately because I don't trust the
905 # order of sed -e expressions.
907 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
909 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
910 rm -f ${subdir}/Makefile.tem
912 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
;;
914 site_makefile_frag
=${srcdir}/config
/ms-
${site}
916 if [ -f ${site_makefile_frag} ] ; then
917 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
918 > ${subdir}/Makefile.tem
920 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
925 # working copy now in ${subdir}/Makefile.tem
927 # Conditionalize the makefile for this host.
929 case "${host_makefile_frag}" in
930 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
932 if [ ! -f ${host_makefile_frag} ] ; then
933 host_makefile_frag=${srcdir}/${host_makefile_frag}
935 if [ -f ${host_makefile_frag} ] ; then
936 sed -e "/^
####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
938 echo '***' Expected
host makefile fragment
\"${host_makefile_frag}\" 1>&2
939 echo '***' is missing
in ${PWD=`pwd`}.
1>&2
940 mv ${subdir}/Makefile.tem
${Makefile}
943 # working copy now in ${Makefile}
945 # Conditionalize the makefile for this target.
946 rm -f ${subdir}/Makefile.tem
947 case "${target_makefile_frag}" in
948 "") mv ${Makefile} ${subdir}/Makefile.tem
;;
950 if [ ! -f ${target_makefile_frag} ] ; then
951 target_makefile_frag
=${srcdir}/${target_makefile_frag}
953 if [ -f ${target_makefile_frag} ] ; then
954 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
956 mv ${Makefile} ${subdir}/Makefile.tem
957 target_makefile_frag=
961 # real copy now in ${subdir}/Makefile.tem
963 # Conditionalize the makefile for this package.
965 case "${package_makefile_frag}" in
966 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
968 if [ ! -f ${package_makefile_frag} ] ; then
969 package_makefile_frag=${srcdir}/${package_makefile_frag}
971 if [ -f ${package_makefile_frag} ] ; then
972 sed -e "/^
####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
973 rm -f ${subdir}/Makefile.tem
975 echo '***' Expected package makefile fragment
\"${package_makefile_frag}\" 1>&2
976 echo '***' is missing
in ${PWD=`pwd`}.
1>&2
977 mv ${subdir}/Makefile.tem
${Makefile}
980 # working copy now in ${Makefile}
982 mv ${Makefile} ${subdir}/Makefile.tem
984 # real copy now in ${subdir}/Makefile.tem
986 # prepend warning about editting, and a bunch of variables.
988 cat > ${Makefile} <<EOF
990 VPATH = ${makesrcdir}
991 links = ${configlinks}
992 host_alias = ${host_alias}
993 host_cpu = ${host_cpu}
994 host_vendor = ${host_vendor}
996 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
997 target_alias = ${target_alias}
998 target_cpu = ${target_cpu}
999 target_vendor = ${target_vendor}
1000 target_os = ${target_os}
1001 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1005 *) cat >> ${Makefile} << EOF
1006 build_alias = ${build_alias}
1007 build_cpu = ${build_cpu}
1008 build_vendor = ${build_vendor}
1009 build_os = ${build_os}
1010 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1014 case "${package_makefile_frag}" in
1016 /*) echo package_makefile_frag
= ${package_makefile_frag} >>${Makefile} ;;
1017 *) echo package_makefile_frag
= ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1020 case "${target_makefile_frag}" in
1022 /*) echo target_makefile_frag
= ${target_makefile_frag} >>${Makefile} ;;
1023 *) echo target_makefile_frag
= ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1026 case "${host_makefile_frag}" in
1028 /*) echo host_makefile_frag
= ${host_makefile_frag} >>${Makefile} ;;
1029 *) echo host_makefile_frag
= ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1032 if [ "${site_makefile_frag}" != "" ] ; then
1033 echo site_makefile_frag
= ${invsubdir}${site_makefile_frag} >>${Makefile}
1036 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1037 # remove any form feeds.
1038 if [ -z "${subdirs}" ]; then
1039 rm -f ${subdir}/Makefile.tem2
1040 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1041 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1042 ${subdir}/Makefile.tem
> ${subdir}/Makefile.tem2
1043 rm -f ${subdir}/Makefile.tem
1044 mv ${subdir}/Makefile.tem2
${subdir}/Makefile.tem
1046 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
1047 -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
1053 s%^CC[ ]*=.*$%CC = ${CC}%
1060 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1062 -e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \
1063 -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
1065 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1066 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1067 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1068 -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
1069 ${subdir}/Makefile.tem
>> ${Makefile}
1071 # If this is a Canadian Cross, preset the values of many more
1073 if [ "${build}" != "${host}" ]; then
1074 for var
in ${tools}; do
1075 val
=`eval 'echo $'"${var}"`
1076 sed -e "/^${var}[ ]*=/{
1081 s%^${var}[ ]*=.*$%${var} = ${val}%
1082 }" ${Makefile} > ${Makefile}.tem
1083 mv -f ${Makefile}.tem
${Makefile}
1087 # final copy now in ${Makefile}
1090 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1093 rm -f ${subdir}/Makefile.tem
1095 case "${host_makefile_frag}" in
1097 *) using
="and \"${host_makefile_frag}\"" ;;
1100 case "${target_makefile_frag}" in
1102 *) using
="${using} and \"${target_makefile_frag}\"" ;;
1105 case "${site_makefile_frag}" in
1107 *) using
="${using} and \"${site_makefile_frag}\"" ;;
1110 newusing
=`echo "${using}" | sed 's/and/using/'`
1112 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1116 # describe the chosen configuration in config.status.
1117 # Make that file a shellscript which will reestablish
1118 # the same configuration. Used in Makefiles to rebuild
1121 case "${norecursion}" in
1122 "") arguments="${arguments} --norecursion" ;;
1126 if [ ${subdir} = . ] ; then
1129 # This directory was configured as follows:
1130 ${progname}" ${arguments} "
1131 # ${using}" > ${subdir}/config.new
1135 # This directory was configured as follows:
1137 ${progname}" ${arguments} "
1138 # ${using}" > ${subdir}/config.new
1140 chmod a
+x
${subdir}/config.new
1141 if [ -r ${subdir}/config.back
] ; then
1142 mv -f ${subdir}/config.back
${subdir}/config.status
1144 ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1147 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1151 # If there are subdirectories, then recur.
1152 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
1153 for configdir
in ${configdirs} ; do
1155 if [ -d ${srcdir}/${configdir} ] ; then
1156 eval echo Configuring
${configdir}...
${redirect}
1160 if [ ! -d .
/${configdir} ] ; then
1161 if mkdir .
/${configdir} ; then
1164 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1174 ### figure out what to do with srcdir
1176 ".") newsrcdir
=${srcdir} ;; # no -srcdir option. We're building in place.
1178 newsrcdir
=${srcdir}/${configdir}
1179 srcdiroption
="--srcdir=${newsrcdir}"
1181 *) # otherwise relative
1182 newsrcdir
=..
/${srcdir}/${configdir}
1183 srcdiroption
="--srcdir=${newsrcdir}"
1187 # Handle --cache-file=../XXX
1188 case "${cache_file}" in
1192 cache_file_option
="--cache-file=${cache_file}"
1195 cache_file_option
="--cache-file=../${cache_file}"
1199 ### check for guested configure, otherwise fix possibly relative progname
1200 if [ -f ${newsrcdir}/configure
] ; then
1201 recprog
=${newsrcdir}/configure
1202 elif [ -f ${newsrcdir}/configure.
in ] ; then
1203 case "${progname}" in
1204 /*) recprog
=${progname} ;;
1205 *) recprog
=..
/${progname} ;;
1208 eval echo No configuration information
in ${configdir} ${redirect}
1212 ### The recursion line is here.
1213 if [ ! -z "${recprog}" ] ; then
1214 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1215 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1216 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1219 echo Configure
in `pwd` failed
, exiting.
1>&2
1229 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1230 # and reset the trap handler.
1231 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos