configure.in 56 KB

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