configure.in 54 KB

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