configure.in 55 KB

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