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.11)
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 Check for PostgreSQL libraries
164 _SAVEDLIBS="$LIBS"
165 _SAVEDCPPFLAGS="$CPPFLAGS"
166 AC_ARG_WITH(pgsql,
167 ACX_HELP_STRING([--with-pgsql=DIR],
168 [sets path to pgsql installation]),
169 PGSQL=$withval,)
170 AC_CHECK_LIB(crypt,main)
171 if test "$ac_cv_lib_crypt_main" = "yes"; then
172 if test -n "$PGSQL"; then
173 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
174 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
175 fi
176 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
177 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
178 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
179 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
180 AC_CHECK_HEADERS(libpq-fe.h)
181 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
182 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
183 PGINCLUDE="-I$PGSQL/include"
184 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
185 PGLIBS="-lpq -lcrypt"
186 PGINCLUDE="-I/usr/include/pgsql"
187 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
188 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
189 PGINCLUDE="-I/usr/include/postgresql"
190 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
191 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
192 PGINCLUDE="-I$PGSQL/include"
193 fi
194 if test -z "$PGINCLUDE"; then
195 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
196 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
197 else
198 AC_SUBST(PGLIBS)
199 AC_SUBST(PGINCLUDE)
200 EXTRAS="$EXTRAS check_pgsql"
201 fi
202 else
203 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
204 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
205 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
206 fi
207 else
208 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
209 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
210 fi
211 LIBS="$_SAVEDLIBS"
212 CPPFLAGS="$_SAVEDCPPFLAGS"
214 dnl Check for radius libraries
215 _SAVEDLIBS="$LIBS"
216 AC_CHECK_LIB(radiusclient,rc_read_config)
217 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
218 EXTRAS="$EXTRAS check_radius"
219 RADIUSLIBS="-lradiusclient"
220 AC_SUBST(RADIUSLIBS)
221 else
222 AC_CHECK_LIB(radiusclient-ng,rc_read_config)
223 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
224 EXTRAS="$EXTRAS check_radius"
225 RADIUSLIBS="-lradiusclient-ng"
226 AC_SUBST(RADIUSLIBS)
227 else
228 AC_MSG_WARN([Skipping radius plugin])
229 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
230 fi
231 fi
232 LIBS="$_SAVEDLIBS"
234 dnl Check for LDAP libraries
235 _SAVEDLIBS="$LIBS"
236 AC_CHECK_LIB(ldap,main,,,-llber)
237 if test "$ac_cv_lib_ldap_main" = "yes"; then
238 LDAPLIBS="-lldap -llber"\
239 LDAPINCLUDE="-I/usr/include/ldap"
240 AC_SUBST(LDAPLIBS)
241 AC_SUBST(LDAPINCLUDE)
242 AC_CHECK_FUNCS(ldap_set_option)
243 EXTRAS="$EXTRAS check_ldap"
244 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
245 else
246 AC_MSG_WARN([Skipping LDAP plugin])
247 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
248 fi
249 LIBS="$_SAVEDLIBS"
251 dnl Check for headers used by check_ide_smart
252 AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
253 if test "$FOUNDINCLUDE" = "yes" ; then
254 AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
255 fi
257 if test "$FOUNDINCLUDE" = "yes" ; then
258 EXTRAS="$EXTRAS check_ide_smart"
259 else
260 AC_MSG_WARN([Skipping check_ide_smart plugin.])
261 AC_MSG_WARN([check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h.])
262 fi
264 dnl Check for mysql libraries
265 np_mysqlclient
266 if test $with_mysql = "no" ; then
267 AC_MSG_WARN([Skipping mysql plugin])
268 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
269 else
270 EXTRAS="$EXTRAS check_mysql check_mysql_query"
271 MYSQLINCLUDE="$np_mysql_include"
272 MYSQLLIBS="$np_mysql_libs"
273 MYSQLCFLAGS="$np_mysql_cflags"
274 AC_SUBST(MYSQLINCLUDE)
275 AC_SUBST(MYSQLLIBS)
276 AC_SUBST(MYSQLCFLAGS)
277 fi
279 AC_ARG_WITH([ipv6],
280 [AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
281 [], [with_ipv6=check])
283 dnl Check for AF_INET6 support - unistd.h required for Darwin
284 if test "$with_ipv6" != "no"; then
285 AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
286 AC_TRY_COMPILE(
287 [#ifdef HAVE_UNISTD_H
288 #include <unistd.h>
289 #endif
290 #include <netinet/in.h>
291 #include <sys/socket.h>],
292 [struct sockaddr_in6 sin6;
293 void *p;
295 sin6.sin6_family = AF_INET6;
296 sin6.sin6_port = 587;
297 p = &sin6.sin6_addr;],
298 [np_cv_sys_ipv6=yes],
299 [np_cv_sys_ipv6=no])
300 ])
301 if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
302 AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
303 fi
304 if test "$np_cv_sys_ipv6" = "yes"; then
305 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
306 fi
307 with_ipv6="$np_cv_sys_ipv6"
308 fi
311 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
312 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
313 if test "$FOUNDINCLUDE" = "no"; then
314 _SAVEDCPPFLAGS="$CPPFLAGS"
315 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
316 unset ac_cv_header_krb5_h
317 AC_CHECK_HEADERS(krb5.h,
318 KRB5INCLUDE="-I/usr/kerberos/include"
319 FOUNDINCLUDE=yes,
320 FOUNDINCLUDE=no)
321 fi
322 AC_SUBST(KRBINCLUDE)
323 if test "$FOUNDINCLUDE" = "no"; then
324 CPPFLAGS="$_SAVEDCPPFLAGS"
325 fi
328 dnl openssl detection/configuration
329 if ! test x"$with_openssl" = x"no"; then
330 dnl Check for OpenSSL location if it wasn't already specified
331 if ! test -d "$with_openssl"; then
332 for d in $OPENSSL_DIRS; do
333 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
334 with_openssl=$d
335 fi
336 done
337 fi
339 _SAVEDCPPFLAGS="$CPPFLAGS"
340 _SAVEDLDFLAGS="$LDFLAGS"
341 dnl Check for OpenSSL header files
342 unset FOUNDINCLUDE
343 if test x"$with_openssl" != x"/usr" ; then
344 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
345 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
346 fi
348 dnl check for openssl in $dir/include/openssl
349 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
350 SSLINCLUDE="-I$with_openssl/include"
351 FOUNDINCLUDE=yes,
352 FOUNDINCLUDE=no)
353 dnl else check to see if $dir/include has it
354 if test "$FOUNDINCLUDE" = "no"; then
355 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
356 SSLINCLUDE="-I$with_openssl/include"
357 FOUNDINCLUDE=yes,
358 FOUNDINCLUDE=no)
359 fi
360 AC_SUBST(SSLINCLUDE)
361 dnl if we didn't find it, reset CPPFLAGS
362 if test "$FOUNDINCLUDE" = "no"; then
363 CPPFLAGS="$_SAVEDCPPFLAGS"
364 LDFLAGS="$_SAVEDLDFLAGS"
365 fi
367 dnl Check for crypto lib
368 _SAVEDLIBS="$LIBS"
369 LIBS="-L${with_openssl}/lib"
370 AC_CHECK_LIB(crypto,CRYPTO_lock)
371 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
372 dnl Check for SSL lib
373 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
374 fi
375 LIBS="$_SAVEDLIBS"
377 dnl test headers and libs to decide whether check_http should use SSL
378 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
379 if test "$ac_cv_lib_ssl_main" = "yes"; then
380 if test "$FOUNDINCLUDE" = "yes"; then
381 FOUNDOPENSSL="yes"
382 fi
383 fi
384 fi
385 fi
388 dnl check for gnutls if openssl isn't found (or is disabled)
389 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
390 if test ! "$with_gnutls" = ""; then
391 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
392 elif test ! "$LIBGNUTLS_CONFIG" = ""; then
393 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
394 fi
395 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
396 if test "$FOUNDGNUTLS" = "yes"; then
397 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
398 fi
399 fi
400 dnl end check for gnutls
402 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
403 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
404 AC_SUBST(check_tcp_ssl)
405 AC_SUBST(SSLLIBS)
406 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
407 if test "$FOUNDOPENSSL" = "yes"; then
408 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
409 with_openssl="yes"
410 with_gnutls="no"
411 else
412 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
413 with_gnutls="yes"
414 with_openssl="no"
415 fi
416 else
417 dnl else deliberately disabled or no ssl support available
418 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
419 with_openssl="no"
420 with_gnutls="no"
421 fi
423 dnl
424 dnl Checks for header files.
425 dnl
427 AC_HEADER_TIME
428 AC_HEADER_SYS_WAIT
429 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
430 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
432 dnl Checks for typedefs, structures, and compiler characteristics.
433 AC_C_CONST
434 AC_STRUCT_TM
435 AC_TYPE_PID_T
436 AC_TYPE_SIZE_T
437 AC_TYPE_SIGNAL
439 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
440 AC_TRY_LINK([#include <stdarg.h>
441 va_list ap1,ap2;], [va_copy(ap1,ap2);],
442 ac_cv_HAVE_VA_COPY=yes,
443 ac_cv_HAVE_VA_COPY=no)])
444 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
445 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
446 else
447 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
448 AC_TRY_LINK([#include <stdarg.h>
449 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
450 ac_cv_HAVE___VA_COPY=yes,
451 ac_cv_HAVE___VA_COPY=no)])
452 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
453 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
454 fi
455 fi
457 AC_TRY_COMPILE([#include <sys/time.h>],
458 [struct timeval *tv;
459 struct timezone *tz;],
460 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
461 AC_TRY_COMPILE([#include <sys/time.h>],
462 [struct timeval *tv;
463 struct timezone *tz;
464 gettimeofday(tv, tz);],
465 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
466 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
468 dnl Checks for library functions.
469 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
470 AC_CHECK_FUNCS(poll)
472 AC_MSG_CHECKING(return type of socket size)
473 AC_TRY_COMPILE([#include <stdlib.h>
474 #include <sys/types.h>
475 #include <sys/socket.h>],
476 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
477 ac_cv_socket_size_type=["size_t"]
478 AC_MSG_RESULT(size_t),
479 ac_cv_socket_size_type=["int"]
480 AC_MSG_RESULT(int))
482 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
483 [Define type of socket size])
486 dnl #### Process table test
488 AC_PATH_PROG(PATH_TO_PS,ps)
490 AC_MSG_CHECKING(for ps syntax)
491 AC_ARG_WITH(ps_command,
492 ACX_HELP_STRING([--with-ps-command=PATH],
493 [Verbatim command to execute for ps]),
494 PS_COMMAND=$withval)
495 AC_ARG_WITH(ps_format,
496 ACX_HELP_STRING([--with-ps-format=FORMAT],
497 [Format string for scanning ps output]),
498 PS_FORMAT=$withval)
499 AC_ARG_WITH(ps_cols,
500 ACX_HELP_STRING([--with-ps-cols=NUM],
501 [Number of columns in ps command]),
502 PS_COLS=$withval)
503 AC_ARG_WITH(ps_varlist,
504 ACX_HELP_STRING([--with-ps-varlist=LIST],
505 [Variable list for sscanf of 'ps' output]),
506 PS_VARLIST=$withval)
508 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
509 ac_cv_ps_command="$PS_COMMAND"
510 ac_cv_ps_format="$PS_FORMAT"
511 ac_cv_ps_varlist="$PS_VARLIST"
512 ac_cv_ps_cols="$PS_COLS"
513 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
515 dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
516 elif test "$ac_cv_uname_s" = "SunOS"; then
517 #
518 # this is a very, very ugly hack, to hardcode the location for plugins
519 #
520 if test "$libexecdir" = '${exec_prefix}/libexec'; then
521 if test "$exec_prefix" = "NONE"; then
522 if test "$prefix" = "NONE"; then
523 pst3="$ac_default_prefix/libexec/pst3"
524 else
525 pst3="$prefix/libexec/pst3"
526 fi
527 else
528 pst3="$exec_prefix/libexec/pst3"
529 fi
530 else
531 pst3="$libexecdir/pst3"
532 fi
533 ac_cv_ps_command="$pst3"
534 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
535 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
536 ac_cv_ps_cols=9
537 AC_MSG_RESULT([using nagios-plugins internal ps command (pst3) for solaris])
538 if test `isainfo -b` = 64 ; then
539 PST3CFLAGS="-m64"
540 AC_SUBST(PST3CFLAGS)
541 AC_MSG_NOTICE([using 64bit pst3])
542 else
543 AC_MSG_NOTICE([using 32bit pst3])
544 fi
545 EXTRAS_ROOT="$EXTRAS_ROOT pst3"
547 dnl Removing this for the moment - Ton
548 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
549 dnl Limitation that command name is not available
550 dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
551 dnl egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
552 dnl then
553 dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
554 dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
555 dnl ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
556 dnl ac_cv_ps_cols=8
557 dnl AC_MSG_RESULT([$ac_cv_ps_command])
559 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
560 dnl so test for this first...
561 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
562 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
563 then
564 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
565 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
566 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
567 ac_cv_ps_cols=9
568 AC_MSG_RESULT([$ac_cv_ps_command])
570 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
571 dnl Should also work for FreeBSD 5.2.1 and 5.3
572 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
573 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
574 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
575 then
576 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
577 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
578 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
579 ac_cv_ps_cols=9
580 AC_MSG_RESULT([$ac_cv_ps_command])
582 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
583 dnl Limitation: Only first 16 chars returned for ucomm field
584 dnl Must come before ps -weo
585 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
586 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +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 ucomm command'"
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 STAT UCOMM VSZ RSS USER UID PPID COMMAND
595 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
596 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
597 then
598 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
599 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
600 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
601 ac_cv_ps_cols=10
602 AC_MSG_RESULT([$ac_cv_ps_command])
604 dnl FreeBSD
605 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
606 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
607 then
608 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
609 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
610 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
611 ac_cv_ps_cols=9
612 AC_MSG_RESULT([$ac_cv_ps_command])
614 dnl BSD-like mode in RH 6.1
615 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
616 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
617 then
618 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
619 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
620 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
621 ac_cv_ps_cols=9
622 AC_MSG_RESULT([$ac_cv_ps_command])
624 dnl SunOS 4.1.3:
625 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
626 dnl Need the head -1 otherwise test will work because arguments are found
627 elif ps -laxnwww 2>/dev/null | head -1 | \
628 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
629 then
630 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
631 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
632 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
633 ac_cv_ps_cols=9
634 AC_MSG_RESULT([$ac_cv_ps_command])
636 dnl Debian Linux / procps v1.2.9:
637 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
638 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
639 dnl
640 elif ps laxnwww 2>/dev/null | \
641 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
642 then
643 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
644 ac_cv_ps_command="$PATH_TO_PS laxnwww"
645 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
646 ac_cv_ps_cols=9
647 AC_MSG_RESULT([$ac_cv_ps_command])
649 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
650 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
651 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
652 then
653 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
654 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
655 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
656 ac_cv_ps_cols=9
657 AC_MSG_RESULT([$ac_cv_ps_command])
659 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
660 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
661 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
662 dnl of 1500). Will need big changes to check_procs to support
663 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
664 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
665 then
666 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
667 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
668 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
669 ac_cv_ps_cols=8
670 AC_MSG_RESULT([$ac_cv_ps_command])
672 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
673 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +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 -eo 's 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 AIX 4.3.3 and 5.1 do not have an rss field
682 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
683 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
684 then
685 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
686 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
687 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
688 ac_cv_ps_cols=8
689 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
691 dnl Solaris 2.6
692 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
693 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
694 then
695 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
696 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
697 # There must be no space between the %s and %n due to a wierd problem in sscanf where
698 # it will return %n as longer than the line length
699 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
700 ac_cv_ps_cols=9
701 AC_MSG_RESULT([$ac_cv_ps_command])
703 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
704 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
705 then
706 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
707 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
708 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
709 ac_cv_ps_cols=9
710 AC_MSG_RESULT([$ac_cv_ps_command])
712 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
713 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
714 then
715 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
716 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
717 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
718 ac_cv_ps_cols=9
719 AC_MSG_RESULT([$ac_cv_ps_command])
721 dnl wonder who takes state instead of stat
722 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
723 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
724 then
725 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
726 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
727 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
728 ac_cv_ps_cols=8
729 AC_MSG_RESULT([$ac_cv_ps_command])
731 dnl IRIX 53
732 elif ps -el 2>/dev/null | \
733 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
734 then
735 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
736 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
737 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
738 ac_cv_ps_cols=8
739 AC_MSG_RESULT([$ac_cv_ps_command])
741 dnl IRIX 63
742 elif ps -el 2>/dev/null | \
743 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
744 then
745 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
746 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
747 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
748 ac_cv_ps_cols=6
749 AC_MSG_RESULT([$ac_cv_ps_command])
751 dnl AIX 4.1:
752 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
753 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
754 elif ps -el 2>/dev/null | \
755 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
756 then
757 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
758 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
759 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
760 ac_cv_ps_cols=6
761 AC_MSG_RESULT([$ac_cv_ps_command])
763 dnl AIX?
764 elif ps glaxen 2>/dev/null | \
765 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
766 then
767 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
768 ac_cv_ps_command="$PATH_TO_PS glaxen"
769 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
770 ac_cv_ps_cols=8
771 AC_MSG_RESULT([$ac_cv_ps_command])
773 dnl MacOSX / Darwin
774 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
775 dnl Some truncation will happen in UCOMM column
776 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
777 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
778 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
779 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
780 then
781 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
782 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
783 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
784 ac_cv_ps_cols=8
785 AC_MSG_RESULT([$ac_cv_ps_command])
787 dnl UnixWare
788 elif ps -Al 2>/dev/null | \
789 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
790 then
791 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
792 ac_cv_ps_command="$PATH_TO_PS -Al"
793 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
794 ac_cv_ps_cols=8
795 AC_MSG_RESULT([$ac_cv_ps_command])
797 else
798 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
799 fi
801 if test -n "$ac_cv_ps_varlist" ; then
802 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
803 [Variable list for sscanf of 'ps' output])
804 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
805 [Verbatim command to execute for ps in check_procs])
806 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
807 [Format string for scanning ps output in check_procs])
808 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
809 [Number of columns in ps command])
810 EXTRAS="$EXTRAS check_procs check_nagios"
811 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
812 AC_DEFINE(PS_USES_PROCETIME,"yes",
813 [Whether the ps utility uses the "procetime" field])
814 fi
815 fi
817 AC_PATH_PROG(PATH_TO_PING,ping)
818 AC_PATH_PROG(PATH_TO_PING6,ping6)
820 AC_ARG_WITH(ping_command,
821 ACX_HELP_STRING([--with-ping-command=SYNTAX],
822 [sets syntax for ICMP ping]),
823 with_ping_command=$withval,)
825 AC_MSG_CHECKING(for ICMP ping syntax)
826 ac_cv_ping_packets_first=no
827 ac_cv_ping_has_timeout=no
828 if test -n "$with_ping_command"
829 then
830 AC_MSG_RESULT([(command-line) $with_ping_command])
831 if test -n "$ac_cv_ping_packets_first"
832 then
833 ac_cv_ping_packets_first=yes
834 ac_cv_ping_has_timeout=yes
835 fi
837 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
838 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
839 egrep -i "^round-trip|^rtt" >/dev/null
840 then
841 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
842 ac_cv_ping_packets_first=yes
843 AC_MSG_RESULT([$with_ping_command])
845 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
846 egrep -i "^round-trip|^rtt" >/dev/null
847 then
848 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
849 ac_cv_ping_packets_first=yes
850 ac_cv_ping_has_timeout=yes
851 AC_MSG_RESULT([$with_ping_command])
853 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
854 egrep -i "^round-trip|^rtt" >/dev/null
855 then
856 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
857 ac_cv_ping_packets_first=yes
858 AC_MSG_RESULT([$with_ping_command])
860 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
861 egrep -i "^round-trip|^rtt" >/dev/null
862 then
863 with_ping_command="$PATH_TO_PING -n -c %d %s"
864 ac_cv_ping_packets_first=yes
865 AC_MSG_RESULT([$with_ping_command])
867 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
868 egrep -i "^round-trip|^rtt" >/dev/null
869 then
870 with_ping_command="$PATH_TO_PING -n %s -c %d"
871 AC_MSG_RESULT([$with_ping_command])
873 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
874 egrep -i "^round-trip|^rtt" >/dev/null
875 then
876 with_ping_command="$PATH_TO_PING %s -n %d"
877 AC_MSG_RESULT([$with_ping_command])
879 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
880 egrep -i "^round-trip|^rtt" >/dev/null
881 then
882 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
883 AC_MSG_RESULT([$with_ping_command])
885 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
886 egrep -i "^round-trip|^rtt" >/dev/null
887 then
888 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
889 AC_MSG_RESULT([$with_ping_command])
891 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
892 egrep -i "^round-trip|^rtt" >/dev/null
893 then
894 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
895 ac_cv_ping_packets_first=yes
896 AC_MSG_RESULT([$with_ping_command])
898 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
899 egrep -i "^round-trip|^rtt" >/dev/null
900 then
901 with_ping_command="$PATH_TO_PING -n -c %d %s"
902 ac_cv_ping_packets_first=yes
903 AC_MSG_RESULT([$with_ping_command])
905 else
906 AC_MSG_WARN([unable to find usable ping syntax])
907 fi
909 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
910 [path and args for ICMP ping command])
912 if test "x$ac_cv_ping_packets_first" != "xno"
913 then
914 AC_DEFINE(PING_PACKETS_FIRST,1,
915 [Define if packet count must precede host])
916 fi
918 if test "x$ac_cv_ping_has_timeout" != "xno"
919 then
920 AC_DEFINE(PING_HAS_TIMEOUT,1,
921 [Define if ping has its own timeout option that should be set])
922 fi
924 AC_ARG_WITH(ping6_command,
925 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
926 [sets syntax for ICMPv6 ping]),
927 with_ping6_command=$withval,)
929 if test x"$with_ipv6" != xno ; then
930 AC_MSG_CHECKING(for ICMPv6 ping syntax)
931 ac_cv_ping6_packets_first=no
932 if test -n "$with_ping6_command"
933 then
934 AC_MSG_RESULT([(command-line) $with_ping6_command])
935 if test -n "$ac_cv_ping6_packets_first"
936 then
937 ac_cv_ping6_packets_first=yes
938 fi
940 elif test "x$PATH_TO_PING6" != "x"; then
941 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
942 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
943 egrep -i "^round-trip|^rtt" >/dev/null
944 then
945 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
946 ac_cv_ping6_packets_first=yes
947 AC_MSG_RESULT([$with_ping6_command])
949 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
950 egrep -i "^round-trip|^rtt" >/dev/null
951 then
952 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
953 ac_cv_ping6_packets_first=yes
954 ac_cv_ping_has_timeout=yes
955 AC_MSG_RESULT([$with_ping6_command])
957 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
958 egrep -i "^round-trip|^rtt" >/dev/null
959 then
960 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
961 ac_cv_ping6_packets_first=yes
962 AC_MSG_RESULT([$with_ping6_command])
964 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
965 egrep -i "^round-trip|^rtt" >/dev/null
966 then
967 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
968 ac_cv_ping6_packets_first=yes
969 AC_MSG_RESULT([$with_ping6_command])
971 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
972 egrep -i "^round-trip|^rtt" >/dev/null
973 then
974 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
975 AC_MSG_RESULT([$with_ping6_command])
977 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
978 egrep -i "^round-trip|^rtt" >/dev/null
979 then
980 with_ping6_command="$PATH_TO_PING6 %s -n %d"
981 AC_MSG_RESULT([$with_ping6_command])
983 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
984 egrep -i "^round-trip|^rtt" >/dev/null
985 then
986 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
987 AC_MSG_RESULT([$with_ping6_command])
989 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
990 egrep -i "^round-trip|^rtt" >/dev/null
991 then
992 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
993 AC_MSG_RESULT([$with_ping6_command])
995 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
996 egrep -i "^round-trip|^rtt" >/dev/null
997 then
998 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
999 ac_cv_ping6_packets_first=yes
1000 AC_MSG_RESULT([$with_ping_command])
1002 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1003 egrep -i "^round-trip|^rtt" >/dev/null
1004 then
1005 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1006 ac_cv_ping6_packets_first=yes
1007 AC_MSG_RESULT([$with_ping6_command])
1009 fi
1011 elif test "x$PATH_TO_PING" != "x"; then
1012 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1013 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1014 egrep -i "^round-trip|^rtt" >/dev/null
1015 then
1016 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1017 ac_cv_ping6_packets_first=yes
1018 AC_MSG_RESULT([$with_ping6_command])
1020 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1021 egrep -i "^round-trip|^rtt" >/dev/null
1022 then
1023 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1024 ac_cv_ping6_packets_first=yes
1025 AC_MSG_RESULT([$with_ping6_command])
1027 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1028 egrep -i "^round-trip|^rtt" >/dev/null
1029 then
1030 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1031 ac_cv_ping6_packets_first=yes
1032 AC_MSG_RESULT([$with_ping6_command])
1034 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1035 egrep -i "^round-trip|^rtt" >/dev/null
1036 then
1037 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1038 AC_MSG_RESULT([$with_ping6_command])
1040 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1041 egrep -i "^round-trip|^rtt" >/dev/null
1042 then
1043 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1044 AC_MSG_RESULT([$with_ping6_command])
1046 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1047 egrep -i "^round-trip|^rtt" >/dev/null
1048 then
1049 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1050 AC_MSG_RESULT([$with_ping6_command])
1052 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1053 egrep -i "^round-trip|^rtt" >/dev/null
1054 then
1055 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1056 AC_MSG_RESULT([$with_ping6_command])
1058 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::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 56 -c %d %s"
1062 ac_cv_ping6_packets_first=yes
1063 AC_MSG_RESULT([$with_ping_command])
1065 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1066 egrep -i "^round-trip|^rtt" >/dev/null
1067 then
1068 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1069 ac_cv_ping6_packets_first=yes
1070 AC_MSG_RESULT([$with_ping6_command])
1072 fi
1074 fi
1076 if test "x$with_ping6_command" != "x"; then
1077 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1078 [path and args for ICMPv6 ping command])
1079 else
1080 AC_MSG_RESULT([none])
1081 fi
1083 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1084 AC_DEFINE(PING6_PACKETS_FIRST,1,
1085 [Define if packet count must precede host])
1086 fi
1087 fi
1090 AC_ARG_WITH(nslookup_command,
1091 ACX_HELP_STRING([--with-nslookup-command=PATH],
1092 [sets path to nslookup executable]),
1093 ac_cv_nslookup_command=$withval)
1094 if test -n "$ac_cv_nslookup_command"; then
1095 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1096 else
1097 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1098 if test -n "$PATH_TO_NSLOOKUP"
1099 then
1100 AC_MSG_CHECKING(for nslookup syntax)
1101 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1102 then
1103 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1104 AC_MSG_RESULT([$ac_cv_nslookup_command])
1106 else
1107 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1108 AC_MSG_RESULT([$ac_cv_nslookup_command])
1110 fi
1111 else
1112 AC_MSG_WARN([nslookup command not found])
1113 fi
1114 fi
1116 if test -n "$ac_cv_nslookup_command"; then
1117 EXTRAS="$EXTRAS check_dns"
1118 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1119 fi
1121 AC_MSG_CHECKING([for number of cpus])
1122 AC_TRY_COMPILE([#include <unistd.h>],
1123 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1124 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
1125 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1126 AC_MSG_RESULT([cannot calculate])
1127 )
1129 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1130 AC_ARG_WITH(uptime_command,
1131 ACX_HELP_STRING([--with-uptime-command=PATH],
1132 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1133 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1135 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1136 AC_ARG_WITH(rpcinfo_command,
1137 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1138 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1139 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1141 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1142 if test -x "$PATH_TO_LMSTAT"
1143 then
1144 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1145 else
1146 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1147 fi
1149 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1150 AC_ARG_WITH(smbclient_command,
1151 ACX_HELP_STRING([--with-smbclient-command=PATH],
1152 [sets path to smbclient]),
1153 PATH_TO_SMBCLIENT=$withval)
1154 if test -n "$PATH_TO_SMBCLIENT"
1155 then
1156 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1157 else
1158 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1159 fi
1162 AC_PATH_PROG(PATH_TO_WHO,who)
1164 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1165 then
1166 ac_cv_path_to_who="$PATH_TO_WHO -q"
1167 else
1168 ac_cv_path_to_who="$PATH_TO_WHO"
1169 fi
1171 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1172 [path and arguments for invoking 'who'])
1174 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1175 AC_ARG_WITH(snmpget_command,
1176 ACX_HELP_STRING([--with-snmpget-command=PATH],
1177 [Path to snmpget command]),
1178 PATH_TO_SNMPGET=$withval)
1179 if test -n "$PATH_TO_SNMPGET"
1180 then
1181 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1182 EXTRAS="$EXTRAS check_hpjd check_snmp"
1183 else
1184 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1185 fi
1187 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1188 AC_ARG_WITH(snmpgetnext_command,
1189 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1190 [Path to snmpgetnext command]),
1191 PATH_TO_SNMPGETNEXT=$withval)
1192 if test -n "$PATH_TO_SNMPGETNEXT"
1193 then
1194 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1195 fi
1197 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1198 then
1199 AC_MSG_CHECKING(for Net::SNMP perl module)
1200 AC_MSG_RESULT([found])
1201 else
1202 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1203 fi
1205 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1206 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1207 AC_ARG_WITH(qstat_command,
1208 ACX_HELP_STRING([--with-qstat-command=PATH],
1209 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1211 if test -x "$PATH_TO_QUAKESTAT"
1212 then
1213 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1214 EXTRAS="$EXTRAS check_game"
1216 elif test -n "$PATH_TO_QSTAT"
1217 then
1218 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1219 EXTRAS="$EXTRAS check_game"
1220 else
1221 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1222 fi
1224 if test $ac_cv_path_to_qstat
1225 then
1226 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1227 [path to qstat/quakestat])
1228 fi
1230 AC_PATH_PROG(PATH_TO_FPING,fping)
1231 AC_ARG_WITH(fping_command,
1232 ACX_HELP_STRING([--with-fping-command=PATH],
1233 [Path to fping command]), PATH_TO_FPING=$withval)
1234 if test -n "$PATH_TO_FPING"
1235 then
1236 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1237 EXTRAS="$EXTRAS check_fping"
1238 else
1239 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1240 fi
1242 AC_PATH_PROG(PATH_TO_SSH,ssh)
1243 AC_ARG_WITH(ssh_command,
1244 ACX_HELP_STRING([--with-ssh-command=PATH],
1245 [sets path for ssh]), PATH_TO_SSH=$withval)
1246 if test -n "$PATH_TO_SSH"
1247 then
1248 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1249 EXTRAS="$EXTRAS check_by_ssh"
1250 else
1251 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1252 fi
1255 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1256 AC_ARG_WITH(mailq_command,
1257 ACX_HELP_STRING([--with-mailq-command=PATH],
1258 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1259 if test -n "$PATH_TO_MAILQ"
1260 then
1261 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1262 else
1263 AC_MSG_WARN([Could not find mailq or eqivalent])
1264 fi
1266 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1267 if test -x "$PATH_TO_QMAIL_QSTAT"
1268 then
1269 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1270 else
1271 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1272 fi
1274 dnl SWAP info required is amount allocated/available and amount free
1275 dnl The plugin works through all the swap devices and adds up the total swap
1276 dnl available.
1277 AC_PATH_PROG(PATH_TO_SWAP,swap)
1278 if (test -n "$PATH_TO_SWAP")
1279 then
1280 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1281 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1282 then
1283 ac_cv_have_swap=yes
1284 ac_cv_swap_command="$PATH_TO_SWAP -l"
1285 if [$PATH_TO_SWAP -l 2>/dev/null | \
1286 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1287 >/dev/null]
1288 then
1289 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1290 ac_cv_swap_conv=2048
1291 AC_MSG_RESULT([using IRIX format swap])
1293 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1294 then
1295 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1296 ac_cv_swap_conv=2048
1297 AC_MSG_RESULT([using Unixware format swap])
1298 else
1299 dnl if we don't know what format swap's output is
1300 dnl we might as well pretend we didn't see it
1301 ac_cv_have_swap=""
1302 ac_cv_swap_command=""
1303 fi
1304 fi
1305 dnl end if for PATH_TO_SWAP
1306 fi
1308 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1309 if (test -n "$PATH_TO_SWAPINFO")
1310 then
1311 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1312 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1313 then
1314 ac_cv_have_swap=yes
1315 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1317 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1318 then
1319 ac_cv_swap_format=["%*s %f %*d %f"]
1320 ac_cv_swap_conv=1024
1321 AC_MSG_RESULT([using FreeBSD format swapinfo])
1322 fi
1324 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1325 then
1326 ac_cv_have_swap=yes
1327 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1328 ac_cv_swap_format=["%*s %f %*d %f"]
1329 ac_cv_swap_conv=1024
1330 AC_MSG_RESULT([using HP-UX format swapinfo])
1331 fi
1332 dnl end if for PATH_TO_SWAPINFO
1333 fi
1335 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1336 if (test -n "$PATH_TO_LSPS")
1337 then
1338 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1339 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1340 then
1341 ac_cv_have_swap=yes
1342 ac_cv_swap_command="$PATH_TO_LSPS -a"
1343 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1344 ac_cv_swap_conv=1
1345 AC_MSG_RESULT([using AIX lsps])
1346 fi
1347 dnl end if for PATH_TO_SWAPINFO
1348 fi
1350 dnl
1351 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1352 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1353 dnl in the various BSD's
1354 dnl
1356 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1357 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1358 #ifdef HAVE_SYS_PARAM_H
1359 #include <sys/param.h>
1360 #endif
1361 ])
1362 AC_CHECK_DECLS([swapctl],,,[
1363 #include <unistd.h>
1364 #include <sys/types.h>
1365 #include <sys/param.h>
1366 #include <sys/stat.h>
1367 #include <sys/swap.h>
1368 ])
1369 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1370 #include <sys/types.h>
1371 #include <sys/param.h>
1372 #include <sys/stat.h>
1373 #include <sys/swap.h>
1374 ])
1375 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1376 #include <unistd.h>
1377 #include <sys/types.h>
1378 #include <sys/param.h>
1379 #include <sys/stat.h>
1380 #include <sys/swap.h>
1381 ])
1383 if test "$ac_cv_have_decl_swapctl" = "yes";
1384 then
1385 EXTRAS="$EXTRAS check_swap"
1386 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1387 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1388 "$ac_cv_type_swapent_t" = "yes";
1389 then
1390 AC_MSG_RESULT([yes])
1391 ac_cv_check_swap_swapctl_svr4="1";
1392 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1393 [Define if 2-argument SVR4 swapctl exists])
1394 else
1395 AC_MSG_RESULT([no])
1396 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1397 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1398 then
1399 AC_MSG_RESULT([yes])
1400 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1401 [Define if 3-argument BSD swapctl exists])
1402 else
1403 AC_MSG_RESULT([no])
1404 fi
1405 fi
1406 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1407 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1408 then
1409 dnl
1410 dnl the SVR4 spec returns values in pages
1411 dnl
1412 AC_MSG_RESULT([page])
1413 AC_CHECK_DECLS([sysconf])
1414 AC_MSG_CHECKING([for system page size])
1415 if test "$ac_cv_have_decl_sysconf" = "yes";
1416 then
1417 AC_MSG_RESULT([determined by sysconf(3)])
1418 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1419 else
1420 AC_MSG_WARN([don't know. guessing 4096k])
1421 ac_cv_swap_conv=256
1422 fi
1423 else
1424 dnl
1425 dnl the BSD spec returns values in blocks
1426 dnl
1427 AC_MSG_RESULT([blocks (assuming 512b)])
1428 ac_cv_swap_conv=2048
1429 fi
1430 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1431 [Conversion factor to MB])
1432 fi
1433 dnl
1434 dnl end tests for the swapctl system calls
1435 dnl
1438 if test "x$ac_cv_have_swap" != "x"
1439 then
1440 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1441 EXTRAS="$EXTRAS check_swap"
1442 fi
1443 if test "x$ac_cv_swap_command" != "x"
1444 then
1445 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1446 [Path to swap/swapinfo binary, with any args])
1447 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1448 [Format string for parsing swap output])
1449 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1450 [Conversion factor to MB])
1451 fi
1453 AC_ARG_WITH(proc-meminfo,
1454 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1455 [path to /proc/meminfo or equivalent]),
1456 ac_cv_proc_meminfo=$withval)
1457 dnl dunno why this does not work below - use hack (kbd)
1458 dnl fine on linux, broken on solaris
1459 dnl if /bin/test -e "/proc/meminfo"
1460 AC_MSG_CHECKING([for /proc/meminfo])
1461 if test -n "$ac_cv_proc_meminfo"; then
1462 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1463 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1464 AC_MSG_RESULT([found /proc/meminfo])
1465 ac_cv_proc_meminfo="/proc/meminfo"
1466 else
1467 AC_MSG_RESULT([no])
1468 fi
1470 if test -n "$ac_cv_proc_meminfo"; then
1471 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1472 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1473 EXTRAS="$EXTRAS check_swap"
1474 fi
1476 AC_PATH_PROG(PATH_TO_DIG,dig)
1477 AC_ARG_WITH(dig_command,
1478 ACX_HELP_STRING([--with-dig-command=PATH],
1479 [Path to dig command]), PATH_TO_DIG=$withval)
1480 if test -n "$PATH_TO_DIG"; then
1481 EXTRAS="$EXTRAS check_dig"
1482 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1483 fi
1485 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1486 AC_ARG_WITH(apt-get_command,
1487 ACX_HELP_STRING([--with-apt-get-command=PATH],
1488 [Path to apt-get command]),
1489 with_apt_get_command=$withval,
1490 with_apt_get_command=$PATH_TO_APTGET)
1491 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1492 if test -n "$PATH_TO_APTGET" ; then
1493 EXTRAS="$EXTRAS check_apt"
1494 fi
1497 if test -f plugins/check_nt.c ; then
1498 EXTRAS="$EXTRAS check_nt"
1499 elif test -f ../plugins/check_nt.c ; then
1500 EXTRAS="$EXTRAS check_nt"
1501 fi
1504 dnl used in check_dhcp
1505 AC_CHECK_HEADERS(sys/sockio.h)
1507 case $host in
1508 *bsd*)
1509 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1510 ;;
1511 *linux*)
1512 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1513 ;;
1514 *sun* | solaris*)
1515 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1516 ;;
1517 *hpux*)
1518 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1519 ;;
1520 esac
1522 AC_SUBST(EXTRAS)
1523 AC_SUBST(EXTRAS_ROOT)
1524 AC_SUBST(EXTRA_NETOBJS)
1525 AC_SUBST(DEPLIBS)
1527 AM_GNU_GETTEXT([external], [need-ngettext])
1528 AM_GNU_GETTEXT_VERSION(0.15)
1530 dnl Check for Redhat spopen problem
1531 dnl Wierd problem where ECHILD is returned from a wait call in error
1532 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1533 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1534 dnl We patch plugins/popen.c
1535 dnl Need to add smp because uname different on those
1536 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1537 AC_ARG_ENABLE(redhat-pthread-workaround,
1538 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1539 [force Redhat patch to be applied (default: test system)]),
1540 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1541 [ac_cv_enable_redhat_pthread_workaround=test])
1542 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1543 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1544 AC_MSG_NOTICE([See http://nagiosplugins.org/faq/compile/configure_appears_to_hang if this next part takes a long time])
1545 AC_MSG_CHECKING(for redhat spopen problem)
1546 ( cd config_test && make && make test ) > /dev/null 2>&1
1547 if test $? -eq 0 ; then
1548 AC_MSG_RESULT(okay)
1549 else
1550 AC_MSG_RESULT(error)
1551 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1552 fi
1553 fi
1554 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1555 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1556 fi
1558 dnl Perl modules
1559 AC_ARG_ENABLE(perl-modules,
1560 AC_HELP_STRING([--enable-perl-modules],
1561 [Enables installation of Nagios::Plugin and its dependencies (default: no)]),
1562 [enable_perl_modules=$enableval],
1563 [enable_perl_modules=no])
1564 if test "$enable_perl_modules" = "yes" ; then
1565 AC_SUBST(PERLMODS_DIR,perlmods)
1566 fi
1568 dnl External libraries - see ACKNOWLEDGEMENTS
1569 gl_INIT
1571 dnl Some helpful common compile errors checked here
1572 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
1573 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1574 fi
1576 AC_OUTPUT(
1577 Makefile
1578 lib/Makefile
1579 plugins/Makefile
1580 lib/tests/Makefile
1581 plugins-root/Makefile
1582 plugins-scripts/Makefile
1583 plugins-scripts/subst
1584 plugins-scripts/utils.pm
1585 plugins-scripts/utils.sh
1586 perlmods/Makefile
1587 command.cfg
1588 test.pl
1589 pkg/solaris/pkginfo
1590 po/Makefile.in
1591 )
1594 dnl the ones below that are commented out need to be cleaned up
1595 dnl in the configure code above to use with_foo instead of ac_cv_foo
1596 dnl if we want them to show up here. it'd also make the code cleaner.
1597 dnl i'll get to that on another rainy day :) -sf
1598 ACX_FEATURE([with],[apt-get-command])
1599 dnl ACX_FEATURE([with],[dig-command])
1600 dnl ACX_FEATURE([with],[fping-command])
1601 dnl ACX_FEATURE([with],[mailq-command])
1602 dnl ACX_FEATURE([with],[nslookup-command])
1603 ACX_FEATURE([with],[ping6-command])
1604 ACX_FEATURE([with],[ping-command])
1605 dnl ACX_FEATURE([with],[qstat-command])
1606 dnl ACX_FEATURE([with],[rpcinfo-command])
1607 dnl ACX_FEATURE([with],[smbclient-command])
1608 dnl ACX_FEATURE([with],[snmpget-command])
1609 dnl ACX_FEATURE([with],[snmpgetnext-command])
1610 dnl ACX_FEATURE([with],[ssh-command])
1611 dnl ACX_FEATURE([with],[uptime-command])
1613 dnl ACX_FEATURE([with],[proc-meminfo])
1614 dnl ACX_FEATURE([with],[ps-command])
1615 dnl ACX_FEATURE([with],[ps-format])
1616 dnl ACX_FEATURE([with],[ps-cols])
1617 dnl ACX_FEATURE([with],[ps-varlist])
1619 ACX_FEATURE([with],[ipv6])
1620 ACX_FEATURE([with],[mysql])
1621 ACX_FEATURE([with],[openssl])
1622 ACX_FEATURE([with],[gnutls])
1623 ACX_FEATURE([with],[perl])
1624 ACX_FEATURE([enable],[perl-modules])
1625 ACX_FEATURE([with],[cgiurl])
1626 ACX_FEATURE([with],[trusted-path])