aboutsummaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-11-21 12:31:01 -0800
committerH.J. Lu <hjl.tools@gmail.com>2012-11-21 12:34:32 -0800
commit6bfea97493900d456245ca9f29765e1f0ee9d649 (patch)
tree29187abc833cddbe02fe07b6eb96232300f9ab49 /aclocal.m4
parentad35f2dd750ed3e3f483409ef50b38ea19745002 (diff)
downloadglibc-6bfea97493900d456245ca9f29765e1f0ee9d649.tar
glibc-6bfea97493900d456245ca9f29765e1f0ee9d649.tar.gz
glibc-6bfea97493900d456245ca9f29765e1f0ee9d649.tar.bz2
glibc-6bfea97493900d456245ca9f29765e1f0ee9d649.zip
Properly check linker -z XXX support
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m428
1 files changed, 28 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index b173e9e339..956ea8616c 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -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)])