Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 0230e2e374bb71aed0181ccd9ebd13c0c5125a5d Mon Sep 17 00:00:00 2001 |
| 2 | From: Trevor Woerner <twoerner@gmail.com> |
| 3 | Date: Fri, 25 Oct 2019 17:01:20 -0400 |
| 4 | Subject: [PATCH] configure.ac: add library if header found |
| 5 | |
| 6 | If the pthread.h header is found, make sure library containing |
| 7 | "pthread_atfork" is added to the list of libraries against which to link. |
| 8 | On some hosts (e.g. openSUSE 15.1) "-lpthread" needs to be explicitly added |
| 9 | in order for the code to compile correctly. |
| 10 | |
| 11 | Upstream-Status: Submitted [https://github.com/stevegrubb/libcap-ng/pull/10] |
| 12 | Signed-off-by: Trevor Woerner <twoerner@gmail.com> |
| 13 | --- |
| 14 | configure.ac | 4 +++- |
| 15 | 1 file changed, 3 insertions(+), 1 deletion(-) |
| 16 | |
| 17 | diff --git a/configure.ac b/configure.ac |
| 18 | index 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 |