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-beta2)
5 AC_CONFIG_SRCDIR(Helper.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(PERL,perl)
105 AC_PATH_PROG(SH,sh)
107 AC_PATH_PROG(HOSTNAME,hostname)
108 AC_PATH_PROG(BASENAME,basename)
110 dnl
111 dnl Check for miscellaneous stuff
112 dnl
114 case $host_vender-$host_os in
115 sun*)
116 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
117 ;;
118 osf*)
119 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
120 ;;
121 esac
123 dnl
124 dnl Checks for libraries.
125 dnl
127 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
128 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
129 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
130 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
131 AC_SUBST(SOCKETLIBS)
133 dnl Check for PostgreSQL libraries
134 _SAVEDLIBS="$LIBS"
135 _SAVEDCPPFLAGS="$CPPFLAGS"
136 AC_ARG_WITH(pgsql,
137 ACX_HELP_STRING([--with-pgsql=DIR],
138 [sets path to pgsql installation]),
139 PGSQL=$withval,)
140 AC_CHECK_LIB(crypt,main)
141 if test "$ac_cv_lib_crypt_main" = "yes"; then
142 if test -n "$PGSQL"; then
143 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
144 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
145 fi
146 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
147 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
148 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
149 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
150 AC_CHECK_HEADERS(libpq-fe.h)
151 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
152 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
153 PGINCLUDE="-I$PGSQL/include"
154 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
155 PGLIBS="-lpq -lcrypt"
156 PGINCLUDE="-I/usr/include/pgsql"
157 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
158 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
159 PGINCLUDE="-I/usr/include/postgresql"
160 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
161 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
162 PGINCLUDE="-I$PGSQL/include"
163 fi
164 if test -z "$PGINCLUDE"; then
165 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
166 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
167 else
168 AC_SUBST(PGLIBS)
169 AC_SUBST(PGINCLUDE)
170 EXTRAS="$EXTRAS check_pgsql"
171 fi
172 else
173 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
174 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
175 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
176 fi
177 else
178 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
179 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
180 fi
181 LIBS="$_SAVEDLIBS"
182 CPPFLAGS="$_SAVEDCPPFLAGS"
184 dnl Check for radius libraries
185 _SAVEDLIBS="$LIBS"
186 AC_CHECK_LIB(radiusclient,rc_read_config)
187 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
188 EXTRAS="$EXTRAS check_radius"
189 RADIUSLIBS="-lradiusclient"
190 AC_SUBST(RADIUSLIBS)
191 else
192 AC_MSG_WARN([Skipping radius plugin])
193 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
194 fi
195 LIBS="$_SAVEDLIBS"
197 dnl Check for LDAP libraries
198 _SAVEDLIBS="$LIBS"
199 AC_CHECK_LIB(ldap,main,,,-llber)
200 if test "$ac_cv_lib_ldap_main" = "yes"; then
201 LDAPLIBS="-lldap -llber"\
202 LDAPINCLUDE="-I/usr/include/ldap"
203 AC_SUBST(LDAPLIBS)
204 AC_SUBST(LDAPINCLUDE)
205 AC_CHECK_FUNCS(ldap_set_option)
206 EXTRAS="$EXTRAS check_ldap"
207 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
208 else
209 AC_MSG_WARN([Skipping LDAP plugin])
210 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
211 fi
212 LIBS="$_SAVEDLIBS"
215 dnl Check for mysql libraries
216 _SAVEDLIBS="$LIBS"
217 _SAVEDCPPFLAGS="$CPPFLAGS"
218 AC_ARG_WITH(mysql,
219 ACX_HELP_STRING([--with-mysql=DIR],
220 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
221 MYSQL=$withval,)
222 if test -n "$MYSQL"; then
223 MYSQLLIBDIR=$MYSQL/lib/mysql
224 CPPFLAGS="-I$MYSQL/include"
225 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
226 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
227 elif test -f /usr/lib/libmysqlclient.so; then
228 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
229 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
230 elif test -f /usr/lib/libmysqlclient.a; then
231 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
232 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
233 elif test -f /usr/lib/mysql/libmysqlclient.so; then
234 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
235 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
236 elif test -f /usr/lib/mysql/libmysqlclient.a; then
237 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
238 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
239 fi
240 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
241 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
242 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
243 EXTRAS="$EXTRAS check_mysql"
244 AC_SUBST(MYSQLINCLUDE)
245 AC_SUBST(MYSQLLIBS)
246 AC_SUBST(check_mysql_LDFLAGS)
247 else
248 AC_MSG_WARN([Skipping mysql plugin])
249 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
250 fi
251 else
252 AC_MSG_WARN([Skipping mysql plugin])
253 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
254 fi
255 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
256 LIBS="$_SAVEDLIBS"
258 AC_CHECK_HEADERS(unistd.h)
260 dnl Check for AF_INET6 support - unistd.h required for Darwin
261 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
262 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
263 #include <unistd.h>
264 #endif
265 #include <netinet/in.h>
266 #include <sys/socket.h>],
267 [struct sockaddr_in6 sin6;
268 void *p;
270 sin6.sin6_family = AF_INET6;
271 sin6.sin6_port = 587;
272 p = &sin6.sin6_addr;],
273 [with_ipv6=yes],
274 [with_ipv6=no])
275 ])
277 if test x"$with_ipv6" != xno ; then
278 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
279 fi
281 dnl #########################################################################
282 dnl Check if Posix getaddrinfo() is available. It is also possible to use
283 dnl the version from the lwres library distributed with BIND.
284 dnl #########################################################################
285 AC_ARG_ENABLE([emulate-getaddrinfo],
286 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
287 [enable getaddrinfo emulation (default=no)]),
288 ,
289 enable_emulate_getaddrinfo=no)
291 AC_ARG_WITH(lwres,
292 ACX_HELP_STRING([--with-lwres=DIR],
293 [use lwres library for getaddrinfo (default=no)]),
294 ,
295 with_lwres=no)
297 dnl ## enable force to test getaddrinfo.c
298 if test x$enable_emulate_getaddrinfo = xforce ; then
299 enable_emulate_getaddrinfo=yes
300 have_getaddrinfo=no
301 else
303 have_getaddrinfo=no
304 if test x$with_lwres != xno ; then
305 if test "$with_lwres" != yes ; then
306 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
307 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
308 fi
309 AC_CHECK_HEADERS(lwres/netdb.h, ,
310 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
311 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
312 [AC_MSG_ERROR([cannot find the lwres library])],
313 -lnsl -lpthread)
314 have_getaddrinfo=yes
315 fi
317 if test x$have_getaddrinfo != xyes ; then
318 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
319 fi
321 dnl # Special nonsense for systems that actually have getaddrinfo but
322 dnl # redefine the name to something else, e.g. OSF
323 if test x$have_getaddrinfo != xyes ; then
324 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
325 AC_TRY_LINK([
326 # include <netdb.h>
327 ], [
328 struct addrinfo hints, *res;
329 int err;
331 err = getaddrinfo ("host", "service", &hints, &res);
332 ], [
333 have_getaddrinfo=yes
334 AC_MSG_RESULT(yes)
335 ], [AC_MSG_RESULT(no)])
336 fi
338 fi
340 if test x$have_getaddrinfo != xno ; then
341 if test x$enable_emulate_getaddrinfo != xno ; then
342 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
343 fi
344 AC_DEFINE(HAVE_GETADDRINFO, 1,
345 [Does system provide RFC 2553/Posix getaddrinfo?])
346 else
347 if test x$enable_emulate_getaddrinfo != xyes ; then
348 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
349 enable_emulate_getaddrinfo=yes
350 AC_MSG_WARN([enabling getaddrinfo emulation])
351 fi
352 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
353 fi
355 if test x"$enable_emulate_getaddrinfo" != xno ; then
356 have_resolver=no
358 dnl Try for getipnodebyname
359 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
360 if test x"$have_resolver" != xno ; then
361 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
362 [Set when getipnodebyname is available])
363 fi
365 dnl Try for gethostbyname_r
366 if test x"$have_resolver" = xno ; then
367 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
368 [have_resolver=yes
369 ACX_WHICH_GETHOSTBYNAME_R])
370 fi
372 dnl Try for gethostbyname
373 if test x"$have_resolver" = xno ; then
374 if test x"$enable_pthreads" != xno ; then
375 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
376 fi
377 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
378 [AC_MSG_ERROR([cannot find gethostbyname])])
379 fi
380 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
382 fi
384 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
385 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
386 if test "$FOUNDINCLUDE" = "no"; then
387 _SAVEDCPPFLAGS="$CPPFLAGS"
388 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
389 unset ac_cv_header_krb5_h
390 AC_CHECK_HEADERS(krb5.h,
391 KRB5INCLUDE="-I/usr/kerberos/include"
392 FOUNDINCLUDE=yes,
393 FOUNDINCLUDE=no)
394 fi
395 AC_SUBST(KRBINCLUDE)
396 if test "$FOUNDINCLUDE" = "no"; then
397 CPPFLAGS="$_SAVEDCPPFLAGS"
398 fi
400 dnl Check for OpenSSL location
401 AC_PATH_PROG(OPENSSL,openssl)
402 if test "$OPENSSL" = "/usr/bin/openssl"; then
403 OPENSSL=/usr
404 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
405 OPENSSL=/usr
406 elif test "$OPENSSL" = "/opt/bin/openssl"; then
407 OPENSSL=/opt
408 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
409 OPENSSL=/opt/openssl
410 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
411 OPENSSL=/usr/slocal
412 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
413 OPENSSL=/usr/local
414 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
415 OPENSSL=/usr/local/ssl
416 fi
417 AC_ARG_WITH(openssl,
418 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
419 AC_HELP_STRING([--without-openssl], [disable openssl]),
420 OPENSSL=$withval)
422 _SAVEDCPPFLAGS="$CPPFLAGS"
423 _SAVEDLDFLAGS="$LDFLAGS"
424 if test X"$OPENSSL" = "Xno"; then
425 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
426 FOUNDSSL="dontbother"
427 else
428 dnl Check for OpenSSL header files
429 unset FOUNDINCLUDE
430 if test "$OPENSSL" != "/usr"; then
431 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
432 LDFLAGS="$LDFLAGS -R$OPENSSL/lib"
433 fi
434 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
435 SSLINCLUDE="-I$OPENSSL/include"
436 FOUNDINCLUDE=yes,
437 FOUNDINCLUDE=no)
438 if test "$FOUNDINCLUDE" = "no"; then
439 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
440 SSLINCLUDE="-I$OPENSSL/include"
441 FOUNDINCLUDE=yes,
442 FOUNDINCLUDE=no)
443 fi
444 AC_SUBST(SSLINCLUDE)
445 if test "$FOUNDINCLUDE" = "no"; then
446 CPPFLAGS="$_SAVEDCPPFLAGS"
447 fi
449 dnl Check for crypto lib
450 _SAVEDLIBS="$LIBS"
451 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
452 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
453 dnl Check for SSL lib
454 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)
455 fi
456 LIBS="$_SAVEDLIBS"
458 FOUNDSSL="no"
459 dnl test headers and libs to decide whether check_http should use SSL
460 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
461 if test "$ac_cv_lib_ssl_main" = "yes"; then
462 if test "$FOUNDINCLUDE" = "yes"; then
463 FOUNDSSL="yes"
464 fi
465 fi
466 fi
467 fi
469 if test "$FOUNDSSL" = "yes"; then
470 check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
471 AC_SUBST(check_tcp_ssl)
472 AC_SUBST(SSLLIBS)
473 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
474 with_openssl="yes"
475 else
476 if test "$FOUNDSSL" = "no"; then
477 AC_MSG_WARN([OpenSSL libs could not be found])
478 dnl else deliberately disabled
479 fi
480 with_openssl="no"
481 CPPFLAGS="$_SAVEDCPPFLAGS"
482 LDFLAGS="$_SAVEDLDFLAGS"
483 fi
485 dnl
486 dnl Checks for header files.
487 dnl
489 AC_HEADER_STDC
490 AC_HEADER_TIME
491 AC_HEADER_SYS_WAIT
492 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)
493 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
495 dnl Checks for typedefs, structures, and compiler characteristics.
496 AC_C_CONST
497 AC_STRUCT_TM
498 AC_TYPE_PID_T
499 AC_TYPE_SIZE_T
500 AC_TYPE_SIGNAL
502 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
503 AC_TRY_LINK([#include <stdarg.h>
504 va_list ap1,ap2;], [va_copy(ap1,ap2);],
505 ac_cv_HAVE_VA_COPY=yes,
506 ac_cv_HAVE_VA_COPY=no)])
507 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
508 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
509 else
510 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
511 AC_TRY_LINK([#include <stdarg.h>
512 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
513 ac_cv_HAVE___VA_COPY=yes,
514 ac_cv_HAVE___VA_COPY=no)])
515 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
516 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
517 fi
518 fi
520 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
521 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
522 AC_TRY_RUN([
523 #include <sys/types.h>
524 #include <stdarg.h>
525 void foo(const char *format, ...) {
526 va_list ap;
527 int len;
528 char buf[5];
530 va_start(ap, format);
531 len = vsnprintf(buf, 0, format, ap);
532 va_end(ap);
533 if (len != 5) exit(1);
535 va_start(ap, format);
536 len = vsnprintf(0, 0, format, ap);
537 va_end(ap);
538 if (len != 5) exit(1);
540 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
542 exit(0);
543 }
544 main() { foo("hello"); }
545 ],
546 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
547 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
548 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
549 fi
551 AC_TRY_COMPILE([#include <sys/time.h>],
552 [struct timeval *tv;
553 struct timezone *tz;],
554 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
555 AC_TRY_COMPILE([#include <sys/time.h>],
556 [struct timeval *tv;
557 struct timezone *tz;
558 gettimeofday(tv, tz);],
559 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
560 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
562 dnl Checks for library functions.
563 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
565 AC_MSG_CHECKING(return type of socket size)
566 AC_TRY_COMPILE([#include <stdlib.h>
567 #include <sys/types.h>
568 #include <sys/socket.h>],
569 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
570 ac_cv_socket_size_type=["size_t"]
571 AC_MSG_RESULT(size_t),
572 ac_cv_socket_size_type=["int"]
573 AC_MSG_RESULT(int))
575 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
576 [Define type of socket size])
578 if test -f "/proc/loadavg"
579 then
580 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
581 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
582 fi
584 dnl #### Process table test
586 AC_PATH_PROG(PATH_TO_PS,ps)
588 AC_MSG_CHECKING(for ps syntax)
589 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
590 dnl Should also work for FreeBSD 5.2.1 and 5.3
591 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
592 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
593 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
594 then
595 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
596 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
597 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
598 ac_cv_ps_cols=8
599 AC_MSG_RESULT([$ac_cv_ps_command])
601 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
602 dnl Limitation: Only first 16 chars returned for ucomm field
603 dnl Must come before ps -weo
604 elif ps -axwo 'stat uid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
605 egrep -i ["^ *STAT +UID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
606 then
607 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
608 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu ucomm command'"
609 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
610 ac_cv_ps_cols=8
611 AC_MSG_RESULT([$ac_cv_ps_command])
613 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
614 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
615 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
616 then
617 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
618 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
619 ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
620 ac_cv_ps_cols=9
621 AC_MSG_RESULT([$ac_cv_ps_command])
623 dnl FreeBSD
624 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
625 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
626 then
627 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
628 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
629 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
630 ac_cv_ps_cols=8
631 AC_MSG_RESULT([$ac_cv_ps_command])
633 dnl BSD-like mode in RH 6.1
634 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
635 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
636 then
637 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
638 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
639 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
640 ac_cv_ps_cols=8
641 AC_MSG_RESULT([$ac_cv_ps_command])
643 dnl SunOS 4.1.3:
644 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
645 dnl Need the head -1 otherwise test will work because arguments are found
646 elif ps -laxnwww 2>/dev/null | head -1 | \
647 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
648 then
649 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
650 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
651 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
652 ac_cv_ps_cols=8
653 AC_MSG_RESULT([$ac_cv_ps_command])
655 dnl Debian Linux / procps v1.2.9:
656 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
657 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
658 dnl
659 elif ps laxnwww 2>/dev/null | \
660 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
661 then
662 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
663 ac_cv_ps_command="$PATH_TO_PS laxnwww"
664 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
665 ac_cv_ps_cols=8
666 AC_MSG_RESULT([$ac_cv_ps_command])
668 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
669 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
670 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
671 then
672 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
673 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
674 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
675 ac_cv_ps_cols=8
676 AC_MSG_RESULT([$ac_cv_ps_command])
678 dnl Tru64 - needs %*[ +] in PS_FORMAT
679 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
680 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
681 then
682 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
683 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
684 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
685 ac_cv_ps_cols=8
686 AC_MSG_RESULT([$ac_cv_ps_command])
688 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
689 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
690 then
691 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
692 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
693 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
694 ac_cv_ps_cols=8
695 AC_MSG_RESULT([$ac_cv_ps_command])
697 dnl AIX 4.3.3 and 5.1 do not have an rss field
698 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
699 egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
700 then
701 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
702 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
703 ac_cv_ps_format="%s %d %d %d %f %s %n"
704 ac_cv_ps_cols=7
705 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
707 dnl Solaris 2.6
708 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
709 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
710 then
711 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
712 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
713 # There must be no space between the %s and %n due to a wierd problem in sscanf where
714 # it will return %n as longer than the line length
715 ac_cv_ps_format="%s %d %d %d %d %f %s%n"
716 ac_cv_ps_cols=8
717 AC_MSG_RESULT([$ac_cv_ps_command])
719 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
720 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
721 then
722 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
723 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
724 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
725 ac_cv_ps_cols=8
726 AC_MSG_RESULT([$ac_cv_ps_command])
728 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
729 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
730 then
731 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
732 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
733 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
734 ac_cv_ps_cols=8
735 AC_MSG_RESULT([$ac_cv_ps_command])
737 dnl wonder who takes state instead of stat
738 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
739 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
740 then
741 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
742 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
743 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
744 ac_cv_ps_cols=7
745 AC_MSG_RESULT([$ac_cv_ps_command])
747 dnl IRIX 53
748 elif ps -el 2>/dev/null | \
749 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
750 then
751 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
752 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
753 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
754 ac_cv_ps_cols=7
755 AC_MSG_RESULT([$ac_cv_ps_command])
757 dnl IRIX 63
758 elif ps -el 2>/dev/null | \
759 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
760 then
761 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
762 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
763 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
764 ac_cv_ps_cols=5
765 AC_MSG_RESULT([$ac_cv_ps_command])
767 dnl AIX 4.1:
768 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
769 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
770 elif ps -el 2>/dev/null | \
771 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
772 then
773 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
774 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
775 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
776 ac_cv_ps_cols=5
777 AC_MSG_RESULT([$ac_cv_ps_command])
779 dnl AIX?
780 elif ps glaxen 2>/dev/null | \
781 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
782 then
783 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
784 ac_cv_ps_command="$PATH_TO_PS glaxen"
785 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
786 ac_cv_ps_cols=7
787 AC_MSG_RESULT([$ac_cv_ps_command])
789 dnl MacOSX / Darwin
790 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
791 dnl Some truncation will happen in UCOMM column
792 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
793 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
794 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
795 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
796 then
797 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
798 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
799 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
800 ac_cv_ps_cols=7
801 AC_MSG_RESULT([$ac_cv_ps_command])
803 dnl UnixWare
804 elif ps -Al 2>/dev/null | \
805 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
806 then
807 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
808 ac_cv_ps_command="$PATH_TO_PS -Al"
809 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
810 ac_cv_ps_cols=7
811 AC_MSG_RESULT([$ac_cv_ps_command])
813 else
814 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
815 fi
817 if test -n "$ac_cv_ps_varlist" ; then
818 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
819 [Variable list for sscanf of 'ps' output])
820 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
821 [Verbatim command to execute for ps in check_procs])
822 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
823 [Format string for scanning ps output in check_procs])
824 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
825 [Number of columns in ps command])
826 EXTRAS="$EXTRAS check_procs check_nagios"
827 fi
829 AC_PATH_PROG(PATH_TO_PING,ping)
830 AC_PATH_PROG(PATH_TO_PING6,ping6)
832 AC_ARG_WITH(ping_command,
833 ACX_HELP_STRING([--with-ping-command=SYNTAX],
834 [sets syntax for ICMP ping]),
835 with_ping_command=$withval,)
837 AC_MSG_CHECKING(for ICMP ping syntax)
838 ac_cv_ping_packets_first=no
839 ac_cv_ping_has_timeout=no
840 if test -n "$with_ping_command"
841 then
842 AC_MSG_RESULT([(command-line) $with_ping_command])
843 if test -n "$ac_cv_ping_packets_first"
844 then
845 ac_cv_ping_packets_first=yes
846 fi
848 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
849 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
850 egrep -i "^round-trip|^rtt" >/dev/null
851 then
852 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
853 ac_cv_ping_packets_first=yes
854 AC_MSG_RESULT([$with_ping_command])
856 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
857 egrep -i "^round-trip|^rtt" >/dev/null
858 then
859 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
860 ac_cv_ping_packets_first=yes
861 ac_cv_ping_has_timeout=yes
862 AC_MSG_RESULT([$with_ping_command])
864 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
865 egrep -i "^round-trip|^rtt" >/dev/null
866 then
867 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
868 ac_cv_ping_packets_first=yes
869 AC_MSG_RESULT([$with_ping_command])
871 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
872 egrep -i "^round-trip|^rtt" >/dev/null
873 then
874 with_ping_command="$PATH_TO_PING -n -c %d %s"
875 ac_cv_ping_packets_first=yes
876 AC_MSG_RESULT([$with_ping_command])
878 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
879 egrep -i "^round-trip|^rtt" >/dev/null
880 then
881 with_ping_command="$PATH_TO_PING -n %s -c %d"
882 AC_MSG_RESULT([$with_ping_command])
884 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
885 egrep -i "^round-trip|^rtt" >/dev/null
886 then
887 with_ping_command="$PATH_TO_PING %s -n %d"
888 AC_MSG_RESULT([$with_ping_command])
890 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
891 egrep -i "^round-trip|^rtt" >/dev/null
892 then
893 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
894 AC_MSG_RESULT([$with_ping_command])
896 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
897 egrep -i "^round-trip|^rtt" >/dev/null
898 then
899 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
900 AC_MSG_RESULT([$with_ping_command])
902 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
903 egrep -i "^round-trip|^rtt" >/dev/null
904 then
905 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
906 ac_cv_ping_packets_first=yes
907 AC_MSG_RESULT([$with_ping_command])
909 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
910 egrep -i "^round-trip|^rtt" >/dev/null
911 then
912 with_ping_command="$PATH_TO_PING -n -c %d %s"
913 ac_cv_ping_packets_first=yes
914 AC_MSG_RESULT([$with_ping_command])
916 else
917 AC_MSG_WARN([unable to find usable ping syntax])
918 fi
920 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
921 [path and args for ICMP ping command])
923 if test "x$ac_cv_ping_packets_first" != "xno"
924 then
925 AC_DEFINE(PING_PACKETS_FIRST,1,
926 [Define if packet count must precede host])
927 fi
929 if test "x$ac_cv_ping_has_timeout" != "xno"
930 then
931 AC_DEFINE(PING_HAS_TIMEOUT,1,
932 [Define if ping has its own timeout option that should be set])
933 fi
935 AC_ARG_WITH(ping6_command,
936 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
937 [sets syntax for ICMPv6 ping]),
938 with_ping6_command=$withval,)
940 if test x"$with_ipv6" != xno ; then
941 AC_MSG_CHECKING(for ICMPv6 ping syntax)
942 ac_cv_ping6_packets_first=no
943 if test -n "$with_ping6_command"
944 then
945 AC_MSG_RESULT([(command-line) $with_ping6_command])
946 if test -n "$ac_cv_ping6_packets_first"
947 then
948 ac_cv_ping6_packets_first=yes
949 fi
951 elif test "x$PATH_TO_PING6" != "x"; then
952 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
953 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
954 egrep -i "^round-trip|^rtt" >/dev/null
955 then
956 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
957 ac_cv_ping6_packets_first=yes
958 AC_MSG_RESULT([$with_ping6_command])
960 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
961 egrep -i "^round-trip|^rtt" >/dev/null
962 then
963 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
964 ac_cv_ping6_packets_first=yes
965 AC_MSG_RESULT([$with_ping6_command])
967 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
968 egrep -i "^round-trip|^rtt" >/dev/null
969 then
970 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
971 ac_cv_ping6_packets_first=yes
972 AC_MSG_RESULT([$with_ping6_command])
974 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
975 egrep -i "^round-trip|^rtt" >/dev/null
976 then
977 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
978 AC_MSG_RESULT([$with_ping6_command])
980 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
981 egrep -i "^round-trip|^rtt" >/dev/null
982 then
983 with_ping6_command="$PATH_TO_PING6 %s -n %d"
984 AC_MSG_RESULT([$with_ping6_command])
986 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
987 egrep -i "^round-trip|^rtt" >/dev/null
988 then
989 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
990 AC_MSG_RESULT([$with_ping6_command])
992 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
993 egrep -i "^round-trip|^rtt" >/dev/null
994 then
995 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
996 AC_MSG_RESULT([$with_ping6_command])
998 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
999 egrep -i "^round-trip|^rtt" >/dev/null
1000 then
1001 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1002 ac_cv_ping6_packets_first=yes
1003 AC_MSG_RESULT([$with_ping_command])
1005 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1006 egrep -i "^round-trip|^rtt" >/dev/null
1007 then
1008 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1009 ac_cv_ping6_packets_first=yes
1010 AC_MSG_RESULT([$with_ping6_command])
1012 fi
1014 elif test "x$PATH_TO_PING" != "x"; then
1015 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1016 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1017 egrep -i "^round-trip|^rtt" >/dev/null
1018 then
1019 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1020 ac_cv_ping6_packets_first=yes
1021 AC_MSG_RESULT([$with_ping6_command])
1023 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1024 egrep -i "^round-trip|^rtt" >/dev/null
1025 then
1026 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1027 ac_cv_ping6_packets_first=yes
1028 AC_MSG_RESULT([$with_ping6_command])
1030 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1031 egrep -i "^round-trip|^rtt" >/dev/null
1032 then
1033 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1034 ac_cv_ping6_packets_first=yes
1035 AC_MSG_RESULT([$with_ping6_command])
1037 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1038 egrep -i "^round-trip|^rtt" >/dev/null
1039 then
1040 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1041 AC_MSG_RESULT([$with_ping6_command])
1043 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1044 egrep -i "^round-trip|^rtt" >/dev/null
1045 then
1046 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1047 AC_MSG_RESULT([$with_ping6_command])
1049 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1050 egrep -i "^round-trip|^rtt" >/dev/null
1051 then
1052 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1053 AC_MSG_RESULT([$with_ping6_command])
1055 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1056 egrep -i "^round-trip|^rtt" >/dev/null
1057 then
1058 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1059 AC_MSG_RESULT([$with_ping6_command])
1061 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1062 egrep -i "^round-trip|^rtt" >/dev/null
1063 then
1064 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1065 ac_cv_ping6_packets_first=yes
1066 AC_MSG_RESULT([$with_ping_command])
1068 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1069 egrep -i "^round-trip|^rtt" >/dev/null
1070 then
1071 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1072 ac_cv_ping6_packets_first=yes
1073 AC_MSG_RESULT([$with_ping6_command])
1075 fi
1077 fi
1079 if test "x$with_ping6_command" != "x"; then
1080 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1081 [path and args for ICMPv6 ping command])
1082 else
1083 AC_MSG_RESULT([none])
1084 fi
1086 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1087 AC_DEFINE(PING6_PACKETS_FIRST,1,
1088 [Define if packet count must precede host])
1089 fi
1090 fi
1092 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1094 AC_MSG_CHECKING(for nslookup syntax)
1095 if test -n "$PATH_TO_NSLOOKUP"
1096 then
1097 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1098 then
1099 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1100 AC_MSG_RESULT([$ac_cv_nslookup_command])
1102 else
1103 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1104 AC_MSG_RESULT([$ac_cv_nslookup_command])
1106 fi
1107 EXTRAS="$EXTRAS check_dns"
1109 else
1110 AC_MSG_WARN([nslookup command not found])
1111 fi
1113 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1114 [path and args for nslookup])
1116 AC_PATH_PROG(PATH_TO_HOST,host)
1117 if test -n "$ac_cv_path_PATH_TO_HOST"
1118 then
1119 EXTRAS="$EXTRAS check_dns"
1120 fi
1122 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1123 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1125 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1126 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1128 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1129 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1130 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1131 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1132 then
1133 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1134 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1135 else
1136 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1137 fi
1139 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1140 if test -x "$PATH_TO_LMSTAT"
1141 then
1142 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1143 else
1144 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1145 fi
1147 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1148 if test -x "$PATH_TO_SMBCLIENT"
1149 then
1150 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1151 else
1152 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1153 fi
1156 AC_PATH_PROG(PATH_TO_WHO,who)
1158 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1159 then
1160 ac_cv_path_to_who="$PATH_TO_WHO -q"
1161 else
1162 ac_cv_path_to_who="$PATH_TO_WHO"
1163 fi
1165 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1166 [path and arguments for invoking 'who'])
1168 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1169 if test -x "$PATH_TO_SNMPGET"
1170 then
1171 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1172 EXTRAS="$EXTRAS check_hpjd check_snmp"
1173 else
1174 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1175 fi
1177 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1178 if test -x "$PATH_TO_SNMPGETNEXT"
1179 then
1180 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1181 fi
1183 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1184 then
1185 AC_MSG_CHECKING(for Net::SNMP perl module)
1186 AC_MSG_RESULT([found])
1187 else
1188 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1189 fi
1191 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1192 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1194 if test -x "$PATH_TO_QUAKESTAT"
1195 then
1196 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1197 EXTRAS="$EXTRAS check_game"
1199 elif test -x "$PATH_TO_QSTAT"
1200 then
1201 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1202 EXTRAS="$EXTRAS check_game"
1203 else
1204 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1205 fi
1207 if test $ac_cv_path_to_qstat
1208 then
1209 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1210 [path to qstat/quakestat])
1211 fi
1213 AC_PATH_PROG(PATH_TO_FPING,fping)
1214 if test -x "$PATH_TO_FPING"
1215 then
1216 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1217 EXTRAS="$EXTRAS check_fping"
1218 else
1219 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1220 fi
1222 AC_PATH_PROG(PATH_TO_SSH,ssh)
1224 if test -x "$PATH_TO_SSH"
1225 then
1226 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1227 EXTRAS="$EXTRAS check_by_ssh"
1228 else
1229 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1230 fi
1233 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1234 if test -x "$PATH_TO_MAILQ"
1235 then
1236 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1237 else
1238 AC_MSG_WARN([Could not find mailq or eqivalent])
1239 fi
1241 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1242 if test -x "$PATH_TO_QMAIL_QSTAT"
1243 then
1244 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1245 else
1246 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1247 fi
1249 dnl SWAP info required is amount allocated/available and amount free
1250 dnl The plugin works through all the swap devices and adds up the total swap
1251 dnl available.
1252 AC_PATH_PROG(PATH_TO_SWAP,swap)
1253 if (test -n "$PATH_TO_SWAP")
1254 then
1255 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1256 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1257 then
1258 ac_cv_have_swap=yes
1259 ac_cv_swap_command="$PATH_TO_SWAP -l"
1260 if [$PATH_TO_SWAP -l 2>/dev/null | \
1261 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1262 >/dev/null]
1263 then
1264 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1265 ac_cv_swap_conv=2048
1266 AC_MSG_RESULT([using IRIX format swap])
1268 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1269 then
1270 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1271 ac_cv_swap_conv=2048
1272 AC_MSG_RESULT([using Unixware format swap])
1273 else
1274 dnl if we don't know what format swap's output is
1275 dnl we might as well pretend we didn't see it
1276 ac_cv_have_swap=""
1277 ac_cv_swap_command=""
1278 fi
1279 fi
1280 dnl end if for PATH_TO_SWAP
1281 fi
1283 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1284 if (test -n "$PATH_TO_SWAPINFO")
1285 then
1286 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1287 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1288 then
1289 ac_cv_have_swap=yes
1290 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1292 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1293 then
1294 ac_cv_swap_format=["%*s %f %*d %f"]
1295 ac_cv_swap_conv=1024
1296 AC_MSG_RESULT([using FreeBSD format swapinfo])
1297 fi
1299 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1300 then
1301 ac_cv_have_swap=yes
1302 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1303 ac_cv_swap_format=["%*s %f %*d %f"]
1304 ac_cv_swap_conv=1024
1305 AC_MSG_RESULT([using HP-UX format swapinfo])
1306 fi
1307 dnl end if for PATH_TO_SWAPINFO
1308 fi
1310 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1311 if (test -n "$PATH_TO_LSPS")
1312 then
1313 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1314 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1315 then
1316 ac_cv_have_swap=yes
1317 ac_cv_swap_command="$PATH_TO_LSPS -a"
1318 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1319 ac_cv_swap_conv=1
1320 AC_MSG_RESULT([using AIX lsps])
1321 fi
1322 dnl end if for PATH_TO_SWAPINFO
1323 fi
1325 dnl
1326 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1327 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1328 dnl in the various BSD's
1329 dnl
1331 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1332 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1333 #ifdef HAVE_SYS_PARAM_H
1334 #include <sys/param.h>
1335 #endif
1336 ])
1337 AC_CHECK_DECLS([swapctl],,,[
1338 #include <unistd.h>
1339 #include <sys/types.h>
1340 #include <sys/param.h>
1341 #include <sys/stat.h>
1342 #include <sys/swap.h>
1343 ])
1344 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1345 #include <sys/types.h>
1346 #include <sys/param.h>
1347 #include <sys/stat.h>
1348 #include <sys/swap.h>
1349 ])
1350 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1351 #include <unistd.h>
1352 #include <sys/types.h>
1353 #include <sys/param.h>
1354 #include <sys/stat.h>
1355 #include <sys/swap.h>
1356 ])
1358 if test "$ac_cv_have_decl_swapctl" = "yes";
1359 then
1360 EXTRAS="$EXTRAS check_swap"
1361 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1362 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1363 "$ac_cv_type_swapent_t" = "yes";
1364 then
1365 AC_MSG_RESULT([yes])
1366 ac_cv_check_swap_swapctl_svr4="1";
1367 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1368 [Define if 2-argument SVR4 swapctl exists])
1369 else
1370 AC_MSG_RESULT([no])
1371 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1372 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1373 then
1374 AC_MSG_RESULT([yes])
1375 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1376 [Define if 3-argument BSD swapctl exists])
1377 else
1378 AC_MSG_RESULT([no])
1379 fi
1380 fi
1381 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1382 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1383 then
1384 dnl
1385 dnl the SVR4 spec returns values in pages
1386 dnl
1387 AC_MSG_RESULT([page])
1388 AC_CHECK_DECLS([sysconf])
1389 AC_MSG_CHECKING([for system page size])
1390 if test "$ac_cv_have_decl_sysconf" = "yes";
1391 then
1392 AC_MSG_RESULT([determined by sysconf(3)])
1393 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1394 else
1395 AC_MSG_WARN([don't know. guessing 4096k])
1396 ac_cv_swap_conv=256
1397 fi
1398 else
1399 dnl
1400 dnl the BSD spec returns values in blocks
1401 dnl
1402 AC_MSG_RESULT([blocks (assuming 512b)])
1403 ac_cv_swap_conv=2048
1404 fi
1405 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1406 [Conversion factor to MB])
1407 fi
1408 dnl
1409 dnl end tests for the swapctl system calls
1410 dnl
1413 if test "x$ac_cv_have_swap" != "x"
1414 then
1415 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1416 EXTRAS="$EXTRAS check_swap"
1417 fi
1418 if test "x$ac_cv_swap_command" != "x"
1419 then
1420 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1421 [Path to swap/swapinfo binary, with any args])
1422 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1423 [Format string for parsing swap output])
1424 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1425 [Conversion factor to MB])
1426 fi
1428 dnl dunno why this does not work below - use hack (kbd)
1429 dnl fine on linux, broken on solaris
1430 dnl if /bin/test -e "/proc/meminfo"
1431 AC_MSG_CHECKING([for /proc/meminfo])
1432 if [cat /proc/meminfo > /dev/null 2>&1]
1433 then
1434 AC_MSG_RESULT([found /proc/meminfo])
1435 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1436 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1437 EXTRAS="$EXTRAS check_swap"
1438 else
1439 AC_MSG_RESULT([no])
1440 fi
1442 AC_PATH_PROG(PATH_TO_DIG,dig)
1443 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1444 if test -n "$PATH_TO_DIG"; then
1445 EXTRAS="$EXTRAS check_dig"
1446 fi
1448 if test -f plugins/check_nt.c ; then
1449 EXTRAS="$EXTRAS check_nt"
1450 elif test -f ../plugins/check_nt.c ; then
1451 EXTRAS="$EXTRAS check_nt"
1452 fi
1454 AC_MSG_CHECKING(for va_list)
1455 AC_TRY_COMPILE([#ifdef __STDC__
1456 #include <stdio.h>
1457 #include <stdlib.h>
1458 #include <stdarg.h>
1459 #else
1460 #include <sys/types.h>
1461 #include <stdio.h>
1462 #include <varargs.h>
1463 #endif],
1464 [va_list args;],
1465 [AC_MSG_RESULT(yes)],
1466 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1468 AC_SUBST(EXTRAS)
1469 AC_SUBST(EXTRA_NETOBJS)
1470 AC_SUBST(DEPLIBS)
1472 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1473 AM_GNU_GETTEXT_VERSION(0.11.5)
1475 dnl External libraries - see ACKNOWLEDGEMENTS
1476 np_COREUTILS
1477 np_CURL
1479 AC_OUTPUT(
1480 Makefile
1481 lib/Makefile
1482 m4/Makefile
1483 plugins/Makefile
1484 plugins-scripts/Makefile
1485 plugins-scripts/subst
1486 plugins-scripts/utils.pm
1487 plugins-scripts/utils.sh
1488 command.cfg
1489 test.pl
1490 pkg/solaris/pkginfo
1491 intl/Makefile
1492 po/Makefile.in
1493 )
1495 ACX_FEATURE([with],[cgiurl])
1496 ACX_FEATURE([with],[nagios-user])
1497 ACX_FEATURE([with],[nagios-group])
1498 ACX_FEATURE([with],[trusted-path])
1499 ACX_FEATURE([with],[ping-command])
1500 ACX_FEATURE([with],[ping6-command])
1501 ACX_FEATURE([with],[lwres])
1502 ACX_FEATURE([with],[ipv6])
1503 ACX_FEATURE([with],[openssl])
1504 ACX_FEATURE([enable],[emulate-getaddrinfo])