]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - aclocal.m4
Properly check linker -z XXX support
[thirdparty/glibc.git] / aclocal.m4
index b173e9e339d7debe59ca6fe6b61c873ef23d8657..956ea8616c7d16ac9fb724caf50c0495d675ea4b 100644 (file)
@@ -213,3 +213,31 @@ AC_DEFUN([ACX_BUGURL],[
   AC_SUBST(REPORT_BUGS_TO)
   AC_SUBST(REPORT_BUGS_TEXI)
 ])
+
+dnl Check linker option support.
+dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
+AC_DEFUN([LIBC_LINKER_FEATURE],
+[AC_MSG_CHECKING([for linker that supports $1])
+libc_linker_feature=no
+if test x"$gnu_ld" = x"yes"; then
+  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\$1"`
+  if test -n "$libc_linker_check"; then
+    cat > conftest.c <<EOF
+int _start (void) { return 42; }
+EOF
+    if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+                               $2 -nostdlib -nostartfiles
+                               -fPIC -shared -o conftest.so conftest.c
+                               1>&AS_MESSAGE_LOG_FD])
+    then
+      libc_linker_feature=yes
+    fi
+    rm -f conftest*
+  fi
+fi
+if test $libc_linker_feature = yes; then
+  $3
+else
+  $4
+fi
+AC_MSG_RESULT($libc_linker_feature)])