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