4 AC_DEFUN([lldp_CHECK_SNMP], [
5 if test x"$with_snmp" != x"no"; then
6 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
7 if test x"$NETSNMP_CONFIG" = x"no"; then
9 if test x"$with_snmp" = x"yes"; then
10 AC_MSG_FAILURE([*** no NetSNMP support found])
14 dnl Check it is working as expected
15 NETSNMP_LIBS=`${NETSNMP_CONFIG} --agent-libs`
16 NETSNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags` -DNETSNMP_NO_INLINE"
20 CFLAGS="$CFLAGS ${NETSNMP_CFLAGS}"
21 LIBS="$LIBS ${NETSNMP_LIBS}"
22 AC_MSG_CHECKING([whether C compiler supports flag "${NETSNMP_CFLAGS} ${NETSNMP_LIBS}" from Net-SNMP])
23 AC_LINK_IFELSE([AC_LANG_PROGRAM([
32 dnl Is Net-SNMP usable?
33 AC_CHECK_LIB([netsnmp], [snmp_register_callback], [
34 dnl Do we have subagent support?
35 AC_CHECK_FUNCS([netsnmp_enable_subagent], [
36 dnl Yes, we need to check a few more things
37 AC_SUBST([NETSNMP_LIBS])
38 AC_SUBST([NETSNMP_CFLAGS])
39 AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support])
42 dnl Should we use f_create_from_tstring_new or f_create_from_tstring?
43 AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,[
44 @%:@include <net-snmp/net-snmp-config.h>
45 @%:@include <net-snmp/net-snmp-includes.h>
46 @%:@include <net-snmp/library/snmp_transport.h>
48 dnl Do we have a usable <net-snmp/agent/util_funcs.h> header?
49 AC_CHECK_HEADERS([net-snmp/agent/util_funcs.h],,,[
50 @%:@include <net-snmp/net-snmp-config.h>
51 @%:@include <net-snmp/net-snmp-includes.h>
52 @%:@include <net-snmp/library/snmp_transport.h>
53 @%:@include <net-snmp/agent/net-snmp-agent-includes.h>
54 @%:@include <net-snmp/agent/snmp_vars.h>
56 dnl Can we use snmp_select_info2?
57 AC_CHECK_FUNCS([snmp_select_info2])
59 if test x"$with_snmp" = x"yes"; then
60 AC_MSG_ERROR([*** no subagent support in net-snmp])
65 if test x"$with_snmp" = x"yes"; then
66 AC_MSG_ERROR([*** unable to use net-snmp])
72 if test x"$with_snmp" = x"yes"; then
73 AC_MSG_ERROR([*** incorrect CFLAGS from net-snmp-config])