1Fix missing PTHREAD_MUTEX_RECURSIVE_NP 2 3The musl C library does not provide the non portable 4PTHREAD_MUTEX_RECURSIVE_NP. In addition, uClibc does not define it as 5a #define, but as an enum value, so doing a #if defined() check 6doesn't work properly. Instead, add a AC_CHECK_DECL() autoconf check. 7 8Signed-off-by: Baruch Siach <baruch@tkos.co.il> 9[Thomas: switch to an autoconf check.] 10Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 11 12Index: b/configure.in 13=================================================================== 14--- a/configure.in 15+++ b/configure.in 16@@ -294,6 +294,10 @@ 17 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)]) 18 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there]) 19 WITH_THREADS="1"])) 20+ 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>]) 24 fi 25 26 dnl Use weak symbols on linux/gcc to avoid imposing libpthreads to apps 27Index: b/libgamin/gam_data.c 28=================================================================== 29--- a/libgamin/gam_data.c 30+++ b/libgamin/gam_data.c 31@@ -470,7 +470,7 @@ 32 } 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); 38 #else 39 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); 40