]> git.ipfire.org Git - thirdparty/lldpd.git/blob - m4/snmp.m4
os: add support for DragonFly BSD
[thirdparty/lldpd.git] / m4 / snmp.m4
1 #
2 # lldp_CHECK_SNMP
3 #
4 AC_DEFUN([lldp_CHECK_SNMP], [
5 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
6 if test x"$NETSNMP_CONFIG" = x"no"; then
7 AC_MSG_ERROR([*** unable to find net-snmp-config])
8 fi
9 NETSNMP_LIBS=`${NETSNMP_CONFIG} --agent-libs`
10 NETSNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags` -DNETSNMP_NO_INLINE"
11
12 _save_flags="$CFLAGS"
13 _save_libs="$LIBS"
14 CFLAGS="$CFLAGS ${NETSNMP_CFLAGS}"
15 LIBS="$LIBS ${NETSNMP_LIBS}"
16 AC_MSG_CHECKING([whether C compiler supports flag "${NETSNMP_CFLAGS} ${NETSNMP_LIBS}" from Net-SNMP])
17 AC_LINK_IFELSE([AC_LANG_PROGRAM([
18 int main(void);
19 ],
20 [
21 {
22 return 0;
23 }
24 ])],[AC_MSG_RESULT(yes)],[
25 AC_MSG_RESULT(no)
26 AC_MSG_ERROR([*** incorrect CFLAGS from net-snmp-config])])
27 # Is Net-SNMP usable?
28 AC_CHECK_LIB([netsnmp], [snmp_register_callback], [:],
29 [AC_MSG_ERROR([*** unable to use net-snmp])], ${NETSNMP_LIBS})
30 # Do we have subagent support?
31 AC_CHECK_FUNCS([netsnmp_enable_subagent], [:],
32 [AC_MSG_ERROR([*** no subagent support in net-snmp])])
33
34 AC_SUBST([NETSNMP_LIBS])
35 AC_SUBST([NETSNMP_CFLAGS])
36 AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support])
37
38 # Should we use f_create_from_tstring_new or f_create_from_tstring?
39 AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,
40 [
41 @%:@include <net-snmp/net-snmp-config.h>
42 @%:@include <net-snmp/net-snmp-includes.h>
43 @%:@include <net-snmp/library/snmp_transport.h>
44 ])
45 # Do we have a usable <net-snmp/agent/util_funcs.h> header?
46 AC_CHECK_HEADERS([net-snmp/agent/util_funcs.h],,,[
47 @%:@include <net-snmp/net-snmp-config.h>
48 @%:@include <net-snmp/net-snmp-includes.h>
49 @%:@include <net-snmp/library/snmp_transport.h>
50 @%:@include <net-snmp/agent/net-snmp-agent-includes.h>
51 @%:@include <net-snmp/agent/snmp_vars.h>
52 ])
53
54 CFLAGS="$_save_flags"
55 LIBS="$_save_libs"
56 ])