configure.in 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  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. LIBOBJS="$LIBOBJS 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. LIBOBJS="$LIBOBJS gethostbyname.o"
  372. fi
  373. AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
  374. if test "$FOUNDINCLUDE" = "no"; then
  375. _SAVEDCPPFLAGS="$CPPFLAGS"
  376. CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
  377. unset ac_cv_header_krb5_h
  378. AC_CHECK_HEADERS(krb5.h,
  379. KRB5INCLUDE="-I/usr/kerberos/include"
  380. FOUNDINCLUDE=yes,
  381. FOUNDINCLUDE=no)
  382. fi
  383. AC_SUBST(KRBINCLUDE)
  384. if test "$FOUNDINCLUDE" = "no"; then
  385. CPPFLAGS="$_SAVEDCPPFLAGS"
  386. fi
  387. dnl Check for OpenSSL header files
  388. unset FOUNDINCLUDE
  389. _SAVEDCPPFLAGS="$CPPFLAGS"
  390. CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
  391. AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
  392. SSLINCLUDE="-I$OPENSSL/include"
  393. FOUNDINCLUDE=yes,
  394. FOUNDINCLUDE=no)
  395. if test "$FOUNDINCLUDE" = "no"; then
  396. AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
  397. SSLINCLUDE="-I$OPENSSL/include"
  398. FOUNDINCLUDE=yes,
  399. FOUNDINCLUDE=no)
  400. fi
  401. AC_SUBST(SSLINCLUDE)
  402. if test "$FOUNDINCLUDE" = "no"; then
  403. CPPFLAGS="$_SAVEDCPPFLAGS"
  404. fi
  405. dnl Check for crypto lib
  406. _SAVEDLIBS="$LIBS"
  407. AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
  408. if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
  409. dnl Check for SSL lib
  410. 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)
  411. fi
  412. LIBS="$_SAVEDLIBS"
  413. dnl test headers and libs to decide whether check_http should use SSL
  414. if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
  415. if test "$ac_cv_lib_ssl_main" = "yes"; then
  416. if test "$FOUNDINCLUDE" = "yes"; then
  417. AC_SUBST(SSLLIBS)
  418. AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
  419. fi
  420. fi
  421. fi
  422. CPPFLAGS="$_SAVEDCPPFLAGS"
  423. dnl
  424. dnl Checks for header files.
  425. dnl
  426. AC_HEADER_STDC
  427. AC_HEADER_TIME
  428. AC_HEADER_SYS_WAIT
  429. 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)
  430. AC_CHECK_HEADERS(stdarg.h sys/unistd.h unistd.h ctype.h stdlib.h)
  431. dnl Linux
  432. AC_CHECK_HEADERS(sys/vfs.h,
  433. [AC_TRY_COMPILE([#include <sys/vfs.h>],
  434. [struct statfs buf; long foo; statfs ("/", &buf); foo = buf.f_namelen;],
  435. [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
  436. dnl FreeBSD
  437. AC_CHECK_HEADERS(sys/param.h sys/mount.h,
  438. [AC_TRY_COMPILE([#include <sys/param.h>
  439. #include <sys/mount.h>],
  440. [struct statfs buf; int foo; statfs ("/", &buf); foo = buf.f_flags;],
  441. [AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if statfs struct can be found])])])
  442. dnl Checks for typedefs, structures, and compiler characteristics.
  443. AC_C_CONST
  444. AC_STRUCT_TM
  445. AC_TYPE_PID_T
  446. AC_TYPE_SIZE_T
  447. AC_TYPE_SIGNAL
  448. AC_CHECK_SIZEOF(int,cross)
  449. AC_CHECK_SIZEOF(long,cross)
  450. AC_CHECK_SIZEOF(short,cross)
  451. AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
  452. AC_TRY_RUN([#include <stdio.h>
  453. main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
  454. ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
  455. if test x"$ac_cv_have_longlong" = x"yes"; then
  456. AC_DEFINE(HAVE_LONGLONG,1,[Define if system has long long type])
  457. fi
  458. #
  459. # Check if the compiler supports the LL prefix on long long integers.
  460. # AIX needs this.
  461. AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
  462. AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
  463. ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
  464. if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
  465. AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Define if compiler support long long])
  466. fi
  467. AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE_VA_COPY,[
  468. AC_TRY_LINK([#include <stdarg.h>
  469. va_list ap1,ap2;], [__va_copy(ap1,ap2);],
  470. ac_cv_HAVE_VA_COPY=yes,ac_cv_HAVE_VA_COPY=no)])
  471. if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
  472. AC_DEFINE(HAVE_VA_COPY,1,[Define if system has va_copy])
  473. fi
  474. AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
  475. AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
  476. AC_TRY_RUN([
  477. #include <sys/types.h>
  478. #include <stdarg.h>
  479. void foo(const char *format, ...) {
  480. va_list ap;
  481. int len;
  482. char buf[5];
  483. va_start(ap, format);
  484. len = vsnprintf(buf, 0, format, ap);
  485. va_end(ap);
  486. if (len != 5) exit(1);
  487. va_start(ap, format);
  488. len = vsnprintf(0, 0, format, ap);
  489. va_end(ap);
  490. if (len != 5) exit(1);
  491. if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
  492. exit(0);
  493. }
  494. main() { foo("hello"); }
  495. ],
  496. ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
  497. if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
  498. AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
  499. fi
  500. AC_TRY_COMPILE([#include <sys/time.h>],
  501. [struct timeval *tv;
  502. struct timezone *tz;],
  503. AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
  504. AC_TRY_COMPILE([#include <sys/time.h>],
  505. [struct timeval *tv;
  506. struct timezone *tz;
  507. gettimeofday(tv, tz);],
  508. AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
  509. AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
  510. dnl Checks for library functions.
  511. AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
  512. AC_MSG_CHECKING(return type of socket size)
  513. AC_TRY_COMPILE([#include <stdlib.h>
  514. #include <sys/types.h>
  515. #include <sys/socket.h>],
  516. [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
  517. ac_cv_socket_size_type=["size_t"]
  518. AC_MSG_RESULT(size_t),
  519. ac_cv_socket_size_type=["int"]
  520. AC_MSG_RESULT(int))
  521. AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
  522. [Define type of socket size])
  523. if test -f "/proc/loadavg"
  524. then
  525. AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
  526. AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
  527. fi
  528. dnl #### Process table test
  529. AC_PATH_PROG(PATH_TO_PS,ps)
  530. ac_cv_use_ps_vars=no
  531. AC_MSG_CHECKING(for ps syntax)
  532. dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
  533. if ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  534. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  535. then
  536. ac_cv_use_ps_vars=yes
  537. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  538. ac_cv_ps_raw_command="$PATH_TO_PS -weo 'stat user ppid args'"
  539. ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid comm args'"
  540. ac_cv_ps_format="%s %d %d %s %n"
  541. ac_cv_vsz_command="$PATH_TO_PS -weo 'vsz comm'"
  542. ac_cv_vsz_format="%d %s"
  543. ac_cv_rss_command="$PATH_TO_PS -weo 'rss comm'"
  544. ac_cv_rss_format="%d %s"
  545. EXTRAS="$EXTRAS check_nagios"
  546. AC_MSG_RESULT([$ac_cv_ps_command])
  547. dnl FreeBSD
  548. elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
  549. egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
  550. then
  551. ac_cv_use_ps_vars=yes
  552. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  553. ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
  554. ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid command command'"
  555. ac_cv_ps_format="%s %d %d %s %n"
  556. ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
  557. ac_cv_vsz_format="%d %s"
  558. ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
  559. ac_cv_rss_format="%d %s"
  560. EXTRAS="$EXTRAS check_nagios"
  561. AC_MSG_RESULT([$ac_cv_ps_command])
  562. dnl BSD-like mode in RH 6.1
  563. elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
  564. egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  565. then
  566. ac_cv_use_ps_vars=yes
  567. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  568. ac_cv_ps_raw_command="$PATH_TO_PS waxno 'state user ppid comm'"
  569. ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid comm args'"
  570. ac_cv_ps_format="%s %d %d %s %n"
  571. ac_cv_vsz_command="$PATH_TO_PS waxno 'vsz comm'"
  572. ac_cv_vsz_format="%d %s"
  573. ac_cv_rss_command="$PATH_TO_PS waxno 'rss comm'"
  574. ac_cv_rss_format="%d %s"
  575. EXTRAS="$EXTRAS check_nagios"
  576. AC_MSG_RESULT([$ac_cv_ps_command])
  577. dnl SunOS 4.1.3:
  578. dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
  579. elif ps -laxnwww 2>/dev/null | \
  580. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
  581. then
  582. ac_cv_use_ps_vars=yes
  583. ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
  584. ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
  585. ac_cv_ps_command="$PATH_TO_PS -laxnwww"
  586. ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %*s %s %*s %*s %n%s"
  587. ac_cv_vsz_command="$PATH_TO_PS laxnwww"
  588. ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %d"
  589. ac_cv_rss_command="$PATH_TO_PS laxnwww"
  590. ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %d"
  591. EXTRAS="$EXTRAS check_nagios"
  592. AC_MSG_RESULT([$ac_cv_ps_command])
  593. dnl Debian Linux / procps v1.2.9:
  594. dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
  595. dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
  596. dnl
  597. elif ps laxnwww 2>/dev/null | \
  598. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
  599. then
  600. ac_cv_use_ps_vars=yes
  601. ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
  602. ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
  603. ac_cv_ps_command="$PATH_TO_PS laxnwww"
  604. ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
  605. ac_cv_vsz_command="$PATH_TO_PS laxnwww"
  606. ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
  607. ac_cv_rss_command="$PATH_TO_PS laxnwww"
  608. ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
  609. EXTRAS="$EXTRAS check_nagios"
  610. AC_MSG_RESULT([$ac_cv_ps_command])
  611. dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
  612. elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  613. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  614. then
  615. ac_cv_use_ps_vars=yes
  616. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  617. ac_cv_ps_raw_command="$PATH_TO_PS -axo 'stat user ppid args'"
  618. ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid comm args'"
  619. ac_cv_ps_format="%s %d %d %s %n"
  620. ac_cv_vsz_command="$PATH_TO_PS -axo 'vsz comm'"
  621. ac_cv_vsz_format="%d %s"
  622. ac_cv_rss_command="$PATH_TO_PS -axo 'rss comm'"
  623. ac_cv_rss_format="%d %s"
  624. EXTRAS="$EXTRAS check_nagios"
  625. AC_MSG_RESULT([$ac_cv_ps_command])
  626. dnl AIX 4.3.3 - needs verification. This works for Tru64 - needs %*[ +] in PS_FORMAT
  627. elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  628. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  629. then
  630. ac_cv_use_ps_vars=yes
  631. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  632. ac_cv_ps_raw_command="$PATH_TO_PS -ao 'stat user ppid args'"
  633. ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid comm args'"
  634. ac_cv_ps_format="[["%s%*[ +] %d %d %s %n"]]"
  635. ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz comm'"
  636. ac_cv_vsz_format="%d %s"
  637. ac_cv_rss_command="$PATH_TO_PS -ao 'rss comm'"
  638. ac_cv_rss_format="%d %s"
  639. EXTRAS="$EXTRAS check_nagios"
  640. AC_MSG_RESULT([$ac_cv_ps_command])
  641. elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
  642. egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  643. then
  644. ac_cv_use_ps_vars=yes
  645. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  646. ac_cv_ps_raw_command="$PATH_TO_PS -eo 's user ppid args'"
  647. ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid comm args'"
  648. ac_cv_ps_format="%s %d %d %s %n"
  649. ac_cv_vsz_command="$PATH_TO_PS -eo 'vsz comm'"
  650. ac_cv_vsz_format="%d %s"
  651. ac_cv_rss_command="$PATH_TO_PS -eo 'rss comm'"
  652. ac_cv_rss_format="%d %s"
  653. EXTRAS="$EXTRAS check_nagios"
  654. AC_MSG_RESULT([$ac_cv_ps_command])
  655. elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
  656. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  657. then
  658. ac_cv_use_ps_vars=yes
  659. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  660. ac_cv_ps_raw_command="$PATH_TO_PS -Ao 's user ppid args'"
  661. ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid comm args'"
  662. ac_cv_ps_format="%s %d %d %s %n"
  663. ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
  664. ac_cv_vsz_format="%d %s"
  665. ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
  666. ac_cv_rss_format="%d %s"
  667. EXTRAS="$EXTRAS check_nagios"
  668. AC_MSG_RESULT([$ac_cv_ps_command])
  669. elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
  670. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  671. then
  672. ac_cv_use_ps_vars=yes
  673. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  674. ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'status user ppid args'"
  675. ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid comm args'"
  676. ac_cv_ps_format="%s %d %d %s %n"
  677. ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
  678. ac_cv_vsz_format="%d %s"
  679. ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
  680. ac_cv_rss_format="%d %s"
  681. EXTRAS="$EXTRAS check_nagios"
  682. AC_MSG_RESULT([$ac_cv_ps_command])
  683. elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
  684. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  685. then
  686. ac_cv_use_ps_vars=yes
  687. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  688. ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'state user ppid args'"
  689. ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid comm args'"
  690. ac_cv_ps_format="%s %d %d %s %n"
  691. ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
  692. ac_cv_vsz_format="%d %s"
  693. ac_cv_rss_command="$PATH_TO_PS -Ao 'rss comm'"
  694. ac_cv_rss_format="%d %s"
  695. EXTRAS="$EXTRAS check_nagios"
  696. AC_MSG_RESULT([$ac_cv_ps_command])
  697. dnl wonder who takes state instead of stat
  698. elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
  699. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  700. then
  701. ac_cv_use_ps_vars=yes
  702. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  703. ac_cv_ps_raw_command="$PATH_TO_PS -ao 'state user ppid args'"
  704. ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid command args'"
  705. ac_cv_ps_format="%s %d %d %s %n"
  706. ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz command'"
  707. ac_cv_vsz_format="%d %s"
  708. ac_cv_rss_command="$PATH_TO_PS -ao 'rss command'"
  709. ac_cv_rss_format="%d %s"
  710. EXTRAS="$EXTRAS check_nagios"
  711. AC_MSG_RESULT([$ac_cv_ps_command])
  712. dnl IRIX 53
  713. elif ps -el 2>/dev/null | \
  714. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  715. then
  716. ac_cv_use_ps_vars=yes
  717. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  718. ac_cv_ps_command="$PATH_TO_PS -el"
  719. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  720. ac_cv_vsz_command="$PATH_TO_PS -el"
  721. ac_cv_vsz_format="%*s %*s %*s %*s %d"
  722. ac_cv_rss_command="$PATH_TO_PS -el"
  723. ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
  724. AC_MSG_RESULT([$ac_cv_ps_command])
  725. dnl IRIX 63
  726. elif ps -el 2>/dev/null | \
  727. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  728. then
  729. ac_cv_use_ps_vars=yes
  730. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  731. ac_cv_ps_command="$PATH_TO_PS -el"
  732. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  733. ac_cv_vsz_command="$PATH_TO_PS -el"
  734. ac_cv_vsz_format="%*s %*s %*s %*s %d"
  735. ac_cv_rss_command="$PATH_TO_PS -el"
  736. ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
  737. AC_MSG_RESULT([$ac_cv_ps_command])
  738. dnl AIX 4.1:
  739. dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
  740. dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
  741. elif ps -el 2>/dev/null | \
  742. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  743. then
  744. ac_cv_use_ps_vars=yes
  745. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  746. ac_cv_ps_command="$PATH_TO_PS -el"
  747. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  748. ac_cv_vsz_command="$PATH_TO_PS -el"
  749. ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
  750. ac_cv_rss_command="$PATH_TO_PS -el"
  751. ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %*s %*s %d"
  752. AC_MSG_RESULT([$ac_cv_ps_command])
  753. dnl AIX?
  754. elif ps glaxen 2>/dev/null | \
  755. egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
  756. then
  757. ac_cv_use_ps_vars=yes
  758. ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
  759. ac_cv_ps_command="$PATH_TO_PS glaxen"
  760. ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
  761. ac_cv_vsz_command="$PATH_TO_PS glaxen"
  762. ac_cv_vsz_format="%*s %*s %*s %*s %*s %*s %d"
  763. ac_cv_rss_command="$PATH_TO_PS glaxen"
  764. ac_cv_rss_format="%*s %*s %*s %*s %*s %*s %*s %d"
  765. AC_MSG_RESULT([$ac_cv_ps_command])
  766. dnl MacOSX / Darwin
  767. dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
  768. dnl STAT VSZ RSS UID USER PPID UCOMM COMMAND
  769. dnl Ss 1308 272 0 root 0 init /sbin/init
  770. elif ps waxo 'state vsz rss uid user ppid ucomm command' 2>/dev/null | \
  771. egrep -i ["^STAT +VSZ +RSS +UID +USER +PPID +UCOMM +COMMAND"] >/dev/null
  772. then
  773. ac_cv_use_ps_vars=yes
  774. ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
  775. ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
  776. ac_cv_ps_command="$PATH_TO_PS waxo 'state uid ppid ucomm command'"
  777. ac_cv_ps_format="%s %d %d %s %n"
  778. ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
  779. ac_cv_vsz_format="%d %s"
  780. ac_cv_rss_command="$PATH_TO_PS waxco 'rss command'"
  781. ac_cv_rss_format="%d %s"
  782. EXTRAS="$EXTRAS check_nagios"
  783. AC_MSG_RESULT([$ac_cv_ps_command])
  784. dnl UnixWare
  785. elif ps -Al 2>/dev/null | \
  786. egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
  787. then
  788. ac_cv_use_ps_vars=yes
  789. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  790. ac_cv_ps_command="$PATH_TO_PS -Al"
  791. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  792. if ps -Ao 'vsz comm' 2>/dev/null | \
  793. egrep -i ["^ *VSZ +COMMAND"] >/dev/null
  794. then
  795. ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
  796. ac_cv_vsz_format="%*s %d"
  797. fi
  798. AC_MSG_RESULT([$ac_cv_ps_command])
  799. else
  800. AC_MSG_WARN([unable to find usable ps syntax])
  801. fi
  802. if test "x$ac_cv_use_ps_vars" != "xno"
  803. then
  804. AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
  805. fi
  806. AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
  807. [Variable list for sscanf of 'ps' output])
  808. AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$ac_cv_ps_raw_command",
  809. [Verbatim command to execute for ps in check_netsaint])
  810. AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
  811. [Verbatim command to execute for ps in check_procs])
  812. AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
  813. [Format string for scanning ps output in check_procs])
  814. AC_DEFINE_UNQUOTED(VSZ_COMMAND,"$ac_cv_vsz_command",
  815. [Verbatim command to execute for ps in check_vsz])
  816. AC_DEFINE_UNQUOTED(VSZ_FORMAT,"$ac_cv_vsz_format",
  817. [Format string for scanning ps output in check_vsz])
  818. AC_DEFINE_UNQUOTED(RSS_COMMAND,"$ac_cv_rss_command",
  819. [Verbatim command to execute for ps in check_rss])
  820. AC_DEFINE_UNQUOTED(RSS_FORMAT,"$ac_cv_rss_format",
  821. [Format string for scanning ps output in check_rss])
  822. AC_PATH_PROG(PATH_TO_DF,df)
  823. AC_PATH_PROG(PATH_TO_BDF,bdf)
  824. AC_ARG_WITH(df_command,
  825. ACX_HELP_STRING([--with-df-command=SYNTAX],
  826. [sets syntax for df]),
  827. with_df_command=$withval,)
  828. AC_MSG_CHECKING(for df syntax)
  829. if test -n "$with_df_command"
  830. then
  831. AC_MSG_RESULT([$with_df_command])
  832. 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
  833. then
  834. with_df_command="$PATH_TO_DF -Pk"
  835. AC_MSG_RESULT([$with_df_command])
  836. 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
  837. then
  838. with_df_command="$PATH_TO_DF -k"
  839. AC_MSG_RESULT([$with_df_command])
  840. elif df 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
  841. then
  842. with_df_command="$PATH_TO_DF"
  843. AC_MSG_RESULT([$with_df_command])
  844. elif bdf 2>/dev/null | egrep -i ["^/dev/[a-z0-9/]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+% +/[a-z0-9/]*"] >/dev/null
  845. then
  846. with_df_command="$PATH_TO_BDF"
  847. AC_MSG_RESULT([$with_df_command])
  848. else
  849. AC_MSG_WARN([unable to find usable df syntax])
  850. fi
  851. AC_DEFINE_UNQUOTED(DF_COMMAND,"$with_df_command",[path and args for df command])
  852. AC_PATH_PROG(PATH_TO_PING,ping)
  853. AC_PATH_PROG(PATH_TO_PING6,ping6)
  854. AC_ARG_WITH(ping_command,
  855. ACX_HELP_STRING([--with-ping-command=SYNTAX],
  856. [sets syntax for ICMP ping]),
  857. with_ping_command=$withval,)
  858. AC_MSG_CHECKING(for ICMP ping syntax)
  859. ac_cv_ping_packets_first=no
  860. if test -n "$with_ping_command"
  861. then
  862. AC_MSG_RESULT([(command-line) $with_ping_command])
  863. if test -n "$ac_cv_ping_packets_first"
  864. then
  865. ac_cv_ping_packets_first=yes
  866. fi
  867. elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  868. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  869. egrep -i "^round-trip|^rtt" >/dev/null
  870. then
  871. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  872. ac_cv_ping_packets_first=yes
  873. AC_MSG_RESULT([$with_ping_command])
  874. elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
  875. egrep -i "^round-trip|^rtt" >/dev/null
  876. then
  877. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  878. ac_cv_ping_packets_first=yes
  879. AC_MSG_RESULT([$with_ping_command])
  880. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  881. egrep -i "^round-trip|^rtt" >/dev/null
  882. then
  883. with_ping_command="$PATH_TO_PING -n -c %d %s"
  884. ac_cv_ping_packets_first=yes
  885. AC_MSG_RESULT([$with_ping_command])
  886. elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
  887. egrep -i "^round-trip|^rtt" >/dev/null
  888. then
  889. with_ping_command="$PATH_TO_PING -n %s -c %d"
  890. AC_MSG_RESULT([$with_ping_command])
  891. elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
  892. egrep -i "^round-trip|^rtt" >/dev/null
  893. then
  894. with_ping_command="$PATH_TO_PING %s -n %d"
  895. AC_MSG_RESULT([$with_ping_command])
  896. elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  897. egrep -i "^round-trip|^rtt" >/dev/null
  898. then
  899. with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
  900. AC_MSG_RESULT([$with_ping_command])
  901. elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
  902. egrep -i "^round-trip|^rtt" >/dev/null
  903. then
  904. with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
  905. AC_MSG_RESULT([$with_ping_command])
  906. elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
  907. egrep -i "^round-trip|^rtt" >/dev/null
  908. then
  909. with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
  910. ac_cv_ping_packets_first=yes
  911. AC_MSG_RESULT([$with_ping_command])
  912. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  913. egrep -i "^round-trip|^rtt" >/dev/null
  914. then
  915. with_ping_command="$PATH_TO_PING -n -c %d %s"
  916. ac_cv_ping_packets_first=yes
  917. AC_MSG_RESULT([$with_ping_command])
  918. else
  919. AC_MSG_WARN([unable to find usable ping syntax])
  920. fi
  921. AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
  922. [path and args for ICMP ping command])
  923. if test "x$ac_cv_ping_packets_first" != "xno"
  924. then
  925. AC_DEFINE(PING_PACKETS_FIRST,1,
  926. [Define if packet count must precede host])
  927. fi
  928. AC_ARG_WITH(ping6_command,
  929. ACX_HELP_STRING([--with-ping6-command=SYNTAX],
  930. [sets syntax for ICMPv6 ping]),
  931. with_ping6_command=$withval,)
  932. if test x"$with_ipv6" != xno ; then
  933. AC_MSG_CHECKING(for ICMPv6 ping syntax)
  934. ac_cv_ping6_packets_first=no
  935. if test -n "$with_ping6_command"
  936. then
  937. AC_MSG_RESULT([(command-line) $with_ping6_command])
  938. if test -n "$ac_cv_ping6_packets_first"
  939. then
  940. ac_cv_ping6_packets_first=yes
  941. fi
  942. elif test "x$PATH_TO_PING6" != "x"; then
  943. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  944. $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  945. egrep -i "^round-trip|^rtt" >/dev/null
  946. then
  947. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  948. ac_cv_ping6_packets_first=yes
  949. AC_MSG_RESULT([$with_ping6_command])
  950. elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
  951. egrep -i "^round-trip|^rtt" >/dev/null
  952. then
  953. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  954. ac_cv_ping6_packets_first=yes
  955. AC_MSG_RESULT([$with_ping6_command])
  956. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  957. egrep -i "^round-trip|^rtt" >/dev/null
  958. then
  959. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  960. ac_cv_ping6_packets_first=yes
  961. AC_MSG_RESULT([$with_ping6_command])
  962. elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
  963. egrep -i "^round-trip|^rtt" >/dev/null
  964. then
  965. with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
  966. AC_MSG_RESULT([$with_ping6_command])
  967. elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
  968. egrep -i "^round-trip|^rtt" >/dev/null
  969. then
  970. with_ping6_command="$PATH_TO_PING6 %s -n %d"
  971. AC_MSG_RESULT([$with_ping6_command])
  972. elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  973. egrep -i "^round-trip|^rtt" >/dev/null
  974. then
  975. with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
  976. AC_MSG_RESULT([$with_ping6_command])
  977. elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  978. egrep -i "^round-trip|^rtt" >/dev/null
  979. then
  980. with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
  981. AC_MSG_RESULT([$with_ping6_command])
  982. elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
  983. egrep -i "^round-trip|^rtt" >/dev/null
  984. then
  985. with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
  986. ac_cv_ping6_packets_first=yes
  987. AC_MSG_RESULT([$with_ping_command])
  988. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  989. egrep -i "^round-trip|^rtt" >/dev/null
  990. then
  991. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  992. ac_cv_ping6_packets_first=yes
  993. AC_MSG_RESULT([$with_ping6_command])
  994. fi
  995. elif test "x$PATH_TO_PING" != "x"; then
  996. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  997. $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  998. egrep -i "^round-trip|^rtt" >/dev/null
  999. then
  1000. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  1001. ac_cv_ping6_packets_first=yes
  1002. AC_MSG_RESULT([$with_ping6_command])
  1003. elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
  1004. egrep -i "^round-trip|^rtt" >/dev/null
  1005. then
  1006. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  1007. ac_cv_ping6_packets_first=yes
  1008. AC_MSG_RESULT([$with_ping6_command])
  1009. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  1010. egrep -i "^round-trip|^rtt" >/dev/null
  1011. then
  1012. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  1013. ac_cv_ping6_packets_first=yes
  1014. AC_MSG_RESULT([$with_ping6_command])
  1015. elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
  1016. egrep -i "^round-trip|^rtt" >/dev/null
  1017. then
  1018. with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
  1019. AC_MSG_RESULT([$with_ping6_command])
  1020. elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
  1021. egrep -i "^round-trip|^rtt" >/dev/null
  1022. then
  1023. with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
  1024. AC_MSG_RESULT([$with_ping6_command])
  1025. elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  1026. egrep -i "^round-trip|^rtt" >/dev/null
  1027. then
  1028. with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
  1029. AC_MSG_RESULT([$with_ping6_command])
  1030. elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  1031. egrep -i "^round-trip|^rtt" >/dev/null
  1032. then
  1033. with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
  1034. AC_MSG_RESULT([$with_ping6_command])
  1035. elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
  1036. egrep -i "^round-trip|^rtt" >/dev/null
  1037. then
  1038. with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
  1039. ac_cv_ping6_packets_first=yes
  1040. AC_MSG_RESULT([$with_ping_command])
  1041. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  1042. egrep -i "^round-trip|^rtt" >/dev/null
  1043. then
  1044. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  1045. ac_cv_ping6_packets_first=yes
  1046. AC_MSG_RESULT([$with_ping6_command])
  1047. fi
  1048. fi
  1049. if test "x$with_ping6_command" != "x"; then
  1050. AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
  1051. [path and args for ICMPv6 ping command])
  1052. else
  1053. AC_MSG_RESULT([none])
  1054. fi
  1055. if test "x$ac_cv_ping6_packets_first" != "xno"; then
  1056. AC_DEFINE(PING6_PACKETS_FIRST,1,
  1057. [Define if packet count must precede host])
  1058. fi
  1059. fi
  1060. AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
  1061. AC_MSG_CHECKING(for nslookup syntax)
  1062. if test -n "$PATH_TO_NSLOOKUP"
  1063. then
  1064. if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
  1065. then
  1066. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
  1067. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1068. else
  1069. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
  1070. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1071. fi
  1072. EXTRAS="$EXTRAS check_dns"
  1073. else
  1074. AC_MSG_WARN([nslookup command not found])
  1075. fi
  1076. AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
  1077. [path and args for nslookup])
  1078. AC_PATH_PROG(PATH_TO_HOST,host)
  1079. if test -n "$ac_cv_path_PATH_TO_HOST"
  1080. then
  1081. EXTRAS="$EXTRAS check_dns"
  1082. fi
  1083. AC_PATH_PROG(PATH_TO_UPTIME,uptime)
  1084. AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
  1085. AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
  1086. AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
  1087. AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
  1088. AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
  1089. AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
  1090. if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
  1091. then
  1092. AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
  1093. AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
  1094. else
  1095. AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
  1096. fi
  1097. AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
  1098. if test -x "$PATH_TO_LMSTAT"
  1099. then
  1100. AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
  1101. else
  1102. AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
  1103. fi
  1104. AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
  1105. if test -x "$PATH_TO_SMBCLIENT"
  1106. then
  1107. AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
  1108. else
  1109. AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
  1110. fi
  1111. AC_PATH_PROG(PATH_TO_WHO,who)
  1112. if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
  1113. then
  1114. ac_cv_path_to_who="$PATH_TO_WHO -q"
  1115. else
  1116. ac_cv_path_to_who="$PATH_TO_WHO"
  1117. fi
  1118. AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
  1119. [path and arguments for invoking 'who'])
  1120. AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
  1121. if test -x "$PATH_TO_SNMPGET"
  1122. then
  1123. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
  1124. EXTRAS="$EXTRAS check_hpjd check_snmp"
  1125. else
  1126. AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
  1127. fi
  1128. AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
  1129. if test -x "$PATH_TO_SNMPGETNEXT"
  1130. then
  1131. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
  1132. fi
  1133. if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
  1134. then
  1135. AC_MSG_CHECKING(for Net::SNMP perl module)
  1136. AC_MSG_RESULT([found])
  1137. else
  1138. AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
  1139. fi
  1140. AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
  1141. AC_PATH_PROG(PATH_TO_QSTAT,qstat)
  1142. if test -x "$PATH_TO_QUAKESTAT"
  1143. then
  1144. ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
  1145. EXTRAS="$EXTRAS check_game"
  1146. elif test -x "$PATH_TO_QSTAT"
  1147. then
  1148. ac_cv_path_to_qstat="$PATH_TO_QSTAT"
  1149. EXTRAS="$EXTRAS check_game"
  1150. else
  1151. AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
  1152. fi
  1153. if test $ac_cv_path_to_qstat
  1154. then
  1155. AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
  1156. [path to qstat/quakestat])
  1157. fi
  1158. AC_PATH_PROG(PATH_TO_FPING,fping)
  1159. if test -x "$PATH_TO_FPING"
  1160. then
  1161. AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
  1162. EXTRAS="$EXTRAS check_fping"
  1163. else
  1164. AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
  1165. fi
  1166. AC_PATH_PROG(PATH_TO_SSH,ssh)
  1167. if test -x "$PATH_TO_SSH"
  1168. then
  1169. AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
  1170. EXTRAS="$EXTRAS check_by_ssh"
  1171. else
  1172. AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
  1173. fi
  1174. AC_PATH_PROG(PATH_TO_MAILQ,mailq)
  1175. if test -x "$PATH_TO_MAILQ"
  1176. then
  1177. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
  1178. else
  1179. AC_MSG_WARN([Could not find mailq or eqivalent])
  1180. fi
  1181. dnl SWAP info required is amount allocated/available and amount free
  1182. dnl The plugin works through all the swap devices and adds up the total swap
  1183. dnl available.
  1184. dnl dunno why this does not work below - use hack (kbd)
  1185. dnl fine on linux, broken on solaris
  1186. dnl if /bin/test -e "/proc/meminfo"
  1187. AC_PATH_PROG(PATH_TO_SWAP,swap)
  1188. AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
  1189. AC_MSG_CHECKING(for how to check memory)
  1190. if [cat /proc/meminfo > /dev/null 2>&1]
  1191. then
  1192. AC_MSG_RESULT([found /proc/meminfo])
  1193. AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
  1194. AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
  1195. EXTRAS="$EXTRAS check_swap"
  1196. elif [$PATH_TO_SWAP -l 2>&1 >/dev/null]
  1197. then
  1198. ac_cv_have_swap=yes
  1199. ac_cv_swap_command="$PATH_TO_SWAP -l"
  1200. if [$PATH_TO_SWAP -l 2>/dev/null | \
  1201. egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
  1202. >/dev/null]
  1203. then
  1204. ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
  1205. AC_MSG_RESULT([using IRIX format swap])
  1206. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null]
  1207. then
  1208. ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
  1209. AC_MSG_RESULT([using Solaris format swap])
  1210. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
  1211. then
  1212. ac_cv_swap_format=["%*s %*[[0-9,-]] %*d %d %d"]
  1213. AC_MSG_RESULT([using Unixware format swap])
  1214. fi
  1215. EXTRAS="$EXTRAS check_swap"
  1216. elif [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
  1217. then
  1218. ac_cv_have_swap=yes
  1219. ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
  1220. if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
  1221. then
  1222. ac_cv_swap_format=["%*s %d %*d %d"]
  1223. AC_MSG_RESULT([using FreeBSD format swapinfo])
  1224. fi
  1225. EXTRAS="$EXTRAS check_swap"
  1226. elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
  1227. then
  1228. ac_cv_have_swap=yes
  1229. ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
  1230. ac_cv_swap_format=["%*s %d %*d %d"]
  1231. AC_MSG_RESULT([using HP-UX format swapinfo])
  1232. fi
  1233. if test x$ac_cv_have_swap != x
  1234. then
  1235. AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
  1236. fi
  1237. AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
  1238. [Format string for parsing swap output])
  1239. if test "x$ac_cv_swap_command" != "x"
  1240. then
  1241. AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
  1242. [Path to swap/swapinfo binary, with any args])
  1243. fi
  1244. AC_PATH_PROG(PATH_TO_DIG,dig)
  1245. AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
  1246. if test -n "$PATH_TO_DIG"; then
  1247. EXTRAS="$EXTRAS check_dig"
  1248. fi
  1249. if test -f plugins/check_nt.c ; then
  1250. EXTRAS="$EXTRAS check_nt"
  1251. elif test -f ../plugins/check_nt.c ; then
  1252. EXTRAS="$EXTRAS check_nt"
  1253. fi
  1254. AC_MSG_CHECKING(for va_list)
  1255. AC_TRY_COMPILE([#ifdef __STDC__
  1256. #include <stdio.h>
  1257. #include <stdlib.h>
  1258. #include <stdarg.h>
  1259. #else
  1260. #include <sys/types.h>
  1261. #include <stdio.h>
  1262. #include <varargs.h>
  1263. #endif],
  1264. [va_list args;],
  1265. [AC_MSG_RESULT(yes)],
  1266. [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
  1267. AC_SUBST(EXTRAS)
  1268. AC_SUBST(DEPLIBS)
  1269. AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
  1270. 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)
  1271. ACX_FEATURE([with],[cgiurl])
  1272. ACX_FEATURE([with],[nagios-user])
  1273. ACX_FEATURE([with],[nagios-group])
  1274. ACX_FEATURE([with],[trusted-path])
  1275. ACX_FEATURE([with],[df-command])
  1276. ACX_FEATURE([with],[ping-command])
  1277. ACX_FEATURE([with],[ping6-command])
  1278. ACX_FEATURE([with],[lwres])
  1279. ACX_FEATURE([with],[ipv6])
  1280. ACX_FEATURE([enable],[emulate-getaddrinfo])