Code

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