configure.in 48 KB

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