1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
4 AC_INIT(nagios-plugins,1.4.2)
5 AC_CONFIG_SRCDIR(NPTest.pm)
7 AM_CONFIG_HEADER(config.h)
13 AC_PREFIX_DEFAULT(/usr/local/nagios)
15 dnl Figure out how to invoke "install" and what install options to use.
19 dnl Must come very early on due to coreutils requirement
20 dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
21 gl_USE_SYSTEM_EXTENSIONS
25 AC_PROG_GCC_TRADITIONAL
35 AC_CONFIG_LIBOBJ_DIR(lib)
36 AC_FUNC_GETLOADAVG([lib])
38 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
41 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
42 AC_SUBST(PLUGIN_TEST)dnl
44 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
45 AC_SUBST(SCRIPT_TEST)dnl
47 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
50 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
53 dnl CGIURL has changed for Nagios with 1.0 beta
55 ACX_HELP_STRING([--with-cgiurl=DIR],
56 [sets URL for cgi programs]),
58 with_cgiurl=/nagios/cgi-bin)
60 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
62 AC_ARG_WITH(nagios_user,
63 ACX_HELP_STRING([--with-nagios-user=USER],
64 [set user name to run nagios]),
65 with_nagios_user=$withval,
66 with_nagios_user=nagios)
67 AC_ARG_WITH(nagios_group,
68 ACX_HELP_STRING([--with-nagios-group=GROUP],
69 [set group name to run nagios]),
70 with_nagios_group=$withval,
71 with_nagios_group=nagios)
72 AC_SUBST(with_nagios_user)
73 AC_SUBST(with_nagios_group)
74 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
75 AC_SUBST(INSTALL_OPTS)
77 AC_ARG_WITH(trusted_path,
78 ACX_HELP_STRING([--with-trusted-path=PATH],
79 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
80 with_trusted_path=$withval,
81 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
82 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`
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 Checks for programs.
103 AC_PATH_PROG(PYTHON,python)
105 AC_PATH_PROG(PERL,perl)
107 dnl allow them to override the path of perl
109 ACX_HELP_STRING([--with-perl=PATH],
110 [sets path to perl executable]),
111 with_perl=$withval,with_perl=$PERL)
112 AC_SUBST(PERL, $with_perl)
114 AC_PATH_PROG(HOSTNAME,hostname)
115 AC_PATH_PROG(BASENAME,basename)
118 dnl Check for miscellaneous stuff
121 case $host_vender-$host_os in
123 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
126 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
131 dnl Checks for libraries.
134 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
135 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
136 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
137 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
141 dnl check for math-related functions needing -lm
142 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
145 dnl Check for PostgreSQL libraries
147 _SAVEDCPPFLAGS="$CPPFLAGS"
149 ACX_HELP_STRING([--with-pgsql=DIR],
150 [sets path to pgsql installation]),
152 AC_CHECK_LIB(crypt,main)
153 if test "$ac_cv_lib_crypt_main" = "yes"; then
154 if test -n "$PGSQL"; then
155 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
156 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
158 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
159 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
160 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
161 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
162 AC_CHECK_HEADERS(libpq-fe.h)
163 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
164 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
165 PGINCLUDE="-I$PGSQL/include"
166 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
167 PGLIBS="-lpq -lcrypt"
168 PGINCLUDE="-I/usr/include/pgsql"
169 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
170 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
171 PGINCLUDE="-I/usr/include/postgresql"
172 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
173 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
174 PGINCLUDE="-I$PGSQL/include"
176 if test -z "$PGINCLUDE"; then
177 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
178 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
182 EXTRAS="$EXTRAS check_pgsql"
185 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
186 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
187 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
190 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
191 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
194 CPPFLAGS="$_SAVEDCPPFLAGS"
196 dnl Check for radius libraries
198 AC_CHECK_LIB(radiusclient,rc_read_config)
199 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
200 EXTRAS="$EXTRAS check_radius"
201 RADIUSLIBS="-lradiusclient"
204 AC_MSG_WARN([Skipping radius plugin])
205 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
209 dnl Check for LDAP libraries
211 AC_CHECK_LIB(ldap,main,,,-llber)
212 if test "$ac_cv_lib_ldap_main" = "yes"; then
213 LDAPLIBS="-lldap -llber"\
214 LDAPINCLUDE="-I/usr/include/ldap"
216 AC_SUBST(LDAPINCLUDE)
217 AC_CHECK_FUNCS(ldap_set_option)
218 EXTRAS="$EXTRAS check_ldap"
219 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
221 AC_MSG_WARN([Skipping LDAP plugin])
222 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
227 dnl Check for mysql libraries
229 _SAVEDCPPFLAGS="$CPPFLAGS"
231 ACX_HELP_STRING([--with-mysql=DIR],
232 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
234 if test -n "$MYSQL"; then
235 MYSQLLIBDIR=$MYSQL/lib/mysql
236 CPPFLAGS="-I$MYSQL/include"
237 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
238 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
239 elif test -f /usr/lib/libmysqlclient.so; then
240 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
241 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
242 elif test -f /usr/lib/libmysqlclient.a; then
243 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
244 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
245 elif test -f /usr/lib/mysql/libmysqlclient.so; then
246 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
247 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
248 elif test -f /usr/lib/mysql/libmysqlclient.a; then
249 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
250 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
252 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
253 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
254 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
255 EXTRAS="$EXTRAS check_mysql"
256 AC_SUBST(MYSQLINCLUDE)
258 AC_SUBST(check_mysql_LDFLAGS)
260 AC_MSG_WARN([Skipping mysql plugin])
261 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
264 AC_MSG_WARN([Skipping mysql plugin])
265 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
267 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
270 AC_CHECK_HEADERS(unistd.h)
272 dnl Check for AF_INET6 support - unistd.h required for Darwin
273 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
274 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
277 #include <netinet/in.h>
278 #include <sys/socket.h>],
279 [struct sockaddr_in6 sin6;
282 sin6.sin6_family = AF_INET6;
283 sin6.sin6_port = 587;
284 p = &sin6.sin6_addr;],
289 if test x"$with_ipv6" != xno ; then
290 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
293 dnl #########################################################################
294 dnl Check if Posix getaddrinfo() is available. It is also possible to use
295 dnl the version from the lwres library distributed with BIND.
296 dnl #########################################################################
297 AC_ARG_ENABLE([emulate-getaddrinfo],
298 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
299 [enable getaddrinfo emulation (default=no)]),
301 enable_emulate_getaddrinfo=no)
304 ACX_HELP_STRING([--with-lwres=DIR],
305 [use lwres library for getaddrinfo (default=no)]),
309 dnl ## enable force to test getaddrinfo.c
310 if test x$enable_emulate_getaddrinfo = xforce ; then
311 enable_emulate_getaddrinfo=yes
316 if test x$with_lwres != xno ; then
317 if test "$with_lwres" != yes ; then
318 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
319 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
321 AC_CHECK_HEADERS(lwres/netdb.h, ,
322 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
323 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
324 [AC_MSG_ERROR([cannot find the lwres library])],
329 if test x$have_getaddrinfo != xyes ; then
330 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
333 dnl # Special nonsense for systems that actually have getaddrinfo but
334 dnl # redefine the name to something else, e.g. OSF
335 if test x$have_getaddrinfo != xyes ; then
336 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
340 struct addrinfo hints, *res;
343 err = getaddrinfo ("host", "service", &hints, &res);
347 ], [AC_MSG_RESULT(no)])
352 if test x$have_getaddrinfo != xno ; then
353 if test x$enable_emulate_getaddrinfo != xno ; then
354 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
356 AC_DEFINE(HAVE_GETADDRINFO, 1,
357 [Does system provide RFC 2553/Posix getaddrinfo?])
359 if test x$enable_emulate_getaddrinfo != xyes ; then
360 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
361 enable_emulate_getaddrinfo=yes
362 AC_MSG_WARN([enabling getaddrinfo emulation])
364 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
367 if test x"$enable_emulate_getaddrinfo" != xno ; then
370 dnl Try for getipnodebyname
371 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
372 if test x"$have_resolver" != xno ; then
373 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
374 [Set when getipnodebyname is available])
377 dnl Try for gethostbyname_r
378 if test x"$have_resolver" = xno ; then
379 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
381 ACX_WHICH_GETHOSTBYNAME_R])
384 dnl Try for gethostbyname
385 if test x"$have_resolver" = xno ; then
386 if test x"$enable_pthreads" != xno ; then
387 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
389 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
390 [AC_MSG_ERROR([cannot find gethostbyname])])
392 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
396 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
397 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
398 if test "$FOUNDINCLUDE" = "no"; then
399 _SAVEDCPPFLAGS="$CPPFLAGS"
400 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
401 unset ac_cv_header_krb5_h
402 AC_CHECK_HEADERS(krb5.h,
403 KRB5INCLUDE="-I/usr/kerberos/include"
408 if test "$FOUNDINCLUDE" = "no"; then
409 CPPFLAGS="$_SAVEDCPPFLAGS"
412 dnl Check for OpenSSL location
413 AC_PATH_PROG(OPENSSL,openssl)
414 if test "$OPENSSL" = "/usr/bin/openssl"; then
416 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
418 elif test "$OPENSSL" = "/opt/bin/openssl"; then
420 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
422 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
424 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
426 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
427 OPENSSL=/usr/local/ssl
430 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
431 AC_HELP_STRING([--without-openssl], [disable openssl]),
434 _SAVEDCPPFLAGS="$CPPFLAGS"
435 _SAVEDLDFLAGS="$LDFLAGS"
436 if test X"$OPENSSL" = "Xno"; then
437 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
438 FOUNDSSL="dontbother"
440 dnl Check for OpenSSL header files
442 if test "$OPENSSL" != "/usr"; then
443 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
444 LDFLAGS="$LDFLAGS -R$OPENSSL/lib"
446 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
447 SSLINCLUDE="-I$OPENSSL/include"
450 if test "$FOUNDINCLUDE" = "no"; then
451 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
452 SSLINCLUDE="-I$OPENSSL/include"
457 if test "$FOUNDINCLUDE" = "no"; then
458 CPPFLAGS="$_SAVEDCPPFLAGS"
461 dnl Check for crypto lib
463 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
464 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
465 dnl Check for SSL lib
466 AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto",AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto"),-L$OPENSSL/lib -lcrypto)
471 dnl test headers and libs to decide whether check_http should use SSL
472 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
473 if test "$ac_cv_lib_ssl_main" = "yes"; then
474 if test "$FOUNDINCLUDE" = "yes"; then
481 if test "$FOUNDSSL" = "yes"; then
482 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
483 AC_SUBST(check_tcp_ssl)
485 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
488 if test "$FOUNDSSL" = "no"; then
489 AC_MSG_WARN([OpenSSL libs could not be found])
490 dnl else deliberately disabled
493 CPPFLAGS="$_SAVEDCPPFLAGS"
494 LDFLAGS="$_SAVEDLDFLAGS"
498 dnl Checks for header files.
504 AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h)
505 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
507 dnl Checks for typedefs, structures, and compiler characteristics.
514 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
515 AC_TRY_LINK([#include <stdarg.h>
516 va_list ap1,ap2;], [va_copy(ap1,ap2);],
517 ac_cv_HAVE_VA_COPY=yes,
518 ac_cv_HAVE_VA_COPY=no)])
519 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
520 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
522 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
523 AC_TRY_LINK([#include <stdarg.h>
524 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
525 ac_cv_HAVE___VA_COPY=yes,
526 ac_cv_HAVE___VA_COPY=no)])
527 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
528 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
532 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
533 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
535 #include <sys/types.h>
537 void foo(const char *format, ...) {
542 va_start(ap, format);
543 len = vsnprintf(buf, 0, format, ap);
545 if (len != 5) exit(1);
547 va_start(ap, format);
548 len = vsnprintf(0, 0, format, ap);
550 if (len != 5) exit(1);
552 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
556 main() { foo("hello"); }
558 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
559 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
560 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
563 AC_TRY_COMPILE([#include <sys/time.h>],
565 struct timezone *tz;],
566 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
567 AC_TRY_COMPILE([#include <sys/time.h>],
570 gettimeofday(tv, tz);],
571 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
572 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
574 dnl Checks for library functions.
575 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul floor)
577 AC_MSG_CHECKING(return type of socket size)
578 AC_TRY_COMPILE([#include <stdlib.h>
579 #include <sys/types.h>
580 #include <sys/socket.h>],
581 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
582 ac_cv_socket_size_type=["size_t"]
583 AC_MSG_RESULT(size_t),
584 ac_cv_socket_size_type=["int"]
587 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
588 [Define type of socket size])
590 if test -f "/proc/loadavg"
592 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
593 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
596 dnl #### Process table test
598 AC_PATH_PROG(PATH_TO_PS,ps)
600 AC_MSG_CHECKING(for ps syntax)
601 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
602 dnl so test for this first...
603 if ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
604 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
606 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
607 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
608 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
610 AC_MSG_RESULT([$ac_cv_ps_command])
612 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
613 dnl Should also work for FreeBSD 5.2.1 and 5.3
614 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
615 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
616 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
618 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
619 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
620 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
622 AC_MSG_RESULT([$ac_cv_ps_command])
624 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
625 dnl Limitation: Only first 16 chars returned for ucomm field
626 dnl Must come before ps -weo
627 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
628 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
630 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
631 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
632 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
634 AC_MSG_RESULT([$ac_cv_ps_command])
636 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
637 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
638 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
640 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
641 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
642 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
644 AC_MSG_RESULT([$ac_cv_ps_command])
647 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
648 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
650 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
651 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
652 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
654 AC_MSG_RESULT([$ac_cv_ps_command])
656 dnl BSD-like mode in RH 6.1
657 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
658 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
660 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
661 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
662 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
664 AC_MSG_RESULT([$ac_cv_ps_command])
667 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
668 dnl Need the head -1 otherwise test will work because arguments are found
669 elif ps -laxnwww 2>/dev/null | head -1 | \
670 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
672 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
673 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
674 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
676 AC_MSG_RESULT([$ac_cv_ps_command])
678 dnl Debian Linux / procps v1.2.9:
679 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
680 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
682 elif ps laxnwww 2>/dev/null | \
683 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
685 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
686 ac_cv_ps_command="$PATH_TO_PS laxnwww"
687 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
689 AC_MSG_RESULT([$ac_cv_ps_command])
691 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
692 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
693 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
695 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
696 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
697 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
699 AC_MSG_RESULT([$ac_cv_ps_command])
701 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
702 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
703 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
704 dnl of 1500). Will need big changes to check_procs to support
705 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
706 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
708 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
709 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
710 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
712 AC_MSG_RESULT([$ac_cv_ps_command])
714 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
715 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
717 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
718 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
719 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
721 AC_MSG_RESULT([$ac_cv_ps_command])
723 dnl AIX 4.3.3 and 5.1 do not have an rss field
724 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
725 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
727 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
728 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
729 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
731 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
734 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
735 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
737 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
738 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
739 # There must be no space between the %s and %n due to a wierd problem in sscanf where
740 # it will return %n as longer than the line length
741 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
743 AC_MSG_RESULT([$ac_cv_ps_command])
745 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
746 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
748 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
749 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
750 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
752 AC_MSG_RESULT([$ac_cv_ps_command])
754 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
755 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
757 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
758 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
759 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
761 AC_MSG_RESULT([$ac_cv_ps_command])
763 dnl wonder who takes state instead of stat
764 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
765 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
767 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
768 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
769 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
771 AC_MSG_RESULT([$ac_cv_ps_command])
774 elif ps -el 2>/dev/null | \
775 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
777 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
778 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
779 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
781 AC_MSG_RESULT([$ac_cv_ps_command])
784 elif ps -el 2>/dev/null | \
785 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
787 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
788 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
789 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
791 AC_MSG_RESULT([$ac_cv_ps_command])
794 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
795 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
796 elif ps -el 2>/dev/null | \
797 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
799 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
800 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
801 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
803 AC_MSG_RESULT([$ac_cv_ps_command])
806 elif ps glaxen 2>/dev/null | \
807 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
809 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
810 ac_cv_ps_command="$PATH_TO_PS glaxen"
811 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
813 AC_MSG_RESULT([$ac_cv_ps_command])
816 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
817 dnl Some truncation will happen in UCOMM column
818 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
819 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
820 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
821 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
823 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
824 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
825 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
827 AC_MSG_RESULT([$ac_cv_ps_command])
830 elif ps -Al 2>/dev/null | \
831 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
833 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
834 ac_cv_ps_command="$PATH_TO_PS -Al"
835 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
837 AC_MSG_RESULT([$ac_cv_ps_command])
840 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
843 if test -n "$ac_cv_ps_varlist" ; then
844 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
845 [Variable list for sscanf of 'ps' output])
846 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
847 [Verbatim command to execute for ps in check_procs])
848 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
849 [Format string for scanning ps output in check_procs])
850 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
851 [Number of columns in ps command])
852 EXTRAS="$EXTRAS check_procs check_nagios"
855 AC_PATH_PROG(PATH_TO_PING,ping)
856 AC_PATH_PROG(PATH_TO_PING6,ping6)
858 AC_ARG_WITH(ping_command,
859 ACX_HELP_STRING([--with-ping-command=SYNTAX],
860 [sets syntax for ICMP ping]),
861 with_ping_command=$withval,)
863 AC_MSG_CHECKING(for ICMP ping syntax)
864 ac_cv_ping_packets_first=no
865 ac_cv_ping_has_timeout=no
866 if test -n "$with_ping_command"
868 AC_MSG_RESULT([(command-line) $with_ping_command])
869 if test -n "$ac_cv_ping_packets_first"
871 ac_cv_ping_packets_first=yes
874 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
875 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
876 egrep -i "^round-trip|^rtt" >/dev/null
878 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
879 ac_cv_ping_packets_first=yes
880 AC_MSG_RESULT([$with_ping_command])
882 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
883 egrep -i "^round-trip|^rtt" >/dev/null
885 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
886 ac_cv_ping_packets_first=yes
887 ac_cv_ping_has_timeout=yes
888 AC_MSG_RESULT([$with_ping_command])
890 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
891 egrep -i "^round-trip|^rtt" >/dev/null
893 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
894 ac_cv_ping_packets_first=yes
895 AC_MSG_RESULT([$with_ping_command])
897 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
898 egrep -i "^round-trip|^rtt" >/dev/null
900 with_ping_command="$PATH_TO_PING -n -c %d %s"
901 ac_cv_ping_packets_first=yes
902 AC_MSG_RESULT([$with_ping_command])
904 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
905 egrep -i "^round-trip|^rtt" >/dev/null
907 with_ping_command="$PATH_TO_PING -n %s -c %d"
908 AC_MSG_RESULT([$with_ping_command])
910 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
911 egrep -i "^round-trip|^rtt" >/dev/null
913 with_ping_command="$PATH_TO_PING %s -n %d"
914 AC_MSG_RESULT([$with_ping_command])
916 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
917 egrep -i "^round-trip|^rtt" >/dev/null
919 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
920 AC_MSG_RESULT([$with_ping_command])
922 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
923 egrep -i "^round-trip|^rtt" >/dev/null
925 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
926 AC_MSG_RESULT([$with_ping_command])
928 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
929 egrep -i "^round-trip|^rtt" >/dev/null
931 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
932 ac_cv_ping_packets_first=yes
933 AC_MSG_RESULT([$with_ping_command])
935 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
936 egrep -i "^round-trip|^rtt" >/dev/null
938 with_ping_command="$PATH_TO_PING -n -c %d %s"
939 ac_cv_ping_packets_first=yes
940 AC_MSG_RESULT([$with_ping_command])
943 AC_MSG_WARN([unable to find usable ping syntax])
946 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
947 [path and args for ICMP ping command])
949 if test "x$ac_cv_ping_packets_first" != "xno"
951 AC_DEFINE(PING_PACKETS_FIRST,1,
952 [Define if packet count must precede host])
955 if test "x$ac_cv_ping_has_timeout" != "xno"
957 AC_DEFINE(PING_HAS_TIMEOUT,1,
958 [Define if ping has its own timeout option that should be set])
961 AC_ARG_WITH(ping6_command,
962 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
963 [sets syntax for ICMPv6 ping]),
964 with_ping6_command=$withval,)
966 if test x"$with_ipv6" != xno ; then
967 AC_MSG_CHECKING(for ICMPv6 ping syntax)
968 ac_cv_ping6_packets_first=no
969 if test -n "$with_ping6_command"
971 AC_MSG_RESULT([(command-line) $with_ping6_command])
972 if test -n "$ac_cv_ping6_packets_first"
974 ac_cv_ping6_packets_first=yes
977 elif test "x$PATH_TO_PING6" != "x"; then
978 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
979 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
980 egrep -i "^round-trip|^rtt" >/dev/null
982 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
983 ac_cv_ping6_packets_first=yes
984 AC_MSG_RESULT([$with_ping6_command])
986 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
987 egrep -i "^round-trip|^rtt" >/dev/null
989 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
990 ac_cv_ping6_packets_first=yes
991 ac_cv_ping_has_timeout=yes
992 AC_MSG_RESULT([$with_ping6_command])
994 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
995 egrep -i "^round-trip|^rtt" >/dev/null
997 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
998 ac_cv_ping6_packets_first=yes
999 AC_MSG_RESULT([$with_ping6_command])
1001 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1002 egrep -i "^round-trip|^rtt" >/dev/null
1004 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1005 ac_cv_ping6_packets_first=yes
1006 AC_MSG_RESULT([$with_ping6_command])
1008 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1009 egrep -i "^round-trip|^rtt" >/dev/null
1011 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1012 AC_MSG_RESULT([$with_ping6_command])
1014 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1015 egrep -i "^round-trip|^rtt" >/dev/null
1017 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1018 AC_MSG_RESULT([$with_ping6_command])
1020 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1021 egrep -i "^round-trip|^rtt" >/dev/null
1023 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1024 AC_MSG_RESULT([$with_ping6_command])
1026 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1027 egrep -i "^round-trip|^rtt" >/dev/null
1029 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1030 AC_MSG_RESULT([$with_ping6_command])
1032 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1033 egrep -i "^round-trip|^rtt" >/dev/null
1035 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1036 ac_cv_ping6_packets_first=yes
1037 AC_MSG_RESULT([$with_ping_command])
1039 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1040 egrep -i "^round-trip|^rtt" >/dev/null
1042 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1043 ac_cv_ping6_packets_first=yes
1044 AC_MSG_RESULT([$with_ping6_command])
1048 elif test "x$PATH_TO_PING" != "x"; then
1049 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1050 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1051 egrep -i "^round-trip|^rtt" >/dev/null
1053 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1054 ac_cv_ping6_packets_first=yes
1055 AC_MSG_RESULT([$with_ping6_command])
1057 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1058 egrep -i "^round-trip|^rtt" >/dev/null
1060 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1061 ac_cv_ping6_packets_first=yes
1062 AC_MSG_RESULT([$with_ping6_command])
1064 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1065 egrep -i "^round-trip|^rtt" >/dev/null
1067 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1068 ac_cv_ping6_packets_first=yes
1069 AC_MSG_RESULT([$with_ping6_command])
1071 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1072 egrep -i "^round-trip|^rtt" >/dev/null
1074 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1075 AC_MSG_RESULT([$with_ping6_command])
1077 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1078 egrep -i "^round-trip|^rtt" >/dev/null
1080 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1081 AC_MSG_RESULT([$with_ping6_command])
1083 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1084 egrep -i "^round-trip|^rtt" >/dev/null
1086 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1087 AC_MSG_RESULT([$with_ping6_command])
1089 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1090 egrep -i "^round-trip|^rtt" >/dev/null
1092 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1093 AC_MSG_RESULT([$with_ping6_command])
1095 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1096 egrep -i "^round-trip|^rtt" >/dev/null
1098 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1099 ac_cv_ping6_packets_first=yes
1100 AC_MSG_RESULT([$with_ping_command])
1102 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1103 egrep -i "^round-trip|^rtt" >/dev/null
1105 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1106 ac_cv_ping6_packets_first=yes
1107 AC_MSG_RESULT([$with_ping6_command])
1113 if test "x$with_ping6_command" != "x"; then
1114 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1115 [path and args for ICMPv6 ping command])
1117 AC_MSG_RESULT([none])
1120 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1121 AC_DEFINE(PING6_PACKETS_FIRST,1,
1122 [Define if packet count must precede host])
1126 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1128 AC_MSG_CHECKING(for nslookup syntax)
1129 if test -n "$PATH_TO_NSLOOKUP"
1131 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1133 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1134 AC_MSG_RESULT([$ac_cv_nslookup_command])
1137 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1138 AC_MSG_RESULT([$ac_cv_nslookup_command])
1141 EXTRAS="$EXTRAS check_dns"
1144 AC_MSG_WARN([nslookup command not found])
1147 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1148 [path and args for nslookup])
1150 AC_PATH_PROG(PATH_TO_HOST,host)
1151 if test -n "$ac_cv_path_PATH_TO_HOST"
1153 EXTRAS="$EXTRAS check_dns"
1156 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1157 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1159 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1160 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1162 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1163 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1164 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1165 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1167 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1168 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1170 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1173 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1174 if test -x "$PATH_TO_LMSTAT"
1176 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1178 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1181 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1182 if test -x "$PATH_TO_SMBCLIENT"
1184 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1186 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1190 AC_PATH_PROG(PATH_TO_WHO,who)
1192 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1194 ac_cv_path_to_who="$PATH_TO_WHO -q"
1196 ac_cv_path_to_who="$PATH_TO_WHO"
1199 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1200 [path and arguments for invoking 'who'])
1202 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1203 if test -x "$PATH_TO_SNMPGET"
1205 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1206 EXTRAS="$EXTRAS check_hpjd check_snmp"
1208 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1211 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1212 if test -x "$PATH_TO_SNMPGETNEXT"
1214 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1217 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1219 AC_MSG_CHECKING(for Net::SNMP perl module)
1220 AC_MSG_RESULT([found])
1222 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1225 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1226 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1228 if test -x "$PATH_TO_QUAKESTAT"
1230 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1231 EXTRAS="$EXTRAS check_game"
1233 elif test -x "$PATH_TO_QSTAT"
1235 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1236 EXTRAS="$EXTRAS check_game"
1238 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1241 if test $ac_cv_path_to_qstat
1243 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1244 [path to qstat/quakestat])
1247 AC_PATH_PROG(PATH_TO_FPING,fping)
1248 if test -x "$PATH_TO_FPING"
1250 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1251 EXTRAS="$EXTRAS check_fping"
1253 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1256 AC_PATH_PROG(PATH_TO_SSH,ssh)
1258 if test -x "$PATH_TO_SSH"
1260 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1261 EXTRAS="$EXTRAS check_by_ssh"
1263 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1267 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1268 if test -x "$PATH_TO_MAILQ"
1270 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1272 AC_MSG_WARN([Could not find mailq or eqivalent])
1275 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1276 if test -x "$PATH_TO_QMAIL_QSTAT"
1278 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1280 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1283 dnl SWAP info required is amount allocated/available and amount free
1284 dnl The plugin works through all the swap devices and adds up the total swap
1286 AC_PATH_PROG(PATH_TO_SWAP,swap)
1287 if (test -n "$PATH_TO_SWAP")
1289 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1290 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1293 ac_cv_swap_command="$PATH_TO_SWAP -l"
1294 if [$PATH_TO_SWAP -l 2>/dev/null | \
1295 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1298 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1299 ac_cv_swap_conv=2048
1300 AC_MSG_RESULT([using IRIX format swap])
1302 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1304 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1305 ac_cv_swap_conv=2048
1306 AC_MSG_RESULT([using Unixware format swap])
1308 dnl if we don't know what format swap's output is
1309 dnl we might as well pretend we didn't see it
1311 ac_cv_swap_command=""
1314 dnl end if for PATH_TO_SWAP
1317 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1318 if (test -n "$PATH_TO_SWAPINFO")
1320 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1321 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1324 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1326 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1328 ac_cv_swap_format=["%*s %f %*d %f"]
1329 ac_cv_swap_conv=1024
1330 AC_MSG_RESULT([using FreeBSD format swapinfo])
1333 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1336 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1337 ac_cv_swap_format=["%*s %f %*d %f"]
1338 ac_cv_swap_conv=1024
1339 AC_MSG_RESULT([using HP-UX format swapinfo])
1341 dnl end if for PATH_TO_SWAPINFO
1344 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1345 if (test -n "$PATH_TO_LSPS")
1347 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1348 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1351 ac_cv_swap_command="$PATH_TO_LSPS -a"
1352 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1354 AC_MSG_RESULT([using AIX lsps])
1356 dnl end if for PATH_TO_SWAPINFO
1360 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1361 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1362 dnl in the various BSD's
1365 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1366 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1367 #ifdef HAVE_SYS_PARAM_H
1368 #include <sys/param.h>
1371 AC_CHECK_DECLS([swapctl],,,[
1373 #include <sys/types.h>
1374 #include <sys/param.h>
1375 #include <sys/stat.h>
1376 #include <sys/swap.h>
1378 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1379 #include <sys/types.h>
1380 #include <sys/param.h>
1381 #include <sys/stat.h>
1382 #include <sys/swap.h>
1384 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1386 #include <sys/types.h>
1387 #include <sys/param.h>
1388 #include <sys/stat.h>
1389 #include <sys/swap.h>
1392 if test "$ac_cv_have_decl_swapctl" = "yes";
1394 EXTRAS="$EXTRAS check_swap"
1395 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1396 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1397 "$ac_cv_type_swapent_t" = "yes";
1399 AC_MSG_RESULT([yes])
1400 ac_cv_check_swap_swapctl_svr4="1";
1401 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1402 [Define if 2-argument SVR4 swapctl exists])
1405 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1406 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1408 AC_MSG_RESULT([yes])
1409 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1410 [Define if 3-argument BSD swapctl exists])
1415 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1416 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1419 dnl the SVR4 spec returns values in pages
1421 AC_MSG_RESULT([page])
1422 AC_CHECK_DECLS([sysconf])
1423 AC_MSG_CHECKING([for system page size])
1424 if test "$ac_cv_have_decl_sysconf" = "yes";
1426 AC_MSG_RESULT([determined by sysconf(3)])
1427 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1429 AC_MSG_WARN([don't know. guessing 4096k])
1434 dnl the BSD spec returns values in blocks
1436 AC_MSG_RESULT([blocks (assuming 512b)])
1437 ac_cv_swap_conv=2048
1439 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1440 [Conversion factor to MB])
1443 dnl end tests for the swapctl system calls
1447 if test "x$ac_cv_have_swap" != "x"
1449 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1450 EXTRAS="$EXTRAS check_swap"
1452 if test "x$ac_cv_swap_command" != "x"
1454 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1455 [Path to swap/swapinfo binary, with any args])
1456 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1457 [Format string for parsing swap output])
1458 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1459 [Conversion factor to MB])
1462 dnl dunno why this does not work below - use hack (kbd)
1463 dnl fine on linux, broken on solaris
1464 dnl if /bin/test -e "/proc/meminfo"
1465 AC_MSG_CHECKING([for /proc/meminfo])
1466 if [cat /proc/meminfo > /dev/null 2>&1]
1468 AC_MSG_RESULT([found /proc/meminfo])
1469 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1470 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1471 EXTRAS="$EXTRAS check_swap"
1476 AC_PATH_PROG(PATH_TO_DIG,dig)
1477 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1478 if test -n "$PATH_TO_DIG"; then
1479 EXTRAS="$EXTRAS check_dig"
1482 if test -f plugins/check_nt.c ; then
1483 EXTRAS="$EXTRAS check_nt"
1484 elif test -f ../plugins/check_nt.c ; then
1485 EXTRAS="$EXTRAS check_nt"
1488 AC_MSG_CHECKING(for va_list)
1489 AC_TRY_COMPILE([#ifdef __STDC__
1494 #include <sys/types.h>
1496 #include <varargs.h>
1499 [AC_MSG_RESULT(yes)],
1500 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1504 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1507 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1510 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1513 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1518 AC_SUBST(EXTRA_NETOBJS)
1521 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1522 AM_GNU_GETTEXT_VERSION(0.11.5)
1524 dnl Check for Redhat spopen problem
1525 dnl Wierd problem where ECHILD is returned from a wait call in error
1526 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1527 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1528 dnl We patch plugins/popen.c
1529 if echo $ac_cv_uname_r | egrep "\.EL$" >/dev/null 2>&1 ; then
1530 AC_MSG_CHECKING(for redhat spopen problem)
1531 ( cd config_test && make && make test ) > /dev/null 2>&1
1532 if test $? -eq 0 ; then
1535 AC_MSG_RESULT(error)
1536 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, "Problem on redhat with spopen")
1540 dnl External libraries - see ACKNOWLEDGEMENTS
1549 plugins-root/Makefile
1550 plugins-scripts/Makefile
1551 plugins-scripts/subst
1552 plugins-scripts/utils.pm
1553 plugins-scripts/utils.sh
1561 ACX_FEATURE([with],[perl])
1562 ACX_FEATURE([with],[cgiurl])
1563 ACX_FEATURE([with],[nagios-user])
1564 ACX_FEATURE([with],[nagios-group])
1565 ACX_FEATURE([with],[trusted-path])
1566 ACX_FEATURE([with],[ping-command])
1567 ACX_FEATURE([with],[ping6-command])
1568 ACX_FEATURE([with],[lwres])
1569 ACX_FEATURE([with],[ipv6])
1570 ACX_FEATURE([with],[openssl])
1571 ACX_FEATURE([enable],[emulate-getaddrinfo])