configure.in 53 KB

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