1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(monitoring-plugins,2.2)
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")
160 dnl check for math-related functions needing -lm
161 AC_CHECK_HEADERS(math.h)
162 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
163 AC_CHECK_HEADERS(mp.h)
164 AC_CHECK_LIB(bsd,pow,MATHLIBS="$MATHLIBS -lbsd")
167 dnl Check if we buils local libtap
168 AC_ARG_ENABLE(libtap,
169 AC_HELP_STRING([--enable-libtap],
170 [Enable built-in libtap for unit-testing (default: autodetect system library).]),
171 [enable_libtap=$enableval],
173 AM_CONDITIONAL([USE_LIBTAP_LOCAL],[test "$enable_libtap" = "yes"])
175 # If not local, check if we can use the system one
176 if test "$enable_libtap" != "yes" ; then
177 dnl Check for libtap, to run perl-like tests
178 AC_CHECK_LIB(tap, plan_tests,
183 # Finally, define tests if we use libtap
184 if test "$enable_libtap" = "yes" ; then
185 EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64"
190 AC_ARG_ENABLE(extra-opts,
191 AC_HELP_STRING([--enable-extra-opts],
192 [Enables parsing of plugins ini config files for extra options (default: no)]),
193 [enable_extra_opts=$enableval],
194 [enable_extra_opts=yes])
195 AM_CONDITIONAL([USE_PARSE_INI],[test "$enable_extra_opts" = "yes"])
196 if test "$enable_extra_opts" = "yes" ; then
197 AC_DEFINE(NP_EXTRA_OPTS,[1],[Enable INI file parsing.])
198 if test "$enable_libtap" = "yes"; then
199 EXTRA_TEST="$EXTRA_TEST test_ini1 test_ini3 test_opts1 test_opts2 test_opts3"
204 dnl Check for PostgreSQL libraries
206 _SAVEDCPPFLAGS="$CPPFLAGS"
208 ACX_HELP_STRING([--with-pgsql=DIR],
209 [sets path to pgsql installation]),
211 AC_CHECK_LIB(crypt,main)
212 if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
213 if test -n "$PGSQL"; then
214 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
215 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
217 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
218 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
219 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
220 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
221 AC_CHECK_HEADERS(libpq-fe.h)
222 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
223 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
224 PGINCLUDE="-I$PGSQL/include"
225 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
226 PGLIBS="-lpq -lcrypt"
227 PGINCLUDE="-I/usr/include/pgsql"
228 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
229 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
230 PGINCLUDE="-I/usr/include/postgresql"
231 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
232 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
233 PGINCLUDE="-I$PGSQL/include"
235 if test -z "$PGINCLUDE"; then
236 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
237 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
241 EXTRAS="$EXTRAS check_pgsql\$(EXEEXT)"
244 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
245 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
246 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
249 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
250 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
253 CPPFLAGS="$_SAVEDCPPFLAGS"
255 AC_ARG_WITH([dbi], [AS_HELP_STRING([--without-dbi], [Skips the dbi plugin])])
256 dnl Check for DBI libraries
257 AS_IF([test "x$with_dbi" != "xno"], [
259 AC_CHECK_LIB(dbi,dbi_initialize)
260 if test "$ac_cv_lib_dbi_dbi_initialize" = "yes"; then
261 EXTRAS="$EXTRAS check_dbi\$(EXEEXT)"
265 AC_MSG_WARN([Skipping dbi plugin])
266 AC_MSG_WARN([install DBI libs to compile this plugin (see REQUIREMENTS).])
271 AC_ARG_WITH([radius], [AS_HELP_STRING([--without-radius], [Skips the radius plugin])])
273 dnl Check for radius libraries
274 AS_IF([test "x$with_radius" != "xno"], [
276 AC_CHECK_LIB(radcli,rc_read_config)
277 if test "$ac_cv_lib_radcli_rc_read_config" = "yes"; then
278 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
279 RADIUSLIBS="-lradcli"
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).])
309 AC_ARG_WITH([ldap], [AS_HELP_STRING([--without-ldap], [Skips the LDAP plugin])])
311 dnl Check for LDAP libraries
312 AS_IF([test "x$with_ldap" != "xno"], [
314 AC_CHECK_LIB(ldap,main,,,-llber)
315 if test "$ac_cv_lib_ldap_main" = "yes"; then
316 LDAPLIBS="-lldap -llber"\
317 LDAPINCLUDE="-I/usr/include/ldap"
319 AC_SUBST(LDAPINCLUDE)
320 AC_CHECK_FUNCS(ldap_set_option)
321 EXTRAS="$EXTRAS check_ldap\$(EXEEXT)"
322 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
324 AC_MSG_WARN([Skipping LDAP plugin])
325 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
330 dnl Check for headers used by check_ide_smart
333 AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
334 if test "$FOUNDINCLUDE" = "yes" ; then
335 AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
337 if test "$FOUNDINCLUDE" = "no" ; then
338 AC_MSG_WARN([Skipping check_ide_smart plugin.])
339 AC_MSG_WARN([check_ide_smart requires linux/hdreg.h and linux/types.h.])
343 AC_CHECK_HEADER(dev/ata/atareg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
344 if test "$FOUNDINCLUDE" = "yes" ; then
345 AC_CHECK_HEADER(dev/ic/wdcreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
347 if test "$FOUNDINCLUDE" = "no" ; then
348 AC_MSG_WARN([Skipping check_ide_smart plugin.])
349 AC_MSG_WARN([check_ide_smart requires dev/ata/atareg.h and dev/ic/wdcreg.h])
353 AC_MSG_WARN([Skipping check_ide_smart plugin.])
354 AC_MSG_WARN([check_ide_smart works only on Linux and NetBSD])
357 if test "$FOUNDINCLUDE" = "yes" ; then
358 EXTRAS="$EXTRAS check_ide_smart\$(EXEEXT)"
361 dnl Check for mysql libraries
363 if test $with_mysql = "no" ; then
364 AC_MSG_WARN([Skipping mysql plugin])
365 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
367 EXTRAS="$EXTRAS check_mysql\$(EXEEXT) check_mysql_query\$(EXEEXT)"
368 MYSQLINCLUDE="$np_mysql_include"
369 MYSQLLIBS="$np_mysql_libs"
370 MYSQLCFLAGS="$np_mysql_cflags"
371 AC_SUBST(MYSQLINCLUDE)
373 AC_SUBST(MYSQLCFLAGS)
376 dnl Check for headers used by check_users
377 AC_CHECK_HEADERS(utmpx.h)
378 AM_CONDITIONAL([HAVE_UTMPX], [test "$ac_cv_header_utmpx_h" = "yes"])
380 AC_CHECK_HEADERS(wtsapi32.h, [], [], [#include <windows.h>])
381 AM_CONDITIONAL([HAVE_WTS32API], [test "$ac_cv_header_wtsapi32_h" = "yes"])
383 if test "$ac_cv_header_wtsapi32_h" = "yes"; then
384 WTSAPI32LIBS="-lwtsapi32"
385 AC_SUBST(WTSAPI32LIBS)
388 AC_ARG_ENABLE(check-curl,
389 AC_HELP_STRING([--enable-check-curl],
390 [Enables compilation of check_curl (default: no)]),
391 [enable_check_curl=$enableval],
392 [enable_check_curl=no])
393 if test "$enable_check_curl" = "yes" ; then
394 _can_enable_check_curl=no
396 dnl Check for cURL library
397 LIBCURL_CHECK_CONFIG(yes, 7.15.2, [
398 _can_enable_check_curl=yes
399 LIBCURLINCLUDE="$LIBCURL_CPPFLAGS"
400 LIBCURLLIBS="$LIBCURL"
401 LIBCURLCFLAGS="$LIBCURL_CPPFLAGS"
402 AC_SUBST(LIBCURLINCLUDE)
403 AC_SUBST(LIBCURLLIBS)
404 AC_SUBST(LIBCURLCFLAGS)
406 _can_enable_check_curl=no
407 AC_MSG_WARN([Skipping curl plugin])
408 AC_MSG_WARN([install libcurl libs to compile this plugin (see REQUIREMENTS).])
411 dnl Check for uriparser library
412 URIPARSER_CHECK(yes, 0.7.5, [
413 _can_enable_check_curl=yes
414 URIPARSERINCLUDE="$URIPARSER_CPPFLAGS"
415 URIPARSERLIBS="$URIPARSER"
416 URIPARSERCFLAGS="$URIPARSER_CPPFLAGS"
417 AC_SUBST(URIPARSERINCLUDE)
418 AC_SUBST(URIPARSERLIBS)
419 AC_SUBST(URIPARSERCFLAGS)
421 _can_enable_check_curl=no
422 AC_MSG_WARN([Skipping curl plugin])
423 AC_MSG_WARN([install the uriparser library to compile this plugin (see REQUIREMENTS).])
426 dnl prerequisites met, enable the plugin
427 if test x$_can_enable_check_curl = xyes; then
428 EXTRAS="$EXTRAS check_curl\$(EXEEXT)"
430 dnl Enable bundled picohttpparser library (for now)
431 AC_SUBST(PICOHTTPPARSER_DIR, picohttpparser)
434 AM_CONDITIONAL([WITH_CHECK_CURL], [test "$enable_check_curl" = "yes"])
435 AM_COND_IF([WITH_CHECK_CURL],
436 [AC_CONFIG_FILES([plugins/picohttpparser/Makefile])])
438 dnl Fallback to who(1) if the system doesn't provide an utmpx(5) interface
439 if test "$ac_cv_header_utmpx_h" = "no" -a "$ac_cv_header_wtsapi32_h" = "no"
441 AC_PATH_PROG(PATH_TO_WHO,who)
443 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
445 ac_cv_path_to_who="$PATH_TO_WHO -q"
447 ac_cv_path_to_who="$PATH_TO_WHO"
450 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
451 [path and arguments for invoking 'who'])
455 [AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
456 [], [with_ipv6=check])
458 dnl Check for AF_INET6 support - unistd.h required for Darwin
459 if test "$with_ipv6" != "no"; then
460 AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
462 [#ifdef HAVE_UNISTD_H
465 #include <netinet/in.h>
466 #include <sys/socket.h>],
467 [struct sockaddr_in6 sin6;
470 sin6.sin6_family = AF_INET6;
471 sin6.sin6_port = 587;
472 p = &sin6.sin6_addr;],
473 [np_cv_sys_ipv6=yes],
476 if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
477 AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
479 if test "$np_cv_sys_ipv6" = "yes"; then
480 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
482 with_ipv6="$np_cv_sys_ipv6"
486 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
487 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
488 if test "$FOUNDINCLUDE" = "no"; then
489 _SAVEDCPPFLAGS="$CPPFLAGS"
490 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
491 unset ac_cv_header_krb5_h
492 AC_CHECK_HEADERS(krb5.h,
493 KRB5INCLUDE="-I/usr/kerberos/include"
498 if test "$FOUNDINCLUDE" = "no"; then
499 CPPFLAGS="$_SAVEDCPPFLAGS"
502 dnl *** The following block comes from wget configure.ac ***
503 dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
504 dnl shared library doesn't record its dependency on libdl, so we
505 dnl need to check for it ourselves so we won't fail to link due to a
506 dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
508 AC_CHECK_LIB(dl,dlopen)
509 AC_CHECK_LIB(dl,shl_load)
511 dnl openssl detection/configuration
512 if ! test x"$with_openssl" = x"no"; then
513 dnl Check for OpenSSL location if it wasn't already specified
514 if ! test -d "$with_openssl"; then
515 for d in $OPENSSL_DIRS; do
516 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
522 _SAVEDCPPFLAGS="$CPPFLAGS"
523 _SAVEDLDFLAGS="$LDFLAGS"
524 dnl Check for OpenSSL header files
526 if test x"$with_openssl" != x"/usr" ; then
527 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
528 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
531 dnl check for openssl in $dir/include/openssl
532 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
533 SSLINCLUDE="-I$with_openssl/include"
536 dnl else check to see if $dir/include has it
537 if test "$FOUNDINCLUDE" = "no"; then
538 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
539 SSLINCLUDE="-I$with_openssl/include"
544 dnl if we didn't find it, reset CPPFLAGS
545 if test "$FOUNDINCLUDE" = "no"; then
546 CPPFLAGS="$_SAVEDCPPFLAGS"
547 LDFLAGS="$_SAVEDLDFLAGS"
550 dnl Check for crypto lib
552 LIBS="-L${with_openssl}/lib"
553 AC_CHECK_LIB(crypto,CRYPTO_new_ex_data)
554 if test "$ac_cv_lib_crypto_CRYPTO_new_ex_data" = "yes"; then
555 dnl Check for SSL lib
556 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
560 dnl test headers and libs to decide whether check_http should use SSL
561 if test "$ac_cv_lib_crypto_CRYPTO_new_ex_data" = "yes"; then
562 if test "$ac_cv_lib_ssl_main" = "yes"; then
563 if test "$FOUNDINCLUDE" = "yes"; then
571 dnl check for gnutls if openssl isn't found (or is disabled)
572 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
573 if test ! "$with_gnutls" = ""; then
574 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
576 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
577 if test "$FOUNDGNUTLS" = "yes"; then
578 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
581 dnl end check for gnutls
583 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
584 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
585 AC_SUBST(check_tcp_ssl)
587 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
588 if test "$FOUNDOPENSSL" = "yes"; then
589 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
593 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
598 dnl else deliberately disabled or no ssl support available
599 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
605 dnl Checks for header files.
610 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
611 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
613 dnl Checks for typedefs, structures, and compiler characteristics.
620 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
621 AC_TRY_LINK([#include <stdarg.h>
622 va_list ap1,ap2;], [va_copy(ap1,ap2);],
623 ac_cv_HAVE_VA_COPY=yes,
624 ac_cv_HAVE_VA_COPY=no)])
625 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
626 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
628 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
629 AC_TRY_LINK([#include <stdarg.h>
630 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
631 ac_cv_HAVE___VA_COPY=yes,
632 ac_cv_HAVE___VA_COPY=no)])
633 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
634 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
638 AC_TRY_COMPILE([#include <sys/time.h>],
640 struct timezone *tz;],
641 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
642 AC_TRY_COMPILE([#include <sys/time.h>],
645 gettimeofday(tv, tz);],
646 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
647 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
649 dnl Checks for library functions.
650 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
653 AC_MSG_CHECKING(return type of socket size)
654 AC_TRY_COMPILE([#include <stdlib.h>
655 #include <sys/types.h>
656 #include <sys/socket.h>],
657 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
658 ac_cv_socket_size_type=["size_t"]
659 AC_MSG_RESULT(size_t),
660 ac_cv_socket_size_type=["int"]
663 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
664 [Define type of socket size])
667 dnl #### Process table test
669 AC_PATH_PROG(PATH_TO_PS,ps)
670 AC_PATH_PROG(PATH_TO_ENV,env)
672 AC_MSG_CHECKING(for ps syntax)
673 AC_ARG_WITH(ps_command,
674 ACX_HELP_STRING([--with-ps-command=PATH],
675 [Verbatim command to execute for ps]),
677 AC_ARG_WITH(ps_format,
678 ACX_HELP_STRING([--with-ps-format=FORMAT],
679 [Format string for scanning ps output]),
682 ACX_HELP_STRING([--with-ps-cols=NUM],
683 [Number of columns in ps command]),
685 AC_ARG_WITH(ps_varlist,
686 ACX_HELP_STRING([--with-ps-varlist=LIST],
687 [Variable list for sscanf of 'ps' output]),
690 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
691 ac_cv_ps_command="$PS_COMMAND"
692 ac_cv_ps_format="$PS_FORMAT"
693 ac_cv_ps_varlist="$PS_VARLIST"
694 ac_cv_ps_cols="$PS_COLS"
695 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
697 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
698 elif test "$ac_cv_uname_s" = "SunOS"; then
700 # this is a very, very ugly hack, to hardcode the location for plugins
702 if test "$libexecdir" = '${exec_prefix}/libexec'; then
703 if test "$exec_prefix" = "NONE"; then
704 if test "$prefix" = "NONE"; then
705 pst3="$ac_default_prefix/libexec/pst3"
707 pst3="$prefix/libexec/pst3"
710 pst3="$exec_prefix/libexec/pst3"
713 pst3="$libexecdir/pst3"
715 ac_cv_ps_command="$pst3"
716 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
717 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
719 AC_MSG_RESULT([using monitoring-plugins internal ps command (pst3) for solaris])
720 if test `isainfo -b` = 64 ; then
722 AC_MSG_NOTICE([using 64bit pst3])
724 AC_MSG_NOTICE([using 32bit pst3])
726 EXTRAS_ROOT="$EXTRAS_ROOT pst3\$(EXEEXT)"
728 if test "$pst3_use_64bit" = 1; then
729 dnl Test if we can actually compile code in 64bit
731 CFLAGS="$CFLAGS -m64"
734 [AC_LANG_PROGRAM([], [
735 return sizeof(void*) == 8 ? 0 : 1;
741 AC_MSG_NOTICE([using -m64 for 64bit code])
744 AC_MSG_NOTICE([compiler do not like -m64])
747 if test "$pst3_64bit_working" = 0; then
749 CFLAGS="$CFLAGS -xarch=v9"
751 [AC_LANG_PROGRAM([], [
752 return sizeof(void*) == 8 ? 0 : 1;
755 PST3CFLAGS="-xarch=v9"
758 AC_MSG_NOTICE([using -xarch=v9 for 64bit code])
761 AC_MSG_NOTICE([compiler do not like -xarch=v9])
765 if test "$pst3_64bit_working" = 0; then
767 CFLAGS="$CFLAGS -xarch=amd64"
769 [AC_LANG_PROGRAM([], [
770 return sizeof(void*) == 8 ? 0 : 1;
773 PST3CFLAGS="-xarch=amd64"
776 AC_MSG_NOTICE([using -xarch=amd64 for 64bit code])
779 AC_MSG_NOTICE([compiler do not like -xarch=amd64])
783 if test "$pst3_64bit_working" = 0; then
784 AC_MSG_ERROR([I don't know how to build a 64-bit object!])
788 dnl Removing this for the moment - Ton
789 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
790 dnl Limitation that command name is not available
791 dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
792 dnl egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
794 dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
795 dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
796 dnl ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
798 dnl AC_MSG_RESULT([$ac_cv_ps_command])
800 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
801 dnl so test for this first...
802 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
803 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
805 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
806 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
807 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
809 AC_MSG_RESULT([$ac_cv_ps_command])
811 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
812 dnl Should also work for FreeBSD 5.2.1 and 5.3
813 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
814 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
815 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
817 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
818 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
819 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
821 AC_MSG_RESULT([$ac_cv_ps_command])
823 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
824 dnl Limitation: Only first 16 chars returned for ucomm field
825 dnl Must come before ps -weo
826 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
827 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
829 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
830 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
831 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
833 AC_MSG_RESULT([$ac_cv_ps_command])
835 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
836 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
837 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
839 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
840 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
841 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
843 AC_MSG_RESULT([$ac_cv_ps_command])
846 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
847 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
849 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
850 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
851 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
853 AC_MSG_RESULT([$ac_cv_ps_command])
855 dnl BSD-like mode in RH 6.1
856 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
857 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
859 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
860 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
861 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
863 AC_MSG_RESULT([$ac_cv_ps_command])
866 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
867 dnl Need the head -1 otherwise test will work because arguments are found
868 elif ps -laxnwww 2>/dev/null | head -1 | \
869 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
871 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
872 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
873 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
875 AC_MSG_RESULT([$ac_cv_ps_command])
877 dnl Debian Linux / procps v1.2.9:
878 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
879 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
881 elif ps laxnwww 2>/dev/null | \
882 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
884 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
885 ac_cv_ps_command="$PATH_TO_PS laxnwww"
886 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
888 AC_MSG_RESULT([$ac_cv_ps_command])
890 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
891 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
892 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
894 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
895 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
896 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
898 AC_MSG_RESULT([$ac_cv_ps_command])
900 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
901 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
902 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
903 dnl of 1500). Will need big changes to check_procs to support
904 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
905 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
907 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
908 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
909 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
911 AC_MSG_RESULT([$ac_cv_ps_command])
913 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
914 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
916 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
917 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
918 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
920 AC_MSG_RESULT([$ac_cv_ps_command])
922 dnl AIX 4.3.3 and 5.1 do not have an rss field
923 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
924 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
926 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
927 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
928 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
930 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
933 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
934 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
936 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
937 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
938 # There must be no space between the %s and %n due to a wierd problem in sscanf where
939 # it will return %n as longer than the line length
940 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
942 AC_MSG_RESULT([$ac_cv_ps_command])
944 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
945 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
947 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
948 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
949 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
951 AC_MSG_RESULT([$ac_cv_ps_command])
953 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
954 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
956 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
957 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
958 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
960 AC_MSG_RESULT([$ac_cv_ps_command])
962 dnl wonder who takes state instead of stat
963 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
964 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
966 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
967 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
968 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
970 AC_MSG_RESULT([$ac_cv_ps_command])
973 elif ps -el 2>/dev/null | \
974 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
976 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
977 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
978 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
980 AC_MSG_RESULT([$ac_cv_ps_command])
983 elif ps -el 2>/dev/null | \
984 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
986 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
987 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
988 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
990 AC_MSG_RESULT([$ac_cv_ps_command])
993 dnl S UID RUID USER RUSER PID PPID VSZ %CPU COMMAND COMMAND
994 dnl S 0 400 root oracle 2805 1 12904 0.00 ora_dism_SEA1X ora_dism_SEA1X
995 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
996 elif env UNIX95=1 ps -eo 'state uid ruid user ruser pid ppid vsz pcpu comm args' 2>/dev/null | head -n 1 | \
997 egrep -i ["^ *S +UID +RUID +USER +RUSER +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
999 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
1000 ac_cv_ps_command="$PATH_TO_ENV UNIX95=1 $PATH_TO_PS -eo 'state uid pid ppid vsz pcpu comm args'"
1001 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
1003 AC_MSG_RESULT([$ac_cv_ps_command])
1006 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
1007 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
1008 elif ps -el 2>/dev/null | \
1009 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
1011 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
1012 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
1013 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
1015 AC_MSG_RESULT([$ac_cv_ps_command])
1018 elif ps glaxen 2>/dev/null | \
1019 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
1021 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
1022 ac_cv_ps_command="$PATH_TO_PS glaxen"
1023 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
1025 AC_MSG_RESULT([$ac_cv_ps_command])
1028 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
1029 dnl Some truncation will happen in UCOMM column
1030 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
1031 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
1032 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
1033 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
1035 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
1036 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
1037 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
1039 AC_MSG_RESULT([$ac_cv_ps_command])
1042 elif ps -Al 2>/dev/null | \
1043 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
1045 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
1046 ac_cv_ps_command="$PATH_TO_PS -Al"
1047 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
1049 AC_MSG_RESULT([$ac_cv_ps_command])
1052 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
1055 if test -n "$ac_cv_ps_varlist" ; then
1056 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
1057 [Variable list for sscanf of 'ps' output])
1058 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
1059 [Verbatim command to execute for ps in check_procs])
1060 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
1061 [Format string for scanning ps output in check_procs])
1062 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
1063 [Number of columns in ps command])
1064 EXTRAS="$EXTRAS check_procs check_nagios\$(EXEEXT)"
1065 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
1066 AC_DEFINE(PS_USES_PROCETIME,"yes",
1067 [Whether the ps utility uses the "procetime" field])
1071 AC_PATH_PROG(PATH_TO_PING,ping)
1072 AC_PATH_PROG(PATH_TO_PING6,ping6)
1074 AC_ARG_WITH(ping_command,
1075 ACX_HELP_STRING([--with-ping-command=SYNTAX],
1076 [sets syntax for ICMP ping]),
1077 with_ping_command=$withval,)
1079 AC_MSG_CHECKING(for ICMP ping syntax)
1080 ac_cv_ping_packets_first=no
1081 ac_cv_ping_has_timeout=no
1082 if test -n "$with_ping_command"
1084 AC_MSG_RESULT([(command-line) $with_ping_command])
1085 if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null
1087 ac_cv_ping_packets_first=yes
1088 ac_cv_ping_has_timeout=yes
1089 elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \
1090 echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null
1092 ac_cv_ping_has_timeout=yes
1093 elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null
1095 ac_cv_ping_packets_first=yes
1098 elif [[ "z$ac_cv_uname_o" = "zCygwin" ]]
1100 with_ping_command="$PATH_TO_PING -n %d -w %d000 %s"
1101 ac_cv_ping_packets_first=yes
1102 ac_cv_ping_has_timeout=yes
1103 AC_MSG_RESULT([$with_ping_command])
1105 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1106 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1107 egrep -i "^round-trip|^rtt" >/dev/null
1109 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1110 ac_cv_ping_packets_first=yes
1111 AC_MSG_RESULT([$with_ping_command])
1113 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
1114 egrep -i "^round-trip|^rtt" >/dev/null
1116 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
1117 ac_cv_ping_packets_first=yes
1118 ac_cv_ping_has_timeout=yes
1119 AC_MSG_RESULT([$with_ping_command])
1121 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
1122 egrep -i "^round-trip|^rtt" >/dev/null
1124 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1125 ac_cv_ping_packets_first=yes
1126 AC_MSG_RESULT([$with_ping_command])
1128 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1129 egrep -i "^round-trip|^rtt" >/dev/null
1131 with_ping_command="$PATH_TO_PING -n -c %d %s"
1132 ac_cv_ping_packets_first=yes
1133 AC_MSG_RESULT([$with_ping_command])
1135 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
1136 egrep -i "^round-trip|^rtt" >/dev/null
1138 with_ping_command="$PATH_TO_PING -n %s -c %d"
1139 AC_MSG_RESULT([$with_ping_command])
1141 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1142 egrep -i "^round-trip|^rtt" >/dev/null
1144 with_ping_command="$PATH_TO_PING %s -n %d"
1145 AC_MSG_RESULT([$with_ping_command])
1147 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1148 egrep -i "^round-trip|^rtt" >/dev/null
1150 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1151 AC_MSG_RESULT([$with_ping_command])
1153 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1154 egrep -i "^round-trip|^rtt" >/dev/null
1156 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1157 AC_MSG_RESULT([$with_ping_command])
1159 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1160 egrep -i "^round-trip|^rtt" >/dev/null
1162 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1163 ac_cv_ping_packets_first=yes
1164 AC_MSG_RESULT([$with_ping_command])
1166 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1167 egrep -i "^round-trip|^rtt" >/dev/null
1169 with_ping_command="$PATH_TO_PING -n -c %d %s"
1170 ac_cv_ping_packets_first=yes
1171 AC_MSG_RESULT([$with_ping_command])
1174 AC_MSG_WARN([unable to find usable ping syntax])
1177 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1178 [path and args for ICMP ping command])
1180 if test "x$ac_cv_ping_packets_first" != "xno"
1182 AC_DEFINE(PING_PACKETS_FIRST,1,
1183 [Define if packet count must precede host])
1186 if test "x$ac_cv_ping_has_timeout" != "xno"
1188 AC_DEFINE(PING_HAS_TIMEOUT,1,
1189 [Define if ping has its own timeout option that should be set])
1192 AC_ARG_WITH(ping6_command,
1193 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1194 [sets syntax for ICMPv6 ping]),
1195 with_ping6_command=$withval,)
1197 if test x"$with_ipv6" != xno ; then
1198 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1199 ac_cv_ping6_packets_first=no
1200 if test -n "$with_ping6_command"
1202 AC_MSG_RESULT([(command-line) $with_ping6_command])
1203 if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null
1205 ac_cv_ping6_packets_first=yes
1206 elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \
1207 echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null
1209 # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout
1211 elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null
1213 ac_cv_ping6_packets_first=yes
1215 elif [[ "z$ac_cv_uname_o" = "zCygwin" -a "x$PATH_TO_PING" != "x" ]]; then
1216 with_ping6_command="$PATH_TO_PING -6 -n %d -w %d000 %s"
1217 ac_cv_ping6_packets_first=yes
1218 ac_cv_ping_has_timeout=yes
1219 AC_MSG_RESULT([$with_ping6_command])
1220 elif test "x$PATH_TO_PING6" != "x"; then
1221 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1222 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1223 egrep -i "^round-trip|^rtt" >/dev/null
1225 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1226 ac_cv_ping6_packets_first=yes
1227 AC_MSG_RESULT([$with_ping6_command])
1229 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
1230 egrep -i "^round-trip|^rtt" >/dev/null
1232 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
1233 ac_cv_ping6_packets_first=yes
1234 ac_cv_ping_has_timeout=yes
1235 AC_MSG_RESULT([$with_ping6_command])
1237 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1238 egrep -i "^round-trip|^rtt" >/dev/null
1240 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1241 ac_cv_ping6_packets_first=yes
1242 AC_MSG_RESULT([$with_ping6_command])
1244 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1245 egrep -i "^round-trip|^rtt" >/dev/null
1247 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1248 ac_cv_ping6_packets_first=yes
1249 AC_MSG_RESULT([$with_ping6_command])
1251 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1252 egrep -i "^round-trip|^rtt" >/dev/null
1254 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1255 AC_MSG_RESULT([$with_ping6_command])
1257 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1258 egrep -i "^round-trip|^rtt" >/dev/null
1260 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1261 AC_MSG_RESULT([$with_ping6_command])
1263 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1264 egrep -i "^round-trip|^rtt" >/dev/null
1266 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1267 AC_MSG_RESULT([$with_ping6_command])
1269 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1270 egrep -i "^round-trip|^rtt" >/dev/null
1272 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1273 AC_MSG_RESULT([$with_ping6_command])
1275 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1276 egrep -i "^round-trip|^rtt" >/dev/null
1278 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1279 ac_cv_ping6_packets_first=yes
1280 AC_MSG_RESULT([$with_ping_command])
1282 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1283 egrep -i "^round-trip|^rtt" >/dev/null
1285 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1286 ac_cv_ping6_packets_first=yes
1287 AC_MSG_RESULT([$with_ping6_command])
1291 elif test "x$PATH_TO_PING" != "x"; then
1292 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1293 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1294 egrep -i "^round-trip|^rtt" >/dev/null
1296 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1297 ac_cv_ping6_packets_first=yes
1298 AC_MSG_RESULT([$with_ping6_command])
1300 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1301 egrep -i "^round-trip|^rtt" >/dev/null
1303 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1304 ac_cv_ping6_packets_first=yes
1305 AC_MSG_RESULT([$with_ping6_command])
1307 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1308 egrep -i "^round-trip|^rtt" >/dev/null
1310 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1311 ac_cv_ping6_packets_first=yes
1312 AC_MSG_RESULT([$with_ping6_command])
1314 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1315 egrep -i "^round-trip|^rtt" >/dev/null
1317 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1318 AC_MSG_RESULT([$with_ping6_command])
1320 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1321 egrep -i "^round-trip|^rtt" >/dev/null
1323 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1324 AC_MSG_RESULT([$with_ping6_command])
1326 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1327 egrep -i "^round-trip|^rtt" >/dev/null
1329 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1330 AC_MSG_RESULT([$with_ping6_command])
1332 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1333 egrep -i "^round-trip|^rtt" >/dev/null
1335 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1336 AC_MSG_RESULT([$with_ping6_command])
1338 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1339 egrep -i "^round-trip|^rtt" >/dev/null
1341 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1342 ac_cv_ping6_packets_first=yes
1343 AC_MSG_RESULT([$with_ping_command])
1345 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1346 egrep -i "^round-trip|^rtt" >/dev/null
1348 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1349 ac_cv_ping6_packets_first=yes
1350 AC_MSG_RESULT([$with_ping6_command])
1356 if test "x$with_ping6_command" != "x"; then
1357 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1358 [path and args for ICMPv6 ping command])
1360 AC_MSG_RESULT([none])
1363 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1364 AC_DEFINE(PING6_PACKETS_FIRST,1,
1365 [Define if packet count must precede host])
1370 AC_ARG_WITH(nslookup_command,
1371 ACX_HELP_STRING([--with-nslookup-command=PATH],
1372 [sets path to nslookup executable]),
1373 ac_cv_nslookup_command=$withval)
1374 if test -n "$ac_cv_nslookup_command"; then
1375 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1377 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1378 if test -n "$PATH_TO_NSLOOKUP"
1380 AC_MSG_CHECKING(for nslookup syntax)
1381 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1383 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1384 AC_MSG_RESULT([$ac_cv_nslookup_command])
1387 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1388 AC_MSG_RESULT([$ac_cv_nslookup_command])
1392 AC_MSG_WARN([nslookup command not found])
1396 if test -n "$ac_cv_nslookup_command"; then
1397 EXTRAS="$EXTRAS check_dns\$(EXEEXT)"
1398 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1401 AC_MSG_CHECKING([for number of online cpus])
1402 AC_TRY_COMPILE([#include <unistd.h>],
1403 [sysconf(_SC_NPROCESSORS_ONLN) > 0;],
1404 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_ONLN,1,[Define if sysconf returns number of online cpus])
1405 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_ONLN)]),
1406 AC_MSG_RESULT([cannot calculate])
1409 AC_MSG_CHECKING([for number of available cpus])
1410 AC_TRY_COMPILE([#include <unistd.h>],
1411 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1412 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of available cpus])
1413 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1414 AC_MSG_RESULT([cannot calculate])
1417 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1418 AC_ARG_WITH(uptime_command,
1419 ACX_HELP_STRING([--with-uptime-command=PATH],
1420 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1421 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1423 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1424 AC_ARG_WITH(rpcinfo_command,
1425 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1426 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1427 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1429 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1430 if test -x "$PATH_TO_LMSTAT"
1432 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1434 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1437 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1438 AC_ARG_WITH(smbclient_command,
1439 ACX_HELP_STRING([--with-smbclient-command=PATH],
1440 [sets path to smbclient]),
1441 PATH_TO_SMBCLIENT=$withval)
1442 if test -n "$PATH_TO_SMBCLIENT"
1444 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1446 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1449 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1450 AC_ARG_WITH(snmpget_command,
1451 ACX_HELP_STRING([--with-snmpget-command=PATH],
1452 [Path to snmpget command]),
1453 PATH_TO_SNMPGET=$withval)
1454 if test -n "$PATH_TO_SNMPGET"
1456 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1457 EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)"
1459 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1462 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1463 AC_ARG_WITH(snmpgetnext_command,
1464 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1465 [Path to snmpgetnext command]),
1466 PATH_TO_SNMPGETNEXT=$withval)
1467 if test -n "$PATH_TO_SNMPGETNEXT"
1469 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1472 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1474 AC_MSG_CHECKING(for Net::SNMP perl module)
1475 AC_MSG_RESULT([found])
1477 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1480 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1481 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1482 AC_ARG_WITH(qstat_command,
1483 ACX_HELP_STRING([--with-qstat-command=PATH],
1484 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1486 if test -x "$PATH_TO_QUAKESTAT"
1488 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1489 EXTRAS="$EXTRAS check_game\$(EXEEXT)"
1491 elif test -n "$PATH_TO_QSTAT"
1493 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1494 EXTRAS="$EXTRAS check_game\$(EXEEXT)"
1496 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1499 if test $ac_cv_path_to_qstat
1501 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1502 [path to qstat/quakestat])
1505 AC_PATH_PROG(PATH_TO_FPING,fping)
1506 AC_PATH_PROG(PATH_TO_FPING6,fping6)
1508 AC_ARG_WITH(fping_command,
1509 ACX_HELP_STRING([--with-fping-command=PATH],
1510 [Path to fping command]), PATH_TO_FPING=$withval)
1511 AC_ARG_WITH(fping6_command,
1512 ACX_HELP_STRING([--with-fping6-command=PATH],
1513 [Path to fping6 command]), PATH_TO_FPING6=$withval)
1515 if test -n "$PATH_TO_FPING"
1517 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1518 EXTRAS="$EXTRAS check_fping\$(EXEEXT)"
1519 if test x"$with_ipv6" != xno && test -n "$PATH_TO_FPING6"; then
1520 AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
1523 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1526 AC_PATH_PROG(PATH_TO_SSH,ssh)
1527 AC_ARG_WITH(ssh_command,
1528 ACX_HELP_STRING([--with-ssh-command=PATH],
1529 [sets path for ssh]), PATH_TO_SSH=$withval)
1530 if test -n "$PATH_TO_SSH"
1532 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1533 EXTRAS="$EXTRAS check_by_ssh\$(EXEEXT)"
1535 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1538 AC_PATH_PROG(PATH_TO_SUDO,sudo)
1539 AC_ARG_WITH(sudo_command,
1540 ACX_HELP_STRING([--with-sudo-command=PATH],
1541 [sets path to sudo]), PATH_TO_SUDO=$withval)
1542 if test -n "$PATH_TO_SUDO"
1544 AC_DEFINE_UNQUOTED(PATH_TO_SUDO,"$PATH_TO_SUDO",[path to sudo])
1546 AC_MSG_WARN([Could not find sudo or eqivalent])
1549 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1550 AC_ARG_WITH(mailq_command,
1551 ACX_HELP_STRING([--with-mailq-command=PATH],
1552 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1553 if test -n "$PATH_TO_MAILQ"
1555 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1557 AC_MSG_WARN([Could not find mailq or eqivalent])
1560 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1561 AC_ARG_WITH(qmail_qstat_command,
1562 ACX_HELP_STRING([--with-qmail-qstat-command=PATH],
1563 [sets path to qmail-qstat]), PATH_TO_QMAIL_QSTAT=$withval)
1564 if test -n "$PATH_TO_QMAIL_QSTAT"
1566 AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1568 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1571 dnl SWAP info required is amount allocated/available and amount free
1572 dnl The plugin works through all the swap devices and adds up the total swap
1574 AC_PATH_PROG(PATH_TO_SWAP,swap)
1575 if (test -n "$PATH_TO_SWAP")
1577 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1578 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1581 ac_cv_swap_command="$PATH_TO_SWAP -l"
1582 if [$PATH_TO_SWAP -l 2>/dev/null | \
1583 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1586 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1587 ac_cv_swap_conv=2048
1588 AC_MSG_RESULT([using IRIX format swap])
1590 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1592 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1593 ac_cv_swap_conv=2048
1594 AC_MSG_RESULT([using Unixware format swap])
1596 dnl if we don't know what format swap's output is
1597 dnl we might as well pretend we didn't see it
1599 ac_cv_swap_command=""
1602 dnl end if for PATH_TO_SWAP
1605 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1606 if (test -n "$PATH_TO_SWAPINFO")
1608 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1609 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1612 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1614 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1616 ac_cv_swap_format=["%*s %f %*d %f"]
1617 ac_cv_swap_conv=1024
1618 AC_MSG_RESULT([using FreeBSD format swapinfo])
1621 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1624 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1625 ac_cv_swap_format=["%*s %f %*d %f"]
1626 ac_cv_swap_conv=1024
1627 AC_MSG_RESULT([using HP-UX format swapinfo])
1629 dnl end if for PATH_TO_SWAPINFO
1632 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1633 if (test -n "$PATH_TO_LSPS")
1635 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1636 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1639 ac_cv_swap_command="$PATH_TO_LSPS -a"
1640 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1642 AC_MSG_RESULT([using AIX lsps])
1644 dnl end if for PATH_TO_SWAPINFO
1648 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1649 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1650 dnl in the various BSD's
1653 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1654 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1655 #ifdef HAVE_SYS_PARAM_H
1656 #include <sys/param.h>
1659 AC_CHECK_DECLS([swapctl],,,[
1661 #include <sys/types.h>
1662 #include <sys/param.h>
1663 #include <sys/stat.h>
1664 #include <sys/swap.h>
1666 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1667 #include <sys/types.h>
1668 #include <sys/param.h>
1669 #include <sys/stat.h>
1670 #include <sys/swap.h>
1672 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1674 #include <sys/types.h>
1675 #include <sys/param.h>
1676 #include <sys/stat.h>
1677 #include <sys/swap.h>
1680 if test "$ac_cv_have_decl_swapctl" = "yes";
1682 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1683 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1684 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1685 "$ac_cv_type_swapent_t" = "yes";
1687 AC_MSG_RESULT([yes])
1688 ac_cv_check_swap_swapctl_svr4="1";
1689 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1690 [Define if 2-argument SVR4 swapctl exists])
1693 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1694 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1696 AC_MSG_RESULT([yes])
1697 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1698 [Define if 3-argument BSD swapctl exists])
1703 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1704 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1707 dnl the SVR4 spec returns values in pages
1709 AC_MSG_RESULT([page])
1710 AC_CHECK_DECLS([sysconf])
1711 AC_MSG_CHECKING([for system page size])
1712 if test "$ac_cv_have_decl_sysconf" = "yes";
1714 AC_MSG_RESULT([determined by sysconf(3)])
1715 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1717 AC_MSG_WARN([don't know. guessing 4096k])
1722 dnl the BSD spec returns values in blocks
1724 AC_MSG_RESULT([blocks (assuming 512b)])
1725 ac_cv_swap_conv=2048
1727 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1728 [Conversion factor to MB])
1731 dnl end tests for the swapctl system calls
1735 if test "x$ac_cv_have_swap" != "x"
1737 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1738 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1740 if test "x$ac_cv_swap_command" != "x"
1742 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1743 [Path to swap/swapinfo binary, with any args])
1744 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1745 [Format string for parsing swap output])
1746 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1747 [Conversion factor to MB])
1750 AC_ARG_WITH(proc-meminfo,
1751 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1752 [path to /proc/meminfo or equivalent]),
1753 ac_cv_proc_meminfo=$withval)
1754 dnl dunno why this does not work below - use hack (kbd)
1755 dnl fine on linux, broken on solaris
1756 dnl if /bin/test -e "/proc/meminfo"
1757 AC_MSG_CHECKING([for /proc/meminfo])
1758 if test -n "$ac_cv_proc_meminfo"; then
1759 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1760 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1761 AC_MSG_RESULT([found /proc/meminfo])
1762 ac_cv_proc_meminfo="/proc/meminfo"
1767 if test -n "$ac_cv_proc_meminfo"; then
1768 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1769 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1770 EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
1773 AC_PATH_PROG(PATH_TO_DIG,dig)
1774 AC_ARG_WITH(dig_command,
1775 ACX_HELP_STRING([--with-dig-command=PATH],
1776 [Path to dig command]), PATH_TO_DIG=$withval)
1777 if test -n "$PATH_TO_DIG"; then
1778 EXTRAS="$EXTRAS check_dig\$(EXEEXT)"
1779 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1782 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1783 AC_ARG_WITH(apt-get_command,
1784 ACX_HELP_STRING([--with-apt-get-command=PATH],
1785 [Path to apt-get command]),
1786 with_apt_get_command=$withval,
1787 with_apt_get_command=$PATH_TO_APTGET)
1788 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1789 if test -n "$PATH_TO_APTGET" ; then
1790 EXTRAS="$EXTRAS check_apt\$(EXEEXT)"
1794 if test -f $srcdir/plugins/check_nt.c ; then
1795 EXTRAS="$EXTRAS check_nt\$(EXEEXT)"
1799 dnl used in check_dhcp
1800 AC_CHECK_HEADERS(sys/sockio.h)
1804 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1807 AC_DEFINE(__linux__,1,[linux specific code in check_dhcp.c])
1810 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1813 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1818 AC_SUBST(EXTRAS_ROOT)
1819 AC_SUBST(EXTRA_NETOBJS)
1822 AM_GNU_GETTEXT([external], [need-ngettext])
1823 AM_GNU_GETTEXT_VERSION(0.15)
1825 dnl Check for Redhat spopen problem
1826 dnl Wierd problem where ECHILD is returned from a wait call in error
1827 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1828 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1829 dnl We patch plugins/popen.c
1830 dnl Need to add smp because uname different on those
1831 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1832 AC_ARG_ENABLE(redhat-pthread-workaround,
1833 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1834 [force Redhat patch to be applied (default: test system)]),
1835 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1836 [ac_cv_enable_redhat_pthread_workaround=test])
1837 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1838 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1839 AC_MSG_NOTICE([See https://www.monitoring-plugins.org/doc/faq/configure-hangs.html if this next part takes a long time])
1840 AC_MSG_CHECKING(for redhat spopen problem)
1841 ( cd config_test && make && make test ) > /dev/null 2>&1
1842 if test $? -eq 0 ; then
1845 AC_MSG_RESULT(error)
1846 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1849 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1850 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1854 AC_ARG_ENABLE(perl-modules,
1855 AC_HELP_STRING([--enable-perl-modules],
1856 [Enables installation of Monitoring::Plugin and its dependencies (default: no)]),
1857 [enable_perl_modules=$enableval],
1858 [enable_perl_modules=no])
1859 if test "$enable_perl_modules" = "yes" ; then
1860 AC_SUBST(PERLMODS_DIR,perlmods)
1863 # From Tap configure
1864 # Checks for libraries
1867 LDFLAGS="$LDFLAGS -pthread"
1871 AC_CHECK_LIB(pthread, main)
1875 dnl External libraries - see ACKNOWLEDGEMENTS
1878 dnl Some helpful common compile errors checked here
1879 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
1880 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1889 plugins-root/Makefile
1890 plugins-scripts/Makefile
1891 plugins-scripts/utils.pm
1892 plugins-scripts/utils.sh
1900 dnl the ones below that are commented out need to be cleaned up
1901 dnl in the configure code above to use with_foo instead of ac_cv_foo
1902 dnl if we want them to show up here. it'd also make the code cleaner.
1903 dnl i'll get to that on another rainy day :) -sf
1904 ACX_FEATURE([with],[apt-get-command])
1905 dnl ACX_FEATURE([with],[dig-command])
1906 dnl ACX_FEATURE([with],[fping-command])
1907 dnl ACX_FEATURE([with],[mailq-command])
1908 dnl ACX_FEATURE([with],[nslookup-command])
1909 ACX_FEATURE([with],[ping6-command])
1910 ACX_FEATURE([with],[ping-command])
1911 dnl ACX_FEATURE([with],[qstat-command])
1912 dnl ACX_FEATURE([with],[rpcinfo-command])
1913 dnl ACX_FEATURE([with],[smbclient-command])
1914 dnl ACX_FEATURE([with],[snmpget-command])
1915 dnl ACX_FEATURE([with],[snmpgetnext-command])
1916 dnl ACX_FEATURE([with],[ssh-command])
1917 dnl ACX_FEATURE([with],[uptime-command])
1919 dnl ACX_FEATURE([with],[proc-meminfo])
1920 dnl ACX_FEATURE([with],[ps-command])
1921 dnl ACX_FEATURE([with],[ps-format])
1922 dnl ACX_FEATURE([with],[ps-cols])
1923 dnl ACX_FEATURE([with],[ps-varlist])
1925 ACX_FEATURE([with],[ipv6])
1926 ACX_FEATURE([with],[mysql])
1927 ACX_FEATURE([with],[openssl])
1928 ACX_FEATURE([with],[gnutls])
1929 ACX_FEATURE([enable],[extra-opts])
1930 ACX_FEATURE([with],[perl])
1931 ACX_FEATURE([enable],[perl-modules])
1932 ACX_FEATURE([with],[cgiurl])
1933 ACX_FEATURE([with],[trusted-path])
1934 ACX_FEATURE([enable],[libtap])
1935 ACX_FEATURE([enable],[check-curl])
1936 ACX_FEATURE([with],[libcurl])
1937 ACX_FEATURE([with],[uriparser])