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)
108 dnl allow them to override the path of perl
109 AC_ARG_WITH(perl,
110 ACX_HELP_STRING([--with-perl=PATH],
111 [sets path to perl executable]),
112 with_perl=$withval,with_perl=$PERL)
113 AC_SUBST(PERL, $with_perl)
115 dnl allow for gnutls, if it exists, instead of openssl
116 AC_ARG_WITH(gnutls,
117 ACX_HELP_STRING([--with-gnutls=PATH],
118 [path to gnutls installation root]),
119 GNUTLS=$withval)
121 AC_PATH_PROG(HOSTNAME,hostname)
122 AC_PATH_PROG(BASENAME,basename)
124 dnl
125 dnl Check for miscellaneous stuff
126 dnl
128 case $host_vender-$host_os in
129 sun*)
130 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
131 ;;
132 osf*)
133 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
134 ;;
135 esac
137 dnl
138 dnl Checks for libraries.
139 dnl
141 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
142 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
143 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
144 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
145 AC_SUBST(SOCKETLIBS)
147 dnl
148 dnl check for math-related functions needing -lm
149 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
150 AC_SUBST(MATHLIBS)
152 dnl Check for PostgreSQL libraries
153 _SAVEDLIBS="$LIBS"
154 _SAVEDCPPFLAGS="$CPPFLAGS"
155 AC_ARG_WITH(pgsql,
156 ACX_HELP_STRING([--with-pgsql=DIR],
157 [sets path to pgsql installation]),
158 PGSQL=$withval,)
159 AC_CHECK_LIB(crypt,main)
160 if test "$ac_cv_lib_crypt_main" = "yes"; then
161 if test -n "$PGSQL"; then
162 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
163 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
164 fi
165 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
166 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
167 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
168 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
169 AC_CHECK_HEADERS(libpq-fe.h)
170 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
171 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
172 PGINCLUDE="-I$PGSQL/include"
173 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
174 PGLIBS="-lpq -lcrypt"
175 PGINCLUDE="-I/usr/include/pgsql"
176 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
177 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
178 PGINCLUDE="-I/usr/include/postgresql"
179 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
180 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
181 PGINCLUDE="-I$PGSQL/include"
182 fi
183 if test -z "$PGINCLUDE"; then
184 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
185 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
186 else
187 AC_SUBST(PGLIBS)
188 AC_SUBST(PGINCLUDE)
189 EXTRAS="$EXTRAS check_pgsql"
190 fi
191 else
192 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
193 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
194 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
195 fi
196 else
197 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
198 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
199 fi
200 LIBS="$_SAVEDLIBS"
201 CPPFLAGS="$_SAVEDCPPFLAGS"
203 dnl Check for radius libraries
204 _SAVEDLIBS="$LIBS"
205 AC_CHECK_LIB(radiusclient,rc_read_config)
206 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
207 EXTRAS="$EXTRAS check_radius"
208 RADIUSLIBS="-lradiusclient"
209 AC_SUBST(RADIUSLIBS)
210 else
211 AC_MSG_WARN([Skipping radius plugin])
212 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
213 fi
214 LIBS="$_SAVEDLIBS"
216 dnl Check for LDAP libraries
217 _SAVEDLIBS="$LIBS"
218 AC_CHECK_LIB(ldap,main,,,-llber)
219 if test "$ac_cv_lib_ldap_main" = "yes"; then
220 LDAPLIBS="-lldap -llber"\
221 LDAPINCLUDE="-I/usr/include/ldap"
222 AC_SUBST(LDAPLIBS)
223 AC_SUBST(LDAPINCLUDE)
224 AC_CHECK_FUNCS(ldap_set_option)
225 EXTRAS="$EXTRAS check_ldap"
226 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
227 else
228 AC_MSG_WARN([Skipping LDAP plugin])
229 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
230 fi
231 LIBS="$_SAVEDLIBS"
234 dnl Check for mysql libraries
235 _SAVEDLIBS="$LIBS"
236 _SAVEDCPPFLAGS="$CPPFLAGS"
237 AC_ARG_WITH(mysql,
238 ACX_HELP_STRING([--with-mysql=DIR],
239 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
240 MYSQL=$withval,)
241 if test -n "$MYSQL"; then
242 MYSQLLIBDIR=$MYSQL/lib/mysql
243 CPPFLAGS="-I$MYSQL/include"
244 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
245 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
246 elif test -f /usr/lib/libmysqlclient.so; then
247 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
248 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
249 elif test -f /usr/lib/libmysqlclient.a; then
250 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
251 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
252 elif test -f /usr/lib/mysql/libmysqlclient.so; then
253 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
254 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
255 elif test -f /usr/lib/mysql/libmysqlclient.a; then
256 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
257 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
258 fi
259 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
260 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
261 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
262 EXTRAS="$EXTRAS check_mysql"
263 AC_SUBST(MYSQLINCLUDE)
264 AC_SUBST(MYSQLLIBS)
265 AC_SUBST(check_mysql_LDFLAGS)
266 else
267 AC_MSG_WARN([Skipping mysql plugin])
268 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
269 fi
270 else
271 AC_MSG_WARN([Skipping mysql plugin])
272 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
273 fi
274 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
275 LIBS="$_SAVEDLIBS"
277 AC_CHECK_HEADERS(unistd.h)
279 dnl Check for AF_INET6 support - unistd.h required for Darwin
280 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
281 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
282 #include <unistd.h>
283 #endif
284 #include <netinet/in.h>
285 #include <sys/socket.h>],
286 [struct sockaddr_in6 sin6;
287 void *p;
289 sin6.sin6_family = AF_INET6;
290 sin6.sin6_port = 587;
291 p = &sin6.sin6_addr;],
292 [with_ipv6=yes],
293 [with_ipv6=no])
294 ])
296 if test x"$with_ipv6" != xno ; then
297 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
298 fi
300 dnl #########################################################################
301 dnl Check if Posix getaddrinfo() is available. It is also possible to use
302 dnl the version from the lwres library distributed with BIND.
303 dnl #########################################################################
304 AC_ARG_ENABLE([emulate-getaddrinfo],
305 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
306 [enable getaddrinfo emulation (default=no)]),
307 ,
308 enable_emulate_getaddrinfo=no)
310 AC_ARG_WITH(lwres,
311 ACX_HELP_STRING([--with-lwres=DIR],
312 [use lwres library for getaddrinfo (default=no)]),
313 ,
314 with_lwres=no)
316 dnl ## enable force to test getaddrinfo.c
317 if test x$enable_emulate_getaddrinfo = xforce ; then
318 enable_emulate_getaddrinfo=yes
319 have_getaddrinfo=no
320 else
322 have_getaddrinfo=no
323 if test x$with_lwres != xno ; then
324 if test "$with_lwres" != yes ; then
325 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
326 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
327 fi
328 AC_CHECK_HEADERS(lwres/netdb.h, ,
329 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
330 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
331 [AC_MSG_ERROR([cannot find the lwres library])],
332 -lnsl -lpthread)
333 have_getaddrinfo=yes
334 fi
336 if test x$have_getaddrinfo != xyes ; then
337 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
338 fi
340 dnl # Special nonsense for systems that actually have getaddrinfo but
341 dnl # redefine the name to something else, e.g. OSF
342 if test x$have_getaddrinfo != xyes ; then
343 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
344 AC_TRY_LINK([
345 # include <netdb.h>
346 ], [
347 struct addrinfo hints, *res;
348 int err;
350 err = getaddrinfo ("host", "service", &hints, &res);
351 ], [
352 have_getaddrinfo=yes
353 AC_MSG_RESULT(yes)
354 ], [AC_MSG_RESULT(no)])
355 fi
357 fi
359 if test x$have_getaddrinfo != xno ; then
360 if test x$enable_emulate_getaddrinfo != xno ; then
361 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
362 fi
363 AC_DEFINE(HAVE_GETADDRINFO, 1,
364 [Does system provide RFC 2553/Posix getaddrinfo?])
365 else
366 if test x$enable_emulate_getaddrinfo != xyes ; then
367 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
368 enable_emulate_getaddrinfo=yes
369 AC_MSG_WARN([enabling getaddrinfo emulation])
370 fi
371 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
372 fi
374 if test x"$enable_emulate_getaddrinfo" != xno ; then
375 have_resolver=no
377 dnl Try for getipnodebyname
378 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
379 if test x"$have_resolver" != xno ; then
380 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
381 [Set when getipnodebyname is available])
382 fi
384 dnl Try for gethostbyname_r
385 if test x"$have_resolver" = xno ; then
386 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
387 [have_resolver=yes
388 ACX_WHICH_GETHOSTBYNAME_R])
389 fi
391 dnl Try for gethostbyname
392 if test x"$have_resolver" = xno ; then
393 if test x"$enable_pthreads" != xno ; then
394 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
395 fi
396 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
397 [AC_MSG_ERROR([cannot find gethostbyname])])
398 fi
399 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
401 fi
403 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
404 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
405 if test "$FOUNDINCLUDE" = "no"; then
406 _SAVEDCPPFLAGS="$CPPFLAGS"
407 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
408 unset ac_cv_header_krb5_h
409 AC_CHECK_HEADERS(krb5.h,
410 KRB5INCLUDE="-I/usr/kerberos/include"
411 FOUNDINCLUDE=yes,
412 FOUNDINCLUDE=no)
413 fi
414 AC_SUBST(KRBINCLUDE)
415 if test "$FOUNDINCLUDE" = "no"; then
416 CPPFLAGS="$_SAVEDCPPFLAGS"
417 fi
420 dnl Check for OpenSSL location
421 AC_PATH_PROG(OPENSSL,openssl)
422 if test "$OPENSSL" = "/usr/bin/openssl"; then
423 OPENSSL=/usr
424 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
425 OPENSSL=/usr
426 elif test "$OPENSSL" = "/opt/bin/openssl"; then
427 OPENSSL=/opt
428 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
429 OPENSSL=/opt/openssl
430 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
431 OPENSSL=/usr/slocal
432 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
433 OPENSSL=/usr/local
434 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
435 OPENSSL=/usr/local/ssl
436 fi
437 AC_ARG_WITH(openssl,
438 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
439 AC_HELP_STRING([--without-openssl], [disable openssl]),
440 OPENSSL=$withval)
442 _SAVEDCPPFLAGS="$CPPFLAGS"
443 _SAVEDLDFLAGS="$LDFLAGS"
444 if test X"$OPENSSL" = "Xno"; then
445 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
446 FOUNDSSL="dontbother"
447 else
448 dnl Check for OpenSSL header files
449 unset FOUNDINCLUDE
450 if test "$OPENSSL" != "/usr"; then
451 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
452 LDFLAGS="$LDFLAGS -R$OPENSSL/lib"
453 fi
454 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
455 SSLINCLUDE="-I$OPENSSL/include"
456 FOUNDINCLUDE=yes,
457 FOUNDINCLUDE=no)
458 if test "$FOUNDINCLUDE" = "no"; then
459 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
460 SSLINCLUDE="-I$OPENSSL/include"
461 FOUNDINCLUDE=yes,
462 FOUNDINCLUDE=no)
463 fi
464 AC_SUBST(SSLINCLUDE)
465 if test "$FOUNDINCLUDE" = "no"; then
466 CPPFLAGS="$_SAVEDCPPFLAGS"
467 fi
469 dnl Check for crypto lib
470 _SAVEDLIBS="$LIBS"
471 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
472 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
473 dnl Check for SSL lib
474 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)
475 fi
476 LIBS="$_SAVEDLIBS"
478 FOUNDSSL="no"
479 dnl test headers and libs to decide whether check_http should use SSL
480 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
481 if test "$ac_cv_lib_ssl_main" = "yes"; then
482 if test "$FOUNDINCLUDE" = "yes"; then
483 FOUNDSSL="yes"
484 fi
485 fi
486 fi
487 fi
489 dnl check for gnutls if openssl isn't found (or is disabled)
490 FOUNDGNUTLS="no"
491 if ! test "$FOUNDSSL" = "yes" && ! test "$with_gnutls" = "no"; then
492 if test "$GNUTLS" = ""; then
493 CPPFLAGS="$CPPFLAGS -I$GNUTLS"
494 elif ! test "$LIBGNUTLS_CONFIG" = ""; then
495 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
496 fi
497 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
498 if test "$FOUNDGNUTLS" = "yes"; then
499 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
500 FOUNDSSL="yes"
501 fi
502 fi
503 dnl end check for gnutls
505 if test "$FOUNDSSL" = "yes"; then
506 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
507 AC_SUBST(check_tcp_ssl)
508 AC_SUBST(SSLLIBS)
509 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
510 if test "$FOUNDGNUTLS" = "no"; then
511 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
512 with_openssl="yes"
513 with_gnutls="no"
514 else
515 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
516 with_gnutls="yes"
517 with_openssl="no"
518 fi
519 else
520 if test "$FOUNDSSL" = "no"; then
521 AC_MSG_WARN([OpenSSL libs could not be found])
522 dnl else deliberately disabled
523 fi
524 with_openssl="no"
525 with_gnutls="no"
526 CPPFLAGS="$_SAVEDCPPFLAGS"
527 LDFLAGS="$_SAVEDLDFLAGS"
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)
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 if test -f "/proc/loadavg"
624 then
625 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
626 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
627 fi
629 dnl #### Process table test
631 AC_PATH_PROG(PATH_TO_PS,ps)
633 AC_MSG_CHECKING(for ps syntax)
635 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
636 AM_CONDITIONAL(WANT_PST3, false)
637 if test "$ac_cv_uname_s" = "SunOS"; then
638 #
639 # this is a very, very ugly hack, to hardcode the location for plugins
640 #
641 if test "$libexecdir" = '${exec_prefix}/libexec'; then
642 if test "$exec_prefix" = "NONE"; then
643 if test "$prefix" = "NONE"; then
644 pst3="$ac_default_prefix/libexec/pst3"
645 else
646 pst3="$prefix/libexec/pst3"
647 fi
648 else
649 pst3="$exec_prefix/libexec/pst3"
650 fi
651 else
652 pst3="$libexecdir/pst3"
653 fi
654 ac_cv_ps_command="$pst3"
655 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
656 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
657 ac_cv_ps_cols=8
658 AC_MSG_RESULT([using nagios-plugins internal ps for solaris])
659 AM_CONDITIONAL(WANT_PST3, true)
661 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
662 dnl so test for this first...
663 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
664 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
665 then
666 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
667 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
668 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
669 ac_cv_ps_cols=9
670 AC_MSG_RESULT([$ac_cv_ps_command])
672 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
673 dnl Should also work for FreeBSD 5.2.1 and 5.3
674 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
675 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
676 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
677 then
678 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
679 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
680 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
681 ac_cv_ps_cols=9
682 AC_MSG_RESULT([$ac_cv_ps_command])
684 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
685 dnl Limitation: Only first 16 chars returned for ucomm field
686 dnl Must come before ps -weo
687 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
688 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
689 then
690 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
691 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
692 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
693 ac_cv_ps_cols=9
694 AC_MSG_RESULT([$ac_cv_ps_command])
696 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
697 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
698 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
699 then
700 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
701 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
702 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
703 ac_cv_ps_cols=10
704 AC_MSG_RESULT([$ac_cv_ps_command])
706 dnl FreeBSD
707 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
708 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
709 then
710 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
711 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
712 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
713 ac_cv_ps_cols=9
714 AC_MSG_RESULT([$ac_cv_ps_command])
716 dnl BSD-like mode in RH 6.1
717 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
718 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
719 then
720 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
721 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
722 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
723 ac_cv_ps_cols=9
724 AC_MSG_RESULT([$ac_cv_ps_command])
726 dnl SunOS 4.1.3:
727 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
728 dnl Need the head -1 otherwise test will work because arguments are found
729 elif ps -laxnwww 2>/dev/null | head -1 | \
730 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
731 then
732 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
733 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
734 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
735 ac_cv_ps_cols=9
736 AC_MSG_RESULT([$ac_cv_ps_command])
738 dnl Debian Linux / procps v1.2.9:
739 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
740 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
741 dnl
742 elif ps laxnwww 2>/dev/null | \
743 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
744 then
745 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
746 ac_cv_ps_command="$PATH_TO_PS laxnwww"
747 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
748 ac_cv_ps_cols=9
749 AC_MSG_RESULT([$ac_cv_ps_command])
751 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
752 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
753 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
754 then
755 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
756 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
757 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
758 ac_cv_ps_cols=9
759 AC_MSG_RESULT([$ac_cv_ps_command])
761 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
762 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
763 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
764 dnl of 1500). Will need big changes to check_procs to support
765 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
766 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
767 then
768 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
769 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
770 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
771 ac_cv_ps_cols=8
772 AC_MSG_RESULT([$ac_cv_ps_command])
774 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
775 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
776 then
777 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
778 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
779 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
780 ac_cv_ps_cols=9
781 AC_MSG_RESULT([$ac_cv_ps_command])
783 dnl AIX 4.3.3 and 5.1 do not have an rss field
784 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
785 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
786 then
787 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
788 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
789 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
790 ac_cv_ps_cols=8
791 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
793 dnl Solaris 2.6
794 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
795 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
796 then
797 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
798 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
799 # There must be no space between the %s and %n due to a wierd problem in sscanf where
800 # it will return %n as longer than the line length
801 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
802 ac_cv_ps_cols=9
803 AC_MSG_RESULT([$ac_cv_ps_command])
805 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
806 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
807 then
808 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
809 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
810 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
811 ac_cv_ps_cols=9
812 AC_MSG_RESULT([$ac_cv_ps_command])
814 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
815 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
816 then
817 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
818 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
819 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
820 ac_cv_ps_cols=9
821 AC_MSG_RESULT([$ac_cv_ps_command])
823 dnl wonder who takes state instead of stat
824 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
825 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
826 then
827 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
828 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
829 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
830 ac_cv_ps_cols=8
831 AC_MSG_RESULT([$ac_cv_ps_command])
833 dnl IRIX 53
834 elif ps -el 2>/dev/null | \
835 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
836 then
837 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
838 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
839 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
840 ac_cv_ps_cols=8
841 AC_MSG_RESULT([$ac_cv_ps_command])
843 dnl IRIX 63
844 elif ps -el 2>/dev/null | \
845 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
846 then
847 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
848 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
849 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
850 ac_cv_ps_cols=6
851 AC_MSG_RESULT([$ac_cv_ps_command])
853 dnl AIX 4.1:
854 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
855 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
856 elif ps -el 2>/dev/null | \
857 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
858 then
859 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
860 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
861 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
862 ac_cv_ps_cols=6
863 AC_MSG_RESULT([$ac_cv_ps_command])
865 dnl AIX?
866 elif ps glaxen 2>/dev/null | \
867 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
868 then
869 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
870 ac_cv_ps_command="$PATH_TO_PS glaxen"
871 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
872 ac_cv_ps_cols=8
873 AC_MSG_RESULT([$ac_cv_ps_command])
875 dnl MacOSX / Darwin
876 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
877 dnl Some truncation will happen in UCOMM column
878 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
879 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
880 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
881 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
882 then
883 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
884 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
885 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
886 ac_cv_ps_cols=8
887 AC_MSG_RESULT([$ac_cv_ps_command])
889 dnl UnixWare
890 elif ps -Al 2>/dev/null | \
891 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
892 then
893 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
894 ac_cv_ps_command="$PATH_TO_PS -Al"
895 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
896 ac_cv_ps_cols=8
897 AC_MSG_RESULT([$ac_cv_ps_command])
899 else
900 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
901 fi
903 if test -n "$ac_cv_ps_varlist" ; then
904 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
905 [Variable list for sscanf of 'ps' output])
906 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
907 [Verbatim command to execute for ps in check_procs])
908 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
909 [Format string for scanning ps output in check_procs])
910 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
911 [Number of columns in ps command])
912 EXTRAS="$EXTRAS check_procs check_nagios"
913 fi
915 AC_PATH_PROG(PATH_TO_PING,ping)
916 AC_PATH_PROG(PATH_TO_PING6,ping6)
918 AC_ARG_WITH(ping_command,
919 ACX_HELP_STRING([--with-ping-command=SYNTAX],
920 [sets syntax for ICMP ping]),
921 with_ping_command=$withval,)
923 AC_MSG_CHECKING(for ICMP ping syntax)
924 ac_cv_ping_packets_first=no
925 ac_cv_ping_has_timeout=no
926 if test -n "$with_ping_command"
927 then
928 AC_MSG_RESULT([(command-line) $with_ping_command])
929 if test -n "$ac_cv_ping_packets_first"
930 then
931 ac_cv_ping_packets_first=yes
932 fi
934 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
935 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
936 egrep -i "^round-trip|^rtt" >/dev/null
937 then
938 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
939 ac_cv_ping_packets_first=yes
940 AC_MSG_RESULT([$with_ping_command])
942 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
943 egrep -i "^round-trip|^rtt" >/dev/null
944 then
945 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
946 ac_cv_ping_packets_first=yes
947 ac_cv_ping_has_timeout=yes
948 AC_MSG_RESULT([$with_ping_command])
950 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
951 egrep -i "^round-trip|^rtt" >/dev/null
952 then
953 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
954 ac_cv_ping_packets_first=yes
955 AC_MSG_RESULT([$with_ping_command])
957 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
958 egrep -i "^round-trip|^rtt" >/dev/null
959 then
960 with_ping_command="$PATH_TO_PING -n -c %d %s"
961 ac_cv_ping_packets_first=yes
962 AC_MSG_RESULT([$with_ping_command])
964 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
965 egrep -i "^round-trip|^rtt" >/dev/null
966 then
967 with_ping_command="$PATH_TO_PING -n %s -c %d"
968 AC_MSG_RESULT([$with_ping_command])
970 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
971 egrep -i "^round-trip|^rtt" >/dev/null
972 then
973 with_ping_command="$PATH_TO_PING %s -n %d"
974 AC_MSG_RESULT([$with_ping_command])
976 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
977 egrep -i "^round-trip|^rtt" >/dev/null
978 then
979 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
980 AC_MSG_RESULT([$with_ping_command])
982 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
983 egrep -i "^round-trip|^rtt" >/dev/null
984 then
985 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
986 AC_MSG_RESULT([$with_ping_command])
988 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
989 egrep -i "^round-trip|^rtt" >/dev/null
990 then
991 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
992 ac_cv_ping_packets_first=yes
993 AC_MSG_RESULT([$with_ping_command])
995 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
996 egrep -i "^round-trip|^rtt" >/dev/null
997 then
998 with_ping_command="$PATH_TO_PING -n -c %d %s"
999 ac_cv_ping_packets_first=yes
1000 AC_MSG_RESULT([$with_ping_command])
1002 else
1003 AC_MSG_WARN([unable to find usable ping syntax])
1004 fi
1006 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1007 [path and args for ICMP ping command])
1009 if test "x$ac_cv_ping_packets_first" != "xno"
1010 then
1011 AC_DEFINE(PING_PACKETS_FIRST,1,
1012 [Define if packet count must precede host])
1013 fi
1015 if test "x$ac_cv_ping_has_timeout" != "xno"
1016 then
1017 AC_DEFINE(PING_HAS_TIMEOUT,1,
1018 [Define if ping has its own timeout option that should be set])
1019 fi
1021 AC_ARG_WITH(ping6_command,
1022 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1023 [sets syntax for ICMPv6 ping]),
1024 with_ping6_command=$withval,)
1026 if test x"$with_ipv6" != xno ; then
1027 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1028 ac_cv_ping6_packets_first=no
1029 if test -n "$with_ping6_command"
1030 then
1031 AC_MSG_RESULT([(command-line) $with_ping6_command])
1032 if test -n "$ac_cv_ping6_packets_first"
1033 then
1034 ac_cv_ping6_packets_first=yes
1035 fi
1037 elif test "x$PATH_TO_PING6" != "x"; then
1038 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1039 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1040 egrep -i "^round-trip|^rtt" >/dev/null
1041 then
1042 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1043 ac_cv_ping6_packets_first=yes
1044 AC_MSG_RESULT([$with_ping6_command])
1046 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
1047 egrep -i "^round-trip|^rtt" >/dev/null
1048 then
1049 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
1050 ac_cv_ping6_packets_first=yes
1051 ac_cv_ping_has_timeout=yes
1052 AC_MSG_RESULT([$with_ping6_command])
1054 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1055 egrep -i "^round-trip|^rtt" >/dev/null
1056 then
1057 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1058 ac_cv_ping6_packets_first=yes
1059 AC_MSG_RESULT([$with_ping6_command])
1061 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1062 egrep -i "^round-trip|^rtt" >/dev/null
1063 then
1064 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1065 ac_cv_ping6_packets_first=yes
1066 AC_MSG_RESULT([$with_ping6_command])
1068 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1069 egrep -i "^round-trip|^rtt" >/dev/null
1070 then
1071 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1072 AC_MSG_RESULT([$with_ping6_command])
1074 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1075 egrep -i "^round-trip|^rtt" >/dev/null
1076 then
1077 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1078 AC_MSG_RESULT([$with_ping6_command])
1080 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1081 egrep -i "^round-trip|^rtt" >/dev/null
1082 then
1083 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1084 AC_MSG_RESULT([$with_ping6_command])
1086 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1087 egrep -i "^round-trip|^rtt" >/dev/null
1088 then
1089 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1090 AC_MSG_RESULT([$with_ping6_command])
1092 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1093 egrep -i "^round-trip|^rtt" >/dev/null
1094 then
1095 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1096 ac_cv_ping6_packets_first=yes
1097 AC_MSG_RESULT([$with_ping_command])
1099 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1100 egrep -i "^round-trip|^rtt" >/dev/null
1101 then
1102 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1103 ac_cv_ping6_packets_first=yes
1104 AC_MSG_RESULT([$with_ping6_command])
1106 fi
1108 elif test "x$PATH_TO_PING" != "x"; then
1109 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1110 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1111 egrep -i "^round-trip|^rtt" >/dev/null
1112 then
1113 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1114 ac_cv_ping6_packets_first=yes
1115 AC_MSG_RESULT([$with_ping6_command])
1117 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1118 egrep -i "^round-trip|^rtt" >/dev/null
1119 then
1120 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1121 ac_cv_ping6_packets_first=yes
1122 AC_MSG_RESULT([$with_ping6_command])
1124 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1125 egrep -i "^round-trip|^rtt" >/dev/null
1126 then
1127 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1128 ac_cv_ping6_packets_first=yes
1129 AC_MSG_RESULT([$with_ping6_command])
1131 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1132 egrep -i "^round-trip|^rtt" >/dev/null
1133 then
1134 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1135 AC_MSG_RESULT([$with_ping6_command])
1137 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1138 egrep -i "^round-trip|^rtt" >/dev/null
1139 then
1140 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1141 AC_MSG_RESULT([$with_ping6_command])
1143 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1144 egrep -i "^round-trip|^rtt" >/dev/null
1145 then
1146 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1147 AC_MSG_RESULT([$with_ping6_command])
1149 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1150 egrep -i "^round-trip|^rtt" >/dev/null
1151 then
1152 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1153 AC_MSG_RESULT([$with_ping6_command])
1155 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1156 egrep -i "^round-trip|^rtt" >/dev/null
1157 then
1158 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1159 ac_cv_ping6_packets_first=yes
1160 AC_MSG_RESULT([$with_ping_command])
1162 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1163 egrep -i "^round-trip|^rtt" >/dev/null
1164 then
1165 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1166 ac_cv_ping6_packets_first=yes
1167 AC_MSG_RESULT([$with_ping6_command])
1169 fi
1171 fi
1173 if test "x$with_ping6_command" != "x"; then
1174 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1175 [path and args for ICMPv6 ping command])
1176 else
1177 AC_MSG_RESULT([none])
1178 fi
1180 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1181 AC_DEFINE(PING6_PACKETS_FIRST,1,
1182 [Define if packet count must precede host])
1183 fi
1184 fi
1186 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1188 AC_MSG_CHECKING(for nslookup syntax)
1189 if test -n "$PATH_TO_NSLOOKUP"
1190 then
1191 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1192 then
1193 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1194 AC_MSG_RESULT([$ac_cv_nslookup_command])
1196 else
1197 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1198 AC_MSG_RESULT([$ac_cv_nslookup_command])
1200 fi
1201 EXTRAS="$EXTRAS check_dns"
1203 else
1204 AC_MSG_WARN([nslookup command not found])
1205 fi
1207 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1208 [path and args for nslookup])
1210 AC_PATH_PROG(PATH_TO_HOST,host)
1211 if test -n "$ac_cv_path_PATH_TO_HOST"
1212 then
1213 EXTRAS="$EXTRAS check_dns"
1214 fi
1216 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1217 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1219 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1220 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1222 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1223 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1224 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1225 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1226 then
1227 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1228 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1229 else
1230 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1231 fi
1233 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1234 if test -x "$PATH_TO_LMSTAT"
1235 then
1236 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1237 else
1238 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1239 fi
1241 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1242 if test -x "$PATH_TO_SMBCLIENT"
1243 then
1244 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1245 else
1246 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1247 fi
1250 AC_PATH_PROG(PATH_TO_WHO,who)
1252 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1253 then
1254 ac_cv_path_to_who="$PATH_TO_WHO -q"
1255 else
1256 ac_cv_path_to_who="$PATH_TO_WHO"
1257 fi
1259 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1260 [path and arguments for invoking 'who'])
1262 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1263 if test -x "$PATH_TO_SNMPGET"
1264 then
1265 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1266 EXTRAS="$EXTRAS check_hpjd check_snmp"
1267 else
1268 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1269 fi
1271 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1272 if test -x "$PATH_TO_SNMPGETNEXT"
1273 then
1274 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1275 fi
1277 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1278 then
1279 AC_MSG_CHECKING(for Net::SNMP perl module)
1280 AC_MSG_RESULT([found])
1281 else
1282 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1283 fi
1285 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1286 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1288 if test -x "$PATH_TO_QUAKESTAT"
1289 then
1290 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1291 EXTRAS="$EXTRAS check_game"
1293 elif test -x "$PATH_TO_QSTAT"
1294 then
1295 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1296 EXTRAS="$EXTRAS check_game"
1297 else
1298 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1299 fi
1301 if test $ac_cv_path_to_qstat
1302 then
1303 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1304 [path to qstat/quakestat])
1305 fi
1307 AC_PATH_PROG(PATH_TO_FPING,fping)
1308 if test -x "$PATH_TO_FPING"
1309 then
1310 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1311 EXTRAS="$EXTRAS check_fping"
1312 else
1313 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1314 fi
1316 AC_PATH_PROG(PATH_TO_SSH,ssh)
1318 if test -x "$PATH_TO_SSH"
1319 then
1320 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1321 EXTRAS="$EXTRAS check_by_ssh"
1322 else
1323 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1324 fi
1327 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1328 if test -x "$PATH_TO_MAILQ"
1329 then
1330 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1331 else
1332 AC_MSG_WARN([Could not find mailq or eqivalent])
1333 fi
1335 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1336 if test -x "$PATH_TO_QMAIL_QSTAT"
1337 then
1338 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1339 else
1340 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1341 fi
1343 dnl SWAP info required is amount allocated/available and amount free
1344 dnl The plugin works through all the swap devices and adds up the total swap
1345 dnl available.
1346 AC_PATH_PROG(PATH_TO_SWAP,swap)
1347 if (test -n "$PATH_TO_SWAP")
1348 then
1349 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1350 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1351 then
1352 ac_cv_have_swap=yes
1353 ac_cv_swap_command="$PATH_TO_SWAP -l"
1354 if [$PATH_TO_SWAP -l 2>/dev/null | \
1355 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1356 >/dev/null]
1357 then
1358 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1359 ac_cv_swap_conv=2048
1360 AC_MSG_RESULT([using IRIX format swap])
1362 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1363 then
1364 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1365 ac_cv_swap_conv=2048
1366 AC_MSG_RESULT([using Unixware format swap])
1367 else
1368 dnl if we don't know what format swap's output is
1369 dnl we might as well pretend we didn't see it
1370 ac_cv_have_swap=""
1371 ac_cv_swap_command=""
1372 fi
1373 fi
1374 dnl end if for PATH_TO_SWAP
1375 fi
1377 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1378 if (test -n "$PATH_TO_SWAPINFO")
1379 then
1380 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1381 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1382 then
1383 ac_cv_have_swap=yes
1384 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1386 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1387 then
1388 ac_cv_swap_format=["%*s %f %*d %f"]
1389 ac_cv_swap_conv=1024
1390 AC_MSG_RESULT([using FreeBSD format swapinfo])
1391 fi
1393 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1394 then
1395 ac_cv_have_swap=yes
1396 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1397 ac_cv_swap_format=["%*s %f %*d %f"]
1398 ac_cv_swap_conv=1024
1399 AC_MSG_RESULT([using HP-UX format swapinfo])
1400 fi
1401 dnl end if for PATH_TO_SWAPINFO
1402 fi
1404 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1405 if (test -n "$PATH_TO_LSPS")
1406 then
1407 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1408 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1409 then
1410 ac_cv_have_swap=yes
1411 ac_cv_swap_command="$PATH_TO_LSPS -a"
1412 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1413 ac_cv_swap_conv=1
1414 AC_MSG_RESULT([using AIX lsps])
1415 fi
1416 dnl end if for PATH_TO_SWAPINFO
1417 fi
1419 dnl
1420 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1421 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1422 dnl in the various BSD's
1423 dnl
1425 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1426 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1427 #ifdef HAVE_SYS_PARAM_H
1428 #include <sys/param.h>
1429 #endif
1430 ])
1431 AC_CHECK_DECLS([swapctl],,,[
1432 #include <unistd.h>
1433 #include <sys/types.h>
1434 #include <sys/param.h>
1435 #include <sys/stat.h>
1436 #include <sys/swap.h>
1437 ])
1438 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1439 #include <sys/types.h>
1440 #include <sys/param.h>
1441 #include <sys/stat.h>
1442 #include <sys/swap.h>
1443 ])
1444 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1445 #include <unistd.h>
1446 #include <sys/types.h>
1447 #include <sys/param.h>
1448 #include <sys/stat.h>
1449 #include <sys/swap.h>
1450 ])
1452 if test "$ac_cv_have_decl_swapctl" = "yes";
1453 then
1454 EXTRAS="$EXTRAS check_swap"
1455 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1456 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1457 "$ac_cv_type_swapent_t" = "yes";
1458 then
1459 AC_MSG_RESULT([yes])
1460 ac_cv_check_swap_swapctl_svr4="1";
1461 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1462 [Define if 2-argument SVR4 swapctl exists])
1463 else
1464 AC_MSG_RESULT([no])
1465 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1466 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1467 then
1468 AC_MSG_RESULT([yes])
1469 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1470 [Define if 3-argument BSD swapctl exists])
1471 else
1472 AC_MSG_RESULT([no])
1473 fi
1474 fi
1475 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1476 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1477 then
1478 dnl
1479 dnl the SVR4 spec returns values in pages
1480 dnl
1481 AC_MSG_RESULT([page])
1482 AC_CHECK_DECLS([sysconf])
1483 AC_MSG_CHECKING([for system page size])
1484 if test "$ac_cv_have_decl_sysconf" = "yes";
1485 then
1486 AC_MSG_RESULT([determined by sysconf(3)])
1487 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1488 else
1489 AC_MSG_WARN([don't know. guessing 4096k])
1490 ac_cv_swap_conv=256
1491 fi
1492 else
1493 dnl
1494 dnl the BSD spec returns values in blocks
1495 dnl
1496 AC_MSG_RESULT([blocks (assuming 512b)])
1497 ac_cv_swap_conv=2048
1498 fi
1499 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1500 [Conversion factor to MB])
1501 fi
1502 dnl
1503 dnl end tests for the swapctl system calls
1504 dnl
1507 if test "x$ac_cv_have_swap" != "x"
1508 then
1509 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1510 EXTRAS="$EXTRAS check_swap"
1511 fi
1512 if test "x$ac_cv_swap_command" != "x"
1513 then
1514 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1515 [Path to swap/swapinfo binary, with any args])
1516 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1517 [Format string for parsing swap output])
1518 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1519 [Conversion factor to MB])
1520 fi
1522 dnl dunno why this does not work below - use hack (kbd)
1523 dnl fine on linux, broken on solaris
1524 dnl if /bin/test -e "/proc/meminfo"
1525 AC_MSG_CHECKING([for /proc/meminfo])
1526 if [cat /proc/meminfo > /dev/null 2>&1]
1527 then
1528 AC_MSG_RESULT([found /proc/meminfo])
1529 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1530 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1531 EXTRAS="$EXTRAS check_swap"
1532 else
1533 AC_MSG_RESULT([no])
1534 fi
1536 AC_PATH_PROG(PATH_TO_DIG,dig)
1537 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1538 if test -n "$PATH_TO_DIG"; then
1539 EXTRAS="$EXTRAS check_dig"
1540 fi
1542 if test -f plugins/check_nt.c ; then
1543 EXTRAS="$EXTRAS check_nt"
1544 elif test -f ../plugins/check_nt.c ; then
1545 EXTRAS="$EXTRAS check_nt"
1546 fi
1548 AC_MSG_CHECKING(for va_list)
1549 AC_TRY_COMPILE([#ifdef __STDC__
1550 #include <stdio.h>
1551 #include <stdlib.h>
1552 #include <stdarg.h>
1553 #else
1554 #include <sys/types.h>
1555 #include <stdio.h>
1556 #include <varargs.h>
1557 #endif],
1558 [va_list args;],
1559 [AC_MSG_RESULT(yes)],
1560 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1562 case $host in
1563 *bsd*)
1564 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1565 ;;
1566 *linux*)
1567 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1568 ;;
1569 *sun* | solaris*)
1570 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1571 ;;
1572 *hpux*)
1573 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1574 ;;
1575 esac
1577 AC_SUBST(EXTRAS)
1578 AC_SUBST(EXTRA_NETOBJS)
1579 AC_SUBST(DEPLIBS)
1581 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1582 AM_GNU_GETTEXT_VERSION(0.11.5)
1584 dnl Check for Redhat spopen problem
1585 dnl Wierd problem where ECHILD is returned from a wait call in error
1586 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1587 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1588 dnl We patch plugins/popen.c
1589 dnl Need to add smp because uname different on those. May need to check
1590 dnl Fedora Core too in future
1591 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1592 AC_MSG_CHECKING(for redhat spopen problem)
1593 ( cd config_test && make && make test ) > /dev/null 2>&1
1594 if test $? -eq 0 ; then
1595 AC_MSG_RESULT(okay)
1596 else
1597 AC_MSG_RESULT(error)
1598 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, "Problem on redhat with spopen")
1599 fi
1600 fi
1602 dnl External libraries - see ACKNOWLEDGEMENTS
1603 np_COREUTILS
1604 np_CURL
1606 AC_OUTPUT(
1607 Makefile
1608 lib/Makefile
1609 m4/Makefile
1610 plugins/Makefile
1611 plugins-root/Makefile
1612 plugins-scripts/Makefile
1613 plugins-scripts/subst
1614 plugins-scripts/utils.pm
1615 plugins-scripts/utils.sh
1616 command.cfg
1617 test.pl
1618 pkg/solaris/pkginfo
1619 intl/Makefile
1620 po/Makefile.in
1621 )
1623 ACX_FEATURE([with],[perl])
1624 ACX_FEATURE([with],[cgiurl])
1625 ACX_FEATURE([with],[nagios-user])
1626 ACX_FEATURE([with],[nagios-group])
1627 ACX_FEATURE([with],[trusted-path])
1628 ACX_FEATURE([with],[ping-command])
1629 ACX_FEATURE([with],[ping6-command])
1630 ACX_FEATURE([with],[lwres])
1631 ACX_FEATURE([with],[ipv6])
1632 ACX_FEATURE([with],[openssl])
1633 ACX_FEATURE([with],[gnutls])
1634 ACX_FEATURE([enable],[emulate-getaddrinfo])