From c02ba63082d9ab7ca07775184587d320410069d5 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 13 Jun 2007 23:13:07 +0200 Subject: [PATCH] configure.in, src/Makefile.am: Only link against Net-SNMP if it is found. --- configure.in | 27 +++++++++++++++++++++++++++ src/Makefile.am | 5 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index d0124201..0b8299dd 100644 --- a/configure.in +++ b/configure.in @@ -1219,6 +1219,32 @@ else fi AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") +AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_libnetsnmp="yes" + fi +], +[with_libnetsnmp="yes"]) +if test "x$with_libnetsnmp" = "xyes" +then + AC_CHECK_LIB(netsnmp, init_snmp, + [ + AC_DEFINE(HAVE_LIBSNMP, 1, [Define to 1 if you have the Net-SNMP library (-lnetsnmp).]) + ], [with_libnetsnmp="no (libnetsnmp not found)"]) +fi +if test "x$with_libnetsnmp" = "xyes" +then + AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, + [ + AC_DEFINE(HAVE_NET_SNMP_NET_SNMP_CONFIG_H, 1, [Define to 1 if you have the header file.]) + ], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes") + AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" @@ -1377,6 +1403,7 @@ Configuration: libiptc . . . . . . $with_libiptc libkstat . . . . . $with_kstat libmysql . . . . . $with_libmysql + libnetsnmp . . . . $with_libnetsnmp liboconfig . . . . $with_liboconfig liboping . . . . . $with_liboping libpcap . . . . . . $with_libpcap diff --git a/src/Makefile.am b/src/Makefile.am index f7168a99..6642aa0f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -475,7 +475,10 @@ endif if BUILD_MODULE_SNMP pkglib_LTLIBRARIES += snmp.la snmp_la_SOURCES = snmp.c -snmp_la_LDFLAGS = -module -avoid-version -lsnmp +snmp_la_LDFLAGS = -module -avoid-version +if BUILD_WITH_LIBNETSNMP +snmp_la_LDFLAGS += -lnetsnmp +endif collectd_LDADD += "-dlopen" snmp.la collectd_DEPENDENCIES += snmp.la endif -- 2.11.0