configure.in 55 KB

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