Parcourir la source

check_fping: Use fping6(8) only if available

Let check_fping use IPv6 only if

- the operating system supports IPv6,
- the user didn't specify --without-ipv6, and
- the "configure" script found the fping6(8) binary.
Holger Weiss il y a 12 ans
Parent
commit
108baecaec
2 fichiers modifiés avec 10 ajouts et 12 suppressions
  1. 9 11
      configure.in
  2. 1 1
      plugins/check_fping.c

+ 9 - 11
configure.in

@@ -1378,28 +1378,26 @@ then
 fi
 fi
 
 
 AC_PATH_PROG(PATH_TO_FPING,fping)
 AC_PATH_PROG(PATH_TO_FPING,fping)
+AC_PATH_PROG(PATH_TO_FPING6,fping6)
+
 AC_ARG_WITH(fping_command,
 AC_ARG_WITH(fping_command,
             ACX_HELP_STRING([--with-fping-command=PATH],
             ACX_HELP_STRING([--with-fping-command=PATH],
                             [Path to fping command]), PATH_TO_FPING=$withval)
                             [Path to fping command]), PATH_TO_FPING=$withval)
+AC_ARG_WITH(fping6_command,
+            ACX_HELP_STRING([--with-fping6-command=PATH],
+                            [Path to fping6 command]), PATH_TO_FPING6=$withval)
+
 if test -n "$PATH_TO_FPING"
 if test -n "$PATH_TO_FPING"
 then
 then
 	AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
 	AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
 	EXTRAS="$EXTRAS check_fping"
 	EXTRAS="$EXTRAS check_fping"
+	if test x"$with_ipv6" != xno && test -n "$PATH_TO_FPING6"; then
+		AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
+	fi
 else
 else
 	AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
 	AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
 fi
 fi
 
 
-AC_PATH_PROG(PATH_TO_FPING6,fping6)
-AC_ARG_WITH(fping6_command,
-            ACX_HELP_STRING([--with-fping6-command=PATH],
-                            [Path to fping6 command]), PATH_TO_FPING6=$withval)
-if test -n "$PATH_TO_FPING6"
-then
-	AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
-else
-	AC_MSG_WARN([Get fping6 from http://www.fping.com in order to make check_fping plugin])
-fi
-
 AC_PATH_PROG(PATH_TO_SSH,ssh)
 AC_PATH_PROG(PATH_TO_SSH,ssh)
 AC_ARG_WITH(ssh_command,
 AC_ARG_WITH(ssh_command,
             ACX_HELP_STRING([--with-ssh-command=PATH],
             ACX_HELP_STRING([--with-ssh-command=PATH],

+ 1 - 1
plugins/check_fping.c

@@ -103,7 +103,7 @@ main (int argc, char **argv)
   if (sourceif)
   if (sourceif)
     xasprintf(&option_string, "%s-I %s ", option_string, sourceif);
     xasprintf(&option_string, "%s-I %s ", option_string, sourceif);
 
 
-#ifdef USE_IPV6
+#ifdef PATH_TO_FPING6
   if (address_family == AF_INET6)
   if (address_family == AF_INET6)
     fping_prog = strdup(PATH_TO_FPING6);
     fping_prog = strdup(PATH_TO_FPING6);
   else
   else