* scripttempl/i960.sc: Add CONSTRUCTORS to .data.
[binutils-gdb.git] / configure
index 8676d3ba1321f0c66e3289778b13618dfd64237a..65185c2f44db8cdee91cfb311bcc3c657dcf53f5 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,7 +3,7 @@
 ### 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
@@ -17,7 +17,7 @@
 # 
 # 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:
 # configure@cygnus.com
@@ -60,6 +60,7 @@ host_alias=NOHOST
 host_makefile_frag=
 moveifchange=
 norecursion=
+other_options=
 package_makefile_frag=
 prefix=/usr/local
 progname=
@@ -118,7 +119,7 @@ do
 # Break out if there are no more args
        case $# in
        0)
-               break 2
+               break
                ;;
        esac
 
@@ -140,7 +141,7 @@ do
                ;;
 # These options have mandatory values.  Since we didn't find an = sign,
 # the value must be in the next argument
-       --b* | --e* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm*)
+       --b* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
                optarg=$1
                shift
                ;;
@@ -157,7 +158,22 @@ do
                   ;;
                esac
                ;;
-       --exec-prefix* | --e*)
+       --disable-*)
+               enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
+               eval $enableopt=no
+               disableoptions="$disableoptions $option"
+               ;;
+       --enable-*)
+               case "$option" in
+               *=*)    ;;
+               *)      optarg=yes ;;
+               esac
+
+               enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
+               eval $enableopt="$optarg"
+               enableoptions="$enableoptions $option"
+               ;;
+       --exec-prefix* | --ex*)
                exec_prefix=$optarg
                exec_prefixoption="--exec-prefix=$optarg"
                ;;
@@ -165,7 +181,7 @@ do
                gas=yes
                ;;
        --help | --he*)
-               fatal=true
+               fatal=yes
                ;;
        --host* | --ho*)
                case $host_alias in
@@ -179,7 +195,7 @@ do
                floating_point=no
                ;;
        --norecursion | --no*)
-               norecursion=true
+               norecursion=yes
                ;;
        --prefix* | --pre*)
                prefix=$optarg
@@ -196,20 +212,24 @@ do
        --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*)
@@ -246,17 +266,18 @@ do
                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=true
+               echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+               exit 1
                ;;
        *)
                case $undefs in
@@ -271,22 +292,18 @@ done
 
 # process host and target
 
-# The following section does some error checking, and then does defaulting for
-# the host and target.  The inputs are host, which comes from the --host
-# option, target, which comes from the --target options, and undefs, which is
-# an argument that isn't an option (cuz it doesn't start with --).  Ie:
-#      configure --host HOST --target TARGET --opt1 UNDEFS --opt2 --opt3 ...
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET UNDEFS
 #
-# The first rule is that you aren't allowed to specify --host, --target and
-# undefs at the same time.  After that, we do defaulting.  The host defaults to
-# undefs.  Ie:
-#      configure --target TARGET --opt1 HOST --opt2
-#
-# If there are no undefs, the host defaults to the current host (as determined
-# by config.guess).
-#
-# Target defaults to undefs.  If undefs wasn't specified, then it defaults to
-# host.
+# The rules are:
+# 1. You aren't allowed to specify --host, --target, and undefs at the
+#    same time.
+# 2. Host defaults to undefs.
+# 3. If undefs is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target defaults to undefs.
+# 5. If undefs is not specified, then target defaults to host.
 
 case "${fatal}" in
 "")
@@ -311,6 +328,30 @@ case "${fatal}" 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)
+                                       case $undefs in
+                                       NOUNDEFS) ;;
+                                       *)
+                                           if expr $host_alias : $undefs >/dev/null
+                                           then
+                                               host_alias=$undefs
+                                           fi
+                                           ;;
+                                       esac
+                                       ;;
+                               *)
+                                       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
@@ -343,10 +384,10 @@ esac
 
 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 dependent files into MYDIR. ["/usr/local"]'
+       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]'
@@ -360,10 +401,12 @@ if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
        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 ' --with-FOO, --with-FOO=BAR specify that FOO is available'
-       echo ' --without-FOO             specify that FOO is NOT available'
+       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 "sun4", "decstation", "encore", etc.'
        echo
        if [ -r config.status ] ; then
                cat config.status
@@ -613,9 +656,15 @@ for subdir in . ${subdirs} ; do
                 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
@@ -718,6 +767,7 @@ 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
@@ -922,9 +972,10 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
                        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} ${removing} ${redirect} ; then
+                                       ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
                                        true
                                else
+                                       echo Configure in `pwd` failed, exiting. 1>&2
                                        exit 1
                                fi
                        fi