Skip to content

Commit a176f0a

Browse files
committed
Autotools: Fix SNMP checks
This is a follow-up of GH-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.
1 parent 00001c4 commit a176f0a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

ext/snmp/config.m4

+18-6
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,33 @@ if test "$PHP_SNMP" != "no"; then
5858
[],
5959
[$SNMP_SHARED_LIBADD])
6060

61-
dnl Check whether usmHMAC192SHA256AuthProtocol exists.
62-
PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [usmHMAC192SHA256AuthProtocol],
61+
CFLAGS_SAVE=$CFLAGS
62+
LIBS_SAVE=$LIBS
63+
CFLAGS="$CFLAGS $SNMP_CFLAGS"
64+
LIBS="$LIBS $SNMP_LIBS"
65+
66+
AC_CHECK_DECL([usmHMAC192SHA256AuthProtocol],
6367
[AC_DEFINE([HAVE_SNMP_SHA256], [1],
6468
[Define to 1 if SNMP library has the 'usmHMAC192SHA256AuthProtocol'
6569
array.])],
6670
[],
67-
[$SNMP_SHARED_LIBADD])
71+
[
72+
#include <net-snmp/net-snmp-config.h>
73+
#include <net-snmp/net-snmp-includes.h>
74+
])
6875

69-
dnl Check whether usmHMAC384SHA512AuthProtocol exists.
70-
PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [usmHMAC384SHA512AuthProtocol],
76+
AC_CHECK_DECL([usmHMAC384SHA512AuthProtocol],
7177
[AC_DEFINE([HAVE_SNMP_SHA512], [1],
7278
[Define to 1 if SNMP library has the 'usmHMAC384SHA512AuthProtocol'
7379
array.])],
7480
[],
75-
[$SNMP_SHARED_LIBADD])
81+
[
82+
#include <net-snmp/net-snmp-config.h>
83+
#include <net-snmp/net-snmp-includes.h>
84+
])
85+
86+
CFLAGS=$CFLAGS_SAVE
87+
LIBS=$LIBS_SAVE
7688

7789
PHP_NEW_EXTENSION([snmp], [snmp.c], [$ext_shared])
7890
PHP_SUBST([SNMP_SHARED_LIBADD])

0 commit comments

Comments
 (0)