configure.in 51 KB

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