configure.ac 51 KB

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