configure.in 56 KB

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