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