about summary refs log tree commit diff
path: root/aclocal.m4
diff options
context:
space:
mode:
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)])