configure.in 52 KB

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