configure.in 52 KB

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