blob: 6b155ccea85a48f5459553079990421edd23e535 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 0230e2e374bb71aed0181ccd9ebd13c0c5125a5d Mon Sep 17 00:00:00 2001
2From: Trevor Woerner <twoerner@gmail.com>
3Date: Fri, 25 Oct 2019 17:01:20 -0400
4Subject: [PATCH] configure.ac: add library if header found
5
6If the pthread.h header is found, make sure library containing
7"pthread_atfork" is added to the list of libraries against which to link.
8On some hosts (e.g. openSUSE 15.1) "-lpthread" needs to be explicitly added
9in order for the code to compile correctly.
10
11Upstream-Status: Submitted [https://github.com/stevegrubb/libcap-ng/pull/10]
12Signed-off-by: Trevor Woerner <twoerner@gmail.com>
13---
14 configure.ac | 4 +++-
15 1 file changed, 3 insertions(+), 1 deletion(-)
16
17diff --git a/configure.ac b/configure.ac
18index 63088f4..639b464 100644
19--- a/configure.ac
20+++ b/configure.ac
21@@ -56,7 +56,9 @@ AC_CHECK_HEADERS(sys/xattr.h, [], [
22 AC_CHECK_HEADERS(attr/xattr.h, [], [AC_MSG_WARN(attr/xattr.h not found, disabling file system capabilities.)])
23 ])
24 AC_CHECK_HEADERS(linux/securebits.h, [], [])
25-AC_CHECK_HEADERS(pthread.h, [], [AC_MSG_WARN(pthread.h not found, disabling pthread_atfork.)])
26+AC_CHECK_HEADERS(pthread.h,
27+ [AC_SEARCH_LIBS(pthread_atfork, pthread)],
28+ [AC_MSG_WARN(pthread.h not found, disabling pthread_atfork.)])
29
30 AC_C_CONST
31 AC_C_INLINE