configure.in 47 KB

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