From 69296300f651fa8da663e9769e3a03f9fd5fbce3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 15 Feb 2025 17:45:53 -0500 Subject: configure.ac: update net-snmp homepage --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ef3d26e2..5141c652 100644 --- a/configure.ac +++ b/configure.ac @@ -1465,7 +1465,7 @@ then AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary]) EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)" else - AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins]) + AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to make check_hpjd and check_snmp plugins]) fi AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext) -- cgit v1.2.3-74-g34f1 From df03c12a2b206465046805426f7368a8de90e85c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 15 Feb 2025 17:47:34 -0500 Subject: configure.ac: use AS_IF in net-snmp tests Not strictly required here, but the AS_IF macro is generally safer because it handles (often unintentional) AC_REQUIRE calls. --- configure.ac | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 5141c652..e8ab77f0 100644 --- a/configure.ac +++ b/configure.ac @@ -1460,23 +1460,21 @@ AC_ARG_WITH(snmpget_command, ACX_HELP_STRING([--with-snmpget-command=PATH], [Path to snmpget command]), PATH_TO_SNMPGET=$withval) -if test -n "$PATH_TO_SNMPGET" -then +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)" -else +], [ AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to make check_hpjd and check_snmp plugins]) -fi +]) 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) -if test -n "$PATH_TO_SNMPGETNEXT" -then +AS_IF([test -n "$PATH_TO_SNMPGETNEXT"], [ AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary]) -fi +]) if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null ) then -- cgit v1.2.3-74-g34f1 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