36f86051808c3fb7867ff134387f856f2d58f128
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.0-alpha3)
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 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([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 $MYSQLINCLUDE"
255 LIBS="$_SAVEDLIBS"
257 dnl Check for OpenSSL location
258 dnl This whole check is inspired by curl 7.12.2's configure.ac
259 OPT_OPENSSL=off
260 AC_ARG_WITH(openssl,
261 AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
262 AC_HELP_STRING([--without-openssl], [disable openssl]),
263 OPT_OPENSSL=$withval)
265 if test X"$OPT_OPENSSL" = "Xno"; then
266 AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
267 with_openssl=no
268 else
269 dnl backup the pre-ssl variables
270 CLEANLDFLAGS="$LDFLAGS"
271 CLEANCPPFLAGS="$CPPFLAGS"
272 CLEANLIBS="$LIBS"
274 case "$OPT_OPENSSL" in
275 yes)
276 dnl --with-openssl (without path) used
277 PKGTEST="yes"
278 ;;
279 off)
280 dnl no --with-openssl given, check default places
281 PKGTEST="yes"
282 ;;
283 *)
284 dnl use the given area
285 PKGTEST="no"
286 OPENSSL=$OPT_OPENSSL
287 LDFLAGS="$LDFLAGS -L$OPENSSL/lib"
288 CPPFLAGS="$CPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
289 ;;
290 esac
292 dnl Check usual areas for openssl
293 if test "$PKGTEST" = "yes"; then
294 AC_PATH_PROG(OPENSSL,openssl)
295 # Don't think 2 tests below are necessary because /usr is always included
296 # if test "$OPENSSL" = "/usr/bin/openssl"; then
297 # OPENSSL=/usr
298 #elif test "$OPENSSL" = "/usr/sbin/openssl"; then
299 # OPENSSL=/usr
300 if test "$OPENSSL" = "/opt/bin/openssl"; then
301 OPENSSL=/opt
302 elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
303 OPENSSL=/opt/openssl
304 elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
305 OPENSSL=/usr/slocal
306 elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
307 OPENSSL=/usr/local
308 elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
309 OPENSSL=/usr/local/ssl
310 fi
311 fi
313 AC_CHECK_LIB(crypto, CRYPTO_lock,[
314 HAVECRYPTO="yes"
315 ],[
316 LDFLAGS="$CLEANLDFLAGS -L$OPENSSL/lib"
317 CPPFLAGS="$CLEANCPPFLAGS -I$OPENSSL/include/openssl -I$OPENSSL/include"
318 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
319 HAVECRYPTO="yes" ], [
320 LDFLAGS="$CLEANLDFLAGS"
321 CPPFLAGS="$CLEANCPPFLAGS"
322 LIBS="$CLEANLIBS"
323 ])
324 ])
326 if test "$HAVECRYPTO" = "yes"; then
327 dnl This is only reasonable to do if crypto actually is there: check for
328 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
330 dnl This is for Msys/Mingw
331 AC_MSG_CHECKING([for gdi32])
332 my_ac_save_LIBS=$LIBS
333 LIBS="-lgdi32 $LIBS"
334 AC_TRY_LINK([#include <windef.h>
335 #include <wingdi.h>],
336 [GdiFlush();],
337 [ dnl worked!
338 AC_MSG_RESULT([yes])],
339 [ dnl failed, restore LIBS
340 LIBS=$my_ac_save_LIBS
341 AC_MSG_RESULT(no)]
342 )
344 AC_CHECK_LIB(crypto, CRYPTO_add_lock)
345 AC_CHECK_LIB(ssl, SSL_connect)
347 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
348 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
349 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
350 OLIBS=$LIBS
351 LIBS="$LIBS -lRSAglue -lrsaref"
352 AC_CHECK_LIB(ssl, SSL_connect)
353 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
354 dnl still no SSL_connect
355 AC_MSG_RESULT(no)
356 LIBS=$OLIBS
357 else
358 AC_MSG_RESULT(yes)
359 fi
360 fi
363 dnl Check for SSLeay headers
364 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
365 openssl/pem.h openssl/ssl.h openssl/err.h,
366 OPENSSL_ENABLED=1)
368 if test $ac_cv_header_openssl_x509_h = no; then
369 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
370 OPENSSL_ENABLED=1)
371 fi
373 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
374 dnl header, it is kind of "separated" from the main SSL check
375 AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
377 dnl AC_SUBST(OPENSSL_ENABLED)
379 dnl these can only exist if openssl exists
380 AC_CHECK_FUNCS( RAND_status \
381 RAND_screen \
382 RAND_egd \
383 CRYPTO_cleanup_all_ex_data )
385 fi
387 if test X"$OPT_OPENSSL" != "Xno" &&
388 test "$OPENSSL_ENABLED" != "1"; then
389 AC_MSG_WARN([OpenSSL libs and/or directories were not found where specified!])
390 with_openssl="no"
391 elif test "$OPENSSL_ENABLED" = "1"; then
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 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSSL/lib"
399 fi
400 fi
402 AC_CHECK_HEADERS(unistd.h)
404 dnl Check for AF_INET6 support - unistd.h required for Darwin
405 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
406 AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
407 #include <unistd.h>
408 #endif
409 #include <netinet/in.h>
410 #include <sys/socket.h>],
411 [struct sockaddr_in6 sin6;
412 void *p;
414 sin6.sin6_family = AF_INET6;
415 sin6.sin6_port = 587;
416 p = &sin6.sin6_addr;],
417 [with_ipv6=yes],
418 [with_ipv6=no])
419 ])
421 if test x"$with_ipv6" != xno ; then
422 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
423 fi
425 dnl #########################################################################
426 dnl Check if Posix getaddrinfo() is available. It is also possible to use
427 dnl the version from the lwres library distributed with BIND.
428 dnl #########################################################################
429 AC_ARG_ENABLE([emulate-getaddrinfo],
430 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
431 [enable getaddrinfo emulation (default=no)]),
432 ,
433 enable_emulate_getaddrinfo=no)
435 AC_ARG_WITH(lwres,
436 ACX_HELP_STRING([--with-lwres=DIR],
437 [use lwres library for getaddrinfo (default=no)]),
438 ,
439 with_lwres=no)
441 dnl ## enable force to test getaddrinfo.c
442 if test x$enable_emulate_getaddrinfo = xforce ; then
443 enable_emulate_getaddrinfo=yes
444 have_getaddrinfo=no
445 else
447 have_getaddrinfo=no
448 if test x$with_lwres != xno ; then
449 if test "$with_lwres" != yes ; then
450 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
451 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
452 fi
453 AC_CHECK_HEADERS(lwres/netdb.h, ,
454 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
455 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
456 [AC_MSG_ERROR([cannot find the lwres library])],
457 -lnsl -lpthread)
458 have_getaddrinfo=yes
459 fi
461 if test x$have_getaddrinfo != xyes ; then
462 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
463 fi
465 dnl # Special nonsense for systems that actually have getaddrinfo but
466 dnl # redefine the name to something else, e.g. OSF
467 if test x$have_getaddrinfo != xyes ; then
468 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
469 AC_TRY_LINK([
470 # include <netdb.h>
471 ], [
472 struct addrinfo hints, *res;
473 int err;
475 err = getaddrinfo ("host", "service", &hints, &res);
476 ], [
477 have_getaddrinfo=yes
478 AC_MSG_RESULT(yes)
479 ], [AC_MSG_RESULT(no)])
480 fi
482 fi
484 if test x$have_getaddrinfo != xno ; then
485 if test x$enable_emulate_getaddrinfo != xno ; then
486 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
487 fi
488 AC_DEFINE(HAVE_GETADDRINFO, 1,
489 [Does system provide RFC 2553/Posix getaddrinfo?])
490 else
491 if test x$enable_emulate_getaddrinfo != xyes ; then
492 dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
493 enable_emulate_getaddrinfo=yes
494 AC_MSG_WARN([enabling getaddrinfo emulation])
495 fi
496 EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
497 fi
499 if test x"$enable_emulate_getaddrinfo" != xno ; then
500 have_resolver=no
502 dnl Try for getipnodebyname
503 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
504 if test x"$have_resolver" != xno ; then
505 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
506 [Set when getipnodebyname is available])
507 fi
509 dnl Try for gethostbyname_r
510 if test x"$have_resolver" = xno ; then
511 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
512 [have_resolver=yes
513 ACX_WHICH_GETHOSTBYNAME_R])
514 fi
516 dnl Try for gethostbyname
517 if test x"$have_resolver" = xno ; then
518 if test x"$enable_pthreads" != xno ; then
519 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
520 fi
521 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
522 [AC_MSG_ERROR([cannot find gethostbyname])])
523 fi
524 EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
526 fi
528 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
529 if test "$FOUNDINCLUDE" = "no"; then
530 _SAVEDCPPFLAGS="$CPPFLAGS"
531 CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
532 unset ac_cv_header_krb5_h
533 AC_CHECK_HEADERS(krb5.h,
534 KRB5INCLUDE="-I/usr/kerberos/include"
535 FOUNDINCLUDE=yes,
536 FOUNDINCLUDE=no)
537 fi
538 AC_SUBST(KRBINCLUDE)
539 if test "$FOUNDINCLUDE" = "no"; then
540 CPPFLAGS="$_SAVEDCPPFLAGS"
541 fi
543 dnl
544 dnl Checks for header files.
545 dnl
547 AC_HEADER_STDC
548 AC_HEADER_TIME
549 AC_HEADER_SYS_WAIT
550 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)
551 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
552 AC_CHECK_HEADERS(limits.h sys/param.h)
553 AC_CHECK_HEADERS([sys/mount.h],[],[],[
554 #ifdef HAVE_SYS_PARAM_H
555 #include <sys/param.h>
556 #endif
557 ])
558 AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h fcntl.h sys/statfs.h sys/dustat.h sys/statvfs.h)
560 # glibc 2.3.2 stdlib.h does not define HUGE_VAL (see man strtod)
561 AC_MSG_CHECKING([for HUGE_VAL in <stdlib.h>])
562 AC_TRY_COMPILE([#include <stdlib.h>],
563 [double x = HUGE_VAL;],
564 [AC_MSG_RESULT(yes)],
565 [AC_MSG_RESULT(no)
566 AC_MSG_CHECKING([for HUGE_VAL in <math.h>])
567 AC_TRY_COMPILE([#include <math.h>],
568 [double x = HUGE_VAL;],
569 [AC_MSG_RESULT(yes)
570 AC_DEFINE_UNQUOTED(HUGE_VAL_NEEDS_MATH_H, 1,
571 [Define if <math.h> is required for HUGE_VAL])],
572 [AC_MSG_RESULT(no)])])
574 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
575 # doesn't clash with <sys/types.h>, and declares uintmax_t.
577 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
578 [AC_TRY_COMPILE(
579 [#include <sys/types.h>
580 #include <inttypes.h>],
581 [uintmax_t i = (uintmax_t) -1;],
582 jm_ac_cv_header_inttypes_h=yes,
583 jm_ac_cv_header_inttypes_h=no)])
585 if test $jm_ac_cv_header_inttypes_h = yes; then
586 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
587 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
588 and declares uintmax_t. ])
589 fi
591 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
592 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
593 # enable the work-around code in fsusage.c.
594 AC_MSG_CHECKING([for statfs that truncates block counts])
595 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
596 [AC_TRY_COMPILE([
597 #if !defined(sun) && !defined(__sun)
598 choke -- this is a workaround for a Sun-specific problem
599 #endif
600 #include <sys/types.h>
601 #include <sys/vfs.h>],
602 [struct statfs t; long c = *(t.f_spare);],
603 fu_cv_sys_truncating_statfs=yes
604 AC_MSG_RESULT(yes),
605 fu_cv_sys_truncating_statfs=no
606 AC_MSG_RESULT(no),
607 )])
608 if test $fu_cv_sys_truncating_statfs = yes; then
609 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
610 [ Define if the block counts reported by statfs may be truncated to 2GB
611 and the correct values may be stored in the f_spare array.
612 (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
613 SunOS 4.1.1 seems not to be affected.)])
614 fi
616 dnl Checks for typedefs, structures, and compiler characteristics.
617 AC_C_CONST
618 AC_STRUCT_TM
619 AC_TYPE_PID_T
620 AC_TYPE_SIZE_T
621 AC_TYPE_SIGNAL
623 AC_CHECK_SIZEOF(int,cross)
624 AC_CHECK_SIZEOF(long,cross)
625 AC_CHECK_SIZEOF(short,cross)
627 AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
628 AC_TRY_RUN([#include <stdio.h>
629 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
630 ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
631 if test x"$ac_cv_have_longlong" = x"yes"; then
632 AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
633 fi
635 #
636 # Check if the compiler supports the LL prefix on long long integers.
637 # AIX needs this.
639 AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
640 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
641 ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
642 if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
643 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
644 fi
646 AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
647 AC_TRY_LINK([#include <stdarg.h>
648 va_list ap1,ap2;], [va_copy(ap1,ap2);],
649 ac_cv_HAVE_VA_COPY=yes,
650 ac_cv_HAVE_VA_COPY=no)])
651 if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
652 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
653 else
654 AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
655 AC_TRY_LINK([#include <stdarg.h>
656 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
657 ac_cv_HAVE___VA_COPY=yes,
658 ac_cv_HAVE___VA_COPY=no)])
659 if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
660 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
661 fi
662 fi
664 AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
665 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
666 AC_TRY_RUN([
667 #include <sys/types.h>
668 #include <stdarg.h>
669 void foo(const char *format, ...) {
670 va_list ap;
671 int len;
672 char buf[5];
674 va_start(ap, format);
675 len = vsnprintf(buf, 0, format, ap);
676 va_end(ap);
677 if (len != 5) exit(1);
679 va_start(ap, format);
680 len = vsnprintf(0, 0, format, ap);
681 va_end(ap);
682 if (len != 5) exit(1);
684 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
686 exit(0);
687 }
688 main() { foo("hello"); }
689 ],
690 ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
691 if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
692 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
693 fi
695 AC_TRY_COMPILE([#include <sys/time.h>],
696 [struct timeval *tv;
697 struct timezone *tz;],
698 AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
699 AC_TRY_COMPILE([#include <sys/time.h>],
700 [struct timeval *tv;
701 struct timezone *tz;
702 gettimeofday(tv, tz);],
703 AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
704 AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
706 dnl Checks for library functions.
707 AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
709 AC_MSG_CHECKING(return type of socket size)
710 AC_TRY_COMPILE([#include <stdlib.h>
711 #include <sys/types.h>
712 #include <sys/socket.h>],
713 [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
714 ac_cv_socket_size_type=["size_t"]
715 AC_MSG_RESULT(size_t),
716 ac_cv_socket_size_type=["int"]
717 AC_MSG_RESULT(int))
719 AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
720 [Define type of socket size])
722 if test -f "/proc/loadavg"
723 then
724 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
725 AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
726 fi
728 dnl #### Process table test
730 AC_PATH_PROG(PATH_TO_PS,ps)
732 AC_MSG_CHECKING(for ps syntax)
733 dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
734 dnl STAT UCOMM VSZ RSS USER PPID COMMAND
735 if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
736 egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /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 -axwo 'stat 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 STAT UCOMM VSZ RSS USER UID PPID COMMAND
745 elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
746 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
747 then
748 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
749 ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
750 ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
751 ac_cv_ps_cols=9
752 AC_MSG_RESULT([$ac_cv_ps_command])
754 dnl FreeBSD
755 elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
756 egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/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 waxco 'state uid ppid vsz rss pcpu command command'"
760 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
761 ac_cv_ps_cols=8
762 AC_MSG_RESULT([$ac_cv_ps_command])
764 dnl BSD-like mode in RH 6.1
765 elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
766 egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
767 then
768 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
769 ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
770 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
771 ac_cv_ps_cols=8
772 AC_MSG_RESULT([$ac_cv_ps_command])
774 dnl SunOS 4.1.3:
775 dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
776 dnl Need the head -1 otherwise test will work because arguments are found
777 elif ps -laxnwww 2>/dev/null | head -1 | \
778 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
779 then
780 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
781 ac_cv_ps_command="$PATH_TO_PS -laxnwww"
782 ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
783 ac_cv_ps_cols=8
784 AC_MSG_RESULT([$ac_cv_ps_command])
786 dnl Debian Linux / procps v1.2.9:
787 dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
788 dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
789 dnl
790 elif ps laxnwww 2>/dev/null | \
791 egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
792 then
793 ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
794 ac_cv_ps_command="$PATH_TO_PS laxnwww"
795 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
796 ac_cv_ps_cols=8
797 AC_MSG_RESULT([$ac_cv_ps_command])
799 dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
800 elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
801 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
802 then
803 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
804 ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
805 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
806 ac_cv_ps_cols=8
807 AC_MSG_RESULT([$ac_cv_ps_command])
809 dnl Tru64 - needs %*[ +] in PS_FORMAT
810 elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
811 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
812 then
813 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
814 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
815 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
816 ac_cv_ps_cols=8
817 AC_MSG_RESULT([$ac_cv_ps_command])
819 elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
820 egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
821 then
822 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
823 ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
824 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
825 ac_cv_ps_cols=8
826 AC_MSG_RESULT([$ac_cv_ps_command])
828 dnl AIX 4.3.3 and 5.1 do not have an rss field
829 elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
830 egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
831 then
832 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
833 ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
834 ac_cv_ps_format="%s %d %d %d %f %s %n"
835 ac_cv_ps_cols=7
836 AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
838 dnl Solaris 2.6
839 elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
840 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
841 then
842 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
843 ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
844 # There must be no space between the %s and %n due to a wierd problem in sscanf where
845 # it will return %n as longer than the line length
846 ac_cv_ps_format="%s %d %d %d %d %f %s%n"
847 ac_cv_ps_cols=8
848 AC_MSG_RESULT([$ac_cv_ps_command])
850 elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
851 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
852 then
853 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
854 ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
855 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
856 ac_cv_ps_cols=8
857 AC_MSG_RESULT([$ac_cv_ps_command])
859 elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
860 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
861 then
862 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
863 ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
864 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
865 ac_cv_ps_cols=8
866 AC_MSG_RESULT([$ac_cv_ps_command])
868 dnl wonder who takes state instead of stat
869 elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
870 egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
871 then
872 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
873 ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
874 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
875 ac_cv_ps_cols=7
876 AC_MSG_RESULT([$ac_cv_ps_command])
878 dnl IRIX 53
879 elif ps -el 2>/dev/null | \
880 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
881 then
882 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
883 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
884 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
885 ac_cv_ps_cols=7
886 AC_MSG_RESULT([$ac_cv_ps_command])
888 dnl IRIX 63
889 elif ps -el 2>/dev/null | \
890 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
891 then
892 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
893 ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
894 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
895 ac_cv_ps_cols=5
896 AC_MSG_RESULT([$ac_cv_ps_command])
898 dnl AIX 4.1:
899 dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
900 dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
901 elif ps -el 2>/dev/null | \
902 egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
903 then
904 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
905 ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
906 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
907 ac_cv_ps_cols=5
908 AC_MSG_RESULT([$ac_cv_ps_command])
910 dnl AIX?
911 elif ps glaxen 2>/dev/null | \
912 egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
913 then
914 ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
915 ac_cv_ps_command="$PATH_TO_PS glaxen"
916 ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
917 ac_cv_ps_cols=7
918 AC_MSG_RESULT([$ac_cv_ps_command])
920 dnl MacOSX / Darwin
921 dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
922 dnl Some truncation will happen in UCOMM column
923 dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
924 dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
925 elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
926 egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
927 then
928 ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
929 ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
930 ac_cv_ps_format="%s %d %d %d %d %f %s %n"
931 ac_cv_ps_cols=7
932 AC_MSG_RESULT([$ac_cv_ps_command])
934 dnl UnixWare
935 elif ps -Al 2>/dev/null | \
936 egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
937 then
938 ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
939 ac_cv_ps_command="$PATH_TO_PS -Al"
940 ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
941 ac_cv_ps_cols=7
942 AC_MSG_RESULT([$ac_cv_ps_command])
944 else
945 AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
946 fi
948 if test -n "$ac_cv_ps_varlist" ; then
949 AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
950 [Variable list for sscanf of 'ps' output])
951 AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
952 [Verbatim command to execute for ps in check_procs])
953 AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
954 [Format string for scanning ps output in check_procs])
955 AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
956 [Number of columns in ps command])
957 EXTRAS="$EXTRAS check_procs check_nagios"
958 fi
960 dnl jm_AFS
961 jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
962 jm_FSTYPENAME
963 jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
965 AC_PATH_PROG(PATH_TO_PING,ping)
966 AC_PATH_PROG(PATH_TO_PING6,ping6)
968 AC_ARG_WITH(ping_command,
969 ACX_HELP_STRING([--with-ping-command=SYNTAX],
970 [sets syntax for ICMP ping]),
971 with_ping_command=$withval,)
973 AC_MSG_CHECKING(for ICMP ping syntax)
974 ac_cv_ping_packets_first=no
975 ac_cv_ping_has_timeout=no
976 if test -n "$with_ping_command"
977 then
978 AC_MSG_RESULT([(command-line) $with_ping_command])
979 if test -n "$ac_cv_ping_packets_first"
980 then
981 ac_cv_ping_packets_first=yes
982 fi
984 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
985 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
986 egrep -i "^round-trip|^rtt" >/dev/null
987 then
988 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
989 ac_cv_ping_packets_first=yes
990 AC_MSG_RESULT([$with_ping_command])
992 elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
993 egrep -i "^round-trip|^rtt" >/dev/null
994 then
995 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
996 ac_cv_ping_packets_first=yes
997 ac_cv_ping_has_timeout=yes
998 AC_MSG_RESULT([$with_ping_command])
1000 elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
1001 egrep -i "^round-trip|^rtt" >/dev/null
1002 then
1003 with_ping_command="$PATH_TO_PING -n -U -c %d %s"
1004 ac_cv_ping_packets_first=yes
1005 AC_MSG_RESULT([$with_ping_command])
1007 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1008 egrep -i "^round-trip|^rtt" >/dev/null
1009 then
1010 with_ping_command="$PATH_TO_PING -n -c %d %s"
1011 ac_cv_ping_packets_first=yes
1012 AC_MSG_RESULT([$with_ping_command])
1014 elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
1015 egrep -i "^round-trip|^rtt" >/dev/null
1016 then
1017 with_ping_command="$PATH_TO_PING -n %s -c %d"
1018 AC_MSG_RESULT([$with_ping_command])
1020 elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
1021 egrep -i "^round-trip|^rtt" >/dev/null
1022 then
1023 with_ping_command="$PATH_TO_PING %s -n %d"
1024 AC_MSG_RESULT([$with_ping_command])
1026 elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1027 egrep -i "^round-trip|^rtt" >/dev/null
1028 then
1029 with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
1030 AC_MSG_RESULT([$with_ping_command])
1032 elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
1033 egrep -i "^round-trip|^rtt" >/dev/null
1034 then
1035 with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
1036 AC_MSG_RESULT([$with_ping_command])
1038 elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
1039 egrep -i "^round-trip|^rtt" >/dev/null
1040 then
1041 with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
1042 ac_cv_ping_packets_first=yes
1043 AC_MSG_RESULT([$with_ping_command])
1045 elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
1046 egrep -i "^round-trip|^rtt" >/dev/null
1047 then
1048 with_ping_command="$PATH_TO_PING -n -c %d %s"
1049 ac_cv_ping_packets_first=yes
1050 AC_MSG_RESULT([$with_ping_command])
1052 else
1053 AC_MSG_WARN([unable to find usable ping syntax])
1054 fi
1056 AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
1057 [path and args for ICMP ping command])
1059 if test "x$ac_cv_ping_packets_first" != "xno"
1060 then
1061 AC_DEFINE(PING_PACKETS_FIRST,1,
1062 [Define if packet count must precede host])
1063 fi
1065 if test "x$ac_cv_ping_has_timeout" != "xno"
1066 then
1067 AC_DEFINE(PING_HAS_TIMEOUT,1,
1068 [Define if ping has its own timeout option that should be set])
1069 fi
1071 AC_ARG_WITH(ping6_command,
1072 ACX_HELP_STRING([--with-ping6-command=SYNTAX],
1073 [sets syntax for ICMPv6 ping]),
1074 with_ping6_command=$withval,)
1076 if test x"$with_ipv6" != xno ; then
1077 AC_MSG_CHECKING(for ICMPv6 ping syntax)
1078 ac_cv_ping6_packets_first=no
1079 if test -n "$with_ping6_command"
1080 then
1081 AC_MSG_RESULT([(command-line) $with_ping6_command])
1082 if test -n "$ac_cv_ping6_packets_first"
1083 then
1084 ac_cv_ping6_packets_first=yes
1085 fi
1087 elif test "x$PATH_TO_PING6" != "x"; then
1088 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1089 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1090 egrep -i "^round-trip|^rtt" >/dev/null
1091 then
1092 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1093 ac_cv_ping6_packets_first=yes
1094 AC_MSG_RESULT([$with_ping6_command])
1096 elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
1097 egrep -i "^round-trip|^rtt" >/dev/null
1098 then
1099 with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
1100 ac_cv_ping6_packets_first=yes
1101 AC_MSG_RESULT([$with_ping6_command])
1103 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1104 egrep -i "^round-trip|^rtt" >/dev/null
1105 then
1106 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1107 ac_cv_ping6_packets_first=yes
1108 AC_MSG_RESULT([$with_ping6_command])
1110 elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
1111 egrep -i "^round-trip|^rtt" >/dev/null
1112 then
1113 with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
1114 AC_MSG_RESULT([$with_ping6_command])
1116 elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
1117 egrep -i "^round-trip|^rtt" >/dev/null
1118 then
1119 with_ping6_command="$PATH_TO_PING6 %s -n %d"
1120 AC_MSG_RESULT([$with_ping6_command])
1122 elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
1123 egrep -i "^round-trip|^rtt" >/dev/null
1124 then
1125 with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
1126 AC_MSG_RESULT([$with_ping6_command])
1128 elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1129 egrep -i "^round-trip|^rtt" >/dev/null
1130 then
1131 with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
1132 AC_MSG_RESULT([$with_ping6_command])
1134 elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
1135 egrep -i "^round-trip|^rtt" >/dev/null
1136 then
1137 with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
1138 ac_cv_ping6_packets_first=yes
1139 AC_MSG_RESULT([$with_ping_command])
1141 elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
1142 egrep -i "^round-trip|^rtt" >/dev/null
1143 then
1144 with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
1145 ac_cv_ping6_packets_first=yes
1146 AC_MSG_RESULT([$with_ping6_command])
1148 fi
1150 elif test "x$PATH_TO_PING" != "x"; then
1151 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1152 $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1153 egrep -i "^round-trip|^rtt" >/dev/null
1154 then
1155 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1156 ac_cv_ping6_packets_first=yes
1157 AC_MSG_RESULT([$with_ping6_command])
1159 elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
1160 egrep -i "^round-trip|^rtt" >/dev/null
1161 then
1162 with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
1163 ac_cv_ping6_packets_first=yes
1164 AC_MSG_RESULT([$with_ping6_command])
1166 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1167 egrep -i "^round-trip|^rtt" >/dev/null
1168 then
1169 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1170 ac_cv_ping6_packets_first=yes
1171 AC_MSG_RESULT([$with_ping6_command])
1173 elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
1174 egrep -i "^round-trip|^rtt" >/dev/null
1175 then
1176 with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
1177 AC_MSG_RESULT([$with_ping6_command])
1179 elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
1180 egrep -i "^round-trip|^rtt" >/dev/null
1181 then
1182 with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
1183 AC_MSG_RESULT([$with_ping6_command])
1185 elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
1186 egrep -i "^round-trip|^rtt" >/dev/null
1187 then
1188 with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
1189 AC_MSG_RESULT([$with_ping6_command])
1191 elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
1192 egrep -i "^round-trip|^rtt" >/dev/null
1193 then
1194 with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
1195 AC_MSG_RESULT([$with_ping6_command])
1197 elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
1198 egrep -i "^round-trip|^rtt" >/dev/null
1199 then
1200 with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
1201 ac_cv_ping6_packets_first=yes
1202 AC_MSG_RESULT([$with_ping_command])
1204 elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
1205 egrep -i "^round-trip|^rtt" >/dev/null
1206 then
1207 with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
1208 ac_cv_ping6_packets_first=yes
1209 AC_MSG_RESULT([$with_ping6_command])
1211 fi
1213 fi
1215 if test "x$with_ping6_command" != "x"; then
1216 AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
1217 [path and args for ICMPv6 ping command])
1218 else
1219 AC_MSG_RESULT([none])
1220 fi
1222 if test "x$ac_cv_ping6_packets_first" != "xno"; then
1223 AC_DEFINE(PING6_PACKETS_FIRST,1,
1224 [Define if packet count must precede host])
1225 fi
1226 fi
1228 AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1230 AC_MSG_CHECKING(for nslookup syntax)
1231 if test -n "$PATH_TO_NSLOOKUP"
1232 then
1233 if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
1234 then
1235 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
1236 AC_MSG_RESULT([$ac_cv_nslookup_command])
1238 else
1239 ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
1240 AC_MSG_RESULT([$ac_cv_nslookup_command])
1242 fi
1243 EXTRAS="$EXTRAS check_dns"
1245 else
1246 AC_MSG_WARN([nslookup command not found])
1247 fi
1249 AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
1250 [path and args for nslookup])
1252 AC_PATH_PROG(PATH_TO_HOST,host)
1253 if test -n "$ac_cv_path_PATH_TO_HOST"
1254 then
1255 EXTRAS="$EXTRAS check_dns"
1256 fi
1258 AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1259 AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
1261 AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
1262 AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
1264 AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
1265 AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
1266 AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
1267 if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
1268 then
1269 AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
1270 AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
1271 else
1272 AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
1273 fi
1275 AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
1276 if test -x "$PATH_TO_LMSTAT"
1277 then
1278 AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
1279 else
1280 AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
1281 fi
1283 AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
1284 if test -x "$PATH_TO_SMBCLIENT"
1285 then
1286 AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
1287 else
1288 AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
1289 fi
1292 AC_PATH_PROG(PATH_TO_WHO,who)
1294 if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
1295 then
1296 ac_cv_path_to_who="$PATH_TO_WHO -q"
1297 else
1298 ac_cv_path_to_who="$PATH_TO_WHO"
1299 fi
1301 AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
1302 [path and arguments for invoking 'who'])
1304 AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
1305 if test -x "$PATH_TO_SNMPGET"
1306 then
1307 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1308 EXTRAS="$EXTRAS check_hpjd check_snmp"
1309 else
1310 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1311 fi
1313 AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1314 if test -x "$PATH_TO_SNMPGETNEXT"
1315 then
1316 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1317 fi
1319 if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1320 then
1321 AC_MSG_CHECKING(for Net::SNMP perl module)
1322 AC_MSG_RESULT([found])
1323 else
1324 AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
1325 fi
1327 AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
1328 AC_PATH_PROG(PATH_TO_QSTAT,qstat)
1330 if test -x "$PATH_TO_QUAKESTAT"
1331 then
1332 ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
1333 EXTRAS="$EXTRAS check_game"
1335 elif test -x "$PATH_TO_QSTAT"
1336 then
1337 ac_cv_path_to_qstat="$PATH_TO_QSTAT"
1338 EXTRAS="$EXTRAS check_game"
1339 else
1340 AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
1341 fi
1343 if test $ac_cv_path_to_qstat
1344 then
1345 AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
1346 [path to qstat/quakestat])
1347 fi
1349 AC_PATH_PROG(PATH_TO_FPING,fping)
1350 if test -x "$PATH_TO_FPING"
1351 then
1352 AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
1353 EXTRAS="$EXTRAS check_fping"
1354 else
1355 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
1356 fi
1358 AC_PATH_PROG(PATH_TO_SSH,ssh)
1360 if test -x "$PATH_TO_SSH"
1361 then
1362 AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
1363 EXTRAS="$EXTRAS check_by_ssh"
1364 else
1365 AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
1366 fi
1369 AC_PATH_PROG(PATH_TO_MAILQ,mailq)
1370 if test -x "$PATH_TO_MAILQ"
1371 then
1372 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
1373 else
1374 AC_MSG_WARN([Could not find mailq or eqivalent])
1375 fi
1377 AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
1378 if test -x "$PATH_TO_QMAIL_QSTAT"
1379 then
1380 AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
1381 else
1382 AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
1383 fi
1385 dnl SWAP info required is amount allocated/available and amount free
1386 dnl The plugin works through all the swap devices and adds up the total swap
1387 dnl available.
1388 AC_PATH_PROG(PATH_TO_SWAP,swap)
1389 if (test -n "$PATH_TO_SWAP")
1390 then
1391 AC_MSG_CHECKING([for $PATH_TO_SWAP format])
1392 if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
1393 then
1394 ac_cv_have_swap=yes
1395 ac_cv_swap_command="$PATH_TO_SWAP -l"
1396 if [$PATH_TO_SWAP -l 2>/dev/null | \
1397 egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
1398 >/dev/null]
1399 then
1400 ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
1401 ac_cv_swap_conv=2048
1402 AC_MSG_RESULT([using IRIX format swap])
1404 elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
1405 then
1406 ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
1407 ac_cv_swap_conv=2048
1408 AC_MSG_RESULT([using Unixware format swap])
1409 else
1410 dnl if we don't know what format swap's output is
1411 dnl we might as well pretend we didn't see it
1412 ac_cv_have_swap=""
1413 ac_cv_swap_command=""
1414 fi
1415 fi
1416 dnl end if for PATH_TO_SWAP
1417 fi
1419 AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
1420 if (test -n "$PATH_TO_SWAPINFO")
1421 then
1422 AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
1423 if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
1424 then
1425 ac_cv_have_swap=yes
1426 ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
1428 if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
1429 then
1430 ac_cv_swap_format=["%*s %d %*d %d"]
1431 ac_cv_swap_conv=1024
1432 AC_MSG_RESULT([using FreeBSD format swapinfo])
1433 fi
1435 elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
1436 then
1437 ac_cv_have_swap=yes
1438 ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
1439 ac_cv_swap_format=["%*s %d %*d %d"]
1440 ac_cv_swap_conv=1024
1441 AC_MSG_RESULT([using HP-UX format swapinfo])
1442 fi
1443 dnl end if for PATH_TO_SWAPINFO
1444 fi
1446 AC_PATH_PROG(PATH_TO_LSPS,lsps)
1447 if (test -n "$PATH_TO_LSPS")
1448 then
1449 AC_MSG_CHECKING([for $PATH_TO_LSPS format])
1450 if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
1451 then
1452 ac_cv_have_swap=yes
1453 ac_cv_swap_command="$PATH_TO_LSPS -a"
1454 ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
1455 ac_cv_swap_conv=1
1456 AC_MSG_RESULT([using AIX lsps])
1457 fi
1458 dnl end if for PATH_TO_SWAPINFO
1459 fi
1461 dnl
1462 dnl test for swapctl system call, both the 2-arg and 3-arg variants
1463 dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
1464 dnl in the various BSD's
1465 dnl
1467 AC_CHECK_HEADERS([sys/swap.h], [], [], [
1468 #ifdef HAVE_SYS_PARAM_H
1469 #include <sys/param.h>
1470 #endif
1471 ])
1472 AC_CHECK_HEADERS([sys/stat.h sys/param.h])
1473 AC_CHECK_DECLS([swapctl],,,[
1474 #include <unistd.h>
1475 #include <sys/types.h>
1476 #include <sys/param.h>
1477 #include <sys/stat.h>
1478 #include <sys/swap.h>
1479 ])
1480 AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
1481 #include <sys/types.h>
1482 #include <sys/param.h>
1483 #include <sys/stat.h>
1484 #include <sys/swap.h>
1485 ])
1486 AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
1487 #include <unistd.h>
1488 #include <sys/types.h>
1489 #include <sys/param.h>
1490 #include <sys/stat.h>
1491 #include <sys/swap.h>
1492 ])
1494 if test "$ac_cv_have_decl_swapctl" = "yes";
1495 then
1496 EXTRAS="$EXTRAS check_swap"
1497 AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
1498 if test "$ac_cv_type_swaptbl_t" = "yes" -a \
1499 "$ac_cv_type_swapent_t" = "yes";
1500 then
1501 AC_MSG_RESULT([yes])
1502 ac_cv_check_swap_swapctl_svr4="1";
1503 AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
1504 [Define if 2-argument SVR4 swapctl exists])
1505 else
1506 AC_MSG_RESULT([no])
1507 AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
1508 if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
1509 then
1510 AC_MSG_RESULT([yes])
1511 AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
1512 [Define if 3-argument BSD swapctl exists])
1513 else
1514 AC_MSG_RESULT([no])
1515 fi
1516 fi
1517 AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
1518 if test "$ac_cv_check_swap_swapctl_svr4" = "1";
1519 then
1520 dnl
1521 dnl the SVR4 spec returns values in pages
1522 dnl
1523 AC_MSG_RESULT([page])
1524 AC_CHECK_DECLS([sysconf])
1525 AC_MSG_CHECKING([for system page size])
1526 if test "$ac_cv_have_decl_sysconf" = "yes";
1527 then
1528 AC_MSG_RESULT([determined by sysconf(3)])
1529 ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
1530 else
1531 AC_MSG_WARN([don't know. guessing 4096k])
1532 ac_cv_swap_conv=256
1533 fi
1534 else
1535 dnl
1536 dnl the BSD spec returns values in blocks
1537 dnl
1538 AC_MSG_RESULT([blocks (assuming 512b)])
1539 ac_cv_swap_conv=2048
1540 fi
1541 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1542 [Conversion factor to MB])
1543 fi
1544 dnl
1545 dnl end tests for the swapctl system calls
1546 dnl
1549 if test "x$ac_cv_have_swap" != "x"
1550 then
1551 AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
1552 EXTRAS="$EXTRAS check_swap"
1553 fi
1554 if test "x$ac_cv_swap_command" != "x"
1555 then
1556 AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
1557 [Path to swap/swapinfo binary, with any args])
1558 AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
1559 [Format string for parsing swap output])
1560 AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
1561 [Conversion factor to MB])
1562 fi
1564 dnl dunno why this does not work below - use hack (kbd)
1565 dnl fine on linux, broken on solaris
1566 dnl if /bin/test -e "/proc/meminfo"
1567 AC_MSG_CHECKING([for /proc/meminfo])
1568 if [cat /proc/meminfo > /dev/null 2>&1]
1569 then
1570 AC_MSG_RESULT([found /proc/meminfo])
1571 AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
1572 AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
1573 EXTRAS="$EXTRAS check_swap"
1574 else
1575 AC_MSG_RESULT([no])
1576 fi
1578 AC_PATH_PROG(PATH_TO_DIG,dig)
1579 AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
1580 if test -n "$PATH_TO_DIG"; then
1581 EXTRAS="$EXTRAS check_dig"
1582 fi
1584 if test -f plugins/check_nt.c ; then
1585 EXTRAS="$EXTRAS check_nt"
1586 elif test -f ../plugins/check_nt.c ; then
1587 EXTRAS="$EXTRAS check_nt"
1588 fi
1590 AC_MSG_CHECKING(for va_list)
1591 AC_TRY_COMPILE([#ifdef __STDC__
1592 #include <stdio.h>
1593 #include <stdlib.h>
1594 #include <stdarg.h>
1595 #else
1596 #include <sys/types.h>
1597 #include <stdio.h>
1598 #include <varargs.h>
1599 #endif],
1600 [va_list args;],
1601 [AC_MSG_RESULT(yes)],
1602 [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
1604 AC_SUBST(EXTRAS)
1605 AC_SUBST(EXTRA_NETOBJS)
1606 AC_SUBST(DEPLIBS)
1608 AM_GNU_GETTEXT_VERSION(0.11.5)
1609 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
1611 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 )
1613 ACX_FEATURE([with],[cgiurl])
1614 ACX_FEATURE([with],[nagios-user])
1615 ACX_FEATURE([with],[nagios-group])
1616 ACX_FEATURE([with],[trusted-path])
1617 ACX_FEATURE([with],[ping-command])
1618 ACX_FEATURE([with],[ping6-command])
1619 ACX_FEATURE([with],[lwres])
1620 ACX_FEATURE([with],[ipv6])
1621 ACX_FEATURE([with],[openssl])
1622 ACX_FEATURE([enable],[emulate-getaddrinfo])