* configure: Rebuild with autoconf 2.12.
[deliverable/binutils-gdb.git] / configure
index 7508ae09cf8d34dd64245d6f2e50f444fedaa727..83a3bf9d908dcc5d6e0db554d4d9187d338116df 100755 (executable)
--- a/configure
+++ b/configure
 # 
 # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# Please email any bugs, comments, and/or additions to this file to:
-# configure@cygnus.com
-
-# This file was written by K. Richard Pixley.
+# This file was originally written by K. Richard Pixley.
 
 #
 # Shell script to create proper links to machine-dependent files in
@@ -48,8 +45,10 @@ symbolic_link='ln -s'
 
 Makefile=Makefile
 Makefile_in=Makefile.in
-arguments=$*
+arguments=
 build_alias=
+cache_file=
+cache_file_option=
 configdirs=
 exec_prefix=
 exec_prefixoption=
@@ -138,19 +137,27 @@ do
        case $option in
        --*=*)
                optarg=`echo $option | sed -e 's/^[^=]*=//'`
+               arguments="$arguments $option"
                ;;
 # 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*)
+       --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*)
                optarg=$1
                shift
+               arguments="$arguments $option=$optarg"
+               ;;
+       --v)
+               arguments="$arguments -v"
+               ;;
+       --*)
+               arguments="$arguments $option"
                ;;
        esac
 
 # Now, process the options
        case $option in
 
-       --build* | --b*)
+       --build* | --bu*)
                case "$build_alias" in
                "") build_alias=$optarg ;;
                *) echo '***' Can only configure for one build machine at a time.  1>&2
@@ -158,6 +165,9 @@ do
                   ;;
                esac
                ;;
+       --cache*)
+               cache_file=$optarg
+               ;;
        --disable-*)
                enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
                eval $enableopt=no
@@ -170,8 +180,8 @@ do
                esac
 
                enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
-               eval $enableopt="$optarg"
-               enableoptions="$enableoptions $option"
+               eval "$enableopt='$optarg'"
+               enableoptions="$enableoptions '$option'"
                ;;
        --exec-prefix* | --ex*)
                exec_prefix=$optarg
@@ -193,6 +203,7 @@ do
                ;;
        --nfp | --nf*)
                floating_point=no
+               floating_pointoption="--nfp"
                ;;
        --norecursion | --no*)
                norecursion=yes
@@ -212,7 +223,7 @@ 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
@@ -273,11 +284,14 @@ do
        --x)    with_x=yes
                withoptions="$withoptions --with-x"
                ;;
+       --x-i* | --x-l*) other_options="$other_options $orig_option"
+               ;;
+       --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
+               # These options were added to autoconf for emacs.
+               ;;
        --*)
-               echo "Warning: Unrecognized option: \"$orig_option\"". >&2
-               # Pass the option to any configure scripts in subdirectories
-               # in case they recognize it.
-               other_options="$other_options $orig_option"
+               echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+               exit 1
                ;;
        *)
                case $undefs in
@@ -326,8 +340,22 @@ case "${fatal}" in
                        # Neither --host option nor undefs were present.
                        # Call config.guess.
                        guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
-                       if host_alias=`${guesssys}`
+                       if host_alias=`${config_shell} ${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
@@ -337,6 +365,8 @@ case "${fatal}" in
                        ;;
                *)
                        host_alias=$undefs
+                       arguments="--host=$host_alias $arguments"
+                       undefs=NOUNDEFS
                        ;;
                esac
        esac
@@ -351,6 +381,7 @@ case "${fatal}" in
                        ;;
                *)
                        target_alias=$undefs
+                       arguments="--target=$target_alias $arguments"
                        ;;
                esac
        esac
@@ -360,29 +391,29 @@ 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 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
@@ -395,7 +426,7 @@ configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
 
 # this is a hack.  sun4 must always be a valid host alias or this will fail.
-if ${configsub} sun4 >/dev/null 2>&1 ; then
+if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
         true
 else
         echo '***' cannot find config.sub.  1>&2
@@ -403,7 +434,7 @@ else
 fi
 
 touch config.junk
-if ${moveifchange} config.junk config.trash ; then
+if ${config_shell} ${moveifchange} config.junk config.trash ; then
         true
 else
         echo '***' cannot find move-if-change.  1>&2
@@ -424,7 +455,18 @@ case "${srcdir}" in
                 fi
         fi
         ;;
-*) ;;
+*)
+       # Set srcdir to "." if that's what it is.
+       # This is important for multilib support.
+       if [ ! -d ${srcdir} ] ; then
+               echo "Invalid source directory ${srcdir}" >&2
+               exit 1
+       fi
+       pwd=`pwd`
+       srcpwd=`cd ${srcdir} ; pwd`
+       if [ "${pwd}" = "${srcpwd}" ] ; then
+               srcdir=.
+       fi
 esac
 
 ### warn about some conflicting configurations.
@@ -439,7 +481,7 @@ case "${srcdir}" in
 esac
 
 # default exec_prefix
-case "${exec_prefix}" in
+case "${exec_prefixoption}" in
 "") exec_prefix="\$(prefix)" ;;
 *) ;;
 esac
@@ -448,6 +490,34 @@ 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} ${floating_pointoption} \
+               ${cache_file_option} ${removing} ${other_options} ${redirect}
+         else
+           echo '***' There is no configure script present though. 1>&2
+         fi
+       fi
         exit 1
         ;;
 *) ;;
@@ -468,7 +538,12 @@ esac
 
 # 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 Makefile.tem ${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.
@@ -496,29 +571,51 @@ case "${srctrigger}" in
 esac
 
 case "${build_alias}" in
-"")    ;;
+"")
+       if result=`${config_shell} ${configsub} ${host_alias}` ; then
+           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}
+           build_alias=${host_alias}
+       fi
+       ;;
 *)
-       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}`
-host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+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/'`
 host=${host_cpu}-${host_vendor}-${host_os}
 
 . ${tmpfile}.hst
 
-result=`${configsub} ${target_alias}`
-target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+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/'`
 target=${target_cpu}-${target_vendor}-${target_os}
 
 . ${tmpfile}.tgt
@@ -559,16 +656,206 @@ if [ "${host_alias}" != "${target_alias}" ] ; then
     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
     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
 fi
 
+# If CC and CXX are not set in the environment, and the Makefile
+# exists, try to extract them from it.  This is to handle running
+# ./config.status by hand.
+if [ -z "${CC}" -a -r Makefile ]; then
+  sed -n -e ':loop
+/\\$/ N
+s/\\\n//g
+t loop
+/^CC[  ]*=/ s/CC[      ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
+  CC=`tail -1 Makefile.cc`
+  rm -f Makefile.cc
+fi
+
+if [ -z "${CXX}" -a -r Makefile ]; then
+  sed -n -e ':loop
+/\\$/ N
+s/\\\n//g
+t loop
+/^CXX[         ]*=/ s/CXX[     ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
+  CXX=`tail -1 Makefile.cc`
+  rm -f Makefile.cc
+fi
+
+# Generate a default definition for YACC.  This is used if the makefile can't
+# locate bison or byacc in objdir.
+
+for prog in 'bison -y' byacc yacc
+do
+  set dummy $prog; tmp=$2
+  IFS="${IFS=  }"; save_ifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$tmp; then
+      DEFAULT_YACC="$prog"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  test -n "$DEFAULT_YACC" && break
+done
+
+# Generate a default definition for LEX.  This is used if the makefile can't
+# locate flex in objdir.
+
+for prog in flex lex
+do
+  set dummy $prog; tmp=$2
+  IFS="${IFS=  }"; save_ifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$tmp; then
+      DEFAULT_LEX="$prog"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  test -n "$DEFAULT_LEX" && break
+done
+
+if [ "${build}" != "${host}" ]; then
+  # If we are doing a Canadian Cross, in which the host and build systems
+  # are not the same, we set reasonable default values for the tools.
+
+  tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
+  tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
+  tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET HOST_PREFIX"
+  tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
+  tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
+
+  for var in ${tools}; do
+    if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
+      sed -n -e ':loop
+/\\$/ N
+s/\\\n//g
+t loop
+/^'"${var}"'[  ]*=/ s/'"${var}"'[      ]*=[    ]*\(.*\)/\1/p' \
+       < Makefile > Makefile.v
+      t=`tail -1 Makefile.v`
+      if [ -n "${t}" ]; then
+       eval "${var}='${t}'"
+      fi
+      rm -f Makefile.v
+    fi
+  done
+
+  AR=${AR-${host_alias}-ar}
+  AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
+  AS=${AS-${host_alias}-as}
+  AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
+  CC=${CC-${host_alias}-gcc}
+  CXX=${CXX-${host_alias}-gcc}
+  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
+  CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
+  CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-gcc}
+  DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
+  DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
+  HOST_PREFIX=${build_alias}-
+  HOST_PREFIX_1=${build_alias}-
+  LD=${LD-${host_alias}-ld}
+  LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
+  MAKEINFO=${MAKEINFO-makeinfo}
+  NM=${NM-${host_alias}-nm}
+  NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
+  RANLIB=${RANLIB-${host_alias}-ranlib}
+  RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
+
+  if [ -z "${BISON}" ]; then
+    IFS="${IFS=        }"; save_ifs="$IFS"; IFS="${IFS}:"
+    for dir in $PATH; do
+      test -z "$dir" && dir=.
+      if test -f $dir/byacc; then
+       BISON=byacc
+       break
+      fi
+      if test -f $dir/bison; then
+       BISON=bison
+       break
+      fi
+      if test -f $dir/yacc; then
+       BISON=yacc
+       break
+      fi
+    done
+    IFS="$save_ifs"
+    BISON=${BISON-bison}
+  fi
+
+  if [ -z "${LEX}" ]; then
+    IFS="${IFS=        }"; save_ifs="$IFS"; IFS="${IFS}:"
+    for dir in $PATH; do
+      test -z "$dir" && dir=.
+      if test -f $dir/flex; then
+       LEX=flex
+       break
+      fi
+      if test -f $dir/lex; then
+       LEX=lex
+       break
+      fi
+    done
+    IFS="$save_ifs"
+    LEX=${LEX-flex}
+  fi
+
+  # Export variables which autoconf might try to set.
+  export AS
+  export AR
+  export CC_FOR_BUILD
+  export DLLTOOL
+  export LD
+  export NM
+  export RANLIB
+else
+  # If CC is still not set, try to get gcc.
+  if [ -z "${CC}" ]; then
+    IFS="${IFS=        }"; save_ifs="$IFS"; IFS="${IFS}:"
+    for dir in $PATH; do
+      test -z "$dir" && dir=.
+      if test -f $dir/gcc; then
+       CC="gcc -O2"
+       break
+      fi
+    done
+    IFS="$save_ifs"
+    CC=${CC-cc}
+  fi
+
+  CXX=${CXX-"gcc"}
+fi
+
+export CC
+export CXX
+
+case "$host" in
+       *go32*)
+           enable_gdbtk=no ;;
+       *cygwin32*)
+           enable_gdbtk=no ;;
+esac
+
+# Determine whether gdb needs tk/tcl or not.
+if [ "$enable_gdbtk" != "no" ]; then
+       GDB_TK="all-tcl all-tk"
+else
+       GDB_TK=""
+fi
+
 for subdir in . ${subdirs} ; do
 
     # ${subdir} is relative path from . to the directory we're currently
@@ -632,9 +919,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
@@ -651,8 +944,8 @@ for subdir in . ${subdirs} ; do
                 .) ;;
                 *) cat > ${subdir}/.gdbinit <<EOF
 # ${NO_EDIT}
-dir .
 dir ${makesrcdir}
+dir .
 source ${makesrcdir}/.gdbinit
 EOF
                         ;;
@@ -737,6 +1030,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
@@ -799,11 +1093,6 @@ EOF
                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
             fi 
 
-           # make sure that some sort of reasonable default exists for these 
-           # two variables
-           CXX=${CXX-"g++ -O"}
-           CC=${CC-cc}
-
             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
             # remove any form feeds.
             if [ -z "${subdirs}" ]; then
@@ -816,14 +1105,48 @@ EOF
             fi
             sed -e "s:^prefix[         ]*=.*$:prefix = ${prefix}:" \
                     -e "s:^exec_prefix[        ]*=.*$:exec_prefix = ${exec_prefix}:" \
+                   -e "/^CC[   ]*=/{
+                       :loop1
+                       /\\\\$/ N
+                       s/\\\\\\n//g
+                       t loop1
+                       s%^CC[  ]*=.*$%CC = ${CC}%
+                       }" \
+                   -e "/^CXX[  ]*=/{
+                       :loop2
+                       /\\\\$/ N
+                       s/\\\\\\n//g
+                       t loop2
+                       s%^CXX[         ]*=.*$%CXX = ${CXX}%
+                       }" \
                    -e "s:^SHELL[        ]*=.*$:SHELL = ${config_shell}:" \
+                   -e "s:^GDB_TK[       ]*=.*$:GDB_TK = ${GDB_TK}:" \
                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
                     -e "s/\f//" \
                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
                     -e "s:^tooldir[    ]*=.*$:tooldir = ${tooldir}:" \
+                   -e "s:^DEFAULT_YACC[         ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
+                   -e "s:^DEFAULT_LEX[  ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
                     ${subdir}/Makefile.tem >> ${Makefile}
+
+           # If this is a Canadian Cross, preset the values of many more
+           # tools.
+           if [ "${build}" != "${host}" ]; then
+               for var in ${tools}; do
+                   val=`eval 'echo $'"${var}"`
+                   sed -e "/^${var}[   ]*=/{
+                          :loop1
+                          /\\\\$/ N
+                          /\\\\$/ b loop1
+                          s/\\\\\\n//g
+                          s%^${var}[   ]*=.*$%${var} = ${val}%
+                          }" ${Makefile} > ${Makefile}.tem
+                   mv -f ${Makefile}.tem ${Makefile}
+               done
+           fi
+
             # final copy now in ${Makefile}
 
         else
@@ -924,6 +1247,18 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
                                 ;;
                         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
@@ -941,7 +1276,7 @@ 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} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
+                                       ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
                                        true
                                else
                                        echo Configure in `pwd` failed, exiting. 1>&2
@@ -954,6 +1289,11 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
         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
 
 #
This page took 0.033415 seconds and 4 git commands to generate.