3 ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
6 # Copyright (C) 1988, 1990, 1991, 1992, 1993 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 # Please email any bugs, comments, and/or additions to this file to:
25 # This file was written by K. Richard Pixley.
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 $$)
45 #symbolic_link="echo ln -s"
47 # clear some things potentially inherited from environment.
50 Makefile_in=Makefile.in
56 floating_point=default
68 package_makefile_frag=
75 program_transform_name=
76 program_transform_nameoption=
91 ### we might need to use some other shell than /bin/sh for running subshells
93 config_shell=${CONFIG_SHELL-}
95 NO_EDIT="This file was generated automatically by configure. Do not edit."
97 ## this is a little touchy and won't always work, but...
99 ## if the argv[0] starts with a slash then it is an absolute name that can (and
100 ## must) be used as is.
102 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
103 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
107 # if PWD already has a value, it is probably wrong.
108 if [ -n "$PWD" ]; then PWD=`pwd`; fi
110 case "${progname}" in
114 PATH=$PATH:${PWD=`pwd`} ; export PATH
120 # handle things that might have args following as separate words
121 if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
122 elif [ -n "${next_exec_prefix}" ] ; then
124 exec_prefixoption="-exec-prefix=${exec_prefix}"
126 elif [ -n "${next_site}" ] ; then site=${arg} ; site_option=-site=${site} ; next_site=
127 # remove any possible trailing slash from srcdir. See note below.
128 elif [ -n "${next_srcdir}" ] ; then srcdir=`echo ${arg} | sed -e 's:/$::'` ; next_srcdir=
129 elif [ -n "${next_program_prefix}" ] ; then
130 program_prefix=${arg}
131 program_prefixoption="-program_prefix=${program_prefix}"
133 elif [ -n "${next_program_suffix}" ] ; then
134 program_suffix=${arg}
135 program_suffixoption="-program_suffix=${program_suffix}"
137 elif [ -n "${next_program_transform_name}" ] ; then
138 # Double any backslashes or dollar signs in the argument
139 if [ -n "${arg}" ] ; then
140 program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
142 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='${arg}'"
143 next_program_transform_name=
144 elif [ -n "${next_target}" ] ; then
146 case "${target_alias}" in
148 target_alias="${arg}"
151 echo '***' Can only configure for one target at a time. 1>&2
155 elif [ -n "${next_host}" ] ; then
157 case "${host_alias}" in
162 echo '***' Can only configure for one host at a time. 1>&2
166 elif [ -n "${next_tmpdir}" ] ; then
168 tmpdiroption="--tmpdir=${arg}"
173 -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=* | -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* )
174 exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
175 exec_prefixoption=${arg}
177 -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e | -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec-)
186 -host=* | --host=* | --hos=* | --ho=*)
187 case "${host_alias}" in
189 host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
192 echo '***' Can only configure for one host at a time. 1>&2
197 -host=* | --host | --hos | --ho)
198 case "${host_alias}" in
203 echo '***' Can only configure for one host at a time. 1>&2
211 -norecursion | --no*)
214 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*)
215 prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
218 -prefix | --prefix | --prefi | --pref | --pre)
221 -rm | --rm) removing=${arg} ;;
222 -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | -program-prefix=* | --program-prefix=* | --program-prefi=* | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
223 program_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
224 program_prefixoption=${arg}
226 -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | -program-prefix | --program-prefix | --program-prefi | --program-pref | --program-pre | --program-pr | --program-p)
227 next_program_prefix=yes
229 -program_suffix=* | --program_suffix=* | --program_suffi=* | --program_suff=* | --program_suf=* | --program_su=* | --program_s=* | -program-suffix=* | --program-suffix=* | --program-suffi=* | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
230 program_suffix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
231 program_suffixoption=${arg}
233 -program_suffix | --program_suffix | --program_suffi | --program_suff | --program_suf | --program_su | --program_s |-program-suffix | --program-suffix | --program-suffi | --program-suff | --program-suf | --program-su | --program-s)
234 next_program_suffix=yes
236 -program_transform_name=* | --program_transform_name=* | --program_transform_nam=* | --program_transform_na=* | --program_transform_n=* | --program_transform_=* | --program_transform=* | --program_transfor=* | --program_transfo=* | --program_transf=* | --program_trans=* | --program_tran=* | --program_tra=* | --program_tr=* | --program_t=* | -program-transform-name=* | --program-transform-name=* | --program-transform-nam=* | --program-transform-na=* | --program-transform-n=* | --program-transform-=* | --program-transform=* | --program-transfor=* | --program-transfo=* | --program-transf=* | --program-trans=* | --program-tran=* | --program-tra=* | --program-tr=* | --program-t=*)
237 arg=`echo ${arg} | sed -e 's/^[-a-z_]*=//'`
238 # Double any \ or $ in the argument
239 if [ -n "${arg}" ] ; then
240 program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
242 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='${arg}'"
244 -program_transform_name | --program_transform_name | --program_transform_nam | --program_transform_na | --program_transform_n | --program_transform_ | --program_transform | --program_transfor | --program_transfo | --program_transf | --program_trans | --program_tran | --program_tra | --program_tr | --program_t | -program-transform-name | --program-transform-name | --program-transform-nam | --program-transform-na | --program-transform-n | --program-transform- | --program-transform | --program-transfor | --program-transfo | --program-transf | --program-trans | --program-tran | --program-tra | --program-tr | --program-t)
245 next_program_transform_name=yes
247 -site=* | --site=* | --sit=* | --si=*)
249 site=`echo ${arg} | sed 's/^[-a-z]*=//'`
251 -site | --site | --sit)
254 # remove trailing slashes. Otherwise, when the file name gets
255 # bolted into an object file as debug info, it has two slashes in
256 # it. Ordinarily this is ok, but emacs takes double slash to
257 # mean "forget the first part".
258 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
259 srcdir=`echo ${arg} | sed 's/^[-a-z]*=//' | sed -e 's:/$::'`
261 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
264 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
265 case "${target_alias}" in
266 "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
268 echo '***' Can only configure for one target at a time. 1>&2
273 -target | --target | --targe | --targ | --tar | --ta)
276 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
278 TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
280 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
287 -version | -V | --version | --V)
288 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
291 -with*=* | --with*=*)
292 withopt=`echo ${arg} | sed 's:^-*\(with[^=]*\)=.*$:\1:;s/-/_/g'`
293 withval=`echo ${arg} | sed 's:^-*with[^=]*=\(.*\)$:\1:'`
294 eval $withopt="$withval"
295 withoptions="$withoptions $arg"
297 -without* | --without*)
298 withopt=`echo ${arg} | sed 's:^-*without:with:;s/-/_/g'`
300 withoutoptions="$withoutoptions $arg"
303 withopt=`echo ${arg} | sed 's:^-*with:with:;s/-/_/g'`
305 withoptions="$withoptions $arg"
310 echo "Unrecognized option: \"${arg}\"". ;
320 echo '***' Can only configure for one host and one target at a time. 1>&2
329 # process host and target
332 # # Complain if an arg is missing
333 # if [ -z "${host_alias}" ] ; then
335 # echo "configure: No HOST specified." ;
340 ### This is a bit twisted.
341 ### * if all three are specified, this is an error.
342 ### * if we have neither hosts, nor unadorned args, this is an error.
343 ### * if no hosts are specified, then the unadorned args are hosts, but if
344 ### there were none, this is an error.
345 ### * if no targets are specified, then the unadorned args are targets, but if
346 ### there were no unadorned args, then the hosts are also targets.
348 if [ -n "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ] ; then
349 echo '***' Can only configure for one host and one target at a time. 1>&2
351 elif [ -z "${host_alias}" -a -z "${undefs}" ] ; then
352 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
353 if tmp_alias=`${guesssys}` ; then
354 echo "Configuring for a ${tmp_alias} host." 1>&2
355 host_alias=${tmp_alias}
356 case "${target_alias}" in
357 "") target_alias=${tmp_alias} ;;
360 arguments="--host=${host_alias} ${arguments}"
362 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
366 case "${host_alias}" in
367 "") host_alias=${undefs} ;;
371 case "${target_alias}" in
374 "") target_alias=${host_alias} ;;
375 *) target_alias=${undefs} ;;
385 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
386 (echo "Usage: configure HOST" ;
388 echo "Options: [defaults in brackets]" ;
389 echo " --prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
390 echo " --exec-prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
391 echo " --help print this message. [normal config]" ;
392 echo " --norecursion configure this directory only. [recurse]" ;
393 echo " --program-prefix=FOO install programs with FOO prepended to their names. [ \"\" ]" ;
394 echo " --program-suffix=FOO install programs with FOO appended to their names. [ \"\" ]" ;
395 echo " --program-transform-name=FOO install programs with names transformed by sed pattern FOO. [ \"\" ]" ;
396 echo " --site=SITE configure with site specific makefile for SITE" ;
397 echo " --srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ;
398 echo " --target=TARGET configure for TARGET. [TARGET = HOST]" ;
399 echo " --tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
400 echo " --nfp configure the compilers default to soft floating point. [hard float]" ;
401 echo " --with-FOO, --with-FOO=BAR specify that FOO is available"
402 echo " --without-FOO specify that FOO is NOT available"
404 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
407 if [ -r config.status ] ; then
414 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
415 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
417 # this is a hack. sun4 must always be a valid host alias or this will fail.
418 if ${configsub} sun4 >/dev/null 2>&1 ; then
421 echo '***' cannot find config.sub. 1>&2
426 if ${moveifchange} config.junk config.trash ; then
429 echo '***' cannot find move-if-change. 1>&2
432 rm -f config.junk config.trash
436 if [ -r configure.in ] ; then
439 if [ -r ${progname}.in ] ; then
440 srcdir=`echo ${progname} | sed 's:/configure$::'`
442 echo '***' "Can't find configure.in. Try using -srcdir=some_dir" 1>&2
450 ### warn about some conflicting configurations.
455 if [ -f ${srcdir}/config.status ] ; then
456 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
461 # default exec_prefix
462 case "${exec_prefix}" in
463 "") exec_prefix="\$(prefix)" ;;
467 ### break up ${srcdir}/configure.in.
468 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
470 echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
476 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
478 echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
485 "") TMPDIR=/tmp ; export TMPDIR ;;
489 # keep this filename short for &%*%$*# 14 char file names
490 tmpfile=${TMPDIR}/cONf$$
491 trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
493 # split ${srcdir}/configure.in into common, per-host, per-target,
494 # and post-target parts. Post-target is optional.
495 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
496 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
497 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
498 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
499 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
501 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
505 ### do common part of configure.in
509 # some sanity checks on configure.in
510 case "${srctrigger}" in
512 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
518 result=`${configsub} ${host_alias}`
519 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
520 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
521 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
522 host=${host_cpu}-${host_vendor}-${host_os}
526 result=`${configsub} ${target_alias}`
527 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
528 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
529 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
530 target=${target_cpu}-${target_vendor}-${target_os}
534 # Find the source files, if location was not specified.
539 if [ ! -r ${srctrigger} ] ; then
546 if [ ! -r ${srcdir}/${srctrigger} ] ; then
547 case "${srcdirdefaulted}" in
548 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
549 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
552 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
556 # Some systems (e.g., one of the i386-aix systems the gas testers are
557 # using) don't handle "\$" correctly, so don't use it here.
558 tooldir='$(exec_prefix)'/${target_alias}
560 if [ "${host_alias}" != "${target_alias}" ] ; then
561 if [ "${program_prefixoption}" = "" ] ; then
562 if [ "${program_suffixoption}" = "" ] ; then
563 if [ "${program_transform_nameoption}" = "" ] ; then
564 program_prefix=${target_alias}- ;
570 # Merge program_prefix and program_suffix onto program_transform_name
571 # Use a double $ so that make ignores it
572 if [ "${program_suffix}" != "" ] ; then
573 program_transform_name="-e s/\$\$/${program_suffix}/ ${program_transform_name}"
576 if [ "${program_prefix}" != "" ] ; then
577 program_transform_name="-e s/^/${program_prefix}/ ${program_transform_name}"
580 for subdir in . ${subdirs} ; do
582 # ${subdir} is relative path from . to the directory we're currently
584 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
585 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
587 ### figure out what to do with srcdir
589 ".") # no -srcdir option. We're building in place.
592 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
594 *) # otherwise relative
596 .) makesrcdir=${srcdir} ;;
597 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
602 if [ "${subdir}/" != "./" ] ; then
603 Makefile=${subdir}/Makefile
606 if [ ! -d ${subdir} ] ; then
607 if mkdir ${subdir} ; then
610 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
615 case "${removing}" in
619 *) eval echo Building in ${subdir} ${redirect} ;;
622 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
623 # Set up the list of links to be made.
624 # ${links} is the list of link names, and ${files} is the list of names to link to.
627 configlinks="${links}"
628 if [ -r ${subdir}/config.status ] ; then
629 mv -f ${subdir}/config.status ${subdir}/config.back
631 while [ -n "${files}" ] ; do
632 # set file to car of files, files to cdr of files
633 set ${files}; file=$1; shift; files=$*
634 set ${links}; link=$1; shift; links=$*
636 if [ ! -r ${srcdir}/${file} ] ; then
637 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
638 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
643 # Make a symlink if possible, otherwise try a hard link
644 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
646 if [ ! -r ${link} ] ; then
647 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
651 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
654 # Create a .gdbinit file which runs the one in srcdir
655 # and tells GDB to look there for source files.
657 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
660 *) cat > ${subdir}/.gdbinit <<EOF
664 source ${makesrcdir}/.gdbinit
670 # Install a makefile, and make it set VPATH
671 # if necessary so that the sources are found.
672 # Also change its value of srcdir.
673 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
674 # been somewhat optimized and is perhaps a bit twisty.
676 # code is order so as to try to sed the smallest input files we know.
678 # the four makefile fragments MUST end up in the resulting Makefile in this order:
679 # package, target, host, and site. so do these separately because I don't trust the
680 # order of sed -e expressions.
682 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
684 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
685 rm -f ${subdir}/Makefile.tem
687 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
689 site_makefile_frag=${srcdir}/config/ms-${site}
691 if [ -f ${site_makefile_frag} ] ; then
692 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
693 > ${subdir}/Makefile.tem
695 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
700 # working copy now in ${subdir}/Makefile.tem
702 # Conditionalize the makefile for this host.
704 case "${host_makefile_frag}" in
705 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
707 if [ ! -f ${host_makefile_frag} ] ; then
708 host_makefile_frag=${srcdir}/${host_makefile_frag}
710 if [ -f ${host_makefile_frag} ] ; then
711 sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
713 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
714 echo '***' is missing in ${PWD=`pwd`}. 1>&2
715 mv ${subdir}/Makefile.tem ${Makefile}
718 # working copy now in ${Makefile}
720 # Conditionalize the makefile for this target.
721 rm -f ${subdir}/Makefile.tem
722 case "${target_makefile_frag}" in
723 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
725 if [ ! -f ${target_makefile_frag} ] ; then
726 target_makefile_frag=${srcdir}/${target_makefile_frag}
728 if [ -f ${target_makefile_frag} ] ; then
729 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
731 mv ${Makefile} ${subdir}/Makefile.tem
732 target_makefile_frag=
736 # real copy now in ${subdir}/Makefile.tem
738 # Conditionalize the makefile for this package.
740 case "${package_makefile_frag}" in
741 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
743 if [ ! -f ${package_makefile_frag} ] ; then
744 package_makefile_frag=${srcdir}/${package_makefile_frag}
746 if [ -f ${package_makefile_frag} ] ; then
747 sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
749 echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
750 echo '***' is missing in ${PWD=`pwd`}. 1>&2
751 mv ${subdir}/Makefile.tem ${Makefile}
754 # working copy now in ${Makefile}
756 mv ${Makefile} ${subdir}/Makefile.tem
758 # real copy now in ${subdir}/Makefile.tem
760 # prepend warning about editting, and a bunch of variables.
762 cat > ${Makefile} <<EOF
764 VPATH = ${makesrcdir}
765 links = ${configlinks}
766 host_alias = ${host_alias}
767 host_cpu = ${host_cpu}
768 host_vendor = ${host_vendor}
770 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
771 target_alias = ${target_alias}
772 target_cpu = ${target_cpu}
773 target_vendor = ${target_vendor}
774 target_os = ${target_os}
775 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
777 case "${package_makefile_frag}" in
779 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
780 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
783 case "${target_makefile_frag}" in
785 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
786 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
789 case "${host_makefile_frag}" in
791 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
792 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
795 if [ "${site_makefile_frag}" != "" ] ; then
796 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
799 # make sure that some sort of reasonable default exists for these
804 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
805 # remove any form feeds.
806 if [ -z "${subdirs}" ]; then
807 rm -f ${subdir}/Makefile.tem2
808 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
809 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
810 ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
811 rm -f ${subdir}/Makefile.tem
812 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
814 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
815 -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
823 s/^CC[ ]*=.*$/CC = ${CC}/
832 s/^CXX[ ]*=.*$/CXX = ${CXX}/
834 -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
836 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
837 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
838 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
839 -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
840 ${subdir}/Makefile.tem >> ${Makefile}
841 # final copy now in ${Makefile}
844 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
847 rm -f ${subdir}/Makefile.tem
849 case "${host_makefile_frag}" in
851 *) using="and \"${host_makefile_frag}\"" ;;
854 case "${target_makefile_frag}" in
856 *) using="${using} and \"${target_makefile_frag}\"" ;;
859 case "${site_makefile_frag}" in
861 *) using="${using} and \"${site_makefile_frag}\"" ;;
864 newusing=`echo "${using}" | sed 's/and/using/'`
866 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
870 # describe the chosen configuration in config.status.
871 # Make that file a shellscript which will reestablish
872 # the same configuration. Used in Makefiles to rebuild
875 case "${norecursion}" in
876 "") arguments="${arguments} -norecursion" ;;
880 if [ ${subdir} = . ] ; then
883 # This directory was configured as follows:
884 ${progname}" ${arguments} "
885 # ${using}" > ${subdir}/config.new
889 # This directory was configured as follows:
891 ${progname}" ${arguments} "
892 # ${using}" > ${subdir}/config.new
894 chmod a+x ${subdir}/config.new
895 if [ -r ${subdir}/config.back ] ; then
896 mv -f ${subdir}/config.back ${subdir}/config.status
898 ${moveifchange} ${subdir}/config.new ${subdir}/config.status
901 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
905 # If there are subdirectories, then recur.
906 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
907 for configdir in ${configdirs} ; do
909 if [ -d ${srcdir}/${configdir} ] ; then
910 eval echo Configuring ${configdir}... ${redirect}
914 if [ ! -d ./${configdir} ] ; then
915 if mkdir ./${configdir} ; then
918 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
928 ### figure out what to do with srcdir
930 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
932 newsrcdir=${srcdir}/${configdir}
933 srcdiroption="-srcdir=${newsrcdir}"
935 *) # otherwise relative
936 newsrcdir=../${srcdir}/${configdir}
937 srcdiroption="-srcdir=${newsrcdir}"
941 ### check for guested configure, otherwise fix possibly relative progname
942 if [ -f ${newsrcdir}/configure ] ; then
943 recprog=${newsrcdir}/configure
944 elif [ -f ${newsrcdir}/configure.in ] ; then
945 case "${progname}" in
946 /*) recprog=${progname} ;;
947 *) recprog=../${progname} ;;
950 eval echo No configuration information in ${configdir} ${redirect}
954 ### The recursion line is here.
955 if [ ! -z "${recprog}" ] ; then
956 if eval ${config_shell} ${recprog} ${verbose} --host=${host_alias} --target=${target_alias} \
957 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
958 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${removing} ${redirect} ; then