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