1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(monitoring-plugins,2.1.1)
4 AC_CONFIG_SRCDIR(NPTest.pm)
5 AC_CONFIG_FILES([gl/Makefile])
6 AC_CONFIG_AUX_DIR(build-aux)
7 AM_INIT_AUTOMAKE([1.8.3])
8 AM_MAINTAINER_MODE([enable])
9 AC_CONFIG_HEADERS([config.h])
12 DEFAULT_PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
16 dnl Deprecated configure options
19 dnl Append user (-o), group (-g), mode (-m) to install command
20 dnl There is an assumption that this is possible with ./configure's chosen install command
22 AC_ARG_WITH(nagios_user,
23 ACX_HELP_STRING([--with-nagios-user=USER],
24 [Installs executables with this user. Defaults to install user]),
25 extra_install_args="-o $withval")
26 AC_ARG_WITH(nagios_group,
27 ACX_HELP_STRING([--with-nagios-group=GROUP],
28 [Installs executables with this group. Defaults to install user]),
29 extra_install_args="$extra_install_args -g $withval")
30 AC_ARG_WITH(world_permissions,
31 ACX_HELP_STRING([--without-world-permissions],
32 [Installs executables without world permissions]))
34 if test "x$with_world_permissions" = xno ; then
35 extra_install_args="$extra_install_args -m 0550"
38 INSTALL="$INSTALL $extra_install_args"
39 INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args"
44 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 Monitoring 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 help@monitoring-plugins.org if you have questions regarding use\nof this software. To submit patches or suggest improvements, send email to\ndevel@monitoring-plugins.org. Please include version information with all\ncorrespondence (when possible, use output from the --version option of the\nplugin 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]),
78 with_trusted_path=$withval,
79 with_trusted_path=$DEFAULT_PATH)
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`
92 ac_cv_uname_o=`uname -o`
95 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
96 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
99 AC_SUBST(REV_DATESTAMP)
100 AC_SUBST(REV_TIMESTAMP)
102 dnl Check if version file is present
103 AM_CONDITIONAL([RELEASE_PRESENT], [test -f $srcdir/release])
105 # Also read in the version from it
106 if test -f $srcdir/release; then
107 NP_RELEASE="$(<release)"
109 NP_RELEASE="$PACKAGE_VERSION"
113 dnl Checks for programs.
114 AC_PATH_PROG(PERL,perl)
115 AC_PATH_PROG(HOSTNAME,hostname)
116 AC_PATH_PROG(BASENAME,basename)
118 dnl allow them to override the path of perl
120 ACX_HELP_STRING([--with-perl=PATH],
121 [sets path to perl executable]),
122 with_perl=$withval,with_perl=$PERL)
123 AC_SUBST(PERL, $with_perl)
127 AC_HELP_STRING([--with-openssl=DIR],
128 [path to openssl installation]),)
131 ACX_HELP_STRING([--with-gnutls=PATH],
132 [path to gnutls installation root]),)
134 dnl you can only have one or the other
135 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
138 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
142 dnl list of possible dirs to try to autodetect openssl
143 dnl if $dir/include exists, we consider it found
144 dnl the order should allow locally installed versions to override distros' ones
145 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
150 dnl Checks for libraries.
153 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
154 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
155 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
156 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
159 dnl Check for POSIX thread libraries
160 AC_CHECK_HEADERS(pthread.h)
161 AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread",
162 AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread -lrt",-lrt))
166 dnl check for math-related functions needing -lm
167 AC_CHECK_HEADERS(math.h)
168 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
169 AC_CHECK_HEADERS(mp.h)
170 AC_CHECK_LIB(bsd,pow,MATHLIBS="$MATHLIBS -lbsd")
173 dnl Check if we buils local libtap
174 AC_ARG_ENABLE(libtap,
175 AC_HELP_STRING([--enable-libtap],
176 [Enable built-in libtap for unit-testing (default: autodetect system library).]),
177 [enable_libtap=$enableval],
179 AM_CONDITIONAL([USE_LIBTAP_LOCAL],[test "$enable_libtap" = "yes"])
181 # If not local, check if we can use the system one
182 if test "$enable_libtap" != "yes" ; then
183 dnl Check for libtap, to run perl-like tests
184 AC_CHECK_LIB(tap, plan_tests,
189 # Finally, define tests if we use libtap
190 if test "$enable_libtap" = "yes" ; then
191 EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64"
196 AC_ARG_ENABLE(extra-opts,
197 AC_HELP_STRING([--enable-extra-opts],
198 [Enables parsing of plugins ini config files for extra options (default: no)]),
199 [enable_extra_opts=$enableval],
200 [enable_extra_opts=yes])
201 AM_CONDITIONAL([USE_PARSE_INI],[test "$enable_extra_opts" = "yes"])
202 if test "$enable_extra_opts" = "yes" ; then
203 AC_DEFINE(NP_EXTRA_OPTS,[1],[Enable INI file parsing.])
204 if test "$enable_libtap" = "yes"; then
205 EXTRA_TEST="$EXTRA_TEST test_ini1 test_ini3 test_opts1 test_opts2 test_opts3"
210 dnl Check for PostgreSQL libraries
212 _SAVEDCPPFLAGS="$CPPFLAGS"
214 ACX_HELP_STRING([--with-pgsql=DIR],
215 [sets path to pgsql installation]),
217 AC_CHECK_LIB(crypt,main)
218 if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
219 if test -n "$PGSQL"; then
220 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
221 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
223 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
224 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
225 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
226 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
227 AC_CHECK_HEADERS(libpq-fe.h)
228 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
229 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
230 PGINCLUDE="-I$PGSQL/include"
231 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
232 PGLIBS="-lpq -lcrypt"
233 PGINCLUDE="-I/usr/include/pgsql"
234 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
235 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
236 PGINCLUDE="-I/usr/include/postgresql"
237 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
238 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
239 PGINCLUDE="-I$PGSQL/include"
241 if test -z "$PGINCLUDE"; then
242 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
243 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
247 EXTRAS="$EXTRAS check_pgsql\$(EXEEXT)"
250 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
251 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
252 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
255 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
256 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
259 CPPFLAGS="$_SAVEDCPPFLAGS"
261 AC_ARG_WITH([dbi], [AS_HELP_STRING([--without-dbi], [Skips the dbi plugin])])
262 dnl Check for DBI libraries
263 AS_IF([test "x$with_dbi" != "xno"], [
265 AC_CHECK_LIB(dbi,dbi_initialize)
266 if test "$ac_cv_lib_dbi_dbi_initialize" = "yes"; then
267 EXTRAS="$EXTRAS check_dbi\$(EXEEXT)"
271 AC_MSG_WARN([Skipping dbi plugin])
272 AC_MSG_WARN([install DBI libs to compile this plugin (see REQUIREMENTS).])
277 AC_ARG_WITH([radius], [AS_HELP_STRING([--without-radius], [Skips the radius plugin])])
279 dnl Check for radius libraries
280 AS_IF([test "x$with_radius" != "xno"], [
282 AC_CHECK_LIB(freeradius-client,rc_read_config)
283 if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then
284 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
285 RADIUSLIBS="-lfreeradius-client"
288 AC_CHECK_LIB(radiusclient-ng,rc_read_config)
289 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
290 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
291 RADIUSLIBS="-lradiusclient-ng"
294 AC_CHECK_LIB(radiusclient,rc_read_config)
295 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
296 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
297 RADIUSLIBS="-lradiusclient"
300 AC_MSG_WARN([Skipping radius plugin])
301 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
308 AC_ARG_WITH([ldap], [AS_HELP_STRING([--without-ldap], [Skips the LDAP plugin])])
310 dnl Check for LDAP libraries
311 AS_IF([test "x$with_ldap" != "xno"], [
313 AC_CHECK_LIB(ldap,main,,,-llber)
314 if test "$ac_cv_lib_ldap_main" = "yes"; then
315 LDAPLIBS="-lldap -llber"\
316 LDAPINCLUDE="-I/usr/include/ldap"
318 AC_SUBST(LDAPINCLUDE)
319 AC_CHECK_FUNCS(ldap_set_option)
320 EXTRAS="$EXTRAS check_ldap\$(EXEEXT)"
321 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
323 AC_MSG_WARN([Skipping LDAP plugin])
324 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
329 dnl Check for headers used by check_ide_smart
332 AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
333 if test "$FOUNDINCLUDE" = "yes" ; then
334 AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
336 if test "$FOUNDINCLUDE" = "no" ; then
337 AC_MSG_WARN([Skipping check_ide_smart plugin.])
338 AC_MSG_WARN([check_ide_smart requires linux/hdreg.h and linux/types.h.])
342 AC_CHECK_HEADER(dev/ata/atareg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
343 if test "$FOUNDINCLUDE" = "yes" ; then
344 AC_CHECK_HEADER(dev/ic/wdcreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
346 if test "$FOUNDINCLUDE" = "no" ; then
347 AC_MSG_WARN([Skipping check_ide_smart plugin.])
348 AC_MSG_WARN([check_ide_smart requires dev/ata/atareg.h and dev/ic/wdcreg.h])
352 AC_MSG_WARN([Skipping check_ide_smart plugin.])
353 AC_MSG_WARN([check_ide_smart works only on Linux and NetBSD])
356 if test "$FOUNDINCLUDE" = "yes" ; then
357 EXTRAS="$EXTRAS check_ide_smart\$(EXEEXT)"
360 dnl Check for mysql libraries
362 if test $with_mysql = "no" ; then
363 AC_MSG_WARN([Skipping mysql plugin])
364 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
366 EXTRAS="$EXTRAS check_mysql\$(EXEEXT) check_mysql_query\$(EXEEXT)"
367 MYSQLINCLUDE="$np_mysql_include"
368 MYSQLLIBS="$np_mysql_libs"
369 MYSQLCFLAGS="$np_mysql_cflags"
370 AC_SUBST(MYSQLINCLUDE)
372 AC_SUBST(MYSQLCFLAGS)
375 dnl Check for headers used by check_users
376 AC_CHECK_HEADERS(utmpx.h)
377 AM_CONDITIONAL([HAVE_UTMPX], [test "$ac_cv_header_utmpx_h" = "yes"])
379 AC_CHECK_HEADERS(wtsapi32.h, [], [], [#include <windows.h>])
380 AM_CONDITIONAL([HAVE_WTS32API], [test "$ac_cv_header_wtsapi32_h" = "yes"])
382 if test "$ac_cv_header_wtsapi32_h" = "yes"; then
383 WTSAPI32LIBS="-lwtsapi32"
384 AC_SUBST(WTSAPI32LIBS)
387 dnl Fallback to who(1) if the system doesn't provide an utmpx(5) interface
388 if test "$ac_cv_header_utmpx_h" = "no" -a "$ac_cv_header_wtsapi32_h" = "no"
390 AC_PATH_PROG(PATH_TO_WHO,who)
392 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
394 ac_cv_path_to_who="$PATH_TO_WHO -q"
396 ac_cv_path_to_who="$PATH_TO_WHO"
399 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
400 [path and arguments for invoking 'who'])
404 [AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
405 [], [with_ipv6=check])
407 dnl Check for AF_INET6 support - unistd.h required for Darwin
408 if test "$with_ipv6" != "no"; then
409 AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
411 [#ifdef HAVE_UNISTD_H
414 #include <netinet/in.h>
415 #include <sys/socket.h>],
416 [struct sockaddr_in6 sin6;
419 sin6.sin6_family = AF_INET6;
420 sin6.sin6_port = 587;
421 p = &sin6.sin6_addr;],
422 [np_cv_sys_ipv6=yes],
425 if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
426 AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
428 if test "$np_cv_sys_ipv6" = "yes"; then
429 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
431 with_ipv6="$np_cv_sys_ipv6"
435 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
436 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
437 if test "$FOUNDINCLUDE" = "no"; then
438 _SAVEDCPPFLAGS="$CPPFLAGS"
439 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
440 unset ac_cv_header_krb5_h
441 AC_CHECK_HEADERS(krb5.h,
442 KRB5INCLUDE="-I/usr/kerberos/include"
447 if test "$FOUNDINCLUDE" = "no"; then
448 CPPFLAGS="$_SAVEDCPPFLAGS"
451 dnl *** The following block comes from wget configure.ac ***
452 dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
453 dnl shared library doesn't record its dependency on libdl, so we
454 dnl need to check for it ourselves so we won't fail to link due to a
455 dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
457 AC_CHECK_LIB(dl,dlopen)
458 AC_CHECK_LIB(dl,shl_load)
460 dnl openssl detection/configuration
461 if ! test x"$with_openssl" = x"no"; then
462 dnl Check for OpenSSL location if it wasn't already specified
463 if ! test -d "$with_openssl"; then
464 for d in $OPENSSL_DIRS; do
465 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
471 _SAVEDCPPFLAGS="$CPPFLAGS"
472 _SAVEDLDFLAGS="$LDFLAGS"
473 dnl Check for OpenSSL header files
475 if test x"$with_openssl" != x"/usr" ; then
476 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
477 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
480 dnl check for openssl in $dir/include/openssl
481 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
482 SSLINCLUDE="-I$with_openssl/include"
485 dnl else check to see if $dir/include has it
486 if test "$FOUNDINCLUDE" = "no"; then
487 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
488 SSLINCLUDE="-I$with_openssl/include"
493 dnl if we didn't find it, reset CPPFLAGS
494 if test "$FOUNDINCLUDE" = "no"; then
495 CPPFLAGS="$_SAVEDCPPFLAGS"
496 LDFLAGS="$_SAVEDLDFLAGS"
499 dnl Check for crypto lib
501 LIBS="-L${with_openssl}/lib"
502 AC_CHECK_LIB(crypto,CRYPTO_lock)
503 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
504 dnl Check for SSL lib
505 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
509 dnl test headers and libs to decide whether check_http should use SSL
510 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
511 if test "$ac_cv_lib_ssl_main" = "yes"; then
512 if test "$FOUNDINCLUDE" = "yes"; then
520 dnl check for gnutls if openssl isn't found (or is disabled)
521 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
522 if test ! "$with_gnutls" = ""; then
523 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
525 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
526 if test "$FOUNDGNUTLS" = "yes"; then
527 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
530 dnl end check for gnutls
532 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
533 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
534 AC_SUBST(check_tcp_ssl)
536 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
537 if test "$FOUNDOPENSSL" = "yes"; then
538 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
542 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
547 dnl else deliberately disabled or no ssl support available
548 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
554 dnl Checks for header files.
559 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
560 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
562 dnl Checks for typedefs, structures, and compiler characteristics.
569 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
570 AC_TRY_LINK([#include <stdarg.h>
571 va_list ap1,ap2;], [va_copy(ap1,ap2);],
572 ac_cv_HAVE_VA_COPY=yes,
573 ac_cv_HAVE_VA_COPY=no)])
574 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
575 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
577 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
578 AC_TRY_LINK([#include <stdarg.h>
579 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
580 ac_cv_HAVE___VA_COPY=yes,
581 ac_cv_HAVE___VA_COPY=no)])
582 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
583 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
587 AC_TRY_COMPILE([#include <sys/time.h>],
589 struct timezone *tz;],
590 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
591 AC_TRY_COMPILE([#include <sys/time.h>],
594 gettimeofday(tv, tz);],
595 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
596 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
598 dnl Checks for library functions.
599 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
602 AC_MSG_CHECKING(return type of socket size)
603 AC_TRY_COMPILE([#include <stdlib.h>
604 #include <sys/types.h>
605 #include <sys/socket.h>],
606 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
607 ac_cv_socket_size_type=["size_t"]
608 AC_MSG_RESULT(size_t),
609 ac_cv_socket_size_type=["int"]
612 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
613 [Define type of socket size])
616 dnl #### Process table test
618 AC_PATH_PROG(PATH_TO_PS,ps)
619 AC_PATH_PROG(PATH_TO_ENV,env)
621 AC_MSG_CHECKING(for ps syntax)
622 AC_ARG_WITH(ps_command,
623 ACX_HELP_STRING([--with-ps-command=PATH],
624 [Verbatim command to execute for ps]),
626 AC_ARG_WITH(ps_format,
627 ACX_HELP_STRING([--with-ps-format=FORMAT],
628 [Format string for scanning ps output]),
631 ACX_HELP_STRING([--with-ps-cols=NUM],
632 [Number of columns in ps command]),
634 AC_ARG_WITH(ps_varlist,
635 ACX_HELP_STRING([--with-ps-varlist=LIST],
636 [Variable list for sscanf of 'ps' output]),
639 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
640 ac_cv_ps_command="$PS_COMMAND"
641 ac_cv_ps_format="$PS_FORMAT"
642 ac_cv_ps_varlist="$PS_VARLIST"
643 ac_cv_ps_cols="$PS_COLS"
644 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
646 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
647 elif test "$ac_cv_uname_s" = "SunOS"; then
649 # this is a very, very ugly hack, to hardcode the location for plugins
651 if test "$libexecdir" = '${exec_prefix}/libexec'; then
652 if test "$exec_prefix" = "NONE"; then
653 if test "$prefix" = "NONE"; then
654 pst3="$ac_default_prefix/libexec/pst3"
656 pst3="$prefix/libexec/pst3"
659 pst3="$exec_prefix/libexec/pst3"
662 pst3="$libexecdir/pst3"
664 ac_cv_ps_command="$pst3"
665 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
666 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
668 AC_MSG_RESULT([using monitoring-plugins internal ps command (pst3) for solaris])
669 if test `isainfo -b` = 64 ; then
671 AC_MSG_NOTICE([using 64bit pst3])
673 AC_MSG_NOTICE([using 32bit pst3])
675 EXTRAS_ROOT="$EXTRAS_ROOT pst3\$(EXEEXT)"
677 if test "$pst3_use_64bit" = 1; then
678 dnl Test if we can actually compile code in 64bit
680 CFLAGS="$CFLAGS -m64"
683 [AC_LANG_PROGRAM([], [
684 return sizeof(void*) == 8 ? 0 : 1;
690 AC_MSG_NOTICE([using -m64 for 64bit code])
693 AC_MSG_NOTICE([compiler do not like -m64])
696 if test "$pst3_64bit_working" = 0; then
698 CFLAGS="$CFLAGS -xarch=v9"
700 [AC_LANG_PROGRAM([], [
701 return sizeof(void*) == 8 ? 0 : 1;
704 PST3CFLAGS="-xarch=v9"
707 AC_MSG_NOTICE([using -xarch=v9 for 64bit code])
710 AC_MSG_NOTICE([compiler do not like -xarch=v9])
714 if test "$pst3_64bit_working" = 0; then
716 CFLAGS="$CFLAGS -xarch=amd64"
718 [AC_LANG_PROGRAM([], [
719 return sizeof(void*) == 8 ? 0 : 1;
722 PST3CFLAGS="-xarch=amd64"
725 AC_MSG_NOTICE([using -xarch=amd64 for 64bit code])
728 AC_MSG_NOTICE([compiler do not like -xarch=amd64])
732 if test "$pst3_64bit_working" = 0; then
733 AC_MSG_ERROR([I don't know how to build a 64-bit object!])
737 dnl Removing this for the moment - Ton
738 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
739 dnl Limitation that command name is not available
740 dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
741 dnl egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
743 dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
744 dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
745 dnl ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
747 dnl AC_MSG_RESULT([$ac_cv_ps_command])
749 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
750 dnl so test for this first...
751 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
752 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
754 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
755 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
756 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
758 AC_MSG_RESULT([$ac_cv_ps_command])
760 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
761 dnl Should also work for FreeBSD 5.2.1 and 5.3
762 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
763 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
764 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
766 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
767 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
768 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
770 AC_MSG_RESULT([$ac_cv_ps_command])
772 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
773 dnl Limitation: Only first 16 chars returned for ucomm field
774 dnl Must come before ps -weo
775 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
776 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
778 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
779 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
780 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
782 AC_MSG_RESULT([$ac_cv_ps_command])
784 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
785 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
786 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
788 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
789 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
790 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
792 AC_MSG_RESULT([$ac_cv_ps_command])
795 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
796 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
798 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
799 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
800 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
802 AC_MSG_RESULT([$ac_cv_ps_command])
804 dnl BSD-like mode in RH 6.1
805 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
806 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
808 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
809 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
810 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
812 AC_MSG_RESULT([$ac_cv_ps_command])
815 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
816 dnl Need the head -1 otherwise test will work because arguments are found
817 elif ps -laxnwww 2>/dev/null | head -1 | \
818 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
820 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
821 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
822 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
824 AC_MSG_RESULT([$ac_cv_ps_command])
826 dnl Debian Linux / procps v1.2.9:
827 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
828 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
830 elif ps laxnwww 2>/dev/null | \
831 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
833 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
834 ac_cv_ps_command="$PATH_TO_PS laxnwww"
835 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
837 AC_MSG_RESULT([$ac_cv_ps_command])
839 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
840 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
841 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
843 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
844 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
845 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
847 AC_MSG_RESULT([$ac_cv_ps_command])
849 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
850 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
851 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
852 dnl of 1500). Will need big changes to check_procs to support
853 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
854 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
856 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
857 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
858 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
860 AC_MSG_RESULT([$ac_cv_ps_command])
862 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
863 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
865 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
866 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
867 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
869 AC_MSG_RESULT([$ac_cv_ps_command])
871 dnl AIX 4.3.3 and 5.1 do not have an rss field
872 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
873 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
875 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
876 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
877 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
879 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
882 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
883 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
885 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
886 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
887 # There must be no space between the %s and %n due to a wierd problem in sscanf where
888 # it will return %n as longer than the line length
889 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
891 AC_MSG_RESULT([$ac_cv_ps_command])
893 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
894 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
896 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
897 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
898 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
900 AC_MSG_RESULT([$ac_cv_ps_command])
902 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
903 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
905 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
906 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
907 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
909 AC_MSG_RESULT([$ac_cv_ps_command])
911 dnl wonder who takes state instead of stat
912 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
913 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
915 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
916 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
917 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
919 AC_MSG_RESULT([$ac_cv_ps_command])
922 elif ps -el 2>/dev/null | \
923 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
925 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
926 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
927 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
929 AC_MSG_RESULT([$ac_cv_ps_command])
932 elif ps -el 2>/dev/null | \
933 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
935 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
936 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
937 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
939 AC_MSG_RESULT([$ac_cv_ps_command])
942 dnl S UID RUID USER RUSER PID PPID VSZ %CPU COMMAND COMMAND
943 dnl S 0 400 root oracle 2805 1 12904 0.00 ora_dism_SEA1X ora_dism_SEA1X
944 dnl S 400 400 oracle oracle 19261 1 126488 0.00 tnslsnr /u01/app/oracle/product/db/11.2.0.3/bin/tnslsnr LISTENER -inherit
945 elif env UNIX95=1 ps -eo 'state uid ruid user ruser pid ppid vsz pcpu comm args' 2>/dev/null | head -n 1 | \
946 egrep -i ["^ *S +UID +RUID +USER +RUSER +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
948 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
949 ac_cv_ps_command="$PATH_TO_ENV UNIX95=1 $PATH_TO_PS -eo 'state uid pid ppid vsz pcpu comm args'"
950 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
952 AC_MSG_RESULT([$ac_cv_ps_command])
955 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
956 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
957 elif ps -el 2>/dev/null | \
958 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
960 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
961 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
962 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
964 AC_MSG_RESULT([$ac_cv_ps_command])
967 elif ps glaxen 2>/dev/null | \
968 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
970 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
971 ac_cv_ps_command="$PATH_TO_PS glaxen"
972 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
974 AC_MSG_RESULT([$ac_cv_ps_command])
977 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
978 dnl Some truncation will happen in UCOMM column
979 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
980 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
981 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
982 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
984 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
985 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
986 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
988 AC_MSG_RESULT([$ac_cv_ps_command])
991 elif ps -Al 2>/dev/null | \
992 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
994 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
995 ac_cv_ps_command="$PATH_TO_PS -Al"
996 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
998 AC_MSG_RESULT([$ac_cv_ps_command])
1001 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
1004 if test -n "$ac_cv_ps_varlist" ; then
1005 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
1006 [Variable list for sscanf of 'ps' output])
1007 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
1008 [Verbatim command to execute for ps in check_procs])
1009 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
1010 [Format string for scanning ps output in check_procs])
1011 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
1012 [Number of columns in ps command])
1013 EXTRAS="$EXTRAS check_procs check_nagios\$(EXEEXT)"
1014 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
1015 AC_DEFINE(PS_USES_PROCETIME,"yes",
1016 [Whether the ps utility uses the "procetime" field])
1020 AC_PATH_PROG(PATH_TO_PING,ping)
1021 AC_PATH_PROG(PATH_TO_PING6,ping6)
1023 AC_ARG_WITH(ping_command,
1024 ACX_HELP_STRING([--with-ping-command=SYNTAX],
1025 [sets syntax for ICMP ping]),
1026 with_ping_command=$withval,)
1028 AC_MSG_CHECKING(for ICMP ping syntax)
1029 ac_cv_ping_packets_first=no
1030 ac_cv_ping_has_timeout=no
1031 if test -n "$with_ping_command"
1033 AC_MSG_RESULT([(command-line) $with_ping_command])
1034 if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null
1036 ac_cv_ping_packets_first=yes
1037 ac_cv_ping_has_timeout=yes
1038 elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \
1039 echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null
1041 ac_cv_ping_has_timeout=yes
1042 elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null
1044 ac_cv_ping_packets_first=yes
1047 elif [[ "z$ac_cv_uname_o" = "zCygwin" ]]
1049 with_ping_command="$PATH_TO_PING -n %d -w %d000 %s"
1050 ac_cv_ping_packets_first=yes
1051 ac_cv_ping_has_timeout=yes
1052 AC_MSG_RESULT([$with_ping_command])
1054 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1055 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1056 egrep -i "^round-trip|^rtt" >/dev/null
1058 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1059 ac_cv_ping_packets_first=yes
1060 AC_MSG_RESULT([$with_ping_command])
1062 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
1063 egrep -i "^round-trip|^rtt" >/dev/null
1065 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
1066 ac_cv_ping_packets_first=yes
1067 ac_cv_ping_has_timeout=yes
1068 AC_MSG_RESULT([$with_ping_command])
1070 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
1071 egrep -i "^round-trip|^rtt" >/dev/null
1073 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1074 ac_cv_ping_packets_first=yes
1075 AC_MSG_RESULT([$with_ping_command])
1077 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1078 egrep -i "^round-trip|^rtt" >/dev/null
1080 with_ping_command="$PATH_TO_PING -n -c %d %s"
1081 ac_cv_ping_packets_first=yes
1082 AC_MSG_RESULT([$with_ping_command])
1084 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
1085 egrep -i "^round-trip|^rtt" >/dev/null
1087 with_ping_command="$PATH_TO_PING -n %s -c %d"
1088 AC_MSG_RESULT([$with_ping_command])
1090 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1091 egrep -i "^round-trip|^rtt" >/dev/null
1093 with_ping_command="$PATH_TO_PING %s -n %d"
1094 AC_MSG_RESULT([$with_ping_command])
1096 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1097 egrep -i "^round-trip|^rtt" >/dev/null
1099 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1100 AC_MSG_RESULT([$with_ping_command])
1102 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1103 egrep -i "^round-trip|^rtt" >/dev/null
1105 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1106 AC_MSG_RESULT([$with_ping_command])
1108 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1109 egrep -i "^round-trip|^rtt" >/dev/null
1111 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1112 ac_cv_ping_packets_first=yes
1113 AC_MSG_RESULT([$with_ping_command])
1115 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1116 egrep -i "^round-trip|^rtt" >/dev/null
1118 with_ping_command="$PATH_TO_PING -n -c %d %s"
1119 ac_cv_ping_packets_first=yes
1120 AC_MSG_RESULT([$with_ping_command])
1123 AC_MSG_WARN([unable to find usable ping syntax])
1126 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1127 [path and args for ICMP ping command])
1129 if test "x$ac_cv_ping_packets_first" != "xno"
1131 AC_DEFINE(PING_PACKETS_FIRST,1,
1132 [Define if packet count must precede host])
1135 if test "x$ac_cv_ping_has_timeout" != "xno"
1137 AC_DEFINE(PING_HAS_TIMEOUT,1,
1138 [Define if ping has its own timeout option that should be set])
1141 AC_ARG_WITH(ping6_command,
1142 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1143 [sets syntax for ICMPv6 ping]),
1144 with_ping6_command=$withval,)
1146 if test x"$with_ipv6" != xno ; then
1147 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1148 ac_cv_ping6_packets_first=no
1149 if test -n "$with_ping6_command"
1151 AC_MSG_RESULT([(command-line) $with_ping6_command])
1152 if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null
1154 ac_cv_ping6_packets_first=yes
1155 elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \
1156 echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null
1158 # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout
1160 elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null
1162 ac_cv_ping6_packets_first=yes
1164 elif [[ "z$ac_cv_uname_o" = "zCygwin" -a "x$PATH_TO_PING" != "x" ]]; then
1165 with_ping6_command="$PATH_TO_PING -6 -n %d -w %d000 %s"
1166 ac_cv_ping6_packets_first=yes
1167 ac_cv_ping_has_timeout=yes
1168 AC_MSG_RESULT([$with_ping6_command])
1169 elif test "x$PATH_TO_PING6" != "x"; then
1170 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1171 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1172 egrep -i "^round-trip|^rtt" >/dev/null
1174 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1175 ac_cv_ping6_packets_first=yes
1176 AC_MSG_RESULT([$with_ping6_command])
1178 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
1179 egrep -i "^round-trip|^rtt" >/dev/null
1181 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
1182 ac_cv_ping6_packets_first=yes
1183 ac_cv_ping_has_timeout=yes
1184 AC_MSG_RESULT([$with_ping6_command])
1186 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1187 egrep -i "^round-trip|^rtt" >/dev/null
1189 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1190 ac_cv_ping6_packets_first=yes
1191 AC_MSG_RESULT([$with_ping6_command])
1193 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1194 egrep -i "^round-trip|^rtt" >/dev/null
1196 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1197 ac_cv_ping6_packets_first=yes
1198 AC_MSG_RESULT([$with_ping6_command])
1200 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1201 egrep -i "^round-trip|^rtt" >/dev/null
1203 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1204 AC_MSG_RESULT([$with_ping6_command])
1206 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1207 egrep -i "^round-trip|^rtt" >/dev/null
1209 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1210 AC_MSG_RESULT([$with_ping6_command])
1212 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1213 egrep -i "^round-trip|^rtt" >/dev/null
1215 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1216 AC_MSG_RESULT([$with_ping6_command])
1218 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1219 egrep -i "^round-trip|^rtt" >/dev/null
1221 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1222 AC_MSG_RESULT([$with_ping6_command])
1224 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1225 egrep -i "^round-trip|^rtt" >/dev/null
1227 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1228 ac_cv_ping6_packets_first=yes
1229 AC_MSG_RESULT([$with_ping_command])
1231 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1232 egrep -i "^round-trip|^rtt" >/dev/null
1234 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1235 ac_cv_ping6_packets_first=yes
1236 AC_MSG_RESULT([$with_ping6_command])
1240 elif test "x$PATH_TO_PING" != "x"; then
1241 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1242 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1243 egrep -i "^round-trip|^rtt" >/dev/null
1245 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1246 ac_cv_ping6_packets_first=yes
1247 AC_MSG_RESULT([$with_ping6_command])
1249 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1250 egrep -i "^round-trip|^rtt" >/dev/null
1252 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1253 ac_cv_ping6_packets_first=yes
1254 AC_MSG_RESULT([$with_ping6_command])
1256 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1257 egrep -i "^round-trip|^rtt" >/dev/null
1259 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1260 ac_cv_ping6_packets_first=yes
1261 AC_MSG_RESULT([$with_ping6_command])
1263 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1264 egrep -i "^round-trip|^rtt" >/dev/null
1266 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1267 AC_MSG_RESULT([$with_ping6_command])
1269 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1270 egrep -i "^round-trip|^rtt" >/dev/null
1272 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1273 AC_MSG_RESULT([$with_ping6_command])
1275 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1276 egrep -i "^round-trip|^rtt" >/dev/null
1278 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1279 AC_MSG_RESULT([$with_ping6_command])
1281 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1282 egrep -i "^round-trip|^rtt" >/dev/null
1284 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1285 AC_MSG_RESULT([$with_ping6_command])
1287 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1288 egrep -i "^round-trip|^rtt" >/dev/null
1290 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1291 ac_cv_ping6_packets_first=yes
1292 AC_MSG_RESULT([$with_ping_command])
1294 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1295 egrep -i "^round-trip|^rtt" >/dev/null
1297 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1298 ac_cv_ping6_packets_first=yes
1299 AC_MSG_RESULT([$with_ping6_command])
1305 if test "x$with_ping6_command" != "x"; then
1306 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1307 [path and args for ICMPv6 ping command])
1309 AC_MSG_RESULT([none])
1312 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1313 AC_DEFINE(PING6_PACKETS_FIRST,1,
1314 [Define if packet count must precede host])
1319 AC_ARG_WITH(nslookup_command,
1320 ACX_HELP_STRING([--with-nslookup-command=PATH],
1321 [sets path to nslookup executable]),
1322 ac_cv_nslookup_command=$withval)
1323 if test -n "$ac_cv_nslookup_command"; then
1324 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1326 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1327 if test -n "$PATH_TO_NSLOOKUP"
1329 AC_MSG_CHECKING(for nslookup syntax)
1330 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1332 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1333 AC_MSG_RESULT([$ac_cv_nslookup_command])
1336 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1337 AC_MSG_RESULT([$ac_cv_nslookup_command])
1341 AC_MSG_WARN([nslookup command not found])
1345 if test -n "$ac_cv_nslookup_command"; then
1346 EXTRAS="$EXTRAS check_dns\$(EXEEXT)"
1347 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1350 AC_MSG_CHECKING([for number of online cpus])
1351 AC_TRY_COMPILE([#include <unistd.h>],
1352 [sysconf(_SC_NPROCESSORS_ONLN) > 0;],
1353 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_ONLN,1,[Define if sysconf returns number of online cpus])
1354 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_ONLN)]),
1355 AC_MSG_RESULT([cannot calculate])
1358 AC_MSG_CHECKING([for number of available cpus])
1359 AC_TRY_COMPILE([#include <unistd.h>],
1360 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1361 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of available cpus])
1362 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1363 AC_MSG_RESULT([cannot calculate])
1366 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1367 AC_ARG_WITH(uptime_command,
1368 ACX_HELP_STRING([--with-uptime-command=PATH],
1369 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1370 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1372 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1373 AC_ARG_WITH(rpcinfo_command,
1374 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1375 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1376 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1378 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1379 if test -x "$PATH_TO_LMSTAT"
1381 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1383 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1386 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1387 AC_ARG_WITH(smbclient_command,
1388 ACX_HELP_STRING([--with-smbclient-command=PATH],
1389 [sets path to smbclient]),
1390 PATH_TO_SMBCLIENT=$withval)
1391 if test -n "$PATH_TO_SMBCLIENT"
1393 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1395 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1398 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1399 AC_ARG_WITH(snmpget_command,
1400 ACX_HELP_STRING([--with-snmpget-command=PATH],
1401 [Path to snmpget command]),
1402 PATH_TO_SNMPGET=$withval)
1403 if test -n "$PATH_TO_SNMPGET"
1405 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1406 EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)"
1408 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1411 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1412 AC_ARG_WITH(snmpgetnext_command,
1413 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1414 [Path to snmpgetnext command]),
1415 PATH_TO_SNMPGETNEXT=$withval)
1416 if test -n "$PATH_TO_SNMPGETNEXT"
1418 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1421 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1423 AC_MSG_CHECKING(for Net::SNMP perl module)
1424 AC_MSG_RESULT([found])
1426 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1429 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1430 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1431 AC_ARG_WITH(qstat_command,
1432 ACX_HELP_STRING([--with-qstat-command=PATH],
1433 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1435 if test -x "$PATH_TO_QUAKESTAT"
1437 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1438 EXTRAS="$EXTRAS check_game\$(EXEEXT)"
1440 elif test -n "$PATH_TO_QSTAT"
1442 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1443 EXTRAS="$EXTRAS check_game\$(EXEEXT)"
1445 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1448 if test $ac_cv_path_to_qstat
1450 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1451 [path to qstat/quakestat])
1454 AC_PATH_PROG(PATH_TO_FPING,fping)
1455 AC_PATH_PROG(PATH_TO_FPING6,fping6)
1457 AC_ARG_WITH(fping_command,
1458 ACX_HELP_STRING([--with-fping-command=PATH],
1459 [Path to fping command]), PATH_TO_FPING=$withval)
1460 AC_ARG_WITH(fping6_command,
1461 ACX_HELP_STRING([--with-fping6-command=PATH],
1462 [Path to fping6 command]), PATH_TO_FPING6=$withval)
1464 if test -n "$PATH_TO_FPING"
1466 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1467 EXTRAS="$EXTRAS check_fping\$(EXEEXT)"
1468 if test x"$with_ipv6" != xno && test -n "$PATH_TO_FPING6"; then
1469 AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
1472 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1475 AC_PATH_PROG(PATH_TO_SSH,ssh)
1476 AC_ARG_WITH(ssh_command,
1477 ACX_HELP_STRING([--with-ssh-command=PATH],
1478 [sets path for ssh]), PATH_TO_SSH=$withval)
1479 if test -n "$PATH_TO_SSH"
1481 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1482 EXTRAS="$EXTRAS check_by_ssh\$(EXEEXT)"
1484 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1487 AC_PATH_PROG(PATH_TO_SUDO,sudo)
1488 AC_ARG_WITH(sudo_command,
1489 ACX_HELP_STRING([--with-sudo-command=PATH],
1490 [sets path to sudo]), PATH_TO_SUDO=$withval)
1491 if test -n "$PATH_TO_SUDO"
1493 AC_DEFINE_UNQUOTED(PATH_TO_SUDO,"$PATH_TO_SUDO",[path to sudo])
1495 AC_MSG_WARN([Could not find sudo or eqivalent])
1498 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1499 AC_ARG_WITH(mailq_command,
1500 ACX_HELP_STRING([--with-mailq-command=PATH],
1501 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1502 if test -n "$PATH_TO_MAILQ"
1504 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1506 AC_MSG_WARN([Could not find mailq or eqivalent])
1509 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1510 AC_ARG_WITH(qmail_qstat_command,
1511 ACX_HELP_STRING([--with-qmail-qstat-command=PATH],
1512 [sets path to qmail-qstat]), PATH_TO_QMAIL_QSTAT=$withval)
1513 if test -n "$PATH_TO_QMAIL_QSTAT"
1515 AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1517 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1520 dnl SWAP info required is amount allocated/available and amount free
1521 dnl The plugin works through all the swap devices and adds up the total swap
1523 AC_PATH_PROG(PATH_TO_SWAP,swap)
1524 if (test -n "$PATH_TO_SWAP")
1526 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1527 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1530 ac_cv_swap_command="$PATH_TO_SWAP -l"
1531 if [$PATH_TO_SWAP -l 2>/dev/null | \
1532 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1535 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1536 ac_cv_swap_conv=2048
1537 AC_MSG_RESULT([using IRIX format swap])
1539 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1541 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1542 ac_cv_swap_conv=2048
1543 AC_MSG_RESULT([using Unixware format swap])
1545 dnl if we don't know what format swap's output is
1546 dnl we might as well pretend we didn't see it
1548 ac_cv_swap_command=""
1551 dnl end if for PATH_TO_SWAP
1554 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1555 if (test -n "$PATH_TO_SWAPINFO")
1557 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1558 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1561 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1563 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1565 ac_cv_swap_format=["%*s %f %*d %f"]
1566 ac_cv_swap_conv=1024
1567 AC_MSG_RESULT([using FreeBSD format swapinfo])
1570 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1573 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1574 ac_cv_swap_format=["%*s %f %*d %f"]
1575 ac_cv_swap_conv=1024
1576 AC_MSG_RESULT([using HP-UX format swapinfo])
1578 dnl end if for PATH_TO_SWAPINFO
1581 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1582 if (test -n "$PATH_TO_LSPS")
1584 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1585 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1588 ac_cv_swap_command="$PATH_TO_LSPS -a"
1589 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1591 AC_MSG_RESULT([using AIX lsps])
1593 dnl end if for PATH_TO_SWAPINFO
1597 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1598 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1599 dnl in the various BSD's
1602 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1603 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1604 #ifdef HAVE_SYS_PARAM_H
1605 #include <sys/param.h>
1608 AC_CHECK_DECLS([swapctl],,,[
1610 #include <sys/types.h>
1611 #include <sys/param.h>
1612 #include <sys/stat.h>
1613 #include <sys/swap.h>
1615 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1616 #include <sys/types.h>
1617 #include <sys/param.h>
1618 #include <sys/stat.h>
1619 #include <sys/swap.h>
1621 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1623 #include <sys/types.h>
1624 #include <sys/param.h>
1625 #include <sys/stat.h>
1626 #include <sys/swap.h>
1629 if test "$ac_cv_have_decl_swapctl" = "yes";
1631 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1632 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1633 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1634 "$ac_cv_type_swapent_t" = "yes";
1636 AC_MSG_RESULT([yes])
1637 ac_cv_check_swap_swapctl_svr4="1";
1638 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1639 [Define if 2-argument SVR4 swapctl exists])
1642 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1643 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1645 AC_MSG_RESULT([yes])
1646 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1647 [Define if 3-argument BSD swapctl exists])
1652 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1653 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1656 dnl the SVR4 spec returns values in pages
1658 AC_MSG_RESULT([page])
1659 AC_CHECK_DECLS([sysconf])
1660 AC_MSG_CHECKING([for system page size])
1661 if test "$ac_cv_have_decl_sysconf" = "yes";
1663 AC_MSG_RESULT([determined by sysconf(3)])
1664 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1666 AC_MSG_WARN([don't know. guessing 4096k])
1671 dnl the BSD spec returns values in blocks
1673 AC_MSG_RESULT([blocks (assuming 512b)])
1674 ac_cv_swap_conv=2048
1676 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1677 [Conversion factor to MB])
1680 dnl end tests for the swapctl system calls
1684 if test "x$ac_cv_have_swap" != "x"
1686 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1687 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1689 if test "x$ac_cv_swap_command" != "x"
1691 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1692 [Path to swap/swapinfo binary, with any args])
1693 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1694 [Format string for parsing swap output])
1695 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1696 [Conversion factor to MB])
1699 AC_ARG_WITH(proc-meminfo,
1700 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1701 [path to /proc/meminfo or equivalent]),
1702 ac_cv_proc_meminfo=$withval)
1703 dnl dunno why this does not work below - use hack (kbd)
1704 dnl fine on linux, broken on solaris
1705 dnl if /bin/test -e "/proc/meminfo"
1706 AC_MSG_CHECKING([for /proc/meminfo])
1707 if test -n "$ac_cv_proc_meminfo"; then
1708 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1709 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1710 AC_MSG_RESULT([found /proc/meminfo])
1711 ac_cv_proc_meminfo="/proc/meminfo"
1716 if test -n "$ac_cv_proc_meminfo"; then
1717 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1718 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1719 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1722 AC_PATH_PROG(PATH_TO_DIG,dig)
1723 AC_ARG_WITH(dig_command,
1724 ACX_HELP_STRING([--with-dig-command=PATH],
1725 [Path to dig command]), PATH_TO_DIG=$withval)
1726 if test -n "$PATH_TO_DIG"; then
1727 EXTRAS="$EXTRAS check_dig\$(EXEEXT)"
1728 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1731 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1732 AC_ARG_WITH(apt-get_command,
1733 ACX_HELP_STRING([--with-apt-get-command=PATH],
1734 [Path to apt-get command]),
1735 with_apt_get_command=$withval,
1736 with_apt_get_command=$PATH_TO_APTGET)
1737 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1738 if test -n "$PATH_TO_APTGET" ; then
1739 EXTRAS="$EXTRAS check_apt\$(EXEEXT)"
1743 if test -f $srcdir/plugins/check_nt.c ; then
1744 EXTRAS="$EXTRAS check_nt\$(EXEEXT)"
1748 dnl used in check_dhcp
1749 AC_CHECK_HEADERS(sys/sockio.h)
1753 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1756 AC_DEFINE(__linux__,1,[linux specific code in check_dhcp.c])
1759 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1762 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1767 AC_SUBST(EXTRAS_ROOT)
1768 AC_SUBST(EXTRA_NETOBJS)
1771 AM_GNU_GETTEXT([external], [need-ngettext])
1772 AM_GNU_GETTEXT_VERSION(0.15)
1774 dnl Check for Redhat spopen problem
1775 dnl Wierd problem where ECHILD is returned from a wait call in error
1776 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1777 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1778 dnl We patch plugins/popen.c
1779 dnl Need to add smp because uname different on those
1780 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1781 AC_ARG_ENABLE(redhat-pthread-workaround,
1782 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1783 [force Redhat patch to be applied (default: test system)]),
1784 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1785 [ac_cv_enable_redhat_pthread_workaround=test])
1786 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1787 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1788 AC_MSG_NOTICE([See https://www.monitoring-plugins.org/doc/faq/configure-hangs.html if this next part takes a long time])
1789 AC_MSG_CHECKING(for redhat spopen problem)
1790 ( cd config_test && make && make test ) > /dev/null 2>&1
1791 if test $? -eq 0 ; then
1794 AC_MSG_RESULT(error)
1795 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1798 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1799 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1803 AC_ARG_ENABLE(perl-modules,
1804 AC_HELP_STRING([--enable-perl-modules],
1805 [Enables installation of Monitoring::Plugin and its dependencies (default: no)]),
1806 [enable_perl_modules=$enableval],
1807 [enable_perl_modules=no])
1808 if test "$enable_perl_modules" = "yes" ; then
1809 AC_SUBST(PERLMODS_DIR,perlmods)
1812 # From Tap configure
1813 # Checks for libraries
1816 LDFLAGS="$LDFLAGS -pthread"
1820 AC_CHECK_LIB(pthread, main)
1824 dnl External libraries - see ACKNOWLEDGEMENTS
1827 dnl Some helpful common compile errors checked here
1828 if test "$ac_cv_uname_s" = 'SunOS' -a \( "x$ac_cv_prog_ac_ct_AR" = "x" -o "$ac_cv_prog_ac_ct_AR" = 'false' \) ; then
1829 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1838 plugins-root/Makefile
1839 plugins-scripts/Makefile
1840 plugins-scripts/utils.pm
1841 plugins-scripts/utils.sh
1849 dnl the ones below that are commented out need to be cleaned up
1850 dnl in the configure code above to use with_foo instead of ac_cv_foo
1851 dnl if we want them to show up here. it'd also make the code cleaner.
1852 dnl i'll get to that on another rainy day :) -sf
1853 ACX_FEATURE([with],[apt-get-command])
1854 dnl ACX_FEATURE([with],[dig-command])
1855 dnl ACX_FEATURE([with],[fping-command])
1856 dnl ACX_FEATURE([with],[mailq-command])
1857 dnl ACX_FEATURE([with],[nslookup-command])
1858 ACX_FEATURE([with],[ping6-command])
1859 ACX_FEATURE([with],[ping-command])
1860 dnl ACX_FEATURE([with],[qstat-command])
1861 dnl ACX_FEATURE([with],[rpcinfo-command])
1862 dnl ACX_FEATURE([with],[smbclient-command])
1863 dnl ACX_FEATURE([with],[snmpget-command])
1864 dnl ACX_FEATURE([with],[snmpgetnext-command])
1865 dnl ACX_FEATURE([with],[ssh-command])
1866 dnl ACX_FEATURE([with],[uptime-command])
1868 dnl ACX_FEATURE([with],[proc-meminfo])
1869 dnl ACX_FEATURE([with],[ps-command])
1870 dnl ACX_FEATURE([with],[ps-format])
1871 dnl ACX_FEATURE([with],[ps-cols])
1872 dnl ACX_FEATURE([with],[ps-varlist])
1874 ACX_FEATURE([with],[ipv6])
1875 ACX_FEATURE([with],[mysql])
1876 ACX_FEATURE([with],[openssl])
1877 ACX_FEATURE([with],[gnutls])
1878 ACX_FEATURE([enable],[extra-opts])
1879 ACX_FEATURE([with],[perl])
1880 ACX_FEATURE([enable],[perl-modules])
1881 ACX_FEATURE([with],[cgiurl])
1882 ACX_FEATURE([with],[trusted-path])
1883 ACX_FEATURE([enable],[libtap])