Code

Fix compilation of check_ldap, check_radius and check_pgsql (*ding*)
[nagiosplug.git] / configure.in
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.8)
5 AC_CONFIG_SRCDIR(NPTest.pm)
6 AC_CONFIG_FILES(gl/Makefile)
7 AC_CONFIG_AUX_DIR(build-aux)
8 AM_INIT_AUTOMAKE([1.8.3])
9 AM_CONFIG_HEADER(config.h)
10 AC_CANONICAL_HOST
12 RELEASE=1
13 AC_SUBST(RELEASE)
15 AC_PREFIX_DEFAULT(/usr/local/nagios)
17 dnl Deprecated configure options
20 dnl Append user (-o), group (-g), mode (-m) to install command
21 dnl There is an assumption that this is possible with ./configure's chosen install command
22 extra_install_args=""
23 AC_ARG_WITH(nagios_user,
24         ACX_HELP_STRING([--with-nagios-user=USER],
25                 [Installs executables with this user. Defaults to install user]),
26         extra_install_args="-o $withval")
27 AC_ARG_WITH(nagios_group,
28         ACX_HELP_STRING([--with-nagios-group=GROUP],
29                 [Installs executables with this group. Defaults to install user]),
30         extra_install_args="$extra_install_args -g $withval")
31 AC_ARG_WITH(world_permissions,
32         ACX_HELP_STRING([--without-world-permissions],
33                 [Installs executables without world permissions]))
35 if test "x$with_world_permissions" = xno ; then
36         extra_install_args="$extra_install_args -m 0550"
37 fi
39 INSTALL="$INSTALL $extra_install_args"
40 INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args"
41 AC_SUBST(INSTALL)
43 AC_PROG_CC
44 gl_EARLY
45 AC_PROG_GCC_TRADITIONAL
46 AC_PROG_LIBTOOL
48 AM_PROG_CC_C_O
50 AC_FUNC_ERROR_AT_LINE
52 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
54 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
55 AC_SUBST(PLUGIN_TEST)dnl
57 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
58 AC_SUBST(SCRIPT_TEST)dnl
60 WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
61 AC_SUBST(WARRANTY)
63 SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
64 AC_SUBST(SUPPORT)
66 dnl CGIURL has changed for Nagios with 1.0 beta
67 AC_ARG_WITH(cgiurl,
68         ACX_HELP_STRING([--with-cgiurl=DIR],
69                 [sets URL for cgi programs]),
70         with_cgiurl=$withval,
71         with_cgiurl=/nagios/cgi-bin)
72 CGIURL="$with_cgiurl"
73 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
75 AC_ARG_WITH(trusted_path,
76         ACX_HELP_STRING([--with-trusted-path=PATH],
77                 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
78         with_trusted_path=$withval,
79         with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
80 AC_SUBST(with_trusted_path)
82 EXTRAS=
83 EXTRAS_ROOT=
84 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
86 LDFLAGS="$LDFLAGS -L."
88 ac_cv_uname_m=`uname -m`
89 ac_cv_uname_s=`uname -s`
90 ac_cv_uname_r=`uname -r`
91 ac_cv_uname_v=`uname -v`
93 PKG_ARCH=`uname -p`
94 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
95 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
97 AC_SUBST(PKG_ARCH)
98 AC_SUBST(REV_DATESTAMP)
99 AC_SUBST(REV_TIMESTAMP)
101 dnl Checks for programs.
102 AC_PATH_PROG(PYTHON,python)
103 AC_PATH_PROG(SH,sh)
104 AC_PATH_PROG(PERL,perl)
105 AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
106 AC_PATH_PROG(HOSTNAME,hostname)
107 AC_PATH_PROG(BASENAME,basename)
109 dnl allow them to override the path of perl
110 AC_ARG_WITH(perl,
111         ACX_HELP_STRING([--with-perl=PATH],
112                         [sets path to perl executable]),
113                         with_perl=$withval,with_perl=$PERL)
114 AC_SUBST(PERL, $with_perl)
116 dnl openssl/gnutls
117 AC_ARG_WITH(openssl,
118             AC_HELP_STRING([--with-openssl=DIR], 
119                            [path to openssl installation]),)
121 AC_ARG_WITH(gnutls,
122             ACX_HELP_STRING([--with-gnutls=PATH],
123                             [path to gnutls installation root]),)
125 dnl you can only have one or the other
126 if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
127         with_gnutls="no"
128 fi
129 if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
130         with_openssl="no"
131 fi
133 dnl list of possible dirs to try to autodetect openssl
134 dnl if $dir/include exists, we consider it found
135 dnl the order should allow locally installed versions to override distros' ones
136 OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
137               /opt /opt/openssl"
140 dnl
141 dnl Checks for libraries.
142 dnl
144 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
145 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
146 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
147 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
148 AC_SUBST(SOCKETLIBS)
150 dnl
151 dnl check for math-related functions needing -lm
152 AC_CHECK_HEADERS(math.h)
153 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
154 AC_SUBST(MATHLIBS)
156 dnl Check for libtap, to run perl-like tests
157 AC_CHECK_LIB(tap, plan_tests, 
158         EXTRA_TEST="test_utils test_disk"
159         AC_SUBST(EXTRA_TEST)
160         )
162 dnl Check for PostgreSQL libraries
163 _SAVEDLIBS="$LIBS"
164 _SAVEDCPPFLAGS="$CPPFLAGS"
165 AC_ARG_WITH(pgsql,
166         ACX_HELP_STRING([--with-pgsql=DIR],
167                 [sets path to pgsql installation]),
168         PGSQL=$withval,)
169 AC_CHECK_LIB(crypt,main)
170 if test "$ac_cv_lib_crypt_main" = "yes"; then
171   if test -n "$PGSQL"; then
172     LDFLAGS="$LDFLAGS -L$PGSQL/lib"
173     CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
174   fi
175   AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
176   if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
177     AC_CHECK_HEADERS(pgsql/libpq-fe.h)
178     AC_CHECK_HEADERS(postgresql/libpq-fe.h)
179     AC_CHECK_HEADERS(libpq-fe.h)
180     if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
181       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
182       PGINCLUDE="-I$PGSQL/include"
183     elif test  "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
184       PGLIBS="-lpq -lcrypt"
185       PGINCLUDE="-I/usr/include/pgsql"
186     elif test  "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
187       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
188       PGINCLUDE="-I/usr/include/postgresql"
189     elif test  "$ac_cv_header_libpq_fe_h" = "yes"; then
190       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
191       PGINCLUDE="-I$PGSQL/include"
192     fi
193     if test -z "$PGINCLUDE"; then
194       AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
195       AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
196     else
197       AC_SUBST(PGLIBS)
198       AC_SUBST(PGINCLUDE)
199       EXTRAS="$EXTRAS check_pgsql"
200     fi
201   else
202     AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
203     AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
204     AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
205   fi
206 else
207   AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
208   AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
209 fi
210 LIBS="$_SAVEDLIBS"
211 CPPFLAGS="$_SAVEDCPPFLAGS"
213 dnl Check for radius libraries
214 _SAVEDLIBS="$LIBS"
215 AC_CHECK_LIB(radiusclient,rc_read_config)
216 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
217   EXTRAS="$EXTRAS check_radius"
218         RADIUSLIBS="-lradiusclient"
219   AC_SUBST(RADIUSLIBS)
220 else
221   AC_MSG_WARN([Skipping radius plugin])
222   AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
223 fi
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).])
240 fi
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)
256 fi
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])
277 fi
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)
290 fi
291 AC_SUBST(KRBINCLUDE)
292 if test "$FOUNDINCLUDE" = "no"; then
293   CPPFLAGS="$_SAVEDCPPFLAGS"
294 fi
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
354 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
368 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"
390 fi
392 dnl
393 dnl Checks for header files.
394 dnl
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
424 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]
575 dnl
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])
735 fi
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
751 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])
843 fi
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])
852 fi
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])
858 fi
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
1010 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])
1017 fi
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])
1022 fi
1023 fi
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
1050 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])
1055 fi
1057 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1058 AC_ARG_WITH(uptime_command,
1059             ACX_HELP_STRING([--with-uptime-command=PATH],
1060                             [sets path to uptime]), PATH_TO_UPTIME=$withval)
1061 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1063 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1064 AC_ARG_WITH(rpcinfo_command,
1065             ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1066                             [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1067 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1069 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1070 if test -x "$PATH_TO_LMSTAT"
1071 then
1072         AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1073 else
1074         AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1075 fi
1077 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1078 AC_ARG_WITH(smbclient_command,
1079             ACX_HELP_STRING([--with-smbclient-command=PATH],
1080                             [sets path to smbclient]), 
1081             PATH_TO_SMBCLIENT=$withval)
1082 if test -n "$PATH_TO_SMBCLIENT"
1083 then
1084         AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1085 else
1086         AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1087 fi
1090 AC_PATH_PROG(PATH_TO_WHO,who)
1092 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1093 then
1094         ac_cv_path_to_who="$PATH_TO_WHO -q"
1095 else
1096         ac_cv_path_to_who="$PATH_TO_WHO"
1097 fi
1099 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1100         [path and arguments for invoking 'who'])
1102 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1103 AC_ARG_WITH(snmpget_command,
1104             ACX_HELP_STRING([--with-snmpget-command=PATH],
1105                             [Path to snmpget command]),
1106             PATH_TO_SNMPGET=$withval)
1107 if test -n "$PATH_TO_SNMPGET"
1108 then
1109         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1110         EXTRAS="$EXTRAS check_hpjd check_snmp"
1111 else
1112         AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1113 fi
1115 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1116 AC_ARG_WITH(snmpgetnext_command,
1117             ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1118                             [Path to snmpgetnext command]),
1119             PATH_TO_SNMPGETNEXT=$withval)
1120 if test -n "$PATH_TO_SNMPGETNEXT"
1121 then
1122         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1123 fi
1125 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null  )
1126 then
1127         AC_MSG_CHECKING(for Net::SNMP perl module)
1128         AC_MSG_RESULT([found])
1129 else
1130         AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1131 fi
1133 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1134 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1135 AC_ARG_WITH(qstat_command,
1136             ACX_HELP_STRING([--with-qstat-command=PATH], 
1137                             [Path to qstat command]), PATH_TO_QSTAT=$withval)
1139 if test -x "$PATH_TO_QUAKESTAT"
1140 then
1141         ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1142         EXTRAS="$EXTRAS check_game"
1144 elif test -n "$PATH_TO_QSTAT"
1145 then
1146         ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1147         EXTRAS="$EXTRAS check_game"
1148 else
1149         AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1150 fi
1152 if test $ac_cv_path_to_qstat 
1153 then
1154         AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1155                 [path to qstat/quakestat])
1156 fi
1158 AC_PATH_PROG(PATH_TO_FPING,fping)
1159 AC_ARG_WITH(fping_command,
1160             ACX_HELP_STRING([--with-fping-command=PATH],
1161                             [Path to fping command]), PATH_TO_FPING=$withval)
1162 if test -n "$PATH_TO_FPING"
1163 then
1164         AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1165         EXTRAS="$EXTRAS check_fping"
1166 else
1167         AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1168 fi
1170 AC_PATH_PROG(PATH_TO_SSH,ssh)
1171 AC_ARG_WITH(ssh_command,
1172             ACX_HELP_STRING([--with-ssh-command=PATH],
1173                             [sets path for ssh]), PATH_TO_SSH=$withval)
1174 if test -n "$PATH_TO_SSH"
1175 then
1176         AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1177         EXTRAS="$EXTRAS check_by_ssh"
1178 else
1179         AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1180 fi
1183 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1184 AC_ARG_WITH(mailq_command,
1185             ACX_HELP_STRING([--with-mailq-command=PATH],
1186                             [sets path to mailq]), PATH_TO_MAILQ=$withval)
1187 if test -n "$PATH_TO_MAILQ"
1188 then
1189         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1190 else
1191         AC_MSG_WARN([Could not find mailq or eqivalent])
1192 fi
1194 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1195 if test -x "$PATH_TO_QMAIL_QSTAT"
1196 then
1197         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1198 else
1199         AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1200 fi
1202 dnl SWAP info required is amount allocated/available and amount free
1203 dnl The plugin works through all the swap devices and adds up the total swap
1204 dnl available.
1205 AC_PATH_PROG(PATH_TO_SWAP,swap)
1206 if (test -n "$PATH_TO_SWAP")
1207 then
1208 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1209 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1210 then
1211         ac_cv_have_swap=yes
1212         ac_cv_swap_command="$PATH_TO_SWAP -l"
1213         if [$PATH_TO_SWAP -l 2>/dev/null | \
1214                 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1215                 >/dev/null]
1216         then
1217                 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1218                 ac_cv_swap_conv=2048
1219                 AC_MSG_RESULT([using IRIX format swap])
1221         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1222         then
1223                 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1224                 ac_cv_swap_conv=2048
1225                 AC_MSG_RESULT([using Unixware format swap])
1226         else
1227                 dnl if we don't know what format swap's output is
1228                 dnl we might as well pretend we didn't see it
1229                 ac_cv_have_swap=""
1230                 ac_cv_swap_command=""
1231         fi
1232 fi
1233 dnl end if for PATH_TO_SWAP
1234 fi
1236 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1237 if (test -n "$PATH_TO_SWAPINFO")
1238 then
1239 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1240 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1241 then
1242         ac_cv_have_swap=yes
1243         ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1245         if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1246         then
1247                 ac_cv_swap_format=["%*s %f %*d %f"]
1248                 ac_cv_swap_conv=1024
1249                 AC_MSG_RESULT([using FreeBSD format swapinfo])
1250         fi
1252 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1253 then
1254         ac_cv_have_swap=yes
1255         ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1256         ac_cv_swap_format=["%*s %f %*d %f"]
1257         ac_cv_swap_conv=1024
1258         AC_MSG_RESULT([using HP-UX format swapinfo])
1259 fi
1260 dnl end if for PATH_TO_SWAPINFO
1261 fi
1263 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1264 if (test -n "$PATH_TO_LSPS")
1265 then
1266 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1267 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1268 then
1269         ac_cv_have_swap=yes
1270         ac_cv_swap_command="$PATH_TO_LSPS -a"
1271         ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1272         ac_cv_swap_conv=1
1273         AC_MSG_RESULT([using AIX lsps])
1274 fi
1275 dnl end if for PATH_TO_SWAPINFO
1276 fi
1278 dnl
1279 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1280 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1281 dnl in the various BSD's
1282 dnl
1284 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1285 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1286 #ifdef HAVE_SYS_PARAM_H
1287 #include <sys/param.h>
1288 #endif
1289 ])
1290 AC_CHECK_DECLS([swapctl],,,[
1291                #include <unistd.h>
1292                #include <sys/types.h>
1293                #include <sys/param.h>
1294                #include <sys/stat.h>
1295                #include <sys/swap.h>
1296                ])
1297 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1298                #include <sys/types.h>
1299                #include <sys/param.h>
1300                #include <sys/stat.h>
1301                #include <sys/swap.h>
1302                ])
1303 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1304                #include <unistd.h>
1305                #include <sys/types.h>
1306                #include <sys/param.h>
1307                #include <sys/stat.h>
1308                #include <sys/swap.h>
1309                ])
1311 if test "$ac_cv_have_decl_swapctl" = "yes"; 
1312 then
1313         EXTRAS="$EXTRAS check_swap"
1314         AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1315         if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1316                 "$ac_cv_type_swapent_t" = "yes"; 
1317         then
1318                 AC_MSG_RESULT([yes])
1319                 ac_cv_check_swap_swapctl_svr4="1";
1320                 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1321                           [Define if 2-argument SVR4 swapctl exists])
1322         else
1323                 AC_MSG_RESULT([no])
1324                 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1325                 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes"; 
1326                 then
1327                         AC_MSG_RESULT([yes])
1328                         AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1329                                   [Define if 3-argument BSD swapctl exists])
1330                 else
1331                         AC_MSG_RESULT([no])
1332                 fi
1333         fi
1334         AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1335         if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1336         then
1337                 dnl
1338                 dnl the SVR4 spec returns values in pages
1339                 dnl
1340                 AC_MSG_RESULT([page])
1341                 AC_CHECK_DECLS([sysconf])
1342                 AC_MSG_CHECKING([for system page size])
1343                 if test "$ac_cv_have_decl_sysconf" = "yes";
1344                 then
1345                         AC_MSG_RESULT([determined by sysconf(3)])
1346                         ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1347                 else
1348                         AC_MSG_WARN([don't know. guessing 4096k])
1349                         ac_cv_swap_conv=256
1350                 fi
1351         else
1352                 dnl
1353                 dnl the BSD spec returns values in blocks
1354                 dnl
1355                 AC_MSG_RESULT([blocks (assuming 512b)])
1356                 ac_cv_swap_conv=2048
1357         fi
1358         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1359                 [Conversion factor to MB])
1360 fi
1361 dnl
1362 dnl end tests for the swapctl system calls
1363 dnl
1366 if test "x$ac_cv_have_swap" != "x" 
1367 then
1368         AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1369         EXTRAS="$EXTRAS check_swap"
1370 fi
1371 if test "x$ac_cv_swap_command" != "x" 
1372 then
1373         AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1374                 [Path to swap/swapinfo binary, with any args])
1375         AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1376                 [Format string for parsing swap output])
1377         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1378                 [Conversion factor to MB])
1379 fi
1381 AC_ARG_WITH(proc-meminfo,
1382             ACX_HELP_STRING([--with-proc-meminfo=PATH],
1383                             [path to /proc/meminfo or equivalent]),
1384                             ac_cv_proc_meminfo=$withval)
1385 dnl dunno why this does not work below - use hack (kbd)
1386 dnl fine on linux, broken on solaris
1387 dnl if /bin/test -e "/proc/meminfo"
1388 AC_MSG_CHECKING([for /proc/meminfo])
1389 if test -n "$ac_cv_proc_meminfo"; then
1390         AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1391 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1392         AC_MSG_RESULT([found /proc/meminfo])
1393         ac_cv_proc_meminfo="/proc/meminfo"
1394 else
1395         AC_MSG_RESULT([no])
1396 fi
1398 if test -n "$ac_cv_proc_meminfo"; then
1399         AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1400         AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1401         EXTRAS="$EXTRAS check_swap"
1402 fi
1404 AC_PATH_PROG(PATH_TO_DIG,dig)
1405 AC_ARG_WITH(dig_command,
1406             ACX_HELP_STRING([--with-dig-command=PATH],
1407                             [Path to dig command]), PATH_TO_DIG=$withval)
1408 if test -n "$PATH_TO_DIG"; then
1409         EXTRAS="$EXTRAS check_dig"
1410         AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1411 fi
1413 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1414 AC_ARG_WITH(apt-get_command,
1415             ACX_HELP_STRING([--with-apt-get-command=PATH],
1416                             [Path to apt-get command]), 
1417                             with_apt_get_command=$withval,
1418                             with_apt_get_command=$PATH_TO_APTGET)
1419 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1420 if test -n "$PATH_TO_APTGET" ; then
1421         EXTRAS="$EXTRAS check_apt"
1422 fi
1425 if test -f plugins/check_nt.c ; then
1426   EXTRAS="$EXTRAS check_nt"
1427 elif test -f ../plugins/check_nt.c ; then
1428   EXTRAS="$EXTRAS check_nt"
1429 fi
1432 case $host in
1433         *bsd*)
1434                 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1435         ;;
1436         *linux*)
1437                 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1438         ;;
1439         *sun* | solaris*)
1440                 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1441         ;;
1442         *hpux*)  
1443                 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1444         ;;
1445 esac
1447 AC_SUBST(EXTRAS)
1448 AC_SUBST(EXTRAS_ROOT)
1449 AC_SUBST(EXTRA_NETOBJS)
1450 AC_SUBST(DEPLIBS)
1452 AM_GNU_GETTEXT([external], [need-ngettext])
1453 AM_GNU_GETTEXT_VERSION(0.13.1)
1455 dnl Check for Redhat spopen problem
1456 dnl Wierd problem where ECHILD is returned from a wait call in error
1457 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1458 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1459 dnl We patch plugins/popen.c
1460 dnl Need to add smp because uname different on those
1461 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1462 AC_ARG_ENABLE(redhat-pthread-workaround, 
1463         AC_HELP_STRING([--enable-redhat-pthread-workaround], 
1464                 [force Redhat patch to be applied (default: test system)]),
1465         [ac_cv_enable_redhat_pthread_workaround=$enableval],
1466         [ac_cv_enable_redhat_pthread_workaround=test])
1467 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1468         if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1469                 AC_MSG_CHECKING(for redhat spopen problem)
1470                 ( cd config_test && make && make test ) > /dev/null 2>&1
1471                 if test $? -eq 0 ; then
1472                         AC_MSG_RESULT(okay)
1473                 else
1474                         AC_MSG_RESULT(error)
1475                         AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1476                 fi
1477         fi
1478 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1479         AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1480 fi
1482 dnl External libraries - see ACKNOWLEDGEMENTS
1483 gl_INIT
1485 dnl Some helpful common compile errors checked here
1486 if test "$ac_cv_uname_s" = 'SunOS' -a "$ac_cv_prog_ac_ct_AR" = 'false' ; then
1487         AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1488 fi
1490 AC_OUTPUT(
1491   Makefile 
1492   lib/Makefile 
1493   plugins/Makefile 
1494   lib/tests/Makefile
1495   plugins-root/Makefile
1496   plugins-scripts/Makefile 
1497   plugins-scripts/subst 
1498   plugins-scripts/utils.pm 
1499   plugins-scripts/utils.sh 
1500   command.cfg 
1501   test.pl 
1502   pkg/solaris/pkginfo 
1503   po/Makefile.in 
1507 dnl the ones below that are commented out need to be cleaned up 
1508 dnl in the configure code above to use with_foo instead of ac_cv_foo
1509 dnl if we want them to show up here.  it'd also make the code cleaner.
1510 dnl i'll get to that on another rainy day :) -sf
1511 ACX_FEATURE([with],[apt-get-command])
1512 dnl ACX_FEATURE([with],[dig-command])
1513 dnl ACX_FEATURE([with],[fping-command])
1514 dnl ACX_FEATURE([with],[mailq-command])
1515 dnl ACX_FEATURE([with],[nslookup-command])
1516 ACX_FEATURE([with],[ping6-command])
1517 ACX_FEATURE([with],[ping-command])
1518 dnl ACX_FEATURE([with],[qstat-command])
1519 dnl ACX_FEATURE([with],[rpcinfo-command])
1520 dnl ACX_FEATURE([with],[smbclient-command])
1521 dnl ACX_FEATURE([with],[snmpget-command])
1522 dnl ACX_FEATURE([with],[snmpgetnext-command])
1523 dnl ACX_FEATURE([with],[ssh-command])
1524 dnl ACX_FEATURE([with],[uptime-command])
1526 dnl ACX_FEATURE([with],[proc-meminfo])
1527 dnl ACX_FEATURE([with],[ps-command])
1528 dnl ACX_FEATURE([with],[ps-format])
1529 dnl ACX_FEATURE([with],[ps-cols])
1530 dnl ACX_FEATURE([with],[ps-varlist])
1532 ACX_FEATURE([with],[ipv6])
1533 ACX_FEATURE([with],[mysql])
1534 ACX_FEATURE([with],[openssl])
1535 ACX_FEATURE([with],[gnutls])
1536 ACX_FEATURE([with],[perl])
1537 ACX_FEATURE([with],[cgiurl])
1538 ACX_FEATURE([with],[trusted-path])