]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/configure.in
configure.in: Make $(target_subdir) correspond with top level usage.
[gcc.git] / gcc / configure.in
index 14fd66e3b5946c105765082a3660b523ca5aa1b9..5431013ddb98cb83589db3f88b43615fd991e698 100644 (file)
 #Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #02111-1307, USA.
 
-# Initialization and defaults
+# --------------------------------
+# Initialization and sanity checks
+# --------------------------------
+
 AC_PREREQ(2.13)
 AC_INIT(tree.c)
 AC_CONFIG_HEADER(auto-host.h:config.in)
 
-remove=rm
-hard_link=ln
-symbolic_link='ln -s'
-copy=cp
+# Determine the host, build, and target systems
+AC_CANONICAL_SYSTEM
+
+# Define variables host_canonical and build_canonical
+build_canonical=${build}
+host_canonical=${host}
+AC_SUBST(build_canonical)
+AC_SUBST(host_canonical)
+
+target_subdir=${target_alias}
+AC_SUBST(target_subdir)
+       
+# Set program_transform_name
+AC_ARG_PROGRAM
 
 # Check for bogus environment variables.
 # Test if LIBRARY_PATH contains the notation for the current directory
@@ -84,7 +97,63 @@ AC_MSG_ERROR([
 *** and run configure again.])
 fi
 
-# Check for additional parameters
+# -----------
+# Directories
+# -----------
+
+# Specify the local prefix
+local_prefix=
+AC_ARG_WITH(local-prefix,
+[  --with-local-prefix=DIR specifies directory to put local include],
+[case "${withval}" in
+yes)   AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
+no)    ;;
+*)     local_prefix=$with_local_prefix ;;
+esac])
+
+# Default local prefix if it is empty
+if test x$local_prefix = x; then
+       local_prefix=/usr/local
+fi
+
+# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
+# passed in by the toplevel make and thus we'd get different behavior
+# depending on where we built the sources.
+gcc_gxx_include_dir=
+# Specify the g++ header file directory
+AC_ARG_WITH(gxx-include-dir,
+[  --with-gxx-include-dir=DIR
+                          specifies directory to put g++ header files],
+[case "${withval}" in
+yes)   AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
+no)    ;;
+*)     gcc_gxx_include_dir=$with_gxx_include_dir ;;
+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/c++'
+  else
+    topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
+changequote(<<, >>)dnl
+    gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir}
+changequote([, ])dnl
+  fi
+fi
+
+AC_ARG_WITH(cpp_install_dir,
+[  --with-cpp-install-dir=DIR
+                          install the user visible C preprocessor in DIR
+                          (relative to PREFIX) as well as PREFIX/bin],
+[if test x$withval = xyes; then
+  AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
+elif test x$withval != xno; then
+  cpp_install_dir=$withval
+fi])
+
+# -------------------
+# Find default linker
+# -------------------
 
 # With GNU ld
 AC_ARG_WITH(gnu-ld,
@@ -106,6 +175,21 @@ if test x"${DEFAULT_LINKER+set}" = x"set"; then
        [Define to enable the use of a default linker.])
 fi
 
+AC_MSG_CHECKING([whether a default linker was specified])
+if test x"${DEFAULT_LINKER+set}" = x"set"; then
+  if test x"$gnu_ld_flag" = x"no"; then
+    AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
+  else
+    AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
+  fi
+else
+  AC_MSG_RESULT(no)
+fi
+
+# ----------------------
+# Find default assembler
+# ----------------------
+
 # With GNU as
 AC_ARG_WITH(gnu-as,
 [  --with-gnu-as           arrange to work with GNU as],
@@ -125,63 +209,20 @@ if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
        [Define to enable the use of a default assembler.])
 fi
 
-# With stabs
-AC_ARG_WITH(stabs,
-[  --with-stabs            arrange to use stabs instead of host debug format],
-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)
-
-# Specify the local prefix
-local_prefix=
-AC_ARG_WITH(local-prefix,
-[  --with-local-prefix=DIR specifies directory to put local include],
-[case "${withval}" in
-yes)   AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
-no)    ;;
-*)     local_prefix=$with_local_prefix ;;
-esac])
-
-# Default local prefix if it is empty
-if test x$local_prefix = x; then
-       local_prefix=/usr/local
-fi
-
-# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
-# passed in by the toplevel make and thus we'd get different behavior
-# depending on where we built the sources.
-gcc_gxx_include_dir=
-# Specify the g++ header file directory
-AC_ARG_WITH(gxx-include-dir,
-[  --with-gxx-include-dir=DIR
-                          specifies directory to put g++ header files],
-[case "${withval}" in
-yes)   AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
-no)    ;;
-*)     gcc_gxx_include_dir=$with_gxx_include_dir ;;
-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/c++'
+AC_MSG_CHECKING([whether a default assembler was specified])
+if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
+  if test x"$gas_flag" = x"no"; then
+    AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
   else
-    topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
-changequote(<<, >>)dnl
-    gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir}
-changequote([, ])dnl
+    AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
   fi
+else
+  AC_MSG_RESULT(no)
 fi
 
-# Determine the host, build, and target systems
-AC_CANONICAL_SYSTEM
-
-# Set program_transform_name
-AC_ARG_PROGRAM
+# ---------------
+# Find C compiler
+# ---------------
 
 # Find the native compiler
 AC_PROG_CC
@@ -195,8 +236,9 @@ fi
 AC_SUBST(NO_MINUS_C_MINUS_O)
 AC_SUBST(OUTPUT_OPTION)
 
-# See if GNAT has been installed
-gcc_AC_PROG_GNAT
+# -------------------------
+# Check C compiler features
+# -------------------------
 
 AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
 ac_cv_prog_cc_no_long_long,
@@ -206,6 +248,34 @@ AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
               ac_cv_prog_cc_no_long_long=no)
 CFLAGS="$save_CFLAGS"])
 
+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
+
+# -----------------
+# Find Ada compiler
+# -----------------
+
+# See if GNAT has been installed
+gcc_AC_PROG_GNAT
+
 if test x$have_gnat != xno ; then 
 AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
 ac_cv_prog_adac_no_long_long,
@@ -222,6 +292,10 @@ else
   ac_cv_prog_adac_no_long_long=yes
 fi
 
+# ---------------------
+# Warnings and checking
+# ---------------------
+
 strict1_warn=
 if test $ac_cv_prog_cc_no_long_long = yes && \
     test $ac_cv_prog_adac_no_long_long = yes ; then
@@ -229,27 +303,6 @@ if test $ac_cv_prog_cc_no_long_long = yes && \
 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'.
@@ -259,12 +312,6 @@ if test "x$GCC" = "xyes"; then
 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, 
@@ -355,17 +402,30 @@ 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_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
+  AC_TRY_CPP(
+    [#include <memcheck.h>
+#ifndef VALGRIND_DISCARD
+#error VALGRIND_DISCARD not defined
+#endif],
+  [gcc_cv_header_memcheck_h=yes], 
+  gcc_cv_header_memcheck_h=no)
+  AC_MSG_RESULT($gcc_cv_header_memcheck_h)
   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])
+  if test "x$valgrind_path" = "x" || (test $have_valgrind_h = no && test $gcc_cv_header_memcheck_h = no); then
+       AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h/memcheck.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.])
+  if test $gcc_cv_header_memcheck_h = yes; then
+    AC_DEFINE(HAVE_MEMCHECK_H, 1,
+       [Define if valgrind's memcheck.h header is installed.])
+  fi
 fi
 AC_SUBST(valgrind_path_defines)
 AC_SUBST(valgrind_command)
@@ -392,28 +452,33 @@ esac],
 [coverage_flags=""])
 AC_SUBST(coverage_flags)
 
-AC_ARG_WITH(cpp_install_dir,
-[  --with-cpp-install-dir=DIR
-                          install the user visible C preprocessor in DIR
-                          (relative to PREFIX) as well as PREFIX/bin],
-[if test x$withval = xyes; then
-  AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
-elif test x$withval != xno; then
-  cpp_install_dir=$withval
-fi])
+# -------------------------------
+# Miscenalleous configure options
+# -------------------------------
+
+# With stabs
+AC_ARG_WITH(stabs,
+[  --with-stabs            arrange to use stabs instead of host debug format],
+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],
+[], [enable_multilib=yes])
+AC_SUBST(enable_multilib)
 
 # 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++],
@@ -443,7 +508,7 @@ case x${enable_threads_flag} in
                target_thread_file=''
                ;;
        xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
-       xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix)
+       xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix | xgnat)
                target_thread_file=$enable_threads_flag
                ;;
        *)
@@ -515,72 +580,19 @@ AC_ARG_WITH(sysroot,
  esac
 ], [
  TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
+ TARGET_SYSTEM_ROOT_DEFINE=
  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=
-case $build in
-vax-*-*)
-  if test x$GCC = xyes
-  then
-    stage1_cflags="-Wa,-J"
-  else
-    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)
+# -------------------------
+# Checks for other programs
+# -------------------------
 
 AC_PROG_MAKE_SET
 
-AC_MSG_CHECKING([whether a default assembler was specified])
-if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
-    if test x"$gas_flag" = x"no"; then
-       AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
-    else
-       AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
-    fi
-else
-    AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING([whether a default linker was specified])
-if test x"${DEFAULT_LINKER+set}" = x"set"; then
-    if test x"$gnu_ld_flag" = x"no"; then
-       AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
-    else
-       AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
-    fi
-else
-    AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for GNU C library)
-AC_CACHE_VAL(gcc_cv_glibc,
-[AC_TRY_COMPILE(
-  [#include <features.h>],[
-#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
-#error Not a GNU C library system
-#endif], 
-  [gcc_cv_glibc=yes], 
-  gcc_cv_glibc=no)])
-AC_MSG_RESULT($gcc_cv_glibc)
-if test $gcc_cv_glibc = yes; then
-  AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
-fi
-
 # Find some useful tools
 AC_PROG_AWK
 gcc_AC_PROG_LN
@@ -588,25 +600,6 @@ gcc_AC_PROG_LN_S
 AC_PROG_RANLIB
 gcc_AC_PROG_INSTALL
 
-AC_HEADER_STDC
-AC_HEADER_TIME
-gcc_AC_HEADER_STDBOOL
-gcc_AC_HEADER_STRING
-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 ldfcn.h)
-
-# Check for thread headers.
-AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
-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
-AC_C_BIGENDIAN_CROSS
-gcc_AC_C_FLOAT_FORMAT
-
 # See if we have the mktemp command.
 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
 
@@ -642,6 +635,26 @@ 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.
@@ -659,6 +672,67 @@ else
   AC_CHECK_PROG(BISON, bison, bison, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison)
 fi
 
+# --------------------
+# Checks for C headers
+# --------------------
+
+AC_MSG_CHECKING(for GNU C library)
+AC_CACHE_VAL(gcc_cv_glibc,
+[AC_TRY_COMPILE(
+  [#include <features.h>],[
+#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
+#error Not a GNU C library system
+#endif], 
+  [gcc_cv_glibc=yes], 
+  gcc_cv_glibc=no)])
+AC_MSG_RESULT($gcc_cv_glibc)
+if test $gcc_cv_glibc = yes; then
+  AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
+fi
+
+AC_HEADER_STDC
+AC_HEADER_TIME
+gcc_AC_HEADER_STDBOOL
+gcc_AC_HEADER_STRING
+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)
+
+# Check for thread headers.
+AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
+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
+AC_C_BIGENDIAN_CROSS
+
+# --------
+# UNSORTED
+# --------
+
+# Stage specific cflags for build.
+stage1_cflags=
+case $build in
+vax-*-*)
+  if test x$GCC = xyes
+  then
+    stage1_cflags="-Wa,-J"
+  else
+    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)
+
 # These libraries may be used by collect2.
 # We may need a special search path to get them linked.
 AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
@@ -688,6 +762,15 @@ GNAT_LIBEXC="$LIBS"
 LIBS="$save_LIBS"
 AC_SUBST(GNAT_LIBEXC)
 
+# Some systems put ldexp and frexp in libm instead of libc; assume
+# they're both in the same place.  jcf-dump needs them.
+save_LIBS="$LIBS"
+LIBS=
+AC_SEARCH_LIBS(ldexp, m)
+LDEXP_LIB="$LIBS"
+LIBS="$save_LIBS"
+AC_SUBST(LDEXP_LIB)
+
 # See if the stage1 system preprocessor understands the ANSI C
 # preprocessor stringification operator.  (Used by symcat.h.)
 AC_C_STRINGIZE
@@ -714,7 +797,25 @@ 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)
+        scandir alphasort gettimeofday mbstowcs wcswidth mmap)
+
+if test x$ac_cv_func_mbstowcs = xyes; then
+  AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
+[    AC_TRY_RUN([#include <stdlib.h>
+int main()
+{
+  mbstowcs(0, "", 0);
+  return 0;
+}],
+    gcc_cv_func_mbstowcs_works=yes,
+    gcc_cv_func_mbstowcs_works=no,
+    gcc_cv_func_mbstowcs_works=yes)])
+  if test x$gcc_cv_func_mbstowcs_works = xyes; then
+    AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
+  [Define this macro if mbstowcs does not crash when its
+   first argument is NULL.])
+  fi
+fi
 
 AC_CHECK_TYPE(ssize_t, int)
 
@@ -739,6 +840,7 @@ fi
 AC_SUBST(TARGET_GETGROUPS_T)
 
 gcc_AC_FUNC_PRINTF_PTR
+gcc_AC_FUNC_MMAP_BLACKLIST
 
 case "${host}" in
 *-*-uwin*)
@@ -754,8 +856,6 @@ case "${host}" in
   ;;
 esac
 AC_FUNC_VFORK
-AC_FUNC_MMAP_ANYWHERE
-AC_FUNC_MMAP_FILE
 
 AM_ICONV
 
@@ -777,6 +877,15 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
 #endif
 ])
 
+AC_TRY_COMPILE([
+#include "ansidecl.h"
+#include "system.h"
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+],[rlim_t l = 0;],,[AC_DEFINE([rlim_t],[long],
+[Define to \`long' if <sys/resource.h> doesn't define.])])
+
 gcc_AC_CHECK_DECLS(ldgetname, , ,[
 #include "ansidecl.h"
 #include "system.h"
@@ -865,6 +974,10 @@ if test x"$use_libunwind_exceptions" = xyes; then
        [Define if gcc should use -lunwind.])
 fi
 
+# --------------------------------------------------------
+# Build, host, and target specific configuration fragments
+# --------------------------------------------------------
+
 target_gtfiles=
 build_xm_file=
 build_xm_defines=
@@ -1000,6 +1113,15 @@ if test x$thread_file = x; then
        fi
 fi
 
+if test x$enable___cxa_atexit = xyes || \
+   test x$enable___cxa_atexit = x -a x$default_use_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
+
 # 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}
@@ -1058,6 +1180,10 @@ build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
 # put this back in temporarily.
 xm_file="ansidecl.h ${xm_file}"
 
+# --------
+# UNSORTED
+# --------
+
 # Truncate the target if necessary
 if test x$host_truncate_target != x; then
        target=`echo $target | sed -e 's/\(..............\).*/\1/'`
@@ -1085,6 +1211,10 @@ cat > configargs.h <<EOF
 /* Generated automatically. */
 static const char configuration_arguments[] = "$gcc_config_arguments";
 static const char thread_model[] = "$thread_file";
+
+static const struct {
+  const char *name, *value;
+} configure_default_options[] = $configure_default_options;
 EOF
 changequote([,])dnl
 
@@ -1188,6 +1318,8 @@ do
        fi
 done
 
+symbolic_link='ln -s'
+
 # If the host doesn't support symlinks, modify CC in
 # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
 # Otherwise, we can use "CC=$(CC)".
@@ -1276,18 +1408,23 @@ then
            | powerpc*-*-*,powerpc64*-*-*)
                CROSS="$CROSS -DNATIVE_CROSS" ;;
        esac
+elif test "x$TARGET_SYSTEM_ROOT" != x; then
+        # This is just $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)
+        SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
 fi
 
 # If this is a cross-compiler that does not
 # have its own set of headers then define
 # inhibit_libc
 
-# If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS.
+# If this is using newlib, without having the headers available now,
+# then define inhibit_libc in LIBGCC2_CFLAGS.
 # This prevents libgcc2 from containing any code which requires libc
 # support.
 inhibit_libc=
-if { test x$host != x$target && test "x$with_headers" = x &&
-     test "x$with_sysroot" = x ; } || test x$with_newlib = xyes ; then
+if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
+       test x$with_newlib = xyes ; } &&
+     test "x$with_headers" = x ; then
        inhibit_libc=-Dinhibit_libc
 fi
 AC_SUBST(inhibit_libc)
@@ -1313,8 +1450,10 @@ then
     BUILD_CC='$(CC_FOR_BUILD)'
     BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
 
-    STMP_FIXINC=
-    STMP_FIXPROTO=
+    if test "x$TARGET_SYSTEM_ROOT" = x; then
+       STMP_FIXINC=
+       STMP_FIXPROTO=
+    fi
 fi
 
 # Expand extra_headers to include complete path.
@@ -1330,40 +1469,29 @@ else
        done
 fi
 
-if test x$use_collect2 = xno; then
-       use_collect2=
-fi
-
 # Add a definition of USE_COLLECT2 if system wants one.
-if test x$use_collect2 != x
-then
-       host_xm_defines="${host_xm_defines} USE_COLLECT2"
-       xm_defines="${xm_defines} USE_COLLECT2"
-fi
-
-# If we have gas in the build tree, make a link to it.
-if test -f ../gas/Makefile; then
-       rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
-fi
-
-# If we have nm and objdump in the build tree, make a link to them.
-if test -f ../binutils/Makefile; then
-       rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
-       rm -f objdump; $symbolic_link ../binutils/objdump$host_exeext objdump$host_exeext 2>/dev/null
-fi
-
-# If we have ld in the build tree, make a link to it.
-if test -f ../ld/Makefile; then
-       rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
-fi
+case $use_collect2 in
+  no) use_collect2= ;;
+  "") ;;
+  *) 
+    host_xm_defines="${host_xm_defines} USE_COLLECT2"
+    xm_defines="${xm_defines} USE_COLLECT2"
+    ;;
+esac
 
-# Figure out what assembler we will be using.
+# Identify the assembler which will work hand-in-glove with the newly
+# built GCC, so that we can examine its features.  This is the assembler
+# which will be driven by the driver program.
+#
+# If build != host, and we aren't building gas in-tree, we identify a
+# build->target assembler and hope that it will have the same features
+# as the host->target assembler we'll be using.
 AC_MSG_CHECKING(what assembler to use)
+in_tree_gas=no
 gcc_cv_as=
 gcc_cv_gas_major_version=
 gcc_cv_gas_minor_version=
 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
-gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
 if test -x "$DEFAULT_ASSEMBLER"; then
        gcc_cv_as="$DEFAULT_ASSEMBLER"
 elif test -x "$AS"; then
@@ -1371,22 +1499,13 @@ elif test -x "$AS"; then
 elif test -x as$host_exeext; then
        # Build using assembler in the current directory.
        gcc_cv_as=./as$host_exeext
-elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then
-       # Single tree build which includes gas.
-       for f in $gcc_cv_as_bfd_srcdir/configure $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
-       do
-changequote(,)dnl
-               gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
-changequote([,])dnl
-               if test x$gcc_cv_gas_version != x; then
-                       break
-               fi
-       done
-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
+elif test -f $gcc_cv_as_gas_srcdir/configure.in \
+     && test -f ../gas/Makefile; then
+  # Single tree build which includes gas.
+  in_tree_gas=yes
+  _gcc_COMPUTE_GAS_VERSION
+  rm -f as$host_exeext
+  $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
 fi
 
 if test "x$gcc_cv_as" = x; then
@@ -1448,14 +1567,24 @@ if test "x$gcc_cv_as" = x; then
                fi
        done
 fi
-if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
-  AC_MSG_RESULT("newly built gas")
-else
-  AC_MSG_RESULT($gcc_cv_as)
-fi
+case $in_tree_gas in
+  yes)
+    AC_MSG_RESULT("newly built gas")
+    ;;
+  no)
+    AC_MSG_RESULT($gcc_cv_as)
+    ;;
+esac
 
-# Figure out what linker we will be using.
+# Identify the linker which will work hand-in-glove with the newly
+# built GCC, so that we can examine its features.  This is the linker
+# which will be driven by the driver program.
+#
+# If build != host, and we aren't building gas in-tree, we identify a
+# build->target linker and hope that it will have the same features
+# as the host->target linker we'll be using.
 AC_MSG_CHECKING(what linker to use)
+in_tree_ld=no
 gcc_cv_ld=
 gcc_cv_gld_major_version=
 gcc_cv_gld_minor_version=
@@ -1465,11 +1594,13 @@ if test -x "$DEFAULT_LINKER"; then
        gcc_cv_ld="$DEFAULT_LINKER"
 elif test -x "$LD"; then
        gcc_cv_ld="$LD"
-elif test -x ld$host_exeext; then
+elif test -x collect-ld$host_exeext; then
        # Build using linker in the current directory.
-       gcc_cv_ld=./ld$host_exeext
-elif test -f $gcc_cv_ld_gld_srcdir/configure.in -a -f ../ld/Makefile; then
+       gcc_cv_ld=./collect-ld$host_exeext
+elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
+     && test -f ../ld/Makefile; then
        # Single tree build which includes ld.
+       in_tree_ld=yes
        for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in
        do
 changequote(,)dnl
@@ -1483,6 +1614,9 @@ changequote(,)dnl
        gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
        gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
 changequote([,])dnl
+       rm -f collect-ld$host_exeext
+       $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext \
+               2>/dev/null
 fi
 
 if test "x$gcc_cv_ld" = x; then
@@ -1544,50 +1678,77 @@ if test "x$gcc_cv_ld" = x; then
                fi
        done
 fi
-if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
-  AC_MSG_RESULT("newly built ld")
-else
-  AC_MSG_RESULT($gcc_cv_ld)
-fi
+case $in_tree_ld in
+  yes)
+    AC_MSG_RESULT("newly built ld")
+    ;;
+  no)
+    AC_MSG_RESULT($gcc_cv_ld)
+    ;;
+esac
 
 # Figure out what nm we will be using.
+gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
 AC_MSG_CHECKING(what nm to use)
+in_tree_nm=no
 if test -x nm$host_exeext; then
        gcc_cv_nm=./nm$host_exeext
+elif test -f $gcc_cv_binutils_srcdir/configure.in \
+     && test -f ../binutils/Makefile; then
+       # Single tree build which includes binutils.
+       in_tree_nm=yes
+       gcc_cv_nm=./nm$host_exeext
+       rm -f nm$host_exeext
+       $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
 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)
+case $in_tree_nm in
+  yes) AC_MSG_RESULT("newly built nm") ;;
+  no)  AC_MSG_RESULT($gcc_cv_nm) ;;
+esac
 
 # Figure out what objdump we will be using.
 AC_MSG_CHECKING(what objdump to use)
+in_tree_objdump=no
 if test -x objdump$host_exeext; then
        gcc_cv_objdump=./objdump$host_exeext
+elif test -f $gcc_cv_binutils_srcdir/configure.in \
+     && test -f ../binutils/Makefile; then
+       # Single tree build which includes binutils.
+       in_tree_objdump=yes
+       gcc_cv_objdump=./objdump$host_exeext
+       rm -f objdump$host_exeext
+       $symbolic_link ../binutils/objdump$host_exeext \
+               objdump$host_exeext 2>/dev/null
 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
+       gcc_cv_objdump=`echo objdump | \
+               sed ${program_transform_name}`$host_exeext
 fi
-AC_MSG_RESULT($gcc_cv_objdump)
+case $in_tree_objdump in
+  yes) AC_MSG_RESULT("newly built objdump") ;;
+  no)  AC_MSG_RESULT($gcc_cv_objdump) ;;
+esac
 
 # Figure out what assembler alignment features are present.
 AC_MSG_CHECKING(assembler alignment features)
 gcc_cv_as_alignment_features=none
-if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
-       # Gas version 2.6 and later support for .balign and .p2align.
-       # bytes to skip when using .p2align.
-       if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then
-               gcc_cv_as_alignment_features=".balign and .p2align"
-               AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
-       fi
-       # Gas version 2.8 and later support specifying the maximum
-       # bytes to skip when using .p2align.
-       if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then
-               gcc_cv_as_alignment_features=".p2align including maximum skip"
-               AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
-       fi
+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
@@ -1610,10 +1771,12 @@ AC_MSG_RESULT($gcc_cv_as_alignment_features)
 
 AC_MSG_CHECKING(assembler subsection support)
 gcc_cv_as_subsections=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 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-    gcc_cv_as_subsections="working .subsection -1"
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+      gcc_cv_as_subsections="working .subsection -1"
+    fi
+  ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .subsection
        echo ".subsection 1" > conftest.s
@@ -1648,10 +1811,10 @@ AC_MSG_RESULT($gcc_cv_as_subsections)
 
 AC_MSG_CHECKING(assembler weak support)
 gcc_cv_as_weak=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 2 -o "$gcc_cv_gas_major_version" -gt 2; then
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,2,0,[
     gcc_cv_as_weak="yes"
-  fi
+  ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .weak
        echo "  .weak foobar" > conftest.s
@@ -1667,16 +1830,12 @@ 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" -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
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+      gcc_cv_as_hidden="yes"
+    fi
+  ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .hidden
        echo "  .hidden foobar" > conftest.s
@@ -1692,8 +1851,8 @@ elif test x$gcc_cv_as != x; then
        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'`
+               ld_vers=`echo $ld_ver | sed -n '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
@@ -1719,12 +1878,6 @@ changequote(,)dnl
 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
@@ -1734,18 +1887,26 @@ case "$target" in
       # -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
+      gcc_cv_as_hidden=no
     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
 AC_SUBST(libgcc_visibility)
 
 AC_MSG_CHECKING(assembler leb128 support)
 gcc_cv_as_leb128=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 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-    gcc_cv_as_leb128="yes"
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+      gcc_cv_as_leb128="yes"
+    fi
+  ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .[us]leb128, and support symbol arithmetic with it.
        cat > conftest.s <<EOF
@@ -1786,10 +1947,12 @@ AC_MSG_RESULT($gcc_cv_as_leb128)
 
 AC_MSG_CHECKING(assembler eh_frame optimization)
 gcc_cv_as_eh_frame=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 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-    gcc_cv_as_eh_frame="yes"
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+      gcc_cv_as_eh_frame="yes"
+    fi
+  ])
 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`
@@ -1864,10 +2027,12 @@ AC_MSG_RESULT($gcc_cv_as_eh_frame)
 
 AC_MSG_CHECKING(assembler section merging support)
 gcc_cv_as_shf_merge=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 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-    gcc_cv_as_shf_merge=yes
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+      gcc_cv_as_shf_merge=yes
+    fi
+  ])
 elif test x$gcc_cv_as != x; then
        # Check if we support SHF_MERGE sections
        echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s
@@ -1887,6 +2052,7 @@ gcc_cv_as_tls=no
 conftest_s=
 tls_first_major=
 tls_first_minor=
+tls_as_opt=
 case "$target" in
 changequote(,)dnl
   alpha*-*-*)
@@ -1962,6 +2128,66 @@ foo:     data8   25
        tls_first_major=2
        tls_first_minor=13
        ;;
+  powerpc-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+       .align 2
+ld0:   .space 4
+ld1:   .space 4
+x1:    .space 4
+x2:    .space 4
+x3:    .space 4
+       .text
+       addi 3,31,ld0@got@tlsgd
+       bl __tls_get_addr
+       addi 3,31,x1@got@tlsld
+       bl __tls_get_addr
+       addi 9,3,x1@dtprel
+       addis 9,3,x2@dtprel@ha
+       addi 9,9,x2@dtprel@l
+       lwz 9,x3@got@tprel(31)
+       add 9,9,x@tls
+       addi 9,2,x1@tprel
+       addis 9,2,x2@tprel@ha
+       addi 9,9,x2@tprel@l'
+       tls_first_major=2
+       tls_first_minor=14
+       tls_as_opt=-a32
+       ;;
+  powerpc64-*-*)
+    conftest_s='
+       .section ".tdata","awT",@progbits
+       .align 3
+ld0:   .space 8
+ld1:   .space 8
+x1:    .space 8
+x2:    .space 8
+x3:    .space 8
+       .text
+       addi 3,2,ld0@got@tlsgd
+       bl .__tls_get_addr
+       nop
+       addi 3,2,ld1@toc
+       bl .__tls_get_addr
+       nop
+       addi 3,2,x1@got@tlsld
+       bl .__tls_get_addr
+       nop
+       addi 9,3,x1@dtprel
+       bl .__tls_get_addr
+       nop
+       addis 9,3,x2@dtprel@ha
+       addi 9,9,x2@dtprel@l
+       bl .__tls_get_addr
+       nop
+       ld 9,x3@got@dtprel(2)
+       add 9,9,3
+       bl .__tls_get_addr
+       nop'
+       tls_first_major=2
+       tls_first_minor=14
+       tls_as_opt=-a64
+       ;;
   s390-*-*)
     conftest_s='
        .section ".tdata","awT",@progbits
@@ -1979,6 +2205,7 @@ foo:      .long   25
        bas     %r14,0(%r1,%r13):tls_ldcall:foo'
        tls_first_major=2
        tls_first_minor=14
+       tls_as_opt=-m31
        ;;
   s390x-*-*)
     conftest_s='
@@ -1996,20 +2223,18 @@ foo:    .long   25
        brasl   %r14,__tls_get_offset@PLT:tls_ldcall:foo'
        tls_first_major=2
        tls_first_minor=14
+       tls_as_opt="-m64 -Aesame"
        ;;
 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
+elif test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE($tls_first_major,$tls_first_minor,0,[
     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
+  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
@@ -2027,14 +2252,10 @@ case "$target" in
     AC_CACHE_CHECK([assembler supports explicit relocations],
        gcc_cv_as_explicit_relocs, [
        gcc_cv_as_explicit_relocs=unknown
-       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 12 \
-                  -o "$gcc_cv_gas_major_version" -gt 2; then
+       if test $in_tree_gas = yes ; then
+           gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
              gcc_cv_as_explicit_relocs=yes
-          fi
+          ])
        elif test x$gcc_cv_as != x; then
            cat > conftest.s << 'EOF'
        .set nomacro
@@ -2186,10 +2407,10 @@ changequote(,)dnl
 changequote([,])dnl
     AC_MSG_CHECKING(assembler instructions)
     gcc_cv_as_instructions=
-    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 9 -o "$gcc_cv_gas_major_version" -gt 2; then
+    if test $in_tree_gas = yes ; then 
+      gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
        gcc_cv_as_instructions="filds fists"
-      fi
+      ])
     elif test x$gcc_cv_as != x; then
        set "filds fists" "filds mem; fists mem"
        while test $# -gt 0
@@ -2209,13 +2430,10 @@ changequote([,])dnl
 
     AC_MSG_CHECKING(assembler GOTOFF in data directives)
     gcc_cv_as_gotoff_in_data=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 11 \
-        -o "$gcc_cv_gas_major_version" -gt 2; then
+    if test $in_tree_gas = yes ; then
+      gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
        gcc_cv_as_gotoff_in_data=yes
-      fi
+      ])
     elif test x$gcc_cv_as != x; then
        cat > conftest.s <<EOF
        .text
@@ -2233,6 +2451,37 @@ EOF
       [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
+       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
+    ;;
 esac
 
 AC_MSG_CHECKING(assembler dwarf2 debug_line support)
@@ -2245,22 +2494,20 @@ gcc_cv_as_dwarf2_debug_line=no
 # version to the per-target configury.
 case "$target" in
   i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
-  | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-*)
+  | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-* | xstormy16*-*-*)
     insn="nop"
     ;;
   ia64*-*-*)
     insn="nop 0"
     ;;
   esac
-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 11 \
-       -o "$gcc_cv_gas_major_version" -gt 2 \
-     && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
-     && test x"$insn" != x ; then
-    gcc_cv_as_dwarf2_debug_line="yes"
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+        && test x"$insn" != x ; then
+      gcc_cv_as_dwarf2_debug_line="yes"
+    fi
+  ])
 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
@@ -2292,15 +2539,13 @@ AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
 
 AC_MSG_CHECKING(assembler --gdwarf2 support)
 gcc_cv_as_gdwarf2_flag=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 11 \
-       -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_flag="yes"
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+        && test x"$insn" != x ; then
+      gcc_cv_as_gdwarf2_flag="yes"
+    fi
+  ])
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '' > conftest.s
        # ??? This fails with non-gnu grep.
@@ -2318,15 +2563,13 @@ AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag)
 
 AC_MSG_CHECKING(assembler --gstabs support)
 gcc_cv_as_gstabs_flag=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 11 \
-       -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_flag="yes"
-  fi
+if test $in_tree_gas = yes ; then
+  gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+    if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+        && test x"$insn" != x ; then
+      gcc_cv_as_gstabs_flag="yes"
+    fi
+  ])
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '' > conftest.s
        # ??? This fails with non-gnu grep.
@@ -2343,7 +2586,7 @@ 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 $in_tree_ld = yes ; 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
@@ -2357,9 +2600,9 @@ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
      && $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
+       conftest2.o conftest3.o > /dev/null 2>&1; then
     gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
-                        | grep -A1 myfoosect`
+                        | sed -e '/myfoosect/!d' -e N`
     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
@@ -2381,7 +2624,7 @@ 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
+if test $in_tree_ld = yes ; then
   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
     gcc_cv_ld_eh_frame_hdr=yes
   fi
@@ -2397,6 +2640,24 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
 fi
 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
 
+AC_MSG_CHECKING(linker position independent executable support)
+gcc_cv_ld_pie=no
+if test $in_tree_ld = yes ; then
+  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
+    gcc_cv_ld_pie=yes
+  fi
+elif test x$gcc_cv_ld != x; then
+       # Check if linker supports -pie option
+       if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then
+               gcc_cv_ld_pie=yes
+       fi
+fi
+if test x"$gcc_cv_ld_pie" = xyes; then
+       AC_DEFINE(HAVE_LD_PIE, 1,
+[Define if your linker supports -pie option.])
+fi
+AC_MSG_RESULT($gcc_cv_ld_pie)
+
 # Miscellaneous target-specific checks.
 case "$target" in
   mips*-*-*)
@@ -2424,6 +2685,23 @@ 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 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
 
@@ -2728,12 +3006,12 @@ done
 
 rm -f Make-hooks
 touch Make-hooks
-target_list="all.build all.cross start.encap rest.encap \
+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 \
-       stage1 stage2 stage3 stage4"
+       stage1 stage2 stage3 stage4 stageprofile stagefeedback"
 for t in $target_list
 do
        x=
@@ -2762,18 +3040,6 @@ if test "x$subdirs" != x; then
 fi
 echo "source ${srcdir}/gdbinit.in" >> .gdbinit
 
-# Define variables host_canonical and build_canonical
-# because some Cygnus local changes in the Makefile depend on them.
-build_canonical=${build}
-host_canonical=${host}
-target_subdir=
-if test "${host}" != "${target}" ; then
-    target_subdir=${target_alias}/
-fi
-AC_SUBST(build_canonical)
-AC_SUBST(host_canonical)
-AC_SUBST(target_subdir)
-       
 # If $(exec_prefix) exists and is not the same as $(prefix), then compute an
 # absolute path for gcc_tooldir based on inserting the number of up-directory
 # movements required to get from $(exec_prefix) to $(prefix) into the basic
@@ -2961,7 +3227,7 @@ if test "$symbolic_link" = "ln -s"; then
    if test $d != ..; then
        STARTDIR=`${PWDCMD-pwd}`
        cd $d
-       for t in stage1 stage2 stage3 stage4 include
+       for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include
        do
                rm -f $t
                $symbolic_link ../$t $t 2>/dev/null
This page took 0.070722 seconds and 5 git commands to generate.