76e0ca9da1625950b0bfa3dd86f3454c74ba0f02
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.58)
4 AC_INIT(nagios-plugins,1.4-beta1)
5 AC_CONFIG_SRCDIR(Helper.pm)
6 AM_INIT_AUTOMAKE
7 AM_CONFIG_HEADER(config.h)
8 AC_CANONICAL_HOST
10 RELEASE=1
11 AC_SUBST(RELEASE)
13 AC_PREFIX_DEFAULT(/usr/local/nagios)
15 dnl Figure out how to invoke "install" and what install options to use.
16 AC_PROG_INSTALL
17 AC_SUBST(INSTALL)
19 dnl Must come very early on due to coreutils requirement
20 dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
21 gl_USE_SYSTEM_EXTENSIONS
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_RANLIB
28 AC_PROG_MAKE_SET
29 AC_PROG_AWK
31 AC_FUNC_MALLOC
32 AC_FUNC_REALLOC
33 AC_FUNC_ERROR_AT_LINE
35 AC_CONFIG_LIBOBJ_DIR(lib)
36 AC_FUNC_GETLOADAVG([lib])
38 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
39 dnl AM_WITH_REGEX
41 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
42 AC_SUBST(PLUGIN_TEST)dnl
44 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
45 AC_SUBST(SCRIPT_TEST)dnl
47 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
48 AC_SUBST(WARRANTY)
50 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
51 AC_SUBST(SUPPORT)
53 dnl CGIURL has changed for Nagios with 1.0 beta
54 AC_ARG_WITH(cgiurl,
55 ACX_HELP_STRING([--with-cgiurl=DIR],
56 [sets URL for cgi programs]),
57 with_cgiurl=$withval,
58 with_cgiurl=/nagios/cgi-bin)
59 CGIURL="$with_cgiurl"
60 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
62 AC_ARG_WITH(nagios_user,
63 ACX_HELP_STRING([--with-nagios-user=USER],
64 [set user name to run nagios]),
65 with_nagios_user=$withval,
66 with_nagios_user=nagios)
67 AC_ARG_WITH(nagios_group,
68 ACX_HELP_STRING([--with-nagios-group=GROUP],
69 [set group name to run nagios]),
70 with_nagios_group=$withval,
71 with_nagios_group=nagios)
72 AC_SUBST(with_nagios_user)
73 AC_SUBST(with_nagios_group)
74 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
75 AC_SUBST(INSTALL_OPTS)
77 AC_ARG_WITH(trusted_path,
78 ACX_HELP_STRING([--with-trusted-path=PATH],
79 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
80 with_trusted_path=$withval,
81 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
82 AC_SUBST(with_trusted_path)
84 EXTRAS=
85 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
87 LDFLAGS="$LDFLAGS -L."
89 ac_cv_uname_m=`uname -m`
90 ac_cv_uname_s=`uname -s`
91 ac_cv_uname_r=`uname -r`
92 ac_cv_uname_v=`uname -v`
94 PKG_ARCH=`uname -p`
95 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
96 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
98 AC_SUBST(PKG_ARCH)
99 AC_SUBST(REV_DATESTAMP)
100 AC_SUBST(REV_TIMESTAMP)
102 dnl Checks for programs.
103 AC_PATH_PROG(PYTHON,python)
104 AC_PATH_PROG(PERL,perl)
105 AC_PATH_PROG(SH,sh)
107 AC_PATH_PROG(HOSTNAME,hostname)
108 AC_PATH_PROG(BASENAME,basename)
110 dnl
111 dnl Check for miscellaneous stuff
112 dnl
114 case $host_vender-$host_os in
115 sun*)
116 AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
117 ;;
118 osf*)
119 AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
120 ;;
121 esac
123 dnl
124 dnl Checks for libraries.
125 dnl
127 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
128 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
129 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
130 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
131 AC_SUBST(SOCKETLIBS)
133 dnl Check for PostgreSQL libraries
134 _SAVEDLIBS="$LIBS"
135 _SAVEDCPPFLAGS="$CPPFLAGS"
136 AC_ARG_WITH(pgsql,
137 ACX_HELP_STRING([--with-pgsql=DIR],
138 [sets path to pgsql installation]),
139 PGSQL=$withval,)
140 AC_CHECK_LIB(crypt,main)
141 if test "$ac_cv_lib_crypt_main" = "yes"; then
142 if test -n "$PGSQL"; then
143 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
144 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
145 fi
146 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
147 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
148 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
149 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
150 AC_CHECK_HEADERS(libpq-fe.h)
151 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
152 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
153 PGINCLUDE="-I$PGSQL/include"
154 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
155 PGLIBS="-lpq -lcrypt"
156 PGINCLUDE="-I/usr/include/pgsql"
157 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
158 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
159 PGINCLUDE="-I/usr/include/postgresql"
160 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
161 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
162 PGINCLUDE="-I$PGSQL/include"
163 fi
164 if test -z "$PGINCLUDE"; then
165 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
166 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
167 else
168 AC_SUBST(PGLIBS)
169 AC_SUBST(PGINCLUDE)
170 EXTRAS="$EXTRAS check_pgsql"
171 fi
172 else
173 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
174 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
175 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
176 fi
177 else
178 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
179 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
180 fi
181 LIBS="$_SAVEDLIBS"
182 CPPFLAGS="$_SAVEDCPPFLAGS"
184 dnl Check for radius libraries
185 _SAVEDLIBS="$LIBS"
186 AC_CHECK_LIB(radiusclient,rc_read_config)
187 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
188 EXTRAS="$EXTRAS check_radius"
189 RADIUSLIBS="-lradiusclient"
190 AC_SUBST(RADIUSLIBS)
191 else
192 AC_MSG_WARN([Skipping radius plugin])
193 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
194 fi
195 LIBS="$_SAVEDLIBS"
197 dnl Check for LDAP libraries
198 _SAVEDLIBS="$LIBS"
199 AC_CHECK_LIB(ldap,main,,,-llber)
200 if test "$ac_cv_lib_ldap_main" = "yes"; then
201 LDAPLIBS="-lldap -llber"\
202 LDAPINCLUDE="-I/usr/include/ldap"
203 AC_SUBST(LDAPLIBS)
204 AC_SUBST(LDAPINCLUDE)
205 AC_CHECK_FUNCS(ldap_set_option)
206 EXTRAS="$EXTRAS check_ldap"
207 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
208 else
209 AC_MSG_WARN([Skipping LDAP plugin])
210 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
211 fi
212 LIBS="$_SAVEDLIBS"
215 dnl Check for mysql libraries
216 _SAVEDLIBS="$LIBS"
217 _SAVEDCPPFLAGS="$CPPFLAGS"
218 AC_ARG_WITH(mysql,
219 ACX_HELP_STRING([--with-mysql=DIR],
220 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
221 MYSQL=$withval,)
222 if test -n "$MYSQL"; then
223 MYSQLLIBDIR=$MYSQL/lib/mysql
224 CPPFLAGS="-I$MYSQL/include"
225 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
226 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
227 elif test -f /usr/lib/libmysqlclient.so; then
228 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
229 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
230 elif test -f /usr/lib/libmysqlclient.a; then
231 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
232 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
233 elif test -f /usr/lib/mysql/libmysqlclient.so; then
234 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
235 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
236 elif test -f /usr/lib/mysql/libmysqlclient.a; then
237 AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
238 AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
239 fi
240 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
241 AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
242 if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
243 EXTRAS="$EXTRAS check_mysql"
244 AC_SUBST(MYSQLINCLUDE)
245 AC_SUBST(MYSQLLIBS)
246 AC_SUBST(check_mysql_LDFLAGS)
247 else
248 AC_MSG_WARN([Skipping mysql plugin])
249 AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
250 fi
251 else
252 AC_MSG_WARN([Skipping mysql plugin])
253 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
254 fi
255 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
256 LIBS="$_SAVEDLIBS"
258 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 if test X"$OPENSSL" = "Xno"; then
423 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
424 FOUNDSSL="dontbother"
425 else
426 dnl Check for OpenSSL header files
427 unset FOUNDINCLUDE
428 _SAVEDCPPFLAGS="$CPPFLAGS"
429 if test "$OPENSSL" != "/usr"; then
430 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
431 fi
432 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
433 SSLINCLUDE="-I$OPENSSL/include"
434 FOUNDINCLUDE=yes,
435 FOUNDINCLUDE=no)
436 if test "$FOUNDINCLUDE" = "no"; then
437 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
438 SSLINCLUDE="-I$OPENSSL/include"
439 FOUNDINCLUDE=yes,
440 FOUNDINCLUDE=no)
441 fi
442 AC_SUBST(SSLINCLUDE)
443 if test "$FOUNDINCLUDE" = "no"; then
444 CPPFLAGS="$_SAVEDCPPFLAGS"
445 fi
447 dnl Check for crypto lib
448 _SAVEDLIBS="$LIBS"
449 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
450 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
451 dnl Check for SSL lib
452 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)
453 fi
454 LIBS="$_SAVEDLIBS"
456 FOUNDSSL="no"
457 dnl test headers and libs to decide whether check_http should use SSL
458 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
459 if test "$ac_cv_lib_ssl_main" = "yes"; then
460 if test "$FOUNDINCLUDE" = "yes"; then
461 FOUNDSSL="yes"
462 fi
463 fi
464 fi
465 fi
467 if test "$FOUNDSSL" = "yes"; then
468 check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
469 AC_SUBST(check_tcp_ssl)
470 AC_SUBST(SSLLIBS)
471 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
472 with_openssl="yes"
473 elif test "$FOUNDSSL" = "no"; then
474 AC_MSG_WARN([OpenSSL libs could not be found])
475 with_openssl="no"
476 else
477 with_openssl="no"
478 fi
479 CPPFLAGS="$_SAVEDCPPFLAGS"
481 dnl
482 dnl Checks for header files.
483 dnl
485 AC_HEADER_STDC
486 AC_HEADER_TIME
487 AC_HEADER_SYS_WAIT
488 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)
489 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
491 dnl Checks for typedefs, structures, and compiler characteristics.
492 AC_C_CONST
493 AC_STRUCT_TM
494 AC_TYPE_PID_T
495 AC_TYPE_SIZE_T
496 AC_TYPE_SIGNAL
498 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
499 AC_TRY_LINK([#include <stdarg.h>
500 va_list ap1,ap2;], [va_copy(ap1,ap2);],
501 ac_cv_HAVE_VA_COPY=yes,
502 ac_cv_HAVE_VA_COPY=no)])
503 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
504 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
505 else
506 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
507 AC_TRY_LINK([#include <stdarg.h>
508 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
509 ac_cv_HAVE___VA_COPY=yes,
510 ac_cv_HAVE___VA_COPY=no)])
511 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
512 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
513 fi
514 fi
516 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
517 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
518 AC_TRY_RUN([
519 #include <sys/types.h>
520 #include <stdarg.h>
521 void foo(const char *format, ...) {
522 va_list ap;
523 int len;
524 char buf[5];
526 va_start(ap, format);
527 len = vsnprintf(buf, 0, format, ap);
528 va_end(ap);
529 if (len != 5) exit(1);
531 va_start(ap, format);
532 len = vsnprintf(0, 0, format, ap);
533 va_end(ap);
534 if (len != 5) exit(1);
536 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
538 exit(0);
539 }
540 main() { foo("hello"); }
541 ],
542 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
543 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
544 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
545 fi
547 AC_TRY_COMPILE([#include <sys/time.h>],
548 [struct timeval *tv;
549 struct timezone *tz;],
550 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
551 AC_TRY_COMPILE([#include <sys/time.h>],
552 [struct timeval *tv;
553 struct timezone *tz;
554 gettimeofday(tv, tz);],
555 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
556 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
558 dnl Checks for library functions.
559 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
561 AC_MSG_CHECKING(return type of socket size)
562 AC_TRY_COMPILE([#include <stdlib.h>
563 #include <sys/types.h>
564 #include <sys/socket.h>],
565 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
566 ac_cv_socket_size_type=["size_t"]
567 AC_MSG_RESULT(size_t),
568 ac_cv_socket_size_type=["int"]
569 AC_MSG_RESULT(int))
571 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
572 [Define type of socket size])
574 if test -f "/proc/loadavg"
575 then
576 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
577 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
578 fi
580 dnl #### Process table test
582 AC_PATH_PROG(PATH_TO_PS,ps)
584 AC_MSG_CHECKING(for ps syntax)
585 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
586 dnl Should also work for FreeBSD 5.2.1 and 5.3
587 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
588 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
589 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
590 then
591 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
592 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
593 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
594 ac_cv_ps_cols=8
595 AC_MSG_RESULT([$ac_cv_ps_command])
597 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
598 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
599 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
600 then
601 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
602 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
603 ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
604 ac_cv_ps_cols=9
605 AC_MSG_RESULT([$ac_cv_ps_command])
607 dnl FreeBSD
608 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
609 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
610 then
611 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
612 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
613 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
614 ac_cv_ps_cols=8
615 AC_MSG_RESULT([$ac_cv_ps_command])
617 dnl BSD-like mode in RH 6.1
618 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
619 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
620 then
621 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
622 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
623 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
624 ac_cv_ps_cols=8
625 AC_MSG_RESULT([$ac_cv_ps_command])
627 dnl SunOS 4.1.3:
628 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
629 dnl Need the head -1 otherwise test will work because arguments are found
630 elif ps -laxnwww 2>/dev/null | head -1 | \
631 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
632 then
633 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
634 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
635 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
636 ac_cv_ps_cols=8
637 AC_MSG_RESULT([$ac_cv_ps_command])
639 dnl Debian Linux / procps v1.2.9:
640 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
641 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
642 dnl
643 elif ps laxnwww 2>/dev/null | \
644 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
645 then
646 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
647 ac_cv_ps_command="$PATH_TO_PS laxnwww"
648 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
649 ac_cv_ps_cols=8
650 AC_MSG_RESULT([$ac_cv_ps_command])
652 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
653 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
654 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
655 then
656 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
657 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
658 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
659 ac_cv_ps_cols=8
660 AC_MSG_RESULT([$ac_cv_ps_command])
662 dnl Tru64 - needs %*[ +] in PS_FORMAT
663 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
664 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
665 then
666 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
667 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
668 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
669 ac_cv_ps_cols=8
670 AC_MSG_RESULT([$ac_cv_ps_command])
672 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
673 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
674 then
675 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
676 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
677 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
678 ac_cv_ps_cols=8
679 AC_MSG_RESULT([$ac_cv_ps_command])
681 dnl AIX 4.3.3 and 5.1 do not have an rss field
682 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
683 egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
684 then
685 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
686 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
687 ac_cv_ps_format="%s %d %d %d %f %s %n"
688 ac_cv_ps_cols=7
689 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
691 dnl Solaris 2.6
692 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
693 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
694 then
695 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
696 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
697 # There must be no space between the %s and %n due to a wierd problem in sscanf where
698 # it will return %n as longer than the line length
699 ac_cv_ps_format="%s %d %d %d %d %f %s%n"
700 ac_cv_ps_cols=8
701 AC_MSG_RESULT([$ac_cv_ps_command])
703 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
704 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
705 then
706 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
707 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
708 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
709 ac_cv_ps_cols=8
710 AC_MSG_RESULT([$ac_cv_ps_command])
712 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
713 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
714 then
715 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
716 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
717 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
718 ac_cv_ps_cols=8
719 AC_MSG_RESULT([$ac_cv_ps_command])
721 dnl wonder who takes state instead of stat
722 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
723 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
724 then
725 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
726 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
727 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
728 ac_cv_ps_cols=7
729 AC_MSG_RESULT([$ac_cv_ps_command])
731 dnl IRIX 53
732 elif ps -el 2>/dev/null | \
733 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
734 then
735 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
736 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
737 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
738 ac_cv_ps_cols=7
739 AC_MSG_RESULT([$ac_cv_ps_command])
741 dnl IRIX 63
742 elif ps -el 2>/dev/null | \
743 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
744 then
745 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
746 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
747 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
748 ac_cv_ps_cols=5
749 AC_MSG_RESULT([$ac_cv_ps_command])
751 dnl AIX 4.1:
752 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
753 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
754 elif ps -el 2>/dev/null | \
755 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
756 then
757 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
758 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
759 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
760 ac_cv_ps_cols=5
761 AC_MSG_RESULT([$ac_cv_ps_command])
763 dnl AIX?
764 elif ps glaxen 2>/dev/null | \
765 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
766 then
767 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
768 ac_cv_ps_command="$PATH_TO_PS glaxen"
769 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
770 ac_cv_ps_cols=7
771 AC_MSG_RESULT([$ac_cv_ps_command])
773 dnl MacOSX / Darwin
774 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
775 dnl Some truncation will happen in UCOMM column
776 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
777 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
778 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
779 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
780 then
781 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
782 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
783 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
784 ac_cv_ps_cols=7
785 AC_MSG_RESULT([$ac_cv_ps_command])
787 dnl UnixWare
788 elif ps -Al 2>/dev/null | \
789 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
790 then
791 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
792 ac_cv_ps_command="$PATH_TO_PS -Al"
793 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
794 ac_cv_ps_cols=7
795 AC_MSG_RESULT([$ac_cv_ps_command])
797 else
798 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
799 fi
801 if test -n "$ac_cv_ps_varlist" ; then
802 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
803 [Variable list for sscanf of 'ps' output])
804 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
805 [Verbatim command to execute for ps in check_procs])
806 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
807 [Format string for scanning ps output in check_procs])
808 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
809 [Number of columns in ps command])
810 EXTRAS="$EXTRAS check_procs check_nagios"
811 fi
813 AC_PATH_PROG(PATH_TO_PING,ping)
814 AC_PATH_PROG(PATH_TO_PING6,ping6)
816 AC_ARG_WITH(ping_command,
817 ACX_HELP_STRING([--with-ping-command=SYNTAX],
818 [sets syntax for ICMP ping]),
819 with_ping_command=$withval,)
821 AC_MSG_CHECKING(for ICMP ping syntax)
822 ac_cv_ping_packets_first=no
823 ac_cv_ping_has_timeout=no
824 if test -n "$with_ping_command"
825 then
826 AC_MSG_RESULT([(command-line) $with_ping_command])
827 if test -n "$ac_cv_ping_packets_first"
828 then
829 ac_cv_ping_packets_first=yes
830 fi
832 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
833 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
834 egrep -i "^round-trip|^rtt" >/dev/null
835 then
836 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
837 ac_cv_ping_packets_first=yes
838 AC_MSG_RESULT([$with_ping_command])
840 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
841 egrep -i "^round-trip|^rtt" >/dev/null
842 then
843 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
844 ac_cv_ping_packets_first=yes
845 ac_cv_ping_has_timeout=yes
846 AC_MSG_RESULT([$with_ping_command])
848 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
849 egrep -i "^round-trip|^rtt" >/dev/null
850 then
851 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
852 ac_cv_ping_packets_first=yes
853 AC_MSG_RESULT([$with_ping_command])
855 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
856 egrep -i "^round-trip|^rtt" >/dev/null
857 then
858 with_ping_command="$PATH_TO_PING -n -c %d %s"
859 ac_cv_ping_packets_first=yes
860 AC_MSG_RESULT([$with_ping_command])
862 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
863 egrep -i "^round-trip|^rtt" >/dev/null
864 then
865 with_ping_command="$PATH_TO_PING -n %s -c %d"
866 AC_MSG_RESULT([$with_ping_command])
868 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
869 egrep -i "^round-trip|^rtt" >/dev/null
870 then
871 with_ping_command="$PATH_TO_PING %s -n %d"
872 AC_MSG_RESULT([$with_ping_command])
874 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
875 egrep -i "^round-trip|^rtt" >/dev/null
876 then
877 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
878 AC_MSG_RESULT([$with_ping_command])
880 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
881 egrep -i "^round-trip|^rtt" >/dev/null
882 then
883 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
884 AC_MSG_RESULT([$with_ping_command])
886 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
887 egrep -i "^round-trip|^rtt" >/dev/null
888 then
889 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
890 ac_cv_ping_packets_first=yes
891 AC_MSG_RESULT([$with_ping_command])
893 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
894 egrep -i "^round-trip|^rtt" >/dev/null
895 then
896 with_ping_command="$PATH_TO_PING -n -c %d %s"
897 ac_cv_ping_packets_first=yes
898 AC_MSG_RESULT([$with_ping_command])
900 else
901 AC_MSG_WARN([unable to find usable ping syntax])
902 fi
904 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
905 [path and args for ICMP ping command])
907 if test "x$ac_cv_ping_packets_first" != "xno"
908 then
909 AC_DEFINE(PING_PACKETS_FIRST,1,
910 [Define if packet count must precede host])
911 fi
913 if test "x$ac_cv_ping_has_timeout" != "xno"
914 then
915 AC_DEFINE(PING_HAS_TIMEOUT,1,
916 [Define if ping has its own timeout option that should be set])
917 fi
919 AC_ARG_WITH(ping6_command,
920 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
921 [sets syntax for ICMPv6 ping]),
922 with_ping6_command=$withval,)
924 if test x"$with_ipv6" != xno ; then
925 AC_MSG_CHECKING(for ICMPv6 ping syntax)
926 ac_cv_ping6_packets_first=no
927 if test -n "$with_ping6_command"
928 then
929 AC_MSG_RESULT([(command-line) $with_ping6_command])
930 if test -n "$ac_cv_ping6_packets_first"
931 then
932 ac_cv_ping6_packets_first=yes
933 fi
935 elif test "x$PATH_TO_PING6" != "x"; then
936 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
937 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
938 egrep -i "^round-trip|^rtt" >/dev/null
939 then
940 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
941 ac_cv_ping6_packets_first=yes
942 AC_MSG_RESULT([$with_ping6_command])
944 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
945 egrep -i "^round-trip|^rtt" >/dev/null
946 then
947 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
948 ac_cv_ping6_packets_first=yes
949 AC_MSG_RESULT([$with_ping6_command])
951 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
952 egrep -i "^round-trip|^rtt" >/dev/null
953 then
954 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
955 ac_cv_ping6_packets_first=yes
956 AC_MSG_RESULT([$with_ping6_command])
958 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
959 egrep -i "^round-trip|^rtt" >/dev/null
960 then
961 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
962 AC_MSG_RESULT([$with_ping6_command])
964 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
965 egrep -i "^round-trip|^rtt" >/dev/null
966 then
967 with_ping6_command="$PATH_TO_PING6 %s -n %d"
968 AC_MSG_RESULT([$with_ping6_command])
970 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
971 egrep -i "^round-trip|^rtt" >/dev/null
972 then
973 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
974 AC_MSG_RESULT([$with_ping6_command])
976 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
977 egrep -i "^round-trip|^rtt" >/dev/null
978 then
979 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
980 AC_MSG_RESULT([$with_ping6_command])
982 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
983 egrep -i "^round-trip|^rtt" >/dev/null
984 then
985 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
986 ac_cv_ping6_packets_first=yes
987 AC_MSG_RESULT([$with_ping_command])
989 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
990 egrep -i "^round-trip|^rtt" >/dev/null
991 then
992 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
993 ac_cv_ping6_packets_first=yes
994 AC_MSG_RESULT([$with_ping6_command])
996 fi
998 elif test "x$PATH_TO_PING" != "x"; then
999 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1000 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1001 egrep -i "^round-trip|^rtt" >/dev/null
1002 then
1003 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1004 ac_cv_ping6_packets_first=yes
1005 AC_MSG_RESULT([$with_ping6_command])
1007 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1008 egrep -i "^round-trip|^rtt" >/dev/null
1009 then
1010 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1011 ac_cv_ping6_packets_first=yes
1012 AC_MSG_RESULT([$with_ping6_command])
1014 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1015 egrep -i "^round-trip|^rtt" >/dev/null
1016 then
1017 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1018 ac_cv_ping6_packets_first=yes
1019 AC_MSG_RESULT([$with_ping6_command])
1021 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1022 egrep -i "^round-trip|^rtt" >/dev/null
1023 then
1024 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1025 AC_MSG_RESULT([$with_ping6_command])
1027 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1028 egrep -i "^round-trip|^rtt" >/dev/null
1029 then
1030 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1031 AC_MSG_RESULT([$with_ping6_command])
1033 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1034 egrep -i "^round-trip|^rtt" >/dev/null
1035 then
1036 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1037 AC_MSG_RESULT([$with_ping6_command])
1039 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1040 egrep -i "^round-trip|^rtt" >/dev/null
1041 then
1042 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1043 AC_MSG_RESULT([$with_ping6_command])
1045 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1046 egrep -i "^round-trip|^rtt" >/dev/null
1047 then
1048 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1049 ac_cv_ping6_packets_first=yes
1050 AC_MSG_RESULT([$with_ping_command])
1052 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1053 egrep -i "^round-trip|^rtt" >/dev/null
1054 then
1055 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1056 ac_cv_ping6_packets_first=yes
1057 AC_MSG_RESULT([$with_ping6_command])
1059 fi
1061 fi
1063 if test "x$with_ping6_command" != "x"; then
1064 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1065 [path and args for ICMPv6 ping command])
1066 else
1067 AC_MSG_RESULT([none])
1068 fi
1070 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1071 AC_DEFINE(PING6_PACKETS_FIRST,1,
1072 [Define if packet count must precede host])
1073 fi
1074 fi
1076 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1078 AC_MSG_CHECKING(for nslookup syntax)
1079 if test -n "$PATH_TO_NSLOOKUP"
1080 then
1081 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1082 then
1083 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1084 AC_MSG_RESULT([$ac_cv_nslookup_command])
1086 else
1087 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1088 AC_MSG_RESULT([$ac_cv_nslookup_command])
1090 fi
1091 EXTRAS="$EXTRAS check_dns"
1093 else
1094 AC_MSG_WARN([nslookup command not found])
1095 fi
1097 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1098 [path and args for nslookup])
1100 AC_PATH_PROG(PATH_TO_HOST,host)
1101 if test -n "$ac_cv_path_PATH_TO_HOST"
1102 then
1103 EXTRAS="$EXTRAS check_dns"
1104 fi
1106 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1107 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1109 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1110 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1112 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1113 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1114 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1115 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1116 then
1117 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1118 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1119 else
1120 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1121 fi
1123 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1124 if test -x "$PATH_TO_LMSTAT"
1125 then
1126 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1127 else
1128 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1129 fi
1131 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1132 if test -x "$PATH_TO_SMBCLIENT"
1133 then
1134 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1135 else
1136 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1137 fi
1140 AC_PATH_PROG(PATH_TO_WHO,who)
1142 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1143 then
1144 ac_cv_path_to_who="$PATH_TO_WHO -q"
1145 else
1146 ac_cv_path_to_who="$PATH_TO_WHO"
1147 fi
1149 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1150 [path and arguments for invoking 'who'])
1152 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1153 if test -x "$PATH_TO_SNMPGET"
1154 then
1155 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1156 EXTRAS="$EXTRAS check_hpjd check_snmp"
1157 else
1158 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1159 fi
1161 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1162 if test -x "$PATH_TO_SNMPGETNEXT"
1163 then
1164 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1165 fi
1167 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1168 then
1169 AC_MSG_CHECKING(for Net::SNMP perl module)
1170 AC_MSG_RESULT([found])
1171 else
1172 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1173 fi
1175 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1176 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1178 if test -x "$PATH_TO_QUAKESTAT"
1179 then
1180 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1181 EXTRAS="$EXTRAS check_game"
1183 elif test -x "$PATH_TO_QSTAT"
1184 then
1185 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1186 EXTRAS="$EXTRAS check_game"
1187 else
1188 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1189 fi
1191 if test $ac_cv_path_to_qstat
1192 then
1193 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1194 [path to qstat/quakestat])
1195 fi
1197 AC_PATH_PROG(PATH_TO_FPING,fping)
1198 if test -x "$PATH_TO_FPING"
1199 then
1200 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1201 EXTRAS="$EXTRAS check_fping"
1202 else
1203 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1204 fi
1206 AC_PATH_PROG(PATH_TO_SSH,ssh)
1208 if test -x "$PATH_TO_SSH"
1209 then
1210 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1211 EXTRAS="$EXTRAS check_by_ssh"
1212 else
1213 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1214 fi
1217 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1218 if test -x "$PATH_TO_MAILQ"
1219 then
1220 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1221 else
1222 AC_MSG_WARN([Could not find mailq or eqivalent])
1223 fi
1225 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1226 if test -x "$PATH_TO_QMAIL_QSTAT"
1227 then
1228 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1229 else
1230 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1231 fi
1233 dnl SWAP info required is amount allocated/available and amount free
1234 dnl The plugin works through all the swap devices and adds up the total swap
1235 dnl available.
1236 AC_PATH_PROG(PATH_TO_SWAP,swap)
1237 if (test -n "$PATH_TO_SWAP")
1238 then
1239 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1240 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1241 then
1242 ac_cv_have_swap=yes
1243 ac_cv_swap_command="$PATH_TO_SWAP -l"
1244 if [$PATH_TO_SWAP -l 2>/dev/null | \
1245 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1246 >/dev/null]
1247 then
1248 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1249 ac_cv_swap_conv=2048
1250 AC_MSG_RESULT([using IRIX format swap])
1252 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1253 then
1254 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1255 ac_cv_swap_conv=2048
1256 AC_MSG_RESULT([using Unixware format swap])
1257 else
1258 dnl if we don't know what format swap's output is
1259 dnl we might as well pretend we didn't see it
1260 ac_cv_have_swap=""
1261 ac_cv_swap_command=""
1262 fi
1263 fi
1264 dnl end if for PATH_TO_SWAP
1265 fi
1267 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1268 if (test -n "$PATH_TO_SWAPINFO")
1269 then
1270 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1271 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1272 then
1273 ac_cv_have_swap=yes
1274 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1276 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1277 then
1278 ac_cv_swap_format=["%*s %d %*d %d"]
1279 ac_cv_swap_conv=1024
1280 AC_MSG_RESULT([using FreeBSD format swapinfo])
1281 fi
1283 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1284 then
1285 ac_cv_have_swap=yes
1286 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1287 ac_cv_swap_format=["%*s %d %*d %d"]
1288 ac_cv_swap_conv=1024
1289 AC_MSG_RESULT([using HP-UX format swapinfo])
1290 fi
1291 dnl end if for PATH_TO_SWAPINFO
1292 fi
1294 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1295 if (test -n "$PATH_TO_LSPS")
1296 then
1297 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1298 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1299 then
1300 ac_cv_have_swap=yes
1301 ac_cv_swap_command="$PATH_TO_LSPS -a"
1302 ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
1303 ac_cv_swap_conv=1
1304 AC_MSG_RESULT([using AIX lsps])
1305 fi
1306 dnl end if for PATH_TO_SWAPINFO
1307 fi
1309 dnl
1310 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1311 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1312 dnl in the various BSD's
1313 dnl
1315 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1316 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1317 #ifdef HAVE_SYS_PARAM_H
1318 #include <sys/param.h>
1319 #endif
1320 ])
1321 AC_CHECK_DECLS([swapctl],,,[
1322 #include <unistd.h>
1323 #include <sys/types.h>
1324 #include <sys/param.h>
1325 #include <sys/stat.h>
1326 #include <sys/swap.h>
1327 ])
1328 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1329 #include <sys/types.h>
1330 #include <sys/param.h>
1331 #include <sys/stat.h>
1332 #include <sys/swap.h>
1333 ])
1334 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1335 #include <unistd.h>
1336 #include <sys/types.h>
1337 #include <sys/param.h>
1338 #include <sys/stat.h>
1339 #include <sys/swap.h>
1340 ])
1342 if test "$ac_cv_have_decl_swapctl" = "yes";
1343 then
1344 EXTRAS="$EXTRAS check_swap"
1345 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1346 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1347 "$ac_cv_type_swapent_t" = "yes";
1348 then
1349 AC_MSG_RESULT([yes])
1350 ac_cv_check_swap_swapctl_svr4="1";
1351 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1352 [Define if 2-argument SVR4 swapctl exists])
1353 else
1354 AC_MSG_RESULT([no])
1355 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1356 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1357 then
1358 AC_MSG_RESULT([yes])
1359 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1360 [Define if 3-argument BSD swapctl exists])
1361 else
1362 AC_MSG_RESULT([no])
1363 fi
1364 fi
1365 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1366 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1367 then
1368 dnl
1369 dnl the SVR4 spec returns values in pages
1370 dnl
1371 AC_MSG_RESULT([page])
1372 AC_CHECK_DECLS([sysconf])
1373 AC_MSG_CHECKING([for system page size])
1374 if test "$ac_cv_have_decl_sysconf" = "yes";
1375 then
1376 AC_MSG_RESULT([determined by sysconf(3)])
1377 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1378 else
1379 AC_MSG_WARN([don't know. guessing 4096k])
1380 ac_cv_swap_conv=256
1381 fi
1382 else
1383 dnl
1384 dnl the BSD spec returns values in blocks
1385 dnl
1386 AC_MSG_RESULT([blocks (assuming 512b)])
1387 ac_cv_swap_conv=2048
1388 fi
1389 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1390 [Conversion factor to MB])
1391 fi
1392 dnl
1393 dnl end tests for the swapctl system calls
1394 dnl
1397 if test "x$ac_cv_have_swap" != "x"
1398 then
1399 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1400 EXTRAS="$EXTRAS check_swap"
1401 fi
1402 if test "x$ac_cv_swap_command" != "x"
1403 then
1404 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1405 [Path to swap/swapinfo binary, with any args])
1406 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1407 [Format string for parsing swap output])
1408 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1409 [Conversion factor to MB])
1410 fi
1412 dnl dunno why this does not work below - use hack (kbd)
1413 dnl fine on linux, broken on solaris
1414 dnl if /bin/test -e "/proc/meminfo"
1415 AC_MSG_CHECKING([for /proc/meminfo])
1416 if [cat /proc/meminfo > /dev/null 2>&1]
1417 then
1418 AC_MSG_RESULT([found /proc/meminfo])
1419 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1420 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1421 EXTRAS="$EXTRAS check_swap"
1422 else
1423 AC_MSG_RESULT([no])
1424 fi
1426 AC_PATH_PROG(PATH_TO_DIG,dig)
1427 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1428 if test -n "$PATH_TO_DIG"; then
1429 EXTRAS="$EXTRAS check_dig"
1430 fi
1432 if test -f plugins/check_nt.c ; then
1433 EXTRAS="$EXTRAS check_nt"
1434 elif test -f ../plugins/check_nt.c ; then
1435 EXTRAS="$EXTRAS check_nt"
1436 fi
1438 AC_MSG_CHECKING(for va_list)
1439 AC_TRY_COMPILE([#ifdef __STDC__
1440 #include <stdio.h>
1441 #include <stdlib.h>
1442 #include <stdarg.h>
1443 #else
1444 #include <sys/types.h>
1445 #include <stdio.h>
1446 #include <varargs.h>
1447 #endif],
1448 [va_list args;],
1449 [AC_MSG_RESULT(yes)],
1450 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1452 AC_SUBST(EXTRAS)
1453 AC_SUBST(EXTRA_NETOBJS)
1454 AC_SUBST(DEPLIBS)
1456 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1457 AM_GNU_GETTEXT_VERSION(0.11.5)
1459 dnl External libraries - see ACKNOWLEDGEMENTS
1460 np_COREUTILS
1461 np_CURL
1463 AC_OUTPUT(
1464 Makefile
1465 lib/Makefile
1466 m4/Makefile
1467 plugins/Makefile
1468 plugins-scripts/Makefile
1469 plugins-scripts/subst
1470 plugins-scripts/utils.pm
1471 plugins-scripts/utils.sh
1472 command.cfg
1473 test.pl
1474 pkg/solaris/pkginfo
1475 intl/Makefile
1476 po/Makefile.in
1477 )
1479 ACX_FEATURE([with],[cgiurl])
1480 ACX_FEATURE([with],[nagios-user])
1481 ACX_FEATURE([with],[nagios-group])
1482 ACX_FEATURE([with],[trusted-path])
1483 ACX_FEATURE([with],[ping-command])
1484 ACX_FEATURE([with],[ping6-command])
1485 ACX_FEATURE([with],[lwres])
1486 ACX_FEATURE([with],[ipv6])
1487 ACX_FEATURE([with],[openssl])
1488 ACX_FEATURE([enable],[emulate-getaddrinfo])