From a176f0a558d3d93af1a0e581cfe4549d8068ec53 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Tue, 6 Aug 2024 23:27:52 +0200 Subject: [PATCH] Autotools: Fix SNMP checks This is a follow-up of GH-15242 (0b25e26b4ec15dbd7ef69e89c1cda05fa005b4e6) because the usmHMAC192SHA256AuthProtocol and usmHMAC384SHA512AuthProtocol are not functions but arrays. The AC_CHECK_DECL might be more appropriate and portable way to find these. --- ext/snmp/config.m4 | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index 02b4c6ac8da50..79abace8de888 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -58,21 +58,33 @@ if test "$PHP_SNMP" != "no"; then [], [$SNMP_SHARED_LIBADD]) - dnl Check whether usmHMAC192SHA256AuthProtocol exists. - PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [usmHMAC192SHA256AuthProtocol], + CFLAGS_SAVE=$CFLAGS + LIBS_SAVE=$LIBS + CFLAGS="$CFLAGS $SNMP_CFLAGS" + LIBS="$LIBS $SNMP_LIBS" + + AC_CHECK_DECL([usmHMAC192SHA256AuthProtocol], [AC_DEFINE([HAVE_SNMP_SHA256], [1], [Define to 1 if SNMP library has the 'usmHMAC192SHA256AuthProtocol' array.])], [], - [$SNMP_SHARED_LIBADD]) + [ + #include + #include + ]) - dnl Check whether usmHMAC384SHA512AuthProtocol exists. - PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [usmHMAC384SHA512AuthProtocol], + AC_CHECK_DECL([usmHMAC384SHA512AuthProtocol], [AC_DEFINE([HAVE_SNMP_SHA512], [1], [Define to 1 if SNMP library has the 'usmHMAC384SHA512AuthProtocol' array.])], [], - [$SNMP_SHARED_LIBADD]) + [ + #include + #include + ]) + + CFLAGS=$CFLAGS_SAVE + LIBS=$LIBS_SAVE PHP_NEW_EXTENSION([snmp], [snmp.c], [$ext_shared]) PHP_SUBST([SNMP_SHARED_LIBADD])