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