configure.in 56 KB

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