--- a/m4/_xine.m4
+++ b/m4/_xine.m4
@@ -128,3 +128,18 @@
     AC_TRY_COMPILE([],[switch (0) case 0: case (sizeof ($1) == $2):;],[],
         [AC_MSG_ERROR([can not build a default inttypes.h])])
     AC_MSG_RESULT([yes])])
+
+dnl AC_TRY_LDFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
+dnl check if $CC supports a given set of ldflags
+AC_DEFUN([AC_TRY_LDFLAGS],
+    [AC_MSG_CHECKING([if $CC supports $1 flags])
+    SAVE_LDFLAGS="$LDFLAGS"
+    LDFLAGS="$1"
+    AC_TRY_LINK([],[],[ac_cv_try_ldflags_ok=yes],[ac_cv_try_ldflags_ok=no])
+    LDFLAGS="$SAVE_LDFLAGS"
+    AC_MSG_RESULT([$ac_cv_try_ldflags_ok])
+    if test x"$ac_cv_try_ldflags_ok" = x"yes"; then
+        ifelse([$2],[],[:],[$2])
+    else
+        ifelse([$3],[],[:],[$3])
+    fi])