From 9e137cdbc77ab58680fcf674c7968281eea12492 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 2 Dec 2006 17:51:16 +0100 Subject: [PATCH] dns plugin: Check for `libpthread' and link the plugin against it. --- configure.in | 53 ++++++++++++++++++++++++++----------------------- src/Makefile.am | 25 +++++++++++++---------- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/configure.in b/configure.in index 52a8cef4..348552ec 100644 --- a/configure.in +++ b/configure.in @@ -277,6 +277,8 @@ AC_CHECK_HEADERS(regex.h) # For the dns plugin AC_CHECK_HEADERS(arpa/nameser.h) +AC_CHECK_HEADERS(pthread.h) +AC_CHECK_HEADERS(net/if_ppp.h) dnl Checking for libraries AC_CHECK_LIB(m, ext) @@ -495,31 +497,32 @@ AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool], [Wether or not to use rrdtool library]) AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes") -#AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]), -#[ if test "x$withval" != "xno" && test "x$withval" != "xyes" -# then -# LDFLAGS="$LDFLAGS -L$withval/lib" -# CPPFLAGS="$CPPFLAGS -I$withval/include" -# with_pth="yes" -# fi -#], [with_pth="no"]) -#if test "x$with_pth" = "xyes" -#then -# AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], []) -#fi -#if test "x$with_pth" = "xyes" -#then -# AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"]) -#fi -#if test "x$with_pth" = "xyes" -#then -# collect_pth=1 -#else -# collect_pth=0 -#fi -#AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth], -# [Wether or not to use pth (portable threads) library]) -#AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes") +with_pthread="yes" +AC_ARG_WITH(pthread, [AS_HELP_STRING([--with-pthread=@<:@=PREFIX@:>@], [Path to pthread (experimental).])], +[ if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_pthread="yes" + fi +], [with_pthread="no"]) +if test "x$with_pthread" = "xyes" +then + AC_CHECK_LIB(pthread, pthread_create, [with_pthread="yes"], [with_pthread="no (libpthread not found)"], []) +fi +if test "x$with_pthread" = "xyes" +then + AC_CHECK_HEADERS(pthread.h,, [with_pthread="no (pthread.h not found)"]) +fi +if test "x$with_pthread" = "xyes" +then + collect_pthread=1 +else + collect_pthread=0 +fi +AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread], + [Wether or not to use pthread (POSIX threads) library]) +AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_pthread" = "xyes") if test "$ac_system" = "Solaris" then diff --git a/src/Makefile.am b/src/Makefile.am index 5cd0e282..12693691 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -156,6 +156,20 @@ collectd_LDADD += "-dlopen" disk.la collectd_DEPENDENCIES += disk.la endif +if BUILD_MODULE_DNS +pkglib_LTLIBRARIES += dns.la +dns_la_SOURCES = dns.c utils_dns.c +dns_la_LDFLAGS = -module -avoid-version +if BUILD_WITH_LIBPCAP +dns_la_LDFLAGS += -lpcap +endif +if BUILD_WITH_LIBPTHREAD +dns_la_LDFLAGS += -lpthread +endif +collectd_LDADD += "-dlopen" dns.la +collectd_DEPENDENCIES += dns.la +endif + #if BUILD_MODULE_QUOTA #pkglib_LTLIBRARIES += quota.la #quota_la_SOURCES = quota_plugin.c quota_plugin.h @@ -237,17 +251,6 @@ collectd_LDADD += "-dlopen" mysql.la collectd_DEPENDENCIES += mysql.la endif -if BUILD_MODULE_DNS -pkglib_LTLIBRARIES += dns.la -dns_la_SOURCES = dns.c utils_dns.c -dns_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBPCAP -dns_la_LDFLAGS += -lpcap -endif -collectd_LDADD += "-dlopen" dns.la -collectd_DEPENDENCIES += dns.la -endif - if BUILD_MODULE_NFS pkglib_LTLIBRARIES += nfs.la nfs_la_SOURCES = nfs.c -- 2.30.2