summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2013-11-26 17:23:52 +0100
committerStef Walter <stef@thewalter.net>2013-12-02 15:23:27 +0100
commit157941cbd75492b0c74ff21f95de3093cf6d4aca (patch)
tree4509b910a15630ae01a1202732c51efb5ea2c0dc
parentec02489eca1b7b57c35db71bce5a6f7b876e535e (diff)
downloadp11-kit-157941cbd75492b0c74ff21f95de3093cf6d4aca.tar.gz
Check if pthread and nanosleep() are in libc before linking other libs
In recent versions of glibc this is true and prevents linking with pthreads when it is not necessary. Tweaked by Stef Walter Signed-off-by: Stef Walter <stef@thewalter.net>
-rw-r--r--configure.ac21
1 files changed, 15 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 91bb856..b9b538a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,12 +68,21 @@ AC_C_BIGENDIAN
AC_HEADER_STDBOOL
if test "$os_unix" = "yes"; then
- AC_CHECK_LIB(pthread, pthread_mutex_lock,,
- [AC_MSG_ERROR([could not find pthread_mutex_lock])])
- AC_SEARCH_LIBS([dlopen], [dl dld], [],
- [AC_MSG_ERROR([could not find dlopen])])
- AC_SEARCH_LIBS([nanosleep], [rt], [],
- [AC_MSG_ERROR([could not find nanosleep])])
+ AC_CHECK_FUNC([pthread_mutexattr_init], , [
+ AC_CHECK_LIB(pthread, pthread_mutexattr_init, , [
+ AC_MSG_ERROR([could not find pthread_mutexattr_init])
+ ])
+ ])
+
+ AC_CHECK_FUNC([nanosleep], , [
+ AC_SEARCH_LIBS([nanosleep], [rt], , [
+ AC_MSG_ERROR([could not find nanosleep])
+ ])
+ ])
+
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [
+ AC_MSG_ERROR([could not find dlopen])
+ ])
# These are thngs we can work around
AC_CHECK_FUNCS([getprogname getexecname basename mkstemp mkdtemp])