configure.in 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.59)
  3. AC_INIT(nagios-plugins,1.4.13)
  4. AC_CONFIG_SRCDIR(NPTest.pm)
  5. AC_CONFIG_FILES(gl/Makefile)
  6. AC_CONFIG_AUX_DIR(build-aux)
  7. AM_INIT_AUTOMAKE([1.8.3])
  8. AM_CONFIG_HEADER(config.h)
  9. AC_CANONICAL_HOST
  10. RELEASE=1
  11. AC_SUBST(RELEASE)
  12. AC_PREFIX_DEFAULT(/usr/local/nagios)
  13. dnl Deprecated configure options
  14. dnl Append user (-o), group (-g), mode (-m) to install command
  15. dnl There is an assumption that this is possible with ./configure's chosen install command
  16. extra_install_args=""
  17. AC_ARG_WITH(nagios_user,
  18. ACX_HELP_STRING([--with-nagios-user=USER],
  19. [Installs executables with this user. Defaults to install user]),
  20. extra_install_args="-o $withval")
  21. AC_ARG_WITH(nagios_group,
  22. ACX_HELP_STRING([--with-nagios-group=GROUP],
  23. [Installs executables with this group. Defaults to install user]),
  24. extra_install_args="$extra_install_args -g $withval")
  25. AC_ARG_WITH(world_permissions,
  26. ACX_HELP_STRING([--without-world-permissions],
  27. [Installs executables without world permissions]))
  28. if test "x$with_world_permissions" = xno ; then
  29. extra_install_args="$extra_install_args -m 0550"
  30. fi
  31. INSTALL="$INSTALL $extra_install_args"
  32. INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args"
  33. AC_SUBST(INSTALL)
  34. AC_PROG_CC
  35. gl_EARLY
  36. AC_PROG_GCC_TRADITIONAL
  37. AC_PROG_LIBTOOL
  38. AM_PROG_CC_C_O
  39. AC_FUNC_ERROR_AT_LINE
  40. AC_SYS_LARGEFILE
  41. ifdef([AC_FUNC_STRTOD],[AC_FUNC_STRTOD],[AM_FUNC_STRTOD])
  42. PLUGIN_TEST=`echo $srcdir/plugins/t/*.t|sed -e 's,\.*/plugins/,,g'`
  43. AC_SUBST(PLUGIN_TEST)dnl
  44. SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
  45. AC_SUBST(SCRIPT_TEST)dnl
  46. 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"
  47. AC_SUBST(WARRANTY)
  48. 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"
  49. AC_SUBST(SUPPORT)
  50. dnl CGIURL has changed for Nagios with 1.0 beta
  51. AC_ARG_WITH(cgiurl,
  52. ACX_HELP_STRING([--with-cgiurl=DIR],
  53. [sets URL for cgi programs]),
  54. with_cgiurl=$withval,
  55. with_cgiurl=/nagios/cgi-bin)
  56. CGIURL="$with_cgiurl"
  57. AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
  58. AC_ARG_WITH(trusted_path,
  59. ACX_HELP_STRING([--with-trusted-path=PATH],
  60. [sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
  61. with_trusted_path=$withval,
  62. with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
  63. AC_SUBST(with_trusted_path)
  64. EXTRAS=
  65. EXTRAS_ROOT=
  66. dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
  67. LDFLAGS="$LDFLAGS -L."
  68. ac_cv_uname_m=`uname -m`
  69. ac_cv_uname_s=`uname -s`
  70. ac_cv_uname_r=`uname -r`
  71. ac_cv_uname_v=`uname -v`
  72. PKG_ARCH=`uname -p`
  73. REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
  74. REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
  75. AC_SUBST(PKG_ARCH)
  76. AC_SUBST(REV_DATESTAMP)
  77. AC_SUBST(REV_TIMESTAMP)
  78. dnl Checks for programs.
  79. AC_PATH_PROG(PYTHON,python)
  80. AC_PATH_PROG(SH,sh)
  81. AC_PATH_PROG(PERL,perl)
  82. AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
  83. AC_PATH_PROG(HOSTNAME,hostname)
  84. AC_PATH_PROG(BASENAME,basename)
  85. dnl allow them to override the path of perl
  86. AC_ARG_WITH(perl,
  87. ACX_HELP_STRING([--with-perl=PATH],
  88. [sets path to perl executable]),
  89. with_perl=$withval,with_perl=$PERL)
  90. AC_SUBST(PERL, $with_perl)
  91. dnl openssl/gnutls
  92. AC_ARG_WITH(openssl,
  93. AC_HELP_STRING([--with-openssl=DIR],
  94. [path to openssl installation]),)
  95. AC_ARG_WITH(gnutls,
  96. ACX_HELP_STRING([--with-gnutls=PATH],
  97. [path to gnutls installation root]),)
  98. dnl you can only have one or the other
  99. if test ! "$with_openssl" = "" && test ! "$with_openssl" = "no"; then
  100. with_gnutls="no"
  101. fi
  102. if test ! "$with_gnutls" = "" && test ! "$with_gnutls" = "no"; then
  103. with_openssl="no"
  104. fi
  105. dnl list of possible dirs to try to autodetect openssl
  106. dnl if $dir/include exists, we consider it found
  107. dnl the order should allow locally installed versions to override distros' ones
  108. OPENSSL_DIRS="/usr /usr/local /usr/slocal /usr/local/openssl /usr/local/ssl \
  109. /opt /opt/openssl"
  110. dnl
  111. dnl Checks for libraries.
  112. dnl
  113. AC_CHECK_LIB(dce,main,SOCKETLIBS="$SOCKETLIBS -ldce")
  114. AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
  115. AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
  116. AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
  117. AC_SUBST(SOCKETLIBS)
  118. dnl
  119. dnl check for math-related functions needing -lm
  120. AC_CHECK_HEADERS(math.h)
  121. AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
  122. AC_SUBST(MATHLIBS)
  123. dnl Add libtap for tests
  124. AC_ARG_ENABLE(libtap,
  125. AC_HELP_STRING([--enable-libtap],
  126. [Enables configuring of libtap in external/tap/. Run "make tap" to compile (default: no)]),
  127. [enable_libtap=$enableval],
  128. [enable_libtap=no])
  129. dnl Have to define TAP_DIR so that Makefile can pull it as an extra dist
  130. TAP_DIR=external/tap-1.01
  131. AC_SUBST(TAP_DIR)
  132. if test "$enable_libtap" = yes; then
  133. dnl Have to have AC_CONFIG_SUBDIRS as a literal
  134. AC_CONFIG_SUBDIRS([external/tap-1.01])
  135. dnl This is required so that TAP stuff is compiled before the libs and tests
  136. dnl A make install will also install the tap library, but as this is a development tool, this should be okay
  137. INCLUDE_TAP_DIR=$TAP_DIR
  138. AC_SUBST(INCLUDE_TAP_DIR)
  139. EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64"
  140. AC_SUBST(EXTRA_TEST)
  141. fi
  142. dnl INI Parsing
  143. AC_ARG_ENABLE(extra-opts,
  144. AC_HELP_STRING([--enable-extra-opts],
  145. [Enables parsing of plugins ini config files for extra options (default: no)]),
  146. [enable_extra_opts=$enableval],
  147. [enable_extra_opts=no])
  148. AM_CONDITIONAL([USE_PARSE_INI],[test "$enable_extra_opts" = "yes"])
  149. if test "$enable_extra_opts" = "yes" ; then
  150. AC_DEFINE(NP_EXTRA_OPTS,[1],[Enable INI file parsing.])
  151. if test "$enable_libtap" = yes; then
  152. EXTRA_TEST="$EXTRA_TEST test_ini test_opts"
  153. AC_SUBST(EXTRA_TEST)
  154. fi
  155. fi
  156. dnl Check for PostgreSQL libraries
  157. _SAVEDLIBS="$LIBS"
  158. _SAVEDCPPFLAGS="$CPPFLAGS"
  159. AC_ARG_WITH(pgsql,
  160. ACX_HELP_STRING([--with-pgsql=DIR],
  161. [sets path to pgsql installation]),
  162. PGSQL=$withval,)
  163. AC_CHECK_LIB(crypt,main)
  164. if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
  165. if test -n "$PGSQL"; then
  166. LDFLAGS="$LDFLAGS -L$PGSQL/lib"
  167. CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
  168. fi
  169. AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
  170. if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
  171. AC_CHECK_HEADERS(pgsql/libpq-fe.h)
  172. AC_CHECK_HEADERS(postgresql/libpq-fe.h)
  173. AC_CHECK_HEADERS(libpq-fe.h)
  174. if [[ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]]; then
  175. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  176. PGINCLUDE="-I$PGSQL/include"
  177. elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
  178. PGLIBS="-lpq -lcrypt"
  179. PGINCLUDE="-I/usr/include/pgsql"
  180. elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
  181. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  182. PGINCLUDE="-I/usr/include/postgresql"
  183. elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
  184. PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
  185. PGINCLUDE="-I$PGSQL/include"
  186. fi
  187. if test -z "$PGINCLUDE"; then
  188. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  189. AC_MSG_WARN([install PostgreSQL headers to compile this plugin (see REQUIREMENTS).])
  190. else
  191. AC_SUBST(PGLIBS)
  192. AC_SUBST(PGINCLUDE)
  193. EXTRAS="$EXTRAS check_pgsql"
  194. fi
  195. else
  196. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  197. AC_MSG_WARN([LIBS="$LIBS" CPPFLAGS="$CPPFLAGS"])
  198. AC_MSG_WARN([install PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
  199. fi
  200. else
  201. AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
  202. AC_MSG_WARN([install lib crypt and PostgreSQL libs to compile this plugin (see REQUIREMENTS).])
  203. fi
  204. LIBS="$_SAVEDLIBS"
  205. CPPFLAGS="$_SAVEDCPPFLAGS"
  206. dnl Check for radius libraries
  207. _SAVEDLIBS="$LIBS"
  208. AC_CHECK_LIB(radiusclient,rc_read_config)
  209. if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
  210. EXTRAS="$EXTRAS check_radius"
  211. RADIUSLIBS="-lradiusclient"
  212. AC_SUBST(RADIUSLIBS)
  213. else
  214. AC_CHECK_LIB(radiusclient-ng,rc_read_config)
  215. if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
  216. EXTRAS="$EXTRAS check_radius"
  217. RADIUSLIBS="-lradiusclient-ng"
  218. AC_SUBST(RADIUSLIBS)
  219. else
  220. AC_MSG_WARN([Skipping radius plugin])
  221. AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
  222. fi
  223. fi
  224. LIBS="$_SAVEDLIBS"
  225. dnl Check for LDAP libraries
  226. _SAVEDLIBS="$LIBS"
  227. AC_CHECK_LIB(ldap,main,,,-llber)
  228. if test "$ac_cv_lib_ldap_main" = "yes"; then
  229. LDAPLIBS="-lldap -llber"\
  230. LDAPINCLUDE="-I/usr/include/ldap"
  231. AC_SUBST(LDAPLIBS)
  232. AC_SUBST(LDAPINCLUDE)
  233. AC_CHECK_FUNCS(ldap_set_option)
  234. EXTRAS="$EXTRAS check_ldap"
  235. AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
  236. else
  237. AC_MSG_WARN([Skipping LDAP plugin])
  238. AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])
  239. fi
  240. LIBS="$_SAVEDLIBS"
  241. dnl Check for headers used by check_ide_smart
  242. AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
  243. if test "$FOUNDINCLUDE" = "yes" ; then
  244. AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no)
  245. fi
  246. if test "$FOUNDINCLUDE" = "yes" ; then
  247. EXTRAS="$EXTRAS check_ide_smart"
  248. else
  249. AC_MSG_WARN([Skipping check_ide_smart plugin.])
  250. AC_MSG_WARN([check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h.])
  251. fi
  252. dnl Check for mysql libraries
  253. np_mysqlclient
  254. if test $with_mysql = "no" ; then
  255. AC_MSG_WARN([Skipping mysql plugin])
  256. AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
  257. else
  258. EXTRAS="$EXTRAS check_mysql check_mysql_query"
  259. MYSQLINCLUDE="$np_mysql_include"
  260. MYSQLLIBS="$np_mysql_libs"
  261. MYSQLCFLAGS="$np_mysql_cflags"
  262. AC_SUBST(MYSQLINCLUDE)
  263. AC_SUBST(MYSQLLIBS)
  264. AC_SUBST(MYSQLCFLAGS)
  265. fi
  266. AC_ARG_WITH([ipv6],
  267. [AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
  268. [], [with_ipv6=check])
  269. dnl Check for AF_INET6 support - unistd.h required for Darwin
  270. if test "$with_ipv6" != "no"; then
  271. AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
  272. AC_TRY_COMPILE(
  273. [#ifdef HAVE_UNISTD_H
  274. #include <unistd.h>
  275. #endif
  276. #include <netinet/in.h>
  277. #include <sys/socket.h>],
  278. [struct sockaddr_in6 sin6;
  279. void *p;
  280. sin6.sin6_family = AF_INET6;
  281. sin6.sin6_port = 587;
  282. p = &sin6.sin6_addr;],
  283. [np_cv_sys_ipv6=yes],
  284. [np_cv_sys_ipv6=no])
  285. ])
  286. if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
  287. AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
  288. fi
  289. if test "$np_cv_sys_ipv6" = "yes"; then
  290. AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
  291. fi
  292. with_ipv6="$np_cv_sys_ipv6"
  293. fi
  294. dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3
  295. AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
  296. if test "$FOUNDINCLUDE" = "no"; then
  297. _SAVEDCPPFLAGS="$CPPFLAGS"
  298. CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
  299. unset ac_cv_header_krb5_h
  300. AC_CHECK_HEADERS(krb5.h,
  301. KRB5INCLUDE="-I/usr/kerberos/include"
  302. FOUNDINCLUDE=yes,
  303. FOUNDINCLUDE=no)
  304. fi
  305. AC_SUBST(KRBINCLUDE)
  306. if test "$FOUNDINCLUDE" = "no"; then
  307. CPPFLAGS="$_SAVEDCPPFLAGS"
  308. fi
  309. dnl *** The following block comes from wget configure.ac ***
  310. dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
  311. dnl shared library doesn't record its dependency on libdl, so we
  312. dnl need to check for it ourselves so we won't fail to link due to a
  313. dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
  314. dnl shl_load().
  315. AC_CHECK_LIB(dl,dlopen)
  316. AC_CHECK_LIB(dl,shl_load)
  317. dnl openssl detection/configuration
  318. if ! test x"$with_openssl" = x"no"; then
  319. dnl Check for OpenSSL location if it wasn't already specified
  320. if ! test -d "$with_openssl"; then
  321. for d in $OPENSSL_DIRS; do
  322. if test -x ${d}/bin/openssl || test -x ${d}/sbin/openssl ; then
  323. with_openssl=$d
  324. fi
  325. done
  326. fi
  327. _SAVEDCPPFLAGS="$CPPFLAGS"
  328. _SAVEDLDFLAGS="$LDFLAGS"
  329. dnl Check for OpenSSL header files
  330. unset FOUNDINCLUDE
  331. if test x"$with_openssl" != x"/usr" ; then
  332. CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
  333. LDFLAGS="$LDFLAGS -L$with_openssl/lib"
  334. fi
  335. dnl check for openssl in $dir/include/openssl
  336. AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h,
  337. SSLINCLUDE="-I$with_openssl/include"
  338. FOUNDINCLUDE=yes,
  339. FOUNDINCLUDE=no)
  340. dnl else check to see if $dir/include has it
  341. if test "$FOUNDINCLUDE" = "no"; then
  342. AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h,
  343. SSLINCLUDE="-I$with_openssl/include"
  344. FOUNDINCLUDE=yes,
  345. FOUNDINCLUDE=no)
  346. fi
  347. AC_SUBST(SSLINCLUDE)
  348. dnl if we didn't find it, reset CPPFLAGS
  349. if test "$FOUNDINCLUDE" = "no"; then
  350. CPPFLAGS="$_SAVEDCPPFLAGS"
  351. LDFLAGS="$_SAVEDLDFLAGS"
  352. fi
  353. dnl Check for crypto lib
  354. _SAVEDLIBS="$LIBS"
  355. LIBS="-L${with_openssl}/lib"
  356. AC_CHECK_LIB(crypto,CRYPTO_lock)
  357. if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
  358. dnl Check for SSL lib
  359. AC_CHECK_LIB(ssl,main, SSLLIBS="-lssl -lcrypto",,-lcrypto)
  360. fi
  361. LIBS="$_SAVEDLIBS"
  362. dnl test headers and libs to decide whether check_http should use SSL
  363. if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then
  364. if test "$ac_cv_lib_ssl_main" = "yes"; then
  365. if test "$FOUNDINCLUDE" = "yes"; then
  366. FOUNDOPENSSL="yes"
  367. fi
  368. fi
  369. fi
  370. fi
  371. dnl check for gnutls if openssl isn't found (or is disabled)
  372. if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
  373. if test ! "$with_gnutls" = ""; then
  374. CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
  375. elif test ! "$LIBGNUTLS_CONFIG" = ""; then
  376. CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
  377. fi
  378. AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
  379. if test "$FOUNDGNUTLS" = "yes"; then
  380. AC_CHECK_LIB(gnutls-openssl,main,SSLLIBS="-lgnutls-openssl")
  381. fi
  382. fi
  383. dnl end check for gnutls
  384. if test "$FOUNDOPENSSL" = "yes" || test "$FOUNDGNUTLS" = "yes"; then
  385. check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp"
  386. AC_SUBST(check_tcp_ssl)
  387. AC_SUBST(SSLLIBS)
  388. AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
  389. if test "$FOUNDOPENSSL" = "yes"; then
  390. AC_DEFINE(USE_OPENSSL,1,[Define if using OpenSSL libraries])
  391. with_openssl="yes"
  392. with_gnutls="no"
  393. else
  394. AC_DEFINE(USE_GNUTLS,1,[Define if using gnutls libraries])
  395. with_gnutls="yes"
  396. with_openssl="no"
  397. fi
  398. else
  399. dnl else deliberately disabled or no ssl support available
  400. AC_MSG_WARN([OpenSSL or GnuTLS libs could not be found or were disabled])
  401. with_openssl="no"
  402. with_gnutls="no"
  403. fi
  404. dnl
  405. dnl Checks for header files.
  406. dnl
  407. AC_HEADER_TIME
  408. AC_HEADER_SYS_WAIT
  409. AC_CHECK_HEADERS(signal.h syslog.h uio.h errno.h sys/time.h sys/socket.h sys/un.h sys/poll.h)
  410. AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h)
  411. dnl Checks for typedefs, structures, and compiler characteristics.
  412. AC_C_CONST
  413. AC_STRUCT_TM
  414. AC_TYPE_PID_T
  415. AC_TYPE_SIZE_T
  416. AC_TYPE_SIGNAL
  417. AC_TYPE_MBSTATE_T
  418. AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
  419. AC_TRY_LINK([#include <stdarg.h>
  420. va_list ap1,ap2;], [va_copy(ap1,ap2);],
  421. ac_cv_HAVE_VA_COPY=yes,
  422. ac_cv_HAVE_VA_COPY=no)])
  423. if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
  424. AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
  425. else
  426. AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
  427. AC_TRY_LINK([#include <stdarg.h>
  428. va_list ap1,ap2;], [__va_copy(ap1,ap2);],
  429. ac_cv_HAVE___VA_COPY=yes,
  430. ac_cv_HAVE___VA_COPY=no)])
  431. if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
  432. AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
  433. fi
  434. fi
  435. AC_TRY_COMPILE([#include <sys/time.h>],
  436. [struct timeval *tv;
  437. struct timezone *tz;],
  438. AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
  439. AC_TRY_COMPILE([#include <sys/time.h>],
  440. [struct timeval *tv;
  441. struct timezone *tz;
  442. gettimeofday(tv, tz);],
  443. AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
  444. AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
  445. dnl Checks for library functions.
  446. AC_CHECK_FUNCS(memmove select socket strdup strstr strtol strtoul floor)
  447. AC_CHECK_FUNCS(poll)
  448. AC_MSG_CHECKING(return type of socket size)
  449. AC_TRY_COMPILE([#include <stdlib.h>
  450. #include <sys/types.h>
  451. #include <sys/socket.h>],
  452. [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
  453. ac_cv_socket_size_type=["size_t"]
  454. AC_MSG_RESULT(size_t),
  455. ac_cv_socket_size_type=["int"]
  456. AC_MSG_RESULT(int))
  457. AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
  458. [Define type of socket size])
  459. dnl #### Process table test
  460. AC_PATH_PROG(PATH_TO_PS,ps)
  461. AC_MSG_CHECKING(for ps syntax)
  462. AC_ARG_WITH(ps_command,
  463. ACX_HELP_STRING([--with-ps-command=PATH],
  464. [Verbatim command to execute for ps]),
  465. PS_COMMAND=$withval)
  466. AC_ARG_WITH(ps_format,
  467. ACX_HELP_STRING([--with-ps-format=FORMAT],
  468. [Format string for scanning ps output]),
  469. PS_FORMAT=$withval)
  470. AC_ARG_WITH(ps_cols,
  471. ACX_HELP_STRING([--with-ps-cols=NUM],
  472. [Number of columns in ps command]),
  473. PS_COLS=$withval)
  474. AC_ARG_WITH(ps_varlist,
  475. ACX_HELP_STRING([--with-ps-varlist=LIST],
  476. [Variable list for sscanf of 'ps' output]),
  477. PS_VARLIST=$withval)
  478. if test -n "$PS_COMMAND" && test -n "$PS_FORMAT" && test -n "$PS_COLS" && test -n "$PS_VARLIST"; then
  479. ac_cv_ps_command="$PS_COMMAND"
  480. ac_cv_ps_format="$PS_FORMAT"
  481. ac_cv_ps_varlist="$PS_VARLIST"
  482. ac_cv_ps_cols="$PS_COLS"
  483. AC_MSG_RESULT([(command-line) $ac_cv_ps_command])
  484. dnl Now using the pst3/kmem hack for solaris systems to avoid truncation
  485. elif test "$ac_cv_uname_s" = "SunOS"; then
  486. #
  487. # this is a very, very ugly hack, to hardcode the location for plugins
  488. #
  489. if test "$libexecdir" = '${exec_prefix}/libexec'; then
  490. if test "$exec_prefix" = "NONE"; then
  491. if test "$prefix" = "NONE"; then
  492. pst3="$ac_default_prefix/libexec/pst3"
  493. else
  494. pst3="$prefix/libexec/pst3"
  495. fi
  496. else
  497. pst3="$exec_prefix/libexec/pst3"
  498. fi
  499. else
  500. pst3="$libexecdir/pst3"
  501. fi
  502. ac_cv_ps_command="$pst3"
  503. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  504. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  505. ac_cv_ps_cols=9
  506. AC_MSG_RESULT([using nagios-plugins internal ps command (pst3) for solaris])
  507. if test `isainfo -b` = 64 ; then
  508. PST3CFLAGS="-m64"
  509. AC_SUBST(PST3CFLAGS)
  510. AC_MSG_NOTICE([using 64bit pst3])
  511. else
  512. AC_MSG_NOTICE([using 32bit pst3])
  513. fi
  514. EXTRAS_ROOT="$EXTRAS_ROOT pst3"
  515. dnl Removing this for the moment - Ton
  516. dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
  517. dnl Limitation that command name is not available
  518. dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
  519. dnl egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
  520. dnl then
  521. dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
  522. dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
  523. dnl ac_cv_ps_format=["%*s %d %d %d %d %*d %*d %d %d%*[ 0123456789abcdef]%[OSRZT]%*s %*s %n"]
  524. dnl ac_cv_ps_cols=8
  525. dnl AC_MSG_RESULT([$ac_cv_ps_command])
  526. dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
  527. dnl so test for this first...
  528. elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
  529. egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
  530. then
  531. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  532. ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
  533. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  534. ac_cv_ps_cols=9
  535. AC_MSG_RESULT([$ac_cv_ps_command])
  536. dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
  537. dnl Should also work for FreeBSD 5.2.1 and 5.3
  538. dnl STAT UCOMM VSZ RSS USER PPID COMMAND
  539. elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
  540. egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
  541. then
  542. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  543. ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
  544. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  545. ac_cv_ps_cols=9
  546. AC_MSG_RESULT([$ac_cv_ps_command])
  547. dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
  548. dnl Limitation: Only first 16 chars returned for ucomm field
  549. dnl Must come before ps -weo
  550. elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
  551. egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
  552. then
  553. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  554. ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
  555. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  556. ac_cv_ps_cols=9
  557. AC_MSG_RESULT([$ac_cv_ps_command])
  558. dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
  559. elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
  560. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
  561. then
  562. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
  563. ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
  564. ac_cv_ps_format="%s %d %d %d %d %d %f %s %s %n"
  565. ac_cv_ps_cols=10
  566. AC_MSG_RESULT([$ac_cv_ps_command])
  567. dnl FreeBSD
  568. elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
  569. egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
  570. then
  571. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  572. ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
  573. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  574. ac_cv_ps_cols=9
  575. AC_MSG_RESULT([$ac_cv_ps_command])
  576. dnl BSD-like mode in RH 6.1
  577. elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
  578. egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  579. then
  580. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  581. ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
  582. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  583. ac_cv_ps_cols=9
  584. AC_MSG_RESULT([$ac_cv_ps_command])
  585. dnl SunOS 4.1.3:
  586. dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
  587. dnl Need the head -1 otherwise test will work because arguments are found
  588. elif ps -laxnwww 2>/dev/null | head -1 | \
  589. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
  590. then
  591. ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  592. ac_cv_ps_command="$PATH_TO_PS -laxnwww"
  593. ac_cv_ps_format="%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
  594. ac_cv_ps_cols=9
  595. AC_MSG_RESULT([$ac_cv_ps_command])
  596. dnl Debian Linux / procps v1.2.9:
  597. dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
  598. dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
  599. dnl
  600. elif ps laxnwww 2>/dev/null | \
  601. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
  602. then
  603. ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
  604. ac_cv_ps_command="$PATH_TO_PS laxnwww"
  605. ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  606. ac_cv_ps_cols=9
  607. AC_MSG_RESULT([$ac_cv_ps_command])
  608. dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
  609. elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
  610. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  611. then
  612. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  613. ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
  614. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  615. ac_cv_ps_cols=9
  616. AC_MSG_RESULT([$ac_cv_ps_command])
  617. dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
  618. dnl Has /usr/bin/ps and /sbin/ps - force sbin version
  619. dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
  620. dnl of 1500). Will need big changes to check_procs to support
  621. elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
  622. egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
  623. then
  624. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
  625. ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
  626. ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
  627. ac_cv_ps_cols=8
  628. AC_MSG_RESULT([$ac_cv_ps_command])
  629. elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
  630. egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  631. then
  632. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  633. ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
  634. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  635. ac_cv_ps_cols=9
  636. AC_MSG_RESULT([$ac_cv_ps_command])
  637. dnl AIX 4.3.3 and 5.1 do not have an rss field
  638. elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
  639. egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
  640. then
  641. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
  642. ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
  643. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  644. ac_cv_ps_cols=8
  645. AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
  646. dnl Solaris 2.6
  647. elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
  648. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  649. then
  650. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  651. ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'"
  652. # There must be no space between the %s and %n due to a wierd problem in sscanf where
  653. # it will return %n as longer than the line length
  654. ac_cv_ps_format="%s %d %d %d %d %d %f %s%n"
  655. ac_cv_ps_cols=9
  656. AC_MSG_RESULT([$ac_cv_ps_command])
  657. elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
  658. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  659. then
  660. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  661. ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
  662. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  663. ac_cv_ps_cols=9
  664. AC_MSG_RESULT([$ac_cv_ps_command])
  665. elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
  666. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  667. then
  668. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  669. ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
  670. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  671. ac_cv_ps_cols=9
  672. AC_MSG_RESULT([$ac_cv_ps_command])
  673. dnl wonder who takes state instead of stat
  674. elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
  675. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
  676. then
  677. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  678. ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
  679. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  680. ac_cv_ps_cols=8
  681. AC_MSG_RESULT([$ac_cv_ps_command])
  682. dnl IRIX 53
  683. elif ps -el 2>/dev/null | \
  684. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  685. then
  686. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
  687. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
  688. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
  689. ac_cv_ps_cols=8
  690. AC_MSG_RESULT([$ac_cv_ps_command])
  691. dnl IRIX 63
  692. elif ps -el 2>/dev/null | \
  693. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  694. then
  695. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
  696. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
  697. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  698. ac_cv_ps_cols=6
  699. AC_MSG_RESULT([$ac_cv_ps_command])
  700. dnl AIX 4.1:
  701. dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
  702. dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
  703. elif ps -el 2>/dev/null | \
  704. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  705. then
  706. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
  707. ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
  708. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  709. ac_cv_ps_cols=6
  710. AC_MSG_RESULT([$ac_cv_ps_command])
  711. dnl AIX?
  712. elif ps glaxen 2>/dev/null | \
  713. egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
  714. then
  715. ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  716. ac_cv_ps_command="$PATH_TO_PS glaxen"
  717. ac_cv_ps_format="%*s %d %d %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  718. ac_cv_ps_cols=8
  719. AC_MSG_RESULT([$ac_cv_ps_command])
  720. dnl MacOSX / Darwin
  721. dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
  722. dnl Some truncation will happen in UCOMM column
  723. dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
  724. dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
  725. elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
  726. egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
  727. then
  728. ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
  729. ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
  730. ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
  731. ac_cv_ps_cols=8
  732. AC_MSG_RESULT([$ac_cv_ps_command])
  733. dnl UnixWare
  734. elif ps -Al 2>/dev/null | \
  735. egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
  736. then
  737. ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
  738. ac_cv_ps_command="$PATH_TO_PS -Al"
  739. ac_cv_ps_format="%*s %s %d %d %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  740. ac_cv_ps_cols=8
  741. AC_MSG_RESULT([$ac_cv_ps_command])
  742. else
  743. AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
  744. fi
  745. if test -n "$ac_cv_ps_varlist" ; then
  746. AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
  747. [Variable list for sscanf of 'ps' output])
  748. AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
  749. [Verbatim command to execute for ps in check_procs])
  750. AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
  751. [Format string for scanning ps output in check_procs])
  752. AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
  753. [Number of columns in ps command])
  754. EXTRAS="$EXTRAS check_procs check_nagios"
  755. if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
  756. AC_DEFINE(PS_USES_PROCETIME,"yes",
  757. [Whether the ps utility uses the "procetime" field])
  758. fi
  759. fi
  760. AC_PATH_PROG(PATH_TO_PING,ping)
  761. AC_PATH_PROG(PATH_TO_PING6,ping6)
  762. AC_ARG_WITH(ping_command,
  763. ACX_HELP_STRING([--with-ping-command=SYNTAX],
  764. [sets syntax for ICMP ping]),
  765. with_ping_command=$withval,)
  766. AC_MSG_CHECKING(for ICMP ping syntax)
  767. ac_cv_ping_packets_first=no
  768. ac_cv_ping_has_timeout=no
  769. if test -n "$with_ping_command"
  770. then
  771. AC_MSG_RESULT([(command-line) $with_ping_command])
  772. if test -n "$ac_cv_ping_packets_first"
  773. then
  774. ac_cv_ping_packets_first=yes
  775. ac_cv_ping_has_timeout=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 -w 10 -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 -w %d -c %d %s"
  876. ac_cv_ping6_packets_first=yes
  877. ac_cv_ping_has_timeout=yes
  878. AC_MSG_RESULT([$with_ping6_command])
  879. elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
  880. egrep -i "^round-trip|^rtt" >/dev/null
  881. then
  882. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  883. ac_cv_ping6_packets_first=yes
  884. AC_MSG_RESULT([$with_ping6_command])
  885. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  886. egrep -i "^round-trip|^rtt" >/dev/null
  887. then
  888. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  889. ac_cv_ping6_packets_first=yes
  890. AC_MSG_RESULT([$with_ping6_command])
  891. elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
  892. egrep -i "^round-trip|^rtt" >/dev/null
  893. then
  894. with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
  895. AC_MSG_RESULT([$with_ping6_command])
  896. elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
  897. egrep -i "^round-trip|^rtt" >/dev/null
  898. then
  899. with_ping6_command="$PATH_TO_PING6 %s -n %d"
  900. AC_MSG_RESULT([$with_ping6_command])
  901. elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  902. egrep -i "^round-trip|^rtt" >/dev/null
  903. then
  904. with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
  905. AC_MSG_RESULT([$with_ping6_command])
  906. elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  907. egrep -i "^round-trip|^rtt" >/dev/null
  908. then
  909. with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
  910. AC_MSG_RESULT([$with_ping6_command])
  911. elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
  912. egrep -i "^round-trip|^rtt" >/dev/null
  913. then
  914. with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
  915. ac_cv_ping6_packets_first=yes
  916. AC_MSG_RESULT([$with_ping_command])
  917. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  918. egrep -i "^round-trip|^rtt" >/dev/null
  919. then
  920. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  921. ac_cv_ping6_packets_first=yes
  922. AC_MSG_RESULT([$with_ping6_command])
  923. fi
  924. elif test "x$PATH_TO_PING" != "x"; then
  925. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  926. $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  927. egrep -i "^round-trip|^rtt" >/dev/null
  928. then
  929. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  930. ac_cv_ping6_packets_first=yes
  931. AC_MSG_RESULT([$with_ping6_command])
  932. elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
  933. egrep -i "^round-trip|^rtt" >/dev/null
  934. then
  935. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  936. ac_cv_ping6_packets_first=yes
  937. AC_MSG_RESULT([$with_ping6_command])
  938. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  939. egrep -i "^round-trip|^rtt" >/dev/null
  940. then
  941. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  942. ac_cv_ping6_packets_first=yes
  943. AC_MSG_RESULT([$with_ping6_command])
  944. elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
  945. egrep -i "^round-trip|^rtt" >/dev/null
  946. then
  947. with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
  948. AC_MSG_RESULT([$with_ping6_command])
  949. elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
  950. egrep -i "^round-trip|^rtt" >/dev/null
  951. then
  952. with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
  953. AC_MSG_RESULT([$with_ping6_command])
  954. elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  955. egrep -i "^round-trip|^rtt" >/dev/null
  956. then
  957. with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
  958. AC_MSG_RESULT([$with_ping6_command])
  959. elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  960. egrep -i "^round-trip|^rtt" >/dev/null
  961. then
  962. with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
  963. AC_MSG_RESULT([$with_ping6_command])
  964. elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
  965. egrep -i "^round-trip|^rtt" >/dev/null
  966. then
  967. with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
  968. ac_cv_ping6_packets_first=yes
  969. AC_MSG_RESULT([$with_ping_command])
  970. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  971. egrep -i "^round-trip|^rtt" >/dev/null
  972. then
  973. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  974. ac_cv_ping6_packets_first=yes
  975. AC_MSG_RESULT([$with_ping6_command])
  976. fi
  977. fi
  978. if test "x$with_ping6_command" != "x"; then
  979. AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
  980. [path and args for ICMPv6 ping command])
  981. else
  982. AC_MSG_RESULT([none])
  983. fi
  984. if test "x$ac_cv_ping6_packets_first" != "xno"; then
  985. AC_DEFINE(PING6_PACKETS_FIRST,1,
  986. [Define if packet count must precede host])
  987. fi
  988. fi
  989. AC_ARG_WITH(nslookup_command,
  990. ACX_HELP_STRING([--with-nslookup-command=PATH],
  991. [sets path to nslookup executable]),
  992. ac_cv_nslookup_command=$withval)
  993. if test -n "$ac_cv_nslookup_command"; then
  994. AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
  995. else
  996. AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
  997. if test -n "$PATH_TO_NSLOOKUP"
  998. then
  999. AC_MSG_CHECKING(for nslookup syntax)
  1000. if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
  1001. then
  1002. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
  1003. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1004. else
  1005. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
  1006. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1007. fi
  1008. else
  1009. AC_MSG_WARN([nslookup command not found])
  1010. fi
  1011. fi
  1012. if test -n "$ac_cv_nslookup_command"; then
  1013. EXTRAS="$EXTRAS check_dns"
  1014. AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
  1015. fi
  1016. AC_MSG_CHECKING([for number of cpus])
  1017. AC_TRY_COMPILE([#include <unistd.h>],
  1018. [sysconf(_SC_NPROCESSORS_CONF) > 0;],
  1019. AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
  1020. AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
  1021. AC_MSG_RESULT([cannot calculate])
  1022. )
  1023. AC_PATH_PROG(PATH_TO_UPTIME,uptime)
  1024. AC_ARG_WITH(uptime_command,
  1025. ACX_HELP_STRING([--with-uptime-command=PATH],
  1026. [sets path to uptime]), PATH_TO_UPTIME=$withval)
  1027. AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
  1028. AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
  1029. AC_ARG_WITH(rpcinfo_command,
  1030. ACX_HELP_STRING([--with-rpcinfo-command=PATH],
  1031. [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
  1032. AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
  1033. AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
  1034. if test -x "$PATH_TO_LMSTAT"
  1035. then
  1036. AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
  1037. else
  1038. AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
  1039. fi
  1040. AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
  1041. AC_ARG_WITH(smbclient_command,
  1042. ACX_HELP_STRING([--with-smbclient-command=PATH],
  1043. [sets path to smbclient]),
  1044. PATH_TO_SMBCLIENT=$withval)
  1045. if test -n "$PATH_TO_SMBCLIENT"
  1046. then
  1047. AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
  1048. else
  1049. AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
  1050. fi
  1051. AC_PATH_PROG(PATH_TO_WHO,who)
  1052. if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
  1053. then
  1054. ac_cv_path_to_who="$PATH_TO_WHO -q"
  1055. else
  1056. ac_cv_path_to_who="$PATH_TO_WHO"
  1057. fi
  1058. AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
  1059. [path and arguments for invoking 'who'])
  1060. AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
  1061. AC_ARG_WITH(snmpget_command,
  1062. ACX_HELP_STRING([--with-snmpget-command=PATH],
  1063. [Path to snmpget command]),
  1064. PATH_TO_SNMPGET=$withval)
  1065. if test -n "$PATH_TO_SNMPGET"
  1066. then
  1067. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
  1068. EXTRAS="$EXTRAS check_hpjd check_snmp"
  1069. else
  1070. AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
  1071. fi
  1072. AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
  1073. AC_ARG_WITH(snmpgetnext_command,
  1074. ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
  1075. [Path to snmpgetnext command]),
  1076. PATH_TO_SNMPGETNEXT=$withval)
  1077. if test -n "$PATH_TO_SNMPGETNEXT"
  1078. then
  1079. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
  1080. fi
  1081. if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
  1082. then
  1083. AC_MSG_CHECKING(for Net::SNMP perl module)
  1084. AC_MSG_RESULT([found])
  1085. else
  1086. AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
  1087. fi
  1088. AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
  1089. AC_PATH_PROG(PATH_TO_QSTAT,qstat)
  1090. AC_ARG_WITH(qstat_command,
  1091. ACX_HELP_STRING([--with-qstat-command=PATH],
  1092. [Path to qstat command]), PATH_TO_QSTAT=$withval)
  1093. if test -x "$PATH_TO_QUAKESTAT"
  1094. then
  1095. ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
  1096. EXTRAS="$EXTRAS check_game"
  1097. elif test -n "$PATH_TO_QSTAT"
  1098. then
  1099. ac_cv_path_to_qstat="$PATH_TO_QSTAT"
  1100. EXTRAS="$EXTRAS check_game"
  1101. else
  1102. AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
  1103. fi
  1104. if test $ac_cv_path_to_qstat
  1105. then
  1106. AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
  1107. [path to qstat/quakestat])
  1108. fi
  1109. AC_PATH_PROG(PATH_TO_FPING,fping)
  1110. AC_ARG_WITH(fping_command,
  1111. ACX_HELP_STRING([--with-fping-command=PATH],
  1112. [Path to fping command]), PATH_TO_FPING=$withval)
  1113. if test -n "$PATH_TO_FPING"
  1114. then
  1115. AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
  1116. EXTRAS="$EXTRAS check_fping"
  1117. else
  1118. AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
  1119. fi
  1120. AC_PATH_PROG(PATH_TO_SSH,ssh)
  1121. AC_ARG_WITH(ssh_command,
  1122. ACX_HELP_STRING([--with-ssh-command=PATH],
  1123. [sets path for ssh]), PATH_TO_SSH=$withval)
  1124. if test -n "$PATH_TO_SSH"
  1125. then
  1126. AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
  1127. EXTRAS="$EXTRAS check_by_ssh"
  1128. else
  1129. AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
  1130. fi
  1131. AC_PATH_PROG(PATH_TO_MAILQ,mailq)
  1132. AC_ARG_WITH(mailq_command,
  1133. ACX_HELP_STRING([--with-mailq-command=PATH],
  1134. [sets path to mailq]), PATH_TO_MAILQ=$withval)
  1135. if test -n "$PATH_TO_MAILQ"
  1136. then
  1137. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
  1138. else
  1139. AC_MSG_WARN([Could not find mailq or eqivalent])
  1140. fi
  1141. AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
  1142. if test -x "$PATH_TO_QMAIL_QSTAT"
  1143. then
  1144. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
  1145. else
  1146. AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
  1147. fi
  1148. dnl SWAP info required is amount allocated/available and amount free
  1149. dnl The plugin works through all the swap devices and adds up the total swap
  1150. dnl available.
  1151. AC_PATH_PROG(PATH_TO_SWAP,swap)
  1152. if (test -n "$PATH_TO_SWAP")
  1153. then
  1154. AC_MSG_CHECKING([for $PATH_TO_SWAP format])
  1155. if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
  1156. then
  1157. ac_cv_have_swap=yes
  1158. ac_cv_swap_command="$PATH_TO_SWAP -l"
  1159. if [$PATH_TO_SWAP -l 2>/dev/null | \
  1160. egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
  1161. >/dev/null]
  1162. then
  1163. ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
  1164. ac_cv_swap_conv=2048
  1165. AC_MSG_RESULT([using IRIX format swap])
  1166. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
  1167. then
  1168. ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
  1169. ac_cv_swap_conv=2048
  1170. AC_MSG_RESULT([using Unixware format swap])
  1171. else
  1172. dnl if we don't know what format swap's output is
  1173. dnl we might as well pretend we didn't see it
  1174. ac_cv_have_swap=""
  1175. ac_cv_swap_command=""
  1176. fi
  1177. fi
  1178. dnl end if for PATH_TO_SWAP
  1179. fi
  1180. AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
  1181. if (test -n "$PATH_TO_SWAPINFO")
  1182. then
  1183. AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
  1184. if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
  1185. then
  1186. ac_cv_have_swap=yes
  1187. ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
  1188. if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
  1189. then
  1190. ac_cv_swap_format=["%*s %f %*d %f"]
  1191. ac_cv_swap_conv=1024
  1192. AC_MSG_RESULT([using FreeBSD format swapinfo])
  1193. fi
  1194. elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
  1195. then
  1196. ac_cv_have_swap=yes
  1197. ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
  1198. ac_cv_swap_format=["%*s %f %*d %f"]
  1199. ac_cv_swap_conv=1024
  1200. AC_MSG_RESULT([using HP-UX format swapinfo])
  1201. fi
  1202. dnl end if for PATH_TO_SWAPINFO
  1203. fi
  1204. AC_PATH_PROG(PATH_TO_LSPS,lsps)
  1205. if (test -n "$PATH_TO_LSPS")
  1206. then
  1207. AC_MSG_CHECKING([for $PATH_TO_LSPS format])
  1208. if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
  1209. then
  1210. ac_cv_have_swap=yes
  1211. ac_cv_swap_command="$PATH_TO_LSPS -a"
  1212. ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
  1213. ac_cv_swap_conv=1
  1214. AC_MSG_RESULT([using AIX lsps])
  1215. fi
  1216. dnl end if for PATH_TO_SWAPINFO
  1217. fi
  1218. dnl
  1219. dnl test for swapctl system call, both the 2-arg and 3-arg variants
  1220. dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
  1221. dnl in the various BSD's
  1222. dnl
  1223. AC_CHECK_HEADERS([sys/stat.h sys/param.h])
  1224. AC_CHECK_HEADERS([sys/swap.h], [], [], [
  1225. #ifdef HAVE_SYS_PARAM_H
  1226. #include <sys/param.h>
  1227. #endif
  1228. ])
  1229. AC_CHECK_DECLS([swapctl],,,[
  1230. #include <unistd.h>
  1231. #include <sys/types.h>
  1232. #include <sys/param.h>
  1233. #include <sys/stat.h>
  1234. #include <sys/swap.h>
  1235. ])
  1236. AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
  1237. #include <sys/types.h>
  1238. #include <sys/param.h>
  1239. #include <sys/stat.h>
  1240. #include <sys/swap.h>
  1241. ])
  1242. AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
  1243. #include <unistd.h>
  1244. #include <sys/types.h>
  1245. #include <sys/param.h>
  1246. #include <sys/stat.h>
  1247. #include <sys/swap.h>
  1248. ])
  1249. if test "$ac_cv_have_decl_swapctl" = "yes";
  1250. then
  1251. EXTRAS="$EXTRAS check_swap"
  1252. AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
  1253. if test "$ac_cv_type_swaptbl_t" = "yes" -a \
  1254. "$ac_cv_type_swapent_t" = "yes";
  1255. then
  1256. AC_MSG_RESULT([yes])
  1257. ac_cv_check_swap_swapctl_svr4="1";
  1258. AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
  1259. [Define if 2-argument SVR4 swapctl exists])
  1260. else
  1261. AC_MSG_RESULT([no])
  1262. AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
  1263. if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
  1264. then
  1265. AC_MSG_RESULT([yes])
  1266. AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
  1267. [Define if 3-argument BSD swapctl exists])
  1268. else
  1269. AC_MSG_RESULT([no])
  1270. fi
  1271. fi
  1272. AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
  1273. if test "$ac_cv_check_swap_swapctl_svr4" = "1";
  1274. then
  1275. dnl
  1276. dnl the SVR4 spec returns values in pages
  1277. dnl
  1278. AC_MSG_RESULT([page])
  1279. AC_CHECK_DECLS([sysconf])
  1280. AC_MSG_CHECKING([for system page size])
  1281. if test "$ac_cv_have_decl_sysconf" = "yes";
  1282. then
  1283. AC_MSG_RESULT([determined by sysconf(3)])
  1284. ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
  1285. else
  1286. AC_MSG_WARN([don't know. guessing 4096k])
  1287. ac_cv_swap_conv=256
  1288. fi
  1289. else
  1290. dnl
  1291. dnl the BSD spec returns values in blocks
  1292. dnl
  1293. AC_MSG_RESULT([blocks (assuming 512b)])
  1294. ac_cv_swap_conv=2048
  1295. fi
  1296. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1297. [Conversion factor to MB])
  1298. fi
  1299. dnl
  1300. dnl end tests for the swapctl system calls
  1301. dnl
  1302. if test "x$ac_cv_have_swap" != "x"
  1303. then
  1304. AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
  1305. EXTRAS="$EXTRAS check_swap"
  1306. fi
  1307. if test "x$ac_cv_swap_command" != "x"
  1308. then
  1309. AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
  1310. [Path to swap/swapinfo binary, with any args])
  1311. AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
  1312. [Format string for parsing swap output])
  1313. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1314. [Conversion factor to MB])
  1315. fi
  1316. AC_ARG_WITH(proc-meminfo,
  1317. ACX_HELP_STRING([--with-proc-meminfo=PATH],
  1318. [path to /proc/meminfo or equivalent]),
  1319. ac_cv_proc_meminfo=$withval)
  1320. dnl dunno why this does not work below - use hack (kbd)
  1321. dnl fine on linux, broken on solaris
  1322. dnl if /bin/test -e "/proc/meminfo"
  1323. AC_MSG_CHECKING([for /proc/meminfo])
  1324. if test -n "$ac_cv_proc_meminfo"; then
  1325. AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
  1326. elif [cat /proc/meminfo > /dev/null 2>&1]; then
  1327. AC_MSG_RESULT([found /proc/meminfo])
  1328. ac_cv_proc_meminfo="/proc/meminfo"
  1329. else
  1330. AC_MSG_RESULT([no])
  1331. fi
  1332. if test -n "$ac_cv_proc_meminfo"; then
  1333. AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
  1334. AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
  1335. EXTRAS="$EXTRAS check_swap"
  1336. fi
  1337. AC_PATH_PROG(PATH_TO_DIG,dig)
  1338. AC_ARG_WITH(dig_command,
  1339. ACX_HELP_STRING([--with-dig-command=PATH],
  1340. [Path to dig command]), PATH_TO_DIG=$withval)
  1341. if test -n "$PATH_TO_DIG"; then
  1342. EXTRAS="$EXTRAS check_dig"
  1343. AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
  1344. fi
  1345. AC_PATH_PROG(PATH_TO_APTGET,apt-get)
  1346. AC_ARG_WITH(apt-get_command,
  1347. ACX_HELP_STRING([--with-apt-get-command=PATH],
  1348. [Path to apt-get command]),
  1349. with_apt_get_command=$withval,
  1350. with_apt_get_command=$PATH_TO_APTGET)
  1351. AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
  1352. if test -n "$PATH_TO_APTGET" ; then
  1353. EXTRAS="$EXTRAS check_apt"
  1354. fi
  1355. if test -f plugins/check_nt.c ; then
  1356. EXTRAS="$EXTRAS check_nt"
  1357. elif test -f ../plugins/check_nt.c ; then
  1358. EXTRAS="$EXTRAS check_nt"
  1359. fi
  1360. dnl used in check_dhcp
  1361. AC_CHECK_HEADERS(sys/sockio.h)
  1362. case $host in
  1363. *bsd*)
  1364. AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
  1365. ;;
  1366. *linux*)
  1367. AC_DEFINE(__linux__,1,[linux specific code in check_dhcp.c])
  1368. ;;
  1369. *sun* | *solaris*)
  1370. AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
  1371. ;;
  1372. *hpux*)
  1373. AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
  1374. ;;
  1375. esac
  1376. AC_SUBST(EXTRAS)
  1377. AC_SUBST(EXTRAS_ROOT)
  1378. AC_SUBST(EXTRA_NETOBJS)
  1379. AC_SUBST(DEPLIBS)
  1380. AM_GNU_GETTEXT([external], [need-ngettext])
  1381. AM_GNU_GETTEXT_VERSION(0.15)
  1382. dnl Check for Redhat spopen problem
  1383. dnl Wierd problem where ECHILD is returned from a wait call in error
  1384. dnl Only appears to affect nslookup and dig calls. Only affects redhat around
  1385. dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
  1386. dnl We patch plugins/popen.c
  1387. dnl Need to add smp because uname different on those
  1388. dnl Can force patch to be applied with --enable-redhat-pthread-workaround
  1389. AC_ARG_ENABLE(redhat-pthread-workaround,
  1390. AC_HELP_STRING([--enable-redhat-pthread-workaround],
  1391. [force Redhat patch to be applied (default: test system)]),
  1392. [ac_cv_enable_redhat_pthread_workaround=$enableval],
  1393. [ac_cv_enable_redhat_pthread_workaround=test])
  1394. if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
  1395. if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
  1396. AC_MSG_NOTICE([See http://nagiosplugins.org/faq/compile/configure_appears_to_hang if this next part takes a long time])
  1397. AC_MSG_CHECKING(for redhat spopen problem)
  1398. ( cd config_test && make && make test ) > /dev/null 2>&1
  1399. if test $? -eq 0 ; then
  1400. AC_MSG_RESULT(okay)
  1401. else
  1402. AC_MSG_RESULT(error)
  1403. AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
  1404. fi
  1405. fi
  1406. elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
  1407. AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
  1408. fi
  1409. dnl Perl modules
  1410. AC_ARG_ENABLE(perl-modules,
  1411. AC_HELP_STRING([--enable-perl-modules],
  1412. [Enables installation of Nagios::Plugin and its dependencies (default: no)]),
  1413. [enable_perl_modules=$enableval],
  1414. [enable_perl_modules=no])
  1415. if test "$enable_perl_modules" = "yes" ; then
  1416. AC_SUBST(PERLMODS_DIR,perlmods)
  1417. fi
  1418. dnl External libraries - see ACKNOWLEDGEMENTS
  1419. gl_INIT
  1420. dnl Some helpful common compile errors checked here
  1421. if test "$ac_cv_uname_s" = 'SunOS' -a \( "x$ac_cv_prog_ac_ct_AR" = "x" -o "$ac_cv_prog_ac_ct_AR" = 'false' \) ; then
  1422. AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
  1423. fi
  1424. AC_OUTPUT(
  1425. Makefile
  1426. lib/Makefile
  1427. plugins/Makefile
  1428. lib/tests/Makefile
  1429. plugins-root/Makefile
  1430. plugins-scripts/Makefile
  1431. plugins-scripts/subst
  1432. plugins-scripts/utils.pm
  1433. plugins-scripts/utils.sh
  1434. perlmods/Makefile
  1435. command.cfg
  1436. test.pl
  1437. pkg/solaris/pkginfo
  1438. po/Makefile.in
  1439. )
  1440. dnl the ones below that are commented out need to be cleaned up
  1441. dnl in the configure code above to use with_foo instead of ac_cv_foo
  1442. dnl if we want them to show up here. it'd also make the code cleaner.
  1443. dnl i'll get to that on another rainy day :) -sf
  1444. ACX_FEATURE([with],[apt-get-command])
  1445. dnl ACX_FEATURE([with],[dig-command])
  1446. dnl ACX_FEATURE([with],[fping-command])
  1447. dnl ACX_FEATURE([with],[mailq-command])
  1448. dnl ACX_FEATURE([with],[nslookup-command])
  1449. ACX_FEATURE([with],[ping6-command])
  1450. ACX_FEATURE([with],[ping-command])
  1451. dnl ACX_FEATURE([with],[qstat-command])
  1452. dnl ACX_FEATURE([with],[rpcinfo-command])
  1453. dnl ACX_FEATURE([with],[smbclient-command])
  1454. dnl ACX_FEATURE([with],[snmpget-command])
  1455. dnl ACX_FEATURE([with],[snmpgetnext-command])
  1456. dnl ACX_FEATURE([with],[ssh-command])
  1457. dnl ACX_FEATURE([with],[uptime-command])
  1458. dnl ACX_FEATURE([with],[proc-meminfo])
  1459. dnl ACX_FEATURE([with],[ps-command])
  1460. dnl ACX_FEATURE([with],[ps-format])
  1461. dnl ACX_FEATURE([with],[ps-cols])
  1462. dnl ACX_FEATURE([with],[ps-varlist])
  1463. ACX_FEATURE([with],[ipv6])
  1464. ACX_FEATURE([with],[mysql])
  1465. ACX_FEATURE([with],[openssl])
  1466. ACX_FEATURE([with],[gnutls])
  1467. ACX_FEATURE([enable],[extra-opts])
  1468. ACX_FEATURE([with],[perl])
  1469. ACX_FEATURE([enable],[perl-modules])
  1470. ACX_FEATURE([with],[cgiurl])
  1471. ACX_FEATURE([with],[trusted-path])