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