configure.ac 62 KB

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