From b66f2646c3fff9859f6f1ccffdd730d24e161992 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Mon, 24 Dec 2007 03:39:50 +0000 Subject: [PATCH] Added a configure test to check if pthread_rwlock_t is available. Define _GNU_SOURCE if needed. The fallback behaviou will only be implemented if _GNU_SOURCE prooves to be insufficient on some platforms. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@274 119443c7-1b9e-41f8-b6fc-b9c35fce742c --- ChangeLog | 6 ++++++ configure.ac | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index 56f1d6a..47e46e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ Version 1.6.3 ******************************************************************************* +2007-12-24 Marcelo Jimenez + * Added a configure test to check if pthread_rwlock_t is available. + Define _GNU_SOURCE if needed. The fallback behaviou will only be + implemented if _GNU_SOURCE prooves to be insufficient on some + platforms. + 2007-12-17 Marcelo Jimenez * Removed unused iasnprintf.{c,h} files. diff --git a/configure.ac b/configure.ac index 0a13fa3..1a67b54 100644 --- a/configure.ac +++ b/configure.ac @@ -328,9 +328,31 @@ AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)]) # # Checks for POSIX Threads # +echo "--------------------------- pthread stuff -------------------------------------" ACX_PTHREAD( [], [AC_MSG_ERROR([POSIX threads are required to build this program])]) +dnl # Determine if RW-mutex is available +echo "----------------------- pthread_rwlock_t stuff --------------------------------" +AC_MSG_CHECKING([if pthread_rwlock_t is available]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include ], + [pthread_rwlock_t *x;])], + [AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t]) + AC_MSG_RESULT([yes, supported without any options])], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#define _GNU_SOURCE], + [#include ], + [pthread_rwlock_t *x;])], + [AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t]) + AC_DEFINE([_GNU_SOURCE], [], [_GNU_SOURCE needed for pthread_rwlock_t in this platform]) + AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])], + [AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t]) + AC_MSG_RESULT([no, needs to fallback to pthread_mutex]) + AC_MSG_ERROR([pthread_rwlock_t not available])])]) +echo "-------------------------------------------------------------------------------" AC_CONFIG_FILES([