configure.ac 66 KB

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