diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2013-11-26 17:23:52 +0100 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-12-02 15:23:27 +0100 |
commit | 157941cbd75492b0c74ff21f95de3093cf6d4aca (patch) | |
tree | 4509b910a15630ae01a1202732c51efb5ea2c0dc | |
parent | ec02489eca1b7b57c35db71bce5a6f7b876e535e (diff) |
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.ac | 21 |
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]) |