3 ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
6 # Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
7 # Free Software Foundation, Inc.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 # This file was originally 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
51 cache_file=config.cache
57 floating_point=default
64 package_makefile_frag=
71 program_transform_name=
72 program_transform_nameoption=
87 ### we might need to use some other shell than /bin/sh for running subshells
89 config_shell=${CONFIG_SHELL-/bin/sh}
91 NO_EDIT="This file was generated automatically by configure. Do not edit."
93 ## this is a little touchy and won't always work, but...
95 ## if the argv[0] starts with a slash then it is an absolute name that can (and
96 ## must) be used as is.
98 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
99 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
103 # if PWD already has a value, it is probably wrong.
104 if [ -n "$PWD" ]; then PWD=`pwd`; fi
106 case "${progname}" in
110 PATH=$PATH:${PWD=`pwd`} ; export PATH
119 # Break out if there are no more args
126 # Get the first arg, and shuffle
130 # Make all options have two hyphens
131 orig_option=$option # Save original for error messages
134 -*) option=-$option ;;
137 # Split out the argument for options that take them
140 optarg=`echo $option | sed -e 's/^[^=]*=//'`
141 arguments="$arguments $option"
143 # These options have mandatory values. Since we didn't find an = sign,
144 # the value must be in the next argument
145 --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
148 arguments="$arguments $option=$optarg"
151 arguments="$arguments -v"
154 arguments="$arguments $option"
158 # Now, process the options
162 case "$build_alias" in
163 "") build_alias=$optarg ;;
164 *) echo '***' Can only configure for one build machine at a time. 1>&2
173 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
175 disableoptions="$disableoptions $option"
183 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
184 eval "$enableopt='$optarg'"
185 enableoptions="$enableoptions '$option'"
187 --exec-prefix* | --ex*)
189 exec_prefixoption="--exec-prefix=$optarg"
199 NOHOST) host_alias=$optarg ;;
200 *) echo '***' Can only configure for one host at a time. 1>&2
207 floating_pointoption="--nfp"
209 --norecursion | --no*)
214 prefixoption="--prefix=$optarg"
216 --program-prefix* | --program-p*)
217 program_prefix=$optarg
218 program_prefixoption="--program-prefix=$optarg"
220 --program-suffix* | --program-s*)
221 program_suffix=$optarg
222 program_suffixoption="--program-suffix=$optarg"
224 --program-transform-name* | --program-t*)
225 # Double any backslashes or dollar signs in the argument
226 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
227 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
232 --silent | --sil* | --quiet | --q*)
233 redirect=">/dev/null"
238 site_option="--site=$optarg"
241 # Remove trailing slashes. Otherwise, when the file name gets
242 # bolted into an object file as debug info, it has two slashes
243 # in it. Ordinarily this is ok, but emacs takes double slash
244 # to mean "forget the first part".
245 srcdir=`echo $optarg | sed -e 's:/$::'`
251 case $target_alias in
252 NOTARGET) target_alias=$optarg ;;
253 *) echo '***' Can only configure for one target at a time. 1>&2
260 tmpdiroption="--tmpdir=$optarg"
262 --verbose | --v | --verb*)
266 --version | --V | --vers*)
267 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
276 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
277 eval $withopt="$optarg"
278 withoptions="$withoptions $option"
281 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
283 withoutoptions="$withoutoptions $option"
286 withoptions="$withoptions --with-x"
288 --x-i* | --x-l*) other_options="$other_options $orig_option"
290 --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
291 # These options were added to autoconf for emacs.
294 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
299 NOUNDEFS) undefs=$option ;;
300 *) echo '***' Can only configure for one host and one target at a time. 1>&2
308 # process host and target
310 # Do some error checking and defaulting for the host and target type.
312 # configure --host=HOST --target=TARGET UNDEFS
315 # 1. You aren't allowed to specify --host, --target, and undefs at the
317 # 2. Host defaults to undefs.
318 # 3. If undefs is not specified, then host defaults to the current host,
319 # as determined by config.guess.
320 # 4. Target defaults to undefs.
321 # 5. If undefs is not specified, then target defaults to host.
325 # Make sure that host, target & undefs aren't all specified at the
327 case $host_alias---$target_alias---$undefs in
328 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
330 *) echo '***' Can only configure for one host and one target at a time. 1>&2
336 # Now, do defaulting for host.
341 # Neither --host option nor undefs were present.
343 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
344 if host_alias=`${config_shell} ${guesssys}`
346 # If the string we are going to use for
347 # the target is a prefix of the string
348 # we just guessed for the host, then
349 # assume we are running native, and force
350 # the same string for both target and host.
351 case $target_alias in
354 if expr $host_alias : $target_alias >/dev/null
356 host_alias=$target_alias
360 echo "Configuring for a ${host_alias} host." 1>&2
361 arguments="--host=$host_alias $arguments"
363 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
369 arguments="--host=$host_alias $arguments"
375 # Do defaulting for target. If --target option isn't present, default
376 # to undefs. If undefs isn't present, default to host.
377 case $target_alias in
381 target_alias=$host_alias
385 arguments="--target=$target_alias $arguments"
393 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
395 echo Usage: configure [OPTIONS] [HOST]
397 echo Options: [defaults in brackets]
398 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
399 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
400 echo ' --help print this message [normal config]'
401 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
402 echo ' --host=HOST configure for HOST [determined via config.guess]'
403 echo ' --norecursion configure this directory only [recurse]'
404 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
405 echo ' --program-suffix=FOO append FOO to installed program names [""]'
406 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
407 echo ' --site=SITE configure with site-specific makefile for SITE'
408 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
409 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
410 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
411 echo ' --nfp configure for software floating point [hard float]'
412 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
413 echo ' --without-FOO package FOO is NOT available'
414 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
415 echo ' --disable-FOO do not include feature FOO'
417 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
419 if [ -r config.status ] ; then
426 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
427 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
429 # this is a hack. sun4 must always be a valid host alias or this will fail.
430 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
433 echo '***' cannot find config.sub. 1>&2
438 if ${config_shell} ${moveifchange} config.junk config.trash ; then
441 echo '***' cannot find move-if-change. 1>&2
444 rm -f config.junk config.trash
448 if [ -r configure.in ] ; then
451 if [ -r ${progname}.in ] ; then
452 srcdir=`echo ${progname} | sed 's:/configure$::'`
454 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
460 # Set srcdir to "." if that's what it is.
461 # This is important for multilib support.
462 if [ ! -d ${srcdir} ] ; then
463 echo "Invalid source directory ${srcdir}" >&2
467 srcpwd=`cd ${srcdir} ; pwd`
468 if [ "${pwd}" = "${srcpwd}" ] ; then
473 ### warn about some conflicting configurations.
478 if [ -f ${srcdir}/config.status ] ; then
479 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
484 # default exec_prefix
485 case "${exec_prefixoption}" in
486 "") exec_prefix="\$(prefix)" ;;
490 ### break up ${srcdir}/configure.in.
491 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
493 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
494 # Check for a directory that's been converted to use autoconf since
495 # it was last configured.
496 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
497 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
498 if [ -r ${srcdir}/configure ] ; then
499 echo '***' Running the local configure script. 1>&2
500 case "${cache_file}" in
501 "") cache_file_option= ;;
502 *) cache_file_option="--cache-file=${cache_file}" ;;
504 srcdiroption="--srcdir=${srcdir}"
505 case "${build_alias}" in
507 *) buildopt="--build=${build_alias}" ;;
509 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
510 ${buildopt} --host=${host_alias} --target=${target_alias} \
511 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
513 ${program_prefixoption} ${program_suffixoption} \
514 ${program_transform_nameoption} ${site_option} \
515 ${withoptions} ${withoutoptions} \
516 ${enableoptions} ${disableoptions} ${floating_pointoption} \
517 ${cache_file_option} ${removing} ${other_options} ${redirect}
519 echo '***' There is no configure script present though. 1>&2
527 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
529 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
536 "") TMPDIR=/tmp ; export TMPDIR ;;
540 # keep this filename short for &%*%$*# 14 char file names
541 tmpfile=${TMPDIR}/cONf$$
542 # Note that under many versions of sh a trap handler for 0 will *override* any
543 # exit status you explicitly specify! At this point, the only non-error exit
544 # is at the end of the script; these actions are duplicated there, minus
545 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
546 # trap handler, or you'll lose.
547 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
549 # split ${srcdir}/configure.in into common, per-host, per-target,
550 # and post-target parts. Post-target is optional.
551 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
552 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
553 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
554 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
555 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
557 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
561 ### do common part of configure.in
565 # some sanity checks on configure.in
566 case "${srctrigger}" in
568 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
574 case "${build_alias}" in
576 if result=`${config_shell} ${configsub} ${host_alias}` ; then
577 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
578 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
579 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
580 build=${build_cpu}-${build_vendor}-${build_os}
581 build_alias=${host_alias}
585 if result=`${config_shell} ${configsub} ${build_alias}` ; then
586 buildopt="--build=${build_alias}"
587 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
588 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
589 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
590 build=${build_cpu}-${build_vendor}-${build_os}
592 echo "Unrecognized build system name ${build_alias}." 1>&2
598 if result=`${config_shell} ${configsub} ${host_alias}` ; then
601 echo "Unrecognized host system name ${host_alias}." 1>&2
604 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
605 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
606 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
607 host=${host_cpu}-${host_vendor}-${host_os}
611 if result=`${config_shell} ${configsub} ${target_alias}` ; then
614 echo "Unrecognized target system name ${target_alias}." 1>&2
617 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
618 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
619 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
620 target=${target_cpu}-${target_vendor}-${target_os}
624 # Find the source files, if location was not specified.
629 if [ ! -r ${srctrigger} ] ; then
636 if [ ! -r ${srcdir}/${srctrigger} ] ; then
637 case "${srcdirdefaulted}" in
638 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
639 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
642 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
646 # Some systems (e.g., one of the i386-aix systems the gas testers are
647 # using) don't handle "\$" correctly, so don't use it here.
648 tooldir='$(exec_prefix)'/${target_alias}
650 if [ "${host_alias}" != "${target_alias}" ] ; then
651 if [ "${program_prefixoption}" = "" ] ; then
652 if [ "${program_suffixoption}" = "" ] ; then
653 if [ "${program_transform_nameoption}" = "" ] ; then
654 program_prefix=${target_alias}- ;
660 # Merge program_prefix and program_suffix onto program_transform_name.
661 # (program_suffix used to use $, but it's hard to preserve $ through both
663 if [ "${program_suffix}" != "" ] ; then
664 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
667 if [ "${program_prefix}" != "" ] ; then
668 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
671 # If CC and CXX are not set in the environment, and the Makefile
672 # exists, try to extract them from it. This is to handle running
673 # ./config.status by hand.
674 if [ -z "${CC}" -a -r Makefile ]; then
679 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
680 CC=`tail -1 Makefile.cc`
684 if [ -z "${CXX}" -a -r Makefile ]; then
689 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
690 CXX=`tail -1 Makefile.cc`
694 # Generate a default definition for YACC. This is used if the makefile can't
695 # locate bison or byacc in objdir.
697 for prog in 'bison -y' byacc yacc
699 set dummy $prog; tmp=$2
700 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
702 test -z "$dir" && dir=.
703 if test -f $dir/$tmp; then
710 test -n "$DEFAULT_YACC" && break
713 # Generate a default definition for LEX. This is used if the makefile can't
714 # locate flex in objdir.
718 set dummy $prog; tmp=$2
719 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
721 test -z "$dir" && dir=.
722 if test -f $dir/$tmp; then
729 test -n "$DEFAULT_LEX" && break
732 if [ "${build}" != "${host}" ]; then
733 # If we are doing a Canadian Cross, in which the host and build systems
734 # are not the same, we set reasonable default values for the tools.
736 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
737 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
738 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
739 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
740 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
742 for var in ${tools}; do
743 if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
748 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
749 < Makefile > Makefile.v
750 t=`tail -1 Makefile.v`
751 if [ -n "${t}" ]; then
758 AR=${AR-${host_alias}-ar}
759 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
760 AS=${AS-${host_alias}-as}
761 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
762 CC=${CC-${host_alias}-gcc}
763 CXX=${CXX-${host_alias}-c++}
764 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
765 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
766 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
767 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
768 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
769 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
770 HOST_PREFIX=${build_alias}-
771 HOST_PREFIX_1=${build_alias}-
772 LD=${LD-${host_alias}-ld}
773 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
774 MAKEINFO=${MAKEINFO-makeinfo}
775 NM=${NM-${host_alias}-nm}
776 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
777 RANLIB=${RANLIB-${host_alias}-ranlib}
778 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
780 if [ -z "${BISON}" ]; then
781 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
783 test -z "$dir" && dir=.
784 if test -f $dir/byacc; then
788 if test -f $dir/bison; then
792 if test -f $dir/yacc; then
801 if [ -z "${LEX}" ]; then
802 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
804 test -z "$dir" && dir=.
805 if test -f $dir/flex; then
809 if test -f $dir/lex; then
818 # Export variables which autoconf might try to set.
827 # If CC is still not set, try to get gcc.
828 if [ -z "${CC}" ]; then
829 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
831 test -z "$dir" && dir=.
832 if test -f $dir/gcc; then
854 # Determine whether gdb needs tk/tcl or not.
855 if [ "$enable_gdbtk" != "no" ]; then
856 GDB_TK="all-tcl all-tk"
861 for subdir in . ${subdirs} ; do
863 # ${subdir} is relative path from . to the directory we're currently
865 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
866 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
868 ### figure out what to do with srcdir
870 ".") # no -srcdir option. We're building in place.
873 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
875 *) # otherwise relative
877 .) makesrcdir=${srcdir} ;;
878 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
883 if [ "${subdir}/" != "./" ] ; then
884 Makefile=${subdir}/Makefile
887 if [ ! -d ${subdir} ] ; then
888 if mkdir ${subdir} ; then
891 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
896 case "${removing}" in
900 *) eval echo Building in ${subdir} ${redirect} ;;
903 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
904 # Set up the list of links to be made.
905 # ${links} is the list of link names, and ${files} is the list of names to link to.
908 configlinks="${links}"
909 if [ -r ${subdir}/config.status ] ; then
910 mv -f ${subdir}/config.status ${subdir}/config.back
912 while [ -n "${files}" ] ; do
913 # set file to car of files, files to cdr of files
914 set ${files}; file=$1; shift; files=$*
915 set ${links}; link=$1; shift; links=$*
917 if [ ! -r ${srcdir}/${file} ] ; then
918 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
919 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
924 # Make a symlink if possible, otherwise try a hard link
925 if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
928 # We need to re-remove the file because Lynx leaves a
929 # very strange directory there when it fails an NFS symlink.
930 ${remove} -r -f ${link}
931 ${hard_link} ${srcdir}/${file} ${link}
933 if [ ! -r ${link} ] ; then
934 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
938 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
941 # Create a .gdbinit file which runs the one in srcdir
942 # and tells GDB to look there for source files.
944 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
947 *) cat > ${subdir}/.gdbinit <<EOF
951 source ${makesrcdir}/.gdbinit
957 # Install a makefile, and make it set VPATH
958 # if necessary so that the sources are found.
959 # Also change its value of srcdir.
960 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
961 # been somewhat optimized and is perhaps a bit twisty.
963 # code is order so as to try to sed the smallest input files we know.
965 # the four makefile fragments MUST end up in the resulting Makefile in this order:
966 # package, target, host, and site. so do these separately because I don't trust the
967 # order of sed -e expressions.
969 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
971 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
972 rm -f ${subdir}/Makefile.tem
974 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
976 site_makefile_frag=${srcdir}/config/ms-${site}
978 if [ -f ${site_makefile_frag} ] ; then
979 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
980 > ${subdir}/Makefile.tem
982 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
987 # working copy now in ${subdir}/Makefile.tem
989 # Conditionalize the makefile for this host.
991 case "${host_makefile_frag}" in
992 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
994 if [ ! -f ${host_makefile_frag} ] ; then
995 host_makefile_frag=${srcdir}/${host_makefile_frag}
997 if [ -f ${host_makefile_frag} ] ; then
998 sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1000 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1001 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1002 mv ${subdir}/Makefile.tem ${Makefile}
1005 # working copy now in ${Makefile}
1007 # Conditionalize the makefile for this target.
1008 rm -f ${subdir}/Makefile.tem
1009 case "${target_makefile_frag}" in
1010 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1012 if [ ! -f ${target_makefile_frag} ] ; then
1013 target_makefile_frag=${srcdir}/${target_makefile_frag}
1015 if [ -f ${target_makefile_frag} ] ; then
1016 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1018 mv ${Makefile} ${subdir}/Makefile.tem
1019 target_makefile_frag=
1023 # real copy now in ${subdir}/Makefile.tem
1025 # Conditionalize the makefile for this package.
1027 case "${package_makefile_frag}" in
1028 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1030 if [ ! -f ${package_makefile_frag} ] ; then
1031 package_makefile_frag=${srcdir}/${package_makefile_frag}
1033 if [ -f ${package_makefile_frag} ] ; then
1034 sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1035 rm -f ${subdir}/Makefile.tem
1037 echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
1038 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1039 mv ${subdir}/Makefile.tem ${Makefile}
1042 # working copy now in ${Makefile}
1044 mv ${Makefile} ${subdir}/Makefile.tem
1046 # real copy now in ${subdir}/Makefile.tem
1048 # prepend warning about editting, and a bunch of variables.
1050 cat > ${Makefile} <<EOF
1052 VPATH = ${makesrcdir}
1053 links = ${configlinks}
1054 host_alias = ${host_alias}
1055 host_cpu = ${host_cpu}
1056 host_vendor = ${host_vendor}
1057 host_os = ${host_os}
1058 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1059 target_alias = ${target_alias}
1060 target_cpu = ${target_cpu}
1061 target_vendor = ${target_vendor}
1062 target_os = ${target_os}
1063 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1067 *) cat >> ${Makefile} << EOF
1068 build_alias = ${build_alias}
1069 build_cpu = ${build_cpu}
1070 build_vendor = ${build_vendor}
1071 build_os = ${build_os}
1072 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1076 case "${package_makefile_frag}" in
1078 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1079 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1082 case "${target_makefile_frag}" in
1084 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1085 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1088 case "${host_makefile_frag}" in
1090 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1091 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1094 if [ "${site_makefile_frag}" != "" ] ; then
1095 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1098 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1099 # remove any form feeds.
1100 if [ -z "${subdirs}" ]; then
1101 rm -f ${subdir}/Makefile.tem2
1102 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1103 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1104 ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
1105 rm -f ${subdir}/Makefile.tem
1106 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
1108 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1109 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
1115 s%^CC[ ]*=.*$%CC = ${CC}%
1122 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1124 -e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \
1125 -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" \
1126 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1128 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1129 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1130 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1131 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
1132 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1133 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1134 ${subdir}/Makefile.tem >> ${Makefile}
1136 # If this is a Canadian Cross, preset the values of many more
1138 if [ "${build}" != "${host}" ]; then
1139 for var in ${tools}; do
1140 val=`eval 'echo $'"${var}"`
1141 sed -e "/^${var}[ ]*=/{
1146 s%^${var}[ ]*=.*$%${var} = ${val}%
1147 }" ${Makefile} > ${Makefile}.tem
1148 mv -f ${Makefile}.tem ${Makefile}
1152 # final copy now in ${Makefile}
1155 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1158 rm -f ${subdir}/Makefile.tem
1160 case "${host_makefile_frag}" in
1162 *) using="and \"${host_makefile_frag}\"" ;;
1165 case "${target_makefile_frag}" in
1167 *) using="${using} and \"${target_makefile_frag}\"" ;;
1170 case "${site_makefile_frag}" in
1172 *) using="${using} and \"${site_makefile_frag}\"" ;;
1175 newusing=`echo "${using}" | sed 's/and/using/'`
1177 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1181 # describe the chosen configuration in config.status.
1182 # Make that file a shellscript which will reestablish
1183 # the same configuration. Used in Makefiles to rebuild
1186 case "${norecursion}" in
1187 "") arguments="${arguments} --norecursion" ;;
1191 if [ ${subdir} = . ] ; then
1194 # This directory was configured as follows:
1195 ${progname}" ${arguments} "
1196 # ${using}" > ${subdir}/config.new
1200 # This directory was configured as follows:
1202 ${progname}" ${arguments} "
1203 # ${using}" > ${subdir}/config.new
1205 chmod a+x ${subdir}/config.new
1206 if [ -r ${subdir}/config.back ] ; then
1207 mv -f ${subdir}/config.back ${subdir}/config.status
1209 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1212 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1216 # If there are subdirectories, then recur.
1217 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
1218 for configdir in ${configdirs} ; do
1220 if [ -d ${srcdir}/${configdir} ] ; then
1221 eval echo Configuring ${configdir}... ${redirect}
1225 if [ ! -d ./${configdir} ] ; then
1226 if mkdir ./${configdir} ; then
1229 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1239 ### figure out what to do with srcdir
1241 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1243 newsrcdir=${srcdir}/${configdir}
1244 srcdiroption="--srcdir=${newsrcdir}"
1246 ?:*) # absolute path on win32
1247 newsrcdir=${srcdir}/${configdir}
1248 srcdiroption="--srcdir=${newsrcdir}"
1250 *) # otherwise relative
1251 newsrcdir=../${srcdir}/${configdir}
1252 srcdiroption="--srcdir=${newsrcdir}"
1256 # Handle --cache-file=../XXX
1257 case "${cache_file}" in
1261 cache_file_option="--cache-file=${cache_file}"
1263 ?:*) # absolute path on win32
1264 cache_file_option="--cache-file=${cache_file}"
1267 cache_file_option="--cache-file=../${cache_file}"
1271 ### check for guested configure, otherwise fix possibly relative progname
1272 if [ -f ${newsrcdir}/configure ] ; then
1273 recprog=${newsrcdir}/configure
1274 elif [ -f ${newsrcdir}/configure.in ] ; then
1275 case "${progname}" in
1276 /*) recprog=${progname} ;;
1277 ?:*) recprog=${progname} ;;
1278 *) recprog=../${progname} ;;
1281 eval echo No configuration information in ${configdir} ${redirect}
1285 ### The recursion line is here.
1286 if [ ! -z "${recprog}" ] ; then
1287 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1288 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1289 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1292 echo Configure in `pwd` failed, exiting. 1>&2
1302 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1303 # and reset the trap handler.
1304 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos