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