From e6086f597b64d86feb82ea222d61da78d596693e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 15 Feb 2025 18:10:06 -0500 Subject: configure.ac: require snmpgetnext for check_snmp PATH_TO_SNMPGETNEXT is used unconditionally in plugins/check_snmp.c, and the build will fail if it is left undefined (that is, if we are building check_snmp but snmpgetnext was neither found on the user's PATH or supplied manually). To avoid this build failure, we now test for snmpgetnext inside the case for snmpget, and skip check_snmp unless BOTH are found. --- configure.ac | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index e8ab77f0..204fc6e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1460,20 +1460,29 @@ AC_ARG_WITH(snmpget_command, ACX_HELP_STRING([--with-snmpget-command=PATH], [Path to snmpget command]), PATH_TO_SNMPGET=$withval) -AS_IF([test -n "$PATH_TO_SNMPGET"], [ - AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary]) - EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)" -], [ - AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to make check_hpjd and check_snmp plugins]) -]) AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext) AC_ARG_WITH(snmpgetnext_command, ACX_HELP_STRING([--with-snmpgetnext-command=PATH], [Path to snmpgetnext command]), PATH_TO_SNMPGETNEXT=$withval) -AS_IF([test -n "$PATH_TO_SNMPGETNEXT"], [ - AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary]) + +AS_IF([test -n "$PATH_TO_SNMPGET"], [ + AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary]) + EXTRAS="$EXTRAS check_hpjd" + + dnl PATH_TO_SNMPGETNEXT is used unconditionally in check_snmp: + dnl + dnl https://github.com/nagios-plugins/nagios-plugins/issues/788 + dnl + AS_IF([test -n "$PATH_TO_SNMPGETNEXT"], [ + AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary]) + EXTRAS="$EXTRAS check_snmp\$(EXEEXT)" + ], [ + AC_MSG_WARN([Get snmpgetnext from https://net-snmp.sourceforge.io/ to build the check_snmp plugin]) + ]) +], [ + AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to build the check_hpjd and check_snmp plugins]) ]) if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null ) -- cgit v1.2.3-74-g34f1