build: Define _NPTH_NO_RWLOCK when we can't find pthread_rwlock_t. master
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 23 Jan 2019 02:24:00 +0000 (11:24 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 23 Jan 2019 02:24:00 +0000 (11:24 +0900)
* configure.ac (INSERT_NO_RWLOCK): New.
* src/npth.h.in (@INSERT_NO_RWLOCK@): Use.

--

This change allows nPth to be compiled on old system with no
pthread_rwlock_t support.

GnuPG-bug-id: 4306
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
configure.ac
src/npth.h.in

index 32bf5ea..23718d6 100644 (file)
@@ -268,6 +268,7 @@ if test "$have_w32_system" = no; then
   esac
   if test "$have_pthread" != no; then
     AC_DEFINE(HAVE_PTHREAD,1,[Define if we have pthread.])
+    AC_CHECK_TYPE([pthread_rwlock_t])
     AC_CHECK_FUNCS([pthread_tryjoin_np pthread_setname_np pthread_getname_np])
     AC_CHECK_FUNCS([pthread_mutex_timedlock])
     AC_CHECK_FUNCS([pthread_rwlock_rdlock pthread_rwlock_wrlock])
@@ -277,6 +278,12 @@ if test "$have_w32_system" = no; then
   fi
 fi
 
+INSERT_NO_RWLOCK="undef _NPTH_NO_RWLOCK"
+if test x"$ac_cv_type_pthread_rwlock_t" = xno; then
+  INSERT_NO_RWLOCK="define _NPTH_NO_RWLOCK 1"
+fi
+AC_SUBST(INSERT_NO_RWLOCK)
+
 AC_CHECK_FUNCS([select pselect gettimeofday])
 
 npth_LIBSOCKET
index 39dcf32..1901ded 100644 (file)
@@ -51,6 +51,7 @@
 
 #include <pthread.h>
 
+#@INSERT_NO_RWLOCK@
 #ifdef __ANDROID__
 #include <android/api-level.h>
 #if __ANDROID_API__ < 9