configure.in 47 KB

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