### WARNING: this file contains embedded tabs. Do not run untabify on this file.
# Configuration script
-# Copyright (C) 1988, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+# Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-# Please email any bugs, comments, and/or additions to this file to:
+# Please report any problems running this configure script to
+# Please do not send reports about other problems to this address. See
+# gdb/README, gas/README, etc., for info on where and how to report
+# problems about particular tools.
# This file was written by K. Richard Pixley.
Makefile_in=Makefile.in
arguments=$*
build_alias=
+cache_file=
+cache_file_option=
configdirs=
exec_prefix=
exec_prefixoption=
host_makefile_frag=
moveifchange=
norecursion=
+other_options=
package_makefile_frag=
prefix=/usr/local
progname=
;;
# These options have mandatory values. Since we didn't find an = sign,
# the value must be in the next argument
- --b* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm*)
+ --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
optarg=$1
shift
;;
;;
esac
;;
+ --cache*)
+ cache_file=$optarg
+ ;;
+ --disable-*)
+ enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
+ eval $enableopt=no
+ disableoptions="$disableoptions $option"
+ ;;
--enable-*)
case "$option" in
*=*) ;;
--program-transform-name* | --program-t*)
# Double any backslashes or dollar signs in the argument
program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
- program_transform_nameoption="--program-transform-nameoption='$optarg'"
+ program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
;;
--rm)
removing=--rm
;;
- --site* | --si*)
+ --silent | --sil* | --quiet | --q*)
+ redirect=">/dev/null"
+ verbose=--silent
+ ;;
+ --site* | --sit*)
site=$optarg
site_option="--site=$optarg"
;;
--srcdir*/ | --sr*/)
# Remove trailing slashes. Otherwise, when the file name gets
- # bolted into an object file as debug info, it has two slashes in
- # it. Ordinarily this is ok, but emacs takes double slash to
- # mean "forget the first part".
+ # bolted into an object file as debug info, it has two slashes
+ # in it. Ordinarily this is ok, but emacs takes double slash
+ # to mean "forget the first part".
srcdir=`echo $optarg | sed -e 's:/$::'`
;;
--srcdir* | --sr*)
withoptions="$withoptions $option"
;;
--without-*)
- withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
+ withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
eval $withopt=no
withoutoptions="$withoutoptions $option"
;;
- --x) ;;
+ --x) with_x=yes
+ withoptions="$withoptions --with-x"
+ ;;
+ --x-i* | --x-l*) other_options="$other_options $orig_option"
+ ;;
--*)
- exec 1>&2
- echo
- echo "Unrecognized option: \"$orig_option\"".
- echo
- fatal=yes
+ echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+ exit 1
;;
*)
case $undefs in
guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
if host_alias=`${guesssys}`
then
+ # If the string we are going to use for
+ # the target is a prefix of the string
+ # we just guessed for the host, then
+ # assume we are running native, and force
+ # the same string for both target and host.
+ case $target_alias in
+ NOTARGET) ;;
+ *)
+ if expr $host_alias : $target_alias >/dev/null
+ then
+ host_alias=$target_alias
+ fi
+ ;;
+ esac
echo "Configuring for a ${host_alias} host." 1>&2
arguments="--host=$host_alias $arguments"
else
if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
exec 1>&2
- echo Usage: configure HOST
+ echo Usage: configure [OPTIONS] [HOST]
echo
echo Options: [defaults in brackets]
- echo ' --prefix=MYDIR configure for installation of host independent files into MYDIR. ["/usr/local"]'
- echo ' --exec-prefix=MYDIR configure for installation of host dependent files into MYDIR. ["/usr/local"]'
- echo ' --help print this message. [normal config]'
- echo ' --build=BUILD configure for building on BUILD. [BUILD=HOST]'
- echo ' --host=HOST configure for HOST. [determined via config.guess]'
- echo ' --norecursion configure this directory only. [recurse]'
- echo ' --program-prefix=FOO install programs with FOO prepended to their names. [ "" ]'
- echo ' --program-suffix=FOO install programs with FOO appended to their names. [ "" ]'
- echo ' --program-transform-name=FOO install programs with names transformed by sed pattern FOO. [ "" ]'
- echo ' --site=SITE configure with site specific makefile for SITE'
- echo ' --srcdir=DIR find the sources in DIR. ["." or ".."]'
- echo ' --target=TARGET configure for TARGET. [TARGET = HOST]'
- echo ' --tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = "/tmp" ]'
- echo ' --nfp configure the compilers default to soft floating point. [hard float]'
+ echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
+ echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
+ echo ' --help print this message [normal config]'
+ echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
+ echo ' --host=HOST configure for HOST [determined via config.guess]'
+ echo ' --norecursion configure this directory only [recurse]'
+ echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
+ echo ' --program-suffix=FOO append FOO to installed program names [""]'
+ echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
+ echo ' --site=SITE configure with site-specific makefile for SITE'
+ echo ' --srcdir=DIR find the sources in DIR [. or ..]'
+ echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
+ echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
+ echo ' --nfp configure for software floating point [hard float]'
echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
echo ' --without-FOO package FOO is NOT available'
echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
+ echo ' --disable-FOO do not include feature FOO'
echo
- echo 'Where HOST and TARGET are something like "vax", "sun3", "encore", etc.'
+ echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
echo
if [ -r config.status ] ; then
cat config.status
esac
# default exec_prefix
-case "${exec_prefix}" in
+case "${exec_prefixoption}" in
"") exec_prefix="\$(prefix)" ;;
*) ;;
esac
case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
"")
echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
+ # Check for a directory that's been converted to use autoconf since
+ # it was last configured.
+ if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
+ echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
+ if [ -r ${srcdir}/configure ] ; then
+ echo '***' Running the local configure script. 1>&2
+ case "${cache_file}" in
+ "") cache_file_option= ;;
+ *) cache_file_option="--cache-file=${cache_file}" ;;
+ esac
+ srcdiroption="--srcdir=${srcdir}"
+ case "${build_alias}" in
+ "") buildopt= ;;
+ *) buildopt="--build=${build_alias}" ;;
+ esac
+ eval exec ${config_shell} ${srcdir}/configure ${verbose} \
+ ${buildopt} --host=${host_alias} --target=${target_alias} \
+ ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
+ ${srcdiroption} \
+ ${program_prefixoption} ${program_suffixoption} \
+ ${program_transform_nameoption} ${site_option} \
+ ${withoptions} ${withoutoptions} \
+ ${enableoptions} ${disableoptions} \
+ ${cache_file_option} ${removing} ${other_options} ${redirect}
+ else
+ echo '***' There is no configure script present though. 1>&2
+ fi
+ fi
exit 1
;;
*) ;;
# keep this filename short for &%*%$*# 14 char file names
tmpfile=${TMPDIR}/cONf$$
-trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
+# Note that under many versions of sh a trap handler for 0 will *override* any
+# exit status you explicitly specify! At this point, the only non-error exit
+# is at the end of the script; these actions are duplicated there, minus
+# the "exit 1". Don't use "exit 0" anywhere after this without resetting the
+# trap handler, or you'll lose.
+trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
# split ${srcdir}/configure.in into common, per-host, per-target,
# and post-target parts. Post-target is optional.
case "${build_alias}" in
"") ;;
*)
- result=`${configsub} ${build_alias}`
- buildopt="--build=${build_alias}"
- build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
- build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
- build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
- build=${build_cpu}-${build_vendor}-${build_os}
+ if result=`${config_shell} ${configsub} ${build_alias}` ; then
+ buildopt="--build=${build_alias}"
+ build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+ build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+ build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+ build=${build_cpu}-${build_vendor}-${build_os}
+ else
+ echo "Unrecognized build system name ${build_alias}." 1>&2
+ exit 1
+ fi
;;
esac
-result=`${configsub} ${host_alias}`
+if result=`${config_shell} ${configsub} ${host_alias}` ; then
+ true
+else
+ echo "Unrecognized host system name ${host_alias}." 1>&2
+ exit 1
+fi
host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
. ${tmpfile}.hst
-result=`${configsub} ${target_alias}`
+if result=`${config_shell} ${configsub} ${target_alias}` ; then
+ true
+else
+ echo "Unrecognized target system name ${target_alias}." 1>&2
+ exit 1
+fi
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
fi
fi
-# Merge program_prefix and program_suffix onto program_transform_name
-# Use a double $ so that make ignores it
+# Merge program_prefix and program_suffix onto program_transform_name.
+# (program_suffix used to use $, but it's hard to preserve $ through both
+# make and sh.)
if [ "${program_suffix}" != "" ] ; then
- program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
+ program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
fi
if [ "${program_prefix}" != "" ] ; then
fi
${remove} -f ${link}
- # Make a symlink if possible, otherwise try a hard link
- ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
-
+ # Make a symlink if possible, otherwise try a hard link
+ if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
+ true
+ else
+ # We need to re-remove the file because Lynx leaves a
+ # very strange directory there when it fails an NFS symlink.
+ ${remove} -r -f ${link}
+ ${hard_link} ${srcdir}/${file} ${link}
+ fi
if [ ! -r ${link} ] ; then
echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
exit 1
.) ;;
*) cat > ${subdir}/.gdbinit <<EOF
# ${NO_EDIT}
-dir .
dir ${makesrcdir}
+dir .
source ${makesrcdir}/.gdbinit
EOF
;;
fi
if [ -f ${package_makefile_frag} ] ; then
sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
+ rm -f ${subdir}/Makefile.tem
else
echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
echo '***' is missing in ${PWD=`pwd`}. 1>&2
;;
esac
+ # Handle --cache-file=../XXX
+ case "${cache_file}" in
+ "") # empty
+ ;;
+ /*) # absolute path
+ cache_file_option="--cache-file=${cache_file}"
+ ;;
+ *) # relative path
+ cache_file_option="--cache-file=../${cache_file}"
+ ;;
+ esac
+
### check for guested configure, otherwise fix possibly relative progname
if [ -f ${newsrcdir}/configure ] ; then
recprog=${newsrcdir}/configure
if [ ! -z "${recprog}" ] ; then
if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
- ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${removing} ${redirect} ; then
+ ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
true
else
echo Configure in `pwd` failed, exiting. 1>&2
done
fi
+# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
+# and reset the trap handler.
+rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
+trap 0
+
exit 0
#