configure.ac 65 KB

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