configure.in 50 KB

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