Code

Removed --with-ipv6 configure option so it determines IPv6 availablity
[nagiosplug.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_INIT(Helper.pm)
4 VER=1.3.99
5 REL=1
6 AC_SUBST(VER)
7 AC_SUBST(REL)
8 PACKAGE_VERSION="${VER}"
9 AC_SUBST(PACKAGE_VERSION)
10 PACKAGE_RELEASE="${REL}"
11 AC_SUBST(PACKAGE_RELEASE)
12 AM_INIT_AUTOMAKE(nagios-plugins,${PACKAGE_VERSION})
13 AM_CONFIG_HEADER(plugins/config.h plugins/common.h plugins/version.h plugins/netutils.h plugins/utils.h plugins/popen.h)
14 AC_CANONICAL_HOST
16 AC_PREFIX_DEFAULT(/usr/local/nagios)
18 dnl Figure out how to invoke "install" and what install options to use.
20 AC_PROG_INSTALL
21 AC_SUBST(INSTALL)
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_RANLIB
27 AC_AIX
28 AC_MINIX
30 AC_PROG_MAKE_SET
31 AC_PROG_AWK
33 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
34 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
35 # enable the work-around code in fsusage.c.
36 AC_MSG_CHECKING([for statfs that truncates block counts])
37 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
38 [AC_TRY_COMPILE([
39 #if !defined(sun) && !defined(__sun)
40 choke -- this is a workaround for a Sun-specific problem
41 #endif
42 #include <sys/types.h>
43 #include <sys/vfs.h>],
44 [struct statfs t; long c = *(t.f_spare);],
45 fu_cv_sys_truncating_statfs=yes
46 AC_MSG_RESULT(yes),
47 fu_cv_sys_truncating_statfs=no
48 AC_MSG_RESULT(no),
49 )])
50 if test $fu_cv_sys_truncating_statfs = yes; then
51   AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
52 [  Define if the block counts reported by statfs may be truncated to 2GB
53    and the correct values may be stored in the f_spare array.
54    (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
55    SunOS 4.1.1 seems not to be affected.)])
56 fi
58 saved_srcdir=$srcdir
59 srcdir=$srcdir/lib
60 test -f $srcdir/getloadavg.c \
61   || AC_MSG_ERROR([getloadavg.c is not in $srcdir])
62 AC_FUNC_GETLOADAVG
63 srcdir=$saved_srcdir
65 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
66 dnl AM_WITH_REGEX
67 AC_PROG_RANLIB
69 AC_PATH_PROG(ACLOCAL,aclocal)
70 AC_PATH_PROG(AUTOMAKE,automake)
71 AC_PATH_PROG(AUTOCONF,autoconf)
72 AC_PATH_PROG(AUTOHEADER,autoheader)
74 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
75 AC_SUBST(PLUGIN_TEST)dnl
77 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
78 AC_SUBST(SCRIPT_TEST)dnl
80 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"
81 AC_SUBST(WARRANTY)
83 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\n"
84 AC_SUBST(SUPPORT)
86 dnl CGIURL has changed for Nagios with 1.0 beta
87 AC_ARG_WITH(cgiurl,
88         ACX_HELP_STRING([--with-cgiurl=DIR],
89                 [sets URL for cgi programs]),
90         with_cgiurl=$withval,
91         with_cgiurl=/nagios/cgi-bin)
92 CGIURL="$with_cgiurl"
93 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
95 AC_ARG_WITH(nagios_user,
96         ACX_HELP_STRING([--with-nagios-user=USER],
97                 [set user name to run nagios]),
98         with_nagios_user=$withval,
99         with_nagios_user=nagios)
100 AC_ARG_WITH(nagios_group,
101         ACX_HELP_STRING([--with-nagios-group=GROUP],
102                 [set group name to run nagios]),
103         with_nagios_group=$withval,
104         with_nagios_group=nagios)
105 AC_SUBST(with_nagios_user)
106 AC_SUBST(with_nagios_group)
107 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
108 AC_SUBST(INSTALL_OPTS)
110 AC_ARG_WITH(trusted_path,
111         ACX_HELP_STRING([--with-trusted-path=PATH],
112                 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
113         with_trusted_path=$withval,
114         with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
115 AC_SUBST(with_trusted_path)
117 EXTRAS=
118 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
120 LDFLAGS="$LDFLAGS -L."
122 ac_cv_uname_m=`uname -m`
123 ac_cv_uname_s=`uname -s`
124 ac_cv_uname_r=`uname -r`
125 ac_cv_uname_v=`uname -v`
127 dnl Checks for programs.
128 AC_PATH_PROG(PYTHON,python)
129 AC_PATH_PROG(PERL,perl)
130 AC_PATH_PROG(SH,sh)
132 AC_PATH_PROG(HOSTNAME,hostname)
133 AC_PATH_PROG(BASENAME,basename)
135 dnl
136 dnl Check for miscellaneous stuff
137 dnl 
139 case $host_vender-$host_os in
140 sun*)
141         AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
142         ;;
143 osf*)
144         AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
145         ;;
146 esac
148 dnl
149 dnl Checks for libraries.
150 dnl
152 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
153 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
154 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
155 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
156 AC_SUBST(SOCKETLIBS)
158 dnl Check for PostgreSQL libraries
159 _SAVEDLIBS="$LIBS"
160 _SAVEDCPPFLAGS="$CPPFLAGS"
161 AC_ARG_WITH(pgsql,
162         ACX_HELP_STRING([--with-pgsql=DIR],
163                 [sets path to pgsql installation]),
164         PGSQL=$withval,)
165 AC_CHECK_LIB(crypt,main)
166 if test "$ac_cv_lib_crypt_main" = "yes"; then
167   if test -n "$PGSQL"; then
168     LDFLAGS="$LDFLAGS -L$PGSQL/lib"
169     CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
170   fi
171   AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
172   if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
173     AC_CHECK_HEADERS(pgsql/libpq-fe.h)
174     AC_CHECK_HEADERS(postgresql/libpq-fe.h)
175     AC_CHECK_HEADERS(libpq-fe.h)
176     if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
177       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
178       PGINCLUDE="-I$PGSQL/include"
179     elif test  "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
180       PGLIBS="-lpq -lcrypt"
181       PGINCLUDE="-I/usr/include/pgsql"
182     elif test  "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
183       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
184       PGINCLUDE="-I/usr/include/postgresql"
185     elif test  "$ac_cv_header_libpq_fe_h" = "yes"; then
186       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
187       PGINCLUDE="-I$PGSQL/include"
188     fi
189     if test -z "$PGINCLUDE"; then
190       AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
191       AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
192     else
193       AC_SUBST(PGLIBS)
194       AC_SUBST(PGINCLUDE)
195       EXTRAS="$EXTRAS check_pgsql"
196     fi
197   else
198     AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
199     AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
200     AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
201   fi
202 else
203   AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
204   AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
205 fi
206 LIBS="$_SAVEDLIBS"
207 CPPFLAGS="$_SAVEDCPPFLAGS"
209 dnl Check for radius libraries
210 _SAVEDLIBS="$LIBS"
211 AC_CHECK_LIB(radiusclient,rc_read_config)
212 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
213   EXTRAS="$EXTRAS check_radius"
214         RADIUSLIBS="-lradiusclient"
215   AC_SUBST(RADIUSLIBS)
216 else
217   AC_MSG_WARN([Skipping radius plugin])
218   AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
219 fi
220 LIBS="$_SAVEDLIBS"
222 dnl Check for LDAP libraries
223 _SAVEDLIBS="$LIBS"
224 AC_CHECK_LIB(ldap,main,,,-llber)
225 if test "$ac_cv_lib_ldap_main" = "yes"; then
226   LDAPLIBS="-lldap -llber"\
227   LDAPINCLUDE="-I/usr/include/ldap"
228   AC_SUBST(LDAPLIBS)
229   AC_SUBST(LDAPINCLUDE)
230   EXTRAS="$EXTRAS check_ldap"
231 else
232   AC_MSG_WARN([Skipping LDAP plugin])
233   AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
234 fi
235 LIBS="$_SAVEDLIBS"
238 dnl Check for mysql libraries
239 _SAVEDLIBS="$LIBS"
240 _SAVEDCPPFLAGS="$CPPFLAGS"
241 AC_ARG_WITH(mysql,
242         ACX_HELP_STRING([--with-mysql=DIR],
243                 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
244         MYSQL=$withval,)
245 if test -n "$MYSQL"; then
246   MYSQLLIBDIR=$MYSQL/lib/mysql
247   CPPFLAGS="-I$MYSQL/include"
248   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
249   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
250 elif test -f /usr/lib/libmysqlclient.so; then
251   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
252   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
253 elif test -f /usr/lib/libmysqlclient.a; then
254   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
255   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
256 elif test -f /usr/lib/mysql/libmysqlclient.so; then
257   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
258   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
259 elif test -f /usr/lib/mysql/libmysqlclient.a; then
260   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
261   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
262 fi
263 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
264   AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
265   if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
266     EXTRAS="$EXTRAS check_mysql"
267     AC_SUBST(MYSQLINCLUDE)
268     AC_SUBST(MYSQLLIBS)
269     AC_SUBST(check_mysql_LDFLAGS)
270   else
271     AC_MSG_WARN([Skipping mysql plugin])
272     AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
273   fi
274 else
275   AC_MSG_WARN([Skipping mysql plugin])
276   AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
277 fi
278 CPPFLAGS="$_SAVEDCPPFLAGS"
279 LIBS="$_SAVEDLIBS"
281 dnl Check for OpenSSL location
282 AC_PATH_PROG(OPENSSL,openssl)
283 if test "$OPENSSL" = "/usr/bin/openssl"; then
284   OPENSSL=/usr
285 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
286   OPENSSL=/usr
287 elif test "$OPENSSL" = "/opt/bin/openssl"; then
288   OPENSSL=/opt
289 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
290   OPENSSL=/opt/openssl
291 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
292   OPENSSL=/usr/slocal
293 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
294   OPENSSL=/usr/local
295 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
296   OPENSSL=/usr/local/ssl
297 fi
298 AC_ARG_WITH(openssl,
299         ACX_HELP_STRING([--with-openssl=DIR],
300                 [sets path to openssl installation]),
301         OPENSSL=$withval,)
303 dnl Check for AF_INET6 support
304 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
305         AC_TRY_COMPILE([#include <netinet/in.h>
306                         #include <sys/socket.h>],
307                         [struct sockaddr_in6 sin6;
308                         void *p;
310                         sin6.sin6_family = AF_INET6;
311                         sin6.sin6_port = 587;
312                         p = &sin6.sin6_addr;],
313                         [with_ipv6=yes], 
314                         [with_ipv6=no])
315         ])
317 if test x"$with_ipv6" != xno ; then
318         AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
319 fi
321 dnl #########################################################################
322 dnl Check if Posix getaddrinfo() is available.  It is also possible to use
323 dnl the version from the lwres library distributed with BIND.
324 dnl #########################################################################
325 AC_ARG_ENABLE([emulate-getaddrinfo],
326               ACX_HELP_STRING([--enable-emulate-getaddrinfo],
327                              [enable getaddrinfo emulation (default=no)]),
328               ,
329               enable_emulate_getaddrinfo=no)
330 AC_ARG_WITH(lwres,
331             ACX_HELP_STRING([--with-lwres=DIR],
332                            [use lwres library for getaddrinfo (default=no)]),
333             ,
334             with_lwres=no)
336 dnl ## enable force to test getaddrinfo.c
337 if test x$enable_emulate_getaddrinfo = xforce ; then
338         enable_emulate_getaddrinfo=yes
339         have_getaddrinfo=no
340 else
342 have_getaddrinfo=no
343 if test x$with_lwres != xno ; then
344         if test "$with_lwres" != yes ; then
345                    CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
346                    LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
347         fi
348         AC_CHECK_HEADERS(lwres/netdb.h, ,
349                         [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
350         AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
351                      [AC_MSG_ERROR([cannot find the lwres library])],
352                      -lnsl -lpthread)
353         have_getaddrinfo=yes
354 fi
356 if test x$have_getaddrinfo != xyes ; then
357         AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
358 fi
360 dnl # Special nonsense for systems that actually have getaddrinfo but
361 dnl # redefine the name to something else, e.g. OSF
362 if test x$have_getaddrinfo != xyes ; then
363         AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
364         AC_TRY_LINK([
365 #               include <netdb.h>
366         ], [
367                 struct addrinfo hints, *res;
368                 int err;
370                 err = getaddrinfo ("host", "service", &hints, &res);
371         ], [
372                 have_getaddrinfo=yes
373                 AC_MSG_RESULT(yes)
374         ], [AC_MSG_RESULT(no)])
375 fi
377 fi
379 if test x$have_getaddrinfo != xno ; then
380         if test x$enable_emulate_getaddrinfo != xno ; then
381                 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
382         fi
383         AC_DEFINE(HAVE_GETADDRINFO, 1,
384                   [Does system provide RFC 2553/Posix getaddrinfo?])
385 else
386         if test x$enable_emulate_getaddrinfo != xyes ; then
387                 AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
388         fi
389         LIBOBJS="$LIBOBJS getaddrinfo.o"
390 fi
392 if test x"$enable_emulate_getaddrinfo" != xno ; then
393     have_resolver=no
395   dnl  Try for getipnodebyname
396     AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
397     if test x"$have_resolver" != xno ; then
398          AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
399                    [Set when getipnodebyname is available])
400     fi
402   dnl  Try for gethostbyname_r
403     if test x"$have_resolver" = xno ; then
404         AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
405                        [have_resolver=yes
406                         ACX_WHICH_GETHOSTBYNAME_R])
407     fi
409   dnl  Try for gethostbyname
410     if test x"$have_resolver" = xno ; then
411         if test x"$enable_pthreads" != xno ; then
412             AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
413         fi
414         AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
415                        [AC_MSG_ERROR([cannot find gethostbyname])])
416     fi
417     LIBOBJS="$LIBOBJS gethostbyname.o"
419 fi
421 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
422 if test "$FOUNDINCLUDE" = "no"; then
423   _SAVEDCPPFLAGS="$CPPFLAGS"
424   CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
425   unset ac_cv_header_krb5_h
426   AC_CHECK_HEADERS(krb5.h,
427                    KRB5INCLUDE="-I/usr/kerberos/include"
428                    FOUNDINCLUDE=yes,
429                    FOUNDINCLUDE=no)
430 fi
431 AC_SUBST(KRBINCLUDE)
432 if test "$FOUNDINCLUDE" = "no"; then
433   CPPFLAGS="$_SAVEDCPPFLAGS"
434 fi
436 dnl Check for OpenSSL header files
437 unset FOUNDINCLUDE
438 _SAVEDCPPFLAGS="$CPPFLAGS"
439 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
440 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
441                  SSLINCLUDE="-I$OPENSSL/include"
442                  FOUNDINCLUDE=yes,
443                  FOUNDINCLUDE=no)
444 if test "$FOUNDINCLUDE" = "no"; then
445   AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
446                    SSLINCLUDE="-I$OPENSSL/include"
447                    FOUNDINCLUDE=yes,
448                    FOUNDINCLUDE=no)
449 fi
450 AC_SUBST(SSLINCLUDE)
451 if test "$FOUNDINCLUDE" = "no"; then
452   CPPFLAGS="$_SAVEDCPPFLAGS"
453 fi
455 dnl Check for crypto lib
456 _SAVEDLIBS="$LIBS"
457 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
458 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
459   dnl Check for SSL lib
460   AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto",AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto"),-L$OPENSSL/lib -lcrypto)
461 fi
462 LIBS="$_SAVEDLIBS"
464 dnl test headers and libs to decide whether check_http should use SSL
465 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
466   if test "$ac_cv_lib_ssl_main" = "yes"; then
467     if test "$FOUNDINCLUDE" = "yes"; then
468       AC_SUBST(SSLLIBS)
469       AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
470     fi
471   fi
472 fi
473 CPPFLAGS="$_SAVEDCPPFLAGS"
475 dnl
476 dnl Checks for header files.
477 dnl
479 AC_HEADER_STDC
480 AC_HEADER_TIME
481 AC_HEADER_SYS_WAIT
482 AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h unistd.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h)
483 AC_CHECK_HEADERS(stdarg.h sys/unistd.h unistd.h ctype.h stdlib.h)
485 dnl Linux
486 AC_CHECK_HEADERS(sys/vfs.h,
487                  [AC_TRY_COMPILE([#include <sys/vfs.h>],
488                                  [struct statfs buf; long foo; statfs ("/", &buf); foo = buf.f_namelen;],
489                                  [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
491 dnl FreeBSD
492 AC_CHECK_HEADERS(sys/param.h sys/mount.h,
493                  [AC_TRY_COMPILE([#include <sys/param.h>
494 #include <sys/mount.h>],
495                                  [struct statfs buf; int foo; statfs ("/", &buf); foo = buf.f_flags;],
496                                  [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
498 dnl Checks for typedefs, structures, and compiler characteristics.
499 AC_C_CONST
500 AC_STRUCT_TM
501 AC_TYPE_PID_T
502 AC_TYPE_SIZE_T
503 AC_TYPE_SIGNAL
505 AC_CHECK_SIZEOF(int,cross)
506 AC_CHECK_SIZEOF(long,cross)
507 AC_CHECK_SIZEOF(short,cross)
509 AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
510 AC_TRY_RUN([#include <stdio.h>
511 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
512 ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
513 if test x"$ac_cv_have_longlong" = x"yes"; then
514     AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
515 fi
518 # Check if the compiler supports the LL prefix on long long integers.
519 # AIX needs this.
521 AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
522     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
523         ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
524 if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
525    AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
526 fi
528 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE_VA_COPY,[
529 AC_TRY_LINK([#include <stdarg.h>
530 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
531 ac_cv_HAVE_VA_COPY=yes,ac_cv_HAVE_VA_COPY=no)])
532 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
533     AC_DEFINE(HAVE_VA_COPY,1,[Define if system has va_copy])
534 fi
536 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
537 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
538 AC_TRY_RUN([
539 #include <sys/types.h>
540 #include <stdarg.h>
541 void foo(const char *format, ...) { 
542        va_list ap;
543        int len;
544        char buf[5];
546        va_start(ap, format);
547        len = vsnprintf(buf, 0, format, ap);
548        va_end(ap);
549        if (len != 5) exit(1);
551        va_start(ap, format);
552        len = vsnprintf(0, 0, format, ap);
553        va_end(ap);
554        if (len != 5) exit(1);
556        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
558        exit(0);
560 main() { foo("hello"); }
561 ],
562 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
563 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
564     AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
565 fi
567 AC_TRY_COMPILE([#include <sys/time.h>],
568                [struct timeval *tv;
569                 struct timezone *tz;],
570                AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
571                AC_TRY_COMPILE([#include <sys/time.h>],
572                               [struct timeval *tv;
573                                struct timezone *tz;
574                                gettimeofday(tv, tz);],
575                               AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
576                               AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
578 dnl Checks for library functions.
579 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
581 AC_MSG_CHECKING(return type of socket size)
582 AC_TRY_COMPILE([#include <stdlib.h>
583                 #include <sys/types.h>
584                 #include <sys/socket.h>],
585                [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
586                ac_cv_socket_size_type=["size_t"]
587                 AC_MSG_RESULT(size_t),
588                ac_cv_socket_size_type=["int"]
589                 AC_MSG_RESULT(int))
591 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
592         [Define type of socket size])
594 if test -f "/proc/loadavg"
595 then
596   AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
597   AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
598 fi
600 dnl #### Process table test
602 AC_PATH_PROG(PATH_TO_PS,ps)
603 ac_cv_use_ps_vars=no
605 AC_MSG_CHECKING(for ps syntax)
606 dnl  STAT UCOMM              VSZ   RSS USER       UID  PPID COMMAND
607 if ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
608         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
609 then
610         ac_cv_use_ps_vars=yes
611         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
612         ac_cv_ps_raw_command="$PATH_TO_PS -weo 'stat user ppid args'"
613         ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid comm args'"
614         ac_cv_ps_format="%s %d %d %s %n"
615         ac_cv_vsz_command="$PATH_TO_PS -weo 'vsz comm'"
616         ac_cv_vsz_format="%d %s"
617         ac_cv_rss_command="$PATH_TO_PS -weo 'rss comm'"
618         ac_cv_rss_format="%d %s"
619         EXTRAS="$EXTRAS check_nagios"
620         AC_MSG_RESULT([$ac_cv_ps_command])
622 dnl FreeBSD
623 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
624         egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
625 then
626         ac_cv_use_ps_vars=yes
627         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
628         ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
629         ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid command command'"
630         ac_cv_ps_format="%s %d %d %s %n"
631         ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
632         ac_cv_vsz_format="%d %s"
633         ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
634         ac_cv_rss_format="%d %s"
635         EXTRAS="$EXTRAS check_nagios"
636         AC_MSG_RESULT([$ac_cv_ps_command])
638 dnl BSD-like mode in RH 6.1
639 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
640         egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
641 then
642         ac_cv_use_ps_vars=yes
643         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
644         ac_cv_ps_raw_command="$PATH_TO_PS waxno 'state user ppid comm'"
645         ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid comm args'"
646         ac_cv_ps_format="%s %d %d %s %n"
647         ac_cv_vsz_command="$PATH_TO_PS waxno 'vsz comm'"
648         ac_cv_vsz_format="%d %s"
649         ac_cv_rss_command="$PATH_TO_PS waxno 'rss comm'"
650         ac_cv_rss_format="%d %s"
651         EXTRAS="$EXTRAS check_nagios"
652         AC_MSG_RESULT([$ac_cv_ps_command])
654 dnl SunOS 4.1.3:
655 dnl  F  UID  PID  PPID  CP  PRI  NI  SZ  RSS  WCHAN  STAT  TT  TIME  COMMAND
656 elif ps -laxnwww 2>/dev/null | \
657         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
658 then
659         ac_cv_use_ps_vars=yes
660         ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
661         ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
662         ac_cv_ps_command="$PATH_TO_PS -laxnwww"
663         ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %*s %s %*s %*s %n%s"
664         ac_cv_vsz_command="$PATH_TO_PS laxnwww"
665         ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %d"
666         ac_cv_rss_command="$PATH_TO_PS laxnwww"
667         ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %d"
668         EXTRAS="$EXTRAS check_nagios"
669         AC_MSG_RESULT([$ac_cv_ps_command])
671 dnl Debian Linux / procps v1.2.9:
672 dnl  FLAGS   UID   PID  PPID PRI  NI   SIZE   RSS WCHAN       STA TTY TIME COMMAND
673 dnl    100     0     1     0   0   0    776    76  c0131c8c   S  ffff  0:11 init [2]
674 dnl
675 elif ps laxnwww 2>/dev/null | \
676         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
677 then
678         ac_cv_use_ps_vars=yes
679         ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
680         ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
681         ac_cv_ps_command="$PATH_TO_PS laxnwww"
682         ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
683         ac_cv_vsz_command="$PATH_TO_PS laxnwww"
684         ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
685         ac_cv_rss_command="$PATH_TO_PS laxnwww"
686         ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
687         EXTRAS="$EXTRAS check_nagios"
688         AC_MSG_RESULT([$ac_cv_ps_command])
690 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
691 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
692         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
693 then
694         ac_cv_use_ps_vars=yes
695         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
696         ac_cv_ps_raw_command="$PATH_TO_PS -axo 'stat user ppid args'"
697         ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid comm args'"
698         ac_cv_ps_format="%s %d %d %s %n"
699         ac_cv_vsz_command="$PATH_TO_PS -axo 'vsz comm'"
700         ac_cv_vsz_format="%d %s"
701         ac_cv_rss_command="$PATH_TO_PS -axo 'rss comm'"
702         ac_cv_rss_format="%d %s"
703         EXTRAS="$EXTRAS check_nagios"
704         AC_MSG_RESULT([$ac_cv_ps_command])
706 dnl AIX 4.3.3 - needs verification. This works for Tru64 - needs %*[ +] in PS_FORMAT
707 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
708         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
709 then
710         ac_cv_use_ps_vars=yes
711         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
712         ac_cv_ps_raw_command="$PATH_TO_PS -ao 'stat user ppid args'"
713         ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid comm args'"
714         ac_cv_ps_format="[["%s%*[ +] %d %d %s %n"]]"
715         ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz comm'"
716         ac_cv_vsz_format="%d %s"
717         ac_cv_rss_command="$PATH_TO_PS -ao 'rss comm'"
718         ac_cv_rss_format="%d %s"
719         EXTRAS="$EXTRAS check_nagios"
720         AC_MSG_RESULT([$ac_cv_ps_command])
722 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
723         egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
724 then
725         ac_cv_use_ps_vars=yes
726         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
727         ac_cv_ps_raw_command="$PATH_TO_PS -eo 's user ppid args'"
728         ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid comm args'"
729         ac_cv_ps_format="%s %d %d %s %n"
730         ac_cv_vsz_command="$PATH_TO_PS -eo 'vsz comm'"
731         ac_cv_vsz_format="%d %s"
732         ac_cv_rss_command="$PATH_TO_PS -eo 'rss comm'"
733         ac_cv_rss_format="%d %s"
734         EXTRAS="$EXTRAS check_nagios"
735         AC_MSG_RESULT([$ac_cv_ps_command])
737 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
738         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
739 then
740         ac_cv_use_ps_vars=yes
741         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
742         ac_cv_ps_raw_command="$PATH_TO_PS -Ao 's user ppid args'"
743         ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid comm args'"
744         ac_cv_ps_format="%s %d %d %s %n"
745         ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
746         ac_cv_vsz_format="%d %s"
747         ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
748         ac_cv_rss_format="%d %s"
749         EXTRAS="$EXTRAS check_nagios"
750         AC_MSG_RESULT([$ac_cv_ps_command])
752 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
753         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
754 then
755         ac_cv_use_ps_vars=yes
756         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
757         ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'status user ppid args'"
758         ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid comm args'"
759         ac_cv_ps_format="%s %d %d %s %n"
760         ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
761         ac_cv_vsz_format="%d %s"
762         ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
763         ac_cv_rss_format="%d %s"
764         EXTRAS="$EXTRAS check_nagios"
765         AC_MSG_RESULT([$ac_cv_ps_command])
767 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
768         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
769 then
770         ac_cv_use_ps_vars=yes
771         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
772         ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'state user ppid args'"
773         ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid comm args'"
774         ac_cv_ps_format="%s %d %d %s %n"
775         ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
776         ac_cv_vsz_format="%d %s"
777         ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
778         ac_cv_rss_format="%d %s"
779         EXTRAS="$EXTRAS check_nagios"
780         AC_MSG_RESULT([$ac_cv_ps_command])
782 dnl wonder who takes state instead of stat
783 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
784         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
785 then
786         ac_cv_use_ps_vars=yes
787         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
788         ac_cv_ps_raw_command="$PATH_TO_PS -ao 'state user ppid args'"
789         ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid command args'"
790         ac_cv_ps_format="%s %d %d %s %n"
791         ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz command'"
792         ac_cv_vsz_format="%d %s"
793         ac_cv_rss_command="$PATH_TO_PS -ao 'rss command'"
794         ac_cv_rss_format="%d %s"
795         EXTRAS="$EXTRAS check_nagios"
796         AC_MSG_RESULT([$ac_cv_ps_command])
798 dnl IRIX 53
799 elif ps -el 2>/dev/null | \
800         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
801 then
802         ac_cv_use_ps_vars=yes
803         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
804         ac_cv_ps_command="$PATH_TO_PS -el"
805         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
806         ac_cv_vsz_command="$PATH_TO_PS -el"
807         ac_cv_vsz_format="%*s %*s %*s %*s %d"
808         ac_cv_rss_command="$PATH_TO_PS -el"
809         ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
810         AC_MSG_RESULT([$ac_cv_ps_command])
812 dnl IRIX 63
813 elif ps -el 2>/dev/null | \
814         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
815 then
816         ac_cv_use_ps_vars=yes
817         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
818         ac_cv_ps_command="$PATH_TO_PS -el"
819         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
820         ac_cv_vsz_command="$PATH_TO_PS -el"
821         ac_cv_vsz_format="%*s %*s %*s %*s %d"
822         ac_cv_rss_command="$PATH_TO_PS -el"
823         ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
824         AC_MSG_RESULT([$ac_cv_ps_command])
826 dnl AIX 4.1:
827 dnl     F S      UID   PID  PPID   C PRI NI ADDR  SZ  RSS   WCHAN    TTY  TIME CMD
828 dnl    303 A        0     0     0 120  16 -- 1c07  20   24              -  0:45 swapper
829 elif ps -el 2>/dev/null | \
830         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
831 then
832         ac_cv_use_ps_vars=yes
833         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
834         ac_cv_ps_command="$PATH_TO_PS -el"
835         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
836         ac_cv_vsz_command="$PATH_TO_PS -el"
837         ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
838         ac_cv_rss_command="$PATH_TO_PS -el"
839         ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
840         AC_MSG_RESULT([$ac_cv_ps_command])
842 dnl AIX?
843 elif ps glaxen 2>/dev/null | \
844         egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
845 then
846         ac_cv_use_ps_vars=yes
847         ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
848         ac_cv_ps_command="$PATH_TO_PS glaxen"
849         ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
850         ac_cv_vsz_command="$PATH_TO_PS glaxen"
851         ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
852         ac_cv_rss_command="$PATH_TO_PS glaxen"
853         ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
854         AC_MSG_RESULT([$ac_cv_ps_command])
856 dnl MacOSX / Darwin
857 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
858 dnl STAT      VSZ    RSS   UID USER     PPID UCOMM            COMMAND
859 dnl Ss       1308    272     0 root        0 init             /sbin/init
860 elif ps waxo 'state vsz rss uid user ppid ucomm command' 2>/dev/null | \
861         egrep -i ["^STAT +VSZ +RSS +UID +USER +PPID +UCOMM +COMMAND"] >/dev/null
862 then
863         ac_cv_use_ps_vars=yes
864         ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
865         ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
866         ac_cv_ps_command="$PATH_TO_PS waxo 'state uid ppid ucomm command'"
867         ac_cv_ps_format="%s %d %d %s %n"
868         ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
869         ac_cv_vsz_format="%d %s"
870         ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
871         ac_cv_rss_format="%d %s"
872         EXTRAS="$EXTRAS check_nagios"
873         AC_MSG_RESULT([$ac_cv_ps_command])
875 dnl UnixWare 
876 elif ps -Al 2>/dev/null | \
877         egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
878 then
879         ac_cv_use_ps_vars=yes
880         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
881         ac_cv_ps_command="$PATH_TO_PS -Al"
882         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
883         if ps -Ao 'vsz comm' 2>/dev/null | \
884                 egrep -i ["^ *VSZ +COMMAND"] >/dev/null
885         then
886                 ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
887                 ac_cv_vsz_format="%*s %d"
888         fi
889         AC_MSG_RESULT([$ac_cv_ps_command])
891 else
892         AC_MSG_WARN([unable to find usable ps syntax])
893 fi
895 if test "x$ac_cv_use_ps_vars" != "xno"
896 then
897         AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
898 fi
899 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
900         [Variable list for sscanf of 'ps' output])
901 AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$ac_cv_ps_raw_command",
902         [Verbatim command to execute for ps in check_netsaint])
903 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
904         [Verbatim command to execute for ps in check_procs])
905 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
906         [Format string for scanning ps output in check_procs])
907 AC_DEFINE_UNQUOTED(VSZ_COMMAND,"$ac_cv_vsz_command",
908         [Verbatim command to execute for ps in check_vsz])
909 AC_DEFINE_UNQUOTED(VSZ_FORMAT,"$ac_cv_vsz_format",
910         [Format string for scanning ps output in check_vsz])
911 AC_DEFINE_UNQUOTED(RSS_COMMAND,"$ac_cv_rss_command",
912         [Verbatim command to execute for ps in check_rss])
913 AC_DEFINE_UNQUOTED(RSS_FORMAT,"$ac_cv_rss_format",
914         [Format string for scanning ps output in check_rss])
916 AC_PATH_PROG(PATH_TO_DF,df)
917 AC_PATH_PROG(PATH_TO_BDF,bdf)
919 AC_ARG_WITH(df_command,
920         ACX_HELP_STRING([--with-df-command=SYNTAX],
921                 [sets syntax for df]),
922         with_df_command=$withval,)
924 AC_MSG_CHECKING(for df syntax)
925 if test -n "$with_df_command"
926 then
927         AC_MSG_RESULT([$with_df_command])
929 elif df -Pk 2>/dev/null | egrep -i ["^(/dev/|[a-zA-Z]:)[a-z0-9/\\]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/\\]*"] >/dev/null
930 then
931         with_df_command="$PATH_TO_DF -Pk"
932         AC_MSG_RESULT([$with_df_command])
934 elif df -k 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
935 then
936         with_df_command="$PATH_TO_DF -k"
937         AC_MSG_RESULT([$with_df_command])
939 elif df 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
940 then
941         with_df_command="$PATH_TO_DF"
942         AC_MSG_RESULT([$with_df_command])
944 elif bdf 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
945 then
946         with_df_command="$PATH_TO_BDF"
947         AC_MSG_RESULT([$with_df_command])
949 else
950         AC_MSG_WARN([unable to find usable df syntax])
951 fi
953 AC_DEFINE_UNQUOTED(DF_COMMAND,"$with_df_command",[path and args for df command])
955 AC_PATH_PROG(PATH_TO_PING,ping)
956 AC_PATH_PROG(PATH_TO_PING6,ping6)
958 AC_ARG_WITH(ping_command,
959         ACX_HELP_STRING([--with-ping-command=SYNTAX],
960                 [sets syntax for ICMP ping]),
961         with_ping_command=$withval,)
963 AC_MSG_CHECKING(for ICMP ping syntax)
964 ac_cv_ping_packets_first=no
965 if test -n "$with_ping_command"
966 then
967         AC_MSG_RESULT([(command-line) $with_ping_command])
968         if test -n "$ac_cv_ping_packets_first"
969         then
970                 ac_cv_ping_packets_first=yes
971         fi
973 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
974         $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
975         egrep -i "^round-trip|^rtt" >/dev/null
976 then
977         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
978         ac_cv_ping_packets_first=yes
979         AC_MSG_RESULT([$with_ping_command])
981 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
982         egrep -i "^round-trip|^rtt" >/dev/null
983 then
984         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
985         ac_cv_ping_packets_first=yes
986         AC_MSG_RESULT([$with_ping_command])
988 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
989         egrep -i "^round-trip|^rtt" >/dev/null
990 then
991         with_ping_command="$PATH_TO_PING -n -c %d %s"
992         ac_cv_ping_packets_first=yes
993         AC_MSG_RESULT([$with_ping_command])
995 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
996         egrep -i "^round-trip|^rtt" >/dev/null
997 then
998         with_ping_command="$PATH_TO_PING -n %s -c %d"
999         AC_MSG_RESULT([$with_ping_command])
1001 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1002         egrep -i "^round-trip|^rtt" >/dev/null
1003 then
1004         with_ping_command="$PATH_TO_PING %s -n %d"
1005         AC_MSG_RESULT([$with_ping_command])
1007 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1008         egrep -i "^round-trip|^rtt" >/dev/null
1009 then
1010         with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1011         AC_MSG_RESULT([$with_ping_command])
1013 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1014         egrep -i "^round-trip|^rtt" >/dev/null
1015 then
1016         with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1017         AC_MSG_RESULT([$with_ping_command])
1019 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1020         egrep -i "^round-trip|^rtt" >/dev/null
1021 then
1022         with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1023         ac_cv_ping_packets_first=yes
1024         AC_MSG_RESULT([$with_ping_command])
1026 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1027         egrep -i "^round-trip|^rtt" >/dev/null
1028 then
1029         with_ping_command="$PATH_TO_PING -n -c %d %s"
1030         ac_cv_ping_packets_first=yes
1031         AC_MSG_RESULT([$with_ping_command])
1033 else
1034         AC_MSG_WARN([unable to find usable ping syntax])
1035 fi
1037 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1038         [path and args for ICMP ping command])
1040 if test "x$ac_cv_ping_packets_first" != "xno"
1041 then
1042         AC_DEFINE(PING_PACKETS_FIRST,1,
1043                 [Define if packet count must precede host])
1044 fi
1046 AC_ARG_WITH(ping6_command,
1047         ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1048                 [sets syntax for ICMPv6 ping]),
1049         with_ping6_command=$withval,)
1051 if test x"$with_ipv6" != xno ; then
1052 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1053 ac_cv_ping6_packets_first=no
1054 if test -n "$with_ping6_command"
1055 then
1056         AC_MSG_RESULT([(command-line) $with_ping6_command])
1057         if test -n "$ac_cv_ping6_packets_first"
1058         then
1059                 ac_cv_ping6_packets_first=yes
1060         fi
1062 elif test "x$PATH_TO_PING6" != "x"; then
1063         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1064                 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1065                 egrep -i "^round-trip|^rtt" >/dev/null
1066         then
1067                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1068                 ac_cv_ping6_packets_first=yes
1069                 AC_MSG_RESULT([$with_ping6_command])
1071         elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1072                 egrep -i "^round-trip|^rtt" >/dev/null
1073         then
1074                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1075                 ac_cv_ping6_packets_first=yes
1076                 AC_MSG_RESULT([$with_ping6_command])
1078         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1079                 egrep -i "^round-trip|^rtt" >/dev/null
1080         then
1081                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1082                 ac_cv_ping6_packets_first=yes
1083                 AC_MSG_RESULT([$with_ping6_command])
1085         elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1086                 egrep -i "^round-trip|^rtt" >/dev/null
1087         then
1088                 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1089                 AC_MSG_RESULT([$with_ping6_command])
1091         elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1092                 egrep -i "^round-trip|^rtt" >/dev/null
1093         then
1094                 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1095                 AC_MSG_RESULT([$with_ping6_command])
1097         elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1098                 egrep -i "^round-trip|^rtt" >/dev/null
1099         then
1100                 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1101                 AC_MSG_RESULT([$with_ping6_command])
1103         elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1104                 egrep -i "^round-trip|^rtt" >/dev/null
1105         then
1106                 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1107                 AC_MSG_RESULT([$with_ping6_command])
1109         elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1110                 egrep -i "^round-trip|^rtt" >/dev/null
1111         then
1112                 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1113                 ac_cv_ping6_packets_first=yes
1114                 AC_MSG_RESULT([$with_ping_command])
1116         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1117                 egrep -i "^round-trip|^rtt" >/dev/null
1118         then
1119                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1120                 ac_cv_ping6_packets_first=yes
1121                 AC_MSG_RESULT([$with_ping6_command])
1123         fi
1125 elif test "x$PATH_TO_PING" != "x"; then
1126         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1127                 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1128                 egrep -i "^round-trip|^rtt" >/dev/null
1129         then
1130                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1131                 ac_cv_ping6_packets_first=yes
1132                 AC_MSG_RESULT([$with_ping6_command])
1134         elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1135                 egrep -i "^round-trip|^rtt" >/dev/null
1136         then
1137                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1138                 ac_cv_ping6_packets_first=yes
1139                 AC_MSG_RESULT([$with_ping6_command])
1141         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1142                 egrep -i "^round-trip|^rtt" >/dev/null
1143         then
1144                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1145                 ac_cv_ping6_packets_first=yes
1146                 AC_MSG_RESULT([$with_ping6_command])
1148         elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1149                 egrep -i "^round-trip|^rtt" >/dev/null
1150         then
1151                 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1152                 AC_MSG_RESULT([$with_ping6_command])
1154         elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1155                 egrep -i "^round-trip|^rtt" >/dev/null
1156         then
1157                 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1158                 AC_MSG_RESULT([$with_ping6_command])
1160         elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1161                 egrep -i "^round-trip|^rtt" >/dev/null
1162         then
1163                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1164                 AC_MSG_RESULT([$with_ping6_command])
1166         elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1167                 egrep -i "^round-trip|^rtt" >/dev/null
1168         then
1169                 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1170                 AC_MSG_RESULT([$with_ping6_command])
1172         elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1173                 egrep -i "^round-trip|^rtt" >/dev/null
1174         then
1175                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1176                 ac_cv_ping6_packets_first=yes
1177                 AC_MSG_RESULT([$with_ping_command])
1179         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1180                 egrep -i "^round-trip|^rtt" >/dev/null
1181         then
1182                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1183                 ac_cv_ping6_packets_first=yes
1184                 AC_MSG_RESULT([$with_ping6_command])
1186         fi
1188 fi
1190 if test "x$with_ping6_command" != "x"; then
1191         AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1192                 [path and args for ICMPv6 ping command])
1193 else
1194         AC_MSG_RESULT([none])
1195 fi
1197 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1198         AC_DEFINE(PING6_PACKETS_FIRST,1,
1199                 [Define if packet count must precede host])
1200 fi
1201 fi
1203 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1205 AC_MSG_CHECKING(for nslookup syntax)
1206 if test -n "$PATH_TO_NSLOOKUP"
1207 then
1208         if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1209         then
1210                 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1211                 AC_MSG_RESULT([$ac_cv_nslookup_command])
1213         else
1214                 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1215                 AC_MSG_RESULT([$ac_cv_nslookup_command])
1217         fi
1218         EXTRAS="$EXTRAS check_dns"
1220 else
1221         AC_MSG_WARN([nslookup command not found])
1222 fi
1224 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1225         [path and args for nslookup])
1227 AC_PATH_PROG(PATH_TO_HOST,host)
1228 if test -n "$ac_cv_path_PATH_TO_HOST"
1229 then
1230         EXTRAS="$EXTRAS check_dns"
1231 fi
1233 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1234 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1236 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1237 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1239 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1240 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1241 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1242 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1243 then
1244         AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1245         AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1246 else
1247         AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1248 fi
1250 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1251 if test -x "$PATH_TO_LMSTAT"
1252 then
1253         AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1254 else
1255         AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1256 fi
1258 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1259 if test -x "$PATH_TO_SMBCLIENT"
1260 then
1261         AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1262 else
1263         AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1264 fi
1267 AC_PATH_PROG(PATH_TO_WHO,who)
1269 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1270 then
1271         ac_cv_path_to_who="$PATH_TO_WHO -q"
1272 else
1273         ac_cv_path_to_who="$PATH_TO_WHO"
1274 fi
1276 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1277         [path and arguments for invoking 'who'])
1279 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1280 if test -x "$PATH_TO_SNMPGET"
1281 then
1282         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1283         EXTRAS="$EXTRAS check_hpjd check_snmp"
1284 else
1285         AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1286 fi
1288 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1289 if test -x "$PATH_TO_SNMPGETNEXT"
1290 then
1291         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1292 fi
1294 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null  )
1295 then
1296         AC_MSG_CHECKING(for Net::SNMP perl module)
1297         AC_MSG_RESULT([found])
1298 else
1299         AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1300 fi
1302 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1303 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1305 if test -x "$PATH_TO_QUAKESTAT"
1306 then
1307         ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1308         EXTRAS="$EXTRAS check_game"
1310 elif test -x "$PATH_TO_QSTAT"
1311 then
1312         ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1313         EXTRAS="$EXTRAS check_game"
1314 else
1315         AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1316 fi
1318 if test $ac_cv_path_to_qstat 
1319 then
1320         AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1321                 [path to qstat/quakestat])
1322 fi
1324 AC_PATH_PROG(PATH_TO_FPING,fping)
1325 if test -x "$PATH_TO_FPING"
1326 then
1327         AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1328         EXTRAS="$EXTRAS check_fping"
1329 else
1330         AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1331 fi
1333 AC_PATH_PROG(PATH_TO_SSH,ssh)
1335 if test -x "$PATH_TO_SSH"
1336 then
1337         AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1338         EXTRAS="$EXTRAS check_by_ssh"
1339 else
1340         AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1341 fi
1344 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1345 if test -x "$PATH_TO_MAILQ"
1346 then
1347         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1348 else
1349         AC_MSG_WARN([Could not find mailq or eqivalent])
1350 fi
1352 dnl SWAP info required is amount allocated/available and amount free
1353 dnl The plugin works through all the swap devices and adds up the total swap
1354 dnl available.
1356 dnl dunno why this does not work below - use hack (kbd)
1357 dnl fine on linux, broken on solaris
1358 dnl if /bin/test -e "/proc/meminfo"
1360 AC_PATH_PROG(PATH_TO_SWAP,swap)
1361 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1363 AC_MSG_CHECKING(for how to check memory)
1364 if [cat /proc/meminfo > /dev/null 2>&1]
1365 then
1366         AC_MSG_RESULT([found /proc/meminfo])
1367         AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1368         AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1369         EXTRAS="$EXTRAS check_swap"
1371 elif [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1372 then
1373         ac_cv_have_swap=yes
1374         ac_cv_swap_command="$PATH_TO_SWAP -l"
1375         if [$PATH_TO_SWAP -l 2>/dev/null | \
1376                 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1377                 >/dev/null]
1378         then
1379                 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1380                 AC_MSG_RESULT([using IRIX format swap])
1382         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null]
1383         then
1384                 ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
1385                 AC_MSG_RESULT([using Solaris format swap])
1387         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1388         then
1389                 ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
1390                 AC_MSG_RESULT([using Unixware format swap])
1392         fi
1393         EXTRAS="$EXTRAS check_swap"
1395 elif [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1396 then
1397         ac_cv_have_swap=yes
1398         ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1400         if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1401         then
1402                 ac_cv_swap_format=["%*s %d %*d %d"]
1403                 AC_MSG_RESULT([using FreeBSD format swapinfo])
1404         fi
1405         EXTRAS="$EXTRAS check_swap"
1407 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1408 then
1409         ac_cv_have_swap=yes
1410         ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1411         ac_cv_swap_format=["%*s %d %*d %d"]
1412         AC_MSG_RESULT([using HP-UX format swapinfo])
1413 fi
1415 if test x$ac_cv_have_swap != x 
1416 then
1417         AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1418 fi
1419 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1420         [Format string for parsing swap output])
1421 if test "x$ac_cv_swap_command" != "x" 
1422 then
1423         AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1424                 [Path to swap/swapinfo binary, with any args])
1425 fi
1427 AC_PATH_PROG(PATH_TO_DIG,dig)
1428 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1429 if test -n "$PATH_TO_DIG"; then
1430         EXTRAS="$EXTRAS check_dig"
1431 fi
1433 if test -f plugins/check_nt.c ; then
1434   EXTRAS="$EXTRAS check_nt"
1435 elif test -f ../plugins/check_nt.c ; then
1436   EXTRAS="$EXTRAS check_nt"
1437 fi
1439 AC_MSG_CHECKING(for va_list)
1440 AC_TRY_COMPILE([#ifdef __STDC__
1441                 #include <stdio.h>
1442                 #include <stdlib.h>
1443                 #include <stdarg.h>
1444                 #else
1445                 #include <sys/types.h>
1446                 #include <stdio.h>
1447                 #include <varargs.h>
1448                 #endif],
1449                 [va_list args;],
1450                 [AC_MSG_RESULT(yes)],
1451                 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1453 AC_SUBST(EXTRAS)
1454 AC_SUBST(DEPLIBS)
1456 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
1458 AC_OUTPUT(Makefile subst lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,echo timestamp > plugins/stamp-h1;echo timestamp > plugins/stamp-h2;echo timestamp > plugins/stamp-h3;echo timestamp > plugins/stamp-h4;echo timestamp > plugins/stamp-h5;echo timestamp > plugins/stamp-h6;PATH=.:..:$PATH subst.sh command.cfg)
1460 ACX_FEATURE([with],[cgiurl])
1461 ACX_FEATURE([with],[nagios-user])
1462 ACX_FEATURE([with],[nagios-group])
1463 ACX_FEATURE([with],[trusted-path])
1464 ACX_FEATURE([with],[df-command])
1465 ACX_FEATURE([with],[ping-command])
1466 ACX_FEATURE([with],[ping6-command])
1467 ACX_FEATURE([with],[lwres])
1468 ACX_FEATURE([with],[ipv6])
1469 ACX_FEATURE([enable],[emulate-getaddrinfo])