configure.in 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554
  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. dnl The /usr checks need to be done so that the right area is include'd
  261. if test "$OPENSSL" = "/usr/bin/openssl"; then
  262. OPENSSL=/usr
  263. elif test "$OPENSSL" = "/usr/sbin/openssl"; then
  264. OPENSSL=/usr
  265. elif 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. if test "$PKGTEST" = "yes"; then
  341. AC_MSG_WARN([OpenSSL libs could not be found])
  342. else
  343. AC_MSG_WARN([OpenSSL libs and/or directories were not found where specified!])
  344. fi
  345. with_openssl="no"
  346. else
  347. check_tcp_ssl="check_simap check_spop check_jabber check_nntps"
  348. AC_SUBST(check_tcp_ssl)
  349. AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found])
  350. with_openssl="yes"
  351. # Needed for subsequent compiled programs
  352. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSSL/lib$libsuff"
  353. export LD_LIBRARY_PATH
  354. fi
  355. fi
  356. AC_CHECK_HEADERS(unistd.h)
  357. dnl Check for AF_INET6 support - unistd.h required for Darwin
  358. AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
  359. AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
  360. #include <unistd.h>
  361. #endif
  362. #include <netinet/in.h>
  363. #include <sys/socket.h>],
  364. [struct sockaddr_in6 sin6;
  365. void *p;
  366. sin6.sin6_family = AF_INET6;
  367. sin6.sin6_port = 587;
  368. p = &sin6.sin6_addr;],
  369. [with_ipv6=yes],
  370. [with_ipv6=no])
  371. ])
  372. if test x"$with_ipv6" != xno ; then
  373. AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
  374. fi
  375. dnl #########################################################################
  376. dnl Check if Posix getaddrinfo() is available. It is also possible to use
  377. dnl the version from the lwres library distributed with BIND.
  378. dnl #########################################################################
  379. AC_ARG_ENABLE([emulate-getaddrinfo],
  380. ACX_HELP_STRING([--enable-emulate-getaddrinfo],
  381. [enable getaddrinfo emulation (default=no)]),
  382. ,
  383. enable_emulate_getaddrinfo=no)
  384. AC_ARG_WITH(lwres,
  385. ACX_HELP_STRING([--with-lwres=DIR],
  386. [use lwres library for getaddrinfo (default=no)]),
  387. ,
  388. with_lwres=no)
  389. dnl ## enable force to test getaddrinfo.c
  390. if test x$enable_emulate_getaddrinfo = xforce ; then
  391. enable_emulate_getaddrinfo=yes
  392. have_getaddrinfo=no
  393. else
  394. have_getaddrinfo=no
  395. if test x$with_lwres != xno ; then
  396. if test "$with_lwres" != yes ; then
  397. CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
  398. LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
  399. fi
  400. AC_CHECK_HEADERS(lwres/netdb.h, ,
  401. [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
  402. AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
  403. [AC_MSG_ERROR([cannot find the lwres library])],
  404. -lnsl -lpthread)
  405. have_getaddrinfo=yes
  406. fi
  407. if test x$have_getaddrinfo != xyes ; then
  408. AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
  409. fi
  410. dnl # Special nonsense for systems that actually have getaddrinfo but
  411. dnl # redefine the name to something else, e.g. OSF
  412. if test x$have_getaddrinfo != xyes ; then
  413. AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
  414. AC_TRY_LINK([
  415. # include <netdb.h>
  416. ], [
  417. struct addrinfo hints, *res;
  418. int err;
  419. err = getaddrinfo ("host", "service", &hints, &res);
  420. ], [
  421. have_getaddrinfo=yes
  422. AC_MSG_RESULT(yes)
  423. ], [AC_MSG_RESULT(no)])
  424. fi
  425. fi
  426. if test x$have_getaddrinfo != xno ; then
  427. if test x$enable_emulate_getaddrinfo != xno ; then
  428. AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
  429. fi
  430. AC_DEFINE(HAVE_GETADDRINFO, 1,
  431. [Does system provide RFC 2553/Posix getaddrinfo?])
  432. else
  433. if test x$enable_emulate_getaddrinfo != xyes ; then
  434. dnl AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
  435. enable_emulate_getaddrinfo=yes
  436. AC_MSG_WARN([enabling getaddrinfo emulation])
  437. fi
  438. EXTRA_NETOBJS="$EXTRA_NETOBJS getaddrinfo.o"
  439. fi
  440. if test x"$enable_emulate_getaddrinfo" != xno ; then
  441. have_resolver=no
  442. dnl Try for getipnodebyname
  443. AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
  444. if test x"$have_resolver" != xno ; then
  445. AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
  446. [Set when getipnodebyname is available])
  447. fi
  448. dnl Try for gethostbyname_r
  449. if test x"$have_resolver" = xno ; then
  450. AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
  451. [have_resolver=yes
  452. ACX_WHICH_GETHOSTBYNAME_R])
  453. fi
  454. dnl Try for gethostbyname
  455. if test x"$have_resolver" = xno ; then
  456. if test x"$enable_pthreads" != xno ; then
  457. AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
  458. fi
  459. AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
  460. [AC_MSG_ERROR([cannot find gethostbyname])])
  461. fi
  462. EXTRA_NETOBJS="$EXTRA_NETOBJS gethostbyname.o"
  463. fi
  464. AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
  465. if test "$FOUNDINCLUDE" = "no"; then
  466. _SAVEDCPPFLAGS="$CPPFLAGS"
  467. CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
  468. unset ac_cv_header_krb5_h
  469. AC_CHECK_HEADERS(krb5.h,
  470. KRB5INCLUDE="-I/usr/kerberos/include"
  471. FOUNDINCLUDE=yes,
  472. FOUNDINCLUDE=no)
  473. fi
  474. AC_SUBST(KRBINCLUDE)
  475. if test "$FOUNDINCLUDE" = "no"; then
  476. CPPFLAGS="$_SAVEDCPPFLAGS"
  477. fi
  478. dnl
  479. dnl Checks for header files.
  480. dnl
  481. AC_HEADER_STDC
  482. AC_HEADER_TIME
  483. AC_HEADER_SYS_WAIT
  484. 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)
  485. AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
  486. dnl Checks for typedefs, structures, and compiler characteristics.
  487. AC_C_CONST
  488. AC_STRUCT_TM
  489. AC_TYPE_PID_T
  490. AC_TYPE_SIZE_T
  491. AC_TYPE_SIGNAL
  492. AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
  493. AC_TRY_LINK([#include <stdarg.h>
  494. va_list ap1,ap2;], [va_copy(ap1,ap2);],
  495. ac_cv_HAVE_VA_COPY=yes,
  496. ac_cv_HAVE_VA_COPY=no)])
  497. if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
  498. AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
  499. else
  500. AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
  501. AC_TRY_LINK([#include <stdarg.h>
  502. va_list ap1,ap2;], [__va_copy(ap1,ap2);],
  503. ac_cv_HAVE___VA_COPY=yes,
  504. ac_cv_HAVE___VA_COPY=no)])
  505. if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
  506. AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
  507. fi
  508. fi
  509. AC_CHECK_FUNCS(vsnprintf snprintf asprintf vasprintf)
  510. AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
  511. AC_TRY_RUN([
  512. #include <sys/types.h>
  513. #include <stdarg.h>
  514. void foo(const char *format, ...) {
  515. va_list ap;
  516. int len;
  517. char buf[5];
  518. va_start(ap, format);
  519. len = vsnprintf(buf, 0, format, ap);
  520. va_end(ap);
  521. if (len != 5) exit(1);
  522. va_start(ap, format);
  523. len = vsnprintf(0, 0, format, ap);
  524. va_end(ap);
  525. if (len != 5) exit(1);
  526. if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
  527. exit(0);
  528. }
  529. main() { foo("hello"); }
  530. ],
  531. ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
  532. if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
  533. AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
  534. fi
  535. AC_TRY_COMPILE([#include <sys/time.h>],
  536. [struct timeval *tv;
  537. struct timezone *tz;],
  538. AC_DEFINE(HAVE_STRUCT_TIMEVAL,1,[Define if we have a timeval structure])
  539. AC_TRY_COMPILE([#include <sys/time.h>],
  540. [struct timeval *tv;
  541. struct timezone *tz;
  542. gettimeofday(tv, tz);],
  543. AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define if gettimeofday is found]),
  544. AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed])))
  545. dnl Checks for library functions.
  546. AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul)
  547. AC_MSG_CHECKING(return type of socket size)
  548. AC_TRY_COMPILE([#include <stdlib.h>
  549. #include <sys/types.h>
  550. #include <sys/socket.h>],
  551. [int a = send(1, (const void *) buffer, (size_t *) 0, (int *) 0);],
  552. ac_cv_socket_size_type=["size_t"]
  553. AC_MSG_RESULT(size_t),
  554. ac_cv_socket_size_type=["int"]
  555. AC_MSG_RESULT(int))
  556. AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $ac_cv_socket_size_type ,
  557. [Define type of socket size])
  558. if test -f "/proc/loadavg"
  559. then
  560. AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define if /proc/loadavg or similar exists])
  561. AC_DEFINE_UNQUOTED(PROC_LOADAVG,"/proc/loadavg",[Location of /proc/loadavg])
  562. fi
  563. dnl #### Process table test
  564. AC_PATH_PROG(PATH_TO_PS,ps)
  565. AC_MSG_CHECKING(for ps syntax)
  566. dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
  567. dnl Should also work for FreeBSD 5.2.1 and 5.3
  568. dnl STAT UCOMM VSZ RSS USER PPID COMMAND
  569. if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  570. egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
  571. then
  572. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  573. ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid ppid vsz rss pcpu comm args'"
  574. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  575. ac_cv_ps_cols=8
  576. AC_MSG_RESULT([$ac_cv_ps_command])
  577. dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
  578. elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \
  579. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
  580. then
  581. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
  582. ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'"
  583. ac_cv_ps_format="%s %d %d %d %d %f %s %s %n"
  584. ac_cv_ps_cols=9
  585. AC_MSG_RESULT([$ac_cv_ps_command])
  586. dnl FreeBSD
  587. elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
  588. egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
  589. then
  590. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  591. ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid vsz rss pcpu command command'"
  592. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  593. ac_cv_ps_cols=8
  594. AC_MSG_RESULT([$ac_cv_ps_command])
  595. dnl BSD-like mode in RH 6.1
  596. elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
  597. egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  598. then
  599. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  600. ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid vsz rss pcpu comm args'"
  601. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  602. ac_cv_ps_cols=8
  603. AC_MSG_RESULT([$ac_cv_ps_command])
  604. dnl SunOS 4.1.3:
  605. dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
  606. dnl Need the head -1 otherwise test will work because arguments are found
  607. elif ps -laxnwww 2>/dev/null | head -1 | \
  608. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
  609. then
  610. ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  611. ac_cv_ps_command="$PATH_TO_PS -laxnwww"
  612. ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
  613. ac_cv_ps_cols=8
  614. AC_MSG_RESULT([$ac_cv_ps_command])
  615. dnl Debian Linux / procps v1.2.9:
  616. dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
  617. dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
  618. dnl
  619. elif ps laxnwww 2>/dev/null | \
  620. egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
  621. then
  622. ac_cv_ps_varlist="[&procuid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
  623. ac_cv_ps_command="$PATH_TO_PS laxnwww"
  624. ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  625. ac_cv_ps_cols=8
  626. AC_MSG_RESULT([$ac_cv_ps_command])
  627. dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
  628. elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  629. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  630. then
  631. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  632. ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid vsz rss pcpu comm args'"
  633. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  634. ac_cv_ps_cols=8
  635. AC_MSG_RESULT([$ac_cv_ps_command])
  636. dnl Tru64 - needs %*[ +] in PS_FORMAT
  637. elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
  638. egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  639. then
  640. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  641. ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid vsz rss pcpu comm args'"
  642. ac_cv_ps_format=["%s%*[ +] %d %d %d %d %f %s %n"]
  643. ac_cv_ps_cols=8
  644. AC_MSG_RESULT([$ac_cv_ps_command])
  645. elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
  646. egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
  647. then
  648. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  649. ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid vsz rss pcpu comm args'"
  650. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  651. ac_cv_ps_cols=8
  652. AC_MSG_RESULT([$ac_cv_ps_command])
  653. dnl AIX 4.3.3 and 5.1 do not have an rss field
  654. elif ps -eo 'stat uid ppid vsz pcpu comm args' 2>/dev/null | \
  655. egrep -i ["^ *S[TAUES]* +UID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
  656. then
  657. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
  658. ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid ppid vsz pcpu comm args'"
  659. ac_cv_ps_format="%s %d %d %d %f %s %n"
  660. ac_cv_ps_cols=7
  661. AC_MSG_RESULT([$ac_cv_ps_command - with no RSS])
  662. dnl Solaris 2.6
  663. elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
  664. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  665. then
  666. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  667. ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid vsz rss pcpu comm args'"
  668. # There must be no space between the %s and %n due to a wierd problem in sscanf where
  669. # it will return %n as longer than the line length
  670. ac_cv_ps_format="%s %d %d %d %d %f %s%n"
  671. ac_cv_ps_cols=8
  672. AC_MSG_RESULT([$ac_cv_ps_command])
  673. elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
  674. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  675. then
  676. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  677. ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid vsz rss pcpu comm args'"
  678. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  679. ac_cv_ps_cols=8
  680. AC_MSG_RESULT([$ac_cv_ps_command])
  681. elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
  682. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  683. then
  684. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  685. ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid vsz rss pcpu comm args'"
  686. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  687. ac_cv_ps_cols=8
  688. AC_MSG_RESULT([$ac_cv_ps_command])
  689. dnl wonder who takes state instead of stat
  690. elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
  691. egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
  692. then
  693. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
  694. ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid vsz rss pcpu command args'"
  695. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  696. ac_cv_ps_cols=7
  697. AC_MSG_RESULT([$ac_cv_ps_command])
  698. dnl IRIX 53
  699. elif ps -el 2>/dev/null | \
  700. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  701. then
  702. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&pos,procprog]"
  703. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
  704. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %d %d %*s %*s %*s %n%s"
  705. ac_cv_ps_cols=7
  706. AC_MSG_RESULT([$ac_cv_ps_command])
  707. dnl IRIX 63
  708. elif ps -el 2>/dev/null | \
  709. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  710. then
  711. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  712. ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
  713. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  714. ac_cv_ps_cols=5
  715. AC_MSG_RESULT([$ac_cv_ps_command])
  716. dnl AIX 4.1:
  717. dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
  718. dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
  719. elif ps -el 2>/dev/null | \
  720. egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
  721. then
  722. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  723. ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
  724. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  725. ac_cv_ps_cols=5
  726. AC_MSG_RESULT([$ac_cv_ps_command])
  727. dnl AIX?
  728. elif ps glaxen 2>/dev/null | \
  729. egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
  730. then
  731. ac_cv_ps_varlist="[&procuid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
  732. ac_cv_ps_command="$PATH_TO_PS glaxen"
  733. ac_cv_ps_format="%*s %d %*s %d %*s %*s %d %d %*s %s %*s %*s %n%s"
  734. ac_cv_ps_cols=7
  735. AC_MSG_RESULT([$ac_cv_ps_command])
  736. dnl MacOSX / Darwin
  737. dnl TODO: MacOSX has commands with spaces which will cause problems to PS_FORMAT
  738. dnl Some truncation will happen in UCOMM column
  739. dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
  740. dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
  741. elif ps wwaxo 'state vsz rss uid ppid pcpu ucomm command' 2>/dev/null | \
  742. egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
  743. then
  744. ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid ppid pcpu ucomm command'"
  745. ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procppid,&procpcpu,procprog,&pos]"
  746. ac_cv_ps_format="%s %d %d %d %d %f %s %n"
  747. ac_cv_ps_cols=7
  748. AC_MSG_RESULT([$ac_cv_ps_command])
  749. dnl UnixWare
  750. elif ps -Al 2>/dev/null | \
  751. egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
  752. then
  753. ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
  754. ac_cv_ps_command="$PATH_TO_PS -Al"
  755. ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
  756. ac_cv_ps_cols=7
  757. AC_MSG_RESULT([$ac_cv_ps_command])
  758. else
  759. AC_MSG_WARN([unable to find usable ps syntax - check_procs and check_nagios will not be compiled])
  760. fi
  761. if test -n "$ac_cv_ps_varlist" ; then
  762. AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
  763. [Variable list for sscanf of 'ps' output])
  764. AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
  765. [Verbatim command to execute for ps in check_procs])
  766. AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
  767. [Format string for scanning ps output in check_procs])
  768. AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
  769. [Number of columns in ps command])
  770. EXTRAS="$EXTRAS check_procs check_nagios"
  771. fi
  772. AC_PATH_PROG(PATH_TO_PING,ping)
  773. AC_PATH_PROG(PATH_TO_PING6,ping6)
  774. AC_ARG_WITH(ping_command,
  775. ACX_HELP_STRING([--with-ping-command=SYNTAX],
  776. [sets syntax for ICMP ping]),
  777. with_ping_command=$withval,)
  778. AC_MSG_CHECKING(for ICMP ping syntax)
  779. ac_cv_ping_packets_first=no
  780. ac_cv_ping_has_timeout=no
  781. if test -n "$with_ping_command"
  782. then
  783. AC_MSG_RESULT([(command-line) $with_ping_command])
  784. if test -n "$ac_cv_ping_packets_first"
  785. then
  786. ac_cv_ping_packets_first=yes
  787. fi
  788. elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  789. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  790. egrep -i "^round-trip|^rtt" >/dev/null
  791. then
  792. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  793. ac_cv_ping_packets_first=yes
  794. AC_MSG_RESULT([$with_ping_command])
  795. elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
  796. egrep -i "^round-trip|^rtt" >/dev/null
  797. then
  798. with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
  799. ac_cv_ping_packets_first=yes
  800. ac_cv_ping_has_timeout=yes
  801. AC_MSG_RESULT([$with_ping_command])
  802. elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
  803. egrep -i "^round-trip|^rtt" >/dev/null
  804. then
  805. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  806. ac_cv_ping_packets_first=yes
  807. AC_MSG_RESULT([$with_ping_command])
  808. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  809. egrep -i "^round-trip|^rtt" >/dev/null
  810. then
  811. with_ping_command="$PATH_TO_PING -n -c %d %s"
  812. ac_cv_ping_packets_first=yes
  813. AC_MSG_RESULT([$with_ping_command])
  814. elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
  815. egrep -i "^round-trip|^rtt" >/dev/null
  816. then
  817. with_ping_command="$PATH_TO_PING -n %s -c %d"
  818. AC_MSG_RESULT([$with_ping_command])
  819. elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
  820. egrep -i "^round-trip|^rtt" >/dev/null
  821. then
  822. with_ping_command="$PATH_TO_PING %s -n %d"
  823. AC_MSG_RESULT([$with_ping_command])
  824. elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  825. egrep -i "^round-trip|^rtt" >/dev/null
  826. then
  827. with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
  828. AC_MSG_RESULT([$with_ping_command])
  829. elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
  830. egrep -i "^round-trip|^rtt" >/dev/null
  831. then
  832. with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
  833. AC_MSG_RESULT([$with_ping_command])
  834. elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
  835. egrep -i "^round-trip|^rtt" >/dev/null
  836. then
  837. with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
  838. ac_cv_ping_packets_first=yes
  839. AC_MSG_RESULT([$with_ping_command])
  840. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  841. egrep -i "^round-trip|^rtt" >/dev/null
  842. then
  843. with_ping_command="$PATH_TO_PING -n -c %d %s"
  844. ac_cv_ping_packets_first=yes
  845. AC_MSG_RESULT([$with_ping_command])
  846. else
  847. AC_MSG_WARN([unable to find usable ping syntax])
  848. fi
  849. AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
  850. [path and args for ICMP ping command])
  851. if test "x$ac_cv_ping_packets_first" != "xno"
  852. then
  853. AC_DEFINE(PING_PACKETS_FIRST,1,
  854. [Define if packet count must precede host])
  855. fi
  856. if test "x$ac_cv_ping_has_timeout" != "xno"
  857. then
  858. AC_DEFINE(PING_HAS_TIMEOUT,1,
  859. [Define if ping has its own timeout option that should be set])
  860. fi
  861. AC_ARG_WITH(ping6_command,
  862. ACX_HELP_STRING([--with-ping6-command=SYNTAX],
  863. [sets syntax for ICMPv6 ping]),
  864. with_ping6_command=$withval,)
  865. if test x"$with_ipv6" != xno ; then
  866. AC_MSG_CHECKING(for ICMPv6 ping syntax)
  867. ac_cv_ping6_packets_first=no
  868. if test -n "$with_ping6_command"
  869. then
  870. AC_MSG_RESULT([(command-line) $with_ping6_command])
  871. if test -n "$ac_cv_ping6_packets_first"
  872. then
  873. ac_cv_ping6_packets_first=yes
  874. fi
  875. elif test "x$PATH_TO_PING6" != "x"; then
  876. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  877. $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  878. egrep -i "^round-trip|^rtt" >/dev/null
  879. then
  880. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  881. ac_cv_ping6_packets_first=yes
  882. AC_MSG_RESULT([$with_ping6_command])
  883. elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
  884. egrep -i "^round-trip|^rtt" >/dev/null
  885. then
  886. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  887. ac_cv_ping6_packets_first=yes
  888. AC_MSG_RESULT([$with_ping6_command])
  889. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  890. egrep -i "^round-trip|^rtt" >/dev/null
  891. then
  892. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  893. ac_cv_ping6_packets_first=yes
  894. AC_MSG_RESULT([$with_ping6_command])
  895. elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
  896. egrep -i "^round-trip|^rtt" >/dev/null
  897. then
  898. with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
  899. AC_MSG_RESULT([$with_ping6_command])
  900. elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
  901. egrep -i "^round-trip|^rtt" >/dev/null
  902. then
  903. with_ping6_command="$PATH_TO_PING6 %s -n %d"
  904. AC_MSG_RESULT([$with_ping6_command])
  905. elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  906. egrep -i "^round-trip|^rtt" >/dev/null
  907. then
  908. with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
  909. AC_MSG_RESULT([$with_ping6_command])
  910. elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  911. egrep -i "^round-trip|^rtt" >/dev/null
  912. then
  913. with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
  914. AC_MSG_RESULT([$with_ping6_command])
  915. elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
  916. egrep -i "^round-trip|^rtt" >/dev/null
  917. then
  918. with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
  919. ac_cv_ping6_packets_first=yes
  920. AC_MSG_RESULT([$with_ping_command])
  921. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  922. egrep -i "^round-trip|^rtt" >/dev/null
  923. then
  924. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  925. ac_cv_ping6_packets_first=yes
  926. AC_MSG_RESULT([$with_ping6_command])
  927. fi
  928. elif test "x$PATH_TO_PING" != "x"; then
  929. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  930. $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  931. egrep -i "^round-trip|^rtt" >/dev/null
  932. then
  933. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  934. ac_cv_ping6_packets_first=yes
  935. AC_MSG_RESULT([$with_ping6_command])
  936. elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
  937. egrep -i "^round-trip|^rtt" >/dev/null
  938. then
  939. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  940. ac_cv_ping6_packets_first=yes
  941. AC_MSG_RESULT([$with_ping6_command])
  942. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  943. egrep -i "^round-trip|^rtt" >/dev/null
  944. then
  945. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  946. ac_cv_ping6_packets_first=yes
  947. AC_MSG_RESULT([$with_ping6_command])
  948. elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
  949. egrep -i "^round-trip|^rtt" >/dev/null
  950. then
  951. with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
  952. AC_MSG_RESULT([$with_ping6_command])
  953. elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
  954. egrep -i "^round-trip|^rtt" >/dev/null
  955. then
  956. with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
  957. AC_MSG_RESULT([$with_ping6_command])
  958. elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  959. egrep -i "^round-trip|^rtt" >/dev/null
  960. then
  961. with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
  962. AC_MSG_RESULT([$with_ping6_command])
  963. elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  964. egrep -i "^round-trip|^rtt" >/dev/null
  965. then
  966. with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
  967. AC_MSG_RESULT([$with_ping6_command])
  968. elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
  969. egrep -i "^round-trip|^rtt" >/dev/null
  970. then
  971. with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
  972. ac_cv_ping6_packets_first=yes
  973. AC_MSG_RESULT([$with_ping_command])
  974. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  975. egrep -i "^round-trip|^rtt" >/dev/null
  976. then
  977. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  978. ac_cv_ping6_packets_first=yes
  979. AC_MSG_RESULT([$with_ping6_command])
  980. fi
  981. fi
  982. if test "x$with_ping6_command" != "x"; then
  983. AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
  984. [path and args for ICMPv6 ping command])
  985. else
  986. AC_MSG_RESULT([none])
  987. fi
  988. if test "x$ac_cv_ping6_packets_first" != "xno"; then
  989. AC_DEFINE(PING6_PACKETS_FIRST,1,
  990. [Define if packet count must precede host])
  991. fi
  992. fi
  993. AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
  994. AC_MSG_CHECKING(for nslookup syntax)
  995. if test -n "$PATH_TO_NSLOOKUP"
  996. then
  997. if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
  998. then
  999. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
  1000. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1001. else
  1002. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
  1003. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1004. fi
  1005. EXTRAS="$EXTRAS check_dns"
  1006. else
  1007. AC_MSG_WARN([nslookup command not found])
  1008. fi
  1009. AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command",
  1010. [path and args for nslookup])
  1011. AC_PATH_PROG(PATH_TO_HOST,host)
  1012. if test -n "$ac_cv_path_PATH_TO_HOST"
  1013. then
  1014. EXTRAS="$EXTRAS check_dns"
  1015. fi
  1016. AC_PATH_PROG(PATH_TO_UPTIME,uptime)
  1017. AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
  1018. AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
  1019. AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
  1020. AC_PATH_PROG(PATH_TO_NTPDATE,ntpdate)
  1021. AC_PATH_PROGS(PATH_TO_NTPDC,ntpdc xntpdc)
  1022. AC_PATH_PROGS(PATH_TO_NTPQ,ntpq)
  1023. if (test -x "$PATH_TO_NTPDATE" || test -x "$PATH_TO_NTPQ")
  1024. then
  1025. AC_DEFINE_UNQUOTED(PATH_TO_NTPQ,"$PATH_TO_NTPQ",[path to ntpq binary])
  1026. AC_DEFINE_UNQUOTED(PATH_TO_NTPDATE,"$PATH_TO_NTPDATE",[path to ntpdate binary])
  1027. else
  1028. AC_MSG_WARN([Install NTP programs (http://www.ntp.org) if you want to monitor time synchronization])
  1029. fi
  1030. AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
  1031. if test -x "$PATH_TO_LMSTAT"
  1032. then
  1033. AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
  1034. else
  1035. AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
  1036. fi
  1037. AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
  1038. if test -x "$PATH_TO_SMBCLIENT"
  1039. then
  1040. AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
  1041. else
  1042. AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
  1043. fi
  1044. AC_PATH_PROG(PATH_TO_WHO,who)
  1045. if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
  1046. then
  1047. ac_cv_path_to_who="$PATH_TO_WHO -q"
  1048. else
  1049. ac_cv_path_to_who="$PATH_TO_WHO"
  1050. fi
  1051. AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
  1052. [path and arguments for invoking 'who'])
  1053. AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
  1054. if test -x "$PATH_TO_SNMPGET"
  1055. then
  1056. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
  1057. EXTRAS="$EXTRAS check_hpjd check_snmp"
  1058. else
  1059. AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
  1060. fi
  1061. AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
  1062. if test -x "$PATH_TO_SNMPGETNEXT"
  1063. then
  1064. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
  1065. fi
  1066. if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
  1067. then
  1068. AC_MSG_CHECKING(for Net::SNMP perl module)
  1069. AC_MSG_RESULT([found])
  1070. else
  1071. AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
  1072. fi
  1073. AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
  1074. AC_PATH_PROG(PATH_TO_QSTAT,qstat)
  1075. if test -x "$PATH_TO_QUAKESTAT"
  1076. then
  1077. ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
  1078. EXTRAS="$EXTRAS check_game"
  1079. elif test -x "$PATH_TO_QSTAT"
  1080. then
  1081. ac_cv_path_to_qstat="$PATH_TO_QSTAT"
  1082. EXTRAS="$EXTRAS check_game"
  1083. else
  1084. AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
  1085. fi
  1086. if test $ac_cv_path_to_qstat
  1087. then
  1088. AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
  1089. [path to qstat/quakestat])
  1090. fi
  1091. AC_PATH_PROG(PATH_TO_FPING,fping)
  1092. if test -x "$PATH_TO_FPING"
  1093. then
  1094. AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
  1095. EXTRAS="$EXTRAS check_fping"
  1096. else
  1097. AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
  1098. fi
  1099. AC_PATH_PROG(PATH_TO_SSH,ssh)
  1100. if test -x "$PATH_TO_SSH"
  1101. then
  1102. AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
  1103. EXTRAS="$EXTRAS check_by_ssh"
  1104. else
  1105. AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
  1106. fi
  1107. AC_PATH_PROG(PATH_TO_MAILQ,mailq)
  1108. if test -x "$PATH_TO_MAILQ"
  1109. then
  1110. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
  1111. else
  1112. AC_MSG_WARN([Could not find mailq or eqivalent])
  1113. fi
  1114. AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
  1115. if test -x "$PATH_TO_QMAIL_QSTAT"
  1116. then
  1117. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
  1118. else
  1119. AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
  1120. fi
  1121. dnl SWAP info required is amount allocated/available and amount free
  1122. dnl The plugin works through all the swap devices and adds up the total swap
  1123. dnl available.
  1124. AC_PATH_PROG(PATH_TO_SWAP,swap)
  1125. if (test -n "$PATH_TO_SWAP")
  1126. then
  1127. AC_MSG_CHECKING([for $PATH_TO_SWAP format])
  1128. if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
  1129. then
  1130. ac_cv_have_swap=yes
  1131. ac_cv_swap_command="$PATH_TO_SWAP -l"
  1132. if [$PATH_TO_SWAP -l 2>/dev/null | \
  1133. egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
  1134. >/dev/null]
  1135. then
  1136. ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %d %d"]
  1137. ac_cv_swap_conv=2048
  1138. AC_MSG_RESULT([using IRIX format swap])
  1139. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
  1140. then
  1141. ac_cv_swap_format=["%*s %*[0-9,-] %*d %d %d"]
  1142. ac_cv_swap_conv=2048
  1143. AC_MSG_RESULT([using Unixware format swap])
  1144. else
  1145. dnl if we don't know what format swap's output is
  1146. dnl we might as well pretend we didn't see it
  1147. ac_cv_have_swap=""
  1148. ac_cv_swap_command=""
  1149. fi
  1150. fi
  1151. dnl end if for PATH_TO_SWAP
  1152. fi
  1153. AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
  1154. if (test -n "$PATH_TO_SWAPINFO")
  1155. then
  1156. AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
  1157. if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
  1158. then
  1159. ac_cv_have_swap=yes
  1160. ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
  1161. if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
  1162. then
  1163. ac_cv_swap_format=["%*s %d %*d %d"]
  1164. ac_cv_swap_conv=1024
  1165. AC_MSG_RESULT([using FreeBSD format swapinfo])
  1166. fi
  1167. elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
  1168. then
  1169. ac_cv_have_swap=yes
  1170. ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM",
  1171. ac_cv_swap_format=["%*s %d %*d %d"]
  1172. ac_cv_swap_conv=1024
  1173. AC_MSG_RESULT([using HP-UX format swapinfo])
  1174. fi
  1175. dnl end if for PATH_TO_SWAPINFO
  1176. fi
  1177. AC_PATH_PROG(PATH_TO_LSPS,lsps)
  1178. if (test -n "$PATH_TO_LSPS")
  1179. then
  1180. AC_MSG_CHECKING([for $PATH_TO_LSPS format])
  1181. if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
  1182. then
  1183. ac_cv_have_swap=yes
  1184. ac_cv_swap_command="$PATH_TO_LSPS -a"
  1185. ac_cv_swap_format=["%*s %*s %*s %d%*s %d %*s"]
  1186. ac_cv_swap_conv=1
  1187. AC_MSG_RESULT([using AIX lsps])
  1188. fi
  1189. dnl end if for PATH_TO_SWAPINFO
  1190. fi
  1191. dnl
  1192. dnl test for swapctl system call, both the 2-arg and 3-arg variants
  1193. dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
  1194. dnl in the various BSD's
  1195. dnl
  1196. AC_CHECK_HEADERS([sys/swap.h], [], [], [
  1197. #ifdef HAVE_SYS_PARAM_H
  1198. #include <sys/param.h>
  1199. #endif
  1200. ])
  1201. AC_CHECK_HEADERS([sys/stat.h sys/param.h])
  1202. AC_CHECK_DECLS([swapctl],,,[
  1203. #include <unistd.h>
  1204. #include <sys/types.h>
  1205. #include <sys/param.h>
  1206. #include <sys/stat.h>
  1207. #include <sys/swap.h>
  1208. ])
  1209. AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
  1210. #include <sys/types.h>
  1211. #include <sys/param.h>
  1212. #include <sys/stat.h>
  1213. #include <sys/swap.h>
  1214. ])
  1215. AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
  1216. #include <unistd.h>
  1217. #include <sys/types.h>
  1218. #include <sys/param.h>
  1219. #include <sys/stat.h>
  1220. #include <sys/swap.h>
  1221. ])
  1222. if test "$ac_cv_have_decl_swapctl" = "yes";
  1223. then
  1224. EXTRAS="$EXTRAS check_swap"
  1225. AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
  1226. if test "$ac_cv_type_swaptbl_t" = "yes" -a \
  1227. "$ac_cv_type_swapent_t" = "yes";
  1228. then
  1229. AC_MSG_RESULT([yes])
  1230. ac_cv_check_swap_swapctl_svr4="1";
  1231. AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
  1232. [Define if 2-argument SVR4 swapctl exists])
  1233. else
  1234. AC_MSG_RESULT([no])
  1235. AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
  1236. if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
  1237. then
  1238. AC_MSG_RESULT([yes])
  1239. AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
  1240. [Define if 3-argument BSD swapctl exists])
  1241. else
  1242. AC_MSG_RESULT([no])
  1243. fi
  1244. fi
  1245. AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
  1246. if test "$ac_cv_check_swap_swapctl_svr4" = "1";
  1247. then
  1248. dnl
  1249. dnl the SVR4 spec returns values in pages
  1250. dnl
  1251. AC_MSG_RESULT([page])
  1252. AC_CHECK_DECLS([sysconf])
  1253. AC_MSG_CHECKING([for system page size])
  1254. if test "$ac_cv_have_decl_sysconf" = "yes";
  1255. then
  1256. AC_MSG_RESULT([determined by sysconf(3)])
  1257. ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
  1258. else
  1259. AC_MSG_WARN([don't know. guessing 4096k])
  1260. ac_cv_swap_conv=256
  1261. fi
  1262. else
  1263. dnl
  1264. dnl the BSD spec returns values in blocks
  1265. dnl
  1266. AC_MSG_RESULT([blocks (assuming 512b)])
  1267. ac_cv_swap_conv=2048
  1268. fi
  1269. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1270. [Conversion factor to MB])
  1271. fi
  1272. dnl
  1273. dnl end tests for the swapctl system calls
  1274. dnl
  1275. if test "x$ac_cv_have_swap" != "x"
  1276. then
  1277. AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
  1278. EXTRAS="$EXTRAS check_swap"
  1279. fi
  1280. if test "x$ac_cv_swap_command" != "x"
  1281. then
  1282. AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
  1283. [Path to swap/swapinfo binary, with any args])
  1284. AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
  1285. [Format string for parsing swap output])
  1286. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1287. [Conversion factor to MB])
  1288. fi
  1289. dnl dunno why this does not work below - use hack (kbd)
  1290. dnl fine on linux, broken on solaris
  1291. dnl if /bin/test -e "/proc/meminfo"
  1292. AC_MSG_CHECKING([for /proc/meminfo])
  1293. if [cat /proc/meminfo > /dev/null 2>&1]
  1294. then
  1295. AC_MSG_RESULT([found /proc/meminfo])
  1296. AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
  1297. AC_DEFINE_UNQUOTED(PROC_MEMINFO,"/proc/meminfo",[path to /proc/meminfo if name changes])
  1298. EXTRAS="$EXTRAS check_swap"
  1299. else
  1300. AC_MSG_RESULT([no])
  1301. fi
  1302. AC_PATH_PROG(PATH_TO_DIG,dig)
  1303. AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
  1304. if test -n "$PATH_TO_DIG"; then
  1305. EXTRAS="$EXTRAS check_dig"
  1306. fi
  1307. if test -f plugins/check_nt.c ; then
  1308. EXTRAS="$EXTRAS check_nt"
  1309. elif test -f ../plugins/check_nt.c ; then
  1310. EXTRAS="$EXTRAS check_nt"
  1311. fi
  1312. AC_MSG_CHECKING(for va_list)
  1313. AC_TRY_COMPILE([#ifdef __STDC__
  1314. #include <stdio.h>
  1315. #include <stdlib.h>
  1316. #include <stdarg.h>
  1317. #else
  1318. #include <sys/types.h>
  1319. #include <stdio.h>
  1320. #include <varargs.h>
  1321. #endif],
  1322. [va_list args;],
  1323. [AC_MSG_RESULT(yes)],
  1324. [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)])
  1325. AC_SUBST(EXTRAS)
  1326. AC_SUBST(EXTRA_NETOBJS)
  1327. AC_SUBST(DEPLIBS)
  1328. AM_GNU_GETTEXT([no-libtool], [need-ngettext])
  1329. AM_GNU_GETTEXT_VERSION(0.11.5)
  1330. dnl External libraries
  1331. np_COREUTILS
  1332. AC_OUTPUT(
  1333. Makefile
  1334. lib/Makefile
  1335. m4/Makefile
  1336. plugins/Makefile
  1337. plugins-scripts/Makefile
  1338. plugins-scripts/subst
  1339. plugins-scripts/utils.pm
  1340. plugins-scripts/utils.sh
  1341. command.cfg
  1342. test.pl
  1343. pkg/solaris/pkginfo
  1344. intl/Makefile
  1345. po/Makefile.in
  1346. )
  1347. ACX_FEATURE([with],[cgiurl])
  1348. ACX_FEATURE([with],[nagios-user])
  1349. ACX_FEATURE([with],[nagios-group])
  1350. ACX_FEATURE([with],[trusted-path])
  1351. ACX_FEATURE([with],[ping-command])
  1352. ACX_FEATURE([with],[ping6-command])
  1353. ACX_FEATURE([with],[lwres])
  1354. ACX_FEATURE([with],[ipv6])
  1355. ACX_FEATURE([with],[openssl])
  1356. ACX_FEATURE([enable],[emulate-getaddrinfo])