diff --git a/config.h.in b/config.h.in index 53fb54d67e..c5318aa00a 100644 --- a/config.h.in +++ b/config.h.in @@ -556,6 +556,9 @@ /* define if PKCS11 is used for Public-Key Cryptography */ #undef USE_PKCS11 +/* Define if you want to use pthread rwlock implementation */ +#undef USE_PTHREAD_RWLOCK + /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE diff --git a/configure b/configure index 9805770823..b2e4836f78 100755 --- a/configure +++ b/configure @@ -15602,14 +15602,14 @@ esac # # Check whether --enable-pthread_rwlock was given. if test "${enable_pthread_rwlock+set}" = set; then : - enableval=$enable_pthread_rwlock; use_pthread_rwlock=$enableval + enableval=$enable_pthread_rwlock; else - use_pthread_rwlock=no + enable_pthread_rwlock=no fi -if test "x$use_pthread_rwlock" != "xno"; then - for ac_func in pthread_rwlock_rdlock +if test "$enable_pthread_rwlock" = "yes"; then : + for ac_func in pthread_rwlock_rdlock do : ac_fn_c_check_func "$LINENO" "pthread_rwlock_rdlock" "ac_cv_func_pthread_rwlock_rdlock" if test "x$ac_cv_func_pthread_rwlock_rdlock" = xyes; then : @@ -15617,9 +15617,15 @@ if test "x$ac_cv_func_pthread_rwlock_rdlock" = xyes; then : #define HAVE_PTHREAD_RWLOCK_RDLOCK 1 _ACEOF +else + as_fn_error $? "pthread_rwlock_rdlock requested but not found" "$LINENO" 5 fi done + +$as_echo "#define USE_PTHREAD_RWLOCK 1" >>confdefs.h + + fi # diff --git a/configure.ac b/configure.ac index eee8bd0a6e..71862813ec 100644 --- a/configure.ac +++ b/configure.ac @@ -727,14 +727,16 @@ AC_SUBST(INSTALL_LIBRARY) # Do we want to use pthread rwlock? (useful for ThreadSanitizer) # -AC_ARG_ENABLE(pthread_rwlock, - AS_HELP_STRING([--enable-pthread-rwlock], - [use pthread rwlock instead of internal rwlock implementation]), - use_pthread_rwlock=$enableval, use_pthread_rwlock=no) +AC_ARG_ENABLE([pthread_rwlock], + [AS_HELP_STRING([--enable-pthread-rwlock], + [use pthread rwlock instead of internal rwlock implementation])], + [], [enable_pthread_rwlock=no]) -if test "x$use_pthread_rwlock" != "xno"; then - AC_CHECK_FUNCS([pthread_rwlock_rdlock]) -fi +AS_IF([test "$enable_pthread_rwlock" = "yes"], + [AC_CHECK_FUNCS([pthread_rwlock_rdlock], [], + [AC_MSG_ERROR([pthread_rwlock_rdlock requested but not found])]) + AC_DEFINE([USE_PTHREAD_RWLOCK],[1],[Define if you want to use pthread rwlock implementation]) + ]) # # If PIC is disabled, shared libraries must also be