configure.in 47 KB

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