configure.ac 65 KB

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