configure.in 53 KB

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