configure.in 53 KB

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