configure.in 52 KB

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