configure.in 50 KB

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