configure.ac 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626
  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_LIBMNL], [1], [libmnl usability])
  779. AC_DEFINE([HAVE_LIBNETFILTER_ACCT], [1], [libnetfilter_acct usability])
  780. AC_DEFINE([HAVE_LINUX_NETFILTER_NFNETLINK_CONNTRACK_H], [1], [libnetfilter_nfnetlink_conntrack header usability])
  781. OPTIONAL_NFACCT_CFLAGS="${NFACCT_CFLAGS} ${LIBMNL_CFLAGS}"
  782. OPTIONAL_NFACCT_LIBS="${NFACCT_LIBS} ${LIBMNL_LIBS}"
  783. else
  784. enable_plugin_nfacct="no"
  785. fi
  786. AC_MSG_RESULT([${enable_plugin_nfacct}])
  787. AM_CONDITIONAL([ENABLE_PLUGIN_NFACCT], [test "${enable_plugin_nfacct}" = "yes"])
  788. # -----------------------------------------------------------------------------
  789. # xenstat.plugin - libxenstat
  790. PKG_CHECK_MODULES(
  791. [YAJL],
  792. [yajl],
  793. [AC_CHECK_LIB(
  794. [yajl],
  795. [yajl_tree_get],
  796. [have_libyajl=yes],
  797. [have_libyajl=no]
  798. )],
  799. [have_libyajl=no]
  800. )
  801. AC_CHECK_LIB(
  802. [xenstat],
  803. [xenstat_init],
  804. [AC_CHECK_HEADER(
  805. [xenstat.h],
  806. [have_libxenstat=yes],
  807. [have_libxenstat=no]
  808. )],
  809. [have_libxenstat=no],
  810. [-lyajl]
  811. )
  812. PKG_CHECK_MODULES(
  813. [XENLIGHT],
  814. [xenlight],
  815. [AC_CHECK_LIB(
  816. [xenlight],
  817. [libxl_domain_info],
  818. [AC_CHECK_HEADER(
  819. [libxl.h],
  820. [have_libxenlight=yes],
  821. [have_libxenlight=no]
  822. )],
  823. [have_libxenlight=no]
  824. )],
  825. [have_libxenlight=no]
  826. )
  827. test "${enable_plugin_xenstat}" = "yes" -a "${have_libxenstat}" != "yes" && \
  828. AC_MSG_ERROR([libxenstat required but not found. try installing 'xen-dom0-libs-devel'])
  829. test "${enable_plugin_xenstat}" = "yes" -a "${have_libxenlight}" != "yes" && \
  830. AC_MSG_ERROR([libxenlight required but not found. try installing 'xen-dom0-libs-devel'])
  831. test "${enable_plugin_xenstat}" = "yes" -a "${have_libyajl}" != "yes" && \
  832. AC_MSG_ERROR([libyajl required but not found. Try installing 'yajl-devel'])
  833. AC_MSG_CHECKING([if xenstat.plugin should be enabled])
  834. if test "${enable_plugin_xenstat}" != "no" -a "${have_libxenstat}" = "yes" -a "${have_libxenlight}" = "yes" -a "${have_libyajl}" = "yes"; then
  835. enable_plugin_xenstat="yes"
  836. AC_DEFINE([HAVE_LIBXENSTAT], [1], [libxenstat usability])
  837. AC_DEFINE([HAVE_LIBXENLIGHT], [1], [libxenlight usability])
  838. AC_DEFINE([HAVE_LIBYAJL], [1], [libyajl usability])
  839. OPTIONAL_XENSTAT_CFLAGS="${XENLIGHT_CFLAGS} ${YAJL_CFLAGS}"
  840. OPTIONAL_XENSTAT_LIBS="-lxenstat ${XENLIGHT_LIBS} ${YAJL_LIBS}"
  841. else
  842. enable_plugin_xenstat="no"
  843. fi
  844. AC_MSG_RESULT([${enable_plugin_xenstat}])
  845. AM_CONDITIONAL([ENABLE_PLUGIN_XENSTAT], [test "${enable_plugin_xenstat}" = "yes"])
  846. if test "${enable_plugin_xenstat}" == "yes"; then
  847. AC_MSG_CHECKING([for xenstat_vbd_error in -lxenstat])
  848. AC_TRY_LINK(
  849. [ #include <xenstat.h> ],
  850. [
  851. xenstat_vbd * vbd;
  852. int out = xenstat_vbd_error(vbd);
  853. ],
  854. [
  855. have_xenstat_vbd_error=yes
  856. AC_DEFINE([HAVE_XENSTAT_VBD_ERROR], [1], [xenstat_vbd_error usability])
  857. ],
  858. [ have_xenstat_vbd_error=no ]
  859. )
  860. AC_MSG_RESULT([${have_xenstat_vbd_error}])
  861. fi
  862. # -----------------------------------------------------------------------------
  863. # perf.plugin
  864. AC_CHECK_HEADER(
  865. [linux/perf_event.h],
  866. [AC_CHECK_DECL(
  867. [PERF_COUNT_HW_REF_CPU_CYCLES],
  868. [have_perf_event=yes],
  869. [have_perf_event=no],
  870. [#include <linux/perf_event.h>]
  871. )],
  872. [have_perf_event=no]
  873. )
  874. AC_MSG_CHECKING([if perf.plugin should be enabled])
  875. if test "${build_target}" == "linux" -a "${have_perf_event}" = "yes"; then
  876. AC_DEFINE([ENABLE_PERF_PLUGIN], [1], [perf.plugin])
  877. enable_plugin_perf="yes"
  878. else
  879. enable_plugin_perf="no"
  880. fi
  881. AC_MSG_RESULT([${enable_plugin_perf}])
  882. AM_CONDITIONAL([ENABLE_PLUGIN_PERF], [test "${enable_plugin_perf}" = "yes"])
  883. # -----------------------------------------------------------------------------
  884. # ebpf.plugin
  885. if test "${build_target}" = "linux" -a "${enable_ebpf}" != "no"; then
  886. PKG_CHECK_MODULES(
  887. [LIBELF],
  888. [libelf],
  889. [have_libelf=yes],
  890. [have_libelf=no]
  891. )
  892. AC_CHECK_TYPE(
  893. [struct bpf_prog_info],
  894. [have_bpf=yes],
  895. [have_bpf=no],
  896. [#include <linux/bpf.h>]
  897. )
  898. AC_CHECK_FILE(
  899. externaldeps/libbpf/libbpf.a,
  900. [have_libbpf=yes],
  901. [have_libbpf=no]
  902. )
  903. AC_MSG_CHECKING([if ebpf.plugin should be enabled])
  904. if test "${have_libelf}" = "yes" -a \
  905. "${have_bpf}" = "yes" -a \
  906. "${have_libbpf}" = "yes"; then
  907. OPTIONAL_BPF_CFLAGS="${LIBELF_CFLAGS} -I externaldeps/libbpf/include"
  908. OPTIONAL_BPF_LIBS="externaldeps/libbpf/libbpf.a ${LIBELF_LIBS}"
  909. AC_DEFINE([HAVE_LIBBPF], [1], [libbpf usability])
  910. enable_ebpf="yes"
  911. else
  912. enable_ebpf="no"
  913. fi
  914. else
  915. enable_ebpf="no"
  916. fi
  917. AC_MSG_RESULT([${enable_ebpf}])
  918. AM_CONDITIONAL([ENABLE_PLUGIN_EBPF], [test "${enable_ebpf}" = "yes"])
  919. # -----------------------------------------------------------------------------
  920. # slabinfo.plugin
  921. AC_MSG_CHECKING([if slabinfo.plugin should be enabled])
  922. if test "${build_target}" == "linux"; then
  923. AC_DEFINE([ENABLE_SLABINFO], [1], [slabinfo plugin])
  924. enable_plugin_slabinfo="yes"
  925. else
  926. enable_plugin_slabinfo="no"
  927. fi
  928. AC_MSG_RESULT([${enable_plugin_slabinfo}])
  929. AM_CONDITIONAL([ENABLE_PLUGIN_SLABINFO], [test "${enable_plugin_slabinfo}" = "yes"])
  930. # -----------------------------------------------------------------------------
  931. # AWS Kinesis backend - libaws-cpp-sdk-kinesis, libaws-cpp-sdk-core, libssl, libcrypto, libcurl
  932. PKG_CHECK_MODULES(
  933. [LIBCRYPTO],
  934. [libcrypto],
  935. [AC_CHECK_LIB(
  936. [crypto],
  937. [CRYPTO_new_ex_data],
  938. [have_libcrypto=yes],
  939. [have_libcrypto=no]
  940. )],
  941. [have_libcrypto=no]
  942. )
  943. PKG_CHECK_MODULES(
  944. [LIBSSL],
  945. [libssl],
  946. [AC_CHECK_LIB(
  947. [ssl],
  948. [SSL_connect],
  949. [have_libssl=yes],
  950. [have_libssl=no]
  951. )],
  952. [have_libssl=no]
  953. )
  954. PKG_CHECK_MODULES(
  955. [LIBCURL],
  956. [libcurl],
  957. [AC_CHECK_LIB(
  958. [curl],
  959. [curl_easy_init],
  960. [have_libcurl=yes],
  961. [have_libcurl=no]
  962. )],
  963. [have_libcurl=no]
  964. )
  965. PKG_CHECK_MODULES(
  966. [AWS_CPP_SDK_CORE],
  967. [aws-cpp-sdk-core],
  968. [AC_CHECK_LIB(
  969. [aws-cpp-sdk-core],
  970. [cJSON_free],
  971. [have_libaws_cpp_sdk_core=yes],
  972. [have_libaws_cpp_sdk_core=no]
  973. )],
  974. [have_libaws_cpp_sdk_core=no]
  975. )
  976. PKG_CHECK_MODULES(
  977. [AWS_CPP_SDK_KINESIS],
  978. [aws-cpp-sdk-kinesis],
  979. [have_libaws_cpp_sdk_kinesis=yes],
  980. [have_libaws_cpp_sdk_kinesis=no]
  981. )
  982. AC_CHECK_LIB(
  983. [aws-checksums],
  984. [aws_checksums_crc32],
  985. [have_libaws_checksums=yes],
  986. [have_libaws_checksums=no]
  987. )
  988. AC_CHECK_LIB(
  989. [aws-c-common],
  990. [aws_default_allocator],
  991. [have_libaws_c_common=yes],
  992. [have_libaws_c_common=no]
  993. )
  994. AC_CHECK_LIB(
  995. [aws-c-event-stream],
  996. [aws_event_stream_library_init],
  997. [have_libaws_c_event_stream=yes],
  998. [have_libaws_c_event_stream=no]
  999. )
  1000. test "${enable_backend_kinesis}" = "yes" -a "${have_libaws_cpp_sdk_kinesis}" != "yes" && \
  1001. AC_MSG_ERROR([libaws-cpp-sdk-kinesis required but not found. try installing AWS C++ SDK])
  1002. test "${enable_backend_kinesis}" = "yes" -a "${have_libaws_cpp_sdk_core}" != "yes" && \
  1003. AC_MSG_ERROR([libaws-cpp-sdk-core required but not found. try installing AWS C++ SDK])
  1004. test "${enable_backend_kinesis}" = "yes" -a "${have_libcurl}" != "yes" && \
  1005. AC_MSG_ERROR([libcurl required but not found])
  1006. test "${enable_backend_kinesis}" = "yes" -a "${have_libssl}" != "yes" && \
  1007. AC_MSG_ERROR([libssl required but not found])
  1008. test "${enable_backend_kinesis}" = "yes" -a "${have_libcrypto}" != "yes" && \
  1009. AC_MSG_ERROR([libcrypto required but not found])
  1010. test "${enable_backend_kinesis}" = "yes" -a "${have_libaws_checksums}" != "yes" \
  1011. -a "${have_libaws_c_common}" != "yes" \
  1012. -a "${have_libaws_c_event_stream}" != "yes" && \
  1013. AC_MSG_ERROR([AWS SKD third party dependencies required but not found])
  1014. AC_MSG_CHECKING([if kinesis backend should be enabled])
  1015. if test "${enable_backend_kinesis}" != "no" -a "${have_libaws_cpp_sdk_kinesis}" = "yes" \
  1016. -a "${have_libaws_cpp_sdk_core}" = "yes" \
  1017. -a "${have_libaws_checksums}" = "yes" \
  1018. -a "${have_libaws_c_common}" = "yes" \
  1019. -a "${have_libaws_c_event_stream}" = "yes" \
  1020. -a "${have_libcurl}" = "yes" \
  1021. -a "${have_libssl}" = "yes" \
  1022. -a "${have_libcrypto}" = "yes"; then
  1023. enable_backend_kinesis="yes"
  1024. AC_DEFINE([HAVE_KINESIS], [1], [libaws-cpp-sdk-kinesis usability])
  1025. OPTIONAL_KINESIS_CFLAGS="${LIBCRYPTO_CFLAGS} ${LIBSSL_CFLAGS} ${LIBCURL_CFLAGS}"
  1026. CXX11FLAG="${AWS_CPP_SDK_KINESIS_CFLAGS} ${AWS_CPP_SDK_CORE_CFLAGS}"
  1027. OPTIONAL_KINESIS_LIBS="${AWS_CPP_SDK_KINESIS_LIBS} ${AWS_CPP_SDK_CORE_LIBS} \
  1028. ${LIBCRYPTO_LIBS} ${LIBSSL_LIBS} ${LIBCURL_LIBS}"
  1029. else
  1030. enable_backend_kinesis="no"
  1031. fi
  1032. AC_MSG_RESULT([${enable_backend_kinesis}])
  1033. AM_CONDITIONAL([ENABLE_BACKEND_KINESIS], [test "${enable_backend_kinesis}" = "yes"])
  1034. # -----------------------------------------------------------------------------
  1035. # Pub/Sub exporting connector - googleapis
  1036. PKG_CHECK_MODULES(
  1037. [GRPC],
  1038. [grpc],
  1039. [have_libgrpc=yes],
  1040. [have_libgrpc=no]
  1041. )
  1042. PKG_CHECK_MODULES(
  1043. [PUBSUB],
  1044. [googleapis_cpp_pubsub_protos],
  1045. [have_pubsub_protos=yes],
  1046. [have_pubsub_protos=no]
  1047. )
  1048. AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
  1049. AS_IF(
  1050. [test x"${CXX_BINARY}" == x"no"],
  1051. [have_CXX_compiler=no],
  1052. [have_CXX_compiler=yes]
  1053. )
  1054. test "${enable_pubsub}" = "yes" -a "${have_grpc}" != "yes" && \
  1055. AC_MSG_ERROR([libgrpc required but not found. try installing grpc])
  1056. test "${enable_pubsub}" = "yes" -a "${have_pubsub_protos}" != "yes" && \
  1057. AC_MSG_ERROR([libgoogleapis_cpp_pubsub_protos required but not found. try installing googleapis])
  1058. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler}" != "yes" && \
  1059. AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
  1060. AC_MSG_CHECKING([if pubsub exporting connector should be enabled])
  1061. if test "${enable_exporting_pubsub}" != "no" -a "${have_pubsub_protos}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
  1062. enable_exporting_pubsub="yes"
  1063. AC_DEFINE([ENABLE_EXPORTING_PUBSUB], [1], [Pub/Sub API usability])
  1064. OPTIONAL_PUBSUB_CFLAGS="${GRPC_CFLAGS} ${PUBSUB_CFLAGS}"
  1065. CXX11FLAG="-std=c++11"
  1066. OPTIONAL_PUBSUB_LIBS="${GRPC_LIBS} ${PUBSUB_LIBS}"
  1067. else
  1068. enable_pubsub="no"
  1069. fi
  1070. AC_MSG_RESULT([${enable_exporting_pubsub}])
  1071. AM_CONDITIONAL([ENABLE_EXPORTING_PUBSUB], [test "${enable_exporting_pubsub}" = "yes"])
  1072. # -----------------------------------------------------------------------------
  1073. # Prometheus remote write backend - libprotobuf, libsnappy, protoc
  1074. PKG_CHECK_MODULES(
  1075. [PROTOBUF],
  1076. [protobuf >= 3],
  1077. [have_libprotobuf=yes],
  1078. [have_libprotobuf=no]
  1079. )
  1080. AC_MSG_CHECKING([for snappy::RawCompress in -lsnappy])
  1081. AC_LANG_SAVE
  1082. AC_LANG_CPLUSPLUS
  1083. save_LIBS="${LIBS}"
  1084. LIBS="-lsnappy"
  1085. save_CXXFLAGS="${CXXFLAGS}"
  1086. CXXFLAGS="${CXXFLAGS} -std=c++11"
  1087. AC_TRY_LINK(
  1088. [
  1089. #include <stdlib.h>
  1090. #include <snappy.h>
  1091. ],
  1092. [
  1093. const char *input = "test";
  1094. size_t compressed_length;
  1095. char *buffer = (char *)malloc(5 * sizeof(char));
  1096. snappy::RawCompress(input, 4, buffer, &compressed_length);
  1097. free(buffer);
  1098. ],
  1099. [
  1100. have_libsnappy=yes
  1101. SNAPPY_CFLAGS=""
  1102. SNAPPY_LIBS="-lsnappy"
  1103. ],
  1104. [have_libsnappy=no]
  1105. )
  1106. LIBS="${save_LIBS}"
  1107. CXXFLAGS="${save_CXXFLAGS}"
  1108. AC_LANG_RESTORE
  1109. AC_MSG_RESULT([${have_libsnappy}])
  1110. AC_PATH_PROG([PROTOC], [protoc], [no])
  1111. AS_IF(
  1112. [test x"${PROTOC}" == x"no"],
  1113. [have_protoc=no],
  1114. [have_protoc=yes]
  1115. )
  1116. AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
  1117. AS_IF(
  1118. [test x"${CXX_BINARY}" == x"no"],
  1119. [have_CXX_compiler=no],
  1120. [have_CXX_compiler=yes]
  1121. )
  1122. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_libprotobuf}" != "yes" && \
  1123. AC_MSG_ERROR([libprotobuf required but not found. try installing protobuf])
  1124. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_libsnappy}" != "yes" && \
  1125. AC_MSG_ERROR([libsnappy required but not found. try installing snappy])
  1126. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_protoc}" != "yes" && \
  1127. AC_MSG_ERROR([protoc compiler required but not found. try installing protobuf])
  1128. test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler}" != "yes" && \
  1129. AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
  1130. AC_MSG_CHECKING([if prometheus remote write backend should be enabled])
  1131. if test "${enable_backend_prometheus_remote_write}" != "no" -a "${have_libprotobuf}" = "yes" -a "${have_libsnappy}" = "yes" \
  1132. -a "${have_protoc}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
  1133. enable_backend_prometheus_remote_write="yes"
  1134. AC_DEFINE([ENABLE_PROMETHEUS_REMOTE_WRITE], [1], [Prometheus remote write API usability])
  1135. OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS="${PROTOBUF_CFLAGS} ${SNAPPY_CFLAGS} -Iexporting/prometheus/remote_write"
  1136. CXX11FLAG="-std=c++11"
  1137. OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS="${PROTOBUF_LIBS} ${SNAPPY_LIBS}"
  1138. else
  1139. enable_backend_prometheus_remote_write="no"
  1140. fi
  1141. AC_MSG_RESULT([${enable_backend_prometheus_remote_write}])
  1142. AM_CONDITIONAL([ENABLE_BACKEND_PROMETHEUS_REMOTE_WRITE], [test "${enable_backend_prometheus_remote_write}" = "yes"])
  1143. # -----------------------------------------------------------------------------
  1144. # MongoDB backend - libmongoc
  1145. PKG_CHECK_MODULES(
  1146. [LIBMONGOC],
  1147. [libmongoc-1.0 >= 1.7],
  1148. [have_libmongoc=yes],
  1149. [have_libmongoc=no]
  1150. )
  1151. test "${enable_backend_mongodb}" = "yes" -a "${have_libmongoc}" != "yes" && \
  1152. AC_MSG_ERROR([libmongoc required but not found. Try installing `mongoc`.])
  1153. AC_MSG_CHECKING([if mongodb backend should be enabled])
  1154. if test "${enable_backend_mongodb}" != "no" -a "${have_libmongoc}" = "yes"; then
  1155. enable_backend_mongodb="yes"
  1156. AC_DEFINE([HAVE_MONGOC], [1], [libmongoc usability])
  1157. OPTIONAL_MONGOC_CFLAGS="${LIBMONGOC_CFLAGS}"
  1158. OPTIONAL_MONGOC_LIBS="${LIBMONGOC_LIBS}"
  1159. else
  1160. enable_backend_mongodb="no"
  1161. fi
  1162. AC_MSG_RESULT([${enable_backend_mongodb}])
  1163. AM_CONDITIONAL([ENABLE_BACKEND_MONGODB], [test "${enable_backend_mongodb}" = "yes"])
  1164. # -----------------------------------------------------------------------------
  1165. # check for setns() - cgroup-network
  1166. AC_CHECK_FUNC([setns])
  1167. AC_MSG_CHECKING([if cgroup-network can be enabled])
  1168. if test "$ac_cv_func_setns" = "yes" ; then
  1169. have_setns="yes"
  1170. AC_DEFINE([HAVE_SETNS], [1], [Define 1 if you have setns() function])
  1171. else
  1172. have_setns="no"
  1173. fi
  1174. AC_MSG_RESULT([${have_setns}])
  1175. AM_CONDITIONAL([ENABLE_PLUGIN_CGROUP_NETWORK], [test "${have_setns}" = "yes"])
  1176. # -----------------------------------------------------------------------------
  1177. # Link-Time-Optimization
  1178. if test "${enable_lto}" != "no"; then
  1179. opt="-flto"
  1180. AX_CHECK_COMPILE_FLAG(${opt}, [have_lto=yes], [have_lto=no])
  1181. fi
  1182. if test "${have_lto}" = "yes"; then
  1183. oCFLAGS="${CFLAGS}"
  1184. CFLAGS="${CFLAGS} -flto"
  1185. ac_cv_c_lto_cross_compile="${enable_lto}"
  1186. test "${ac_cv_c_lto_cross_compile}" != "yes" && ac_cv_c_lto_cross_compile="no"
  1187. AC_C_LTO
  1188. CFLAGS="${oCFLAGS}"
  1189. test "${ac_cv_c_lto}" != "yes" && have_lto="no"
  1190. fi
  1191. test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
  1192. AC_MSG_ERROR([LTO is required but is not available.])
  1193. AC_MSG_CHECKING([if LTO should be enabled])
  1194. if test "${enable_lto}" != "no" -a "${have_lto}" = "yes"; then
  1195. enable_lto="yes"
  1196. CFLAGS="${CFLAGS} -flto"
  1197. else
  1198. enable_lto="no"
  1199. fi
  1200. AC_MSG_RESULT([${enable_lto}])
  1201. # -----------------------------------------------------------------------------
  1202. AM_CONDITIONAL([ENABLE_CXX_LINKER], [test "${enable_backend_kinesis}" = "yes" \
  1203. -o "${enable_exporting_pubsub}" = "yes" \
  1204. -o "${enable_backend_prometheus_remote_write}" = "yes"])
  1205. AC_DEFINE_UNQUOTED([NETDATA_USER], ["${with_user}"], [use this user to drop privileged])
  1206. varlibdir="${localstatedir}/lib/netdata"
  1207. registrydir="${localstatedir}/lib/netdata/registry"
  1208. cachedir="${localstatedir}/cache/netdata"
  1209. chartsdir="${libexecdir}/netdata/charts.d"
  1210. nodedir="${libexecdir}/netdata/node.d"
  1211. pythondir="${libexecdir}/netdata/python.d"
  1212. configdir="${sysconfdir}/netdata"
  1213. libconfigdir="${libdir}/netdata/conf.d"
  1214. logdir="${localstatedir}/log/netdata"
  1215. pluginsdir="${libexecdir}/netdata/plugins.d"
  1216. AC_SUBST([build_target])
  1217. AC_SUBST([varlibdir])
  1218. AC_SUBST([registrydir])
  1219. AC_SUBST([cachedir])
  1220. AC_SUBST([chartsdir])
  1221. AC_SUBST([nodedir])
  1222. AC_SUBST([pythondir])
  1223. AC_SUBST([configdir])
  1224. AC_SUBST([libconfigdir])
  1225. AC_SUBST([logdir])
  1226. AC_SUBST([pluginsdir])
  1227. AC_SUBST([webdir])
  1228. CFLAGS="${CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} ${OPTIONAL_ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \
  1229. ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \
  1230. ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PUBSUB_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} \
  1231. ${OPTIONAL_MONGOC_CFLAGS} ${LWS_CFLAGS} ${OPTIONAL_JSONC_STATIC_CFLAGS} ${OPTIONAL_BPF_CFLAGS} ${OPTIONAL_JUDY_CFLAGS}"
  1232. CXXFLAGS="${CFLAGS} ${CXX11FLAG}"
  1233. CPPFLAGS="\
  1234. -DTARGET_OS=${build_target_id} \
  1235. -DVARLIB_DIR=\"\\\"${varlibdir}\\\"\" \
  1236. -DCACHE_DIR=\"\\\"${cachedir}\\\"\" \
  1237. -DCONFIG_DIR=\"\\\"${configdir}\\\"\" \
  1238. -DLIBCONFIG_DIR=\"\\\"${libconfigdir}\\\"\" \
  1239. -DLOG_DIR=\"\\\"${logdir}\\\"\" \
  1240. -DPLUGINS_DIR=\"\\\"${pluginsdir}\\\"\" \
  1241. -DRUN_DIR=\"\\\"${localstatedir}/run/netdata\\\"\" \
  1242. -DWEB_DIR=\"\\\"${webdir}\\\"\" \
  1243. "
  1244. AC_SUBST([OPTIONAL_MATH_CFLAGS])
  1245. AC_SUBST([OPTIONAL_MATH_LIBS])
  1246. AC_SUBST([OPTIONAL_UV_LIBS])
  1247. AC_SUBST([OPTIONAL_LZ4_LIBS])
  1248. AC_SUBST([OPTIONAL_JUDY_CFLAGS])
  1249. AC_SUBST([OPTIONAL_JUDY_LIBS])
  1250. AC_SUBST([OPTIONAL_SSL_LIBS])
  1251. AC_SUBST([OPTIONAL_JSONC_LIBS])
  1252. AC_SUBST([OPTIONAL_NFACCT_CFLAGS])
  1253. AC_SUBST([OPTIONAL_NFACCT_LIBS])
  1254. AC_SUBST([OPTIONAL_ZLIB_CFLAGS])
  1255. AC_SUBST([OPTIONAL_ZLIB_LIBS])
  1256. AC_SUBST([OPTIONAL_UUID_CFLAGS])
  1257. AC_SUBST([OPTIONAL_UUID_LIBS])
  1258. AC_SUBST([OPTIONAL_BPF_CFLAGS])
  1259. AC_SUBST([OPTIONAL_BPF_LIBS])
  1260. AC_SUBST([OPTIONAL_MQTT_LIBS])
  1261. AC_SUBST([OPTIONAL_LIBCAP_CFLAGS])
  1262. AC_SUBST([OPTIONAL_LIBCAP_LIBS])
  1263. AC_SUBST([OPTIONAL_IPMIMONITORING_CFLAGS])
  1264. AC_SUBST([OPTIONAL_IPMIMONITORING_LIBS])
  1265. AC_SUBST([OPTIONAL_CUPS_CFLAGS])
  1266. AC_SUBST([OPTIONAL_CUPS_LIBS])
  1267. AC_SUBST([OPTIONAL_XENSTAT_CFLAGS])
  1268. AC_SUBST([OPTIONAL_XENSTAT_LIBS])
  1269. AC_SUBST([OPTIONAL_KINESIS_CFLAGS])
  1270. AC_SUBST([OPTIONAL_KINESIS_LIBS])
  1271. AC_SUBST([OPTIONAL_PUBSUB_CFLAGS])
  1272. AC_SUBST([OPTIONAL_PUBSUB_LIBS])
  1273. AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS])
  1274. AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS])
  1275. AC_SUBST([OPTIONAL_MONGOC_CFLAGS])
  1276. AC_SUBST([OPTIONAL_MONGOC_LIBS])
  1277. AC_SUBST([OPTIONAL_LWS_LIBS])
  1278. # -----------------------------------------------------------------------------
  1279. # Check if cmocka is available - needed for unit testing
  1280. AC_ARG_ENABLE(
  1281. [unit-tests],
  1282. [AS_HELP_STRING([--disable-unit-tests],
  1283. [Disables building and running the unit tests suite])],
  1284. [],
  1285. [enable_unit_tests="yes"]
  1286. )
  1287. PKG_CHECK_MODULES(
  1288. [CMOCKA],
  1289. [cmocka],
  1290. [have_cmocka="yes"],
  1291. [AC_MSG_NOTICE([CMocka not found on the system. Unit tests disabled])]
  1292. )
  1293. AM_CONDITIONAL([ENABLE_UNITTESTS], [test "${enable_unit_tests}" = "yes" -a "${have_cmocka}" = "yes" ])
  1294. AC_SUBST([ENABLE_UNITTESTS])
  1295. TEST_CFLAGS="${CFLAGS} ${CMOCKA_CFLAGS}"
  1296. TEST_LIBS="${CMOCKA_LIBS}"
  1297. AC_SUBST([TEST_CFLAGS])
  1298. AC_SUBST([TEST_LIBS])
  1299. # -----------------------------------------------------------------------------
  1300. # save configure options for build info
  1301. AC_DEFINE_UNQUOTED(
  1302. [CONFIGURE_COMMAND],
  1303. ["$ac_configure_args"],
  1304. [options passed to configure script]
  1305. )
  1306. AC_CONFIG_FILES([
  1307. Makefile
  1308. netdata.spec
  1309. backends/graphite/Makefile
  1310. backends/json/Makefile
  1311. backends/Makefile
  1312. backends/opentsdb/Makefile
  1313. backends/prometheus/Makefile
  1314. backends/prometheus/remote_write/Makefile
  1315. backends/aws_kinesis/Makefile
  1316. backends/mongodb/Makefile
  1317. collectors/Makefile
  1318. collectors/apps.plugin/Makefile
  1319. collectors/cgroups.plugin/Makefile
  1320. collectors/charts.d.plugin/Makefile
  1321. collectors/checks.plugin/Makefile
  1322. collectors/diskspace.plugin/Makefile
  1323. collectors/fping.plugin/Makefile
  1324. collectors/ioping.plugin/Makefile
  1325. collectors/freebsd.plugin/Makefile
  1326. collectors/freeipmi.plugin/Makefile
  1327. collectors/cups.plugin/Makefile
  1328. collectors/idlejitter.plugin/Makefile
  1329. collectors/macos.plugin/Makefile
  1330. collectors/nfacct.plugin/Makefile
  1331. collectors/node.d.plugin/Makefile
  1332. collectors/plugins.d/Makefile
  1333. collectors/proc.plugin/Makefile
  1334. collectors/python.d.plugin/Makefile
  1335. collectors/slabinfo.plugin/Makefile
  1336. collectors/statsd.plugin/Makefile
  1337. collectors/ebpf.plugin/Makefile
  1338. collectors/tc.plugin/Makefile
  1339. collectors/xenstat.plugin/Makefile
  1340. collectors/perf.plugin/Makefile
  1341. daemon/Makefile
  1342. database/Makefile
  1343. database/engine/Makefile
  1344. database/engine/metadata_log/Makefile
  1345. database/engine/global_uuid_map/Makefile
  1346. diagrams/Makefile
  1347. exporting/Makefile
  1348. exporting/graphite/Makefile
  1349. exporting/json/Makefile
  1350. exporting/opentsdb/Makefile
  1351. exporting/prometheus/Makefile
  1352. exporting/prometheus/remote_write/Makefile
  1353. exporting/aws_kinesis/Makefile
  1354. exporting/pubsub/Makefile
  1355. exporting/mongodb/Makefile
  1356. exporting/tests/Makefile
  1357. health/Makefile
  1358. health/notifications/Makefile
  1359. libnetdata/Makefile
  1360. libnetdata/tests/Makefile
  1361. libnetdata/adaptive_resortable_list/Makefile
  1362. libnetdata/avl/Makefile
  1363. libnetdata/buffer/Makefile
  1364. libnetdata/clocks/Makefile
  1365. libnetdata/config/Makefile
  1366. libnetdata/dictionary/Makefile
  1367. libnetdata/ebpf/Makefile
  1368. libnetdata/eval/Makefile
  1369. libnetdata/locks/Makefile
  1370. libnetdata/log/Makefile
  1371. libnetdata/popen/Makefile
  1372. libnetdata/procfile/Makefile
  1373. libnetdata/simple_pattern/Makefile
  1374. libnetdata/socket/Makefile
  1375. libnetdata/statistical/Makefile
  1376. libnetdata/storage_number/Makefile
  1377. libnetdata/storage_number/tests/Makefile
  1378. libnetdata/threads/Makefile
  1379. libnetdata/url/Makefile
  1380. libnetdata/json/Makefile
  1381. libnetdata/health/Makefile
  1382. registry/Makefile
  1383. streaming/Makefile
  1384. system/Makefile
  1385. tests/Makefile
  1386. web/Makefile
  1387. web/api/Makefile
  1388. web/api/badges/Makefile
  1389. web/api/exporters/Makefile
  1390. web/api/exporters/shell/Makefile
  1391. web/api/exporters/prometheus/Makefile
  1392. web/api/formatters/Makefile
  1393. web/api/formatters/csv/Makefile
  1394. web/api/formatters/json/Makefile
  1395. web/api/formatters/ssv/Makefile
  1396. web/api/formatters/value/Makefile
  1397. web/api/queries/Makefile
  1398. web/api/queries/average/Makefile
  1399. web/api/queries/des/Makefile
  1400. web/api/queries/incremental_sum/Makefile
  1401. web/api/queries/max/Makefile
  1402. web/api/queries/median/Makefile
  1403. web/api/queries/min/Makefile
  1404. web/api/queries/ses/Makefile
  1405. web/api/queries/stddev/Makefile
  1406. web/api/queries/sum/Makefile
  1407. web/api/health/Makefile
  1408. web/gui/Makefile
  1409. web/server/Makefile
  1410. web/server/static/Makefile
  1411. claim/Makefile
  1412. aclk/Makefile
  1413. spawn/Makefile
  1414. parser/Makefile
  1415. ])
  1416. AC_OUTPUT
  1417. test "${with_math}" != "yes" && AC_MSG_WARN([You are building without math. math allows accurate calculations. It should be enabled.]) || :
  1418. 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.]) || :