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