configure.in 49 KB

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