configure.ac 54 KB

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