configure.in 52 KB

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