configure.in 49 KB

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