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-beta1)
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 dnl Check for OpenSSL location
259 AC_PATH_PROG(OPENSSL,openssl)
260 if test "$OPENSSL" = "/usr/bin/openssl"; then
261 OPENSSL=/usr
262 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
263 OPENSSL=/usr
264 elif test "$OPENSSL" = "/opt/bin/openssl"; then
265 OPENSSL=/opt
266 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
267 OPENSSL=/opt/openssl
268 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
269 OPENSSL=/usr/slocal
270 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
271 OPENSSL=/usr/local
272 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
273 OPENSSL=/usr/local/ssl
274 fi
275 AC_ARG_WITH(openssl,
276 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
277 AC_HELP_STRING([--without-openssl], [disable openssl]),
278 OPENSSL=$withval)
280 if test X"$OPENSSL" = "Xno"; then
281 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
282 FOUNDSSL="dontbother"
283 else
284 dnl Check for OpenSSL header files
285 unset FOUNDINCLUDE
286 _SAVEDCPPFLAGS="$CPPFLAGS"
287 if test "$OPENSSL" != "/usr"; then
288 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
289 fi
290 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
291 SSLINCLUDE="-I$OPENSSL/include"
292 FOUNDINCLUDE=yes,
293 FOUNDINCLUDE=no)
294 if test "$FOUNDINCLUDE" = "no"; then
295 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
296 SSLINCLUDE="-I$OPENSSL/include"
297 FOUNDINCLUDE=yes,
298 FOUNDINCLUDE=no)
299 fi
300 AC_SUBST(SSLINCLUDE)
301 if test "$FOUNDINCLUDE" = "no"; then
302 CPPFLAGS="$_SAVEDCPPFLAGS"
303 fi
305 dnl Check for crypto lib
306 _SAVEDLIBS="$LIBS"
307 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
308 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
309 dnl Check for SSL lib
310 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)
311 fi
312 LIBS="$_SAVEDLIBS"
314 FOUNDSSL="no"
315 dnl test headers and libs to decide whether check_http should use SSL
316 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
317 if test "$ac_cv_lib_ssl_main" = "yes"; then
318 if test "$FOUNDINCLUDE" = "yes"; then
319 FOUNDSSL="yes"
320 fi
321 fi
322 fi
323 fi
325 if test "$FOUNDSSL" = "yes"; then
326 check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
327 AC_SUBST(check_tcp_ssl)
328 AC_SUBST(SSLLIBS)
329 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
330 with_openssl="yes"
331 elif test "$FOUNDSSL" = "no"; then
332 AC_MSG_WARN([OpenSSL libs could not be found])
333 with_openssl="no"
334 else
335 with_openssl="no"
336 fi
337 CPPFLAGS="$_SAVEDCPPFLAGS"
339 AC_CHECK_HEADERS(unistd.h)
341 dnl Check for AF_INET6 support - unistd.h required for Darwin
342 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
343 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
344 #include <unistd.h>
345 #endif
346 #include <netinet/in.h>
347 #include <sys/socket.h>],
348 [struct sockaddr_in6 sin6;
349 void *p;
351 sin6.sin6_family = AF_INET6;
352 sin6.sin6_port = 587;
353 p = &sin6.sin6_addr;],
354 [with_ipv6=yes],
355 [with_ipv6=no])
356 ])
358 if test x"$with_ipv6" != xno ; then
359 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
360 fi
362 dnl #########################################################################
363 dnl Check if Posix getaddrinfo() is available. It is also possible to use
364 dnl the version from the lwres library distributed with BIND.
365 dnl #########################################################################
366 AC_ARG_ENABLE([emulate-getaddrinfo],
367 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
368 [enable getaddrinfo emulation (default=no)]),
369 ,
370 enable_emulate_getaddrinfo=no)
372 AC_ARG_WITH(lwres,
373 ACX_HELP_STRING([--with-lwres=DIR],
374 [use lwres library for getaddrinfo (default=no)]),
375 ,
376 with_lwres=no)
378 dnl ## enable force to test getaddrinfo.c
379 if test x$enable_emulate_getaddrinfo = xforce ; then
380 enable_emulate_getaddrinfo=yes
381 have_getaddrinfo=no
382 else
384 have_getaddrinfo=no
385 if test x$with_lwres != xno ; then
386 if test "$with_lwres" != yes ; then
387 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
388 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
389 fi
390 AC_CHECK_HEADERS(lwres/netdb.h, ,
391 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
392 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
393 [AC_MSG_ERROR([cannot find the lwres library])],
394 -lnsl -lpthread)
395 have_getaddrinfo=yes
396 fi
398 if test x$have_getaddrinfo != xyes ; then
399 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
400 fi
402 dnl # Special nonsense for systems that actually have getaddrinfo but
403 dnl # redefine the name to something else, e.g. OSF
404 if test x$have_getaddrinfo != xyes ; then
405 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
406 AC_TRY_LINK([
407 # include <netdb.h>
408 ], [
409 struct addrinfo hints, *res;
410 int err;
412 err = getaddrinfo ("host", "service", &hints, &res);
413 ], [
414 have_getaddrinfo=yes
415 AC_MSG_RESULT(yes)
416 ], [AC_MSG_RESULT(no)])
417 fi
419 fi
421 if test x$have_getaddrinfo != xno ; then
422 if test x$enable_emulate_getaddrinfo != xno ; then
423 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
424 fi
425 AC_DEFINE(HAVE_GETADDRINFO, 1,
426 [Does system provide RFC 2553/Posix getaddrinfo?])
427 else
428 if test x$enable_emulate_getaddrinfo != xyes ; then
429 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
430 enable_emulate_getaddrinfo=yes
431 AC_MSG_WARN([enabling getaddrinfo emulation])
432 fi
433 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
434 fi
436 if test x"$enable_emulate_getaddrinfo" != xno ; then
437 have_resolver=no
439 dnl Try for getipnodebyname
440 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
441 if test x"$have_resolver" != xno ; then
442 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
443 [Set when getipnodebyname is available])
444 fi
446 dnl Try for gethostbyname_r
447 if test x"$have_resolver" = xno ; then
448 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
449 [have_resolver=yes
450 ACX_WHICH_GETHOSTBYNAME_R])
451 fi
453 dnl Try for gethostbyname
454 if test x"$have_resolver" = xno ; then
455 if test x"$enable_pthreads" != xno ; then
456 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
457 fi
458 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
459 [AC_MSG_ERROR([cannot find gethostbyname])])
460 fi
461 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
463 fi
465 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
466 if test "$FOUNDINCLUDE" = "no"; then
467 _SAVEDCPPFLAGS="$CPPFLAGS"
468 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
469 unset ac_cv_header_krb5_h
470 AC_CHECK_HEADERS(krb5.h,
471 KRB5INCLUDE="-I/usr/kerberos/include"
472 FOUNDINCLUDE=yes,
473 FOUNDINCLUDE=no)
474 fi
475 AC_SUBST(KRBINCLUDE)
476 if test "$FOUNDINCLUDE" = "no"; then
477 CPPFLAGS="$_SAVEDCPPFLAGS"
478 fi
480 dnl
481 dnl Checks for header files.
482 dnl
484 AC_HEADER_STDC
485 AC_HEADER_TIME
486 AC_HEADER_SYS_WAIT
487 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)
488 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
490 dnl Checks for typedefs, structures, and compiler characteristics.
491 AC_C_CONST
492 AC_STRUCT_TM
493 AC_TYPE_PID_T
494 AC_TYPE_SIZE_T
495 AC_TYPE_SIGNAL
497 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
498 AC_TRY_LINK([#include <stdarg.h>
499 va_list ap1,ap2;], [va_copy(ap1,ap2);],
500 ac_cv_HAVE_VA_COPY=yes,
501 ac_cv_HAVE_VA_COPY=no)])
502 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
503 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
504 else
505 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
506 AC_TRY_LINK([#include <stdarg.h>
507 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
508 ac_cv_HAVE___VA_COPY=yes,
509 ac_cv_HAVE___VA_COPY=no)])
510 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
511 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
512 fi
513 fi
515 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
516 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
517 AC_TRY_RUN([
518 #include <sys/types.h>
519 #include <stdarg.h>
520 void foo(const char *format, ...) {
521 va_list ap;
522 int len;
523 char buf[5];
525 va_start(ap, format);
526 len = vsnprintf(buf, 0, format, ap);
527 va_end(ap);
528 if (len != 5) exit(1);
530 va_start(ap, format);
531 len = vsnprintf(0, 0, format, ap);
532 va_end(ap);
533 if (len != 5) exit(1);
535 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
537 exit(0);
538 }
539 main() { foo("hello"); }
540 ],
541 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
542 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
543 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
544 fi
546 AC_TRY_COMPILE([#include <sys/time.h>],
547 [struct timeval *tv;
548 struct timezone *tz;],
549 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
550 AC_TRY_COMPILE([#include <sys/time.h>],
551 [struct timeval *tv;
552 struct timezone *tz;
553 gettimeofday(tv, tz);],
554 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
555 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
557 dnl Checks for library functions.
558 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
560 AC_MSG_CHECKING(return type of socket size)
561 AC_TRY_COMPILE([#include <stdlib.h>
562 #include <sys/types.h>
563 #include <sys/socket.h>],
564 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
565 ac_cv_socket_size_type=["size_t"]
566 AC_MSG_RESULT(size_t),
567 ac_cv_socket_size_type=["int"]
568 AC_MSG_RESULT(int))
570 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
571 [Define type of socket size])
573 if test -f "/proc/loadavg"
574 then
575 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
576 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
577 fi
579 dnl #### Process table test
581 AC_PATH_PROG(PATH_TO_PS,ps)
583 AC_MSG_CHECKING(for ps syntax)
584 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
585 dnl Should also work for FreeBSD 5.2.1 and 5.3
586 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
587 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
588 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
589 then
590 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
591 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
592 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
593 ac_cv_ps_cols=8
594 AC_MSG_RESULT([$ac_cv_ps_command])
596 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
597 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
598 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
599 then
600 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
601 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
602 ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
603 ac_cv_ps_cols=9
604 AC_MSG_RESULT([$ac_cv_ps_command])
606 dnl FreeBSD
607 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
608 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
609 then
610 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
611 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
612 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
613 ac_cv_ps_cols=8
614 AC_MSG_RESULT([$ac_cv_ps_command])
616 dnl BSD-like mode in RH 6.1
617 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
618 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
619 then
620 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
621 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
622 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
623 ac_cv_ps_cols=8
624 AC_MSG_RESULT([$ac_cv_ps_command])
626 dnl SunOS 4.1.3:
627 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
628 dnl Need the head -1 otherwise test will work because arguments are found
629 elif ps -laxnwww 2>/dev/null | head -1 | \
630 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
631 then
632 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
633 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
634 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
635 ac_cv_ps_cols=8
636 AC_MSG_RESULT([$ac_cv_ps_command])
638 dnl Debian Linux / procps v1.2.9:
639 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
640 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
641 dnl
642 elif ps laxnwww 2>/dev/null | \
643 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
644 then
645 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
646 ac_cv_ps_command="$PATH_TO_PS laxnwww"
647 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
648 ac_cv_ps_cols=8
649 AC_MSG_RESULT([$ac_cv_ps_command])
651 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
652 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
653 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
654 then
655 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
656 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
657 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
658 ac_cv_ps_cols=8
659 AC_MSG_RESULT([$ac_cv_ps_command])
661 dnl Tru64 - needs %*[ +] in PS_FORMAT
662 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
663 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
664 then
665 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
666 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
667 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
668 ac_cv_ps_cols=8
669 AC_MSG_RESULT([$ac_cv_ps_command])
671 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
672 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
673 then
674 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
675 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
676 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
677 ac_cv_ps_cols=8
678 AC_MSG_RESULT([$ac_cv_ps_command])
680 dnl AIX 4.3.3 and 5.1 do not have an rss field
681 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
682 egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
683 then
684 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
685 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
686 ac_cv_ps_format="%s %d %d %d %f %s %n"
687 ac_cv_ps_cols=7
688 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
690 dnl Solaris 2.6
691 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
692 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
693 then
694 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
695 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
696 # There must be no space between the %s and %n due to a wierd problem in sscanf where
697 # it will return %n as longer than the line length
698 ac_cv_ps_format="%s %d %d %d %d %f %s%n"
699 ac_cv_ps_cols=8
700 AC_MSG_RESULT([$ac_cv_ps_command])
702 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
703 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
704 then
705 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
706 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
707 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
708 ac_cv_ps_cols=8
709 AC_MSG_RESULT([$ac_cv_ps_command])
711 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
712 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
713 then
714 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
715 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
716 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
717 ac_cv_ps_cols=8
718 AC_MSG_RESULT([$ac_cv_ps_command])
720 dnl wonder who takes state instead of stat
721 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
722 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
723 then
724 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
725 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
726 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
727 ac_cv_ps_cols=7
728 AC_MSG_RESULT([$ac_cv_ps_command])
730 dnl IRIX 53
731 elif ps -el 2>/dev/null | \
732 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
733 then
734 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
735 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
736 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
737 ac_cv_ps_cols=7
738 AC_MSG_RESULT([$ac_cv_ps_command])
740 dnl IRIX 63
741 elif ps -el 2>/dev/null | \
742 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
743 then
744 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
745 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
746 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
747 ac_cv_ps_cols=5
748 AC_MSG_RESULT([$ac_cv_ps_command])
750 dnl AIX 4.1:
751 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
752 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
753 elif ps -el 2>/dev/null | \
754 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
755 then
756 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
757 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
758 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
759 ac_cv_ps_cols=5
760 AC_MSG_RESULT([$ac_cv_ps_command])
762 dnl AIX?
763 elif ps glaxen 2>/dev/null | \
764 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
765 then
766 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
767 ac_cv_ps_command="$PATH_TO_PS glaxen"
768 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
769 ac_cv_ps_cols=7
770 AC_MSG_RESULT([$ac_cv_ps_command])
772 dnl MacOSX / Darwin
773 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
774 dnl Some truncation will happen in UCOMM column
775 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
776 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
777 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
778 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
779 then
780 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
781 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
782 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
783 ac_cv_ps_cols=7
784 AC_MSG_RESULT([$ac_cv_ps_command])
786 dnl UnixWare
787 elif ps -Al 2>/dev/null | \
788 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
789 then
790 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
791 ac_cv_ps_command="$PATH_TO_PS -Al"
792 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
793 ac_cv_ps_cols=7
794 AC_MSG_RESULT([$ac_cv_ps_command])
796 else
797 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
798 fi
800 if test -n "$ac_cv_ps_varlist" ; then
801 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
802 [Variable list for sscanf of 'ps' output])
803 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
804 [Verbatim command to execute for ps in check_procs])
805 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
806 [Format string for scanning ps output in check_procs])
807 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
808 [Number of columns in ps command])
809 EXTRAS="$EXTRAS check_procs check_nagios"
810 fi
812 AC_PATH_PROG(PATH_TO_PING,ping)
813 AC_PATH_PROG(PATH_TO_PING6,ping6)
815 AC_ARG_WITH(ping_command,
816 ACX_HELP_STRING([--with-ping-command=SYNTAX],
817 [sets syntax for ICMP ping]),
818 with_ping_command=$withval,)
820 AC_MSG_CHECKING(for ICMP ping syntax)
821 ac_cv_ping_packets_first=no
822 ac_cv_ping_has_timeout=no
823 if test -n "$with_ping_command"
824 then
825 AC_MSG_RESULT([(command-line) $with_ping_command])
826 if test -n "$ac_cv_ping_packets_first"
827 then
828 ac_cv_ping_packets_first=yes
829 fi
831 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
832 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
833 egrep -i "^round-trip|^rtt" >/dev/null
834 then
835 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
836 ac_cv_ping_packets_first=yes
837 AC_MSG_RESULT([$with_ping_command])
839 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
840 egrep -i "^round-trip|^rtt" >/dev/null
841 then
842 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
843 ac_cv_ping_packets_first=yes
844 ac_cv_ping_has_timeout=yes
845 AC_MSG_RESULT([$with_ping_command])
847 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
848 egrep -i "^round-trip|^rtt" >/dev/null
849 then
850 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
851 ac_cv_ping_packets_first=yes
852 AC_MSG_RESULT([$with_ping_command])
854 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
855 egrep -i "^round-trip|^rtt" >/dev/null
856 then
857 with_ping_command="$PATH_TO_PING -n -c %d %s"
858 ac_cv_ping_packets_first=yes
859 AC_MSG_RESULT([$with_ping_command])
861 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
862 egrep -i "^round-trip|^rtt" >/dev/null
863 then
864 with_ping_command="$PATH_TO_PING -n %s -c %d"
865 AC_MSG_RESULT([$with_ping_command])
867 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
868 egrep -i "^round-trip|^rtt" >/dev/null
869 then
870 with_ping_command="$PATH_TO_PING %s -n %d"
871 AC_MSG_RESULT([$with_ping_command])
873 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
874 egrep -i "^round-trip|^rtt" >/dev/null
875 then
876 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
877 AC_MSG_RESULT([$with_ping_command])
879 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
880 egrep -i "^round-trip|^rtt" >/dev/null
881 then
882 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
883 AC_MSG_RESULT([$with_ping_command])
885 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
886 egrep -i "^round-trip|^rtt" >/dev/null
887 then
888 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
889 ac_cv_ping_packets_first=yes
890 AC_MSG_RESULT([$with_ping_command])
892 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
893 egrep -i "^round-trip|^rtt" >/dev/null
894 then
895 with_ping_command="$PATH_TO_PING -n -c %d %s"
896 ac_cv_ping_packets_first=yes
897 AC_MSG_RESULT([$with_ping_command])
899 else
900 AC_MSG_WARN([unable to find usable ping syntax])
901 fi
903 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
904 [path and args for ICMP ping command])
906 if test "x$ac_cv_ping_packets_first" != "xno"
907 then
908 AC_DEFINE(PING_PACKETS_FIRST,1,
909 [Define if packet count must precede host])
910 fi
912 if test "x$ac_cv_ping_has_timeout" != "xno"
913 then
914 AC_DEFINE(PING_HAS_TIMEOUT,1,
915 [Define if ping has its own timeout option that should be set])
916 fi
918 AC_ARG_WITH(ping6_command,
919 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
920 [sets syntax for ICMPv6 ping]),
921 with_ping6_command=$withval,)
923 if test x"$with_ipv6" != xno ; then
924 AC_MSG_CHECKING(for ICMPv6 ping syntax)
925 ac_cv_ping6_packets_first=no
926 if test -n "$with_ping6_command"
927 then
928 AC_MSG_RESULT([(command-line) $with_ping6_command])
929 if test -n "$ac_cv_ping6_packets_first"
930 then
931 ac_cv_ping6_packets_first=yes
932 fi
934 elif test "x$PATH_TO_PING6" != "x"; then
935 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
936 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
937 egrep -i "^round-trip|^rtt" >/dev/null
938 then
939 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
940 ac_cv_ping6_packets_first=yes
941 AC_MSG_RESULT([$with_ping6_command])
943 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
944 egrep -i "^round-trip|^rtt" >/dev/null
945 then
946 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
947 ac_cv_ping6_packets_first=yes
948 AC_MSG_RESULT([$with_ping6_command])
950 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
951 egrep -i "^round-trip|^rtt" >/dev/null
952 then
953 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
954 ac_cv_ping6_packets_first=yes
955 AC_MSG_RESULT([$with_ping6_command])
957 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
958 egrep -i "^round-trip|^rtt" >/dev/null
959 then
960 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
961 AC_MSG_RESULT([$with_ping6_command])
963 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
964 egrep -i "^round-trip|^rtt" >/dev/null
965 then
966 with_ping6_command="$PATH_TO_PING6 %s -n %d"
967 AC_MSG_RESULT([$with_ping6_command])
969 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
970 egrep -i "^round-trip|^rtt" >/dev/null
971 then
972 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
973 AC_MSG_RESULT([$with_ping6_command])
975 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
976 egrep -i "^round-trip|^rtt" >/dev/null
977 then
978 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
979 AC_MSG_RESULT([$with_ping6_command])
981 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
982 egrep -i "^round-trip|^rtt" >/dev/null
983 then
984 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
985 ac_cv_ping6_packets_first=yes
986 AC_MSG_RESULT([$with_ping_command])
988 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
989 egrep -i "^round-trip|^rtt" >/dev/null
990 then
991 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
992 ac_cv_ping6_packets_first=yes
993 AC_MSG_RESULT([$with_ping6_command])
995 fi
997 elif test "x$PATH_TO_PING" != "x"; then
998 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
999 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1000 egrep -i "^round-trip|^rtt" >/dev/null
1001 then
1002 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1003 ac_cv_ping6_packets_first=yes
1004 AC_MSG_RESULT([$with_ping6_command])
1006 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1007 egrep -i "^round-trip|^rtt" >/dev/null
1008 then
1009 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1010 ac_cv_ping6_packets_first=yes
1011 AC_MSG_RESULT([$with_ping6_command])
1013 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1014 egrep -i "^round-trip|^rtt" >/dev/null
1015 then
1016 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1017 ac_cv_ping6_packets_first=yes
1018 AC_MSG_RESULT([$with_ping6_command])
1020 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1021 egrep -i "^round-trip|^rtt" >/dev/null
1022 then
1023 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1024 AC_MSG_RESULT([$with_ping6_command])
1026 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1027 egrep -i "^round-trip|^rtt" >/dev/null
1028 then
1029 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1030 AC_MSG_RESULT([$with_ping6_command])
1032 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1033 egrep -i "^round-trip|^rtt" >/dev/null
1034 then
1035 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1036 AC_MSG_RESULT([$with_ping6_command])
1038 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1039 egrep -i "^round-trip|^rtt" >/dev/null
1040 then
1041 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1042 AC_MSG_RESULT([$with_ping6_command])
1044 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1045 egrep -i "^round-trip|^rtt" >/dev/null
1046 then
1047 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1048 ac_cv_ping6_packets_first=yes
1049 AC_MSG_RESULT([$with_ping_command])
1051 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1052 egrep -i "^round-trip|^rtt" >/dev/null
1053 then
1054 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1055 ac_cv_ping6_packets_first=yes
1056 AC_MSG_RESULT([$with_ping6_command])
1058 fi
1060 fi
1062 if test "x$with_ping6_command" != "x"; then
1063 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1064 [path and args for ICMPv6 ping command])
1065 else
1066 AC_MSG_RESULT([none])
1067 fi
1069 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1070 AC_DEFINE(PING6_PACKETS_FIRST,1,
1071 [Define if packet count must precede host])
1072 fi
1073 fi
1075 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1077 AC_MSG_CHECKING(for nslookup syntax)
1078 if test -n "$PATH_TO_NSLOOKUP"
1079 then
1080 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1081 then
1082 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1083 AC_MSG_RESULT([$ac_cv_nslookup_command])
1085 else
1086 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1087 AC_MSG_RESULT([$ac_cv_nslookup_command])
1089 fi
1090 EXTRAS="$EXTRAS check_dns"
1092 else
1093 AC_MSG_WARN([nslookup command not found])
1094 fi
1096 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1097 [path and args for nslookup])
1099 AC_PATH_PROG(PATH_TO_HOST,host)
1100 if test -n "$ac_cv_path_PATH_TO_HOST"
1101 then
1102 EXTRAS="$EXTRAS check_dns"
1103 fi
1105 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1106 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1108 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1109 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1111 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1112 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1113 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1114 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1115 then
1116 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1117 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1118 else
1119 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1120 fi
1122 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1123 if test -x "$PATH_TO_LMSTAT"
1124 then
1125 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1126 else
1127 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1128 fi
1130 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1131 if test -x "$PATH_TO_SMBCLIENT"
1132 then
1133 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1134 else
1135 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1136 fi
1139 AC_PATH_PROG(PATH_TO_WHO,who)
1141 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1142 then
1143 ac_cv_path_to_who="$PATH_TO_WHO -q"
1144 else
1145 ac_cv_path_to_who="$PATH_TO_WHO"
1146 fi
1148 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1149 [path and arguments for invoking 'who'])
1151 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1152 if test -x "$PATH_TO_SNMPGET"
1153 then
1154 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1155 EXTRAS="$EXTRAS check_hpjd check_snmp"
1156 else
1157 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1158 fi
1160 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1161 if test -x "$PATH_TO_SNMPGETNEXT"
1162 then
1163 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1164 fi
1166 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1167 then
1168 AC_MSG_CHECKING(for Net::SNMP perl module)
1169 AC_MSG_RESULT([found])
1170 else
1171 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1172 fi
1174 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1175 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1177 if test -x "$PATH_TO_QUAKESTAT"
1178 then
1179 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1180 EXTRAS="$EXTRAS check_game"
1182 elif test -x "$PATH_TO_QSTAT"
1183 then
1184 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1185 EXTRAS="$EXTRAS check_game"
1186 else
1187 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1188 fi
1190 if test $ac_cv_path_to_qstat
1191 then
1192 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1193 [path to qstat/quakestat])
1194 fi
1196 AC_PATH_PROG(PATH_TO_FPING,fping)
1197 if test -x "$PATH_TO_FPING"
1198 then
1199 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1200 EXTRAS="$EXTRAS check_fping"
1201 else
1202 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1203 fi
1205 AC_PATH_PROG(PATH_TO_SSH,ssh)
1207 if test -x "$PATH_TO_SSH"
1208 then
1209 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1210 EXTRAS="$EXTRAS check_by_ssh"
1211 else
1212 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1213 fi
1216 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1217 if test -x "$PATH_TO_MAILQ"
1218 then
1219 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1220 else
1221 AC_MSG_WARN([Could not find mailq or eqivalent])
1222 fi
1224 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1225 if test -x "$PATH_TO_QMAIL_QSTAT"
1226 then
1227 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1228 else
1229 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1230 fi
1232 dnl SWAP info required is amount allocated/available and amount free
1233 dnl The plugin works through all the swap devices and adds up the total swap
1234 dnl available.
1235 AC_PATH_PROG(PATH_TO_SWAP,swap)
1236 if (test -n "$PATH_TO_SWAP")
1237 then
1238 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1239 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1240 then
1241 ac_cv_have_swap=yes
1242 ac_cv_swap_command="$PATH_TO_SWAP -l"
1243 if [$PATH_TO_SWAP -l 2>/dev/null | \
1244 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1245 >/dev/null]
1246 then
1247 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1248 ac_cv_swap_conv=2048
1249 AC_MSG_RESULT([using IRIX format swap])
1251 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1252 then
1253 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1254 ac_cv_swap_conv=2048
1255 AC_MSG_RESULT([using Unixware format swap])
1256 else
1257 dnl if we don't know what format swap's output is
1258 dnl we might as well pretend we didn't see it
1259 ac_cv_have_swap=""
1260 ac_cv_swap_command=""
1261 fi
1262 fi
1263 dnl end if for PATH_TO_SWAP
1264 fi
1266 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1267 if (test -n "$PATH_TO_SWAPINFO")
1268 then
1269 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1270 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1271 then
1272 ac_cv_have_swap=yes
1273 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1275 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1276 then
1277 ac_cv_swap_format=["%*s %d %*d %d"]
1278 ac_cv_swap_conv=1024
1279 AC_MSG_RESULT([using FreeBSD format swapinfo])
1280 fi
1282 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1283 then
1284 ac_cv_have_swap=yes
1285 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1286 ac_cv_swap_format=["%*s %d %*d %d"]
1287 ac_cv_swap_conv=1024
1288 AC_MSG_RESULT([using HP-UX format swapinfo])
1289 fi
1290 dnl end if for PATH_TO_SWAPINFO
1291 fi
1293 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1294 if (test -n "$PATH_TO_LSPS")
1295 then
1296 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1297 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1298 then
1299 ac_cv_have_swap=yes
1300 ac_cv_swap_command="$PATH_TO_LSPS -a"
1301 ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
1302 ac_cv_swap_conv=1
1303 AC_MSG_RESULT([using AIX lsps])
1304 fi
1305 dnl end if for PATH_TO_SWAPINFO
1306 fi
1308 dnl
1309 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1310 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1311 dnl in the various BSD's
1312 dnl
1314 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1315 #ifdef HAVE_SYS_PARAM_H
1316 #include <sys/param.h>
1317 #endif
1318 ])
1319 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1320 AC_CHECK_DECLS([swapctl],,,[
1321 #include <unistd.h>
1322 #include <sys/types.h>
1323 #include <sys/param.h>
1324 #include <sys/stat.h>
1325 #include <sys/swap.h>
1326 ])
1327 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1328 #include <sys/types.h>
1329 #include <sys/param.h>
1330 #include <sys/stat.h>
1331 #include <sys/swap.h>
1332 ])
1333 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1334 #include <unistd.h>
1335 #include <sys/types.h>
1336 #include <sys/param.h>
1337 #include <sys/stat.h>
1338 #include <sys/swap.h>
1339 ])
1341 if test "$ac_cv_have_decl_swapctl" = "yes";
1342 then
1343 EXTRAS="$EXTRAS check_swap"
1344 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1345 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1346 "$ac_cv_type_swapent_t" = "yes";
1347 then
1348 AC_MSG_RESULT([yes])
1349 ac_cv_check_swap_swapctl_svr4="1";
1350 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1351 [Define if 2-argument SVR4 swapctl exists])
1352 else
1353 AC_MSG_RESULT([no])
1354 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1355 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1356 then
1357 AC_MSG_RESULT([yes])
1358 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1359 [Define if 3-argument BSD swapctl exists])
1360 else
1361 AC_MSG_RESULT([no])
1362 fi
1363 fi
1364 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1365 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1366 then
1367 dnl
1368 dnl the SVR4 spec returns values in pages
1369 dnl
1370 AC_MSG_RESULT([page])
1371 AC_CHECK_DECLS([sysconf])
1372 AC_MSG_CHECKING([for system page size])
1373 if test "$ac_cv_have_decl_sysconf" = "yes";
1374 then
1375 AC_MSG_RESULT([determined by sysconf(3)])
1376 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1377 else
1378 AC_MSG_WARN([don't know. guessing 4096k])
1379 ac_cv_swap_conv=256
1380 fi
1381 else
1382 dnl
1383 dnl the BSD spec returns values in blocks
1384 dnl
1385 AC_MSG_RESULT([blocks (assuming 512b)])
1386 ac_cv_swap_conv=2048
1387 fi
1388 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1389 [Conversion factor to MB])
1390 fi
1391 dnl
1392 dnl end tests for the swapctl system calls
1393 dnl
1396 if test "x$ac_cv_have_swap" != "x"
1397 then
1398 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1399 EXTRAS="$EXTRAS check_swap"
1400 fi
1401 if test "x$ac_cv_swap_command" != "x"
1402 then
1403 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1404 [Path to swap/swapinfo binary, with any args])
1405 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1406 [Format string for parsing swap output])
1407 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1408 [Conversion factor to MB])
1409 fi
1411 dnl dunno why this does not work below - use hack (kbd)
1412 dnl fine on linux, broken on solaris
1413 dnl if /bin/test -e "/proc/meminfo"
1414 AC_MSG_CHECKING([for /proc/meminfo])
1415 if [cat /proc/meminfo > /dev/null 2>&1]
1416 then
1417 AC_MSG_RESULT([found /proc/meminfo])
1418 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1419 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1420 EXTRAS="$EXTRAS check_swap"
1421 else
1422 AC_MSG_RESULT([no])
1423 fi
1425 AC_PATH_PROG(PATH_TO_DIG,dig)
1426 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1427 if test -n "$PATH_TO_DIG"; then
1428 EXTRAS="$EXTRAS check_dig"
1429 fi
1431 if test -f plugins/check_nt.c ; then
1432 EXTRAS="$EXTRAS check_nt"
1433 elif test -f ../plugins/check_nt.c ; then
1434 EXTRAS="$EXTRAS check_nt"
1435 fi
1437 AC_MSG_CHECKING(for va_list)
1438 AC_TRY_COMPILE([#ifdef __STDC__
1439 #include <stdio.h>
1440 #include <stdlib.h>
1441 #include <stdarg.h>
1442 #else
1443 #include <sys/types.h>
1444 #include <stdio.h>
1445 #include <varargs.h>
1446 #endif],
1447 [va_list args;],
1448 [AC_MSG_RESULT(yes)],
1449 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1451 AC_SUBST(EXTRAS)
1452 AC_SUBST(EXTRA_NETOBJS)
1453 AC_SUBST(DEPLIBS)
1455 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1456 AM_GNU_GETTEXT_VERSION(0.11.5)
1458 dnl External libraries
1459 np_COREUTILS
1461 AC_OUTPUT(
1462 Makefile
1463 lib/Makefile
1464 m4/Makefile
1465 plugins/Makefile
1466 plugins-scripts/Makefile
1467 plugins-scripts/subst
1468 plugins-scripts/utils.pm
1469 plugins-scripts/utils.sh
1470 command.cfg
1471 test.pl
1472 pkg/solaris/pkginfo
1473 intl/Makefile
1474 po/Makefile.in
1475 )
1477 ACX_FEATURE([with],[cgiurl])
1478 ACX_FEATURE([with],[nagios-user])
1479 ACX_FEATURE([with],[nagios-group])
1480 ACX_FEATURE([with],[trusted-path])
1481 ACX_FEATURE([with],[ping-command])
1482 ACX_FEATURE([with],[ping6-command])
1483 ACX_FEATURE([with],[lwres])
1484 ACX_FEATURE([with],[ipv6])
1485 ACX_FEATURE([with],[openssl])
1486 ACX_FEATURE([enable],[emulate-getaddrinfo])