Code

Support for FreeBSD 5.2.1 and 5.3 in check_procs
[nagiosplug.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION ($Revision$)
3 AC_PREREQ(2.58)
4 AC_INIT(nagios-plugins,1.4-beta1)
5 AC_CONFIG_SRCDIR(Helper.pm)
6 AM_INIT_AUTOMAKE
7 AM_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 dnl Must come very early on due to coreutils requirement
20 dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
21 gl_USE_SYSTEM_EXTENSIONS
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_RANLIB
28 AC_PROG_MAKE_SET
29 AC_PROG_AWK
31 AC_FUNC_MALLOC
32 AC_FUNC_REALLOC
33 AC_FUNC_ERROR_AT_LINE
35 AC_CONFIG_LIBOBJ_DIR(lib)
36 AC_FUNC_GETLOADAVG([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         AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
208 else
209   AC_MSG_WARN([Skipping LDAP plugin])
210   AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
211 fi
212 LIBS="$_SAVEDLIBS"
215 dnl Check for mysql libraries
216 _SAVEDLIBS="$LIBS"
217 _SAVEDCPPFLAGS="$CPPFLAGS"
218 AC_ARG_WITH(mysql,
219         ACX_HELP_STRING([--with-mysql=DIR],
220                 [sets path to mysql installation (assumes lib/mysql and include subdirs]),
221         MYSQL=$withval,)
222 if test -n "$MYSQL"; then
223   MYSQLLIBDIR=$MYSQL/lib/mysql
224   CPPFLAGS="-I$MYSQL/include"
225   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
226   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
227 elif test -f /usr/lib/libmysqlclient.so; then
228   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
229   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
230 elif test -f /usr/lib/libmysqlclient.a; then
231   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
232   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
233 elif test -f /usr/lib/mysql/libmysqlclient.so; then
234   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
235   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
236 elif test -f /usr/lib/mysql/libmysqlclient.a; then
237   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
238   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
239 fi
240 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
241   AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
242   if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
243     EXTRAS="$EXTRAS check_mysql"
244     AC_SUBST(MYSQLINCLUDE)
245     AC_SUBST(MYSQLLIBS)
246     AC_SUBST(check_mysql_LDFLAGS)
247   else
248     AC_MSG_WARN([Skipping mysql plugin])
249     AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
250   fi
251 else
252   AC_MSG_WARN([Skipping mysql plugin])
253   AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
254 fi
255 CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
256 LIBS="$_SAVEDLIBS"
258 dnl Check for OpenSSL location
259 dnl This whole check is inspired by curl 7.12.2's configure.ac
260 OPT_OPENSSL=off
261 AC_ARG_WITH(openssl,
262 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
263 AC_HELP_STRING([--without-openssl], [disable openssl]),
264 OPT_OPENSSL=$withval)
266 if test X"$OPT_OPENSSL" = "Xno"; then
267   AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
268   with_openssl=no
269 else
270   dnl backup the pre-ssl variables
271   CLEANLDFLAGS="$LDFLAGS"
272   CLEANCPPFLAGS="$CPPFLAGS"
273   CLEANLIBS="$LIBS"
275   case "$OPT_OPENSSL" in
276   yes)
277     dnl --with-openssl (without path) used
278     PKGTEST="yes"
279     ;;
280   off)
281     dnl no --with-openssl given, check default places
282     PKGTEST="yes"
283     ;;
284   *)
285     dnl use the given area
286     PKGTEST="no"
287     OPENSSL=$OPT_OPENSSL
288     LDFLAGS="$LDFLAGS -L$OPENSSL/lib"
289     CPPFLAGS="$CPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
290   ;;
291   esac
293   dnl Check usual areas for openssl
294   if test "$PKGTEST" = "yes"; then
295     AC_PATH_PROG(OPENSSL,openssl)
296     # Don't think 2 tests below are necessary because /usr is always included
297     # if test "$OPENSSL" = "/usr/bin/openssl"; then
298     #  OPENSSL=/usr
299     #elif test "$OPENSSL" = "/usr/sbin/openssl"; then
300     #  OPENSSL=/usr
301     if test "$OPENSSL" = "/opt/bin/openssl"; then
302       OPENSSL=/opt
303     elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
304       OPENSSL=/opt/openssl
305     elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
306       OPENSSL=/usr/slocal
307     elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
308       OPENSSL=/usr/local
309     elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
310       OPENSSL=/usr/local/ssl
311     fi
312   fi
314   AC_CHECK_LIB(crypto, CRYPTO_lock,[
315      HAVECRYPTO="yes"
316      ],[
317      LDFLAGS="$CLEANLDFLAGS -L$OPENSSL/lib"
318      CPPFLAGS="$CLEANCPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
319      AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
320        HAVECRYPTO="yes" ], [
321        LDFLAGS="$CLEANLDFLAGS"
322        CPPFLAGS="$CLEANCPPFLAGS"
323        LIBS="$CLEANLIBS"
324        ])
325     ])
327   if test "$HAVECRYPTO" = "yes"; then
328     dnl This is only reasonable to do if crypto actually is there: check for
329     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
331     dnl This is for Msys/Mingw
332     AC_MSG_CHECKING([for gdi32])
333     my_ac_save_LIBS=$LIBS
334     LIBS="-lgdi32 $LIBS"
335     AC_TRY_LINK([#include <windef.h>
336                  #include <wingdi.h>],
337                [GdiFlush();],
338                [ dnl worked!
339                AC_MSG_RESULT([yes])],
340                [ dnl failed, restore LIBS
341                LIBS=$my_ac_save_LIBS
342                AC_MSG_RESULT(no)]
343               )
345     AC_CHECK_LIB(crypto, CRYPTO_add_lock)
346     AC_CHECK_LIB(ssl, SSL_connect)
348     if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
349         dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
350         AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
351         OLIBS=$LIBS
352         LIBS="$LIBS -lRSAglue -lrsaref"
353         AC_CHECK_LIB(ssl, SSL_connect)
354         if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
355             dnl still no SSL_connect
356             AC_MSG_RESULT(no)
357             LIBS=$OLIBS
358         else
359             AC_MSG_RESULT(yes)
360         fi
361     fi
364     dnl Check for SSLeay headers
365     AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
366                      openssl/pem.h openssl/ssl.h openssl/err.h,
367       OPENSSL_ENABLED=1)
369     if test $ac_cv_header_openssl_x509_h = no; then
370       AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
371         OPENSSL_ENABLED=1)
372     fi
374     dnl If the ENGINE library seems to be around, check for the OpenSSL engine
375     dnl header, it is kind of "separated" from the main SSL check
376     AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
378     dnl AC_SUBST(OPENSSL_ENABLED)
380     dnl these can only exist if openssl exists
381     AC_CHECK_FUNCS( RAND_status \
382                     RAND_screen \
383                     RAND_egd \
384                     CRYPTO_cleanup_all_ex_data )
386   fi
388   if test "$OPENSSL_ENABLED" != "1"; then
389     AC_MSG_WARN([OpenSSL libs and/or directories were not found where specified!])
390     with_openssl="no"
391   else
392     check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
393     AC_SUBST(check_tcp_ssl)
394     AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
395     with_openssl="yes"
397     # Needed for subsequent compiled programs
398     LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSSL/lib$libsuff"
399     export LD_LIBRARY_PATH
400   fi
401 fi
403 AC_CHECK_HEADERS(unistd.h)
405 dnl Check for AF_INET6 support - unistd.h required for Darwin
406 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
407         AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
408                         #include <unistd.h>
409                         #endif
410                         #include <netinet/in.h>
411                         #include <sys/socket.h>],
412                         [struct sockaddr_in6 sin6;
413                         void *p;
415                         sin6.sin6_family = AF_INET6;
416                         sin6.sin6_port = 587;
417                         p = &sin6.sin6_addr;],
418                         [with_ipv6=yes], 
419                         [with_ipv6=no])
420         ])
422 if test x"$with_ipv6" != xno ; then
423         AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
424 fi
426 dnl #########################################################################
427 dnl Check if Posix getaddrinfo() is available.  It is also possible to use
428 dnl the version from the lwres library distributed with BIND.
429 dnl #########################################################################
430 AC_ARG_ENABLE([emulate-getaddrinfo],
431               ACX_HELP_STRING([--enable-emulate-getaddrinfo],
432                              [enable getaddrinfo emulation (default=no)]),
433               ,
434               enable_emulate_getaddrinfo=no)
436 AC_ARG_WITH(lwres,
437             ACX_HELP_STRING([--with-lwres=DIR],
438                            [use lwres library for getaddrinfo (default=no)]),
439             ,
440             with_lwres=no)
442 dnl ## enable force to test getaddrinfo.c
443 if test x$enable_emulate_getaddrinfo = xforce ; then
444         enable_emulate_getaddrinfo=yes
445         have_getaddrinfo=no
446 else
448 have_getaddrinfo=no
449 if test x$with_lwres != xno ; then
450         if test "$with_lwres" != yes ; then
451                    CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
452                    LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
453         fi
454         AC_CHECK_HEADERS(lwres/netdb.h, ,
455                         [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
456         AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
457                      [AC_MSG_ERROR([cannot find the lwres library])],
458                      -lnsl -lpthread)
459         have_getaddrinfo=yes
460 fi
462 if test x$have_getaddrinfo != xyes ; then
463         AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
464 fi
466 dnl # Special nonsense for systems that actually have getaddrinfo but
467 dnl # redefine the name to something else, e.g. OSF
468 if test x$have_getaddrinfo != xyes ; then
469         AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
470         AC_TRY_LINK([
471 #               include <netdb.h>
472         ], [
473                 struct addrinfo hints, *res;
474                 int err;
476                 err = getaddrinfo ("host", "service", &hints, &res);
477         ], [
478                 have_getaddrinfo=yes
479                 AC_MSG_RESULT(yes)
480         ], [AC_MSG_RESULT(no)])
481 fi
483 fi
485 if test x$have_getaddrinfo != xno ; then
486         if test x$enable_emulate_getaddrinfo != xno ; then
487                 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
488         fi
489         AC_DEFINE(HAVE_GETADDRINFO, 1,
490                   [Does system provide RFC 2553/Posix getaddrinfo?])
491 else
492         if test x$enable_emulate_getaddrinfo != xyes ; then
493 dnl                AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
494                enable_emulate_getaddrinfo=yes
495                AC_MSG_WARN([enabling getaddrinfo emulation])
496         fi
497         EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
498 fi
500 if test x"$enable_emulate_getaddrinfo" != xno ; then
501     have_resolver=no
503   dnl  Try for getipnodebyname
504     AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
505     if test x"$have_resolver" != xno ; then
506          AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
507                    [Set when getipnodebyname is available])
508     fi
510   dnl  Try for gethostbyname_r
511     if test x"$have_resolver" = xno ; then
512         AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
513                        [have_resolver=yes
514                         ACX_WHICH_GETHOSTBYNAME_R])
515     fi
517   dnl  Try for gethostbyname
518     if test x"$have_resolver" = xno ; then
519         if test x"$enable_pthreads" != xno ; then
520             AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
521         fi
522         AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
523                        [AC_MSG_ERROR([cannot find gethostbyname])])
524     fi
525     EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
527 fi
529 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
530 if test "$FOUNDINCLUDE" = "no"; then
531   _SAVEDCPPFLAGS="$CPPFLAGS"
532   CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
533   unset ac_cv_header_krb5_h
534   AC_CHECK_HEADERS(krb5.h,
535                    KRB5INCLUDE="-I/usr/kerberos/include"
536                    FOUNDINCLUDE=yes,
537                    FOUNDINCLUDE=no)
538 fi
539 AC_SUBST(KRBINCLUDE)
540 if test "$FOUNDINCLUDE" = "no"; then
541   CPPFLAGS="$_SAVEDCPPFLAGS"
542 fi
544 dnl
545 dnl Checks for header files.
546 dnl
548 AC_HEADER_STDC
549 AC_HEADER_TIME
550 AC_HEADER_SYS_WAIT
551 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)
552 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
554 dnl Checks for typedefs, structures, and compiler characteristics.
555 AC_C_CONST
556 AC_STRUCT_TM
557 AC_TYPE_PID_T
558 AC_TYPE_SIZE_T
559 AC_TYPE_SIGNAL
561 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
562 AC_TRY_LINK([#include <stdarg.h>
563 va_list ap1,ap2;], [va_copy(ap1,ap2);],
564 ac_cv_HAVE_VA_COPY=yes,
565 ac_cv_HAVE_VA_COPY=no)])
566 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
567     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
568 else    
569     AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
570     AC_TRY_LINK([#include <stdarg.h>
571     va_list ap1,ap2;], [__va_copy(ap1,ap2);],
572     ac_cv_HAVE___VA_COPY=yes,
573     ac_cv_HAVE___VA_COPY=no)])
574     if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
575         AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
576     fi
577 fi
579 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
580 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
581 AC_TRY_RUN([
582 #include <sys/types.h>
583 #include <stdarg.h>
584 void foo(const char *format, ...) { 
585        va_list ap;
586        int len;
587        char buf[5];
589        va_start(ap, format);
590        len = vsnprintf(buf, 0, format, ap);
591        va_end(ap);
592        if (len != 5) exit(1);
594        va_start(ap, format);
595        len = vsnprintf(0, 0, format, ap);
596        va_end(ap);
597        if (len != 5) exit(1);
599        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
601        exit(0);
603 main() { foo("hello"); }
604 ],
605 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
606 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
607     AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
608 fi
610 AC_TRY_COMPILE([#include <sys/time.h>],
611                [struct timeval *tv;
612                 struct timezone *tz;],
613                AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
614                AC_TRY_COMPILE([#include <sys/time.h>],
615                               [struct timeval *tv;
616                                struct timezone *tz;
617                                gettimeofday(tv, tz);],
618                               AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
619                               AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
621 dnl Checks for library functions.
622 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
624 AC_MSG_CHECKING(return type of socket size)
625 AC_TRY_COMPILE([#include <stdlib.h>
626                 #include <sys/types.h>
627                 #include <sys/socket.h>],
628                [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
629                ac_cv_socket_size_type=["size_t"]
630                 AC_MSG_RESULT(size_t),
631                ac_cv_socket_size_type=["int"]
632                 AC_MSG_RESULT(int))
634 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
635         [Define type of socket size])
637 if test -f "/proc/loadavg"
638 then
639   AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
640   AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
641 fi
643 dnl #### Process table test
645 AC_PATH_PROG(PATH_TO_PS,ps)
647 AC_MSG_CHECKING(for ps syntax)
648 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
649 dnl Should also work for FreeBSD 5.2.1 and 5.3
650 dnl  STAT UCOMM              VSZ   RSS USER      PPID COMMAND
651 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
652         egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
653 then
654         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
655         ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
656         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
657         ac_cv_ps_cols=8
658         AC_MSG_RESULT([$ac_cv_ps_command])
660 dnl  STAT UCOMM              VSZ   RSS USER       UID  PPID COMMAND
661 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
662         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
663 then
664         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
665         ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
666         ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
667         ac_cv_ps_cols=9
668         AC_MSG_RESULT([$ac_cv_ps_command])
670 dnl FreeBSD
671 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
672         egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
673 then
674         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
675         ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
676         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
677         ac_cv_ps_cols=8
678         AC_MSG_RESULT([$ac_cv_ps_command])
680 dnl BSD-like mode in RH 6.1
681 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
682         egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
683 then
684         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
685         ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
686         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
687         ac_cv_ps_cols=8
688         AC_MSG_RESULT([$ac_cv_ps_command])
690 dnl SunOS 4.1.3:
691 dnl  F  UID  PID  PPID  CP  PRI  NI  SZ  RSS  WCHAN  STAT  TT  TIME  COMMAND
692 dnl Need the head -1 otherwise test will work because arguments are found
693 elif ps -laxnwww 2>/dev/null | head -1 | \
694         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
695 then
696         ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
697         ac_cv_ps_command="$PATH_TO_PS -laxnwww"
698         ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
699         ac_cv_ps_cols=8
700         AC_MSG_RESULT([$ac_cv_ps_command])
702 dnl Debian Linux / procps v1.2.9:
703 dnl  FLAGS   UID   PID  PPID PRI  NI   SIZE   RSS WCHAN       STA TTY TIME COMMAND
704 dnl    100     0     1     0   0   0    776    76  c0131c8c   S  ffff  0:11 init [2]
705 dnl
706 elif ps laxnwww 2>/dev/null | \
707         egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
708 then
709         ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
710         ac_cv_ps_command="$PATH_TO_PS laxnwww"
711         ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
712         ac_cv_ps_cols=8
713         AC_MSG_RESULT([$ac_cv_ps_command])
715 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
716 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
717         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
718 then
719         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
720         ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
721         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
722         ac_cv_ps_cols=8
723         AC_MSG_RESULT([$ac_cv_ps_command])
725 dnl Tru64 - needs %*[ +] in PS_FORMAT
726 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
727         egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
728 then
729         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
730         ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
731         ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
732         ac_cv_ps_cols=8
733         AC_MSG_RESULT([$ac_cv_ps_command])
735 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
736         egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
737 then
738         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
739         ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
740         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
741         ac_cv_ps_cols=8
742         AC_MSG_RESULT([$ac_cv_ps_command])
744 dnl AIX 4.3.3 and 5.1 do not have an rss field
745 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
746         egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
747 then
748         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
749         ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
750         ac_cv_ps_format="%s %d %d %d %f %s %n"
751         ac_cv_ps_cols=7
752         AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
754 dnl Solaris 2.6
755 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
756         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
757 then
758         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
759         ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
760         # There must be no space between the %s and %n due to a wierd problem in sscanf where
761         # it will return %n as longer than the line length
762         ac_cv_ps_format="%s %d %d %d %d %f %s%n"
763         ac_cv_ps_cols=8
764         AC_MSG_RESULT([$ac_cv_ps_command])
766 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
767         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
768 then
769         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
770         ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
771         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
772         ac_cv_ps_cols=8
773         AC_MSG_RESULT([$ac_cv_ps_command])
775 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
776         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
777 then
778         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
779         ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
780         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
781         ac_cv_ps_cols=8
782         AC_MSG_RESULT([$ac_cv_ps_command])
784 dnl wonder who takes state instead of stat
785 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
786         egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
787 then
788         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
789         ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
790         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
791         ac_cv_ps_cols=7
792         AC_MSG_RESULT([$ac_cv_ps_command])
794 dnl IRIX 53
795 elif ps -el 2>/dev/null | \
796         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
797 then
798         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
799         ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
800         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
801         ac_cv_ps_cols=7
802         AC_MSG_RESULT([$ac_cv_ps_command])
804 dnl IRIX 63
805 elif ps -el 2>/dev/null | \
806         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
807 then
808         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
809         ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
810         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
811         ac_cv_ps_cols=5
812         AC_MSG_RESULT([$ac_cv_ps_command])
814 dnl AIX 4.1:
815 dnl     F S      UID   PID  PPID   C PRI NI ADDR  SZ  RSS   WCHAN    TTY  TIME CMD
816 dnl    303 A        0     0     0 120  16 -- 1c07  20   24              -  0:45 swapper
817 elif ps -el 2>/dev/null | \
818         egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
819 then
820         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
821         ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
822         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
823         ac_cv_ps_cols=5
824         AC_MSG_RESULT([$ac_cv_ps_command])
826 dnl AIX?
827 elif ps glaxen 2>/dev/null | \
828         egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
829 then
830         ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
831         ac_cv_ps_command="$PATH_TO_PS glaxen"
832         ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
833         ac_cv_ps_cols=7
834         AC_MSG_RESULT([$ac_cv_ps_command])
836 dnl MacOSX / Darwin
837 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
838 dnl Some truncation will happen in UCOMM column
839 dnl STAT      VSZ    RSS   UID  PPID %CPU UCOMM            COMMAND
840 dnl Ss      52756  22496   501     1   6.9 Window Manager   /System/Library/CoreServices/WindowServer -daemon
841 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
842         egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
843 then
844         ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
845         ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
846         ac_cv_ps_format="%s %d %d %d %d %f %s %n"
847         ac_cv_ps_cols=7
848         AC_MSG_RESULT([$ac_cv_ps_command])
850 dnl UnixWare 
851 elif ps -Al 2>/dev/null | \
852         egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
853 then
854         ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
855         ac_cv_ps_command="$PATH_TO_PS -Al"
856         ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
857         ac_cv_ps_cols=7
858         AC_MSG_RESULT([$ac_cv_ps_command])
860 else
861         AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
862 fi
864 if test -n "$ac_cv_ps_varlist" ; then
865         AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
866                 [Variable list for sscanf of 'ps' output])
867         AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
868                 [Verbatim command to execute for ps in check_procs])
869         AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
870                 [Format string for scanning ps output in check_procs])
871         AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
872                 [Number of columns in ps command])
873         EXTRAS="$EXTRAS check_procs check_nagios"
874 fi
876 AC_PATH_PROG(PATH_TO_PING,ping)
877 AC_PATH_PROG(PATH_TO_PING6,ping6)
879 AC_ARG_WITH(ping_command,
880         ACX_HELP_STRING([--with-ping-command=SYNTAX],
881                 [sets syntax for ICMP ping]),
882         with_ping_command=$withval,)
884 AC_MSG_CHECKING(for ICMP ping syntax)
885 ac_cv_ping_packets_first=no
886 ac_cv_ping_has_timeout=no
887 if test -n "$with_ping_command"
888 then
889         AC_MSG_RESULT([(command-line) $with_ping_command])
890         if test -n "$ac_cv_ping_packets_first"
891         then
892                 ac_cv_ping_packets_first=yes
893         fi
895 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
896         $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
897         egrep -i "^round-trip|^rtt" >/dev/null
898 then
899         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
900         ac_cv_ping_packets_first=yes
901         AC_MSG_RESULT([$with_ping_command])
903 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
904         egrep -i "^round-trip|^rtt" >/dev/null
905 then
906         with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
907         ac_cv_ping_packets_first=yes
908   ac_cv_ping_has_timeout=yes
909         AC_MSG_RESULT([$with_ping_command])
911 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
912         egrep -i "^round-trip|^rtt" >/dev/null
913 then
914         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
915         ac_cv_ping_packets_first=yes
916         AC_MSG_RESULT([$with_ping_command])
918 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
919         egrep -i "^round-trip|^rtt" >/dev/null
920 then
921         with_ping_command="$PATH_TO_PING -n -c %d %s"
922         ac_cv_ping_packets_first=yes
923         AC_MSG_RESULT([$with_ping_command])
925 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
926         egrep -i "^round-trip|^rtt" >/dev/null
927 then
928         with_ping_command="$PATH_TO_PING -n %s -c %d"
929         AC_MSG_RESULT([$with_ping_command])
931 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
932         egrep -i "^round-trip|^rtt" >/dev/null
933 then
934         with_ping_command="$PATH_TO_PING %s -n %d"
935         AC_MSG_RESULT([$with_ping_command])
937 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
938         egrep -i "^round-trip|^rtt" >/dev/null
939 then
940         with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
941         AC_MSG_RESULT([$with_ping_command])
943 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
944         egrep -i "^round-trip|^rtt" >/dev/null
945 then
946         with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
947         AC_MSG_RESULT([$with_ping_command])
949 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
950         egrep -i "^round-trip|^rtt" >/dev/null
951 then
952         with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
953         ac_cv_ping_packets_first=yes
954         AC_MSG_RESULT([$with_ping_command])
956 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
957         egrep -i "^round-trip|^rtt" >/dev/null
958 then
959         with_ping_command="$PATH_TO_PING -n -c %d %s"
960         ac_cv_ping_packets_first=yes
961         AC_MSG_RESULT([$with_ping_command])
963 else
964         AC_MSG_WARN([unable to find usable ping syntax])
965 fi
967 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
968         [path and args for ICMP ping command])
970 if test "x$ac_cv_ping_packets_first" != "xno"
971 then
972         AC_DEFINE(PING_PACKETS_FIRST,1,
973                 [Define if packet count must precede host])
974 fi
976 if test "x$ac_cv_ping_has_timeout" != "xno"
977 then
978         AC_DEFINE(PING_HAS_TIMEOUT,1,
979                 [Define if ping has its own timeout option that should be set])
980 fi
982 AC_ARG_WITH(ping6_command,
983         ACX_HELP_STRING([--with-ping6-command=SYNTAX],
984                 [sets syntax for ICMPv6 ping]),
985         with_ping6_command=$withval,)
987 if test x"$with_ipv6" != xno ; then
988 AC_MSG_CHECKING(for ICMPv6 ping syntax)
989 ac_cv_ping6_packets_first=no
990 if test -n "$with_ping6_command"
991 then
992         AC_MSG_RESULT([(command-line) $with_ping6_command])
993         if test -n "$ac_cv_ping6_packets_first"
994         then
995                 ac_cv_ping6_packets_first=yes
996         fi
998 elif test "x$PATH_TO_PING6" != "x"; then
999         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1000                 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1001                 egrep -i "^round-trip|^rtt" >/dev/null
1002         then
1003                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1004                 ac_cv_ping6_packets_first=yes
1005                 AC_MSG_RESULT([$with_ping6_command])
1007         elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1008                 egrep -i "^round-trip|^rtt" >/dev/null
1009         then
1010                 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1011                 ac_cv_ping6_packets_first=yes
1012                 AC_MSG_RESULT([$with_ping6_command])
1014         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1015                 egrep -i "^round-trip|^rtt" >/dev/null
1016         then
1017                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1018                 ac_cv_ping6_packets_first=yes
1019                 AC_MSG_RESULT([$with_ping6_command])
1021         elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1022                 egrep -i "^round-trip|^rtt" >/dev/null
1023         then
1024                 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1025                 AC_MSG_RESULT([$with_ping6_command])
1027         elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1028                 egrep -i "^round-trip|^rtt" >/dev/null
1029         then
1030                 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1031                 AC_MSG_RESULT([$with_ping6_command])
1033         elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1034                 egrep -i "^round-trip|^rtt" >/dev/null
1035         then
1036                 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1037                 AC_MSG_RESULT([$with_ping6_command])
1039         elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1040                 egrep -i "^round-trip|^rtt" >/dev/null
1041         then
1042                 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1043                 AC_MSG_RESULT([$with_ping6_command])
1045         elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1046                 egrep -i "^round-trip|^rtt" >/dev/null
1047         then
1048                 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1049                 ac_cv_ping6_packets_first=yes
1050                 AC_MSG_RESULT([$with_ping_command])
1052         elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1053                 egrep -i "^round-trip|^rtt" >/dev/null
1054         then
1055                 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1056                 ac_cv_ping6_packets_first=yes
1057                 AC_MSG_RESULT([$with_ping6_command])
1059         fi
1061 elif test "x$PATH_TO_PING" != "x"; then
1062         if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1063                 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1064                 egrep -i "^round-trip|^rtt" >/dev/null
1065         then
1066                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1067                 ac_cv_ping6_packets_first=yes
1068                 AC_MSG_RESULT([$with_ping6_command])
1070         elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1071                 egrep -i "^round-trip|^rtt" >/dev/null
1072         then
1073                 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1074                 ac_cv_ping6_packets_first=yes
1075                 AC_MSG_RESULT([$with_ping6_command])
1077         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1078                 egrep -i "^round-trip|^rtt" >/dev/null
1079         then
1080                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1081                 ac_cv_ping6_packets_first=yes
1082                 AC_MSG_RESULT([$with_ping6_command])
1084         elif $PATH_TO_PING -A inet6 -n ::1 -c 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 -c %d"
1088                 AC_MSG_RESULT([$with_ping6_command])
1090         elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1091                 egrep -i "^round-trip|^rtt" >/dev/null
1092         then
1093                 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1094                 AC_MSG_RESULT([$with_ping6_command])
1096         elif $PATH_TO_PING -A inet6 -n -s ::1 56 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 %s 56 %d"
1100                 AC_MSG_RESULT([$with_ping6_command])
1102         elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1103                 egrep -i "^round-trip|^rtt" >/dev/null
1104         then
1105                 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1106                 AC_MSG_RESULT([$with_ping6_command])
1108         elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1109                 egrep -i "^round-trip|^rtt" >/dev/null
1110         then
1111                 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1112                 ac_cv_ping6_packets_first=yes
1113                 AC_MSG_RESULT([$with_ping_command])
1115         elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1116                 egrep -i "^round-trip|^rtt" >/dev/null
1117         then
1118                 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1119                 ac_cv_ping6_packets_first=yes
1120                 AC_MSG_RESULT([$with_ping6_command])
1122         fi
1124 fi
1126 if test "x$with_ping6_command" != "x"; then
1127         AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1128                 [path and args for ICMPv6 ping command])
1129 else
1130         AC_MSG_RESULT([none])
1131 fi
1133 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1134         AC_DEFINE(PING6_PACKETS_FIRST,1,
1135                 [Define if packet count must precede host])
1136 fi
1137 fi
1139 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1141 AC_MSG_CHECKING(for nslookup syntax)
1142 if test -n "$PATH_TO_NSLOOKUP"
1143 then
1144         if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1145         then
1146                 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1147                 AC_MSG_RESULT([$ac_cv_nslookup_command])
1149         else
1150                 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1151                 AC_MSG_RESULT([$ac_cv_nslookup_command])
1153         fi
1154         EXTRAS="$EXTRAS check_dns"
1156 else
1157         AC_MSG_WARN([nslookup command not found])
1158 fi
1160 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1161         [path and args for nslookup])
1163 AC_PATH_PROG(PATH_TO_HOST,host)
1164 if test -n "$ac_cv_path_PATH_TO_HOST"
1165 then
1166         EXTRAS="$EXTRAS check_dns"
1167 fi
1169 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1170 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1172 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1173 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1175 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1176 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1177 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1178 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1179 then
1180         AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1181         AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1182 else
1183         AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1184 fi
1186 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1187 if test -x "$PATH_TO_LMSTAT"
1188 then
1189         AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1190 else
1191         AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1192 fi
1194 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1195 if test -x "$PATH_TO_SMBCLIENT"
1196 then
1197         AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1198 else
1199         AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1200 fi
1203 AC_PATH_PROG(PATH_TO_WHO,who)
1205 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1206 then
1207         ac_cv_path_to_who="$PATH_TO_WHO -q"
1208 else
1209         ac_cv_path_to_who="$PATH_TO_WHO"
1210 fi
1212 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1213         [path and arguments for invoking 'who'])
1215 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1216 if test -x "$PATH_TO_SNMPGET"
1217 then
1218         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1219         EXTRAS="$EXTRAS check_hpjd check_snmp"
1220 else
1221         AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1222 fi
1224 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1225 if test -x "$PATH_TO_SNMPGETNEXT"
1226 then
1227         AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1228 fi
1230 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null  )
1231 then
1232         AC_MSG_CHECKING(for Net::SNMP perl module)
1233         AC_MSG_RESULT([found])
1234 else
1235         AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1236 fi
1238 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1239 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1241 if test -x "$PATH_TO_QUAKESTAT"
1242 then
1243         ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1244         EXTRAS="$EXTRAS check_game"
1246 elif test -x "$PATH_TO_QSTAT"
1247 then
1248         ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1249         EXTRAS="$EXTRAS check_game"
1250 else
1251         AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1252 fi
1254 if test $ac_cv_path_to_qstat 
1255 then
1256         AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1257                 [path to qstat/quakestat])
1258 fi
1260 AC_PATH_PROG(PATH_TO_FPING,fping)
1261 if test -x "$PATH_TO_FPING"
1262 then
1263         AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1264         EXTRAS="$EXTRAS check_fping"
1265 else
1266         AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1267 fi
1269 AC_PATH_PROG(PATH_TO_SSH,ssh)
1271 if test -x "$PATH_TO_SSH"
1272 then
1273         AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1274         EXTRAS="$EXTRAS check_by_ssh"
1275 else
1276         AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1277 fi
1280 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1281 if test -x "$PATH_TO_MAILQ"
1282 then
1283         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1284 else
1285         AC_MSG_WARN([Could not find mailq or eqivalent])
1286 fi
1288 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1289 if test -x "$PATH_TO_QMAIL_QSTAT"
1290 then
1291         AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1292 else
1293         AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1294 fi
1296 dnl SWAP info required is amount allocated/available and amount free
1297 dnl The plugin works through all the swap devices and adds up the total swap
1298 dnl available.
1299 AC_PATH_PROG(PATH_TO_SWAP,swap)
1300 if (test -n "$PATH_TO_SWAP")
1301 then
1302 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1303 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1304 then
1305         ac_cv_have_swap=yes
1306         ac_cv_swap_command="$PATH_TO_SWAP -l"
1307         if [$PATH_TO_SWAP -l 2>/dev/null | \
1308                 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1309                 >/dev/null]
1310         then
1311                 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1312                 ac_cv_swap_conv=2048
1313                 AC_MSG_RESULT([using IRIX format swap])
1315         elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1316         then
1317                 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1318                 ac_cv_swap_conv=2048
1319                 AC_MSG_RESULT([using Unixware format swap])
1320         else
1321                 dnl if we don't know what format swap's output is
1322                 dnl we might as well pretend we didn't see it
1323                 ac_cv_have_swap=""
1324                 ac_cv_swap_command=""
1325         fi
1326 fi
1327 dnl end if for PATH_TO_SWAP
1328 fi
1330 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1331 if (test -n "$PATH_TO_SWAPINFO")
1332 then
1333 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1334 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1335 then
1336         ac_cv_have_swap=yes
1337         ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1339         if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1340         then
1341                 ac_cv_swap_format=["%*s %d %*d %d"]
1342                 ac_cv_swap_conv=1024
1343                 AC_MSG_RESULT([using FreeBSD format swapinfo])
1344         fi
1346 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1347 then
1348         ac_cv_have_swap=yes
1349         ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1350         ac_cv_swap_format=["%*s %d %*d %d"]
1351         ac_cv_swap_conv=1024
1352         AC_MSG_RESULT([using HP-UX format swapinfo])
1353 fi
1354 dnl end if for PATH_TO_SWAPINFO
1355 fi
1357 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1358 if (test -n "$PATH_TO_LSPS")
1359 then
1360 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1361 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1362 then
1363         ac_cv_have_swap=yes
1364         ac_cv_swap_command="$PATH_TO_LSPS -a"
1365         ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
1366         ac_cv_swap_conv=1
1367         AC_MSG_RESULT([using AIX lsps])
1368 fi
1369 dnl end if for PATH_TO_SWAPINFO
1370 fi
1372 dnl
1373 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1374 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1375 dnl in the various BSD's
1376 dnl
1378 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1379 #ifdef HAVE_SYS_PARAM_H
1380 #include <sys/param.h>
1381 #endif
1382 ])
1383 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1384 AC_CHECK_DECLS([swapctl],,,[
1385                #include <unistd.h>
1386                #include <sys/types.h>
1387                #include <sys/param.h>
1388                #include <sys/stat.h>
1389                #include <sys/swap.h>
1390                ])
1391 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1392                #include <sys/types.h>
1393                #include <sys/param.h>
1394                #include <sys/stat.h>
1395                #include <sys/swap.h>
1396                ])
1397 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1398                #include <unistd.h>
1399                #include <sys/types.h>
1400                #include <sys/param.h>
1401                #include <sys/stat.h>
1402                #include <sys/swap.h>
1403                ])
1405 if test "$ac_cv_have_decl_swapctl" = "yes"; 
1406 then
1407         EXTRAS="$EXTRAS check_swap"
1408         AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1409         if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1410                 "$ac_cv_type_swapent_t" = "yes"; 
1411         then
1412                 AC_MSG_RESULT([yes])
1413                 ac_cv_check_swap_swapctl_svr4="1";
1414                 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1415                           [Define if 2-argument SVR4 swapctl exists])
1416         else
1417                 AC_MSG_RESULT([no])
1418                 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1419                 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes"; 
1420                 then
1421                         AC_MSG_RESULT([yes])
1422                         AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1423                                   [Define if 3-argument BSD swapctl exists])
1424                 else
1425                         AC_MSG_RESULT([no])
1426                 fi
1427         fi
1428         AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1429         if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1430         then
1431                 dnl
1432                 dnl the SVR4 spec returns values in pages
1433                 dnl
1434                 AC_MSG_RESULT([page])
1435                 AC_CHECK_DECLS([sysconf])
1436                 AC_MSG_CHECKING([for system page size])
1437                 if test "$ac_cv_have_decl_sysconf" = "yes";
1438                 then
1439                         AC_MSG_RESULT([determined by sysconf(3)])
1440                         ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1441                 else
1442                         AC_MSG_WARN([don't know. guessing 4096k])
1443                         ac_cv_swap_conv=256
1444                 fi
1445         else
1446                 dnl
1447                 dnl the BSD spec returns values in blocks
1448                 dnl
1449                 AC_MSG_RESULT([blocks (assuming 512b)])
1450                 ac_cv_swap_conv=2048
1451         fi
1452         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1453                 [Conversion factor to MB])
1454 fi
1455 dnl
1456 dnl end tests for the swapctl system calls
1457 dnl
1460 if test "x$ac_cv_have_swap" != "x" 
1461 then
1462         AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1463         EXTRAS="$EXTRAS check_swap"
1464 fi
1465 if test "x$ac_cv_swap_command" != "x" 
1466 then
1467         AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1468                 [Path to swap/swapinfo binary, with any args])
1469         AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1470                 [Format string for parsing swap output])
1471         AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1472                 [Conversion factor to MB])
1473 fi
1475 dnl dunno why this does not work below - use hack (kbd)
1476 dnl fine on linux, broken on solaris
1477 dnl if /bin/test -e "/proc/meminfo"
1478 AC_MSG_CHECKING([for /proc/meminfo])
1479 if [cat /proc/meminfo > /dev/null 2>&1]
1480 then
1481         AC_MSG_RESULT([found /proc/meminfo])
1482         AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1483         AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1484         EXTRAS="$EXTRAS check_swap"
1485 else
1486         AC_MSG_RESULT([no])
1487 fi
1489 AC_PATH_PROG(PATH_TO_DIG,dig)
1490 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1491 if test -n "$PATH_TO_DIG"; then
1492         EXTRAS="$EXTRAS check_dig"
1493 fi
1495 if test -f plugins/check_nt.c ; then
1496   EXTRAS="$EXTRAS check_nt"
1497 elif test -f ../plugins/check_nt.c ; then
1498   EXTRAS="$EXTRAS check_nt"
1499 fi
1501 AC_MSG_CHECKING(for va_list)
1502 AC_TRY_COMPILE([#ifdef __STDC__
1503                 #include <stdio.h>
1504                 #include <stdlib.h>
1505                 #include <stdarg.h>
1506                 #else
1507                 #include <sys/types.h>
1508                 #include <stdio.h>
1509                 #include <varargs.h>
1510                 #endif],
1511                 [va_list args;],
1512                 [AC_MSG_RESULT(yes)],
1513                 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1515 AC_SUBST(EXTRAS)
1516 AC_SUBST(EXTRA_NETOBJS)
1517 AC_SUBST(DEPLIBS)
1519 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1520 AM_GNU_GETTEXT_VERSION(0.11.5)
1522 dnl External libraries
1523 np_COREUTILS
1525 AC_OUTPUT(
1526   Makefile 
1527   lib/Makefile 
1528   m4/Makefile 
1529   plugins/Makefile 
1530   plugins-scripts/Makefile 
1531   plugins-scripts/subst 
1532   plugins-scripts/utils.pm 
1533   plugins-scripts/utils.sh 
1534   command.cfg 
1535   test.pl 
1536   pkg/solaris/pkginfo 
1537   intl/Makefile
1538   po/Makefile.in 
1541 ACX_FEATURE([with],[cgiurl])
1542 ACX_FEATURE([with],[nagios-user])
1543 ACX_FEATURE([with],[nagios-group])
1544 ACX_FEATURE([with],[trusted-path])
1545 ACX_FEATURE([with],[ping-command])
1546 ACX_FEATURE([with],[ping6-command])
1547 ACX_FEATURE([with],[lwres])
1548 ACX_FEATURE([with],[ipv6])
1549 ACX_FEATURE([with],[openssl])
1550 ACX_FEATURE([enable],[emulate-getaddrinfo])