[nagiosplug] Check for who(1) only if utmpx(5) isn't available

Nagios Plugin Development nagios-plugins at users.sourceforge.net
Tue Aug 20 22:10:28 CEST 2013


 Module: nagiosplug
 Branch: master
 Commit: 1a329f250fa2b462473da4633506908193ee81d6
 Author: Holger Weiss <holger at zedat.fu-berlin.de>
   Date: Tue Aug 20 21:57:52 2013 +0200
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=1a329f2

Check for who(1) only if utmpx(5) isn't available

The who(1) command is only called by check_users if the system doesn't
provide an utmpx(5) interface.

---

 configure.in |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/configure.in b/configure.in
index 529720e..a157596 100644
--- a/configure.in
+++ b/configure.in
@@ -316,10 +316,6 @@ AS_IF([test "x$with_ldap" != "xno"], [
   LIBS="$_SAVEDLIBS"
 ])
 
-dnl Check for headers used by check_users
-AC_CHECK_HEADERS(utmpx.h)
-AM_CONDITIONAL([HAVE_UTMPX], [test "$ac_cv_header_utmpx_h" = "yes"])
-
 dnl Check for headers used by check_ide_smart
 case $host in
   *linux*)
@@ -366,6 +362,26 @@ else
   AC_SUBST(MYSQLCFLAGS)
 fi
 
+dnl Check for headers used by check_users
+AC_CHECK_HEADERS(utmpx.h)
+AM_CONDITIONAL([HAVE_UTMPX], [test "$ac_cv_header_utmpx_h" = "yes"])
+
+dnl Fallback to who(1) if the system doesn't provide an utmpx(5) interface
+if test "$ac_cv_header_utmpx_h" = "no"
+then
+	AC_PATH_PROG(PATH_TO_WHO,who)
+
+	if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
+	then
+		ac_cv_path_to_who="$PATH_TO_WHO -q"
+	else
+		ac_cv_path_to_who="$PATH_TO_WHO"
+	fi
+
+	AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
+		[path and arguments for invoking 'who'])
+fi
+
 AC_ARG_WITH([ipv6],
 	[AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
 	[], [with_ipv6=check])
@@ -1338,19 +1354,6 @@ else
 	AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
 fi
 
-
-AC_PATH_PROG(PATH_TO_WHO,who)
-
-if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
-then
-	ac_cv_path_to_who="$PATH_TO_WHO -q"
-else
-	ac_cv_path_to_who="$PATH_TO_WHO"
-fi
-
-AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
-	[path and arguments for invoking 'who'])
-
 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
 AC_ARG_WITH(snmpget_command,
             ACX_HELP_STRING([--with-snmpget-command=PATH],





More information about the Commits mailing list