configure.in 52 KB

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