configure.ac 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621
  1. #
  2. # Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
  3. # SPDX-License-Identifier: GPL-3.0-or-later
  4. #
  5. AC_PREREQ(2.60)
  6. # We do not use m4_esyscmd_s to support older autoconf.
  7. define([VERSION_STRING], m4_esyscmd([git describe 2>/dev/null | tr -d '\n']))
  8. define([VERSION_FROM_FILE], m4_esyscmd([cat packaging/version | tr -d '\n']))
  9. m4_ifval(VERSION_STRING, [], [define([VERSION_STRING], VERSION_FROM_FILE)])
  10. AC_INIT([netdata], VERSION_STRING[])
  11. AM_MAINTAINER_MODE([disable])
  12. if test x"$USE_MAINTAINER_MODE" = xyes; then
  13. AC_MSG_NOTICE(***************** MAINTAINER MODE *****************)
  14. fi
  15. PACKAGE_RPM_VERSION="VERSION_STRING"
  16. AC_SUBST([PACKAGE_RPM_VERSION])
  17. # -----------------------------------------------------------------------------
  18. # autoconf initialization
  19. AC_CONFIG_AUX_DIR([.])
  20. AC_CONFIG_HEADERS([config.h])
  21. AC_CONFIG_MACRO_DIR([build/m4])
  22. AC_CONFIG_SRCDIR([daemon/main.c])
  23. define([AUTOMATE_INIT_OPTIONS], [tar-pax subdir-objects])
  24. m4_ifdef([AM_SILENT_RULES], [
  25. define([AUTOMATE_INIT_OPTIONS], [tar-pax silent-rules subdir-objects])
  26. ])
  27. AM_INIT_AUTOMAKE(AUTOMATE_INIT_OPTIONS)
  28. m4_ifdef([AM_SILENT_RULES], [
  29. AM_SILENT_RULES([yes])
  30. ])
  31. AC_CANONICAL_HOST
  32. AC_PROG_CC
  33. AC_PROG_CC_C99
  34. AM_PROG_CC_C_O
  35. AC_PROG_CXX
  36. AC_PROG_INSTALL
  37. PKG_PROG_PKG_CONFIG
  38. AC_USE_SYSTEM_EXTENSIONS
  39. # -----------------------------------------------------------------------------
  40. # configurable options
  41. AC_ARG_ENABLE(
  42. [plugin-nfacct],
  43. [AS_HELP_STRING([--enable-plugin-nfacct], [enable nfacct plugin @<:@default autodetect@:>@])],
  44. ,
  45. [enable_plugin_nfacct="detect"]
  46. )
  47. AC_ARG_ENABLE(
  48. [plugin-freeipmi],
  49. [AS_HELP_STRING([--enable-plugin-freeipmi], [enable freeipmi plugin @<:@default autodetect@:>@])],
  50. ,
  51. [enable_plugin_freeipmi="detect"]
  52. )
  53. AC_ARG_ENABLE(
  54. [plugin-cups],
  55. [AS_HELP_STRING([--enable-plugin-cups], [enable cups plugin @<:@default autodetect@:>@])],
  56. ,
  57. [enable_plugin_cups="detect"]
  58. )
  59. AC_ARG_ENABLE(
  60. [plugin-xenstat],
  61. [AS_HELP_STRING([--enable-plugin-xenstat], [enable xenstat plugin @<:@default autodetect@:>@])],
  62. ,
  63. [enable_plugin_xenstat="detect"]
  64. )
  65. AC_ARG_ENABLE(
  66. [backend-kinesis],
  67. [AS_HELP_STRING([--enable-backend-kinesis], [enable kinesis backend @<:@default autodetect@:>@])],
  68. ,
  69. [enable_backend_kinesis="detect"]
  70. )
  71. AC_ARG_ENABLE(
  72. [exporting-pubsub],
  73. [AS_HELP_STRING([--enable-exporting-pubsub], [enable pubsub exporting connector @<:@default autodetect@:>@])],
  74. ,
  75. [enable_exporting_pubsub="detect"]
  76. )
  77. AC_ARG_ENABLE(
  78. [backend-prometheus-remote-write],
  79. [AS_HELP_STRING([--enable-backend-prometheus-remote-write], [enable prometheus remote write backend @<:@default autodetect@:>@])],
  80. ,
  81. [enable_backend_prometheus_remote_write="detect"]
  82. )
  83. AC_ARG_ENABLE(
  84. [backend-mongodb],
  85. [AS_HELP_STRING([--enable-backend-mongodb], [enable mongodb backend @<:@default autodetect@:>@])],
  86. ,
  87. [enable_backend_mongodb="detect"]
  88. )
  89. AC_ARG_ENABLE(
  90. [pedantic],
  91. [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings @<:@default disabled@:>@])],
  92. ,
  93. [enable_pedantic="no"]
  94. )
  95. AC_ARG_ENABLE(
  96. [accept4],
  97. [AS_HELP_STRING([--disable-accept4], [System does not have accept4 @<:@default autodetect@:>@])],
  98. ,
  99. [enable_accept4="detect"]
  100. )
  101. AC_ARG_WITH(
  102. [webdir],
  103. [AS_HELP_STRING([--with-webdir], [location of webdir @<:@PKGDATADIR/web@:>@])],
  104. [webdir="${withval}"],
  105. [webdir="\$(pkgdatadir)/web"]
  106. )
  107. AC_ARG_WITH(
  108. [libcap],
  109. [AS_HELP_STRING([--with-libcap], [build with libcap @<:@default autodetect@:>@])],
  110. ,
  111. [with_libcap="detect"]
  112. )
  113. AC_ARG_WITH(
  114. [zlib],
  115. [AS_HELP_STRING([--without-zlib], [build without zlib @<:@default enabled@:>@])],
  116. ,
  117. [with_zlib="yes"]
  118. )
  119. AC_ARG_WITH(
  120. [math],
  121. [AS_HELP_STRING([--without-math], [build without math @<:@default enabled@:>@])],
  122. ,
  123. [with_math="yes"]
  124. )
  125. AC_ARG_WITH(
  126. [user],
  127. [AS_HELP_STRING([--with-user], [use this user to drop privilege @<:@default nobody@:>@])],
  128. ,
  129. [with_user="nobody"]
  130. )
  131. AC_ARG_ENABLE(
  132. [x86-sse],
  133. [AS_HELP_STRING([--disable-x86-sse], [SSE/SS2 optimizations on x86 @<:@default enabled@:>@])],
  134. ,
  135. [enable_x86_sse="yes"]
  136. )
  137. AC_ARG_ENABLE(
  138. [lto],
  139. [AS_HELP_STRING([--disable-lto], [Link Time Optimizations @<:@default autodetect@:>@])],
  140. ,
  141. [enable_lto="detect"]
  142. )
  143. AC_ARG_ENABLE(
  144. [https],
  145. [AS_HELP_STRING([--enable-https], [Enable SSL support @<:@default autodetect@:>@])],
  146. ,
  147. [enable_https="detect"]
  148. )
  149. AC_ARG_ENABLE(
  150. [dbengine],
  151. [AS_HELP_STRING([--disable-dbengine], [disable netdata dbengine @<:@default autodetect@:>@])],
  152. ,
  153. [enable_dbengine="detect"]
  154. )
  155. AC_ARG_ENABLE(
  156. [jsonc],
  157. [AS_HELP_STRING([--enable-jsonc], [Enable JSON-C support @<:@default autodetect@:>@])],
  158. ,
  159. [enable_jsonc="detect"]
  160. )
  161. AC_ARG_ENABLE(
  162. [ebpf],
  163. [AS_HELP_STRING([--disable-ebpf], [Disable eBPF support @<:@default autodetect@:>@])],
  164. ,
  165. [enable_ebpf="detect"]
  166. )
  167. AC_ARG_WITH(
  168. [bundled-lws],
  169. [AS_HELP_STRING([--with-bundled-lws=DIR], [Use a specific Libwebsockets static library @<:@default use system library@:>@])],
  170. [
  171. with_bundled_lws="yes"
  172. bundled_lws_dir="${withval}"
  173. ],
  174. [with_bundled_lws="no"]
  175. )
  176. # -----------------------------------------------------------------------------
  177. # Enforce building with C99, bail early if we can't.
  178. test "${ac_cv_prog_cc_c99}" = "no" && AC_MSG_ERROR([Netdata rquires a compiler that supports C99 to build])
  179. # -----------------------------------------------------------------------------
  180. # Check if cloud is enabled and if the functionality is available
  181. AC_ARG_ENABLE(
  182. [cloud],
  183. [AS_HELP_STRING([--disable-cloud],
  184. [Disables all cloud functionality])],
  185. [ enable_cloud="$enableval" ],
  186. [ enable_cloud="detect" ]
  187. )
  188. if test "${enable_cloud}" = "no"; then
  189. AC_DEFINE([DISABLE_CLOUD], [1], [disable netdata cloud functionality])
  190. fi
  191. # -----------------------------------------------------------------------------
  192. # netdata required checks
  193. # fails on centos6
  194. #AX_CHECK_ENABLE_DEBUG()
  195. AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
  196. AX_GCC_FUNC_ATTRIBUTE([malloc])
  197. AX_GCC_FUNC_ATTRIBUTE([noreturn])
  198. AX_GCC_FUNC_ATTRIBUTE([noinline])
  199. AX_GCC_FUNC_ATTRIBUTE([format])
  200. AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
  201. AC_CHECK_TYPES([struct timespec, clockid_t], [], [], [[#include <time.h>]])
  202. AC_SEARCH_LIBS([clock_gettime], [rt posix4])
  203. AC_CHECK_FUNCS([clock_gettime])
  204. AC_CHECK_FUNCS([sched_setscheduler sched_getscheduler sched_getparam sched_get_priority_min sched_get_priority_max getpriority setpriority nice])
  205. AC_CHECK_FUNCS([recvmmsg])
  206. AC_TYPE_INT8_T
  207. AC_TYPE_INT16_T
  208. AC_TYPE_INT32_T
  209. AC_TYPE_INT64_T
  210. AC_TYPE_UINT8_T
  211. AC_TYPE_UINT16_T
  212. AC_TYPE_UINT32_T
  213. AC_TYPE_UINT64_T
  214. AC_C_INLINE
  215. AC_FUNC_STRERROR_R
  216. AC_C__GENERIC
  217. AC_C___ATOMIC
  218. # AC_C_STMT_EXPR
  219. AC_CHECK_SIZEOF([void *])
  220. AC_CANONICAL_HOST
  221. AC_HEADER_MAJOR
  222. AC_HEADER_RESOLV
  223. AC_CHECK_HEADERS_ONCE([sys/prctl.h])
  224. AC_CHECK_HEADERS_ONCE([sys/vfs.h])
  225. AC_CHECK_HEADERS_ONCE([sys/statfs.h])
  226. AC_CHECK_HEADERS_ONCE([sys/statvfs.h])
  227. AC_CHECK_HEADERS_ONCE([sys/mount.h])
  228. if test "${enable_accept4}" != "no"; then
  229. AC_CHECK_FUNCS_ONCE(accept4)
  230. fi
  231. # -----------------------------------------------------------------------------
  232. # operating system detection
  233. AC_MSG_CHECKING([operating system])
  234. case "$host_os" in
  235. freebsd*)
  236. build_target=freebsd
  237. build_target_id=2
  238. CFLAGS="${CFLAGS} -I/usr/local/include -L/usr/local/lib"
  239. ;;
  240. darwin*)
  241. build_target=macos
  242. build_target_id=3
  243. LDFLAGS="${LDFLAGS} -framework CoreFoundation -framework IOKit"
  244. ;;
  245. *)
  246. build_target=linux
  247. build_target_id=1
  248. ;;
  249. esac
  250. AM_CONDITIONAL([FREEBSD], [test "${build_target}" = "freebsd"])
  251. AM_CONDITIONAL([MACOS], [test "${build_target}" = "macos"])
  252. AM_CONDITIONAL([LINUX], [test "${build_target}" = "linux"])
  253. AC_MSG_RESULT([${build_target} with id ${build_target_id}])
  254. # -----------------------------------------------------------------------------
  255. # pthreads
  256. ACX_PTHREAD(, [AC_MSG_ERROR([Cannot initialize pthread environment])])
  257. LIBS="${PTHREAD_LIBS} ${LIBS}"
  258. CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
  259. CC="${PTHREAD_CC}"
  260. AC_CHECK_LIB(
  261. [pthread],
  262. [pthread_getname_np],
  263. [AC_DEFINE([HAVE_PTHREAD_GETNAME_NP], [1], [Is set if pthread_getname_np is available])]
  264. )
  265. # -----------------------------------------------------------------------------
  266. # libm
  267. AC_ARG_VAR([MATH_CFLAGS], [C compiler flags for math])
  268. AC_ARG_VAR([MATH_LIBS], [linker flags for math])
  269. if test -z "${MATH_LIBS}"; then
  270. AC_CHECK_LIB(
  271. [m],
  272. [sin],
  273. [MATH_LIBS="-lm"]
  274. )
  275. fi
  276. test "${with_math}" = "yes" -a -z "${MATH_LIBS}" && AC_MSG_ERROR([math required but not found])
  277. AC_MSG_CHECKING([if libm should be used])
  278. if test "${with_math}" != "no" -a ! -z "${MATH_LIBS}"; then
  279. with_math="yes"
  280. AC_DEFINE([STORAGE_WITH_MATH], [1], [math usability])
  281. OPTIONAL_MATH_CFLAGS="${MATH_CFLAGS}"
  282. OPTIONAL_MATH_LIBS="${MATH_LIBS}"
  283. else
  284. with_math="no"
  285. fi
  286. AC_MSG_RESULT([${with_math}])
  287. # -----------------------------------------------------------------------------
  288. # libuv multi-platform support library with a focus on asynchronous I/O
  289. # TODO: check version, uv_fs_scandir_next only available in version >= 1.0
  290. AC_CHECK_LIB(
  291. [uv],
  292. [uv_fs_scandir_next],
  293. [UV_LIBS="-luv"]
  294. )
  295. test -z "${UV_LIBS}" && \
  296. AC_MSG_ERROR([libuv required but not found. Try installing 'libuv1-dev' or 'libuv-devel'.])
  297. OPTIONAL_UV_CFLAGS="${UV_CFLAGS}"
  298. OPTIONAL_UV_LIBS="${UV_LIBS}"
  299. # -----------------------------------------------------------------------------
  300. # lz4 Extremely Fast Compression algorithm
  301. AC_CHECK_LIB(
  302. [lz4],
  303. [LZ4_compress_default],
  304. [LZ4_LIBS="-llz4"]
  305. )
  306. # -----------------------------------------------------------------------------
  307. # zlib
  308. PKG_CHECK_MODULES(
  309. [ZLIB],
  310. [zlib],
  311. [have_zlib=yes],
  312. [have_zlib=no]
  313. )
  314. test "${with_zlib}" = "yes" -a "${have_zlib}" != "yes" && AC_MSG_ERROR([zlib required but not found. Try installing 'zlib1g-dev' or 'zlib-devel'.])
  315. AC_MSG_CHECKING([if zlib should be used])
  316. if test "${with_zlib}" != "no" -a "${have_zlib}" = "yes"; then
  317. with_zlib="yes"
  318. AC_DEFINE([NETDATA_WITH_ZLIB], [1], [zlib usability])
  319. OPTIONAL_ZLIB_CFLAGS="${ZLIB_CFLAGS}"
  320. OPTIONAL_ZLIB_LIBS="${ZLIB_LIBS}"
  321. else
  322. with_zlib="no"
  323. fi
  324. AC_MSG_RESULT([${with_zlib}])
  325. # -----------------------------------------------------------------------------
  326. # libuuid
  327. PKG_CHECK_MODULES(
  328. [UUID],
  329. [uuid],
  330. [have_uuid=yes],
  331. [AC_MSG_ERROR([libuuid required but not found. Try installing 'uuid-dev' or 'libuuid-devel'.])]
  332. )
  333. AC_DEFINE([NETDATA_WITH_UUID], [1], [uuid usability])
  334. OPTIONAL_UUID_CFLAGS="${UUID_CFLAGS}"
  335. OPTIONAL_UUID_LIBS="${UUID_LIBS}"
  336. # -----------------------------------------------------------------------------
  337. # OpenSSL Cryptography and SSL/TLS Toolkit
  338. AC_CHECK_LIB(
  339. [crypto],
  340. [SHA256_Init],
  341. [SSL_LIBS="-lcrypto -lssl"]
  342. )
  343. AC_CHECK_LIB(
  344. [crypto],
  345. [X509_VERIFY_PARAM_set1_host],
  346. [ssl_host_validation="yes"],
  347. [ssl_host_validation="no"]
  348. )
  349. test -z "${SSL_LIBS}" || \
  350. AC_DEFINE([HAVE_CRYPTO], [1], [libcrypto availability])
  351. if test "${ssl_host_validation}" = "no"; then
  352. AC_DEFINE([HAVE_X509_VERIFY_PARAM_set1_host], [0], [ssl host validation])
  353. AC_MSG_WARN([DISABLING SSL HOSTNAME VALIDATION BECAUSE IT IS NOT AVAILABLE ON THIS SYSTEM.])
  354. else
  355. AC_DEFINE([HAVE_X509_VERIFY_PARAM_set1_host], [1], [ssl host validation])
  356. fi
  357. # -----------------------------------------------------------------------------
  358. # JSON-C library
  359. PKG_CHECK_MODULES([JSON],[json-c],AC_CHECK_LIB(
  360. [json-c],
  361. [json_object_get_type],
  362. [JSONC_LIBS="-ljson-c"]),AC_CHECK_LIB(
  363. [json],
  364. [json_object_get_type],
  365. [JSONC_LIBS="-ljson"])
  366. )
  367. OPTIONAL_JSONC_LIBS="${JSONC_LIBS}"
  368. # -----------------------------------------------------------------------------
  369. # DB engine and HTTPS
  370. test "${enable_dbengine}" = "yes" -a -z "${LZ4_LIBS}" && \
  371. AC_MSG_ERROR([liblz4 required but not found. Try installing 'liblz4-dev' or 'lz4-devel'.])
  372. AC_ARG_WITH([libJudy],
  373. [AS_HELP_STRING([--with-libJudy=PREFIX],[Use a specific Judy library (default is system-library)])],
  374. [
  375. libJudy_dir="$withval"
  376. AC_MSG_CHECKING(for libJudy in $withval)
  377. if test -f "${libJudy_dir}/libJudy.a" -a -f "${libJudy_dir}/Judy.h"; then
  378. LIBS_BACKUP="${LIBS}"
  379. LIBS="${libJudy_dir}/libJudy.a"
  380. AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "${libJudy_dir}/Judy.h"
  381. int main (int argc, char **argv) {
  382. Pvoid_t PJLArray = (Pvoid_t) NULL;
  383. Word_t * PValue;
  384. Word_t Index;
  385. JLI(PValue, PJLArray, Index);
  386. }]])],
  387. [HAVE_libJudy_a="yes"],
  388. [HAVE_libJudy_a="no"])
  389. LIBS="${LIBS_BACKUP}"
  390. JUDY_LIBS="${libJudy_dir}/libJudy.a"
  391. JUDY_CFLAGS="-I${libJudy_dir}"
  392. AC_MSG_RESULT([$HAVE_libJudy_a])
  393. else
  394. libjudy_dir=""
  395. HAVE_libJudy_a="no"
  396. AC_MSG_RESULT([$HAVE_libJudy_a])
  397. fi
  398. ],
  399. [HAVE_libJudy_a="no"])
  400. if test "${HAVE_libJudy_a}" = "no"; then
  401. AC_CHECK_LIB(
  402. [Judy],
  403. [JudyLIns],
  404. [JUDY_LIBS="-lJudy"]
  405. )
  406. fi
  407. test "${enable_dbengine}" = "yes" -a -z "${JUDY_LIBS}" && \
  408. AC_MSG_ERROR([libJudy required but not found. Try installing 'libjudy-dev' or 'Judy-devel'.])
  409. test "${enable_https}" = "yes" -a -z "${SSL_LIBS}" && \
  410. AC_MSG_ERROR([OpenSSL required for HTTPS but not found. Try installing 'libssl-dev' or 'openssl-devel'.])
  411. test "${enable_dbengine}" = "yes" -a -z "${SSL_LIBS}" && \
  412. AC_MSG_ERROR([OpenSSL required for DBENGINE but not found. Try installing 'libssl-dev' or 'openssl-devel'.])
  413. AC_MSG_CHECKING([if netdata dbengine should be used])
  414. if test "${enable_dbengine}" != "no" -a "${UV_LIBS}" -a "${LZ4_LIBS}" -a "${JUDY_LIBS}" -a "${SSL_LIBS}"; then
  415. enable_dbengine="yes"
  416. AC_DEFINE([ENABLE_DBENGINE], [1], [netdata dbengine usability])
  417. OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
  418. OPTIONAL_LZ4_LIBS="${LZ4_LIBS}"
  419. OPTIONAL_JUDY_CFLAGS="${JUDY_CFLAGS}"
  420. OPTIONAL_JUDY_LIBS="${JUDY_LIBS}"
  421. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  422. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  423. else
  424. enable_dbengine="no"
  425. fi
  426. AC_MSG_RESULT([${enable_dbengine}])
  427. AM_CONDITIONAL([ENABLE_DBENGINE], [test "${enable_dbengine}" = "yes"])
  428. AC_MSG_CHECKING([if netdata https should be used])
  429. if test "${enable_https}" != "no" -a "${SSL_LIBS}"; then
  430. enable_https="yes"
  431. AC_DEFINE([ENABLE_HTTPS], [1], [netdata HTTPS usability])
  432. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  433. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  434. else
  435. enable_https="no"
  436. fi
  437. AC_MSG_RESULT([${enable_https}])
  438. AM_CONDITIONAL([ENABLE_HTTPS], [test "${enable_https}" = "yes"])
  439. # -----------------------------------------------------------------------------
  440. # JSON-C
  441. if test "${enable_jsonc}" != "no" -a -z "${JSONC_LIBS}"; then
  442. # Try and detect manual static build presence (from netdata-installer.sh)
  443. AC_MSG_CHECKING([if statically built json-c is present])
  444. HAVE_libjson_c_a="no"
  445. if test -f "externaldeps/jsonc/libjson-c.a"; then
  446. LIBS_BKP="${LIBS}"
  447. LIBS="externaldeps/jsonc/libjson-c.a"
  448. AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/jsonc/json-c/json.h"
  449. int main (int argc, char **argv) {
  450. struct json_object *jobj;
  451. char *str = "{ \"msg-type\": \"random\" }";
  452. jobj = json_tokener_parse(str);
  453. json_object_get_type(jobj);
  454. }]])],
  455. [HAVE_libjson_c_a="yes"],
  456. [HAVE_libjson_c_a="no"])
  457. LIBS="${LIBS_BKP}"
  458. fi
  459. if test "${HAVE_libjson_c_a}" = "yes"; then
  460. AC_DEFINE([LINK_STATIC_JSONC], [1], [static json-c should be used])
  461. JSONC_LIBS="static"
  462. OPTIONAL_JSONC_STATIC_CFLAGS="-I externaldeps/jsonc"
  463. fi
  464. AC_MSG_RESULT([${HAVE_libjson_c_a}])
  465. fi
  466. AM_CONDITIONAL([LINK_STATIC_JSONC], [test "${JSONC_LIBS}" = "static"])
  467. test "${enable_jsonc}" = "yes" -a -z "${JSONC_LIBS}" && \
  468. AC_MSG_ERROR([JSON-C required but not found. Try installing 'libjson-c-dev' or 'json-c'.])
  469. AC_MSG_CHECKING([if json-c should be used])
  470. if test "${enable_jsonc}" != "no" -a "${JSONC_LIBS}"; then
  471. enable_jsonc="yes"
  472. AC_DEFINE([ENABLE_JSONC], [1], [netdata json-c usability])
  473. else
  474. enable_jsonc="no"
  475. fi
  476. AC_MSG_RESULT([${enable_jsonc}])
  477. AM_CONDITIONAL([ENABLE_JSONC], [test "${enable_jsonc}" = "yes"])
  478. # -----------------------------------------------------------------------------
  479. # compiler options
  480. AC_ARG_VAR([SSE_CANDIDATE], [C compiler flags for SSE])
  481. AS_CASE([$host_cpu],
  482. [i?86], [SSE_CANDIDATE="yes"]
  483. )
  484. AC_SUBST([SSE_CANDIDATE])
  485. if test "${SSE_CANDIDATE}" = "yes" -a "${enable_x86_sse}" = "yes"; then
  486. opt="-msse2 -mfpmath=sse"
  487. AX_CHECK_COMPILE_FLAG(${opt}, [CFLAGS="${CFLAGS} ${opt}"], [])
  488. fi
  489. if test "${GCC}" = "yes"; then
  490. AC_DEFINE_UNQUOTED([likely(x)], [__builtin_expect(!!(x), 1)], [gcc branch optimization])
  491. AC_DEFINE_UNQUOTED([unlikely(x)], [__builtin_expect(!!(x), 0)], [gcc branch optimization])
  492. else
  493. AC_DEFINE_UNQUOTED([likely(x)], [(x)], [gcc branch optimization])
  494. AC_DEFINE_UNQUOTED([unlikely(x)], [(x)], [gcc branch optimization])
  495. fi
  496. if test "${GCC}" = "yes"; then
  497. AC_DEFINE([__always_unused], [__attribute__((unused))], [gcc unused attribute])
  498. AC_DEFINE([__maybe_unused], [__attribute__((unused))], [gcc unused attribute])
  499. else
  500. AC_DEFINE([__always_unused], [], [dummy unused attribute])
  501. AC_DEFINE([__maybe_unused], [], [dummy unused attribute])
  502. fi
  503. if test "${enable_pedantic}" = "yes"; then
  504. enable_strict="yes"
  505. CFLAGS="${CFLAGS} -pedantic -Wall -Wextra -Wno-long-long"
  506. fi
  507. # -----------------------------------------------------------------------------
  508. # memory allocation library
  509. AC_MSG_CHECKING([for memory allocator])
  510. TS_CHECK_JEMALLOC
  511. if test "$has_jemalloc" = "1"; then
  512. AC_DEFINE([ENABLE_JEMALLOC], [1], [compile and link with jemalloc])
  513. AC_MSG_RESULT([jemalloc])
  514. else
  515. TS_CHECK_TCMALLOC
  516. if test "$has_tcmalloc" = "1"; then
  517. AC_DEFINE([ENABLE_TCMALLOC], [1], [compile and link with tcmalloc])
  518. AC_MSG_RESULT([tcmalloc])
  519. else
  520. AC_MSG_RESULT([system])
  521. AC_C_MALLOPT
  522. AC_C_MALLINFO
  523. fi
  524. fi
  525. # -----------------------------------------------------------------------------
  526. # libcap
  527. PKG_CHECK_MODULES(
  528. [LIBCAP],
  529. [libcap],
  530. [AC_CHECK_LIB([cap], [cap_get_proc, cap_set_proc],
  531. [AC_CHECK_HEADER(
  532. [sys/capability.h],
  533. [have_libcap=yes],
  534. [have_libcap=no]
  535. )],
  536. [have_libcap=no]
  537. )],
  538. [have_libcap=no]
  539. )
  540. test "${with_libcap}" = "yes" -a "${have_libcap}" != "yes" && AC_MSG_ERROR([libcap required but not found.])
  541. AC_MSG_CHECKING([if libcap should be used])
  542. if test "${with_libcap}" != "no" -a "${have_libcap}" = "yes"; then
  543. with_libcap="yes"
  544. AC_DEFINE([HAVE_CAPABILITY], [1], [libcap usability])
  545. OPTIONAL_LIBCAP_CFLAGS="${LIBCAP_CFLAGS}"
  546. OPTIONAL_LIBCAP_LIBS="${LIBCAP_LIBS}"
  547. else
  548. with_libcap="no"
  549. fi
  550. AC_MSG_RESULT([${with_libcap}])
  551. AM_CONDITIONAL([ENABLE_CAPABILITY], [test "${with_libcap}" = "yes"])
  552. # -----------------------------------------------------------------------------
  553. # ACLK
  554. AC_MSG_CHECKING([if cloud functionality should be enabled])
  555. AC_MSG_RESULT([${enable_cloud}])
  556. if test "$enable_cloud" != "no"; then
  557. # just to have all messages that can fail ACLK build in one place
  558. # so it is easier to see why it can't be built
  559. if test -n "${SSL_LIBS}"; then
  560. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  561. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  562. else
  563. AC_MSG_WARN([OpenSSL required for agent-cloud-link but not found. Try installing 'libssl-dev' or 'openssl-devel'.])
  564. fi
  565. AC_MSG_CHECKING([if libmosquitto static lib is present (and builds)])
  566. if test -f "externaldeps/mosquitto/libmosquitto.a"; then
  567. LIBS_BKP="${LIBS}"
  568. LIBS="externaldeps/mosquitto/libmosquitto.a ${OPTIONAL_SSL_LIBS} ${LIBS_BKP}"
  569. AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/mosquitto/mosquitto.h"
  570. int main (int argc, char **argv) {
  571. int m,mm,r;
  572. mosquitto_lib_version(&m, &mm, &r);
  573. }]])],
  574. [HAVE_libmosquitto_a="yes"],
  575. [HAVE_libmosquitto_a="no"])
  576. LIBS="${LIBS_BKP}"
  577. else
  578. HAVE_libmosquitto_a="no"
  579. AC_DEFINE([ACLK_NO_LIBMOSQ], [1], [Libmosquitto.a was not found during build.])
  580. fi
  581. AC_MSG_RESULT([${HAVE_libmosquitto_a}])
  582. if test "${with_bundled_lws}" = "yes"; then
  583. AC_MSG_CHECKING([if libwebsockets static lib is present])
  584. if test -f "${bundled_lws_dir}/libwebsockets.a"; then
  585. LWS_CFLAGS="-I ${bundled_lws_dir}/include"
  586. OPTIONAL_LWS_LIBS="${bundled_lws_dir}/libwebsockets.a"
  587. AC_MSG_RESULT([yes])
  588. AC_DEFINE([BUNDLED_LWS], [1], [using statically linked libwebsockets])
  589. else
  590. AC_DEFINE([ACLK_NO_LWS], [1], [libwebsockets.a was not found during build.])
  591. # this should be error if installer ever changes default to system
  592. # as currently this is default we prefer building netdata without ACLK
  593. # instead of error fail
  594. AC_MSG_RESULT([no])
  595. AC_MSG_WARN([You required static libwebsockets to be used but we can't use it. Disabling ACLK])
  596. fi
  597. else
  598. AC_CHECK_LIB([websockets],
  599. [lws_get_vhost_by_name],
  600. [OPTIONAL_LWS_LIBS="-lwebsockets"],
  601. [AC_DEFINE([ACLK_NO_LWS], [1], [usable system libwebsockets was not found during build.])])
  602. fi
  603. if test "${build_target}" = "linux" -a "${enable_cloud}" != "no"; then
  604. if test "${have_libcap}" = "yes" -a "${with_libcap}" = "no"; then
  605. AC_MSG_ERROR([agent-cloud-link can't be built without libcap. Disable it by --disable-cloud or enable libcap])
  606. fi
  607. if test "${with_libcap}" = "yes"; then
  608. LWS_CFLAGS+=" ${LIBCAP_CFLAGS}"
  609. fi
  610. fi
  611. # next 2 lines are just to have info for ACLK dependencies in common place
  612. AC_MSG_CHECKING([if json-c available for ACLK])
  613. AC_MSG_RESULT([${enable_jsonc}])
  614. test "${enable_cloud}" = "yes" -a "${enable_jsonc}" = "no" && \
  615. AC_MSG_ERROR([You have asked for ACLK to be built but no json-c available. ACLK requires json-c])
  616. AC_MSG_CHECKING([if netdata agent-cloud-link can be enabled])
  617. if test "${HAVE_libmosquitto_a}" = "yes" -a -n "${OPTIONAL_LWS_LIBS}" -a -n "${SSL_LIBS}" -a "${enable_jsonc}" = "yes"; then
  618. can_enable_aclk="yes"
  619. else
  620. can_enable_aclk="no"
  621. fi
  622. AC_MSG_RESULT([${can_enable_aclk}])
  623. test "${enable_cloud}" = "yes" -a "${can_enable_aclk}" = "no" && \
  624. AC_MSG_ERROR([User required agent-cloud-link but it can't be built!])
  625. AC_MSG_CHECKING([if netdata agent-cloud-link should/will be enabled])
  626. if test "${enable_cloud}" = "detect"; then
  627. enable_aclk=$can_enable_aclk
  628. else
  629. enable_aclk=$enable_cloud
  630. fi
  631. AC_SUBST([can_enable_aclk])
  632. if test "${enable_aclk}" = "yes"; then
  633. AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
  634. fi
  635. AC_MSG_RESULT([${enable_aclk}])
  636. fi
  637. AC_SUBST([enable_cloud])
  638. AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"])
  639. # -----------------------------------------------------------------------------
  640. # apps.plugin
  641. AC_MSG_CHECKING([if apps.plugin should be enabled])
  642. if test "${build_target}" != "macos"; then
  643. AC_DEFINE([ENABLE_APPS_PLUGIN], [1], [apps.plugin])
  644. enable_plugin_apps="yes"
  645. else
  646. enable_plugin_apps="no"
  647. fi
  648. AC_MSG_RESULT([${enable_plugin_apps}])
  649. AM_CONDITIONAL([ENABLE_PLUGIN_APPS], [test "${enable_plugin_apps}" = "yes"])
  650. # -----------------------------------------------------------------------------
  651. # freeipmi.plugin - libipmimonitoring
  652. PKG_CHECK_MODULES(
  653. [IPMIMONITORING],
  654. [libipmimonitoring],
  655. [AC_CHECK_LIB([ipmimonitoring], [
  656. ipmi_monitoring_sensor_readings_by_record_id,
  657. ipmi_monitoring_sensor_readings_by_sensor_type,
  658. ipmi_monitoring_sensor_read_sensor_number,
  659. ipmi_monitoring_sensor_read_sensor_name,
  660. ipmi_monitoring_sensor_read_sensor_state,
  661. ipmi_monitoring_sensor_read_sensor_units,
  662. ipmi_monitoring_sensor_iterator_next,
  663. ipmi_monitoring_ctx_sensor_config_file,
  664. ipmi_monitoring_ctx_sdr_cache_directory,
  665. ipmi_monitoring_ctx_errormsg,
  666. ipmi_monitoring_ctx_create
  667. ],
  668. [AC_CHECK_HEADER(
  669. [ipmi_monitoring.h],
  670. [AC_CHECK_HEADER(
  671. [ipmi_monitoring_bitmasks.h],
  672. [have_ipmimonitoring=yes],
  673. [have_ipmimonitoring=no]
  674. )],
  675. [have_ipmimonitoring=no]
  676. )],
  677. [have_ipmimonitoring=no]
  678. )],
  679. [have_ipmimonitoring=no]
  680. )
  681. test "${enable_plugin_freeipmi}" = "yes" -a "${have_ipmimonitoring}" != "yes" && \
  682. AC_MSG_ERROR([ipmimonitoring required but not found. Try installing 'libipmimonitoring-dev' or 'libipmimonitoring-devel'])
  683. AC_MSG_CHECKING([if freeipmi.plugin should be enabled])
  684. if test "${enable_plugin_freeipmi}" != "no" -a "${have_ipmimonitoring}" = "yes"; then
  685. enable_plugin_freeipmi="yes"
  686. AC_DEFINE([HAVE_FREEIPMI], [1], [ipmimonitoring usability])
  687. OPTIONAL_IPMIMONITORING_CFLAGS="${IPMIMONITORING_CFLAGS}"
  688. OPTIONAL_IPMIMONITORING_LIBS="${IPMIMONITORING_LIBS}"
  689. else
  690. enable_plugin_freeipmi="no"
  691. fi
  692. AC_MSG_RESULT([${enable_plugin_freeipmi}])
  693. AM_CONDITIONAL([ENABLE_PLUGIN_FREEIPMI], [test "${enable_plugin_freeipmi}" = "yes"])
  694. # -----------------------------------------------------------------------------
  695. # cups.plugin - libcups
  696. # Only check most recently added method of cups
  697. AC_CHECK_LIB([cups], [httpConnect2],
  698. [AC_CHECK_HEADER(
  699. [cups/cups.h],
  700. [have_cups=yes],
  701. [have_cups=no]
  702. )],
  703. [have_cups=no]
  704. )
  705. test "${enable_plugin_cups}" = "yes" -a "${have_cups}" != "yes" && \
  706. AC_MSG_ERROR([cups required but not found. Try installing 'cups'])
  707. AC_ARG_WITH([cups-config],
  708. [AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])],
  709. [with_cups_config="$withval"],
  710. [with_cups_config=system]
  711. )
  712. AS_IF([test "x$with_cups_config" != "xsystem"], [
  713. CUPSCONFIG=$with_cups_config
  714. ], [
  715. AC_PATH_TOOL(CUPSCONFIG, [cups-config])
  716. AS_IF([test -z "$CUPSCONFIG"], [
  717. have_cups=no
  718. ])
  719. ])
  720. AC_MSG_CHECKING([if cups.plugin should be enabled])
  721. if test "${enable_plugin_cups}" != "no" -a "${have_cups}" = "yes"; then
  722. enable_plugin_cups="yes"
  723. AC_DEFINE([HAVE_CUPS], [1], [cups usability])
  724. CUPS_CFLAGS="${CUPS_CFLAGS} `$CUPSCONFIG --cflags`"
  725. CUPS_LIBS="${CUPS_LIBS} `$CUPSCONFIG --libs`"
  726. OPTIONAL_CUPS_CFLAGS="${CUPS_CFLAGS}"
  727. OPTIONAL_CUPS_LIBS="${CUPS_LIBS}"
  728. else
  729. enable_plugin_cups="no"
  730. fi
  731. AC_MSG_RESULT([${enable_plugin_cups}])
  732. AM_CONDITIONAL([ENABLE_PLUGIN_CUPS], [test "${enable_plugin_cups}" = "yes"])
  733. # -----------------------------------------------------------------------------
  734. # nfacct.plugin - libmnl, libnetfilter_acct
  735. AC_CHECK_HEADER(
  736. [linux/netfilter/nfnetlink_conntrack.h],
  737. [AC_CHECK_DECL(
  738. [CTA_STATS_MAX],
  739. [have_nfnetlink_conntrack=yes],
  740. [have_nfnetlink_conntrack=no],
  741. [#include <linux/netfilter/nfnetlink_conntrack.h>]
  742. )],
  743. [have_nfnetlink_conntrack=no]
  744. )
  745. PKG_CHECK_MODULES(
  746. [NFACCT],
  747. [libnetfilter_acct],
  748. [AC_CHECK_LIB(
  749. [netfilter_acct],
  750. [nfacct_alloc],
  751. [have_libnetfilter_acct=yes],
  752. [have_libnetfilter_acct=no]
  753. )],
  754. [have_libnetfilter_acct=no]
  755. )
  756. PKG_CHECK_MODULES(
  757. [LIBMNL],
  758. [libmnl],
  759. [AC_CHECK_LIB(
  760. [mnl],
  761. [mnl_socket_open],
  762. [have_libmnl=yes],
  763. [have_libmnl=no]
  764. )],
  765. [have_libmnl=no]
  766. )
  767. test "${enable_plugin_nfacct}" = "yes" -a "${have_nfnetlink_conntrack}" != "yes" && \
  768. AC_MSG_ERROR([nfnetlink_conntrack.h required but not found or too old])
  769. test "${enable_plugin_nfacct}" = "yes" -a "${have_libnetfilter_acct}" != "yes" && \
  770. AC_MSG_ERROR([netfilter_acct required but not found])
  771. test "${enable_plugin_nfacct}" = "yes" -a "${have_libmnl}" != "yes" && \
  772. AC_MSG_ERROR([libmnl required but not found. Try installing 'libmnl-dev' or 'libmnl-devel'])
  773. AC_MSG_CHECKING([if nfacct.plugin should be enabled])
  774. if test "${enable_plugin_nfacct}" != "no" -a "${have_libnetfilter_acct}" = "yes" \
  775. -a "${have_libmnl}" = "yes" \
  776. -a "${have_nfnetlink_conntrack}" = "yes"; then
  777. enable_plugin_nfacct="yes"
  778. AC_DEFINE([HAVE_NFACCT], [1], [netfilter accounting usability])
  779. OPTIONAL_NFACCT_CFLAGS="${NFACCT_CFLAGS} ${LIBMNL_CFLAGS}"
  780. OPTIONAL_NFACCT_LIBS="${NFACCT_LIBS} ${LIBMNL_LIBS}"
  781. else
  782. enable_plugin_nfacct="no"
  783. fi
  784. AC_MSG_RESULT([${enable_plugin_nfacct}])
  785. AM_CONDITIONAL([ENABLE_PLUGIN_NFACCT], [test "${enable_plugin_nfacct}" = "yes"])
  786. # -----------------------------------------------------------------------------
  787. # xenstat.plugin - libxenstat
  788. PKG_CHECK_MODULES(
  789. [YAJL],
  790. [yajl],
  791. [AC_CHECK_LIB(
  792. [yajl],
  793. [yajl_tree_get],
  794. [have_libyajl=yes],
  795. [have_libyajl=no]
  796. )],
  797. [have_libyajl=no]
  798. )
  799. AC_CHECK_LIB(
  800. [xenstat],
  801. [xenstat_init],
  802. [AC_CHECK_HEADER(
  803. [xenstat.h],
  804. [have_libxenstat=yes],
  805. [have_libxenstat=no]
  806. )],
  807. [have_libxenstat=no],
  808. [-lyajl]
  809. )
  810. PKG_CHECK_MODULES(
  811. [XENLIGHT],
  812. [xenlight],
  813. [AC_CHECK_LIB(
  814. [xenlight],
  815. [libxl_domain_info],
  816. [AC_CHECK_HEADER(
  817. [libxl.h],
  818. [have_libxenlight=yes],
  819. [have_libxenlight=no]
  820. )],
  821. [have_libxenlight=no]
  822. )],
  823. [have_libxenlight=no]
  824. )
  825. test "${enable_plugin_xenstat}" = "yes" -a "${have_libxenstat}" != "yes" && \
  826. AC_MSG_ERROR([libxenstat required but not found. try installing 'xen-dom0-libs-devel'])
  827. test "${enable_plugin_xenstat}" = "yes" -a "${have_libxenlight}" != "yes" && \
  828. AC_MSG_ERROR([libxenlight required but not found. try installing 'xen-dom0-libs-devel'])
  829. test "${enable_plugin_xenstat}" = "yes" -a "${have_libyajl}" != "yes" && \
  830. AC_MSG_ERROR([libyajl required but not found. Try installing 'yajl-devel'])
  831. AC_MSG_CHECKING([if xenstat.plugin should be enabled])
  832. if test "${enable_plugin_xenstat}" != "no" -a "${have_libxenstat}" = "yes" -a "${have_libxenlight}" = "yes" -a "${have_libyajl}" = "yes"; then
  833. enable_plugin_xenstat="yes"
  834. AC_DEFINE([HAVE_LIBXENSTAT], [1], [libxenstat usability])
  835. OPTIONAL_XENSTAT_CFLAGS="${XENLIGHT_CFLAGS} ${YAJL_CFLAGS}"
  836. OPTIONAL_XENSTAT_LIBS="-lxenstat ${XENLIGHT_LIBS} ${YAJL_LIBS}"
  837. else
  838. enable_plugin_xenstat="no"
  839. fi
  840. AC_MSG_RESULT([${enable_plugin_xenstat}])
  841. AM_CONDITIONAL([ENABLE_PLUGIN_XENSTAT], [test "${enable_plugin_xenstat}" = "yes"])
  842. if test "${enable_plugin_xenstat}" == "yes"; then
  843. AC_MSG_CHECKING([for xenstat_vbd_error in -lxenstat])
  844. AC_TRY_LINK(
  845. [ #include <xenstat.h> ],
  846. [
  847. xenstat_vbd * vbd;
  848. int out = xenstat_vbd_error(vbd);
  849. ],
  850. [
  851. have_xenstat_vbd_error=yes
  852. AC_DEFINE([HAVE_XENSTAT_VBD_ERROR], [1], [xenstat_vbd_error usability])
  853. ],
  854. [ have_xenstat_vbd_error=no ]
  855. )
  856. AC_MSG_RESULT([${have_xenstat_vbd_error}])
  857. fi
  858. # -----------------------------------------------------------------------------
  859. # perf.plugin
  860. AC_CHECK_HEADER(
  861. [linux/perf_event.h],
  862. [AC_CHECK_DECL(
  863. [PERF_COUNT_HW_REF_CPU_CYCLES],
  864. [have_perf_event=yes],
  865. [have_perf_event=no],
  866. [#include <linux/perf_event.h>]
  867. )],
  868. [have_perf_event=no]
  869. )
  870. AC_MSG_CHECKING([if perf.plugin should be enabled])
  871. if test "${build_target}" == "linux" -a "${have_perf_event}" = "yes"; then
  872. AC_DEFINE([ENABLE_PERF_PLUGIN], [1], [perf.plugin])
  873. enable_plugin_perf="yes"
  874. else
  875. enable_plugin_perf="no"
  876. fi
  877. AC_MSG_RESULT([${enable_plugin_perf}])
  878. AM_CONDITIONAL([ENABLE_PLUGIN_PERF], [test "${enable_plugin_perf}" = "yes"])
  879. # -----------------------------------------------------------------------------
  880. # ebpf.plugin
  881. if test "${build_target}" = "linux" -a "${enable_ebpf}" != "no"; then
  882. PKG_CHECK_MODULES(
  883. [LIBELF],
  884. [libelf],
  885. [have_libelf=yes],
  886. [have_libelf=no]
  887. )
  888. AC_CHECK_TYPE(
  889. [struct bpf_prog_info],
  890. [have_bpf=yes],
  891. [have_bpf=no],
  892. [#include <linux/bpf.h>]
  893. )
  894. AC_CHECK_FILE(
  895. externaldeps/libbpf/libbpf.a,
  896. [have_libbpf=yes],
  897. [have_libbpf=no]
  898. )
  899. AC_MSG_CHECKING([if ebpf.plugin should be enabled])
  900. if test "${have_libelf}" = "yes" -a \
  901. "${have_bpf}" = "yes" -a \
  902. "${have_libbpf}" = "yes"; then
  903. OPTIONAL_BPF_CFLAGS="${LIBELF_CFLAGS} -I externaldeps/libbpf/include"
  904. OPTIONAL_BPF_LIBS="externaldeps/libbpf/libbpf.a ${LIBELF_LIBS}"
  905. AC_DEFINE([HAVE_LIBBPF], [1], [libbpf usability])
  906. enable_ebpf="yes"
  907. else
  908. enable_ebpf="no"
  909. fi
  910. else
  911. enable_ebpf="no"
  912. fi
  913. AC_MSG_RESULT([${enable_ebpf}])
  914. AM_CONDITIONAL([ENABLE_PLUGIN_EBPF], [test "${enable_ebpf}" = "yes"])
  915. # -----------------------------------------------------------------------------
  916. # slabinfo.plugin
  917. AC_MSG_CHECKING([if slabinfo.plugin should be enabled])
  918. if test "${build_target}" == "linux"; then
  919. AC_DEFINE([ENABLE_SLABINFO], [1], [slabinfo plugin])
  920. enable_plugin_slabinfo="yes"
  921. else
  922. enable_plugin_slabinfo="no"
  923. fi
  924. AC_MSG_RESULT([${enable_plugin_slabinfo}])
  925. AM_CONDITIONAL([ENABLE_PLUGIN_SLABINFO], [test "${enable_plugin_slabinfo}" = "yes"])
  926. # -----------------------------------------------------------------------------
  927. # AWS Kinesis backend - libaws-cpp-sdk-kinesis, libaws-cpp-sdk-core, libssl, libcrypto, libcurl
  928. PKG_CHECK_MODULES(
  929. [LIBCRYPTO],
  930. [libcrypto],
  931. [AC_CHECK_LIB(
  932. [crypto],
  933. [CRYPTO_new_ex_data],
  934. [have_libcrypto=yes],
  935. [have_libcrypto=no]
  936. )],
  937. [have_libcrypto=no]
  938. )
  939. PKG_CHECK_MODULES(
  940. [LIBSSL],
  941. [libssl],
  942. [AC_CHECK_LIB(
  943. [ssl],
  944. [SSL_connect],
  945. [have_libssl=yes],
  946. [have_libssl=no]
  947. )],
  948. [have_libssl=no]
  949. )
  950. PKG_CHECK_MODULES(
  951. [LIBCURL],
  952. [libcurl],
  953. [AC_CHECK_LIB(
  954. [curl],
  955. [curl_easy_init],
  956. [have_libcurl=yes],
  957. [have_libcurl=no]
  958. )],
  959. [have_libcurl=no]
  960. )
  961. PKG_CHECK_MODULES(
  962. [AWS_CPP_SDK_CORE],
  963. [aws-cpp-sdk-core],
  964. [AC_CHECK_LIB(
  965. [aws-cpp-sdk-core],
  966. [cJSON_free],
  967. [have_libaws_cpp_sdk_core=yes],
  968. [have_libaws_cpp_sdk_core=no]
  969. )],
  970. [have_libaws_cpp_sdk_core=no]
  971. )
  972. PKG_CHECK_MODULES(
  973. [AWS_CPP_SDK_KINESIS],
  974. [aws-cpp-sdk-kinesis],
  975. [have_libaws_cpp_sdk_kinesis=yes],
  976. [have_libaws_cpp_sdk_kinesis=no]
  977. )
  978. AC_CHECK_LIB(
  979. [aws-checksums],
  980. [aws_checksums_crc32],
  981. [have_libaws_checksums=yes],
  982. [have_libaws_checksums=no]
  983. )
  984. AC_CHECK_LIB(
  985. [aws-c-common],
  986. [aws_default_allocator],
  987. [have_libaws_c_common=yes],
  988. [have_libaws_c_common=no]
  989. )
  990. AC_CHECK_LIB(
  991. [aws-c-event-stream],
  992. [aws_event_stream_library_init],
  993. [have_libaws_c_event_stream=yes],
  994. [have_libaws_c_event_stream=no]
  995. )
  996. test "${enable_backend_kinesis}" = "yes" -a "${have_libaws_cpp_sdk_kinesis}" != "yes" && \
  997. AC_MSG_ERROR([libaws-cpp-sdk-kinesis required but not found. try installing AWS C++ SDK])
  998. test "${enable_backend_kinesis}" = "yes" -a "${have_libaws_cpp_sdk_core}" != "yes" && \
  999. AC_MSG_ERROR([libaws-cpp-sdk-core required but not found. try installing AWS C++ SDK])
  1000. test "${enable_backend_kinesis}" = "yes" -a "${have_libcurl}" != "yes" && \
  1001. AC_MSG_ERROR([libcurl required but not found])
  1002. test "${enable_backend_kinesis}" = "yes" -a "${have_libssl}" != "yes" && \
  1003. AC_MSG_ERROR([libssl required but not found])
  1004. test "${enable_backend_kinesis}" = "yes" -a "${have_libcrypto}" != "yes" && \
  1005. AC_MSG_ERROR([libcrypto required but not found])
  1006. test "${enable_backend_kinesis}" = "yes" -a "${have_libaws_checksums}" != "yes" \
  1007. -a "${have_libaws_c_common}" != "yes" \
  1008. -a "${have_libaws_c_event_stream}" != "yes" && \
  1009. AC_MSG_ERROR([AWS SKD third party dependencies required but not found])
  1010. AC_MSG_CHECKING([if kinesis backend should be enabled])
  1011. if test "${enable_backend_kinesis}" != "no" -a "${have_libaws_cpp_sdk_kinesis}" = "yes" \
  1012. -a "${have_libaws_cpp_sdk_core}" = "yes" \
  1013. -a "${have_libaws_checksums}" = "yes" \
  1014. -a "${have_libaws_c_common}" = "yes" \
  1015. -a "${have_libaws_c_event_stream}" = "yes" \
  1016. -a "${have_libcurl}" = "yes" \
  1017. -a "${have_libssl}" = "yes" \
  1018. -a "${have_libcrypto}" = "yes"; then
  1019. enable_backend_kinesis="yes"
  1020. AC_DEFINE([HAVE_KINESIS], [1], [libaws-cpp-sdk-kinesis usability])
  1021. OPTIONAL_KINESIS_CFLAGS="${LIBCRYPTO_CFLAGS} ${LIBSSL_CFLAGS} ${LIBCURL_CFLAGS}"
  1022. CXX11FLAG="${AWS_CPP_SDK_KINESIS_CFLAGS} ${AWS_CPP_SDK_CORE_CFLAGS}"
  1023. OPTIONAL_KINESIS_LIBS="${AWS_CPP_SDK_KINESIS_LIBS} ${AWS_CPP_SDK_CORE_LIBS} \
  1024. ${LIBCRYPTO_LIBS} ${LIBSSL_LIBS} ${LIBCURL_LIBS}"
  1025. else
  1026. enable_backend_kinesis="no"
  1027. fi
  1028. AC_MSG_RESULT([${enable_backend_kinesis}])
  1029. AM_CONDITIONAL([ENABLE_BACKEND_KINESIS], [test "${enable_backend_kinesis}" = "yes"])
  1030. # -----------------------------------------------------------------------------
  1031. # Pub/Sub exporting connector - googleapis
  1032. PKG_CHECK_MODULES(
  1033. [GRPC],
  1034. [grpc],
  1035. [have_libgrpc=yes],
  1036. [have_libgrpc=no]
  1037. )
  1038. PKG_CHECK_MODULES(
  1039. [PUBSUB],
  1040. [googleapis_cpp_pubsub_protos],
  1041. [have_pubsub_protos=yes],
  1042. [have_pubsub_protos=no]
  1043. )
  1044. AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
  1045. AS_IF(
  1046. [test x"${CXX_BINARY}" == x"no"],
  1047. [have_CXX_compiler=no],
  1048. [have_CXX_compiler=yes]
  1049. )
  1050. test "${enable_pubsub}" = "yes" -a "${have_grpc}" != "yes" && \
  1051. AC_MSG_ERROR([libgrpc required but not found. try installing grpc])
  1052. test "${enable_pubsub}" = "yes" -a "${have_pubsub_protos}" != "yes" && \
  1053. AC_MSG_ERROR([libgoogleapis_cpp_pubsub_protos required but not found. try installing googleapis])
  1054. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler}" != "yes" && \
  1055. AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
  1056. AC_MSG_CHECKING([if pubsub exporting connector should be enabled])
  1057. if test "${enable_exporting_pubsub}" != "no" -a "${have_pubsub_protos}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
  1058. enable_exporting_pubsub="yes"
  1059. AC_DEFINE([ENABLE_EXPORTING_PUBSUB], [1], [Pub/Sub API usability])
  1060. OPTIONAL_PUBSUB_CFLAGS="${GRPC_CFLAGS} ${PUBSUB_CFLAGS}"
  1061. CXX11FLAG="-std=c++11"
  1062. OPTIONAL_PUBSUB_LIBS="${GRPC_LIBS} ${PUBSUB_LIBS}"
  1063. else
  1064. enable_pubsub="no"
  1065. fi
  1066. AC_MSG_RESULT([${enable_exporting_pubsub}])
  1067. AM_CONDITIONAL([ENABLE_EXPORTING_PUBSUB], [test "${enable_exporting_pubsub}" = "yes"])
  1068. # -----------------------------------------------------------------------------
  1069. # Prometheus remote write backend - libprotobuf, libsnappy, protoc
  1070. PKG_CHECK_MODULES(
  1071. [PROTOBUF],
  1072. [protobuf >= 3],
  1073. [have_libprotobuf=yes],
  1074. [have_libprotobuf=no]
  1075. )
  1076. AC_MSG_CHECKING([for snappy::RawCompress in -lsnappy])
  1077. AC_LANG_SAVE
  1078. AC_LANG_CPLUSPLUS
  1079. save_LIBS="${LIBS}"
  1080. LIBS="-lsnappy"
  1081. save_CXXFLAGS="${CXXFLAGS}"
  1082. CXXFLAGS="${CXXFLAGS} -std=c++11"
  1083. AC_TRY_LINK(
  1084. [
  1085. #include <stdlib.h>
  1086. #include <snappy.h>
  1087. ],
  1088. [
  1089. const char *input = "test";
  1090. size_t compressed_length;
  1091. char *buffer = (char *)malloc(5 * sizeof(char));
  1092. snappy::RawCompress(input, 4, buffer, &compressed_length);
  1093. free(buffer);
  1094. ],
  1095. [
  1096. have_libsnappy=yes
  1097. SNAPPY_CFLAGS=""
  1098. SNAPPY_LIBS="-lsnappy"
  1099. ],
  1100. [have_libsnappy=no]
  1101. )
  1102. LIBS="${save_LIBS}"
  1103. CXXFLAGS="${save_CXXFLAGS}"
  1104. AC_LANG_RESTORE
  1105. AC_MSG_RESULT([${have_libsnappy}])
  1106. AC_PATH_PROG([PROTOC], [protoc], [no])
  1107. AS_IF(
  1108. [test x"${PROTOC}" == x"no"],
  1109. [have_protoc=no],
  1110. [have_protoc=yes]
  1111. )
  1112. AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
  1113. AS_IF(
  1114. [test x"${CXX_BINARY}" == x"no"],
  1115. [have_CXX_compiler=no],
  1116. [have_CXX_compiler=yes]
  1117. )
  1118. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_libprotobuf}" != "yes" && \
  1119. AC_MSG_ERROR([libprotobuf required but not found. try installing protobuf])
  1120. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_libsnappy}" != "yes" && \
  1121. AC_MSG_ERROR([libsnappy required but not found. try installing snappy])
  1122. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_protoc}" != "yes" && \
  1123. AC_MSG_ERROR([protoc compiler required but not found. try installing protobuf])
  1124. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler}" != "yes" && \
  1125. AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
  1126. AC_MSG_CHECKING([if prometheus remote write backend should be enabled])
  1127. if test "${enable_backend_prometheus_remote_write}" != "no" -a "${have_libprotobuf}" = "yes" -a "${have_libsnappy}" = "yes" \
  1128. -a "${have_protoc}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
  1129. enable_backend_prometheus_remote_write="yes"
  1130. AC_DEFINE([ENABLE_PROMETHEUS_REMOTE_WRITE], [1], [Prometheus remote write API usability])
  1131. OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS="${PROTOBUF_CFLAGS} ${SNAPPY_CFLAGS} -Iexporting/prometheus/remote_write"
  1132. CXX11FLAG="-std=c++11"
  1133. OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS="${PROTOBUF_LIBS} ${SNAPPY_LIBS}"
  1134. else
  1135. enable_backend_prometheus_remote_write="no"
  1136. fi
  1137. AC_MSG_RESULT([${enable_backend_prometheus_remote_write}])
  1138. AM_CONDITIONAL([ENABLE_BACKEND_PROMETHEUS_REMOTE_WRITE], [test "${enable_backend_prometheus_remote_write}" = "yes"])
  1139. # -----------------------------------------------------------------------------
  1140. # MongoDB backend - libmongoc
  1141. PKG_CHECK_MODULES(
  1142. [LIBMONGOC],
  1143. [libmongoc-1.0 >= 1.7],
  1144. [have_libmongoc=yes],
  1145. [have_libmongoc=no]
  1146. )
  1147. test "${enable_backend_mongodb}" = "yes" -a "${have_libmongoc}" != "yes" && \
  1148. AC_MSG_ERROR([libmongoc required but not found. Try installing `mongoc`.])
  1149. AC_MSG_CHECKING([if mongodb backend should be enabled])
  1150. if test "${enable_backend_mongodb}" != "no" -a "${have_libmongoc}" = "yes"; then
  1151. enable_backend_mongodb="yes"
  1152. AC_DEFINE([HAVE_MONGOC], [1], [libmongoc usability])
  1153. OPTIONAL_MONGOC_CFLAGS="${LIBMONGOC_CFLAGS}"
  1154. OPTIONAL_MONGOC_LIBS="${LIBMONGOC_LIBS}"
  1155. else
  1156. enable_backend_mongodb="no"
  1157. fi
  1158. AC_MSG_RESULT([${enable_backend_mongodb}])
  1159. AM_CONDITIONAL([ENABLE_BACKEND_MONGODB], [test "${enable_backend_mongodb}" = "yes"])
  1160. # -----------------------------------------------------------------------------
  1161. # check for setns() - cgroup-network
  1162. AC_CHECK_FUNC([setns])
  1163. AC_MSG_CHECKING([if cgroup-network can be enabled])
  1164. if test "$ac_cv_func_setns" = "yes" ; then
  1165. have_setns="yes"
  1166. AC_DEFINE([HAVE_SETNS], [1], [Define 1 if you have setns() function])
  1167. else
  1168. have_setns="no"
  1169. fi
  1170. AC_MSG_RESULT([${have_setns}])
  1171. AM_CONDITIONAL([ENABLE_PLUGIN_CGROUP_NETWORK], [test "${have_setns}" = "yes"])
  1172. # -----------------------------------------------------------------------------
  1173. # Link-Time-Optimization
  1174. if test "${enable_lto}" != "no"; then
  1175. opt="-flto"
  1176. AX_CHECK_COMPILE_FLAG(${opt}, [have_lto=yes], [have_lto=no])
  1177. fi
  1178. if test "${have_lto}" = "yes"; then
  1179. oCFLAGS="${CFLAGS}"
  1180. CFLAGS="${CFLAGS} -flto"
  1181. ac_cv_c_lto_cross_compile="${enable_lto}"
  1182. test "${ac_cv_c_lto_cross_compile}" != "yes" && ac_cv_c_lto_cross_compile="no"
  1183. AC_C_LTO
  1184. CFLAGS="${oCFLAGS}"
  1185. test "${ac_cv_c_lto}" != "yes" && have_lto="no"
  1186. fi
  1187. test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
  1188. AC_MSG_ERROR([LTO is required but is not available.])
  1189. AC_MSG_CHECKING([if LTO should be enabled])
  1190. if test "${enable_lto}" != "no" -a "${have_lto}" = "yes"; then
  1191. enable_lto="yes"
  1192. CFLAGS="${CFLAGS} -flto"
  1193. else
  1194. enable_lto="no"
  1195. fi
  1196. AC_MSG_RESULT([${enable_lto}])
  1197. # -----------------------------------------------------------------------------
  1198. AM_CONDITIONAL([ENABLE_CXX_LINKER], [test "${enable_backend_kinesis}" = "yes" \
  1199. -o "${enable_exporting_pubsub}" = "yes" \
  1200. -o "${enable_backend_prometheus_remote_write}" = "yes"])
  1201. AC_DEFINE_UNQUOTED([NETDATA_USER], ["${with_user}"], [use this user to drop privileged])
  1202. varlibdir="${localstatedir}/lib/netdata"
  1203. registrydir="${localstatedir}/lib/netdata/registry"
  1204. cachedir="${localstatedir}/cache/netdata"
  1205. chartsdir="${libexecdir}/netdata/charts.d"
  1206. nodedir="${libexecdir}/netdata/node.d"
  1207. pythondir="${libexecdir}/netdata/python.d"
  1208. configdir="${sysconfdir}/netdata"
  1209. libconfigdir="${libdir}/netdata/conf.d"
  1210. logdir="${localstatedir}/log/netdata"
  1211. pluginsdir="${libexecdir}/netdata/plugins.d"
  1212. AC_SUBST([build_target])
  1213. AC_SUBST([varlibdir])
  1214. AC_SUBST([registrydir])
  1215. AC_SUBST([cachedir])
  1216. AC_SUBST([chartsdir])
  1217. AC_SUBST([nodedir])
  1218. AC_SUBST([pythondir])
  1219. AC_SUBST([configdir])
  1220. AC_SUBST([libconfigdir])
  1221. AC_SUBST([logdir])
  1222. AC_SUBST([pluginsdir])
  1223. AC_SUBST([webdir])
  1224. CFLAGS="${CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} ${OPTIONAL_ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \
  1225. ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \
  1226. ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PUBSUB_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} \
  1227. ${OPTIONAL_MONGOC_CFLAGS} ${LWS_CFLAGS} ${OPTIONAL_JSONC_STATIC_CFLAGS} ${OPTIONAL_BPF_CFLAGS} ${OPTIONAL_JUDY_CFLAGS}"
  1228. CXXFLAGS="${CFLAGS} ${CXX11FLAG}"
  1229. CPPFLAGS="\
  1230. -DTARGET_OS=${build_target_id} \
  1231. -DVARLIB_DIR=\"\\\"${varlibdir}\\\"\" \
  1232. -DCACHE_DIR=\"\\\"${cachedir}\\\"\" \
  1233. -DCONFIG_DIR=\"\\\"${configdir}\\\"\" \
  1234. -DLIBCONFIG_DIR=\"\\\"${libconfigdir}\\\"\" \
  1235. -DLOG_DIR=\"\\\"${logdir}\\\"\" \
  1236. -DPLUGINS_DIR=\"\\\"${pluginsdir}\\\"\" \
  1237. -DRUN_DIR=\"\\\"${localstatedir}/run/netdata\\\"\" \
  1238. -DWEB_DIR=\"\\\"${webdir}\\\"\" \
  1239. "
  1240. AC_SUBST([OPTIONAL_MATH_CFLAGS])
  1241. AC_SUBST([OPTIONAL_MATH_LIBS])
  1242. AC_SUBST([OPTIONAL_UV_LIBS])
  1243. AC_SUBST([OPTIONAL_LZ4_LIBS])
  1244. AC_SUBST([OPTIONAL_JUDY_CFLAGS])
  1245. AC_SUBST([OPTIONAL_JUDY_LIBS])
  1246. AC_SUBST([OPTIONAL_SSL_LIBS])
  1247. AC_SUBST([OPTIONAL_JSONC_LIBS])
  1248. AC_SUBST([OPTIONAL_NFACCT_CFLAGS])
  1249. AC_SUBST([OPTIONAL_NFACCT_LIBS])
  1250. AC_SUBST([OPTIONAL_ZLIB_CFLAGS])
  1251. AC_SUBST([OPTIONAL_ZLIB_LIBS])
  1252. AC_SUBST([OPTIONAL_UUID_CFLAGS])
  1253. AC_SUBST([OPTIONAL_UUID_LIBS])
  1254. AC_SUBST([OPTIONAL_BPF_CFLAGS])
  1255. AC_SUBST([OPTIONAL_BPF_LIBS])
  1256. AC_SUBST([OPTIONAL_MQTT_LIBS])
  1257. AC_SUBST([OPTIONAL_LIBCAP_CFLAGS])
  1258. AC_SUBST([OPTIONAL_LIBCAP_LIBS])
  1259. AC_SUBST([OPTIONAL_IPMIMONITORING_CFLAGS])
  1260. AC_SUBST([OPTIONAL_IPMIMONITORING_LIBS])
  1261. AC_SUBST([OPTIONAL_CUPS_CFLAGS])
  1262. AC_SUBST([OPTIONAL_CUPS_LIBS])
  1263. AC_SUBST([OPTIONAL_XENSTAT_CFLAGS])
  1264. AC_SUBST([OPTIONAL_XENSTAT_LIBS])
  1265. AC_SUBST([OPTIONAL_KINESIS_CFLAGS])
  1266. AC_SUBST([OPTIONAL_KINESIS_LIBS])
  1267. AC_SUBST([OPTIONAL_PUBSUB_CFLAGS])
  1268. AC_SUBST([OPTIONAL_PUBSUB_LIBS])
  1269. AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS])
  1270. AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS])
  1271. AC_SUBST([OPTIONAL_MONGOC_CFLAGS])
  1272. AC_SUBST([OPTIONAL_MONGOC_LIBS])
  1273. AC_SUBST([OPTIONAL_LWS_LIBS])
  1274. # -----------------------------------------------------------------------------
  1275. # Check if cmocka is available - needed for unit testing
  1276. AC_ARG_ENABLE(
  1277. [unit-tests],
  1278. [AS_HELP_STRING([--disable-unit-tests],
  1279. [Disables building and running the unit tests suite])],
  1280. [],
  1281. [enable_unit_tests="yes"]
  1282. )
  1283. PKG_CHECK_MODULES(
  1284. [CMOCKA],
  1285. [cmocka],
  1286. [have_cmocka="yes"],
  1287. [AC_MSG_NOTICE([CMocka not found on the system. Unit tests disabled])]
  1288. )
  1289. AM_CONDITIONAL([ENABLE_UNITTESTS], [test "${enable_unit_tests}" = "yes" -a "${have_cmocka}" = "yes" ])
  1290. AC_SUBST([ENABLE_UNITTESTS])
  1291. TEST_CFLAGS="${CFLAGS} ${CMOCKA_CFLAGS}"
  1292. TEST_LIBS="${CMOCKA_LIBS}"
  1293. AC_SUBST([TEST_CFLAGS])
  1294. AC_SUBST([TEST_LIBS])
  1295. # -----------------------------------------------------------------------------
  1296. # save configure options for build info
  1297. AC_DEFINE_UNQUOTED(
  1298. [CONFIGURE_COMMAND],
  1299. ["$ac_configure_args"],
  1300. [options passed to configure script]
  1301. )
  1302. AC_CONFIG_FILES([
  1303. Makefile
  1304. netdata.spec
  1305. backends/graphite/Makefile
  1306. backends/json/Makefile
  1307. backends/Makefile
  1308. backends/opentsdb/Makefile
  1309. backends/prometheus/Makefile
  1310. backends/prometheus/remote_write/Makefile
  1311. backends/aws_kinesis/Makefile
  1312. backends/mongodb/Makefile
  1313. collectors/Makefile
  1314. collectors/apps.plugin/Makefile
  1315. collectors/cgroups.plugin/Makefile
  1316. collectors/charts.d.plugin/Makefile
  1317. collectors/checks.plugin/Makefile
  1318. collectors/diskspace.plugin/Makefile
  1319. collectors/fping.plugin/Makefile
  1320. collectors/ioping.plugin/Makefile
  1321. collectors/freebsd.plugin/Makefile
  1322. collectors/freeipmi.plugin/Makefile
  1323. collectors/cups.plugin/Makefile
  1324. collectors/idlejitter.plugin/Makefile
  1325. collectors/macos.plugin/Makefile
  1326. collectors/nfacct.plugin/Makefile
  1327. collectors/node.d.plugin/Makefile
  1328. collectors/plugins.d/Makefile
  1329. collectors/proc.plugin/Makefile
  1330. collectors/python.d.plugin/Makefile
  1331. collectors/slabinfo.plugin/Makefile
  1332. collectors/statsd.plugin/Makefile
  1333. collectors/ebpf.plugin/Makefile
  1334. collectors/tc.plugin/Makefile
  1335. collectors/xenstat.plugin/Makefile
  1336. collectors/perf.plugin/Makefile
  1337. daemon/Makefile
  1338. database/Makefile
  1339. database/engine/Makefile
  1340. database/engine/metadata_log/Makefile
  1341. diagrams/Makefile
  1342. exporting/Makefile
  1343. exporting/graphite/Makefile
  1344. exporting/json/Makefile
  1345. exporting/opentsdb/Makefile
  1346. exporting/prometheus/Makefile
  1347. exporting/prometheus/remote_write/Makefile
  1348. exporting/aws_kinesis/Makefile
  1349. exporting/pubsub/Makefile
  1350. exporting/mongodb/Makefile
  1351. exporting/tests/Makefile
  1352. health/Makefile
  1353. health/notifications/Makefile
  1354. libnetdata/Makefile
  1355. libnetdata/tests/Makefile
  1356. libnetdata/adaptive_resortable_list/Makefile
  1357. libnetdata/avl/Makefile
  1358. libnetdata/buffer/Makefile
  1359. libnetdata/clocks/Makefile
  1360. libnetdata/config/Makefile
  1361. libnetdata/dictionary/Makefile
  1362. libnetdata/ebpf/Makefile
  1363. libnetdata/eval/Makefile
  1364. libnetdata/locks/Makefile
  1365. libnetdata/log/Makefile
  1366. libnetdata/popen/Makefile
  1367. libnetdata/procfile/Makefile
  1368. libnetdata/simple_pattern/Makefile
  1369. libnetdata/socket/Makefile
  1370. libnetdata/statistical/Makefile
  1371. libnetdata/storage_number/Makefile
  1372. libnetdata/storage_number/tests/Makefile
  1373. libnetdata/threads/Makefile
  1374. libnetdata/url/Makefile
  1375. libnetdata/json/Makefile
  1376. libnetdata/health/Makefile
  1377. registry/Makefile
  1378. streaming/Makefile
  1379. system/Makefile
  1380. tests/Makefile
  1381. web/Makefile
  1382. web/api/Makefile
  1383. web/api/badges/Makefile
  1384. web/api/exporters/Makefile
  1385. web/api/exporters/shell/Makefile
  1386. web/api/exporters/prometheus/Makefile
  1387. web/api/formatters/Makefile
  1388. web/api/formatters/csv/Makefile
  1389. web/api/formatters/json/Makefile
  1390. web/api/formatters/ssv/Makefile
  1391. web/api/formatters/value/Makefile
  1392. web/api/queries/Makefile
  1393. web/api/queries/average/Makefile
  1394. web/api/queries/des/Makefile
  1395. web/api/queries/incremental_sum/Makefile
  1396. web/api/queries/max/Makefile
  1397. web/api/queries/median/Makefile
  1398. web/api/queries/min/Makefile
  1399. web/api/queries/ses/Makefile
  1400. web/api/queries/stddev/Makefile
  1401. web/api/queries/sum/Makefile
  1402. web/api/health/Makefile
  1403. web/gui/Makefile
  1404. web/server/Makefile
  1405. web/server/static/Makefile
  1406. claim/Makefile
  1407. aclk/legacy/Makefile
  1408. spawn/Makefile
  1409. parser/Makefile
  1410. ])
  1411. AC_OUTPUT
  1412. test "${with_math}" != "yes" && AC_MSG_WARN([You are building without math. math allows accurate calculations. It should be enabled.]) || :
  1413. test "${with_zlib}" != "yes" && AC_MSG_WARN([You are building without zlib. zlib allows netdata to transfer a lot less data with web clients. It should be enabled.]) || :