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