[monitoring-plugins] Implement autoconf logic for fping version ...
Lorenz Kästle
git at monitoring-plugins.org
Thu Jun 12 13:50:11 CEST 2025
Module: monitoring-plugins
Branch: master
Commit: 88683af1da8baae6b252795ab5d85a48e9cd3e63
Author: Lorenz Kästle <lorenz.kaestle at netways.de>
Date: Wed Jun 11 17:09:27 2025 +0200
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=88683af1
Implement autoconf logic for fping version detection
---
configure.ac | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ae704361..bec50cb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1523,10 +1523,44 @@ AC_PATH_PROG(PATH_TO_FPING,fping)
AC_ARG_WITH(fping_command,
ACX_HELP_STRING([--with-fping-command=PATH],
[Path to fping command]), PATH_TO_FPING=$withval)
-if test -n "$PATH_TO_FPING"
-then
+if test -n "$PATH_TO_FPING"; then
AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
EXTRAS="$EXTRAS check_fping\$(EXEEXT)"
+
+ if test -z "$($PATH_TO_FPING --version)" ; then
+ AC_MSG_NOTICE([failed to get version of fping])
+ else
+ FPING_MAJOR_VERSION="$($PATH_TO_FPING --version | sed 's/.*fping: Version //' | sed 's/\..*//')"
+ FPING_MINOR_VERSION="$($PATH_TO_FPING --version | sed 's/.*fping: Version //' | sed 's/.*\.//')"
+
+ if test $FPING_MAJOR_VERSION -eq 5 ; then
+ if test $FPING_MINOR_VERSION -ge 3 ; then
+ AC_DEFINE(FPING_VERSION_5_3_OR_HIGHER, "true", [fping is of version 5.3 or higher])
+ AC_MSG_NOTICE([fping is of version 5.3 or higher])
+ AC_DEFINE(FPING_VERSION_5_2_OR_HIGHER, "true", [fping is of version 5.2 or higher])
+ AC_MSG_NOTICE([fping is of version 5.2 or higher])
+ elif test $FPING_MINOR_VERSION -ge 2 ; then
+ AC_DEFINE(FPING_VERSION_5_2_OR_HIGHER, "true", [fping is of version 5.2 or higher])
+ AC_MSG_NOTICE([fping is of version 5.2 or higher])
+ else
+ AC_MSG_NOTICE([fping is of a version lower then 5.2])
+ fi
+
+ elif $FPING_MAJOR_VERSION > 5 ; then
+ AC_DEFINE(FPING_VERSION_5_2_OR_HIGHER, "true", [fping is of version 5.2 or higher])
+ AC_MSG_NOTICE([fping is of version 5.2 or higher])
+ AC_DEFINE(FPING_VERSION_5_3_OR_HIGHER, "true", [fping is of version 5.2 or higher])
+ AC_MSG_NOTICE([fping is of version 5.3 or higher])
+ fi
+
+ if test "`fping --version | sed 's/.*fping: Version //'`" = "5.2" ; then
+ AC_DEFINE(FPING_VERSION, "5.2", [the version of fping available])
+ AC_MSG_NOTICE([fping version: 5.2])
+ elif test "`fping --version | sed 's/.*fping: Version //'`" = "5.3"; then
+ AC_DEFINE(FPING_VERSION, "5.3", [the version of fping available])
+ AC_MSG_NOTICE([fping version: 5.3])
+ fi
+ fi
else
AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
fi
More information about the Commits
mailing list