]> granicus.if.org Git - p11-kit/commitdiff
Check if pthread and nanosleep() are in libc before linking other libs
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 26 Nov 2013 16:23:52 +0000 (17:23 +0100)
committerStef Walter <stef@thewalter.net>
Mon, 2 Dec 2013 14:23:27 +0000 (15:23 +0100)
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>
configure.ac

index 91bb856065a2937c721ac93195be1098414a9168..b9b538aa0d554b49ba50b2ef5d70a9cc0c60da80 100644 (file)
@@ -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])