configure.in 50 KB

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