aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-09 18:42:35 +0100
committerMax Kellermann <max@duempel.org>2014-12-09 21:19:09 +0100
commit7a1e026bb557c07f9b324f5fef64f0a483cbd017 (patch)
tree929214843562e6046ea39a1f09e88a57df8c326e /configure.ac
parent64f04ee6dbc9065db3a0af4fbe8b23b820c8a831 (diff)
downloadmpd-7a1e026bb557c07f9b324f5fef64f0a483cbd017.tar.gz
mpd-7a1e026bb557c07f9b324f5fef64f0a483cbd017.tar.xz
mpd-7a1e026bb557c07f9b324f5fef64f0a483cbd017.zip
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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac24
1 files changed, 12 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index b58321981..755ff382a 100644
--- a/configure.ac
+++ b/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 ---------------------------------------------------------------------------