configure.in 56 KB

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