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