OSDN Git Service

* Makefile.in, configure.in, config.host, mkheaders.in: Replace
[pf3gnuchains/gcc-fork.git] / gcc / configure.in
index 3fcee82..a7d8ab7 100644 (file)
@@ -32,6 +32,9 @@ AC_CONFIG_HEADER(auto-host.h:config.in)
 # Determine the host, build, and target systems
 AC_CANONICAL_SYSTEM
 
+# Determine the noncanonical target name, for directory use.
+_GCC_TOPLEV_NONCANONICAL_TARGET
+
 # Determine the target- and build-specific subdirectories
 GCC_TOPLEV_SUBDIRS
 
@@ -249,6 +252,7 @@ gcc_AC_C_LONG_LONG
 gcc_AC_C__BOOL
 
 # sizeof(char) is 1 by definition.
+AC_COMPILE_CHECK_SIZEOF(void *)
 AC_COMPILE_CHECK_SIZEOF(short)
 AC_COMPILE_CHECK_SIZEOF(int)
 AC_COMPILE_CHECK_SIZEOF(long)
@@ -317,7 +321,7 @@ AC_ARG_ENABLE(checking,
 [  --enable-checking[=LIST]
                          enable expensive run-time checks.  With LIST,
                          enable only specific categories of checks.
-                         Categories are: misc,tree,rtl,rtlflag,gc,gcac;
+                         Categories are: misc,tree,rtl,rtlflag,gc,gcac,fold;
                          default is misc,tree,gc,rtlflag],
 [ac_checking=
 ac_tree_checking=
@@ -325,6 +329,7 @@ ac_rtl_checking=
 ac_rtlflag_checking=
 ac_gc_checking=
 ac_gc_always_collect=
+ac_fold_checking=
 case "${enableval}" in
 yes)   ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;
        ac_rtlflag_checking=1 ;;
@@ -341,6 +346,7 @@ no) ;;
                rtl)    ac_rtl_checking=1 ;;
                gc)     ac_gc_checking=1 ;;
                gcac)   ac_gc_always_collect=1 ;;
+               fold)   ac_fold_checking=1 ;;
                valgrind)       ac_checking_valgrind=1 ;;
                *)      AC_MSG_ERROR(unknown check category $check) ;;
                esac
@@ -387,6 +393,11 @@ if test x$ac_gc_always_collect != x ; then
    paranoid mode, validating the entire heap and collecting garbage at
    every opportunity.  This is extremely expensive.])
 fi
+if test x$ac_fold_checking != x ; then
+  AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
+[Define if you want fold checked that it never destructs its argument.
+   This is quite expensive.])
+fi
 valgrind_path_defines=
 valgrind_command=
 if test x$ac_checking_valgrind != x ; then
@@ -452,12 +463,6 @@ AC_ARG_WITH(stabs,
 stabs="$with_stabs",
 stabs=no)
 
-# With ELF
-AC_ARG_WITH(elf,
-[  --with-elf              arrange to use ELF instead of host debug format],
-elf="$with_elf",
-elf=no)
-
 # Determine whether or not multilibs are enabled.
 AC_ARG_ENABLE(multilib,
 [  --enable-multilib       enable library support for multiple ABIs],
@@ -476,27 +481,8 @@ AC_ARG_ENABLE(threads,
 [  --enable-threads        enable thread usage for target GCC
   --enable-threads=LIB    use LIB thread package for target GCC],,
 enable_threads='')
-
+# Save in case it gets overwritten in config.gcc
 enable_threads_flag=$enable_threads
-# Check if a valid thread package
-case x${enable_threads_flag} in
-       x | xno)
-               # No threads
-               target_thread_file='single'
-               ;;
-       xyes)
-               # default
-               target_thread_file=''
-               ;;
-       xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
-       xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix | xgnat)
-               target_thread_file=$enable_threads_flag
-               ;;
-       *)
-               echo "$enable_threads is an unknown thread package" 1>&2
-               exit 1
-               ;;
-esac
 
 AC_ARG_ENABLE(objc-gc,
 [  --enable-objc-gc      enable the use of Boehm's garbage collector with
@@ -536,7 +522,7 @@ AC_ARG_WITH(sysroot,
 [  --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
 [
  case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
  esac
    
@@ -568,6 +554,16 @@ AC_SUBST(TARGET_SYSTEM_ROOT)
 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
 
+# Build with intermodule optimisations
+AC_ARG_ENABLE(intermodule,
+[  --enable-intermodule    build the compiler in one step],
+[case ${enable_intermodule} in
+  yes) onestep="-onestep";;
+  *) onestep="";;
+esac],
+[onestep=""])
+AC_SUBST(onestep)
+
 # -------------------------
 # Checks for other programs
 # -------------------------
@@ -581,6 +577,9 @@ gcc_AC_PROG_LN_S
 AC_PROG_RANLIB
 gcc_AC_PROG_INSTALL
 
+# See if cmp has --ignore-initial.
+gcc_AC_PROG_CMP_IGNORE_INITIAL
+
 # See if we have the mktemp command.
 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
 
@@ -616,26 +615,6 @@ else
   GENERATED_MANPAGES=
 fi
 
-# 'make compare' can be significantly faster, if cmp itself can
-# skip bytes instead of using tail.  The test being performed is
-# "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
-# but we need to sink errors and handle broken shells.
-AC_MSG_CHECKING([for cmp's capabilities])
-echo abfoo >t1
-echo cdfoo >t2
-if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
-  if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
-    make_compare_target=slowcompare
-  else
-    make_compare_target=gnucompare
-  fi
-else
-  make_compare_target=slowcompare
-fi
-rm t1 t2
-AC_SUBST(make_compare_target)
-AC_MSG_RESULT($make_compare_target)
-
 # How about lex?
 dnl Don't use AC_PROG_LEX; we insist on flex.
 dnl LEXLIB is not useful in gcc.
@@ -679,7 +658,7 @@ AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
                 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
                 sys/resource.h sys/param.h sys/times.h sys/stat.h \
-                direct.h malloc.h langinfo.h ldfcn.h wchar.h)
+                direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
 
 # Check for thread headers.
 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@@ -773,8 +752,9 @@ dnl gcc_AC_C_ENUM_BF_UNSIGNED
 
 AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \
        sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
-       fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
-        scandir alphasort gettimeofday mbstowcs wcswidth mmap mincore)
+       fwrite_unlocked fprintf_unlocked getrusage nl_langinfo \
+        scandir alphasort gettimeofday mbstowcs wcswidth mmap mincore \
+        setlocale)
 
 if test x$ac_cv_func_mbstowcs = xyes; then
   AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
@@ -794,7 +774,7 @@ int main()
   fi
 fi
 
-AC_CHECK_TYPE(ssize_t, int)
+gcc_AC_CHECK_TYPE(ssize_t, int)
 
 # Try to determine the array type of the second argument of getgroups
 # for the target system (int or gid_t).
@@ -820,13 +800,8 @@ gcc_AC_FUNC_PRINTF_PTR
 gcc_AC_FUNC_MMAP_BLACKLIST
 
 case "${host}" in
-*-*-uwin*)
-  AC_MSG_ERROR([
-*** UWIN may not be used as a host platform because
-*** linking with posix.dll is not allowed by the GNU GPL])
-  ;;
 *-*-*vms*)
-  # Under VMS, vfork works very different than on Unix. The standard test 
+  # Under VMS, vfork works very differently than on Unix. The standard test 
   # won't work, and it isn't easily adaptable. It makes more sense to
   # just force it.
   ac_cv_func_vfork_works=yes
@@ -835,6 +810,11 @@ esac
 AC_FUNC_VFORK
 
 AM_ICONV
+# Until we have in-tree GNU iconv:
+LIBICONV_DEP=
+AC_SUBST(LIBICONV_DEP)
+
+AM_LC_MESSAGES
 
 # We will need to find libiberty.h and ansidecl.h
 saved_CFLAGS="$CFLAGS"
@@ -940,7 +920,11 @@ AC_ARG_ENABLE(sjlj-exceptions,
 AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
   [Define 0/1 to force the choice for exception handling model.])])
 
-AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no)
+if test x$host = x$target; then
+   AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no)
+else
+   use_libunwind_default=no
+fi
 # Use libunwind based exception handling.
 AC_ARG_ENABLE(libunwind-exceptions,
 [  --enable-libunwind-exceptions  force use libunwind for exceptions],
@@ -955,23 +939,16 @@ fi
 # Build, host, and target specific configuration fragments
 # --------------------------------------------------------
 
+# Collect build-machine-specific information.
+. ${srcdir}/config.build
+
+# Collect host-machine-specific information.
+. ${srcdir}/config.host
+
 target_gtfiles=
-build_xm_file=
-build_xm_defines=
-build_install_headers_dir=install-headers-tar
-build_exeext=
-host_xm_file=
-host_xm_defines=
-host_xmake_file=
-host_exeext=
-
-# Decode the host machine, then the target machine.
-# For the host machine, we save the xm_file variable as host_xm_file;
-# then we decode the target machine and forget everything else
-# that came from the host machine.
-for machine in $build $host $target; do
-       . ${srcdir}/config.gcc
-done
+
+# Collect target-machine-specific information.
+. ${srcdir}/config.gcc
 
 extra_objs="${host_extra_objs} ${extra_objs}"
 
@@ -1081,12 +1058,30 @@ if test "$host_xm_file" != "$build_xm_file"; then
        fi
 fi
 
-if test x$thread_file = x; then
-       if test x$target_thread_file != x; then
-               thread_file=$target_thread_file
-       else
-               thread_file='single'
-       fi
+# Check if a valid thread package
+case ${enable_threads_flag} in
+  "" | no)
+    # No threads
+    target_thread_file='single'
+    ;;
+  yes)
+    # default
+    target_thread_file='single'
+    ;;
+  aix | dce | gnat | irix | posix | rtems | \
+  single | solaris | vxworks | win32 )
+    target_thread_file=${enable_threads_flag}
+    ;;
+  *)
+    echo "${enable_threads_flag} is an unknown thread package" 1>&2
+    exit 1
+    ;;
+esac
+
+if test x${thread_file} = x; then
+  # No thread file set by target-specific clauses in config.gcc,
+  # so use file chosen by default logic above
+  thread_file=${target_thread_file}
 fi
 
 if test x$enable___cxa_atexit = xyes || \
@@ -1102,12 +1097,9 @@ fi
 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
   extra_modes_file='$(srcdir)'/config/${extra_modes}
   AC_SUBST(extra_modes_file)
-  AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "$extra_modes",
+  AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
   [Define to the name of a file containing a list of extra machine modes
    for this architecture.])
-  AC_DEFINE(EXTRA_CC_MODES, 1,
-  [Define if the target architecture needs extra machine modes to represent
-   the results of comparisons.])
 fi
 
 # auto-host.h is the file containing items generated by autoconf and is
@@ -1178,9 +1170,18 @@ if test -f configargs.h ; then
 else
        gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
 fi
+
+# Double all backslashes and backslash all quotes to turn
+# gcc_config_arguments into a C string.
+sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
+$gcc_config_arguments
+EOF
+gcc_config_arguments_str=`cat conftest.out`
+rm -f conftest.out
+
 cat > configargs.h <<EOF
 /* Generated automatically. */
-static const char configuration_arguments[] = "$gcc_config_arguments";
+static const char configuration_arguments[] = "$gcc_config_arguments_str";
 static const char thread_model[] = "$thread_file";
 
 static const struct {
@@ -1195,20 +1196,13 @@ VERSION="$gcc_version"
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 
-# Enable NLS support by default
-AC_ARG_ENABLE(nls,
-  [  --enable-nls            use Native Language Support (default)],
-  , enable_nls=yes)
-
-# if cross compiling, disable NLS support.
-# It's not worth the trouble, at least for now.
-
-if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then
-  AC_MSG_WARN(Disabling NLS support for canadian cross compiler.)
-  enable_nls=no
-fi
+ZW_GNU_GETTEXT_SISTER_DIR
 
-CY_GNU_GETTEXT
+# If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
+# -liconv on the link line twice.
+case "$LIBINTL" in *$LIBICONV*)
+       LIBICONV= ;;
+esac
 
 # Windows32 Registry support for specifying GCC installation paths.
 AC_ARG_ENABLE(win32-registry,
@@ -1264,30 +1258,25 @@ topdir=`${PWDCMD-pwd}`
 cd $holddir
 
 # Conditionalize the makefile for this host machine.
-# Make-host contains the concatenation of all host makefile fragments
-# [there can be more than one].  This file is built by configure.frag.
-host_overrides=Make-host
-dep_host_xmake_file=
-for f in .. ${host_xmake_file}
+xmake_file=
+for f in ${host_xmake_file}
 do
        if test -f ${srcdir}/config/$f
        then
-               dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f"
+               xmake_file="${xmake_file} \$(srcdir)/config/$f"
        fi
 done
 
 # Conditionalize the makefile for this target machine.
-# Make-target contains the concatenation of all host makefile fragments
-# [there can be more than one].  This file is built by configure.frag.
-target_overrides=Make-target
-dep_tmake_file=
-for f in .. ${tmake_file}
+tmake_file_=
+for f in ${tmake_file}
 do
        if test -f ${srcdir}/config/$f
        then
-               dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f"
+               tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
        fi
 done
+tmake_file="${tmake_file_}"
 
 symbolic_link='ln -s'
 
@@ -1319,35 +1308,69 @@ rm -f symtest.tem
 out_object_file=`basename $out_file .c`.o
 
 tm_file_list=
+tm_include_list=
 for f in $tm_file; do
   case $f in
-    ansidecl.h )
-       tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
     defaults.h )
-       tm_file_list="${tm_file_list} \$(srcdir)/$f" ;;
-    *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;;
+       tm_file_list="${tm_file_list} \$(srcdir)/$f"
+       tm_include_list="${tm_include_list} $f"
+       ;;
+    * )
+       tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
+       tm_include_list="${tm_include_list} config/$f"
+       ;;
   esac
 done
 
 tm_p_file_list=
+tm_p_include_list=
 for f in $tm_p_file; do
   case $f in
     tm-preds.h )
-       tm_p_file_list="${tm_p_file_list} $f" ;;
-    *) tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" ;;
+       tm_p_file_list="${tm_p_file_list} $f"
+       tm_p_include_list="${tm_p_include_list} $f"
+       ;;
+    * )
+       tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
+       tm_p_include_list="${tm_p_include_list} config/$f"
+  esac
+done
+
+xm_file_list=
+xm_include_list=
+for f in $xm_file; do
+  case $f in
+    ansidecl.h )
+       xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
+       xm_include_list="${xm_include_list} $f"
+       ;;
+    auto-host.h )
+       xm_file_list="${xm_file_list} $f"
+       xm_include_list="${xm_include_list} $f"
+       ;;
+    * )
+       xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
+       xm_include_list="${xm_include_list} config/$f"
+       ;;
   esac
 done
 
 host_xm_file_list=
+host_xm_include_list=
 for f in $host_xm_file; do
   case $f in
     ansidecl.h )
-       host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
+       host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
+       host_xm_include_list="${host_xm_include_list} $f"
+       ;;
     auto-host.h )
-       host_xm_file_list="${host_xm_file_list} $f" ;;
-    defaults.h )
-       host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;;
-    *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;;
+       host_xm_file_list="${host_xm_file_list} $f"
+       host_xm_include_list="${host_xm_include_list} $f"
+       ;;
+    * )
+       host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
+       host_xm_include_list="${host_xm_include_list} config/$f"
+       ;;
   esac
 done
 
@@ -1355,12 +1378,17 @@ build_xm_file_list=
 for f in $build_xm_file; do
   case $f in
     ansidecl.h )
-       build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
+       build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
+       build_xm_include_list="${build_xm_include_list} $f"
+       ;;
     auto-build.h | auto-host.h )
-       build_xm_file_list="${build_xm_file_list} $f" ;;
-    defaults.h )
-       host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;;
-    *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;;
+       build_xm_file_list="${build_xm_file_list} $f"
+       build_xm_include_list="${build_xm_include_list} $f"
+       ;;
+    * )
+       build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
+       build_xm_include_list="${build_xm_include_list} config/$f"
+       ;;
   esac
 done
 
@@ -1375,6 +1403,21 @@ then
        ALL=all.cross
        SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
        case "$host","$target" in
+       # Darwin crosses can use the host system's libraries and headers,
+       # because of the fat library support.  Of course, it must be the
+       # same version of Darwin on both sides.  Allow the user to
+       # just say --target=foo-darwin without a version number to mean
+       # "the version on this system".
+           *-*-darwin*,*-*-darwin*)
+               hostos=`echo $host | sed 's/.*-darwin/darwin/'`
+               targetos=`echo $target | sed 's/.*-darwin/darwin/'`
+               if test $hostos = $targetos -o $targetos = darwin ; then
+                   CROSS=
+                   SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
+                   with_headers=yes
+               fi
+               ;;
+
            i?86-*-*,x86_64-*-* \
            | powerpc*-*-*,powerpc64*-*-*)
                CROSS="$CROSS -DNATIVE_CROSS" ;;
@@ -1395,7 +1438,7 @@ fi
 inhibit_libc=
 if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
        test x$with_newlib = xyes ; } &&
-     test "x$with_headers" = x ; then
+     { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
        inhibit_libc=-Dinhibit_libc
 fi
 AC_SUBST(inhibit_libc)
@@ -1411,10 +1454,20 @@ CC_FOR_BUILD='$(CC)'            AC_SUBST(CC_FOR_BUILD)
 BUILD_CFLAGS='$(ALL_CFLAGS)'   AC_SUBST(BUILD_CFLAGS)
 
 STMP_FIXINC=stmp-fixinc                AC_SUBST(STMP_FIXINC)
-STMP_FIXPROTO=stmp-fixproto    AC_SUBST(STMP_FIXPROTO)
 
-# And these apply if build != host.
-if test x$build != x$host
+# Possibly disable fixproto, on a per-target basis.
+case ${use_fixproto} in
+  no)
+    STMP_FIXPROTO=
+    ;;
+  yes)
+    STMP_FIXPROTO=stmp-fixproto
+    ;;
+esac
+AC_SUBST(STMP_FIXPROTO)
+
+# And these apply if build != host, or we are generating coverage data
+if test x$build != x$host || test "x$coverage_flags" != x
 then
     BUILD_PREFIX=build-
     BUILD_PREFIX_1=build-
@@ -1429,15 +1482,10 @@ fi
 # Expand extra_headers to include complete path.
 # This substitutes for lots of t-* files.
 extra_headers_list=
-if test "x$extra_headers" = x
-then true
-else
-       # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers.
-       for file in $extra_headers;
-       do
-               extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
-       done
-fi
+# Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
+for file in ${extra_headers} ; do
+  extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
+done
 
 # Add a definition of USE_COLLECT2 if system wants one.
 case $use_collect2 in
@@ -1516,12 +1564,12 @@ if test "x$gcc_cv_as" = x; then
                gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext
        fi
 
-       test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
-                  $test_prefix/lib/gcc-lib/$target_alias \
-                  /usr/lib/gcc/$target_alias/$gcc_version \
-                  /usr/lib/gcc/$target_alias \
-                  $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
-                  $test_prefix/$target_alias/bin"
+       test_dirs="$test_prefix/lib/gcc-lib/$target_noncanonical/$gcc_version \
+                  $test_prefix/lib/gcc-lib/$target_noncanonical \
+                  /usr/lib/gcc/$target_noncanonical/$gcc_version \
+                  /usr/lib/gcc/$target_noncanonical \
+                  $test_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version \
+                  $test_prefix/$target_noncanonical/bin"
 
        if test x$host = x$target; then
            test_dirs="$test_dirs \
@@ -1632,12 +1680,12 @@ if test "x$gcc_cv_ld" = x; then
                gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext
        fi
 
-       test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
-                  $test_prefix/lib/gcc-lib/$target_alias \
-                  /usr/lib/gcc/$target_alias/$gcc_version \
-                  /usr/lib/gcc/$target_alias \
-                  $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
-                  $test_prefix/$target_alias/bin"
+       test_dirs="$test_prefix/lib/gcc-lib/$target_noncanonical/$gcc_version \
+                  $test_prefix/lib/gcc-lib/$target_noncanonical \
+                  /usr/lib/gcc/$target_noncanonical/$gcc_version \
+                  /usr/lib/gcc/$target_noncanonical \
+                  $test_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version \
+                  $test_prefix/$target_noncanonical/bin"
 
        if test x$host = x$target; then
            test_dirs="$test_dirs \
@@ -1717,232 +1765,145 @@ case $in_tree_objdump in
 esac
 
 # Figure out what assembler alignment features are present.
-AC_MSG_CHECKING(assembler alignment features)
-gcc_cv_as_alignment_features=none
-if test $in_tree_gas = yes; then
-  # Gas version 2.6 and later support for .balign and .p2align.
-  gcc_GAS_VERSION_GTE_IFELSE(2,6,0,[
-    gcc_cv_as_alignment_features=".balign and .p2align"
-    AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
-  ])
-  # Gas version 2.8 and later support specifying the maximum
-  # bytes to skip when using .p2align.
-  gcc_GAS_VERSION_GTE_IFELSE(2,8,0,[
-    gcc_cv_as_alignment_features=".p2align including maximum skip"
-    AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if we have .balign and .p2align
-       echo ".balign  4" > conftest.s
-       echo ".p2align  2" >> conftest.s
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_alignment_features=".balign and .p2align"
-               AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
-       fi
-       rm -f conftest.s conftest.o
-       # Check if specifying the maximum bytes to skip when
-       # using .p2align is supported.
-       echo ".p2align 4,,7" > conftest.s
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_alignment_features=".p2align including maximum skip"
-               AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
-       fi
-       rm -f conftest.s conftest.o
-fi
-AC_MSG_RESULT($gcc_cv_as_alignment_features)
-
-AC_MSG_CHECKING(assembler subsection support)
-gcc_cv_as_subsections=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
-    test $in_tree_gas_is_elf = yes \
-       && gcc_cv_as_subsections="working .subsection -1"
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if we have .subsection
-       echo ".subsection 1" > conftest.s
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_subsections=".subsection"
-               if test x$gcc_cv_nm != x; then
-                       cat > conftest.s <<EOF
-conftest_label1: .word 0
+gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
+ [2,6,0],,
+[.balign 4
+.p2align 2],,
+[AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
+  [Define if your assembler supports .balign and .p2align.])])
+
+gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
+ [2,8,0],,
+ [.p2align 4,,7],,
+[AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
+  [Define if your assembler supports specifying the maximum number
+   of bytes to skip when using the GAS .p2align command.])])
+
+gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
+ [elf,2,9,0],,
+ [conftest_label1: .word 0
 .subsection -1
 conftest_label2: .word 0
-.previous
-EOF
-                       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-                               $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
-                               $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
-                               if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then
-                                       :
-                               else
-                                       gcc_cv_as_subsections="working .subsection -1"
-                               fi
-                       fi
-               fi
-       fi
-       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
-fi
-if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then
-       AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
-[Define if your assembler supports .subsection and .subsection -1 starts
-   emitting at the beginning of your section.])
-fi
-AC_MSG_RESULT($gcc_cv_as_subsections)
-
-AC_MSG_CHECKING(assembler weak support)
-gcc_cv_as_weak=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,2,0,[
-    gcc_cv_as_weak="yes"
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if we have .weak
-       echo "  .weak foobar" > conftest.s
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_weak="yes"
-       fi
-       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
-fi
-if test x"$gcc_cv_as_weak" = xyes; then
-       AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])
-fi
-AC_MSG_RESULT($gcc_cv_as_weak)
-
-AC_MSG_CHECKING(assembler hidden support)
-gcc_cv_as_hidden=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[
-    test $in_tree_gas_is_elf = yes && gcc_cv_as_hidden="yes"
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if we have .hidden
-       echo "  .hidden foobar" > conftest.s
-       echo "foobar:" >> conftest.s
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_hidden="yes"
-       fi
-       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
-
-       # GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
-       # This is irritatingly difficult to feature test for.  Look for 
-       # the date string after the version number.
-       ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1`
-       if echo "$ld_ver" | grep GNU > /dev/null; then
+.previous],
+ [if test x$gcc_cv_nm != x; then
+    $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
+    $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
+    if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
+    then :
+    else gcc_cv_as_subsection_m1=yes
+    fi
+    rm -f conftest.nm1 conftest.nm2
+  fi],
+ [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
+  [Define if your assembler supports .subsection and .subsection -1 starts
+   emitting at the beginning of your section.])])
+
+gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
+ [2,2,0],,
+ [     .weak foobar],,
+[AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
+
+# .hidden needs to be supported in both the assembler and the linker,
+# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
+# This is irritatingly difficult to feature test for; we have to check the
+# date string after the version number.  If we've got an in-tree
+# ld, we don't know its patchlevel version, so we set the baseline at 2.13
+# to be safe.
+# The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
+gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
+ [elf,2,13,0],,
+[      .hidden foobar
+foobar:])
+
+AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
+[if test $in_tree_ld = yes ; then
+  gcc_cv_ld_hidden=no
+  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 13 -o "$gcc_cv_gld_major_version" -gt 2 \
+     && test $in_tree_ld_is_elf = yes; then
+     gcc_cv_ld_hidden=yes
+  fi
+else
+  gcc_cv_ld_hidden=yes
+  ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
+  if echo "$ld_ver" | grep GNU > /dev/null; then
 changequote(,)dnl
-               ld_vers=`echo $ld_ver | sed -n \
-              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
-              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
-              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
-              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\)[  ].*$,\1,p' \
-              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[     ].*$,\1,p' \
-              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[        ].*$,\1,p'`
-               ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
-               if test 0"$ld_date" -lt 20020404; then
-                       if test -n "$ld_date"; then
-                               # If there was date string, but was earlier than 2002-04-04, fail
-                               gcc_cv_as_hidden="no"
-                       elif test -z "$ld_vers"; then
-                               # If there was no date string nor ld version number, something is wrong
-                               gcc_cv_as_hidden="no"
-                       else
-                               ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
-                               ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
-                               ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
-                               test -z "$ld_vers_patch" && ld_vers_patch=0
-                               if test "$ld_vers_major" -lt 2; then
-                                       gcc_cv_as_hidden="no"
-                               elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
-                                       gcc_cv_as_hidden="no"
-                               elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 \
-                                         -a "$ld_vers_patch" -eq 0; then
-                                       gcc_cv_as_hidden="no"
-                               fi
-                       fi
-               fi
-changequote([,])dnl
+    ld_vers=`echo $ld_ver | sed -n \
+       -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+       -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+       -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+       -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\)[  ].*$,\1,p' \
+       -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[     ].*$,\1,p' \
+       -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[        ].*$,\1,p'`
+    ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
+    if test 0"$ld_date" -lt 20020404; then
+      if test -n "$ld_date"; then
+       # If there was date string, but was earlier than 2002-04-04, fail
+       gcc_cv_ld_hidden=no
+      elif test -z "$ld_vers"; then
+       # If there was no date string nor ld version number, something is wrong
+       gcc_cv_ld_hidden=no
+      else
+       ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
+       ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
+       ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+       test -z "$ld_vers_patch" && ld_vers_patch=0
+       if test "$ld_vers_major" -lt 2; then
+         gcc_cv_ld_hidden=no
+       elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
+         gcc_cv_ld_hidden="no"
+       elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
+         gcc_cv_ld_hidden=no
        fi
-fi
-case "$target" in
-  mips-sgi-irix6*)
-    if test x"$gnu_ld_flag" = x"no"; then
-      # Even if using gas with .hidden support, the resulting object files
-      # cannot be linked with the IRIX 6 O32 linker.  With the N32 and
-      # N64 linkers, the problem is that the linker refuses to accept
-      # -call_shared (passed by default to the linker) and -r (used to
-      # link the object file generated without .hidden directives with
-      # one that hides symbols), so we also lose.
-      gcc_cv_as_hidden=no
+      fi
+changequote([,])dnl
     fi
-    ;;
-esac
-if test x"$gcc_cv_as_hidden" = xyes; then
-       AC_DEFINE(HAVE_GAS_HIDDEN, 1,
-               [Define if your assembler supports .hidden.])
-fi
-AC_MSG_RESULT($gcc_cv_as_hidden)
-libgcc_visibility=$gcc_cv_as_hidden
+  else
+    # non-GNU linkers don't seem to support .hidden yet
+    gcc_cv_ld_hidden=no
+  fi
+fi])
+libgcc_visibility=no
 AC_SUBST(libgcc_visibility)
+if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
+  libgcc_visibility=yes
+  AC_DEFINE(HAVE_GAS_HIDDEN, 1,
+  [Define if your assembler and linker support .hidden.])
+fi
 
-AC_MSG_CHECKING(assembler leb128 support)
-gcc_cv_as_leb128=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-    test $in_tree_gas_is_elf = yes && gcc_cv_as_leb128="yes"
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if we have .[us]leb128, and support symbol arithmetic with it.
-       cat > conftest.s <<EOF
-       .data
+# Check if we have .[us]leb128, and support symbol arithmetic with it.
+gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
+  [elf,2,11,0],,
+[      .data
        .uleb128 L2 - L1
 L1:
        .uleb128 1280
        .sleb128 -1010
-L2:
-EOF
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_leb128="yes"
-
-               # GAS versions before 2.11 do not support uleb128,
-               # despite appearing to.
-               # ??? There exists an elf-specific test that will crash
-               # the assembler.  Perhaps it's better to figure out whether
-               # arbitrary sections are supported and try the test.
-               as_ver=`$gcc_cv_as --version 2>/dev/null | head -1`
-               if echo "$as_ver" | grep GNU > /dev/null; then
+L2:],
+ [# GAS versions before 2.11 do not support uleb128,
+  # despite appearing to.
+  # ??? There exists an elf-specific test that will crash
+  # the assembler.  Perhaps it's better to figure out whether
+  # arbitrary sections are supported and try the test.
+  as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
+  if echo "$as_ver" | grep GNU > /dev/null; then
 changequote(,)dnl
-                       as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
-                       as_major=`echo $as_ver | sed 's/\..*//'`
-                       as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
+    as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
+    as_major=`echo $as_ver | sed 's/\..*//'`
+    as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
 changequote([,])dnl
-                       if test $as_major -eq 2 -a $as_minor -lt 11; then
-                               gcc_cv_as_leb128="no"
-                       fi
-               fi
-       fi
-       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
-fi
-if test x"$gcc_cv_as_leb128" = xyes; then
-       AC_DEFINE(HAVE_AS_LEB128, 1,
-               [Define if your assembler supports .uleb128.])
-fi
-AC_MSG_RESULT($gcc_cv_as_leb128)
-
-AC_MSG_CHECKING(assembler eh_frame optimization)
-gcc_cv_as_eh_frame=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
-    test $in_tree_gas_is_elf = yes && gcc_cv_as_eh_frame="yes"
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if this is GAS.
-       as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1`
-       rm -f a.out 2> /dev/null
-       if echo "$as_ver" | grep GNU > /dev/null; then
-               # Versions up to and including 2.11.0 may mis-optimize
-               # .eh_frame data.  Try something.
-               cat > conftest.s <<EOF
-       .text
+    if test $as_major -eq 2 && test $as_minor -lt 11
+    then :
+    else gcc_cv_as_leb128=yes
+    fi
+  fi],
+  [AC_DEFINE(HAVE_AS_LEB128, 1,
+    [Define if your assembler supports .sleb128 and .uleb128.])])
+
+# GAS versions up to and including 2.11.0 may mis-optimize
+# .eh_frame data.
+gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
+  [elf,2,12,0],,
+[      .text
 .LFB1:
        .4byte  0
 .L1:
@@ -1973,61 +1934,46 @@ __FRAME_BEGIN__:
        .4byte  .LFE1-.LFB1
        .byte   0x4
        .4byte  .L1-.LFB1
-.LEFDE1:
-EOF
-               cat > conftest.lit <<EOF
+.LEFDE1:],
+[  cat > conftest.lit <<EOF
  0000 10000000 00000000 017a0001 781a0004  .........z..x...
  0010 01000000 12000000 18000000 00000000  ................
  0020 08000000 04080000 0044               .........D      
 EOF
-               cat > conftest.big <<EOF
+  cat > conftest.big <<EOF
  0000 00000010 00000000 017a0001 781a0004  .........z..x...
  0010 00000001 00000012 00000018 00000000  ................
  0020 00000008 04000000 0844               .........D      
 EOF
-               # If the assembler didn't choke, and we can objdump,
-               # and we got the correct data, then succeed.
-               if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
-                  && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
-                     | tail -3 > conftest.got \
-                  && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
-                       || cmp conftest.big conftest.got > /dev/null 2>&1; }
-               then
-                       gcc_cv_as_eh_frame="yes"
-               else
-                       gcc_cv_as_eh_frame="bad"
-                       if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then
-                               AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
-       [Define if your assembler mis-optimizes .eh_frame data.])
-                       fi
-               fi
-       fi
-       rm -f conftest.*
-fi
-AC_MSG_RESULT($gcc_cv_as_eh_frame)
-
-AC_MSG_CHECKING(assembler section merging support)
-gcc_cv_as_shf_merge=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
-    test $in_tree_gas_is_elf = yes && gcc_cv_as_shf_merge="yes"
-  ])
-elif test x$gcc_cv_as != x; then
-       # Check if we support SHF_MERGE sections
-       echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s
-       if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_shf_merge=yes
-       fi
-       rm -f conftest.s conftest.o
-fi
-if test x"$gcc_cv_as_shf_merge" = xyes; then
-       AC_DEFINE(HAVE_GAS_SHF_MERGE, 1,
-[Define if your assembler supports marking sections with SHF_MERGE flag.])
+  # If the assembler didn't choke, and we can objdump,
+  # and we got the correct data, then succeed.
+  if test x$gcc_cv_objdump != x \
+  && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
+     | tail -3 > conftest.got \
+  && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
+    || cmp conftest.big conftest.got > /dev/null 2>&1; }
+  then
+    gcc_cv_as_eh_frame=yes
+  elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
+    gcc_cv_as_eh_frame=buggy
+  else
+    # Uh oh, what do we do now?
+    gcc_cv_as_eh_frame=no
+  fi])
+
+if test $gcc_cv_as_eh_frame = buggy; then
+  AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
+  [Define if your assembler mis-optimizes .eh_frame data.])
 fi
-AC_MSG_RESULT($gcc_cv_as_shf_merge)
 
-AC_MSG_CHECKING(assembler thread-local storage support)
-gcc_cv_as_tls=no
+gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
+ [elf,2,12,0], [--fatal-warnings],
+ [.section .rodata.str, "aMS", @progbits, 1])
+AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
+  [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
+[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
+
+# Thread-local storage - the check is heavily parametrized.
 conftest_s=
 tls_first_major=
 tls_first_minor=
@@ -2057,7 +2003,6 @@ foo:      .long   25
        tls_first_minor=13
        ;;
   i[34567]86-*-*)
-changequote([,])dnl
     conftest_s='
        .section ".tdata","awT",@progbits
 foo:   .long   25
@@ -2204,40 +2149,66 @@ foo:    .long   25
        tls_first_minor=14
        tls_as_opt="-m64 -Aesame"
        ;;
+  sh-*-* | sh[34]-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       .long   foo@TLSGD
+       .long   foo@TLSLDM
+       .long   foo@DTPOFF
+       .long   foo@GOTTPOFF
+       .long   foo@TPOFF'
+       tls_first_major=2
+       tls_first_minor=13
+       ;;
+  sparc*-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       sethi   %tgd_hi22(foo), %o0
+       add     %o0, %tgd_lo10(foo), %o1
+       add     %l7, %o1, %o0, %tgd_add(foo)
+       call    __tls_get_addr, %tgd_call(foo)
+       sethi   %tldm_hi22(foo), %l1
+       add     %l1, %tldm_lo10(foo), %l2
+       add     %l7, %l2, %o0, %tldm_add(foo)
+       call    __tls_get_addr, %tldm_call(foo)
+       sethi   %tldo_hix22(foo), %l3
+       xor     %l3, %tldo_lox10(foo), %l4
+       add     %o0, %l4, %l5, %tldo_add(foo)
+       sethi   %tie_hi22(foo), %o3
+       add     %o3, %tie_lo10(foo), %o3
+       ld      [%l7 + %o3], %o2, %tie_ld(foo)
+       add     %g7, %o2, %o4, %tie_add(foo)
+       sethi   %tle_hix22(foo), %l1
+       xor     %l1, %tle_lox10(foo), %o5
+       ld      [%g7 + %o5], %o1'
+       tls_first_major=2
+       tls_first_minor=14
+       tls_as_opt=-32
+       ;;
+changequote([,])dnl
 esac
 if test -z "$tls_first_major"; then
-  :
-elif test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE($tls_first_major,$tls_first_minor,0,[
-    gcc_cv_as_tls=yes
-  ])
-elif test x$gcc_cv_as != x; then
-  echo "$conftest_s" > conftest.s
-  if $gcc_cv_as $tls_as_opt --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1
-  then
-    gcc_cv_as_tls=yes
-  fi
-  rm -f conftest.s conftest.o
-fi
-if test "$gcc_cv_as_tls" = yes; then
-  AC_DEFINE(HAVE_AS_TLS, 1,
-           [Define if your assembler supports thread-local storage.])
+  : # If we don't have a check, assume no support.
+else
+  gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
+  [$tls_first_major,$tls_first_minor,0], [$tls_as_opt --fatal-warnings],
+  [$conftest_s],,
+  [AC_DEFINE(HAVE_AS_TLS, 1,
+           [Define if your assembler supports thread-local storage.])])
 fi
-AC_MSG_RESULT($gcc_cv_as_tls)
+
+# Target-specific assembler checks.
 
 case "$target" in
   # All TARGET_ABI_OSF targets.
   alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
-    AC_CACHE_CHECK([assembler supports explicit relocations],
-       gcc_cv_as_explicit_relocs, [
-       gcc_cv_as_explicit_relocs=unknown
-       if test $in_tree_gas = yes ; then
-           gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
-             gcc_cv_as_explicit_relocs=yes
-          ])
-       elif test x$gcc_cv_as != x; then
-           cat > conftest.s << 'EOF'
-       .set nomacro
+    gcc_GAS_CHECK_FEATURE([explicit relocation support],
+       gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
+[      .set nomacro
        .text
        extbl   $3, $2, $3      !lituse_bytoff!1
        ldq     $2, a($29)      !literal!1
@@ -2249,222 +2220,150 @@ case "$target" in
        lda     $0, c($29)      !gprel
        ldah    $1, d($29)      !gprelhigh
        lda     $1, d($1)       !gprellow
-       lda     $29, 0($29)     !gpdisp!3
-EOF
-           if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_explicit_relocs=yes
-           else
-               gcc_cv_as_explicit_relocs=no
-           fi
-           rm -f conftest.s conftest.o
-       fi
-    ])
-    if test "x$gcc_cv_as_explicit_relocs" = xyes; then
-       AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
-               [Define if your assembler supports explicit relocations.])
-    fi
+       lda     $29, 0($29)     !gpdisp!3],,
+    [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
+  [Define if your assembler supports explicit relocations.])])
     ;;
-  sparc*-*-*)
-    AC_CACHE_CHECK([assembler .register pseudo-op support],
-       gcc_cv_as_register_pseudo_op, [
-       gcc_cv_as_register_pseudo_op=unknown
-       if test x$gcc_cv_as != x; then
-           # Check if we have .register
-           echo ".register %g2, #scratch" > conftest.s
-           if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_register_pseudo_op=yes
-           else
-               gcc_cv_as_register_pseudo_op=no
-           fi
-           rm -f conftest.s conftest.o
-       fi
-    ])
-    if test "x$gcc_cv_as_register_pseudo_op" = xyes; then
-       AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
-               [Define if your assembler supports .register.])
-    fi
-
-    AC_CACHE_CHECK([assembler supports -relax],
-       gcc_cv_as_relax_opt, [
-       gcc_cv_as_relax_opt=unknown
-       if test x$gcc_cv_as != x; then
-           # Check if gas supports -relax
-           echo ".text" > conftest.s
-           if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_relax_opt=yes
-           else
-               gcc_cv_as_relax_opt=no
-           fi
-           rm -f conftest.s conftest.o
-       fi
-    ])
-    if test "x$gcc_cv_as_relax_opt" = xyes; then
-       AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
-               [Define if your assembler supports -relax option.])
-    fi
 
-    AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
-       gcc_cv_as_sparc_ua_pcrel, [
-       gcc_cv_as_sparc_ua_pcrel=unknown
-       if test x$gcc_cv_as != x -a x$gcc_cv_ld != x; then
-           gcc_cv_as_sparc_ua_pcrel=no
-           echo ".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo)" > conftest.s
-           if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \
-              && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
-               gcc_cv_as_sparc_ua_pcrel=yes
-           fi
-           rm -f conftest.s conftest.o conftest
-       fi
-    ])
-    if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then
-       AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
+  sparc*-*-*)
+    gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
+      [.register %g2, #scratch],,
+      [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
+               [Define if your assembler supports .register.])])
+
+    gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
+      [-relax], [.text],,
+      [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
+               [Define if your assembler supports -relax option.])])
+
+    gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
+      gcc_cv_as_sparc_ua_pcrel,,
+      [-K PIC],
+[.text
+foo:
+       nop
+.data
+.align 4
+.byte 0
+.uaword %r_disp32(foo)],
+      [if test x$gcc_cv_ld != x \
+       && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
+        gcc_cv_as_sparc_ua_pcrel=yes
+       fi
+       rm -f conftest],
+      [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
                [Define if your assembler and linker support unaligned PC relative relocs.])
-    fi
-
-    AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs against hidden symbols],
-       gcc_cv_as_sparc_ua_pcrel_hidden, [
-       if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then
-           gcc_cv_as_sparc_ua_pcrel_hidden=unknown
-           if test x$gcc_cv_objdump != x; then
-               gcc_cv_as_sparc_ua_pcrel_hidden=no
-               echo ".data; .align 4; .byte 0x31; .uaword %r_disp32(foo)" > conftest.s
-               echo ".byte 0x32, 0x33, 0x34; .global foo; .hidden foo" >> conftest.s
-               echo "foo: .skip 4" >> conftest.s
-               if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \
-                  && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
-                  && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
-                     | grep ' 31000000 07323334' > /dev/null 2>&1; then
-                   if $gcc_cv_objdump -R conftest 2> /dev/null \
-                      | grep 'DISP32' > /dev/null 2>&1; then
-                       :
-                   else
-                       gcc_cv_as_sparc_ua_pcrel_hidden=yes
-                   fi
-               fi
-           fi
-           rm -f conftest.s conftest.o conftest
-       else
-           gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel"
-       fi
-    ])
-    if test "x$gcc_cv_as_sparc_ua_pcrel_hidden" = xyes; then
-       AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
-               [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])
-    fi
 
-    AC_CACHE_CHECK([for assembler offsetable %lo() support],
-       gcc_cv_as_offsetable_lo10, [
-       gcc_cv_as_offsetable_lo10=unknown
-       if test "x$gcc_cv_as" != x; then
-           # Check if assembler has offsetable %lo()
-           echo "or %g1, %lo(ab) + 12, %g1" > conftest.s
-           echo "or %g1, %lo(ab + 12), %g1" > conftest1.s
-           if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \
-                   > /dev/null 2>&1 &&
-              $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \
-                   > /dev/null 2>&1; then
-               if cmp conftest.o conftest1.o > /dev/null 2>&1; then
-                   gcc_cv_as_offsetable_lo10=no
-               else
-                   gcc_cv_as_offsetable_lo10=yes
-               fi
+      gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
+       gcc_cv_as_sparc_ua_pcrel_hidden,,
+       [-K PIC],
+[.data
+.align 4
+.byte 0x31
+.uaword %r_disp32(foo)
+.byte 0x32, 0x33, 0x34
+.global foo
+.hidden foo
+foo:
+.skip 4],
+       [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
+        && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
+        && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
+           | grep ' 31000000 07323334' > /dev/null 2>&1; then
+           if $gcc_cv_objdump -R conftest 2> /dev/null \
+              | grep 'DISP32' > /dev/null 2>&1; then
+               :
            else
-               gcc_cv_as_offsetable_lo10=no
+               gcc_cv_as_sparc_ua_pcrel_hidden=yes
            fi
-           rm -f conftest.s conftest.o conftest1.s conftest1.o
-       fi
-    ])
-    if test "x$gcc_cv_as_offsetable_lo10" = xyes; then
-       AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
-           [Define if your assembler supports offsetable %lo().])
-    fi
-
+        fi
+        rm -f conftest],
+        [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
+                  [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
+    ]) # unaligned pcrel relocs
+
+    gcc_GAS_CHECK_FEATURE([offsetable %lo()],
+      gcc_cv_as_sparc_offsetable_lo10,,
+      [-xarch=v9],
+[.text
+       or %g1, %lo(ab) + 12, %g1
+       or %g1, %lo(ab + 12), %g1],
+      [if test x$gcc_cv_objdump != x \
+       && %gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
+          | grep ' 82106000 82106000' > /dev/null 2>&1; then
+        gcc_cv_as_offsetable_lo10=yes
+       fi],
+       [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
+                [Define if your assembler supports offsetable %lo().])])
     ;;
 
 changequote(,)dnl
   i[34567]86-*-* | x86_64-*-*)
 changequote([,])dnl
-    AC_MSG_CHECKING(assembler instructions)
-    gcc_cv_as_instructions=
-    if test $in_tree_gas = yes ; then 
-      gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
-       gcc_cv_as_instructions="filds fists"
-      ])
-    elif test x$gcc_cv_as != x; then
-       set "filds fists" "filds mem; fists mem"
-       while test $# -gt 0
-       do
-               echo "$2" > conftest.s
-               if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-                       gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" "
-               fi
-               shift 2
-       done
-       rm -f conftest.s conftest.o
-    fi
-    if test x"$gcc_cv_as_instructions" != x; then
-       AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | sed -e 's/ $//' | tr '[a-z ]' '[A-Z_]'`)
-    fi
-    AC_MSG_RESULT($gcc_cv_as_instructions)
-
-    AC_MSG_CHECKING(assembler GOTOFF in data directives)
-    gcc_cv_as_gotoff_in_data=no
-    if test $in_tree_gas = yes ; then
-      gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-       gcc_cv_as_gotoff_in_data=yes
-      ])
-    elif test x$gcc_cv_as != x; then
-       cat > conftest.s <<EOF
-       .text
+    gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
+       gcc_cv_as_ix86_filds_fists,
+      [2,9,0],, [filds mem; fists mem],,
+      [AC_DEFINE(HAVE_GAS_FILDS_FISTS, 1,
+        [Define if your assembler uses the new HImode fild and fist notation.])])
+
+    gcc_GAS_CHECK_FEATURE([cmov syntax],
+      gcc_cv_as_ix86_cmov_sun_syntax,,,
+      [cmovl.l %edx, %eax],,
+      [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
+        [Define if your assembler supports the Sun syntax for cmov.])])
+
+    # This one is used unconditionally by i386.[ch]; it is to be defined
+    # to 1 if the feature is present, 0 otherwise.
+    gcc_GAS_CHECK_FEATURE([GOTOFF in data],
+        gcc_cv_as_ix86_gotoff_in_data, [2,11,0],,
+[      .text
 .L0:
        nop
        .data
-       .long .L0@GOTOFF
-EOF
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-         gcc_cv_as_gotoff_in_data=yes
-       fi
-    fi
+       .long .L0@GOTOFF])
     AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
-      [`if test $gcc_cv_as_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
+      [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
       [Define true if the assembler supports '.long foo@GOTOFF'.])
-    AC_MSG_RESULT($gcc_cv_as_gotoff_in_data)
     ;;
 
   ia64*-*-*)
-    AC_CACHE_CHECK([assembler supports ltoffx and ldxmov],
-       gcc_cv_as_ltoffx_ldxmov_relocs, [
-       gcc_cv_as_ltoffx_ldxmov_relocs=unknown
-       if test $in_tree_gas = yes ; then
-          gcc_GAS_VERSION_GTE_IFELSE(2,14,0,[
-           gcc_cv_as_ltoffx_ldxmov_relocs=yes
-          ])
-       elif test x$gcc_cv_as != x; then
-           cat > conftest.s << 'EOF'
-changequote(,)dnl
-       .text
+    gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
+       gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
+[      .text
        addl r15 = @ltoffx(x#), gp
        ;;
-       ld8.mov r16 = [r15], x#
-EOF
-changequote([,])dnl
-           if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
-               gcc_cv_as_ltoffx_ldxmov_relocs=yes
-           else
-               gcc_cv_as_ltoffx_ldxmov_relocs=no
-           fi
-           rm -f conftest.s conftest.o
-       fi
-    ])
-    if test "x$gcc_cv_as_ltoffx_ldxmov_relocs" = xyes; then
-       AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
-         [Define if your assembler supports ltoffx and ldxmov relocations.])
-    fi
+       ld8.mov r16 = [[r15]], x#],,
+    [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
+         [Define if your assembler supports ltoffx and ldxmov relocations.])])
+
+    ;;
+
+  powerpc*-*-*)
+    case $target in
+      *-*-aix) conftest_s='    .csect .text[PR]';;
+      *)       conftest_s='    .text';;
+    esac
+    conftest_s="$conftest_s
+       mfcr 3,128"
+
+    gcc_GAS_CHECK_FEATURE([mfcr field support],
+      gcc_cv_as_powerpc_mfcrf, [2,14,0],,
+      [$conftest_s],,
+      [AC_DEFINE(HAVE_AS_MFCRF, 1,
+         [Define if your assembler supports mfcr field.])])
     ;;
-esac
 
-AC_MSG_CHECKING(assembler dwarf2 debug_line support)
-gcc_cv_as_dwarf2_debug_line=no
+  mips*-*-*)
+    gcc_GAS_CHECK_FEATURE([explicit relocation support],
+      gcc_cv_as_mips_explicit_relocs, [2,14,0],,
+[      lw $4,%gp_rel(foo)($4)],,
+      [if test x$target_cpu_default = x
+       then target_cpu_default=MASK_EXPLICIT_RELOCS
+       else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
+       fi])
+
+    ;;
+esac
 # ??? Not all targets support dwarf2 debug_line, even within a version
 # of gas.  Moreover, we need to emit a valid instruction to trigger any
 # info to the output file.  So, as supported targets are added to gas 2.11,
@@ -2483,90 +2382,55 @@ case "$target" in
   mmix-*-*)
     insn="swym 0"
     ;;
-  esac
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-    test $in_tree_gas_is_elf = yes && test x"$insn" != x \
-       && gcc_cv_as_dwarf2_debug_line="yes"
-  ])
-elif test x$gcc_cv_as != x -a x"$insn" != x ; then
-       echo '  .file 1 "conftest.s"' > conftest.s
-       echo '  .loc 1 3 0' >> conftest.s
-       echo "  $insn" >> conftest.s
-       # ??? This fails with non-gnu grep.
-       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
-          && grep debug_line conftest.o > /dev/null 2>&1 ; then
-               # The .debug_line file table must be in the exact order that
-               # we specified the files, since these indices are also used
-               # by DW_AT_decl_file.  Approximate this test by testing if
-               # the assembler bitches if the same index is assigned twice.
-               echo '  .file 1 "foo.s"' > conftest.s
-               echo '  .file 1 "bar.s"' >> conftest.s
-               if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1
-               then
-                 gcc_cv_as_dwarf2_debug_line="no"
-               else
-                 gcc_cv_as_dwarf2_debug_line="yes"
-               fi
-       fi
-       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
-fi
-if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then
+esac
+if test x"$insn" != x; then
+ conftest_s="\
+       .file 1 \"conftest.s\"
+       .loc 1 3 0
+       $insn"
+ gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
+  gcc_cv_as_dwarf2_debug_line,
+  [elf,2,11,0],, [$conftest_s],
+  [# ??? This fails with non-gnu grep.  Maybe use objdump?
+   if grep debug_line conftest.o > /dev/null 2>&1; then
+     gcc_cv_as_dwarf2_debug_line=yes
+   fi])
+
+# The .debug_line file table must be in the exact order that
+# we specified the files, since these indices are also used
+# by DW_AT_decl_file.  Approximate this test by testing if
+# the assembler bitches if the same index is assigned twice.
+ gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
+  gcc_cv_as_dwarf2_file_buggy,,,
+[      .file 1 "foo.s"
+       .file 1 "bar.s"])
+
+ if test $gcc_cv_as_dwarf2_debug_line = yes \
+ && test $gcc_cv_as_dwarf2_file_buggy = no; then
        AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
-[Define if your assembler supports dwarf2 .file/.loc directives,
+  [Define if your assembler supports dwarf2 .file/.loc directives,
    and preserves file table indices exactly as given.])
+ fi
+
+ gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
+  gcc_cv_as_gdwarf2_flag,
+  [elf,2,11,0], [--gdwarf2], [$insn],,
+  [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
+[Define if your assembler supports the --gdwarf2 option.])])
+
+ gcc_GAS_CHECK_FEATURE([--gstabs option],
+  gcc_cv_as_gstabs_flag,
+  [elf,2,11,0], [--gstabs], [$insn],
+  [# The native Solaris 9/Intel assembler doesn't understand --gstabs
+   # and warns about it, but still exits successfully.  So check for
+   # this.
+   if AC_TRY_COMMAND([$gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null])
+   then :
+   else gcc_cv_as_gstabs_flag=yes
+   fi],
+  [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
+[Define if your assembler supports the --gstabs option.])])
 fi
-AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
-
-AC_MSG_CHECKING(assembler --gdwarf2 support)
-gcc_cv_as_gdwarf2_flag=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-    test $in_tree_gas_is_elf = yes && test x"$insn" != x \
-       && gcc_cv_as_gdwarf2_flag="yes"
-  ])
-elif test x$gcc_cv_as != x -a x"$insn" != x ; then
-       echo '' > conftest.s
-       # ??? This fails with non-gnu grep.
-       if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1
-         then
-         gcc_cv_as_gdwarf2_flag="yes"
-       fi
-       rm -f conftest.s conftest.o
-fi
-if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then
-       AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
-[Define if your assembler supports the --gdwarf2 option.])
-fi
-AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag)
-
-AC_MSG_CHECKING(assembler --gstabs support)
-gcc_cv_as_gstabs_flag=no
-if test $in_tree_gas = yes ; then
-  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-    test $in_tree_gas_is_elf = yes && test x"$insn" != x \
-       && gcc_cv_as_gstabs_flag="yes"
-  ])
-elif test x$gcc_cv_as != x -a x"$insn" != x ; then
-       echo '' > conftest.s
-       # ??? This fails with non-gnu grep.
-       if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then
-         gcc_cv_as_gstabs_flag="yes"
-         # The native Solaris 9/Intel assembler doesn't understand --gstabs
-         # and warns about it, but still exits successfully.  So check for
-         # this.
-         if $gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | \
-               grep -i warning > /dev/null ; then
-           gcc_cv_as_gstabs_flag="no"
-         fi
-       fi
-       rm -f conftest.s conftest.o
-fi
-if test x"$gcc_cv_as_gstabs_flag" = xyes; then
-       AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
-[Define if your assembler supports the --gstabs option.])
-fi
-AC_MSG_RESULT($gcc_cv_as_gstabs_flag)
 
 AC_MSG_CHECKING(linker read-only and read-write section mixing)
 gcc_cv_ld_ro_rw_mix=unknown
@@ -2660,7 +2524,7 @@ case "$target" in
     else
       test_prefix=$exec_prefix
     fi
-    for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld
+    for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_noncanonical/lib/idt.ld
     do
       if grep '^STARTUP' $f > /dev/null 2>&1; then
         gcc_cv_mips_libgloss_startup=yes
@@ -2672,33 +2536,13 @@ case "$target" in
         [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.])
     fi
     AC_MSG_RESULT($gcc_cv_mips_libgloss_startup)
-
-    AC_MSG_CHECKING(whether the assembler has explicit relocation support)
-    if test x$gcc_cv_mips_explicit_relocs = x; then
-      gcc_cv_mips_explicit_relocs=no
-      if test $in_tree_gas = yes; then
-        gcc_GAS_VERSION_GTE_IFELSE(2,14,0,[
-         gcc_cv_mips_explicit_relocs=yes
-       ])
-      elif test x$gcc_cv_as != x; then
-       echo '  lw $4,%gp_rel(foo)($4)' > conftest.s
-       if $gcc_cv_as conftest.s -o conftest.o > /dev/null 2>&1; then
-         gcc_cv_mips_explicit_relocs=yes
-       fi
-       rm -f conftest.s conftest.o
-      fi
-    fi
-    if test $gcc_cv_mips_explicit_relocs = yes; then
-      test x$target_cpu_default != x || target_cpu_default=0
-      target_cpu_default="(${target_cpu_default}|MASK_EXPLICIT_RELOCS)"
-    fi
-    AC_MSG_RESULT($gcc_cv_mips_explicit_relocs)
     ;;
 esac
 
 if test x$with_sysroot = x && test x$host = x$target \
    && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
-  AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
+  AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
+[Define to PREFIX/include if cpp should also search that directory.])
 fi
 
 # Figure out what language subdirectories are present.
@@ -2726,11 +2570,9 @@ enable_languages=`echo "${enable_languages}" | sed -e 's/[[      ,]][[   ,]]*/,/g' -e
 # First scan to see if an enabled language requires some other language.
 # We assume that a given config-lang.in will list all the language
 # front ends it requires, even if some are required indirectly.
-for lang in ${srcdir}/*/config-lang.in ..
+for lang in ${srcdir}/*/config-lang.in
 do
    case $lang in
-    ..)
-       ;;
     # The odd quoting in the next line works around
     # an apparent bug in bash 1.12 on linux.
 changequote(,)dnl
@@ -2759,10 +2601,9 @@ done
 expected_languages=`echo ,${enable_languages}, | sed -e 's:,: :g' -e 's:  *: :g' -e 's:  *: :g' -e 's:^ ::' -e 's: $::'`
 found_languages=
 subdirs=
-for lang in ${srcdir}/*/config-lang.in ..
+for lang in ${srcdir}/*/config-lang.in
 do
        case $lang in
-       ..) ;;
        # The odd quoting in the next line works around
        # an apparent bug in bash 1.12 on linux.
 changequote(,)dnl
@@ -2890,7 +2731,6 @@ AC_SUBST(MAINT)dnl
 
 lang_opt_files=
 lang_specs_files=
-lang_options_files=
 lang_tree_files=
 for subdir in . $subdirs
 do
@@ -2900,9 +2740,6 @@ do
        if test -f $srcdir/$subdir/lang-specs.h; then
            lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
        fi
-       if test -f $srcdir/$subdir/lang-options.h; then
-           lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h"
-       fi
        if test -f $srcdir/$subdir/$subdir-tree.def; then
            lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
        fi
@@ -2916,6 +2753,8 @@ all_compilers=
 all_stagestuff=
 all_outputs='Makefile fixinc/Makefile gccbug mklibgcc mkheaders'
 # List of language makefile fragments.
+all_lang_makefrags=
+# List of language subdirectory makefiles.  Deprecated.
 all_lang_makefiles=
 # Files for gengtype
 all_gtfiles="$target_gtfiles"
@@ -2930,13 +2769,10 @@ all_gtfiles_files_files=
 # The other mechanism is a set of hooks for each of the main targets
 # like `clean', `install', etc.
 
-language_fragments="Make-lang"
 language_hooks="Make-hooks"
 
-for s in .. $subdirs
+for s in $subdirs
 do
-       if test $s != ".."
-       then
                language=
                boot_language=
                compilers=
@@ -2949,9 +2785,9 @@ do
                        echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2
                        exit 1
                fi
-               all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in"
+               all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$s/Make-lang.in"
                if test -f ${srcdir}/$s/Makefile.in
-               then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in"
+               then all_lang_makefiles="$s/Makefile"
                fi
                all_languages="$all_languages $language"
                if test "x$boot_language" = xyes
@@ -2962,15 +2798,11 @@ do
                all_stagestuff="$all_stagestuff $stagestuff"
                all_outputs="$all_outputs $outputs"
                all_gtfiles="$all_gtfiles $gtfiles"
-                for f in .. $gtfiles
+                for f in $gtfiles
                 do
-                    if test $f != ".."
-                     then
                          all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} "
                          all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
-                     fi
                 done
-       fi
 done
 
 # Pick up gtfiles for c
@@ -2978,31 +2810,24 @@ gtfiles=
 s="c"
 . ${srcdir}/c-config-lang.in
 all_gtfiles="$all_gtfiles $gtfiles"
-for f in .. $gtfiles
+for f in $gtfiles
 do
-     if test $f != ".."
-     then
         all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} "
         all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
-     fi
 done
 
 check_languages=
-for language in .. $all_languages
+for language in $all_languages
 do
-       if test $language != ".."
-       then
                check_languages="$check_languages check-$language"
-       fi
 done
 
-# Since we can't use `::' targets, we link each language in
-# with a set of hooks, reached indirectly via lang.${target}.
+# We link each language in with a set of hooks, reached indirectly via
+# lang.${target}.
 
 rm -f Make-hooks
 touch Make-hooks
 target_list="all.build all.cross start.encap rest.encap tags \
-       info dvi generated-manpages \
        install-normal install-common install-info install-man \
        uninstall \
        mostlyclean clean distclean extraclean maintainer-clean \
@@ -3010,11 +2835,9 @@ target_list="all.build all.cross start.encap rest.encap tags \
 for t in $target_list
 do
        x=
-       for lang in .. $all_languages
+       for lang in $all_languages
        do
-               if test $lang != ".."; then
                        x="$x $lang.$t"
-               fi
        done
        echo "lang.$t: $x" >> Make-hooks
 done
@@ -3043,7 +2866,7 @@ echo "source ${srcdir}/gdbinit.in" >> .gdbinit
 # make and thus we'd get different behavior depending on where we built the
 # sources.
 if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
-    gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
+    gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_noncanonical)'
 else
 changequote(<<, >>)dnl
 # An explanation of the sed strings:
@@ -3068,7 +2891,7 @@ changequote(<<, >>)dnl
 #   /foo        /foo/bar/ugg      ../../
 #
     dollar='$$'
-    gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)"
+    gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_noncanonical)"
 changequote([, ])dnl
 fi
 AC_SUBST(gcc_tooldir)
@@ -3096,9 +2919,6 @@ AC_SUBST(slibdir)
 objdir=`${PWDCMD-pwd}`
 AC_SUBST(objdir)
 
-# Process the language and host/target makefile fragments.
-${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file"
-
 # Substitute configuration variables
 AC_SUBST(subdirs)
 AC_SUBST(srcdir)
@@ -3107,20 +2927,21 @@ AC_SUBST(all_compilers)
 AC_SUBST(all_gtfiles)
 AC_SUBST(all_gtfiles_files_langs)
 AC_SUBST(all_gtfiles_files_files)
+AC_SUBST(all_lang_makefrags)
 AC_SUBST(all_lang_makefiles)
 AC_SUBST(all_languages)
 AC_SUBST(all_stagestuff)
 AC_SUBST(build_exeext)
 AC_SUBST(build_install_headers_dir)
 AC_SUBST(build_xm_file_list)
-AC_SUBST(build_xm_file)
+AC_SUBST(build_xm_include_list)
 AC_SUBST(build_xm_defines)
 AC_SUBST(check_languages)
 AC_SUBST(cc_set_by_configure)
 AC_SUBST(quoted_cc_set_by_configure)
 AC_SUBST(cpp_install_dir)
-AC_SUBST(dep_host_xmake_file)
-AC_SUBST(dep_tmake_file)
+AC_SUBST(xmake_file)
+AC_SUBST(tmake_file)
 AC_SUBST(extra_headers_list)
 AC_SUBST(extra_objs)
 AC_SUBST(extra_parts)
@@ -3136,12 +2957,11 @@ AC_SUBST(gcc_version_trigger)
 AC_SUBST(host_exeext)
 AC_SUBST(host_extra_gcc_objs)
 AC_SUBST(host_xm_file_list)
-AC_SUBST(host_xm_file)
+AC_SUBST(host_xm_include_list)
 AC_SUBST(host_xm_defines)
 AC_SUBST(out_host_hook_obj)
 AC_SUBST(install)
 AC_SUBST(lang_opt_files)
-AC_SUBST(lang_options_files)
 AC_SUBST(lang_specs_files)
 AC_SUBST(lang_tree_files)
 AC_SUBST(local_prefix)
@@ -3154,20 +2974,18 @@ AC_SUBST(quoted_stage_prefix_set_by_configure)
 AC_SUBST(symbolic_link)
 AC_SUBST(thread_file)
 AC_SUBST(tm_file_list)
-AC_SUBST(tm_file)
+AC_SUBST(tm_include_list)
 AC_SUBST(tm_defines)
 AC_SUBST(tm_p_file_list)
-AC_SUBST(tm_p_file)
-AC_SUBST(xm_file)
+AC_SUBST(tm_p_include_list)
+AC_SUBST(xm_file_list)
+AC_SUBST(xm_include_list)
 AC_SUBST(xm_defines)
-AC_SUBST(target_alias)
+AC_SUBST(target_noncanonical)
 AC_SUBST(c_target_objs)
 AC_SUBST(cxx_target_objs)
 AC_SUBST(target_cpu_default)
 
-AC_SUBST_FILE(target_overrides)
-AC_SUBST_FILE(host_overrides)
-AC_SUBST_FILE(language_fragments)
 AC_SUBST_FILE(language_hooks)
 
 # Echo that links are built
@@ -3207,6 +3025,11 @@ case x$CONFIG_HEADERS in
 xauto-host.h:config.in)
 echo > cstamp-h ;;
 esac
+# Make sure all the subdirs exist.
+for d in $subdirs
+do
+    test -d $d || mkdir $d
+done
 # If the host supports symlinks, point stage[1234] at ../stage[1234] so
 # bootstrapping and the installation procedure can still use
 # CC="stage1/xgcc -Bstage1/".  If the host doesn't support symlinks,
@@ -3214,8 +3037,7 @@ esac
 # This is virtually a duplicate of what happens in configure.lang; we do
 # an extra check to make sure this only happens if ln -s can be used.
 if test "$symbolic_link" = "ln -s"; then
- for d in .. ${subdirs} fixinc ; do
-   if test $d != ..; then
+ for d in ${subdirs} fixinc ; do
        STARTDIR=`${PWDCMD-pwd}`
        cd $d
        for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include
@@ -3224,7 +3046,6 @@ if test "$symbolic_link" = "ln -s"; then
                $symbolic_link ../$t $t 2>/dev/null
        done
        cd $STARTDIR
-   fi
  done
 else true ; fi
 ],