configure.in 52 KB

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