configure.in 49 KB

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