configure.ac 61 KB

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