configure.in 50 KB

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