configure.ac 62 KB

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