]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use -z ignore instead of --as-needed on Solaris
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 24 May 2013 09:23:33 +0000 (09:23 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Fri, 24 May 2013 09:23:33 +0000 (09:23 +0000)
* acinclude.m4 (libgfor_cv_have_as_needed): Check for -z ignore, too.
* configure: Regenerate.

From-SVN: r199285

libgfortran/ChangeLog
libgfortran/acinclude.m4
libgfortran/configure

index 8b34b1257704ab4c49018fc822f476d3bbc03bbe..59ac4da949f60bf311b82b2f175de993bcc29e94 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * acinclude.m4 (libgfor_cv_have_as_needed): Check for -z ignore, too.
+       * configure: Regenerate.
+
 2013-05-05  David Edelsohn  <dje.gcc@gmail.com>
 
        * caf/libcaf.h (_gfortran_caf_critical): Add a prototype.
index 35698ec00f6e25d5813638f0f013ee3178c8a3f9..ba890f9839118840c0a8560e1e5ef0aafb0a75fe 100644 (file)
@@ -296,7 +296,7 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
   if test "x$libgfor_cv_have_float128" = xyes; then
     AC_DEFINE(HAVE_FLOAT128, 1, [Define if have a usable __float128 type.])
 
-    dnl Check whether -Wl,--as-needed is supported
+    dnl Check whether -Wl,--as-needed resp. -Wl,-zignore is supported
     dnl 
     dnl Turn warnings into error to avoid testsuite breakage.  So enable
     dnl AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to turn
@@ -304,23 +304,39 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
     dnl AC_PATH_XTRA.
     dnl Cf. http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html
     ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
-    AC_CACHE_CHECK([whether --as-needed works],
+    AC_CACHE_CHECK([whether --as-needed/-z ignore works],
       [libgfor_cv_have_as_needed],
       [
+      # Test for native Solaris options first.
+      # No whitespace after -z to pass it through -Wl.
+      libgfor_cv_as_needed_option="-zignore"
+      libgfor_cv_no_as_needed_option="-zrecord"
       save_LDFLAGS="$LDFLAGS"
-      LDFLAGS="$LDFLAGS -Wl,--as-needed -lm -Wl,--no-as-needed"
+      LDFLAGS="$LDFLAGS -Wl,$libgfor_cv_as_needed_option -lm -Wl,$libgfor_cv_no_as_needed_option"
       libgfor_cv_have_as_needed=no
       AC_LANG_WERROR
       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
                     [libgfor_cv_have_as_needed=yes],
                     [libgfor_cv_have_as_needed=no])
       LDFLAGS="$save_LDFLAGS"
+      if test "x$libgfor_cv_have_as_needed" = xno; then
+       libgfor_cv_as_needed_option="--as-needed"
+       libgfor_cv_no_as_needed_option="--no-as-needed"
+       save_LDFLAGS="$LDFLAGS"
+       LDFLAGS="$LDFLAGS -Wl,$libgfor_cv_as_needed_option -lm -Wl,$libgfor_cv_no_as_needed_option"
+       libgfor_cv_have_as_needed=no
+       AC_LANG_WERROR
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
+                      [libgfor_cv_have_as_needed=yes],
+                      [libgfor_cv_have_as_needed=no])
+       LDFLAGS="$save_LDFLAGS"
+      fi
       ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag
     ])
 
     dnl For static libgfortran linkage, depend on libquadmath only if needed.
     if test "x$libgfor_cv_have_as_needed" = xyes; then
-      LIBQUADSPEC="%{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed}"
+      LIBQUADSPEC="%{static-libgfortran:$libgfor_cv_as_needed_option} -lquadmath %{static-libgfortran:$libgfor_cv_no_as_needed_option}"
     else
       LIBQUADSPEC="-lquadmath"
     fi
index 8385e9684581f9e9a2d513f8e5d283b14e9ddb48..8601d8440fa909e520f50a5fdbc23de620d5b7f8 100755 (executable)
@@ -600,6 +600,7 @@ ac_includes_default="\
 ac_header_list=
 ac_func_list=
 ac_c_werror_flag=
+ac_c_werror_flag=
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
@@ -12333,7 +12334,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12336 "configure"
+#line 12337 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12439,7 +12440,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12442 "configure"
+#line 12443 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -25720,14 +25721,18 @@ $as_echo "#define HAVE_FLOAT128 1" >>confdefs.h
 
 
                                 ac_xsave_c_werror_flag=$ac_c_werror_flag
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether --as-needed works" >&5
-$as_echo_n "checking whether --as-needed works... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether --as-needed/-z ignore works" >&5
+$as_echo_n "checking whether --as-needed/-z ignore works... " >&6; }
 if test "${libgfor_cv_have_as_needed+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
+      # Test for native Solaris options first.
+      # No whitespace after -z to pass it through -Wl.
+      libgfor_cv_as_needed_option="-zignore"
+      libgfor_cv_no_as_needed_option="-zrecord"
       save_LDFLAGS="$LDFLAGS"
-      LDFLAGS="$LDFLAGS -Wl,--as-needed -lm -Wl,--no-as-needed"
+      LDFLAGS="$LDFLAGS -Wl,$libgfor_cv_as_needed_option -lm -Wl,$libgfor_cv_no_as_needed_option"
       libgfor_cv_have_as_needed=no
 
 ac_c_werror_flag=yes
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
       LDFLAGS="$save_LDFLAGS"
+      if test "x$libgfor_cv_have_as_needed" = xno; then
+       libgfor_cv_as_needed_option="--as-needed"
+       libgfor_cv_no_as_needed_option="--no-as-needed"
+       save_LDFLAGS="$LDFLAGS"
+       LDFLAGS="$LDFLAGS -Wl,$libgfor_cv_as_needed_option -lm -Wl,$libgfor_cv_no_as_needed_option"
+       libgfor_cv_have_as_needed=no
+
+ac_c_werror_flag=yes
+       if test x$gcc_no_link = xyes; then
+  as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  libgfor_cv_have_as_needed=yes
+else
+  libgfor_cv_have_as_needed=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS="$save_LDFLAGS"
+      fi
       ac_c_werror_flag=$ac_xsave_c_werror_flag
 
 fi
@@ -25760,7 +25796,7 @@ fi
 $as_echo "$libgfor_cv_have_as_needed" >&6; }
 
         if test "x$libgfor_cv_have_as_needed" = xyes; then
-      LIBQUADSPEC="%{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed}"
+      LIBQUADSPEC="%{static-libgfortran:$libgfor_cv_as_needed_option} -lquadmath %{static-libgfortran:$libgfor_cv_no_as_needed_option}"
     else
       LIBQUADSPEC="-lquadmath"
     fi