OSDN Git Service

libstdc++/7445
[pf3gnuchains/gcc-fork.git] / configure.in
index 261b13c..21b86fd 100644 (file)
@@ -49,7 +49,7 @@ libstdcxx_version="target-libstdc++-v3"
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
 # know that we are building the simulator.
-host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl inet gawk findutils snavigator libtool gettext zip fastjar"
+host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator libtool gettext zip fastjar"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -76,26 +76,10 @@ target_libs="target-libiberty \
 # list belongs in this list.  those programs are also very likely
 # candidates for the "native_only" list which follows
 #
-target_tools="target-examples target-groff target-gperf"
+target_tools="target-examples target-groff target-gperf target-rda"
 
 ################################################################################
 
-## These two lists are of directories that are to be removed from the
-## ${configdirs} list for either cross-compilations or for native-
-## compilations.  For example, it doesn't make that much sense to
-## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
-## a native environment.  
-
-# directories to be built in the native environment only
-#
-# This must be a single line because of the way it is searched by grep in
-# the code below.
-native_only="autoconf automake libtool cvssrc fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl inet time ash bash bzip2 prms snavigator gnuserv target-gperf"
-
-# directories to be built in a cross environment only
-#
-cross_only="target-libgloss target-newlib target-cygmon target-opcodes target-libstub"
-
 ## All tools belong in one of the four categories, and are assigned above
 ## We assign ${configdirs} this way to remove all embedded newlines.  This
 ## is important because configure will choke if they ever get through.
@@ -175,13 +159,21 @@ fi
 
 case ${with_x} in
   yes | "") ;; # the default value for this tree is that X11 is available
-  no)  skipdirs="${skipdirs} tk libgui" ;;
+  no)
+    skipdirs="${skipdirs} tk tix itcl libgui"
+    # We won't be able to build gdbtk without X.
+    enable_gdbtk=no 
+    ;;
   *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
 esac
 
 # Some tools are only suitable for building in a "native" situation.
-# Remove these if host!=target.  Similarly, some are only suitable
-# for cross toolchains; remove if host=target.
+# Remove these if host!=target.  
+native_only="autoconf automake libtool fileutils find gawk gettext grep gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms snavigator gnuserv target-gperf"
+
+# Similarly, some are only suitable for cross toolchains.
+# Remove these if host=target.
+cross_only="target-libgloss target-newlib target-opcodes"
 
 case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
@@ -222,26 +214,26 @@ case "${host}" in
     noconfigdirs="$noconfigdirs byacc"
     ;;
   i[3456]86-*-vsta)
-    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl inet itcl tix db snavigator gnuserv gettext"
+    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv gettext"
     ;;
   i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
-    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile inet itcl tix db snavigator gnuserv libffi"
+    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix db snavigator gnuserv libffi"
        ;;
   i[3456]86-*-mingw32*)
-    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl inet itcl tix db snavigator gnuserv"
-     noconfigdirs="expect dejagnu cvs autoconf automake send-pr rcs guile perl texinfo inet libtool"
+    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv"
+     noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool"
        ;;
   i[3456]86-*-beos*)
      noconfigdirs="$noconfigdirs tk itcl tix libgui gdb"
      ;;
   *-*-cygwin*)
-     noconfigdirs="autoconf automake send-pr rcs guile perl inet"
+     noconfigdirs="autoconf automake send-pr rcs guile perl"
     ;;
   *-*-netbsd*)
     noconfigdirs="rcs"
     ;;
   ppc*-*-pe)
-     noconfigdirs="patch diff make tk tcl expect dejagnu cvssrc autoconf automake texinfo bison send-pr gprof rcs guile perl inet itcl tix db snavigator gnuserv"
+     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix db snavigator gnuserv"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
@@ -273,7 +265,7 @@ case "${target}" in
     ;;
   *-*-netbsd*)
     # Skip some stuff on all NetBSD configurations.
-    skipdirs="$skipdirs target-newlib target-libiberty target-libgloss"
+    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
 
     # Skip some stuff that's unsupported on some NetBSD configurations.
     case "${target}" in
@@ -329,7 +321,7 @@ case "${target}" in
     noconfigdirs="$noconfigdirs expect dejagnu"
     # the C++ libraries don't build on top of CE's C libraries
     noconfigdirs="$noconfigdirs ${libstdcxx_version}"
-    skipdirs="$skipdirs target-newlib"
+    noconfigdirs="$noconfigdirs target-newlib"
     case "${host}" in
       *-*-cygwin*) ;; # keep gdb and readline
       *) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}"
@@ -339,6 +331,12 @@ case "${target}" in
   arc-*-*)
     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
     ;;
+  arm-*-coff | strongarm-*-coff | xscale-*-coff)
+    noconfigdirs="$noconfigdirs ${libgcj}"
+    ;;
+  arm-*-elf* | strongarm-*-elf* | xscale-*-elf*)
+    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+    ;;
   arm-*-pe*)
     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
     ;;
@@ -354,18 +352,6 @@ case "${target}" in
   thumb-*-oabi)
     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
     ;;
-  strongarm-*-elf)
-    noconfigdirs="$noconfigdirs ${libgcj}"
-    ;;
-  strongarm-*-coff)
-    noconfigdirs="$noconfigdirs ${libgcj}"
-    ;;
-  xscale-*-elf)
-    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
-    ;;
-  xscale-*-coff)
-    noconfigdirs="$noconfigdirs ${libgcj}"
-    ;;
   thumb-*-pe)
     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
     ;;
@@ -375,7 +361,7 @@ case "${target}" in
   avr-*-*)
     noconfigdirs="$noconfigdirs target-libiberty ${libstdcxx_version} ${libgcj}"
     ;;
-  c4x-*-*)
+  c4x-*-* | tic4x-*-*)
     noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss ${libgcj}"
     ;;
   c54x*-*-* | tic54x-*-*)
@@ -392,15 +378,9 @@ case "${target}" in
     ;;
   fr30-*-elf*)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
-    fi
     ;;
   frv-*-*)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-cygmon"
-    fi
     ;;
   h8300*-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
@@ -417,6 +397,7 @@ case "${target}" in
   hppa*-*-*elf* | \
   parisc*-*-linux* | hppa*-*-linux* | \
   hppa*-*-lites* | \
+  hppa*-*-openbsd* | \
   hppa*64*-*-*)
     noconfigdirs="$noconfigdirs ${libgcj}"
     # Do configure ld/binutils/gas for this case.
@@ -436,18 +417,18 @@ case "${target}" in
     ;;
   i[3456]86-*-coff | i[3456]86-*-elf)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-         target_configdirs="${target_configdirs} target-libstub target-cygmon"
-    fi
     ;;
   i[34567]86-*-freebsd*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
-  s390*-*-linux*)
-    # The libffi port is not yet in the GCC tree
-    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
-    ;;
   i[3456]86-*-linux*)
+    # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
+    # not build java stuff by default.
+    case "${target}" in
+      *-*-*libc1*)
+       noconfigdirs="$noconfigdirs ${libgcj}";;
+    esac
+
     # This section makes it possible to build newlib natively on linux.
     # If we are using a cross compiler then don't configure newlib.
     if test x${is_cross_compiler} != xno ; then
@@ -459,9 +440,6 @@ case "${target}" in
     # if the --with-newlib option has been given, because otherwise
     # 'target-newlib' will appear in skipdirs.
     ;;
-  *-*-linux*)
-    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
-    ;;
   i[3456]86-*-mingw32*)
     target_configdirs="$target_configdirs target-mingw"
     noconfigdirs="$noconfigdirs expect target-libgloss ${libgcj}"
@@ -511,15 +489,9 @@ case "${target}" in
     ;;
   m68k-*-elf*)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-cygmon"
-    fi
     ;;
   m68k-*-coff*)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-cygmon"
-    fi
     ;;
   mcore-*-pe*)
   # The EPOC C++ environment does not support exceptions or rtti,
@@ -531,19 +503,13 @@ case "${target}" in
     ;;
   mn10200-*-*)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-libstub target-cygmon"
-    fi
     ;;
   mn10300-*-*)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
-    fi
     ;;
   powerpc-*-aix*)
     # copied from rs6000-*-* entry
-    noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss ${libgcj}"
+    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
     ;;
   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
     target_configdirs="$target_configdirs target-winsup"
@@ -558,15 +524,19 @@ case "${target}" in
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
     ;;
+  powerpc-*-darwin*)
+    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb tk itcl tix libgui gprof ${libgcj}"
+    ;;
   powerpc-*-eabi)
     noconfigdirs="$noconfigdirs ${libgcj}"
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
-    fi
+    ;;
+  powerpc64*-*-linux*)
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    # not yet ported.
+    noconfigdirs="$noconfigdirs target-libffi"
     ;;
   rs6000-*-lynxos*)
-    # The CVS server code doesn't work on the RS/6000
-    noconfigdirs="$noconfigdirs target-newlib gprof cvssrc ${libgcj}"
+    noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}"
     ;;
   rs6000-*-aix*)
     noconfigdirs="$noconfigdirs gprof ${libgcj}"
@@ -597,10 +567,9 @@ case "${target}" in
     ;;
   mipstx39-*-*)
     noconfigdirs="$noconfigdirs gprof ${libgcj}"   # same as generic mips
-    target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
    ;;
   mips*-*-linux*)
-    noconfigdirs="$noconfigdirs target-libffi"
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
   mips*-*-*)
     noconfigdirs="$noconfigdirs gprof ${libgcj}"
@@ -621,27 +590,18 @@ case "${target}" in
     noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
     ;;
   sparc-*-elf*)
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-libstub target-cygmon"
-    fi
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
   sparc64-*-elf*)
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-libstub target-cygmon"
-    fi
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
   sparclite-*-*)
-    if test x${is_cross_compiler} != xno ; then
-          target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
-    fi
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
   sparc-*-sunos4*)
     noconfigdirs="$noconfigdirs ${libgcj}"
     if test x${is_cross_compiler} != xno ; then
-           noconfigdirs="$noconfigdirs gdb gdbtest target-newlib target-libgloss"
+           noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
     else
            use_gnu_ld=no
     fi
@@ -669,15 +629,12 @@ case "${target}" in
   ip2k-*-*)
     noconfigdirs="$noconfigdirs target-libiberty ${libstdcxx_version} ${libgcj}"
     ;;
+  *-*-linux*)
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    ;;
   *-*-lynxos*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;; 
-  *-*-macos* | \
-  *-*-mpw*)
-    # Macs want a resource compiler.
-    configdirs="$configdirs grez"
-    noconfigdirs="$noconfigdirs ${libgcj}"
-    ;;    
   *-*-*)
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
@@ -786,8 +743,7 @@ for dir in . $skipdirs $noconfigdirs ; do
   dirname=`echo $dir | sed -e s/target-//g`
   if test $dir != .  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
     configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
-    if test -r $srcdir/$dirname/configure \
-       || test -r $srcdir/$dirname/configure.in ; then
+    if test -r $srcdir/$dirname/configure ; then
       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
        true
       else
@@ -797,8 +753,7 @@ for dir in . $skipdirs $noconfigdirs ; do
   fi
   if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
     target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
-    if test -r $srcdir/$dirname/configure \
-       || test -r $srcdir/$dirname/configure.in ; then
+    if test -r $srcdir/$dirname/configure ; then
       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
        true
       else
@@ -814,7 +769,7 @@ if test -n "${target_configdirs}" ; then
   others=
   for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
     if test "$i" != "libiberty" ; then
-      if test -r $srcdir/$i/configure || test -r $srcdir/$i/configure.in ; then
+      if test -r $srcdir/$i/configure ; then
        others=yes;
        break;
       fi
@@ -907,36 +862,41 @@ esac
 
 copy_dirs=
 
-# Handle --with-headers=XXX.  The contents of the named directory are
-# copied to $(tooldir)/sys-include.
+# Handle --with-headers=XXX.  If the value is not "yes", the contents of
+# the named directory are copied to $(tooldir)/sys-include.
 if test x"${with_headers}" != x ; then
   if test x${is_cross_compiler} = xno ; then
     echo 1>&2 '***' --with-headers is only supported when cross compiling
     exit 1
   fi
-  case "${exec_prefixoption}" in
-  "") x=${prefix} ;;
-  *) x=${exec_prefix} ;;
-  esac
-  copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
+  if test x"${with_headers}" != xyes ; then
+    case "${exec_prefixoption}" in
+    "") x=${prefix} ;;
+    *) x=${exec_prefix} ;;
+    esac
+    copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
+  fi
 fi
 
-# Handle --with-libs=XXX.  Multiple directories are permitted.  The
-# contents are copied to $(tooldir)/lib.
+# Handle --with-libs=XXX.  If the value is not "yes", the contents of
+# the name directories are copied to $(tooldir)/lib.  Multiple directories
+# are permitted.
 if test x"${with_libs}" != x ; then
   if test x${is_cross_compiler} = xno ; then
     echo 1>&2 '***' --with-libs is only supported when cross compiling
     exit 1
   fi
-  # Copy the libraries in reverse order, so that files in the first named
-  # library override files in subsequent libraries.
-  case "${exec_prefixoption}" in
-  "") x=${prefix} ;;
-  *) x=${exec_prefix} ;;
-  esac
-  for l in ${with_libs}; do
-    copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
-  done
+  if test x"${with_libs}" != xyes ; then
+    # Copy the libraries in reverse order, so that files in the first named
+    # library override files in subsequent libraries.
+    case "${exec_prefixoption}" in
+    "") x=${prefix} ;;
+    *) x=${exec_prefix} ;;
+    esac
+    for l in ${with_libs}; do
+      copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
+    done
+  fi
 fi
 
 # Handle ${copy_dirs}
@@ -1158,65 +1118,49 @@ if test -n "${host_makefile_frag}" ; then
   host_makefile_frag=mh-frag
 fi
 
-# If we aren't going to be using gcc, see if we can extract a definition
-# of CC from the fragment.
-# Actually, use the 'pre-extracted' version above.
-if test -z "${CC}" && test "${build}" = "${host}" ; then
-  IFS="${IFS=  }"; save_ifs="$IFS"; IFS="${IFS}:"
-  found=
-  for dir in $PATH; do
-    test -z "$dir" && dir=.
-    if test -f $dir/gcc; then
-      found=yes
-      break
-    fi
-  done
-  IFS="$save_ifs"
-  if test -z "${found}" && test -n "${tentative_cc}" ; then
-    CC=$tentative_cc
-  fi
-fi
-
 case "${target}" in
   v810*)
-    target_makefile_frag="${target_makefile_frag} config/mt-v810"
+    target_makefile_frag="config/mt-v810"
     ;;
   i[3456]86-*-netware*)
-    target_makefile_frag="${target_makefile_frag} config/mt-netware"
+    target_makefile_frag="config/mt-netware"
     ;;
   powerpc-*-netware*)
-    target_makefile_frag="${target_makefile_frag} config/mt-netware"
-    ;;
-  alpha*-*-linux*)
-    target_makefile_frag="${target_makefile_frag} config/mt-linux"
-    target_makefile_frag="${target_makefile_frag} config/mt-alphaieee"
-    ;;
-  alpha*-*-*)
-    target_makefile_frag="${target_makefile_frag} config/mt-alphaieee"
+    target_makefile_frag="config/mt-netware"
     ;;
   *-*-linux*)
-    target_makefile_frag="${target_makefile_frag} config/mt-linux"
+    target_makefile_frag="config/mt-linux"
     ;;
   *-*-aix4.[3456789]* | *-*-aix[56789].*)
-    target_makefile_frag="${target_makefile_frag} config/mt-aix43"
+    target_makefile_frag="config/mt-aix43"
     ;;
   mips*-*-pe | sh*-*-pe | *arm-wince-pe)
-    target_makefile_frag="${target_makefile_frag} config/mt-wince"
+    target_makefile_frag="config/mt-wince"
+    ;;
+esac
+
+alphaieee_frag=
+case $target in
+  alpha*-*-*)
+    # This just makes sure to use the -mieee option to build target libs.
+    # This should probably be set individually by each library.
+    alphaieee_frag="config/mt-alphaieee"
     ;;
 esac
 
 # If --enable-target-optspace always use -Os instead of -O2 to build
 # the target libraries, similarly if it is not specified, use -Os
 # on selected platforms.
+ospace_frag=
 case "${enable_target_optspace}:${target}" in
   yes:*)
-    target_makefile_frag="${target_makefile_frag} config/mt-ospace"
+    ospace_frag="config/mt-ospace"
     ;;
   :d30v-*)
-    target_makefile_frag="${target_makefile_frag} config/mt-d30v"
+    ospace_frag="config/mt-d30v"
     ;;
   :m32r-* | :d10v-* | :fr30-*)
-    target_makefile_frag="${target_makefile_frag} config/mt-ospace"
+    ospace_frag="config/mt-ospace"
     ;;
   no:* | :*)
     ;;
@@ -1226,8 +1170,8 @@ case "${enable_target_optspace}:${target}" in
 esac
 
 rm -f mt-frag
-if test -n "${target_makefile_frag}" ; then
-  for f in ${target_makefile_frag}
+if test -n "${target_makefile_frag}${alphaieee_frag}${ospace_frag}" ; then
+  for f in ${target_makefile_frag} ${alphaieee_frag} ${ospace_frag}
   do
     cat ${srcdir}/$f >> mt-frag
   done
@@ -1289,6 +1233,10 @@ esac
 # Default to using --with-stabs for certain targets.
 if test x${with_stabs} = x ; then
   case "${target}" in
+  mips*-*-irix6*o32)
+    with_stabs=yes;
+    withoptions="${withoptions} --with-stabs"
+    ;;
   mips*-*-irix6*)
     ;;
   mips*-*-* | alpha*-*-osf*)
@@ -1306,6 +1254,25 @@ case "${host}" in
     ;;
 esac
 
+# If we aren't going to be using gcc, see if we can extract a definition
+# of CC from the fragment.
+# Actually, use the 'pre-extracted' version above.
+if test -z "${CC}" && test "${build}" = "${host}" ; then
+  IFS="${IFS=  }"; save_ifs="$IFS"; IFS="${IFS}:"
+  found=
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/gcc; then
+      found=yes
+      break
+    fi
+  done
+  IFS="$save_ifs"
+  if test -z "${found}" && test -n "${tentative_cc}" ; then
+    CC=$tentative_cc
+  fi
+fi
+
 # post-target:
 
 # Make sure that the compiler is able to generate an executable.  If it
@@ -1361,20 +1328,23 @@ esac
 # If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
 # binutils tools will find libbfd.so.
 if test "${shared}" = "yes" ; then
-  sed -e 's/^SET_LIB_PATH[     ]*=.*$/SET_LIB_PATH = $(REALLY_SET_LIB_PATH)/' \
-      Makefile > Makefile.tem
-  rm -f Makefile
-  mv -f Makefile.tem Makefile
-
-  case "${host}" in
-  *-*-hpux*)
-    sed -e 's/^RPATH_ENVVAR[   ]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
-       Makefile > Makefile.tem
-    rm -f Makefile
-    mv -f Makefile.tem Makefile
-    ;;
-  esac
+  SET_LIB_PATH="\$(REALLY_SET_LIB_PATH)"
+else
+  SET_LIB_PATH=
 fi
+sed -e "s/@SET_LIB_PATH@/${SET_LIB_PATH}/" Makefile > Makefile.tem
+rm -f Makefile
+mv -f Makefile.tem Makefile
+
+
+case "${host}" in
+  *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
+  *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
+esac
+sed -e "s/@RPATH_ENVVAR@/${RPATH_ENVVAR}/" Makefile > Makefile.tem
+rm -f Makefile
+mv -f Makefile.tem Makefile
+
 
 # Base args.  Strip norecursion, cache-file, srcdir, host, build, target.
 # These are the ones we might not want to pass down to subconfigures.
@@ -1439,7 +1409,7 @@ if test -n "${with_gxx_include_dir}"; then
 fi
 if test x${gxx_include_dir} = x; then
   if test x${enable_version_specific_runtime_libs} = xyes; then
-    gxx_include_dir='${libsubdir}/include/g++'
+    gxx_include_dir='${libsubdir}/include/c++'
   else
     . ${srcdir}/config.if
     gxx_include_dir='${prefix}/include/${libstdcxx_incdir}'
@@ -1449,10 +1419,7 @@ else
 fi
 
 FLAGS_FOR_TARGET=
-case " $skipdirs " in
-*" target-newlib "*) ;;
-*)
- case " $target_configdirs " in
+case " $target_configdirs " in
  *" newlib "*)
   case " $targargs " in
   *" --with-newlib "*)
@@ -1500,8 +1467,6 @@ case " $skipdirs " in
    ;;
   esac
   ;;
- esac
- ;;
 esac
 
 # On Canadian crosses, we'll be searching the right directories for
@@ -1513,7 +1478,7 @@ if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
 fi
 
-if test "x${use_gnu_ld}" = x && test "x${with_gnu_ld}" != xno &&
+if test "x${use_gnu_ld}" = x &&
    echo " ${configdirs} " | grep " ld " > /dev/null ; then
   # Arrange for us to find uninstalled linker scripts.
   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld'
@@ -1580,17 +1545,17 @@ qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
 
 sedtemp=sed.$$
 cat >$sedtemp <<EOF
-s:^TARGET_CONFIGDIRS[  ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:
-s%^TARGET_CONFIGARGS[  ]*=.*$%TARGET_CONFIGARGS = ${targargs}%
-s%^FLAGS_FOR_TARGET[   ]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}%
-s%^CC_FOR_TARGET[      ]*=.*$%CC_FOR_TARGET = ${CC_FOR_TARGET}%
-s%^GCJ_FOR_TARGET[      ]*=.*$%GCJ_FOR_TARGET = ${GCJ_FOR_TARGET}%
-s%^CXX_FOR_TARGET[     ]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%
-s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[  ]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = ${qqCXX_FOR_TARGET}%
-s%^TARGET_SUBDIR[      ]*=.*$%TARGET_SUBDIR = ${target_subdir}%
-s%^BUILD_SUBDIR[       ]*=.*$%BUILD_SUBDIR = ${build_subdir}%
-s%^BUILD_CONFIGARGS[   ]*=.*$%BUILD_CONFIGARGS = ${buildargs}%
-s%^gxx_include_dir[    ]*=.*$%gxx_include_dir=${gxx_include_dir}%
+s:@target_configdirs@:${target_configdirs}:
+s%@target_configargs@%${targargs}%
+s%@FLAGS_FOR_TARGET@%${FLAGS_FOR_TARGET}%
+s%@CC_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}%
+s%@GCJ_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}%
+s%@CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}%
+s%@CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}%
+s%@target_subdir@%${target_subdir}%
+s%@build_subdir@%${build_subdir}%
+s%@build_configargs@%${buildargs}%
+s%@gxx_include_dir@%${gxx_include_dir}%
 EOF
 sed -f $sedtemp Makefile > Makefile.tem
 rm -f Makefile $sedtemp