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