From dee5e45a1bcb3b8a95f1b9f448b29dda7b6072b7 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 3 Jun 2016 18:30:00 +0200 Subject: [PATCH] Always build with pthread support Until now you could run ./configure --with-libpthread=no. This didn't actually compile though. The daemon has assumed for a while now that pthread support is available. Bail out in ./configure if this is not the case. --- configure.ac | 43 +++++++++++++----------------------------- src/Makefile.am | 4 +--- src/daemon/Makefile.am | 5 +---- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/configure.ac b/configure.ac index e4d61335..5e2eaa03 100644 --- a/configure.ac +++ b/configure.ac @@ -1603,37 +1603,21 @@ if test "x$with_libhal" = "xyes"; then fi fi -# --with-libpthread {{{ -AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])], -[ if test "x$withval" != "xno" \ - && test "x$withval" != "xyes" - then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include" - with_libpthread="yes" - else - if test "x$withval" = "xno" - then - with_libpthread="no (disabled)" - fi - fi -], [with_libpthread="yes"]) - AC_SUBST([PTHREAD_LIBS]) -if test "x$with_libpthread" = "xyes" -then - SAVE_LIBS="$LIBS" - AC_CHECK_LIB(pthread, pthread_create, [], [with_libpthread="no (Symbol 'pthread_create' not found)"], []) - PTHREAD_LIBS="$LIBS" - LIBS="$SAVE_LIBS" -fi +SAVE_LIBS="$LIBS" +AC_CHECK_LIB([pthread], + [pthread_create], + [], + [AC_MSG_ERROR([Symbol 'pthread_create' not found in libpthread"])], + [] +) +PTHREAD_LIBS="$LIBS" +LIBS="$SAVE_LIBS" -if test "x$with_libpthread" = "xyes" -then - AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"]) -fi -AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes") -# }}} +AC_CHECK_HEADERS([pthread.h], + [], + [AC_MSG_ERROR([pthread.h not found])] +) m4_divert_once([HELP_WITH], [ collectd additional packages:]) @@ -6203,7 +6187,6 @@ Configuration: libperfstat . . . . . $with_perfstat libperl . . . . . . . $with_libperl libpq . . . . . . . . $with_libpq - libpthread . . . . . $with_libpthread librabbitmq . . . . . $with_librabbitmq libriemann-client . . $with_libriemann_client librdkafka . . . . . $with_librdkafka diff --git a/src/Makefile.am b/src/Makefile.am index ec562d86..19a1fb1f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -80,6 +80,7 @@ collectd_tg_SOURCES = collectd-tg.c collectd_tg_CPPFLAGS = $(AM_CPPFLAGS) \ -I$(top_srcdir)/src/libcollectdclient/collectd -I$(top_builddir)/src/libcollectdclient/collectd collectd_tg_LDADD = \ + $(PTHREAD_LIBS) \ daemon/libheap.la \ libcollectdclient/libcollectdclient.la if BUILD_WITH_LIBSOCKET @@ -91,9 +92,6 @@ endif if BUILD_AIX collectd_tg_LDADD += -lm endif -if BUILD_WITH_LIBPTHREAD -collectd_tg_LDADD += $(PTHREAD_LIBS) -endif pkglib_LTLIBRARIES = diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 18aef36c..d59e8234 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -10,7 +10,7 @@ AM_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"' AM_CPPFLAGS += -DPKGDATADIR='"${pkgdatadir}"' # Link to these libraries.. -COMMON_LIBS = +COMMON_LIBS = $(PTHREAD_LIBS) if BUILD_WITH_LIBRT COMMON_LIBS += -lrt endif @@ -23,9 +23,6 @@ endif if BUILD_WITH_LIBRESOLV COMMON_LIBS += -lresolv endif -if BUILD_WITH_LIBPTHREAD -COMMON_LIBS += $(PTHREAD_LIBS) -endif if BUILD_WITH_LIBKSTAT COMMON_LIBS += -lkstat endif -- 2.30.2