Code

1.4.7 release
[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.7)
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 dnl Default is to search path for mysql_config
245 AC_ARG_WITH(mysql,
246         ACX_HELP_STRING([--with-mysql=DIR],
247                 [Compiles mysql plugins. Expects DIR/bin/mysql_config]),
248         with_mysql=$withval,
249         with_mysql=yes)
250 if test $with_mysql != "no" ; then
251   if test -x $with_mysql/bin/mysql_config ; then
252     MYSQLCONFIG="$with_mysql/bin/mysql_config"
253   else
254     AC_PATH_PROG(MYSQLCONFIG, mysql_config)
255   fi
256   if test -z "$MYSQLCONFIG"; then
257     with_mysql="not found"
258     AC_MSG_WARN([Skipping mysql plugin])
259     AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
260   else
261     MYSQLINCLUDE=`$MYSQLCONFIG --include`
262     # Mysql 3 does not support --include. --cflags should be sufficient
263     if test $? -ne 0 ; then
264       MYSQLINCLUDE=""
265       TEMP_INCLUDE="-I$with_mysql/include"      # Guessed location
266     else
267       TEMP_INCLUDE=$MYSQLINCLUDE
268     fi
269     MYSQLLIBS=`$MYSQLCONFIG --libs`
270     MYSQLCFLAGS=`$MYSQLCONFIG --cflags`
271     AC_SUBST(MYSQLINCLUDE)
272     AC_SUBST(MYSQLLIBS)
273     AC_SUBST(MYSQLCFLAGS)
274     dnl Test for mysqlclient. Some redhat systems have mysql_config, but no headers
275     _SAVEDCPPFLAGS=$CPPFLAGS
276     _SAVEDLDFLAGS="$LDFLAGS"
277     CPPFLAGS="$CPPFLAGS $TEMP_INCLUDE"
278     LDFLAGS="$LDFLAGS $MYSQLLIBS"
279     AC_CHECK_LIB([mysqlclient], [mysql_init], [with_mysql=$MYSQLCONFIG
280 EXTRAS="$EXTRA check_mysql check_mysql_query"], [with_mysql="not found"])
281     CPPFLAGS=$_SAVEDCPPFLAGS
282     LDFLAGS=$_SAVEDLDFLAGS
283   fi
284 fi
286 dnl Check for AF_INET6 support - unistd.h required for Darwin
287 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
288         AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
289                         #include <unistd.h>
290                         #endif
291                         #include <netinet/in.h>
292                         #include <sys/socket.h>],
293                         [struct sockaddr_in6 sin6;
294                         void *p;
296                         sin6.sin6_family = AF_INET6;
297                         sin6.sin6_port = 587;
298                         p = &sin6.sin6_addr;],
299                         [with_ipv6=yes], 
300                         [with_ipv6=no])
301         ])
303 if test x"$with_ipv6" != xno ; then
304         AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
305 fi
308 dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
309 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
310 if test "$FOUNDINCLUDE" = "no"; then
311   _SAVEDCPPFLAGS="$CPPFLAGS"
312   CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
313   unset ac_cv_header_krb5_h
314   AC_CHECK_HEADERS(krb5.h,
315                    KRB5INCLUDE="-I/usr/kerberos/include"
316                    FOUNDINCLUDE=yes,
317                    FOUNDINCLUDE=no)
318 fi
319 AC_SUBST(KRBINCLUDE)
320 if test "$FOUNDINCLUDE" = "no"; then
321   CPPFLAGS="$_SAVEDCPPFLAGS"
322 fi
325 dnl openssl detection/configuration
326 if ! test x"$with_openssl" = x"no"; then
327         dnl Check for OpenSSL location if it wasn't already specified
328         if ! test -d "$with_openssl"; then
329                 for d in $OPENSSL_DIRS; do
330                         if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
331                                 with_openssl=$d
332                         fi
333                 done
334         fi
336         _SAVEDCPPFLAGS="$CPPFLAGS"
337         _SAVEDLDFLAGS="$LDFLAGS"
338         dnl Check for OpenSSL header files
339         unset FOUNDINCLUDE
340         if test x"$with_openssl" != x"/usr" ; then
341                 CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
342                 LDFLAGS="$LDFLAGS -L$with_openssl/lib"
343         fi
345         dnl check for openssl in $dir/include/openssl
346         AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
347                          SSLINCLUDE="-I$with_openssl/include"
348                          FOUNDINCLUDE=yes,
349                          FOUNDINCLUDE=no)
350         dnl else check to see if $dir/include has it
351         if test "$FOUNDINCLUDE" = "no"; then
352                 AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
353                                  SSLINCLUDE="-I$with_openssl/include"
354                                  FOUNDINCLUDE=yes,
355                                  FOUNDINCLUDE=no)
356         fi
357         AC_SUBST(SSLINCLUDE)
358         dnl if we didn't find it, reset CPPFLAGS
359         if test "$FOUNDINCLUDE" = "no"; then
360                 CPPFLAGS="$_SAVEDCPPFLAGS"
361                 LDFLAGS="$_SAVEDLDFLAGS"
362         fi
364         dnl Check for crypto lib
365         _SAVEDLIBS="$LIBS"
366         LIBS="-L${with_openssl}/lib"
367         AC_CHECK_LIB(crypto,CRYPTO_lock)
368         if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
369                 dnl Check for SSL lib
370                 AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
371         fi
372         LIBS="$_SAVEDLIBS"
374         dnl test headers and libs to decide whether check_http should use SSL
375         if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
376                 if test "$ac_cv_lib_ssl_main" = "yes"; then
377                         if test "$FOUNDINCLUDE" = "yes"; then
378                                 FOUNDOPENSSL="yes"
379                         fi
380                 fi
381         fi
382 fi
385 dnl check for gnutls if openssl isn't found (or is disabled)
386 if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
387         if test ! "$with_gnutls" = ""; then
388                 CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
389         elif test ! "$LIBGNUTLS_CONFIG" = ""; then
390                 CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
391         fi
392         AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
393         if test "$FOUNDGNUTLS" = "yes"; then
394                 AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
395         fi
396 fi
397 dnl end check for gnutls
399 if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
400         check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
401         AC_SUBST(check_tcp_ssl)
402         AC_SUBST(SSLLIBS)
403         AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
404         if test "$FOUNDOPENSSL" = "yes"; then
405                 AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
406                 with_openssl="yes"
407                 with_gnutls="no"
408         else
409                 AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
410                 with_gnutls="yes"
411                 with_openssl="no"
412         fi
413 else
414         dnl else deliberately disabled or no ssl support available
415         AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
416         with_openssl="no"
417         with_gnutls="no"
418 fi
420 dnl
421 dnl Checks for header files.
422 dnl
424 AC_HEADER_TIME
425 AC_HEADER_SYS_WAIT
426 AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
427 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
429 dnl Checks for typedefs, structures, and compiler characteristics.
430 AC_C_CONST
431 AC_STRUCT_TM
432 AC_TYPE_PID_T
433 AC_TYPE_SIZE_T
434 AC_TYPE_SIGNAL
436 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
437 AC_TRY_LINK([#include <stdarg.h>
438 va_list ap1,ap2;], [va_copy(ap1,ap2);],
439 ac_cv_HAVE_VA_COPY=yes,
440 ac_cv_HAVE_VA_COPY=no)])
441 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
442     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
443 else    
444     AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
445     AC_TRY_LINK([#include <stdarg.h>
446     va_list ap1,ap2;], [__va_copy(ap1,ap2);],
447     ac_cv_HAVE___VA_COPY=yes,
448     ac_cv_HAVE___VA_COPY=no)])
449     if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
450         AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
451     fi
452 fi
454 AC_TRY_COMPILE([#include <sys/time.h>],
455                [struct timeval *tv;
456                 struct timezone *tz;],
457                AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
458                AC_TRY_COMPILE([#include <sys/time.h>],
459                               [struct timeval *tv;
460                                struct timezone *tz;
461                                gettimeofday(tv, tz);],
462                               AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
463                               AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
465 dnl Checks for library functions.
466 AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
467 AC_CHECK_FUNCS(poll)
469 AC_MSG_CHECKING(return type of socket size)
470 AC_TRY_COMPILE([#include <stdlib.h>
471                 #include <sys/types.h>
472                 #include <sys/socket.h>],
473                [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
474                ac_cv_socket_size_type=["size_t"]
475                 AC_MSG_RESULT(size_t),
476                ac_cv_socket_size_type=["int"]
477                 AC_MSG_RESULT(int))
479 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
480         [Define type of socket size])
483 dnl #### Process table test
485 AC_PATH_PROG(PATH_TO_PS,ps)
487 AC_MSG_CHECKING(for ps syntax)
488 AC_ARG_WITH(ps_command,
489             ACX_HELP_STRING([--with-ps-command=PATH], 
490                             [Verbatim command to execute for ps]),
491             PS_COMMAND=$withval)
492 AC_ARG_WITH(ps_format,
493             ACX_HELP_STRING([--with-ps-format=FORMAT],
494                             [Format string for scanning ps output]),
495             PS_FORMAT=$withval)
496 AC_ARG_WITH(ps_cols,
497             ACX_HELP_STRING([--with-ps-cols=NUM], 
498                             [Number of columns in ps command]),
499             PS_COLS=$withval)
500 AC_ARG_WITH(ps_varlist,
501             ACX_HELP_STRING([--with-ps-varlist=LIST],
502                             [Variable list for sscanf of 'ps' output]),
503             PS_VARLIST=$withval)
505 if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then 
506         ac_cv_ps_command="$PS_COMMAND"
507         ac_cv_ps_format="$PS_FORMAT"
508         ac_cv_ps_varlist="$PS_VARLIST"
509         ac_cv_ps_cols="$PS_COLS"
510         AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
512 dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
513 dnl Limitation that command name is not available
514 elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
515         egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
516 then
517         ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
518         ac_cv_ps_command="/usr/ucb/ps -alxwwn"
519         ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
520         ac_cv_ps_cols=8
521         AC_MSG_RESULT([$ac_cv_ps_command])
523 dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
524 dnl so test for this first...
525 elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
526         egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
527 then
528         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
529         ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
530         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
531         ac_cv_ps_cols=9
532         AC_MSG_RESULT([$ac_cv_ps_command])
534 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
535 dnl Should also work for FreeBSD 5.2.1 and 5.3
536 dnl  STAT UCOMM              VSZ   RSS USER      PPID COMMAND
537 elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
538         egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
539 then
540         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
541         ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
542         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
543         ac_cv_ps_cols=9
544         AC_MSG_RESULT([$ac_cv_ps_command])
546 dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4. 
547 dnl Limitation: Only first 16 chars returned for ucomm field
548 dnl Must come before ps -weo
549 elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
550         egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
551 then
552         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
553         ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
554         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
555         ac_cv_ps_cols=9
556         AC_MSG_RESULT([$ac_cv_ps_command])
558 dnl  STAT UCOMM              VSZ   RSS USER       UID  PPID COMMAND
559 elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
560         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
561 then
562         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
563         ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
564         ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
565         ac_cv_ps_cols=10
566         AC_MSG_RESULT([$ac_cv_ps_command])
568 dnl FreeBSD
569 elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
570         egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
571 then
572         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
573         ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
574         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
575         ac_cv_ps_cols=9
576         AC_MSG_RESULT([$ac_cv_ps_command])
578 dnl BSD-like mode in RH 6.1
579 elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
580         egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
581 then
582         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
583         ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
584         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
585         ac_cv_ps_cols=9
586         AC_MSG_RESULT([$ac_cv_ps_command])
588 dnl SunOS 4.1.3:
589 dnl  F  UID  PID  PPID  CP  PRI  NI  SZ  RSS  WCHAN  STAT  TT  TIME  COMMAND
590 dnl Need the head -1 otherwise test will work because arguments are found
591 elif ps -laxnwww 2>/dev/null | head -1 | \
592         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
593 then
594         ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
595         ac_cv_ps_command="$PATH_TO_PS -laxnwww"
596         ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
597         ac_cv_ps_cols=9
598         AC_MSG_RESULT([$ac_cv_ps_command])
600 dnl Debian Linux / procps v1.2.9:
601 dnl  FLAGS   UID   PID  PPID PRI  NI   SIZE   RSS WCHAN       STA TTY TIME COMMAND
602 dnl    100     0     1     0   0   0    776    76  c0131c8c   S  ffff  0:11 init [2]
603 dnl
604 elif ps laxnwww 2>/dev/null | \
605         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
606 then
607         ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
608         ac_cv_ps_command="$PATH_TO_PS laxnwww"
609         ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
610         ac_cv_ps_cols=9
611         AC_MSG_RESULT([$ac_cv_ps_command])
613 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
614 elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
615         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
616 then
617         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
618         ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
619         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
620         ac_cv_ps_cols=9
621         AC_MSG_RESULT([$ac_cv_ps_command])
623 dnl Tru64 - needs %*[ +<>] in PS_FORMAT. 
624 dnl Has /usr/bin/ps and /sbin/ps - force sbin version
625 dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead 
626 dnl of 1500). Will need big changes to check_procs to support
627 elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
628         egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
629 then
630         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
631         ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
632         ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
633         ac_cv_ps_cols=8
634         AC_MSG_RESULT([$ac_cv_ps_command])
636 elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
637         egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
638 then
639         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
640         ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
641         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
642         ac_cv_ps_cols=9
643         AC_MSG_RESULT([$ac_cv_ps_command])
645 dnl AIX 4.3.3 and 5.1 do not have an rss field
646 elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
647         egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
648 then
649         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
650         ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
651         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
652         ac_cv_ps_cols=8
653         AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
655 dnl Solaris 2.6
656 elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
657         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
658 then
659         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
660         ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
661         # There must be no space between the %s and %n due to a wierd problem in sscanf where
662         # it will return %n as longer than the line length
663         ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
664         ac_cv_ps_cols=9
665         AC_MSG_RESULT([$ac_cv_ps_command])
667 elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
668         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
669 then
670         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
671         ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
672         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
673         ac_cv_ps_cols=9
674         AC_MSG_RESULT([$ac_cv_ps_command])
676 elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
677         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
678 then
679         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
680         ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
681         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
682         ac_cv_ps_cols=9
683         AC_MSG_RESULT([$ac_cv_ps_command])
685 dnl wonder who takes state instead of stat
686 elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
687         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
688 then
689         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
690         ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
691         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
692         ac_cv_ps_cols=8
693         AC_MSG_RESULT([$ac_cv_ps_command])
695 dnl IRIX 53
696 elif ps -el 2>/dev/null | \
697         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
698 then
699         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
700         ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
701         ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
702         ac_cv_ps_cols=8
703         AC_MSG_RESULT([$ac_cv_ps_command])
705 dnl IRIX 63
706 elif ps -el 2>/dev/null | \
707         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
708 then
709         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
710         ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
711         ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
712         ac_cv_ps_cols=6
713         AC_MSG_RESULT([$ac_cv_ps_command])
715 dnl AIX 4.1:
716 dnl     F S      UID   PID  PPID   C PRI NI ADDR  SZ  RSS   WCHAN    TTY  TIME CMD
717 dnl    303 A        0     0     0 120  16 -- 1c07  20   24              -  0:45 swapper
718 elif ps -el 2>/dev/null | \
719         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
720 then
721         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
722         ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
723         ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
724         ac_cv_ps_cols=6
725         AC_MSG_RESULT([$ac_cv_ps_command])
727 dnl AIX?
728 elif ps glaxen 2>/dev/null | \
729         egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
730 then
731         ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
732         ac_cv_ps_command="$PATH_TO_PS glaxen"
733         ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
734         ac_cv_ps_cols=8
735         AC_MSG_RESULT([$ac_cv_ps_command])
737 dnl MacOSX / Darwin
738 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
739 dnl Some truncation will happen in UCOMM column
740 dnl STAT      VSZ    RSS   UID  PPID %CPU UCOMM            COMMAND
741 dnl Ss      52756  22496   501     1   6.9 Window Manager   /System/Library/CoreServices/WindowServer -daemon
742 elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
743         egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
744 then
745         ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
746         ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
747         ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
748         ac_cv_ps_cols=8
749         AC_MSG_RESULT([$ac_cv_ps_command])
751 dnl UnixWare 
752 elif ps -Al 2>/dev/null | \
753         egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
754 then
755         ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
756         ac_cv_ps_command="$PATH_TO_PS -Al"
757         ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
758         ac_cv_ps_cols=8
759         AC_MSG_RESULT([$ac_cv_ps_command])
761 else
762         AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
763 fi
765 if test -n "$ac_cv_ps_varlist" ; then
766         AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
767                 [Variable list for sscanf of 'ps' output])
768         AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
769                 [Verbatim command to execute for ps in check_procs])
770         AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
771                 [Format string for scanning ps output in check_procs])
772         AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
773                 [Number of columns in ps command])
774         EXTRAS="$EXTRAS check_procs check_nagios"
775         if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
776                 AC_DEFINE(PS_USES_PROCETIME,"yes",
777                           [Whether the ps utility uses the "procetime" field])
778         fi
779 fi
781 AC_PATH_PROG(PATH_TO_PING,ping)
782 AC_PATH_PROG(PATH_TO_PING6,ping6)
784 AC_ARG_WITH(ping_command,
785         ACX_HELP_STRING([--with-ping-command=SYNTAX],
786                 [sets syntax for ICMP ping]),
787         with_ping_command=$withval,)
789 AC_MSG_CHECKING(for ICMP ping syntax)
790 ac_cv_ping_packets_first=no
791 ac_cv_ping_has_timeout=no
792 if test -n "$with_ping_command"
793 then
794         AC_MSG_RESULT([(command-line) $with_ping_command])
795         if test -n "$ac_cv_ping_packets_first"
796         then
797                 ac_cv_ping_packets_first=yes
798                 ac_cv_ping_has_timeout=yes
799         fi
801 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
802         $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
803         egrep -i "^round-trip|^rtt" >/dev/null
804 then
805         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
806         ac_cv_ping_packets_first=yes
807         AC_MSG_RESULT([$with_ping_command])
809 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
810         egrep -i "^round-trip|^rtt" >/dev/null
811 then
812         with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
813         ac_cv_ping_packets_first=yes
814   ac_cv_ping_has_timeout=yes
815         AC_MSG_RESULT([$with_ping_command])
817 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
818         egrep -i "^round-trip|^rtt" >/dev/null
819 then
820         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
821         ac_cv_ping_packets_first=yes
822         AC_MSG_RESULT([$with_ping_command])
824 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
825         egrep -i "^round-trip|^rtt" >/dev/null
826 then
827         with_ping_command="$PATH_TO_PING -n -c %d %s"
828         ac_cv_ping_packets_first=yes
829         AC_MSG_RESULT([$with_ping_command])
831 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
832         egrep -i "^round-trip|^rtt" >/dev/null
833 then
834         with_ping_command="$PATH_TO_PING -n %s -c %d"
835         AC_MSG_RESULT([$with_ping_command])
837 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
838         egrep -i "^round-trip|^rtt" >/dev/null
839 then
840         with_ping_command="$PATH_TO_PING %s -n %d"
841         AC_MSG_RESULT([$with_ping_command])
843 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
844         egrep -i "^round-trip|^rtt" >/dev/null
845 then
846         with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
847         AC_MSG_RESULT([$with_ping_command])
849 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
850         egrep -i "^round-trip|^rtt" >/dev/null
851 then
852         with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
853         AC_MSG_RESULT([$with_ping_command])
855 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
856         egrep -i "^round-trip|^rtt" >/dev/null
857 then
858         with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
859         ac_cv_ping_packets_first=yes
860         AC_MSG_RESULT([$with_ping_command])
862 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
863         egrep -i "^round-trip|^rtt" >/dev/null
864 then
865         with_ping_command="$PATH_TO_PING -n -c %d %s"
866         ac_cv_ping_packets_first=yes
867         AC_MSG_RESULT([$with_ping_command])
869 else
870         AC_MSG_WARN([unable to find usable ping syntax])
871 fi
873 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
874         [path and args for ICMP ping command])
876 if test "x$ac_cv_ping_packets_first" != "xno"
877 then
878         AC_DEFINE(PING_PACKETS_FIRST,1,
879                 [Define if packet count must precede host])
880 fi
882 if test "x$ac_cv_ping_has_timeout" != "xno"
883 then
884         AC_DEFINE(PING_HAS_TIMEOUT,1,
885                 [Define if ping has its own timeout option that should be set])
886 fi
888 AC_ARG_WITH(ping6_command,
889         ACX_HELP_STRING([--with-ping6-command=SYNTAX],
890                 [sets syntax for ICMPv6 ping]),
891         with_ping6_command=$withval,)
893 if test x"$with_ipv6" != xno ; then
894 AC_MSG_CHECKING(for ICMPv6 ping syntax)
895 ac_cv_ping6_packets_first=no
896 if test -n "$with_ping6_command"
897 then
898         AC_MSG_RESULT([(command-line) $with_ping6_command])
899         if test -n "$ac_cv_ping6_packets_first"
900         then
901                 ac_cv_ping6_packets_first=yes
902         fi
904 elif test "x$PATH_TO_PING6" != "x"; then
905         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
906                 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
907                 egrep -i "^round-trip|^rtt" >/dev/null
908         then
909                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
910                 ac_cv_ping6_packets_first=yes
911                 AC_MSG_RESULT([$with_ping6_command])
913         elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
914                 egrep -i "^round-trip|^rtt" >/dev/null
915         then
916                 with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
917                 ac_cv_ping6_packets_first=yes
918                 ac_cv_ping_has_timeout=yes
919                 AC_MSG_RESULT([$with_ping6_command])
921         elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
922                 egrep -i "^round-trip|^rtt" >/dev/null
923         then
924                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
925                 ac_cv_ping6_packets_first=yes
926                 AC_MSG_RESULT([$with_ping6_command])
928         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
929                 egrep -i "^round-trip|^rtt" >/dev/null
930         then
931                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
932                 ac_cv_ping6_packets_first=yes
933                 AC_MSG_RESULT([$with_ping6_command])
935         elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
936                 egrep -i "^round-trip|^rtt" >/dev/null
937         then
938                 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
939                 AC_MSG_RESULT([$with_ping6_command])
941         elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
942                 egrep -i "^round-trip|^rtt" >/dev/null
943         then
944                 with_ping6_command="$PATH_TO_PING6 %s -n %d"
945                 AC_MSG_RESULT([$with_ping6_command])
947         elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
948                 egrep -i "^round-trip|^rtt" >/dev/null
949         then
950                 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
951                 AC_MSG_RESULT([$with_ping6_command])
953         elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
954                 egrep -i "^round-trip|^rtt" >/dev/null
955         then
956                 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
957                 AC_MSG_RESULT([$with_ping6_command])
959         elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
960                 egrep -i "^round-trip|^rtt" >/dev/null
961         then
962                 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
963                 ac_cv_ping6_packets_first=yes
964                 AC_MSG_RESULT([$with_ping_command])
966         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
967                 egrep -i "^round-trip|^rtt" >/dev/null
968         then
969                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
970                 ac_cv_ping6_packets_first=yes
971                 AC_MSG_RESULT([$with_ping6_command])
973         fi
975 elif test "x$PATH_TO_PING" != "x"; then
976         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
977                 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
978                 egrep -i "^round-trip|^rtt" >/dev/null
979         then
980                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
981                 ac_cv_ping6_packets_first=yes
982                 AC_MSG_RESULT([$with_ping6_command])
984         elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
985                 egrep -i "^round-trip|^rtt" >/dev/null
986         then
987                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
988                 ac_cv_ping6_packets_first=yes
989                 AC_MSG_RESULT([$with_ping6_command])
991         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
992                 egrep -i "^round-trip|^rtt" >/dev/null
993         then
994                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
995                 ac_cv_ping6_packets_first=yes
996                 AC_MSG_RESULT([$with_ping6_command])
998         elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
999                 egrep -i "^round-trip|^rtt" >/dev/null
1000         then
1001                 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1002                 AC_MSG_RESULT([$with_ping6_command])
1004         elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1005                 egrep -i "^round-trip|^rtt" >/dev/null
1006         then
1007                 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1008                 AC_MSG_RESULT([$with_ping6_command])
1010         elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1011                 egrep -i "^round-trip|^rtt" >/dev/null
1012         then
1013                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1014                 AC_MSG_RESULT([$with_ping6_command])
1016         elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1017                 egrep -i "^round-trip|^rtt" >/dev/null
1018         then
1019                 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1020                 AC_MSG_RESULT([$with_ping6_command])
1022         elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1023                 egrep -i "^round-trip|^rtt" >/dev/null
1024         then
1025                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1026                 ac_cv_ping6_packets_first=yes
1027                 AC_MSG_RESULT([$with_ping_command])
1029         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1030                 egrep -i "^round-trip|^rtt" >/dev/null
1031         then
1032                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1033                 ac_cv_ping6_packets_first=yes
1034                 AC_MSG_RESULT([$with_ping6_command])
1036         fi
1038 fi
1040 if test "x$with_ping6_command" != "x"; then
1041         AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1042                 [path and args for ICMPv6 ping command])
1043 else
1044         AC_MSG_RESULT([none])
1045 fi
1047 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1048         AC_DEFINE(PING6_PACKETS_FIRST,1,
1049                 [Define if packet count must precede host])
1050 fi
1051 fi
1054 AC_ARG_WITH(nslookup_command,
1055             ACX_HELP_STRING([--with-nslookup-command=PATH],
1056                             [sets path to nslookup executable]),
1057             ac_cv_nslookup_command=$withval)
1058 if test -n "$ac_cv_nslookup_command"; then
1059         AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
1060 else
1061         AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1062         if test -n "$PATH_TO_NSLOOKUP"
1063         then
1064                 AC_MSG_CHECKING(for nslookup syntax)
1065                 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1066                 then
1067                         ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1068                         AC_MSG_RESULT([$ac_cv_nslookup_command])
1070                 else
1071                         ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1072                         AC_MSG_RESULT([$ac_cv_nslookup_command])
1074                 fi
1075         else
1076                 AC_MSG_WARN([nslookup command not found])
1077         fi
1078 fi
1080 if test -n "$ac_cv_nslookup_command"; then
1081         EXTRAS="$EXTRAS check_dns"
1082         AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
1083 fi
1085 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1086 AC_ARG_WITH(uptime_command,
1087             ACX_HELP_STRING([--with-uptime-command=PATH],
1088                             [sets path to uptime]), PATH_TO_UPTIME=$withval)
1089 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1091 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1092 AC_ARG_WITH(rpcinfo_command,
1093             ACX_HELP_STRING([--with-rpcinfo-command=PATH],
1094                             [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
1095 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1097 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1098 if test -x "$PATH_TO_LMSTAT"
1099 then
1100         AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1101 else
1102         AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1103 fi
1105 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1106 AC_ARG_WITH(smbclient_command,
1107             ACX_HELP_STRING([--with-smbclient-command=PATH],
1108                             [sets path to smbclient]), 
1109             PATH_TO_SMBCLIENT=$withval)
1110 if test -n "$PATH_TO_SMBCLIENT"
1111 then
1112         AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1113 else
1114         AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1115 fi
1118 AC_PATH_PROG(PATH_TO_WHO,who)
1120 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1121 then
1122         ac_cv_path_to_who="$PATH_TO_WHO -q"
1123 else
1124         ac_cv_path_to_who="$PATH_TO_WHO"
1125 fi
1127 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1128         [path and arguments for invoking 'who'])
1130 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1131 AC_ARG_WITH(snmpget_command,
1132             ACX_HELP_STRING([--with-snmpget-command=PATH],
1133                             [Path to snmpget command]),
1134             PATH_TO_SNMPGET=$withval)
1135 if test -n "$PATH_TO_SNMPGET"
1136 then
1137         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1138         EXTRAS="$EXTRAS check_hpjd check_snmp"
1139 else
1140         AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1141 fi
1143 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1144 AC_ARG_WITH(snmpgetnext_command,
1145             ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1146                             [Path to snmpgetnext command]),
1147             PATH_TO_SNMPGETNEXT=$withval)
1148 if test -n "$PATH_TO_SNMPGETNEXT"
1149 then
1150         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1151 fi
1153 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null  )
1154 then
1155         AC_MSG_CHECKING(for Net::SNMP perl module)
1156         AC_MSG_RESULT([found])
1157 else
1158         AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1159 fi
1161 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1162 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1163 AC_ARG_WITH(qstat_command,
1164             ACX_HELP_STRING([--with-qstat-command=PATH], 
1165                             [Path to qstat command]), PATH_TO_QSTAT=$withval)
1167 if test -x "$PATH_TO_QUAKESTAT"
1168 then
1169         ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1170         EXTRAS="$EXTRAS check_game"
1172 elif test -n "$PATH_TO_QSTAT"
1173 then
1174         ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1175         EXTRAS="$EXTRAS check_game"
1176 else
1177         AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1178 fi
1180 if test $ac_cv_path_to_qstat 
1181 then
1182         AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1183                 [path to qstat/quakestat])
1184 fi
1186 AC_PATH_PROG(PATH_TO_FPING,fping)
1187 AC_ARG_WITH(fping_command,
1188             ACX_HELP_STRING([--with-fping-command=PATH],
1189                             [Path to fping command]), PATH_TO_FPING=$withval)
1190 if test -n "$PATH_TO_FPING"
1191 then
1192         AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1193         EXTRAS="$EXTRAS check_fping"
1194 else
1195         AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1196 fi
1198 AC_PATH_PROG(PATH_TO_SSH,ssh)
1199 AC_ARG_WITH(ssh_command,
1200             ACX_HELP_STRING([--with-ssh-command=PATH],
1201                             [sets path for ssh]), PATH_TO_SSH=$withval)
1202 if test -n "$PATH_TO_SSH"
1203 then
1204         AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1205         EXTRAS="$EXTRAS check_by_ssh"
1206 else
1207         AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1208 fi
1211 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1212 AC_ARG_WITH(mailq_command,
1213             ACX_HELP_STRING([--with-mailq-command=PATH],
1214                             [sets path to mailq]), PATH_TO_MAILQ=$withval)
1215 if test -n "$PATH_TO_MAILQ"
1216 then
1217         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1218 else
1219         AC_MSG_WARN([Could not find mailq or eqivalent])
1220 fi
1222 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1223 if test -x "$PATH_TO_QMAIL_QSTAT"
1224 then
1225         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1226 else
1227         AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1228 fi
1230 dnl SWAP info required is amount allocated/available and amount free
1231 dnl The plugin works through all the swap devices and adds up the total swap
1232 dnl available.
1233 AC_PATH_PROG(PATH_TO_SWAP,swap)
1234 if (test -n "$PATH_TO_SWAP")
1235 then
1236 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1237 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1238 then
1239         ac_cv_have_swap=yes
1240         ac_cv_swap_command="$PATH_TO_SWAP -l"
1241         if [$PATH_TO_SWAP -l 2>/dev/null | \
1242                 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1243                 >/dev/null]
1244         then
1245                 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
1246                 ac_cv_swap_conv=2048
1247                 AC_MSG_RESULT([using IRIX format swap])
1249         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1250         then
1251                 ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
1252                 ac_cv_swap_conv=2048
1253                 AC_MSG_RESULT([using Unixware format swap])
1254         else
1255                 dnl if we don't know what format swap's output is
1256                 dnl we might as well pretend we didn't see it
1257                 ac_cv_have_swap=""
1258                 ac_cv_swap_command=""
1259         fi
1260 fi
1261 dnl end if for PATH_TO_SWAP
1262 fi
1264 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1265 if (test -n "$PATH_TO_SWAPINFO")
1266 then
1267 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1268 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1269 then
1270         ac_cv_have_swap=yes
1271         ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1273         if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1274         then
1275                 ac_cv_swap_format=["%*s %f %*d %f"]
1276                 ac_cv_swap_conv=1024
1277                 AC_MSG_RESULT([using FreeBSD format swapinfo])
1278         fi
1280 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1281 then
1282         ac_cv_have_swap=yes
1283         ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
1284         ac_cv_swap_format=["%*s %f %*d %f"]
1285         ac_cv_swap_conv=1024
1286         AC_MSG_RESULT([using HP-UX format swapinfo])
1287 fi
1288 dnl end if for PATH_TO_SWAPINFO
1289 fi
1291 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1292 if (test -n "$PATH_TO_LSPS")
1293 then
1294 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1295 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1296 then
1297         ac_cv_have_swap=yes
1298         ac_cv_swap_command="$PATH_TO_LSPS -a"
1299         ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
1300         ac_cv_swap_conv=1
1301         AC_MSG_RESULT([using AIX lsps])
1302 fi
1303 dnl end if for PATH_TO_SWAPINFO
1304 fi
1306 dnl
1307 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1308 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1309 dnl in the various BSD's
1310 dnl
1312 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1313 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1314 #ifdef HAVE_SYS_PARAM_H
1315 #include <sys/param.h>
1316 #endif
1317 ])
1318 AC_CHECK_DECLS([swapctl],,,[
1319                #include <unistd.h>
1320                #include <sys/types.h>
1321                #include <sys/param.h>
1322                #include <sys/stat.h>
1323                #include <sys/swap.h>
1324                ])
1325 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1326                #include <sys/types.h>
1327                #include <sys/param.h>
1328                #include <sys/stat.h>
1329                #include <sys/swap.h>
1330                ])
1331 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1332                #include <unistd.h>
1333                #include <sys/types.h>
1334                #include <sys/param.h>
1335                #include <sys/stat.h>
1336                #include <sys/swap.h>
1337                ])
1339 if test "$ac_cv_have_decl_swapctl" = "yes"; 
1340 then
1341         EXTRAS="$EXTRAS check_swap"
1342         AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1343         if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1344                 "$ac_cv_type_swapent_t" = "yes"; 
1345         then
1346                 AC_MSG_RESULT([yes])
1347                 ac_cv_check_swap_swapctl_svr4="1";
1348                 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1349                           [Define if 2-argument SVR4 swapctl exists])
1350         else
1351                 AC_MSG_RESULT([no])
1352                 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1353                 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes"; 
1354                 then
1355                         AC_MSG_RESULT([yes])
1356                         AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1357                                   [Define if 3-argument BSD swapctl exists])
1358                 else
1359                         AC_MSG_RESULT([no])
1360                 fi
1361         fi
1362         AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1363         if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1364         then
1365                 dnl
1366                 dnl the SVR4 spec returns values in pages
1367                 dnl
1368                 AC_MSG_RESULT([page])
1369                 AC_CHECK_DECLS([sysconf])
1370                 AC_MSG_CHECKING([for system page size])
1371                 if test "$ac_cv_have_decl_sysconf" = "yes";
1372                 then
1373                         AC_MSG_RESULT([determined by sysconf(3)])
1374                         ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1375                 else
1376                         AC_MSG_WARN([don't know. guessing 4096k])
1377                         ac_cv_swap_conv=256
1378                 fi
1379         else
1380                 dnl
1381                 dnl the BSD spec returns values in blocks
1382                 dnl
1383                 AC_MSG_RESULT([blocks (assuming 512b)])
1384                 ac_cv_swap_conv=2048
1385         fi
1386         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1387                 [Conversion factor to MB])
1388 fi
1389 dnl
1390 dnl end tests for the swapctl system calls
1391 dnl
1394 if test "x$ac_cv_have_swap" != "x" 
1395 then
1396         AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1397         EXTRAS="$EXTRAS check_swap"
1398 fi
1399 if test "x$ac_cv_swap_command" != "x" 
1400 then
1401         AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1402                 [Path to swap/swapinfo binary, with any args])
1403         AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1404                 [Format string for parsing swap output])
1405         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1406                 [Conversion factor to MB])
1407 fi
1409 AC_ARG_WITH(proc-meminfo,
1410             ACX_HELP_STRING([--with-proc-meminfo=PATH],
1411                             [path to /proc/meminfo or equivalent]),
1412                             ac_cv_proc_meminfo=$withval)
1413 dnl dunno why this does not work below - use hack (kbd)
1414 dnl fine on linux, broken on solaris
1415 dnl if /bin/test -e "/proc/meminfo"
1416 AC_MSG_CHECKING([for /proc/meminfo])
1417 if test -n "$ac_cv_proc_meminfo"; then
1418         AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
1419 elif [cat /proc/meminfo > /dev/null 2>&1]; then
1420         AC_MSG_RESULT([found /proc/meminfo])
1421         ac_cv_proc_meminfo="/proc/meminfo"
1422 else
1423         AC_MSG_RESULT([no])
1424 fi
1426 if test -n "$ac_cv_proc_meminfo"; then
1427         AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1428         AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
1429         EXTRAS="$EXTRAS check_swap"
1430 fi
1432 AC_PATH_PROG(PATH_TO_DIG,dig)
1433 AC_ARG_WITH(dig_command,
1434             ACX_HELP_STRING([--with-dig-command=PATH],
1435                             [Path to dig command]), PATH_TO_DIG=$withval)
1436 if test -n "$PATH_TO_DIG"; then
1437         EXTRAS="$EXTRAS check_dig"
1438         AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1439 fi
1441 AC_PATH_PROG(PATH_TO_APTGET,apt-get)
1442 AC_ARG_WITH(apt-get_command,
1443             ACX_HELP_STRING([--with-apt-get-command=PATH],
1444                             [Path to apt-get command]), 
1445                             with_apt_get_command=$withval,
1446                             with_apt_get_command=$PATH_TO_APTGET)
1447 AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
1448 if test -n "$PATH_TO_APTGET" ; then
1449         EXTRAS="$EXTRAS check_apt"
1450 fi
1453 if test -f plugins/check_nt.c ; then
1454   EXTRAS="$EXTRAS check_nt"
1455 elif test -f ../plugins/check_nt.c ; then
1456   EXTRAS="$EXTRAS check_nt"
1457 fi
1460 case $host in
1461         *bsd*)
1462                 AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
1463         ;;
1464         *linux*)
1465                 AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
1466         ;;
1467         *sun* | solaris*)
1468                 AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
1469         ;;
1470         *hpux*)  
1471                 AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
1472         ;;
1473 esac
1475 AC_SUBST(EXTRAS)
1476 AC_SUBST(EXTRAS_ROOT)
1477 AC_SUBST(EXTRA_NETOBJS)
1478 AC_SUBST(DEPLIBS)
1480 AM_GNU_GETTEXT([external], [need-ngettext])
1481 AM_GNU_GETTEXT_VERSION(0.13.1)
1483 dnl Check for Redhat spopen problem
1484 dnl Wierd problem where ECHILD is returned from a wait call in error
1485 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
1486 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
1487 dnl We patch plugins/popen.c
1488 dnl Need to add smp because uname different on those
1489 dnl Can force patch to be applied with --enable-redhat-pthread-workaround
1490 AC_ARG_ENABLE(redhat-pthread-workaround, 
1491         AC_HELP_STRING([--enable-redhat-pthread-workaround], 
1492                 [force Redhat patch to be applied (default: test system)]),
1493         [ac_cv_enable_redhat_pthread_workaround=$enableval],
1494         [ac_cv_enable_redhat_pthread_workaround=test])
1495 if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
1496         if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
1497                 AC_MSG_CHECKING(for redhat spopen problem)
1498                 ( cd config_test && make && make test ) > /dev/null 2>&1
1499                 if test $? -eq 0 ; then
1500                         AC_MSG_RESULT(okay)
1501                 else
1502                         AC_MSG_RESULT(error)
1503                         AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
1504                 fi
1505         fi
1506 elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1507         AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1508 fi
1510 dnl External libraries - see ACKNOWLEDGEMENTS
1511 gl_INIT
1513 dnl Some helpful common compile errors checked here
1514 if test "$ac_cv_uname_s" = 'SunOS' -a "$ac_cv_prog_ac_ct_AR" = 'false' ; then
1515         AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
1516 fi
1518 AC_OUTPUT(
1519   Makefile 
1520   lib/Makefile 
1521   plugins/Makefile 
1522   lib/tests/Makefile
1523   plugins-root/Makefile
1524   plugins-scripts/Makefile 
1525   plugins-scripts/subst 
1526   plugins-scripts/utils.pm 
1527   plugins-scripts/utils.sh 
1528   command.cfg 
1529   test.pl 
1530   pkg/solaris/pkginfo 
1531   po/Makefile.in 
1535 dnl the ones below that are commented out need to be cleaned up 
1536 dnl in the configure code above to use with_foo instead of ac_cv_foo
1537 dnl if we want them to show up here.  it'd also make the code cleaner.
1538 dnl i'll get to that on another rainy day :) -sf
1539 ACX_FEATURE([with],[apt-get-command])
1540 dnl ACX_FEATURE([with],[dig-command])
1541 dnl ACX_FEATURE([with],[fping-command])
1542 dnl ACX_FEATURE([with],[mailq-command])
1543 dnl ACX_FEATURE([with],[nslookup-command])
1544 ACX_FEATURE([with],[ping6-command])
1545 ACX_FEATURE([with],[ping-command])
1546 dnl ACX_FEATURE([with],[qstat-command])
1547 dnl ACX_FEATURE([with],[rpcinfo-command])
1548 dnl ACX_FEATURE([with],[smbclient-command])
1549 dnl ACX_FEATURE([with],[snmpget-command])
1550 dnl ACX_FEATURE([with],[snmpgetnext-command])
1551 dnl ACX_FEATURE([with],[ssh-command])
1552 dnl ACX_FEATURE([with],[uptime-command])
1554 dnl ACX_FEATURE([with],[proc-meminfo])
1555 dnl ACX_FEATURE([with],[ps-command])
1556 dnl ACX_FEATURE([with],[ps-format])
1557 dnl ACX_FEATURE([with],[ps-cols])
1558 dnl ACX_FEATURE([with],[ps-varlist])
1560 ACX_FEATURE([with],[ipv6])
1561 ACX_FEATURE([with],[mysql])
1562 ACX_FEATURE([with],[openssl])
1563 ACX_FEATURE([with],[gnutls])
1564 ACX_FEATURE([with],[perl])
1565 ACX_FEATURE([with],[cgiurl])
1566 ACX_FEATURE([with],[trusted-path])