configure.ac 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625
  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. diagrams/Makefile
  1346. exporting/Makefile
  1347. exporting/graphite/Makefile
  1348. exporting/json/Makefile
  1349. exporting/opentsdb/Makefile
  1350. exporting/prometheus/Makefile
  1351. exporting/prometheus/remote_write/Makefile
  1352. exporting/aws_kinesis/Makefile
  1353. exporting/pubsub/Makefile
  1354. exporting/mongodb/Makefile
  1355. exporting/tests/Makefile
  1356. health/Makefile
  1357. health/notifications/Makefile
  1358. libnetdata/Makefile
  1359. libnetdata/tests/Makefile
  1360. libnetdata/adaptive_resortable_list/Makefile
  1361. libnetdata/avl/Makefile
  1362. libnetdata/buffer/Makefile
  1363. libnetdata/clocks/Makefile
  1364. libnetdata/config/Makefile
  1365. libnetdata/dictionary/Makefile
  1366. libnetdata/ebpf/Makefile
  1367. libnetdata/eval/Makefile
  1368. libnetdata/locks/Makefile
  1369. libnetdata/log/Makefile
  1370. libnetdata/popen/Makefile
  1371. libnetdata/procfile/Makefile
  1372. libnetdata/simple_pattern/Makefile
  1373. libnetdata/socket/Makefile
  1374. libnetdata/statistical/Makefile
  1375. libnetdata/storage_number/Makefile
  1376. libnetdata/storage_number/tests/Makefile
  1377. libnetdata/threads/Makefile
  1378. libnetdata/url/Makefile
  1379. libnetdata/json/Makefile
  1380. libnetdata/health/Makefile
  1381. registry/Makefile
  1382. streaming/Makefile
  1383. system/Makefile
  1384. tests/Makefile
  1385. web/Makefile
  1386. web/api/Makefile
  1387. web/api/badges/Makefile
  1388. web/api/exporters/Makefile
  1389. web/api/exporters/shell/Makefile
  1390. web/api/exporters/prometheus/Makefile
  1391. web/api/formatters/Makefile
  1392. web/api/formatters/csv/Makefile
  1393. web/api/formatters/json/Makefile
  1394. web/api/formatters/ssv/Makefile
  1395. web/api/formatters/value/Makefile
  1396. web/api/queries/Makefile
  1397. web/api/queries/average/Makefile
  1398. web/api/queries/des/Makefile
  1399. web/api/queries/incremental_sum/Makefile
  1400. web/api/queries/max/Makefile
  1401. web/api/queries/median/Makefile
  1402. web/api/queries/min/Makefile
  1403. web/api/queries/ses/Makefile
  1404. web/api/queries/stddev/Makefile
  1405. web/api/queries/sum/Makefile
  1406. web/api/health/Makefile
  1407. web/gui/Makefile
  1408. web/server/Makefile
  1409. web/server/static/Makefile
  1410. claim/Makefile
  1411. aclk/Makefile
  1412. spawn/Makefile
  1413. parser/Makefile
  1414. ])
  1415. AC_OUTPUT
  1416. test "${with_math}" != "yes" && AC_MSG_WARN([You are building without math. math allows accurate calculations. It should be enabled.]) || :
  1417. 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.]) || :