]>
Commit | Line | Data |
---|---|---|
d38eae28 VB |
1 | # |
2 | # lldp_CHECK_SNMP | |
3 | # | |
d38eae28 VB |
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` | |
915dc28b | 10 | NETSNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags` -DNETSNMP_NO_INLINE" |
d38eae28 VB |
11 | |
12 | _save_flags="$CFLAGS" | |
ab2d1c1f | 13 | _save_ldflags="$LDFLAGS" |
d38eae28 | 14 | CFLAGS="$CFLAGS ${NETSNMP_CFLAGS}" |
ab2d1c1f VB |
15 | LDFLAGS="$LDFLAGS ${NETSNMP_LIBS}" |
16 | AC_MSG_CHECKING([whether C compiler supports flag "${NETSNMP_CFLAGS} ${NETSNMP_LIBS}" from Net-SNMP]) | |
d38eae28 VB |
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])]) | |
ab2d1c1f | 27 | # Is Net-SNMP usable? |
d4eaf172 | 28 | AC_CHECK_LIB([netsnmp], [snmp_register_callback], [:], |
d38eae28 | 29 | [AC_MSG_ERROR([*** unable to use net-snmp])], ${NETSNMP_LIBS}) |
ab2d1c1f VB |
30 | # Do we have subagent support? |
31 | AC_CHECK_FUNCS([netsnmp_enable_subagent], [:], | |
32 | [AC_MSG_ERROR([*** no subagent support in net-snmp])]) | |
33 | ||
d38eae28 VB |
34 | AC_SUBST([NETSNMP_LIBS]) |
35 | AC_SUBST([NETSNMP_CFLAGS]) | |
36 | AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support]) | |
ab2d1c1f VB |
37 | |
38 | # Should we use f_create_from_tstring_new or f_create_from_tstring? | |
d38eae28 VB |
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 | ]) | |
ab2d1c1f VB |
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 | ]) | |
d38eae28 VB |
53 | |
54 | CFLAGS="$_save_flags" | |
ab2d1c1f | 55 | LDFLAGS="$_save_ldflags" |
d38eae28 | 56 | ]) |