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 # Please report any problems running this configure script to
24 # Please do not send reports about other problems to this address. See
25 # gdb/README, gas/README, etc., for info on where and how to report
26 # problems about particular tools.
28 # This file was written by K. Richard Pixley.
31 # Shell script to create proper links to machine-dependent files in
32 # preparation for compilation.
34 # If configure succeeds, it leaves its status in config.status.
35 # If configure fails after disturbing the status quo,
36 # config.status is removed.
39 export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
48 #symbolic_link="echo ln -s"
50 # clear some things potentially inherited from environment.
53 Makefile_in=Makefile.in
62 floating_point=default
69 package_makefile_frag=
76 program_transform_name=
77 program_transform_nameoption=
92 ### we might need to use some other shell than /bin/sh for running subshells
94 config_shell=${CONFIG_SHELL-/bin/sh}
96 NO_EDIT="This file was generated automatically by configure. Do not edit."
98 ## this is a little touchy and won't always work, but...
100 ## if the argv[0] starts with a slash then it is an absolute name that can (and
101 ## must) be used as is.
103 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
104 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
108 # if PWD already has a value, it is probably wrong.
109 if [ -n "$PWD" ]; then PWD=`pwd`; fi
111 case "${progname}" in
115 PATH=$PATH:${PWD=`pwd`} ; export PATH
124 # Break out if there are no more args
131 # Get the first arg, and shuffle
135 # Make all options have two hyphens
136 orig_option=$option # Save original for error messages
139 -*) option=-$option ;;
142 # Split out the argument for options that take them
145 optarg=`echo $option | sed -e 's/^[^=]*=//'`
147 # These options have mandatory values. Since we didn't find an = sign,
148 # the value must be in the next argument
149 --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
155 # Now, process the options
159 case "$build_alias" in
160 "") build_alias=$optarg ;;
161 *) echo '***' Can only configure for one build machine at a time. 1>&2
170 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
172 disableoptions="$disableoptions $option"
180 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
181 eval $enableopt="$optarg"
182 enableoptions="$enableoptions $option"
184 --exec-prefix* | --ex*)
186 exec_prefixoption="--exec-prefix=$optarg"
196 NOHOST) host_alias=$optarg ;;
197 *) echo '***' Can only configure for one host at a time. 1>&2
205 --norecursion | --no*)
210 prefixoption="--prefix=$optarg"
212 --program-prefix* | --program-p*)
213 program_prefix=$optarg
214 program_prefixoption="--program-prefix=$optarg"
216 --program-suffix* | --program-s*)
217 program_suffix=$optarg
218 program_suffixoption="--program-suffix=$optarg"
220 --program-transform-name* | --program-t*)
221 # Double any backslashes or dollar signs in the argument
222 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
223 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
228 --silent | --sil* | --quiet | --q*)
229 redirect=">/dev/null"
234 site_option="--site=$optarg"
237 # Remove trailing slashes. Otherwise, when the file name gets
238 # bolted into an object file as debug info, it has two slashes
239 # in it. Ordinarily this is ok, but emacs takes double slash
240 # to mean "forget the first part".
241 srcdir=`echo $optarg | sed -e 's:/$::'`
247 case $target_alias in
248 NOTARGET) target_alias=$optarg ;;
249 *) echo '***' Can only configure for one target at a time. 1>&2
256 tmpdiroption="--tmpdir=$optarg"
258 --verbose | --v | --verb*)
262 --version | --V | --vers*)
263 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
272 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
273 eval $withopt="$optarg"
274 withoptions="$withoptions $option"
277 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
279 withoutoptions="$withoutoptions $option"
282 withoptions="$withoptions --with-x"
284 --x-i* | --x-l*) other_options="$other_options $orig_option"
287 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
292 NOUNDEFS) undefs=$option ;;
293 *) echo '***' Can only configure for one host and one target at a time. 1>&2
301 # process host and target
303 # Do some error checking and defaulting for the host and target type.
305 # configure --host=HOST --target=TARGET UNDEFS
308 # 1. You aren't allowed to specify --host, --target, and undefs at the
310 # 2. Host defaults to undefs.
311 # 3. If undefs is not specified, then host defaults to the current host,
312 # as determined by config.guess.
313 # 4. Target defaults to undefs.
314 # 5. If undefs is not specified, then target defaults to host.
318 # Make sure that host, target & undefs aren't all specified at the
320 case $host_alias---$target_alias---$undefs in
321 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
323 *) echo '***' Can only configure for one host and one target at a time. 1>&2
329 # Now, do defaulting for host.
334 # Neither --host option nor undefs were present.
336 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
337 if host_alias=`${guesssys}`
339 # If the string we are going to use for
340 # the target is a prefix of the string
341 # we just guessed for the host, then
342 # assume we are running native, and force
343 # the same string for both target and host.
344 case $target_alias in
347 if expr $host_alias : $target_alias >/dev/null
349 host_alias=$target_alias
353 echo "Configuring for a ${host_alias} host." 1>&2
354 arguments="--host=$host_alias $arguments"
356 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
366 # Do defaulting for target. If --target option isn't present, default
367 # to undefs. If undefs isn't present, default to host.
368 case $target_alias in
372 target_alias=$host_alias
383 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
385 echo Usage: configure [OPTIONS] [HOST]
387 echo Options: [defaults in brackets]
388 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
389 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
390 echo ' --help print this message [normal config]'
391 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
392 echo ' --host=HOST configure for HOST [determined via config.guess]'
393 echo ' --norecursion configure this directory only [recurse]'
394 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
395 echo ' --program-suffix=FOO append FOO to installed program names [""]'
396 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
397 echo ' --site=SITE configure with site-specific makefile for SITE'
398 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
399 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
400 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
401 echo ' --nfp configure for software floating point [hard float]'
402 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
403 echo ' --without-FOO package FOO is NOT available'
404 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
405 echo ' --disable-FOO do not include feature FOO'
407 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
409 if [ -r config.status ] ; then
416 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
417 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
419 # this is a hack. sun4 must always be a valid host alias or this will fail.
420 if ${configsub} sun4 >/dev/null 2>&1 ; then
423 echo '***' cannot find config.sub. 1>&2
428 if ${moveifchange} config.junk config.trash ; then
431 echo '***' cannot find move-if-change. 1>&2
434 rm -f config.junk config.trash
438 if [ -r configure.in ] ; then
441 if [ -r ${progname}.in ] ; then
442 srcdir=`echo ${progname} | sed 's:/configure$::'`
444 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
452 ### warn about some conflicting configurations.
457 if [ -f ${srcdir}/config.status ] ; then
458 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
463 # default exec_prefix
464 case "${exec_prefixoption}" in
465 "") exec_prefix="\$(prefix)" ;;
469 ### break up ${srcdir}/configure.in.
470 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
472 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
473 # Check for a directory that's been converted to use autoconf since
474 # it was last configured.
475 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
476 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
477 if [ -r ${srcdir}/configure ] ; then
478 echo '***' Running the local configure script. 1>&2
479 case "${cache_file}" in
480 "") cache_file_option= ;;
481 *) cache_file_option="--cache-file=${cache_file}" ;;
483 srcdiroption="--srcdir=${srcdir}"
484 case "${build_alias}" in
486 *) buildopt="--build=${build_alias}" ;;
488 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
489 ${buildopt} --host=${host_alias} --target=${target_alias} \
490 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
492 ${program_prefixoption} ${program_suffixoption} \
493 ${program_transform_nameoption} ${site_option} \
494 ${withoptions} ${withoutoptions} \
495 ${enableoptions} ${disableoptions} \
496 ${cache_file_option} ${removing} ${other_options} ${redirect}
498 echo '***' There is no configure script present though. 1>&2
506 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
508 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
515 "") TMPDIR=/tmp ; export TMPDIR ;;
519 # keep this filename short for &%*%$*# 14 char file names
520 tmpfile=${TMPDIR}/cONf$$
521 # Note that under many versions of sh a trap handler for 0 will *override* any
522 # exit status you explicitly specify! At this point, the only non-error exit
523 # is at the end of the script; these actions are duplicated there, minus
524 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
525 # trap handler, or you'll lose.
526 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
528 # split ${srcdir}/configure.in into common, per-host, per-target,
529 # and post-target parts. Post-target is optional.
530 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
531 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
532 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
533 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
534 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
536 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
540 ### do common part of configure.in
544 # some sanity checks on configure.in
545 case "${srctrigger}" in
547 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
553 case "${build_alias}" in
555 if result=`${config_shell} ${configsub} ${host_alias}` ; then
556 build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
557 build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
558 build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
559 build=${host_cpu}-${host_vendor}-${host_os}
560 build_alias=${host_alias}
564 if result=`${config_shell} ${configsub} ${build_alias}` ; then
565 buildopt="--build=${build_alias}"
566 build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
567 build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
568 build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
569 build=${build_cpu}-${build_vendor}-${build_os}
571 echo "Unrecognized build system name ${build_alias}." 1>&2
577 if result=`${config_shell} ${configsub} ${host_alias}` ; then
580 echo "Unrecognized host system name ${host_alias}." 1>&2
583 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
584 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
585 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
586 host=${host_cpu}-${host_vendor}-${host_os}
590 if result=`${config_shell} ${configsub} ${target_alias}` ; then
593 echo "Unrecognized target system name ${target_alias}." 1>&2
596 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
597 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
598 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
599 target=${target_cpu}-${target_vendor}-${target_os}
603 # Find the source files, if location was not specified.
608 if [ ! -r ${srctrigger} ] ; then
615 if [ ! -r ${srcdir}/${srctrigger} ] ; then
616 case "${srcdirdefaulted}" in
617 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
618 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
621 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
625 # Some systems (e.g., one of the i386-aix systems the gas testers are
626 # using) don't handle "\$" correctly, so don't use it here.
627 tooldir='$(exec_prefix)'/${target_alias}
629 if [ "${host_alias}" != "${target_alias}" ] ; then
630 if [ "${program_prefixoption}" = "" ] ; then
631 if [ "${program_suffixoption}" = "" ] ; then
632 if [ "${program_transform_nameoption}" = "" ] ; then
633 program_prefix=${target_alias}- ;
639 # Merge program_prefix and program_suffix onto program_transform_name.
640 # (program_suffix used to use $, but it's hard to preserve $ through both
642 if [ "${program_suffix}" != "" ] ; then
643 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
646 if [ "${program_prefix}" != "" ] ; then
647 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
650 # If CC and CXX are not set in the environment, and the Makefile
651 # exists, try to extract them from it. This is to handle running
652 # ./config.status by hand.
653 if [ -z "${CC}" -a -r Makefile ]; then
658 /^CC[ ]*=/ s/CC[ ]*=\(.*\)/\1/p' < Makefile > Makefile.cc
659 CC=`tail -1 Makefile.cc`
663 if [ -z "${CXX}" -a -r Makefile ]; then
668 /^CXX[ ]*=/ s/CXX[ ]*=\(.*\)/\1/p' < Makefile > Makefile.cc
669 CXX=`tail -1 Makefile.cc`
673 # If CC is still not set, try to get gcc.
674 if [ -z "${CC}" ]; then
675 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
677 test -z "$dir" && dir=.
678 if test -f $dir/gcc; then
689 for subdir in . ${subdirs} ; do
691 # ${subdir} is relative path from . to the directory we're currently
693 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
694 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
696 ### figure out what to do with srcdir
698 ".") # no -srcdir option. We're building in place.
701 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
703 *) # otherwise relative
705 .) makesrcdir=${srcdir} ;;
706 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
711 if [ "${subdir}/" != "./" ] ; then
712 Makefile=${subdir}/Makefile
715 if [ ! -d ${subdir} ] ; then
716 if mkdir ${subdir} ; then
719 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
724 case "${removing}" in
728 *) eval echo Building in ${subdir} ${redirect} ;;
731 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
732 # Set up the list of links to be made.
733 # ${links} is the list of link names, and ${files} is the list of names to link to.
736 configlinks="${links}"
737 if [ -r ${subdir}/config.status ] ; then
738 mv -f ${subdir}/config.status ${subdir}/config.back
740 while [ -n "${files}" ] ; do
741 # set file to car of files, files to cdr of files
742 set ${files}; file=$1; shift; files=$*
743 set ${links}; link=$1; shift; links=$*
745 if [ ! -r ${srcdir}/${file} ] ; then
746 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
747 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
752 # Make a symlink if possible, otherwise try a hard link
753 if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
756 # We need to re-remove the file because Lynx leaves a
757 # very strange directory there when it fails an NFS symlink.
758 ${remove} -r -f ${link}
759 ${hard_link} ${srcdir}/${file} ${link}
761 if [ ! -r ${link} ] ; then
762 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
766 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
769 # Create a .gdbinit file which runs the one in srcdir
770 # and tells GDB to look there for source files.
772 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
775 *) cat > ${subdir}/.gdbinit <<EOF
779 source ${makesrcdir}/.gdbinit
785 # Install a makefile, and make it set VPATH
786 # if necessary so that the sources are found.
787 # Also change its value of srcdir.
788 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
789 # been somewhat optimized and is perhaps a bit twisty.
791 # code is order so as to try to sed the smallest input files we know.
793 # the four makefile fragments MUST end up in the resulting Makefile in this order:
794 # package, target, host, and site. so do these separately because I don't trust the
795 # order of sed -e expressions.
797 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
799 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
800 rm -f ${subdir}/Makefile.tem
802 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
804 site_makefile_frag=${srcdir}/config/ms-${site}
806 if [ -f ${site_makefile_frag} ] ; then
807 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
808 > ${subdir}/Makefile.tem
810 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
815 # working copy now in ${subdir}/Makefile.tem
817 # Conditionalize the makefile for this host.
819 case "${host_makefile_frag}" in
820 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
822 if [ ! -f ${host_makefile_frag} ] ; then
823 host_makefile_frag=${srcdir}/${host_makefile_frag}
825 if [ -f ${host_makefile_frag} ] ; then
826 sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
828 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
829 echo '***' is missing in ${PWD=`pwd`}. 1>&2
830 mv ${subdir}/Makefile.tem ${Makefile}
833 # working copy now in ${Makefile}
835 # Conditionalize the makefile for this target.
836 rm -f ${subdir}/Makefile.tem
837 case "${target_makefile_frag}" in
838 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
840 if [ ! -f ${target_makefile_frag} ] ; then
841 target_makefile_frag=${srcdir}/${target_makefile_frag}
843 if [ -f ${target_makefile_frag} ] ; then
844 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
846 mv ${Makefile} ${subdir}/Makefile.tem
847 target_makefile_frag=
851 # real copy now in ${subdir}/Makefile.tem
853 # Conditionalize the makefile for this package.
855 case "${package_makefile_frag}" in
856 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
858 if [ ! -f ${package_makefile_frag} ] ; then
859 package_makefile_frag=${srcdir}/${package_makefile_frag}
861 if [ -f ${package_makefile_frag} ] ; then
862 sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
863 rm -f ${subdir}/Makefile.tem
865 echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
866 echo '***' is missing in ${PWD=`pwd`}. 1>&2
867 mv ${subdir}/Makefile.tem ${Makefile}
870 # working copy now in ${Makefile}
872 mv ${Makefile} ${subdir}/Makefile.tem
874 # real copy now in ${subdir}/Makefile.tem
876 # prepend warning about editting, and a bunch of variables.
878 cat > ${Makefile} <<EOF
880 VPATH = ${makesrcdir}
881 links = ${configlinks}
882 host_alias = ${host_alias}
883 host_cpu = ${host_cpu}
884 host_vendor = ${host_vendor}
886 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
887 target_alias = ${target_alias}
888 target_cpu = ${target_cpu}
889 target_vendor = ${target_vendor}
890 target_os = ${target_os}
891 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
895 *) cat >> ${Makefile} << EOF
896 build_alias = ${build_alias}
897 build_cpu = ${build_cpu}
898 build_vendor = ${build_vendor}
899 build_os = ${build_os}
900 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
904 case "${package_makefile_frag}" in
906 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
907 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
910 case "${target_makefile_frag}" in
912 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
913 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
916 case "${host_makefile_frag}" in
918 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
919 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
922 if [ "${site_makefile_frag}" != "" ] ; then
923 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
926 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
927 # remove any form feeds.
928 if [ -z "${subdirs}" ]; then
929 rm -f ${subdir}/Makefile.tem2
930 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
931 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
932 ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
933 rm -f ${subdir}/Makefile.tem
934 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
936 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
937 -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
945 s%^CC[ ]*=.*$%CC = ${CC}%
954 s%^CXX[ ]*=.*$%CXX = ${CXX}%
956 -e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \
957 -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
959 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
960 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
961 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
962 -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
963 ${subdir}/Makefile.tem >> ${Makefile}
964 # final copy now in ${Makefile}
967 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
970 rm -f ${subdir}/Makefile.tem
972 case "${host_makefile_frag}" in
974 *) using="and \"${host_makefile_frag}\"" ;;
977 case "${target_makefile_frag}" in
979 *) using="${using} and \"${target_makefile_frag}\"" ;;
982 case "${site_makefile_frag}" in
984 *) using="${using} and \"${site_makefile_frag}\"" ;;
987 newusing=`echo "${using}" | sed 's/and/using/'`
989 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
993 # describe the chosen configuration in config.status.
994 # Make that file a shellscript which will reestablish
995 # the same configuration. Used in Makefiles to rebuild
998 case "${norecursion}" in
999 "") arguments="${arguments} --norecursion" ;;
1003 if [ ${subdir} = . ] ; then
1006 # This directory was configured as follows:
1007 ${progname}" ${arguments} "
1008 # ${using}" > ${subdir}/config.new
1012 # This directory was configured as follows:
1014 ${progname}" ${arguments} "
1015 # ${using}" > ${subdir}/config.new
1017 chmod a+x ${subdir}/config.new
1018 if [ -r ${subdir}/config.back ] ; then
1019 mv -f ${subdir}/config.back ${subdir}/config.status
1021 ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1024 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1028 # If there are subdirectories, then recur.
1029 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
1030 for configdir in ${configdirs} ; do
1032 if [ -d ${srcdir}/${configdir} ] ; then
1033 eval echo Configuring ${configdir}... ${redirect}
1037 if [ ! -d ./${configdir} ] ; then
1038 if mkdir ./${configdir} ; then
1041 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1051 ### figure out what to do with srcdir
1053 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1055 newsrcdir=${srcdir}/${configdir}
1056 srcdiroption="--srcdir=${newsrcdir}"
1058 *) # otherwise relative
1059 newsrcdir=../${srcdir}/${configdir}
1060 srcdiroption="--srcdir=${newsrcdir}"
1064 # Handle --cache-file=../XXX
1065 case "${cache_file}" in
1069 cache_file_option="--cache-file=${cache_file}"
1072 cache_file_option="--cache-file=../${cache_file}"
1076 ### check for guested configure, otherwise fix possibly relative progname
1077 if [ -f ${newsrcdir}/configure ] ; then
1078 recprog=${newsrcdir}/configure
1079 elif [ -f ${newsrcdir}/configure.in ] ; then
1080 case "${progname}" in
1081 /*) recprog=${progname} ;;
1082 *) recprog=../${progname} ;;
1085 eval echo No configuration information in ${configdir} ${redirect}
1089 ### The recursion line is here.
1090 if [ ! -z "${recprog}" ] ; then
1091 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1092 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1093 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1096 echo Configure in `pwd` failed, exiting. 1>&2
1106 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1107 # and reset the trap handler.
1108 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos