From 157941cbd75492b0c74ff21f95de3093cf6d4aca Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Tue, 26 Nov 2013 17:23:52 +0100 Subject: 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 --- configure.ac | 21 +++++++++++++++------ 1 file 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]) -- cgit v1.1