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)
331 AC_ARG_WITH(lwres,
332 ACX_HELP_STRING([--with-lwres=DIR],
333 [use lwres library for getaddrinfo (default=no)]),
334 ,
335 with_lwres=no)
337 dnl ## enable force to test getaddrinfo.c
338 if test x$enable_emulate_getaddrinfo = xforce ; then
339 enable_emulate_getaddrinfo=yes
340 have_getaddrinfo=no
341 else
343 have_getaddrinfo=no
344 if test x$with_lwres != xno ; then
345 if test "$with_lwres" != yes ; then
346 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
347 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
348 fi
349 AC_CHECK_HEADERS(lwres/netdb.h, ,
350 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
351 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
352 [AC_MSG_ERROR([cannot find the lwres library])],
353 -lnsl -lpthread)
354 have_getaddrinfo=yes
355 fi
357 if test x$have_getaddrinfo != xyes ; then
358 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
359 fi
361 dnl # Special nonsense for systems that actually have getaddrinfo but
362 dnl # redefine the name to something else, e.g. OSF
363 if test x$have_getaddrinfo != xyes ; then
364 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
365 AC_TRY_LINK([
366 # include <netdb.h>
367 ], [
368 struct addrinfo hints, *res;
369 int err;
371 err = getaddrinfo ("host", "service", &hints, &res);
372 ], [
373 have_getaddrinfo=yes
374 AC_MSG_RESULT(yes)
375 ], [AC_MSG_RESULT(no)])
376 fi
378 fi
380 if test x$have_getaddrinfo != xno ; then
381 if test x$enable_emulate_getaddrinfo != xno ; then
382 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
383 fi
384 AC_DEFINE(HAVE_GETADDRINFO, 1,
385 [Does system provide RFC 2553/Posix getaddrinfo?])
386 else
387 if test x$enable_emulate_getaddrinfo != xyes ; then
388 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
389 enable_emulate_getaddrinfo=yes
390 AC_MSG_WARN([enabling getaddrinfo emulation])
391 fi
392 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
393 fi
395 if test x"$enable_emulate_getaddrinfo" != xno ; then
396 have_resolver=no
398 dnl Try for getipnodebyname
399 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
400 if test x"$have_resolver" != xno ; then
401 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
402 [Set when getipnodebyname is available])
403 fi
405 dnl Try for gethostbyname_r
406 if test x"$have_resolver" = xno ; then
407 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
408 [have_resolver=yes
409 ACX_WHICH_GETHOSTBYNAME_R])
410 fi
412 dnl Try for gethostbyname
413 if test x"$have_resolver" = xno ; then
414 if test x"$enable_pthreads" != xno ; then
415 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
416 fi
417 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
418 [AC_MSG_ERROR([cannot find gethostbyname])])
419 fi
420 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
422 fi
424 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
425 if test "$FOUNDINCLUDE" = "no"; then
426 _SAVEDCPPFLAGS="$CPPFLAGS"
427 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
428 unset ac_cv_header_krb5_h
429 AC_CHECK_HEADERS(krb5.h,
430 KRB5INCLUDE="-I/usr/kerberos/include"
431 FOUNDINCLUDE=yes,
432 FOUNDINCLUDE=no)
433 fi
434 AC_SUBST(KRBINCLUDE)
435 if test "$FOUNDINCLUDE" = "no"; then
436 CPPFLAGS="$_SAVEDCPPFLAGS"
437 fi
439 dnl Check for OpenSSL header files
440 unset FOUNDINCLUDE
441 _SAVEDCPPFLAGS="$CPPFLAGS"
442 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
443 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
444 SSLINCLUDE="-I$OPENSSL/include"
445 FOUNDINCLUDE=yes,
446 FOUNDINCLUDE=no)
447 if test "$FOUNDINCLUDE" = "no"; then
448 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
449 SSLINCLUDE="-I$OPENSSL/include"
450 FOUNDINCLUDE=yes,
451 FOUNDINCLUDE=no)
452 fi
453 AC_SUBST(SSLINCLUDE)
454 if test "$FOUNDINCLUDE" = "no"; then
455 CPPFLAGS="$_SAVEDCPPFLAGS"
456 fi
458 dnl Check for crypto lib
459 _SAVEDLIBS="$LIBS"
460 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
461 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
462 dnl Check for SSL lib
463 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)
464 fi
465 LIBS="$_SAVEDLIBS"
467 dnl test headers and libs to decide whether check_http should use SSL
468 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
469 if test "$ac_cv_lib_ssl_main" = "yes"; then
470 if test "$FOUNDINCLUDE" = "yes"; then
471 AC_SUBST(SSLLIBS)
472 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
473 fi
474 fi
475 fi
476 CPPFLAGS="$_SAVEDCPPFLAGS"
478 dnl
479 dnl Checks for header files.
480 dnl
482 AC_HEADER_STDC
483 AC_HEADER_TIME
484 AC_HEADER_SYS_WAIT
485 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)
486 AC_CHECK_HEADERS(stdarg.h sys/unistd.h unistd.h ctype.h stdlib.h)
488 dnl Linux
489 AC_CHECK_HEADERS(sys/vfs.h,
490 [AC_TRY_COMPILE([#include <sys/vfs.h>],
491 [struct statfs buf; long foo; statfs ("/", &buf); foo = buf.f_namelen;],
492 [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
494 dnl FreeBSD
495 AC_CHECK_HEADERS(sys/param.h sys/mount.h,
496 [AC_TRY_COMPILE([#include <sys/param.h>
497 #include <sys/mount.h>],
498 [struct statfs buf; int foo; statfs ("/", &buf); foo = buf.f_flags;],
499 [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
501 dnl Checks for typedefs, structures, and compiler characteristics.
502 AC_C_CONST
503 AC_STRUCT_TM
504 AC_TYPE_PID_T
505 AC_TYPE_SIZE_T
506 AC_TYPE_SIGNAL
508 AC_CHECK_SIZEOF(int,cross)
509 AC_CHECK_SIZEOF(long,cross)
510 AC_CHECK_SIZEOF(short,cross)
512 AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
513 AC_TRY_RUN([#include <stdio.h>
514 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
515 ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
516 if test x"$ac_cv_have_longlong" = x"yes"; then
517 AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
518 fi
520 #
521 # Check if the compiler supports the LL prefix on long long integers.
522 # AIX needs this.
524 AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
525 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
526 ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
527 if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
528 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
529 fi
531 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE_VA_COPY,[
532 AC_TRY_LINK([#include <stdarg.h>
533 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
534 ac_cv_HAVE_VA_COPY=yes,ac_cv_HAVE_VA_COPY=no)])
535 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
536 AC_DEFINE(HAVE_VA_COPY,1,[Define if system has va_copy])
537 fi
539 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
540 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
541 AC_TRY_RUN([
542 #include <sys/types.h>
543 #include <stdarg.h>
544 void foo(const char *format, ...) {
545 va_list ap;
546 int len;
547 char buf[5];
549 va_start(ap, format);
550 len = vsnprintf(buf, 0, format, ap);
551 va_end(ap);
552 if (len != 5) exit(1);
554 va_start(ap, format);
555 len = vsnprintf(0, 0, format, ap);
556 va_end(ap);
557 if (len != 5) exit(1);
559 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
561 exit(0);
562 }
563 main() { foo("hello"); }
564 ],
565 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
566 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
567 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
568 fi
570 AC_TRY_COMPILE([#include <sys/time.h>],
571 [struct timeval *tv;
572 struct timezone *tz;],
573 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
574 AC_TRY_COMPILE([#include <sys/time.h>],
575 [struct timeval *tv;
576 struct timezone *tz;
577 gettimeofday(tv, tz);],
578 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
579 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
581 dnl Checks for library functions.
582 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
584 AC_MSG_CHECKING(return type of socket size)
585 AC_TRY_COMPILE([#include <stdlib.h>
586 #include <sys/types.h>
587 #include <sys/socket.h>],
588 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
589 ac_cv_socket_size_type=["size_t"]
590 AC_MSG_RESULT(size_t),
591 ac_cv_socket_size_type=["int"]
592 AC_MSG_RESULT(int))
594 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
595 [Define type of socket size])
597 if test -f "/proc/loadavg"
598 then
599 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
600 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
601 fi
603 dnl #### Process table test
605 AC_PATH_PROG(PATH_TO_PS,ps)
606 ac_cv_use_ps_vars=no
608 AC_MSG_CHECKING(for ps syntax)
609 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
610 if ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
611 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
612 then
613 ac_cv_use_ps_vars=yes
614 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
615 ac_cv_ps_raw_command="$PATH_TO_PS -weo 'stat user ppid args'"
616 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid comm args'"
617 ac_cv_ps_format="%s %d %d %s %n"
618 ac_cv_vsz_command="$PATH_TO_PS -weo 'vsz comm'"
619 ac_cv_vsz_format="%d %s"
620 ac_cv_rss_command="$PATH_TO_PS -weo 'rss comm'"
621 ac_cv_rss_format="%d %s"
622 EXTRAS="$EXTRAS check_nagios"
623 AC_MSG_RESULT([$ac_cv_ps_command])
625 dnl FreeBSD
626 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
627 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
628 then
629 ac_cv_use_ps_vars=yes
630 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
631 ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
632 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid command command'"
633 ac_cv_ps_format="%s %d %d %s %n"
634 ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
635 ac_cv_vsz_format="%d %s"
636 ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
637 ac_cv_rss_format="%d %s"
638 EXTRAS="$EXTRAS check_nagios"
639 AC_MSG_RESULT([$ac_cv_ps_command])
641 dnl BSD-like mode in RH 6.1
642 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
643 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
644 then
645 ac_cv_use_ps_vars=yes
646 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
647 ac_cv_ps_raw_command="$PATH_TO_PS waxno 'state user ppid comm'"
648 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid comm args'"
649 ac_cv_ps_format="%s %d %d %s %n"
650 ac_cv_vsz_command="$PATH_TO_PS waxno 'vsz comm'"
651 ac_cv_vsz_format="%d %s"
652 ac_cv_rss_command="$PATH_TO_PS waxno 'rss comm'"
653 ac_cv_rss_format="%d %s"
654 EXTRAS="$EXTRAS check_nagios"
655 AC_MSG_RESULT([$ac_cv_ps_command])
657 dnl SunOS 4.1.3:
658 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
659 elif ps -laxnwww 2>/dev/null | \
660 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
661 then
662 ac_cv_use_ps_vars=yes
663 ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
664 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
665 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
666 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %*s %s %*s %*s %n%s"
667 ac_cv_vsz_command="$PATH_TO_PS laxnwww"
668 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %d"
669 ac_cv_rss_command="$PATH_TO_PS laxnwww"
670 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %d"
671 EXTRAS="$EXTRAS check_nagios"
672 AC_MSG_RESULT([$ac_cv_ps_command])
674 dnl Debian Linux / procps v1.2.9:
675 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
676 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
677 dnl
678 elif ps laxnwww 2>/dev/null | \
679 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
680 then
681 ac_cv_use_ps_vars=yes
682 ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
683 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
684 ac_cv_ps_command="$PATH_TO_PS laxnwww"
685 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
686 ac_cv_vsz_command="$PATH_TO_PS laxnwww"
687 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
688 ac_cv_rss_command="$PATH_TO_PS laxnwww"
689 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
690 EXTRAS="$EXTRAS check_nagios"
691 AC_MSG_RESULT([$ac_cv_ps_command])
693 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
694 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
695 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
696 then
697 ac_cv_use_ps_vars=yes
698 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
699 ac_cv_ps_raw_command="$PATH_TO_PS -axo 'stat user ppid args'"
700 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid comm args'"
701 ac_cv_ps_format="%s %d %d %s %n"
702 ac_cv_vsz_command="$PATH_TO_PS -axo 'vsz comm'"
703 ac_cv_vsz_format="%d %s"
704 ac_cv_rss_command="$PATH_TO_PS -axo 'rss comm'"
705 ac_cv_rss_format="%d %s"
706 EXTRAS="$EXTRAS check_nagios"
707 AC_MSG_RESULT([$ac_cv_ps_command])
709 dnl AIX 4.3.3 - needs verification. This works for Tru64 - needs %*[ +] in PS_FORMAT
710 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
711 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
712 then
713 ac_cv_use_ps_vars=yes
714 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
715 ac_cv_ps_raw_command="$PATH_TO_PS -ao 'stat user ppid args'"
716 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid comm args'"
717 ac_cv_ps_format="[["%s%*[ +] %d %d %s %n"]]"
718 ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz comm'"
719 ac_cv_vsz_format="%d %s"
720 ac_cv_rss_command="$PATH_TO_PS -ao 'rss comm'"
721 ac_cv_rss_format="%d %s"
722 EXTRAS="$EXTRAS check_nagios"
723 AC_MSG_RESULT([$ac_cv_ps_command])
725 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
726 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
727 then
728 ac_cv_use_ps_vars=yes
729 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
730 ac_cv_ps_raw_command="$PATH_TO_PS -eo 's user ppid args'"
731 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid comm args'"
732 ac_cv_ps_format="%s %d %d %s %n"
733 ac_cv_vsz_command="$PATH_TO_PS -eo 'vsz comm'"
734 ac_cv_vsz_format="%d %s"
735 ac_cv_rss_command="$PATH_TO_PS -eo 'rss comm'"
736 ac_cv_rss_format="%d %s"
737 EXTRAS="$EXTRAS check_nagios"
738 AC_MSG_RESULT([$ac_cv_ps_command])
740 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
741 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
742 then
743 ac_cv_use_ps_vars=yes
744 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
745 ac_cv_ps_raw_command="$PATH_TO_PS -Ao 's user ppid args'"
746 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid comm args'"
747 ac_cv_ps_format="%s %d %d %s %n"
748 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
749 ac_cv_vsz_format="%d %s"
750 ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
751 ac_cv_rss_format="%d %s"
752 EXTRAS="$EXTRAS check_nagios"
753 AC_MSG_RESULT([$ac_cv_ps_command])
755 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
756 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
757 then
758 ac_cv_use_ps_vars=yes
759 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
760 ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'status user ppid args'"
761 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid comm args'"
762 ac_cv_ps_format="%s %d %d %s %n"
763 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
764 ac_cv_vsz_format="%d %s"
765 ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
766 ac_cv_rss_format="%d %s"
767 EXTRAS="$EXTRAS check_nagios"
768 AC_MSG_RESULT([$ac_cv_ps_command])
770 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
771 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
772 then
773 ac_cv_use_ps_vars=yes
774 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
775 ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'state user ppid args'"
776 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid comm args'"
777 ac_cv_ps_format="%s %d %d %s %n"
778 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
779 ac_cv_vsz_format="%d %s"
780 ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
781 ac_cv_rss_format="%d %s"
782 EXTRAS="$EXTRAS check_nagios"
783 AC_MSG_RESULT([$ac_cv_ps_command])
785 dnl wonder who takes state instead of stat
786 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
787 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
788 then
789 ac_cv_use_ps_vars=yes
790 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
791 ac_cv_ps_raw_command="$PATH_TO_PS -ao 'state user ppid args'"
792 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid command args'"
793 ac_cv_ps_format="%s %d %d %s %n"
794 ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz command'"
795 ac_cv_vsz_format="%d %s"
796 ac_cv_rss_command="$PATH_TO_PS -ao 'rss command'"
797 ac_cv_rss_format="%d %s"
798 EXTRAS="$EXTRAS check_nagios"
799 AC_MSG_RESULT([$ac_cv_ps_command])
801 dnl IRIX 53
802 elif ps -el 2>/dev/null | \
803 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
804 then
805 ac_cv_use_ps_vars=yes
806 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
807 ac_cv_ps_command="$PATH_TO_PS -el"
808 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
809 ac_cv_vsz_command="$PATH_TO_PS -el"
810 ac_cv_vsz_format="%*s %*s %*s %*s %d"
811 ac_cv_rss_command="$PATH_TO_PS -el"
812 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
813 AC_MSG_RESULT([$ac_cv_ps_command])
815 dnl IRIX 63
816 elif ps -el 2>/dev/null | \
817 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
818 then
819 ac_cv_use_ps_vars=yes
820 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
821 ac_cv_ps_command="$PATH_TO_PS -el"
822 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
823 ac_cv_vsz_command="$PATH_TO_PS -el"
824 ac_cv_vsz_format="%*s %*s %*s %*s %d"
825 ac_cv_rss_command="$PATH_TO_PS -el"
826 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
827 AC_MSG_RESULT([$ac_cv_ps_command])
829 dnl AIX 4.1:
830 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
831 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
832 elif ps -el 2>/dev/null | \
833 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
834 then
835 ac_cv_use_ps_vars=yes
836 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
837 ac_cv_ps_command="$PATH_TO_PS -el"
838 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
839 ac_cv_vsz_command="$PATH_TO_PS -el"
840 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
841 ac_cv_rss_command="$PATH_TO_PS -el"
842 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
843 AC_MSG_RESULT([$ac_cv_ps_command])
845 dnl AIX?
846 elif ps glaxen 2>/dev/null | \
847 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
848 then
849 ac_cv_use_ps_vars=yes
850 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
851 ac_cv_ps_command="$PATH_TO_PS glaxen"
852 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
853 ac_cv_vsz_command="$PATH_TO_PS glaxen"
854 ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
855 ac_cv_rss_command="$PATH_TO_PS glaxen"
856 ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
857 AC_MSG_RESULT([$ac_cv_ps_command])
859 dnl MacOSX / Darwin
860 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
861 dnl STAT VSZ RSS UID USER PPID UCOMM COMMAND
862 dnl Ss 1308 272 0 root 0 init /sbin/init
863 elif ps waxo 'state vsz rss uid user ppid ucomm command' 2>/dev/null | \
864 egrep -i ["^STAT +VSZ +RSS +UID +USER +PPID +UCOMM +COMMAND"] >/dev/null
865 then
866 ac_cv_use_ps_vars=yes
867 ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
868 ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
869 ac_cv_ps_command="$PATH_TO_PS waxo 'state uid ppid ucomm command'"
870 ac_cv_ps_format="%s %d %d %s %n"
871 ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
872 ac_cv_vsz_format="%d %s"
873 ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
874 ac_cv_rss_format="%d %s"
875 EXTRAS="$EXTRAS check_nagios"
876 AC_MSG_RESULT([$ac_cv_ps_command])
878 dnl UnixWare
879 elif ps -Al 2>/dev/null | \
880 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
881 then
882 ac_cv_use_ps_vars=yes
883 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
884 ac_cv_ps_command="$PATH_TO_PS -Al"
885 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
886 if ps -Ao 'vsz comm' 2>/dev/null | \
887 egrep -i ["^ *VSZ +COMMAND"] >/dev/null
888 then
889 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
890 ac_cv_vsz_format="%*s %d"
891 fi
892 AC_MSG_RESULT([$ac_cv_ps_command])
894 else
895 AC_MSG_WARN([unable to find usable ps syntax])
896 fi
898 if test "x$ac_cv_use_ps_vars" != "xno"
899 then
900 AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
901 fi
902 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
903 [Variable list for sscanf of 'ps' output])
904 AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$ac_cv_ps_raw_command",
905 [Verbatim command to execute for ps in check_netsaint])
906 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
907 [Verbatim command to execute for ps in check_procs])
908 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
909 [Format string for scanning ps output in check_procs])
910 AC_DEFINE_UNQUOTED(VSZ_COMMAND,"$ac_cv_vsz_command",
911 [Verbatim command to execute for ps in check_vsz])
912 AC_DEFINE_UNQUOTED(VSZ_FORMAT,"$ac_cv_vsz_format",
913 [Format string for scanning ps output in check_vsz])
914 AC_DEFINE_UNQUOTED(RSS_COMMAND,"$ac_cv_rss_command",
915 [Verbatim command to execute for ps in check_rss])
916 AC_DEFINE_UNQUOTED(RSS_FORMAT,"$ac_cv_rss_format",
917 [Format string for scanning ps output in check_rss])
919 AC_PATH_PROG(PATH_TO_DF,df)
920 AC_PATH_PROG(PATH_TO_BDF,bdf)
922 AC_ARG_WITH(df_command,
923 ACX_HELP_STRING([--with-df-command=SYNTAX],
924 [sets syntax for df]),
925 with_df_command=$withval,)
927 AC_MSG_CHECKING(for df syntax)
928 if test -n "$with_df_command"
929 then
930 AC_MSG_RESULT([$with_df_command])
932 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
933 then
934 with_df_command="$PATH_TO_DF -Pk"
935 AC_MSG_RESULT([$with_df_command])
937 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
938 then
939 with_df_command="$PATH_TO_DF -k"
940 AC_MSG_RESULT([$with_df_command])
942 elif df 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
943 then
944 with_df_command="$PATH_TO_DF"
945 AC_MSG_RESULT([$with_df_command])
947 elif bdf 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
948 then
949 with_df_command="$PATH_TO_BDF"
950 AC_MSG_RESULT([$with_df_command])
952 else
953 AC_MSG_WARN([unable to find usable df syntax])
954 fi
956 AC_DEFINE_UNQUOTED(DF_COMMAND,"$with_df_command",[path and args for df command])
958 AC_PATH_PROG(PATH_TO_PING,ping)
959 AC_PATH_PROG(PATH_TO_PING6,ping6)
961 AC_ARG_WITH(ping_command,
962 ACX_HELP_STRING([--with-ping-command=SYNTAX],
963 [sets syntax for ICMP ping]),
964 with_ping_command=$withval,)
966 AC_MSG_CHECKING(for ICMP ping syntax)
967 ac_cv_ping_packets_first=no
968 if test -n "$with_ping_command"
969 then
970 AC_MSG_RESULT([(command-line) $with_ping_command])
971 if test -n "$ac_cv_ping_packets_first"
972 then
973 ac_cv_ping_packets_first=yes
974 fi
976 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
977 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
978 egrep -i "^round-trip|^rtt" >/dev/null
979 then
980 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
981 ac_cv_ping_packets_first=yes
982 AC_MSG_RESULT([$with_ping_command])
984 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
985 egrep -i "^round-trip|^rtt" >/dev/null
986 then
987 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
988 ac_cv_ping_packets_first=yes
989 AC_MSG_RESULT([$with_ping_command])
991 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
992 egrep -i "^round-trip|^rtt" >/dev/null
993 then
994 with_ping_command="$PATH_TO_PING -n -c %d %s"
995 ac_cv_ping_packets_first=yes
996 AC_MSG_RESULT([$with_ping_command])
998 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
999 egrep -i "^round-trip|^rtt" >/dev/null
1000 then
1001 with_ping_command="$PATH_TO_PING -n %s -c %d"
1002 AC_MSG_RESULT([$with_ping_command])
1004 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1005 egrep -i "^round-trip|^rtt" >/dev/null
1006 then
1007 with_ping_command="$PATH_TO_PING %s -n %d"
1008 AC_MSG_RESULT([$with_ping_command])
1010 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1011 egrep -i "^round-trip|^rtt" >/dev/null
1012 then
1013 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1014 AC_MSG_RESULT([$with_ping_command])
1016 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1017 egrep -i "^round-trip|^rtt" >/dev/null
1018 then
1019 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1020 AC_MSG_RESULT([$with_ping_command])
1022 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1023 egrep -i "^round-trip|^rtt" >/dev/null
1024 then
1025 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1026 ac_cv_ping_packets_first=yes
1027 AC_MSG_RESULT([$with_ping_command])
1029 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1030 egrep -i "^round-trip|^rtt" >/dev/null
1031 then
1032 with_ping_command="$PATH_TO_PING -n -c %d %s"
1033 ac_cv_ping_packets_first=yes
1034 AC_MSG_RESULT([$with_ping_command])
1036 else
1037 AC_MSG_WARN([unable to find usable ping syntax])
1038 fi
1040 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1041 [path and args for ICMP ping command])
1043 if test "x$ac_cv_ping_packets_first" != "xno"
1044 then
1045 AC_DEFINE(PING_PACKETS_FIRST,1,
1046 [Define if packet count must precede host])
1047 fi
1049 AC_ARG_WITH(ping6_command,
1050 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1051 [sets syntax for ICMPv6 ping]),
1052 with_ping6_command=$withval,)
1054 if test x"$with_ipv6" != xno ; then
1055 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1056 ac_cv_ping6_packets_first=no
1057 if test -n "$with_ping6_command"
1058 then
1059 AC_MSG_RESULT([(command-line) $with_ping6_command])
1060 if test -n "$ac_cv_ping6_packets_first"
1061 then
1062 ac_cv_ping6_packets_first=yes
1063 fi
1065 elif test "x$PATH_TO_PING6" != "x"; then
1066 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1067 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1068 egrep -i "^round-trip|^rtt" >/dev/null
1069 then
1070 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1071 ac_cv_ping6_packets_first=yes
1072 AC_MSG_RESULT([$with_ping6_command])
1074 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1075 egrep -i "^round-trip|^rtt" >/dev/null
1076 then
1077 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1078 ac_cv_ping6_packets_first=yes
1079 AC_MSG_RESULT([$with_ping6_command])
1081 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1082 egrep -i "^round-trip|^rtt" >/dev/null
1083 then
1084 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1085 ac_cv_ping6_packets_first=yes
1086 AC_MSG_RESULT([$with_ping6_command])
1088 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1089 egrep -i "^round-trip|^rtt" >/dev/null
1090 then
1091 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1092 AC_MSG_RESULT([$with_ping6_command])
1094 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1095 egrep -i "^round-trip|^rtt" >/dev/null
1096 then
1097 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1098 AC_MSG_RESULT([$with_ping6_command])
1100 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1101 egrep -i "^round-trip|^rtt" >/dev/null
1102 then
1103 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1104 AC_MSG_RESULT([$with_ping6_command])
1106 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1107 egrep -i "^round-trip|^rtt" >/dev/null
1108 then
1109 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1110 AC_MSG_RESULT([$with_ping6_command])
1112 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1113 egrep -i "^round-trip|^rtt" >/dev/null
1114 then
1115 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1116 ac_cv_ping6_packets_first=yes
1117 AC_MSG_RESULT([$with_ping_command])
1119 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1120 egrep -i "^round-trip|^rtt" >/dev/null
1121 then
1122 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1123 ac_cv_ping6_packets_first=yes
1124 AC_MSG_RESULT([$with_ping6_command])
1126 fi
1128 elif test "x$PATH_TO_PING" != "x"; then
1129 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1130 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1131 egrep -i "^round-trip|^rtt" >/dev/null
1132 then
1133 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1134 ac_cv_ping6_packets_first=yes
1135 AC_MSG_RESULT([$with_ping6_command])
1137 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1138 egrep -i "^round-trip|^rtt" >/dev/null
1139 then
1140 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1141 ac_cv_ping6_packets_first=yes
1142 AC_MSG_RESULT([$with_ping6_command])
1144 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1145 egrep -i "^round-trip|^rtt" >/dev/null
1146 then
1147 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1148 ac_cv_ping6_packets_first=yes
1149 AC_MSG_RESULT([$with_ping6_command])
1151 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1152 egrep -i "^round-trip|^rtt" >/dev/null
1153 then
1154 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1155 AC_MSG_RESULT([$with_ping6_command])
1157 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1158 egrep -i "^round-trip|^rtt" >/dev/null
1159 then
1160 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1161 AC_MSG_RESULT([$with_ping6_command])
1163 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1164 egrep -i "^round-trip|^rtt" >/dev/null
1165 then
1166 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1167 AC_MSG_RESULT([$with_ping6_command])
1169 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1170 egrep -i "^round-trip|^rtt" >/dev/null
1171 then
1172 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1173 AC_MSG_RESULT([$with_ping6_command])
1175 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1176 egrep -i "^round-trip|^rtt" >/dev/null
1177 then
1178 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1179 ac_cv_ping6_packets_first=yes
1180 AC_MSG_RESULT([$with_ping_command])
1182 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1183 egrep -i "^round-trip|^rtt" >/dev/null
1184 then
1185 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1186 ac_cv_ping6_packets_first=yes
1187 AC_MSG_RESULT([$with_ping6_command])
1189 fi
1191 fi
1193 if test "x$with_ping6_command" != "x"; then
1194 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1195 [path and args for ICMPv6 ping command])
1196 else
1197 AC_MSG_RESULT([none])
1198 fi
1200 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1201 AC_DEFINE(PING6_PACKETS_FIRST,1,
1202 [Define if packet count must precede host])
1203 fi
1204 fi
1206 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1208 AC_MSG_CHECKING(for nslookup syntax)
1209 if test -n "$PATH_TO_NSLOOKUP"
1210 then
1211 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1212 then
1213 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1214 AC_MSG_RESULT([$ac_cv_nslookup_command])
1216 else
1217 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1218 AC_MSG_RESULT([$ac_cv_nslookup_command])
1220 fi
1221 EXTRAS="$EXTRAS check_dns"
1223 else
1224 AC_MSG_WARN([nslookup command not found])
1225 fi
1227 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1228 [path and args for nslookup])
1230 AC_PATH_PROG(PATH_TO_HOST,host)
1231 if test -n "$ac_cv_path_PATH_TO_HOST"
1232 then
1233 EXTRAS="$EXTRAS check_dns"
1234 fi
1236 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1237 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1239 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1240 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1242 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1243 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1244 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1245 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1246 then
1247 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1248 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1249 else
1250 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1251 fi
1253 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1254 if test -x "$PATH_TO_LMSTAT"
1255 then
1256 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1257 else
1258 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1259 fi
1261 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1262 if test -x "$PATH_TO_SMBCLIENT"
1263 then
1264 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1265 else
1266 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1267 fi
1270 AC_PATH_PROG(PATH_TO_WHO,who)
1272 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1273 then
1274 ac_cv_path_to_who="$PATH_TO_WHO -q"
1275 else
1276 ac_cv_path_to_who="$PATH_TO_WHO"
1277 fi
1279 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1280 [path and arguments for invoking 'who'])
1282 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1283 if test -x "$PATH_TO_SNMPGET"
1284 then
1285 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1286 EXTRAS="$EXTRAS check_hpjd check_snmp"
1287 else
1288 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1289 fi
1291 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1292 if test -x "$PATH_TO_SNMPGETNEXT"
1293 then
1294 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1295 fi
1297 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1298 then
1299 AC_MSG_CHECKING(for Net::SNMP perl module)
1300 AC_MSG_RESULT([found])
1301 else
1302 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1303 fi
1305 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1306 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1308 if test -x "$PATH_TO_QUAKESTAT"
1309 then
1310 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1311 EXTRAS="$EXTRAS check_game"
1313 elif test -x "$PATH_TO_QSTAT"
1314 then
1315 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1316 EXTRAS="$EXTRAS check_game"
1317 else
1318 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1319 fi
1321 if test $ac_cv_path_to_qstat
1322 then
1323 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1324 [path to qstat/quakestat])
1325 fi
1327 AC_PATH_PROG(PATH_TO_FPING,fping)
1328 if test -x "$PATH_TO_FPING"
1329 then
1330 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1331 EXTRAS="$EXTRAS check_fping"
1332 else
1333 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1334 fi
1336 AC_PATH_PROG(PATH_TO_SSH,ssh)
1338 if test -x "$PATH_TO_SSH"
1339 then
1340 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1341 EXTRAS="$EXTRAS check_by_ssh"
1342 else
1343 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1344 fi
1347 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1348 if test -x "$PATH_TO_MAILQ"
1349 then
1350 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1351 else
1352 AC_MSG_WARN([Could not find mailq or eqivalent])
1353 fi
1355 dnl SWAP info required is amount allocated/available and amount free
1356 dnl The plugin works through all the swap devices and adds up the total swap
1357 dnl available.
1359 dnl dunno why this does not work below - use hack (kbd)
1360 dnl fine on linux, broken on solaris
1361 dnl if /bin/test -e "/proc/meminfo"
1363 AC_PATH_PROG(PATH_TO_SWAP,swap)
1364 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1366 AC_MSG_CHECKING(for how to check memory)
1367 if [cat /proc/meminfo > /dev/null 2>&1]
1368 then
1369 AC_MSG_RESULT([found /proc/meminfo])
1370 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1371 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1372 EXTRAS="$EXTRAS check_swap"
1374 elif [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1375 then
1376 ac_cv_have_swap=yes
1377 ac_cv_swap_command="$PATH_TO_SWAP -l"
1378 if [$PATH_TO_SWAP -l 2>/dev/null | \
1379 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1380 >/dev/null]
1381 then
1382 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1383 AC_MSG_RESULT([using IRIX format swap])
1385 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null]
1386 then
1387 ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
1388 AC_MSG_RESULT([using Solaris format swap])
1390 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1391 then
1392 ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
1393 AC_MSG_RESULT([using Unixware format swap])
1395 fi
1396 EXTRAS="$EXTRAS check_swap"
1398 elif [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1399 then
1400 ac_cv_have_swap=yes
1401 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1403 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1404 then
1405 ac_cv_swap_format=["%*s %d %*d %d"]
1406 AC_MSG_RESULT([using FreeBSD format swapinfo])
1407 fi
1408 EXTRAS="$EXTRAS check_swap"
1410 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1411 then
1412 ac_cv_have_swap=yes
1413 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1414 ac_cv_swap_format=["%*s %d %*d %d"]
1415 AC_MSG_RESULT([using HP-UX format swapinfo])
1416 fi
1418 if test x$ac_cv_have_swap != x
1419 then
1420 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1421 fi
1422 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1423 [Format string for parsing swap output])
1424 if test "x$ac_cv_swap_command" != "x"
1425 then
1426 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1427 [Path to swap/swapinfo binary, with any args])
1428 fi
1430 AC_PATH_PROG(PATH_TO_DIG,dig)
1431 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1432 if test -n "$PATH_TO_DIG"; then
1433 EXTRAS="$EXTRAS check_dig"
1434 fi
1436 if test -f plugins/check_nt.c ; then
1437 EXTRAS="$EXTRAS check_nt"
1438 elif test -f ../plugins/check_nt.c ; then
1439 EXTRAS="$EXTRAS check_nt"
1440 fi
1442 AC_MSG_CHECKING(for va_list)
1443 AC_TRY_COMPILE([#ifdef __STDC__
1444 #include <stdio.h>
1445 #include <stdlib.h>
1446 #include <stdarg.h>
1447 #else
1448 #include <sys/types.h>
1449 #include <stdio.h>
1450 #include <varargs.h>
1451 #endif],
1452 [va_list args;],
1453 [AC_MSG_RESULT(yes)],
1454 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1456 AC_SUBST(EXTRAS)
1457 AC_SUBST(EXTRA_NETOBJS)
1458 AC_SUBST(DEPLIBS)
1460 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
1462 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)
1464 ACX_FEATURE([with],[cgiurl])
1465 ACX_FEATURE([with],[nagios-user])
1466 ACX_FEATURE([with],[nagios-group])
1467 ACX_FEATURE([with],[trusted-path])
1468 ACX_FEATURE([with],[df-command])
1469 ACX_FEATURE([with],[ping-command])
1470 ACX_FEATURE([with],[ping6-command])
1471 ACX_FEATURE([with],[lwres])
1472 ACX_FEATURE([with],[ipv6])
1473 ACX_FEATURE([enable],[emulate-getaddrinfo])