configure.in 51 KB

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