1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
4 AC_INIT(nagios-plugins,1.4.9)
5 AC_CONFIG_SRCDIR(NPTest.pm)
6 AC_CONFIG_FILES(gl/Makefile)
7 AC_CONFIG_AUX_DIR(build-aux)
8 AM_INIT_AUTOMAKE([1.8.3])
9 AM_CONFIG_HEADER(config.h)
15 AC_PREFIX_DEFAULT(/usr/local/nagios)
17 dnl Deprecated configure options
20 dnl Append user (-o), group (-g), mode (-m) to install command
21 dnl There is an assumption that this is possible with ./configure's chosen install command
23 AC_ARG_WITH(nagios_user,
24 ACX_HELP_STRING([--with-nagios-user=USER],
25 [Installs executables with this user. Defaults to install user]),
26 extra_install_args="-o $withval")
27 AC_ARG_WITH(nagios_group,
28 ACX_HELP_STRING([--with-nagios-group=GROUP],
29 [Installs executables with this group. Defaults to install user]),
30 extra_install_args="$extra_install_args -g $withval")
31 AC_ARG_WITH(world_permissions,
32 ACX_HELP_STRING([--without-world-permissions],
33 [Installs executables without world permissions]))
35 if test "x$with_world_permissions" = xno ; then
36 extra_install_args="$extra_install_args -m 0550"
39 INSTALL="$INSTALL $extra_install_args"
40 INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args"
45 AC_PROG_GCC_TRADITIONAL
52 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
54 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
55 AC_SUBST(PLUGIN_TEST)dnl
57 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
58 AC_SUBST(SCRIPT_TEST)dnl
60 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
63 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
66 dnl CGIURL has changed for Nagios with 1.0 beta
68 ACX_HELP_STRING([--with-cgiurl=DIR],
69 [sets URL for cgi programs]),
71 with_cgiurl=/nagios/cgi-bin)
73 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
75 AC_ARG_WITH(trusted_path,
76 ACX_HELP_STRING([--with-trusted-path=PATH],
77 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
78 with_trusted_path=$withval,
79 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
80 AC_SUBST(with_trusted_path)
84 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
86 LDFLAGS="$LDFLAGS -L."
88 ac_cv_uname_m=`uname -m`
89 ac_cv_uname_s=`uname -s`
90 ac_cv_uname_r=`uname -r`
91 ac_cv_uname_v=`uname -v`
94 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
95 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
98 AC_SUBST(REV_DATESTAMP)
99 AC_SUBST(REV_TIMESTAMP)
101 dnl Checks for programs.
102 AC_PATH_PROG(PYTHON,python)
104 AC_PATH_PROG(PERL,perl)
105 AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
106 AC_PATH_PROG(HOSTNAME,hostname)
107 AC_PATH_PROG(BASENAME,basename)
109 dnl allow them to override the path of perl
111 ACX_HELP_STRING([--with-perl=PATH],
112 [sets path to perl executable]),
113 with_perl=$withval,with_perl=$PERL)
114 AC_SUBST(PERL, $with_perl)
118 AC_HELP_STRING([--with-openssl=DIR],
119 [path to openssl installation]),)
122 ACX_HELP_STRING([--with-gnutls=PATH],
123 [path to gnutls installation root]),)
125 dnl you can only have one or the other
126 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
129 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
133 dnl list of possible dirs to try to autodetect openssl
134 dnl if $dir/include exists, we consider it found
135 dnl the order should allow locally installed versions to override distros' ones
136 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
141 dnl Checks for libraries.
144 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
145 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
146 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
147 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
151 dnl check for math-related functions needing -lm
152 AC_CHECK_HEADERS(math.h)
153 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
156 dnl Check for libtap, to run perl-like tests
157 AC_CHECK_LIB(tap, plan_tests,
158 EXTRA_TEST="test_utils test_disk test_tcp"
162 dnl Check for PostgreSQL libraries
164 _SAVEDCPPFLAGS="$CPPFLAGS"
166 ACX_HELP_STRING([--with-pgsql=DIR],
167 [sets path to pgsql installation]),
169 AC_CHECK_LIB(crypt,main)
170 if test "$ac_cv_lib_crypt_main" = "yes"; then
171 if test -n "$PGSQL"; then
172 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
173 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
175 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
176 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
177 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
178 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
179 AC_CHECK_HEADERS(libpq-fe.h)
180 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
181 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
182 PGINCLUDE="-I$PGSQL/include"
183 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
184 PGLIBS="-lpq -lcrypt"
185 PGINCLUDE="-I/usr/include/pgsql"
186 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
187 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
188 PGINCLUDE="-I/usr/include/postgresql"
189 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
190 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
191 PGINCLUDE="-I$PGSQL/include"
193 if test -z "$PGINCLUDE"; then
194 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
195 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
199 EXTRAS="$EXTRAS check_pgsql"
202 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
203 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
204 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
207 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
208 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
211 CPPFLAGS="$_SAVEDCPPFLAGS"
213 dnl Check for radius libraries
215 AC_CHECK_LIB(radiusclient,rc_read_config)
216 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
217 EXTRAS="$EXTRAS check_radius"
218 RADIUSLIBS="-lradiusclient"
221 AC_MSG_WARN([Skipping radius plugin])
222 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
226 dnl Check for LDAP libraries
228 AC_CHECK_LIB(ldap,main,,,-llber)
229 if test "$ac_cv_lib_ldap_main" = "yes"; then
230 LDAPLIBS="-lldap -llber"\
231 LDAPINCLUDE="-I/usr/include/ldap"
233 AC_SUBST(LDAPINCLUDE)
234 AC_CHECK_FUNCS(ldap_set_option)
235 EXTRAS="$EXTRAS check_ldap"
236 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
238 AC_MSG_WARN([Skipping LDAP plugin])
239 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
243 dnl Check for mysql libraries
245 if test $with_mysql = "no" ; then
246 AC_MSG_WARN([Skipping mysql plugin])
247 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
249 EXTRAS="$EXTRAS check_mysql check_mysql_query"
250 MYSQLINCLUDE="$np_mysql_include"
251 MYSQLLIBS="$np_mysql_libs"
252 MYSQLCFLAGS="$np_mysql_cflags"
253 AC_SUBST(MYSQLINCLUDE)
255 AC_SUBST(MYSQLCFLAGS)
258 dnl Check for AF_INET6 support - unistd.h required for Darwin
259 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
260 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
263 #include <netinet/in.h>
264 #include <sys/socket.h>],
265 [struct sockaddr_in6 sin6;
268 sin6.sin6_family = AF_INET6;
269 sin6.sin6_port = 587;
270 p = &sin6.sin6_addr;],
275 if test x"$with_ipv6" != xno ; then
276 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
280 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
281 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
282 if test "$FOUNDINCLUDE" = "no"; then
283 _SAVEDCPPFLAGS="$CPPFLAGS"
284 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
285 unset ac_cv_header_krb5_h
286 AC_CHECK_HEADERS(krb5.h,
287 KRB5INCLUDE="-I/usr/kerberos/include"
292 if test "$FOUNDINCLUDE" = "no"; then
293 CPPFLAGS="$_SAVEDCPPFLAGS"
297 dnl openssl detection/configuration
298 if ! test x"$with_openssl" = x"no"; then
299 dnl Check for OpenSSL location if it wasn't already specified
300 if ! test -d "$with_openssl"; then
301 for d in $OPENSSL_DIRS; do
302 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
308 _SAVEDCPPFLAGS="$CPPFLAGS"
309 _SAVEDLDFLAGS="$LDFLAGS"
310 dnl Check for OpenSSL header files
312 if test x"$with_openssl" != x"/usr" ; then
313 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
314 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
317 dnl check for openssl in $dir/include/openssl
318 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
319 SSLINCLUDE="-I$with_openssl/include"
322 dnl else check to see if $dir/include has it
323 if test "$FOUNDINCLUDE" = "no"; then
324 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
325 SSLINCLUDE="-I$with_openssl/include"
330 dnl if we didn't find it, reset CPPFLAGS
331 if test "$FOUNDINCLUDE" = "no"; then
332 CPPFLAGS="$_SAVEDCPPFLAGS"
333 LDFLAGS="$_SAVEDLDFLAGS"
336 dnl Check for crypto lib
338 LIBS="-L${with_openssl}/lib"
339 AC_CHECK_LIB(crypto,CRYPTO_lock)
340 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
341 dnl Check for SSL lib
342 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
346 dnl test headers and libs to decide whether check_http should use SSL
347 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
348 if test "$ac_cv_lib_ssl_main" = "yes"; then
349 if test "$FOUNDINCLUDE" = "yes"; then
357 dnl check for gnutls if openssl isn't found (or is disabled)
358 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
359 if test ! "$with_gnutls" = ""; then
360 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
361 elif test ! "$LIBGNUTLS_CONFIG" = ""; then
362 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
364 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
365 if test "$FOUNDGNUTLS" = "yes"; then
366 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
369 dnl end check for gnutls
371 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
372 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
373 AC_SUBST(check_tcp_ssl)
375 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
376 if test "$FOUNDOPENSSL" = "yes"; then
377 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
381 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
386 dnl else deliberately disabled or no ssl support available
387 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
393 dnl Checks for header files.
398 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
399 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
401 dnl Checks for typedefs, structures, and compiler characteristics.
408 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
409 AC_TRY_LINK([#include <stdarg.h>
410 va_list ap1,ap2;], [va_copy(ap1,ap2);],
411 ac_cv_HAVE_VA_COPY=yes,
412 ac_cv_HAVE_VA_COPY=no)])
413 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
414 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
416 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
417 AC_TRY_LINK([#include <stdarg.h>
418 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
419 ac_cv_HAVE___VA_COPY=yes,
420 ac_cv_HAVE___VA_COPY=no)])
421 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
422 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
426 AC_TRY_COMPILE([#include <sys/time.h>],
428 struct timezone *tz;],
429 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
430 AC_TRY_COMPILE([#include <sys/time.h>],
433 gettimeofday(tv, tz);],
434 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
435 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
437 dnl Checks for library functions.
438 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
441 AC_MSG_CHECKING(return type of socket size)
442 AC_TRY_COMPILE([#include <stdlib.h>
443 #include <sys/types.h>
444 #include <sys/socket.h>],
445 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
446 ac_cv_socket_size_type=["size_t"]
447 AC_MSG_RESULT(size_t),
448 ac_cv_socket_size_type=["int"]
451 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
452 [Define type of socket size])
455 dnl #### Process table test
457 AC_PATH_PROG(PATH_TO_PS,ps)
459 AC_MSG_CHECKING(for ps syntax)
460 AC_ARG_WITH(ps_command,
461 ACX_HELP_STRING([--with-ps-command=PATH],
462 [Verbatim command to execute for ps]),
464 AC_ARG_WITH(ps_format,
465 ACX_HELP_STRING([--with-ps-format=FORMAT],
466 [Format string for scanning ps output]),
469 ACX_HELP_STRING([--with-ps-cols=NUM],
470 [Number of columns in ps command]),
472 AC_ARG_WITH(ps_varlist,
473 ACX_HELP_STRING([--with-ps-varlist=LIST],
474 [Variable list for sscanf of 'ps' output]),
477 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
478 ac_cv_ps_command="$PS_COMMAND"
479 ac_cv_ps_format="$PS_FORMAT"
480 ac_cv_ps_varlist="$PS_VARLIST"
481 ac_cv_ps_cols="$PS_COLS"
482 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
484 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
485 dnl Limitation that command name is not available
486 elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
487 egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
489 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
490 ac_cv_ps_command="/usr/ucb/ps -alxwwn"
491 ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
493 AC_MSG_RESULT([$ac_cv_ps_command])
495 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
496 dnl so test for this first...
497 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
498 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
500 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
501 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
502 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
504 AC_MSG_RESULT([$ac_cv_ps_command])
506 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
507 dnl Should also work for FreeBSD 5.2.1 and 5.3
508 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
509 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
510 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
512 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
513 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
514 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
516 AC_MSG_RESULT([$ac_cv_ps_command])
518 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
519 dnl Limitation: Only first 16 chars returned for ucomm field
520 dnl Must come before ps -weo
521 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
522 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
524 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
525 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
526 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
528 AC_MSG_RESULT([$ac_cv_ps_command])
530 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
531 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
532 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
534 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
535 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
536 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
538 AC_MSG_RESULT([$ac_cv_ps_command])
541 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
542 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
544 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
545 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
546 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
548 AC_MSG_RESULT([$ac_cv_ps_command])
550 dnl BSD-like mode in RH 6.1
551 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
552 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
554 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
555 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
556 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
558 AC_MSG_RESULT([$ac_cv_ps_command])
561 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
562 dnl Need the head -1 otherwise test will work because arguments are found
563 elif ps -laxnwww 2>/dev/null | head -1 | \
564 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
566 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
567 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
568 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
570 AC_MSG_RESULT([$ac_cv_ps_command])
572 dnl Debian Linux / procps v1.2.9:
573 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
574 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
576 elif ps laxnwww 2>/dev/null | \
577 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
579 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
580 ac_cv_ps_command="$PATH_TO_PS laxnwww"
581 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
583 AC_MSG_RESULT([$ac_cv_ps_command])
585 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
586 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
587 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
589 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
590 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
591 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
593 AC_MSG_RESULT([$ac_cv_ps_command])
595 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
596 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
597 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
598 dnl of 1500). Will need big changes to check_procs to support
599 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
600 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
602 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
603 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
604 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
606 AC_MSG_RESULT([$ac_cv_ps_command])
608 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
609 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
611 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
612 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
613 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
615 AC_MSG_RESULT([$ac_cv_ps_command])
617 dnl AIX 4.3.3 and 5.1 do not have an rss field
618 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
619 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
621 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
622 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
623 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
625 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
628 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
629 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
631 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
632 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
633 # There must be no space between the %s and %n due to a wierd problem in sscanf where
634 # it will return %n as longer than the line length
635 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
637 AC_MSG_RESULT([$ac_cv_ps_command])
639 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
640 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
642 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
643 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
644 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
646 AC_MSG_RESULT([$ac_cv_ps_command])
648 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
649 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
651 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
652 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
653 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
655 AC_MSG_RESULT([$ac_cv_ps_command])
657 dnl wonder who takes state instead of stat
658 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
659 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
661 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
662 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
663 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
665 AC_MSG_RESULT([$ac_cv_ps_command])
668 elif ps -el 2>/dev/null | \
669 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
671 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
672 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
673 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
675 AC_MSG_RESULT([$ac_cv_ps_command])
678 elif ps -el 2>/dev/null | \
679 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
681 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
682 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
683 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
685 AC_MSG_RESULT([$ac_cv_ps_command])
688 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
689 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
690 elif ps -el 2>/dev/null | \
691 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
693 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
694 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
695 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
697 AC_MSG_RESULT([$ac_cv_ps_command])
700 elif ps glaxen 2>/dev/null | \
701 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
703 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
704 ac_cv_ps_command="$PATH_TO_PS glaxen"
705 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
707 AC_MSG_RESULT([$ac_cv_ps_command])
710 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
711 dnl Some truncation will happen in UCOMM column
712 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
713 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
714 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
715 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
717 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
718 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
719 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
721 AC_MSG_RESULT([$ac_cv_ps_command])
724 elif ps -Al 2>/dev/null | \
725 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
727 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
728 ac_cv_ps_command="$PATH_TO_PS -Al"
729 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
731 AC_MSG_RESULT([$ac_cv_ps_command])
734 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
737 if test -n "$ac_cv_ps_varlist" ; then
738 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
739 [Variable list for sscanf of 'ps' output])
740 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
741 [Verbatim command to execute for ps in check_procs])
742 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
743 [Format string for scanning ps output in check_procs])
744 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
745 [Number of columns in ps command])
746 EXTRAS="$EXTRAS check_procs check_nagios"
747 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
748 AC_DEFINE(PS_USES_PROCETIME,"yes",
749 [Whether the ps utility uses the "procetime" field])
753 AC_PATH_PROG(PATH_TO_PING,ping)
754 AC_PATH_PROG(PATH_TO_PING6,ping6)
756 AC_ARG_WITH(ping_command,
757 ACX_HELP_STRING([--with-ping-command=SYNTAX],
758 [sets syntax for ICMP ping]),
759 with_ping_command=$withval,)
761 AC_MSG_CHECKING(for ICMP ping syntax)
762 ac_cv_ping_packets_first=no
763 ac_cv_ping_has_timeout=no
764 if test -n "$with_ping_command"
766 AC_MSG_RESULT([(command-line) $with_ping_command])
767 if test -n "$ac_cv_ping_packets_first"
769 ac_cv_ping_packets_first=yes
770 ac_cv_ping_has_timeout=yes
773 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
774 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
775 egrep -i "^round-trip|^rtt" >/dev/null
777 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
778 ac_cv_ping_packets_first=yes
779 AC_MSG_RESULT([$with_ping_command])
781 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
782 egrep -i "^round-trip|^rtt" >/dev/null
784 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
785 ac_cv_ping_packets_first=yes
786 ac_cv_ping_has_timeout=yes
787 AC_MSG_RESULT([$with_ping_command])
789 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
790 egrep -i "^round-trip|^rtt" >/dev/null
792 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
793 ac_cv_ping_packets_first=yes
794 AC_MSG_RESULT([$with_ping_command])
796 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
797 egrep -i "^round-trip|^rtt" >/dev/null
799 with_ping_command="$PATH_TO_PING -n -c %d %s"
800 ac_cv_ping_packets_first=yes
801 AC_MSG_RESULT([$with_ping_command])
803 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
804 egrep -i "^round-trip|^rtt" >/dev/null
806 with_ping_command="$PATH_TO_PING -n %s -c %d"
807 AC_MSG_RESULT([$with_ping_command])
809 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
810 egrep -i "^round-trip|^rtt" >/dev/null
812 with_ping_command="$PATH_TO_PING %s -n %d"
813 AC_MSG_RESULT([$with_ping_command])
815 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
816 egrep -i "^round-trip|^rtt" >/dev/null
818 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
819 AC_MSG_RESULT([$with_ping_command])
821 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
822 egrep -i "^round-trip|^rtt" >/dev/null
824 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
825 AC_MSG_RESULT([$with_ping_command])
827 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
828 egrep -i "^round-trip|^rtt" >/dev/null
830 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
831 ac_cv_ping_packets_first=yes
832 AC_MSG_RESULT([$with_ping_command])
834 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
835 egrep -i "^round-trip|^rtt" >/dev/null
837 with_ping_command="$PATH_TO_PING -n -c %d %s"
838 ac_cv_ping_packets_first=yes
839 AC_MSG_RESULT([$with_ping_command])
842 AC_MSG_WARN([unable to find usable ping syntax])
845 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
846 [path and args for ICMP ping command])
848 if test "x$ac_cv_ping_packets_first" != "xno"
850 AC_DEFINE(PING_PACKETS_FIRST,1,
851 [Define if packet count must precede host])
854 if test "x$ac_cv_ping_has_timeout" != "xno"
856 AC_DEFINE(PING_HAS_TIMEOUT,1,
857 [Define if ping has its own timeout option that should be set])
860 AC_ARG_WITH(ping6_command,
861 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
862 [sets syntax for ICMPv6 ping]),
863 with_ping6_command=$withval,)
865 if test x"$with_ipv6" != xno ; then
866 AC_MSG_CHECKING(for ICMPv6 ping syntax)
867 ac_cv_ping6_packets_first=no
868 if test -n "$with_ping6_command"
870 AC_MSG_RESULT([(command-line) $with_ping6_command])
871 if test -n "$ac_cv_ping6_packets_first"
873 ac_cv_ping6_packets_first=yes
876 elif test "x$PATH_TO_PING6" != "x"; then
877 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
878 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
879 egrep -i "^round-trip|^rtt" >/dev/null
881 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
882 ac_cv_ping6_packets_first=yes
883 AC_MSG_RESULT([$with_ping6_command])
885 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
886 egrep -i "^round-trip|^rtt" >/dev/null
888 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
889 ac_cv_ping6_packets_first=yes
890 ac_cv_ping_has_timeout=yes
891 AC_MSG_RESULT([$with_ping6_command])
893 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
894 egrep -i "^round-trip|^rtt" >/dev/null
896 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
897 ac_cv_ping6_packets_first=yes
898 AC_MSG_RESULT([$with_ping6_command])
900 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
901 egrep -i "^round-trip|^rtt" >/dev/null
903 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
904 ac_cv_ping6_packets_first=yes
905 AC_MSG_RESULT([$with_ping6_command])
907 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
908 egrep -i "^round-trip|^rtt" >/dev/null
910 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
911 AC_MSG_RESULT([$with_ping6_command])
913 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
914 egrep -i "^round-trip|^rtt" >/dev/null
916 with_ping6_command="$PATH_TO_PING6 %s -n %d"
917 AC_MSG_RESULT([$with_ping6_command])
919 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
920 egrep -i "^round-trip|^rtt" >/dev/null
922 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
923 AC_MSG_RESULT([$with_ping6_command])
925 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
926 egrep -i "^round-trip|^rtt" >/dev/null
928 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
929 AC_MSG_RESULT([$with_ping6_command])
931 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
932 egrep -i "^round-trip|^rtt" >/dev/null
934 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
935 ac_cv_ping6_packets_first=yes
936 AC_MSG_RESULT([$with_ping_command])
938 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
939 egrep -i "^round-trip|^rtt" >/dev/null
941 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
942 ac_cv_ping6_packets_first=yes
943 AC_MSG_RESULT([$with_ping6_command])
947 elif test "x$PATH_TO_PING" != "x"; then
948 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
949 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
950 egrep -i "^round-trip|^rtt" >/dev/null
952 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
953 ac_cv_ping6_packets_first=yes
954 AC_MSG_RESULT([$with_ping6_command])
956 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
957 egrep -i "^round-trip|^rtt" >/dev/null
959 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
960 ac_cv_ping6_packets_first=yes
961 AC_MSG_RESULT([$with_ping6_command])
963 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
964 egrep -i "^round-trip|^rtt" >/dev/null
966 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
967 ac_cv_ping6_packets_first=yes
968 AC_MSG_RESULT([$with_ping6_command])
970 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
971 egrep -i "^round-trip|^rtt" >/dev/null
973 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
974 AC_MSG_RESULT([$with_ping6_command])
976 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
977 egrep -i "^round-trip|^rtt" >/dev/null
979 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
980 AC_MSG_RESULT([$with_ping6_command])
982 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
983 egrep -i "^round-trip|^rtt" >/dev/null
985 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
986 AC_MSG_RESULT([$with_ping6_command])
988 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
989 egrep -i "^round-trip|^rtt" >/dev/null
991 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
992 AC_MSG_RESULT([$with_ping6_command])
994 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
995 egrep -i "^round-trip|^rtt" >/dev/null
997 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
998 ac_cv_ping6_packets_first=yes
999 AC_MSG_RESULT([$with_ping_command])
1001 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1002 egrep -i "^round-trip|^rtt" >/dev/null
1004 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1005 ac_cv_ping6_packets_first=yes
1006 AC_MSG_RESULT([$with_ping6_command])
1012 if test "x$with_ping6_command" != "x"; then
1013 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1014 [path and args for ICMPv6 ping command])
1016 AC_MSG_RESULT([none])
1019 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1020 AC_DEFINE(PING6_PACKETS_FIRST,1,
1021 [Define if packet count must precede host])
1026 AC_ARG_WITH(nslookup_command,
1027 ACX_HELP_STRING([--with-nslookup-command=PATH],
1028 [sets path to nslookup executable]),
1029 ac_cv_nslookup_command=$withval)
1030 if test -n "$ac_cv_nslookup_command"; then
1031 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1033 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1034 if test -n "$PATH_TO_NSLOOKUP"
1036 AC_MSG_CHECKING(for nslookup syntax)
1037 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1039 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1040 AC_MSG_RESULT([$ac_cv_nslookup_command])
1043 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1044 AC_MSG_RESULT([$ac_cv_nslookup_command])
1048 AC_MSG_WARN([nslookup command not found])
1052 if test -n "$ac_cv_nslookup_command"; then
1053 EXTRAS="$EXTRAS check_dns"
1054 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1057 AC_MSG_CHECKING([for number of cpus])
1058 AC_TRY_COMPILE([#include <unistd.h>],
1059 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1060 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
1061 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1062 AC_MSG_RESULT([cannot calculate])
1065 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1066 AC_ARG_WITH(uptime_command,
1067 ACX_HELP_STRING([--with-uptime-command=PATH],
1068 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1069 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1071 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1072 AC_ARG_WITH(rpcinfo_command,
1073 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1074 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1075 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1077 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1078 if test -x "$PATH_TO_LMSTAT"
1080 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1082 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1085 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1086 AC_ARG_WITH(smbclient_command,
1087 ACX_HELP_STRING([--with-smbclient-command=PATH],
1088 [sets path to smbclient]),
1089 PATH_TO_SMBCLIENT=$withval)
1090 if test -n "$PATH_TO_SMBCLIENT"
1092 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1094 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1098 AC_PATH_PROG(PATH_TO_WHO,who)
1100 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1102 ac_cv_path_to_who="$PATH_TO_WHO -q"
1104 ac_cv_path_to_who="$PATH_TO_WHO"
1107 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1108 [path and arguments for invoking 'who'])
1110 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1111 AC_ARG_WITH(snmpget_command,
1112 ACX_HELP_STRING([--with-snmpget-command=PATH],
1113 [Path to snmpget command]),
1114 PATH_TO_SNMPGET=$withval)
1115 if test -n "$PATH_TO_SNMPGET"
1117 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1118 EXTRAS="$EXTRAS check_hpjd check_snmp"
1120 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1123 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1124 AC_ARG_WITH(snmpgetnext_command,
1125 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1126 [Path to snmpgetnext command]),
1127 PATH_TO_SNMPGETNEXT=$withval)
1128 if test -n "$PATH_TO_SNMPGETNEXT"
1130 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1133 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1135 AC_MSG_CHECKING(for Net::SNMP perl module)
1136 AC_MSG_RESULT([found])
1138 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1141 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1142 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1143 AC_ARG_WITH(qstat_command,
1144 ACX_HELP_STRING([--with-qstat-command=PATH],
1145 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1147 if test -x "$PATH_TO_QUAKESTAT"
1149 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1150 EXTRAS="$EXTRAS check_game"
1152 elif test -n "$PATH_TO_QSTAT"
1154 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1155 EXTRAS="$EXTRAS check_game"
1157 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1160 if test $ac_cv_path_to_qstat
1162 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1163 [path to qstat/quakestat])
1166 AC_PATH_PROG(PATH_TO_FPING,fping)
1167 AC_ARG_WITH(fping_command,
1168 ACX_HELP_STRING([--with-fping-command=PATH],
1169 [Path to fping command]), PATH_TO_FPING=$withval)
1170 if test -n "$PATH_TO_FPING"
1172 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1173 EXTRAS="$EXTRAS check_fping"
1175 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1178 AC_PATH_PROG(PATH_TO_SSH,ssh)
1179 AC_ARG_WITH(ssh_command,
1180 ACX_HELP_STRING([--with-ssh-command=PATH],
1181 [sets path for ssh]), PATH_TO_SSH=$withval)
1182 if test -n "$PATH_TO_SSH"
1184 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1185 EXTRAS="$EXTRAS check_by_ssh"
1187 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1191 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1192 AC_ARG_WITH(mailq_command,
1193 ACX_HELP_STRING([--with-mailq-command=PATH],
1194 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1195 if test -n "$PATH_TO_MAILQ"
1197 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1199 AC_MSG_WARN([Could not find mailq or eqivalent])
1202 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1203 if test -x "$PATH_TO_QMAIL_QSTAT"
1205 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1207 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1210 dnl SWAP info required is amount allocated/available and amount free
1211 dnl The plugin works through all the swap devices and adds up the total swap
1213 AC_PATH_PROG(PATH_TO_SWAP,swap)
1214 if (test -n "$PATH_TO_SWAP")
1216 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1217 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1220 ac_cv_swap_command="$PATH_TO_SWAP -l"
1221 if [$PATH_TO_SWAP -l 2>/dev/null | \
1222 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1225 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1226 ac_cv_swap_conv=2048
1227 AC_MSG_RESULT([using IRIX format swap])
1229 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1231 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1232 ac_cv_swap_conv=2048
1233 AC_MSG_RESULT([using Unixware format swap])
1235 dnl if we don't know what format swap's output is
1236 dnl we might as well pretend we didn't see it
1238 ac_cv_swap_command=""
1241 dnl end if for PATH_TO_SWAP
1244 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1245 if (test -n "$PATH_TO_SWAPINFO")
1247 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1248 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1251 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1253 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1255 ac_cv_swap_format=["%*s %f %*d %f"]
1256 ac_cv_swap_conv=1024
1257 AC_MSG_RESULT([using FreeBSD format swapinfo])
1260 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1263 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1264 ac_cv_swap_format=["%*s %f %*d %f"]
1265 ac_cv_swap_conv=1024
1266 AC_MSG_RESULT([using HP-UX format swapinfo])
1268 dnl end if for PATH_TO_SWAPINFO
1271 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1272 if (test -n "$PATH_TO_LSPS")
1274 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1275 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1278 ac_cv_swap_command="$PATH_TO_LSPS -a"
1279 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1281 AC_MSG_RESULT([using AIX lsps])
1283 dnl end if for PATH_TO_SWAPINFO
1287 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1288 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1289 dnl in the various BSD's
1292 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1293 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1294 #ifdef HAVE_SYS_PARAM_H
1295 #include <sys/param.h>
1298 AC_CHECK_DECLS([swapctl],,,[
1300 #include <sys/types.h>
1301 #include <sys/param.h>
1302 #include <sys/stat.h>
1303 #include <sys/swap.h>
1305 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1306 #include <sys/types.h>
1307 #include <sys/param.h>
1308 #include <sys/stat.h>
1309 #include <sys/swap.h>
1311 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1313 #include <sys/types.h>
1314 #include <sys/param.h>
1315 #include <sys/stat.h>
1316 #include <sys/swap.h>
1319 if test "$ac_cv_have_decl_swapctl" = "yes";
1321 EXTRAS="$EXTRAS check_swap"
1322 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1323 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1324 "$ac_cv_type_swapent_t" = "yes";
1326 AC_MSG_RESULT([yes])
1327 ac_cv_check_swap_swapctl_svr4="1";
1328 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1329 [Define if 2-argument SVR4 swapctl exists])
1332 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1333 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1335 AC_MSG_RESULT([yes])
1336 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1337 [Define if 3-argument BSD swapctl exists])
1342 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1343 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1346 dnl the SVR4 spec returns values in pages
1348 AC_MSG_RESULT([page])
1349 AC_CHECK_DECLS([sysconf])
1350 AC_MSG_CHECKING([for system page size])
1351 if test "$ac_cv_have_decl_sysconf" = "yes";
1353 AC_MSG_RESULT([determined by sysconf(3)])
1354 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1356 AC_MSG_WARN([don't know. guessing 4096k])
1361 dnl the BSD spec returns values in blocks
1363 AC_MSG_RESULT([blocks (assuming 512b)])
1364 ac_cv_swap_conv=2048
1366 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1367 [Conversion factor to MB])
1370 dnl end tests for the swapctl system calls
1374 if test "x$ac_cv_have_swap" != "x"
1376 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1377 EXTRAS="$EXTRAS check_swap"
1379 if test "x$ac_cv_swap_command" != "x"
1381 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1382 [Path to swap/swapinfo binary, with any args])
1383 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1384 [Format string for parsing swap output])
1385 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1386 [Conversion factor to MB])
1389 AC_ARG_WITH(proc-meminfo,
1390 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1391 [path to /proc/meminfo or equivalent]),
1392 ac_cv_proc_meminfo=$withval)
1393 dnl dunno why this does not work below - use hack (kbd)
1394 dnl fine on linux, broken on solaris
1395 dnl if /bin/test -e "/proc/meminfo"
1396 AC_MSG_CHECKING([for /proc/meminfo])
1397 if test -n "$ac_cv_proc_meminfo"; then
1398 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1399 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1400 AC_MSG_RESULT([found /proc/meminfo])
1401 ac_cv_proc_meminfo="/proc/meminfo"
1406 if test -n "$ac_cv_proc_meminfo"; then
1407 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1408 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1409 EXTRAS="$EXTRAS check_swap"
1412 AC_PATH_PROG(PATH_TO_DIG,dig)
1413 AC_ARG_WITH(dig_command,
1414 ACX_HELP_STRING([--with-dig-command=PATH],
1415 [Path to dig command]), PATH_TO_DIG=$withval)
1416 if test -n "$PATH_TO_DIG"; then
1417 EXTRAS="$EXTRAS check_dig"
1418 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1421 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1422 AC_ARG_WITH(apt-get_command,
1423 ACX_HELP_STRING([--with-apt-get-command=PATH],
1424 [Path to apt-get command]),
1425 with_apt_get_command=$withval,
1426 with_apt_get_command=$PATH_TO_APTGET)
1427 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1428 if test -n "$PATH_TO_APTGET" ; then
1429 EXTRAS="$EXTRAS check_apt"
1433 if test -f plugins/check_nt.c ; then
1434 EXTRAS="$EXTRAS check_nt"
1435 elif test -f ../plugins/check_nt.c ; then
1436 EXTRAS="$EXTRAS check_nt"
1442 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1445 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1448 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1451 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1456 AC_SUBST(EXTRAS_ROOT)
1457 AC_SUBST(EXTRA_NETOBJS)
1460 AM_GNU_GETTEXT([external], [need-ngettext])
1461 AM_GNU_GETTEXT_VERSION(0.15)
1463 dnl Check for Redhat spopen problem
1464 dnl Wierd problem where ECHILD is returned from a wait call in error
1465 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1466 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1467 dnl We patch plugins/popen.c
1468 dnl Need to add smp because uname different on those
1469 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1470 AC_ARG_ENABLE(redhat-pthread-workaround,
1471 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1472 [force Redhat patch to be applied (default: test system)]),
1473 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1474 [ac_cv_enable_redhat_pthread_workaround=test])
1475 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1476 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1477 AC_MSG_CHECKING(for redhat spopen problem)
1478 ( cd config_test && make && make test ) > /dev/null 2>&1
1479 if test $? -eq 0 ; then
1482 AC_MSG_RESULT(error)
1483 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1486 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1487 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1490 dnl External libraries - see ACKNOWLEDGEMENTS
1493 dnl Some helpful common compile errors checked here
1494 if test "$ac_cv_uname_s" = 'SunOS' -a "$ac_cv_prog_ac_ct_AR" = 'false' ; then
1495 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1503 plugins-root/Makefile
1504 plugins-scripts/Makefile
1505 plugins-scripts/subst
1506 plugins-scripts/utils.pm
1507 plugins-scripts/utils.sh
1515 dnl the ones below that are commented out need to be cleaned up
1516 dnl in the configure code above to use with_foo instead of ac_cv_foo
1517 dnl if we want them to show up here. it'd also make the code cleaner.
1518 dnl i'll get to that on another rainy day :) -sf
1519 ACX_FEATURE([with],[apt-get-command])
1520 dnl ACX_FEATURE([with],[dig-command])
1521 dnl ACX_FEATURE([with],[fping-command])
1522 dnl ACX_FEATURE([with],[mailq-command])
1523 dnl ACX_FEATURE([with],[nslookup-command])
1524 ACX_FEATURE([with],[ping6-command])
1525 ACX_FEATURE([with],[ping-command])
1526 dnl ACX_FEATURE([with],[qstat-command])
1527 dnl ACX_FEATURE([with],[rpcinfo-command])
1528 dnl ACX_FEATURE([with],[smbclient-command])
1529 dnl ACX_FEATURE([with],[snmpget-command])
1530 dnl ACX_FEATURE([with],[snmpgetnext-command])
1531 dnl ACX_FEATURE([with],[ssh-command])
1532 dnl ACX_FEATURE([with],[uptime-command])
1534 dnl ACX_FEATURE([with],[proc-meminfo])
1535 dnl ACX_FEATURE([with],[ps-command])
1536 dnl ACX_FEATURE([with],[ps-format])
1537 dnl ACX_FEATURE([with],[ps-cols])
1538 dnl ACX_FEATURE([with],[ps-varlist])
1540 ACX_FEATURE([with],[ipv6])
1541 ACX_FEATURE([with],[mysql])
1542 ACX_FEATURE([with],[openssl])
1543 ACX_FEATURE([with],[gnutls])
1544 ACX_FEATURE([with],[perl])
1545 ACX_FEATURE([with],[cgiurl])
1546 ACX_FEATURE([with],[trusted-path])