1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.58)
4 AC_INIT(nagios-plugins,1.4.0-alpha3)
5 AC_CONFIG_SRCDIR(Helper.pm)
6 AM_INIT_AUTOMAKE
7 AM_CONFIG_HEADER(config.h)
8 AC_CANONICAL_HOST
10 RELEASE=1
11 AC_SUBST(RELEASE)
13 AC_PREFIX_DEFAULT(/usr/local/nagios)
15 dnl Figure out how to invoke "install" and what install options to use.
16 AC_PROG_INSTALL
17 AC_SUBST(INSTALL)
19 dnl Must come very early on due to coreutils requirement
20 dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
21 gl_USE_SYSTEM_EXTENSIONS
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_RANLIB
28 AC_PROG_MAKE_SET
29 AC_PROG_AWK
31 AC_FUNC_MALLOC
32 AC_FUNC_REALLOC
33 AC_FUNC_ERROR_AT_LINE
35 AC_CONFIG_LIBOBJ_DIR(lib)
36 AC_FUNC_GETLOADAVG([lib])
38 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
39 dnl AM_WITH_REGEX
41 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
42 AC_SUBST(PLUGIN_TEST)dnl
44 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
45 AC_SUBST(SCRIPT_TEST)dnl
47 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
48 AC_SUBST(WARRANTY)
50 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
51 AC_SUBST(SUPPORT)
53 dnl CGIURL has changed for Nagios with 1.0 beta
54 AC_ARG_WITH(cgiurl,
55 ACX_HELP_STRING([--with-cgiurl=DIR],
56 [sets URL for cgi programs]),
57 with_cgiurl=$withval,
58 with_cgiurl=/nagios/cgi-bin)
59 CGIURL="$with_cgiurl"
60 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
62 AC_ARG_WITH(nagios_user,
63 ACX_HELP_STRING([--with-nagios-user=USER],
64 [set user name to run nagios]),
65 with_nagios_user=$withval,
66 with_nagios_user=nagios)
67 AC_ARG_WITH(nagios_group,
68 ACX_HELP_STRING([--with-nagios-group=GROUP],
69 [set group name to run nagios]),
70 with_nagios_group=$withval,
71 with_nagios_group=nagios)
72 AC_SUBST(with_nagios_user)
73 AC_SUBST(with_nagios_group)
74 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
75 AC_SUBST(INSTALL_OPTS)
77 AC_ARG_WITH(trusted_path,
78 ACX_HELP_STRING([--with-trusted-path=PATH],
79 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
80 with_trusted_path=$withval,
81 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
82 AC_SUBST(with_trusted_path)
84 EXTRAS=
85 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
87 LDFLAGS="$LDFLAGS -L."
89 ac_cv_uname_m=`uname -m`
90 ac_cv_uname_s=`uname -s`
91 ac_cv_uname_r=`uname -r`
92 ac_cv_uname_v=`uname -v`
94 PKG_ARCH=`uname -p`
95 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
96 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
98 AC_SUBST(PKG_ARCH)
99 AC_SUBST(REV_DATESTAMP)
100 AC_SUBST(REV_TIMESTAMP)
102 dnl Checks for programs.
103 AC_PATH_PROG(PYTHON,python)
104 AC_PATH_PROG(PERL,perl)
105 AC_PATH_PROG(SH,sh)
107 AC_PATH_PROG(HOSTNAME,hostname)
108 AC_PATH_PROG(BASENAME,basename)
110 dnl
111 dnl Check for miscellaneous stuff
112 dnl
114 case $host_vender-$host_os in
115 sun*)
116 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
117 ;;
118 osf*)
119 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
120 ;;
121 esac
123 dnl
124 dnl Checks for libraries.
125 dnl
127 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
128 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
129 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
130 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
131 AC_SUBST(SOCKETLIBS)
133 dnl Check for PostgreSQL libraries
134 _SAVEDLIBS="$LIBS"
135 _SAVEDCPPFLAGS="$CPPFLAGS"
136 AC_ARG_WITH(pgsql,
137 ACX_HELP_STRING([--with-pgsql=DIR],
138 [sets path to pgsql installation]),
139 PGSQL=$withval,)
140 AC_CHECK_LIB(crypt,main)
141 if test "$ac_cv_lib_crypt_main" = "yes"; then
142 if test -n "$PGSQL"; then
143 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
144 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
145 fi
146 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
147 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
148 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
149 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
150 AC_CHECK_HEADERS(libpq-fe.h)
151 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
152 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
153 PGINCLUDE="-I$PGSQL/include"
154 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
155 PGLIBS="-lpq -lcrypt"
156 PGINCLUDE="-I/usr/include/pgsql"
157 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
158 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
159 PGINCLUDE="-I/usr/include/postgresql"
160 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
161 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
162 PGINCLUDE="-I$PGSQL/include"
163 fi
164 if test -z "$PGINCLUDE"; then
165 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
166 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
167 else
168 AC_SUBST(PGLIBS)
169 AC_SUBST(PGINCLUDE)
170 EXTRAS="$EXTRAS check_pgsql"
171 fi
172 else
173 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
174 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
175 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
176 fi
177 else
178 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
179 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
180 fi
181 LIBS="$_SAVEDLIBS"
182 CPPFLAGS="$_SAVEDCPPFLAGS"
184 dnl Check for radius libraries
185 _SAVEDLIBS="$LIBS"
186 AC_CHECK_LIB(radiusclient,rc_read_config)
187 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
188 EXTRAS="$EXTRAS check_radius"
189 RADIUSLIBS="-lradiusclient"
190 AC_SUBST(RADIUSLIBS)
191 else
192 AC_MSG_WARN([Skipping radius plugin])
193 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
194 fi
195 LIBS="$_SAVEDLIBS"
197 dnl Check for LDAP libraries
198 _SAVEDLIBS="$LIBS"
199 AC_CHECK_LIB(ldap,main,,,-llber)
200 if test "$ac_cv_lib_ldap_main" = "yes"; then
201 LDAPLIBS="-lldap -llber"\
202 LDAPINCLUDE="-I/usr/include/ldap"
203 AC_SUBST(LDAPLIBS)
204 AC_SUBST(LDAPINCLUDE)
205 AC_CHECK_FUNCS(ldap_set_option)
206 EXTRAS="$EXTRAS check_ldap"
207 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
208 else
209 AC_MSG_WARN([Skipping LDAP plugin])
210 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
211 fi
212 LIBS="$_SAVEDLIBS"
215 dnl Check for mysql libraries
216 _SAVEDLIBS="$LIBS"
217 _SAVEDCPPFLAGS="$CPPFLAGS"
218 AC_ARG_WITH(mysql,
219 ACX_HELP_STRING([--with-mysql=DIR],
220 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
221 MYSQL=$withval,)
222 if test -n "$MYSQL"; then
223 MYSQLLIBDIR=$MYSQL/lib/mysql
224 CPPFLAGS="-I$MYSQL/include"
225 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
226 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
227 elif test -f /usr/lib/libmysqlclient.so; then
228 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
229 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
230 elif test -f /usr/lib/libmysqlclient.a; then
231 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
232 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
233 elif test -f /usr/lib/mysql/libmysqlclient.so; then
234 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
235 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
236 elif test -f /usr/lib/mysql/libmysqlclient.a; then
237 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
238 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
239 fi
240 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
241 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
242 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
243 EXTRAS="$EXTRAS check_mysql"
244 AC_SUBST(MYSQLINCLUDE)
245 AC_SUBST(MYSQLLIBS)
246 AC_SUBST(check_mysql_LDFLAGS)
247 else
248 AC_MSG_WARN([Skipping mysql plugin])
249 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
250 fi
251 else
252 AC_MSG_WARN([Skipping mysql plugin])
253 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
254 fi
255 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
256 LIBS="$_SAVEDLIBS"
258 dnl Check for OpenSSL location
259 dnl This whole check is inspired by curl 7.12.2's configure.ac
260 OPT_OPENSSL=off
261 AC_ARG_WITH(openssl,
262 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
263 AC_HELP_STRING([--without-openssl], [disable openssl]),
264 OPT_OPENSSL=$withval)
266 if test X"$OPT_OPENSSL" = "Xno"; then
267 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
268 with_openssl=no
269 else
270 dnl backup the pre-ssl variables
271 CLEANLDFLAGS="$LDFLAGS"
272 CLEANCPPFLAGS="$CPPFLAGS"
273 CLEANLIBS="$LIBS"
275 case "$OPT_OPENSSL" in
276 yes)
277 dnl --with-openssl (without path) used
278 PKGTEST="yes"
279 ;;
280 off)
281 dnl no --with-openssl given, check default places
282 PKGTEST="yes"
283 ;;
284 *)
285 dnl use the given area
286 PKGTEST="no"
287 OPENSSL=$OPT_OPENSSL
288 LDFLAGS="$LDFLAGS -L$OPENSSL/lib"
289 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
290 ;;
291 esac
293 dnl Check usual areas for openssl
294 if test "$PKGTEST" = "yes"; then
295 AC_PATH_PROG(OPENSSL,openssl)
296 # Don't think 2 tests below are necessary because /usr is always included
297 # if test "$OPENSSL" = "/usr/bin/openssl"; then
298 # OPENSSL=/usr
299 #elif test "$OPENSSL" = "/usr/sbin/openssl"; then
300 # OPENSSL=/usr
301 if test "$OPENSSL" = "/opt/bin/openssl"; then
302 OPENSSL=/opt
303 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
304 OPENSSL=/opt/openssl
305 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
306 OPENSSL=/usr/slocal
307 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
308 OPENSSL=/usr/local
309 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
310 OPENSSL=/usr/local/ssl
311 fi
312 fi
314 AC_CHECK_LIB(crypto, CRYPTO_lock,[
315 HAVECRYPTO="yes"
316 ],[
317 LDFLAGS="$CLEANLDFLAGS -L$OPENSSL/lib"
318 CPPFLAGS="$CLEANCPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
319 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
320 HAVECRYPTO="yes" ], [
321 LDFLAGS="$CLEANLDFLAGS"
322 CPPFLAGS="$CLEANCPPFLAGS"
323 LIBS="$CLEANLIBS"
324 ])
325 ])
327 if test "$HAVECRYPTO" = "yes"; then
328 dnl This is only reasonable to do if crypto actually is there: check for
329 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
331 dnl This is for Msys/Mingw
332 AC_MSG_CHECKING([for gdi32])
333 my_ac_save_LIBS=$LIBS
334 LIBS="-lgdi32 $LIBS"
335 AC_TRY_LINK([#include <windef.h>
336 #include <wingdi.h>],
337 [GdiFlush();],
338 [ dnl worked!
339 AC_MSG_RESULT([yes])],
340 [ dnl failed, restore LIBS
341 LIBS=$my_ac_save_LIBS
342 AC_MSG_RESULT(no)]
343 )
345 AC_CHECK_LIB(crypto, CRYPTO_add_lock)
346 AC_CHECK_LIB(ssl, SSL_connect)
348 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
349 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
350 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
351 OLIBS=$LIBS
352 LIBS="$LIBS -lRSAglue -lrsaref"
353 AC_CHECK_LIB(ssl, SSL_connect)
354 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
355 dnl still no SSL_connect
356 AC_MSG_RESULT(no)
357 LIBS=$OLIBS
358 else
359 AC_MSG_RESULT(yes)
360 fi
361 fi
364 dnl Check for SSLeay headers
365 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
366 openssl/pem.h openssl/ssl.h openssl/err.h,
367 OPENSSL_ENABLED=1)
369 if test $ac_cv_header_openssl_x509_h = no; then
370 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
371 OPENSSL_ENABLED=1)
372 fi
374 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
375 dnl header, it is kind of "separated" from the main SSL check
376 AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
378 dnl AC_SUBST(OPENSSL_ENABLED)
380 dnl these can only exist if openssl exists
381 AC_CHECK_FUNCS( RAND_status \
382 RAND_screen \
383 RAND_egd \
384 CRYPTO_cleanup_all_ex_data )
386 fi
388 if test "$OPENSSL_ENABLED" != "1"; then
389 AC_MSG_WARN([OpenSSL libs and/or directories were not found where specified!])
390 with_openssl="no"
391 else
392 check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
393 AC_SUBST(check_tcp_ssl)
394 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
395 with_openssl="yes"
397 # Needed for subsequent compiled programs
398 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSSL/lib$libsuff"
399 export LD_LIBRARY_PATH
400 fi
401 fi
403 AC_CHECK_HEADERS(unistd.h)
405 dnl Check for AF_INET6 support - unistd.h required for Darwin
406 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
407 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
408 #include <unistd.h>
409 #endif
410 #include <netinet/in.h>
411 #include <sys/socket.h>],
412 [struct sockaddr_in6 sin6;
413 void *p;
415 sin6.sin6_family = AF_INET6;
416 sin6.sin6_port = 587;
417 p = &sin6.sin6_addr;],
418 [with_ipv6=yes],
419 [with_ipv6=no])
420 ])
422 if test x"$with_ipv6" != xno ; then
423 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
424 fi
426 dnl #########################################################################
427 dnl Check if Posix getaddrinfo() is available. It is also possible to use
428 dnl the version from the lwres library distributed with BIND.
429 dnl #########################################################################
430 AC_ARG_ENABLE([emulate-getaddrinfo],
431 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
432 [enable getaddrinfo emulation (default=no)]),
433 ,
434 enable_emulate_getaddrinfo=no)
436 AC_ARG_WITH(lwres,
437 ACX_HELP_STRING([--with-lwres=DIR],
438 [use lwres library for getaddrinfo (default=no)]),
439 ,
440 with_lwres=no)
442 dnl ## enable force to test getaddrinfo.c
443 if test x$enable_emulate_getaddrinfo = xforce ; then
444 enable_emulate_getaddrinfo=yes
445 have_getaddrinfo=no
446 else
448 have_getaddrinfo=no
449 if test x$with_lwres != xno ; then
450 if test "$with_lwres" != yes ; then
451 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
452 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
453 fi
454 AC_CHECK_HEADERS(lwres/netdb.h, ,
455 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
456 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
457 [AC_MSG_ERROR([cannot find the lwres library])],
458 -lnsl -lpthread)
459 have_getaddrinfo=yes
460 fi
462 if test x$have_getaddrinfo != xyes ; then
463 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
464 fi
466 dnl # Special nonsense for systems that actually have getaddrinfo but
467 dnl # redefine the name to something else, e.g. OSF
468 if test x$have_getaddrinfo != xyes ; then
469 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
470 AC_TRY_LINK([
471 # include <netdb.h>
472 ], [
473 struct addrinfo hints, *res;
474 int err;
476 err = getaddrinfo ("host", "service", &hints, &res);
477 ], [
478 have_getaddrinfo=yes
479 AC_MSG_RESULT(yes)
480 ], [AC_MSG_RESULT(no)])
481 fi
483 fi
485 if test x$have_getaddrinfo != xno ; then
486 if test x$enable_emulate_getaddrinfo != xno ; then
487 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
488 fi
489 AC_DEFINE(HAVE_GETADDRINFO, 1,
490 [Does system provide RFC 2553/Posix getaddrinfo?])
491 else
492 if test x$enable_emulate_getaddrinfo != xyes ; then
493 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
494 enable_emulate_getaddrinfo=yes
495 AC_MSG_WARN([enabling getaddrinfo emulation])
496 fi
497 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
498 fi
500 if test x"$enable_emulate_getaddrinfo" != xno ; then
501 have_resolver=no
503 dnl Try for getipnodebyname
504 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
505 if test x"$have_resolver" != xno ; then
506 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
507 [Set when getipnodebyname is available])
508 fi
510 dnl Try for gethostbyname_r
511 if test x"$have_resolver" = xno ; then
512 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
513 [have_resolver=yes
514 ACX_WHICH_GETHOSTBYNAME_R])
515 fi
517 dnl Try for gethostbyname
518 if test x"$have_resolver" = xno ; then
519 if test x"$enable_pthreads" != xno ; then
520 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
521 fi
522 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
523 [AC_MSG_ERROR([cannot find gethostbyname])])
524 fi
525 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
527 fi
529 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
530 if test "$FOUNDINCLUDE" = "no"; then
531 _SAVEDCPPFLAGS="$CPPFLAGS"
532 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
533 unset ac_cv_header_krb5_h
534 AC_CHECK_HEADERS(krb5.h,
535 KRB5INCLUDE="-I/usr/kerberos/include"
536 FOUNDINCLUDE=yes,
537 FOUNDINCLUDE=no)
538 fi
539 AC_SUBST(KRBINCLUDE)
540 if test "$FOUNDINCLUDE" = "no"; then
541 CPPFLAGS="$_SAVEDCPPFLAGS"
542 fi
544 dnl
545 dnl Checks for header files.
546 dnl
548 AC_HEADER_STDC
549 AC_HEADER_TIME
550 AC_HEADER_SYS_WAIT
551 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)
552 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
554 dnl Checks for typedefs, structures, and compiler characteristics.
555 AC_C_CONST
556 AC_STRUCT_TM
557 AC_TYPE_PID_T
558 AC_TYPE_SIZE_T
559 AC_TYPE_SIGNAL
561 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
562 AC_TRY_LINK([#include <stdarg.h>
563 va_list ap1,ap2;], [va_copy(ap1,ap2);],
564 ac_cv_HAVE_VA_COPY=yes,
565 ac_cv_HAVE_VA_COPY=no)])
566 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
567 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
568 else
569 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
570 AC_TRY_LINK([#include <stdarg.h>
571 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
572 ac_cv_HAVE___VA_COPY=yes,
573 ac_cv_HAVE___VA_COPY=no)])
574 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
575 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
576 fi
577 fi
579 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
580 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
581 AC_TRY_RUN([
582 #include <sys/types.h>
583 #include <stdarg.h>
584 void foo(const char *format, ...) {
585 va_list ap;
586 int len;
587 char buf[5];
589 va_start(ap, format);
590 len = vsnprintf(buf, 0, format, ap);
591 va_end(ap);
592 if (len != 5) exit(1);
594 va_start(ap, format);
595 len = vsnprintf(0, 0, format, ap);
596 va_end(ap);
597 if (len != 5) exit(1);
599 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
601 exit(0);
602 }
603 main() { foo("hello"); }
604 ],
605 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
606 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
607 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
608 fi
610 AC_TRY_COMPILE([#include <sys/time.h>],
611 [struct timeval *tv;
612 struct timezone *tz;],
613 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
614 AC_TRY_COMPILE([#include <sys/time.h>],
615 [struct timeval *tv;
616 struct timezone *tz;
617 gettimeofday(tv, tz);],
618 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
619 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
621 dnl Checks for library functions.
622 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
624 AC_MSG_CHECKING(return type of socket size)
625 AC_TRY_COMPILE([#include <stdlib.h>
626 #include <sys/types.h>
627 #include <sys/socket.h>],
628 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
629 ac_cv_socket_size_type=["size_t"]
630 AC_MSG_RESULT(size_t),
631 ac_cv_socket_size_type=["int"]
632 AC_MSG_RESULT(int))
634 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
635 [Define type of socket size])
637 if test -f "/proc/loadavg"
638 then
639 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
640 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
641 fi
643 dnl #### Process table test
645 AC_PATH_PROG(PATH_TO_PS,ps)
647 AC_MSG_CHECKING(for ps syntax)
648 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
649 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
650 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
651 egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
652 then
653 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
654 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
655 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
656 ac_cv_ps_cols=8
657 AC_MSG_RESULT([$ac_cv_ps_command])
659 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
660 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
661 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
662 then
663 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
664 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
665 ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
666 ac_cv_ps_cols=9
667 AC_MSG_RESULT([$ac_cv_ps_command])
669 dnl FreeBSD
670 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
671 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
672 then
673 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
674 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
675 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
676 ac_cv_ps_cols=8
677 AC_MSG_RESULT([$ac_cv_ps_command])
679 dnl BSD-like mode in RH 6.1
680 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
681 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
682 then
683 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
684 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
685 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
686 ac_cv_ps_cols=8
687 AC_MSG_RESULT([$ac_cv_ps_command])
689 dnl SunOS 4.1.3:
690 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
691 dnl Need the head -1 otherwise test will work because arguments are found
692 elif ps -laxnwww 2>/dev/null | head -1 | \
693 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
694 then
695 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
696 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
697 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
698 ac_cv_ps_cols=8
699 AC_MSG_RESULT([$ac_cv_ps_command])
701 dnl Debian Linux / procps v1.2.9:
702 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
703 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
704 dnl
705 elif ps laxnwww 2>/dev/null | \
706 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
707 then
708 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
709 ac_cv_ps_command="$PATH_TO_PS laxnwww"
710 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
711 ac_cv_ps_cols=8
712 AC_MSG_RESULT([$ac_cv_ps_command])
714 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
715 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
716 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[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 -axo 'stat uid ppid vsz rss pcpu comm args'"
720 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
721 ac_cv_ps_cols=8
722 AC_MSG_RESULT([$ac_cv_ps_command])
724 dnl Tru64 - needs %*[ +] in PS_FORMAT
725 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
726 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
727 then
728 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
729 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
730 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
731 ac_cv_ps_cols=8
732 AC_MSG_RESULT([$ac_cv_ps_command])
734 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
735 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
736 then
737 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
738 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
739 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
740 ac_cv_ps_cols=8
741 AC_MSG_RESULT([$ac_cv_ps_command])
743 dnl AIX 4.3.3 and 5.1 do not have an rss field
744 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
745 egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
746 then
747 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
748 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
749 ac_cv_ps_format="%s %d %d %d %f %s %n"
750 ac_cv_ps_cols=7
751 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
753 dnl Solaris 2.6
754 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
755 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
756 then
757 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
758 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
759 # There must be no space between the %s and %n due to a wierd problem in sscanf where
760 # it will return %n as longer than the line length
761 ac_cv_ps_format="%s %d %d %d %d %f %s%n"
762 ac_cv_ps_cols=8
763 AC_MSG_RESULT([$ac_cv_ps_command])
765 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
766 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
767 then
768 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
769 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
770 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
771 ac_cv_ps_cols=8
772 AC_MSG_RESULT([$ac_cv_ps_command])
774 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
775 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
776 then
777 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
778 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
779 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
780 ac_cv_ps_cols=8
781 AC_MSG_RESULT([$ac_cv_ps_command])
783 dnl wonder who takes state instead of stat
784 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
785 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
786 then
787 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
788 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
789 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
790 ac_cv_ps_cols=7
791 AC_MSG_RESULT([$ac_cv_ps_command])
793 dnl IRIX 53
794 elif ps -el 2>/dev/null | \
795 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
796 then
797 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
798 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
799 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
800 ac_cv_ps_cols=7
801 AC_MSG_RESULT([$ac_cv_ps_command])
803 dnl IRIX 63
804 elif ps -el 2>/dev/null | \
805 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
806 then
807 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
808 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
809 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
810 ac_cv_ps_cols=5
811 AC_MSG_RESULT([$ac_cv_ps_command])
813 dnl AIX 4.1:
814 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
815 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
816 elif ps -el 2>/dev/null | \
817 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
818 then
819 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
820 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
821 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
822 ac_cv_ps_cols=5
823 AC_MSG_RESULT([$ac_cv_ps_command])
825 dnl AIX?
826 elif ps glaxen 2>/dev/null | \
827 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
828 then
829 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
830 ac_cv_ps_command="$PATH_TO_PS glaxen"
831 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
832 ac_cv_ps_cols=7
833 AC_MSG_RESULT([$ac_cv_ps_command])
835 dnl MacOSX / Darwin
836 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
837 dnl Some truncation will happen in UCOMM column
838 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
839 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
840 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
841 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
842 then
843 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
844 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
845 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
846 ac_cv_ps_cols=7
847 AC_MSG_RESULT([$ac_cv_ps_command])
849 dnl UnixWare
850 elif ps -Al 2>/dev/null | \
851 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
852 then
853 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
854 ac_cv_ps_command="$PATH_TO_PS -Al"
855 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
856 ac_cv_ps_cols=7
857 AC_MSG_RESULT([$ac_cv_ps_command])
859 else
860 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
861 fi
863 if test -n "$ac_cv_ps_varlist" ; then
864 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
865 [Variable list for sscanf of 'ps' output])
866 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
867 [Verbatim command to execute for ps in check_procs])
868 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
869 [Format string for scanning ps output in check_procs])
870 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
871 [Number of columns in ps command])
872 EXTRAS="$EXTRAS check_procs check_nagios"
873 fi
875 AC_PATH_PROG(PATH_TO_PING,ping)
876 AC_PATH_PROG(PATH_TO_PING6,ping6)
878 AC_ARG_WITH(ping_command,
879 ACX_HELP_STRING([--with-ping-command=SYNTAX],
880 [sets syntax for ICMP ping]),
881 with_ping_command=$withval,)
883 AC_MSG_CHECKING(for ICMP ping syntax)
884 ac_cv_ping_packets_first=no
885 ac_cv_ping_has_timeout=no
886 if test -n "$with_ping_command"
887 then
888 AC_MSG_RESULT([(command-line) $with_ping_command])
889 if test -n "$ac_cv_ping_packets_first"
890 then
891 ac_cv_ping_packets_first=yes
892 fi
894 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
895 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
896 egrep -i "^round-trip|^rtt" >/dev/null
897 then
898 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
899 ac_cv_ping_packets_first=yes
900 AC_MSG_RESULT([$with_ping_command])
902 elif $PATH_TO_PING -n -U -w 10 -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 -U -w %d -c %d %s"
906 ac_cv_ping_packets_first=yes
907 ac_cv_ping_has_timeout=yes
908 AC_MSG_RESULT([$with_ping_command])
910 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
911 egrep -i "^round-trip|^rtt" >/dev/null
912 then
913 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
914 ac_cv_ping_packets_first=yes
915 AC_MSG_RESULT([$with_ping_command])
917 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
918 egrep -i "^round-trip|^rtt" >/dev/null
919 then
920 with_ping_command="$PATH_TO_PING -n -c %d %s"
921 ac_cv_ping_packets_first=yes
922 AC_MSG_RESULT([$with_ping_command])
924 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
925 egrep -i "^round-trip|^rtt" >/dev/null
926 then
927 with_ping_command="$PATH_TO_PING -n %s -c %d"
928 AC_MSG_RESULT([$with_ping_command])
930 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
931 egrep -i "^round-trip|^rtt" >/dev/null
932 then
933 with_ping_command="$PATH_TO_PING %s -n %d"
934 AC_MSG_RESULT([$with_ping_command])
936 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
937 egrep -i "^round-trip|^rtt" >/dev/null
938 then
939 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
940 AC_MSG_RESULT([$with_ping_command])
942 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
943 egrep -i "^round-trip|^rtt" >/dev/null
944 then
945 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
946 AC_MSG_RESULT([$with_ping_command])
948 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
949 egrep -i "^round-trip|^rtt" >/dev/null
950 then
951 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
952 ac_cv_ping_packets_first=yes
953 AC_MSG_RESULT([$with_ping_command])
955 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
956 egrep -i "^round-trip|^rtt" >/dev/null
957 then
958 with_ping_command="$PATH_TO_PING -n -c %d %s"
959 ac_cv_ping_packets_first=yes
960 AC_MSG_RESULT([$with_ping_command])
962 else
963 AC_MSG_WARN([unable to find usable ping syntax])
964 fi
966 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
967 [path and args for ICMP ping command])
969 if test "x$ac_cv_ping_packets_first" != "xno"
970 then
971 AC_DEFINE(PING_PACKETS_FIRST,1,
972 [Define if packet count must precede host])
973 fi
975 if test "x$ac_cv_ping_has_timeout" != "xno"
976 then
977 AC_DEFINE(PING_HAS_TIMEOUT,1,
978 [Define if ping has its own timeout option that should be set])
979 fi
981 AC_ARG_WITH(ping6_command,
982 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
983 [sets syntax for ICMPv6 ping]),
984 with_ping6_command=$withval,)
986 if test x"$with_ipv6" != xno ; then
987 AC_MSG_CHECKING(for ICMPv6 ping syntax)
988 ac_cv_ping6_packets_first=no
989 if test -n "$with_ping6_command"
990 then
991 AC_MSG_RESULT([(command-line) $with_ping6_command])
992 if test -n "$ac_cv_ping6_packets_first"
993 then
994 ac_cv_ping6_packets_first=yes
995 fi
997 elif test "x$PATH_TO_PING6" != "x"; then
998 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
999 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1000 egrep -i "^round-trip|^rtt" >/dev/null
1001 then
1002 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1003 ac_cv_ping6_packets_first=yes
1004 AC_MSG_RESULT([$with_ping6_command])
1006 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1007 egrep -i "^round-trip|^rtt" >/dev/null
1008 then
1009 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1010 ac_cv_ping6_packets_first=yes
1011 AC_MSG_RESULT([$with_ping6_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 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1021 egrep -i "^round-trip|^rtt" >/dev/null
1022 then
1023 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1024 AC_MSG_RESULT([$with_ping6_command])
1026 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1027 egrep -i "^round-trip|^rtt" >/dev/null
1028 then
1029 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1030 AC_MSG_RESULT([$with_ping6_command])
1032 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1033 egrep -i "^round-trip|^rtt" >/dev/null
1034 then
1035 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1036 AC_MSG_RESULT([$with_ping6_command])
1038 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1039 egrep -i "^round-trip|^rtt" >/dev/null
1040 then
1041 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1042 AC_MSG_RESULT([$with_ping6_command])
1044 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1045 egrep -i "^round-trip|^rtt" >/dev/null
1046 then
1047 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1048 ac_cv_ping6_packets_first=yes
1049 AC_MSG_RESULT([$with_ping_command])
1051 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1052 egrep -i "^round-trip|^rtt" >/dev/null
1053 then
1054 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1055 ac_cv_ping6_packets_first=yes
1056 AC_MSG_RESULT([$with_ping6_command])
1058 fi
1060 elif test "x$PATH_TO_PING" != "x"; then
1061 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1062 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1063 egrep -i "^round-trip|^rtt" >/dev/null
1064 then
1065 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1066 ac_cv_ping6_packets_first=yes
1067 AC_MSG_RESULT([$with_ping6_command])
1069 elif $PATH_TO_PING -A inet6 -n -U -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 -U -c %d %s"
1073 ac_cv_ping6_packets_first=yes
1074 AC_MSG_RESULT([$with_ping6_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 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1084 egrep -i "^round-trip|^rtt" >/dev/null
1085 then
1086 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1087 AC_MSG_RESULT([$with_ping6_command])
1089 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1090 egrep -i "^round-trip|^rtt" >/dev/null
1091 then
1092 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1093 AC_MSG_RESULT([$with_ping6_command])
1095 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1096 egrep -i "^round-trip|^rtt" >/dev/null
1097 then
1098 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1099 AC_MSG_RESULT([$with_ping6_command])
1101 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1102 egrep -i "^round-trip|^rtt" >/dev/null
1103 then
1104 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1105 AC_MSG_RESULT([$with_ping6_command])
1107 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1108 egrep -i "^round-trip|^rtt" >/dev/null
1109 then
1110 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1111 ac_cv_ping6_packets_first=yes
1112 AC_MSG_RESULT([$with_ping_command])
1114 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1115 egrep -i "^round-trip|^rtt" >/dev/null
1116 then
1117 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1118 ac_cv_ping6_packets_first=yes
1119 AC_MSG_RESULT([$with_ping6_command])
1121 fi
1123 fi
1125 if test "x$with_ping6_command" != "x"; then
1126 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1127 [path and args for ICMPv6 ping command])
1128 else
1129 AC_MSG_RESULT([none])
1130 fi
1132 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1133 AC_DEFINE(PING6_PACKETS_FIRST,1,
1134 [Define if packet count must precede host])
1135 fi
1136 fi
1138 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1140 AC_MSG_CHECKING(for nslookup syntax)
1141 if test -n "$PATH_TO_NSLOOKUP"
1142 then
1143 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1144 then
1145 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1146 AC_MSG_RESULT([$ac_cv_nslookup_command])
1148 else
1149 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1150 AC_MSG_RESULT([$ac_cv_nslookup_command])
1152 fi
1153 EXTRAS="$EXTRAS check_dns"
1155 else
1156 AC_MSG_WARN([nslookup command not found])
1157 fi
1159 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1160 [path and args for nslookup])
1162 AC_PATH_PROG(PATH_TO_HOST,host)
1163 if test -n "$ac_cv_path_PATH_TO_HOST"
1164 then
1165 EXTRAS="$EXTRAS check_dns"
1166 fi
1168 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1169 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1171 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1172 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1174 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1175 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1176 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1177 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1178 then
1179 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1180 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1181 else
1182 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1183 fi
1185 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1186 if test -x "$PATH_TO_LMSTAT"
1187 then
1188 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1189 else
1190 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1191 fi
1193 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1194 if test -x "$PATH_TO_SMBCLIENT"
1195 then
1196 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1197 else
1198 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1199 fi
1202 AC_PATH_PROG(PATH_TO_WHO,who)
1204 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1205 then
1206 ac_cv_path_to_who="$PATH_TO_WHO -q"
1207 else
1208 ac_cv_path_to_who="$PATH_TO_WHO"
1209 fi
1211 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1212 [path and arguments for invoking 'who'])
1214 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1215 if test -x "$PATH_TO_SNMPGET"
1216 then
1217 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1218 EXTRAS="$EXTRAS check_hpjd check_snmp"
1219 else
1220 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1221 fi
1223 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1224 if test -x "$PATH_TO_SNMPGETNEXT"
1225 then
1226 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1227 fi
1229 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1230 then
1231 AC_MSG_CHECKING(for Net::SNMP perl module)
1232 AC_MSG_RESULT([found])
1233 else
1234 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1235 fi
1237 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1238 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1240 if test -x "$PATH_TO_QUAKESTAT"
1241 then
1242 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1243 EXTRAS="$EXTRAS check_game"
1245 elif test -x "$PATH_TO_QSTAT"
1246 then
1247 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1248 EXTRAS="$EXTRAS check_game"
1249 else
1250 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1251 fi
1253 if test $ac_cv_path_to_qstat
1254 then
1255 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1256 [path to qstat/quakestat])
1257 fi
1259 AC_PATH_PROG(PATH_TO_FPING,fping)
1260 if test -x "$PATH_TO_FPING"
1261 then
1262 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1263 EXTRAS="$EXTRAS check_fping"
1264 else
1265 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1266 fi
1268 AC_PATH_PROG(PATH_TO_SSH,ssh)
1270 if test -x "$PATH_TO_SSH"
1271 then
1272 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1273 EXTRAS="$EXTRAS check_by_ssh"
1274 else
1275 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1276 fi
1279 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1280 if test -x "$PATH_TO_MAILQ"
1281 then
1282 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1283 else
1284 AC_MSG_WARN([Could not find mailq or eqivalent])
1285 fi
1287 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1288 if test -x "$PATH_TO_QMAIL_QSTAT"
1289 then
1290 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1291 else
1292 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1293 fi
1295 dnl SWAP info required is amount allocated/available and amount free
1296 dnl The plugin works through all the swap devices and adds up the total swap
1297 dnl available.
1298 AC_PATH_PROG(PATH_TO_SWAP,swap)
1299 if (test -n "$PATH_TO_SWAP")
1300 then
1301 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1302 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1303 then
1304 ac_cv_have_swap=yes
1305 ac_cv_swap_command="$PATH_TO_SWAP -l"
1306 if [$PATH_TO_SWAP -l 2>/dev/null | \
1307 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1308 >/dev/null]
1309 then
1310 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1311 ac_cv_swap_conv=2048
1312 AC_MSG_RESULT([using IRIX format swap])
1314 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1315 then
1316 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1317 ac_cv_swap_conv=2048
1318 AC_MSG_RESULT([using Unixware format swap])
1319 else
1320 dnl if we don't know what format swap's output is
1321 dnl we might as well pretend we didn't see it
1322 ac_cv_have_swap=""
1323 ac_cv_swap_command=""
1324 fi
1325 fi
1326 dnl end if for PATH_TO_SWAP
1327 fi
1329 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1330 if (test -n "$PATH_TO_SWAPINFO")
1331 then
1332 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1333 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1334 then
1335 ac_cv_have_swap=yes
1336 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1338 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1339 then
1340 ac_cv_swap_format=["%*s %d %*d %d"]
1341 ac_cv_swap_conv=1024
1342 AC_MSG_RESULT([using FreeBSD format swapinfo])
1343 fi
1345 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1346 then
1347 ac_cv_have_swap=yes
1348 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1349 ac_cv_swap_format=["%*s %d %*d %d"]
1350 ac_cv_swap_conv=1024
1351 AC_MSG_RESULT([using HP-UX format swapinfo])
1352 fi
1353 dnl end if for PATH_TO_SWAPINFO
1354 fi
1356 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1357 if (test -n "$PATH_TO_LSPS")
1358 then
1359 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1360 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1361 then
1362 ac_cv_have_swap=yes
1363 ac_cv_swap_command="$PATH_TO_LSPS -a"
1364 ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
1365 ac_cv_swap_conv=1
1366 AC_MSG_RESULT([using AIX lsps])
1367 fi
1368 dnl end if for PATH_TO_SWAPINFO
1369 fi
1371 dnl
1372 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1373 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1374 dnl in the various BSD's
1375 dnl
1377 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1378 #ifdef HAVE_SYS_PARAM_H
1379 #include <sys/param.h>
1380 #endif
1381 ])
1382 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1383 AC_CHECK_DECLS([swapctl],,,[
1384 #include <unistd.h>
1385 #include <sys/types.h>
1386 #include <sys/param.h>
1387 #include <sys/stat.h>
1388 #include <sys/swap.h>
1389 ])
1390 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1391 #include <sys/types.h>
1392 #include <sys/param.h>
1393 #include <sys/stat.h>
1394 #include <sys/swap.h>
1395 ])
1396 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1397 #include <unistd.h>
1398 #include <sys/types.h>
1399 #include <sys/param.h>
1400 #include <sys/stat.h>
1401 #include <sys/swap.h>
1402 ])
1404 if test "$ac_cv_have_decl_swapctl" = "yes";
1405 then
1406 EXTRAS="$EXTRAS check_swap"
1407 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1408 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1409 "$ac_cv_type_swapent_t" = "yes";
1410 then
1411 AC_MSG_RESULT([yes])
1412 ac_cv_check_swap_swapctl_svr4="1";
1413 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1414 [Define if 2-argument SVR4 swapctl exists])
1415 else
1416 AC_MSG_RESULT([no])
1417 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1418 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1419 then
1420 AC_MSG_RESULT([yes])
1421 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1422 [Define if 3-argument BSD swapctl exists])
1423 else
1424 AC_MSG_RESULT([no])
1425 fi
1426 fi
1427 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1428 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1429 then
1430 dnl
1431 dnl the SVR4 spec returns values in pages
1432 dnl
1433 AC_MSG_RESULT([page])
1434 AC_CHECK_DECLS([sysconf])
1435 AC_MSG_CHECKING([for system page size])
1436 if test "$ac_cv_have_decl_sysconf" = "yes";
1437 then
1438 AC_MSG_RESULT([determined by sysconf(3)])
1439 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1440 else
1441 AC_MSG_WARN([don't know. guessing 4096k])
1442 ac_cv_swap_conv=256
1443 fi
1444 else
1445 dnl
1446 dnl the BSD spec returns values in blocks
1447 dnl
1448 AC_MSG_RESULT([blocks (assuming 512b)])
1449 ac_cv_swap_conv=2048
1450 fi
1451 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1452 [Conversion factor to MB])
1453 fi
1454 dnl
1455 dnl end tests for the swapctl system calls
1456 dnl
1459 if test "x$ac_cv_have_swap" != "x"
1460 then
1461 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1462 EXTRAS="$EXTRAS check_swap"
1463 fi
1464 if test "x$ac_cv_swap_command" != "x"
1465 then
1466 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1467 [Path to swap/swapinfo binary, with any args])
1468 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1469 [Format string for parsing swap output])
1470 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1471 [Conversion factor to MB])
1472 fi
1474 dnl dunno why this does not work below - use hack (kbd)
1475 dnl fine on linux, broken on solaris
1476 dnl if /bin/test -e "/proc/meminfo"
1477 AC_MSG_CHECKING([for /proc/meminfo])
1478 if [cat /proc/meminfo > /dev/null 2>&1]
1479 then
1480 AC_MSG_RESULT([found /proc/meminfo])
1481 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1482 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1483 EXTRAS="$EXTRAS check_swap"
1484 else
1485 AC_MSG_RESULT([no])
1486 fi
1488 AC_PATH_PROG(PATH_TO_DIG,dig)
1489 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1490 if test -n "$PATH_TO_DIG"; then
1491 EXTRAS="$EXTRAS check_dig"
1492 fi
1494 if test -f plugins/check_nt.c ; then
1495 EXTRAS="$EXTRAS check_nt"
1496 elif test -f ../plugins/check_nt.c ; then
1497 EXTRAS="$EXTRAS check_nt"
1498 fi
1500 AC_MSG_CHECKING(for va_list)
1501 AC_TRY_COMPILE([#ifdef __STDC__
1502 #include <stdio.h>
1503 #include <stdlib.h>
1504 #include <stdarg.h>
1505 #else
1506 #include <sys/types.h>
1507 #include <stdio.h>
1508 #include <varargs.h>
1509 #endif],
1510 [va_list args;],
1511 [AC_MSG_RESULT(yes)],
1512 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1514 AC_SUBST(EXTRAS)
1515 AC_SUBST(EXTRA_NETOBJS)
1516 AC_SUBST(DEPLIBS)
1518 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1519 AM_GNU_GETTEXT_VERSION(0.11.5)
1521 dnl External libraries
1522 np_COREUTILS
1524 AC_OUTPUT(
1525 Makefile
1526 lib/Makefile
1527 m4/Makefile
1528 plugins/Makefile
1529 plugins-scripts/Makefile
1530 plugins-scripts/subst
1531 plugins-scripts/utils.pm
1532 plugins-scripts/utils.sh
1533 command.cfg
1534 test.pl
1535 pkg/solaris/pkginfo
1536 intl/Makefile
1537 po/Makefile.in
1538 )
1540 ACX_FEATURE([with],[cgiurl])
1541 ACX_FEATURE([with],[nagios-user])
1542 ACX_FEATURE([with],[nagios-group])
1543 ACX_FEATURE([with],[trusted-path])
1544 ACX_FEATURE([with],[ping-command])
1545 ACX_FEATURE([with],[ping6-command])
1546 ACX_FEATURE([with],[lwres])
1547 ACX_FEATURE([with],[ipv6])
1548 ACX_FEATURE([with],[openssl])
1549 ACX_FEATURE([enable],[emulate-getaddrinfo])