Code

test GNU_SOURCE and include features.h if present to clear warning about asprintf...
[nagiosplug.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.50)
4 AC_INIT(Helper.pm)
5 VER=1.3.99
6 REL=1
7 AC_SUBST(VER)
8 AC_SUBST(REL)
9 PACKAGE_VERSION="${VER}"
10 AC_SUBST(PACKAGE_VERSION)
11 PACKAGE_RELEASE="${REL}"
12 AC_SUBST(PACKAGE_RELEASE)
13 AM_INIT_AUTOMAKE(nagios-plugins,${PACKAGE_VERSION})
14 AM_CONFIG_HEADER(plugins/config.h)
15 AC_CANONICAL_HOST
17 AC_PREFIX_DEFAULT(/usr/local/nagios)
19 dnl Figure out how to invoke "install" and what install options to use.
21 AC_PROG_INSTALL
22 AC_SUBST(INSTALL)
24 AC_GNU_SOURCE
25 AC_PROG_CC
26 AC_PROG_CPP
27 AC_PROG_GCC_TRADITIONAL
28 AC_PROG_RANLIB
29 AC_AIX
30 AC_MINIX
32 AC_PROG_MAKE_SET
33 AC_PROG_AWK
37 saved_srcdir=$srcdir
38 srcdir=$srcdir/lib
39 test -f $srcdir/getloadavg.c \
40   || AC_MSG_ERROR([getloadavg.c is not in $srcdir])
41 AC_FUNC_GETLOADAVG
42 srcdir=$saved_srcdir
44 ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
45 dnl AM_WITH_REGEX
47 PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
48 AC_SUBST(PLUGIN_TEST)dnl
50 SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
51 AC_SUBST(SCRIPT_TEST)dnl
53 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"
54 AC_SUBST(WARRANTY)
56 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"
57 AC_SUBST(SUPPORT)
59 dnl CGIURL has changed for Nagios with 1.0 beta
60 AC_ARG_WITH(cgiurl,
61         ACX_HELP_STRING([--with-cgiurl=DIR],
62                 [sets URL for cgi programs]),
63         with_cgiurl=$withval,
64         with_cgiurl=/nagios/cgi-bin)
65 CGIURL="$with_cgiurl"
66 AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
68 AC_ARG_WITH(nagios_user,
69         ACX_HELP_STRING([--with-nagios-user=USER],
70                 [set user name to run nagios]),
71         with_nagios_user=$withval,
72         with_nagios_user=nagios)
73 AC_ARG_WITH(nagios_group,
74         ACX_HELP_STRING([--with-nagios-group=GROUP],
75                 [set group name to run nagios]),
76         with_nagios_group=$withval,
77         with_nagios_group=nagios)
78 AC_SUBST(with_nagios_user)
79 AC_SUBST(with_nagios_group)
80 INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
81 AC_SUBST(INSTALL_OPTS)
83 AC_ARG_WITH(trusted_path,
84         ACX_HELP_STRING([--with-trusted-path=PATH],
85                 [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
86         with_trusted_path=$withval,
87         with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
88 AC_SUBST(with_trusted_path)
90 EXTRAS=
91 dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
93 LDFLAGS="$LDFLAGS -L."
95 ac_cv_uname_m=`uname -m`
96 ac_cv_uname_s=`uname -s`
97 ac_cv_uname_r=`uname -r`
98 ac_cv_uname_v=`uname -v`
100 PKG_ARCH=`uname -p`
101 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
102 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
104 AC_SUBST(PKG_ARCH)
105 AC_SUBST(REV_DATESTAMP)
106 AC_SUBST(REV_TIMESTAMP)
108 dnl Checks for programs.
109 AC_PATH_PROG(PYTHON,python)
110 AC_PATH_PROG(PERL,perl)
111 AC_PATH_PROG(SH,sh)
113 AC_PATH_PROG(HOSTNAME,hostname)
114 AC_PATH_PROG(BASENAME,basename)
116 dnl
117 dnl Check for miscellaneous stuff
118 dnl 
120 case $host_vender-$host_os in
121 sun*)
122         AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
123         ;;
124 osf*)
125         AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
126         ;;
127 esac
129 dnl
130 dnl Checks for libraries.
131 dnl
133 AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
134 AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
135 AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
136 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
137 AC_SUBST(SOCKETLIBS)
139 dnl Check for PostgreSQL libraries
140 _SAVEDLIBS="$LIBS"
141 _SAVEDCPPFLAGS="$CPPFLAGS"
142 AC_ARG_WITH(pgsql,
143         ACX_HELP_STRING([--with-pgsql=DIR],
144                 [sets path to pgsql installation]),
145         PGSQL=$withval,)
146 AC_CHECK_LIB(crypt,main)
147 if test "$ac_cv_lib_crypt_main" = "yes"; then
148   if test -n "$PGSQL"; then
149     LDFLAGS="$LDFLAGS -L$PGSQL/lib"
150     CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
151   fi
152   AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
153   if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
154     AC_CHECK_HEADERS(pgsql/libpq-fe.h)
155     AC_CHECK_HEADERS(postgresql/libpq-fe.h)
156     AC_CHECK_HEADERS(libpq-fe.h)
157     if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
158       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
159       PGINCLUDE="-I$PGSQL/include"
160     elif test  "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
161       PGLIBS="-lpq -lcrypt"
162       PGINCLUDE="-I/usr/include/pgsql"
163     elif test  "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
164       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
165       PGINCLUDE="-I/usr/include/postgresql"
166     elif test  "$ac_cv_header_libpq_fe_h" = "yes"; then
167       PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
168       PGINCLUDE="-I$PGSQL/include"
169     fi
170     if test -z "$PGINCLUDE"; then
171       AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
172       AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
173     else
174       AC_SUBST(PGLIBS)
175       AC_SUBST(PGINCLUDE)
176       EXTRAS="$EXTRAS check_pgsql"
177     fi
178   else
179     AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
180     AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
181     AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
182   fi
183 else
184   AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
185   AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
186 fi
187 LIBS="$_SAVEDLIBS"
188 CPPFLAGS="$_SAVEDCPPFLAGS"
190 dnl Check for radius libraries
191 _SAVEDLIBS="$LIBS"
192 AC_CHECK_LIB(radiusclient,rc_read_config)
193 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
194   EXTRAS="$EXTRAS check_radius"
195         RADIUSLIBS="-lradiusclient"
196   AC_SUBST(RADIUSLIBS)
197 else
198   AC_MSG_WARN([Skipping radius plugin])
199   AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
200 fi
201 LIBS="$_SAVEDLIBS"
203 dnl Check for LDAP libraries
204 _SAVEDLIBS="$LIBS"
205 AC_CHECK_LIB(ldap,main,,,-llber)
206 if test "$ac_cv_lib_ldap_main" = "yes"; then
207   LDAPLIBS="-lldap -llber"\
208   LDAPINCLUDE="-I/usr/include/ldap"
209   AC_SUBST(LDAPLIBS)
210   AC_SUBST(LDAPINCLUDE)
211   AC_CHECK_FUNCS(ldap_set_option)
212   EXTRAS="$EXTRAS check_ldap"
213 else
214   AC_MSG_WARN([Skipping LDAP plugin])
215   AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
216 fi
217 LIBS="$_SAVEDLIBS"
220 dnl Check for mysql libraries
221 _SAVEDLIBS="$LIBS"
222 _SAVEDCPPFLAGS="$CPPFLAGS"
223 AC_ARG_WITH(mysql,
224         ACX_HELP_STRING([--with-mysql=DIR],
225                 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
226         MYSQL=$withval,)
227 if test -n "$MYSQL"; then
228   MYSQLLIBDIR=$MYSQL/lib/mysql
229   CPPFLAGS="-I$MYSQL/include"
230   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
231   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
232 elif test -f /usr/lib/libmysqlclient.so; then
233   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
234   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
235 elif test -f /usr/lib/libmysqlclient.a; then
236   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
237   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
238 elif test -f /usr/lib/mysql/libmysqlclient.so; then
239   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
240   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
241 elif test -f /usr/lib/mysql/libmysqlclient.a; then
242   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
243   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
244 fi
245 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
246   AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
247   if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
248     EXTRAS="$EXTRAS check_mysql"
249     AC_SUBST(MYSQLINCLUDE)
250     AC_SUBST(MYSQLLIBS)
251     AC_SUBST(check_mysql_LDFLAGS)
252   else
253     AC_MSG_WARN([Skipping mysql plugin])
254     AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
255   fi
256 else
257   AC_MSG_WARN([Skipping mysql plugin])
258   AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
259 fi
260 CPPFLAGS="$_SAVEDCPPFLAGS"
261 LIBS="$_SAVEDLIBS"
263 dnl Check for OpenSSL location
264 AC_PATH_PROG(OPENSSL,openssl)
265 if test "$OPENSSL" = "/usr/bin/openssl"; then
266   OPENSSL=/usr
267 elif test "$OPENSSL" = "/usr/sbin/openssl"; then
268   OPENSSL=/usr
269 elif test "$OPENSSL" = "/opt/bin/openssl"; then
270   OPENSSL=/opt
271 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
272   OPENSSL=/opt/openssl
273 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
274   OPENSSL=/usr/slocal
275 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
276   OPENSSL=/usr/local
277 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
278   OPENSSL=/usr/local/ssl
279 fi
280 AC_ARG_WITH(openssl,
281         ACX_HELP_STRING([--with-openssl=DIR],
282                 [sets path to openssl installation]),
283         OPENSSL=$withval,)
285 AC_CHECK_HEADERS(unistd.h)
287 dnl Check for AF_INET6 support - unistd.h required for Darwin
288 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
289         AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
290                         #include <unistd.h>
291                         #endif
292                         #include <netinet/in.h>
293                         #include <sys/socket.h>],
294                         [struct sockaddr_in6 sin6;
295                         void *p;
297                         sin6.sin6_family = AF_INET6;
298                         sin6.sin6_port = 587;
299                         p = &sin6.sin6_addr;],
300                         [with_ipv6=yes], 
301                         [with_ipv6=no])
302         ])
304 if test x"$with_ipv6" != xno ; then
305         AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
306 fi
308 dnl #########################################################################
309 dnl Check if Posix getaddrinfo() is available.  It is also possible to use
310 dnl the version from the lwres library distributed with BIND.
311 dnl #########################################################################
312 AC_ARG_ENABLE([emulate-getaddrinfo],
313               ACX_HELP_STRING([--enable-emulate-getaddrinfo],
314                              [enable getaddrinfo emulation (default=no)]),
315               ,
316               enable_emulate_getaddrinfo=no)
318 AC_ARG_WITH(lwres,
319             ACX_HELP_STRING([--with-lwres=DIR],
320                            [use lwres library for getaddrinfo (default=no)]),
321             ,
322             with_lwres=no)
324 dnl ## enable force to test getaddrinfo.c
325 if test x$enable_emulate_getaddrinfo = xforce ; then
326         enable_emulate_getaddrinfo=yes
327         have_getaddrinfo=no
328 else
330 have_getaddrinfo=no
331 if test x$with_lwres != xno ; then
332         if test "$with_lwres" != yes ; then
333                    CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
334                    LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
335         fi
336         AC_CHECK_HEADERS(lwres/netdb.h, ,
337                         [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
338         AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
339                      [AC_MSG_ERROR([cannot find the lwres library])],
340                      -lnsl -lpthread)
341         have_getaddrinfo=yes
342 fi
344 if test x$have_getaddrinfo != xyes ; then
345         AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
346 fi
348 dnl # Special nonsense for systems that actually have getaddrinfo but
349 dnl # redefine the name to something else, e.g. OSF
350 if test x$have_getaddrinfo != xyes ; then
351         AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
352         AC_TRY_LINK([
353 #               include <netdb.h>
354         ], [
355                 struct addrinfo hints, *res;
356                 int err;
358                 err = getaddrinfo ("host", "service", &hints, &res);
359         ], [
360                 have_getaddrinfo=yes
361                 AC_MSG_RESULT(yes)
362         ], [AC_MSG_RESULT(no)])
363 fi
365 fi
367 if test x$have_getaddrinfo != xno ; then
368         if test x$enable_emulate_getaddrinfo != xno ; then
369                 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
370         fi
371         AC_DEFINE(HAVE_GETADDRINFO, 1,
372                   [Does system provide RFC 2553/Posix getaddrinfo?])
373 else
374         if test x$enable_emulate_getaddrinfo != xyes ; then
375 dnl                AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
376                enable_emulate_getaddrinfo=yes
377                AC_MSG_WARN([enabling getaddrinfo emulation])
378         fi
379         EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
380 fi
382 if test x"$enable_emulate_getaddrinfo" != xno ; then
383     have_resolver=no
385   dnl  Try for getipnodebyname
386     AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
387     if test x"$have_resolver" != xno ; then
388          AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
389                    [Set when getipnodebyname is available])
390     fi
392   dnl  Try for gethostbyname_r
393     if test x"$have_resolver" = xno ; then
394         AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
395                        [have_resolver=yes
396                         ACX_WHICH_GETHOSTBYNAME_R])
397     fi
399   dnl  Try for gethostbyname
400     if test x"$have_resolver" = xno ; then
401         if test x"$enable_pthreads" != xno ; then
402             AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
403         fi
404         AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
405                        [AC_MSG_ERROR([cannot find gethostbyname])])
406     fi
407     EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
409 fi
411 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
412 if test "$FOUNDINCLUDE" = "no"; then
413   _SAVEDCPPFLAGS="$CPPFLAGS"
414   CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
415   unset ac_cv_header_krb5_h
416   AC_CHECK_HEADERS(krb5.h,
417                    KRB5INCLUDE="-I/usr/kerberos/include"
418                    FOUNDINCLUDE=yes,
419                    FOUNDINCLUDE=no)
420 fi
421 AC_SUBST(KRBINCLUDE)
422 if test "$FOUNDINCLUDE" = "no"; then
423   CPPFLAGS="$_SAVEDCPPFLAGS"
424 fi
426 dnl Check for OpenSSL header files
427 unset FOUNDINCLUDE
428 _SAVEDCPPFLAGS="$CPPFLAGS"
429 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
430 AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
431                  SSLINCLUDE="-I$OPENSSL/include"
432                  FOUNDINCLUDE=yes,
433                  FOUNDINCLUDE=no)
434 if test "$FOUNDINCLUDE" = "no"; then
435   AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
436                    SSLINCLUDE="-I$OPENSSL/include"
437                    FOUNDINCLUDE=yes,
438                    FOUNDINCLUDE=no)
439 fi
440 AC_SUBST(SSLINCLUDE)
441 if test "$FOUNDINCLUDE" = "no"; then
442   CPPFLAGS="$_SAVEDCPPFLAGS"
443 fi
445 dnl Check for crypto lib
446 _SAVEDLIBS="$LIBS"
447 AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
448 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
449   dnl Check for SSL lib
450   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)
451 fi
452 LIBS="$_SAVEDLIBS"
454 dnl test headers and libs to decide whether check_http should use SSL
455 if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
456   if test "$ac_cv_lib_ssl_main" = "yes"; then
457     if test "$FOUNDINCLUDE" = "yes"; then
458       check_tcp_ssl="check_simap check_spop"
459       AC_SUBST(check_tcp_ssl)
460       AC_SUBST(SSLLIBS)
461       AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
462     fi
463   fi
464 fi
465 CPPFLAGS="$_SAVEDCPPFLAGS"
467 dnl
468 dnl Checks for header files.
469 dnl
471 AC_HEADER_STDC
472 AC_HEADER_TIME
473 AC_HEADER_SYS_WAIT
474 AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h)
475 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
476 AC_CHECK_HEADERS(limits.h sys/param.h sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h fcntl.h sys/statfs.h sys/dustat.h sys/statvfs.h)
478 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
479 # doesn't clash with <sys/types.h>, and declares uintmax_t.
481 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
482 [AC_TRY_COMPILE(
483   [#include <sys/types.h>
484 #include <inttypes.h>],
485   [uintmax_t i = (uintmax_t) -1;],
486   jm_ac_cv_header_inttypes_h=yes,
487   jm_ac_cv_header_inttypes_h=no)])
489 if test $jm_ac_cv_header_inttypes_h = yes; then
490   AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
491 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
492    and declares uintmax_t. ])
493 fi
495 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
496 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
497 # enable the work-around code in fsusage.c.
498 AC_MSG_CHECKING([for statfs that truncates block counts])
499 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
500 [AC_TRY_COMPILE([
501 #if !defined(sun) && !defined(__sun)
502 choke -- this is a workaround for a Sun-specific problem
503 #endif
504 #include <sys/types.h>
505 #include <sys/vfs.h>],
506 [struct statfs t; long c = *(t.f_spare);],
507 fu_cv_sys_truncating_statfs=yes
508 AC_MSG_RESULT(yes),
509 fu_cv_sys_truncating_statfs=no
510 AC_MSG_RESULT(no),
511 )])
512 if test $fu_cv_sys_truncating_statfs = yes; then
513   AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
514 [  Define if the block counts reported by statfs may be truncated to 2GB
515    and the correct values may be stored in the f_spare array.
516    (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
517    SunOS 4.1.1 seems not to be affected.)])
518 fi
520 dnl Checks for typedefs, structures, and compiler characteristics.
521 AC_C_CONST
522 AC_STRUCT_TM
523 AC_TYPE_PID_T
524 AC_TYPE_SIZE_T
525 AC_TYPE_SIGNAL
527 AC_CHECK_SIZEOF(int,cross)
528 AC_CHECK_SIZEOF(long,cross)
529 AC_CHECK_SIZEOF(short,cross)
531 AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
532 AC_TRY_RUN([#include <stdio.h>
533 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
534 ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
535 if test x"$ac_cv_have_longlong" = x"yes"; then
536     AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
537 fi
540 # Check if the compiler supports the LL prefix on long long integers.
541 # AIX needs this.
543 AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
544     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
545         ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
546 if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
547    AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
548 fi
550 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE_VA_COPY,[
551 AC_TRY_LINK([#include <stdarg.h>
552 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
553 ac_cv_HAVE_VA_COPY=yes,ac_cv_HAVE_VA_COPY=no)])
554 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
555     AC_DEFINE(HAVE_VA_COPY,1,[Define if system has va_copy])
556 fi
558 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
559 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
560 AC_TRY_RUN([
561 #include <sys/types.h>
562 #include <stdarg.h>
563 void foo(const char *format, ...) { 
564        va_list ap;
565        int len;
566        char buf[5];
568        va_start(ap, format);
569        len = vsnprintf(buf, 0, format, ap);
570        va_end(ap);
571        if (len != 5) exit(1);
573        va_start(ap, format);
574        len = vsnprintf(0, 0, format, ap);
575        va_end(ap);
576        if (len != 5) exit(1);
578        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
580        exit(0);
582 main() { foo("hello"); }
583 ],
584 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
585 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
586     AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
587 fi
589 AC_TRY_COMPILE([#include <sys/time.h>],
590                [struct timeval *tv;
591                 struct timezone *tz;],
592                AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
593                AC_TRY_COMPILE([#include <sys/time.h>],
594                               [struct timeval *tv;
595                                struct timezone *tz;
596                                gettimeofday(tv, tz);],
597                               AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
598                               AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
600 dnl Checks for library functions.
601 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
603 AC_MSG_CHECKING(return type of socket size)
604 AC_TRY_COMPILE([#include <stdlib.h>
605                 #include <sys/types.h>
606                 #include <sys/socket.h>],
607                [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
608                ac_cv_socket_size_type=["size_t"]
609                 AC_MSG_RESULT(size_t),
610                ac_cv_socket_size_type=["int"]
611                 AC_MSG_RESULT(int))
613 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
614         [Define type of socket size])
616 if test -f "/proc/loadavg"
617 then
618   AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
619   AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
620 fi
622 dnl #### Process table test
624 AC_PATH_PROG(PATH_TO_PS,ps)
626 AC_MSG_CHECKING(for ps syntax)
627 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
628 dnl  STAT UCOMM              VSZ   RSS USER      PPID COMMAND
629 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
630         egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
631 then
632         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
633         ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
634         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
635         EXTRAS="$EXTRAS check_nagios"
636         AC_MSG_RESULT([$ac_cv_ps_command])
638 dnl  STAT UCOMM              VSZ   RSS USER       UID  PPID COMMAND
639 elif ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
640         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
641 then
642         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
643         ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu comm args'"
644         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
645         EXTRAS="$EXTRAS check_nagios"
646         AC_MSG_RESULT([$ac_cv_ps_command])
648 dnl FreeBSD
649 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
650         egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
651 then
652         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
653         ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
654         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
655         EXTRAS="$EXTRAS check_nagios"
656         AC_MSG_RESULT([$ac_cv_ps_command])
658 dnl BSD-like mode in RH 6.1
659 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
660         egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
661 then
662         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
663         ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
664         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
665         EXTRAS="$EXTRAS check_nagios"
666         AC_MSG_RESULT([$ac_cv_ps_command])
668 dnl SunOS 4.1.3:
669 dnl  F  UID  PID  PPID  CP  PRI  NI  SZ  RSS  WCHAN  STAT  TT  TIME  COMMAND
670 elif ps -laxnwww 2>/dev/null | \
671         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
672 then
673         ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
674         ac_cv_ps_command="$PATH_TO_PS -laxnwww"
675         ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
676         EXTRAS="$EXTRAS check_nagios"
677         AC_MSG_RESULT([$ac_cv_ps_command])
679 dnl Debian Linux / procps v1.2.9:
680 dnl  FLAGS   UID   PID  PPID PRI  NI   SIZE   RSS WCHAN       STA TTY TIME COMMAND
681 dnl    100     0     1     0   0   0    776    76  c0131c8c   S  ffff  0:11 init [2]
682 dnl
683 elif ps laxnwww 2>/dev/null | \
684         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
685 then
686         ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
687         ac_cv_ps_command="$PATH_TO_PS laxnwww"
688         ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
689         EXTRAS="$EXTRAS check_nagios"
690         AC_MSG_RESULT([$ac_cv_ps_command])
692 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
693 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
694         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
695 then
696         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
697         ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
698         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
699         EXTRAS="$EXTRAS check_nagios"
700         AC_MSG_RESULT([$ac_cv_ps_command])
702 dnl AIX 4.3.3 - needs verification. This works for Tru64 - needs %*[ +] in PS_FORMAT
703 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
704         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
705 then
706         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
707         ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
708         ac_cv_ps_format="[["%s%*[ +] %d %d %d %d %f %s %n"]]"
709         EXTRAS="$EXTRAS check_nagios"
710         AC_MSG_RESULT([$ac_cv_ps_command])
712 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
713         egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
714 then
715         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
716         ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
717         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
718         EXTRAS="$EXTRAS check_nagios"
719         AC_MSG_RESULT([$ac_cv_ps_command])
721 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
722         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
723 then
724         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
725         ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
726         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
727         EXTRAS="$EXTRAS check_nagios"
728         AC_MSG_RESULT([$ac_cv_ps_command])
730 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
731         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
732 then
733         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
734         ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
735         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
736         EXTRAS="$EXTRAS check_nagios"
737         AC_MSG_RESULT([$ac_cv_ps_command])
739 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
740         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
741 then
742         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
743         ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
744         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
745         EXTRAS="$EXTRAS check_nagios"
746         AC_MSG_RESULT([$ac_cv_ps_command])
748 dnl wonder who takes state instead of stat
749 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
750         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
751 then
752         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
753         ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
754         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
755         EXTRAS="$EXTRAS check_nagios"
756         AC_MSG_RESULT([$ac_cv_ps_command])
758 dnl IRIX 53
759 elif ps -el 2>/dev/null | \
760         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
761 then
762         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
763         ac_cv_ps_command="$PATH_TO_PS -el"
764         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
765         AC_MSG_RESULT([$ac_cv_ps_command])
767 dnl IRIX 63
768 elif ps -el 2>/dev/null | \
769         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
770 then
771         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
772         ac_cv_ps_command="$PATH_TO_PS -el"
773         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
774         AC_MSG_RESULT([$ac_cv_ps_command])
776 dnl AIX 4.1:
777 dnl     F S      UID   PID  PPID   C PRI NI ADDR  SZ  RSS   WCHAN    TTY  TIME CMD
778 dnl    303 A        0     0     0 120  16 -- 1c07  20   24              -  0:45 swapper
779 elif ps -el 2>/dev/null | \
780         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
781 then
782         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
783         ac_cv_ps_command="$PATH_TO_PS -el"
784         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
785         AC_MSG_RESULT([$ac_cv_ps_command])
787 dnl AIX?
788 elif ps glaxen 2>/dev/null | \
789         egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
790 then
791         ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
792         ac_cv_ps_command="$PATH_TO_PS glaxen"
793         ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
794         AC_MSG_RESULT([$ac_cv_ps_command])
796 dnl MacOSX / Darwin
797 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
798 dnl Some truncation will happen in UCOMM column
799 dnl STAT      VSZ    RSS   UID  PPID %CPU UCOMM            COMMAND
800 dnl Ss      52756  22496   501     1   6.9 Window Manager   /System/Library/CoreServices/WindowServer -daemon
801 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
802         egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
803 then
804         ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
805         ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
806         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
807         EXTRAS="$EXTRAS check_nagios"
808         AC_MSG_RESULT([$ac_cv_ps_command])
810 dnl UnixWare 
811 elif ps -Al 2>/dev/null | \
812         egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
813 then
814         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
815         ac_cv_ps_command="$PATH_TO_PS -Al"
816         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
817         #if ps -Ao 'vsz comm' 2>/dev/null | \
818         #       egrep -i ["^ *VSZ +COMMAND"] >/dev/null
819         #then
820         #       ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
821         #       ac_cv_vsz_format="%*s %d"
822         #fi
823         AC_MSG_RESULT([$ac_cv_ps_command])
825 else
826         AC_MSG_WARN([unable to find usable ps syntax])
827 fi
829 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
830         [Variable list for sscanf of 'ps' output])
831 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
832         [Verbatim command to execute for ps in check_procs])
833 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
834         [Format string for scanning ps output in check_procs])
836 AC_PATH_PROG(PATH_TO_DF,df)
837 AC_PATH_PROG(PATH_TO_BDF,bdf)
839 AC_ARG_WITH(df_command,
840         ACX_HELP_STRING([--with-df-command=SYNTAX],
841                 [sets syntax for df]),
842         with_df_command=$withval,)
844 AC_MSG_CHECKING(for df syntax)
845 if test -n "$with_df_command"
846 then
847         AC_MSG_RESULT([$with_df_command])
849 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
850 then
851         with_df_command="$PATH_TO_DF -Pk"
852         AC_MSG_RESULT([$with_df_command])
854 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
855 then
856         with_df_command="$PATH_TO_DF -k"
857         AC_MSG_RESULT([$with_df_command])
859 elif df 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
860 then
861         with_df_command="$PATH_TO_DF"
862         AC_MSG_RESULT([$with_df_command])
864 elif bdf 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
865 then
866         with_df_command="$PATH_TO_BDF"
867         AC_MSG_RESULT([$with_df_command])
869 else
870         AC_MSG_WARN([unable to find usable df syntax])
871 fi
873 AC_DEFINE_UNQUOTED(DF_COMMAND,"$with_df_command",[path and args for df command])
875 dnl jm_AFS
876 jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
877 jm_FSTYPENAME
878 jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
880 AC_PATH_PROG(PATH_TO_PING,ping)
881 AC_PATH_PROG(PATH_TO_PING6,ping6)
883 AC_ARG_WITH(ping_command,
884         ACX_HELP_STRING([--with-ping-command=SYNTAX],
885                 [sets syntax for ICMP ping]),
886         with_ping_command=$withval,)
888 AC_MSG_CHECKING(for ICMP ping syntax)
889 ac_cv_ping_packets_first=no
890 if test -n "$with_ping_command"
891 then
892         AC_MSG_RESULT([(command-line) $with_ping_command])
893         if test -n "$ac_cv_ping_packets_first"
894         then
895                 ac_cv_ping_packets_first=yes
896         fi
898 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
899         $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
900         egrep -i "^round-trip|^rtt" >/dev/null
901 then
902         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
903         ac_cv_ping_packets_first=yes
904         AC_MSG_RESULT([$with_ping_command])
906 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
907         egrep -i "^round-trip|^rtt" >/dev/null
908 then
909         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
910         ac_cv_ping_packets_first=yes
911         AC_MSG_RESULT([$with_ping_command])
913 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
914         egrep -i "^round-trip|^rtt" >/dev/null
915 then
916         with_ping_command="$PATH_TO_PING -n -c %d %s"
917         ac_cv_ping_packets_first=yes
918         AC_MSG_RESULT([$with_ping_command])
920 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
921         egrep -i "^round-trip|^rtt" >/dev/null
922 then
923         with_ping_command="$PATH_TO_PING -n %s -c %d"
924         AC_MSG_RESULT([$with_ping_command])
926 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
927         egrep -i "^round-trip|^rtt" >/dev/null
928 then
929         with_ping_command="$PATH_TO_PING %s -n %d"
930         AC_MSG_RESULT([$with_ping_command])
932 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
933         egrep -i "^round-trip|^rtt" >/dev/null
934 then
935         with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
936         AC_MSG_RESULT([$with_ping_command])
938 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
939         egrep -i "^round-trip|^rtt" >/dev/null
940 then
941         with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
942         AC_MSG_RESULT([$with_ping_command])
944 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
945         egrep -i "^round-trip|^rtt" >/dev/null
946 then
947         with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
948         ac_cv_ping_packets_first=yes
949         AC_MSG_RESULT([$with_ping_command])
951 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
952         egrep -i "^round-trip|^rtt" >/dev/null
953 then
954         with_ping_command="$PATH_TO_PING -n -c %d %s"
955         ac_cv_ping_packets_first=yes
956         AC_MSG_RESULT([$with_ping_command])
958 else
959         AC_MSG_WARN([unable to find usable ping syntax])
960 fi
962 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
963         [path and args for ICMP ping command])
965 if test "x$ac_cv_ping_packets_first" != "xno"
966 then
967         AC_DEFINE(PING_PACKETS_FIRST,1,
968                 [Define if packet count must precede host])
969 fi
971 AC_ARG_WITH(ping6_command,
972         ACX_HELP_STRING([--with-ping6-command=SYNTAX],
973                 [sets syntax for ICMPv6 ping]),
974         with_ping6_command=$withval,)
976 if test x"$with_ipv6" != xno ; then
977 AC_MSG_CHECKING(for ICMPv6 ping syntax)
978 ac_cv_ping6_packets_first=no
979 if test -n "$with_ping6_command"
980 then
981         AC_MSG_RESULT([(command-line) $with_ping6_command])
982         if test -n "$ac_cv_ping6_packets_first"
983         then
984                 ac_cv_ping6_packets_first=yes
985         fi
987 elif test "x$PATH_TO_PING6" != "x"; then
988         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
989                 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
990                 egrep -i "^round-trip|^rtt" >/dev/null
991         then
992                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
993                 ac_cv_ping6_packets_first=yes
994                 AC_MSG_RESULT([$with_ping6_command])
996         elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
997                 egrep -i "^round-trip|^rtt" >/dev/null
998         then
999                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1000                 ac_cv_ping6_packets_first=yes
1001                 AC_MSG_RESULT([$with_ping6_command])
1003         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1004                 egrep -i "^round-trip|^rtt" >/dev/null
1005         then
1006                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1007                 ac_cv_ping6_packets_first=yes
1008                 AC_MSG_RESULT([$with_ping6_command])
1010         elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1011                 egrep -i "^round-trip|^rtt" >/dev/null
1012         then
1013                 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1014                 AC_MSG_RESULT([$with_ping6_command])
1016         elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1017                 egrep -i "^round-trip|^rtt" >/dev/null
1018         then
1019                 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1020                 AC_MSG_RESULT([$with_ping6_command])
1022         elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1023                 egrep -i "^round-trip|^rtt" >/dev/null
1024         then
1025                 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1026                 AC_MSG_RESULT([$with_ping6_command])
1028         elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1029                 egrep -i "^round-trip|^rtt" >/dev/null
1030         then
1031                 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1032                 AC_MSG_RESULT([$with_ping6_command])
1034         elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1035                 egrep -i "^round-trip|^rtt" >/dev/null
1036         then
1037                 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1038                 ac_cv_ping6_packets_first=yes
1039                 AC_MSG_RESULT([$with_ping_command])
1041         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1042                 egrep -i "^round-trip|^rtt" >/dev/null
1043         then
1044                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1045                 ac_cv_ping6_packets_first=yes
1046                 AC_MSG_RESULT([$with_ping6_command])
1048         fi
1050 elif test "x$PATH_TO_PING" != "x"; then
1051         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1052                 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1053                 egrep -i "^round-trip|^rtt" >/dev/null
1054         then
1055                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1056                 ac_cv_ping6_packets_first=yes
1057                 AC_MSG_RESULT([$with_ping6_command])
1059         elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1060                 egrep -i "^round-trip|^rtt" >/dev/null
1061         then
1062                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1063                 ac_cv_ping6_packets_first=yes
1064                 AC_MSG_RESULT([$with_ping6_command])
1066         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1067                 egrep -i "^round-trip|^rtt" >/dev/null
1068         then
1069                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1070                 ac_cv_ping6_packets_first=yes
1071                 AC_MSG_RESULT([$with_ping6_command])
1073         elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1074                 egrep -i "^round-trip|^rtt" >/dev/null
1075         then
1076                 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1077                 AC_MSG_RESULT([$with_ping6_command])
1079         elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1080                 egrep -i "^round-trip|^rtt" >/dev/null
1081         then
1082                 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1083                 AC_MSG_RESULT([$with_ping6_command])
1085         elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1086                 egrep -i "^round-trip|^rtt" >/dev/null
1087         then
1088                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1089                 AC_MSG_RESULT([$with_ping6_command])
1091         elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1092                 egrep -i "^round-trip|^rtt" >/dev/null
1093         then
1094                 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1095                 AC_MSG_RESULT([$with_ping6_command])
1097         elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1098                 egrep -i "^round-trip|^rtt" >/dev/null
1099         then
1100                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1101                 ac_cv_ping6_packets_first=yes
1102                 AC_MSG_RESULT([$with_ping_command])
1104         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1105                 egrep -i "^round-trip|^rtt" >/dev/null
1106         then
1107                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1108                 ac_cv_ping6_packets_first=yes
1109                 AC_MSG_RESULT([$with_ping6_command])
1111         fi
1113 fi
1115 if test "x$with_ping6_command" != "x"; then
1116         AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1117                 [path and args for ICMPv6 ping command])
1118 else
1119         AC_MSG_RESULT([none])
1120 fi
1122 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1123         AC_DEFINE(PING6_PACKETS_FIRST,1,
1124                 [Define if packet count must precede host])
1125 fi
1126 fi
1128 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1130 AC_MSG_CHECKING(for nslookup syntax)
1131 if test -n "$PATH_TO_NSLOOKUP"
1132 then
1133         if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1134         then
1135                 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1136                 AC_MSG_RESULT([$ac_cv_nslookup_command])
1138         else
1139                 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1140                 AC_MSG_RESULT([$ac_cv_nslookup_command])
1142         fi
1143         EXTRAS="$EXTRAS check_dns"
1145 else
1146         AC_MSG_WARN([nslookup command not found])
1147 fi
1149 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1150         [path and args for nslookup])
1152 AC_PATH_PROG(PATH_TO_HOST,host)
1153 if test -n "$ac_cv_path_PATH_TO_HOST"
1154 then
1155         EXTRAS="$EXTRAS check_dns"
1156 fi
1158 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1159 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1161 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1162 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1164 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1165 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1166 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1167 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1168 then
1169         AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1170         AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1171 else
1172         AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1173 fi
1175 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1176 if test -x "$PATH_TO_LMSTAT"
1177 then
1178         AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1179 else
1180         AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1181 fi
1183 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1184 if test -x "$PATH_TO_SMBCLIENT"
1185 then
1186         AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1187 else
1188         AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1189 fi
1192 AC_PATH_PROG(PATH_TO_WHO,who)
1194 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1195 then
1196         ac_cv_path_to_who="$PATH_TO_WHO -q"
1197 else
1198         ac_cv_path_to_who="$PATH_TO_WHO"
1199 fi
1201 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1202         [path and arguments for invoking 'who'])
1204 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1205 if test -x "$PATH_TO_SNMPGET"
1206 then
1207         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1208         EXTRAS="$EXTRAS check_hpjd check_snmp"
1209 else
1210         AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1211 fi
1213 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1214 if test -x "$PATH_TO_SNMPGETNEXT"
1215 then
1216         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1217 fi
1219 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null  )
1220 then
1221         AC_MSG_CHECKING(for Net::SNMP perl module)
1222         AC_MSG_RESULT([found])
1223 else
1224         AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1225 fi
1227 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1228 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1230 if test -x "$PATH_TO_QUAKESTAT"
1231 then
1232         ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1233         EXTRAS="$EXTRAS check_game"
1235 elif test -x "$PATH_TO_QSTAT"
1236 then
1237         ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1238         EXTRAS="$EXTRAS check_game"
1239 else
1240         AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1241 fi
1243 if test $ac_cv_path_to_qstat 
1244 then
1245         AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1246                 [path to qstat/quakestat])
1247 fi
1249 AC_PATH_PROG(PATH_TO_FPING,fping)
1250 if test -x "$PATH_TO_FPING"
1251 then
1252         AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1253         EXTRAS="$EXTRAS check_fping"
1254 else
1255         AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1256 fi
1258 AC_PATH_PROG(PATH_TO_SSH,ssh)
1260 if test -x "$PATH_TO_SSH"
1261 then
1262         AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1263         EXTRAS="$EXTRAS check_by_ssh"
1264 else
1265         AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1266 fi
1269 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1270 if test -x "$PATH_TO_MAILQ"
1271 then
1272         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1273 else
1274         AC_MSG_WARN([Could not find mailq or eqivalent])
1275 fi
1277 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1278 if test -x "$PATH_TO_QMAIL_QSTAT"
1279 then
1280         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1281 else
1282         AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1283 fi
1285 dnl SWAP info required is amount allocated/available and amount free
1286 dnl The plugin works through all the swap devices and adds up the total swap
1287 dnl available.
1289 dnl dunno why this does not work below - use hack (kbd)
1290 dnl fine on linux, broken on solaris
1291 dnl if /bin/test -e "/proc/meminfo"
1293 AC_PATH_PROG(PATH_TO_SWAP,swap)
1294 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1296 AC_MSG_CHECKING(for how to check memory)
1297 if [cat /proc/meminfo > /dev/null 2>&1]
1298 then
1299         AC_MSG_RESULT([found /proc/meminfo])
1300         AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1301         AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1302         EXTRAS="$EXTRAS check_swap"
1304 elif [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1305 then
1306         ac_cv_have_swap=yes
1307         ac_cv_swap_command="$PATH_TO_SWAP -l"
1308         if [$PATH_TO_SWAP -l 2>/dev/null | \
1309                 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1310                 >/dev/null]
1311         then
1312                 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1313                 ac_cv_swap_conv=2048
1314                 AC_MSG_RESULT([using IRIX format swap])
1316         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null]
1317         then
1318                 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1319                 ac_cv_swap_conv=2048
1320                 AC_MSG_RESULT([using Solaris format swap])
1322         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1323         then
1324                 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1325                 ac_cv_swap_conv=2048
1326                 AC_MSG_RESULT([using Unixware format swap])
1328         fi
1329         EXTRAS="$EXTRAS check_swap"
1331 elif [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1332 then
1333         ac_cv_have_swap=yes
1334         ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1336         if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1337         then
1338                 ac_cv_swap_format=["%*s %d %*d %d"]
1339                 ac_cv_swap_conv=1024
1340                 AC_MSG_RESULT([using FreeBSD format swapinfo])
1341         fi
1342         EXTRAS="$EXTRAS check_swap"
1344 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1345 then
1346         ac_cv_have_swap=yes
1347         ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1348         ac_cv_swap_format=["%*s %d %*d %d"]
1349         ac_cv_swap_conv=1024
1350         AC_MSG_RESULT([using HP-UX format swapinfo])
1351 fi
1353 if test "x$ac_cv_have_swap" != "x" 
1354 then
1355         AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1356 fi
1357 if test "x$ac_cv_swap_command" != "x" 
1358 then
1359         AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1360                 [Path to swap/swapinfo binary, with any args])
1361         AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1362                 [Format string for parsing swap output])
1363         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1364                 [Conversion factor to MB])
1365 fi
1367 AC_PATH_PROG(PATH_TO_DIG,dig)
1368 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1369 if test -n "$PATH_TO_DIG"; then
1370         EXTRAS="$EXTRAS check_dig"
1371 fi
1373 if test -f plugins/check_nt.c ; then
1374   EXTRAS="$EXTRAS check_nt"
1375 elif test -f ../plugins/check_nt.c ; then
1376   EXTRAS="$EXTRAS check_nt"
1377 fi
1379 AC_MSG_CHECKING(for va_list)
1380 AC_TRY_COMPILE([#ifdef __STDC__
1381                 #include <stdio.h>
1382                 #include <stdlib.h>
1383                 #include <stdarg.h>
1384                 #else
1385                 #include <sys/types.h>
1386                 #include <stdio.h>
1387                 #include <varargs.h>
1388                 #endif],
1389                 [va_list args;],
1390                 [AC_MSG_RESULT(yes)],
1391                 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1393 AC_SUBST(EXTRAS)
1394 AC_SUBST(EXTRA_NETOBJS)
1395 AC_SUBST(DEPLIBS)
1397 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
1399 AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl pkg/solaris/pkginfo)
1401 ACX_FEATURE([with],[cgiurl])
1402 ACX_FEATURE([with],[nagios-user])
1403 ACX_FEATURE([with],[nagios-group])
1404 ACX_FEATURE([with],[trusted-path])
1405 ACX_FEATURE([with],[df-command])
1406 ACX_FEATURE([with],[ping-command])
1407 ACX_FEATURE([with],[ping6-command])
1408 ACX_FEATURE([with],[lwres])
1409 ACX_FEATURE([with],[ipv6])
1410 ACX_FEATURE([enable],[emulate-getaddrinfo])