configure.ac 62 KB

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