OSDN Git Service

* regclass.c (init_reg_autoinc): New function.
[pf3gnuchains/gcc-fork.git] / gcc / configure.in
index 8cbc766..4ec16ea 100644 (file)
@@ -1,7 +1,8 @@
 # configure.in for GCC
 # Process this file with autoconf to generate a configuration script.
 
-# Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
@@ -167,7 +168,7 @@ esac])
 
 if test x${gcc_gxx_include_dir} = x; then
   if test x${enable_version_specific_runtime_libs} = xyes; then
-    gcc_gxx_include_dir='${libsubdir}/include/g++'
+    gcc_gxx_include_dir='${libsubdir}/include/c++'
   else
     topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
 changequote(<<, >>)dnl
@@ -176,26 +177,120 @@ changequote([, ])dnl
   fi
 fi
 
+# Determine the host, build, and target systems
+AC_CANONICAL_SYSTEM
+
+# Set program_transform_name
+AC_ARG_PROGRAM
+
+# Find the native compiler
+AC_PROG_CC
+AC_PROG_CC_C_O
+# autoconf is lame and doesn't give us any substitution variable for this.
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
+  NO_MINUS_C_MINUS_O=yes
+else
+  OUTPUT_OPTION='-o $@'
+fi
+AC_SUBST(NO_MINUS_C_MINUS_O)
+AC_SUBST(OUTPUT_OPTION)
+
+# See if GNAT has been installed
+gcc_AC_PROG_GNAT
+
+AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
+ac_cv_prog_cc_no_long_long,
+[save_CFLAGS="$CFLAGS"
+CFLAGS="-Wno-long-long"
+AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
+              ac_cv_prog_cc_no_long_long=no)
+CFLAGS="$save_CFLAGS"])
+
+if test x$have_gnat != xno ; then 
+AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
+ac_cv_prog_adac_no_long_long,
+[cat >conftest.adb <<EOF
+procedure conftest is begin null; end conftest;
+EOF
+if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
+  ac_cv_prog_adac_no_long_long=yes
+else
+  ac_cv_prog_adac_no_long_long=no
+fi
+rm -f conftest*])
+else
+  ac_cv_prog_adac_no_long_long=yes
+fi
+
+strict1_warn=
+if test $ac_cv_prog_cc_no_long_long = yes && \
+    test $ac_cv_prog_adac_no_long_long = yes ; then
+  strict1_warn="-pedantic -Wno-long-long"
+fi
+AC_SUBST(strict1_warn)
+
+AC_PROG_CPP
+AC_C_INLINE
+gcc_AC_C_VOLATILE
+
+gcc_AC_C_LONG_DOUBLE
+gcc_AC_C_LONG_LONG
+gcc_AC_C__BOOL
+
+# sizeof(char) is 1 by definition.
+AC_COMPILE_CHECK_SIZEOF(short)
+AC_COMPILE_CHECK_SIZEOF(int)
+AC_COMPILE_CHECK_SIZEOF(long)
+if test $ac_cv_c_long_long = yes; then
+  AC_COMPILE_CHECK_SIZEOF(long long)
+fi
+if test $ac_cv_c___int64 = yes; then
+  AC_COMPILE_CHECK_SIZEOF(__int64)
+fi
+
+gcc_AC_C_CHARSET
+
+# If the native compiler is GCC, we can enable warnings even in stage1.  
+# That's useful for people building cross-compilers, or just running a
+# quick `make'.
+warn_cflags=
+if test "x$GCC" = "xyes"; then
+  warn_cflags='$(GCC_WARN_CFLAGS)'
+fi
+AC_SUBST(warn_cflags)
+
 # Determine whether or not multilibs are enabled.
 AC_ARG_ENABLE(multilib,
 [  --enable-multilib       enable library support for multiple ABIs],
 [], [enable_multilib=yes])
 AC_SUBST(enable_multilib)
 
+# Enable -Werror in bootstrap stage2 and later.
+# Change the default to "no" on release branches.
+AC_ARG_ENABLE(werror, 
+[  --enable-werror         enable -Werror in bootstrap stage2 and later], [],
+[enable_werror=yes])
+if test x$enable_werror = xyes ; then
+  WERROR=-Werror
+fi
+AC_SUBST(WERROR)
+
 # Enable expensive internal checks
 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,gc,gcac; default
-                         is misc,tree,gc],
+                         Categories are: misc,tree,rtl,rtlflag,gc,gcac;
+                         default is misc,tree,gc,rtlflag],
 [ac_checking=
 ac_tree_checking=
 ac_rtl_checking=
+ac_rtlflag_checking=
 ac_gc_checking=
 ac_gc_always_collect=
 case "${enableval}" in
-yes)   ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;;
+yes)   ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;
+       ac_rtlflag_checking=1 ;;
 no)    ;;
 *)     IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
        set fnord $enableval; shift
@@ -205,9 +300,11 @@ no)        ;;
                case $check in
                misc)   ac_checking=1 ;;
                tree)   ac_tree_checking=1 ;;
+               rtlflag)        ac_rtlflag_checking=1 ;;
                rtl)    ac_rtl_checking=1 ;;
                gc)     ac_gc_checking=1 ;;
                gcac)   ac_gc_always_collect=1 ;;
+               valgrind)       ac_checking_valgrind=1 ;;
                *)      AC_MSG_ERROR(unknown check category $check) ;;
                esac
        done
@@ -215,12 +312,15 @@ no)       ;;
 esac
 ], 
 # Enable some checks by default for development versions of GCC
-[ac_checking=1; ac_tree_checking=1; ac_gc_checking=1;])
+[ac_checking=1; ac_tree_checking=1; ac_gc_checking=1; ac_rtlflag_checking=1;])
+nocommon_flag=""
 if test x$ac_checking != x ; then
   AC_DEFINE(ENABLE_CHECKING, 1,
 [Define if you want more run-time sanity checks.  This one gets a grab
    bag of miscellaneous but relatively cheap checks.])
+  nocommon_flag=-fno-common
 fi
+AC_SUBST(nocommon_flag)
 if test x$ac_tree_checking != x ; then
   AC_DEFINE(ENABLE_TREE_CHECKING, 1,
 [Define if you want all operations on trees (the basic data
@@ -233,6 +333,12 @@ if test x$ac_rtl_checking != x ; then
    of the optimizer and back end) to be checked for dynamic type safety
    at runtime.  This is quite expensive.])
 fi
+if test x$ac_rtlflag_checking != x ; then
+  AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
+[Define if you want RTL flag accesses to be checked against the RTL
+   codes that are supported for each access macro.  This is relatively
+   cheap.])
+fi
 if test x$ac_gc_checking != x ; then
   AC_DEFINE(ENABLE_GC_CHECKING, 1,
 [Define if you want the garbage collector to do object poisoning and
@@ -244,11 +350,47 @@ 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
-
-
-AC_ARG_ENABLE(cpp,
-[  --disable-cpp           don't provide a user-visible C preprocessor],
-[], [enable_cpp=yes])
+valgrind_path_defines=
+valgrind_command=
+if test x$ac_checking_valgrind != x ; then
+  # It is certainly possible that there's valgrind but no valgrind.h.
+  # GCC relies on making annotations so we must have both.
+  AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
+  AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
+       [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
+  if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then
+       AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h])
+  fi
+  valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
+  valgrind_command="$valgrind_path -q"
+  AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
+[Define if you want to run subprograms and generated programs
+   through valgrind (a memory checker).  This is extremely expensive.])
+fi
+AC_SUBST(valgrind_path_defines)
+AC_SUBST(valgrind_command)
+
+# Enable code coverage collection
+AC_ARG_ENABLE(coverage,
+[  --enable-coverage[=LEVEL]
+                         enable compiler\'s code coverage collection.
+                         Use to measure compiler performance and locate
+                         unused parts of the compiler. With LEVEL, specify
+                         optimization. Values are opt, noopt,
+                         default is noopt],
+[case "${enableval}" in
+yes|noopt)
+       coverage_flags="-fprofile-arcs -ftest-coverage -O0 -DSELF_COVERAGE=1"
+       ;;
+opt)
+       coverage_flags="-fprofile-arcs -ftest-coverage -O2 -DSELF_COVERAGE=2"
+       ;;
+*)
+       AC_MSG_ERROR(unknown coverage setting $enableval)
+       ;;
+esac],
+[coverage_flags=""])
+AC_SUBST(coverage_flags)
 
 AC_ARG_WITH(cpp_install_dir,
 [  --with-cpp-install-dir=DIR
@@ -260,6 +402,18 @@ elif test x$withval != xno; then
   cpp_install_dir=$withval
 fi])
 
+# Enable __cxa_atexit for C++.
+AC_ARG_ENABLE(__cxa_atexit,
+[  --enable-__cxa_atexit   enable __cxa_atexit for C++],
+[], [])
+if test x$enable___cxa_atexit = xyes; then
+  AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1,
+  [Define if you want to use __cxa_atexit, rather than atexit, to
+   register C++ destructors for local statics and global objects.
+   This is essential for fully standards-compliant handling of
+   destructors, but requires __cxa_atexit in libc.])
+fi
+  
 # Enable Multibyte Characters for C/C++
 AC_ARG_ENABLE(c-mbchar,
 [  --enable-c-mbchar       enable multibyte characters for C and C++],
@@ -332,66 +486,24 @@ AC_ARG_ENABLE(shared,
 ], [enable_shared=yes])
 AC_SUBST(enable_shared)
 
-# Determine the host, build, and target systems
-AC_CANONICAL_SYSTEM
-
-# Set program_transform_name
-AC_ARG_PROGRAM
-
-# Find the native compiler
-AC_PROG_CC
-AC_PROG_CC_C_O
-# autoconf is lame and doesn't give us any substitution variable for this.
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
-  NO_MINUS_C_MINUS_O=yes
-else
-  OUTPUT_OPTION='-o $@'
-fi
-AC_SUBST(NO_MINUS_C_MINUS_O)
-AC_SUBST(OUTPUT_OPTION)
-
-AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
-ac_cv_prog_cc_no_long_long,
-[save_CFLAGS="$CFLAGS"
-CFLAGS="-Wno-long-long"
-AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
-              ac_cv_prog_cc_no_long_long=no)
-CFLAGS="$save_CFLAGS"])
-strict1_warn=
-if test $ac_cv_prog_cc_no_long_long = yes; then
-  strict1_warn="-pedantic -Wno-long-long"
-fi
-AC_SUBST(strict1_warn)
-
-AC_PROG_CPP
-AC_C_INLINE
-gcc_AC_C_VOLATILE
-
-gcc_AC_C_LONG_DOUBLE
-gcc_AC_C_LONG_LONG
-gcc_AC_C__BOOL
-
-# sizeof(char) is 1 by definition.
-gcc_AC_COMPILE_CHECK_SIZEOF(short)
-gcc_AC_COMPILE_CHECK_SIZEOF(int)
-gcc_AC_COMPILE_CHECK_SIZEOF(long)
-if test $ac_cv_c_long_long = yes; then
-  gcc_AC_COMPILE_CHECK_SIZEOF(long long)
-fi
-if test $ac_cv_c___int64 = yes; then
-  gcc_AC_COMPILE_CHECK_SIZEOF(__int64)
-fi
-
-gcc_AC_C_CHARSET
-
-# If the native compiler is GCC, we can enable warnings even in stage1.  
-# That's useful for people building cross-compilers, or just running a
-# quick `make'.
-warn_cflags=
-if test "x$GCC" = "xyes"; then
-  warn_cflags='$(GCC_WARN_CFLAGS)'
-fi
-AC_SUBST(warn_cflags)
+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='${gcc_tooldir}/sys-root' ;;
+ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
+ esac
+   
+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
+], [
+ TARGET_SYSTEM_ROOT=
+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
+ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
+])
+AC_SUBST(TARGET_SYSTEM_ROOT)
+AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
 
 # Stage specific cflags for build.
 stage1_cflags=
@@ -404,6 +516,13 @@ vax-*-*)
     stage1_cflags="-J"
   fi
   ;;
+powerpc-*-darwin*)
+  # The spiffy cpp-precomp chokes on some legitimate constructs in GCC
+  # sources; use -no-cpp-precomp to get to GNU cpp.
+  # Apple's GCC has bugs in designated initializer handling, so disable
+  # that too.
+  stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
+  ;;
 esac
 AC_SUBST(stage1_cflags)
 
@@ -460,7 +579,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/resource.h sys/param.h sys/times.h sys/stat.h \
-                direct.h malloc.h langinfo.h)
+                direct.h malloc.h langinfo.h ldfcn.h)
 
 # Check for thread headers.
 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@@ -468,12 +587,9 @@ AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
 
 # These tests can't be done till we know if we have limits.h.
 gcc_AC_C_CHAR_BIT
-gcc_AC_C_COMPILE_ENDIAN
+AC_C_BIGENDIAN_CROSS
 gcc_AC_C_FLOAT_FORMAT
 
-# See if GNAT has been installed
-gcc_AC_PROG_GNAT
-
 # See if we have the mktemp command.
 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
 
@@ -487,7 +603,7 @@ else
   # that we can use it.
   gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
   [GNU texinfo.* \([0-9][0-9.]*\)],
-  [4.*])
+  [4.[2-9]*])
 fi
 
 if test $gcc_cv_prog_makeinfo_modern = no; then
@@ -501,7 +617,7 @@ fi
 
 # Is pod2man recent enough to regenerate manpages?
 AC_MSG_CHECKING([for recent Pod::Man])
-if perl -e 'use 1.10 Pod::Man' >/dev/null 2>&1; then
+if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
   AC_MSG_RESULT(yes)
   GENERATED_MANPAGES=generated-manpages                AC_SUBST(GENERATED_MANPAGES)
 else
@@ -515,7 +631,7 @@ dnl LEXLIB is not useful in gcc.
 if test -f $srcdir/../flex/skel.c; then
   FLEX='$(objdir)/../flex/flex'
 else
-  AC_CHECK_PROG(FLEX, flex, flex, false)
+  AC_CHECK_PROG(FLEX, flex, flex, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing flex)
 fi
 
 # Bison?
@@ -523,7 +639,7 @@ fi
 if test -f $srcdir/../bison/bison.simple; then
   BISON='$(objdir)/../bison/bison -L $(srcdir)/../bison/'
 else
-  AC_CHECK_PROG(BISON, bison, bison, false)
+  AC_CHECK_PROG(BISON, bison, bison, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison)
 fi
 
 # These libraries may be used by collect2.
@@ -580,7 +696,8 @@ 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)
+       fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
+        scandir alphasort)
 
 AC_CHECK_TYPE(ssize_t, int)
 
@@ -630,7 +747,7 @@ saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
 gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \
        strsignal putc_unlocked fputs_unlocked fwrite_unlocked \
-        fprintf_unlocked strstr environ errno \
+        fprintf_unlocked strstr errno vasprintf \
        malloc realloc calloc free basename getopt clock, , ,[
 #include "ansidecl.h"
 #include "system.h"])
@@ -643,6 +760,14 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
 #endif
 ])
 
+gcc_AC_CHECK_DECLS(ldgetname, , ,[
+#include "ansidecl.h"
+#include "system.h"
+#ifdef HAVE_LDFCN_H
+#include <ldfcn.h>
+#endif
+])
+
 gcc_AC_CHECK_DECLS(times, , ,[
 #include "ansidecl.h"
 #include "system.h"
@@ -677,9 +802,24 @@ if test $gcc_cv_type_clock_t = yes; then
   [Define if <time.h> defines clock_t.])
 fi
 
+AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
+[AC_TRY_COMPILE([
+#include "ansidecl.h"
+#include "system.h"
+], 
+[if ((uchar *)0) return 0;
+ if (sizeof(uchar)) return 0;],
+ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
+if test $ac_cv_type_uchar = yes; then
+  AC_DEFINE(HAVE_UCHAR, 1,
+  [Define if <sys/types.h> defines \`uchar'.])
+fi
+
 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
 CFLAGS="$saved_CFLAGS"
 
+gcc_AC_INITFINI_ARRAY
+
 # mkdir takes a single argument on some systems. 
 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
 
@@ -689,6 +829,26 @@ objext='.o'
 AC_SUBST(manext)
 AC_SUBST(objext)
 
+# With Setjmp/Longjmp based exception handling.
+AC_ARG_ENABLE(sjlj-exceptions,
+[  --enable-sjlj-exceptions
+                          arrange to use setjmp/longjmp exception handling],
+[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
+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)
+# Use libunwind based exception handling.
+AC_ARG_ENABLE(libunwind-exceptions,
+[  --enable-libunwind-exceptions  force use libunwind for exceptions],
+use_libunwind_exceptions=$enableval,
+use_libunwind_exceptions=$use_libunwind_default)
+if test x"$use_libunwind_exceptions" = xyes; then
+   AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1,
+       [Define if gcc should use -lunwind.])
+fi
+
+target_gtfiles=
 build_xm_file=
 build_xm_defines=
 build_install_headers_dir=install-headers-tar
@@ -730,21 +890,6 @@ if test x"$dwarf2" = xyes
 then tm_file="$tm_file tm-dwarf2.h"
 fi
 
-if test x$float_format = x
-then float_format=i64
-fi
-
-if test $float_format = none
-then float_h_file=Makefile.in
-else float_h_file=float-$float_format.h
-fi
-
-# Handle cpp installation.
-if test x$enable_cpp != xno
-then
-  tmake_file="$tmake_file t-install-cpp"
-fi
-
 # Say what files are being used for the output code and MD file.
 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
 echo "Using \`$srcdir/config/$md_file' as machine description file."
@@ -792,6 +937,11 @@ else
        done
 fi
 
+if test x$need_64bit_hwint = xyes; then
+       AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1,
+[Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).])
+fi
+
 count=a
 for f in $host_xm_file; do
        count=${count}x
@@ -832,9 +982,21 @@ if test x$thread_file = x; then
        fi
 fi
 
+# Look for a file containing extra machine modes.
+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",
+  [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
 # the first file included by config.h.
-# If host=build, it is correct to have hconfig include auto-host.h
+# If host=build, it is correct to have bconfig include auto-host.h
 # as well.  If host!=build, we are in error and need to do more 
 # work to find out the build config parameters.
 if test x$host = x$build
@@ -857,7 +1019,7 @@ else
        saved_CFLAGS="${CFLAGS}"
        CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
        ${realsrcdir}/configure \
-               --target=$target --host=$build --build=$build
+               --target=$target_alias --host=$build_alias --build=$build_alias
        CFLAGS="${saved_CFLAGS}"
 
        # We just finished tests for the build machine, so rename
@@ -866,14 +1028,17 @@ else
        cd ..
        rm -rf $tempdir
        build_auto=auto-build.h
-       FORBUILD=../$build
+       FORBUILD=../build-$build_alias
 fi
 AC_SUBST(FORBUILD)
 
 tm_file="${tm_file} defaults.h"
-host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}"
-build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}"
-xm_file="ansidecl.h ${xm_file} ${tm_file}"
+tm_p_file="${tm_p_file} tm-preds.h"
+host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
+build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
+# We don't want ansidecl.h in target files, write code there in ISO/GNU C.
+# put this back in temporarily.
+xm_file="ansidecl.h ${xm_file}"
 
 # Truncate the target if necessary
 if test x$host_truncate_target != x; then
@@ -908,10 +1073,6 @@ changequote([,])dnl
 # Internationalization
 PACKAGE=gcc
 VERSION="$gcc_version"
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",
-       [Define to the name of the distribution.])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION",
-       [Define to the version of the distribution.])
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 
@@ -978,9 +1139,9 @@ fi
 esac
 
 # Get an absolute path to the GCC top-level source directory
-holddir=`pwd`
+holddir=`${PWDCMD-pwd}`
 cd $srcdir
-topdir=`pwd`
+topdir=`${PWDCMD-pwd}`
 cd $holddir
 
 # Conditionalize the makefile for this host machine.
@@ -1018,6 +1179,7 @@ then
        cc_set_by_configure="\$(CC)"
        quoted_cc_set_by_configure="\$(CC)"
        stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
+       quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
 else
        rm -f symtest.tem
        if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null
@@ -1029,6 +1191,7 @@ else
        cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
        quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
        stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
+       quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
 fi
 rm -f symtest.tem
 
@@ -1040,14 +1203,18 @@ for f in $tm_file; do
     ansidecl.h )
        tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
     defaults.h )
-       tm_file_list="${tm_file_list} $f" ;;
+       tm_file_list="${tm_file_list} \$(srcdir)/$f" ;;
     *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;;
   esac
 done
 
 tm_p_file_list=
 for f in $tm_p_file; do
-    tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
+  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" ;;
+  esac
 done
 
 host_xm_file_list=
@@ -1055,8 +1222,10 @@ for f in $host_xm_file; do
   case $f in
     ansidecl.h )
        host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
-    auto-host.h | defaults.h )
+    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" ;;
   esac
 done
@@ -1066,8 +1235,10 @@ for f in $build_xm_file; do
   case $f in
     ansidecl.h )
        build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
-    auto-build.h | auto-host.h | defaults.h )
+    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" ;;
   esac
 done
@@ -1082,6 +1253,11 @@ then
        CROSS="-DCROSS_COMPILE"
        ALL=all.cross
        SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
+       case "$host","$target" in
+           i?86-*-*,x86_64-*-* \
+           | powerpc*-*-*,powerpc64*-*-*)
+               CROSS="$CROSS -DNATIVE_CROSS" ;;
+       esac
 fi
 
 # If this is a cross-compiler that does not
@@ -1092,26 +1268,21 @@ fi
 # This prevents libgcc2 from containing any code which requires libc
 # support.
 inhibit_libc=
-if [test x$host != x$target] && [test x$with_headers = x]; then
+if { test x$host != x$target && test "x$with_headers" = x &&
+     test "x$with_sysroot" = x ; } || test x$with_newlib = xyes ; then
        inhibit_libc=-Dinhibit_libc
-else
-       if [test x$with_newlib = xyes]; then
-               inhibit_libc=-Dinhibit_libc
-       fi
 fi
 AC_SUBST(inhibit_libc)
 
 # When building gcc with a cross-compiler, we need to adjust things so
 # that the generator programs are still built with the native compiler.
 # Also, we cannot run fixincludes or fix-header.
-# Note that the terminology here is wrong; it should be BUILD_* throughout.
-# FIXME.
 
 # These are the normal (build=host) settings:
-HOST_PREFIX=                   AC_SUBST(HOST_PREFIX)
-HOST_PREFIX_1=ignore-          AC_SUBST(HOST_PREFIX_1)
-HOST_CC='$(CC)'                        AC_SUBST(HOST_CC)
-HOST_CFLAGS='$(ALL_CFLAGS)'    AC_SUBST(HOST_CFLAGS)
+BUILD_PREFIX=                  AC_SUBST(BUILD_PREFIX)
+BUILD_PREFIX_1=ignore-         AC_SUBST(BUILD_PREFIX_1)
+BUILD_CC='$(CC)'               AC_SUBST(BUILD_CC)
+BUILD_CFLAGS='$(ALL_CFLAGS)'   AC_SUBST(BUILD_CFLAGS)
 
 STMP_FIXINC=stmp-fixinc                AC_SUBST(STMP_FIXINC)
 STMP_FIXPROTO=stmp-fixproto    AC_SUBST(STMP_FIXPROTO)
@@ -1119,10 +1290,10 @@ STMP_FIXPROTO=stmp-fixproto     AC_SUBST(STMP_FIXPROTO)
 # And these apply if build != host.
 if test x$build != x$host
 then
-    HOST_PREFIX=build-
-    HOST_PREFIX_1=build-
-    HOST_CC='$(CC_FOR_BUILD)'
-    HOST_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
+    BUILD_PREFIX=build-
+    BUILD_PREFIX_1=build-
+    BUILD_CC='$(CC_FOR_BUILD)'
+    BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
 
     STMP_FIXINC=
     STMP_FIXPROTO=
@@ -1134,10 +1305,10 @@ extra_headers_list=
 if test "x$extra_headers" = x
 then true
 else
-       # Prepend ${srcdir}/ginclude/ to every entry in extra_headers.
+       # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers.
        for file in $extra_headers;
        do
-               extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/${file}"
+               extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
        done
 fi
 
@@ -1196,11 +1367,11 @@ changequote([,])dnl
 changequote(,)dnl
        gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
        gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
+       gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"`
 changequote([,])dnl
 fi
 
-if test "x$gcc_cv_as" = x -a x$host = x$target; then
-       # Native build.
+if test "x$gcc_cv_as" = x; then
        # Search the same directories that the installed compiler will
        # search.  Else we may find the wrong assembler and lose.  If we
        # do not find a suitable assembler binary, then try the user's
@@ -1225,14 +1396,21 @@ if test "x$gcc_cv_as" = x -a x$host = x$target; then
        # If the loop below does not find an assembler, then use whatever
        # one we can find in the users's path.
        # user's path.
-       gcc_cv_as=as$host_exeext
-
-       test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
-                  $test_prefix/lib/gcc-lib/$target \
-                  /usr/lib/gcc/$target/$gcc_version \
-                  /usr/lib/gcc/$target \
-                  $test_prefix/$target/bin/$target/$gcc_version \
-                  $test_prefix/$target/bin \
+       if test "x$program_prefix" != xNONE; then
+               gcc_cv_as=${program_prefix}as$host_exeext
+       else
+               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"
+
+       if test x$host = x$target; then
+           test_dirs="$test_dirs \
                   /usr/libexec \
                   /usr/ccs/gcc \
                   /usr/ccs/bin \
@@ -1243,9 +1421,10 @@ if test "x$gcc_cv_as" = x -a x$host = x$target; then
                   /sysv/usr/lib/cmplrs/cc \
                   /svr4/usr/lib/cmplrs/cc \
                   /usr/bin"
+       fi
 
        for dir in $test_dirs; do
-               if test -f $dir/as$host_exeext; then
+               if test -x $dir/as$host_exeext; then
                        gcc_cv_as=$dir/as$host_exeext
                        break;
                fi
@@ -1288,8 +1467,7 @@ changequote(,)dnl
 changequote([,])dnl
 fi
 
-if test "x$gcc_cv_ld" = x -a x$host = x$target; then
-       # Native build.
+if test "x$gcc_cv_ld" = x; then
        # Search the same directories that the installed compiler will
        # search.  Else we may find the wrong linker and lose.  If we
        # do not find a suitable linker binary, then try the user's
@@ -1314,14 +1492,21 @@ if test "x$gcc_cv_ld" = x -a x$host = x$target; then
        # If the loop below does not find an linker, then use whatever
        # one we can find in the users's path.
        # user's path.
-       gcc_cv_ld=ld$host_exeext
-
-       test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
-                  $test_prefix/lib/gcc-lib/$target \
-                  /usr/lib/gcc/$target/$gcc_version \
-                  /usr/lib/gcc/$target \
-                  $test_prefix/$target/bin/$target/$gcc_version \
-                  $test_prefix/$target/bin \
+       if test "x$program_prefix" != xNONE; then
+               gcc_cv_ld=${program_prefix}ld$host_exeext
+       else
+               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"
+
+       if test x$host = x$target; then
+           test_dirs="$test_dirs \
                   /usr/libexec \
                   /usr/ccs/gcc \
                   /usr/ccs/bin \
@@ -1332,9 +1517,10 @@ if test "x$gcc_cv_ld" = x -a x$host = x$target; then
                   /sysv/usr/lib/cmplrs/cc \
                   /svr4/usr/lib/cmplrs/cc \
                   /usr/bin"
+       fi
 
        for dir in $test_dirs; do
-               if test -f $dir/ld$host_exeext; then
+               if test -x $dir/ld$host_exeext; then
                        gcc_cv_ld=$dir/ld$host_exeext
                        break;
                fi
@@ -1350,9 +1536,10 @@ fi
 AC_MSG_CHECKING(what nm to use)
 if test -x nm$host_exeext; then
        gcc_cv_nm=./nm$host_exeext
-elif test x$host = x$target; then
-       # Native build.
-       gcc_cv_nm=nm$host_exeext
+elif test "x$program_prefix" != xNONE; then
+       gcc_cv_nm=${program_prefix}nm$host_exeext
+else
+       gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext
 fi
 AC_MSG_RESULT($gcc_cv_nm)
 
@@ -1360,9 +1547,10 @@ AC_MSG_RESULT($gcc_cv_nm)
 AC_MSG_CHECKING(what objdump to use)
 if test -x objdump$host_exeext; then
        gcc_cv_objdump=./objdump$host_exeext
-elif test x$host = x$target; then
-       # Native build.
-       gcc_cv_objdump=objdump$host_exeext
+elif test "x$program_prefix" != xNONE; then
+       gcc_cv_objdump=${program_prefix}objdump$host_exeext
+else
+       gcc_cv_objdump=`echo objdump | sed ${program_transform_name}`$host_exeext
 fi
 AC_MSG_RESULT($gcc_cv_objdump)
 
@@ -1462,7 +1650,13 @@ AC_MSG_RESULT($gcc_cv_as_weak)
 AC_MSG_CHECKING(assembler hidden support)
 gcc_cv_as_hidden=no
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
-  if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+  if test "$gcc_cv_gas_major_version" -eq 2    \
+         -a "$gcc_cv_gas_minor_version" -eq 12 \
+         -a "$gcc_cv_gas_patch_version" -ge 1  \
+         -o "$gcc_cv_gas_major_version" -eq 2  \
+         -a "$gcc_cv_gas_minor_version" -gt 12 \
+         -o "$gcc_cv_gas_major_version" -gt 2  \
+    && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
     gcc_cv_as_hidden="yes"
   fi
 elif test x$gcc_cv_as != x; then
@@ -1473,12 +1667,60 @@ elif test x$gcc_cv_as != x; 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
+changequote(,)dnl
+               ld_vers=`echo $ld_ver | sed -n 's,^.*[  ]\([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
+       fi
 fi
 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
+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.
+      libgcc_visibility=no
+    fi
+    ;;
+esac
+AC_SUBST(libgcc_visibility)
 
 AC_MSG_CHECKING(assembler leb128 support)
 gcc_cv_as_leb128=no
@@ -1622,6 +1864,145 @@ if test x"$gcc_cv_as_shf_merge" = xyes; then
 fi
 AC_MSG_RESULT($gcc_cv_as_shf_merge)
 
+AC_MSG_CHECKING(assembler thread-local storage support)
+gcc_cv_as_tls=no
+conftest_s=
+tls_first_major=
+tls_first_minor=
+case "$target" in
+changequote(,)dnl
+  alpha*-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       ldq     $27,__tls_get_addr($29)         !literal!1
+       lda     $16,foo($29)                    !tlsgd!1
+       jsr     $26,($27),__tls_get_addr        !lituse_tlsgd!1
+       ldq     $27,__tls_get_addr($29)         !literal!2
+       lda     $16,foo($29)                    !tlsldm!2
+       jsr     $26,($27),__tls_get_addr        !lituse_tlsldm!2
+       ldq     $1,foo($29)                     !gotdtprel
+       ldah    $2,foo($29)                     !dtprelhi
+       lda     $3,foo($2)                      !dtprello
+       lda     $4,foo($29)                     !dtprel
+       ldq     $1,foo($29)                     !gottprel
+       ldah    $2,foo($29)                     !tprelhi
+       lda     $3,foo($2)                      !tprello
+       lda     $4,foo($29)                     !tprel'
+       tls_first_major=2
+       tls_first_minor=13
+       ;;
+  i[34567]86-*-*)
+changequote([,])dnl
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       movl    %gs:0, %eax
+       leal    foo@TLSGD(,%ebx,1), %eax
+       leal    foo@TLSLDM(%ebx), %eax
+       leal    foo@DTPOFF(%eax), %edx
+       movl    foo@GOTTPOFF(%ebx), %eax
+       subl    foo@GOTTPOFF(%ebx), %eax
+       addl    foo@GOTNTPOFF(%ebx), %eax
+       movl    foo@INDNTPOFF, %eax
+       movl    $foo@TPOFF, %eax
+       subl    $foo@TPOFF, %eax
+       leal    foo@NTPOFF(%ecx), %eax'
+       tls_first_major=2
+       tls_first_minor=14
+       ;;
+  x86_64-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       movq    %fs:0, %rax
+       leaq    foo@TLSGD(%rip), %rdi
+       leaq    foo@TLSLD(%rip), %rdi
+       leaq    foo@DTPOFF(%rax), %rdx
+       movq    foo@GOTTPOFF(%rip), %rax
+       movq    $foo@TPOFF, %rax'
+       tls_first_major=2
+       tls_first_minor=14
+       ;;
+  ia64-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   data8   25
+       .text
+       addl    r16 = @ltoff(@dtpmod(foo#)), gp
+       addl    r17 = @ltoff(@dtprel(foo#)), gp
+       addl    r18 = @ltoff(@tprel(foo#)), gp
+       addl    r19 = @dtprel(foo#), gp
+       adds    r21 = @dtprel(foo#), r13
+       movl    r23 = @dtprel(foo#)
+       addl    r20 = @tprel(foo#), gp
+       adds    r22 = @tprel(foo#), r13
+       movl    r24 = @tprel(foo#)'
+       tls_first_major=2
+       tls_first_minor=13
+       ;;
+  s390-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       .long   foo@TLSGD
+       .long   foo@TLSLDM
+       .long   foo@DTPOFF
+       .long   foo@NTPOFF
+       .long   foo@GOTNTPOFF
+       .long   foo@INDNTPOFF
+       l       %r1,foo@GOTNTPOFF(%r12)
+       l       %r1,0(%r1):tls_load:foo
+       bas     %r14,0(%r1,%r13):tls_gdcall:foo
+       bas     %r14,0(%r1,%r13):tls_ldcall:foo'
+       tls_first_major=2
+       tls_first_minor=14
+       ;;
+  s390x-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+foo:   .long   25
+       .text
+       .quad   foo@TLSGD
+       .quad   foo@TLSLDM
+       .quad   foo@DTPOFF
+       .quad   foo@NTPOFF
+       .quad   foo@GOTNTPOFF
+       lg      %r1,foo@GOTNTPOFF(%r12)
+       larl    %r1,foo@INDNTPOFF
+       brasl   %r14,__tls_get_offset@PLT:tls_gdcall:foo
+       brasl   %r14,__tls_get_offset@PLT:tls_ldcall:foo'
+       tls_first_major=2
+       tls_first_minor=14
+       ;;
+esac
+if test -z "$tls_first_major"; then
+  :
+elif test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x
+then
+  if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \
+         -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \
+         -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then
+    gcc_cv_as_tls=yes
+  fi
+elif test x$gcc_cv_as != x; then
+  echo "$conftest_s" > conftest.s
+  if $gcc_cv_as --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.])
+fi
+AC_MSG_RESULT($gcc_cv_as_tls)
+
 case "$target" in
   # All TARGET_ABI_OSF targets.
   alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
@@ -1704,70 +2085,80 @@ EOF
                [Define if your assembler supports -relax option.])
     fi
 
-    case "$tm_file" in
-    *64*)
-       AC_CACHE_CHECK([for 64 bit support in assembler ($gcc_cv_as)],
-           gcc_cv_as_flags64, [
-               if test -n "$gcc_cv_as"; then
-                   echo ".xword foo" > conftest.s
-                   gcc_cv_as_flags64=no
-                   for flag in "-xarch=v9" "-64 -Av9"; do
-                       if $gcc_cv_as $flag -o conftest.o conftest.s \
-                           > /dev/null 2>&1; then
-                           gcc_cv_as_flags64=$flag
-                           break
-                       fi
-                   done
-                   rm -f conftest.s conftest.o
-               else
-                   if test "$gas" = yes; then
-                       gcc_cv_as_flags64="-64 -Av9"
+    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,
+               [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_flags64="-xarch=v9"
+                       gcc_cv_as_sparc_ua_pcrel_hidden=yes
                    fi
                fi
-       ])
-       if test "x$gcc_cv_as_flags64" = xno; then
-changequote(, )
-           tmake_file=`echo " $tmake_file " | sed -e 's, sparc/t-sol2-64 , ,' -e 's,^ ,,' -e 's, $,,'`
-           dep_tmake_file=`echo " $dep_tmake_file " | sed -e 's, [^ ]*/config/sparc/t-sol2-64 , ,' -e 's,^ ,,' -e 's, $,,'`
-changequote([, ])
+           fi
+           rm -f conftest.s conftest.o conftest
        else
-           AC_DEFINE_UNQUOTED(AS_SPARC64_FLAG, "$gcc_cv_as_flags64",
-                       [Define if the assembler supports 64bit sparc.])
+           gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel"
        fi
-       ;;
-    *) gcc_cv_as_flags64=${gcc_cv_as_flags64-no}
-       ;;
-    esac
-
-    if test "x$gcc_cv_as_flags64" != xno; then
-       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 $gcc_cv_as_flags64 -o conftest.o conftest.s \
-                       > /dev/null 2>&1 &&
-                  $gcc_cv_as $gcc_cv_as_flags64 -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
-               else
+    ])
+    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
-               rm -f conftest.s conftest.o conftest1.s conftest1.o
+           else
+               gcc_cv_as_offsetable_lo10=no
            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().])
+           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
 
     ;;
@@ -1835,7 +2226,8 @@ gcc_cv_as_dwarf2_debug_line=no
 # ??? Once 2.11 is released, probably need to add first known working
 # version to the per-target configury.
 case "$target" in
-  i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* | x86_64*-*-*)
+  i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
+  | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-*)
     insn="nop"
     ;;
   ia64*-*-*)
@@ -1889,7 +2281,7 @@ then
        -o "$gcc_cv_gas_major_version" -gt 2 \
      && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
      && test x"$insn" != x ; then
-    gcc_cv_as_gdwarf2_debug_flag="yes"
+    gcc_cv_as_gdwarf2_flag="yes"
   fi
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '' > conftest.s
@@ -1915,7 +2307,7 @@ then
        -o "$gcc_cv_gas_major_version" -gt 2 \
      && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
      && test x"$insn" != x ; then
-    gcc_cv_as_gstabs_debug_flag="yes"
+    gcc_cv_as_gstabs_flag="yes"
   fi
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '' > conftest.s
@@ -1931,6 +2323,44 @@ if test x"$gcc_cv_as_gstabs_flag" = xyes; then
 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
+if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
+  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
+    gcc_cv_ld_ro_rw_mix=read-write
+  fi
+elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
+  echo '.section "myfoosect", "a"' > conftest1.s
+  echo '.section "myfoosect", "aw"' > conftest2.s
+  echo '.byte 1' >> conftest2.s
+  echo '.section "myfoosect", "a"' > conftest3.s
+  echo '.byte 0' >> conftest3.s
+  if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
+     && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
+     && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
+     && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
+       conftest2.o conftest3.o; then
+    gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
+                        | grep -A1 myfoosect`
+    if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
+      if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
+       gcc_cv_ld_ro_rw_mix=read-only
+      else
+       gcc_cv_ld_ro_rw_mix=read-write
+      fi
+    fi
+  fi
+changequote(,)dnl
+  rm -f conftest.* conftest[123].*
+changequote([,])dnl
+fi
+if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
+       AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
+  [Define if your linker links a mix of read-only
+   and read-write sections into a read-write section.])
+fi
+AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
+
 AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
 gcc_cv_ld_eh_frame_hdr=no
 if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
@@ -1949,7 +2379,37 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
 fi
 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
 
-if test "$prefix" != "/usr" && test "$prefix" != "/usr/local" ; then
+# Miscellaneous target-specific checks.
+case "$target" in
+  mips*-*-*)
+    AC_MSG_CHECKING(whether libgloss uses STARTUP directives consistently)
+    gcc_cv_mips_libgloss_startup=no
+    gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss
+    if test "x$exec_prefix" = xNONE; then
+      if test "x$prefix" = xNONE; then
+        test_prefix=/usr/local
+      else
+        test_prefix=$prefix
+      fi
+    else
+      test_prefix=$exec_prefix
+    fi
+    for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld
+    do
+      if grep '^STARTUP' $f > /dev/null 2>&1; then
+        gcc_cv_mips_libgloss_startup=yes
+        break
+      fi
+    done
+    if test x"$gcc_cv_mips_libgloss_startup" = xyes; then
+      AC_DEFINE(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES, 1,
+        [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.])
+    fi
+    AC_MSG_RESULT($gcc_cv_mips_libgloss_startup)
+    ;;
+esac
+
+if test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
   AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
 fi
 
@@ -1967,8 +2427,8 @@ if test x"${enable_languages+set}" != xset; then
                enable_languages=all
        fi
 else
-       if test x"${enable_languages}" = x ||
-          test x"${enable_languages}" = xyes;
+       if test x"${enable_languages}" = x \
+        || test x"${enable_languages}" = xyes;
        then
                AC_MSG_ERROR([--enable-languages needs at least one language argument])
        fi
@@ -2008,6 +2468,8 @@ changequote([,])dnl
    esac
 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 ..
 do
@@ -2032,6 +2494,7 @@ changequote(,)dnl
          *,all,*) add_this_lang=yes ;;
          *) add_this_lang=no ;;
          esac
+          found_languages="${found_languages} ${lang_alias}"
          if test x"${add_this_lang}" = xyes; then
                case $lang in
                    ${srcdir}/ada/config-lang.in)
@@ -2049,6 +2512,35 @@ changequote([,])dnl
        esac
 done
 
+missing_languages=
+for expected_language in ${expected_languages} ..
+do 
+    if test "${expected_language}" != ..; then
+        missing_language="${expected_language}"
+        if test "${expected_language}" = "c" \
+           || test "${expected_language}" = "all"; then
+                missing_language=
+        fi
+        for found_language in ${found_languages} ..
+        do 
+            if test "${found_language}" != ..; then
+                if test "${expected_language}" = "${found_language}"; then
+                    missing_language=
+                fi
+            fi
+        done
+        if test "x${missing_language}" != x; then
+           missing_languages="${missing_languages} ${missing_language}"
+        fi
+    fi
+done
+
+if test "x$missing_languages" != x; then
+  AC_MSG_ERROR([
+The following requested languages were not found:${missing_languages}
+The following languages were available: c${found_languages}])
+fi
+
 # Make gthr-default.h if we have a thread file.
 gthread_flags=
 if test $thread_file != single; then
@@ -2105,35 +2597,22 @@ else
 fi
 AC_SUBST(MAINT)dnl
 
-# With Setjmp/Longjmp based exception handling.
-AC_ARG_ENABLE(sjlj-exceptions,
-[  --enable-sjlj-exceptions
-                          arrange to use setjmp/longjmp exception handling],
-[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
-AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
-  [Define 0/1 to force the choice for exception handling model.])])
-
 # Make empty files to contain the specs and options for each language.
 # Then add #include lines to for a compiler that has specs and/or options.
 
 lang_specs_files=
 lang_options_files=
 lang_tree_files=
-rm -f specs.h options.h gencheck.h
-touch specs.h options.h gencheck.h
 for subdir in . $subdirs
 do
        if test -f $srcdir/$subdir/lang-specs.h; then
-               echo "#include \"$subdir/lang-specs.h\"" >>specs.h
-               lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
+           lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
        fi
        if test -f $srcdir/$subdir/lang-options.h; then
-               echo "#include \"$subdir/lang-options.h\"" >>options.h
-               lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h"
+           lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h"
        fi
        if test -f $srcdir/$subdir/$subdir-tree.def; then
-               echo "#include \"$subdir/$subdir-tree.def\"" >>gencheck.h
-               lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
+           lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
        fi
 done
 
@@ -2143,9 +2622,14 @@ all_languages=
 all_boot_languages=
 all_compilers=
 all_stagestuff=
-all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc'
+all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc mkheaders'
 # List of language makefile fragments.
 all_lang_makefiles=
+# Files for gengtype
+all_gtfiles="$target_gtfiles"
+# Files for gengtype with language
+all_gtfiles_files_langs=
+all_gtfiles_files_files=
 
 # Add the language fragments.
 # Languages are added via two mechanisms.  Some information must be
@@ -2166,6 +2650,7 @@ do
                compilers=
                stagestuff=
                outputs=
+               gtfiles=
                . ${srcdir}/$s/config-lang.in
                if test "x$language" = x
                then
@@ -2184,9 +2669,32 @@ do
                all_compilers="$all_compilers $compilers"
                all_stagestuff="$all_stagestuff $stagestuff"
                all_outputs="$all_outputs $outputs"
+               all_gtfiles="$all_gtfiles $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
+gtfiles=
+s="c"
+. ${srcdir}/c-config-lang.in
+all_gtfiles="$all_gtfiles $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
 do
@@ -2305,8 +2813,7 @@ else
 fi)
 AC_SUBST(slibdir)
 
-# Nothing to do for FLOAT_H, float_format already handled.
-objdir=`pwd`
+objdir=`${PWDCMD-pwd}`
 AC_SUBST(objdir)
 
 # Process the language and host/target makefile fragments.
@@ -2314,8 +2821,12 @@ ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xma
 
 # Substitute configuration variables
 AC_SUBST(subdirs)
+AC_SUBST(srcdir)
 AC_SUBST(all_boot_languages)
 AC_SUBST(all_compilers)
+AC_SUBST(all_gtfiles)
+AC_SUBST(all_gtfiles_files_langs)
+AC_SUBST(all_gtfiles_files_files)
 AC_SUBST(all_lang_makefiles)
 AC_SUBST(all_languages)
 AC_SUBST(all_stagestuff)
@@ -2357,10 +2868,12 @@ AC_SUBST(objc_boehm_gc)
 AC_SUBST(out_file)
 AC_SUBST(out_object_file)
 AC_SUBST(stage_prefix_set_by_configure)
+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_defines)
 AC_SUBST(tm_p_file_list)
 AC_SUBST(tm_p_file)
 AC_SUBST(xm_file)
@@ -2426,7 +2939,7 @@ esac
 if test "$symbolic_link" = "ln -s"; then
  for d in .. ${subdirs} fixinc ; do
    if test $d != ..; then
-       STARTDIR=`pwd`
+       STARTDIR=`${PWDCMD-pwd}`
        cd $d
        for t in stage1 stage2 stage3 stage4 include
        do
@@ -2442,35 +2955,7 @@ if test -f intl/libintl.h; then
   echo creating libintl.h
   echo '#include "intl/libintl.h"' >libintl.h
 fi
-],
-[
-host='${host}'
-build='${build}'
-target='${target}'
-target_alias='${target_alias}'
-srcdir='${srcdir}'
-subdirs='${subdirs}'
-symbolic_link='${symbolic_link}'
-program_transform_set='${program_transform_set}'
-program_transform_name='${program_transform_name}'
-dep_host_xmake_file='${dep_host_xmake_file}'
-host_xmake_file='${host_xmake_file}'
-dep_tmake_file='${dep_tmake_file}'
-tmake_file='${tmake_file}'
-thread_file='${thread_file}'
-gcc_config_arguments='${gcc_config_arguments}'
-gcc_version='${gcc_version}'
-gcc_version_full='${gcc_version_full}'
-gcc_version_trigger='${gcc_version_trigger}'
-local_prefix='${local_prefix}'
-build_install_headers_dir='${build_install_headers_dir}'
-build_exeext='${build_exeext}'
-host_exeext='${host_exeext}'
-out_file='${out_file}'
-gdb_needs_out_file_path='${gdb_needs_out_file_path}'
-SET_MAKE='${SET_MAKE}'
-target_list='${target_list}'
-target_overrides='${target_overrides}'
-host_overrides='${host_overrides}'
-cpp_install_dir='${cpp_install_dir}'
+], 
+[subdirs='$subdirs'
+symbolic_link='$symbolic_link'
 ])