1 Fix missing PTHREAD_MUTEX_RECURSIVE_NP
3 The musl C library does not provide the non portable
4 PTHREAD_MUTEX_RECURSIVE_NP. In addition, uClibc does not define it as
5 a #define, but as an enum value, so doing a #if defined() check
6 doesn't work properly. Instead, add a AC_CHECK_DECL() autoconf check.
8 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
9 [Thomas: switch to an autoconf check.]
10 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13 ===================================================================
17 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
18 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
21 + AC_CHECK_DECL([PTHREAD_MUTEX_RECURSIVE_NP],
22 + [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], [], [whether HAVE_PTHREAD_MUTEX_RECURSIVE_NP is defined])],
23 + [], [#include <pthread.h>])
26 dnl Use weak symbols on linux/gcc to avoid imposing libpthreads to apps
27 Index: b/libgamin/gam_data.c
28 ===================================================================
29 --- a/libgamin/gam_data.c
30 +++ b/libgamin/gam_data.c
33 if (is_threaded > 0) {
34 pthread_mutexattr_init(&attr);
35 -#if defined(linux) || defined(PTHREAD_MUTEX_RECURSIVE_NP)
36 +#if defined(HAVE_PTHREAD_MUTEX_RECURSIVE_NP)
37 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
39 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);