1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.59)
4 AC_INIT(nagios-plugins,1.4.9)
5 AC_CONFIG_SRCDIR(NPTest.pm)
6 AC_CONFIG_FILES(gl/Makefile)
7 AC_CONFIG_AUX_DIR(build-aux)
8 AM_INIT_AUTOMAKE([1.8.3])
9 AM_CONFIG_HEADER(config.h)
10 AC_CANONICAL_HOST
12 RELEASE=1
13 AC_SUBST(RELEASE)
15 AC_PREFIX_DEFAULT(/usr/local/nagios)
17 dnl Deprecated configure options
20 dnl Append user (-o), group (-g), mode (-m) to install command
21 dnl There is an assumption that this is possible with ./configure's chosen install command
22 extra_install_args=""
23 AC_ARG_WITH(nagios_user,
24 ACX_HELP_STRING([--with-nagios-user=USER],
25 [Installs executables with this user. Defaults to install user]),
26 extra_install_args="-o $withval")
27 AC_ARG_WITH(nagios_group,
28 ACX_HELP_STRING([--with-nagios-group=GROUP],
29 [Installs executables with this group. Defaults to install user]),
30 extra_install_args="$extra_install_args -g $withval")
31 AC_ARG_WITH(world_permissions,
32 ACX_HELP_STRING([--without-world-permissions],
33 [Installs executables without world permissions]))
35 if test "x$with_world_permissions" = xno ; then
36 extra_install_args="$extra_install_args -m 0550"
37 fi
39 INSTALL="$INSTALL $extra_install_args"
40 INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args"
41 AC_SUBST(INSTALL)
43 AC_PROG_CC
44 gl_EARLY
45 AC_PROG_GCC_TRADITIONAL
46 AC_PROG_LIBTOOL
48 AM_PROG_CC_C_O
50 AC_FUNC_ERROR_AT_LINE
52 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
54 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
55 AC_SUBST(PLUGIN_TEST)dnl
57 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
58 AC_SUBST(SCRIPT_TEST)dnl
60 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
61 AC_SUBST(WARRANTY)
63 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
64 AC_SUBST(SUPPORT)
66 dnl CGIURL has changed for Nagios with 1.0 beta
67 AC_ARG_WITH(cgiurl,
68 ACX_HELP_STRING([--with-cgiurl=DIR],
69 [sets URL for cgi programs]),
70 with_cgiurl=$withval,
71 with_cgiurl=/nagios/cgi-bin)
72 CGIURL="$with_cgiurl"
73 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
75 AC_ARG_WITH(trusted_path,
76 ACX_HELP_STRING([--with-trusted-path=PATH],
77 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
78 with_trusted_path=$withval,
79 with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
80 AC_SUBST(with_trusted_path)
82 EXTRAS=
83 EXTRAS_ROOT=
84 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
86 LDFLAGS="$LDFLAGS -L."
88 ac_cv_uname_m=`uname -m`
89 ac_cv_uname_s=`uname -s`
90 ac_cv_uname_r=`uname -r`
91 ac_cv_uname_v=`uname -v`
93 PKG_ARCH=`uname -p`
94 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
95 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
97 AC_SUBST(PKG_ARCH)
98 AC_SUBST(REV_DATESTAMP)
99 AC_SUBST(REV_TIMESTAMP)
101 dnl Checks for programs.
102 AC_PATH_PROG(PYTHON,python)
103 AC_PATH_PROG(SH,sh)
104 AC_PATH_PROG(PERL,perl)
105 AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
106 AC_PATH_PROG(HOSTNAME,hostname)
107 AC_PATH_PROG(BASENAME,basename)
109 dnl allow them to override the path of perl
110 AC_ARG_WITH(perl,
111 ACX_HELP_STRING([--with-perl=PATH],
112 [sets path to perl executable]),
113 with_perl=$withval,with_perl=$PERL)
114 AC_SUBST(PERL, $with_perl)
116 dnl openssl/gnutls
117 AC_ARG_WITH(openssl,
118 AC_HELP_STRING([--with-openssl=DIR],
119 [path to openssl installation]),)
121 AC_ARG_WITH(gnutls,
122 ACX_HELP_STRING([--with-gnutls=PATH],
123 [path to gnutls installation root]),)
125 dnl you can only have one or the other
126 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
127 with_gnutls="no"
128 fi
129 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
130 with_openssl="no"
131 fi
133 dnl list of possible dirs to try to autodetect openssl
134 dnl if $dir/include exists, we consider it found
135 dnl the order should allow locally installed versions to override distros' ones
136 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
137 /opt /opt/openssl"
140 dnl
141 dnl Checks for libraries.
142 dnl
144 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
145 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
146 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
147 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
148 AC_SUBST(SOCKETLIBS)
150 dnl
151 dnl check for math-related functions needing -lm
152 AC_CHECK_HEADERS(math.h)
153 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
154 AC_SUBST(MATHLIBS)
156 dnl Check for libtap, to run perl-like tests
157 AC_CHECK_LIB(tap, plan_tests,
158 EXTRA_TEST="test_utils test_disk test_tcp test_cmd"
159 AC_SUBST(EXTRA_TEST)
160 )
162 dnl Check for PostgreSQL libraries
163 _SAVEDLIBS="$LIBS"
164 _SAVEDCPPFLAGS="$CPPFLAGS"
165 AC_ARG_WITH(pgsql,
166 ACX_HELP_STRING([--with-pgsql=DIR],
167 [sets path to pgsql installation]),
168 PGSQL=$withval,)
169 AC_CHECK_LIB(crypt,main)
170 if test "$ac_cv_lib_crypt_main" = "yes"; then
171 if test -n "$PGSQL"; then
172 LDFLAGS="$LDFLAGS -L$PGSQL/lib"
173 CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
174 fi
175 AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
176 if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
177 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
178 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
179 AC_CHECK_HEADERS(libpq-fe.h)
180 if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
181 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
182 PGINCLUDE="-I$PGSQL/include"
183 elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
184 PGLIBS="-lpq -lcrypt"
185 PGINCLUDE="-I/usr/include/pgsql"
186 elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
187 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
188 PGINCLUDE="-I/usr/include/postgresql"
189 elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
190 PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
191 PGINCLUDE="-I$PGSQL/include"
192 fi
193 if test -z "$PGINCLUDE"; then
194 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
195 AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
196 else
197 AC_SUBST(PGLIBS)
198 AC_SUBST(PGINCLUDE)
199 EXTRAS="$EXTRAS check_pgsql"
200 fi
201 else
202 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
203 AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
204 AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
205 fi
206 else
207 AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
208 AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
209 fi
210 LIBS="$_SAVEDLIBS"
211 CPPFLAGS="$_SAVEDCPPFLAGS"
213 dnl Check for radius libraries
214 _SAVEDLIBS="$LIBS"
215 AC_CHECK_LIB(radiusclient,rc_read_config)
216 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
217 EXTRAS="$EXTRAS check_radius"
218 RADIUSLIBS="-lradiusclient"
219 AC_SUBST(RADIUSLIBS)
220 else
221 AC_CHECK_LIB(radiusclient-ng,rc_read_config)
222 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
223 EXTRAS="$EXTRAS check_radius"
224 RADIUSLIBS="-lradiusclient-ng"
225 AC_SUBST(RADIUSLIBS)
226 else
227 AC_MSG_WARN([Skipping radius plugin])
228 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
229 fi
230 fi
231 LIBS="$_SAVEDLIBS"
233 dnl Check for LDAP libraries
234 _SAVEDLIBS="$LIBS"
235 AC_CHECK_LIB(ldap,main,,,-llber)
236 if test "$ac_cv_lib_ldap_main" = "yes"; then
237 LDAPLIBS="-lldap -llber"\
238 LDAPINCLUDE="-I/usr/include/ldap"
239 AC_SUBST(LDAPLIBS)
240 AC_SUBST(LDAPINCLUDE)
241 AC_CHECK_FUNCS(ldap_set_option)
242 EXTRAS="$EXTRAS check_ldap"
243 AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
244 else
245 AC_MSG_WARN([Skipping LDAP plugin])
246 AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
247 fi
248 LIBS="$_SAVEDLIBS"
250 dnl Check for headers used by check_ide_smart
251 AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
252 if test "$FOUNDINCLUDE" = "yes" ; then
253 AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
254 fi
256 if test "$FOUNDINCLUDE" = "yes" ; then
257 EXTRAS="$EXTRAS check_ide_smart"
258 else
259 AC_MSG_WARN([Skipping check_ide_smart plugin.])
260 AC_MSG_WARN([check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h.])
261 fi
263 dnl Check for mysql libraries
264 np_mysqlclient
265 if test $with_mysql = "no" ; then
266 AC_MSG_WARN([Skipping mysql plugin])
267 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
268 else
269 EXTRAS="$EXTRAS check_mysql check_mysql_query"
270 MYSQLINCLUDE="$np_mysql_include"
271 MYSQLLIBS="$np_mysql_libs"
272 MYSQLCFLAGS="$np_mysql_cflags"
273 AC_SUBST(MYSQLINCLUDE)
274 AC_SUBST(MYSQLLIBS)
275 AC_SUBST(MYSQLCFLAGS)
276 fi
278 dnl Check for AF_INET6 support - unistd.h required for Darwin
279 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
280 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
281 #include <unistd.h>
282 #endif
283 #include <netinet/in.h>
284 #include <sys/socket.h>],
285 [struct sockaddr_in6 sin6;
286 void *p;
288 sin6.sin6_family = AF_INET6;
289 sin6.sin6_port = 587;
290 p = &sin6.sin6_addr;],
291 [with_ipv6=yes],
292 [with_ipv6=no])
293 ])
295 if test x"$with_ipv6" != xno ; then
296 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
297 fi
300 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
301 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
302 if test "$FOUNDINCLUDE" = "no"; then
303 _SAVEDCPPFLAGS="$CPPFLAGS"
304 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
305 unset ac_cv_header_krb5_h
306 AC_CHECK_HEADERS(krb5.h,
307 KRB5INCLUDE="-I/usr/kerberos/include"
308 FOUNDINCLUDE=yes,
309 FOUNDINCLUDE=no)
310 fi
311 AC_SUBST(KRBINCLUDE)
312 if test "$FOUNDINCLUDE" = "no"; then
313 CPPFLAGS="$_SAVEDCPPFLAGS"
314 fi
317 dnl openssl detection/configuration
318 if ! test x"$with_openssl" = x"no"; then
319 dnl Check for OpenSSL location if it wasn't already specified
320 if ! test -d "$with_openssl"; then
321 for d in $OPENSSL_DIRS; do
322 if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
323 with_openssl=$d
324 fi
325 done
326 fi
328 _SAVEDCPPFLAGS="$CPPFLAGS"
329 _SAVEDLDFLAGS="$LDFLAGS"
330 dnl Check for OpenSSL header files
331 unset FOUNDINCLUDE
332 if test x"$with_openssl" != x"/usr" ; then
333 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
334 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
335 fi
337 dnl check for openssl in $dir/include/openssl
338 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
339 SSLINCLUDE="-I$with_openssl/include"
340 FOUNDINCLUDE=yes,
341 FOUNDINCLUDE=no)
342 dnl else check to see if $dir/include has it
343 if test "$FOUNDINCLUDE" = "no"; then
344 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
345 SSLINCLUDE="-I$with_openssl/include"
346 FOUNDINCLUDE=yes,
347 FOUNDINCLUDE=no)
348 fi
349 AC_SUBST(SSLINCLUDE)
350 dnl if we didn't find it, reset CPPFLAGS
351 if test "$FOUNDINCLUDE" = "no"; then
352 CPPFLAGS="$_SAVEDCPPFLAGS"
353 LDFLAGS="$_SAVEDLDFLAGS"
354 fi
356 dnl Check for crypto lib
357 _SAVEDLIBS="$LIBS"
358 LIBS="-L${with_openssl}/lib"
359 AC_CHECK_LIB(crypto,CRYPTO_lock)
360 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
361 dnl Check for SSL lib
362 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
363 fi
364 LIBS="$_SAVEDLIBS"
366 dnl test headers and libs to decide whether check_http should use SSL
367 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
368 if test "$ac_cv_lib_ssl_main" = "yes"; then
369 if test "$FOUNDINCLUDE" = "yes"; then
370 FOUNDOPENSSL="yes"
371 fi
372 fi
373 fi
374 fi
377 dnl check for gnutls if openssl isn't found (or is disabled)
378 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
379 if test ! "$with_gnutls" = ""; then
380 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
381 elif test ! "$LIBGNUTLS_CONFIG" = ""; then
382 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
383 fi
384 AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
385 if test "$FOUNDGNUTLS" = "yes"; then
386 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
387 fi
388 fi
389 dnl end check for gnutls
391 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
392 check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
393 AC_SUBST(check_tcp_ssl)
394 AC_SUBST(SSLLIBS)
395 AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
396 if test "$FOUNDOPENSSL" = "yes"; then
397 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
398 with_openssl="yes"
399 with_gnutls="no"
400 else
401 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
402 with_gnutls="yes"
403 with_openssl="no"
404 fi
405 else
406 dnl else deliberately disabled or no ssl support available
407 AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
408 with_openssl="no"
409 with_gnutls="no"
410 fi
412 dnl
413 dnl Checks for header files.
414 dnl
416 AC_HEADER_TIME
417 AC_HEADER_SYS_WAIT
418 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
419 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
421 dnl Checks for typedefs, structures, and compiler characteristics.
422 AC_C_CONST
423 AC_STRUCT_TM
424 AC_TYPE_PID_T
425 AC_TYPE_SIZE_T
426 AC_TYPE_SIGNAL
428 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
429 AC_TRY_LINK([#include <stdarg.h>
430 va_list ap1,ap2;], [va_copy(ap1,ap2);],
431 ac_cv_HAVE_VA_COPY=yes,
432 ac_cv_HAVE_VA_COPY=no)])
433 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
434 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
435 else
436 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
437 AC_TRY_LINK([#include <stdarg.h>
438 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
439 ac_cv_HAVE___VA_COPY=yes,
440 ac_cv_HAVE___VA_COPY=no)])
441 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
442 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
443 fi
444 fi
446 AC_TRY_COMPILE([#include <sys/time.h>],
447 [struct timeval *tv;
448 struct timezone *tz;],
449 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
450 AC_TRY_COMPILE([#include <sys/time.h>],
451 [struct timeval *tv;
452 struct timezone *tz;
453 gettimeofday(tv, tz);],
454 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
455 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
457 dnl Checks for library functions.
458 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
459 AC_CHECK_FUNCS(poll)
461 AC_MSG_CHECKING(return type of socket size)
462 AC_TRY_COMPILE([#include <stdlib.h>
463 #include <sys/types.h>
464 #include <sys/socket.h>],
465 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
466 ac_cv_socket_size_type=["size_t"]
467 AC_MSG_RESULT(size_t),
468 ac_cv_socket_size_type=["int"]
469 AC_MSG_RESULT(int))
471 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
472 [Define type of socket size])
475 dnl #### Process table test
477 AC_PATH_PROG(PATH_TO_PS,ps)
479 AC_MSG_CHECKING(for ps syntax)
480 AC_ARG_WITH(ps_command,
481 ACX_HELP_STRING([--with-ps-command=PATH],
482 [Verbatim command to execute for ps]),
483 PS_COMMAND=$withval)
484 AC_ARG_WITH(ps_format,
485 ACX_HELP_STRING([--with-ps-format=FORMAT],
486 [Format string for scanning ps output]),
487 PS_FORMAT=$withval)
488 AC_ARG_WITH(ps_cols,
489 ACX_HELP_STRING([--with-ps-cols=NUM],
490 [Number of columns in ps command]),
491 PS_COLS=$withval)
492 AC_ARG_WITH(ps_varlist,
493 ACX_HELP_STRING([--with-ps-varlist=LIST],
494 [Variable list for sscanf of 'ps' output]),
495 PS_VARLIST=$withval)
497 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
498 ac_cv_ps_command="$PS_COMMAND"
499 ac_cv_ps_format="$PS_FORMAT"
500 ac_cv_ps_varlist="$PS_VARLIST"
501 ac_cv_ps_cols="$PS_COLS"
502 AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
504 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
505 dnl Limitation that command name is not available
506 elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
507 egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
508 then
509 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
510 ac_cv_ps_command="/usr/ucb/ps -alxwwn"
511 ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
512 ac_cv_ps_cols=8
513 AC_MSG_RESULT([$ac_cv_ps_command])
515 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
516 dnl so test for this first...
517 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
518 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
519 then
520 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
521 ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
522 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
523 ac_cv_ps_cols=9
524 AC_MSG_RESULT([$ac_cv_ps_command])
526 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
527 dnl Should also work for FreeBSD 5.2.1 and 5.3
528 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
529 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
530 egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
531 then
532 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
533 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
534 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
535 ac_cv_ps_cols=9
536 AC_MSG_RESULT([$ac_cv_ps_command])
538 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
539 dnl Limitation: Only first 16 chars returned for ucomm field
540 dnl Must come before ps -weo
541 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
542 egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
543 then
544 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
545 ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
546 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
547 ac_cv_ps_cols=9
548 AC_MSG_RESULT([$ac_cv_ps_command])
550 dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
551 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
552 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
553 then
554 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
555 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
556 ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
557 ac_cv_ps_cols=10
558 AC_MSG_RESULT([$ac_cv_ps_command])
560 dnl FreeBSD
561 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
562 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
563 then
564 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
565 ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
566 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
567 ac_cv_ps_cols=9
568 AC_MSG_RESULT([$ac_cv_ps_command])
570 dnl BSD-like mode in RH 6.1
571 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
572 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
573 then
574 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
575 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
576 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
577 ac_cv_ps_cols=9
578 AC_MSG_RESULT([$ac_cv_ps_command])
580 dnl SunOS 4.1.3:
581 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
582 dnl Need the head -1 otherwise test will work because arguments are found
583 elif ps -laxnwww 2>/dev/null | head -1 | \
584 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
585 then
586 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
587 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
588 ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
589 ac_cv_ps_cols=9
590 AC_MSG_RESULT([$ac_cv_ps_command])
592 dnl Debian Linux / procps v1.2.9:
593 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
594 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
595 dnl
596 elif ps laxnwww 2>/dev/null | \
597 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
598 then
599 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
600 ac_cv_ps_command="$PATH_TO_PS laxnwww"
601 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
602 ac_cv_ps_cols=9
603 AC_MSG_RESULT([$ac_cv_ps_command])
605 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
606 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
607 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
608 then
609 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
610 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
611 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
612 ac_cv_ps_cols=9
613 AC_MSG_RESULT([$ac_cv_ps_command])
615 dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
616 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
617 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
618 dnl of 1500). Will need big changes to check_procs to support
619 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
620 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
621 then
622 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
623 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
624 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
625 ac_cv_ps_cols=8
626 AC_MSG_RESULT([$ac_cv_ps_command])
628 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
629 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
630 then
631 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
632 ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
633 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
634 ac_cv_ps_cols=9
635 AC_MSG_RESULT([$ac_cv_ps_command])
637 dnl AIX 4.3.3 and 5.1 do not have an rss field
638 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
639 egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
640 then
641 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
642 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
643 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
644 ac_cv_ps_cols=8
645 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
647 dnl Solaris 2.6
648 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
649 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
650 then
651 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
652 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
653 # There must be no space between the %s and %n due to a wierd problem in sscanf where
654 # it will return %n as longer than the line length
655 ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
656 ac_cv_ps_cols=9
657 AC_MSG_RESULT([$ac_cv_ps_command])
659 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
660 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
661 then
662 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
663 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
664 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
665 ac_cv_ps_cols=9
666 AC_MSG_RESULT([$ac_cv_ps_command])
668 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
669 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
670 then
671 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
672 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
673 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
674 ac_cv_ps_cols=9
675 AC_MSG_RESULT([$ac_cv_ps_command])
677 dnl wonder who takes state instead of stat
678 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
679 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
680 then
681 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
682 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
683 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
684 ac_cv_ps_cols=8
685 AC_MSG_RESULT([$ac_cv_ps_command])
687 dnl IRIX 53
688 elif ps -el 2>/dev/null | \
689 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
690 then
691 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
692 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
693 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
694 ac_cv_ps_cols=8
695 AC_MSG_RESULT([$ac_cv_ps_command])
697 dnl IRIX 63
698 elif ps -el 2>/dev/null | \
699 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
700 then
701 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
702 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
703 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
704 ac_cv_ps_cols=6
705 AC_MSG_RESULT([$ac_cv_ps_command])
707 dnl AIX 4.1:
708 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
709 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
710 elif ps -el 2>/dev/null | \
711 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
712 then
713 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
714 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
715 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
716 ac_cv_ps_cols=6
717 AC_MSG_RESULT([$ac_cv_ps_command])
719 dnl AIX?
720 elif ps glaxen 2>/dev/null | \
721 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
722 then
723 ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
724 ac_cv_ps_command="$PATH_TO_PS glaxen"
725 ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
726 ac_cv_ps_cols=8
727 AC_MSG_RESULT([$ac_cv_ps_command])
729 dnl MacOSX / Darwin
730 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
731 dnl Some truncation will happen in UCOMM column
732 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
733 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
734 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
735 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
736 then
737 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
738 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
739 ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
740 ac_cv_ps_cols=8
741 AC_MSG_RESULT([$ac_cv_ps_command])
743 dnl UnixWare
744 elif ps -Al 2>/dev/null | \
745 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
746 then
747 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
748 ac_cv_ps_command="$PATH_TO_PS -Al"
749 ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
750 ac_cv_ps_cols=8
751 AC_MSG_RESULT([$ac_cv_ps_command])
753 else
754 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
755 fi
757 if test -n "$ac_cv_ps_varlist" ; then
758 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
759 [Variable list for sscanf of 'ps' output])
760 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
761 [Verbatim command to execute for ps in check_procs])
762 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
763 [Format string for scanning ps output in check_procs])
764 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
765 [Number of columns in ps command])
766 EXTRAS="$EXTRAS check_procs check_nagios"
767 if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
768 AC_DEFINE(PS_USES_PROCETIME,"yes",
769 [Whether the ps utility uses the "procetime" field])
770 fi
771 fi
773 AC_PATH_PROG(PATH_TO_PING,ping)
774 AC_PATH_PROG(PATH_TO_PING6,ping6)
776 AC_ARG_WITH(ping_command,
777 ACX_HELP_STRING([--with-ping-command=SYNTAX],
778 [sets syntax for ICMP ping]),
779 with_ping_command=$withval,)
781 AC_MSG_CHECKING(for ICMP ping syntax)
782 ac_cv_ping_packets_first=no
783 ac_cv_ping_has_timeout=no
784 if test -n "$with_ping_command"
785 then
786 AC_MSG_RESULT([(command-line) $with_ping_command])
787 if test -n "$ac_cv_ping_packets_first"
788 then
789 ac_cv_ping_packets_first=yes
790 ac_cv_ping_has_timeout=yes
791 fi
793 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
794 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
795 egrep -i "^round-trip|^rtt" >/dev/null
796 then
797 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
798 ac_cv_ping_packets_first=yes
799 AC_MSG_RESULT([$with_ping_command])
801 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
802 egrep -i "^round-trip|^rtt" >/dev/null
803 then
804 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
805 ac_cv_ping_packets_first=yes
806 ac_cv_ping_has_timeout=yes
807 AC_MSG_RESULT([$with_ping_command])
809 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
810 egrep -i "^round-trip|^rtt" >/dev/null
811 then
812 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
813 ac_cv_ping_packets_first=yes
814 AC_MSG_RESULT([$with_ping_command])
816 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
817 egrep -i "^round-trip|^rtt" >/dev/null
818 then
819 with_ping_command="$PATH_TO_PING -n -c %d %s"
820 ac_cv_ping_packets_first=yes
821 AC_MSG_RESULT([$with_ping_command])
823 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
824 egrep -i "^round-trip|^rtt" >/dev/null
825 then
826 with_ping_command="$PATH_TO_PING -n %s -c %d"
827 AC_MSG_RESULT([$with_ping_command])
829 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
830 egrep -i "^round-trip|^rtt" >/dev/null
831 then
832 with_ping_command="$PATH_TO_PING %s -n %d"
833 AC_MSG_RESULT([$with_ping_command])
835 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
836 egrep -i "^round-trip|^rtt" >/dev/null
837 then
838 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
839 AC_MSG_RESULT([$with_ping_command])
841 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
842 egrep -i "^round-trip|^rtt" >/dev/null
843 then
844 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
845 AC_MSG_RESULT([$with_ping_command])
847 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
848 egrep -i "^round-trip|^rtt" >/dev/null
849 then
850 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
851 ac_cv_ping_packets_first=yes
852 AC_MSG_RESULT([$with_ping_command])
854 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
855 egrep -i "^round-trip|^rtt" >/dev/null
856 then
857 with_ping_command="$PATH_TO_PING -n -c %d %s"
858 ac_cv_ping_packets_first=yes
859 AC_MSG_RESULT([$with_ping_command])
861 else
862 AC_MSG_WARN([unable to find usable ping syntax])
863 fi
865 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
866 [path and args for ICMP ping command])
868 if test "x$ac_cv_ping_packets_first" != "xno"
869 then
870 AC_DEFINE(PING_PACKETS_FIRST,1,
871 [Define if packet count must precede host])
872 fi
874 if test "x$ac_cv_ping_has_timeout" != "xno"
875 then
876 AC_DEFINE(PING_HAS_TIMEOUT,1,
877 [Define if ping has its own timeout option that should be set])
878 fi
880 AC_ARG_WITH(ping6_command,
881 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
882 [sets syntax for ICMPv6 ping]),
883 with_ping6_command=$withval,)
885 if test x"$with_ipv6" != xno ; then
886 AC_MSG_CHECKING(for ICMPv6 ping syntax)
887 ac_cv_ping6_packets_first=no
888 if test -n "$with_ping6_command"
889 then
890 AC_MSG_RESULT([(command-line) $with_ping6_command])
891 if test -n "$ac_cv_ping6_packets_first"
892 then
893 ac_cv_ping6_packets_first=yes
894 fi
896 elif test "x$PATH_TO_PING6" != "x"; then
897 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
898 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
899 egrep -i "^round-trip|^rtt" >/dev/null
900 then
901 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
902 ac_cv_ping6_packets_first=yes
903 AC_MSG_RESULT([$with_ping6_command])
905 elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
906 egrep -i "^round-trip|^rtt" >/dev/null
907 then
908 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
909 ac_cv_ping6_packets_first=yes
910 ac_cv_ping_has_timeout=yes
911 AC_MSG_RESULT([$with_ping6_command])
913 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
914 egrep -i "^round-trip|^rtt" >/dev/null
915 then
916 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
917 ac_cv_ping6_packets_first=yes
918 AC_MSG_RESULT([$with_ping6_command])
920 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
921 egrep -i "^round-trip|^rtt" >/dev/null
922 then
923 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
924 ac_cv_ping6_packets_first=yes
925 AC_MSG_RESULT([$with_ping6_command])
927 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
928 egrep -i "^round-trip|^rtt" >/dev/null
929 then
930 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
931 AC_MSG_RESULT([$with_ping6_command])
933 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
934 egrep -i "^round-trip|^rtt" >/dev/null
935 then
936 with_ping6_command="$PATH_TO_PING6 %s -n %d"
937 AC_MSG_RESULT([$with_ping6_command])
939 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
940 egrep -i "^round-trip|^rtt" >/dev/null
941 then
942 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
943 AC_MSG_RESULT([$with_ping6_command])
945 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
946 egrep -i "^round-trip|^rtt" >/dev/null
947 then
948 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
949 AC_MSG_RESULT([$with_ping6_command])
951 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
952 egrep -i "^round-trip|^rtt" >/dev/null
953 then
954 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
955 ac_cv_ping6_packets_first=yes
956 AC_MSG_RESULT([$with_ping_command])
958 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
959 egrep -i "^round-trip|^rtt" >/dev/null
960 then
961 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
962 ac_cv_ping6_packets_first=yes
963 AC_MSG_RESULT([$with_ping6_command])
965 fi
967 elif test "x$PATH_TO_PING" != "x"; then
968 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
969 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
970 egrep -i "^round-trip|^rtt" >/dev/null
971 then
972 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
973 ac_cv_ping6_packets_first=yes
974 AC_MSG_RESULT([$with_ping6_command])
976 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
977 egrep -i "^round-trip|^rtt" >/dev/null
978 then
979 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
980 ac_cv_ping6_packets_first=yes
981 AC_MSG_RESULT([$with_ping6_command])
983 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
984 egrep -i "^round-trip|^rtt" >/dev/null
985 then
986 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
987 ac_cv_ping6_packets_first=yes
988 AC_MSG_RESULT([$with_ping6_command])
990 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
991 egrep -i "^round-trip|^rtt" >/dev/null
992 then
993 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
994 AC_MSG_RESULT([$with_ping6_command])
996 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
997 egrep -i "^round-trip|^rtt" >/dev/null
998 then
999 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1000 AC_MSG_RESULT([$with_ping6_command])
1002 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1003 egrep -i "^round-trip|^rtt" >/dev/null
1004 then
1005 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1006 AC_MSG_RESULT([$with_ping6_command])
1008 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1009 egrep -i "^round-trip|^rtt" >/dev/null
1010 then
1011 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1012 AC_MSG_RESULT([$with_ping6_command])
1014 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1015 egrep -i "^round-trip|^rtt" >/dev/null
1016 then
1017 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1018 ac_cv_ping6_packets_first=yes
1019 AC_MSG_RESULT([$with_ping_command])
1021 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1022 egrep -i "^round-trip|^rtt" >/dev/null
1023 then
1024 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1025 ac_cv_ping6_packets_first=yes
1026 AC_MSG_RESULT([$with_ping6_command])
1028 fi
1030 fi
1032 if test "x$with_ping6_command" != "x"; then
1033 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1034 [path and args for ICMPv6 ping command])
1035 else
1036 AC_MSG_RESULT([none])
1037 fi
1039 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1040 AC_DEFINE(PING6_PACKETS_FIRST,1,
1041 [Define if packet count must precede host])
1042 fi
1043 fi
1046 AC_ARG_WITH(nslookup_command,
1047 ACX_HELP_STRING([--with-nslookup-command=PATH],
1048 [sets path to nslookup executable]),
1049 ac_cv_nslookup_command=$withval)
1050 if test -n "$ac_cv_nslookup_command"; then
1051 AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1052 else
1053 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1054 if test -n "$PATH_TO_NSLOOKUP"
1055 then
1056 AC_MSG_CHECKING(for nslookup syntax)
1057 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1058 then
1059 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1060 AC_MSG_RESULT([$ac_cv_nslookup_command])
1062 else
1063 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1064 AC_MSG_RESULT([$ac_cv_nslookup_command])
1066 fi
1067 else
1068 AC_MSG_WARN([nslookup command not found])
1069 fi
1070 fi
1072 if test -n "$ac_cv_nslookup_command"; then
1073 EXTRAS="$EXTRAS check_dns"
1074 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1075 fi
1077 AC_MSG_CHECKING([for number of cpus])
1078 AC_TRY_COMPILE([#include <unistd.h>],
1079 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1080 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
1081 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1082 AC_MSG_RESULT([cannot calculate])
1083 )
1085 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1086 AC_ARG_WITH(uptime_command,
1087 ACX_HELP_STRING([--with-uptime-command=PATH],
1088 [sets path to uptime]), PATH_TO_UPTIME=$withval)
1089 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1091 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1092 AC_ARG_WITH(rpcinfo_command,
1093 ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1094 [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1095 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1097 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1098 if test -x "$PATH_TO_LMSTAT"
1099 then
1100 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1101 else
1102 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1103 fi
1105 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1106 AC_ARG_WITH(smbclient_command,
1107 ACX_HELP_STRING([--with-smbclient-command=PATH],
1108 [sets path to smbclient]),
1109 PATH_TO_SMBCLIENT=$withval)
1110 if test -n "$PATH_TO_SMBCLIENT"
1111 then
1112 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1113 else
1114 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1115 fi
1118 AC_PATH_PROG(PATH_TO_WHO,who)
1120 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1121 then
1122 ac_cv_path_to_who="$PATH_TO_WHO -q"
1123 else
1124 ac_cv_path_to_who="$PATH_TO_WHO"
1125 fi
1127 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1128 [path and arguments for invoking 'who'])
1130 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1131 AC_ARG_WITH(snmpget_command,
1132 ACX_HELP_STRING([--with-snmpget-command=PATH],
1133 [Path to snmpget command]),
1134 PATH_TO_SNMPGET=$withval)
1135 if test -n "$PATH_TO_SNMPGET"
1136 then
1137 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1138 EXTRAS="$EXTRAS check_hpjd check_snmp"
1139 else
1140 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1141 fi
1143 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1144 AC_ARG_WITH(snmpgetnext_command,
1145 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1146 [Path to snmpgetnext command]),
1147 PATH_TO_SNMPGETNEXT=$withval)
1148 if test -n "$PATH_TO_SNMPGETNEXT"
1149 then
1150 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1151 fi
1153 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1154 then
1155 AC_MSG_CHECKING(for Net::SNMP perl module)
1156 AC_MSG_RESULT([found])
1157 else
1158 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1159 fi
1161 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1162 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1163 AC_ARG_WITH(qstat_command,
1164 ACX_HELP_STRING([--with-qstat-command=PATH],
1165 [Path to qstat command]), PATH_TO_QSTAT=$withval)
1167 if test -x "$PATH_TO_QUAKESTAT"
1168 then
1169 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1170 EXTRAS="$EXTRAS check_game"
1172 elif test -n "$PATH_TO_QSTAT"
1173 then
1174 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1175 EXTRAS="$EXTRAS check_game"
1176 else
1177 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1178 fi
1180 if test $ac_cv_path_to_qstat
1181 then
1182 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1183 [path to qstat/quakestat])
1184 fi
1186 AC_PATH_PROG(PATH_TO_FPING,fping)
1187 AC_ARG_WITH(fping_command,
1188 ACX_HELP_STRING([--with-fping-command=PATH],
1189 [Path to fping command]), PATH_TO_FPING=$withval)
1190 if test -n "$PATH_TO_FPING"
1191 then
1192 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1193 EXTRAS="$EXTRAS check_fping"
1194 else
1195 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1196 fi
1198 AC_PATH_PROG(PATH_TO_SSH,ssh)
1199 AC_ARG_WITH(ssh_command,
1200 ACX_HELP_STRING([--with-ssh-command=PATH],
1201 [sets path for ssh]), PATH_TO_SSH=$withval)
1202 if test -n "$PATH_TO_SSH"
1203 then
1204 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1205 EXTRAS="$EXTRAS check_by_ssh"
1206 else
1207 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1208 fi
1211 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1212 AC_ARG_WITH(mailq_command,
1213 ACX_HELP_STRING([--with-mailq-command=PATH],
1214 [sets path to mailq]), PATH_TO_MAILQ=$withval)
1215 if test -n "$PATH_TO_MAILQ"
1216 then
1217 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1218 else
1219 AC_MSG_WARN([Could not find mailq or eqivalent])
1220 fi
1222 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1223 if test -x "$PATH_TO_QMAIL_QSTAT"
1224 then
1225 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1226 else
1227 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1228 fi
1230 dnl SWAP info required is amount allocated/available and amount free
1231 dnl The plugin works through all the swap devices and adds up the total swap
1232 dnl available.
1233 AC_PATH_PROG(PATH_TO_SWAP,swap)
1234 if (test -n "$PATH_TO_SWAP")
1235 then
1236 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1237 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1238 then
1239 ac_cv_have_swap=yes
1240 ac_cv_swap_command="$PATH_TO_SWAP -l"
1241 if [$PATH_TO_SWAP -l 2>/dev/null | \
1242 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1243 >/dev/null]
1244 then
1245 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1246 ac_cv_swap_conv=2048
1247 AC_MSG_RESULT([using IRIX format swap])
1249 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1250 then
1251 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1252 ac_cv_swap_conv=2048
1253 AC_MSG_RESULT([using Unixware format swap])
1254 else
1255 dnl if we don't know what format swap's output is
1256 dnl we might as well pretend we didn't see it
1257 ac_cv_have_swap=""
1258 ac_cv_swap_command=""
1259 fi
1260 fi
1261 dnl end if for PATH_TO_SWAP
1262 fi
1264 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1265 if (test -n "$PATH_TO_SWAPINFO")
1266 then
1267 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1268 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1269 then
1270 ac_cv_have_swap=yes
1271 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1273 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1274 then
1275 ac_cv_swap_format=["%*s %f %*d %f"]
1276 ac_cv_swap_conv=1024
1277 AC_MSG_RESULT([using FreeBSD format swapinfo])
1278 fi
1280 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1281 then
1282 ac_cv_have_swap=yes
1283 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1284 ac_cv_swap_format=["%*s %f %*d %f"]
1285 ac_cv_swap_conv=1024
1286 AC_MSG_RESULT([using HP-UX format swapinfo])
1287 fi
1288 dnl end if for PATH_TO_SWAPINFO
1289 fi
1291 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1292 if (test -n "$PATH_TO_LSPS")
1293 then
1294 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1295 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1296 then
1297 ac_cv_have_swap=yes
1298 ac_cv_swap_command="$PATH_TO_LSPS -a"
1299 ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1300 ac_cv_swap_conv=1
1301 AC_MSG_RESULT([using AIX lsps])
1302 fi
1303 dnl end if for PATH_TO_SWAPINFO
1304 fi
1306 dnl
1307 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1308 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1309 dnl in the various BSD's
1310 dnl
1312 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1313 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1314 #ifdef HAVE_SYS_PARAM_H
1315 #include <sys/param.h>
1316 #endif
1317 ])
1318 AC_CHECK_DECLS([swapctl],,,[
1319 #include <unistd.h>
1320 #include <sys/types.h>
1321 #include <sys/param.h>
1322 #include <sys/stat.h>
1323 #include <sys/swap.h>
1324 ])
1325 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1326 #include <sys/types.h>
1327 #include <sys/param.h>
1328 #include <sys/stat.h>
1329 #include <sys/swap.h>
1330 ])
1331 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1332 #include <unistd.h>
1333 #include <sys/types.h>
1334 #include <sys/param.h>
1335 #include <sys/stat.h>
1336 #include <sys/swap.h>
1337 ])
1339 if test "$ac_cv_have_decl_swapctl" = "yes";
1340 then
1341 EXTRAS="$EXTRAS check_swap"
1342 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1343 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1344 "$ac_cv_type_swapent_t" = "yes";
1345 then
1346 AC_MSG_RESULT([yes])
1347 ac_cv_check_swap_swapctl_svr4="1";
1348 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1349 [Define if 2-argument SVR4 swapctl exists])
1350 else
1351 AC_MSG_RESULT([no])
1352 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1353 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1354 then
1355 AC_MSG_RESULT([yes])
1356 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1357 [Define if 3-argument BSD swapctl exists])
1358 else
1359 AC_MSG_RESULT([no])
1360 fi
1361 fi
1362 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1363 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1364 then
1365 dnl
1366 dnl the SVR4 spec returns values in pages
1367 dnl
1368 AC_MSG_RESULT([page])
1369 AC_CHECK_DECLS([sysconf])
1370 AC_MSG_CHECKING([for system page size])
1371 if test "$ac_cv_have_decl_sysconf" = "yes";
1372 then
1373 AC_MSG_RESULT([determined by sysconf(3)])
1374 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1375 else
1376 AC_MSG_WARN([don't know. guessing 4096k])
1377 ac_cv_swap_conv=256
1378 fi
1379 else
1380 dnl
1381 dnl the BSD spec returns values in blocks
1382 dnl
1383 AC_MSG_RESULT([blocks (assuming 512b)])
1384 ac_cv_swap_conv=2048
1385 fi
1386 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1387 [Conversion factor to MB])
1388 fi
1389 dnl
1390 dnl end tests for the swapctl system calls
1391 dnl
1394 if test "x$ac_cv_have_swap" != "x"
1395 then
1396 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1397 EXTRAS="$EXTRAS check_swap"
1398 fi
1399 if test "x$ac_cv_swap_command" != "x"
1400 then
1401 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1402 [Path to swap/swapinfo binary, with any args])
1403 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1404 [Format string for parsing swap output])
1405 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1406 [Conversion factor to MB])
1407 fi
1409 AC_ARG_WITH(proc-meminfo,
1410 ACX_HELP_STRING([--with-proc-meminfo=PATH],
1411 [path to /proc/meminfo or equivalent]),
1412 ac_cv_proc_meminfo=$withval)
1413 dnl dunno why this does not work below - use hack (kbd)
1414 dnl fine on linux, broken on solaris
1415 dnl if /bin/test -e "/proc/meminfo"
1416 AC_MSG_CHECKING([for /proc/meminfo])
1417 if test -n "$ac_cv_proc_meminfo"; then
1418 AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1419 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1420 AC_MSG_RESULT([found /proc/meminfo])
1421 ac_cv_proc_meminfo="/proc/meminfo"
1422 else
1423 AC_MSG_RESULT([no])
1424 fi
1426 if test -n "$ac_cv_proc_meminfo"; then
1427 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1428 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1429 EXTRAS="$EXTRAS check_swap"
1430 fi
1432 AC_PATH_PROG(PATH_TO_DIG,dig)
1433 AC_ARG_WITH(dig_command,
1434 ACX_HELP_STRING([--with-dig-command=PATH],
1435 [Path to dig command]), PATH_TO_DIG=$withval)
1436 if test -n "$PATH_TO_DIG"; then
1437 EXTRAS="$EXTRAS check_dig"
1438 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1439 fi
1441 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1442 AC_ARG_WITH(apt-get_command,
1443 ACX_HELP_STRING([--with-apt-get-command=PATH],
1444 [Path to apt-get command]),
1445 with_apt_get_command=$withval,
1446 with_apt_get_command=$PATH_TO_APTGET)
1447 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1448 if test -n "$PATH_TO_APTGET" ; then
1449 EXTRAS="$EXTRAS check_apt"
1450 fi
1453 if test -f plugins/check_nt.c ; then
1454 EXTRAS="$EXTRAS check_nt"
1455 elif test -f ../plugins/check_nt.c ; then
1456 EXTRAS="$EXTRAS check_nt"
1457 fi
1460 dnl used in check_dhcp
1461 AC_CHECK_HEADERS(sys/sockio.h)
1463 case $host in
1464 *bsd*)
1465 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1466 ;;
1467 *linux*)
1468 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1469 ;;
1470 *sun* | solaris*)
1471 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1472 ;;
1473 *hpux*)
1474 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1475 ;;
1476 esac
1478 AC_SUBST(EXTRAS)
1479 AC_SUBST(EXTRAS_ROOT)
1480 AC_SUBST(EXTRA_NETOBJS)
1481 AC_SUBST(DEPLIBS)
1483 AM_GNU_GETTEXT([external], [need-ngettext])
1484 AM_GNU_GETTEXT_VERSION(0.15)
1486 dnl Check for Redhat spopen problem
1487 dnl Wierd problem where ECHILD is returned from a wait call in error
1488 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1489 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1490 dnl We patch plugins/popen.c
1491 dnl Need to add smp because uname different on those
1492 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1493 AC_ARG_ENABLE(redhat-pthread-workaround,
1494 AC_HELP_STRING([--enable-redhat-pthread-workaround],
1495 [force Redhat patch to be applied (default: test system)]),
1496 [ac_cv_enable_redhat_pthread_workaround=$enableval],
1497 [ac_cv_enable_redhat_pthread_workaround=test])
1498 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1499 if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1500 AC_MSG_CHECKING(for redhat spopen problem)
1501 ( cd config_test && make && make test ) > /dev/null 2>&1
1502 if test $? -eq 0 ; then
1503 AC_MSG_RESULT(okay)
1504 else
1505 AC_MSG_RESULT(error)
1506 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1507 fi
1508 fi
1509 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1510 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1511 fi
1513 dnl Perl modules
1514 AC_ARG_ENABLE(perl-modules,
1515 AC_HELP_STRING([--enable-perl-modules],
1516 [Enables installation of Nagios::Plugin and its dependencies (default: no)]),
1517 [enable_perl_modules=$enableval],
1518 [enable_perl_modules=no])
1519 if test "$enable_perl_modules" = "yes" ; then
1520 AC_SUBST(PERLMODS_DIR,perlmods)
1521 fi
1523 dnl External libraries - see ACKNOWLEDGEMENTS
1524 gl_INIT
1526 dnl Some helpful common compile errors checked here
1527 if test "$ac_cv_uname_s" = 'SunOS' -a "$ac_cv_prog_ac_ct_AR" = 'false' ; then
1528 AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1529 fi
1531 AC_OUTPUT(
1532 Makefile
1533 lib/Makefile
1534 plugins/Makefile
1535 lib/tests/Makefile
1536 plugins-root/Makefile
1537 plugins-scripts/Makefile
1538 plugins-scripts/subst
1539 plugins-scripts/utils.pm
1540 plugins-scripts/utils.sh
1541 perlmods/Makefile
1542 command.cfg
1543 test.pl
1544 pkg/solaris/pkginfo
1545 po/Makefile.in
1546 )
1549 dnl the ones below that are commented out need to be cleaned up
1550 dnl in the configure code above to use with_foo instead of ac_cv_foo
1551 dnl if we want them to show up here. it'd also make the code cleaner.
1552 dnl i'll get to that on another rainy day :) -sf
1553 ACX_FEATURE([with],[apt-get-command])
1554 dnl ACX_FEATURE([with],[dig-command])
1555 dnl ACX_FEATURE([with],[fping-command])
1556 dnl ACX_FEATURE([with],[mailq-command])
1557 dnl ACX_FEATURE([with],[nslookup-command])
1558 ACX_FEATURE([with],[ping6-command])
1559 ACX_FEATURE([with],[ping-command])
1560 dnl ACX_FEATURE([with],[qstat-command])
1561 dnl ACX_FEATURE([with],[rpcinfo-command])
1562 dnl ACX_FEATURE([with],[smbclient-command])
1563 dnl ACX_FEATURE([with],[snmpget-command])
1564 dnl ACX_FEATURE([with],[snmpgetnext-command])
1565 dnl ACX_FEATURE([with],[ssh-command])
1566 dnl ACX_FEATURE([with],[uptime-command])
1568 dnl ACX_FEATURE([with],[proc-meminfo])
1569 dnl ACX_FEATURE([with],[ps-command])
1570 dnl ACX_FEATURE([with],[ps-format])
1571 dnl ACX_FEATURE([with],[ps-cols])
1572 dnl ACX_FEATURE([with],[ps-varlist])
1574 ACX_FEATURE([with],[ipv6])
1575 ACX_FEATURE([with],[mysql])
1576 ACX_FEATURE([with],[openssl])
1577 ACX_FEATURE([with],[gnutls])
1578 ACX_FEATURE([with],[perl])
1579 ACX_FEATURE([enable],[perl-modules])
1580 ACX_FEATURE([with],[cgiurl])
1581 ACX_FEATURE([with],[trusted-path])