OSDN Git Service

Patch from Gunther Nikl.
[pf3gnuchains/gcc-fork.git] / gcc / configure.in
index fefc7a1..b543a6f 100644 (file)
@@ -32,18 +32,9 @@ AC_CONFIG_HEADER(auto-host.h:config.in)
 # 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=
-if test "${host}" != "${target}" ; then
-    target_subdir=${target_alias}/
-fi
-AC_SUBST(target_subdir)
-       
+# Determine the target- and build-specific subdirectories
+GCC_TOPLEV_SUBDIRS
+
 # Set program_transform_name
 AC_ARG_PROGRAM
 
@@ -253,9 +244,7 @@ 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
 
@@ -270,8 +259,6 @@ if test $ac_cv_c___int64 = yes; then
   AC_COMPILE_CHECK_SIZEOF(__int64)
 fi
 
-gcc_AC_C_CHARSET
-
 # -----------------
 # Find Ada compiler
 # -----------------
@@ -481,14 +468,7 @@ AC_SUBST(enable_multilib)
 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++],
@@ -645,6 +625,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.
@@ -686,7 +686,7 @@ 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 \
+                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)
 
@@ -761,10 +761,6 @@ 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
-
 # Use <inttypes.h> only if it exists,
 # doesn't clash with <sys/types.h>, and declares intmax_t.
 AC_MSG_CHECKING(for inttypes.h)
@@ -787,7 +783,7 @@ dnl gcc_AC_C_ENUM_BF_UNSIGNED
 AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \
        sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
        fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
-        scandir alphasort gettimeofday mbstowcs wcswidth)
+        scandir alphasort gettimeofday mbstowcs wcswidth mmap mincore)
 
 if test x$ac_cv_func_mbstowcs = xyes; then
   AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
@@ -830,6 +826,7 @@ fi
 AC_SUBST(TARGET_GETGROUPS_T)
 
 gcc_AC_FUNC_PRINTF_PTR
+gcc_AC_FUNC_MMAP_BLACKLIST
 
 case "${host}" in
 *-*-uwin*)
@@ -845,8 +842,6 @@ case "${host}" in
   ;;
 esac
 AC_FUNC_VFORK
-AC_FUNC_MMAP_ANYWHERE
-AC_FUNC_MMAP_FILE
 
 AM_ICONV
 
@@ -977,7 +972,6 @@ build_exeext=
 host_xm_file=
 host_xm_defines=
 host_xmake_file=
-host_truncate_target=
 host_exeext=
 
 # Decode the host machine, then the target machine.
@@ -1104,6 +1098,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}
@@ -1150,7 +1153,7 @@ else
        cd ..
        rm -rf $tempdir
        build_auto=auto-build.h
-       FORBUILD=../build-$build_alias
+       FORBUILD=../${build_subdir}
 fi
 AC_SUBST(FORBUILD)
 
@@ -1166,11 +1169,6 @@ 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/'`
-fi
-
 # Get the version trigger filename from the toplevel
 if test "${with_gcc_version_trigger+set}" = set; then
        gcc_version_trigger=$with_gcc_version_trigger
@@ -1193,6 +1191,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
 
@@ -1395,12 +1397,14 @@ fi
 # 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)
@@ -1412,7 +1416,7 @@ AC_SUBST(inhibit_libc)
 # These are the normal (build=host) settings:
 BUILD_PREFIX=                  AC_SUBST(BUILD_PREFIX)
 BUILD_PREFIX_1=ignore-         AC_SUBST(BUILD_PREFIX_1)
-BUILD_CC='$(CC)'               AC_SUBST(BUILD_CC)
+CC_FOR_BUILD='$(CC)'           AC_SUBST(CC_FOR_BUILD)
 BUILD_CFLAGS='$(ALL_CFLAGS)'   AC_SUBST(BUILD_CFLAGS)
 
 STMP_FIXINC=stmp-fixinc                AC_SUBST(STMP_FIXINC)
@@ -1423,7 +1427,6 @@ if test x$build != x$host
 then
     BUILD_PREFIX=build-
     BUILD_PREFIX_1=build-
-    BUILD_CC='$(CC_FOR_BUILD)'
     BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
 
     if test "x$TARGET_SYSTEM_ROOT" = x; then
@@ -1482,6 +1485,13 @@ elif test -f $gcc_cv_as_gas_srcdir/configure.in \
   _gcc_COMPUTE_GAS_VERSION
   rm -f as$host_exeext
   $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
+  in_tree_gas_is_elf=no
+  if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+     || (grep 'obj_format = multi' ../gas/Makefile \
+         && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
+  then
+    in_tree_gas_is_elf=yes
+  fi
 fi
 
 if test "x$gcc_cv_as" = x; then
@@ -1577,6 +1587,11 @@ 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
+       in_tree_ld_is_elf=no
+       if (grep 'EMUL = .*elf' ../ld/Makefile \
+           || grep 'EMUL = .*linux' ../ld/Makefile) > /dev/null; then
+         in_tree_ld_is_elf=yes
+       fi
        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
@@ -1749,9 +1764,8 @@ AC_MSG_CHECKING(assembler subsection support)
 gcc_cv_as_subsections=no
 if test $in_tree_gas = yes ; then
   gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
-    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-      gcc_cv_as_subsections="working .subsection -1"
-    fi
+    test $in_tree_gas_is_elf = yes \
+       && gcc_cv_as_subsections="working .subsection -1"
   ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .subsection
@@ -1808,9 +1822,7 @@ AC_MSG_CHECKING(assembler hidden support)
 gcc_cv_as_hidden=no
 if test $in_tree_gas = yes ; then
   gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[
-    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-      gcc_cv_as_hidden="yes"
-    fi
+    test $in_tree_gas_is_elf = yes && gcc_cv_as_hidden="yes"
   ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .hidden
@@ -1827,8 +1839,14 @@ 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 \
+              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\)[  ].*$,\1,p' \
+              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[     ].*$,\1,p' \
+              -e 's,^.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[        ].*$,\1,p'`
+               ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
                if test 0"$ld_date" -lt 20020404; then
                        if test -n "$ld_date"; then
                                # If there was date string, but was earlier than 2002-04-04, fail
@@ -1854,12 +1872,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
@@ -1869,19 +1881,23 @@ 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 $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
+    test $in_tree_gas_is_elf = yes && gcc_cv_as_leb128="yes"
   ])
 elif test x$gcc_cv_as != x; then
        # Check if we have .[us]leb128, and support symbol arithmetic with it.
@@ -1925,9 +1941,7 @@ AC_MSG_CHECKING(assembler eh_frame optimization)
 gcc_cv_as_eh_frame=no
 if test $in_tree_gas = yes ; then
   gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
-    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-      gcc_cv_as_eh_frame="yes"
-    fi
+    test $in_tree_gas_is_elf = yes && gcc_cv_as_eh_frame="yes"
   ])
 elif test x$gcc_cv_as != x; then
        # Check if this is GAS.
@@ -2005,9 +2019,7 @@ AC_MSG_CHECKING(assembler section merging support)
 gcc_cv_as_shf_merge=no
 if test $in_tree_gas = yes ; then
   gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
-    if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
-      gcc_cv_as_shf_merge=yes
-    fi
+    test $in_tree_gas_is_elf = yes && gcc_cv_as_shf_merge="yes"
   ])
 elif test x$gcc_cv_as != x; then
        # Check if we support SHF_MERGE sections
@@ -2028,6 +2040,7 @@ gcc_cv_as_tls=no
 conftest_s=
 tls_first_major=
 tls_first_minor=
+tls_as_opt=
 case "$target" in
 changequote(,)dnl
   alpha*-*-*)
@@ -2103,6 +2116,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
@@ -2120,6 +2193,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='
@@ -2137,6 +2211,7 @@ 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
@@ -2147,7 +2222,7 @@ elif test $in_tree_gas = yes ; then
   ])
 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
@@ -2407,19 +2482,21 @@ 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*-*-* | cris-*-*)
     insn="nop"
     ;;
   ia64*-*-*)
     insn="nop 0"
     ;;
+  mmix-*-*)
+    insn="swym 0"
+    ;;
   esac
 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
+    test $in_tree_gas_is_elf = yes && test x"$insn" != x \
+       && gcc_cv_as_dwarf2_debug_line="yes"
   ])
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '  .file 1 "conftest.s"' > conftest.s
@@ -2454,10 +2531,8 @@ AC_MSG_CHECKING(assembler --gdwarf2 support)
 gcc_cv_as_gdwarf2_flag=no
 if test $in_tree_gas = yes ; then
   gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-    if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
-        && test x"$insn" != x ; then
-      gcc_cv_as_gdwarf2_flag="yes"
-    fi
+    test $in_tree_gas_is_elf = yes && test x"$insn" != x \
+       && gcc_cv_as_gdwarf2_flag="yes"
   ])
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '' > conftest.s
@@ -2478,16 +2553,21 @@ AC_MSG_CHECKING(assembler --gstabs support)
 gcc_cv_as_gstabs_flag=no
 if test $in_tree_gas = yes ; then
   gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
-    if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
-        && test x"$insn" != x ; then
-      gcc_cv_as_gstabs_flag="yes"
-    fi
+    test $in_tree_gas_is_elf = yes && test x"$insn" != x \
+       && gcc_cv_as_gstabs_flag="yes"
   ])
 elif test x$gcc_cv_as != x -a x"$insn" != x ; then
        echo '' > conftest.s
        # ??? This fails with non-gnu grep.
        if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then
          gcc_cv_as_gstabs_flag="yes"
+         # The native Solaris 9/Intel assembler doesn't understand --gstabs
+         # and warns about it, but still exits successfully.  So check for
+         # this.
+         if $gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | \
+               grep -i warning > /dev/null ; then
+           gcc_cv_as_gstabs_flag="no"
+         fi
        fi
        rm -f conftest.s conftest.o
 fi
@@ -2500,22 +2580,23 @@ 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 $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
+  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 \
+     && test $in_tree_ld_is_elf = yes; 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 '.section myfoosect, "a"' > conftest1.s
+  echo '.section myfoosect, "aw"' > conftest2.s
   echo '.byte 1' >> conftest2.s
-  echo '.section "myfoosect", "a"' > conftest3.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
+       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
@@ -2538,7 +2619,8 @@ 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 $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
+  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 \
+     && test $in_tree_ld_is_elf = yes; then
     gcc_cv_ld_eh_frame_hdr=yes
   fi
 elif test x$gcc_cv_ld != x; then
@@ -2553,6 +2635,25 @@ 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 \
+     && test $in_tree_ld_is_elf = yes; 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*-*-*)
@@ -2580,6 +2681,27 @@ case "$target" in
         [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.])
     fi
     AC_MSG_RESULT($gcc_cv_mips_libgloss_startup)
+
+    AC_MSG_CHECKING(whether the assembler has explicit relocation support)
+    if test x$gcc_cv_mips_explicit_relocs = x; then
+      gcc_cv_mips_explicit_relocs=no
+      if test $in_tree_gas = yes; then
+        gcc_GAS_VERSION_GTE_IFELSE(2,14,0,[
+         gcc_cv_mips_explicit_relocs=yes
+       ])
+      elif test x$gcc_cv_as != x; then
+       echo '  lw $4,%gp_rel(foo)($4)' > conftest.s
+       if $gcc_cv_as conftest.s -o conftest.o > /dev/null 2>&1; then
+         gcc_cv_mips_explicit_relocs=yes
+       fi
+       rm -f conftest.s conftest.o
+      fi
+    fi
+    if test $gcc_cv_mips_explicit_relocs = yes; then
+      test x$target_cpu_default != x || target_cpu_default=0
+      target_cpu_default="(${target_cpu_default}|MASK_EXPLICIT_RELOCS)"
+    fi
+    AC_MSG_RESULT($gcc_cv_mips_explicit_relocs)
     ;;
 esac
 
@@ -2775,11 +2897,15 @@ AC_SUBST(MAINT)dnl
 # 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_opt_files=
 lang_specs_files=
 lang_options_files=
 lang_tree_files=
 for subdir in . $subdirs
 do
+       if test -f $srcdir/$subdir/lang.opt; then
+           lang_opt_files="$lang_opt_files $srcdir/$subdir/lang.opt"
+       fi
        if test -f $srcdir/$subdir/lang-specs.h; then
            lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
        fi
@@ -2889,7 +3015,7 @@ target_list="all.build all.cross start.encap rest.encap tags \
        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=
@@ -3023,6 +3149,7 @@ AC_SUBST(host_xm_file)
 AC_SUBST(host_xm_defines)
 AC_SUBST(out_host_hook_obj)
 AC_SUBST(install)
+AC_SUBST(lang_opt_files)
 AC_SUBST(lang_options_files)
 AC_SUBST(lang_specs_files)
 AC_SUBST(lang_tree_files)
@@ -3078,11 +3205,6 @@ then
        echo " ${str2}${str3}." 1>&2
 fi
 
-# Truncate the target if necessary
-if test x$host_truncate_target != x; then
-       target=`echo $target | sed -e 's/\(..............\).*/\1/'`
-fi
-
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
@@ -3105,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