configure.in 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704
  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 echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null
  781. then
  782. ac_cv_ping_packets_first=yes
  783. ac_cv_ping_has_timeout=yes
  784. elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \
  785. echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null
  786. then
  787. ac_cv_ping_has_timeout=yes
  788. elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null
  789. then
  790. ac_cv_ping_packets_first=yes
  791. fi
  792. elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  793. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  794. egrep -i "^round-trip|^rtt" >/dev/null
  795. then
  796. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  797. ac_cv_ping_packets_first=yes
  798. AC_MSG_RESULT([$with_ping_command])
  799. elif $PATH_TO_PING -n -U -w 10 -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 -w %d -c %d %s"
  803. ac_cv_ping_packets_first=yes
  804. ac_cv_ping_has_timeout=yes
  805. AC_MSG_RESULT([$with_ping_command])
  806. elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
  807. egrep -i "^round-trip|^rtt" >/dev/null
  808. then
  809. with_ping_command="$PATH_TO_PING -n -U -c %d %s"
  810. ac_cv_ping_packets_first=yes
  811. AC_MSG_RESULT([$with_ping_command])
  812. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  813. egrep -i "^round-trip|^rtt" >/dev/null
  814. then
  815. with_ping_command="$PATH_TO_PING -n -c %d %s"
  816. ac_cv_ping_packets_first=yes
  817. AC_MSG_RESULT([$with_ping_command])
  818. elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
  819. egrep -i "^round-trip|^rtt" >/dev/null
  820. then
  821. with_ping_command="$PATH_TO_PING -n %s -c %d"
  822. AC_MSG_RESULT([$with_ping_command])
  823. elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
  824. egrep -i "^round-trip|^rtt" >/dev/null
  825. then
  826. with_ping_command="$PATH_TO_PING %s -n %d"
  827. AC_MSG_RESULT([$with_ping_command])
  828. elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  829. egrep -i "^round-trip|^rtt" >/dev/null
  830. then
  831. with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
  832. AC_MSG_RESULT([$with_ping_command])
  833. elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
  834. egrep -i "^round-trip|^rtt" >/dev/null
  835. then
  836. with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
  837. AC_MSG_RESULT([$with_ping_command])
  838. elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
  839. egrep -i "^round-trip|^rtt" >/dev/null
  840. then
  841. with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
  842. ac_cv_ping_packets_first=yes
  843. AC_MSG_RESULT([$with_ping_command])
  844. elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
  845. egrep -i "^round-trip|^rtt" >/dev/null
  846. then
  847. with_ping_command="$PATH_TO_PING -n -c %d %s"
  848. ac_cv_ping_packets_first=yes
  849. AC_MSG_RESULT([$with_ping_command])
  850. else
  851. AC_MSG_WARN([unable to find usable ping syntax])
  852. fi
  853. AC_DEFINE_UNQUOTED(PING_COMMAND,"$with_ping_command",
  854. [path and args for ICMP ping command])
  855. if test "x$ac_cv_ping_packets_first" != "xno"
  856. then
  857. AC_DEFINE(PING_PACKETS_FIRST,1,
  858. [Define if packet count must precede host])
  859. fi
  860. if test "x$ac_cv_ping_has_timeout" != "xno"
  861. then
  862. AC_DEFINE(PING_HAS_TIMEOUT,1,
  863. [Define if ping has its own timeout option that should be set])
  864. fi
  865. AC_ARG_WITH(ping6_command,
  866. ACX_HELP_STRING([--with-ping6-command=SYNTAX],
  867. [sets syntax for ICMPv6 ping]),
  868. with_ping6_command=$withval,)
  869. if test x"$with_ipv6" != xno ; then
  870. AC_MSG_CHECKING(for ICMPv6 ping syntax)
  871. ac_cv_ping6_packets_first=no
  872. if test -n "$with_ping6_command"
  873. then
  874. AC_MSG_RESULT([(command-line) $with_ping6_command])
  875. if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null
  876. then
  877. ac_cv_ping6_packets_first=yes
  878. elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \
  879. echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null
  880. then
  881. # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout
  882. true
  883. elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null
  884. then
  885. ac_cv_ping6_packets_first=yes
  886. fi
  887. elif test "x$PATH_TO_PING6" != "x"; then
  888. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  889. $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  890. egrep -i "^round-trip|^rtt" >/dev/null
  891. then
  892. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  893. ac_cv_ping6_packets_first=yes
  894. AC_MSG_RESULT([$with_ping6_command])
  895. elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
  896. egrep -i "^round-trip|^rtt" >/dev/null
  897. then
  898. with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
  899. ac_cv_ping6_packets_first=yes
  900. ac_cv_ping_has_timeout=yes
  901. AC_MSG_RESULT([$with_ping6_command])
  902. elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
  903. egrep -i "^round-trip|^rtt" >/dev/null
  904. then
  905. with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
  906. ac_cv_ping6_packets_first=yes
  907. AC_MSG_RESULT([$with_ping6_command])
  908. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  909. egrep -i "^round-trip|^rtt" >/dev/null
  910. then
  911. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  912. ac_cv_ping6_packets_first=yes
  913. AC_MSG_RESULT([$with_ping6_command])
  914. elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
  915. egrep -i "^round-trip|^rtt" >/dev/null
  916. then
  917. with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
  918. AC_MSG_RESULT([$with_ping6_command])
  919. elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
  920. egrep -i "^round-trip|^rtt" >/dev/null
  921. then
  922. with_ping6_command="$PATH_TO_PING6 %s -n %d"
  923. AC_MSG_RESULT([$with_ping6_command])
  924. elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
  925. egrep -i "^round-trip|^rtt" >/dev/null
  926. then
  927. with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
  928. AC_MSG_RESULT([$with_ping6_command])
  929. elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  930. egrep -i "^round-trip|^rtt" >/dev/null
  931. then
  932. with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
  933. AC_MSG_RESULT([$with_ping6_command])
  934. elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
  935. egrep -i "^round-trip|^rtt" >/dev/null
  936. then
  937. with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
  938. ac_cv_ping6_packets_first=yes
  939. AC_MSG_RESULT([$with_ping_command])
  940. elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
  941. egrep -i "^round-trip|^rtt" >/dev/null
  942. then
  943. with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
  944. ac_cv_ping6_packets_first=yes
  945. AC_MSG_RESULT([$with_ping6_command])
  946. fi
  947. elif test "x$PATH_TO_PING" != "x"; then
  948. if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
  949. $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  950. egrep -i "^round-trip|^rtt" >/dev/null
  951. then
  952. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  953. ac_cv_ping6_packets_first=yes
  954. AC_MSG_RESULT([$with_ping6_command])
  955. elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
  956. egrep -i "^round-trip|^rtt" >/dev/null
  957. then
  958. with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
  959. ac_cv_ping6_packets_first=yes
  960. AC_MSG_RESULT([$with_ping6_command])
  961. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  962. egrep -i "^round-trip|^rtt" >/dev/null
  963. then
  964. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  965. ac_cv_ping6_packets_first=yes
  966. AC_MSG_RESULT([$with_ping6_command])
  967. elif $PATH_TO_PING -A inet6 -n ::1 -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 %s -c %d"
  971. AC_MSG_RESULT([$with_ping6_command])
  972. elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
  973. egrep -i "^round-trip|^rtt" >/dev/null
  974. then
  975. with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
  976. AC_MSG_RESULT([$with_ping6_command])
  977. elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
  978. egrep -i "^round-trip|^rtt" >/dev/null
  979. then
  980. with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
  981. AC_MSG_RESULT([$with_ping6_command])
  982. elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
  983. egrep -i "^round-trip|^rtt" >/dev/null
  984. then
  985. with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
  986. AC_MSG_RESULT([$with_ping6_command])
  987. elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
  988. egrep -i "^round-trip|^rtt" >/dev/null
  989. then
  990. with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
  991. ac_cv_ping6_packets_first=yes
  992. AC_MSG_RESULT([$with_ping_command])
  993. elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
  994. egrep -i "^round-trip|^rtt" >/dev/null
  995. then
  996. with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
  997. ac_cv_ping6_packets_first=yes
  998. AC_MSG_RESULT([$with_ping6_command])
  999. fi
  1000. fi
  1001. if test "x$with_ping6_command" != "x"; then
  1002. AC_DEFINE_UNQUOTED(PING6_COMMAND,"$with_ping6_command",
  1003. [path and args for ICMPv6 ping command])
  1004. else
  1005. AC_MSG_RESULT([none])
  1006. fi
  1007. if test "x$ac_cv_ping6_packets_first" != "xno"; then
  1008. AC_DEFINE(PING6_PACKETS_FIRST,1,
  1009. [Define if packet count must precede host])
  1010. fi
  1011. fi
  1012. AC_ARG_WITH(nslookup_command,
  1013. ACX_HELP_STRING([--with-nslookup-command=PATH],
  1014. [sets path to nslookup executable]),
  1015. ac_cv_nslookup_command=$withval)
  1016. if test -n "$ac_cv_nslookup_command"; then
  1017. AC_MSG_NOTICE([Using specific nslookup at $ac_cv_nslookup_command])
  1018. else
  1019. AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
  1020. if test -n "$PATH_TO_NSLOOKUP"
  1021. then
  1022. AC_MSG_CHECKING(for nslookup syntax)
  1023. if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
  1024. then
  1025. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
  1026. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1027. else
  1028. ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
  1029. AC_MSG_RESULT([$ac_cv_nslookup_command])
  1030. fi
  1031. else
  1032. AC_MSG_WARN([nslookup command not found])
  1033. fi
  1034. fi
  1035. if test -n "$ac_cv_nslookup_command"; then
  1036. EXTRAS="$EXTRAS check_dns"
  1037. AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
  1038. fi
  1039. AC_MSG_CHECKING([for number of cpus])
  1040. AC_TRY_COMPILE([#include <unistd.h>],
  1041. [sysconf(_SC_NPROCESSORS_CONF) > 0;],
  1042. AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
  1043. AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
  1044. AC_MSG_RESULT([cannot calculate])
  1045. )
  1046. AC_PATH_PROG(PATH_TO_UPTIME,uptime)
  1047. AC_ARG_WITH(uptime_command,
  1048. ACX_HELP_STRING([--with-uptime-command=PATH],
  1049. [sets path to uptime]), PATH_TO_UPTIME=$withval)
  1050. AC_DEFINE_UNQUOTED(PATH_TO_UPTIME,"$PATH_TO_UPTIME",[path to uptime binary])
  1051. AC_PATH_PROG(PATH_TO_RPCINFO,rpcinfo)
  1052. AC_ARG_WITH(rpcinfo_command,
  1053. ACX_HELP_STRING([--with-rpcinfo-command=PATH],
  1054. [sets path to rpcinfo]), PATH_TO_RPCINFO=$withval)
  1055. AC_DEFINE_UNQUOTED(PATH_TO_RPCINFO,"$PATH_TO_RPCINFO",[path to rpcinfo binary])
  1056. AC_PATH_PROG(PATH_TO_LMSTAT,lmstat)
  1057. if test -x "$PATH_TO_LMSTAT"
  1058. then
  1059. AC_DEFINE_UNQUOTED(PATH_TO_LMSTAT,"$PATH_TO_LMSTAT",[path to lmstat])
  1060. else
  1061. AC_MSG_WARN([Get lmstat from Globetrotter Software to monitor flexlm licenses])
  1062. fi
  1063. AC_PATH_PROG(PATH_TO_SMBCLIENT,smbclient)
  1064. AC_ARG_WITH(smbclient_command,
  1065. ACX_HELP_STRING([--with-smbclient-command=PATH],
  1066. [sets path to smbclient]),
  1067. PATH_TO_SMBCLIENT=$withval)
  1068. if test -n "$PATH_TO_SMBCLIENT"
  1069. then
  1070. AC_DEFINE_UNQUOTED(PATH_TO_SMBCLIENT,"$PATH_TO_SMBCLIENT",[path to smbclient binary])
  1071. else
  1072. AC_MSG_WARN([Get smbclient from Samba.org to monitor SMB shares])
  1073. fi
  1074. AC_PATH_PROG(PATH_TO_WHO,who)
  1075. if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
  1076. then
  1077. ac_cv_path_to_who="$PATH_TO_WHO -q"
  1078. else
  1079. ac_cv_path_to_who="$PATH_TO_WHO"
  1080. fi
  1081. AC_DEFINE_UNQUOTED(WHO_COMMAND,"$ac_cv_path_to_who",
  1082. [path and arguments for invoking 'who'])
  1083. AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
  1084. AC_ARG_WITH(snmpget_command,
  1085. ACX_HELP_STRING([--with-snmpget-command=PATH],
  1086. [Path to snmpget command]),
  1087. PATH_TO_SNMPGET=$withval)
  1088. if test -n "$PATH_TO_SNMPGET"
  1089. then
  1090. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
  1091. EXTRAS="$EXTRAS check_hpjd check_snmp"
  1092. else
  1093. AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
  1094. fi
  1095. AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
  1096. AC_ARG_WITH(snmpgetnext_command,
  1097. ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
  1098. [Path to snmpgetnext command]),
  1099. PATH_TO_SNMPGETNEXT=$withval)
  1100. if test -n "$PATH_TO_SNMPGETNEXT"
  1101. then
  1102. AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
  1103. fi
  1104. if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
  1105. then
  1106. AC_MSG_CHECKING(for Net::SNMP perl module)
  1107. AC_MSG_RESULT([found])
  1108. else
  1109. AC_MSG_WARN([Tried $PERL - install Net::SNMP perl module if you want to use the perl snmp plugins])
  1110. fi
  1111. AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
  1112. AC_PATH_PROG(PATH_TO_QSTAT,qstat)
  1113. AC_ARG_WITH(qstat_command,
  1114. ACX_HELP_STRING([--with-qstat-command=PATH],
  1115. [Path to qstat command]), PATH_TO_QSTAT=$withval)
  1116. if test -x "$PATH_TO_QUAKESTAT"
  1117. then
  1118. ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
  1119. EXTRAS="$EXTRAS check_game"
  1120. elif test -n "$PATH_TO_QSTAT"
  1121. then
  1122. ac_cv_path_to_qstat="$PATH_TO_QSTAT"
  1123. EXTRAS="$EXTRAS check_game"
  1124. else
  1125. AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
  1126. fi
  1127. if test $ac_cv_path_to_qstat
  1128. then
  1129. AC_DEFINE_UNQUOTED(PATH_TO_QSTAT,"$ac_cv_path_to_qstat",
  1130. [path to qstat/quakestat])
  1131. fi
  1132. AC_PATH_PROG(PATH_TO_FPING,fping)
  1133. AC_ARG_WITH(fping_command,
  1134. ACX_HELP_STRING([--with-fping-command=PATH],
  1135. [Path to fping command]), PATH_TO_FPING=$withval)
  1136. if test -n "$PATH_TO_FPING"
  1137. then
  1138. AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
  1139. EXTRAS="$EXTRAS check_fping"
  1140. else
  1141. AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
  1142. fi
  1143. AC_PATH_PROG(PATH_TO_SSH,ssh)
  1144. AC_ARG_WITH(ssh_command,
  1145. ACX_HELP_STRING([--with-ssh-command=PATH],
  1146. [sets path for ssh]), PATH_TO_SSH=$withval)
  1147. if test -n "$PATH_TO_SSH"
  1148. then
  1149. AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
  1150. EXTRAS="$EXTRAS check_by_ssh"
  1151. else
  1152. AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
  1153. fi
  1154. AC_PATH_PROG(PATH_TO_MAILQ,mailq)
  1155. AC_ARG_WITH(mailq_command,
  1156. ACX_HELP_STRING([--with-mailq-command=PATH],
  1157. [sets path to mailq]), PATH_TO_MAILQ=$withval)
  1158. if test -n "$PATH_TO_MAILQ"
  1159. then
  1160. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq])
  1161. else
  1162. AC_MSG_WARN([Could not find mailq or eqivalent])
  1163. fi
  1164. AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat)
  1165. if test -x "$PATH_TO_QMAIL_QSTAT"
  1166. then
  1167. AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat])
  1168. else
  1169. AC_MSG_WARN([Could not find qmail-qstat or eqivalent])
  1170. fi
  1171. dnl SWAP info required is amount allocated/available and amount free
  1172. dnl The plugin works through all the swap devices and adds up the total swap
  1173. dnl available.
  1174. AC_PATH_PROG(PATH_TO_SWAP,swap)
  1175. if (test -n "$PATH_TO_SWAP")
  1176. then
  1177. AC_MSG_CHECKING([for $PATH_TO_SWAP format])
  1178. if [$PATH_TO_SWAP -l 2>&1 >/dev/null]
  1179. then
  1180. ac_cv_have_swap=yes
  1181. ac_cv_swap_command="$PATH_TO_SWAP -l"
  1182. if [$PATH_TO_SWAP -l 2>/dev/null | \
  1183. egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
  1184. >/dev/null]
  1185. then
  1186. ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
  1187. ac_cv_swap_conv=2048
  1188. AC_MSG_RESULT([using IRIX format swap])
  1189. elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
  1190. then
  1191. ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
  1192. ac_cv_swap_conv=2048
  1193. AC_MSG_RESULT([using Unixware format swap])
  1194. else
  1195. dnl if we don't know what format swap's output is
  1196. dnl we might as well pretend we didn't see it
  1197. ac_cv_have_swap=""
  1198. ac_cv_swap_command=""
  1199. fi
  1200. fi
  1201. dnl end if for PATH_TO_SWAP
  1202. fi
  1203. AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
  1204. if (test -n "$PATH_TO_SWAPINFO")
  1205. then
  1206. AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
  1207. if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
  1208. then
  1209. ac_cv_have_swap=yes
  1210. ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
  1211. if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
  1212. then
  1213. ac_cv_swap_format=["%*s %f %*d %f"]
  1214. ac_cv_swap_conv=1024
  1215. AC_MSG_RESULT([using FreeBSD format swapinfo])
  1216. fi
  1217. elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
  1218. then
  1219. ac_cv_have_swap=yes
  1220. ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
  1221. ac_cv_swap_format=["%*s %f %*d %f"]
  1222. ac_cv_swap_conv=1024
  1223. AC_MSG_RESULT([using HP-UX format swapinfo])
  1224. fi
  1225. dnl end if for PATH_TO_SWAPINFO
  1226. fi
  1227. AC_PATH_PROG(PATH_TO_LSPS,lsps)
  1228. if (test -n "$PATH_TO_LSPS")
  1229. then
  1230. AC_MSG_CHECKING([for $PATH_TO_LSPS format])
  1231. if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
  1232. then
  1233. ac_cv_have_swap=yes
  1234. ac_cv_swap_command="$PATH_TO_LSPS -a"
  1235. ac_cv_swap_format=["%*s %*s %*s %f%*s %f %*s"]
  1236. ac_cv_swap_conv=1
  1237. AC_MSG_RESULT([using AIX lsps])
  1238. fi
  1239. dnl end if for PATH_TO_SWAPINFO
  1240. fi
  1241. dnl
  1242. dnl test for swapctl system call, both the 2-arg and 3-arg variants
  1243. dnl fwict, the 2-arg is an SVR4 standard, whereas the 3-arg is shared
  1244. dnl in the various BSD's
  1245. dnl
  1246. AC_CHECK_HEADERS([sys/stat.h sys/param.h])
  1247. AC_CHECK_HEADERS([sys/swap.h], [], [], [
  1248. #ifdef HAVE_SYS_PARAM_H
  1249. #include <sys/param.h>
  1250. #endif
  1251. ])
  1252. AC_CHECK_DECLS([swapctl],,,[
  1253. #include <unistd.h>
  1254. #include <sys/types.h>
  1255. #include <sys/param.h>
  1256. #include <sys/stat.h>
  1257. #include <sys/swap.h>
  1258. ])
  1259. AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[
  1260. #include <sys/types.h>
  1261. #include <sys/param.h>
  1262. #include <sys/stat.h>
  1263. #include <sys/swap.h>
  1264. ])
  1265. AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
  1266. #include <unistd.h>
  1267. #include <sys/types.h>
  1268. #include <sys/param.h>
  1269. #include <sys/stat.h>
  1270. #include <sys/swap.h>
  1271. ])
  1272. if test "$ac_cv_have_decl_swapctl" = "yes";
  1273. then
  1274. EXTRAS="$EXTRAS check_swap"
  1275. AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
  1276. if test "$ac_cv_type_swaptbl_t" = "yes" -a \
  1277. "$ac_cv_type_swapent_t" = "yes";
  1278. then
  1279. AC_MSG_RESULT([yes])
  1280. ac_cv_check_swap_swapctl_svr4="1";
  1281. AC_DEFINE([CHECK_SWAP_SWAPCTL_SVR4],1,
  1282. [Define if 2-argument SVR4 swapctl exists])
  1283. else
  1284. AC_MSG_RESULT([no])
  1285. AC_MSG_CHECKING([for 3-arg (*BSD) swapctl])
  1286. if test "$ac_cv_member_struct_swapent_se_nblks" = "yes";
  1287. then
  1288. AC_MSG_RESULT([yes])
  1289. AC_DEFINE([CHECK_SWAP_SWAPCTL_BSD],1,
  1290. [Define if 3-argument BSD swapctl exists])
  1291. else
  1292. AC_MSG_RESULT([no])
  1293. fi
  1294. fi
  1295. AC_MSG_CHECKING([for whether swapctl uses blocks or pages])
  1296. if test "$ac_cv_check_swap_swapctl_svr4" = "1";
  1297. then
  1298. dnl
  1299. dnl the SVR4 spec returns values in pages
  1300. dnl
  1301. AC_MSG_RESULT([page])
  1302. AC_CHECK_DECLS([sysconf])
  1303. AC_MSG_CHECKING([for system page size])
  1304. if test "$ac_cv_have_decl_sysconf" = "yes";
  1305. then
  1306. AC_MSG_RESULT([determined by sysconf(3)])
  1307. ac_cv_swap_conv="(1048576/sysconf(_SC_PAGESIZE))"
  1308. else
  1309. AC_MSG_WARN([don't know. guessing 4096k])
  1310. ac_cv_swap_conv=256
  1311. fi
  1312. else
  1313. dnl
  1314. dnl the BSD spec returns values in blocks
  1315. dnl
  1316. AC_MSG_RESULT([blocks (assuming 512b)])
  1317. ac_cv_swap_conv=2048
  1318. fi
  1319. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1320. [Conversion factor to MB])
  1321. fi
  1322. dnl
  1323. dnl end tests for the swapctl system calls
  1324. dnl
  1325. if test "x$ac_cv_have_swap" != "x"
  1326. then
  1327. AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
  1328. EXTRAS="$EXTRAS check_swap"
  1329. fi
  1330. if test "x$ac_cv_swap_command" != "x"
  1331. then
  1332. AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$ac_cv_swap_command",
  1333. [Path to swap/swapinfo binary, with any args])
  1334. AC_DEFINE_UNQUOTED(SWAP_FORMAT,"$ac_cv_swap_format",
  1335. [Format string for parsing swap output])
  1336. AC_DEFINE_UNQUOTED(SWAP_CONVERSION,$ac_cv_swap_conv,
  1337. [Conversion factor to MB])
  1338. fi
  1339. AC_ARG_WITH(proc-meminfo,
  1340. ACX_HELP_STRING([--with-proc-meminfo=PATH],
  1341. [path to /proc/meminfo or equivalent]),
  1342. ac_cv_proc_meminfo=$withval)
  1343. dnl dunno why this does not work below - use hack (kbd)
  1344. dnl fine on linux, broken on solaris
  1345. dnl if /bin/test -e "/proc/meminfo"
  1346. AC_MSG_CHECKING([for /proc/meminfo])
  1347. if test -n "$ac_cv_proc_meminfo"; then
  1348. AC_MSG_RESULT([(command line) $ac_cv_proc_meminfo])
  1349. elif [cat /proc/meminfo > /dev/null 2>&1]; then
  1350. AC_MSG_RESULT([found /proc/meminfo])
  1351. ac_cv_proc_meminfo="/proc/meminfo"
  1352. else
  1353. AC_MSG_RESULT([no])
  1354. fi
  1355. if test -n "$ac_cv_proc_meminfo"; then
  1356. AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
  1357. AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
  1358. EXTRAS="$EXTRAS check_swap"
  1359. fi
  1360. AC_PATH_PROG(PATH_TO_DIG,dig)
  1361. AC_ARG_WITH(dig_command,
  1362. ACX_HELP_STRING([--with-dig-command=PATH],
  1363. [Path to dig command]), PATH_TO_DIG=$withval)
  1364. if test -n "$PATH_TO_DIG"; then
  1365. EXTRAS="$EXTRAS check_dig"
  1366. AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
  1367. fi
  1368. AC_PATH_PROG(PATH_TO_APTGET,apt-get)
  1369. AC_ARG_WITH(apt-get_command,
  1370. ACX_HELP_STRING([--with-apt-get-command=PATH],
  1371. [Path to apt-get command]),
  1372. with_apt_get_command=$withval,
  1373. with_apt_get_command=$PATH_TO_APTGET)
  1374. AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
  1375. if test -n "$PATH_TO_APTGET" ; then
  1376. EXTRAS="$EXTRAS check_apt"
  1377. fi
  1378. if test -f $srcdir/plugins/check_nt.c ; then
  1379. EXTRAS="$EXTRAS check_nt"
  1380. fi
  1381. dnl used in check_dhcp
  1382. AC_CHECK_HEADERS(sys/sockio.h)
  1383. case $host in
  1384. *bsd*)
  1385. AC_DEFINE(__bsd__,1,[bsd specific code in check_dhcp.c])
  1386. ;;
  1387. *linux*)
  1388. AC_DEFINE(__linux__,1,[linux specific code in check_dhcp.c])
  1389. ;;
  1390. *sun* | *solaris*)
  1391. AC_DEFINE(__sun__,1,[sun specific code in check_dhcp.c])
  1392. ;;
  1393. *hpux*)
  1394. AC_DEFINE(__hpux__,1,[hpux specific code in check_dhcp.c])
  1395. ;;
  1396. esac
  1397. AC_SUBST(EXTRAS)
  1398. AC_SUBST(EXTRAS_ROOT)
  1399. AC_SUBST(EXTRA_NETOBJS)
  1400. AC_SUBST(DEPLIBS)
  1401. AM_GNU_GETTEXT([external], [need-ngettext])
  1402. AM_GNU_GETTEXT_VERSION(0.15)
  1403. dnl Check for Redhat spopen problem
  1404. dnl Wierd problem where ECHILD is returned from a wait call in error
  1405. dnl Only appears to affect nslookup and dig calls. Only affects redhat around
  1406. dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
  1407. dnl We patch plugins/popen.c
  1408. dnl Need to add smp because uname different on those
  1409. dnl Can force patch to be applied with --enable-redhat-pthread-workaround
  1410. AC_ARG_ENABLE(redhat-pthread-workaround,
  1411. AC_HELP_STRING([--enable-redhat-pthread-workaround],
  1412. [force Redhat patch to be applied (default: test system)]),
  1413. [ac_cv_enable_redhat_pthread_workaround=$enableval],
  1414. [ac_cv_enable_redhat_pthread_workaround=test])
  1415. if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
  1416. if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
  1417. AC_MSG_NOTICE([See http://nagiosplugins.org/faq/compile/configure_appears_to_hang if this next part takes a long time])
  1418. AC_MSG_CHECKING(for redhat spopen problem)
  1419. ( cd config_test && make && make test ) > /dev/null 2>&1
  1420. if test $? -eq 0 ; then
  1421. AC_MSG_RESULT(okay)
  1422. else
  1423. AC_MSG_RESULT(error)
  1424. AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
  1425. fi
  1426. fi
  1427. elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
  1428. AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
  1429. fi
  1430. dnl Perl modules
  1431. AC_ARG_ENABLE(perl-modules,
  1432. AC_HELP_STRING([--enable-perl-modules],
  1433. [Enables installation of Nagios::Plugin and its dependencies (default: no)]),
  1434. [enable_perl_modules=$enableval],
  1435. [enable_perl_modules=no])
  1436. if test "$enable_perl_modules" = "yes" ; then
  1437. AC_SUBST(PERLMODS_DIR,perlmods)
  1438. fi
  1439. # From Tap configure
  1440. # Checks for libraries
  1441. case "$host" in
  1442. *-*-*freebsd4*)
  1443. LDFLAGS="$LDFLAGS -pthread"
  1444. HAVE_LIBPTHREAD=1
  1445. ;;
  1446. *)
  1447. AC_CHECK_LIB(pthread, main)
  1448. ;;
  1449. esac
  1450. dnl External libraries - see ACKNOWLEDGEMENTS
  1451. gl_INIT
  1452. dnl Some helpful common compile errors checked here
  1453. 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
  1454. AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?)
  1455. fi
  1456. AC_OUTPUT(
  1457. Makefile
  1458. tap/Makefile
  1459. lib/Makefile
  1460. plugins/Makefile
  1461. lib/tests/Makefile
  1462. plugins-root/Makefile
  1463. plugins-scripts/Makefile
  1464. plugins-scripts/subst
  1465. plugins-scripts/utils.pm
  1466. plugins-scripts/utils.sh
  1467. perlmods/Makefile
  1468. command.cfg
  1469. test.pl
  1470. pkg/solaris/pkginfo
  1471. po/Makefile.in
  1472. )
  1473. dnl the ones below that are commented out need to be cleaned up
  1474. dnl in the configure code above to use with_foo instead of ac_cv_foo
  1475. dnl if we want them to show up here. it'd also make the code cleaner.
  1476. dnl i'll get to that on another rainy day :) -sf
  1477. ACX_FEATURE([with],[apt-get-command])
  1478. dnl ACX_FEATURE([with],[dig-command])
  1479. dnl ACX_FEATURE([with],[fping-command])
  1480. dnl ACX_FEATURE([with],[mailq-command])
  1481. dnl ACX_FEATURE([with],[nslookup-command])
  1482. ACX_FEATURE([with],[ping6-command])
  1483. ACX_FEATURE([with],[ping-command])
  1484. dnl ACX_FEATURE([with],[qstat-command])
  1485. dnl ACX_FEATURE([with],[rpcinfo-command])
  1486. dnl ACX_FEATURE([with],[smbclient-command])
  1487. dnl ACX_FEATURE([with],[snmpget-command])
  1488. dnl ACX_FEATURE([with],[snmpgetnext-command])
  1489. dnl ACX_FEATURE([with],[ssh-command])
  1490. dnl ACX_FEATURE([with],[uptime-command])
  1491. dnl ACX_FEATURE([with],[proc-meminfo])
  1492. dnl ACX_FEATURE([with],[ps-command])
  1493. dnl ACX_FEATURE([with],[ps-format])
  1494. dnl ACX_FEATURE([with],[ps-cols])
  1495. dnl ACX_FEATURE([with],[ps-varlist])
  1496. ACX_FEATURE([with],[ipv6])
  1497. ACX_FEATURE([with],[mysql])
  1498. ACX_FEATURE([with],[openssl])
  1499. ACX_FEATURE([with],[gnutls])
  1500. ACX_FEATURE([enable],[extra-opts])
  1501. ACX_FEATURE([with],[perl])
  1502. ACX_FEATURE([enable],[perl-modules])
  1503. ACX_FEATURE([with],[cgiurl])
  1504. ACX_FEATURE([with],[trusted-path])
  1505. ACX_FEATURE([enable],[libtap])