configure.in 51 KB

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