configure.ac: check for pthread before librt
Works around a linker problem with some older glibc versions: if "-lrt" was used, then "-pthread" was implied, but only the symbols used by librt were available. This led to a linker error because pthread_atfork() was not found. So with "-lrt", autoconf decides that no pthread flag is necessary, but in the end fails due to pthread_atfork() missing. By checking for pthread before librt, we avoid this dependency problem.
This commit is contained in:
parent
64f04ee6db
commit
7a1e026bb5
24
configure.ac
24
configure.ac
@ -193,6 +193,18 @@ dnl ---------------------------------------------------------------------------
|
||||
dnl Header/Library Checks
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
AX_PTHREAD
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
|
||||
AM_CXXFLAGS="$AM_CXXFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
AC_CHECK_LIB([pthread], [pthread_setname_np],
|
||||
[have_pthread_setname_np=yes],
|
||||
[have_pthread_setname_np=no])
|
||||
if test x$have_pthread_setname_np = xyes; then
|
||||
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is pthread_setname_np() available?])
|
||||
fi
|
||||
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||
|
||||
AC_ARG_ENABLE(syslog,
|
||||
@ -229,18 +241,6 @@ AC_CHECK_HEADERS(valgrind/memcheck.h)
|
||||
|
||||
AC_CHECK_HEADERS([sys/prctl.h], AC_CHECK_FUNCS([prctl]))
|
||||
|
||||
AX_PTHREAD
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
|
||||
AM_CXXFLAGS="$AM_CXXFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
AC_CHECK_LIB([pthread], [pthread_setname_np],
|
||||
[have_pthread_setname_np=yes],
|
||||
[have_pthread_setname_np=no])
|
||||
if test x$have_pthread_setname_np = xyes; then
|
||||
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is pthread_setname_np() available?])
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Event loop selection
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user