1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.58)
4 AC_INIT(nagios-plugins,1.4.2)
5 AC_CONFIG_SRCDIR(NPTest.pm)
6 AM_INIT_AUTOMAKE
7 AM_CONFIG_HEADER(config.h)
8 AC_CANONICAL_HOST
10 RELEASE=1
11 AC_SUBST(RELEASE)
13 AC_PREFIX_DEFAULT(/usr/local/nagios)
15 dnl Figure out how to invoke "install" and what install options to use.
16 AC_PROG_INSTALL
17 AC_SUBST(INSTALL)
19 dnl Must come very early on due to coreutils requirement
20 dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
21 gl_USE_SYSTEM_EXTENSIONS
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_RANLIB
28 AC_PROG_MAKE_SET
29 AC_PROG_AWK
31 AC_FUNC_MALLOC
32 AC_FUNC_REALLOC
33 AC_FUNC_ERROR_AT_LINE
35 AC_CONFIG_LIBOBJ_DIR(lib)
36 AC_FUNC_GETLOADAVG([lib])
38 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
39 dnl AM_WITH_REGEX
41 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
42 AC_SUBST(PLUGIN_TEST)dnl
44 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
45 AC_SUBST(SCRIPT_TEST)dnl
47 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
48 AC_SUBST(WARRANTY)
50 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
51 AC_SUBST(SUPPORT)
53 dnl CGIURL has changed for Nagios with 1.0 beta
54 AC_ARG_WITH(cgiurl,
55 ACX_HELP_STRING([--with-cgiurl=DIR],
56 [sets URL for cgi programs]),
57 with_cgiurl=$withval,
58 with_cgiurl=/nagios/cgi-bin)
59 CGIURL="$with_cgiurl"
60 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
62 AC_ARG_WITH(nagios_user,
63 ACX_HELP_STRING([--with-nagios-user=USER],
64 [set user name to run nagios]),
65 with_nagios_user=$withval,
66 with_nagios_user=nagios)
67 AC_ARG_WITH(nagios_group,
68 ACX_HELP_STRING([--with-nagios-group=GROUP],
69 [set group name to run nagios]),
70 with_nagios_group=$withval,
71 with_nagios_group=nagios)
72 AC_SUBST(with_nagios_user)
73 AC_SUBST(with_nagios_group)
74 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
75 AC_SUBST(INSTALL_OPTS)
77 AC_ARG_WITH(trusted_path,
78 ACX_HELP_STRING([--with-trusted-path=PATH],
79 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
80 with_trusted_path=$withval,
81 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
82 AC_SUBST(with_trusted_path)
84 EXTRAS=
85 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
87 LDFLAGS="$LDFLAGS -L."
89 ac_cv_uname_m=`uname -m`
90 ac_cv_uname_s=`uname -s`
91 ac_cv_uname_r=`uname -r`
92 ac_cv_uname_v=`uname -v`
94 PKG_ARCH=`uname -p`
95 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
96 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
98 AC_SUBST(PKG_ARCH)
99 AC_SUBST(REV_DATESTAMP)
100 AC_SUBST(REV_TIMESTAMP)
102 dnl Checks for programs.
103 AC_PATH_PROG(PYTHON,python)
104 AC_PATH_PROG(SH,sh)
105 AC_PATH_PROG(PERL,perl)
106 AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
107 AC_PATH_PROG(HOSTNAME,hostname)
108 AC_PATH_PROG(BASENAME,basename)
110 dnl allow them to override the path of perl
111 AC_ARG_WITH(perl,
112 ACX_HELP_STRING([--with-perl=PATH],
113 [sets path to perl executable]),
114 with_perl=$withval,with_perl=$PERL)
115 AC_SUBST(PERL, $with_perl)
117 dnl openssl/gnutls
118 AC_ARG_WITH(openssl,
119 AC_HELP_STRING([--with-openssl=DIR],
120 [path to openssl installation]),)
122 AC_ARG_WITH(gnutls,
123 ACX_HELP_STRING([--with-gnutls=PATH],
124 [path to gnutls installation root]),)
126 dnl you can only have one or the other
127 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
128 with_gnutls="no"
129 fi
130 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
131 with_openssl="no"
132 fi
134 dnl list of possible dirs to try to autodetect openssl
135 dnl if $dir/include exists, we consider it found
136 dnl the order should allow locally installed versions to override distros' ones
137 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
138 /opt /opt/openssl"
140 dnl
141 dnl Check for miscellaneous stuff
142 dnl
144 case $host_vender-$host_os in
145 sun*)
146 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
147 ;;
148 osf*)
149 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
150 ;;
151 esac
153 dnl
154 dnl Checks for libraries.
155 dnl
157 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
158 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
159 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
160 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
161 AC_SUBST(SOCKETLIBS)
163 dnl
164 dnl check for math-related functions needing -lm
165 AC_CHECK_HEADERS(math.h)
166 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
167 AC_SUBST(MATHLIBS)
169 dnl Check for PostgreSQL libraries
170 _SAVEDLIBS="$LIBS"
171 _SAVEDCPPFLAGS="$CPPFLAGS"
172 AC_ARG_WITH(pgsql,
173 ACX_HELP_STRING([--with-pgsql=DIR],
174 [sets path to pgsql installation]),
175 PGSQL=$withval,)
176 AC_CHECK_LIB(crypt,main)
177 if test "$ac_cv_lib_crypt_main" = "yes"; then
178 if test -n "$PGSQL"; then
179 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
180 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
181 fi
182 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
183 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
184 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
185 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
186 AC_CHECK_HEADERS(libpq-fe.h)
187 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
188 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
189 PGINCLUDE="-I$PGSQL/include"
190 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
191 PGLIBS="-lpq -lcrypt"
192 PGINCLUDE="-I/usr/include/pgsql"
193 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
194 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
195 PGINCLUDE="-I/usr/include/postgresql"
196 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
197 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
198 PGINCLUDE="-I$PGSQL/include"
199 fi
200 if test -z "$PGINCLUDE"; then
201 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
202 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
203 else
204 AC_SUBST(PGLIBS)
205 AC_SUBST(PGINCLUDE)
206 EXTRAS="$EXTRAS check_pgsql"
207 fi
208 else
209 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
210 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
211 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
212 fi
213 else
214 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
215 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
216 fi
217 LIBS="$_SAVEDLIBS"
218 CPPFLAGS="$_SAVEDCPPFLAGS"
220 dnl Check for radius libraries
221 _SAVEDLIBS="$LIBS"
222 AC_CHECK_LIB(radiusclient,rc_read_config)
223 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
224 EXTRAS="$EXTRAS check_radius"
225 RADIUSLIBS="-lradiusclient"
226 AC_SUBST(RADIUSLIBS)
227 else
228 AC_MSG_WARN([Skipping radius plugin])
229 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
230 fi
231 LIBS="$_SAVEDLIBS"
233 dnl Check for LDAP libraries
234 _SAVEDLIBS="$LIBS"
235 AC_CHECK_LIB(ldap,main,,,-llber)
236 if test "$ac_cv_lib_ldap_main" = "yes"; then
237 LDAPLIBS="-lldap -llber"\
238 LDAPINCLUDE="-I/usr/include/ldap"
239 AC_SUBST(LDAPLIBS)
240 AC_SUBST(LDAPINCLUDE)
241 AC_CHECK_FUNCS(ldap_set_option)
242 EXTRAS="$EXTRAS check_ldap"
243 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
244 else
245 AC_MSG_WARN([Skipping LDAP plugin])
246 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
247 fi
248 LIBS="$_SAVEDLIBS"
251 dnl Check for mysql libraries
252 _SAVEDLIBS="$LIBS"
253 _SAVEDCPPFLAGS="$CPPFLAGS"
254 AC_ARG_WITH(mysql,
255 ACX_HELP_STRING([--with-mysql=DIR],
256 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
257 MYSQL=$withval,)
258 if test -n "$MYSQL"; then
259 MYSQLLIBDIR=$MYSQL/lib/mysql
260 CPPFLAGS="-I$MYSQL/include"
261 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
262 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
263 elif test -f /usr/lib/libmysqlclient.so; then
264 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
265 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
266 elif test -f /usr/lib/libmysqlclient.a; then
267 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
268 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
269 elif test -f /usr/lib/mysql/libmysqlclient.so; then
270 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
271 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
272 elif test -f /usr/lib/mysql/libmysqlclient.a; then
273 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
274 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
275 fi
276 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
277 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
278 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
279 EXTRAS="$EXTRAS check_mysql"
280 AC_SUBST(MYSQLINCLUDE)
281 AC_SUBST(MYSQLLIBS)
282 AC_SUBST(check_mysql_LDFLAGS)
283 else
284 AC_MSG_WARN([Skipping mysql plugin])
285 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
286 fi
287 else
288 AC_MSG_WARN([Skipping mysql plugin])
289 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
290 fi
291 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
292 LIBS="$_SAVEDLIBS"
294 AC_CHECK_HEADERS(unistd.h)
296 dnl Check for AF_INET6 support - unistd.h required for Darwin
297 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
298 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
299 #include <unistd.h>
300 #endif
301 #include <netinet/in.h>
302 #include <sys/socket.h>],
303 [struct sockaddr_in6 sin6;
304 void *p;
306 sin6.sin6_family = AF_INET6;
307 sin6.sin6_port = 587;
308 p = &sin6.sin6_addr;],
309 [with_ipv6=yes],
310 [with_ipv6=no])
311 ])
313 if test x"$with_ipv6" != xno ; then
314 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
315 fi
317 dnl #########################################################################
318 dnl Check if Posix getaddrinfo() is available. It is also possible to use
319 dnl the version from the lwres library distributed with BIND.
320 dnl #########################################################################
321 AC_ARG_ENABLE([emulate-getaddrinfo],
322 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
323 [enable getaddrinfo emulation (default=no)]),
324 ,
325 enable_emulate_getaddrinfo=no)
327 AC_ARG_WITH(lwres,
328 ACX_HELP_STRING([--with-lwres=DIR],
329 [use lwres library for getaddrinfo (default=no)]),
330 ,
331 with_lwres=no)
333 dnl ## enable force to test getaddrinfo.c
334 if test x$enable_emulate_getaddrinfo = xforce ; then
335 enable_emulate_getaddrinfo=yes
336 have_getaddrinfo=no
337 else
339 have_getaddrinfo=no
340 if test x$with_lwres != xno ; then
341 if test "$with_lwres" != yes ; then
342 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
343 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
344 fi
345 AC_CHECK_HEADERS(lwres/netdb.h, ,
346 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
347 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
348 [AC_MSG_ERROR([cannot find the lwres library])],
349 -lnsl -lpthread)
350 have_getaddrinfo=yes
351 fi
353 if test x$have_getaddrinfo != xyes ; then
354 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
355 fi
357 dnl # Special nonsense for systems that actually have getaddrinfo but
358 dnl # redefine the name to something else, e.g. OSF
359 if test x$have_getaddrinfo != xyes ; then
360 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
361 AC_TRY_LINK([
362 # include <netdb.h>
363 ], [
364 struct addrinfo hints, *res;
365 int err;
367 err = getaddrinfo ("host", "service", &hints, &res);
368 ], [
369 have_getaddrinfo=yes
370 AC_MSG_RESULT(yes)
371 ], [AC_MSG_RESULT(no)])
372 fi
374 fi
376 if test x$have_getaddrinfo != xno ; then
377 if test x$enable_emulate_getaddrinfo != xno ; then
378 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
379 fi
380 AC_DEFINE(HAVE_GETADDRINFO, 1,
381 [Does system provide RFC 2553/Posix getaddrinfo?])
382 else
383 if test x$enable_emulate_getaddrinfo != xyes ; then
384 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
385 enable_emulate_getaddrinfo=yes
386 AC_MSG_WARN([enabling getaddrinfo emulation])
387 fi
388 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
389 fi
391 if test x"$enable_emulate_getaddrinfo" != xno ; then
392 have_resolver=no
394 dnl Try for getipnodebyname
395 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
396 if test x"$have_resolver" != xno ; then
397 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
398 [Set when getipnodebyname is available])
399 fi
401 dnl Try for gethostbyname_r
402 if test x"$have_resolver" = xno ; then
403 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
404 [have_resolver=yes
405 ACX_WHICH_GETHOSTBYNAME_R])
406 fi
408 dnl Try for gethostbyname
409 if test x"$have_resolver" = xno ; then
410 if test x"$enable_pthreads" != xno ; then
411 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
412 fi
413 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
414 [AC_MSG_ERROR([cannot find gethostbyname])])
415 fi
416 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
418 fi
420 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
421 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
422 if test "$FOUNDINCLUDE" = "no"; then
423 _SAVEDCPPFLAGS="$CPPFLAGS"
424 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
425 unset ac_cv_header_krb5_h
426 AC_CHECK_HEADERS(krb5.h,
427 KRB5INCLUDE="-I/usr/kerberos/include"
428 FOUNDINCLUDE=yes,
429 FOUNDINCLUDE=no)
430 fi
431 AC_SUBST(KRBINCLUDE)
432 if test "$FOUNDINCLUDE" = "no"; then
433 CPPFLAGS="$_SAVEDCPPFLAGS"
434 fi
437 dnl openssl detection/configuration
438 if ! test "$with_openssl" = "no"; then
439 dnl Check for OpenSSL location if it wasn't already specified
440 if ! test -d "$with_openssl"; then
441 for d in $OPENSSL_DIRS; do
442 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
443 with_openssl=$d
444 fi
445 done
446 fi
448 _SAVEDCPPFLAGS="$CPPFLAGS"
449 _SAVEDLDFLAGS="$LDFLAGS"
450 dnl Check for OpenSSL header files
451 unset FOUNDINCLUDE
452 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
453 LDFLAGS="$LDFLAGS -R$OPENSSL/lib"
455 dnl check for openssl in $dir/include/openssl
456 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
457 SSLINCLUDE="-I$OPENSSL/include"
458 FOUNDINCLUDE=yes,
459 FOUNDINCLUDE=no)
460 dnl else check to see if $dir/include has it
461 if test "$FOUNDINCLUDE" = "no"; then
462 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
463 SSLINCLUDE="-I$OPENSSL/include"
464 FOUNDINCLUDE=yes,
465 FOUNDINCLUDE=no)
466 fi
467 AC_SUBST(SSLINCLUDE)
468 dnl if we didn't find it, reset CPPFLAGS
469 if test "$FOUNDINCLUDE" = "no"; then
470 CPPFLAGS="$_SAVEDCPPFLAGS"
471 LDFLAGS="$_SAVEDLDFLAGS"
472 fi
474 dnl Check for crypto lib
475 _SAVEDLIBS="$LIBS"
476 LIBS="-L${with_openssl}/lib"
477 AC_CHECK_LIB(crypto,CRYPTO_lock)
478 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
479 dnl Check for SSL lib
480 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
481 fi
482 LIBS="$_SAVEDLIBS"
484 dnl test headers and libs to decide whether check_http should use SSL
485 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
486 if test "$ac_cv_lib_ssl_main" = "yes"; then
487 if test "$FOUNDINCLUDE" = "yes"; then
488 FOUNDOPENSSL="yes"
489 fi
490 fi
491 fi
492 fi
495 dnl check for gnutls if openssl isn't found (or is disabled)
496 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
497 if test ! "$with_gnutls" = ""; then
498 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
499 elif test ! "$LIBGNUTLS_CONFIG" = ""; then
500 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
501 fi
502 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
503 if test "$FOUNDGNUTLS" = "yes"; then
504 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
505 fi
506 fi
507 dnl end check for gnutls
509 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
510 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
511 AC_SUBST(check_tcp_ssl)
512 AC_SUBST(SSLLIBS)
513 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
514 if test "$FOUNDOPENSSL" = "yes"; then
515 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
516 with_openssl="yes"
517 with_gnutls="no"
518 else
519 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
520 with_gnutls="yes"
521 with_openssl="no"
522 fi
523 else
524 dnl else deliberately disabled or no ssl support available
525 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
526 with_openssl="no"
527 with_gnutls="no"
528 fi
530 dnl
531 dnl Checks for header files.
532 dnl
534 AC_HEADER_STDC
535 AC_HEADER_TIME
536 AC_HEADER_SYS_WAIT
537 AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h sys/un.h)
538 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
540 dnl Checks for typedefs, structures, and compiler characteristics.
541 AC_C_CONST
542 AC_STRUCT_TM
543 AC_TYPE_PID_T
544 AC_TYPE_SIZE_T
545 AC_TYPE_SIGNAL
547 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
548 AC_TRY_LINK([#include <stdarg.h>
549 va_list ap1,ap2;], [va_copy(ap1,ap2);],
550 ac_cv_HAVE_VA_COPY=yes,
551 ac_cv_HAVE_VA_COPY=no)])
552 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
553 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
554 else
555 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
556 AC_TRY_LINK([#include <stdarg.h>
557 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
558 ac_cv_HAVE___VA_COPY=yes,
559 ac_cv_HAVE___VA_COPY=no)])
560 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
561 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
562 fi
563 fi
565 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
566 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
567 AC_TRY_RUN([
568 #include <sys/types.h>
569 #include <stdarg.h>
570 void foo(const char *format, ...) {
571 va_list ap;
572 int len;
573 char buf[5];
575 va_start(ap, format);
576 len = vsnprintf(buf, 0, format, ap);
577 va_end(ap);
578 if (len != 5) exit(1);
580 va_start(ap, format);
581 len = vsnprintf(0, 0, format, ap);
582 va_end(ap);
583 if (len != 5) exit(1);
585 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
587 exit(0);
588 }
589 main() { foo("hello"); }
590 ],
591 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
592 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
593 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
594 fi
596 AC_TRY_COMPILE([#include <sys/time.h>],
597 [struct timeval *tv;
598 struct timezone *tz;],
599 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
600 AC_TRY_COMPILE([#include <sys/time.h>],
601 [struct timeval *tv;
602 struct timezone *tz;
603 gettimeofday(tv, tz);],
604 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
605 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
607 dnl Checks for library functions.
608 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul floor)
610 AC_MSG_CHECKING(return type of socket size)
611 AC_TRY_COMPILE([#include <stdlib.h>
612 #include <sys/types.h>
613 #include <sys/socket.h>],
614 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
615 ac_cv_socket_size_type=["size_t"]
616 AC_MSG_RESULT(size_t),
617 ac_cv_socket_size_type=["int"]
618 AC_MSG_RESULT(int))
620 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
621 [Define type of socket size])
623 AC_ARG_WITH(proc-loadavg,
624 ACX_HELP_STRING([--with-proc-loadavg=PATH],
625 [path to /proc/loadavg or equivalent]),
626 ac_cv_proc_loadavg=$withval)
627 AC_MSG_CHECKING([for /proc/loadavg])
628 if test -n "$ac_cv_proc_loadavg"; then
629 AC_MSG_RESULT([(command line) $ac_cv_proc_loadavg])
630 elif test -f "/proc/loadavg"; then
631 AC_MSG_RESULT([found /proc/loadavg])
632 ac_cv_proc_loadavg="/proc/loadavg"
633 else
634 AC_MSG_RESULT([no])
635 fi
637 if test -n "$ac_cv_proc_loadavg"; then
638 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
639 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
640 fi
642 dnl #### Process table test
644 AC_PATH_PROG(PATH_TO_PS,ps)
646 AC_MSG_CHECKING(for ps syntax)
647 AC_ARG_WITH(ps_command,
648 ACX_HELP_STRING([--with-ps-command=PATH],
649 [Verbatim command to execute for ps]),
650 PS_COMMAND=$withval)
651 AC_ARG_WITH(ps_format,
652 ACX_HELP_STRING([--with-ps-format=FORMAT],
653 [Format string for scanning ps output]),
654 PS_FORMAT=$withval)
655 AC_ARG_WITH(ps_cols,
656 ACX_HELP_STRING([--with-ps-cols=NUM],
657 [Number of columns in ps command]),
658 PS_COLS=$withval)
659 AC_ARG_WITH(ps_varlist,
660 ACX_HELP_STRING([--with-ps-varlist=LIST],
661 [Variable list for sscanf of 'ps' output]),
662 PS_VARLIST=$withval)
664 AM_CONDITIONAL(WANT_PST3, false)
666 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
667 ac_cv_ps_command="$PS_COMMAND"
668 ac_cv_ps_format="$PS_FORMAT"
669 ac_cv_ps_varlist="$PS_VARLIST"
670 ac_cv_ps_cols="$PS_COLS"
671 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
673 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
674 elif test "$ac_cv_uname_s" = "SunOS"; then
675 #
676 # this is a very, very ugly hack, to hardcode the location for plugins
677 #
678 if test "$libexecdir" = '${exec_prefix}/libexec'; then
679 if test "$exec_prefix" = "NONE"; then
680 if test "$prefix" = "NONE"; then
681 pst3="$ac_default_prefix/libexec/pst3"
682 else
683 pst3="$prefix/libexec/pst3"
684 fi
685 else
686 pst3="$exec_prefix/libexec/pst3"
687 fi
688 else
689 pst3="$libexecdir/pst3"
690 fi
691 ac_cv_ps_command="$pst3"
692 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
693 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
694 ac_cv_ps_cols=8
695 AC_MSG_RESULT([using nagios-plugins internal ps for solaris])
696 AM_CONDITIONAL(WANT_PST3, true)
698 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
699 dnl so test for this first...
700 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
701 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
702 then
703 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
704 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
705 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
706 ac_cv_ps_cols=9
707 AC_MSG_RESULT([$ac_cv_ps_command])
709 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
710 dnl Should also work for FreeBSD 5.2.1 and 5.3
711 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
712 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
713 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
714 then
715 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
716 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
717 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
718 ac_cv_ps_cols=9
719 AC_MSG_RESULT([$ac_cv_ps_command])
721 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
722 dnl Limitation: Only first 16 chars returned for ucomm field
723 dnl Must come before ps -weo
724 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
725 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
726 then
727 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
728 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
729 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
730 ac_cv_ps_cols=9
731 AC_MSG_RESULT([$ac_cv_ps_command])
733 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
734 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
735 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
736 then
737 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
738 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
739 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
740 ac_cv_ps_cols=10
741 AC_MSG_RESULT([$ac_cv_ps_command])
743 dnl FreeBSD
744 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
745 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
746 then
747 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
748 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
749 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
750 ac_cv_ps_cols=9
751 AC_MSG_RESULT([$ac_cv_ps_command])
753 dnl BSD-like mode in RH 6.1
754 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
755 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
756 then
757 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
758 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
759 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
760 ac_cv_ps_cols=9
761 AC_MSG_RESULT([$ac_cv_ps_command])
763 dnl SunOS 4.1.3:
764 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
765 dnl Need the head -1 otherwise test will work because arguments are found
766 elif ps -laxnwww 2>/dev/null | head -1 | \
767 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
768 then
769 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
770 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
771 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
772 ac_cv_ps_cols=9
773 AC_MSG_RESULT([$ac_cv_ps_command])
775 dnl Debian Linux / procps v1.2.9:
776 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
777 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
778 dnl
779 elif ps laxnwww 2>/dev/null | \
780 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
781 then
782 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
783 ac_cv_ps_command="$PATH_TO_PS laxnwww"
784 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
785 ac_cv_ps_cols=9
786 AC_MSG_RESULT([$ac_cv_ps_command])
788 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
789 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
790 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
791 then
792 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
793 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
794 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
795 ac_cv_ps_cols=9
796 AC_MSG_RESULT([$ac_cv_ps_command])
798 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
799 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
800 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
801 dnl of 1500). Will need big changes to check_procs to support
802 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
803 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
804 then
805 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
806 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
807 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
808 ac_cv_ps_cols=8
809 AC_MSG_RESULT([$ac_cv_ps_command])
811 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
812 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
813 then
814 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
815 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
816 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
817 ac_cv_ps_cols=9
818 AC_MSG_RESULT([$ac_cv_ps_command])
820 dnl AIX 4.3.3 and 5.1 do not have an rss field
821 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
822 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
823 then
824 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
825 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
826 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
827 ac_cv_ps_cols=8
828 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
830 dnl Solaris 2.6
831 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
832 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
833 then
834 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
835 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
836 # There must be no space between the %s and %n due to a wierd problem in sscanf where
837 # it will return %n as longer than the line length
838 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
839 ac_cv_ps_cols=9
840 AC_MSG_RESULT([$ac_cv_ps_command])
842 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
843 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
844 then
845 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
846 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
847 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
848 ac_cv_ps_cols=9
849 AC_MSG_RESULT([$ac_cv_ps_command])
851 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
852 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
853 then
854 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
855 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
856 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
857 ac_cv_ps_cols=9
858 AC_MSG_RESULT([$ac_cv_ps_command])
860 dnl wonder who takes state instead of stat
861 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
862 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
863 then
864 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
865 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
866 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
867 ac_cv_ps_cols=8
868 AC_MSG_RESULT([$ac_cv_ps_command])
870 dnl IRIX 53
871 elif ps -el 2>/dev/null | \
872 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
873 then
874 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
875 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
876 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
877 ac_cv_ps_cols=8
878 AC_MSG_RESULT([$ac_cv_ps_command])
880 dnl IRIX 63
881 elif ps -el 2>/dev/null | \
882 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
883 then
884 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
885 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
886 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
887 ac_cv_ps_cols=6
888 AC_MSG_RESULT([$ac_cv_ps_command])
890 dnl AIX 4.1:
891 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
892 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
893 elif ps -el 2>/dev/null | \
894 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
895 then
896 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
897 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
898 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
899 ac_cv_ps_cols=6
900 AC_MSG_RESULT([$ac_cv_ps_command])
902 dnl AIX?
903 elif ps glaxen 2>/dev/null | \
904 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
905 then
906 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
907 ac_cv_ps_command="$PATH_TO_PS glaxen"
908 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
909 ac_cv_ps_cols=8
910 AC_MSG_RESULT([$ac_cv_ps_command])
912 dnl MacOSX / Darwin
913 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
914 dnl Some truncation will happen in UCOMM column
915 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
916 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
917 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
918 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
919 then
920 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
921 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
922 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
923 ac_cv_ps_cols=8
924 AC_MSG_RESULT([$ac_cv_ps_command])
926 dnl UnixWare
927 elif ps -Al 2>/dev/null | \
928 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
929 then
930 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
931 ac_cv_ps_command="$PATH_TO_PS -Al"
932 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
933 ac_cv_ps_cols=8
934 AC_MSG_RESULT([$ac_cv_ps_command])
936 else
937 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
938 fi
940 if test -n "$ac_cv_ps_varlist" ; then
941 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
942 [Variable list for sscanf of 'ps' output])
943 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
944 [Verbatim command to execute for ps in check_procs])
945 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
946 [Format string for scanning ps output in check_procs])
947 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
948 [Number of columns in ps command])
949 EXTRAS="$EXTRAS check_procs check_nagios"
950 if echo "$ac_cv_ps_varlist" | grep -q "procetime"; then
951 AC_DEFINE(PS_USES_PROCETIME,"yes",
952 [Whether the ps utility uses the "procetime" field])
953 fi
954 fi
956 AC_PATH_PROG(PATH_TO_PING,ping)
957 AC_PATH_PROG(PATH_TO_PING6,ping6)
959 AC_ARG_WITH(ping_command,
960 ACX_HELP_STRING([--with-ping-command=SYNTAX],
961 [sets syntax for ICMP ping]),
962 with_ping_command=$withval,)
964 AC_MSG_CHECKING(for ICMP ping syntax)
965 ac_cv_ping_packets_first=no
966 ac_cv_ping_has_timeout=no
967 if test -n "$with_ping_command"
968 then
969 AC_MSG_RESULT([(command-line) $with_ping_command])
970 if test -n "$ac_cv_ping_packets_first"
971 then
972 ac_cv_ping_packets_first=yes
973 ac_cv_ping_has_timeout=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 -w 10 -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 -w %d -c %d %s"
988 ac_cv_ping_packets_first=yes
989 ac_cv_ping_has_timeout=yes
990 AC_MSG_RESULT([$with_ping_command])
992 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
993 egrep -i "^round-trip|^rtt" >/dev/null
994 then
995 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
996 ac_cv_ping_packets_first=yes
997 AC_MSG_RESULT([$with_ping_command])
999 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1000 egrep -i "^round-trip|^rtt" >/dev/null
1001 then
1002 with_ping_command="$PATH_TO_PING -n -c %d %s"
1003 ac_cv_ping_packets_first=yes
1004 AC_MSG_RESULT([$with_ping_command])
1006 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
1007 egrep -i "^round-trip|^rtt" >/dev/null
1008 then
1009 with_ping_command="$PATH_TO_PING -n %s -c %d"
1010 AC_MSG_RESULT([$with_ping_command])
1012 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1013 egrep -i "^round-trip|^rtt" >/dev/null
1014 then
1015 with_ping_command="$PATH_TO_PING %s -n %d"
1016 AC_MSG_RESULT([$with_ping_command])
1018 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1019 egrep -i "^round-trip|^rtt" >/dev/null
1020 then
1021 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1022 AC_MSG_RESULT([$with_ping_command])
1024 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1025 egrep -i "^round-trip|^rtt" >/dev/null
1026 then
1027 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1028 AC_MSG_RESULT([$with_ping_command])
1030 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1031 egrep -i "^round-trip|^rtt" >/dev/null
1032 then
1033 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1034 ac_cv_ping_packets_first=yes
1035 AC_MSG_RESULT([$with_ping_command])
1037 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1038 egrep -i "^round-trip|^rtt" >/dev/null
1039 then
1040 with_ping_command="$PATH_TO_PING -n -c %d %s"
1041 ac_cv_ping_packets_first=yes
1042 AC_MSG_RESULT([$with_ping_command])
1044 else
1045 AC_MSG_WARN([unable to find usable ping syntax])
1046 fi
1048 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1049 [path and args for ICMP ping command])
1051 if test "x$ac_cv_ping_packets_first" != "xno"
1052 then
1053 AC_DEFINE(PING_PACKETS_FIRST,1,
1054 [Define if packet count must precede host])
1055 fi
1057 if test "x$ac_cv_ping_has_timeout" != "xno"
1058 then
1059 AC_DEFINE(PING_HAS_TIMEOUT,1,
1060 [Define if ping has its own timeout option that should be set])
1061 fi
1063 AC_ARG_WITH(ping6_command,
1064 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1065 [sets syntax for ICMPv6 ping]),
1066 with_ping6_command=$withval,)
1068 if test x"$with_ipv6" != xno ; then
1069 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1070 ac_cv_ping6_packets_first=no
1071 if test -n "$with_ping6_command"
1072 then
1073 AC_MSG_RESULT([(command-line) $with_ping6_command])
1074 if test -n "$ac_cv_ping6_packets_first"
1075 then
1076 ac_cv_ping6_packets_first=yes
1077 fi
1079 elif test "x$PATH_TO_PING6" != "x"; then
1080 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1081 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1082 egrep -i "^round-trip|^rtt" >/dev/null
1083 then
1084 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1085 ac_cv_ping6_packets_first=yes
1086 AC_MSG_RESULT([$with_ping6_command])
1088 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
1089 egrep -i "^round-trip|^rtt" >/dev/null
1090 then
1091 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
1092 ac_cv_ping6_packets_first=yes
1093 ac_cv_ping_has_timeout=yes
1094 AC_MSG_RESULT([$with_ping6_command])
1096 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1097 egrep -i "^round-trip|^rtt" >/dev/null
1098 then
1099 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1100 ac_cv_ping6_packets_first=yes
1101 AC_MSG_RESULT([$with_ping6_command])
1103 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1104 egrep -i "^round-trip|^rtt" >/dev/null
1105 then
1106 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1107 ac_cv_ping6_packets_first=yes
1108 AC_MSG_RESULT([$with_ping6_command])
1110 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1111 egrep -i "^round-trip|^rtt" >/dev/null
1112 then
1113 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1114 AC_MSG_RESULT([$with_ping6_command])
1116 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1117 egrep -i "^round-trip|^rtt" >/dev/null
1118 then
1119 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1120 AC_MSG_RESULT([$with_ping6_command])
1122 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1123 egrep -i "^round-trip|^rtt" >/dev/null
1124 then
1125 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1126 AC_MSG_RESULT([$with_ping6_command])
1128 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1129 egrep -i "^round-trip|^rtt" >/dev/null
1130 then
1131 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1132 AC_MSG_RESULT([$with_ping6_command])
1134 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1135 egrep -i "^round-trip|^rtt" >/dev/null
1136 then
1137 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1138 ac_cv_ping6_packets_first=yes
1139 AC_MSG_RESULT([$with_ping_command])
1141 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1142 egrep -i "^round-trip|^rtt" >/dev/null
1143 then
1144 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1145 ac_cv_ping6_packets_first=yes
1146 AC_MSG_RESULT([$with_ping6_command])
1148 fi
1150 elif test "x$PATH_TO_PING" != "x"; then
1151 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1152 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1153 egrep -i "^round-trip|^rtt" >/dev/null
1154 then
1155 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1156 ac_cv_ping6_packets_first=yes
1157 AC_MSG_RESULT([$with_ping6_command])
1159 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1160 egrep -i "^round-trip|^rtt" >/dev/null
1161 then
1162 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1163 ac_cv_ping6_packets_first=yes
1164 AC_MSG_RESULT([$with_ping6_command])
1166 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1167 egrep -i "^round-trip|^rtt" >/dev/null
1168 then
1169 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1170 ac_cv_ping6_packets_first=yes
1171 AC_MSG_RESULT([$with_ping6_command])
1173 elif $PATH_TO_PING -A inet6 -n ::1 -c 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 -c %d"
1177 AC_MSG_RESULT([$with_ping6_command])
1179 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1180 egrep -i "^round-trip|^rtt" >/dev/null
1181 then
1182 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1183 AC_MSG_RESULT([$with_ping6_command])
1185 elif $PATH_TO_PING -A inet6 -n -s ::1 56 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 %s 56 %d"
1189 AC_MSG_RESULT([$with_ping6_command])
1191 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1192 egrep -i "^round-trip|^rtt" >/dev/null
1193 then
1194 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1195 AC_MSG_RESULT([$with_ping6_command])
1197 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1198 egrep -i "^round-trip|^rtt" >/dev/null
1199 then
1200 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1201 ac_cv_ping6_packets_first=yes
1202 AC_MSG_RESULT([$with_ping_command])
1204 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1205 egrep -i "^round-trip|^rtt" >/dev/null
1206 then
1207 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1208 ac_cv_ping6_packets_first=yes
1209 AC_MSG_RESULT([$with_ping6_command])
1211 fi
1213 fi
1215 if test "x$with_ping6_command" != "x"; then
1216 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1217 [path and args for ICMPv6 ping command])
1218 else
1219 AC_MSG_RESULT([none])
1220 fi
1222 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1223 AC_DEFINE(PING6_PACKETS_FIRST,1,
1224 [Define if packet count must precede host])
1225 fi
1226 fi
1229 AC_MSG_CHECKING(for nslookup syntax)
1230 AC_ARG_WITH(nslookup_command,
1231 ACX_HELP_STRING([--with-nslookup-command=PATH],
1232 [sets path to nslookup executable]),
1233 ac_cv_nslookup_command=$withval)
1234 if test -n "$ac_cv_nslookup_command"; then
1235 AC_MSG_RESULT([(command line) $ac_cv_nslookup_command])
1236 else
1237 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1238 if test -n "$PATH_TO_NSLOOKUP"
1239 then
1240 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1241 then
1242 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1243 AC_MSG_RESULT([$ac_cv_nslookup_command])
1245 else
1246 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1247 AC_MSG_RESULT([$ac_cv_nslookup_command])
1249 fi
1250 else
1251 AC_MSG_WARN([nslookup command not found])
1252 fi
1253 fi
1255 if test -n "$ac_cv_nslookup_command"; then
1256 EXTRAS="$EXTRAS check_dns"
1257 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1258 fi
1260 AC_PATH_PROG(PATH_TO_HOST,host)
1261 if test -n "$ac_cv_path_PATH_TO_HOST"
1262 then
1263 EXTRAS="$EXTRAS check_dns"
1264 fi
1266 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1267 AC_ARG_WITH(uptime_command,
1268 ACX_HELP_STRING([--with-uptime-command=PATH],
1269 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1270 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1272 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1273 AC_ARG_WITH(rpcinfo_command,
1274 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1275 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1276 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1278 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1279 AC_ARG_WITH(ntpdate_command,
1280 ACX_HELP_STRING([--with-ntpdate-command=PATH],
1281 [sets path to ntpdate]), PATH_TO_NTPDATE=$withval)
1282 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1283 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1284 if (test -n "$PATH_TO_NTPDATE" || test -n "$PATH_TO_NTPQ")
1285 then
1286 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1287 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1288 else
1289 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1290 fi
1292 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1293 if test -x "$PATH_TO_LMSTAT"
1294 then
1295 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1296 else
1297 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1298 fi
1300 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1301 AC_ARG_WITH(smbclient_command,
1302 ACX_HELP_STRING([--with-smbclient-command=PATH],
1303 [sets path to smbclient]),
1304 PATH_TO_SMBCLIENT=$withval)
1305 if test -n "$PATH_TO_SMBCLIENT"
1306 then
1307 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1308 else
1309 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1310 fi
1313 AC_PATH_PROG(PATH_TO_WHO,who)
1315 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1316 then
1317 ac_cv_path_to_who="$PATH_TO_WHO -q"
1318 else
1319 ac_cv_path_to_who="$PATH_TO_WHO"
1320 fi
1322 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1323 [path and arguments for invoking 'who'])
1325 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1326 AC_ARG_WITH(snmpget_command,
1327 ACX_HELP_STRING([--with-snmpget-command=PATH],
1328 [Path to snmpget command]),
1329 PATH_TO_SNMPGET=$withval)
1330 if test -n "$PATH_TO_SNMPGET"
1331 then
1332 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1333 EXTRAS="$EXTRAS check_hpjd check_snmp"
1334 else
1335 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1336 fi
1338 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1339 AC_ARG_WITH(snmpgetnext_command,
1340 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1341 [Path to snmpgetnext command]),
1342 PATH_TO_SNMPGETNEXT=$withval)
1343 if test -n "$PATH_TO_SNMPGETNEXT"
1344 then
1345 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1346 fi
1348 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1349 then
1350 AC_MSG_CHECKING(for Net::SNMP perl module)
1351 AC_MSG_RESULT([found])
1352 else
1353 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1354 fi
1356 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1357 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1358 AC_ARG_WITH(qstat_command,
1359 ACX_HELP_STRING([--with-qstat-command=PATH],
1360 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1362 if test -x "$PATH_TO_QUAKESTAT"
1363 then
1364 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1365 EXTRAS="$EXTRAS check_game"
1367 elif test -n "$PATH_TO_QSTAT"
1368 then
1369 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1370 EXTRAS="$EXTRAS check_game"
1371 else
1372 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1373 fi
1375 if test $ac_cv_path_to_qstat
1376 then
1377 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1378 [path to qstat/quakestat])
1379 fi
1381 AC_PATH_PROG(PATH_TO_FPING,fping)
1382 AC_ARG_WITH(fping_command,
1383 ACX_HELP_STRING([--with-fping-command=PATH],
1384 [Path to fping command]), PATH_TO_FPING=$withval)
1385 if test -n "$PATH_TO_FPING"
1386 then
1387 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1388 EXTRAS="$EXTRAS check_fping"
1389 else
1390 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1391 fi
1393 AC_PATH_PROG(PATH_TO_SSH,ssh)
1394 AC_ARG_WITH(ssh_command,
1395 ACX_HELP_STRING([--with-ssh-command=PATH],
1396 [sets path for ssh]), PATH_TO_SSH=$withval)
1397 if test -n "$PATH_TO_SSH"
1398 then
1399 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1400 EXTRAS="$EXTRAS check_by_ssh"
1401 else
1402 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1403 fi
1406 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1407 AC_ARG_WITH(mailq_command,
1408 ACX_HELP_STRING([--with-mailq-command=PATH],
1409 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1410 if test -n "$PATH_TO_MAILQ"
1411 then
1412 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1413 else
1414 AC_MSG_WARN([Could not find mailq or eqivalent])
1415 fi
1417 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1418 if test -x "$PATH_TO_QMAIL_QSTAT"
1419 then
1420 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1421 else
1422 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1423 fi
1425 dnl SWAP info required is amount allocated/available and amount free
1426 dnl The plugin works through all the swap devices and adds up the total swap
1427 dnl available.
1428 AC_PATH_PROG(PATH_TO_SWAP,swap)
1429 if (test -n "$PATH_TO_SWAP")
1430 then
1431 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1432 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1433 then
1434 ac_cv_have_swap=yes
1435 ac_cv_swap_command="$PATH_TO_SWAP -l"
1436 if [$PATH_TO_SWAP -l 2>/dev/null | \
1437 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1438 >/dev/null]
1439 then
1440 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1441 ac_cv_swap_conv=2048
1442 AC_MSG_RESULT([using IRIX format swap])
1444 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1445 then
1446 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1447 ac_cv_swap_conv=2048
1448 AC_MSG_RESULT([using Unixware format swap])
1449 else
1450 dnl if we don't know what format swap's output is
1451 dnl we might as well pretend we didn't see it
1452 ac_cv_have_swap=""
1453 ac_cv_swap_command=""
1454 fi
1455 fi
1456 dnl end if for PATH_TO_SWAP
1457 fi
1459 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1460 if (test -n "$PATH_TO_SWAPINFO")
1461 then
1462 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1463 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1464 then
1465 ac_cv_have_swap=yes
1466 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1468 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1469 then
1470 ac_cv_swap_format=["%*s %f %*d %f"]
1471 ac_cv_swap_conv=1024
1472 AC_MSG_RESULT([using FreeBSD format swapinfo])
1473 fi
1475 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1476 then
1477 ac_cv_have_swap=yes
1478 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1479 ac_cv_swap_format=["%*s %f %*d %f"]
1480 ac_cv_swap_conv=1024
1481 AC_MSG_RESULT([using HP-UX format swapinfo])
1482 fi
1483 dnl end if for PATH_TO_SWAPINFO
1484 fi
1486 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1487 if (test -n "$PATH_TO_LSPS")
1488 then
1489 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1490 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1491 then
1492 ac_cv_have_swap=yes
1493 ac_cv_swap_command="$PATH_TO_LSPS -a"
1494 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1495 ac_cv_swap_conv=1
1496 AC_MSG_RESULT([using AIX lsps])
1497 fi
1498 dnl end if for PATH_TO_SWAPINFO
1499 fi
1501 dnl
1502 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1503 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1504 dnl in the various BSD's
1505 dnl
1507 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1508 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1509 #ifdef HAVE_SYS_PARAM_H
1510 #include <sys/param.h>
1511 #endif
1512 ])
1513 AC_CHECK_DECLS([swapctl],,,[
1514 #include <unistd.h>
1515 #include <sys/types.h>
1516 #include <sys/param.h>
1517 #include <sys/stat.h>
1518 #include <sys/swap.h>
1519 ])
1520 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1521 #include <sys/types.h>
1522 #include <sys/param.h>
1523 #include <sys/stat.h>
1524 #include <sys/swap.h>
1525 ])
1526 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1527 #include <unistd.h>
1528 #include <sys/types.h>
1529 #include <sys/param.h>
1530 #include <sys/stat.h>
1531 #include <sys/swap.h>
1532 ])
1534 if test "$ac_cv_have_decl_swapctl" = "yes";
1535 then
1536 EXTRAS="$EXTRAS check_swap"
1537 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1538 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1539 "$ac_cv_type_swapent_t" = "yes";
1540 then
1541 AC_MSG_RESULT([yes])
1542 ac_cv_check_swap_swapctl_svr4="1";
1543 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1544 [Define if 2-argument SVR4 swapctl exists])
1545 else
1546 AC_MSG_RESULT([no])
1547 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1548 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1549 then
1550 AC_MSG_RESULT([yes])
1551 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1552 [Define if 3-argument BSD swapctl exists])
1553 else
1554 AC_MSG_RESULT([no])
1555 fi
1556 fi
1557 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1558 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1559 then
1560 dnl
1561 dnl the SVR4 spec returns values in pages
1562 dnl
1563 AC_MSG_RESULT([page])
1564 AC_CHECK_DECLS([sysconf])
1565 AC_MSG_CHECKING([for system page size])
1566 if test "$ac_cv_have_decl_sysconf" = "yes";
1567 then
1568 AC_MSG_RESULT([determined by sysconf(3)])
1569 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1570 else
1571 AC_MSG_WARN([don't know. guessing 4096k])
1572 ac_cv_swap_conv=256
1573 fi
1574 else
1575 dnl
1576 dnl the BSD spec returns values in blocks
1577 dnl
1578 AC_MSG_RESULT([blocks (assuming 512b)])
1579 ac_cv_swap_conv=2048
1580 fi
1581 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1582 [Conversion factor to MB])
1583 fi
1584 dnl
1585 dnl end tests for the swapctl system calls
1586 dnl
1589 if test "x$ac_cv_have_swap" != "x"
1590 then
1591 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1592 EXTRAS="$EXTRAS check_swap"
1593 fi
1594 if test "x$ac_cv_swap_command" != "x"
1595 then
1596 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1597 [Path to swap/swapinfo binary, with any args])
1598 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1599 [Format string for parsing swap output])
1600 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1601 [Conversion factor to MB])
1602 fi
1604 AC_ARG_WITH(proc-meminfo,
1605 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1606 [path to /proc/meminfo or equivalent]),
1607 ac_cv_proc_meminfo=$withval)
1608 dnl dunno why this does not work below - use hack (kbd)
1609 dnl fine on linux, broken on solaris
1610 dnl if /bin/test -e "/proc/meminfo"
1611 AC_MSG_CHECKING([for /proc/meminfo])
1612 if test -n "$ac_cv_proc_meminfo"; then
1613 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1614 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1615 AC_MSG_RESULT([found /proc/meminfo])
1616 ac_cv_proc_meminfo="/proc/meminfo"
1617 else
1618 AC_MSG_RESULT([no])
1619 fi
1621 if test -n "$ac_cv_proc_meminfo"; then
1622 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1623 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1624 EXTRAS="$EXTRAS check_swap"
1625 fi
1627 AC_PATH_PROG(PATH_TO_DIG,dig)
1628 AC_ARG_WITH(dig_command,
1629 ACX_HELP_STRING([--with-dig-command=PATH],
1630 [Path to dig command]), PATH_TO_DIG=$withval)
1631 if test -n "$PATH_TO_DIG"; then
1632 EXTRAS="$EXTRAS check_dig"
1633 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1634 fi
1636 if test -f plugins/check_nt.c ; then
1637 EXTRAS="$EXTRAS check_nt"
1638 elif test -f ../plugins/check_nt.c ; then
1639 EXTRAS="$EXTRAS check_nt"
1640 fi
1642 AC_MSG_CHECKING(for va_list)
1643 AC_TRY_COMPILE([#ifdef __STDC__
1644 #include <stdio.h>
1645 #include <stdlib.h>
1646 #include <stdarg.h>
1647 #else
1648 #include <sys/types.h>
1649 #include <stdio.h>
1650 #include <varargs.h>
1651 #endif],
1652 [va_list args;],
1653 [AC_MSG_RESULT(yes)],
1654 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1656 case $host in
1657 *bsd*)
1658 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1659 ;;
1660 *linux*)
1661 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1662 ;;
1663 *sun* | solaris*)
1664 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1665 ;;
1666 *hpux*)
1667 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1668 ;;
1669 esac
1671 AC_SUBST(EXTRAS)
1672 AC_SUBST(EXTRA_NETOBJS)
1673 AC_SUBST(DEPLIBS)
1675 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1676 AM_GNU_GETTEXT_VERSION(0.11.5)
1678 dnl Check for Redhat spopen problem
1679 dnl Wierd problem where ECHILD is returned from a wait call in error
1680 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1681 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1682 dnl We patch plugins/popen.c
1683 dnl Need to add smp because uname different on those
1684 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1685 AC_ARG_ENABLE(redhat-pthread-workaround,
1686 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1687 [force Redhat patch to be applied (default: test system)]),
1688 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1689 [ac_cv_enable_redhat_pthread_workaround=test])
1690 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1691 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1692 AC_MSG_CHECKING(for redhat spopen problem)
1693 ( cd config_test && make && make test ) > /dev/null 2>&1
1694 if test $? -eq 0 ; then
1695 AC_MSG_RESULT(okay)
1696 else
1697 AC_MSG_RESULT(error)
1698 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1699 fi
1700 fi
1701 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1702 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1703 fi
1705 dnl External libraries - see ACKNOWLEDGEMENTS
1706 np_COREUTILS
1707 np_CURL
1709 AC_OUTPUT(
1710 Makefile
1711 lib/Makefile
1712 m4/Makefile
1713 plugins/Makefile
1714 plugins-root/Makefile
1715 plugins-scripts/Makefile
1716 plugins-scripts/subst
1717 plugins-scripts/utils.pm
1718 plugins-scripts/utils.sh
1719 command.cfg
1720 test.pl
1721 pkg/solaris/pkginfo
1722 intl/Makefile
1723 po/Makefile.in
1724 )
1727 dnl the ones below that are commented out need to be cleaned up
1728 dnl in the configure code above to use with_foo instead of ac_cv_foo
1729 dnl if we want them to show up here. it'd also make the code cleaner.
1730 dnl i'll get to that on another rainy day :) -sf
1731 dnl ACX_FEATURE([with],[dig-command])
1732 dnl ACX_FEATURE([with],[fping-command])
1733 dnl ACX_FEATURE([with],[mailq-command])
1734 dnl ACX_FEATURE([with],[nslookup-command])
1735 dnl ACX_FEATURE([with],[ntpdate-command])
1736 ACX_FEATURE([with],[ping6-command])
1737 ACX_FEATURE([with],[ping-command])
1738 dnl ACX_FEATURE([with],[qstat-command])
1739 dnl ACX_FEATURE([with],[rpcinfo-command])
1740 dnl ACX_FEATURE([with],[smbclient-command])
1741 dnl ACX_FEATURE([with],[snmpget-command])
1742 dnl ACX_FEATURE([with],[snmpgetnext-command])
1743 dnl ACX_FEATURE([with],[ssh-command])
1744 dnl ACX_FEATURE([with],[uptime-command])
1746 dnl ACX_FEATURE([with],[proc-loadavg])
1747 dnl ACX_FEATURE([with],[proc-meminfo])
1748 dnl ACX_FEATURE([with],[ps-command])
1749 dnl ACX_FEATURE([with],[ps-format])
1750 dnl ACX_FEATURE([with],[ps-cols])
1751 dnl ACX_FEATURE([with],[ps-varlist])
1753 ACX_FEATURE([with],[lwres])
1754 ACX_FEATURE([with],[ipv6])
1755 ACX_FEATURE([with],[openssl])
1756 ACX_FEATURE([with],[gnutls])
1757 ACX_FEATURE([enable],[emulate-getaddrinfo])
1758 ACX_FEATURE([with],[perl])
1759 ACX_FEATURE([with],[cgiurl])
1760 ACX_FEATURE([with],[nagios-user])
1761 ACX_FEATURE([with],[nagios-group])
1762 ACX_FEATURE([with],[trusted-path])