summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-24 02:04:27 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-24 02:04:27 +0200
commit0cb95cb5ae7e494f0ba776eeeceec3225ff15a28 (patch)
tree93a8fd15e07739ce52c3e813f5382232ff367569 /m4
parenta2583761573b98127ae9396785875a88a4a4b8ad (diff)
downloadxine-lib-0cb95cb5ae7e494f0ba776eeeceec3225ff15a28.tar.gz
xine-lib-0cb95cb5ae7e494f0ba776eeeceec3225ff15a28.tar.bz2
Backport pthreads.m4 from 1.2.
Both attributes.m4 and pthread.m4 are two reusable M4 macro files, which can eaily be shared between different projects. For this reason it's better if they are kept identical between branches.
Diffstat (limited to 'm4')
-rw-r--r--m4/pthreads.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/m4/pthreads.m4 b/m4/pthreads.m4
index fb1adaab8..facac076f 100644
--- a/m4/pthreads.m4
+++ b/m4/pthreads.m4
@@ -73,3 +73,28 @@ AC_DEFUN([CC_PTHREAD_FLAGS], [
ifelse([$2], , [:], [$2])
fi
])
+
+AC_DEFUN([CC_PTHREAD_RECURSIVE_MUTEX], [
+ AC_REQUIRE([CC_PTHREAD_FLAGS])
+ AC_MSG_CHECKING([for recursive mutex support in pthread])
+
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $PTHREAD_LIBS"
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include <pthread.h>
+
+int main() {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ return 0;
+}
+ ]), [have_recursive_mutex=yes], [have_recursive_mutex=no])
+ LIBS="$ac_save_LIBS"
+
+ AC_MSG_RESULT([$have_recursive_mutex])
+
+ if test x"$have_recursive_mutex" = x"yes"; then
+ ifelse([$1], , [:], [$1])
+ else
+ ifelse([$2], , [:], [$2])
+ fi
+])