summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-08-10 16:45:07 +0200
committerDaiki Ueno <ueno@gnu.org>2018-08-10 18:25:28 +0200
commit541d79cb651cfd3238b9aa41fce70208df8e9496 (patch)
treed4b38e7c2ea397bfb6c3717cbab81398b052f393 /configure.ac
parent6a8da20c0432499480731548256294844cade631 (diff)
build: Link to libpthread, if pthread_atfork() needs to be used
On non-glibc systems (e.g., FreeBSD), pthread_atfork() stub is provided as a nop and our fork detection mechanism doesn't work. Pull in the actual implementation from libpthread in that case. Signed-off-by: Daiki Ueno <dueno@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac7
1 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 93a6c83..dde0ea2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,7 +123,12 @@ if test "$os_unix" = "yes"; then
AC_CHECK_FUNCS([setenv])
AC_CHECK_FUNCS([getpeereid])
AC_CHECK_FUNCS([getpeerucred])
- AC_CHECK_FUNCS([__register_atfork])
+ # If __register_atfork() is not available, we have to link to
+ # libpthread so that the non-stub version of pthread_atfork() work
+ # FIXME: replace pthread_atfork() uses with manual PID checks
+ AC_CHECK_FUNCS([__register_atfork], , [
+ AC_CHECK_LIB([pthread], [pthread_atfork])
+ ])
AC_CHECK_DECLS([__register_atfork])
# Check if issetugid() is available and has compatible behavior with OpenBSD