Code

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