1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_INIT(Helper.pm)
4 VER=1.3.99
5 REL=1
6 AC_SUBST(VER)
7 AC_SUBST(REL)
8 PACKAGE_VERSION="${VER}"
9 AC_SUBST(PACKAGE_VERSION)
10 PACKAGE_RELEASE="${REL}"
11 AC_SUBST(PACKAGE_RELEASE)
12 AM_INIT_AUTOMAKE(nagios-plugins,${PACKAGE_VERSION})
13 AM_CONFIG_HEADER(plugins/config.h)
14 AC_CANONICAL_HOST
16 AC_PREFIX_DEFAULT(/usr/local/nagios)
18 dnl Figure out how to invoke "install" and what install options to use.
20 AC_PROG_INSTALL
21 AC_SUBST(INSTALL)
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_RANLIB
27 AC_AIX
28 AC_MINIX
30 AC_PROG_MAKE_SET
31 AC_PROG_AWK
33 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
34 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
35 # enable the work-around code in fsusage.c.
36 AC_MSG_CHECKING([for statfs that truncates block counts])
37 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
38 [AC_TRY_COMPILE([
39 #if !defined(sun) && !defined(__sun)
40 choke -- this is a workaround for a Sun-specific problem
41 #endif
42 #include <sys/types.h>
43 #include <sys/vfs.h>],
44 [struct statfs t; long c = *(t.f_spare);],
45 fu_cv_sys_truncating_statfs=yes
46 AC_MSG_RESULT(yes),
47 fu_cv_sys_truncating_statfs=no
48 AC_MSG_RESULT(no),
49 )])
50 if test $fu_cv_sys_truncating_statfs = yes; then
51 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
52 [ Define if the block counts reported by statfs may be truncated to 2GB
53 and the correct values may be stored in the f_spare array.
54 (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
55 SunOS 4.1.1 seems not to be affected.)])
56 fi
58 saved_srcdir=$srcdir
59 srcdir=$srcdir/lib
60 test -f $srcdir/getloadavg.c \
61 || AC_MSG_ERROR([getloadavg.c is not in $srcdir])
62 AC_FUNC_GETLOADAVG
63 srcdir=$saved_srcdir
65 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
66 dnl AM_WITH_REGEX
67 AC_PROG_RANLIB
69 AC_PATH_PROG(ACLOCAL,aclocal)
70 AC_PATH_PROG(AUTOMAKE,automake)
71 AC_PATH_PROG(AUTOCONF,autoconf)
72 AC_PATH_PROG(AUTOHEADER,autoheader)
74 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
75 AC_SUBST(PLUGIN_TEST)dnl
77 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
78 AC_SUBST(SCRIPT_TEST)dnl
80 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"
81 AC_SUBST(WARRANTY)
83 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\n"
84 AC_SUBST(SUPPORT)
86 dnl CGIURL has changed for Nagios with 1.0 beta
87 AC_ARG_WITH(cgiurl,
88 ACX_HELP_STRING([--with-cgiurl=DIR],
89 [sets URL for cgi programs]),
90 with_cgiurl=$withval,
91 with_cgiurl=/nagios/cgi-bin)
92 CGIURL="$with_cgiurl"
93 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
95 AC_ARG_WITH(nagios_user,
96 ACX_HELP_STRING([--with-nagios-user=USER],
97 [set user name to run nagios]),
98 with_nagios_user=$withval,
99 with_nagios_user=nagios)
100 AC_ARG_WITH(nagios_group,
101 ACX_HELP_STRING([--with-nagios-group=GROUP],
102 [set group name to run nagios]),
103 with_nagios_group=$withval,
104 with_nagios_group=nagios)
105 AC_SUBST(with_nagios_user)
106 AC_SUBST(with_nagios_group)
107 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
108 AC_SUBST(INSTALL_OPTS)
110 AC_ARG_WITH(trusted_path,
111 ACX_HELP_STRING([--with-trusted-path=PATH],
112 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
113 with_trusted_path=$withval,
114 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
115 AC_SUBST(with_trusted_path)
117 EXTRAS=
118 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
120 LDFLAGS="$LDFLAGS -L."
122 ac_cv_uname_m=`uname -m`
123 ac_cv_uname_s=`uname -s`
124 ac_cv_uname_r=`uname -r`
125 ac_cv_uname_v=`uname -v`
127 dnl Checks for programs.
128 AC_PATH_PROG(PYTHON,python)
129 AC_PATH_PROG(PERL,perl)
130 AC_PATH_PROG(SH,sh)
132 AC_PATH_PROG(HOSTNAME,hostname)
133 AC_PATH_PROG(BASENAME,basename)
135 dnl
136 dnl Check for miscellaneous stuff
137 dnl
139 case $host_vender-$host_os in
140 sun*)
141 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
142 ;;
143 osf*)
144 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
145 ;;
146 esac
148 dnl
149 dnl Checks for libraries.
150 dnl
152 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
153 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
154 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
155 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
156 AC_SUBST(SOCKETLIBS)
158 dnl Check for PostgreSQL libraries
159 _SAVEDLIBS="$LIBS"
160 _SAVEDCPPFLAGS="$CPPFLAGS"
161 AC_ARG_WITH(pgsql,
162 ACX_HELP_STRING([--with-pgsql=DIR],
163 [sets path to pgsql installation]),
164 PGSQL=$withval,)
165 AC_CHECK_LIB(crypt,main)
166 if test "$ac_cv_lib_crypt_main" = "yes"; then
167 if test -n "$PGSQL"; then
168 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
169 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
170 fi
171 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
172 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
173 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
174 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
175 AC_CHECK_HEADERS(libpq-fe.h)
176 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
177 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
178 PGINCLUDE="-I$PGSQL/include"
179 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
180 PGLIBS="-lpq -lcrypt"
181 PGINCLUDE="-I/usr/include/pgsql"
182 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
183 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
184 PGINCLUDE="-I/usr/include/postgresql"
185 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
186 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
187 PGINCLUDE="-I$PGSQL/include"
188 fi
189 if test -z "$PGINCLUDE"; then
190 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
191 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
192 else
193 AC_SUBST(PGLIBS)
194 AC_SUBST(PGINCLUDE)
195 EXTRAS="$EXTRAS check_pgsql"
196 fi
197 else
198 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
199 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
200 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
201 fi
202 else
203 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
204 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
205 fi
206 LIBS="$_SAVEDLIBS"
207 CPPFLAGS="$_SAVEDCPPFLAGS"
209 dnl Check for radius libraries
210 _SAVEDLIBS="$LIBS"
211 AC_CHECK_LIB(radiusclient,rc_read_config)
212 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
213 EXTRAS="$EXTRAS check_radius"
214 RADIUSLIBS="-lradiusclient"
215 AC_SUBST(RADIUSLIBS)
216 else
217 AC_MSG_WARN([Skipping radius plugin])
218 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
219 fi
220 LIBS="$_SAVEDLIBS"
222 dnl Check for LDAP libraries
223 _SAVEDLIBS="$LIBS"
224 AC_CHECK_LIB(ldap,main,,,-llber)
225 if test "$ac_cv_lib_ldap_main" = "yes"; then
226 LDAPLIBS="-lldap -llber"\
227 LDAPINCLUDE="-I/usr/include/ldap"
228 AC_SUBST(LDAPLIBS)
229 AC_SUBST(LDAPINCLUDE)
230 EXTRAS="$EXTRAS check_ldap"
231 else
232 AC_MSG_WARN([Skipping LDAP plugin])
233 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
234 fi
235 LIBS="$_SAVEDLIBS"
238 dnl Check for mysql libraries
239 _SAVEDLIBS="$LIBS"
240 _SAVEDCPPFLAGS="$CPPFLAGS"
241 AC_ARG_WITH(mysql,
242 ACX_HELP_STRING([--with-mysql=DIR],
243 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
244 MYSQL=$withval,)
245 if test -n "$MYSQL"; then
246 MYSQLLIBDIR=$MYSQL/lib/mysql
247 CPPFLAGS="-I$MYSQL/include"
248 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
249 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
250 elif test -f /usr/lib/libmysqlclient.so; then
251 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
252 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
253 elif test -f /usr/lib/libmysqlclient.a; then
254 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
255 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
256 elif test -f /usr/lib/mysql/libmysqlclient.so; then
257 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
258 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
259 elif test -f /usr/lib/mysql/libmysqlclient.a; then
260 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
261 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
262 fi
263 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
264 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
265 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
266 EXTRAS="$EXTRAS check_mysql"
267 AC_SUBST(MYSQLINCLUDE)
268 AC_SUBST(MYSQLLIBS)
269 AC_SUBST(check_mysql_LDFLAGS)
270 else
271 AC_MSG_WARN([Skipping mysql plugin])
272 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
273 fi
274 else
275 AC_MSG_WARN([Skipping mysql plugin])
276 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
277 fi
278 CPPFLAGS="$_SAVEDCPPFLAGS"
279 LIBS="$_SAVEDLIBS"
281 dnl Check for OpenSSL location
282 AC_PATH_PROG(OPENSSL,openssl)
283 if test "$OPENSSL" = "/usr/bin/openssl"; then
284 OPENSSL=/usr
285 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
286 OPENSSL=/usr
287 elif test "$OPENSSL" = "/opt/bin/openssl"; then
288 OPENSSL=/opt
289 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
290 OPENSSL=/opt/openssl
291 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
292 OPENSSL=/usr/slocal
293 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
294 OPENSSL=/usr/local
295 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
296 OPENSSL=/usr/local/ssl
297 fi
298 AC_ARG_WITH(openssl,
299 ACX_HELP_STRING([--with-openssl=DIR],
300 [sets path to openssl installation]),
301 OPENSSL=$withval,)
303 dnl Check for AF_INET6 support
304 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
305 AC_TRY_COMPILE([#include <netinet/in.h>
306 #include <sys/socket.h>],
307 [struct sockaddr_in6 sin6;
308 void *p;
310 sin6.sin6_family = AF_INET6;
311 sin6.sin6_port = 587;
312 p = &sin6.sin6_addr;],
313 [with_ipv6=yes],
314 [with_ipv6=no])
315 ])
317 if test x"$with_ipv6" != xno ; then
318 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
319 fi
321 dnl #########################################################################
322 dnl Check if Posix getaddrinfo() is available. It is also possible to use
323 dnl the version from the lwres library distributed with BIND.
324 dnl #########################################################################
325 AC_ARG_ENABLE([emulate-getaddrinfo],
326 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
327 [enable getaddrinfo emulation (default=no)]),
328 ,
329 enable_emulate_getaddrinfo=no)
330 AC_ARG_WITH(lwres,
331 ACX_HELP_STRING([--with-lwres=DIR],
332 [use lwres library for getaddrinfo (default=no)]),
333 ,
334 with_lwres=no)
336 dnl ## enable force to test getaddrinfo.c
337 if test x$enable_emulate_getaddrinfo = xforce ; then
338 enable_emulate_getaddrinfo=yes
339 have_getaddrinfo=no
340 else
342 have_getaddrinfo=no
343 if test x$with_lwres != xno ; then
344 if test "$with_lwres" != yes ; then
345 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
346 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
347 fi
348 AC_CHECK_HEADERS(lwres/netdb.h, ,
349 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
350 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
351 [AC_MSG_ERROR([cannot find the lwres library])],
352 -lnsl -lpthread)
353 have_getaddrinfo=yes
354 fi
356 if test x$have_getaddrinfo != xyes ; then
357 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
358 fi
360 dnl # Special nonsense for systems that actually have getaddrinfo but
361 dnl # redefine the name to something else, e.g. OSF
362 if test x$have_getaddrinfo != xyes ; then
363 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
364 AC_TRY_LINK([
365 # include <netdb.h>
366 ], [
367 struct addrinfo hints, *res;
368 int err;
370 err = getaddrinfo ("host", "service", &hints, &res);
371 ], [
372 have_getaddrinfo=yes
373 AC_MSG_RESULT(yes)
374 ], [AC_MSG_RESULT(no)])
375 fi
377 fi
379 if test x$have_getaddrinfo != xno ; then
380 if test x$enable_emulate_getaddrinfo != xno ; then
381 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
382 fi
383 AC_DEFINE(HAVE_GETADDRINFO, 1,
384 [Does system provide RFC 2553/Posix getaddrinfo?])
385 else
386 if test x$enable_emulate_getaddrinfo != xyes ; then
387 AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
388 fi
389 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
390 fi
392 if test x"$enable_emulate_getaddrinfo" != xno ; then
393 have_resolver=no
395 dnl Try for getipnodebyname
396 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
397 if test x"$have_resolver" != xno ; then
398 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
399 [Set when getipnodebyname is available])
400 fi
402 dnl Try for gethostbyname_r
403 if test x"$have_resolver" = xno ; then
404 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
405 [have_resolver=yes
406 ACX_WHICH_GETHOSTBYNAME_R])
407 fi
409 dnl Try for gethostbyname
410 if test x"$have_resolver" = xno ; then
411 if test x"$enable_pthreads" != xno ; then
412 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
413 fi
414 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
415 [AC_MSG_ERROR([cannot find gethostbyname])])
416 fi
417 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
418 AC_DEFINE(EMULATE_GETADDRINFO,1,[Define if emulating getaddrinfo])
420 fi
422 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
423 if test "$FOUNDINCLUDE" = "no"; then
424 _SAVEDCPPFLAGS="$CPPFLAGS"
425 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
426 unset ac_cv_header_krb5_h
427 AC_CHECK_HEADERS(krb5.h,
428 KRB5INCLUDE="-I/usr/kerberos/include"
429 FOUNDINCLUDE=yes,
430 FOUNDINCLUDE=no)
431 fi
432 AC_SUBST(KRBINCLUDE)
433 if test "$FOUNDINCLUDE" = "no"; then
434 CPPFLAGS="$_SAVEDCPPFLAGS"
435 fi
437 dnl Check for OpenSSL header files
438 unset FOUNDINCLUDE
439 _SAVEDCPPFLAGS="$CPPFLAGS"
440 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
441 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
442 SSLINCLUDE="-I$OPENSSL/include"
443 FOUNDINCLUDE=yes,
444 FOUNDINCLUDE=no)
445 if test "$FOUNDINCLUDE" = "no"; then
446 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
447 SSLINCLUDE="-I$OPENSSL/include"
448 FOUNDINCLUDE=yes,
449 FOUNDINCLUDE=no)
450 fi
451 AC_SUBST(SSLINCLUDE)
452 if test "$FOUNDINCLUDE" = "no"; then
453 CPPFLAGS="$_SAVEDCPPFLAGS"
454 fi
456 dnl Check for crypto lib
457 _SAVEDLIBS="$LIBS"
458 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
459 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
460 dnl Check for SSL lib
461 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)
462 fi
463 LIBS="$_SAVEDLIBS"
465 dnl test headers and libs to decide whether check_http should use SSL
466 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
467 if test "$ac_cv_lib_ssl_main" = "yes"; then
468 if test "$FOUNDINCLUDE" = "yes"; then
469 AC_SUBST(SSLLIBS)
470 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
471 fi
472 fi
473 fi
474 CPPFLAGS="$_SAVEDCPPFLAGS"
476 dnl
477 dnl Checks for header files.
478 dnl
480 AC_HEADER_STDC
481 AC_HEADER_TIME
482 AC_HEADER_SYS_WAIT
483 AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h unistd.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h)
484 AC_CHECK_HEADERS(stdarg.h sys/unistd.h unistd.h ctype.h stdlib.h)
486 dnl Linux
487 AC_CHECK_HEADERS(sys/vfs.h,
488 [AC_TRY_COMPILE([#include <sys/vfs.h>],
489 [struct statfs buf; long foo; statfs ("/", &buf); foo = buf.f_namelen;],
490 [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
492 dnl FreeBSD
493 AC_CHECK_HEADERS(sys/param.h sys/mount.h,
494 [AC_TRY_COMPILE([#include <sys/param.h>
495 #include <sys/mount.h>],
496 [struct statfs buf; int foo; statfs ("/", &buf); foo = buf.f_flags;],
497 [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
499 dnl Checks for typedefs, structures, and compiler characteristics.
500 AC_C_CONST
501 AC_STRUCT_TM
502 AC_TYPE_PID_T
503 AC_TYPE_SIZE_T
504 AC_TYPE_SIGNAL
506 AC_CHECK_SIZEOF(int,cross)
507 AC_CHECK_SIZEOF(long,cross)
508 AC_CHECK_SIZEOF(short,cross)
510 AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
511 AC_TRY_RUN([#include <stdio.h>
512 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
513 ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
514 if test x"$ac_cv_have_longlong" = x"yes"; then
515 AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
516 fi
518 #
519 # Check if the compiler supports the LL prefix on long long integers.
520 # AIX needs this.
522 AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
523 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
524 ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
525 if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
526 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
527 fi
529 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE_VA_COPY,[
530 AC_TRY_LINK([#include <stdarg.h>
531 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
532 ac_cv_HAVE_VA_COPY=yes,ac_cv_HAVE_VA_COPY=no)])
533 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
534 AC_DEFINE(HAVE_VA_COPY,1,[Define if system has va_copy])
535 fi
537 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
538 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
539 AC_TRY_RUN([
540 #include <sys/types.h>
541 #include <stdarg.h>
542 void foo(const char *format, ...) {
543 va_list ap;
544 int len;
545 char buf[5];
547 va_start(ap, format);
548 len = vsnprintf(buf, 0, format, ap);
549 va_end(ap);
550 if (len != 5) exit(1);
552 va_start(ap, format);
553 len = vsnprintf(0, 0, format, ap);
554 va_end(ap);
555 if (len != 5) exit(1);
557 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
559 exit(0);
560 }
561 main() { foo("hello"); }
562 ],
563 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
564 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
565 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
566 fi
568 AC_TRY_COMPILE([#include <sys/time.h>],
569 [struct timeval *tv;
570 struct timezone *tz;],
571 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
572 AC_TRY_COMPILE([#include <sys/time.h>],
573 [struct timeval *tv;
574 struct timezone *tz;
575 gettimeofday(tv, tz);],
576 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
577 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
579 dnl Checks for library functions.
580 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
582 AC_MSG_CHECKING(return type of socket size)
583 AC_TRY_COMPILE([#include <stdlib.h>
584 #include <sys/types.h>
585 #include <sys/socket.h>],
586 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
587 ac_cv_socket_size_type=["size_t"]
588 AC_MSG_RESULT(size_t),
589 ac_cv_socket_size_type=["int"]
590 AC_MSG_RESULT(int))
592 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
593 [Define type of socket size])
595 if test -f "/proc/loadavg"
596 then
597 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
598 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
599 fi
601 dnl #### Process table test
603 AC_PATH_PROG(PATH_TO_PS,ps)
604 ac_cv_use_ps_vars=no
606 AC_MSG_CHECKING(for ps syntax)
607 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
608 if ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
609 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
610 then
611 ac_cv_use_ps_vars=yes
612 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
613 ac_cv_ps_raw_command="$PATH_TO_PS -weo 'stat user ppid args'"
614 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid comm args'"
615 ac_cv_ps_format="%s %d %d %s %n"
616 ac_cv_vsz_command="$PATH_TO_PS -weo 'vsz comm'"
617 ac_cv_vsz_format="%d %s"
618 ac_cv_rss_command="$PATH_TO_PS -weo 'rss comm'"
619 ac_cv_rss_format="%d %s"
620 EXTRAS="$EXTRAS check_nagios"
621 AC_MSG_RESULT([$ac_cv_ps_command])
623 dnl FreeBSD
624 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
625 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
626 then
627 ac_cv_use_ps_vars=yes
628 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
629 ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
630 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid command command'"
631 ac_cv_ps_format="%s %d %d %s %n"
632 ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
633 ac_cv_vsz_format="%d %s"
634 ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
635 ac_cv_rss_format="%d %s"
636 EXTRAS="$EXTRAS check_nagios"
637 AC_MSG_RESULT([$ac_cv_ps_command])
639 dnl BSD-like mode in RH 6.1
640 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
641 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
642 then
643 ac_cv_use_ps_vars=yes
644 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
645 ac_cv_ps_raw_command="$PATH_TO_PS waxno 'state user ppid comm'"
646 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid comm args'"
647 ac_cv_ps_format="%s %d %d %s %n"
648 ac_cv_vsz_command="$PATH_TO_PS waxno 'vsz comm'"
649 ac_cv_vsz_format="%d %s"
650 ac_cv_rss_command="$PATH_TO_PS waxno 'rss comm'"
651 ac_cv_rss_format="%d %s"
652 EXTRAS="$EXTRAS check_nagios"
653 AC_MSG_RESULT([$ac_cv_ps_command])
655 dnl SunOS 4.1.3:
656 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
657 elif ps -laxnwww 2>/dev/null | \
658 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
659 then
660 ac_cv_use_ps_vars=yes
661 ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
662 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
663 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
664 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %*s %s %*s %*s %n%s"
665 ac_cv_vsz_command="$PATH_TO_PS laxnwww"
666 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %d"
667 ac_cv_rss_command="$PATH_TO_PS laxnwww"
668 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %d"
669 EXTRAS="$EXTRAS check_nagios"
670 AC_MSG_RESULT([$ac_cv_ps_command])
672 dnl Debian Linux / procps v1.2.9:
673 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
674 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
675 dnl
676 elif ps laxnwww 2>/dev/null | \
677 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
678 then
679 ac_cv_use_ps_vars=yes
680 ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
681 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
682 ac_cv_ps_command="$PATH_TO_PS laxnwww"
683 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
684 ac_cv_vsz_command="$PATH_TO_PS laxnwww"
685 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
686 ac_cv_rss_command="$PATH_TO_PS laxnwww"
687 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
688 EXTRAS="$EXTRAS check_nagios"
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 ppid args' 2>/dev/null | \
693 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
694 then
695 ac_cv_use_ps_vars=yes
696 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
697 ac_cv_ps_raw_command="$PATH_TO_PS -axo 'stat user ppid args'"
698 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid comm args'"
699 ac_cv_ps_format="%s %d %d %s %n"
700 ac_cv_vsz_command="$PATH_TO_PS -axo 'vsz comm'"
701 ac_cv_vsz_format="%d %s"
702 ac_cv_rss_command="$PATH_TO_PS -axo 'rss comm'"
703 ac_cv_rss_format="%d %s"
704 EXTRAS="$EXTRAS check_nagios"
705 AC_MSG_RESULT([$ac_cv_ps_command])
707 dnl AIX 4.3.3 - needs verification. This works for Tru64 - needs %*[ +] in PS_FORMAT
708 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
709 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
710 then
711 ac_cv_use_ps_vars=yes
712 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
713 ac_cv_ps_raw_command="$PATH_TO_PS -ao 'stat user ppid args'"
714 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid comm args'"
715 ac_cv_ps_format="[["%s%*[ +] %d %d %s %n"]]"
716 ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz comm'"
717 ac_cv_vsz_format="%d %s"
718 ac_cv_rss_command="$PATH_TO_PS -ao 'rss comm'"
719 ac_cv_rss_format="%d %s"
720 EXTRAS="$EXTRAS check_nagios"
721 AC_MSG_RESULT([$ac_cv_ps_command])
723 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
724 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
725 then
726 ac_cv_use_ps_vars=yes
727 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
728 ac_cv_ps_raw_command="$PATH_TO_PS -eo 's user ppid args'"
729 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid comm args'"
730 ac_cv_ps_format="%s %d %d %s %n"
731 ac_cv_vsz_command="$PATH_TO_PS -eo 'vsz comm'"
732 ac_cv_vsz_format="%d %s"
733 ac_cv_rss_command="$PATH_TO_PS -eo 'rss comm'"
734 ac_cv_rss_format="%d %s"
735 EXTRAS="$EXTRAS check_nagios"
736 AC_MSG_RESULT([$ac_cv_ps_command])
738 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
739 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
740 then
741 ac_cv_use_ps_vars=yes
742 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
743 ac_cv_ps_raw_command="$PATH_TO_PS -Ao 's user ppid args'"
744 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid comm args'"
745 ac_cv_ps_format="%s %d %d %s %n"
746 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
747 ac_cv_vsz_format="%d %s"
748 ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
749 ac_cv_rss_format="%d %s"
750 EXTRAS="$EXTRAS check_nagios"
751 AC_MSG_RESULT([$ac_cv_ps_command])
753 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
754 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
755 then
756 ac_cv_use_ps_vars=yes
757 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
758 ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'status user ppid args'"
759 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid comm args'"
760 ac_cv_ps_format="%s %d %d %s %n"
761 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
762 ac_cv_vsz_format="%d %s"
763 ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
764 ac_cv_rss_format="%d %s"
765 EXTRAS="$EXTRAS check_nagios"
766 AC_MSG_RESULT([$ac_cv_ps_command])
768 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
769 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
770 then
771 ac_cv_use_ps_vars=yes
772 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
773 ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'state user ppid args'"
774 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid comm args'"
775 ac_cv_ps_format="%s %d %d %s %n"
776 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
777 ac_cv_vsz_format="%d %s"
778 ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
779 ac_cv_rss_format="%d %s"
780 EXTRAS="$EXTRAS check_nagios"
781 AC_MSG_RESULT([$ac_cv_ps_command])
783 dnl wonder who takes state instead of stat
784 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
785 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
786 then
787 ac_cv_use_ps_vars=yes
788 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
789 ac_cv_ps_raw_command="$PATH_TO_PS -ao 'state user ppid args'"
790 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid command args'"
791 ac_cv_ps_format="%s %d %d %s %n"
792 ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz command'"
793 ac_cv_vsz_format="%d %s"
794 ac_cv_rss_command="$PATH_TO_PS -ao 'rss command'"
795 ac_cv_rss_format="%d %s"
796 EXTRAS="$EXTRAS check_nagios"
797 AC_MSG_RESULT([$ac_cv_ps_command])
799 dnl IRIX 53
800 elif ps -el 2>/dev/null | \
801 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
802 then
803 ac_cv_use_ps_vars=yes
804 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
805 ac_cv_ps_command="$PATH_TO_PS -el"
806 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
807 ac_cv_vsz_command="$PATH_TO_PS -el"
808 ac_cv_vsz_format="%*s %*s %*s %*s %d"
809 ac_cv_rss_command="$PATH_TO_PS -el"
810 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
811 AC_MSG_RESULT([$ac_cv_ps_command])
813 dnl IRIX 63
814 elif ps -el 2>/dev/null | \
815 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
816 then
817 ac_cv_use_ps_vars=yes
818 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
819 ac_cv_ps_command="$PATH_TO_PS -el"
820 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
821 ac_cv_vsz_command="$PATH_TO_PS -el"
822 ac_cv_vsz_format="%*s %*s %*s %*s %d"
823 ac_cv_rss_command="$PATH_TO_PS -el"
824 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
825 AC_MSG_RESULT([$ac_cv_ps_command])
827 dnl AIX 4.1:
828 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
829 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
830 elif ps -el 2>/dev/null | \
831 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
832 then
833 ac_cv_use_ps_vars=yes
834 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
835 ac_cv_ps_command="$PATH_TO_PS -el"
836 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
837 ac_cv_vsz_command="$PATH_TO_PS -el"
838 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
839 ac_cv_rss_command="$PATH_TO_PS -el"
840 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
841 AC_MSG_RESULT([$ac_cv_ps_command])
843 dnl AIX?
844 elif ps glaxen 2>/dev/null | \
845 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
846 then
847 ac_cv_use_ps_vars=yes
848 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
849 ac_cv_ps_command="$PATH_TO_PS glaxen"
850 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
851 ac_cv_vsz_command="$PATH_TO_PS glaxen"
852 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
853 ac_cv_rss_command="$PATH_TO_PS glaxen"
854 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
855 AC_MSG_RESULT([$ac_cv_ps_command])
857 dnl MacOSX / Darwin
858 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
859 dnl STAT VSZ RSS UID USER PPID UCOMM COMMAND
860 dnl Ss 1308 272 0 root 0 init /sbin/init
861 elif ps waxo 'state vsz rss uid user ppid ucomm command' 2>/dev/null | \
862 egrep -i ["^STAT +VSZ +RSS +UID +USER +PPID +UCOMM +COMMAND"] >/dev/null
863 then
864 ac_cv_use_ps_vars=yes
865 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
866 ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
867 ac_cv_ps_command="$PATH_TO_PS waxo 'state uid ppid ucomm command'"
868 ac_cv_ps_format="%s %d %d %s %n"
869 ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
870 ac_cv_vsz_format="%d %s"
871 ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
872 ac_cv_rss_format="%d %s"
873 EXTRAS="$EXTRAS check_nagios"
874 AC_MSG_RESULT([$ac_cv_ps_command])
876 dnl UnixWare
877 elif ps -Al 2>/dev/null | \
878 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
879 then
880 ac_cv_use_ps_vars=yes
881 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
882 ac_cv_ps_command="$PATH_TO_PS -Al"
883 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
884 if ps -Ao 'vsz comm' 2>/dev/null | \
885 egrep -i ["^ *VSZ +COMMAND"] >/dev/null
886 then
887 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
888 ac_cv_vsz_format="%*s %d"
889 fi
890 AC_MSG_RESULT([$ac_cv_ps_command])
892 else
893 AC_MSG_WARN([unable to find usable ps syntax])
894 fi
896 if test "x$ac_cv_use_ps_vars" != "xno"
897 then
898 AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
899 fi
900 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
901 [Variable list for sscanf of 'ps' output])
902 AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$ac_cv_ps_raw_command",
903 [Verbatim command to execute for ps in check_netsaint])
904 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
905 [Verbatim command to execute for ps in check_procs])
906 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
907 [Format string for scanning ps output in check_procs])
908 AC_DEFINE_UNQUOTED(VSZ_COMMAND,"$ac_cv_vsz_command",
909 [Verbatim command to execute for ps in check_vsz])
910 AC_DEFINE_UNQUOTED(VSZ_FORMAT,"$ac_cv_vsz_format",
911 [Format string for scanning ps output in check_vsz])
912 AC_DEFINE_UNQUOTED(RSS_COMMAND,"$ac_cv_rss_command",
913 [Verbatim command to execute for ps in check_rss])
914 AC_DEFINE_UNQUOTED(RSS_FORMAT,"$ac_cv_rss_format",
915 [Format string for scanning ps output in check_rss])
917 AC_PATH_PROG(PATH_TO_DF,df)
918 AC_PATH_PROG(PATH_TO_BDF,bdf)
920 AC_ARG_WITH(df_command,
921 ACX_HELP_STRING([--with-df-command=SYNTAX],
922 [sets syntax for df]),
923 with_df_command=$withval,)
925 AC_MSG_CHECKING(for df syntax)
926 if test -n "$with_df_command"
927 then
928 AC_MSG_RESULT([$with_df_command])
930 elif df -Pk 2>/dev/null | egrep -i ["^(/dev/|[a-zA-Z]:)[a-z0-9/\\]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/\\]*"] >/dev/null
931 then
932 with_df_command="$PATH_TO_DF -Pk"
933 AC_MSG_RESULT([$with_df_command])
935 elif df -k 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
936 then
937 with_df_command="$PATH_TO_DF -k"
938 AC_MSG_RESULT([$with_df_command])
940 elif df 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
941 then
942 with_df_command="$PATH_TO_DF"
943 AC_MSG_RESULT([$with_df_command])
945 elif bdf 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
946 then
947 with_df_command="$PATH_TO_BDF"
948 AC_MSG_RESULT([$with_df_command])
950 else
951 AC_MSG_WARN([unable to find usable df syntax])
952 fi
954 AC_DEFINE_UNQUOTED(DF_COMMAND,"$with_df_command",[path and args for df command])
956 AC_PATH_PROG(PATH_TO_PING,ping)
957 AC_PATH_PROG(PATH_TO_PING6,ping6)
959 AC_ARG_WITH(ping_command,
960 ACX_HELP_STRING([--with-ping-command=SYNTAX],
961 [sets syntax for ICMP ping]),
962 with_ping_command=$withval,)
964 AC_MSG_CHECKING(for ICMP ping syntax)
965 ac_cv_ping_packets_first=no
966 if test -n "$with_ping_command"
967 then
968 AC_MSG_RESULT([(command-line) $with_ping_command])
969 if test -n "$ac_cv_ping_packets_first"
970 then
971 ac_cv_ping_packets_first=yes
972 fi
974 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
975 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
976 egrep -i "^round-trip|^rtt" >/dev/null
977 then
978 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
979 ac_cv_ping_packets_first=yes
980 AC_MSG_RESULT([$with_ping_command])
982 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
983 egrep -i "^round-trip|^rtt" >/dev/null
984 then
985 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
986 ac_cv_ping_packets_first=yes
987 AC_MSG_RESULT([$with_ping_command])
989 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
990 egrep -i "^round-trip|^rtt" >/dev/null
991 then
992 with_ping_command="$PATH_TO_PING -n -c %d %s"
993 ac_cv_ping_packets_first=yes
994 AC_MSG_RESULT([$with_ping_command])
996 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
997 egrep -i "^round-trip|^rtt" >/dev/null
998 then
999 with_ping_command="$PATH_TO_PING -n %s -c %d"
1000 AC_MSG_RESULT([$with_ping_command])
1002 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1003 egrep -i "^round-trip|^rtt" >/dev/null
1004 then
1005 with_ping_command="$PATH_TO_PING %s -n %d"
1006 AC_MSG_RESULT([$with_ping_command])
1008 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1009 egrep -i "^round-trip|^rtt" >/dev/null
1010 then
1011 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1012 AC_MSG_RESULT([$with_ping_command])
1014 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1015 egrep -i "^round-trip|^rtt" >/dev/null
1016 then
1017 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1018 AC_MSG_RESULT([$with_ping_command])
1020 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1021 egrep -i "^round-trip|^rtt" >/dev/null
1022 then
1023 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1024 ac_cv_ping_packets_first=yes
1025 AC_MSG_RESULT([$with_ping_command])
1027 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1028 egrep -i "^round-trip|^rtt" >/dev/null
1029 then
1030 with_ping_command="$PATH_TO_PING -n -c %d %s"
1031 ac_cv_ping_packets_first=yes
1032 AC_MSG_RESULT([$with_ping_command])
1034 else
1035 AC_MSG_WARN([unable to find usable ping syntax])
1036 fi
1038 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1039 [path and args for ICMP ping command])
1041 if test "x$ac_cv_ping_packets_first" != "xno"
1042 then
1043 AC_DEFINE(PING_PACKETS_FIRST,1,
1044 [Define if packet count must precede host])
1045 fi
1047 AC_ARG_WITH(ping6_command,
1048 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1049 [sets syntax for ICMPv6 ping]),
1050 with_ping6_command=$withval,)
1052 if test x"$with_ipv6" != xno ; then
1053 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1054 ac_cv_ping6_packets_first=no
1055 if test -n "$with_ping6_command"
1056 then
1057 AC_MSG_RESULT([(command-line) $with_ping6_command])
1058 if test -n "$ac_cv_ping6_packets_first"
1059 then
1060 ac_cv_ping6_packets_first=yes
1061 fi
1063 elif test "x$PATH_TO_PING6" != "x"; then
1064 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1065 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1066 egrep -i "^round-trip|^rtt" >/dev/null
1067 then
1068 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1069 ac_cv_ping6_packets_first=yes
1070 AC_MSG_RESULT([$with_ping6_command])
1072 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1073 egrep -i "^round-trip|^rtt" >/dev/null
1074 then
1075 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1076 ac_cv_ping6_packets_first=yes
1077 AC_MSG_RESULT([$with_ping6_command])
1079 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1080 egrep -i "^round-trip|^rtt" >/dev/null
1081 then
1082 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1083 ac_cv_ping6_packets_first=yes
1084 AC_MSG_RESULT([$with_ping6_command])
1086 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1087 egrep -i "^round-trip|^rtt" >/dev/null
1088 then
1089 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1090 AC_MSG_RESULT([$with_ping6_command])
1092 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1093 egrep -i "^round-trip|^rtt" >/dev/null
1094 then
1095 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1096 AC_MSG_RESULT([$with_ping6_command])
1098 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1099 egrep -i "^round-trip|^rtt" >/dev/null
1100 then
1101 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1102 AC_MSG_RESULT([$with_ping6_command])
1104 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1105 egrep -i "^round-trip|^rtt" >/dev/null
1106 then
1107 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1108 AC_MSG_RESULT([$with_ping6_command])
1110 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1111 egrep -i "^round-trip|^rtt" >/dev/null
1112 then
1113 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1114 ac_cv_ping6_packets_first=yes
1115 AC_MSG_RESULT([$with_ping_command])
1117 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1118 egrep -i "^round-trip|^rtt" >/dev/null
1119 then
1120 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1121 ac_cv_ping6_packets_first=yes
1122 AC_MSG_RESULT([$with_ping6_command])
1124 fi
1126 elif test "x$PATH_TO_PING" != "x"; then
1127 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1128 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1129 egrep -i "^round-trip|^rtt" >/dev/null
1130 then
1131 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1132 ac_cv_ping6_packets_first=yes
1133 AC_MSG_RESULT([$with_ping6_command])
1135 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1136 egrep -i "^round-trip|^rtt" >/dev/null
1137 then
1138 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1139 ac_cv_ping6_packets_first=yes
1140 AC_MSG_RESULT([$with_ping6_command])
1142 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1143 egrep -i "^round-trip|^rtt" >/dev/null
1144 then
1145 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1146 ac_cv_ping6_packets_first=yes
1147 AC_MSG_RESULT([$with_ping6_command])
1149 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1150 egrep -i "^round-trip|^rtt" >/dev/null
1151 then
1152 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1153 AC_MSG_RESULT([$with_ping6_command])
1155 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1156 egrep -i "^round-trip|^rtt" >/dev/null
1157 then
1158 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1159 AC_MSG_RESULT([$with_ping6_command])
1161 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1162 egrep -i "^round-trip|^rtt" >/dev/null
1163 then
1164 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1165 AC_MSG_RESULT([$with_ping6_command])
1167 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1168 egrep -i "^round-trip|^rtt" >/dev/null
1169 then
1170 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1171 AC_MSG_RESULT([$with_ping6_command])
1173 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1174 egrep -i "^round-trip|^rtt" >/dev/null
1175 then
1176 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1177 ac_cv_ping6_packets_first=yes
1178 AC_MSG_RESULT([$with_ping_command])
1180 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1181 egrep -i "^round-trip|^rtt" >/dev/null
1182 then
1183 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1184 ac_cv_ping6_packets_first=yes
1185 AC_MSG_RESULT([$with_ping6_command])
1187 fi
1189 fi
1191 if test "x$with_ping6_command" != "x"; then
1192 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1193 [path and args for ICMPv6 ping command])
1194 else
1195 AC_MSG_RESULT([none])
1196 fi
1198 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1199 AC_DEFINE(PING6_PACKETS_FIRST,1,
1200 [Define if packet count must precede host])
1201 fi
1202 fi
1204 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1206 AC_MSG_CHECKING(for nslookup syntax)
1207 if test -n "$PATH_TO_NSLOOKUP"
1208 then
1209 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1210 then
1211 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1212 AC_MSG_RESULT([$ac_cv_nslookup_command])
1214 else
1215 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1216 AC_MSG_RESULT([$ac_cv_nslookup_command])
1218 fi
1219 EXTRAS="$EXTRAS check_dns"
1221 else
1222 AC_MSG_WARN([nslookup command not found])
1223 fi
1225 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1226 [path and args for nslookup])
1228 AC_PATH_PROG(PATH_TO_HOST,host)
1229 if test -n "$ac_cv_path_PATH_TO_HOST"
1230 then
1231 EXTRAS="$EXTRAS check_dns"
1232 fi
1234 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1235 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1237 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1238 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1240 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1241 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1242 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1243 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1244 then
1245 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1246 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1247 else
1248 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1249 fi
1251 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1252 if test -x "$PATH_TO_LMSTAT"
1253 then
1254 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1255 else
1256 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1257 fi
1259 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1260 if test -x "$PATH_TO_SMBCLIENT"
1261 then
1262 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1263 else
1264 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1265 fi
1268 AC_PATH_PROG(PATH_TO_WHO,who)
1270 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1271 then
1272 ac_cv_path_to_who="$PATH_TO_WHO -q"
1273 else
1274 ac_cv_path_to_who="$PATH_TO_WHO"
1275 fi
1277 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1278 [path and arguments for invoking 'who'])
1280 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1281 if test -x "$PATH_TO_SNMPGET"
1282 then
1283 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1284 EXTRAS="$EXTRAS check_hpjd check_snmp"
1285 else
1286 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1287 fi
1289 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1290 if test -x "$PATH_TO_SNMPGETNEXT"
1291 then
1292 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1293 fi
1295 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1296 then
1297 AC_MSG_CHECKING(for Net::SNMP perl module)
1298 AC_MSG_RESULT([found])
1299 else
1300 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1301 fi
1303 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1304 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1306 if test -x "$PATH_TO_QUAKESTAT"
1307 then
1308 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1309 EXTRAS="$EXTRAS check_game"
1311 elif test -x "$PATH_TO_QSTAT"
1312 then
1313 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1314 EXTRAS="$EXTRAS check_game"
1315 else
1316 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1317 fi
1319 if test $ac_cv_path_to_qstat
1320 then
1321 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1322 [path to qstat/quakestat])
1323 fi
1325 AC_PATH_PROG(PATH_TO_FPING,fping)
1326 if test -x "$PATH_TO_FPING"
1327 then
1328 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1329 EXTRAS="$EXTRAS check_fping"
1330 else
1331 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1332 fi
1334 AC_PATH_PROG(PATH_TO_SSH,ssh)
1336 if test -x "$PATH_TO_SSH"
1337 then
1338 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1339 EXTRAS="$EXTRAS check_by_ssh"
1340 else
1341 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1342 fi
1345 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1346 if test -x "$PATH_TO_MAILQ"
1347 then
1348 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1349 else
1350 AC_MSG_WARN([Could not find mailq or eqivalent])
1351 fi
1353 dnl SWAP info required is amount allocated/available and amount free
1354 dnl The plugin works through all the swap devices and adds up the total swap
1355 dnl available.
1357 dnl dunno why this does not work below - use hack (kbd)
1358 dnl fine on linux, broken on solaris
1359 dnl if /bin/test -e "/proc/meminfo"
1361 AC_PATH_PROG(PATH_TO_SWAP,swap)
1362 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1364 AC_MSG_CHECKING(for how to check memory)
1365 if [cat /proc/meminfo > /dev/null 2>&1]
1366 then
1367 AC_MSG_RESULT([found /proc/meminfo])
1368 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1369 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1370 EXTRAS="$EXTRAS check_swap"
1372 elif [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1373 then
1374 ac_cv_have_swap=yes
1375 ac_cv_swap_command="$PATH_TO_SWAP -l"
1376 if [$PATH_TO_SWAP -l 2>/dev/null | \
1377 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1378 >/dev/null]
1379 then
1380 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1381 AC_MSG_RESULT([using IRIX format swap])
1383 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null]
1384 then
1385 ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
1386 AC_MSG_RESULT([using Solaris format swap])
1388 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1389 then
1390 ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
1391 AC_MSG_RESULT([using Unixware format swap])
1393 fi
1394 EXTRAS="$EXTRAS check_swap"
1396 elif [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1397 then
1398 ac_cv_have_swap=yes
1399 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1401 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1402 then
1403 ac_cv_swap_format=["%*s %d %*d %d"]
1404 AC_MSG_RESULT([using FreeBSD format swapinfo])
1405 fi
1406 EXTRAS="$EXTRAS check_swap"
1408 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1409 then
1410 ac_cv_have_swap=yes
1411 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1412 ac_cv_swap_format=["%*s %d %*d %d"]
1413 AC_MSG_RESULT([using HP-UX format swapinfo])
1414 fi
1416 if test x$ac_cv_have_swap != x
1417 then
1418 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1419 fi
1420 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1421 [Format string for parsing swap output])
1422 if test "x$ac_cv_swap_command" != "x"
1423 then
1424 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1425 [Path to swap/swapinfo binary, with any args])
1426 fi
1428 AC_PATH_PROG(PATH_TO_DIG,dig)
1429 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1430 if test -n "$PATH_TO_DIG"; then
1431 EXTRAS="$EXTRAS check_dig"
1432 fi
1434 if test -f plugins/check_nt.c ; then
1435 EXTRAS="$EXTRAS check_nt"
1436 elif test -f ../plugins/check_nt.c ; then
1437 EXTRAS="$EXTRAS check_nt"
1438 fi
1440 AC_MSG_CHECKING(for va_list)
1441 AC_TRY_COMPILE([#ifdef __STDC__
1442 #include <stdio.h>
1443 #include <stdlib.h>
1444 #include <stdarg.h>
1445 #else
1446 #include <sys/types.h>
1447 #include <stdio.h>
1448 #include <varargs.h>
1449 #endif],
1450 [va_list args;],
1451 [AC_MSG_RESULT(yes)],
1452 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1454 AC_SUBST(EXTRAS)
1455 AC_SUBST(EXTRA_NETOBJS)
1456 AC_SUBST(DEPLIBS)
1458 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
1460 AC_OUTPUT(Makefile subst lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,PATH=.:..:$PATH subst.sh command.cfg)
1462 ACX_FEATURE([with],[cgiurl])
1463 ACX_FEATURE([with],[nagios-user])
1464 ACX_FEATURE([with],[nagios-group])
1465 ACX_FEATURE([with],[trusted-path])
1466 ACX_FEATURE([with],[df-command])
1467 ACX_FEATURE([with],[ping-command])
1468 ACX_FEATURE([with],[ping6-command])
1469 ACX_FEATURE([with],[lwres])
1470 ACX_FEATURE([with],[ipv6])
1471 ACX_FEATURE([enable],[emulate-getaddrinfo])