configure.ac 61 KB

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