From bf8dfa9f33c1aa8d76f8d1ae6cf79afb90497cd4 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Mon, 5 May 2014 09:32:23 +0300 Subject: Fix build against older pthreads implementations Older pthreads implementations like glibc NPTL prior to version 2.12, and uClibc linuxthreads (both), need _XOPEN_SOURCE to expose pthread_mutexattr_settype() and THREAD_MUTEX_DEFAULT. The value 600 (SuSv3, POSIX.1-2001) is equivalent to _POSIX_C_SOURCE 200112L. Fixes the following build error: CC compat.lo compat.c: In function 'p11_mutex_init': compat.c:164:2: warning: implicit declaration of function 'pthread_mutexattr_settype' [-Wimplicit-function-declaration] compat.c:164:2: warning: nested extern declaration of 'pthread_mutexattr_settype' [-Wnested-externs] compat.c:164:36: error: 'PTHREAD_MUTEX_DEFAULT' undeclared (first use in this function) https://bugs.freedesktop.org/show_bug.cgi?id=82617 --- common/compat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/compat.c b/common/compat.c index 9314d20..1c8ab87 100644 --- a/common/compat.c +++ b/common/compat.c @@ -34,6 +34,12 @@ #include "config.h" +/* + * This is needed to expose pthread_mutexattr_settype and PTHREAD_MUTEX_DEFAULT + * on older pthreads implementations + */ +#define _XOPEN_SOURCE 600 + #include "compat.h" #include -- cgit v1.1