Skip to content

Commit bf036ca

Browse files
committed
Fix SNMP checks
This is a follow-up of phpGH-15242 (0b25e26) because the usmHMAC192SHA256AuthProtocol and usmHMAC384SHA512AuthProtocol are not functions but arrays. The AC_CHECK_DECL might be more appropriate and portable way to find these. [skip ci]
1 parent 5fc68d8 commit bf036ca

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

ext/snmp/config.m4

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,29 @@ if test "$PHP_SNMP" != "no"; then
5050
[],
5151
[$SNMP_SHARED_LIBADD])
5252

53-
dnl Check whether usmHMAC192SHA256AuthProtocol exists.
54-
PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [usmHMAC192SHA256AuthProtocol],
53+
CFLAGS_SAVE=$CFLAGS
54+
LIBS_SAVE=$LIBS
55+
CFLAGS="$CFLAGS $SNMP_CFLAGS"
56+
LIBS="$LIBS $SNMP_LIBS"
57+
58+
AC_CHECK_DECL([usmHMAC192SHA256AuthProtocol],
5559
[AC_DEFINE([HAVE_SNMP_SHA256], [1],
5660
[Define to 1 if SNMP library has the 'usmHMAC192SHA256AuthProtocol'
57-
array.])],
58-
[],
59-
[$SNMP_SHARED_LIBADD])
61+
array.])],, [
62+
#include <net-snmp/net-snmp-config.h>
63+
#include <net-snmp/net-snmp-includes.h>
64+
])
6065

61-
dnl Check whether usmHMAC384SHA512AuthProtocol exists.
62-
PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [usmHMAC384SHA512AuthProtocol],
66+
AC_CHECK_DECL([usmHMAC384SHA512AuthProtocol],
6367
[AC_DEFINE([HAVE_SNMP_SHA512], [1],
6468
[Define to 1 if SNMP library has the 'usmHMAC384SHA512AuthProtocol'
65-
array.])],
66-
[],
67-
[$SNMP_SHARED_LIBADD])
69+
array.])],, [
70+
#include <net-snmp/net-snmp-config.h>
71+
#include <net-snmp/net-snmp-includes.h>
72+
])
73+
74+
CFLAGS=$CFLAGS_SAVE
75+
LIBS=$LIBS_SAVE
6876

6977
PHP_NEW_EXTENSION([snmp], [snmp.c], [$ext_shared])
7078
PHP_SUBST([SNMP_SHARED_LIBADD])

0 commit comments

Comments
 (0)