@@ -373,9 +373,18 @@ AC_DEFUN([gcc_AC_INITFINI_ARRAY],
[AC_ARG_ENABLE(initfini-array,
[ --enable-initfini-array use .init_array/.fini_array sections],
[], [
+AC_REQUIRE([gcc_AC_PROG_LN_S])dnl
AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
gcc_cv_initfini_array, [dnl
if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
+ saved_CC="$CC"
+ tempdir=build.$$
+ if test x"${DEFAULT_LINKER+set}" = x"set"; then
+ rm -rf $tempdir
+ mkdir $tempdir
+ $gcc_cv_prog_LN_S "${DEFAULT_LINKER}" $tempdir/ld
+ CC="$CC -B${tempdir}/"
+ fi
AC_RUN_IFELSE([AC_LANG_SOURCE([
#ifndef __ELF__
#error Not an ELF OS
@@ -485,10 +494,12 @@ main ()
])],
[gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
[gcc_cv_initfini_array=no])
- else
- AC_MSG_CHECKING(cross compile... guessing)
- gcc_cv_initfini_array=no
- fi])
+ rm -rf $tempdir
+ CC="$saved_CC"
+ else
+ AC_MSG_CHECKING(cross compile... guessing)
+ gcc_cv_initfini_array=no
+ fi])
enable_initfini_array=$gcc_cv_initfini_array
])
if test $enable_initfini_array = yes; then
@@ -10782,6 +10782,14 @@ if test "${gcc_cv_initfini_array+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
+ saved_CC="$CC"
+ tempdir=build.$$
+ if test x"${DEFAULT_LINKER+set}" = x"set"; then
+ rm -rf $tempdir
+ mkdir $tempdir
+ $gcc_cv_prog_LN_S "${DEFAULT_LINKER}" $tempdir/ld
+ CC="$CC -B${tempdir}/"
+ fi
if test "$cross_compiling" = yes; then :
gcc_cv_initfini_array=no
else
@@ -10904,11 +10912,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5
+ rm -rf $tempdir
+ CC="$saved_CC"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5
$as_echo_n "checking cross compile... guessing... " >&6; }
- gcc_cv_initfini_array=no
- fi
+ gcc_cv_initfini_array=no
+ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_initfini_array" >&5
$as_echo "$gcc_cv_initfini_array" >&6; }
@@ -17915,7 +17925,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17918 "configure"
+#line 17928 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18021,7 +18031,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18024 "configure"
+#line 18034 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H