4 # Copyright (C) 1988, 1990-1993 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 # Please email any bugs, comments, and/or additions to this file to:
21 # configure@cygnus.com
23 # This file was written by K. Richard Pixley.
26 # Shell script to create proper links to machine-dependent files in
27 # preparation for compilation.
29 # If configure succeeds, it leaves its status in config.status.
30 # If configure fails after disturbing the status quo,
31 # config.status is removed.
34 export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
43 #symbolic_link="echo ln -s"
45 # clear some things potentially inherited from environment.
48 Makefile_in=Makefile.in
54 floating_point=default
66 package_makefile_frag=
73 program_transform_name=
74 program_transform_nameoption=
89 NO_EDIT="This file was generated automatically by configure. Do not edit."
91 ## this is a little touchy and won't always work, but...
93 ## if the argv[0] starts with a slash then it is an absolute name that can (and
94 ## must) be used as is.
96 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
97 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
101 # if PWD already has a value, it is probably wrong.
102 if [ -n "$PWD" ]; then PWD=`pwd`; fi
104 case "${progname}" in
108 PATH=$PATH:${PWD=`pwd`} ; export PATH
114 # handle things that might have args following as separate words
115 if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
116 elif [ -n "${next_exec_prefix}" ] ; then
118 exec_prefixoption="-exec_prefix=${exec_prefix}"
120 elif [ -n "${next_site}" ] ; then site=${arg} ; site_option=-site=${site} ; next_site=
121 # remove any possible trailing slash from srcdir. See note below.
122 elif [ -n "${next_srcdir}" ] ; then srcdir=`echo ${arg} | sed -e 's:/$::'` ; next_srcdir=
123 elif [ -n "${next_program_prefix}" ] ; then
124 program_prefix=${arg}
125 program_prefixoption="-program_prefix=${program_prefix}"
127 elif [ -n "${next_program_suffix}" ] ; then
128 program_suffix=${arg}
129 program_suffixoption="-program_suffix=${program_suffix}"
131 elif [ -n "${next_program_transform_name}" ] ; then
132 # Double any backslashes or dollar signs in the argument
133 program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
134 program_transform_nameoption="${program_transform_nameoption} -program_transform_name='${arg}'"
135 next_program_transform_name=
136 elif [ -n "${next_target}" ] ; then
138 case "${target_alias}" in
140 target_alias="${arg}"
143 echo '***' Can only configure for one target at a time. 1>&2
147 elif [ -n "${next_tmpdir}" ] ; then
149 tmpdiroption="--tmpdir=${arg}"
154 -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-=* )
155 exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
156 exec_prefixoption=${arg}
158 -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-)
167 -host=* | --host=* | --hos=* | --ho=*)
168 case "${host_alias}" in
170 host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
173 echo '***' Can only configure for one host at a time. 1>&2
181 -norecursion | --no*)
184 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*)
185 prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
188 -prefix | --prefix | --prefi | --pref | --pre)
191 -rm | --rm) removing=${arg} ;;
192 -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=*)
193 program_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
194 program_prefixoption=${arg}
196 -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)
197 next_program_prefix=yes
199 -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=*)
200 program_suffix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
201 program_suffixoption=${arg}
203 -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)
204 next_program_suffix=yes
206 -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=*)
207 # Double any \ or $ in the argument
208 program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/^[-a-z_]*=//' -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
209 program_transform_nameoption="${program_transform_nameoption} -program_transform_name='`echo ${arg} | sed 's/^[-a-z_]*=//'`'"
211 -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)
212 next_program_transform_name=yes
214 -site=* | --site=* | --sit=* | --si=*)
216 site=`echo ${arg} | sed 's/^[-a-z]*=//'`
218 -site | --site | --sit)
221 # remove trailing slashes. Otherwise, when the file name gets
222 # bolted into an object file as debug info, it has two slashes in
223 # it. Ordinarily this is ok, but emacs takes double slash to
224 # mean "forget the first part".
225 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
226 srcdir=`echo ${arg} | sed 's/^[-a-z]*=//' | sed -e 's:/$::'`
228 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
231 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
232 case "${target_alias}" in
233 "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
235 echo '***' Can only configure for one target at a time. 1>&2
240 -target | --target | --targe | --targ | --tar | --ta)
243 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
245 TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
247 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
254 -version | -V | --version | --V)
255 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
258 -with*=* | --with*=*)
259 withopt=`echo ${arg} | sed 's:^-*\(with[^=]*\)=.*$:\1:;s/-/_/g'`
260 withval=`echo ${arg} | sed 's:^-*with[^=]*=\(.*\)$:\1:'`
261 eval $withopt="$withval"
262 withoptions="$withoptions $arg"
265 withopt=`echo ${arg} | sed 's:^-*with:with:;s/-/_/g'`
267 withoptions="$withoptions $arg"
272 echo "Unrecognized option: \"${arg}\"". ;
282 echo '***' Can only configure for one host and one target at a time. 1>&2
291 # process host and target
294 # # Complain if an arg is missing
295 # if [ -z "${host_alias}" ] ; then
297 # echo "configure: No HOST specified." ;
302 ### This is a bit twisted.
303 ### * if all three are specified, this is an error.
304 ### * if we have neither hosts, nor unadorned args, this is an error.
305 ### * if no hosts are specified, then the unadorned args are hosts, but if
306 ### there were none, this is an error.
307 ### * if no targets are specified, then the unadorned args are targets, but if
308 ### there were no unadorned args, then the hosts are also targets.
310 if [ -n "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ] ; then
311 echo '***' Can only configure for one host and one target at a time. 1>&2
313 elif [ -z "${host_alias}" -a -z "${undefs}" ] ; then
314 echo '- You did not tell me what kind of host system you want to configure.
315 - I will attempt to guess the kind of system this is.' 1>&2
316 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
317 if tmp_alias=`${guesssys}` ; then
318 echo "- Looks like this is a ${tmp_alias}" 1>&2
319 host_alias=${tmp_alias}
320 target_alias=${tmp_alias}
322 echo '- Failed to guess the system type. You need to tell me.' 1>&2
326 case "${host_alias}" in
327 "") host_alias=${undefs} ;;
331 case "${target_alias}" in
334 "") target_alias=${host_alias} ;;
335 *) target_alias=${undefs} ;;
345 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
346 (echo "Usage: configure HOST" ;
348 echo "Options: [defaults in brackets]" ;
349 echo " -exec-prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
350 echo " -gas configure the compilers for use with gas. [native as]" ;
351 echo " -help print this message. [normal config]" ;
352 echo " -lang=LANG configure to build LANG. [gcc]" ;
353 echo " -nfp configure the compilers default to soft floating point. [hard float]" ;
354 echo " -norecursion configure this directory only. [recurse]" ;
355 echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
356 echo " -program-prefix=FOO install programs with FOO prepended to their names. [ \"\" ]" ;
357 echo " -program-suffix=FOO install programs with FOO appended to their names. [ \"\" ]" ;
358 echo " -program-transform-name=FOO install programs with names transformed by sed pattern FOO. [ \"\" ]" ;
359 echo " -site=SITE configure with site specific makefile for SITE" ;
360 echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ;
361 echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ;
362 echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
364 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
367 if [ -r config.status ] ; then
374 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
375 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
377 # this is a hack. sun4 must always be a valid host alias or this will fail.
378 if ${configsub} sun4 >/dev/null 2>&1 ; then
381 echo '***' cannot find config.sub. 1>&2
386 if ${moveifchange} config.junk config.trash ; then
389 echo '***' cannot find move-if-change. 1>&2
392 rm -f config.junk config.trash
396 if [ -r configure.in ] ; then
399 if [ -r ${progname}.in ] ; then
400 srcdir=`echo ${progname} | sed 's:/configure$::'`
402 echo '***' "Can't find configure.in. Try using -srcdir=some_dir" 1>&2
410 ### warn about some conflicting configurations.
415 if [ -f ${srcdir}/config.status ] ; then
416 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
421 # default exec_prefix
422 case "${exec_prefix}" in
423 "") exec_prefix="\$(prefix)" ;;
427 ### break up ${srcdir}/configure.in.
428 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
430 echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
436 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
438 echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
445 "") TMPDIR=/tmp ; export TMPDIR ;;
449 # keep this filename short for &%*%$*# 14 char file names
450 tmpfile=${TMPDIR}/cONf$$
451 trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
453 # split ${srcdir}/configure.in into common, per-host, per-target,
454 # and post-target parts. Post-target is optional.
455 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
456 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
457 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
458 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
459 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
461 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
465 ### do common part of configure.in
469 # some sanity checks on configure.in
470 case "${srctrigger}" in
472 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
478 result=`${configsub} ${host_alias}`
479 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
480 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
481 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
482 host=${host_cpu}-${host_vendor}-${host_os}
486 result=`${configsub} ${target_alias}`
487 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
488 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
489 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
490 target=${target_cpu}-${target_vendor}-${target_os}
494 # Find the source files, if location was not specified.
499 if [ ! -r ${srctrigger} ] ; then
506 if [ ! -r ${srcdir}/${srctrigger} ] ; then
507 case "${srcdirdefaulted}" in
508 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
509 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
512 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
516 tooldir="\$(libdir)/${target_alias}"
518 if [ "${host_alias}" != "${target_alias}" ] ; then
519 if [ "${program_prefix}" = "" ] ; then
520 if [ "${program_suffix}" = "" ] ; then
521 if [ "${program_transform_name}" = "" ] ; then
522 program_prefix=${target_alias}- ;
528 # Merge program_prefix and program_suffix onto program_transform_name
529 # Use a double $ so that make ignores it
530 if [ "${program_suffix}" != "" ] ; then
531 program_transform_name="-e s/\$\$/${program_suffix}/ ${program_transform_name}"
534 if [ "${program_prefix}" != "" ] ; then
535 program_transform_name="-e s/^/${program_prefix}/ ${program_transform_name}"
538 for subdir in . ${subdirs} ; do
540 # ${subdir} is relative path from . to the directory we're currently
542 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
543 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
545 ### figure out what to do with srcdir
547 ".") # no -srcdir option. We're building in place.
550 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
552 *) # otherwise relative
554 .) makesrcdir=${srcdir} ;;
555 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
560 if [ "${subdir}/" != "./" ] ; then
561 Makefile=${subdir}/Makefile
564 if [ ! -d ${subdir} ] ; then
565 if mkdir ${subdir} ; then
568 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
573 case "${removing}" in
577 *) eval echo Building in ${subdir} ${redirect} ;;
580 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
581 # Set up the list of links to be made.
582 # ${links} is the list of link names, and ${files} is the list of names to link to.
585 configlinks="${links}"
586 if [ -r ${subdir}/config.status ] ; then
587 mv -f ${subdir}/config.status ${subdir}/config.back
589 while [ -n "${files}" ] ; do
590 # set file to car of files, files to cdr of files
591 set ${files}; file=$1; shift; files=$*
592 set ${links}; link=$1; shift; links=$*
594 if [ ! -r ${srcdir}/${file} ] ; then
595 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
596 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
601 # Make a symlink if possible, otherwise try a hard link
602 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
604 if [ ! -r ${link} ] ; then
605 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
609 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
612 # Create a .gdbinit file which runs the one in srcdir
613 # and tells GDB to look there for source files.
615 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
618 *) cat > ${subdir}/.gdbinit <<EOF
622 source ${makesrcdir}/.gdbinit
628 # Install a makefile, and make it set VPATH
629 # if necessary so that the sources are found.
630 # Also change its value of srcdir.
631 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
632 # been somewhat optimized and is perhaps a bit twisty.
634 # code is order so as to try to sed the smallest input files we know.
636 # the four makefile fragments MUST end up in the resulting Makefile in this order:
637 # package, target, host, and site. so do these separately because I don't trust the
638 # order of sed -e expressions.
640 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
642 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
643 rm -f ${subdir}/Makefile.tem
645 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
647 site_makefile_frag=${srcdir}/config/ms-${site}
649 if [ -f ${site_makefile_frag} ] ; then
650 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
651 > ${subdir}/Makefile.tem
653 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
658 # working copy now in ${subdir}/Makefile.tem
660 # Conditionalize the makefile for this host.
662 case "${host_makefile_frag}" in
663 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
665 if [ ! -f ${host_makefile_frag} ] ; then
666 host_makefile_frag=${srcdir}/${host_makefile_frag}
668 if [ -f ${host_makefile_frag} ] ; then
669 sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
671 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
672 echo '***' is missing in ${PWD=`pwd`}. 1>&2
673 mv ${subdir}/Makefile.tem ${Makefile}
676 # working copy now in ${Makefile}
678 # Conditionalize the makefile for this target.
679 rm -f ${subdir}/Makefile.tem
680 case "${target_makefile_frag}" in
681 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
683 if [ ! -f ${target_makefile_frag} ] ; then
684 target_makefile_frag=${srcdir}/${target_makefile_frag}
686 if [ -f ${target_makefile_frag} ] ; then
687 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
689 mv ${Makefile} ${subdir}/Makefile.tem
690 target_makefile_frag=
694 # real copy now in ${subdir}/Makefile.tem
696 # Conditionalize the makefile for this package.
698 case "${package_makefile_frag}" in
699 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
701 if [ ! -f ${package_makefile_frag} ] ; then
702 package_makefile_frag=${srcdir}/${package_makefile_frag}
704 if [ -f ${package_makefile_frag} ] ; then
705 sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
707 echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
708 echo '***' is missing in ${PWD=`pwd`}. 1>&2
709 mv ${subdir}/Makefile.tem ${Makefile}
712 # working copy now in ${Makefile}
714 mv ${Makefile} ${subdir}/Makefile.tem
716 # real copy now in ${subdir}/Makefile.tem
718 # prepend warning about editting, and a bunch of variables.
720 cat > ${Makefile} <<EOF
722 VPATH = ${makesrcdir}
723 links = ${configlinks}
724 host_alias = ${host_alias}
725 host_cpu = ${host_cpu}
726 host_vendor = ${host_vendor}
728 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
729 target_alias = ${target_alias}
730 target_cpu = ${target_cpu}
731 target_vendor = ${target_vendor}
732 target_os = ${target_os}
733 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
735 case "${package_makefile_frag}" in
737 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
738 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
741 case "${target_makefile_frag}" in
743 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
744 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
747 case "${host_makefile_frag}" in
749 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
750 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
753 if [ "${site_makefile_frag}" != "" ] ; then
754 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
757 # fixme: this shouldn't be in configure.
758 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
759 case "${host_alias}" in
761 echo "ALL=all.internal" >> ${Makefile}
764 echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
765 echo "ALL=all.cross" >> ${Makefile}
769 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
770 # remove any form feeds.
771 if [ -z "${subdirs}" ]; then
772 rm -f ${subdir}/Makefile.tem2
773 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
774 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
775 ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
776 rm -f ${subdir}/Makefile.tem
777 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
779 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
780 -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
781 -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
783 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
784 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
785 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
786 -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
787 ${subdir}/Makefile.tem >> ${Makefile}
788 # final copy now in ${Makefile}
791 echo "No Makefile.in found in ${srcdir}, unable to configure" 1>&2
794 rm -f ${subdir}/Makefile.tem
796 case "${host_makefile_frag}" in
798 *) using="and \"${host_makefile_frag}\"" ;;
801 case "${target_makefile_frag}" in
803 *) using="${using} and \"${target_makefile_frag}\"" ;;
806 case "${site_makefile_frag}" in
808 *) using="${using} and \"${site_makefile_frag}\"" ;;
811 newusing=`echo "${using}" | sed 's/and/using/'`
813 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
817 # describe the chosen configuration in config.status.
818 # Make that file a shellscript which will reestablish
819 # the same configuration. Used in Makefiles to rebuild
822 case "${norecursion}" in
823 "") arguments="${arguments} -norecursion" ;;
827 if [ ${subdir} = . ] ; then
830 # This directory was configured as follows:
831 ${progname}" ${arguments} "
832 # ${using}" > ${subdir}/config.new
836 # This directory was configured as follows:
838 ${progname}" ${arguments} "
839 # ${using}" > ${subdir}/config.new
841 chmod a+x ${subdir}/config.new
842 if [ -r ${subdir}/config.back ] ; then
843 mv -f ${subdir}/config.back ${subdir}/config.status
845 ${moveifchange} ${subdir}/config.new ${subdir}/config.status
848 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
852 # If there are subdirectories, then recur.
853 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
854 for configdir in ${configdirs} ; do
856 if [ -d ${srcdir}/${configdir} ] ; then
857 eval echo Configuring ${configdir}... ${redirect}
861 if [ ! -d ./${configdir} ] ; then
862 if mkdir ./${configdir} ; then
865 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
875 ### figure out what to do with srcdir
877 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
879 newsrcdir=${srcdir}/${configdir}
880 srcdiroption="-srcdir=${newsrcdir}"
882 *) # otherwise relative
883 newsrcdir=../${srcdir}/${configdir}
884 srcdiroption="-srcdir=${newsrcdir}"
888 ### check for guested configure, otherwise fix possibly relative progname
889 if [ -f ${newsrcdir}/configure ] ; then
890 recprog=${newsrcdir}/configure
892 case "${progname}" in
893 /*) recprog=${progname} ;;
894 *) recprog=../${progname} ;;
898 ### The recursion line is here.
899 if eval ${recprog} ${verbose} --host=${host_alias} --target=${target_alias} \
900 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
901 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${removing} ${redirect} ; then