diff options
author | Michael Orlitzky <michael@orlitzky.com> | 2025-02-15 18:10:06 -0500 |
---|---|---|
committer | Michael Orlitzky <michael@orlitzky.com> | 2025-02-15 22:58:07 -0500 |
commit | e6086f597b64d86feb82ea222d61da78d596693e (patch) | |
tree | ee78fdee4a6e4c953734c27751073394dfc9f4e3 | |
parent | df03c12a2b206465046805426f7368a8de90e85c (diff) | |
download | monitoring-plugins-e6086f597b64d86feb82ea222d61da78d596693e.tar.gz |
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.
-rw-r--r-- | configure.ac | 25 |
1 files 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, | |||
1460 | ACX_HELP_STRING([--with-snmpget-command=PATH], | 1460 | ACX_HELP_STRING([--with-snmpget-command=PATH], |
1461 | [Path to snmpget command]), | 1461 | [Path to snmpget command]), |
1462 | PATH_TO_SNMPGET=$withval) | 1462 | PATH_TO_SNMPGET=$withval) |
1463 | AS_IF([test -n "$PATH_TO_SNMPGET"], [ | ||
1464 | AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary]) | ||
1465 | EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)" | ||
1466 | ], [ | ||
1467 | AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to make check_hpjd and check_snmp plugins]) | ||
1468 | ]) | ||
1469 | 1463 | ||
1470 | AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext) | 1464 | AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext) |
1471 | AC_ARG_WITH(snmpgetnext_command, | 1465 | AC_ARG_WITH(snmpgetnext_command, |
1472 | ACX_HELP_STRING([--with-snmpgetnext-command=PATH], | 1466 | ACX_HELP_STRING([--with-snmpgetnext-command=PATH], |
1473 | [Path to snmpgetnext command]), | 1467 | [Path to snmpgetnext command]), |
1474 | PATH_TO_SNMPGETNEXT=$withval) | 1468 | PATH_TO_SNMPGETNEXT=$withval) |
1475 | AS_IF([test -n "$PATH_TO_SNMPGETNEXT"], [ | 1469 | |
1476 | AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary]) | 1470 | AS_IF([test -n "$PATH_TO_SNMPGET"], [ |
1471 | AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary]) | ||
1472 | EXTRAS="$EXTRAS check_hpjd" | ||
1473 | |||
1474 | dnl PATH_TO_SNMPGETNEXT is used unconditionally in check_snmp: | ||
1475 | dnl | ||
1476 | dnl https://github.com/nagios-plugins/nagios-plugins/issues/788 | ||
1477 | dnl | ||
1478 | AS_IF([test -n "$PATH_TO_SNMPGETNEXT"], [ | ||
1479 | AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary]) | ||
1480 | EXTRAS="$EXTRAS check_snmp\$(EXEEXT)" | ||
1481 | ], [ | ||
1482 | AC_MSG_WARN([Get snmpgetnext from https://net-snmp.sourceforge.io/ to build the check_snmp plugin]) | ||
1483 | ]) | ||
1484 | ], [ | ||
1485 | AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to build the check_hpjd and check_snmp plugins]) | ||
1477 | ]) | 1486 | ]) |
1478 | 1487 | ||
1479 | if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null ) | 1488 | if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null ) |