Subject: Re: bug#25821: grep-3.0 FAILS on Make phase

From: Bruno Haible <[email-masked]>
Date: Tue, 21 Feb 2017 17:10:43 +0100

Hi Rene,

> > glthread/lock.c:54:40: error: 'PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP'
> > undeclared (first use in this function)
> >
> > PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
> >                                         ^

Thanks for the report. Fixed in gnulib as follows:

2017-02-21  Bruno Haible  <[email-masked]>

	lock tests: Fix build failure on GNU/Hurd (regression from 2017-01-05).
	Reported by Rene Saavedra <[email-masked]> in
	https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25821 via Paul Eggert.
	* lib/glthread/lock.h: On glibc systems without
	PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, use the fallback
	implementation of rwlocks.
	* lib/glthread/lock.c: Likewise.

diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c
index 061562b..afc86f4 100644
--- a/lib/glthread/lock.c
+++ b/lib/glthread/lock.c
@@ -30,7 +30,7 @@
 
 /* ------------------------- gl_rwlock_t datatype ------------------------- */
 
-# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (__GNU_LIBRARY__ > 1))
+# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1)))
 
 #  ifdef PTHREAD_RWLOCK_INITIALIZER
 
diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h
index ec16d39..67932aa 100644
--- a/lib/glthread/lock.h
+++ b/lib/glthread/lock.h
@@ -179,7 +179,7 @@ typedef pthread_mutex_t gl_lock_t;
 
 /* ------------------------- gl_rwlock_t datatype ------------------------- */
 
-# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (__GNU_LIBRARY__ > 1))
+# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1)))
 
 #  ifdef PTHREAD_RWLOCK_INITIALIZER