configure.ac 68 KB

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