configure.in 49 KB

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