configure.in 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_REVISION ($Revision$)
  3. AC_PREREQ(2.58)
  4. AC_INIT(nagios-plugins,1.4.2)
  5. AC_CONFIG_SRCDIR(NPTest.pm)
  6. AM_INIT_AUTOMAKE
  7. AM_CONFIG_HEADER(config.h)
  8. AC_CANONICAL_HOST
  9. RELEASE=1
  10. AC_SUBST(RELEASE)
  11. AC_PREFIX_DEFAULT(/usr/local/nagios)
  12. dnl Figure out how to invoke "install" and what install options to use.
  13. AC_PROG_INSTALL
  14. AC_SUBST(INSTALL)
  15. dnl Must come very early on due to coreutils requirement
  16. dnl Takes care of AC_GNU_SOURCE, AC_AIX and AC_MINIX
  17. gl_USE_SYSTEM_EXTENSIONS
  18. AC_PROG_CC
  19. AC_PROG_CPP
  20. AC_PROG_GCC_TRADITIONAL
  21. AC_PROG_RANLIB
  22. AC_PROG_MAKE_SET
  23. AC_PROG_AWK
  24. AC_FUNC_MALLOC
  25. AC_FUNC_REALLOC
  26. AC_FUNC_ERROR_AT_LINE
  27. AC_CONFIG_LIBOBJ_DIR(lib)
  28. AC_FUNC_GETLOADAVG([lib])
  29. ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
  30. dnl AM_WITH_REGEX
  31. PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
  32. AC_SUBST(PLUGIN_TEST)dnl
  33. SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
  34. AC_SUBST(SCRIPT_TEST)dnl
  35. 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"
  36. AC_SUBST(WARRANTY)
  37. 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,\nuse output from the --version option of the plugin itself).\n"
  38. AC_SUBST(SUPPORT)
  39. dnl CGIURL has changed for Nagios with 1.0 beta
  40. AC_ARG_WITH(cgiurl,
  41. ACX_HELP_STRING([--with-cgiurl=DIR],
  42. [sets URL for cgi programs]),
  43. with_cgiurl=$withval,
  44. with_cgiurl=/nagios/cgi-bin)
  45. CGIURL="$with_cgiurl"
  46. AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
  47. AC_ARG_WITH(nagios_user,
  48. ACX_HELP_STRING([--with-nagios-user=USER],
  49. [set user name to run nagios]),
  50. with_nagios_user=$withval,
  51. with_nagios_user=nagios)
  52. AC_ARG_WITH(nagios_group,
  53. ACX_HELP_STRING([--with-nagios-group=GROUP],
  54. [set group name to run nagios]),
  55. with_nagios_group=$withval,
  56. with_nagios_group=nagios)
  57. AC_SUBST(with_nagios_user)
  58. AC_SUBST(with_nagios_group)
  59. INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
  60. AC_SUBST(INSTALL_OPTS)
  61. AC_ARG_WITH(trusted_path,
  62. ACX_HELP_STRING([--with-trusted-path=PATH],
  63. [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
  64. with_trusted_path=$withval,
  65. with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
  66. AC_SUBST(with_trusted_path)
  67. EXTRAS=
  68. dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
  69. LDFLAGS="$LDFLAGS -L."
  70. ac_cv_uname_m=`uname -m`
  71. ac_cv_uname_s=`uname -s`
  72. ac_cv_uname_r=`uname -r`
  73. ac_cv_uname_v=`uname -v`
  74. PKG_ARCH=`uname -p`
  75. REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
  76. REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
  77. AC_SUBST(PKG_ARCH)
  78. AC_SUBST(REV_DATESTAMP)
  79. AC_SUBST(REV_TIMESTAMP)
  80. dnl Checks for programs.
  81. AC_PATH_PROG(PYTHON,python)
  82. AC_PATH_PROG(SH,sh)
  83. AC_PATH_PROG(PERL,perl)
  84. AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
  85. dnl allow them to override the path of perl
  86. AC_ARG_WITH(perl,
  87. ACX_HELP_STRING([--with-perl=PATH],
  88. [sets path to perl executable]),
  89. with_perl=$withval,with_perl=$PERL)
  90. AC_SUBST(PERL, $with_perl)
  91. dnl allow for gnutls, if it exists, instead of openssl
  92. AC_ARG_WITH(gnutls,
  93. ACX_HELP_STRING([--with-gnutls=PATH],
  94. [path to gnutls installation root]),
  95. GNUTLS=$withval)
  96. AC_PATH_PROG(HOSTNAME,hostname)
  97. AC_PATH_PROG(BASENAME,basename)
  98. dnl
  99. dnl Check for miscellaneous stuff
  100. dnl
  101. case $host_vender-$host_os in
  102. sun*)
  103. AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo])
  104. ;;
  105. osf*)
  106. AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo])
  107. ;;
  108. esac
  109. dnl
  110. dnl Checks for libraries.
  111. dnl
  112. AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
  113. AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
  114. AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
  115. AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
  116. AC_SUBST(SOCKETLIBS)
  117. dnl
  118. dnl check for math-related functions needing -lm
  119. AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
  120. AC_SUBST(MATHLIBS)
  121. dnl Check for PostgreSQL libraries
  122. _SAVEDLIBS="$LIBS"
  123. _SAVEDCPPFLAGS="$CPPFLAGS"
  124. AC_ARG_WITH(pgsql,
  125. ACX_HELP_STRING([--with-pgsql=DIR],
  126. [sets path to pgsql installation]),
  127. PGSQL=$withval,)
  128. AC_CHECK_LIB(crypt,main)
  129. if test "$ac_cv_lib_crypt_main" = "yes"; then
  130. if test -n "$PGSQL"; then
  131. LDFLAGS="$LDFLAGS -L$PGSQL/lib"
  132. CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
  133. fi
  134. AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
  135. if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
  136. AC_CHECK_HEADERS(pgsql/libpq-fe.h)
  137. AC_CHECK_HEADERS(postgresql/libpq-fe.h)
  138. AC_CHECK_HEADERS(libpq-fe.h)
  139. if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
  140. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  141. PGINCLUDE="-I$PGSQL/include"
  142. elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
  143. PGLIBS="-lpq -lcrypt"
  144. PGINCLUDE="-I/usr/include/pgsql"
  145. elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
  146. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  147. PGINCLUDE="-I/usr/include/postgresql"
  148. elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
  149. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  150. PGINCLUDE="-I$PGSQL/include"
  151. fi
  152. if test -z "$PGINCLUDE"; then
  153. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  154. AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
  155. else
  156. AC_SUBST(PGLIBS)
  157. AC_SUBST(PGINCLUDE)
  158. EXTRAS="$EXTRAS check_pgsql"
  159. fi
  160. else
  161. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  162. AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
  163. AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
  164. fi
  165. else
  166. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  167. AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
  168. fi
  169. LIBS="$_SAVEDLIBS"
  170. CPPFLAGS="$_SAVEDCPPFLAGS"
  171. dnl Check for radius libraries
  172. _SAVEDLIBS="$LIBS"
  173. AC_CHECK_LIB(radiusclient,rc_read_config)
  174. if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
  175. EXTRAS="$EXTRAS check_radius"
  176. RADIUSLIBS="-lradiusclient"
  177. AC_SUBST(RADIUSLIBS)
  178. else
  179. AC_MSG_WARN([Skipping radius plugin])
  180. AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
  181. fi
  182. LIBS="$_SAVEDLIBS"
  183. dnl Check for LDAP libraries
  184. _SAVEDLIBS="$LIBS"
  185. AC_CHECK_LIB(ldap,main,,,-llber)
  186. if test "$ac_cv_lib_ldap_main" = "yes"; then
  187. LDAPLIBS="-lldap -llber"\
  188. LDAPINCLUDE="-I/usr/include/ldap"
  189. AC_SUBST(LDAPLIBS)
  190. AC_SUBST(LDAPINCLUDE)
  191. AC_CHECK_FUNCS(ldap_set_option)
  192. EXTRAS="$EXTRAS check_ldap"
  193. AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
  194. else
  195. AC_MSG_WARN([Skipping LDAP plugin])
  196. AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
  197. fi
  198. LIBS="$_SAVEDLIBS"
  199. dnl Check for mysql libraries
  200. _SAVEDLIBS="$LIBS"
  201. _SAVEDCPPFLAGS="$CPPFLAGS"
  202. AC_ARG_WITH(mysql,
  203. ACX_HELP_STRING([--with-mysql=DIR],
  204. [sets path to mysql installation (assumes lib/mysql and include subdirs]),
  205. MYSQL=$withval,)
  206. if test -n "$MYSQL"; then
  207. MYSQLLIBDIR=$MYSQL/lib/mysql
  208. CPPFLAGS="-I$MYSQL/include"
  209. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
  210. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
  211. elif test -f /usr/lib/libmysqlclient.so; then
  212. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
  213. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
  214. elif test -f /usr/lib/libmysqlclient.a; then
  215. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
  216. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
  217. elif test -f /usr/lib/mysql/libmysqlclient.so; then
  218. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
  219. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
  220. elif test -f /usr/lib/mysql/libmysqlclient.a; then
  221. AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz)
  222. AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
  223. fi
  224. if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
  225. AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
  226. if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
  227. EXTRAS="$EXTRAS check_mysql"
  228. AC_SUBST(MYSQLINCLUDE)
  229. AC_SUBST(MYSQLLIBS)
  230. AC_SUBST(check_mysql_LDFLAGS)
  231. else
  232. AC_MSG_WARN([Skipping mysql plugin])
  233. AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).])
  234. fi
  235. else
  236. AC_MSG_WARN([Skipping mysql plugin])
  237. AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
  238. fi
  239. CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE"
  240. LIBS="$_SAVEDLIBS"
  241. AC_CHECK_HEADERS(unistd.h)
  242. dnl Check for AF_INET6 support - unistd.h required for Darwin
  243. AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
  244. AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
  245. #include <unistd.h>
  246. #endif
  247. #include <netinet/in.h>
  248. #include <sys/socket.h>],
  249. [struct sockaddr_in6 sin6;
  250. void *p;
  251. sin6.sin6_family = AF_INET6;
  252. sin6.sin6_port = 587;
  253. p = &sin6.sin6_addr;],
  254. [with_ipv6=yes],
  255. [with_ipv6=no])
  256. ])
  257. if test x"$with_ipv6" != xno ; then
  258. AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
  259. fi
  260. dnl #########################################################################
  261. dnl Check if Posix getaddrinfo() is available. It is also possible to use
  262. dnl the version from the lwres library distributed with BIND.
  263. dnl #########################################################################
  264. AC_ARG_ENABLE([emulate-getaddrinfo],
  265. ACX_HELP_STRING([--enable-emulate-getaddrinfo],
  266. [enable getaddrinfo emulation (default=no)]),
  267. ,
  268. enable_emulate_getaddrinfo=no)
  269. AC_ARG_WITH(lwres,
  270. ACX_HELP_STRING([--with-lwres=DIR],
  271. [use lwres library for getaddrinfo (default=no)]),
  272. ,
  273. with_lwres=no)
  274. dnl ## enable force to test getaddrinfo.c
  275. if test x$enable_emulate_getaddrinfo = xforce ; then
  276. enable_emulate_getaddrinfo=yes
  277. have_getaddrinfo=no
  278. else
  279. have_getaddrinfo=no
  280. if test x$with_lwres != xno ; then
  281. if test "$with_lwres" != yes ; then
  282. CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
  283. LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
  284. fi
  285. AC_CHECK_HEADERS(lwres/netdb.h, ,
  286. [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
  287. AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
  288. [AC_MSG_ERROR([cannot find the lwres library])],
  289. -lnsl -lpthread)
  290. have_getaddrinfo=yes
  291. fi
  292. if test x$have_getaddrinfo != xyes ; then
  293. AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
  294. fi
  295. dnl # Special nonsense for systems that actually have getaddrinfo but
  296. dnl # redefine the name to something else, e.g. OSF
  297. if test x$have_getaddrinfo != xyes ; then
  298. AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
  299. AC_TRY_LINK([
  300. # include <netdb.h>
  301. ], [
  302. struct addrinfo hints, *res;
  303. int err;
  304. err = getaddrinfo ("host", "service", &hints, &res);
  305. ], [
  306. have_getaddrinfo=yes
  307. AC_MSG_RESULT(yes)
  308. ], [AC_MSG_RESULT(no)])
  309. fi
  310. fi
  311. if test x$have_getaddrinfo != xno ; then
  312. if test x$enable_emulate_getaddrinfo != xno ; then
  313. AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
  314. fi
  315. AC_DEFINE(HAVE_GETADDRINFO, 1,
  316. [Does system provide RFC 2553/Posix getaddrinfo?])
  317. else
  318. if test x$enable_emulate_getaddrinfo != xyes ; then
  319. dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
  320. enable_emulate_getaddrinfo=yes
  321. AC_MSG_WARN([enabling getaddrinfo emulation])
  322. fi
  323. EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
  324. fi
  325. if test x"$enable_emulate_getaddrinfo" != xno ; then
  326. have_resolver=no
  327. dnl Try for getipnodebyname
  328. AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
  329. if test x"$have_resolver" != xno ; then
  330. AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
  331. [Set when getipnodebyname is available])
  332. fi
  333. dnl Try for gethostbyname_r
  334. if test x"$have_resolver" = xno ; then
  335. AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
  336. [have_resolver=yes
  337. ACX_WHICH_GETHOSTBYNAME_R])
  338. fi
  339. dnl Try for gethostbyname
  340. if test x"$have_resolver" = xno ; then
  341. if test x"$enable_pthreads" != xno ; then
  342. AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
  343. fi
  344. AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
  345. [AC_MSG_ERROR([cannot find gethostbyname])])
  346. fi
  347. EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
  348. fi
  349. dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
  350. AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
  351. if test "$FOUNDINCLUDE" = "no"; then
  352. _SAVEDCPPFLAGS="$CPPFLAGS"
  353. CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
  354. unset ac_cv_header_krb5_h
  355. AC_CHECK_HEADERS(krb5.h,
  356. KRB5INCLUDE="-I/usr/kerberos/include"
  357. FOUNDINCLUDE=yes,
  358. FOUNDINCLUDE=no)
  359. fi
  360. AC_SUBST(KRBINCLUDE)
  361. if test "$FOUNDINCLUDE" = "no"; then
  362. CPPFLAGS="$_SAVEDCPPFLAGS"
  363. fi
  364. dnl Check for OpenSSL location
  365. AC_PATH_PROG(OPENSSL,openssl)
  366. if test "$OPENSSL" = "/usr/bin/openssl"; then
  367. OPENSSL=/usr
  368. elif test "$OPENSSL" = "/usr/sbin/openssl"; then
  369. OPENSSL=/usr
  370. elif test "$OPENSSL" = "/opt/bin/openssl"; then
  371. OPENSSL=/opt
  372. elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then
  373. OPENSSL=/opt/openssl
  374. elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then
  375. OPENSSL=/usr/slocal
  376. elif test "$OPENSSL" = "/usr/local/bin/openssl"; then
  377. OPENSSL=/usr/local
  378. elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
  379. OPENSSL=/usr/local/ssl
  380. fi
  381. AC_ARG_WITH(openssl,
  382. AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation])
  383. AC_HELP_STRING([--without-openssl], [disable openssl]),
  384. OPENSSL=$withval)
  385. _SAVEDCPPFLAGS="$CPPFLAGS"
  386. _SAVEDLDFLAGS="$LDFLAGS"
  387. if test X"$OPENSSL" = "Xno"; then
  388. AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins])
  389. FOUNDSSL="dontbother"
  390. else
  391. dnl Check for OpenSSL header files
  392. unset FOUNDINCLUDE
  393. if test "$OPENSSL" != "/usr"; then
  394. CPPFLAGS="$CPPFLAGS -I$OPENSSL/include"
  395. LDFLAGS="$LDFLAGS -R$OPENSSL/lib"
  396. fi
  397. AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
  398. SSLINCLUDE="-I$OPENSSL/include"
  399. FOUNDINCLUDE=yes,
  400. FOUNDINCLUDE=no)
  401. if test "$FOUNDINCLUDE" = "no"; then
  402. AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
  403. SSLINCLUDE="-I$OPENSSL/include"
  404. FOUNDINCLUDE=yes,
  405. FOUNDINCLUDE=no)
  406. fi
  407. AC_SUBST(SSLINCLUDE)
  408. if test "$FOUNDINCLUDE" = "no"; then
  409. CPPFLAGS="$_SAVEDCPPFLAGS"
  410. fi
  411. dnl Check for crypto lib
  412. _SAVEDLIBS="$LIBS"
  413. AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib)
  414. if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
  415. dnl Check for SSL lib
  416. 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)
  417. fi
  418. LIBS="$_SAVEDLIBS"
  419. FOUNDSSL="no"
  420. dnl test headers and libs to decide whether check_http should use SSL
  421. if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
  422. if test "$ac_cv_lib_ssl_main" = "yes"; then
  423. if test "$FOUNDINCLUDE" = "yes"; then
  424. FOUNDSSL="yes"
  425. fi
  426. fi
  427. fi
  428. fi
  429. dnl check for gnutls if openssl isn't found (or is disabled)
  430. FOUNDGNUTLS="no"
  431. if ! test "$FOUNDSSL" = "yes" && ! test "$with_gnutls" = "no"; then
  432. if test "$GNUTLS" = ""; then
  433. CPPFLAGS="$CPPFLAGS -I$GNUTLS"
  434. elif ! test "$LIBGNUTLS_CONFIG" = ""; then
  435. CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
  436. fi
  437. AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
  438. if test "$FOUNDGNUTLS" = "yes"; then
  439. AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
  440. FOUNDSSL="yes"
  441. fi
  442. fi
  443. dnl end check for gnutls
  444. if test "$FOUNDSSL" = "yes"; then
  445. check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
  446. AC_SUBST(check_tcp_ssl)
  447. AC_SUBST(SSLLIBS)
  448. AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
  449. if test "$FOUNDGNUTLS" = "no"; then
  450. AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
  451. with_openssl="yes"
  452. with_gnutls="no"
  453. else
  454. AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
  455. with_gnutls="yes"
  456. with_openssl="no"
  457. fi
  458. else
  459. if test "$FOUNDSSL" = "no"; then
  460. AC_MSG_WARN([OpenSSL libs could not be found])
  461. dnl else deliberately disabled
  462. fi
  463. with_openssl="no"
  464. with_gnutls="no"
  465. CPPFLAGS="$_SAVEDCPPFLAGS"
  466. LDFLAGS="$_SAVEDLDFLAGS"
  467. fi
  468. dnl
  469. dnl Checks for header files.
  470. dnl
  471. AC_HEADER_STDC
  472. AC_HEADER_TIME
  473. AC_HEADER_SYS_WAIT
  474. 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)
  475. AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
  476. dnl Checks for typedefs, structures, and compiler characteristics.
  477. AC_C_CONST
  478. AC_STRUCT_TM
  479. AC_TYPE_PID_T
  480. AC_TYPE_SIZE_T
  481. AC_TYPE_SIGNAL
  482. AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
  483. AC_TRY_LINK([#include <stdarg.h>
  484. va_list ap1,ap2;], [va_copy(ap1,ap2);],
  485. ac_cv_HAVE_VA_COPY=yes,
  486. ac_cv_HAVE_VA_COPY=no)])
  487. if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
  488. AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
  489. else
  490. AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
  491. AC_TRY_LINK([#include <stdarg.h>
  492. va_list ap1,ap2;], [__va_copy(ap1,ap2);],
  493. ac_cv_HAVE___VA_COPY=yes,
  494. ac_cv_HAVE___VA_COPY=no)])
  495. if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
  496. AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
  497. fi
  498. fi
  499. AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
  500. AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
  501. AC_TRY_RUN([
  502. #include <sys/types.h>
  503. #include <stdarg.h>
  504. void foo(const char *format, ...) {
  505. va_list ap;
  506. int len;
  507. char buf[5];
  508. va_start(ap, format);
  509. len = vsnprintf(buf, 0, format, ap);
  510. va_end(ap);
  511. if (len != 5) exit(1);
  512. va_start(ap, format);
  513. len = vsnprintf(0, 0, format, ap);
  514. va_end(ap);
  515. if (len != 5) exit(1);
  516. if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
  517. exit(0);
  518. }
  519. main() { foo("hello"); }
  520. ],
  521. ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
  522. if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
  523. AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
  524. fi
  525. AC_TRY_COMPILE([#include <sys/time.h>],
  526. [struct timeval *tv;
  527. struct timezone *tz;],
  528. AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
  529. AC_TRY_COMPILE([#include <sys/time.h>],
  530. [struct timeval *tv;
  531. struct timezone *tz;
  532. gettimeofday(tv, tz);],
  533. AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
  534. AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
  535. dnl Checks for library functions.
  536. AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul floor)
  537. AC_MSG_CHECKING(return type of socket size)
  538. AC_TRY_COMPILE([#include <stdlib.h>
  539. #include <sys/types.h>
  540. #include <sys/socket.h>],
  541. [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
  542. ac_cv_socket_size_type=["size_t"]
  543. AC_MSG_RESULT(size_t),
  544. ac_cv_socket_size_type=["int"]
  545. AC_MSG_RESULT(int))
  546. AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
  547. [Define type of socket size])
  548. if test -f "/proc/loadavg"
  549. then
  550. AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
  551. AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
  552. fi
  553. dnl #### Process table test
  554. AC_PATH_PROG(PATH_TO_PS,ps)
  555. AC_MSG_CHECKING(for ps syntax)
  556. dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
  557. AM_CONDITIONAL(WANT_PST3, false)
  558. if test "$ac_cv_uname_s" = "SunOS"; then
  559. #
  560. # this is a very, very ugly hack, to hardcode the location for plugins
  561. #
  562. if test "$libexecdir" = '${exec_prefix}/libexec'; then
  563. if test "$exec_prefix" = "NONE"; then
  564. if test "$prefix" = "NONE"; then
  565. pst3="$ac_default_prefix/libexec/pst3"
  566. else
  567. pst3="$prefix/libexec/pst3"
  568. fi
  569. else
  570. pst3="$exec_prefix/libexec/pst3"
  571. fi
  572. else
  573. pst3="$libexecdir/pst3"
  574. fi
  575. ac_cv_ps_command="$pst3"
  576. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  577. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  578. ac_cv_ps_cols=8
  579. AC_MSG_RESULT([using nagios-plugins internal ps for solaris])
  580. AM_CONDITIONAL(WANT_PST3, true)
  581. dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
  582. dnl so test for this first...
  583. elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
  584. egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
  585. then
  586. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  587. ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
  588. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  589. ac_cv_ps_cols=9
  590. AC_MSG_RESULT([$ac_cv_ps_command])
  591. dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
  592. dnl Should also work for FreeBSD 5.2.1 and 5.3
  593. dnl STAT UCOMM VSZ RSS USER PPID COMMAND
  594. elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
  595. egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
  596. then
  597. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  598. ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
  599. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  600. ac_cv_ps_cols=9
  601. AC_MSG_RESULT([$ac_cv_ps_command])
  602. dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
  603. dnl Limitation: Only first 16 chars returned for ucomm field
  604. dnl Must come before ps -weo
  605. elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
  606. egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
  607. then
  608. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  609. ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
  610. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  611. ac_cv_ps_cols=9
  612. AC_MSG_RESULT([$ac_cv_ps_command])
  613. dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
  614. elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
  615. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
  616. then
  617. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
  618. ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
  619. ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
  620. ac_cv_ps_cols=10
  621. AC_MSG_RESULT([$ac_cv_ps_command])
  622. dnl FreeBSD
  623. elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
  624. egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
  625. then
  626. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  627. ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
  628. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  629. ac_cv_ps_cols=9
  630. AC_MSG_RESULT([$ac_cv_ps_command])
  631. dnl BSD-like mode in RH 6.1
  632. elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
  633. egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  634. then
  635. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  636. ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
  637. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  638. ac_cv_ps_cols=9
  639. AC_MSG_RESULT([$ac_cv_ps_command])
  640. dnl SunOS 4.1.3:
  641. dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
  642. dnl Need the head -1 otherwise test will work because arguments are found
  643. elif ps -laxnwww 2>/dev/null | head -1 | \
  644. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
  645. then
  646. ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  647. ac_cv_ps_command="$PATH_TO_PS -laxnwww"
  648. ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
  649. ac_cv_ps_cols=9
  650. AC_MSG_RESULT([$ac_cv_ps_command])
  651. dnl Debian Linux / procps v1.2.9:
  652. dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
  653. dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
  654. dnl
  655. elif ps laxnwww 2>/dev/null | \
  656. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
  657. then
  658. ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
  659. ac_cv_ps_command="$PATH_TO_PS laxnwww"
  660. ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  661. ac_cv_ps_cols=9
  662. AC_MSG_RESULT([$ac_cv_ps_command])
  663. dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
  664. elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
  665. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  666. then
  667. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  668. ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
  669. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  670. ac_cv_ps_cols=9
  671. AC_MSG_RESULT([$ac_cv_ps_command])
  672. dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
  673. dnl Has /usr/bin/ps and /sbin/ps - force sbin version
  674. dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
  675. dnl of 1500). Will need big changes to check_procs to support
  676. elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
  677. egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
  678. then
  679. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
  680. ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
  681. ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
  682. ac_cv_ps_cols=8
  683. AC_MSG_RESULT([$ac_cv_ps_command])
  684. elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
  685. egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  686. then
  687. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  688. ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
  689. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  690. ac_cv_ps_cols=9
  691. AC_MSG_RESULT([$ac_cv_ps_command])
  692. dnl AIX 4.3.3 and 5.1 do not have an rss field
  693. elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
  694. egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
  695. then
  696. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
  697. ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
  698. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  699. ac_cv_ps_cols=8
  700. AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
  701. dnl Solaris 2.6
  702. elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
  703. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  704. then
  705. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  706. ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
  707. # There must be no space between the %s and %n due to a wierd problem in sscanf where
  708. # it will return %n as longer than the line length
  709. ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
  710. ac_cv_ps_cols=9
  711. AC_MSG_RESULT([$ac_cv_ps_command])
  712. elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
  713. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  714. then
  715. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  716. ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
  717. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  718. ac_cv_ps_cols=9
  719. AC_MSG_RESULT([$ac_cv_ps_command])
  720. elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
  721. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  722. then
  723. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  724. ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
  725. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  726. ac_cv_ps_cols=9
  727. AC_MSG_RESULT([$ac_cv_ps_command])
  728. dnl wonder who takes state instead of stat
  729. elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
  730. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  731. then
  732. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  733. ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
  734. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  735. ac_cv_ps_cols=8
  736. AC_MSG_RESULT([$ac_cv_ps_command])
  737. dnl IRIX 53
  738. elif ps -el 2>/dev/null | \
  739. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  740. then
  741. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
  742. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
  743. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
  744. ac_cv_ps_cols=8
  745. AC_MSG_RESULT([$ac_cv_ps_command])
  746. dnl IRIX 63
  747. elif ps -el 2>/dev/null | \
  748. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  749. then
  750. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
  751. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
  752. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  753. ac_cv_ps_cols=6
  754. AC_MSG_RESULT([$ac_cv_ps_command])
  755. dnl AIX 4.1:
  756. dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
  757. dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
  758. elif ps -el 2>/dev/null | \
  759. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  760. then
  761. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
  762. ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
  763. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  764. ac_cv_ps_cols=6
  765. AC_MSG_RESULT([$ac_cv_ps_command])
  766. dnl AIX?
  767. elif ps glaxen 2>/dev/null | \
  768. egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
  769. then
  770. ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  771. ac_cv_ps_command="$PATH_TO_PS glaxen"
  772. ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  773. ac_cv_ps_cols=8
  774. AC_MSG_RESULT([$ac_cv_ps_command])
  775. dnl MacOSX / Darwin
  776. dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
  777. dnl Some truncation will happen in UCOMM column
  778. dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
  779. dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
  780. elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
  781. egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
  782. then
  783. ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
  784. ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
  785. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  786. ac_cv_ps_cols=8
  787. AC_MSG_RESULT([$ac_cv_ps_command])
  788. dnl UnixWare
  789. elif ps -Al 2>/dev/null | \
  790. egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
  791. then
  792. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
  793. ac_cv_ps_command="$PATH_TO_PS -Al"
  794. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  795. ac_cv_ps_cols=8
  796. AC_MSG_RESULT([$ac_cv_ps_command])
  797. else
  798. AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
  799. fi
  800. if test -n "$ac_cv_ps_varlist" ; then
  801. AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
  802. [Variable list for sscanf of 'ps' output])
  803. AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
  804. [Verbatim command to execute for ps in check_procs])
  805. AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
  806. [Format string for scanning ps output in check_procs])
  807. AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
  808. [Number of columns in ps command])
  809. EXTRAS="$EXTRAS check_procs check_nagios"
  810. fi
  811. AC_PATH_PROG(PATH_TO_PING,ping)
  812. AC_PATH_PROG(PATH_TO_PING6,ping6)
  813. AC_ARG_WITH(ping_command,
  814. ACX_HELP_STRING([--with-ping-command=SYNTAX],
  815. [sets syntax for ICMP ping]),
  816. with_ping_command=$withval,)
  817. AC_MSG_CHECKING(for ICMP ping syntax)
  818. ac_cv_ping_packets_first=no
  819. ac_cv_ping_has_timeout=no
  820. if test -n "$with_ping_command"
  821. then
  822. AC_MSG_RESULT([(command-line) $with_ping_command])
  823. if test -n "$ac_cv_ping_packets_first"
  824. then
  825. ac_cv_ping_packets_first=yes
  826. fi
  827. elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  828. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  829. egrep -i "^round-trip|^rtt" >/dev/null
  830. then
  831. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  832. ac_cv_ping_packets_first=yes
  833. AC_MSG_RESULT([$with_ping_command])
  834. elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
  835. egrep -i "^round-trip|^rtt" >/dev/null
  836. then
  837. with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
  838. ac_cv_ping_packets_first=yes
  839. ac_cv_ping_has_timeout=yes
  840. AC_MSG_RESULT([$with_ping_command])
  841. elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
  842. egrep -i "^round-trip|^rtt" >/dev/null
  843. then
  844. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  845. ac_cv_ping_packets_first=yes
  846. AC_MSG_RESULT([$with_ping_command])
  847. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  848. egrep -i "^round-trip|^rtt" >/dev/null
  849. then
  850. with_ping_command="$PATH_TO_PING -n -c %d %s"
  851. ac_cv_ping_packets_first=yes
  852. AC_MSG_RESULT([$with_ping_command])
  853. elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
  854. egrep -i "^round-trip|^rtt" >/dev/null
  855. then
  856. with_ping_command="$PATH_TO_PING -n %s -c %d"
  857. AC_MSG_RESULT([$with_ping_command])
  858. elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
  859. egrep -i "^round-trip|^rtt" >/dev/null
  860. then
  861. with_ping_command="$PATH_TO_PING %s -n %d"
  862. AC_MSG_RESULT([$with_ping_command])
  863. elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  864. egrep -i "^round-trip|^rtt" >/dev/null
  865. then
  866. with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
  867. AC_MSG_RESULT([$with_ping_command])
  868. elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
  869. egrep -i "^round-trip|^rtt" >/dev/null
  870. then
  871. with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
  872. AC_MSG_RESULT([$with_ping_command])
  873. elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
  874. egrep -i "^round-trip|^rtt" >/dev/null
  875. then
  876. with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
  877. ac_cv_ping_packets_first=yes
  878. AC_MSG_RESULT([$with_ping_command])
  879. elif $PATH_TO_PING -n -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 -c %d %s"
  883. ac_cv_ping_packets_first=yes
  884. AC_MSG_RESULT([$with_ping_command])
  885. else
  886. AC_MSG_WARN([unable to find usable ping syntax])
  887. fi
  888. AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
  889. [path and args for ICMP ping command])
  890. if test "x$ac_cv_ping_packets_first" != "xno"
  891. then
  892. AC_DEFINE(PING_PACKETS_FIRST,1,
  893. [Define if packet count must precede host])
  894. fi
  895. if test "x$ac_cv_ping_has_timeout" != "xno"
  896. then
  897. AC_DEFINE(PING_HAS_TIMEOUT,1,
  898. [Define if ping has its own timeout option that should be set])
  899. fi
  900. AC_ARG_WITH(ping6_command,
  901. ACX_HELP_STRING([--with-ping6-command=SYNTAX],
  902. [sets syntax for ICMPv6 ping]),
  903. with_ping6_command=$withval,)
  904. if test x"$with_ipv6" != xno ; then
  905. AC_MSG_CHECKING(for ICMPv6 ping syntax)
  906. ac_cv_ping6_packets_first=no
  907. if test -n "$with_ping6_command"
  908. then
  909. AC_MSG_RESULT([(command-line) $with_ping6_command])
  910. if test -n "$ac_cv_ping6_packets_first"
  911. then
  912. ac_cv_ping6_packets_first=yes
  913. fi
  914. elif test "x$PATH_TO_PING6" != "x"; then
  915. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  916. $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  917. egrep -i "^round-trip|^rtt" >/dev/null
  918. then
  919. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  920. ac_cv_ping6_packets_first=yes
  921. AC_MSG_RESULT([$with_ping6_command])
  922. elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
  923. egrep -i "^round-trip|^rtt" >/dev/null
  924. then
  925. with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
  926. ac_cv_ping6_packets_first=yes
  927. ac_cv_ping_has_timeout=yes
  928. AC_MSG_RESULT([$with_ping6_command])
  929. elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
  930. egrep -i "^round-trip|^rtt" >/dev/null
  931. then
  932. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  933. ac_cv_ping6_packets_first=yes
  934. AC_MSG_RESULT([$with_ping6_command])
  935. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  936. egrep -i "^round-trip|^rtt" >/dev/null
  937. then
  938. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  939. ac_cv_ping6_packets_first=yes
  940. AC_MSG_RESULT([$with_ping6_command])
  941. elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
  942. egrep -i "^round-trip|^rtt" >/dev/null
  943. then
  944. with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
  945. AC_MSG_RESULT([$with_ping6_command])
  946. elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
  947. egrep -i "^round-trip|^rtt" >/dev/null
  948. then
  949. with_ping6_command="$PATH_TO_PING6 %s -n %d"
  950. AC_MSG_RESULT([$with_ping6_command])
  951. elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  952. egrep -i "^round-trip|^rtt" >/dev/null
  953. then
  954. with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
  955. AC_MSG_RESULT([$with_ping6_command])
  956. elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  957. egrep -i "^round-trip|^rtt" >/dev/null
  958. then
  959. with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
  960. AC_MSG_RESULT([$with_ping6_command])
  961. elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
  962. egrep -i "^round-trip|^rtt" >/dev/null
  963. then
  964. with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
  965. ac_cv_ping6_packets_first=yes
  966. AC_MSG_RESULT([$with_ping_command])
  967. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  968. egrep -i "^round-trip|^rtt" >/dev/null
  969. then
  970. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  971. ac_cv_ping6_packets_first=yes
  972. AC_MSG_RESULT([$with_ping6_command])
  973. fi
  974. elif test "x$PATH_TO_PING" != "x"; then
  975. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  976. $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  977. egrep -i "^round-trip|^rtt" >/dev/null
  978. then
  979. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  980. ac_cv_ping6_packets_first=yes
  981. AC_MSG_RESULT([$with_ping6_command])
  982. elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
  983. egrep -i "^round-trip|^rtt" >/dev/null
  984. then
  985. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  986. ac_cv_ping6_packets_first=yes
  987. AC_MSG_RESULT([$with_ping6_command])
  988. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  989. egrep -i "^round-trip|^rtt" >/dev/null
  990. then
  991. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  992. ac_cv_ping6_packets_first=yes
  993. AC_MSG_RESULT([$with_ping6_command])
  994. elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
  995. egrep -i "^round-trip|^rtt" >/dev/null
  996. then
  997. with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
  998. AC_MSG_RESULT([$with_ping6_command])
  999. elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
  1000. egrep -i "^round-trip|^rtt" >/dev/null
  1001. then
  1002. with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
  1003. AC_MSG_RESULT([$with_ping6_command])
  1004. elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  1005. egrep -i "^round-trip|^rtt" >/dev/null
  1006. then
  1007. with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
  1008. AC_MSG_RESULT([$with_ping6_command])
  1009. elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  1010. egrep -i "^round-trip|^rtt" >/dev/null
  1011. then
  1012. with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
  1013. AC_MSG_RESULT([$with_ping6_command])
  1014. elif $PATH_TO_PING -A inet6 -n -s 56 -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 -s 56 -c %d %s"
  1018. ac_cv_ping6_packets_first=yes
  1019. AC_MSG_RESULT([$with_ping_command])
  1020. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  1021. egrep -i "^round-trip|^rtt" >/dev/null
  1022. then
  1023. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  1024. ac_cv_ping6_packets_first=yes
  1025. AC_MSG_RESULT([$with_ping6_command])
  1026. fi
  1027. fi
  1028. if test "x$with_ping6_command" != "x"; then
  1029. AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
  1030. [path and args for ICMPv6 ping command])
  1031. else
  1032. AC_MSG_RESULT([none])
  1033. fi
  1034. if test "x$ac_cv_ping6_packets_first" != "xno"; then
  1035. AC_DEFINE(PING6_PACKETS_FIRST,1,
  1036. [Define if packet count must precede host])
  1037. fi
  1038. fi
  1039. AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
  1040. AC_MSG_CHECKING(for nslookup syntax)
  1041. if test -n "$PATH_TO_NSLOOKUP"
  1042. then
  1043. if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
  1044. then
  1045. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
  1046. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1047. else
  1048. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
  1049. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1050. fi
  1051. EXTRAS="$EXTRAS check_dns"
  1052. else
  1053. AC_MSG_WARN([nslookup command not found])
  1054. fi
  1055. AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
  1056. [path and args for nslookup])
  1057. AC_PATH_PROG(PATH_TO_HOST,host)
  1058. if test -n "$ac_cv_path_PATH_TO_HOST"
  1059. then
  1060. EXTRAS="$EXTRAS check_dns"
  1061. fi
  1062. AC_PATH_PROG(PATH_TO_UPTIME,uptime)
  1063. AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
  1064. AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
  1065. AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
  1066. AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
  1067. AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
  1068. AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
  1069. if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
  1070. then
  1071. AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
  1072. AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
  1073. else
  1074. AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
  1075. fi
  1076. AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
  1077. if test -x "$PATH_TO_LMSTAT"
  1078. then
  1079. AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
  1080. else
  1081. AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
  1082. fi
  1083. AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
  1084. if test -x "$PATH_TO_SMBCLIENT"
  1085. then
  1086. AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
  1087. else
  1088. AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
  1089. fi
  1090. AC_PATH_PROG(PATH_TO_WHO,who)
  1091. if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
  1092. then
  1093. ac_cv_path_to_who="$PATH_TO_WHO -q"
  1094. else
  1095. ac_cv_path_to_who="$PATH_TO_WHO"
  1096. fi
  1097. AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
  1098. [path and arguments for invoking 'who'])
  1099. AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
  1100. if test -x "$PATH_TO_SNMPGET"
  1101. then
  1102. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
  1103. EXTRAS="$EXTRAS check_hpjd check_snmp"
  1104. else
  1105. AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
  1106. fi
  1107. AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
  1108. if test -x "$PATH_TO_SNMPGETNEXT"
  1109. then
  1110. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
  1111. fi
  1112. if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
  1113. then
  1114. AC_MSG_CHECKING(for Net::SNMP perl module)
  1115. AC_MSG_RESULT([found])
  1116. else
  1117. AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
  1118. fi
  1119. AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
  1120. AC_PATH_PROG(PATH_TO_QSTAT,qstat)
  1121. if test -x "$PATH_TO_QUAKESTAT"
  1122. then
  1123. ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
  1124. EXTRAS="$EXTRAS check_game"
  1125. elif test -x "$PATH_TO_QSTAT"
  1126. then
  1127. ac_cv_path_to_qstat="$PATH_TO_QSTAT"
  1128. EXTRAS="$EXTRAS check_game"
  1129. else
  1130. AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
  1131. fi
  1132. if test $ac_cv_path_to_qstat
  1133. then
  1134. AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
  1135. [path to qstat/quakestat])
  1136. fi
  1137. AC_PATH_PROG(PATH_TO_FPING,fping)
  1138. if test -x "$PATH_TO_FPING"
  1139. then
  1140. AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
  1141. EXTRAS="$EXTRAS check_fping"
  1142. else
  1143. AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
  1144. fi
  1145. AC_PATH_PROG(PATH_TO_SSH,ssh)
  1146. if test -x "$PATH_TO_SSH"
  1147. then
  1148. AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
  1149. EXTRAS="$EXTRAS check_by_ssh"
  1150. else
  1151. AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
  1152. fi
  1153. AC_PATH_PROG(PATH_TO_MAILQ,mailq)
  1154. if test -x "$PATH_TO_MAILQ"
  1155. then
  1156. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
  1157. else
  1158. AC_MSG_WARN([Could not find mailq or eqivalent])
  1159. fi
  1160. AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
  1161. if test -x "$PATH_TO_QMAIL_QSTAT"
  1162. then
  1163. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
  1164. else
  1165. AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
  1166. fi
  1167. dnl SWAP info required is amount allocated/available and amount free
  1168. dnl The plugin works through all the swap devices and adds up the total swap
  1169. dnl available.
  1170. AC_PATH_PROG(PATH_TO_SWAP,swap)
  1171. if (test -n "$PATH_TO_SWAP")
  1172. then
  1173. AC_MSG_CHECKING([for $PATH_TO_SWAP format])
  1174. if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
  1175. then
  1176. ac_cv_have_swap=yes
  1177. ac_cv_swap_command="$PATH_TO_SWAP -l"
  1178. if [$PATH_TO_SWAP -l 2>/dev/null | \
  1179. egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
  1180. >/dev/null]
  1181. then
  1182. ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
  1183. ac_cv_swap_conv=2048
  1184. AC_MSG_RESULT([using IRIX format swap])
  1185. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
  1186. then
  1187. ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
  1188. ac_cv_swap_conv=2048
  1189. AC_MSG_RESULT([using Unixware format swap])
  1190. else
  1191. dnl if we don't know what format swap's output is
  1192. dnl we might as well pretend we didn't see it
  1193. ac_cv_have_swap=""
  1194. ac_cv_swap_command=""
  1195. fi
  1196. fi
  1197. dnl end if for PATH_TO_SWAP
  1198. fi
  1199. AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
  1200. if (test -n "$PATH_TO_SWAPINFO")
  1201. then
  1202. AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
  1203. if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
  1204. then
  1205. ac_cv_have_swap=yes
  1206. ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
  1207. if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
  1208. then
  1209. ac_cv_swap_format=["%*s %f %*d %f"]
  1210. ac_cv_swap_conv=1024
  1211. AC_MSG_RESULT([using FreeBSD format swapinfo])
  1212. fi
  1213. elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
  1214. then
  1215. ac_cv_have_swap=yes
  1216. ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
  1217. ac_cv_swap_format=["%*s %f %*d %f"]
  1218. ac_cv_swap_conv=1024
  1219. AC_MSG_RESULT([using HP-UX format swapinfo])
  1220. fi
  1221. dnl end if for PATH_TO_SWAPINFO
  1222. fi
  1223. AC_PATH_PROG(PATH_TO_LSPS,lsps)
  1224. if (test -n "$PATH_TO_LSPS")
  1225. then
  1226. AC_MSG_CHECKING([for $PATH_TO_LSPS format])
  1227. if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
  1228. then
  1229. ac_cv_have_swap=yes
  1230. ac_cv_swap_command="$PATH_TO_LSPS -a"
  1231. ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
  1232. ac_cv_swap_conv=1
  1233. AC_MSG_RESULT([using AIX lsps])
  1234. fi
  1235. dnl end if for PATH_TO_SWAPINFO
  1236. fi
  1237. dnl
  1238. dnl test for swapctl system call, both the 2-arg and 3-arg variants
  1239. dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
  1240. dnl in the various BSD's
  1241. dnl
  1242. AC_CHECK_HEADERS([sys/stat.h sys/param.h])
  1243. AC_CHECK_HEADERS([sys/swap.h], [], [], [
  1244. #ifdef HAVE_SYS_PARAM_H
  1245. #include <sys/param.h>
  1246. #endif
  1247. ])
  1248. AC_CHECK_DECLS([swapctl],,,[
  1249. #include <unistd.h>
  1250. #include <sys/types.h>
  1251. #include <sys/param.h>
  1252. #include <sys/stat.h>
  1253. #include <sys/swap.h>
  1254. ])
  1255. AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
  1256. #include <sys/types.h>
  1257. #include <sys/param.h>
  1258. #include <sys/stat.h>
  1259. #include <sys/swap.h>
  1260. ])
  1261. AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
  1262. #include <unistd.h>
  1263. #include <sys/types.h>
  1264. #include <sys/param.h>
  1265. #include <sys/stat.h>
  1266. #include <sys/swap.h>
  1267. ])
  1268. if test "$ac_cv_have_decl_swapctl" = "yes";
  1269. then
  1270. EXTRAS="$EXTRAS check_swap"
  1271. AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
  1272. if test "$ac_cv_type_swaptbl_t" = "yes" -a \
  1273. "$ac_cv_type_swapent_t" = "yes";
  1274. then
  1275. AC_MSG_RESULT([yes])
  1276. ac_cv_check_swap_swapctl_svr4="1";
  1277. AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
  1278. [Define if 2-argument SVR4 swapctl exists])
  1279. else
  1280. AC_MSG_RESULT([no])
  1281. AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
  1282. if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
  1283. then
  1284. AC_MSG_RESULT([yes])
  1285. AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
  1286. [Define if 3-argument BSD swapctl exists])
  1287. else
  1288. AC_MSG_RESULT([no])
  1289. fi
  1290. fi
  1291. AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
  1292. if test "$ac_cv_check_swap_swapctl_svr4" = "1";
  1293. then
  1294. dnl
  1295. dnl the SVR4 spec returns values in pages
  1296. dnl
  1297. AC_MSG_RESULT([page])
  1298. AC_CHECK_DECLS([sysconf])
  1299. AC_MSG_CHECKING([for system page size])
  1300. if test "$ac_cv_have_decl_sysconf" = "yes";
  1301. then
  1302. AC_MSG_RESULT([determined by sysconf(3)])
  1303. ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
  1304. else
  1305. AC_MSG_WARN([don't know. guessing 4096k])
  1306. ac_cv_swap_conv=256
  1307. fi
  1308. else
  1309. dnl
  1310. dnl the BSD spec returns values in blocks
  1311. dnl
  1312. AC_MSG_RESULT([blocks (assuming 512b)])
  1313. ac_cv_swap_conv=2048
  1314. fi
  1315. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1316. [Conversion factor to MB])
  1317. fi
  1318. dnl
  1319. dnl end tests for the swapctl system calls
  1320. dnl
  1321. if test "x$ac_cv_have_swap" != "x"
  1322. then
  1323. AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
  1324. EXTRAS="$EXTRAS check_swap"
  1325. fi
  1326. if test "x$ac_cv_swap_command" != "x"
  1327. then
  1328. AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
  1329. [Path to swap/swapinfo binary, with any args])
  1330. AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
  1331. [Format string for parsing swap output])
  1332. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1333. [Conversion factor to MB])
  1334. fi
  1335. dnl dunno why this does not work below - use hack (kbd)
  1336. dnl fine on linux, broken on solaris
  1337. dnl if /bin/test -e "/proc/meminfo"
  1338. AC_MSG_CHECKING([for /proc/meminfo])
  1339. if [cat /proc/meminfo > /dev/null 2>&1]
  1340. then
  1341. AC_MSG_RESULT([found /proc/meminfo])
  1342. AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
  1343. AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
  1344. EXTRAS="$EXTRAS check_swap"
  1345. else
  1346. AC_MSG_RESULT([no])
  1347. fi
  1348. AC_PATH_PROG(PATH_TO_DIG,dig)
  1349. AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
  1350. if test -n "$PATH_TO_DIG"; then
  1351. EXTRAS="$EXTRAS check_dig"
  1352. fi
  1353. if test -f plugins/check_nt.c ; then
  1354. EXTRAS="$EXTRAS check_nt"
  1355. elif test -f ../plugins/check_nt.c ; then
  1356. EXTRAS="$EXTRAS check_nt"
  1357. fi
  1358. AC_MSG_CHECKING(for va_list)
  1359. AC_TRY_COMPILE([#ifdef __STDC__
  1360. #include <stdio.h>
  1361. #include <stdlib.h>
  1362. #include <stdarg.h>
  1363. #else
  1364. #include <sys/types.h>
  1365. #include <stdio.h>
  1366. #include <varargs.h>
  1367. #endif],
  1368. [va_list args;],
  1369. [AC_MSG_RESULT(yes)],
  1370. [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
  1371. case $host in
  1372. *bsd*)
  1373. AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
  1374. ;;
  1375. *linux*)
  1376. AC_DEFINE(__linux__,1,[sun specific code in check_dhcp.c])
  1377. ;;
  1378. *sun* | solaris*)
  1379. AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
  1380. ;;
  1381. *hpux*)
  1382. AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
  1383. ;;
  1384. esac
  1385. AC_SUBST(EXTRAS)
  1386. AC_SUBST(EXTRA_NETOBJS)
  1387. AC_SUBST(DEPLIBS)
  1388. AM_GNU_GETTEXT([no-libtool], [need-ngettext])
  1389. AM_GNU_GETTEXT_VERSION(0.11.5)
  1390. dnl Check for Redhat spopen problem
  1391. dnl Wierd problem where ECHILD is returned from a wait call in error
  1392. dnl Only appears to affect nslookup and dig calls. Only affects redhat around
  1393. dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
  1394. dnl We patch plugins/popen.c
  1395. dnl Need to add smp because uname different on those. May need to check
  1396. dnl Fedora Core too in future
  1397. if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
  1398. AC_MSG_CHECKING(for redhat spopen problem)
  1399. ( cd config_test && make && make test ) > /dev/null 2>&1
  1400. if test $? -eq 0 ; then
  1401. AC_MSG_RESULT(okay)
  1402. else
  1403. AC_MSG_RESULT(error)
  1404. AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, "Problem on redhat with spopen")
  1405. fi
  1406. fi
  1407. dnl External libraries - see ACKNOWLEDGEMENTS
  1408. np_COREUTILS
  1409. np_CURL
  1410. AC_OUTPUT(
  1411. Makefile
  1412. lib/Makefile
  1413. m4/Makefile
  1414. plugins/Makefile
  1415. plugins-root/Makefile
  1416. plugins-scripts/Makefile
  1417. plugins-scripts/subst
  1418. plugins-scripts/utils.pm
  1419. plugins-scripts/utils.sh
  1420. command.cfg
  1421. test.pl
  1422. pkg/solaris/pkginfo
  1423. intl/Makefile
  1424. po/Makefile.in
  1425. )
  1426. ACX_FEATURE([with],[perl])
  1427. ACX_FEATURE([with],[cgiurl])
  1428. ACX_FEATURE([with],[nagios-user])
  1429. ACX_FEATURE([with],[nagios-group])
  1430. ACX_FEATURE([with],[trusted-path])
  1431. ACX_FEATURE([with],[ping-command])
  1432. ACX_FEATURE([with],[ping6-command])
  1433. ACX_FEATURE([with],[lwres])
  1434. ACX_FEATURE([with],[ipv6])
  1435. ACX_FEATURE([with],[openssl])
  1436. ACX_FEATURE([with],[gnutls])
  1437. ACX_FEATURE([enable],[emulate-getaddrinfo])