1 dnl look for the (ucd|net)snmp libraries
2 dnl $Id: ucdsnmp.m4,v 1.11 2005/04/26 19:14:08 shadow Exp $
4 AC_DEFUN([CMU_UCDSNMP], [
5 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
6 AC_REQUIRE([CMU_SOCKETS])
8 [ --with-snmp=DIR use ucd|net snmp (rooted in DIR) [yes] ],
9 with_snmp=$withval, with_snmp=yes)
12 dnl Maintain backwards compatibility with old --with-ucdsnmp option
14 AC_ARG_WITH(ucdsnmp,, with_snmp=$withval,)
16 if test "$with_snmp" != "no"; then
19 dnl Try net-snmp first
21 if test "$with_snmp" = "yes"; then
22 AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
24 SNMP_CONFIG="$with_snmp/bin/net-snmp-config"
27 if test -x "$SNMP_CONFIG"; then
28 AC_MSG_CHECKING(NET SNMP libraries)
30 SNMP_LIBS=`$SNMP_CONFIG --agent-libs`
31 SNMP_PREFIX=`$SNMP_CONFIG --prefix`
33 if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
34 CPPFLAGS="$CPPFLAGS -I${SNMP_PREFIX}/include"
35 LIB_UCDSNMP=$SNMP_LIBS
36 AC_DEFINE(HAVE_NETSNMP,1,[Do we have Net-SNMP support?])
41 AC_MSG_WARN([Could not find the required paths. Please check your net-snmp installation.])
45 dnl Try ucd-snmp if net-snmp test failed
47 if test "$with_snmp" != no; then
48 if test -d "$with_snmp"; then
49 CPPFLAGS="$CPPFLAGS -I${with_snmp}/include"
50 LDFLAGS="$LDFLAGS -L${with_snmp}/$CMU_LIB_SUBDIR"
53 AC_CHECK_LIB(snmp, sprint_objid, [
54 AC_CHECK_HEADER(ucd-snmp/version.h,, with_snmp=no)],
55 with_snmp=no, ${LIB_SOCKET})
58 AC_MSG_CHECKING(UCD SNMP libraries)
59 AC_MSG_RESULT($with_snmp)
61 if test "$with_snmp" != no; then
62 AC_DEFINE(HAVE_UCDSNMP,1,[Do we have UCD-SNMP support?])
63 LIB_UCDSNMP="-lucdagent -lucdmibs -lsnmp"
64 AC_CHECK_LIB(rpm, rpmdbOpen,
65 LIB_UCDSNMP="${LIB_UCDSNMP} -lrpm -lpopt",,-lpopt)