configure.in 48 KB

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