configure.ac 63 KB

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