Code

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