configure.ac 65 KB

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