Add autoconf option to optionally enable simple pthread_rwlock

This commit is contained in:
Witold Kręcicki
2019-05-14 00:57:58 +07:00
committed by Ondřej Surý
parent 8976d7e9e4
commit 00441917e0
3 changed files with 42 additions and 7 deletions
+3 -3
View File
@@ -309,6 +309,9 @@
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the `pthread_rwlock_rdlock' function. */
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
/* Define to 1 if you have the `pthread_setaffinity_np' function. */
#undef HAVE_PTHREAD_SETAFFINITY_NP
@@ -363,9 +366,6 @@
/* Define to 1 if you have the `setresuid' function. */
#undef HAVE_SETRESUID
/* Define to 1 if you have the `sigwait' function. */
#undef HAVE_SIGWAIT
/* define if struct stat has st_mtim.tv_nsec field */
#undef HAVE_STAT_NSEC
Vendored
+28 -4
View File
@@ -896,6 +896,7 @@ enable_devpoll
with_geoip
with_locktype
with_libtool
enable_pthread_rwlock
with_openssl
enable_fips_mode
with_cc_alg
@@ -1592,6 +1593,8 @@ Optional Features:
--enable-kqueue use BSD kqueue when available [default=yes]
--enable-epoll use Linux epoll when available [default=auto]
--enable-devpoll use /dev/poll when available [default=yes]
--enable-pthread-rwlock use pthread rwlock instead of internal rwlock
implementation
--enable-fips-mode enable FIPS mode in OpenSSL library [default=no]
--enable-native-pkcs11 use native PKCS11 for public-key crypto [default=no]
--enable-backtrace log stack backtrace on abort [default=yes]
@@ -15308,10 +15311,7 @@ LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
#
# We'd like to use sigwait() too
#
for ac_func in sigwait pthread_attr_getstacksize pthread_attr_setstacksize
for ac_func in pthread_attr_getstacksize pthread_attr_setstacksize
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15598,6 +15598,30 @@ $as_echo "no" >&6; }
esac
# Do we want to use pthread rwlock? (useful for ThreadSanitizer)
#
# Check whether --enable-pthread_rwlock was given.
if test "${enable_pthread_rwlock+set}" = set; then :
enableval=$enable_pthread_rwlock; use_pthread_rwlock=$enableval
else
use_pthread_rwlock=no
fi
if test "x$use_pthread_rwlock" != "xno"; 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 :
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_RWLOCK_RDLOCK 1
_ACEOF
fi
done
fi
#
# If PIC is disabled, shared libraries must also be
#
+11
View File
@@ -725,6 +725,17 @@ case $use_libtool in
esac
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)
if test "x$use_pthread_rwlock" != "xno"; then
AC_CHECK_FUNCS([pthread_rwlock_rdlock])
fi
#
# If PIC is disabled, shared libraries must also be
#