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