configure.in 48 KB

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