1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.59)
4 AC_INIT(nagios-plugins,1.4.12)
5 AC_CONFIG_SRCDIR(NPTest.pm)
6 AC_CONFIG_FILES(gl/Makefile)
7 AC_CONFIG_AUX_DIR(build-aux)
8 AM_INIT_AUTOMAKE([1.8.3])
9 AM_CONFIG_HEADER(config.h)
10 AC_CANONICAL_HOST
12 RELEASE=1
13 AC_SUBST(RELEASE)
15 AC_PREFIX_DEFAULT(/usr/local/nagios)
17 dnl Deprecated configure options
20 dnl Append user (-o), group (-g), mode (-m) to install command
21 dnl There is an assumption that this is possible with ./configure's chosen install command
22 extra_install_args=""
23 AC_ARG_WITH(nagios_user,
24 ACX_HELP_STRING([--with-nagios-user=USER],
25 [Installs executables with this user. Defaults to install user]),
26 extra_install_args="-o $withval")
27 AC_ARG_WITH(nagios_group,
28 ACX_HELP_STRING([--with-nagios-group=GROUP],
29 [Installs executables with this group. Defaults to install user]),
30 extra_install_args="$extra_install_args -g $withval")
31 AC_ARG_WITH(world_permissions,
32 ACX_HELP_STRING([--without-world-permissions],
33 [Installs executables without world permissions]))
35 if test "x$with_world_permissions" = xno ; then
36 extra_install_args="$extra_install_args -m 0550"
37 fi
39 INSTALL="$INSTALL $extra_install_args"
40 INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args"
41 AC_SUBST(INSTALL)
43 AC_PROG_CC
44 gl_EARLY
45 AC_PROG_GCC_TRADITIONAL
46 AC_PROG_LIBTOOL
48 AM_PROG_CC_C_O
50 AC_FUNC_ERROR_AT_LINE
51 AC_SYS_LARGEFILE
53 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
55 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
56 AC_SUBST(PLUGIN_TEST)dnl
58 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
59 AC_SUBST(SCRIPT_TEST)dnl
61 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"
62 AC_SUBST(WARRANTY)
64 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"
65 AC_SUBST(SUPPORT)
67 dnl CGIURL has changed for Nagios with 1.0 beta
68 AC_ARG_WITH(cgiurl,
69 ACX_HELP_STRING([--with-cgiurl=DIR],
70 [sets URL for cgi programs]),
71 with_cgiurl=$withval,
72 with_cgiurl=/nagios/cgi-bin)
73 CGIURL="$with_cgiurl"
74 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
76 AC_ARG_WITH(trusted_path,
77 ACX_HELP_STRING([--with-trusted-path=PATH],
78 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
79 with_trusted_path=$withval,
80 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
81 AC_SUBST(with_trusted_path)
83 EXTRAS=
84 EXTRAS_ROOT=
85 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
87 LDFLAGS="$LDFLAGS -L."
89 ac_cv_uname_m=`uname -m`
90 ac_cv_uname_s=`uname -s`
91 ac_cv_uname_r=`uname -r`
92 ac_cv_uname_v=`uname -v`
94 PKG_ARCH=`uname -p`
95 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
96 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
98 AC_SUBST(PKG_ARCH)
99 AC_SUBST(REV_DATESTAMP)
100 AC_SUBST(REV_TIMESTAMP)
102 dnl Checks for programs.
103 AC_PATH_PROG(PYTHON,python)
104 AC_PATH_PROG(SH,sh)
105 AC_PATH_PROG(PERL,perl)
106 AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
107 AC_PATH_PROG(HOSTNAME,hostname)
108 AC_PATH_PROG(BASENAME,basename)
110 dnl allow them to override the path of perl
111 AC_ARG_WITH(perl,
112 ACX_HELP_STRING([--with-perl=PATH],
113 [sets path to perl executable]),
114 with_perl=$withval,with_perl=$PERL)
115 AC_SUBST(PERL, $with_perl)
117 dnl openssl/gnutls
118 AC_ARG_WITH(openssl,
119 AC_HELP_STRING([--with-openssl=DIR],
120 [path to openssl installation]),)
122 AC_ARG_WITH(gnutls,
123 ACX_HELP_STRING([--with-gnutls=PATH],
124 [path to gnutls installation root]),)
126 dnl you can only have one or the other
127 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
128 with_gnutls="no"
129 fi
130 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
131 with_openssl="no"
132 fi
134 dnl list of possible dirs to try to autodetect openssl
135 dnl if $dir/include exists, we consider it found
136 dnl the order should allow locally installed versions to override distros' ones
137 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
138 /opt /opt/openssl"
141 dnl
142 dnl Checks for libraries.
143 dnl
145 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
146 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
147 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
148 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
149 AC_SUBST(SOCKETLIBS)
151 dnl
152 dnl check for math-related functions needing -lm
153 AC_CHECK_HEADERS(math.h)
154 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
155 AC_SUBST(MATHLIBS)
157 dnl Check for libtap, to run perl-like tests
158 AC_CHECK_LIB(tap, plan_tests,
159 EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64"
160 AC_SUBST(EXTRA_TEST)
161 )
163 dnl INI Parsing
164 AC_ARG_ENABLE(extra-opts,
165 AC_HELP_STRING([--enable-extra-opts],
166 [Enables parsing of plugins ini config files for extra options (default: no)]),
167 [enable_extra_opts=$enableval],
168 [enable_extra_opts=no])
169 AM_CONDITIONAL([USE_PARSE_INI],[test "$enable_extra_opts" = "yes"])
170 if test "$enable_extra_opts" = "yes" ; then
171 EXTRA_TEST="$EXTRA_TEST test_ini test_opts"
172 AC_SUBST(EXTRA_TEST)
173 AC_DEFINE(NP_EXTRA_OPTS,[1],[Enable INI file parsing.])
174 fi
176 dnl Check for PostgreSQL libraries
177 _SAVEDLIBS="$LIBS"
178 _SAVEDCPPFLAGS="$CPPFLAGS"
179 AC_ARG_WITH(pgsql,
180 ACX_HELP_STRING([--with-pgsql=DIR],
181 [sets path to pgsql installation]),
182 PGSQL=$withval,)
183 AC_CHECK_LIB(crypt,main)
184 if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
185 if test -n "$PGSQL"; then
186 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
187 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
188 fi
189 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
190 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
191 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
192 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
193 AC_CHECK_HEADERS(libpq-fe.h)
194 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
195 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
196 PGINCLUDE="-I$PGSQL/include"
197 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
198 PGLIBS="-lpq -lcrypt"
199 PGINCLUDE="-I/usr/include/pgsql"
200 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
201 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
202 PGINCLUDE="-I/usr/include/postgresql"
203 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
204 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
205 PGINCLUDE="-I$PGSQL/include"
206 fi
207 if test -z "$PGINCLUDE"; then
208 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
209 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
210 else
211 AC_SUBST(PGLIBS)
212 AC_SUBST(PGINCLUDE)
213 EXTRAS="$EXTRAS check_pgsql"
214 fi
215 else
216 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
217 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
218 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
219 fi
220 else
221 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
222 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
223 fi
224 LIBS="$_SAVEDLIBS"
225 CPPFLAGS="$_SAVEDCPPFLAGS"
227 dnl Check for radius libraries
228 _SAVEDLIBS="$LIBS"
229 AC_CHECK_LIB(radiusclient,rc_read_config)
230 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
231 EXTRAS="$EXTRAS check_radius"
232 RADIUSLIBS="-lradiusclient"
233 AC_SUBST(RADIUSLIBS)
234 else
235 AC_CHECK_LIB(radiusclient-ng,rc_read_config)
236 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
237 EXTRAS="$EXTRAS check_radius"
238 RADIUSLIBS="-lradiusclient-ng"
239 AC_SUBST(RADIUSLIBS)
240 else
241 AC_MSG_WARN([Skipping radius plugin])
242 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
243 fi
244 fi
245 LIBS="$_SAVEDLIBS"
247 dnl Check for LDAP libraries
248 _SAVEDLIBS="$LIBS"
249 AC_CHECK_LIB(ldap,main,,,-llber)
250 if test "$ac_cv_lib_ldap_main" = "yes"; then
251 LDAPLIBS="-lldap -llber"\
252 LDAPINCLUDE="-I/usr/include/ldap"
253 AC_SUBST(LDAPLIBS)
254 AC_SUBST(LDAPINCLUDE)
255 AC_CHECK_FUNCS(ldap_set_option)
256 EXTRAS="$EXTRAS check_ldap"
257 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
258 else
259 AC_MSG_WARN([Skipping LDAP plugin])
260 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
261 fi
262 LIBS="$_SAVEDLIBS"
264 dnl Check for headers used by check_ide_smart
265 AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
266 if test "$FOUNDINCLUDE" = "yes" ; then
267 AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
268 fi
270 if test "$FOUNDINCLUDE" = "yes" ; then
271 EXTRAS="$EXTRAS check_ide_smart"
272 else
273 AC_MSG_WARN([Skipping check_ide_smart plugin.])
274 AC_MSG_WARN([check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h.])
275 fi
277 dnl Check for mysql libraries
278 np_mysqlclient
279 if test $with_mysql = "no" ; then
280 AC_MSG_WARN([Skipping mysql plugin])
281 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
282 else
283 EXTRAS="$EXTRAS check_mysql check_mysql_query"
284 MYSQLINCLUDE="$np_mysql_include"
285 MYSQLLIBS="$np_mysql_libs"
286 MYSQLCFLAGS="$np_mysql_cflags"
287 AC_SUBST(MYSQLINCLUDE)
288 AC_SUBST(MYSQLLIBS)
289 AC_SUBST(MYSQLCFLAGS)
290 fi
292 AC_ARG_WITH([ipv6],
293 [AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
294 [], [with_ipv6=check])
296 dnl Check for AF_INET6 support - unistd.h required for Darwin
297 if test "$with_ipv6" != "no"; then
298 AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
299 AC_TRY_COMPILE(
300 [#ifdef HAVE_UNISTD_H
301 #include <unistd.h>
302 #endif
303 #include <netinet/in.h>
304 #include <sys/socket.h>],
305 [struct sockaddr_in6 sin6;
306 void *p;
308 sin6.sin6_family = AF_INET6;
309 sin6.sin6_port = 587;
310 p = &sin6.sin6_addr;],
311 [np_cv_sys_ipv6=yes],
312 [np_cv_sys_ipv6=no])
313 ])
314 if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
315 AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
316 fi
317 if test "$np_cv_sys_ipv6" = "yes"; then
318 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
319 fi
320 with_ipv6="$np_cv_sys_ipv6"
321 fi
324 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
325 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
326 if test "$FOUNDINCLUDE" = "no"; then
327 _SAVEDCPPFLAGS="$CPPFLAGS"
328 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
329 unset ac_cv_header_krb5_h
330 AC_CHECK_HEADERS(krb5.h,
331 KRB5INCLUDE="-I/usr/kerberos/include"
332 FOUNDINCLUDE=yes,
333 FOUNDINCLUDE=no)
334 fi
335 AC_SUBST(KRBINCLUDE)
336 if test "$FOUNDINCLUDE" = "no"; then
337 CPPFLAGS="$_SAVEDCPPFLAGS"
338 fi
340 dnl *** The following block comes from wget configure.ac ***
341 dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
342 dnl shared library doesn't record its dependency on libdl, so we
343 dnl need to check for it ourselves so we won't fail to link due to a
344 dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
345 dnl shl_load().
346 AC_CHECK_LIB(dl,dlopen)
347 AC_CHECK_LIB(dl,shl_load)
349 dnl openssl detection/configuration
350 if ! test x"$with_openssl" = x"no"; then
351 dnl Check for OpenSSL location if it wasn't already specified
352 if ! test -d "$with_openssl"; then
353 for d in $OPENSSL_DIRS; do
354 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
355 with_openssl=$d
356 fi
357 done
358 fi
360 _SAVEDCPPFLAGS="$CPPFLAGS"
361 _SAVEDLDFLAGS="$LDFLAGS"
362 dnl Check for OpenSSL header files
363 unset FOUNDINCLUDE
364 if test x"$with_openssl" != x"/usr" ; then
365 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
366 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
367 fi
369 dnl check for openssl in $dir/include/openssl
370 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
371 SSLINCLUDE="-I$with_openssl/include"
372 FOUNDINCLUDE=yes,
373 FOUNDINCLUDE=no)
374 dnl else check to see if $dir/include has it
375 if test "$FOUNDINCLUDE" = "no"; then
376 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
377 SSLINCLUDE="-I$with_openssl/include"
378 FOUNDINCLUDE=yes,
379 FOUNDINCLUDE=no)
380 fi
381 AC_SUBST(SSLINCLUDE)
382 dnl if we didn't find it, reset CPPFLAGS
383 if test "$FOUNDINCLUDE" = "no"; then
384 CPPFLAGS="$_SAVEDCPPFLAGS"
385 LDFLAGS="$_SAVEDLDFLAGS"
386 fi
388 dnl Check for crypto lib
389 _SAVEDLIBS="$LIBS"
390 LIBS="-L${with_openssl}/lib"
391 AC_CHECK_LIB(crypto,CRYPTO_lock)
392 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
393 dnl Check for SSL lib
394 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
395 fi
396 LIBS="$_SAVEDLIBS"
398 dnl test headers and libs to decide whether check_http should use SSL
399 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
400 if test "$ac_cv_lib_ssl_main" = "yes"; then
401 if test "$FOUNDINCLUDE" = "yes"; then
402 FOUNDOPENSSL="yes"
403 fi
404 fi
405 fi
406 fi
409 dnl check for gnutls if openssl isn't found (or is disabled)
410 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
411 if test ! "$with_gnutls" = ""; then
412 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
413 elif test ! "$LIBGNUTLS_CONFIG" = ""; then
414 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
415 fi
416 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
417 if test "$FOUNDGNUTLS" = "yes"; then
418 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
419 fi
420 fi
421 dnl end check for gnutls
423 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
424 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
425 AC_SUBST(check_tcp_ssl)
426 AC_SUBST(SSLLIBS)
427 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
428 if test "$FOUNDOPENSSL" = "yes"; then
429 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
430 with_openssl="yes"
431 with_gnutls="no"
432 else
433 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
434 with_gnutls="yes"
435 with_openssl="no"
436 fi
437 else
438 dnl else deliberately disabled or no ssl support available
439 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
440 with_openssl="no"
441 with_gnutls="no"
442 fi
444 dnl
445 dnl Checks for header files.
446 dnl
448 AC_HEADER_TIME
449 AC_HEADER_SYS_WAIT
450 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
451 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
453 dnl Checks for typedefs, structures, and compiler characteristics.
454 AC_C_CONST
455 AC_STRUCT_TM
456 AC_TYPE_PID_T
457 AC_TYPE_SIZE_T
458 AC_TYPE_SIGNAL
459 AC_TYPE_MBSTATE_T
461 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
462 AC_TRY_LINK([#include <stdarg.h>
463 va_list ap1,ap2;], [va_copy(ap1,ap2);],
464 ac_cv_HAVE_VA_COPY=yes,
465 ac_cv_HAVE_VA_COPY=no)])
466 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
467 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
468 else
469 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
470 AC_TRY_LINK([#include <stdarg.h>
471 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
472 ac_cv_HAVE___VA_COPY=yes,
473 ac_cv_HAVE___VA_COPY=no)])
474 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
475 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
476 fi
477 fi
479 AC_TRY_COMPILE([#include <sys/time.h>],
480 [struct timeval *tv;
481 struct timezone *tz;],
482 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
483 AC_TRY_COMPILE([#include <sys/time.h>],
484 [struct timeval *tv;
485 struct timezone *tz;
486 gettimeofday(tv, tz);],
487 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
488 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
490 dnl Checks for library functions.
491 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
492 AC_CHECK_FUNCS(poll)
494 AC_MSG_CHECKING(return type of socket size)
495 AC_TRY_COMPILE([#include <stdlib.h>
496 #include <sys/types.h>
497 #include <sys/socket.h>],
498 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
499 ac_cv_socket_size_type=["size_t"]
500 AC_MSG_RESULT(size_t),
501 ac_cv_socket_size_type=["int"]
502 AC_MSG_RESULT(int))
504 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
505 [Define type of socket size])
508 dnl #### Process table test
510 AC_PATH_PROG(PATH_TO_PS,ps)
512 AC_MSG_CHECKING(for ps syntax)
513 AC_ARG_WITH(ps_command,
514 ACX_HELP_STRING([--with-ps-command=PATH],
515 [Verbatim command to execute for ps]),
516 PS_COMMAND=$withval)
517 AC_ARG_WITH(ps_format,
518 ACX_HELP_STRING([--with-ps-format=FORMAT],
519 [Format string for scanning ps output]),
520 PS_FORMAT=$withval)
521 AC_ARG_WITH(ps_cols,
522 ACX_HELP_STRING([--with-ps-cols=NUM],
523 [Number of columns in ps command]),
524 PS_COLS=$withval)
525 AC_ARG_WITH(ps_varlist,
526 ACX_HELP_STRING([--with-ps-varlist=LIST],
527 [Variable list for sscanf of 'ps' output]),
528 PS_VARLIST=$withval)
530 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
531 ac_cv_ps_command="$PS_COMMAND"
532 ac_cv_ps_format="$PS_FORMAT"
533 ac_cv_ps_varlist="$PS_VARLIST"
534 ac_cv_ps_cols="$PS_COLS"
535 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
537 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
538 elif test "$ac_cv_uname_s" = "SunOS"; then
539 #
540 # this is a very, very ugly hack, to hardcode the location for plugins
541 #
542 if test "$libexecdir" = '${exec_prefix}/libexec'; then
543 if test "$exec_prefix" = "NONE"; then
544 if test "$prefix" = "NONE"; then
545 pst3="$ac_default_prefix/libexec/pst3"
546 else
547 pst3="$prefix/libexec/pst3"
548 fi
549 else
550 pst3="$exec_prefix/libexec/pst3"
551 fi
552 else
553 pst3="$libexecdir/pst3"
554 fi
555 ac_cv_ps_command="$pst3"
556 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
557 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
558 ac_cv_ps_cols=9
559 AC_MSG_RESULT([using nagios-plugins internal ps command (pst3) for solaris])
560 if test `isainfo -b` = 64 ; then
561 PST3CFLAGS="-m64"
562 AC_SUBST(PST3CFLAGS)
563 AC_MSG_NOTICE([using 64bit pst3])
564 else
565 AC_MSG_NOTICE([using 32bit pst3])
566 fi
567 EXTRAS_ROOT="$EXTRAS_ROOT pst3"
569 dnl Removing this for the moment - Ton
570 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
571 dnl Limitation that command name is not available
572 dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
573 dnl egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
574 dnl then
575 dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
576 dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
577 dnl ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
578 dnl ac_cv_ps_cols=8
579 dnl AC_MSG_RESULT([$ac_cv_ps_command])
581 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
582 dnl so test for this first...
583 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
584 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
585 then
586 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
587 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
588 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
589 ac_cv_ps_cols=9
590 AC_MSG_RESULT([$ac_cv_ps_command])
592 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
593 dnl Should also work for FreeBSD 5.2.1 and 5.3
594 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
595 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
596 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
597 then
598 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
599 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
600 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
601 ac_cv_ps_cols=9
602 AC_MSG_RESULT([$ac_cv_ps_command])
604 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
605 dnl Limitation: Only first 16 chars returned for ucomm field
606 dnl Must come before ps -weo
607 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
608 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
609 then
610 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
611 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
612 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
613 ac_cv_ps_cols=9
614 AC_MSG_RESULT([$ac_cv_ps_command])
616 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
617 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
618 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
619 then
620 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
621 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
622 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
623 ac_cv_ps_cols=10
624 AC_MSG_RESULT([$ac_cv_ps_command])
626 dnl FreeBSD
627 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
628 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
629 then
630 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
631 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
632 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
633 ac_cv_ps_cols=9
634 AC_MSG_RESULT([$ac_cv_ps_command])
636 dnl BSD-like mode in RH 6.1
637 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
638 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
639 then
640 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
641 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
642 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
643 ac_cv_ps_cols=9
644 AC_MSG_RESULT([$ac_cv_ps_command])
646 dnl SunOS 4.1.3:
647 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
648 dnl Need the head -1 otherwise test will work because arguments are found
649 elif ps -laxnwww 2>/dev/null | head -1 | \
650 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
651 then
652 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
653 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
654 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
655 ac_cv_ps_cols=9
656 AC_MSG_RESULT([$ac_cv_ps_command])
658 dnl Debian Linux / procps v1.2.9:
659 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
660 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
661 dnl
662 elif ps laxnwww 2>/dev/null | \
663 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
664 then
665 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
666 ac_cv_ps_command="$PATH_TO_PS laxnwww"
667 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
668 ac_cv_ps_cols=9
669 AC_MSG_RESULT([$ac_cv_ps_command])
671 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
672 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
673 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
674 then
675 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
676 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
677 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
678 ac_cv_ps_cols=9
679 AC_MSG_RESULT([$ac_cv_ps_command])
681 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
682 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
683 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
684 dnl of 1500). Will need big changes to check_procs to support
685 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
686 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
687 then
688 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
689 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
690 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
691 ac_cv_ps_cols=8
692 AC_MSG_RESULT([$ac_cv_ps_command])
694 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
695 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
696 then
697 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
698 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
699 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
700 ac_cv_ps_cols=9
701 AC_MSG_RESULT([$ac_cv_ps_command])
703 dnl AIX 4.3.3 and 5.1 do not have an rss field
704 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
705 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
706 then
707 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
708 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
709 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
710 ac_cv_ps_cols=8
711 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
713 dnl Solaris 2.6
714 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
715 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
716 then
717 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
718 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
719 # There must be no space between the %s and %n due to a wierd problem in sscanf where
720 # it will return %n as longer than the line length
721 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
722 ac_cv_ps_cols=9
723 AC_MSG_RESULT([$ac_cv_ps_command])
725 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
726 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
727 then
728 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
729 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
730 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
731 ac_cv_ps_cols=9
732 AC_MSG_RESULT([$ac_cv_ps_command])
734 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
735 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
736 then
737 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
738 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
739 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
740 ac_cv_ps_cols=9
741 AC_MSG_RESULT([$ac_cv_ps_command])
743 dnl wonder who takes state instead of stat
744 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
745 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
746 then
747 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
748 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
749 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
750 ac_cv_ps_cols=8
751 AC_MSG_RESULT([$ac_cv_ps_command])
753 dnl IRIX 53
754 elif ps -el 2>/dev/null | \
755 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
756 then
757 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
758 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
759 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
760 ac_cv_ps_cols=8
761 AC_MSG_RESULT([$ac_cv_ps_command])
763 dnl IRIX 63
764 elif ps -el 2>/dev/null | \
765 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
766 then
767 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
768 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
769 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
770 ac_cv_ps_cols=6
771 AC_MSG_RESULT([$ac_cv_ps_command])
773 dnl AIX 4.1:
774 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
775 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
776 elif ps -el 2>/dev/null | \
777 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
778 then
779 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
780 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
781 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
782 ac_cv_ps_cols=6
783 AC_MSG_RESULT([$ac_cv_ps_command])
785 dnl AIX?
786 elif ps glaxen 2>/dev/null | \
787 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
788 then
789 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
790 ac_cv_ps_command="$PATH_TO_PS glaxen"
791 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
792 ac_cv_ps_cols=8
793 AC_MSG_RESULT([$ac_cv_ps_command])
795 dnl MacOSX / Darwin
796 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
797 dnl Some truncation will happen in UCOMM column
798 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
799 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
800 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
801 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
802 then
803 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
804 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
805 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
806 ac_cv_ps_cols=8
807 AC_MSG_RESULT([$ac_cv_ps_command])
809 dnl UnixWare
810 elif ps -Al 2>/dev/null | \
811 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
812 then
813 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
814 ac_cv_ps_command="$PATH_TO_PS -Al"
815 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
816 ac_cv_ps_cols=8
817 AC_MSG_RESULT([$ac_cv_ps_command])
819 else
820 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
821 fi
823 if test -n "$ac_cv_ps_varlist" ; then
824 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
825 [Variable list for sscanf of 'ps' output])
826 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
827 [Verbatim command to execute for ps in check_procs])
828 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
829 [Format string for scanning ps output in check_procs])
830 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
831 [Number of columns in ps command])
832 EXTRAS="$EXTRAS check_procs check_nagios"
833 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
834 AC_DEFINE(PS_USES_PROCETIME,"yes",
835 [Whether the ps utility uses the "procetime" field])
836 fi
837 fi
839 AC_PATH_PROG(PATH_TO_PING,ping)
840 AC_PATH_PROG(PATH_TO_PING6,ping6)
842 AC_ARG_WITH(ping_command,
843 ACX_HELP_STRING([--with-ping-command=SYNTAX],
844 [sets syntax for ICMP ping]),
845 with_ping_command=$withval,)
847 AC_MSG_CHECKING(for ICMP ping syntax)
848 ac_cv_ping_packets_first=no
849 ac_cv_ping_has_timeout=no
850 if test -n "$with_ping_command"
851 then
852 AC_MSG_RESULT([(command-line) $with_ping_command])
853 if test -n "$ac_cv_ping_packets_first"
854 then
855 ac_cv_ping_packets_first=yes
856 ac_cv_ping_has_timeout=yes
857 fi
859 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
860 $PATH_TO_PING -n -s 127.0.0.1 56 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 -U -w 10 -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 -U -w %d -c %d %s"
871 ac_cv_ping_packets_first=yes
872 ac_cv_ping_has_timeout=yes
873 AC_MSG_RESULT([$with_ping_command])
875 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
876 egrep -i "^round-trip|^rtt" >/dev/null
877 then
878 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
879 ac_cv_ping_packets_first=yes
880 AC_MSG_RESULT([$with_ping_command])
882 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
883 egrep -i "^round-trip|^rtt" >/dev/null
884 then
885 with_ping_command="$PATH_TO_PING -n -c %d %s"
886 ac_cv_ping_packets_first=yes
887 AC_MSG_RESULT([$with_ping_command])
889 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
890 egrep -i "^round-trip|^rtt" >/dev/null
891 then
892 with_ping_command="$PATH_TO_PING -n %s -c %d"
893 AC_MSG_RESULT([$with_ping_command])
895 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
896 egrep -i "^round-trip|^rtt" >/dev/null
897 then
898 with_ping_command="$PATH_TO_PING %s -n %d"
899 AC_MSG_RESULT([$with_ping_command])
901 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
902 egrep -i "^round-trip|^rtt" >/dev/null
903 then
904 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
905 AC_MSG_RESULT([$with_ping_command])
907 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
908 egrep -i "^round-trip|^rtt" >/dev/null
909 then
910 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
911 AC_MSG_RESULT([$with_ping_command])
913 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
914 egrep -i "^round-trip|^rtt" >/dev/null
915 then
916 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
917 ac_cv_ping_packets_first=yes
918 AC_MSG_RESULT([$with_ping_command])
920 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
921 egrep -i "^round-trip|^rtt" >/dev/null
922 then
923 with_ping_command="$PATH_TO_PING -n -c %d %s"
924 ac_cv_ping_packets_first=yes
925 AC_MSG_RESULT([$with_ping_command])
927 else
928 AC_MSG_WARN([unable to find usable ping syntax])
929 fi
931 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
932 [path and args for ICMP ping command])
934 if test "x$ac_cv_ping_packets_first" != "xno"
935 then
936 AC_DEFINE(PING_PACKETS_FIRST,1,
937 [Define if packet count must precede host])
938 fi
940 if test "x$ac_cv_ping_has_timeout" != "xno"
941 then
942 AC_DEFINE(PING_HAS_TIMEOUT,1,
943 [Define if ping has its own timeout option that should be set])
944 fi
946 AC_ARG_WITH(ping6_command,
947 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
948 [sets syntax for ICMPv6 ping]),
949 with_ping6_command=$withval,)
951 if test x"$with_ipv6" != xno ; then
952 AC_MSG_CHECKING(for ICMPv6 ping syntax)
953 ac_cv_ping6_packets_first=no
954 if test -n "$with_ping6_command"
955 then
956 AC_MSG_RESULT([(command-line) $with_ping6_command])
957 if test -n "$ac_cv_ping6_packets_first"
958 then
959 ac_cv_ping6_packets_first=yes
960 fi
962 elif test "x$PATH_TO_PING6" != "x"; then
963 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
964 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
965 egrep -i "^round-trip|^rtt" >/dev/null
966 then
967 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
968 ac_cv_ping6_packets_first=yes
969 AC_MSG_RESULT([$with_ping6_command])
971 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
972 egrep -i "^round-trip|^rtt" >/dev/null
973 then
974 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
975 ac_cv_ping6_packets_first=yes
976 ac_cv_ping_has_timeout=yes
977 AC_MSG_RESULT([$with_ping6_command])
979 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
980 egrep -i "^round-trip|^rtt" >/dev/null
981 then
982 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
983 ac_cv_ping6_packets_first=yes
984 AC_MSG_RESULT([$with_ping6_command])
986 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
987 egrep -i "^round-trip|^rtt" >/dev/null
988 then
989 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
990 ac_cv_ping6_packets_first=yes
991 AC_MSG_RESULT([$with_ping6_command])
993 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
994 egrep -i "^round-trip|^rtt" >/dev/null
995 then
996 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
997 AC_MSG_RESULT([$with_ping6_command])
999 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1000 egrep -i "^round-trip|^rtt" >/dev/null
1001 then
1002 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1003 AC_MSG_RESULT([$with_ping6_command])
1005 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1006 egrep -i "^round-trip|^rtt" >/dev/null
1007 then
1008 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1009 AC_MSG_RESULT([$with_ping6_command])
1011 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1012 egrep -i "^round-trip|^rtt" >/dev/null
1013 then
1014 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1015 AC_MSG_RESULT([$with_ping6_command])
1017 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1018 egrep -i "^round-trip|^rtt" >/dev/null
1019 then
1020 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1021 ac_cv_ping6_packets_first=yes
1022 AC_MSG_RESULT([$with_ping_command])
1024 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1025 egrep -i "^round-trip|^rtt" >/dev/null
1026 then
1027 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1028 ac_cv_ping6_packets_first=yes
1029 AC_MSG_RESULT([$with_ping6_command])
1031 fi
1033 elif test "x$PATH_TO_PING" != "x"; then
1034 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1035 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1036 egrep -i "^round-trip|^rtt" >/dev/null
1037 then
1038 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1039 ac_cv_ping6_packets_first=yes
1040 AC_MSG_RESULT([$with_ping6_command])
1042 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1043 egrep -i "^round-trip|^rtt" >/dev/null
1044 then
1045 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1046 ac_cv_ping6_packets_first=yes
1047 AC_MSG_RESULT([$with_ping6_command])
1049 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1050 egrep -i "^round-trip|^rtt" >/dev/null
1051 then
1052 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1053 ac_cv_ping6_packets_first=yes
1054 AC_MSG_RESULT([$with_ping6_command])
1056 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1057 egrep -i "^round-trip|^rtt" >/dev/null
1058 then
1059 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1060 AC_MSG_RESULT([$with_ping6_command])
1062 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1063 egrep -i "^round-trip|^rtt" >/dev/null
1064 then
1065 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1066 AC_MSG_RESULT([$with_ping6_command])
1068 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1069 egrep -i "^round-trip|^rtt" >/dev/null
1070 then
1071 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1072 AC_MSG_RESULT([$with_ping6_command])
1074 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1075 egrep -i "^round-trip|^rtt" >/dev/null
1076 then
1077 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1078 AC_MSG_RESULT([$with_ping6_command])
1080 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1081 egrep -i "^round-trip|^rtt" >/dev/null
1082 then
1083 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1084 ac_cv_ping6_packets_first=yes
1085 AC_MSG_RESULT([$with_ping_command])
1087 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1088 egrep -i "^round-trip|^rtt" >/dev/null
1089 then
1090 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1091 ac_cv_ping6_packets_first=yes
1092 AC_MSG_RESULT([$with_ping6_command])
1094 fi
1096 fi
1098 if test "x$with_ping6_command" != "x"; then
1099 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1100 [path and args for ICMPv6 ping command])
1101 else
1102 AC_MSG_RESULT([none])
1103 fi
1105 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1106 AC_DEFINE(PING6_PACKETS_FIRST,1,
1107 [Define if packet count must precede host])
1108 fi
1109 fi
1112 AC_ARG_WITH(nslookup_command,
1113 ACX_HELP_STRING([--with-nslookup-command=PATH],
1114 [sets path to nslookup executable]),
1115 ac_cv_nslookup_command=$withval)
1116 if test -n "$ac_cv_nslookup_command"; then
1117 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1118 else
1119 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1120 if test -n "$PATH_TO_NSLOOKUP"
1121 then
1122 AC_MSG_CHECKING(for nslookup syntax)
1123 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1124 then
1125 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1126 AC_MSG_RESULT([$ac_cv_nslookup_command])
1128 else
1129 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1130 AC_MSG_RESULT([$ac_cv_nslookup_command])
1132 fi
1133 else
1134 AC_MSG_WARN([nslookup command not found])
1135 fi
1136 fi
1138 if test -n "$ac_cv_nslookup_command"; then
1139 EXTRAS="$EXTRAS check_dns"
1140 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1141 fi
1143 AC_MSG_CHECKING([for number of cpus])
1144 AC_TRY_COMPILE([#include <unistd.h>],
1145 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1146 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
1147 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1148 AC_MSG_RESULT([cannot calculate])
1149 )
1151 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1152 AC_ARG_WITH(uptime_command,
1153 ACX_HELP_STRING([--with-uptime-command=PATH],
1154 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1155 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1157 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1158 AC_ARG_WITH(rpcinfo_command,
1159 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1160 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1161 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1163 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1164 if test -x "$PATH_TO_LMSTAT"
1165 then
1166 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1167 else
1168 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1169 fi
1171 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1172 AC_ARG_WITH(smbclient_command,
1173 ACX_HELP_STRING([--with-smbclient-command=PATH],
1174 [sets path to smbclient]),
1175 PATH_TO_SMBCLIENT=$withval)
1176 if test -n "$PATH_TO_SMBCLIENT"
1177 then
1178 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1179 else
1180 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1181 fi
1184 AC_PATH_PROG(PATH_TO_WHO,who)
1186 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1187 then
1188 ac_cv_path_to_who="$PATH_TO_WHO -q"
1189 else
1190 ac_cv_path_to_who="$PATH_TO_WHO"
1191 fi
1193 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1194 [path and arguments for invoking 'who'])
1196 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1197 AC_ARG_WITH(snmpget_command,
1198 ACX_HELP_STRING([--with-snmpget-command=PATH],
1199 [Path to snmpget command]),
1200 PATH_TO_SNMPGET=$withval)
1201 if test -n "$PATH_TO_SNMPGET"
1202 then
1203 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1204 EXTRAS="$EXTRAS check_hpjd check_snmp"
1205 else
1206 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1207 fi
1209 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1210 AC_ARG_WITH(snmpgetnext_command,
1211 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1212 [Path to snmpgetnext command]),
1213 PATH_TO_SNMPGETNEXT=$withval)
1214 if test -n "$PATH_TO_SNMPGETNEXT"
1215 then
1216 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1217 fi
1219 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1220 then
1221 AC_MSG_CHECKING(for Net::SNMP perl module)
1222 AC_MSG_RESULT([found])
1223 else
1224 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1225 fi
1227 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1228 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1229 AC_ARG_WITH(qstat_command,
1230 ACX_HELP_STRING([--with-qstat-command=PATH],
1231 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1233 if test -x "$PATH_TO_QUAKESTAT"
1234 then
1235 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1236 EXTRAS="$EXTRAS check_game"
1238 elif test -n "$PATH_TO_QSTAT"
1239 then
1240 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1241 EXTRAS="$EXTRAS check_game"
1242 else
1243 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1244 fi
1246 if test $ac_cv_path_to_qstat
1247 then
1248 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1249 [path to qstat/quakestat])
1250 fi
1252 AC_PATH_PROG(PATH_TO_FPING,fping)
1253 AC_ARG_WITH(fping_command,
1254 ACX_HELP_STRING([--with-fping-command=PATH],
1255 [Path to fping command]), PATH_TO_FPING=$withval)
1256 if test -n "$PATH_TO_FPING"
1257 then
1258 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1259 EXTRAS="$EXTRAS check_fping"
1260 else
1261 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1262 fi
1264 AC_PATH_PROG(PATH_TO_SSH,ssh)
1265 AC_ARG_WITH(ssh_command,
1266 ACX_HELP_STRING([--with-ssh-command=PATH],
1267 [sets path for ssh]), PATH_TO_SSH=$withval)
1268 if test -n "$PATH_TO_SSH"
1269 then
1270 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1271 EXTRAS="$EXTRAS check_by_ssh"
1272 else
1273 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1274 fi
1277 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1278 AC_ARG_WITH(mailq_command,
1279 ACX_HELP_STRING([--with-mailq-command=PATH],
1280 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1281 if test -n "$PATH_TO_MAILQ"
1282 then
1283 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1284 else
1285 AC_MSG_WARN([Could not find mailq or eqivalent])
1286 fi
1288 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1289 if test -x "$PATH_TO_QMAIL_QSTAT"
1290 then
1291 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1292 else
1293 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1294 fi
1296 dnl SWAP info required is amount allocated/available and amount free
1297 dnl The plugin works through all the swap devices and adds up the total swap
1298 dnl available.
1299 AC_PATH_PROG(PATH_TO_SWAP,swap)
1300 if (test -n "$PATH_TO_SWAP")
1301 then
1302 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1303 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1304 then
1305 ac_cv_have_swap=yes
1306 ac_cv_swap_command="$PATH_TO_SWAP -l"
1307 if [$PATH_TO_SWAP -l 2>/dev/null | \
1308 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1309 >/dev/null]
1310 then
1311 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1312 ac_cv_swap_conv=2048
1313 AC_MSG_RESULT([using IRIX format swap])
1315 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1316 then
1317 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1318 ac_cv_swap_conv=2048
1319 AC_MSG_RESULT([using Unixware format swap])
1320 else
1321 dnl if we don't know what format swap's output is
1322 dnl we might as well pretend we didn't see it
1323 ac_cv_have_swap=""
1324 ac_cv_swap_command=""
1325 fi
1326 fi
1327 dnl end if for PATH_TO_SWAP
1328 fi
1330 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1331 if (test -n "$PATH_TO_SWAPINFO")
1332 then
1333 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1334 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1335 then
1336 ac_cv_have_swap=yes
1337 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1339 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1340 then
1341 ac_cv_swap_format=["%*s %f %*d %f"]
1342 ac_cv_swap_conv=1024
1343 AC_MSG_RESULT([using FreeBSD format swapinfo])
1344 fi
1346 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1347 then
1348 ac_cv_have_swap=yes
1349 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1350 ac_cv_swap_format=["%*s %f %*d %f"]
1351 ac_cv_swap_conv=1024
1352 AC_MSG_RESULT([using HP-UX format swapinfo])
1353 fi
1354 dnl end if for PATH_TO_SWAPINFO
1355 fi
1357 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1358 if (test -n "$PATH_TO_LSPS")
1359 then
1360 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1361 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1362 then
1363 ac_cv_have_swap=yes
1364 ac_cv_swap_command="$PATH_TO_LSPS -a"
1365 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1366 ac_cv_swap_conv=1
1367 AC_MSG_RESULT([using AIX lsps])
1368 fi
1369 dnl end if for PATH_TO_SWAPINFO
1370 fi
1372 dnl
1373 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1374 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1375 dnl in the various BSD's
1376 dnl
1378 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1379 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1380 #ifdef HAVE_SYS_PARAM_H
1381 #include <sys/param.h>
1382 #endif
1383 ])
1384 AC_CHECK_DECLS([swapctl],,,[
1385 #include <unistd.h>
1386 #include <sys/types.h>
1387 #include <sys/param.h>
1388 #include <sys/stat.h>
1389 #include <sys/swap.h>
1390 ])
1391 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1392 #include <sys/types.h>
1393 #include <sys/param.h>
1394 #include <sys/stat.h>
1395 #include <sys/swap.h>
1396 ])
1397 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1398 #include <unistd.h>
1399 #include <sys/types.h>
1400 #include <sys/param.h>
1401 #include <sys/stat.h>
1402 #include <sys/swap.h>
1403 ])
1405 if test "$ac_cv_have_decl_swapctl" = "yes";
1406 then
1407 EXTRAS="$EXTRAS check_swap"
1408 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1409 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1410 "$ac_cv_type_swapent_t" = "yes";
1411 then
1412 AC_MSG_RESULT([yes])
1413 ac_cv_check_swap_swapctl_svr4="1";
1414 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1415 [Define if 2-argument SVR4 swapctl exists])
1416 else
1417 AC_MSG_RESULT([no])
1418 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1419 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1420 then
1421 AC_MSG_RESULT([yes])
1422 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1423 [Define if 3-argument BSD swapctl exists])
1424 else
1425 AC_MSG_RESULT([no])
1426 fi
1427 fi
1428 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1429 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1430 then
1431 dnl
1432 dnl the SVR4 spec returns values in pages
1433 dnl
1434 AC_MSG_RESULT([page])
1435 AC_CHECK_DECLS([sysconf])
1436 AC_MSG_CHECKING([for system page size])
1437 if test "$ac_cv_have_decl_sysconf" = "yes";
1438 then
1439 AC_MSG_RESULT([determined by sysconf(3)])
1440 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1441 else
1442 AC_MSG_WARN([don't know. guessing 4096k])
1443 ac_cv_swap_conv=256
1444 fi
1445 else
1446 dnl
1447 dnl the BSD spec returns values in blocks
1448 dnl
1449 AC_MSG_RESULT([blocks (assuming 512b)])
1450 ac_cv_swap_conv=2048
1451 fi
1452 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1453 [Conversion factor to MB])
1454 fi
1455 dnl
1456 dnl end tests for the swapctl system calls
1457 dnl
1460 if test "x$ac_cv_have_swap" != "x"
1461 then
1462 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1463 EXTRAS="$EXTRAS check_swap"
1464 fi
1465 if test "x$ac_cv_swap_command" != "x"
1466 then
1467 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1468 [Path to swap/swapinfo binary, with any args])
1469 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1470 [Format string for parsing swap output])
1471 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1472 [Conversion factor to MB])
1473 fi
1475 AC_ARG_WITH(proc-meminfo,
1476 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1477 [path to /proc/meminfo or equivalent]),
1478 ac_cv_proc_meminfo=$withval)
1479 dnl dunno why this does not work below - use hack (kbd)
1480 dnl fine on linux, broken on solaris
1481 dnl if /bin/test -e "/proc/meminfo"
1482 AC_MSG_CHECKING([for /proc/meminfo])
1483 if test -n "$ac_cv_proc_meminfo"; then
1484 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1485 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1486 AC_MSG_RESULT([found /proc/meminfo])
1487 ac_cv_proc_meminfo="/proc/meminfo"
1488 else
1489 AC_MSG_RESULT([no])
1490 fi
1492 if test -n "$ac_cv_proc_meminfo"; then
1493 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1494 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1495 EXTRAS="$EXTRAS check_swap"
1496 fi
1498 AC_PATH_PROG(PATH_TO_DIG,dig)
1499 AC_ARG_WITH(dig_command,
1500 ACX_HELP_STRING([--with-dig-command=PATH],
1501 [Path to dig command]), PATH_TO_DIG=$withval)
1502 if test -n "$PATH_TO_DIG"; then
1503 EXTRAS="$EXTRAS check_dig"
1504 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1505 fi
1507 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1508 AC_ARG_WITH(apt-get_command,
1509 ACX_HELP_STRING([--with-apt-get-command=PATH],
1510 [Path to apt-get command]),
1511 with_apt_get_command=$withval,
1512 with_apt_get_command=$PATH_TO_APTGET)
1513 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1514 if test -n "$PATH_TO_APTGET" ; then
1515 EXTRAS="$EXTRAS check_apt"
1516 fi
1519 if test -f plugins/check_nt.c ; then
1520 EXTRAS="$EXTRAS check_nt"
1521 elif test -f ../plugins/check_nt.c ; then
1522 EXTRAS="$EXTRAS check_nt"
1523 fi
1526 dnl used in check_dhcp
1527 AC_CHECK_HEADERS(sys/sockio.h)
1529 case $host in
1530 *bsd*)
1531 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1532 ;;
1533 *linux*)
1534 AC_DEFINE(__linux__,1,[linux specific code in check_dhcp.c])
1535 ;;
1536 *sun* | *solaris*)
1537 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1538 ;;
1539 *hpux*)
1540 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1541 ;;
1542 esac
1544 AC_SUBST(EXTRAS)
1545 AC_SUBST(EXTRAS_ROOT)
1546 AC_SUBST(EXTRA_NETOBJS)
1547 AC_SUBST(DEPLIBS)
1549 AM_GNU_GETTEXT([external], [need-ngettext])
1550 AM_GNU_GETTEXT_VERSION(0.15)
1552 dnl Check for Redhat spopen problem
1553 dnl Wierd problem where ECHILD is returned from a wait call in error
1554 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1555 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1556 dnl We patch plugins/popen.c
1557 dnl Need to add smp because uname different on those
1558 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1559 AC_ARG_ENABLE(redhat-pthread-workaround,
1560 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1561 [force Redhat patch to be applied (default: test system)]),
1562 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1563 [ac_cv_enable_redhat_pthread_workaround=test])
1564 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1565 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1566 AC_MSG_NOTICE([See http://nagiosplugins.org/faq/compile/configure_appears_to_hang if this next part takes a long time])
1567 AC_MSG_CHECKING(for redhat spopen problem)
1568 ( cd config_test && make && make test ) > /dev/null 2>&1
1569 if test $? -eq 0 ; then
1570 AC_MSG_RESULT(okay)
1571 else
1572 AC_MSG_RESULT(error)
1573 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1574 fi
1575 fi
1576 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1577 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1578 fi
1580 dnl Perl modules
1581 AC_ARG_ENABLE(perl-modules,
1582 AC_HELP_STRING([--enable-perl-modules],
1583 [Enables installation of Nagios::Plugin and its dependencies (default: no)]),
1584 [enable_perl_modules=$enableval],
1585 [enable_perl_modules=no])
1586 if test "$enable_perl_modules" = "yes" ; then
1587 AC_SUBST(PERLMODS_DIR,perlmods)
1588 fi
1590 dnl External libraries - see ACKNOWLEDGEMENTS
1591 gl_INIT
1593 dnl Some helpful common compile errors checked here
1594 if test "$ac_cv_uname_s" = 'SunOS' -a \( "x$ac_cv_prog_ac_ct_AR" = "x" -o "$ac_cv_prog_ac_ct_AR" = 'false' \) ; then
1595 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1596 fi
1598 AC_OUTPUT(
1599 Makefile
1600 lib/Makefile
1601 plugins/Makefile
1602 lib/tests/Makefile
1603 plugins-root/Makefile
1604 plugins-scripts/Makefile
1605 plugins-scripts/subst
1606 plugins-scripts/utils.pm
1607 plugins-scripts/utils.sh
1608 perlmods/Makefile
1609 command.cfg
1610 test.pl
1611 pkg/solaris/pkginfo
1612 po/Makefile.in
1613 )
1616 dnl the ones below that are commented out need to be cleaned up
1617 dnl in the configure code above to use with_foo instead of ac_cv_foo
1618 dnl if we want them to show up here. it'd also make the code cleaner.
1619 dnl i'll get to that on another rainy day :) -sf
1620 ACX_FEATURE([with],[apt-get-command])
1621 dnl ACX_FEATURE([with],[dig-command])
1622 dnl ACX_FEATURE([with],[fping-command])
1623 dnl ACX_FEATURE([with],[mailq-command])
1624 dnl ACX_FEATURE([with],[nslookup-command])
1625 ACX_FEATURE([with],[ping6-command])
1626 ACX_FEATURE([with],[ping-command])
1627 dnl ACX_FEATURE([with],[qstat-command])
1628 dnl ACX_FEATURE([with],[rpcinfo-command])
1629 dnl ACX_FEATURE([with],[smbclient-command])
1630 dnl ACX_FEATURE([with],[snmpget-command])
1631 dnl ACX_FEATURE([with],[snmpgetnext-command])
1632 dnl ACX_FEATURE([with],[ssh-command])
1633 dnl ACX_FEATURE([with],[uptime-command])
1635 dnl ACX_FEATURE([with],[proc-meminfo])
1636 dnl ACX_FEATURE([with],[ps-command])
1637 dnl ACX_FEATURE([with],[ps-format])
1638 dnl ACX_FEATURE([with],[ps-cols])
1639 dnl ACX_FEATURE([with],[ps-varlist])
1641 ACX_FEATURE([with],[ipv6])
1642 ACX_FEATURE([with],[mysql])
1643 ACX_FEATURE([with],[openssl])
1644 ACX_FEATURE([with],[gnutls])
1645 ACX_FEATURE([enable],[extra-opts])
1646 ACX_FEATURE([with],[perl])
1647 ACX_FEATURE([enable],[perl-modules])
1648 ACX_FEATURE([with],[cgiurl])
1649 ACX_FEATURE([with],[trusted-path])