1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(monitoring-plugins,2.3git)
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])
9 AM_MAINTAINER_MODE([enable])
10 AC_CONFIG_HEADERS([config.h])
13 DEFAULT_PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
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
53 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
55 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
56 AC_SUBST(PLUGIN_TEST)dnl
58 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
59 AC_SUBST(SCRIPT_TEST)dnl
61 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"
64 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"
67 dnl CGIURL has changed for Nagios with 1.0 beta
69 ACX_HELP_STRING([--with-cgiurl=DIR],
70 [sets URL for cgi programs]),
72 with_cgiurl=/nagios/cgi-bin)
74 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
76 AC_ARG_WITH(trusted_path,
77 ACX_HELP_STRING([--with-trusted-path=PATH],
78 [sets trusted path for executables called by scripts]),
79 with_trusted_path=$withval,
80 with_trusted_path=$DEFAULT_PATH)
81 AC_SUBST(with_trusted_path)
85 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
87 LDFLAGS="$LDFLAGS -L."
89 ac_cv_uname_m=`uname -m`
90 ac_cv_uname_s=`uname -s`
91 ac_cv_uname_r=`uname -r`
92 ac_cv_uname_v=`uname -v`
93 ac_cv_uname_o=`uname -o`
96 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
97 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
100 AC_SUBST(REV_DATESTAMP)
101 AC_SUBST(REV_TIMESTAMP)
103 dnl Check if version file is present
104 AM_CONDITIONAL([RELEASE_PRESENT], [test -f $srcdir/release])
106 # Also read in the version from it
107 if test -f $srcdir/release; then
108 NP_RELEASE="$(<release)"
110 NP_RELEASE="$PACKAGE_VERSION"
114 dnl Checks for programs.
115 AC_PATH_PROG(PERL,perl)
116 AC_PATH_PROG(HOSTNAME,hostname)
117 AC_PATH_PROG(BASENAME,basename)
119 dnl allow them to override the path of perl
121 ACX_HELP_STRING([--with-perl=PATH],
122 [sets path to perl executable]),
123 with_perl=$withval,with_perl=$PERL)
124 AC_SUBST(PERL, $with_perl)
128 AC_HELP_STRING([--with-openssl=DIR],
129 [path to openssl installation]),)
132 ACX_HELP_STRING([--with-gnutls=PATH],
133 [path to gnutls installation root]),)
135 dnl you can only have one or the other
136 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
139 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
143 dnl list of possible dirs to try to autodetect openssl
144 dnl if $dir/include exists, we consider it found
145 dnl the order should allow locally installed versions to override distros' ones
146 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
151 dnl Checks for libraries.
154 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
155 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
156 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
157 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
161 dnl check for math-related functions needing -lm
162 AC_CHECK_HEADERS(math.h)
163 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
164 AC_CHECK_HEADERS(mp.h)
165 AC_CHECK_LIB(bsd,pow,MATHLIBS="$MATHLIBS -lbsd")
168 dnl Check if we buils local libtap
169 AC_ARG_ENABLE(libtap,
170 AC_HELP_STRING([--enable-libtap],
171 [Enable built-in libtap for unit-testing (default: autodetect system library).]),
172 [enable_libtap=$enableval],
174 AM_CONDITIONAL([USE_LIBTAP_LOCAL],[test "$enable_libtap" = "yes"])
176 # If not local, check if we can use the system one
177 if test "$enable_libtap" != "yes" ; then
178 dnl Check for libtap, to run perl-like tests
179 AC_CHECK_LIB(tap, plan_tests,
184 # Finally, define tests if we use libtap
185 if test "$enable_libtap" = "yes" ; then
186 EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64"
191 AC_ARG_ENABLE(extra-opts,
192 AC_HELP_STRING([--enable-extra-opts],
193 [Enables parsing of plugins ini config files for extra options (default: no)]),
194 [enable_extra_opts=$enableval],
195 [enable_extra_opts=yes])
196 AM_CONDITIONAL([USE_PARSE_INI],[test "$enable_extra_opts" = "yes"])
197 if test "$enable_extra_opts" = "yes" ; then
198 AC_DEFINE(NP_EXTRA_OPTS,[1],[Enable INI file parsing.])
199 if test "$enable_libtap" = "yes"; then
200 EXTRA_TEST="$EXTRA_TEST test_ini1 test_ini3 test_opts1 test_opts2 test_opts3"
205 dnl Check for PostgreSQL libraries
207 _SAVEDCPPFLAGS="$CPPFLAGS"
209 ACX_HELP_STRING([--with-pgsql=DIR],
210 [sets path to pgsql installation]),
212 AC_CHECK_LIB(crypt,main)
213 if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
214 if test -n "$PGSQL"; then
215 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
216 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
218 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
219 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
220 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
221 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
222 AC_CHECK_HEADERS(libpq-fe.h)
223 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
224 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
225 PGINCLUDE="-I$PGSQL/include"
226 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
227 PGLIBS="-lpq -lcrypt"
228 PGINCLUDE="-I/usr/include/pgsql"
229 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
230 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
231 PGINCLUDE="-I/usr/include/postgresql"
232 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
233 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
234 PGINCLUDE="-I$PGSQL/include"
236 if test -z "$PGINCLUDE"; then
237 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
238 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
242 EXTRAS="$EXTRAS check_pgsql\$(EXEEXT)"
245 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
246 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
247 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
250 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
251 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
254 CPPFLAGS="$_SAVEDCPPFLAGS"
256 AC_ARG_WITH([dbi], [AS_HELP_STRING([--without-dbi], [Skips the dbi plugin])])
257 dnl Check for DBI libraries
258 AS_IF([test "x$with_dbi" != "xno"], [
260 AC_CHECK_LIB(dbi,dbi_initialize)
261 if test "$ac_cv_lib_dbi_dbi_initialize" = "yes"; then
262 EXTRAS="$EXTRAS check_dbi\$(EXEEXT)"
266 AC_MSG_WARN([Skipping dbi plugin])
267 AC_MSG_WARN([install DBI libs to compile this plugin (see REQUIREMENTS).])
272 AC_ARG_WITH([radius], [AS_HELP_STRING([--without-radius], [Skips the radius plugin])])
274 dnl Check for radius libraries
275 AS_IF([test "x$with_radius" != "xno"], [
277 AC_CHECK_LIB(radcli,rc_read_config)
278 if test "$ac_cv_lib_radcli_rc_read_config" = "yes"; then
279 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
280 RADIUSLIBS="-lradcli"
283 AC_CHECK_LIB(freeradius-client,rc_read_config)
284 if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then
285 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
286 RADIUSLIBS="-lfreeradius-client"
289 AC_CHECK_LIB(radiusclient-ng,rc_read_config)
290 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
291 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
292 RADIUSLIBS="-lradiusclient-ng"
295 AC_CHECK_LIB(radiusclient,rc_read_config)
296 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
297 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
298 RADIUSLIBS="-lradiusclient"
301 AC_MSG_WARN([Skipping radius plugin])
302 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
310 AC_ARG_WITH([ldap], [AS_HELP_STRING([--without-ldap], [Skips the LDAP plugin])])
312 dnl Check for LDAP libraries
313 AS_IF([test "x$with_ldap" != "xno"], [
315 AC_CHECK_LIB(ldap,main,,,-llber)
316 if test "$ac_cv_lib_ldap_main" = "yes"; then
317 LDAPLIBS="-lldap -llber"\
318 LDAPINCLUDE="-I/usr/include/ldap"
320 AC_SUBST(LDAPINCLUDE)
321 AC_CHECK_FUNCS(ldap_set_option)
322 EXTRAS="$EXTRAS check_ldap\$(EXEEXT)"
323 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
325 AC_MSG_WARN([Skipping LDAP plugin])
326 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
332 AC_ARG_WITH([systemd], [AS_HELP_STRING([--without-systemd], [Skips systemd support])])
334 dnl Check for libsystemd
335 AS_IF([test "x$with_systemd" != "xno"], [
337 AC_CHECK_LIB(systemd,sd_get_sessions,,,-lsystemd)
338 if test "$ac_cv_lib_systemd_sd_get_sessions" = "yes"; then
339 SYSTEMDLIBS="-lsystemd"
341 AC_SUBST(SYSTEMDLIBS)
342 AC_SUBST(SYSTEMDINCLUDE)
344 AC_MSG_WARN([Skipping systemd support])
350 dnl Check for headers used by check_ide_smart
353 AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
354 if test "$FOUNDINCLUDE" = "yes" ; then
355 AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
357 if test "$FOUNDINCLUDE" = "no" ; then
358 AC_MSG_WARN([Skipping check_ide_smart plugin.])
359 AC_MSG_WARN([check_ide_smart requires linux/hdreg.h and linux/types.h.])
363 AC_CHECK_HEADER(dev/ata/atareg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
364 if test "$FOUNDINCLUDE" = "yes" ; then
365 AC_CHECK_HEADER(dev/ic/wdcreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
367 if test "$FOUNDINCLUDE" = "no" ; then
368 AC_MSG_WARN([Skipping check_ide_smart plugin.])
369 AC_MSG_WARN([check_ide_smart requires dev/ata/atareg.h and dev/ic/wdcreg.h])
373 AC_MSG_WARN([Skipping check_ide_smart plugin.])
374 AC_MSG_WARN([check_ide_smart works only on Linux and NetBSD])
377 if test "$FOUNDINCLUDE" = "yes" ; then
378 EXTRAS="$EXTRAS check_ide_smart\$(EXEEXT)"
381 dnl Check for mysql libraries
383 if test $with_mysql = "no" ; then
384 AC_MSG_WARN([Skipping mysql plugin])
385 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
387 EXTRAS="$EXTRAS check_mysql\$(EXEEXT) check_mysql_query\$(EXEEXT)"
388 MYSQLINCLUDE="$np_mysql_include"
389 MYSQLLIBS="$np_mysql_libs"
390 MYSQLCFLAGS="$np_mysql_cflags"
391 AC_SUBST(MYSQLINCLUDE)
393 AC_SUBST(MYSQLCFLAGS)
396 dnl Check for headers used by check_users
397 AC_CHECK_HEADERS(utmpx.h)
398 AM_CONDITIONAL([HAVE_UTMPX], [test "$ac_cv_header_utmpx_h" = "yes"])
400 AC_CHECK_HEADERS(wtsapi32.h, [], [], [#include <windows.h>])
401 AM_CONDITIONAL([HAVE_WTS32API], [test "$ac_cv_header_wtsapi32_h" = "yes"])
403 if test "$ac_cv_header_wtsapi32_h" = "yes"; then
404 WTSAPI32LIBS="-lwtsapi32"
405 AC_SUBST(WTSAPI32LIBS)
408 _can_enable_check_curl=no
409 dnl Check for cURL library
410 LIBCURL_CHECK_CONFIG(yes, 7.15.2, [
411 _can_enable_check_curl=yes
412 LIBCURLINCLUDE="$LIBCURL_CPPFLAGS"
413 LIBCURLLIBS="$LIBCURL"
414 LIBCURLCFLAGS="$LIBCURL_CPPFLAGS"
415 AC_SUBST(LIBCURLINCLUDE)
416 AC_SUBST(LIBCURLLIBS)
417 AC_SUBST(LIBCURLCFLAGS)
419 _can_enable_check_curl=no
420 AC_MSG_WARN([Skipping curl plugin])
421 AC_MSG_WARN([install libcurl libs to compile this plugin (see REQUIREMENTS).])
424 dnl Check for uriparser library
425 URIPARSER_CHECK(yes, 0.7.5, [
426 URIPARSERINCLUDE="$URIPARSER_CPPFLAGS"
427 URIPARSERLIBS="$URIPARSER"
428 URIPARSERCFLAGS="$URIPARSER_CPPFLAGS"
429 AC_SUBST(URIPARSERINCLUDE)
430 AC_SUBST(URIPARSERLIBS)
431 AC_SUBST(URIPARSERCFLAGS)
433 _can_enable_check_curl=no
434 AC_MSG_WARN([Skipping curl plugin])
435 AC_MSG_WARN([install the uriparser library to compile this plugin (see REQUIREMENTS).])
438 dnl prerequisites met, enable the plugin
439 if test x$_can_enable_check_curl = xyes; then
440 EXTRAS="$EXTRAS check_curl\$(EXEEXT)"
442 AC_CONFIG_FILES([plugins/picohttpparser/Makefile])
444 dnl Fallback to who(1) if the system doesn't provide an utmpx(5) interface
445 if test "$ac_cv_header_utmpx_h" = "no" -a "$ac_cv_header_wtsapi32_h" = "no"
447 AC_PATH_PROG(PATH_TO_WHO,who)
449 if [$PATH_TO_WHO -q 2>/dev/null | grep -E -i "^# users=[0-9]+$" >/dev/null]
451 ac_cv_path_to_who="$PATH_TO_WHO -q"
453 ac_cv_path_to_who="$PATH_TO_WHO"
456 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
457 [path and arguments for invoking 'who'])
461 [AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
462 [], [with_ipv6=check])
464 dnl Check for AF_INET6 support - unistd.h required for Darwin
465 if test "$with_ipv6" != "no"; then
466 AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
468 [#ifdef HAVE_UNISTD_H
471 #include <netinet/in.h>
472 #include <sys/socket.h>],
473 [struct sockaddr_in6 sin6;
476 sin6.sin6_family = AF_INET6;
477 sin6.sin6_port = 587;
478 p = &sin6.sin6_addr;],
479 [np_cv_sys_ipv6=yes],
482 if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
483 AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
485 if test "$np_cv_sys_ipv6" = "yes"; then
486 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
488 with_ipv6="$np_cv_sys_ipv6"
492 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
493 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
494 if test "$FOUNDINCLUDE" = "no"; then
495 _SAVEDCPPFLAGS="$CPPFLAGS"
496 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
497 unset ac_cv_header_krb5_h
498 AC_CHECK_HEADERS(krb5.h,
499 KRB5INCLUDE="-I/usr/kerberos/include"
504 if test "$FOUNDINCLUDE" = "no"; then
505 CPPFLAGS="$_SAVEDCPPFLAGS"
508 dnl *** The following block comes from wget configure.ac ***
509 dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
510 dnl shared library doesn't record its dependency on libdl, so we
511 dnl need to check for it ourselves so we won't fail to link due to a
512 dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
514 AC_CHECK_LIB(dl,dlopen)
515 AC_CHECK_LIB(dl,shl_load)
517 dnl openssl detection/configuration
518 if ! test x"$with_openssl" = x"no"; then
519 dnl Check for OpenSSL location if it wasn't already specified
520 if ! test -d "$with_openssl"; then
521 for d in $OPENSSL_DIRS; do
522 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
528 _SAVEDCPPFLAGS="$CPPFLAGS"
529 _SAVEDLDFLAGS="$LDFLAGS"
530 dnl Check for OpenSSL header files
532 if test x"$with_openssl" != x"/usr" ; then
533 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
534 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
537 dnl check for openssl in $dir/include/openssl
538 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
539 SSLINCLUDE="-I$with_openssl/include"
542 dnl else check to see if $dir/include has it
543 if test "$FOUNDINCLUDE" = "no"; then
544 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
545 SSLINCLUDE="-I$with_openssl/include"
550 dnl if we didn't find it, reset CPPFLAGS
551 if test "$FOUNDINCLUDE" = "no"; then
552 CPPFLAGS="$_SAVEDCPPFLAGS"
553 LDFLAGS="$_SAVEDLDFLAGS"
556 dnl Check for crypto lib
558 LIBS="-L${with_openssl}/lib"
559 AC_CHECK_LIB(crypto,CRYPTO_new_ex_data)
560 if test "$ac_cv_lib_crypto_CRYPTO_new_ex_data" = "yes"; then
561 dnl Check for SSL lib
562 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
566 dnl test headers and libs to decide whether check_http should use SSL
567 if test "$ac_cv_lib_crypto_CRYPTO_new_ex_data" = "yes"; then
568 if test "$ac_cv_lib_ssl_main" = "yes"; then
569 if test "$FOUNDINCLUDE" = "yes"; then
577 dnl check for gnutls if openssl isn't found (or is disabled)
578 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
579 if test ! "$with_gnutls" = ""; then
580 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
582 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
583 if test "$FOUNDGNUTLS" = "yes"; then
584 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
587 dnl end check for gnutls
589 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
590 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
591 AC_SUBST(check_tcp_ssl)
593 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
594 if test "$FOUNDOPENSSL" = "yes"; then
595 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
599 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
604 dnl else deliberately disabled or no ssl support available
605 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
611 dnl Checks for header files.
616 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
617 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
619 dnl Checks for typedefs, structures, and compiler characteristics.
626 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
627 AC_TRY_LINK([#include <stdarg.h>
628 va_list ap1,ap2;], [va_copy(ap1,ap2);],
629 ac_cv_HAVE_VA_COPY=yes,
630 ac_cv_HAVE_VA_COPY=no)])
631 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
632 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
634 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
635 AC_TRY_LINK([#include <stdarg.h>
636 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
637 ac_cv_HAVE___VA_COPY=yes,
638 ac_cv_HAVE___VA_COPY=no)])
639 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
640 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
644 AC_TRY_COMPILE([#include <sys/time.h>],
646 struct timezone *tz;],
647 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
648 AC_TRY_COMPILE([#include <sys/time.h>],
651 gettimeofday(tv, tz);],
652 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
653 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
655 dnl Checks for library functions.
656 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
659 AC_MSG_CHECKING(return type of socket size)
660 AC_TRY_COMPILE([#include <stdlib.h>
661 #include <sys/types.h>
662 #include <sys/socket.h>],
663 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
664 ac_cv_socket_size_type=["size_t"]
665 AC_MSG_RESULT(size_t),
666 ac_cv_socket_size_type=["int"]
669 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
670 [Define type of socket size])
673 dnl #### Process table test
675 AC_PATH_PROG(PATH_TO_PS,ps)
676 AC_PATH_PROG(PATH_TO_ENV,env)
678 AC_MSG_CHECKING(for ps syntax)
679 AC_ARG_WITH(ps_command,
680 ACX_HELP_STRING([--with-ps-command=PATH],
681 [Verbatim command to execute for ps]),
683 AC_ARG_WITH(ps_format,
684 ACX_HELP_STRING([--with-ps-format=FORMAT],
685 [Format string for scanning ps output]),
688 ACX_HELP_STRING([--with-ps-cols=NUM],
689 [Number of columns in ps command]),
691 AC_ARG_WITH(ps_varlist,
692 ACX_HELP_STRING([--with-ps-varlist=LIST],
693 [Variable list for sscanf of 'ps' output]),
696 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
697 ac_cv_ps_command="$PS_COMMAND"
698 ac_cv_ps_format="$PS_FORMAT"
699 ac_cv_ps_varlist="$PS_VARLIST"
700 ac_cv_ps_cols="$PS_COLS"
701 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
703 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
704 elif test "$ac_cv_uname_s" = "SunOS"; then
706 # this is a very, very ugly hack, to hardcode the location for plugins
708 if test "$libexecdir" = '${exec_prefix}/libexec'; then
709 if test "$exec_prefix" = "NONE"; then
710 if test "$prefix" = "NONE"; then
711 pst3="$ac_default_prefix/libexec/pst3"
713 pst3="$prefix/libexec/pst3"
716 pst3="$exec_prefix/libexec/pst3"
719 pst3="$libexecdir/pst3"
721 ac_cv_ps_command="$pst3"
722 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
723 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
725 AC_MSG_RESULT([using monitoring-plugins internal ps command (pst3) for solaris])
726 if test `isainfo -b` = 64 ; then
728 AC_MSG_NOTICE([using 64bit pst3])
730 AC_MSG_NOTICE([using 32bit pst3])
732 EXTRAS_ROOT="$EXTRAS_ROOT pst3\$(EXEEXT)"
734 if test "$pst3_use_64bit" = 1; then
735 dnl Test if we can actually compile code in 64bit
737 CFLAGS="$CFLAGS -m64"
740 [AC_LANG_PROGRAM([], [
741 return sizeof(void*) == 8 ? 0 : 1;
747 AC_MSG_NOTICE([using -m64 for 64bit code])
750 AC_MSG_NOTICE([compiler do not like -m64])
753 if test "$pst3_64bit_working" = 0; then
755 CFLAGS="$CFLAGS -xarch=v9"
757 [AC_LANG_PROGRAM([], [
758 return sizeof(void*) == 8 ? 0 : 1;
761 PST3CFLAGS="-xarch=v9"
764 AC_MSG_NOTICE([using -xarch=v9 for 64bit code])
767 AC_MSG_NOTICE([compiler do not like -xarch=v9])
771 if test "$pst3_64bit_working" = 0; then
773 CFLAGS="$CFLAGS -xarch=amd64"
775 [AC_LANG_PROGRAM([], [
776 return sizeof(void*) == 8 ? 0 : 1;
779 PST3CFLAGS="-xarch=amd64"
782 AC_MSG_NOTICE([using -xarch=amd64 for 64bit code])
785 AC_MSG_NOTICE([compiler do not like -xarch=amd64])
789 if test "$pst3_64bit_working" = 0; then
790 AC_MSG_ERROR([I don't know how to build a 64-bit object!])
794 dnl Removing this for the moment - Ton
795 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
796 dnl Limitation that command name is not available
797 dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
798 dnl grep -E -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
800 dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
801 dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
802 dnl ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
804 dnl AC_MSG_RESULT([$ac_cv_ps_command])
806 dnl This one is the exact same test as the next one but includes etime
807 elif ps axwo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
808 grep -E -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +ELAPSED +COMMAND"] > /dev/null
810 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
811 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu etime comm args'"
812 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
814 AC_MSG_RESULT([$ac_cv_ps_command])
816 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
817 dnl so test for this first...
818 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
819 grep -E -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
821 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
822 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
823 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
825 AC_MSG_RESULT([$ac_cv_ps_command])
827 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
828 dnl Should also work for FreeBSD 5.2.1 and 5.3
829 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
830 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
831 grep -E -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
833 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
834 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
835 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
837 AC_MSG_RESULT([$ac_cv_ps_command])
839 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
840 dnl Limitation: Only first 16 chars returned for ucomm field
841 dnl Must come before ps -weo
842 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
843 grep -E -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
845 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
846 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
847 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
849 AC_MSG_RESULT([$ac_cv_ps_command])
851 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
852 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
853 grep -E -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
855 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
856 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
857 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
859 AC_MSG_RESULT([$ac_cv_ps_command])
862 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
863 grep -E -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
865 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
866 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
867 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
869 AC_MSG_RESULT([$ac_cv_ps_command])
871 dnl BSD-like mode in RH 6.1
872 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
873 grep -E -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
875 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
876 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
877 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
879 AC_MSG_RESULT([$ac_cv_ps_command])
882 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
883 dnl Need the head -1 otherwise test will work because arguments are found
884 elif ps -laxnwww 2>/dev/null | head -1 | \
885 grep -E -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
887 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
888 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
889 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
891 AC_MSG_RESULT([$ac_cv_ps_command])
893 dnl Debian Linux / procps v1.2.9:
894 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
895 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
897 elif ps laxnwww 2>/dev/null | \
898 grep -E -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
900 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
901 ac_cv_ps_command="$PATH_TO_PS laxnwww"
902 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
904 AC_MSG_RESULT([$ac_cv_ps_command])
906 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
907 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
908 grep -E -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
910 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
911 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
912 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
914 AC_MSG_RESULT([$ac_cv_ps_command])
916 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
917 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
918 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
919 dnl of 1500). Will need big changes to check_procs to support
920 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
921 grep -E -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
923 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
924 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
925 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
927 AC_MSG_RESULT([$ac_cv_ps_command])
929 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
930 grep -E -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
932 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
933 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
934 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
936 AC_MSG_RESULT([$ac_cv_ps_command])
938 dnl AIX 4.3.3 and 5.1 do not have an rss field
939 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
940 grep -E -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
942 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
943 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
944 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
946 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
949 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
950 grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
952 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
953 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
954 # There must be no space between the %s and %n due to a weird problem in sscanf where
955 # it will return %n as longer than the line length
956 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
958 AC_MSG_RESULT([$ac_cv_ps_command])
960 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
961 grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
963 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
964 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
965 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
967 AC_MSG_RESULT([$ac_cv_ps_command])
969 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
970 grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
972 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
973 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
974 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
976 AC_MSG_RESULT([$ac_cv_ps_command])
978 dnl wonder who takes state instead of stat
979 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
980 grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
982 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
983 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
984 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
986 AC_MSG_RESULT([$ac_cv_ps_command])
989 elif ps -el 2>/dev/null | \
990 grep -E -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
992 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
993 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
994 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
996 AC_MSG_RESULT([$ac_cv_ps_command])
999 elif ps -el 2>/dev/null | \
1000 grep -E -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
1002 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
1003 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
1004 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
1006 AC_MSG_RESULT([$ac_cv_ps_command])
1009 dnl S UID RUID USER RUSER PID PPID VSZ %CPU COMMAND COMMAND
1010 dnl S 0 400 root oracle 2805 1 12904 0.00 ora_dism_SEA1X ora_dism_SEA1X
1011 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
1012 elif env UNIX95=1 ps -eo 'state uid ruid user ruser pid ppid vsz pcpu comm args' 2>/dev/null | head -n 1 | \
1013 grep -E -i ["^ *S +UID +RUID +USER +RUSER +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
1015 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
1016 ac_cv_ps_command="$PATH_TO_ENV UNIX95=1 $PATH_TO_PS -eo 'state uid pid ppid vsz pcpu comm args'"
1017 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
1019 AC_MSG_RESULT([$ac_cv_ps_command])
1022 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
1023 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
1024 elif ps -el 2>/dev/null | \
1025 grep -E -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
1027 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
1028 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
1029 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
1031 AC_MSG_RESULT([$ac_cv_ps_command])
1034 elif ps glaxen 2>/dev/null | \
1035 grep -E -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
1037 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
1038 ac_cv_ps_command="$PATH_TO_PS glaxen"
1039 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
1041 AC_MSG_RESULT([$ac_cv_ps_command])
1044 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
1045 dnl Some truncation will happen in UCOMM column
1046 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
1047 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
1048 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
1049 grep -E -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
1051 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
1052 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
1053 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
1055 AC_MSG_RESULT([$ac_cv_ps_command])
1058 elif ps -Al 2>/dev/null | \
1059 grep -E -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
1061 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
1062 ac_cv_ps_command="$PATH_TO_PS -Al"
1063 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
1065 AC_MSG_RESULT([$ac_cv_ps_command])
1068 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
1071 if test -n "$ac_cv_ps_varlist" ; then
1072 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
1073 [Variable list for sscanf of 'ps' output])
1074 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
1075 [Verbatim command to execute for ps in check_procs])
1076 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
1077 [Format string for scanning ps output in check_procs])
1078 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
1079 [Number of columns in ps command])
1080 EXTRAS="$EXTRAS check_procs check_nagios\$(EXEEXT)"
1081 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
1082 AC_DEFINE(PS_USES_PROCETIME,"yes",
1083 [Whether the ps utility uses the "procetime" field])
1085 if echo "$ac_cv_ps_varlist" | grep "procpcpu" >/dev/null; then
1086 AC_DEFINE(PS_USES_PROCPCPU,"yes",
1087 [Whether the ps utility uses the "procpcpu" field])
1091 AC_PATH_PROG(PATH_TO_PING,ping)
1092 AC_PATH_PROG(PATH_TO_PING6,ping6)
1094 AC_ARG_WITH(ping_command,
1095 ACX_HELP_STRING([--with-ping-command=SYNTAX],
1096 [sets syntax for ICMP ping]),
1097 with_ping_command=$withval,)
1099 AC_MSG_CHECKING(for ICMP ping syntax)
1100 ac_cv_ping_packets_first=no
1101 ac_cv_ping_has_timeout=no
1102 if test -n "$with_ping_command"
1104 AC_MSG_RESULT([(command-line) $with_ping_command])
1105 if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null
1107 ac_cv_ping_packets_first=yes
1108 ac_cv_ping_has_timeout=yes
1109 elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \
1110 echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null
1112 ac_cv_ping_has_timeout=yes
1113 elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null
1115 ac_cv_ping_packets_first=yes
1118 elif [[ "z$ac_cv_uname_o" = "zCygwin" ]]
1120 with_ping_command="$PATH_TO_PING -n %d -w %d000 %s"
1121 ac_cv_ping_packets_first=yes
1122 ac_cv_ping_has_timeout=yes
1123 AC_MSG_RESULT([$with_ping_command])
1125 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1126 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1127 grep -E -i "^round-trip|^rtt" >/dev/null
1129 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1130 ac_cv_ping_packets_first=yes
1131 AC_MSG_RESULT([$with_ping_command])
1133 elif $PATH_TO_PING -4 -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
1134 grep -E -i "^round-trip|^rtt" >/dev/null
1136 # check if -4 is supported - issue #1550
1137 with_ping_command="$PATH_TO_PING -4 -n -U -w %d -c %d %s"
1138 ac_cv_ping_packets_first=yes
1139 ac_cv_ping_has_timeout=yes
1140 AC_MSG_RESULT([$with_ping_command])
1141 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
1142 grep -E -i "^round-trip|^rtt" >/dev/null
1144 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
1145 ac_cv_ping_packets_first=yes
1146 ac_cv_ping_has_timeout=yes
1147 AC_MSG_RESULT([$with_ping_command])
1149 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
1150 grep -E -i "^round-trip|^rtt" >/dev/null
1152 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1153 ac_cv_ping_packets_first=yes
1154 AC_MSG_RESULT([$with_ping_command])
1156 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1157 grep -E -i "^round-trip|^rtt" >/dev/null
1159 with_ping_command="$PATH_TO_PING -n -c %d %s"
1160 ac_cv_ping_packets_first=yes
1161 AC_MSG_RESULT([$with_ping_command])
1163 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
1164 grep -E -i "^round-trip|^rtt" >/dev/null
1166 with_ping_command="$PATH_TO_PING -n %s -c %d"
1167 AC_MSG_RESULT([$with_ping_command])
1169 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1170 grep -E -i "^round-trip|^rtt" >/dev/null
1172 with_ping_command="$PATH_TO_PING %s -n %d"
1173 AC_MSG_RESULT([$with_ping_command])
1175 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1176 grep -E -i "^round-trip|^rtt" >/dev/null
1178 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1179 AC_MSG_RESULT([$with_ping_command])
1181 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1182 grep -E -i "^round-trip|^rtt" >/dev/null
1184 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1185 AC_MSG_RESULT([$with_ping_command])
1187 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1188 grep -E -i "^round-trip|^rtt" >/dev/null
1190 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1191 ac_cv_ping_packets_first=yes
1192 AC_MSG_RESULT([$with_ping_command])
1194 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1195 grep -E -i "^round-trip|^rtt" >/dev/null
1197 with_ping_command="$PATH_TO_PING -n -c %d %s"
1198 ac_cv_ping_packets_first=yes
1199 AC_MSG_RESULT([$with_ping_command])
1202 AC_MSG_WARN([unable to find usable ping syntax])
1205 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1206 [path and args for ICMP ping command])
1208 if test "x$ac_cv_ping_packets_first" != "xno"
1210 AC_DEFINE(PING_PACKETS_FIRST,1,
1211 [Define if packet count must precede host])
1214 if test "x$ac_cv_ping_has_timeout" != "xno"
1216 AC_DEFINE(PING_HAS_TIMEOUT,1,
1217 [Define if ping has its own timeout option that should be set])
1220 AC_ARG_WITH(ping6_command,
1221 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1222 [sets syntax for ICMPv6 ping]),
1223 with_ping6_command=$withval,)
1225 if test x"$with_ipv6" != xno ; then
1226 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1227 ac_cv_ping6_packets_first=no
1228 if test -n "$with_ping6_command"
1230 AC_MSG_RESULT([(command-line) $with_ping6_command])
1231 if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null
1233 ac_cv_ping6_packets_first=yes
1234 elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \
1235 echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null
1237 # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout
1239 elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null
1241 ac_cv_ping6_packets_first=yes
1243 elif [[ "z$ac_cv_uname_o" = "zCygwin" -a "x$PATH_TO_PING" != "x" ]]; then
1244 with_ping6_command="$PATH_TO_PING -6 -n %d -w %d000 %s"
1245 ac_cv_ping6_packets_first=yes
1246 ac_cv_ping_has_timeout=yes
1247 AC_MSG_RESULT([$with_ping6_command])
1248 elif test "x$PATH_TO_PING6" != "x"; then
1249 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1250 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1251 grep -E -i "^round-trip|^rtt" >/dev/null
1253 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1254 ac_cv_ping6_packets_first=yes
1255 AC_MSG_RESULT([$with_ping6_command])
1257 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
1258 grep -E -i "^round-trip|^rtt" >/dev/null
1260 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
1261 ac_cv_ping6_packets_first=yes
1262 ac_cv_ping_has_timeout=yes
1263 AC_MSG_RESULT([$with_ping6_command])
1265 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1266 grep -E -i "^round-trip|^rtt" >/dev/null
1268 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1269 ac_cv_ping6_packets_first=yes
1270 AC_MSG_RESULT([$with_ping6_command])
1272 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1273 grep -E -i "^round-trip|^rtt" >/dev/null
1275 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1276 ac_cv_ping6_packets_first=yes
1277 AC_MSG_RESULT([$with_ping6_command])
1279 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1280 grep -E -i "^round-trip|^rtt" >/dev/null
1282 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1283 AC_MSG_RESULT([$with_ping6_command])
1285 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1286 grep -E -i "^round-trip|^rtt" >/dev/null
1288 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1289 AC_MSG_RESULT([$with_ping6_command])
1291 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1292 grep -E -i "^round-trip|^rtt" >/dev/null
1294 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1295 AC_MSG_RESULT([$with_ping6_command])
1297 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1298 grep -E -i "^round-trip|^rtt" >/dev/null
1300 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1301 AC_MSG_RESULT([$with_ping6_command])
1303 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1304 grep -E -i "^round-trip|^rtt" >/dev/null
1306 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1307 ac_cv_ping6_packets_first=yes
1308 AC_MSG_RESULT([$with_ping_command])
1310 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1311 grep -E -i "^round-trip|^rtt" >/dev/null
1313 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1314 ac_cv_ping6_packets_first=yes
1315 AC_MSG_RESULT([$with_ping6_command])
1319 elif test "x$PATH_TO_PING" != "x"; then
1320 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1321 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1322 grep -E -i "^round-trip|^rtt" >/dev/null
1324 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1325 ac_cv_ping6_packets_first=yes
1326 AC_MSG_RESULT([$with_ping6_command])
1328 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1329 grep -E -i "^round-trip|^rtt" >/dev/null
1331 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1332 ac_cv_ping6_packets_first=yes
1333 AC_MSG_RESULT([$with_ping6_command])
1335 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1336 grep -E -i "^round-trip|^rtt" >/dev/null
1338 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1339 ac_cv_ping6_packets_first=yes
1340 AC_MSG_RESULT([$with_ping6_command])
1342 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1343 grep -E -i "^round-trip|^rtt" >/dev/null
1345 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1346 AC_MSG_RESULT([$with_ping6_command])
1348 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1349 grep -E -i "^round-trip|^rtt" >/dev/null
1351 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1352 AC_MSG_RESULT([$with_ping6_command])
1354 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1355 grep -E -i "^round-trip|^rtt" >/dev/null
1357 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1358 AC_MSG_RESULT([$with_ping6_command])
1360 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1361 grep -E -i "^round-trip|^rtt" >/dev/null
1363 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1364 AC_MSG_RESULT([$with_ping6_command])
1366 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1367 grep -E -i "^round-trip|^rtt" >/dev/null
1369 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1370 ac_cv_ping6_packets_first=yes
1371 AC_MSG_RESULT([$with_ping_command])
1373 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1374 grep -E -i "^round-trip|^rtt" >/dev/null
1376 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1377 ac_cv_ping6_packets_first=yes
1378 AC_MSG_RESULT([$with_ping6_command])
1384 if test "x$with_ping6_command" != "x"; then
1385 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1386 [path and args for ICMPv6 ping command])
1388 AC_MSG_RESULT([none])
1391 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1392 AC_DEFINE(PING6_PACKETS_FIRST,1,
1393 [Define if packet count must precede host])
1398 AC_ARG_WITH(nslookup_command,
1399 ACX_HELP_STRING([--with-nslookup-command=PATH],
1400 [sets path to nslookup executable]),
1401 ac_cv_nslookup_command=$withval)
1402 if test -n "$ac_cv_nslookup_command"; then
1403 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1405 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1406 if test -n "$PATH_TO_NSLOOKUP"
1408 AC_MSG_CHECKING(for nslookup syntax)
1409 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1411 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1412 AC_MSG_RESULT([$ac_cv_nslookup_command])
1415 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1416 AC_MSG_RESULT([$ac_cv_nslookup_command])
1420 AC_MSG_WARN([nslookup command not found])
1424 if test -n "$ac_cv_nslookup_command"; then
1425 EXTRAS="$EXTRAS check_dns\$(EXEEXT)"
1426 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1429 AC_MSG_CHECKING([for number of online cpus])
1430 AC_TRY_COMPILE([#include <unistd.h>],
1431 [sysconf(_SC_NPROCESSORS_ONLN) > 0;],
1432 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_ONLN,1,[Define if sysconf returns number of online cpus])
1433 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_ONLN)]),
1434 AC_MSG_RESULT([cannot calculate])
1437 AC_MSG_CHECKING([for number of available cpus])
1438 AC_TRY_COMPILE([#include <unistd.h>],
1439 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1440 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of available cpus])
1441 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1442 AC_MSG_RESULT([cannot calculate])
1445 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1446 AC_ARG_WITH(uptime_command,
1447 ACX_HELP_STRING([--with-uptime-command=PATH],
1448 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1449 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1451 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1452 AC_ARG_WITH(rpcinfo_command,
1453 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1454 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1455 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1457 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1458 if test -x "$PATH_TO_LMSTAT"
1460 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1462 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1465 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1466 AC_ARG_WITH(smbclient_command,
1467 ACX_HELP_STRING([--with-smbclient-command=PATH],
1468 [sets path to smbclient]),
1469 PATH_TO_SMBCLIENT=$withval)
1470 if test -n "$PATH_TO_SMBCLIENT"
1472 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1474 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1477 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1478 AC_ARG_WITH(snmpget_command,
1479 ACX_HELP_STRING([--with-snmpget-command=PATH],
1480 [Path to snmpget command]),
1481 PATH_TO_SNMPGET=$withval)
1482 if test -n "$PATH_TO_SNMPGET"
1484 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1485 EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)"
1487 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1490 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1491 AC_ARG_WITH(snmpgetnext_command,
1492 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1493 [Path to snmpgetnext command]),
1494 PATH_TO_SNMPGETNEXT=$withval)
1495 if test -n "$PATH_TO_SNMPGETNEXT"
1497 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1500 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1502 AC_MSG_CHECKING(for Net::SNMP perl module)
1503 AC_MSG_RESULT([found])
1505 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1508 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1509 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1510 AC_ARG_WITH(qstat_command,
1511 ACX_HELP_STRING([--with-qstat-command=PATH],
1512 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1514 if test -x "$PATH_TO_QUAKESTAT"
1516 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1517 EXTRAS="$EXTRAS check_game\$(EXEEXT)"
1519 elif test -n "$PATH_TO_QSTAT"
1521 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1522 EXTRAS="$EXTRAS check_game\$(EXEEXT)"
1524 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1527 if test $ac_cv_path_to_qstat
1529 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1530 [path to qstat/quakestat])
1533 AC_PATH_PROG(PATH_TO_FPING,fping)
1534 AC_PATH_PROG(PATH_TO_FPING6,fping6)
1536 AC_ARG_WITH(fping_command,
1537 ACX_HELP_STRING([--with-fping-command=PATH],
1538 [Path to fping command]), PATH_TO_FPING=$withval)
1539 AC_ARG_WITH(fping6_command,
1540 ACX_HELP_STRING([--with-fping6-command=PATH],
1541 [Path to fping6 command]), PATH_TO_FPING6=$withval)
1543 if test -n "$PATH_TO_FPING"
1545 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1546 EXTRAS="$EXTRAS check_fping\$(EXEEXT)"
1547 if test x"$with_ipv6" != xno && test -n "$PATH_TO_FPING6"; then
1548 AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
1551 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1554 AC_PATH_PROG(PATH_TO_SSH,ssh)
1555 AC_ARG_WITH(ssh_command,
1556 ACX_HELP_STRING([--with-ssh-command=PATH],
1557 [sets path for ssh]), PATH_TO_SSH=$withval)
1558 if test -n "$PATH_TO_SSH"
1560 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1561 EXTRAS="$EXTRAS check_by_ssh\$(EXEEXT)"
1563 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1566 AC_PATH_PROG(PATH_TO_SUDO,sudo)
1567 AC_ARG_WITH(sudo_command,
1568 ACX_HELP_STRING([--with-sudo-command=PATH],
1569 [sets path to sudo]), PATH_TO_SUDO=$withval)
1570 if test -n "$PATH_TO_SUDO"
1572 AC_DEFINE_UNQUOTED(PATH_TO_SUDO,"$PATH_TO_SUDO",[path to sudo])
1574 AC_MSG_WARN([Could not find sudo or equivalent])
1577 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1578 AC_ARG_WITH(mailq_command,
1579 ACX_HELP_STRING([--with-mailq-command=PATH],
1580 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1581 if test -n "$PATH_TO_MAILQ"
1583 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1585 AC_MSG_WARN([Could not find mailq or equivalent])
1588 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1589 AC_ARG_WITH(qmail_qstat_command,
1590 ACX_HELP_STRING([--with-qmail-qstat-command=PATH],
1591 [sets path to qmail-qstat]), PATH_TO_QMAIL_QSTAT=$withval)
1592 if test -n "$PATH_TO_QMAIL_QSTAT"
1594 AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1596 AC_MSG_WARN([Could not find qmail-qstat or equivalent])
1599 dnl SWAP info required is amount allocated/available and amount free
1600 dnl The plugin works through all the swap devices and adds up the total swap
1602 AC_PATH_PROG(PATH_TO_SWAP,swap)
1603 if (test -n "$PATH_TO_SWAP")
1605 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1606 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1609 ac_cv_swap_command="$PATH_TO_SWAP -l"
1610 if [$PATH_TO_SWAP -l 2>/dev/null | \
1611 grep -E -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1614 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %lu %lu"]
1615 ac_cv_swap_conv=2048
1616 AC_MSG_RESULT([using IRIX format swap])
1618 elif [$PATH_TO_SWAP -l 2>/dev/null | grep -E -i "^path +dev +swaplo +blocks +free" >/dev/null]
1620 ac_cv_swap_format=["%*s %*[0-9,-] %*d %lu %lu"]
1621 ac_cv_swap_conv=2048
1622 AC_MSG_RESULT([using Unixware format swap])
1624 dnl if we don't know what format swap's output is
1625 dnl we might as well pretend we didn't see it
1627 ac_cv_swap_command=""
1630 dnl end if for PATH_TO_SWAP
1633 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1634 if (test -n "$PATH_TO_SWAPINFO")
1636 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1637 if [$PATH_TO_SWAPINFO -k 2>&1 | grep -E -i "^Device" >/dev/null]
1640 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1642 if [$PATH_TO_SWAPINFO -k 2>/dev/null | grep -E -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1644 ac_cv_swap_format=["%*s %lu %*d %lu"]
1645 ac_cv_swap_conv=1024
1646 AC_MSG_RESULT([using FreeBSD format swapinfo])
1649 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | grep -E -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1652 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1653 ac_cv_swap_format=["%*s %lu %*d %lu"]
1654 ac_cv_swap_conv=1024
1655 AC_MSG_RESULT([using HP-UX format swapinfo])
1657 dnl end if for PATH_TO_SWAPINFO
1660 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1661 if (test -n "$PATH_TO_LSPS")
1663 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1664 if [$PATH_TO_LSPS -a 2>/dev/null | grep -E -i "^Page Space" > /dev/null]
1667 ac_cv_swap_command="$PATH_TO_LSPS -a"
1668 ac_cv_swap_format=["%*s %*s %*s %lu%*s %lu %*s"]
1670 AC_MSG_RESULT([using AIX lsps])
1672 dnl end if for PATH_TO_SWAPINFO
1676 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1677 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1678 dnl in the various BSD's
1681 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1682 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1683 #ifdef HAVE_SYS_PARAM_H
1684 #include <sys/param.h>
1687 AC_CHECK_DECLS([swapctl],,,[
1689 #include <sys/types.h>
1690 #include <sys/param.h>
1691 #include <sys/stat.h>
1692 #include <sys/swap.h>
1694 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1695 #include <sys/types.h>
1696 #include <sys/param.h>
1697 #include <sys/stat.h>
1698 #include <sys/swap.h>
1700 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1702 #include <sys/types.h>
1703 #include <sys/param.h>
1704 #include <sys/stat.h>
1705 #include <sys/swap.h>
1708 if test "$ac_cv_have_decl_swapctl" = "yes";
1710 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1711 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1712 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1713 "$ac_cv_type_swapent_t" = "yes";
1715 AC_MSG_RESULT([yes])
1716 ac_cv_check_swap_swapctl_svr4="1";
1717 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1718 [Define if 2-argument SVR4 swapctl exists])
1721 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1722 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1724 AC_MSG_RESULT([yes])
1725 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1726 [Define if 3-argument BSD swapctl exists])
1731 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1732 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1735 dnl the SVR4 spec returns values in pages
1737 AC_MSG_RESULT([page])
1738 AC_CHECK_DECLS([sysconf])
1739 AC_MSG_CHECKING([for system page size])
1740 if test "$ac_cv_have_decl_sysconf" = "yes";
1742 AC_MSG_RESULT([determined by sysconf(3)])
1743 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1745 AC_MSG_WARN([don't know. guessing 4096k])
1750 dnl the BSD spec returns values in blocks
1752 AC_MSG_RESULT([blocks (assuming 512b)])
1753 ac_cv_swap_conv=2048
1755 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1756 [Conversion factor to MB])
1759 dnl end tests for the swapctl system calls
1763 if test "x$ac_cv_have_swap" != "x"
1765 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1766 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1768 if test "x$ac_cv_swap_command" != "x"
1770 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1771 [Path to swap/swapinfo binary, with any args])
1772 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1773 [Format string for parsing swap output])
1774 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1775 [Conversion factor to MB])
1778 AC_ARG_WITH(proc-meminfo,
1779 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1780 [path to /proc/meminfo or equivalent]),
1781 ac_cv_proc_meminfo=$withval)
1782 dnl dunno why this does not work below - use hack (kbd)
1783 dnl fine on linux, broken on solaris
1784 dnl if /bin/test -e "/proc/meminfo"
1785 AC_MSG_CHECKING([for /proc/meminfo])
1786 if test -n "$ac_cv_proc_meminfo"; then
1787 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1788 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1789 AC_MSG_RESULT([found /proc/meminfo])
1790 ac_cv_proc_meminfo="/proc/meminfo"
1795 if test -n "$ac_cv_proc_meminfo"; then
1796 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1797 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1798 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1801 AC_PATH_PROG(PATH_TO_DIG,dig)
1802 AC_ARG_WITH(dig_command,
1803 ACX_HELP_STRING([--with-dig-command=PATH],
1804 [Path to dig command]), PATH_TO_DIG=$withval)
1805 if test -n "$PATH_TO_DIG"; then
1806 EXTRAS="$EXTRAS check_dig\$(EXEEXT)"
1807 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1810 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1811 AC_ARG_WITH(apt-get_command,
1812 ACX_HELP_STRING([--with-apt-get-command=PATH],
1813 [Path to apt-get command]),
1814 with_apt_get_command=$withval,
1815 with_apt_get_command=$PATH_TO_APTGET)
1816 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1817 if test -n "$PATH_TO_APTGET" ; then
1818 EXTRAS="$EXTRAS check_apt\$(EXEEXT)"
1822 if test -f $srcdir/plugins/check_nt.c ; then
1823 EXTRAS="$EXTRAS check_nt\$(EXEEXT)"
1827 dnl used in check_dhcp
1828 AC_CHECK_HEADERS(sys/sockio.h)
1832 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1835 AC_DEFINE(__linux__,1,[linux specific code in check_dhcp.c])
1838 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1841 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1846 AC_SUBST(EXTRAS_ROOT)
1847 AC_SUBST(EXTRA_NETOBJS)
1850 AM_GNU_GETTEXT([external], [need-ngettext])
1851 AM_GNU_GETTEXT_VERSION(0.15)
1853 dnl Check for Redhat spopen problem
1854 dnl Weird problem where ECHILD is returned from a wait call in error
1855 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1856 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1857 dnl We patch plugins/popen.c
1858 dnl Need to add smp because uname different on those
1859 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1860 AC_ARG_ENABLE(redhat-pthread-workaround,
1861 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1862 [force Redhat patch to be applied (default: test system)]),
1863 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1864 [ac_cv_enable_redhat_pthread_workaround=test])
1865 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1866 if echo $ac_cv_uname_r | grep -E "\.EL(smp)?$" >/dev/null 2>&1 ; then
1867 AC_MSG_NOTICE([See https://www.monitoring-plugins.org/doc/faq/configure-hangs.html if this next part takes a long time])
1868 AC_MSG_CHECKING(for redhat spopen problem)
1869 ( cd config_test && make && make test ) > /dev/null 2>&1
1870 if test $? -eq 0 ; then
1873 AC_MSG_RESULT(error)
1874 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1877 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1878 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1882 AC_ARG_ENABLE(perl-modules,
1883 AC_HELP_STRING([--enable-perl-modules],
1884 [Enables installation of Monitoring::Plugin and its dependencies (default: no)]),
1885 [enable_perl_modules=$enableval],
1886 [enable_perl_modules=no])
1887 if test "$enable_perl_modules" = "yes" ; then
1888 AC_SUBST(PERLMODS_DIR,perlmods)
1891 # From Tap configure
1892 # Checks for libraries
1895 LDFLAGS="$LDFLAGS -pthread"
1899 AC_CHECK_LIB(pthread, main)
1903 dnl External libraries - see ACKNOWLEDGEMENTS
1906 dnl Some helpful common compile errors checked here
1907 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
1908 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1917 plugins-root/Makefile
1918 plugins-scripts/Makefile
1919 plugins-scripts/utils.pm
1920 plugins-scripts/utils.sh
1928 dnl the ones below that are commented out need to be cleaned up
1929 dnl in the configure code above to use with_foo instead of ac_cv_foo
1930 dnl if we want them to show up here. it'd also make the code cleaner.
1931 dnl i'll get to that on another rainy day :) -sf
1932 ACX_FEATURE([with],[apt-get-command])
1933 dnl ACX_FEATURE([with],[dig-command])
1934 dnl ACX_FEATURE([with],[fping-command])
1935 dnl ACX_FEATURE([with],[mailq-command])
1936 dnl ACX_FEATURE([with],[nslookup-command])
1937 ACX_FEATURE([with],[ping6-command])
1938 ACX_FEATURE([with],[ping-command])
1939 dnl ACX_FEATURE([with],[qstat-command])
1940 dnl ACX_FEATURE([with],[rpcinfo-command])
1941 dnl ACX_FEATURE([with],[smbclient-command])
1942 dnl ACX_FEATURE([with],[snmpget-command])
1943 dnl ACX_FEATURE([with],[snmpgetnext-command])
1944 dnl ACX_FEATURE([with],[ssh-command])
1945 dnl ACX_FEATURE([with],[uptime-command])
1947 dnl ACX_FEATURE([with],[proc-meminfo])
1948 dnl ACX_FEATURE([with],[ps-command])
1949 dnl ACX_FEATURE([with],[ps-format])
1950 dnl ACX_FEATURE([with],[ps-cols])
1951 dnl ACX_FEATURE([with],[ps-varlist])
1953 ACX_FEATURE([with],[ipv6])
1954 ACX_FEATURE([with],[mysql])
1955 ACX_FEATURE([with],[openssl])
1956 ACX_FEATURE([with],[gnutls])
1957 ACX_FEATURE([enable],[extra-opts])
1958 ACX_FEATURE([with],[perl])
1959 ACX_FEATURE([enable],[perl-modules])
1960 ACX_FEATURE([with],[cgiurl])
1961 ACX_FEATURE([with],[trusted-path])
1962 ACX_FEATURE([enable],[libtap])
1963 ACX_FEATURE([with],[libcurl])
1964 ACX_FEATURE([with],[uriparser])