64f06bf38fd51f6e11ae1150de6d864fc2ba5954
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-beta2)
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 Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
598 dnl Limitation: Only first 16 chars returned for ucomm field
599 dnl Must come before ps -weo
600 elif ps -axwo 'stat uid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
601 egrep -i ["^ *STAT +UID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
602 then
603 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
604 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu ucomm command'"
605 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
606 ac_cv_ps_cols=8
607 AC_MSG_RESULT([$ac_cv_ps_command])
609 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
610 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
611 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
612 then
613 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
614 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
615 ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
616 ac_cv_ps_cols=9
617 AC_MSG_RESULT([$ac_cv_ps_command])
619 dnl FreeBSD
620 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
621 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
622 then
623 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
624 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
625 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
626 ac_cv_ps_cols=8
627 AC_MSG_RESULT([$ac_cv_ps_command])
629 dnl BSD-like mode in RH 6.1
630 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
631 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
632 then
633 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
634 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
635 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
636 ac_cv_ps_cols=8
637 AC_MSG_RESULT([$ac_cv_ps_command])
639 dnl SunOS 4.1.3:
640 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
641 dnl Need the head -1 otherwise test will work because arguments are found
642 elif ps -laxnwww 2>/dev/null | head -1 | \
643 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
644 then
645 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
646 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
647 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
648 ac_cv_ps_cols=8
649 AC_MSG_RESULT([$ac_cv_ps_command])
651 dnl Debian Linux / procps v1.2.9:
652 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
653 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
654 dnl
655 elif ps laxnwww 2>/dev/null | \
656 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
657 then
658 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
659 ac_cv_ps_command="$PATH_TO_PS laxnwww"
660 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
661 ac_cv_ps_cols=8
662 AC_MSG_RESULT([$ac_cv_ps_command])
664 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
665 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
666 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
667 then
668 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
669 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
670 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
671 ac_cv_ps_cols=8
672 AC_MSG_RESULT([$ac_cv_ps_command])
674 dnl Tru64 - needs %*[ +] in PS_FORMAT
675 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
676 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
677 then
678 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
679 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
680 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
681 ac_cv_ps_cols=8
682 AC_MSG_RESULT([$ac_cv_ps_command])
684 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
685 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
686 then
687 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
688 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
689 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
690 ac_cv_ps_cols=8
691 AC_MSG_RESULT([$ac_cv_ps_command])
693 dnl AIX 4.3.3 and 5.1 do not have an rss field
694 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
695 egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
696 then
697 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
698 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
699 ac_cv_ps_format="%s %d %d %d %f %s %n"
700 ac_cv_ps_cols=7
701 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
703 dnl Solaris 2.6
704 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
705 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
706 then
707 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
708 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
709 # There must be no space between the %s and %n due to a wierd problem in sscanf where
710 # it will return %n as longer than the line length
711 ac_cv_ps_format="%s %d %d %d %d %f %s%n"
712 ac_cv_ps_cols=8
713 AC_MSG_RESULT([$ac_cv_ps_command])
715 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
716 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
717 then
718 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
719 ac_cv_ps_command="$PATH_TO_PS -Ao 'status 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 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
725 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
726 then
727 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
728 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
729 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
730 ac_cv_ps_cols=8
731 AC_MSG_RESULT([$ac_cv_ps_command])
733 dnl wonder who takes state instead of stat
734 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
735 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[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 -ao 'state uid ppid vsz rss pcpu command args'"
739 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
740 ac_cv_ps_cols=7
741 AC_MSG_RESULT([$ac_cv_ps_command])
743 dnl IRIX 53
744 elif ps -el 2>/dev/null | \
745 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
746 then
747 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
748 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
749 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
750 ac_cv_ps_cols=7
751 AC_MSG_RESULT([$ac_cv_ps_command])
753 dnl IRIX 63
754 elif ps -el 2>/dev/null | \
755 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +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 (IRIX 63)"
759 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*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 4.1:
764 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
765 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
766 elif ps -el 2>/dev/null | \
767 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
768 then
769 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
770 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
771 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
772 ac_cv_ps_cols=5
773 AC_MSG_RESULT([$ac_cv_ps_command])
775 dnl AIX?
776 elif ps glaxen 2>/dev/null | \
777 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
778 then
779 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
780 ac_cv_ps_command="$PATH_TO_PS glaxen"
781 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
782 ac_cv_ps_cols=7
783 AC_MSG_RESULT([$ac_cv_ps_command])
785 dnl MacOSX / Darwin
786 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
787 dnl Some truncation will happen in UCOMM column
788 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
789 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
790 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
791 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
792 then
793 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
794 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
795 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
796 ac_cv_ps_cols=7
797 AC_MSG_RESULT([$ac_cv_ps_command])
799 dnl UnixWare
800 elif ps -Al 2>/dev/null | \
801 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
802 then
803 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
804 ac_cv_ps_command="$PATH_TO_PS -Al"
805 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
806 ac_cv_ps_cols=7
807 AC_MSG_RESULT([$ac_cv_ps_command])
809 else
810 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
811 fi
813 if test -n "$ac_cv_ps_varlist" ; then
814 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
815 [Variable list for sscanf of 'ps' output])
816 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
817 [Verbatim command to execute for ps in check_procs])
818 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
819 [Format string for scanning ps output in check_procs])
820 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
821 [Number of columns in ps command])
822 EXTRAS="$EXTRAS check_procs check_nagios"
823 fi
825 AC_PATH_PROG(PATH_TO_PING,ping)
826 AC_PATH_PROG(PATH_TO_PING6,ping6)
828 AC_ARG_WITH(ping_command,
829 ACX_HELP_STRING([--with-ping-command=SYNTAX],
830 [sets syntax for ICMP ping]),
831 with_ping_command=$withval,)
833 AC_MSG_CHECKING(for ICMP ping syntax)
834 ac_cv_ping_packets_first=no
835 ac_cv_ping_has_timeout=no
836 if test -n "$with_ping_command"
837 then
838 AC_MSG_RESULT([(command-line) $with_ping_command])
839 if test -n "$ac_cv_ping_packets_first"
840 then
841 ac_cv_ping_packets_first=yes
842 fi
844 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
845 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
846 egrep -i "^round-trip|^rtt" >/dev/null
847 then
848 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
849 ac_cv_ping_packets_first=yes
850 AC_MSG_RESULT([$with_ping_command])
852 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
853 egrep -i "^round-trip|^rtt" >/dev/null
854 then
855 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
856 ac_cv_ping_packets_first=yes
857 ac_cv_ping_has_timeout=yes
858 AC_MSG_RESULT([$with_ping_command])
860 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
861 egrep -i "^round-trip|^rtt" >/dev/null
862 then
863 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
864 ac_cv_ping_packets_first=yes
865 AC_MSG_RESULT([$with_ping_command])
867 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
868 egrep -i "^round-trip|^rtt" >/dev/null
869 then
870 with_ping_command="$PATH_TO_PING -n -c %d %s"
871 ac_cv_ping_packets_first=yes
872 AC_MSG_RESULT([$with_ping_command])
874 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
875 egrep -i "^round-trip|^rtt" >/dev/null
876 then
877 with_ping_command="$PATH_TO_PING -n %s -c %d"
878 AC_MSG_RESULT([$with_ping_command])
880 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
881 egrep -i "^round-trip|^rtt" >/dev/null
882 then
883 with_ping_command="$PATH_TO_PING %s -n %d"
884 AC_MSG_RESULT([$with_ping_command])
886 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
887 egrep -i "^round-trip|^rtt" >/dev/null
888 then
889 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
890 AC_MSG_RESULT([$with_ping_command])
892 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
893 egrep -i "^round-trip|^rtt" >/dev/null
894 then
895 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
896 AC_MSG_RESULT([$with_ping_command])
898 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
899 egrep -i "^round-trip|^rtt" >/dev/null
900 then
901 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
902 ac_cv_ping_packets_first=yes
903 AC_MSG_RESULT([$with_ping_command])
905 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
906 egrep -i "^round-trip|^rtt" >/dev/null
907 then
908 with_ping_command="$PATH_TO_PING -n -c %d %s"
909 ac_cv_ping_packets_first=yes
910 AC_MSG_RESULT([$with_ping_command])
912 else
913 AC_MSG_WARN([unable to find usable ping syntax])
914 fi
916 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
917 [path and args for ICMP ping command])
919 if test "x$ac_cv_ping_packets_first" != "xno"
920 then
921 AC_DEFINE(PING_PACKETS_FIRST,1,
922 [Define if packet count must precede host])
923 fi
925 if test "x$ac_cv_ping_has_timeout" != "xno"
926 then
927 AC_DEFINE(PING_HAS_TIMEOUT,1,
928 [Define if ping has its own timeout option that should be set])
929 fi
931 AC_ARG_WITH(ping6_command,
932 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
933 [sets syntax for ICMPv6 ping]),
934 with_ping6_command=$withval,)
936 if test x"$with_ipv6" != xno ; then
937 AC_MSG_CHECKING(for ICMPv6 ping syntax)
938 ac_cv_ping6_packets_first=no
939 if test -n "$with_ping6_command"
940 then
941 AC_MSG_RESULT([(command-line) $with_ping6_command])
942 if test -n "$ac_cv_ping6_packets_first"
943 then
944 ac_cv_ping6_packets_first=yes
945 fi
947 elif test "x$PATH_TO_PING6" != "x"; then
948 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
949 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
950 egrep -i "^round-trip|^rtt" >/dev/null
951 then
952 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
953 ac_cv_ping6_packets_first=yes
954 AC_MSG_RESULT([$with_ping6_command])
956 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
957 egrep -i "^round-trip|^rtt" >/dev/null
958 then
959 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
960 ac_cv_ping6_packets_first=yes
961 AC_MSG_RESULT([$with_ping6_command])
963 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
964 egrep -i "^round-trip|^rtt" >/dev/null
965 then
966 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
967 ac_cv_ping6_packets_first=yes
968 AC_MSG_RESULT([$with_ping6_command])
970 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
971 egrep -i "^round-trip|^rtt" >/dev/null
972 then
973 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
974 AC_MSG_RESULT([$with_ping6_command])
976 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
977 egrep -i "^round-trip|^rtt" >/dev/null
978 then
979 with_ping6_command="$PATH_TO_PING6 %s -n %d"
980 AC_MSG_RESULT([$with_ping6_command])
982 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
983 egrep -i "^round-trip|^rtt" >/dev/null
984 then
985 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
986 AC_MSG_RESULT([$with_ping6_command])
988 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
989 egrep -i "^round-trip|^rtt" >/dev/null
990 then
991 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
992 AC_MSG_RESULT([$with_ping6_command])
994 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
995 egrep -i "^round-trip|^rtt" >/dev/null
996 then
997 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
998 ac_cv_ping6_packets_first=yes
999 AC_MSG_RESULT([$with_ping_command])
1001 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1002 egrep -i "^round-trip|^rtt" >/dev/null
1003 then
1004 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1005 ac_cv_ping6_packets_first=yes
1006 AC_MSG_RESULT([$with_ping6_command])
1008 fi
1010 elif test "x$PATH_TO_PING" != "x"; then
1011 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1012 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1013 egrep -i "^round-trip|^rtt" >/dev/null
1014 then
1015 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1016 ac_cv_ping6_packets_first=yes
1017 AC_MSG_RESULT([$with_ping6_command])
1019 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1020 egrep -i "^round-trip|^rtt" >/dev/null
1021 then
1022 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1023 ac_cv_ping6_packets_first=yes
1024 AC_MSG_RESULT([$with_ping6_command])
1026 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1027 egrep -i "^round-trip|^rtt" >/dev/null
1028 then
1029 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1030 ac_cv_ping6_packets_first=yes
1031 AC_MSG_RESULT([$with_ping6_command])
1033 elif $PATH_TO_PING -A inet6 -n ::1 -c 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 -c %d"
1037 AC_MSG_RESULT([$with_ping6_command])
1039 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1040 egrep -i "^round-trip|^rtt" >/dev/null
1041 then
1042 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1043 AC_MSG_RESULT([$with_ping6_command])
1045 elif $PATH_TO_PING -A inet6 -n -s ::1 56 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 %s 56 %d"
1049 AC_MSG_RESULT([$with_ping6_command])
1051 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1052 egrep -i "^round-trip|^rtt" >/dev/null
1053 then
1054 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1055 AC_MSG_RESULT([$with_ping6_command])
1057 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1058 egrep -i "^round-trip|^rtt" >/dev/null
1059 then
1060 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1061 ac_cv_ping6_packets_first=yes
1062 AC_MSG_RESULT([$with_ping_command])
1064 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1065 egrep -i "^round-trip|^rtt" >/dev/null
1066 then
1067 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1068 ac_cv_ping6_packets_first=yes
1069 AC_MSG_RESULT([$with_ping6_command])
1071 fi
1073 fi
1075 if test "x$with_ping6_command" != "x"; then
1076 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1077 [path and args for ICMPv6 ping command])
1078 else
1079 AC_MSG_RESULT([none])
1080 fi
1082 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1083 AC_DEFINE(PING6_PACKETS_FIRST,1,
1084 [Define if packet count must precede host])
1085 fi
1086 fi
1088 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1090 AC_MSG_CHECKING(for nslookup syntax)
1091 if test -n "$PATH_TO_NSLOOKUP"
1092 then
1093 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1094 then
1095 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1096 AC_MSG_RESULT([$ac_cv_nslookup_command])
1098 else
1099 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1100 AC_MSG_RESULT([$ac_cv_nslookup_command])
1102 fi
1103 EXTRAS="$EXTRAS check_dns"
1105 else
1106 AC_MSG_WARN([nslookup command not found])
1107 fi
1109 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1110 [path and args for nslookup])
1112 AC_PATH_PROG(PATH_TO_HOST,host)
1113 if test -n "$ac_cv_path_PATH_TO_HOST"
1114 then
1115 EXTRAS="$EXTRAS check_dns"
1116 fi
1118 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1119 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1121 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1122 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1124 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1125 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1126 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1127 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1128 then
1129 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1130 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1131 else
1132 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1133 fi
1135 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1136 if test -x "$PATH_TO_LMSTAT"
1137 then
1138 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1139 else
1140 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1141 fi
1143 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1144 if test -x "$PATH_TO_SMBCLIENT"
1145 then
1146 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1147 else
1148 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1149 fi
1152 AC_PATH_PROG(PATH_TO_WHO,who)
1154 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1155 then
1156 ac_cv_path_to_who="$PATH_TO_WHO -q"
1157 else
1158 ac_cv_path_to_who="$PATH_TO_WHO"
1159 fi
1161 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1162 [path and arguments for invoking 'who'])
1164 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1165 if test -x "$PATH_TO_SNMPGET"
1166 then
1167 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1168 EXTRAS="$EXTRAS check_hpjd check_snmp"
1169 else
1170 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1171 fi
1173 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1174 if test -x "$PATH_TO_SNMPGETNEXT"
1175 then
1176 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1177 fi
1179 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1180 then
1181 AC_MSG_CHECKING(for Net::SNMP perl module)
1182 AC_MSG_RESULT([found])
1183 else
1184 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1185 fi
1187 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1188 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1190 if test -x "$PATH_TO_QUAKESTAT"
1191 then
1192 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1193 EXTRAS="$EXTRAS check_game"
1195 elif test -x "$PATH_TO_QSTAT"
1196 then
1197 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1198 EXTRAS="$EXTRAS check_game"
1199 else
1200 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1201 fi
1203 if test $ac_cv_path_to_qstat
1204 then
1205 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1206 [path to qstat/quakestat])
1207 fi
1209 AC_PATH_PROG(PATH_TO_FPING,fping)
1210 if test -x "$PATH_TO_FPING"
1211 then
1212 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1213 EXTRAS="$EXTRAS check_fping"
1214 else
1215 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1216 fi
1218 AC_PATH_PROG(PATH_TO_SSH,ssh)
1220 if test -x "$PATH_TO_SSH"
1221 then
1222 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1223 EXTRAS="$EXTRAS check_by_ssh"
1224 else
1225 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1226 fi
1229 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1230 if test -x "$PATH_TO_MAILQ"
1231 then
1232 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1233 else
1234 AC_MSG_WARN([Could not find mailq or eqivalent])
1235 fi
1237 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1238 if test -x "$PATH_TO_QMAIL_QSTAT"
1239 then
1240 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1241 else
1242 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1243 fi
1245 dnl SWAP info required is amount allocated/available and amount free
1246 dnl The plugin works through all the swap devices and adds up the total swap
1247 dnl available.
1248 AC_PATH_PROG(PATH_TO_SWAP,swap)
1249 if (test -n "$PATH_TO_SWAP")
1250 then
1251 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1252 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1253 then
1254 ac_cv_have_swap=yes
1255 ac_cv_swap_command="$PATH_TO_SWAP -l"
1256 if [$PATH_TO_SWAP -l 2>/dev/null | \
1257 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1258 >/dev/null]
1259 then
1260 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1261 ac_cv_swap_conv=2048
1262 AC_MSG_RESULT([using IRIX format swap])
1264 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1265 then
1266 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1267 ac_cv_swap_conv=2048
1268 AC_MSG_RESULT([using Unixware format swap])
1269 else
1270 dnl if we don't know what format swap's output is
1271 dnl we might as well pretend we didn't see it
1272 ac_cv_have_swap=""
1273 ac_cv_swap_command=""
1274 fi
1275 fi
1276 dnl end if for PATH_TO_SWAP
1277 fi
1279 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1280 if (test -n "$PATH_TO_SWAPINFO")
1281 then
1282 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1283 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1284 then
1285 ac_cv_have_swap=yes
1286 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1288 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1289 then
1290 ac_cv_swap_format=["%*s %d %*d %d"]
1291 ac_cv_swap_conv=1024
1292 AC_MSG_RESULT([using FreeBSD format swapinfo])
1293 fi
1295 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1296 then
1297 ac_cv_have_swap=yes
1298 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1299 ac_cv_swap_format=["%*s %d %*d %d"]
1300 ac_cv_swap_conv=1024
1301 AC_MSG_RESULT([using HP-UX format swapinfo])
1302 fi
1303 dnl end if for PATH_TO_SWAPINFO
1304 fi
1306 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1307 if (test -n "$PATH_TO_LSPS")
1308 then
1309 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1310 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1311 then
1312 ac_cv_have_swap=yes
1313 ac_cv_swap_command="$PATH_TO_LSPS -a"
1314 ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
1315 ac_cv_swap_conv=1
1316 AC_MSG_RESULT([using AIX lsps])
1317 fi
1318 dnl end if for PATH_TO_SWAPINFO
1319 fi
1321 dnl
1322 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1323 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1324 dnl in the various BSD's
1325 dnl
1327 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1328 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1329 #ifdef HAVE_SYS_PARAM_H
1330 #include <sys/param.h>
1331 #endif
1332 ])
1333 AC_CHECK_DECLS([swapctl],,,[
1334 #include <unistd.h>
1335 #include <sys/types.h>
1336 #include <sys/param.h>
1337 #include <sys/stat.h>
1338 #include <sys/swap.h>
1339 ])
1340 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1341 #include <sys/types.h>
1342 #include <sys/param.h>
1343 #include <sys/stat.h>
1344 #include <sys/swap.h>
1345 ])
1346 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1347 #include <unistd.h>
1348 #include <sys/types.h>
1349 #include <sys/param.h>
1350 #include <sys/stat.h>
1351 #include <sys/swap.h>
1352 ])
1354 if test "$ac_cv_have_decl_swapctl" = "yes";
1355 then
1356 EXTRAS="$EXTRAS check_swap"
1357 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1358 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1359 "$ac_cv_type_swapent_t" = "yes";
1360 then
1361 AC_MSG_RESULT([yes])
1362 ac_cv_check_swap_swapctl_svr4="1";
1363 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1364 [Define if 2-argument SVR4 swapctl exists])
1365 else
1366 AC_MSG_RESULT([no])
1367 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1368 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1369 then
1370 AC_MSG_RESULT([yes])
1371 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1372 [Define if 3-argument BSD swapctl exists])
1373 else
1374 AC_MSG_RESULT([no])
1375 fi
1376 fi
1377 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1378 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1379 then
1380 dnl
1381 dnl the SVR4 spec returns values in pages
1382 dnl
1383 AC_MSG_RESULT([page])
1384 AC_CHECK_DECLS([sysconf])
1385 AC_MSG_CHECKING([for system page size])
1386 if test "$ac_cv_have_decl_sysconf" = "yes";
1387 then
1388 AC_MSG_RESULT([determined by sysconf(3)])
1389 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1390 else
1391 AC_MSG_WARN([don't know. guessing 4096k])
1392 ac_cv_swap_conv=256
1393 fi
1394 else
1395 dnl
1396 dnl the BSD spec returns values in blocks
1397 dnl
1398 AC_MSG_RESULT([blocks (assuming 512b)])
1399 ac_cv_swap_conv=2048
1400 fi
1401 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1402 [Conversion factor to MB])
1403 fi
1404 dnl
1405 dnl end tests for the swapctl system calls
1406 dnl
1409 if test "x$ac_cv_have_swap" != "x"
1410 then
1411 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1412 EXTRAS="$EXTRAS check_swap"
1413 fi
1414 if test "x$ac_cv_swap_command" != "x"
1415 then
1416 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1417 [Path to swap/swapinfo binary, with any args])
1418 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1419 [Format string for parsing swap output])
1420 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1421 [Conversion factor to MB])
1422 fi
1424 dnl dunno why this does not work below - use hack (kbd)
1425 dnl fine on linux, broken on solaris
1426 dnl if /bin/test -e "/proc/meminfo"
1427 AC_MSG_CHECKING([for /proc/meminfo])
1428 if [cat /proc/meminfo > /dev/null 2>&1]
1429 then
1430 AC_MSG_RESULT([found /proc/meminfo])
1431 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1432 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1433 EXTRAS="$EXTRAS check_swap"
1434 else
1435 AC_MSG_RESULT([no])
1436 fi
1438 AC_PATH_PROG(PATH_TO_DIG,dig)
1439 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1440 if test -n "$PATH_TO_DIG"; then
1441 EXTRAS="$EXTRAS check_dig"
1442 fi
1444 if test -f plugins/check_nt.c ; then
1445 EXTRAS="$EXTRAS check_nt"
1446 elif test -f ../plugins/check_nt.c ; then
1447 EXTRAS="$EXTRAS check_nt"
1448 fi
1450 AC_MSG_CHECKING(for va_list)
1451 AC_TRY_COMPILE([#ifdef __STDC__
1452 #include <stdio.h>
1453 #include <stdlib.h>
1454 #include <stdarg.h>
1455 #else
1456 #include <sys/types.h>
1457 #include <stdio.h>
1458 #include <varargs.h>
1459 #endif],
1460 [va_list args;],
1461 [AC_MSG_RESULT(yes)],
1462 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1464 AC_SUBST(EXTRAS)
1465 AC_SUBST(EXTRA_NETOBJS)
1466 AC_SUBST(DEPLIBS)
1468 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1469 AM_GNU_GETTEXT_VERSION(0.11.5)
1471 dnl External libraries - see ACKNOWLEDGEMENTS
1472 np_COREUTILS
1473 np_CURL
1475 AC_OUTPUT(
1476 Makefile
1477 lib/Makefile
1478 m4/Makefile
1479 plugins/Makefile
1480 plugins-scripts/Makefile
1481 plugins-scripts/subst
1482 plugins-scripts/utils.pm
1483 plugins-scripts/utils.sh
1484 command.cfg
1485 test.pl
1486 pkg/solaris/pkginfo
1487 intl/Makefile
1488 po/Makefile.in
1489 )
1491 ACX_FEATURE([with],[cgiurl])
1492 ACX_FEATURE([with],[nagios-user])
1493 ACX_FEATURE([with],[nagios-group])
1494 ACX_FEATURE([with],[trusted-path])
1495 ACX_FEATURE([with],[ping-command])
1496 ACX_FEATURE([with],[ping6-command])
1497 ACX_FEATURE([with],[lwres])
1498 ACX_FEATURE([with],[ipv6])
1499 ACX_FEATURE([with],[openssl])
1500 ACX_FEATURE([enable],[emulate-getaddrinfo])