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