configure.ac 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071
  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. AC_LANG_PUSH([C])
  40. AX_COMPILER_VENDOR
  41. AC_LANG_POP([C])
  42. if test "$ax_cv_c_compiler_vendor" = "clang"; then
  43. AC_CHECK_PROG([AR], [llvm-ar], [llvm-ar], [ar])
  44. AC_CHECK_PROG([RANLIB], [llvm-ranlib], [llvm-ranlib], [ranlib])
  45. else
  46. AC_CHECK_TOOL([RANLIB], [ranlib])
  47. AC_CHECK_TOOL([AR], [ar])
  48. fi
  49. # -----------------------------------------------------------------------------
  50. # configurable options
  51. AC_ARG_ENABLE(
  52. [plugin-nfacct],
  53. [AS_HELP_STRING([--enable-plugin-nfacct], [enable nfacct plugin @<:@default autodetect@:>@])],
  54. ,
  55. [enable_plugin_nfacct="detect"]
  56. )
  57. AC_ARG_ENABLE(
  58. [plugin-freeipmi],
  59. [AS_HELP_STRING([--enable-plugin-freeipmi], [enable freeipmi plugin @<:@default autodetect@:>@])],
  60. ,
  61. [enable_plugin_freeipmi="detect"]
  62. )
  63. AC_ARG_ENABLE(
  64. [plugin-systemd-journal],
  65. [AS_HELP_STRING([--enable-plugin-systemd-journal], [enable systemd-journal plugin @<:@default autodetect@:>@])],
  66. ,
  67. [enable_plugin_systemd_journal="detect"]
  68. )
  69. AC_ARG_ENABLE(
  70. [plugin-cups],
  71. [AS_HELP_STRING([--enable-plugin-cups], [enable cups plugin @<:@default autodetect@:>@])],
  72. ,
  73. [enable_plugin_cups="detect"]
  74. )
  75. AC_ARG_ENABLE(
  76. [plugin-xenstat],
  77. [AS_HELP_STRING([--enable-plugin-xenstat], [enable xenstat plugin @<:@default autodetect@:>@])],
  78. ,
  79. [enable_plugin_xenstat="detect"]
  80. )
  81. AC_ARG_ENABLE(
  82. [exporting-kinesis],
  83. [AS_HELP_STRING([--enable-exporting-kinesis], [enable kinesis exporting connector @<:@default autodetect@:>@])],
  84. ,
  85. [enable_exporting_kinesis="detect"]
  86. )
  87. AC_ARG_ENABLE(
  88. [exporting-pubsub],
  89. [AS_HELP_STRING([--enable-exporting-pubsub], [enable pubsub exporting connector @<:@default autodetect@:>@])],
  90. ,
  91. [enable_exporting_pubsub="detect"]
  92. )
  93. AC_ARG_ENABLE(
  94. [exporting-prometheus-remote-write],
  95. [AS_HELP_STRING([--enable-exporting-prometheus-remote-write], [enable prometheus remote write exporting connector @<:@default autodetect@:>@])],
  96. ,
  97. [enable_exporting_prometheus_remote_write="detect"]
  98. )
  99. AC_ARG_ENABLE(
  100. [exporting-mongodb],
  101. [AS_HELP_STRING([--enable-exporting-mongodb], [enable mongodb exporting @<:@default autodetect@:>@])],
  102. ,
  103. [enable_exporting_mongodb="detect"]
  104. )
  105. AC_ARG_ENABLE(
  106. [pedantic],
  107. [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings @<:@default disabled@:>@])],
  108. ,
  109. [enable_pedantic="no"]
  110. )
  111. AC_ARG_ENABLE(
  112. [accept4],
  113. [AS_HELP_STRING([--disable-accept4], [System does not have accept4 @<:@default autodetect@:>@])],
  114. ,
  115. [enable_accept4="detect"]
  116. )
  117. AC_ARG_WITH(
  118. [webdir],
  119. [AS_HELP_STRING([--with-webdir], [location of webdir @<:@PKGDATADIR/web@:>@])],
  120. [webdir="${withval}"],
  121. [webdir="\$(pkgdatadir)/web"]
  122. )
  123. AC_ARG_WITH(
  124. [libcap],
  125. [AS_HELP_STRING([--with-libcap], [build with libcap @<:@default autodetect@:>@])],
  126. ,
  127. [with_libcap="detect"]
  128. )
  129. AC_ARG_WITH(
  130. [math],
  131. [AS_HELP_STRING([--without-math], [build without math @<:@default enabled@:>@])],
  132. ,
  133. [with_math="yes"]
  134. )
  135. AC_ARG_WITH(
  136. [user],
  137. [AS_HELP_STRING([--with-user], [use this user to drop privilege @<:@default nobody@:>@])],
  138. ,
  139. [with_user="nobody"]
  140. )
  141. AC_ARG_ENABLE(
  142. [x86-sse],
  143. [AS_HELP_STRING([--disable-x86-sse], [SSE/SS2 optimizations on x86 @<:@default enabled@:>@])],
  144. ,
  145. [enable_x86_sse="yes"]
  146. )
  147. AC_ARG_ENABLE(
  148. [lto],
  149. [AS_HELP_STRING([--enable-lto], [Link Time Optimizations @<:@default disabled@:>@])],
  150. ,
  151. [enable_lto="no"]
  152. )
  153. AC_ARG_ENABLE(
  154. [openssl],
  155. [AS_HELP_STRING([--enable-openssl], [Enable OpenSSL support @<:@default autodetect@:>@])],
  156. ,
  157. [enable_openssl="detect"]
  158. )
  159. AC_ARG_ENABLE(
  160. [lz4],
  161. [AS_HELP_STRING([--enable-lz4], [Enable LZ4 support @<:@default autodetect@:>@])],
  162. ,
  163. [enable_lz4="detect"]
  164. )
  165. AC_ARG_ENABLE(
  166. [dbengine],
  167. [AS_HELP_STRING([--disable-dbengine], [disable netdata dbengine @<:@default autodetect@:>@])],
  168. ,
  169. [enable_dbengine="detect"]
  170. )
  171. AC_ARG_ENABLE(
  172. [jsonc],
  173. [AS_HELP_STRING([--enable-jsonc], [Enable JSON-C support @<:@default autodetect@:>@])],
  174. ,
  175. [enable_jsonc="detect"]
  176. )
  177. AC_ARG_ENABLE(
  178. [ebpf],
  179. [AS_HELP_STRING([--disable-ebpf], [Disable eBPF support @<:@default autodetect@:>@])],
  180. ,
  181. [enable_ebpf="detect"]
  182. )
  183. AC_ARG_WITH(
  184. [bundled-lws],
  185. [AS_HELP_STRING([--with-bundled-lws], [Use the bundled version of libwebsockets library @<:@default use system library@:>@])],
  186. [with_bundled_lws="yes"], [with_bundled_lws="no"]
  187. )
  188. AC_ARG_WITH(
  189. [bundled-protobuf],
  190. [AS_HELP_STRING([--with-bundled-protobuf],
  191. [Uses the bundled version of Google Protocol Buffers @<:@default bundled if present@:>@])],
  192. [with_bundled_protobuf="$withval"],
  193. [with_bundled_protobuf="detect"]
  194. )
  195. AC_ARG_ENABLE(
  196. [ml],
  197. [AS_HELP_STRING([--enable-ml], [Enable anomaly detection @<:@default autodetect@:>@])],
  198. ,
  199. [enable_ml="detect"]
  200. )
  201. AC_ARG_ENABLE(
  202. [aclk_ssl_debug],
  203. [AS_HELP_STRING([--enable-aclk-ssl-debug], [Enables possibility for SSL key logging @<:@default no@:>@])],
  204. [aclk_ssl_debug="yes"],
  205. [aclk_ssl_debug="no"]
  206. )
  207. AC_ARG_ENABLE(
  208. [h2o],
  209. [AS_HELP_STRING([--disable-h2o], [Disable H2O webserver @<:@default autodetect@:>@])],
  210. ,
  211. [enable_h2o="detect"]
  212. )
  213. # -----------------------------------------------------------------------------
  214. # Enforce building with C99, bail early if we can't.
  215. test "${ac_cv_prog_cc_c99}" = "no" && AC_MSG_ERROR([Netdata requires a compiler that supports C99 to build])
  216. # -----------------------------------------------------------------------------
  217. # Check if cloud is enabled and if the functionality is available
  218. AC_ARG_ENABLE(
  219. [cloud],
  220. [AS_HELP_STRING([--disable-cloud],
  221. [Disables all cloud functionality])],
  222. [ enable_cloud="$enableval" ],
  223. [ enable_cloud="detect" ]
  224. )
  225. if test "${enable_cloud}" = "no"; then
  226. AC_DEFINE([DISABLE_CLOUD], [1], [disable netdata cloud functionality])
  227. fi
  228. # -----------------------------------------------------------------------------
  229. # C++ version check
  230. # Check for C++17 support (optional)
  231. # AX_CXX_COMPILE_STDCXX(17, noext, optional)
  232. if test "x$HAVE_CXX17" != "x1"; then
  233. # Check for C++11 support (optional)
  234. AX_CXX_COMPILE_STDCXX(11, noext, optional)
  235. fi
  236. AC_MSG_CHECKING([c++ standard to use])
  237. if test "x$HAVE_CXX17" = "x1"; then
  238. have_cxx17="yes"
  239. have_cxx11="yes"
  240. CPP_STD_FLAG="-std=c++17"
  241. cpp_std_to_use="c++17"
  242. AM_CONDITIONAL([HAVE_CXX17], [true])
  243. AM_CONDITIONAL([HAVE_CXX11], [true])
  244. elif test "x$HAVE_CXX11" = "x1"; then
  245. have_cxx17="no"
  246. have_cxx11="yes"
  247. CPP_STD_FLAG="-std=c++11"
  248. cpp_std_to_use="c++11"
  249. AM_CONDITIONAL([HAVE_CXX17], [false])
  250. AM_CONDITIONAL([HAVE_CXX11], [true])
  251. else
  252. have_cxx17="no"
  253. have_cxx11="no"
  254. CPP_STD_FLAG=""
  255. cpp_std_to_use="no c++"
  256. AM_CONDITIONAL([HAVE_CXX17], [false])
  257. AM_CONDITIONAL([HAVE_CXX11], [false])
  258. fi
  259. # PPC64LE needs -std=gnu++11 in order to build dlib. However, the rest of
  260. # the agent's components use and have been tested only with -std=c++11.
  261. # Skip ML compilation on that CPU until we reorganize and test the C++ flags.
  262. if test "${host_cpu}" = "powerpc64le"; then
  263. have_cxx17="no"
  264. have_cxx11="no"
  265. CPP_STD_FLAG=""
  266. cpp_std_to_use="no c++ on powerpc64le"
  267. AM_CONDITIONAL([HAVE_CXX17], [false])
  268. AM_CONDITIONAL([HAVE_CXX11], [false])
  269. fi
  270. AC_MSG_RESULT([${cpp_std_to_use}])
  271. # -----------------------------------------------------------------------------
  272. # netdata required checks
  273. # fails on centos6
  274. #AX_CHECK_ENABLE_DEBUG()
  275. AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
  276. AX_GCC_FUNC_ATTRIBUTE([malloc])
  277. AX_GCC_FUNC_ATTRIBUTE([noreturn])
  278. AX_GCC_FUNC_ATTRIBUTE([noinline])
  279. AX_GCC_FUNC_ATTRIBUTE([format])
  280. AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
  281. AC_CHECK_TYPES([struct timespec, clockid_t], [], [], [[#include <time.h>]])
  282. AC_SEARCH_LIBS([clock_gettime], [rt posix4])
  283. AC_CHECK_FUNCS([clock_gettime])
  284. AC_CHECK_FUNCS([sched_setscheduler sched_getscheduler sched_getparam sched_get_priority_min sched_get_priority_max getpriority setpriority nice])
  285. AC_CHECK_FUNCS([recvmmsg])
  286. AC_CHECK_FUNCS([close_range])
  287. AC_TYPE_INT8_T
  288. AC_TYPE_INT16_T
  289. AC_TYPE_INT32_T
  290. AC_TYPE_INT64_T
  291. AC_TYPE_UINT8_T
  292. AC_TYPE_UINT16_T
  293. AC_TYPE_UINT32_T
  294. AC_TYPE_UINT64_T
  295. AC_C_INLINE
  296. AC_FUNC_STRERROR_R
  297. AC_C__GENERIC
  298. # AC_C_STMT_EXPR
  299. AC_CANONICAL_HOST
  300. AC_HEADER_MAJOR
  301. AC_HEADER_RESOLV
  302. AC_CHECK_HEADERS_ONCE([sys/prctl.h])
  303. AC_CHECK_HEADERS_ONCE([sys/vfs.h])
  304. AC_CHECK_HEADERS_ONCE([sys/statfs.h])
  305. AC_CHECK_HEADERS_ONCE([linux/magic.h])
  306. AC_CHECK_HEADERS_ONCE([sys/statvfs.h])
  307. AC_CHECK_HEADERS_ONCE([sys/mount.h])
  308. if test "${enable_accept4}" != "no"; then
  309. AC_CHECK_FUNCS_ONCE(accept4)
  310. fi
  311. AC_CHECK_FUNCS_ONCE(malloc_usable_size)
  312. # -----------------------------------------------------------------------------
  313. # operating system detection
  314. originalCFLAGS="${CFLAGS}"
  315. AC_MSG_CHECKING([operating system])
  316. case "$host_os" in
  317. freebsd*)
  318. build_target=freebsd
  319. OPTIONAL_OS_DEP_CFLAGS="-I/usr/local/include"
  320. CFLAGS="${CFLAGS} ${OPTIONAL_OS_DEP_CFLAGS}"
  321. LDFLAGS="${LDFLAGS} -L/usr/local/lib"
  322. ;;
  323. darwin*)
  324. build_target=macos
  325. LDFLAGS="${LDFLAGS} -framework CoreFoundation -framework IOKit"
  326. # -----------------------------------------------------------------------------
  327. # Pull in OpenSSL properly if on macOS
  328. if brew --prefix > /dev/null 2>&1; then
  329. if brew --prefix --installed openssl > /dev/null 2>&1; then
  330. HOMEBREW_OPENSSL_PREFIX=$(brew --prefix --installed openssl)
  331. elif brew --prefix --installed openssl@3 > /dev/null 2>&1; then
  332. HOMEBREW_OPENSSL_PREFIX=$(brew --prefix --installed openssl@3)
  333. elif brew --prefix --installed openssl@1.1 > /dev/null 2>&1; then
  334. HOMEBREW_OPENSSL_PREFIX=$(brew --prefix --installed openssl@1.1)
  335. fi
  336. if test -n "${HOMEBREW_OPENSSL_PREFIX}"; then
  337. OPTIONAL_OS_DEP_CFLAGS="-I${HOMEBREW_OPENSSL_PREFIX}/include"
  338. CFLAGS="${CFLAGS} ${OPTIONAL_OS_DEP_CFLAGS}"
  339. LDFLAGS="${LDFLAGS} -L${HOMEBREW_OPENSSL_PREFIX}/lib"
  340. fi
  341. HOMEBREW_PREFIX=$(brew --prefix)
  342. OPTIONAL_OS_DEP_CFLAGS="${OPTIONAL_OS_DEP_CFLAGS} -I${HOMEBREW_PREFIX}/include"
  343. CFLAGS="${CFLAGS} -I${HOMEBREW_PREFIX}/include"
  344. LDFLAGS="${LDFLAGS} -L${HOMEBREW_PREFIX}/lib"
  345. fi
  346. ;;
  347. *)
  348. build_target=linux
  349. ;;
  350. esac
  351. AM_CONDITIONAL([FREEBSD], [test "${build_target}" = "freebsd"])
  352. if test "${build_target}" = "freebsd"
  353. then
  354. AC_DEFINE([COMPILED_FOR_FREEBSD], [1], [Compiled for FreeBSD])
  355. fi
  356. AM_CONDITIONAL([MACOS], [test "${build_target}" = "macos"])
  357. if test "${build_target}" = "macos"
  358. then
  359. AC_DEFINE([COMPILED_FOR_MACOS], [1], [Compiled for MacOS])
  360. fi
  361. AM_CONDITIONAL([LINUX], [test "${build_target}" = "linux"])
  362. if test "${build_target}" = "linux"
  363. then
  364. AC_DEFINE([COMPILED_FOR_LINUX], [1], [Compiled for Linux])
  365. fi
  366. AM_CONDITIONAL([ENABLE_PLUGIN_LOCAL_LISTENERS], [test "${build_target}" = "linux"])
  367. AC_MSG_RESULT([Host OS: ${build_target}])
  368. # -----------------------------------------------------------------------------
  369. # hardening
  370. HARDENING_CFLAGS=""
  371. if ! echo "${originalCFLAGS}" | grep -q '\-fstack-protector'; then
  372. AX_CHECK_COMPILE_FLAG(
  373. [-fstack-protector-strong],
  374. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -fstack-protector-strong"],
  375. [AX_CHECK_COMPILE_FLAG(
  376. [-fstack-protector],
  377. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -fstack-protector"],
  378. ,
  379. [-Werror],
  380. )],
  381. [-Werror],
  382. )
  383. fi
  384. if ! echo "${originalCFLAGS}" | grep -q '\-fno-stack-clash-protection'; then
  385. AX_CHECK_COMPILE_FLAG(
  386. [-fstack-clash-protection],
  387. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -fstack-clash-protection"],
  388. ,
  389. [-Werror],
  390. )
  391. fi
  392. if ! echo "${originalCFLAGS}" | grep -q '\-fcf-protection'; then
  393. AX_CHECK_COMPILE_FLAG(
  394. [-fcf-protection=full],
  395. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -fcf-protection=full"],
  396. ,
  397. [-Werror],
  398. )
  399. fi
  400. if ! echo "${originalCFLAGS}" | grep -q '\-mbranch-protection'; then
  401. AX_CHECK_COMPILE_FLAG(
  402. [-mbranch-protection=standard],
  403. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -mbranch-protection=standard"],
  404. ,
  405. [-Werror],
  406. )
  407. fi
  408. if ! echo "${originalCFLAGS}" | grep -q '\-D_FORTIFY_SOURCE'; then
  409. # This complex set of checks is needed because there is no clean
  410. # way to verify _FORTIFY_SOURCE support without having to check for
  411. # the required compiler builtins.
  412. AC_CHECK_DECLS(
  413. [__builtin_constant_p, __builtin_object_size, __builtin___memcpy_chk, __builtin___memmove_chk, __builtin___mempcpy_chk,
  414. __builtin___memset_chk, __builtin___snprintf_chk, __builtin___sprintf_chk, __builtin___stpcpy_chk, __builtin___strcat_chk,
  415. __builtin___strcpy_chk, __builtin___strncat_chk, __builtin___strncpy_chk, __builtin___vsnprintf_chk, __builtin___vsprintf_chk],
  416. [HAVE_FORTIFY_SOURCE=2]
  417. )
  418. if test "x${HAVE_FORTIFY_SOURCE}" = "x2" && echo "${originalCFLAGS}" | grep -qv '\-O0'; then
  419. AC_CHECK_DECL(
  420. __builtin_dynamic_object_size,
  421. [AX_CHECK_COMPILE_FLAG(
  422. [-D_FORTIFY_SOURCE=3],
  423. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -D_FORTIFY_SOURCE=3"],
  424. ,
  425. [-Werror],
  426. )],
  427. [AX_CHECK_COMPILE_FLAG(
  428. [-D_FORTIFY_SOURCE=2],
  429. [HARDENING_CFLAGS="${HARDENING_CFLAGS} -D_FORTIFY_SOURCE=2"],
  430. ,
  431. [-Werror],
  432. )],
  433. )
  434. fi
  435. fi
  436. # -----------------------------------------------------------------------------
  437. # backtrace
  438. AC_SEARCH_LIBS([backtrace], [execinfo], [AC_DEFINE([HAVE_BACKTRACE], [1], [backtrace availability])])
  439. # -----------------------------------------------------------------------------
  440. # pthreads
  441. ACX_PTHREAD(, [AC_MSG_ERROR([Cannot initialize pthread environment])])
  442. LIBS="${PTHREAD_LIBS} ${LIBS}"
  443. CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
  444. CC="${PTHREAD_CC}"
  445. AC_CHECK_LIB(
  446. [pthread],
  447. [pthread_getname_np],
  448. [AC_DEFINE([HAVE_PTHREAD_GETNAME_NP], [1], [Is set if pthread_getname_np is available])]
  449. )
  450. # -----------------------------------------------------------------------------
  451. # libdatachannel
  452. AC_CHECK_LIB([datachannel], [rtcCreatePeerConnection],
  453. [LIBDATACHANNEL_FOUND=yes],
  454. [LIBDATACHANNEL_FOUND=no])
  455. if test "x$LIBDATACHANNEL_FOUND" = "xyes"; then
  456. AC_DEFINE([HAVE_LIBDATACHANNEL], [1], [libdatachannel usability])
  457. OPTIONAL_DATACHANNEL_LIBS="-ldatachannel"
  458. fi
  459. # -----------------------------------------------------------------------------
  460. # libm
  461. AC_ARG_VAR([MATH_CFLAGS], [C compiler flags for math])
  462. AC_ARG_VAR([MATH_LIBS], [linker flags for math])
  463. if test -z "${MATH_LIBS}"; then
  464. AC_CHECK_LIB(
  465. [m],
  466. [sin],
  467. [MATH_LIBS="-lm"]
  468. )
  469. fi
  470. test "${with_math}" = "yes" -a -z "${MATH_LIBS}" && AC_MSG_ERROR([math required but not found])
  471. AC_MSG_CHECKING([if libm should be used])
  472. if test "${with_math}" != "no" -a ! -z "${MATH_LIBS}"; then
  473. with_math="yes"
  474. AC_DEFINE([STORAGE_WITH_MATH], [1], [math usability])
  475. OPTIONAL_MATH_CFLAGS="${MATH_CFLAGS}"
  476. OPTIONAL_MATH_LIBS="${MATH_LIBS}"
  477. else
  478. with_math="no"
  479. fi
  480. AC_MSG_RESULT([${with_math}])
  481. AC_CHECK_FUNCS([isfinite])
  482. AC_CHECK_FUNCS([finite])
  483. # -----------------------------------------------------------------------------
  484. # libuv multi-platform support library with a focus on asynchronous I/O
  485. # TODO: check version, uv_fs_scandir_next only available in version >= 1.0
  486. AC_CHECK_LIB(
  487. [uv],
  488. [uv_fs_scandir_next],
  489. [UV_LIBS="-luv"]
  490. )
  491. test -z "${UV_LIBS}" && \
  492. AC_MSG_ERROR([libuv required but not found. Try installing 'libuv1-dev' or 'libuv-devel'.])
  493. OPTIONAL_UV_CFLAGS="${UV_CFLAGS}"
  494. OPTIONAL_UV_LIBS="${UV_LIBS}"
  495. # -----------------------------------------------------------------------------
  496. # lz4
  497. AC_CHECK_LIB(
  498. [lz4],
  499. [LZ4_initStream],
  500. [LZ4_LIBS_FAST="-llz4"]
  501. )
  502. AC_CHECK_LIB(
  503. [lz4],
  504. [LZ4_compress_default],
  505. [LZ4_LIBS="-llz4"]
  506. )
  507. # -----------------------------------------------------------------------------
  508. # zlib
  509. PKG_CHECK_MODULES(
  510. [ZLIB],
  511. [zlib],
  512. [have_zlib=yes],
  513. [have_zlib=no]
  514. )
  515. test "${have_zlib}" != "yes" && AC_MSG_ERROR([zlib required but not found. Try installing 'zlib1g-dev' or 'zlib-devel'.])
  516. # -----------------------------------------------------------------------------
  517. # libuuid
  518. PKG_CHECK_MODULES(
  519. [UUID],
  520. [uuid],
  521. [have_uuid=yes],
  522. [AC_MSG_ERROR([libuuid required but not found. Try installing 'uuid-dev' or 'libuuid-devel'.])]
  523. )
  524. OPTIONAL_UUID_CFLAGS="${UUID_CFLAGS}"
  525. OPTIONAL_UUID_LIBS="${UUID_LIBS}"
  526. # -----------------------------------------------------------------------------
  527. # OpenSSL Cryptography and SSL/TLS Toolkit
  528. AC_CHECK_LIB(
  529. [crypto],
  530. [SHA256_Init],
  531. [SSL_LIBS="-lcrypto -lssl"]
  532. )
  533. AC_CHECK_LIB(
  534. [crypto],
  535. [X509_VERIFY_PARAM_set1_host],
  536. [ssl_host_validation="yes"],
  537. [ssl_host_validation="no"]
  538. )
  539. test -z "${SSL_LIBS}" || \
  540. AC_DEFINE([HAVE_CRYPTO], [1], [libcrypto availability])
  541. if test "${ssl_host_validation}" = "no"; then
  542. AC_DEFINE([HAVE_X509_VERIFY_PARAM_set1_host], [0], [ssl host validation])
  543. AC_MSG_WARN([DISABLING SSL HOSTNAME VALIDATION BECAUSE IT IS NOT AVAILABLE ON THIS SYSTEM.])
  544. else
  545. AC_DEFINE([HAVE_X509_VERIFY_PARAM_set1_host], [1], [ssl host validation])
  546. fi
  547. # -----------------------------------------------------------------------------
  548. # JSON-C library
  549. PKG_CHECK_MODULES([JSON],[json-c],AC_CHECK_LIB(
  550. [json-c],
  551. [json_object_get_type],
  552. [JSONC_LIBS="-ljson-c"]),AC_CHECK_LIB(
  553. [json],
  554. [json_object_get_type],
  555. [JSONC_LIBS="-ljson"])
  556. )
  557. OPTIONAL_JSONC_LIBS="${JSONC_LIBS}"
  558. # -----------------------------------------------------------------------------
  559. # YAML library
  560. AC_CHECK_LIB(
  561. [yaml],
  562. [yaml_parser_initialize],
  563. [YAML_LIBS="-lyaml"]
  564. )
  565. OPTIONAL_YAML_LIBS="${YAML_LIBS}"
  566. # -----------------------------------------------------------------------------
  567. # DB engine and OpenSSL
  568. test "${enable_dbengine}" = "yes" -a -z "${LZ4_LIBS}" && \
  569. AC_MSG_ERROR([liblz4 required but not found. Try installing 'liblz4-dev' or 'lz4-devel'.])
  570. AC_C_BIGENDIAN([],
  571. [LIBJUDY_CFLAGS="-DJU_LITTLE_ENDIAN"],
  572. [AC_MSG_ERROR([Could not find out system endiannnes])])
  573. AC_CHECK_SIZEOF(void *)
  574. if test "$ac_cv_sizeof_void_p" = 8; then
  575. AC_MSG_RESULT(Detected 64-bit Build Environment)
  576. LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -DJU_64BIT"
  577. else
  578. AC_MSG_RESULT(Detected 32-bit Build Environment)
  579. LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -UJU_64BIT"
  580. fi
  581. AC_SUBST([LIBJUDY_CFLAGS])
  582. JUDY_CFLAGS="-I \$(abs_top_srcdir)/libnetdata/libjudy/src"
  583. test "${enable_openssl}" = "yes" -a -z "${SSL_LIBS}" && \
  584. AC_MSG_ERROR([OpenSSL required but not found. Try installing 'libssl-dev' or 'openssl-devel'.])
  585. test "${enable_dbengine}" = "yes" -a -z "${SSL_LIBS}" && \
  586. AC_MSG_ERROR([OpenSSL required for DBENGINE but not found. Try installing 'libssl-dev' or 'openssl-devel'.])
  587. AC_MSG_CHECKING([if netdata dbengine should be used])
  588. if test "${enable_dbengine}" != "no" -a "${UV_LIBS}" -a "${LZ4_LIBS}" -a "${SSL_LIBS}"; then
  589. enable_dbengine="yes"
  590. AC_DEFINE([ENABLE_DBENGINE], [1], [netdata dbengine usability])
  591. OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
  592. OPTIONAL_LZ4_LIBS="${LZ4_LIBS}"
  593. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  594. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  595. else
  596. enable_dbengine="no"
  597. fi
  598. AC_MSG_RESULT([${enable_dbengine}])
  599. AM_CONDITIONAL([ENABLE_DBENGINE], [test "${enable_dbengine}" = "yes"])
  600. AC_MSG_CHECKING([if openssl should be used])
  601. if test "${enable_openssl}" != "no" -a "${SSL_LIBS}"; then
  602. enable_openssl="yes"
  603. AC_DEFINE([ENABLE_OPENSSL], [1], [openssl usability])
  604. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  605. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  606. else
  607. enable_openssl="no"
  608. fi
  609. AC_MSG_RESULT([${enable_openssl}])
  610. AM_CONDITIONAL([ENABLE_OPENSSL], [test "${enable_openssl}" = "yes"])
  611. AC_MSG_CHECKING([if lz4 should be used])
  612. if test "${enable_lz4}" != "no"; then
  613. if test "${LZ4_LIBS_FAST}"; then
  614. LIBS_BKP="${LIBS}"
  615. LIBS="${LZ4_LIBS_FAST}"
  616. AC_TRY_LINK(
  617. [ #include <lz4.h> ],
  618. [
  619. LZ4_stream_t* stream = LZ4_initStream(NULL, 0);
  620. ],
  621. [ enable_lz4="yes"],
  622. [ enable_lz4="no" ]
  623. )
  624. LIBS="${LIBS_BKP}"
  625. if test "${enable_lz4}" == "yes"; then
  626. OPTIONAL_LZ4_LIBS="${LZ4_LIBS_FAST}"
  627. AC_DEFINE([ENABLE_LZ4], [1], [lz4 usability])
  628. fi
  629. else
  630. if test "${enable_lz4}" == "yes"; then
  631. AC_MSG_ERROR([liblz4 with version >= 1.9.0 required to enable lz4. Try installing the required version of 'liblz4-dev' or 'liblz4-devel'.])
  632. enable_lz4="no"
  633. fi
  634. enable_lz4="no"
  635. fi
  636. else
  637. enable_lz4="no"
  638. fi
  639. AC_MSG_RESULT([${enable_lz4}])
  640. AM_CONDITIONAL([ENABLE_LZ4], [test "${enable_lz4}" = "yes"])
  641. # -----------------------------------------------------------------------------
  642. # JSON-C
  643. if test "${enable_jsonc}" != "no" -a -z "${JSONC_LIBS}"; then
  644. # Try and detect manual static build presence (from netdata-installer.sh)
  645. AC_MSG_CHECKING([if statically built json-c is present])
  646. HAVE_libjson_c_a="no"
  647. if test -f "externaldeps/jsonc/libjson-c.a"; then
  648. LIBS_BKP="${LIBS}"
  649. LIBS="externaldeps/jsonc/libjson-c.a"
  650. AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/jsonc/json-c/json.h"
  651. int main (int argc, char **argv) {
  652. struct json_object *jobj;
  653. char *str = "{ \"msg-type\": \"random\" }";
  654. jobj = json_tokener_parse(str);
  655. json_object_get_type(jobj);
  656. }]])],
  657. [HAVE_libjson_c_a="yes"],
  658. [HAVE_libjson_c_a="no"])
  659. LIBS="${LIBS_BKP}"
  660. fi
  661. if test "${HAVE_libjson_c_a}" = "yes"; then
  662. AC_DEFINE([LINK_STATIC_JSONC], [1], [static json-c should be used])
  663. JSONC_LIBS="static"
  664. OPTIONAL_JSONC_STATIC_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/jsonc"
  665. fi
  666. AC_MSG_RESULT([${HAVE_libjson_c_a}])
  667. fi
  668. AM_CONDITIONAL([LINK_STATIC_JSONC], [test "${JSONC_LIBS}" = "static"])
  669. test "${enable_jsonc}" = "yes" -a -z "${JSONC_LIBS}" && \
  670. AC_MSG_ERROR([JSON-C required but not found. Try installing 'libjson-c-dev' or 'json-c'.])
  671. AC_MSG_CHECKING([if json-c should be used])
  672. if test "${enable_jsonc}" != "no" -a "${JSONC_LIBS}"; then
  673. enable_jsonc="yes"
  674. AC_DEFINE([ENABLE_JSONC], [1], [netdata json-c usability])
  675. else
  676. enable_jsonc="no"
  677. fi
  678. AC_MSG_RESULT([${enable_jsonc}])
  679. AM_CONDITIONAL([ENABLE_JSONC], [test "${enable_jsonc}" = "yes"])
  680. # -----------------------------------------------------------------------------
  681. # YAML
  682. if test -z "${YAML_LIBS}"; then
  683. # Try and detect manual static build presence (from netdata-installer.sh)
  684. AC_MSG_CHECKING([if statically built libyaml is present])
  685. HAVE_libyaml_a="no"
  686. if test -f "externaldeps/libyaml/libyaml.a"; then
  687. LIBS_BKP="${LIBS}"
  688. LIBS="externaldeps/libyaml/libyaml.a"
  689. AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/libyaml/yaml.h"
  690. int main (int argc, char **argv) {
  691. yaml_parser_t parser;
  692. yaml_parser_initialize(&parser);
  693. }]])],
  694. [HAVE_libyaml_a="yes"],
  695. [HAVE_libyaml_a="no"])
  696. LIBS="${LIBS_BKP}"
  697. fi
  698. if test "${HAVE_libyaml_a}" = "yes"; then
  699. AC_DEFINE([LINK_STATIC_YAML], [1], [static yaml should be used])
  700. YAML_LIBS="static"
  701. OPTIONAL_YAML_STATIC_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/libyaml"
  702. fi
  703. AC_MSG_RESULT([${HAVE_libyaml_a}])
  704. fi
  705. AM_CONDITIONAL([LINK_STATIC_YAML], [test "${YAML_LIBS}" = "static"])
  706. test -z "${YAML_LIBS}" && \
  707. AC_MSG_ERROR([LIBYAML required but not found. Try installing 'libyaml-dev'.])
  708. # -----------------------------------------------------------------------------
  709. # compiler options
  710. AC_ARG_VAR([SSE_CANDIDATE], [C compiler flags for SSE])
  711. AS_CASE([$host_cpu],
  712. [i?86], [SSE_CANDIDATE="yes"]
  713. )
  714. AC_SUBST([SSE_CANDIDATE])
  715. if test "${SSE_CANDIDATE}" = "yes" -a "${enable_x86_sse}" = "yes"; then
  716. opt="-msse2 -mfpmath=sse"
  717. AX_CHECK_COMPILE_FLAG(${opt}, [CFLAGS="${CFLAGS} ${opt}"], [])
  718. fi
  719. if test "${GCC}" = "yes"; then
  720. AC_DEFINE_UNQUOTED([likely(x)], [__builtin_expect(!!(x), 1)], [gcc branch optimization])
  721. AC_DEFINE_UNQUOTED([unlikely(x)], [__builtin_expect(!!(x), 0)], [gcc branch optimization])
  722. else
  723. AC_DEFINE_UNQUOTED([likely(x)], [(x)], [gcc branch optimization])
  724. AC_DEFINE_UNQUOTED([unlikely(x)], [(x)], [gcc branch optimization])
  725. fi
  726. if test "${GCC}" = "yes"; then
  727. AC_DEFINE([__always_unused], [__attribute__((unused))], [gcc unused attribute])
  728. AC_DEFINE([__maybe_unused], [__attribute__((unused))], [gcc unused attribute])
  729. else
  730. AC_DEFINE([__always_unused], [], [dummy unused attribute])
  731. AC_DEFINE([__maybe_unused], [], [dummy unused attribute])
  732. fi
  733. if test "${enable_pedantic}" = "yes"; then
  734. enable_strict="yes"
  735. CFLAGS="${CFLAGS} -pedantic -Wall -Wextra -Wno-long-long"
  736. fi
  737. # -----------------------------------------------------------------------------
  738. # memory allocation library
  739. AC_MSG_CHECKING([for memory allocator])
  740. TS_CHECK_JEMALLOC
  741. if test "$has_jemalloc" = "1"; then
  742. AC_DEFINE([ENABLE_JEMALLOC], [1], [compile and link with jemalloc])
  743. AC_MSG_RESULT([jemalloc])
  744. else
  745. TS_CHECK_TCMALLOC
  746. if test "$has_tcmalloc" = "1"; then
  747. AC_DEFINE([ENABLE_TCMALLOC], [1], [compile and link with tcmalloc])
  748. AC_MSG_RESULT([tcmalloc])
  749. else
  750. AC_MSG_RESULT([system])
  751. AC_C_MALLOPT
  752. AC_C_MALLINFO
  753. fi
  754. fi
  755. # -----------------------------------------------------------------------------
  756. # libcap
  757. PKG_CHECK_MODULES(
  758. [LIBCAP],
  759. [libcap],
  760. [AC_CHECK_LIB([cap], [cap_get_proc, cap_set_proc],
  761. [AC_CHECK_HEADER(
  762. [sys/capability.h],
  763. [have_libcap=yes],
  764. [have_libcap=no]
  765. )],
  766. [have_libcap=no]
  767. )],
  768. [have_libcap=no]
  769. )
  770. test "${with_libcap}" = "yes" -a "${have_libcap}" != "yes" && AC_MSG_ERROR([libcap required but not found.])
  771. AC_MSG_CHECKING([if libcap should be used])
  772. if test "${with_libcap}" != "no" -a "${have_libcap}" = "yes"; then
  773. with_libcap="yes"
  774. AC_DEFINE([HAVE_CAPABILITY], [1], [libcap usability])
  775. OPTIONAL_LIBCAP_CFLAGS="${LIBCAP_CFLAGS}"
  776. OPTIONAL_LIBCAP_LIBS="${LIBCAP_LIBS}"
  777. else
  778. with_libcap="no"
  779. fi
  780. AC_MSG_RESULT([${with_libcap}])
  781. AM_CONDITIONAL([ENABLE_CAPABILITY], [test "${with_libcap}" = "yes"])
  782. # -----------------------------------------------------------------------------
  783. # H2O related
  784. can_build_h2o="no"
  785. if test "${enable_h2o}" != "no"; then
  786. can_build_h2o="yes"
  787. AC_MSG_CHECKING([can build H2O])
  788. if test -z "${UV_LIBS}"; then
  789. can_build_h2o="no"
  790. fi
  791. if test -n "${SSL_LIBS}"; then
  792. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  793. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  794. else
  795. can_build_h2o="no"
  796. fi
  797. if test "${with_zlib}" != "yes"; then
  798. can_build_h2o="no"
  799. fi
  800. AC_MSG_RESULT([${can_build_h2o}])
  801. if test "${can_build_h2o}" = "no" -a "${enable_h2o}" = "yes"; then
  802. AC_MSG_ERROR([H2O was requested but it cannot be built])
  803. fi
  804. if test "${can_build_h2o}" = "yes"; then
  805. AC_DEFINE([ENABLE_H2O], [1], [H2O web server])
  806. H2O_CFLAGS="-Wno-unused-result -Wno-misleading-indentation -Wno-format-security -Wno-format -Wno-unused-function -Wno-unused-parameter -Wno-type-limits -Wno-unused-but-set-variable -Wno-implicit-fallthrough -I\$(abs_top_srcdir)/web/server/h2o/libh2o/include -I\$(abs_top_srcdir)/web/server/h2o/libh2o/deps/picotls/include -I\$(abs_top_srcdir)/web/server/h2o/libh2o/deps/quicly/include -DH2O_USE_LIBUV=0"
  807. fi
  808. fi
  809. AM_CONDITIONAL([ENABLE_H2O], [test "${can_build_h2o}" = "yes"])
  810. # -----------------------------------------------------------------------------
  811. # ACLK
  812. bundled_proto_avail="no"
  813. if test "${with_bundled_protobuf}" != "no"; then
  814. AC_MSG_CHECKING([is bundled protobuf available])
  815. if test -f "externaldeps/protobuf/src/protoc"; then
  816. bundled_proto_avail="yes"
  817. fi
  818. AC_MSG_RESULT([${bundled_proto_avail}])
  819. if test "${with_bundled_protobuf}" == "yes" -a "${bundled_proto_avail}" != "yes"; then
  820. AC_MSG_ERROR([Bundled protobuf requested using --with-bundled-protobuf but it cannot be used/found])
  821. fi
  822. if test "${with_bundled_protobuf}" == "detect" -a "${bundled_proto_avail}" == "yes"; then
  823. with_bundled_protobuf="yes"
  824. fi
  825. fi
  826. AM_CONDITIONAL([MQTT_WSS_DEBUG], [test "${aclk_ssl_debug}" = "yes"])
  827. if test "${aclk_ssl_debug}" = "yes"; then
  828. AC_DEFINE([MQTT_WSS_DEBUG], [1], [ACLK SSL allow debugging])
  829. fi
  830. if test "${with_bundled_protobuf}" != "yes"; then
  831. PKG_CHECK_MODULES(
  832. [PROTOBUF],
  833. [protobuf >= 3],
  834. [have_libprotobuf=yes],
  835. [have_libprotobuf=no]
  836. )
  837. AC_PATH_PROG([PROTOC], [protoc], [no])
  838. AS_IF(
  839. [test x"${PROTOC}" == x"no"],
  840. [have_protoc=no],
  841. [have_protoc=yes]
  842. )
  843. else
  844. AC_MSG_NOTICE([using bundled protobuf])
  845. AC_DEFINE([BUNDLED_PROTOBUF], [1], [Using a bundled copy of protobuf])
  846. PROTOC="\$(abs_top_srcdir)/externaldeps/protobuf/src/protoc"
  847. PROTOBUF_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/protobuf/src"
  848. PROTOBUF_LIBS="\$(abs_top_srcdir)/externaldeps/protobuf/src/.libs/libprotobuf.a"
  849. have_libprotobuf="yes"
  850. have_protoc="yes"
  851. fi
  852. AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
  853. AS_IF(
  854. [test x"${CXX_BINARY}" == x"no"],
  855. [have_CXX_compiler=no],
  856. [have_CXX_compiler=yes]
  857. )
  858. if test "${have_libprotobuf}" == "yes" && test "${have_CXX_compiler}" == "yes"; then
  859. AC_DEFINE([HAVE_PROTOBUF], [1], [Protobuf is available])
  860. fi
  861. AC_MSG_CHECKING([if Cloud functionality should be enabled])
  862. AC_MSG_RESULT([${enable_cloud}])
  863. if test "$enable_cloud" != "no"; then
  864. AC_MSG_NOTICE([Checking if ACLK can be built])
  865. can_enable_ng="yes"
  866. AC_MSG_CHECKING([if git submodules present for ACLK])
  867. if test -f "mqtt_websockets/src/mqtt_wss_client.c"; then
  868. AC_MSG_RESULT([yes])
  869. else
  870. AC_MSG_RESULT([no])
  871. can_enable_ng="no"
  872. fi
  873. AC_MSG_CHECKING([if SSL available for ACLK])
  874. if test -n "${SSL_LIBS}"; then
  875. AC_MSG_RESULT([yes])
  876. OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}"
  877. OPTIONAL_SSL_LIBS="${SSL_LIBS}"
  878. else
  879. AC_MSG_RESULT([no])
  880. fi
  881. AC_MSG_CHECKING([if JSON-C available for ACLK])
  882. if test "$enable_jsonc" != "yes"; then
  883. AC_MSG_RESULT([no])
  884. can_enable_ng="no"
  885. else
  886. AC_MSG_RESULT([yes])
  887. fi
  888. AC_MSG_CHECKING([if protobuf available for ACLK New Cloud Protocol])
  889. if test "${have_libprotobuf}" != "yes"; then
  890. AC_MSG_RESULT([no])
  891. can_enable_ng="no"
  892. else
  893. AC_MSG_RESULT([yes])
  894. fi
  895. AC_MSG_CHECKING([if protoc available for ACLK New Cloud Protocol])
  896. if test "${have_protoc}" != "yes"; then
  897. AC_MSG_RESULT([no])
  898. can_enable_ng="no"
  899. else
  900. AC_MSG_RESULT([yes])
  901. fi
  902. AC_MSG_CHECKING([if C++ compiler available for ACLK New Cloud Protocol])
  903. if test "${have_CXX_compiler}" != "yes"; then
  904. AC_MSG_RESULT([no])
  905. can_enable_ng="no"
  906. else
  907. AC_MSG_RESULT([yes])
  908. fi
  909. AC_MSG_CHECKING([ACLK Next Generation can be built])
  910. AC_MSG_RESULT([${can_enable_ng}])
  911. if test "$can_enable_ng" = "no" -a "$enable_cloud" = "yes"; then
  912. AC_MSG_ERROR([You have requested --with-cloud but ACLK can't be built. See reasons in lines above])
  913. fi
  914. if test "$can_enable_ng" = "yes"; then
  915. enable_aclk="yes"
  916. AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
  917. OPTIONAL_ACLK_CFLAGS="-I \$(abs_top_srcdir)/mqtt_websockets/src/include -I \$(abs_top_srcdir)/mqtt_websockets/c-rbuf/include -I \$(abs_top_srcdir)/aclk/aclk-schemas"
  918. OPTIONAL_PROTOBUF_CFLAGS="${PROTOBUF_CFLAGS}"
  919. OPTIONAL_PROTOBUF_LIBS="${PROTOBUF_LIBS}"
  920. fi
  921. fi
  922. if test "$enable_cloud" = "yes" -a "$enable_aclk" != "yes"; then
  923. AC_MSG_ERROR([ACLK can't be built but --enable-cloud was requested])
  924. fi
  925. AC_SUBST([enable_cloud])
  926. AC_SUBST([enable_aclk])
  927. AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"])
  928. # -----------------------------------------------------------------------------
  929. # apps.plugin
  930. AC_MSG_CHECKING([if apps.plugin should be enabled])
  931. if test "${build_target}" != "macos"; then
  932. AC_DEFINE([ENABLE_APPS_PLUGIN], [1], [apps.plugin])
  933. enable_plugin_apps="yes"
  934. else
  935. enable_plugin_apps="no"
  936. fi
  937. AC_MSG_RESULT([${enable_plugin_apps}])
  938. AM_CONDITIONAL([ENABLE_PLUGIN_APPS], [test "${enable_plugin_apps}" = "yes"])
  939. # -----------------------------------------------------------------------------
  940. # freeipmi.plugin - libipmimonitoring
  941. PKG_CHECK_MODULES(
  942. [IPMIMONITORING],
  943. [libipmimonitoring],
  944. [AC_CHECK_LIB([ipmimonitoring], [
  945. ipmi_monitoring_sensor_readings_by_record_id,
  946. ipmi_monitoring_sensor_readings_by_sensor_type,
  947. ipmi_monitoring_sensor_read_sensor_number,
  948. ipmi_monitoring_sensor_read_sensor_name,
  949. ipmi_monitoring_sensor_read_sensor_state,
  950. ipmi_monitoring_sensor_read_sensor_units,
  951. ipmi_monitoring_sensor_iterator_next,
  952. ipmi_monitoring_ctx_sensor_config_file,
  953. ipmi_monitoring_ctx_sdr_cache_directory,
  954. ipmi_monitoring_ctx_errormsg,
  955. ipmi_monitoring_ctx_create
  956. ],
  957. [AC_CHECK_HEADER(
  958. [ipmi_monitoring.h],
  959. [AC_CHECK_HEADER(
  960. [ipmi_monitoring_bitmasks.h],
  961. [have_ipmimonitoring=yes],
  962. [have_ipmimonitoring=no]
  963. )],
  964. [have_ipmimonitoring=no]
  965. )],
  966. [have_ipmimonitoring=no]
  967. )],
  968. [have_ipmimonitoring=no]
  969. )
  970. test "${enable_plugin_freeipmi}" = "yes" -a "${have_ipmimonitoring}" != "yes" && \
  971. AC_MSG_ERROR([ipmimonitoring required but not found. Try installing 'libipmimonitoring-dev' or 'libipmimonitoring-devel'])
  972. AC_MSG_CHECKING([if freeipmi.plugin should be enabled])
  973. if test "${enable_plugin_freeipmi}" != "no" -a "${have_ipmimonitoring}" = "yes"; then
  974. enable_plugin_freeipmi="yes"
  975. AC_DEFINE([HAVE_FREEIPMI], [1], [ipmimonitoring usability])
  976. OPTIONAL_IPMIMONITORING_CFLAGS="${IPMIMONITORING_CFLAGS}"
  977. OPTIONAL_IPMIMONITORING_LIBS="${IPMIMONITORING_LIBS}"
  978. else
  979. enable_plugin_freeipmi="no"
  980. fi
  981. AC_MSG_RESULT([${enable_plugin_freeipmi}])
  982. AM_CONDITIONAL([ENABLE_PLUGIN_FREEIPMI], [test "${enable_plugin_freeipmi}" = "yes"])
  983. # -----------------------------------------------------------------------------
  984. # systemd-journal.plugin - systemd
  985. LIBS_BAK="${LIBS}"
  986. AC_CHECK_LIB([systemd], [sd_journal_open], [have_systemd_libs=yes], [have_systemd_libs=no])
  987. AC_CHECK_HEADERS([systemd/sd-journal.h], [have_systemd_journal_header=yes], [have_systemd_journal_header=no])
  988. if test "${have_systemd_libs}" = "yes" -a "${have_systemd_journal_header}" = "yes"; then
  989. have_systemd="yes"
  990. else
  991. have_systemd="no"
  992. fi
  993. test "${enable_plugin_systemd_journal}" = "yes" -a "${have_systemd}" != "yes" && \
  994. AC_MSG_ERROR([systemd is required but not found. Try installing 'libsystemd-dev' or 'libsystemd-devel'])
  995. AC_MSG_CHECKING([if systemd-journal.plugin should be enabled])
  996. if test "${enable_plugin_systemd_journal}" != "no" -a "${have_systemd}" = "yes"; then
  997. enable_plugin_systemd_journal="yes"
  998. AC_DEFINE([HAVE_SYSTEMD], [1], [systemd usability])
  999. OPTIONAL_SYSTEMD_CFLAGS="-I/usr/include"
  1000. OPTIONAL_SYSTEMD_LIBS="-lsystemd"
  1001. else
  1002. enable_plugin_systemd_journal="no"
  1003. fi
  1004. AC_MSG_RESULT([${enable_plugin_systemd_journal}])
  1005. AM_CONDITIONAL([ENABLE_PLUGIN_SYSTEMD_JOURNAL], [test "${enable_plugin_systemd_journal}" = "yes"])
  1006. AC_MSG_NOTICE([OPTIONAL_SYSTEMD_LIBS is set to: ${OPTIONAL_SYSTEMD_LIBS}])
  1007. LIBS="${LIBS_BAK}"
  1008. # -----------------------------------------------------------------------------
  1009. # cups.plugin - libcups
  1010. # Only check most recently added method of cups
  1011. AC_CHECK_LIB([cups], [httpConnect2],
  1012. [AC_CHECK_HEADER(
  1013. [cups/cups.h],
  1014. [have_cups=yes],
  1015. [have_cups=no]
  1016. )],
  1017. [have_cups=no]
  1018. )
  1019. test "${enable_plugin_cups}" = "yes" -a "${have_cups}" != "yes" && \
  1020. AC_MSG_ERROR([cups required but not found. Try installing 'cups'])
  1021. AC_ARG_WITH([cups-config],
  1022. [AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])],
  1023. [with_cups_config="$withval"],
  1024. [with_cups_config=system]
  1025. )
  1026. AS_IF([test "x$with_cups_config" != "xsystem"], [
  1027. CUPSCONFIG=$with_cups_config
  1028. ], [
  1029. AC_PATH_TOOL(CUPSCONFIG, [cups-config])
  1030. AS_IF([test -z "$CUPSCONFIG"], [
  1031. have_cups=no
  1032. ])
  1033. ])
  1034. AC_MSG_CHECKING([if cups.plugin should be enabled])
  1035. if test "${enable_plugin_cups}" != "no" -a "${have_cups}" = "yes"; then
  1036. enable_plugin_cups="yes"
  1037. AC_DEFINE([HAVE_CUPS], [1], [cups usability])
  1038. CUPS_CFLAGS="${CUPS_CFLAGS} `$CUPSCONFIG --cflags`"
  1039. CUPS_LIBS="${CUPS_LIBS} `$CUPSCONFIG --libs`"
  1040. OPTIONAL_CUPS_CFLAGS="${CUPS_CFLAGS}"
  1041. OPTIONAL_CUPS_LIBS="${CUPS_LIBS}"
  1042. else
  1043. enable_plugin_cups="no"
  1044. fi
  1045. AC_MSG_RESULT([${enable_plugin_cups}])
  1046. AM_CONDITIONAL([ENABLE_PLUGIN_CUPS], [test "${enable_plugin_cups}" = "yes"])
  1047. # -----------------------------------------------------------------------------
  1048. # nfacct.plugin - libmnl, libnetfilter_acct
  1049. AC_CHECK_HEADER(
  1050. [linux/netfilter/nfnetlink_conntrack.h],
  1051. [AC_CHECK_DECL(
  1052. [CTA_STATS_MAX],
  1053. [have_nfnetlink_conntrack=yes],
  1054. [have_nfnetlink_conntrack=no],
  1055. [#include <linux/netfilter/nfnetlink_conntrack.h>]
  1056. )],
  1057. [have_nfnetlink_conntrack=no]
  1058. )
  1059. LIBS_BAK="${LIBS}"
  1060. LIBS="${LIBS} -lmnl"
  1061. PKG_CHECK_MODULES(
  1062. [LIBMNL],
  1063. [libmnl],
  1064. [AC_CHECK_LIB(
  1065. [mnl],
  1066. [mnl_socket_open],
  1067. [have_libmnl=yes],
  1068. [have_libmnl=no]
  1069. )],
  1070. [have_libmnl=no]
  1071. )
  1072. LIBS="${LIBS}"
  1073. PKG_CHECK_MODULES(
  1074. [NFACCT],
  1075. [libnetfilter_acct],
  1076. AC_SEARCH_LIBS(
  1077. [nfacct_alloc],
  1078. [netfilter_acct libnetfilter_acct],
  1079. [have_libnetfilter_acct=yes],
  1080. [have_libnetfilter_acct=no],
  1081. [${LIBS} -L/libnetfilter-acct-static/lib/libnetfilter_acct.a]
  1082. )],
  1083. [have_libnetfilter_acct=no]
  1084. )
  1085. LIBS="${LIBS_BAK}"
  1086. test "${enable_plugin_nfacct}" = "yes" -a "${have_nfnetlink_conntrack}" != "yes" && \
  1087. AC_MSG_ERROR([nfnetlink_conntrack.h required but not found or too old])
  1088. test "${enable_plugin_nfacct}" = "yes" -a "${have_libnetfilter_acct}" != "yes" && \
  1089. AC_MSG_ERROR([netfilter_acct required but not found])
  1090. test "${enable_plugin_nfacct}" = "yes" -a "${have_libmnl}" != "yes" && \
  1091. AC_MSG_ERROR([libmnl required but not found. Try installing 'libmnl-dev' or 'libmnl-devel'])
  1092. AC_MSG_CHECKING([if nfacct.plugin should be enabled])
  1093. if test "${enable_plugin_nfacct}" != "no" -a "${have_libnetfilter_acct}" = "yes" \
  1094. -a "${have_libmnl}" = "yes" \
  1095. -a "${have_nfnetlink_conntrack}" = "yes"; then
  1096. enable_plugin_nfacct="yes"
  1097. AC_DEFINE([HAVE_NFACCT], [1], [netfilter accounting usability])
  1098. OPTIONAL_NFACCT_CFLAGS="${NFACCT_CFLAGS} ${LIBMNL_CFLAGS}"
  1099. OPTIONAL_NFACCT_LIBS="${NFACCT_LIBS} ${LIBMNL_LIBS}"
  1100. else
  1101. enable_plugin_nfacct="no"
  1102. fi
  1103. AC_MSG_RESULT([${enable_plugin_nfacct}])
  1104. AM_CONDITIONAL([ENABLE_PLUGIN_NFACCT], [test "${enable_plugin_nfacct}" = "yes"])
  1105. # -----------------------------------------------------------------------------
  1106. # xenstat.plugin - libxenstat
  1107. PKG_CHECK_MODULES(
  1108. [YAJL],
  1109. [yajl],
  1110. [AC_CHECK_LIB(
  1111. [yajl],
  1112. [yajl_tree_get],
  1113. [have_libyajl=yes],
  1114. [have_libyajl=no]
  1115. )],
  1116. [have_libyajl=no]
  1117. )
  1118. AC_CHECK_LIB(
  1119. [xenstat],
  1120. [xenstat_init],
  1121. [AC_CHECK_HEADER(
  1122. [xenstat.h],
  1123. [have_libxenstat=yes],
  1124. [have_libxenstat=no]
  1125. )],
  1126. [have_libxenstat=no],
  1127. [-lyajl]
  1128. )
  1129. PKG_CHECK_MODULES(
  1130. [XENLIGHT],
  1131. [xenlight],
  1132. [AC_CHECK_LIB(
  1133. [xenlight],
  1134. [libxl_domain_info],
  1135. [AC_CHECK_HEADER(
  1136. [libxl.h],
  1137. [have_libxenlight=yes],
  1138. [have_libxenlight=no]
  1139. )],
  1140. [have_libxenlight=no]
  1141. )],
  1142. [have_libxenlight=no]
  1143. )
  1144. test "${enable_plugin_xenstat}" = "yes" -a "${have_libxenstat}" != "yes" && \
  1145. AC_MSG_ERROR([libxenstat required but not found. try installing 'xen-dom0-libs-devel'])
  1146. test "${enable_plugin_xenstat}" = "yes" -a "${have_libxenlight}" != "yes" && \
  1147. AC_MSG_ERROR([libxenlight required but not found. try installing 'xen-dom0-libs-devel'])
  1148. test "${enable_plugin_xenstat}" = "yes" -a "${have_libyajl}" != "yes" && \
  1149. AC_MSG_ERROR([libyajl required but not found. Try installing 'yajl-devel'])
  1150. AC_MSG_CHECKING([if xenstat.plugin should be enabled])
  1151. if test "${enable_plugin_xenstat}" != "no" -a "${have_libxenstat}" = "yes" -a "${have_libxenlight}" = "yes" -a "${have_libyajl}" = "yes"; then
  1152. enable_plugin_xenstat="yes"
  1153. AC_DEFINE([HAVE_LIBXENSTAT], [1], [libxenstat usability])
  1154. OPTIONAL_XENSTAT_CFLAGS="${XENLIGHT_CFLAGS} ${YAJL_CFLAGS}"
  1155. OPTIONAL_XENSTAT_LIBS="-lxenstat ${XENLIGHT_LIBS} ${YAJL_LIBS}"
  1156. else
  1157. enable_plugin_xenstat="no"
  1158. fi
  1159. AC_MSG_RESULT([${enable_plugin_xenstat}])
  1160. AM_CONDITIONAL([ENABLE_PLUGIN_XENSTAT], [test "${enable_plugin_xenstat}" = "yes"])
  1161. if test "${enable_plugin_xenstat}" == "yes"; then
  1162. AC_MSG_CHECKING([for xenstat_vbd_error in -lxenstat])
  1163. AC_TRY_LINK(
  1164. [ #include <xenstat.h> ],
  1165. [
  1166. xenstat_vbd * vbd;
  1167. int out = xenstat_vbd_error(vbd);
  1168. ],
  1169. [
  1170. have_xenstat_vbd_error=yes
  1171. AC_DEFINE([HAVE_XENSTAT_VBD_ERROR], [1], [xenstat_vbd_error usability])
  1172. ],
  1173. [ have_xenstat_vbd_error=no ]
  1174. )
  1175. AC_MSG_RESULT([${have_xenstat_vbd_error}])
  1176. fi
  1177. # -----------------------------------------------------------------------------
  1178. # perf.plugin
  1179. AC_CHECK_HEADER(
  1180. [linux/perf_event.h],
  1181. [AC_CHECK_DECL(
  1182. [PERF_COUNT_HW_REF_CPU_CYCLES],
  1183. [have_perf_event=yes],
  1184. [have_perf_event=no],
  1185. [#include <linux/perf_event.h>]
  1186. )],
  1187. [have_perf_event=no]
  1188. )
  1189. AC_MSG_CHECKING([if perf.plugin should be enabled])
  1190. if test "${build_target}" == "linux" -a "${have_perf_event}" = "yes"; then
  1191. AC_DEFINE([ENABLE_PERF_PLUGIN], [1], [perf.plugin])
  1192. enable_plugin_perf="yes"
  1193. else
  1194. enable_plugin_perf="no"
  1195. fi
  1196. AC_MSG_RESULT([${enable_plugin_perf}])
  1197. AM_CONDITIONAL([ENABLE_PLUGIN_PERF], [test "${enable_plugin_perf}" = "yes"])
  1198. # -----------------------------------------------------------------------------
  1199. # gtest/gmock
  1200. AC_MSG_CHECKING([if gtest and gmock can be found])
  1201. PKG_CHECK_MODULES([GTEST], [gtest], [have_gtest=yes], [have_gtest=no])
  1202. PKG_CHECK_MODULES([GMOCK], [gmock], [have_gmock=yes], [have_gmock=no])
  1203. if test "${have_gtest}" = "yes" -a "${have_gmock}" = "yes"; then
  1204. OPTIONAL_GTEST_CFLAGS="${GTEST_CFLAGS} ${GMOCK_CFLAGS}"
  1205. OPTIONAL_GTEST_LIBS="${GTEST_LIBS} ${GMOCK_LIBS}"
  1206. have_gtest="yes"
  1207. else
  1208. have_gtest="no"
  1209. fi
  1210. # -----------------------------------------------------------------------------
  1211. # ml - anomaly detection
  1212. # Check if uuid is available. Fail if ML was explicitly requested.
  1213. if test "${enable_ml}" = "yes" -a "${have_uuid}" != "yes"; then
  1214. AC_MSG_ERROR([You have explicitly requested --enable-ml functionality but libuuid can not be found.])
  1215. fi
  1216. # Check if submodules have not been fetched. Fail if ML was explicitly requested.
  1217. AC_MSG_CHECKING([if git submodules are present for machine learning functionality])
  1218. if test -f "ml/dlib/dlib/all/source.cpp"; then
  1219. AC_MSG_RESULT([yes])
  1220. have_ml_submodules="yes"
  1221. AC_DEFINE([HAVE_DLIB], [1], [dlib availability])
  1222. else
  1223. AC_MSG_RESULT([no])
  1224. have_ml_submodules="no"
  1225. fi
  1226. if test "${enable_ml}" = "yes" -a "${have_ml_submodules}" = "no"; then
  1227. AC_MSG_ERROR([You have explicitly requested --enable-ml functionality but it cannot be built because the required git submodules are missing.])
  1228. fi
  1229. if test "${enable_ml}" = "yes" -a "${have_cxx11}" = "no"; then
  1230. AC_MSG_ERROR([You have explicitly requested --enable-ml functionality but it cannot be built without a C++11 toolchain.])
  1231. fi
  1232. # Decide if we should build ML
  1233. if test "${enable_ml}" != "no" -a "${have_ml_submodules}" = "yes" -a "${have_cxx11}" = "yes" -a "${have_uuid}" = "yes"; then
  1234. build_ml="yes"
  1235. else
  1236. build_ml="no"
  1237. fi
  1238. AM_CONDITIONAL([ENABLE_ML], [test "${build_ml}" = "yes"])
  1239. if test "${build_ml}" = "yes"; then
  1240. AC_DEFINE([ENABLE_ML], [1], [anomaly detection usability])
  1241. OPTIONAL_ML_CFLAGS="-DDLIB_NO_GUI_SUPPORT -I \$(abs_top_srcdir)/ml/dlib"
  1242. OPTIONAL_ML_LIBS=""
  1243. fi
  1244. # -----------------------------------------------------------------------------
  1245. # debugfs.plugin
  1246. if test "${build_target}" = "linux"; then
  1247. AC_DEFINE([ENABLE_DEBUGFS_PLUGIN], [1], [debugfs.plugin])
  1248. enable_plugin_debugfs="yes"
  1249. else
  1250. enable_plugin_debugfs="no"
  1251. fi
  1252. AC_MSG_CHECKING([if debugfs.plugin should be enabled])
  1253. AC_MSG_RESULT([${enable_plugin_debugfs}])
  1254. AM_CONDITIONAL([ENABLE_PLUGIN_DEBUGFS], [test "${enable_plugin_debugfs}" = "yes"])
  1255. # -----------------------------------------------------------------------------
  1256. # ebpf.plugin
  1257. if test "${build_target}" = "linux" -a "${enable_ebpf}" != "no"; then
  1258. PKG_CHECK_MODULES(
  1259. [LIBELF],
  1260. [libelf],
  1261. [have_libelf=yes],
  1262. [have_libelf=no]
  1263. )
  1264. AC_CHECK_TYPE(
  1265. [struct bpf_prog_info],
  1266. [have_bpf=yes],
  1267. [have_bpf=no],
  1268. [#include <linux/bpf.h>]
  1269. )
  1270. AC_CHECK_FILE(
  1271. externaldeps/libbpf/libbpf.a,
  1272. [have_libbpf=yes],
  1273. [have_libbpf=no]
  1274. )
  1275. if test "${have_libelf}" = "yes" -a \
  1276. "${have_bpf}" = "yes" -a \
  1277. "${have_libbpf}" = "yes"; then
  1278. OPTIONAL_BPF_CFLAGS="${LIBELF_CFLAGS} -I \$(abs_top_srcdir)/externaldeps/libbpf/include -I \$(abs_top_srcdir)/externaldeps/libbpf/include/uapi"
  1279. OPTIONAL_BPF_LIBS="\$(abs_top_srcdir)/externaldeps/libbpf/libbpf.a ${LIBELF_LIBS}"
  1280. AC_DEFINE([HAVE_LIBBPF], [1], [libbpf usability])
  1281. enable_ebpf="yes"
  1282. else
  1283. enable_ebpf="no"
  1284. fi
  1285. else
  1286. enable_ebpf="no"
  1287. fi
  1288. AC_MSG_CHECKING([if ebpf.plugin should be enabled])
  1289. AC_MSG_RESULT([${enable_ebpf}])
  1290. AM_CONDITIONAL([ENABLE_PLUGIN_EBPF], [test "${enable_ebpf}" = "yes"])
  1291. # -----------------------------------------------------------------------------
  1292. # slabinfo.plugin
  1293. AC_MSG_CHECKING([if slabinfo.plugin should be enabled])
  1294. if test "${build_target}" == "linux"; then
  1295. AC_DEFINE([ENABLE_SLABINFO], [1], [slabinfo plugin])
  1296. enable_plugin_slabinfo="yes"
  1297. else
  1298. enable_plugin_slabinfo="no"
  1299. fi
  1300. AC_MSG_RESULT([${enable_plugin_slabinfo}])
  1301. AM_CONDITIONAL([ENABLE_PLUGIN_SLABINFO], [test "${enable_plugin_slabinfo}" = "yes"])
  1302. # -----------------------------------------------------------------------------
  1303. # AWS Kinesis exporting connector - libaws-cpp-sdk-kinesis, libaws-cpp-sdk-core, libssl, libcrypto, libcurl
  1304. PKG_CHECK_MODULES(
  1305. [LIBCRYPTO],
  1306. [libcrypto],
  1307. [AC_CHECK_LIB(
  1308. [crypto],
  1309. [CRYPTO_new_ex_data],
  1310. [have_libcrypto=yes],
  1311. [have_libcrypto=no]
  1312. )],
  1313. [have_libcrypto=no]
  1314. )
  1315. PKG_CHECK_MODULES(
  1316. [LIBSSL],
  1317. [libssl],
  1318. [AC_CHECK_LIB(
  1319. [ssl],
  1320. [SSL_connect],
  1321. [have_libssl=yes],
  1322. [have_libssl=no]
  1323. )],
  1324. [have_libssl=no]
  1325. )
  1326. PKG_CHECK_MODULES(
  1327. [LIBCURL],
  1328. [libcurl],
  1329. [AC_CHECK_LIB(
  1330. [curl],
  1331. [curl_easy_init],
  1332. [have_libcurl=yes],
  1333. [have_libcurl=no]
  1334. )],
  1335. [have_libcurl=no]
  1336. )
  1337. PKG_CHECK_MODULES(
  1338. [AWS_CPP_SDK_CORE],
  1339. [aws-cpp-sdk-core],
  1340. [have_libaws_cpp_sdk_core=yes],
  1341. [have_libaws_cpp_sdk_core=no]
  1342. )
  1343. PKG_CHECK_MODULES(
  1344. [AWS_CPP_SDK_KINESIS],
  1345. [aws-cpp-sdk-kinesis],
  1346. [have_libaws_cpp_sdk_kinesis=yes],
  1347. [have_libaws_cpp_sdk_kinesis=no]
  1348. )
  1349. test "${enable_exporting_kinesis}" = "yes" -a "${have_libaws_cpp_sdk_kinesis}" != "yes" && \
  1350. AC_MSG_ERROR([libaws-cpp-sdk-kinesis required but not found. try installing AWS C++ SDK])
  1351. test "${enable_exporting_kinesis}" = "yes" -a "${have_libaws_cpp_sdk_core}" != "yes" && \
  1352. AC_MSG_ERROR([libaws-cpp-sdk-core required but not found. try installing AWS C++ SDK])
  1353. test "${enable_exporting_kinesis}" = "yes" -a "${have_libcurl}" != "yes" && \
  1354. AC_MSG_ERROR([libcurl required but not found])
  1355. test "${enable_exporting_kinesis}" = "yes" -a "${have_libssl}" != "yes" && \
  1356. AC_MSG_ERROR([libssl required but not found])
  1357. test "${enable_exporting_kinesis}" = "yes" -a "${have_libcrypto}" != "yes" && \
  1358. AC_MSG_ERROR([libcrypto required but not found])
  1359. AC_MSG_CHECKING([if kinesis exporting connector should be enabled])
  1360. if test "${enable_exporting_kinesis}" != "no" -a "${have_libaws_cpp_sdk_kinesis}" = "yes" \
  1361. -a "${have_libaws_cpp_sdk_core}" = "yes" \
  1362. -a "${have_libcurl}" = "yes" \
  1363. -a "${have_libssl}" = "yes" \
  1364. -a "${have_libcrypto}" = "yes"; then
  1365. enable_exporting_kinesis="yes"
  1366. AC_DEFINE([HAVE_KINESIS], [1], [libaws-cpp-sdk-kinesis usability])
  1367. OPTIONAL_KINESIS_CFLAGS="${LIBCRYPTO_CFLAGS} ${LIBSSL_CFLAGS} ${LIBCURL_CFLAGS}"
  1368. OPTIONAL_KINESIS_CXXFLAGS="${AWS_CPP_SDK_KINESIS_CFLAGS} ${AWS_CPP_SDK_CORE_CFLAGS}"
  1369. OPTIONAL_KINESIS_LIBS="${AWS_CPP_SDK_KINESIS_LIBS} ${AWS_CPP_SDK_CORE_LIBS} \
  1370. ${LIBCRYPTO_LIBS} ${LIBSSL_LIBS} ${LIBCURL_LIBS}"
  1371. else
  1372. enable_exporting_kinesis="no"
  1373. fi
  1374. AC_MSG_RESULT([${enable_exporting_kinesis}])
  1375. AM_CONDITIONAL([ENABLE_EXPORTING_KINESIS], [test "${enable_exporting_kinesis}" = "yes"])
  1376. # -----------------------------------------------------------------------------
  1377. # Pub/Sub exporting connector - googleapis
  1378. PKG_CHECK_MODULES(
  1379. [GRPC],
  1380. [grpc],
  1381. [have_libgrpc=yes],
  1382. [have_libgrpc=no]
  1383. )
  1384. if test "${enable_exporting_pubsub}" != "no"; then
  1385. PKG_CHECK_MODULES(
  1386. [PUBSUB],
  1387. [google_cloud_cpp_pubsub_protos],
  1388. [have_pubsub_protos=yes],
  1389. [have_pubsub_protos=no]
  1390. )
  1391. fi
  1392. AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
  1393. AS_IF(
  1394. [test x"${CXX_BINARY}" == x"no"],
  1395. [have_CXX_compiler=no],
  1396. [have_CXX_compiler=yes]
  1397. )
  1398. test "${enable_pubsub}" = "yes" -a "${have_grpc}" != "yes" && \
  1399. AC_MSG_ERROR([libgrpc required but not found. try installing grpc])
  1400. test "${enable_pubsub}" = "yes" -a "${have_pubsub_protos}" != "yes" && \
  1401. AC_MSG_ERROR([libgoogleapis_cpp_pubsub_protos required but not found. try installing googleapis])
  1402. test "${enable_exporting_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler}" != "yes" && \
  1403. AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
  1404. AC_MSG_CHECKING([if pubsub exporting connector should be enabled])
  1405. if test "${enable_exporting_pubsub}" != "no" -a "${have_pubsub_protos}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
  1406. enable_exporting_pubsub="yes"
  1407. AC_DEFINE([ENABLE_EXPORTING_PUBSUB], [1], [Pub/Sub API usability])
  1408. OPTIONAL_PUBSUB_CFLAGS="${GRPC_CFLAGS} ${PUBSUB_CFLAGS}"
  1409. OPTIONAL_PUBSUB_LIBS="${GRPC_LIBS} ${PUBSUB_LIBS}"
  1410. else
  1411. enable_pubsub="no"
  1412. fi
  1413. AC_MSG_RESULT([${enable_exporting_pubsub}])
  1414. AM_CONDITIONAL([ENABLE_EXPORTING_PUBSUB], [test "${enable_exporting_pubsub}" = "yes"])
  1415. # -----------------------------------------------------------------------------
  1416. # Prometheus remote write exporting connector - libprotobuf, libsnappy, protoc
  1417. AC_MSG_CHECKING([for snappy::RawCompress in -lsnappy])
  1418. AC_LANG_SAVE
  1419. AC_LANG_CPLUSPLUS
  1420. save_LIBS="${LIBS}"
  1421. LIBS="-lsnappy"
  1422. save_CXXFLAGS="${CXXFLAGS}"
  1423. CXXFLAGS="${CXXFLAGS} ${CPP_STD_FLAG}"
  1424. AC_TRY_LINK(
  1425. [
  1426. #include <stdlib.h>
  1427. #include <snappy.h>
  1428. ],
  1429. [
  1430. const char *input = "test";
  1431. size_t compressed_length;
  1432. char *buffer = (char *)malloc(5 * sizeof(char));
  1433. snappy::RawCompress(input, 4, buffer, &compressed_length);
  1434. free(buffer);
  1435. ],
  1436. [
  1437. have_libsnappy=yes
  1438. SNAPPY_CFLAGS=""
  1439. SNAPPY_LIBS="-lsnappy"
  1440. ],
  1441. [have_libsnappy=no]
  1442. )
  1443. LIBS="${save_LIBS}"
  1444. CXXFLAGS="${save_CXXFLAGS}"
  1445. AC_LANG_RESTORE
  1446. AC_MSG_RESULT([${have_libsnappy}])
  1447. test "${enable_exporting_prometheus_remote_write}" = "yes" -a "${have_libprotobuf}" != "yes" && \
  1448. AC_MSG_ERROR([libprotobuf required but not found. try installing protobuf])
  1449. test "${enable_exporting_prometheus_remote_write}" = "yes" -a "${have_libsnappy}" != "yes" && \
  1450. AC_MSG_ERROR([libsnappy required but not found. try installing snappy])
  1451. test "${enable_exporting_prometheus_remote_write}" = "yes" -a "${have_protoc}" != "yes" && \
  1452. AC_MSG_ERROR([protoc compiler required but not found. try installing protobuf])
  1453. test "${enable_exporting_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler}" != "yes" && \
  1454. AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
  1455. AC_MSG_CHECKING([if prometheus remote write exporting connector should be enabled])
  1456. if test "${enable_exporting_prometheus_remote_write}" != "no" -a "${have_libprotobuf}" = "yes" -a "${have_libsnappy}" = "yes" \
  1457. -a "${have_protoc}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
  1458. enable_exporting_prometheus_remote_write="yes"
  1459. AC_DEFINE([ENABLE_PROMETHEUS_REMOTE_WRITE], [1], [Prometheus remote write API usability])
  1460. OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS="${SNAPPY_CFLAGS} -I \$(abs_top_srcdir)/exporting/prometheus/remote_write"
  1461. OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS="${SNAPPY_LIBS}"
  1462. OPTIONAL_PROTOBUF_CFLAGS="${PROTOBUF_CFLAGS}"
  1463. OPTIONAL_PROTOBUF_LIBS="${PROTOBUF_LIBS}"
  1464. else
  1465. enable_exporting_prometheus_remote_write="no"
  1466. fi
  1467. AC_MSG_RESULT([${enable_exporting_prometheus_remote_write}])
  1468. AM_CONDITIONAL([ENABLE_EXPORTING_PROMETHEUS_REMOTE_WRITE], [test "${enable_exporting_prometheus_remote_write}" = "yes"])
  1469. # -----------------------------------------------------------------------------
  1470. # MongoDB exporting connector - libmongoc
  1471. PKG_CHECK_MODULES(
  1472. [LIBMONGOC],
  1473. [libmongoc-1.0 >= 1.7],
  1474. [have_libmongoc=yes],
  1475. [have_libmongoc=no]
  1476. )
  1477. test "${enable_exporting_mongodb}" = "yes" -a "${have_libmongoc}" != "yes" && \
  1478. AC_MSG_ERROR([libmongoc required but not found. Try installing `mongoc`.])
  1479. AC_MSG_CHECKING([if mongodb exporting connector should be enabled])
  1480. if test "${enable_exporting_mongodb}" != "no" -a "${have_libmongoc}" = "yes"; then
  1481. enable_exporting_mongodb="yes"
  1482. AC_DEFINE([HAVE_MONGOC], [1], [libmongoc usability])
  1483. OPTIONAL_MONGOC_CFLAGS="${LIBMONGOC_CFLAGS}"
  1484. OPTIONAL_MONGOC_LIBS="${LIBMONGOC_LIBS}"
  1485. else
  1486. enable_exporting_mongodb="no"
  1487. fi
  1488. AC_MSG_RESULT([${enable_exporting_mongodb}])
  1489. AM_CONDITIONAL([ENABLE_EXPORTING_MONGODB], [test "${enable_exporting_mongodb}" = "yes"])
  1490. # -----------------------------------------------------------------------------
  1491. # check for setns() - cgroup-network
  1492. AC_CHECK_FUNC([setns])
  1493. AC_MSG_CHECKING([if cgroup-network can be enabled])
  1494. if test "$ac_cv_func_setns" = "yes" ; then
  1495. have_setns="yes"
  1496. AC_DEFINE([HAVE_SETNS], [1], [Define 1 if you have setns() function])
  1497. else
  1498. have_setns="no"
  1499. fi
  1500. AC_MSG_RESULT([${have_setns}])
  1501. AM_CONDITIONAL([ENABLE_PLUGIN_CGROUP_NETWORK], [test "${have_setns}" = "yes"])
  1502. # -----------------------------------------------------------------------------
  1503. # Link-Time-Optimization
  1504. if test "${enable_lto}" != "no"; then
  1505. opt="-flto"
  1506. AX_CHECK_COMPILE_FLAG(${opt}, [have_lto=yes], [have_lto=no])
  1507. fi
  1508. if test "${have_lto}" = "yes"; then
  1509. oCFLAGS="${CFLAGS}"
  1510. CFLAGS="${CFLAGS} -flto"
  1511. ac_cv_c_lto_cross_compile="${enable_lto}"
  1512. test "${ac_cv_c_lto_cross_compile}" != "yes" && ac_cv_c_lto_cross_compile="no"
  1513. AC_C_LTO
  1514. CFLAGS="${oCFLAGS}"
  1515. test "${ac_cv_c_lto}" != "yes" && have_lto="no"
  1516. fi
  1517. test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
  1518. AC_MSG_ERROR([LTO is required but is not available.])
  1519. AC_MSG_CHECKING([if LTO should be enabled])
  1520. if test "${enable_lto}" != "no" -a "${have_lto}" = "yes"; then
  1521. enable_lto="yes"
  1522. OPTIONAL_LTO_CFLAGS="-flto"
  1523. else
  1524. enable_lto="no"
  1525. fi
  1526. AC_MSG_RESULT([${enable_lto}])
  1527. # -----------------------------------------------------------------------------
  1528. # Try to unconditionally link with -latomic. If the compiler can satisfy
  1529. # all the atomic ops with builtins then, the library will be left unused.
  1530. # Otherwise, some ops will be covered by the compiler's intrinsics and some
  1531. # will be picked up by the linker from -latomic. In the later case, if
  1532. # -latomic is not available there will be a build failure, which would
  1533. # have happened either way before this change.
  1534. AC_LANG_PUSH([C++])
  1535. AC_MSG_CHECKING(whether we can use -latomic)
  1536. OLD_LIBS="${LIBS}"
  1537. LIBS="-latomic"
  1538. AC_LINK_IFELSE([AC_LANG_SOURCE([[
  1539. #include <atomic>
  1540. #include <cstdint>
  1541. std::atomic<std::int64_t> v;
  1542. int main() {
  1543. return v;
  1544. }
  1545. ]])], CAN_USE_LIBATOMIC=yes, CAN_USE_LIBATOMIC=no)
  1546. LIBS="${OLD_LIBS}"
  1547. AC_MSG_RESULT($CAN_USE_LIBATOMIC)
  1548. if test "x$CAN_USE_LIBATOMIC" = xyes; then
  1549. OPTIONAL_ATOMIC_LIBS="-latomic"
  1550. fi
  1551. AC_SUBST([OPTIONAL_ATOMIC_LIBS])
  1552. AC_LANG_POP([C++])
  1553. # -----------------------------------------------------------------------------
  1554. AC_MSG_CHECKING(whether we can use dlsym)
  1555. OLD_LIBS="${LIBS}"
  1556. LIBS="-ldl"
  1557. AC_LINK_IFELSE([AC_LANG_SOURCE([[
  1558. #include <dlfcn.h>
  1559. static void *(*libc_malloc)(size_t);
  1560. int main() {
  1561. libc_malloc = dlsym(RTLD_NEXT, "malloc");
  1562. }
  1563. ]])], CAN_USE_DLSYM=yes, CAN_USE_DLSYM=no)
  1564. LIBS="${OLD_LIBS}"
  1565. AC_MSG_RESULT($CAN_USE_DLSYM)
  1566. if test "x$CAN_USE_DLSYM" = xyes; then
  1567. AC_DEFINE([HAVE_DLSYM], [1], [dlsym usability])
  1568. OPTIONAL_DL_LIBS="-ldl"
  1569. fi
  1570. AC_SUBST([OPTIONAL_DL_LIBS])
  1571. # -----------------------------------------------------------------------------
  1572. AC_DEFINE_UNQUOTED([NETDATA_USER], ["${with_user}"], [use this user to drop privileged])
  1573. varlibdir="${localstatedir}/lib/netdata"
  1574. registrydir="${localstatedir}/lib/netdata/registry"
  1575. cachedir="${localstatedir}/cache/netdata"
  1576. chartsdir="${libexecdir}/netdata/charts.d"
  1577. pythondir="${libexecdir}/netdata/python.d"
  1578. configdir="${sysconfdir}/netdata"
  1579. libconfigdir="${libdir}/netdata/conf.d"
  1580. logdir="${localstatedir}/log/netdata"
  1581. pluginsdir="${libexecdir}/netdata/plugins.d"
  1582. netdata_user="${with_user}"
  1583. libsysdir="${libdir}/netdata/system"
  1584. AC_SUBST([varlibdir])
  1585. AC_SUBST([registrydir])
  1586. AC_SUBST([cachedir])
  1587. AC_SUBST([chartsdir])
  1588. AC_SUBST([pythondir])
  1589. AC_SUBST([configdir])
  1590. AC_SUBST([libconfigdir])
  1591. AC_SUBST([logdir])
  1592. AC_SUBST([pluginsdir])
  1593. AC_SUBST([webdir])
  1594. AC_SUBST([netdata_user])
  1595. AC_SUBST([libsysdir])
  1596. CFLAGS="${originalCFLAGS} ${OPTIONAL_LTO_CFLAGS} ${OPTIONAL_PROTOBUF_CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} \
  1597. ${ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \
  1598. ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \
  1599. ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PUBSUB_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} \
  1600. ${OPTIONAL_MONGOC_CFLAGS} ${LWS_CFLAGS} ${OPTIONAL_JSONC_STATIC_CFLAGS} ${OPTIONAL_YAML_STATIC_CFLAGS} ${OPTIONAL_BPF_CFLAGS} ${JUDY_CFLAGS} \
  1601. ${OPTIONAL_ACLK_CFLAGS} ${OPTIONAL_ML_CFLAGS} ${OPTIONAL_OS_DEP_CFLAGS} ${H2O_CFLAGS} ${HARDENING_CFLAGS}"
  1602. CXXFLAGS="${CFLAGS} ${OPTIONAL_KINESIS_CXXFLAGS} ${CPP_STD_FLAG}"
  1603. CPPFLAGS="\
  1604. -DVARLIB_DIR=\"\\\"${varlibdir}\\\"\" \
  1605. -DCACHE_DIR=\"\\\"${cachedir}\\\"\" \
  1606. -DCONFIG_DIR=\"\\\"${configdir}\\\"\" \
  1607. -DLIBCONFIG_DIR=\"\\\"${libconfigdir}\\\"\" \
  1608. -DLOG_DIR=\"\\\"${logdir}\\\"\" \
  1609. -DPLUGINS_DIR=\"\\\"${pluginsdir}\\\"\" \
  1610. -DRUN_DIR=\"\\\"${localstatedir}/run/netdata\\\"\" \
  1611. -DWEB_DIR=\"\\\"${webdir}\\\"\" \
  1612. "
  1613. AC_SUBST([OPTIONAL_MATH_CFLAGS])
  1614. AC_SUBST([OPTIONAL_MATH_LIBS])
  1615. AC_SUBST([OPTIONAL_DATACHANNEL_LIBS])
  1616. AC_SUBST([OPTIONAL_UV_LIBS])
  1617. AC_SUBST([OPTIONAL_LZ4_LIBS])
  1618. AC_SUBST([OPTIONAL_SSL_LIBS])
  1619. AC_SUBST([OPTIONAL_JSONC_LIBS])
  1620. AC_SUBST([OPTIONAL_YAML_LIBS])
  1621. AC_SUBST([OPTIONAL_NFACCT_CFLAGS])
  1622. AC_SUBST([OPTIONAL_NFACCT_LIBS])
  1623. AC_SUBST([ZLIB_CFLAGS])
  1624. AC_SUBST([ZLIB_LIBS])
  1625. AC_SUBST([OPTIONAL_UUID_CFLAGS])
  1626. AC_SUBST([OPTIONAL_UUID_LIBS])
  1627. AC_SUBST([OPTIONAL_BPF_CFLAGS])
  1628. AC_SUBST([OPTIONAL_BPF_LIBS])
  1629. AC_SUBST([OPTIONAL_MQTT_LIBS])
  1630. AC_SUBST([OPTIONAL_LIBCAP_CFLAGS])
  1631. AC_SUBST([OPTIONAL_LIBCAP_LIBS])
  1632. AC_SUBST([OPTIONAL_IPMIMONITORING_CFLAGS])
  1633. AC_SUBST([OPTIONAL_IPMIMONITORING_LIBS])
  1634. AC_SUBST([OPTIONAL_CUPS_CFLAGS])
  1635. AC_SUBST([OPTIONAL_CUPS_LIBS])
  1636. AC_SUBST([OPTIONAL_XENSTAT_CFLAGS])
  1637. AC_SUBST([OPTIONAL_XENSTAT_LIBS])
  1638. AC_SUBST([OPTIONAL_KINESIS_CFLAGS])
  1639. AC_SUBST([OPTIONAL_KINESIS_LIBS])
  1640. AC_SUBST([OPTIONAL_PUBSUB_CFLAGS])
  1641. AC_SUBST([OPTIONAL_PUBSUB_LIBS])
  1642. AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS])
  1643. AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS])
  1644. AC_SUBST([OPTIONAL_MONGOC_CFLAGS])
  1645. AC_SUBST([OPTIONAL_MONGOC_LIBS])
  1646. AC_SUBST([OPTIONAL_LWS_LIBS])
  1647. AC_SUBST([OPTIONAL_ACLK_CFLAGS])
  1648. AC_SUBST([OPTIONAL_PROTOBUF_CFLAGS])
  1649. AC_SUBST([OPTIONAL_PROTOBUF_LIBS])
  1650. AC_SUBST([OPTIONAL_GTEST_CFLAGS])
  1651. AC_SUBST([OPTIONAL_GTEST_LIBS])
  1652. AC_SUBST([OPTIONAL_ML_CFLAGS])
  1653. AC_SUBST([OPTIONAL_ML_LIBS])
  1654. AC_SUBST(OPTIONAL_SYSTEMD_LIBS)
  1655. # -----------------------------------------------------------------------------
  1656. # Check if cmocka is available - needed for unit testing
  1657. AC_ARG_ENABLE(
  1658. [unit-tests],
  1659. [AS_HELP_STRING([--disable-unit-tests],
  1660. [Disables building and running the unit tests suite])],
  1661. [],
  1662. [enable_unit_tests="yes"]
  1663. )
  1664. PKG_CHECK_MODULES(
  1665. [CMOCKA],
  1666. [cmocka],
  1667. [have_cmocka="yes"],
  1668. [AC_MSG_NOTICE([CMocka not found on the system. Unit tests disabled])]
  1669. )
  1670. AM_CONDITIONAL([ENABLE_UNITTESTS], [test "${enable_unit_tests}" = "yes" -a "${have_cmocka}" = "yes" ])
  1671. AC_SUBST([ENABLE_UNITTESTS])
  1672. TEST_CFLAGS="${CFLAGS} ${CMOCKA_CFLAGS}"
  1673. TEST_LIBS="${CMOCKA_LIBS}"
  1674. AC_SUBST([TEST_CFLAGS])
  1675. AC_SUBST([TEST_LIBS])
  1676. # -----------------------------------------------------------------------------
  1677. # save configure options for build info
  1678. AC_DEFINE_UNQUOTED(
  1679. [CONFIGURE_COMMAND],
  1680. ["$ac_configure_args"],
  1681. [options passed to configure script]
  1682. )
  1683. AC_CONFIG_FILES([
  1684. Makefile
  1685. netdata.spec
  1686. collectors/Makefile
  1687. collectors/apps.plugin/Makefile
  1688. collectors/cgroups.plugin/Makefile
  1689. collectors/charts.d.plugin/Makefile
  1690. collectors/debugfs.plugin/Makefile
  1691. collectors/diskspace.plugin/Makefile
  1692. collectors/timex.plugin/Makefile
  1693. collectors/ioping.plugin/Makefile
  1694. collectors/freebsd.plugin/Makefile
  1695. collectors/freeipmi.plugin/Makefile
  1696. collectors/cups.plugin/Makefile
  1697. collectors/idlejitter.plugin/Makefile
  1698. collectors/macos.plugin/Makefile
  1699. collectors/nfacct.plugin/Makefile
  1700. collectors/plugins.d/Makefile
  1701. collectors/proc.plugin/Makefile
  1702. collectors/python.d.plugin/Makefile
  1703. collectors/slabinfo.plugin/Makefile
  1704. collectors/statsd.plugin/Makefile
  1705. collectors/ebpf.plugin/Makefile
  1706. collectors/tc.plugin/Makefile
  1707. collectors/xenstat.plugin/Makefile
  1708. collectors/perf.plugin/Makefile
  1709. collectors/systemd-journal.plugin/Makefile
  1710. daemon/Makefile
  1711. database/Makefile
  1712. database/contexts/Makefile
  1713. database/engine/Makefile
  1714. database/ram/Makefile
  1715. database/sqlite/Makefile
  1716. diagrams/Makefile
  1717. exporting/Makefile
  1718. exporting/graphite/Makefile
  1719. exporting/json/Makefile
  1720. exporting/opentsdb/Makefile
  1721. exporting/prometheus/Makefile
  1722. exporting/prometheus/remote_write/Makefile
  1723. exporting/aws_kinesis/Makefile
  1724. exporting/pubsub/Makefile
  1725. exporting/mongodb/Makefile
  1726. exporting/tests/Makefile
  1727. health/Makefile
  1728. health/notifications/Makefile
  1729. libnetdata/Makefile
  1730. libnetdata/tests/Makefile
  1731. libnetdata/adaptive_resortable_list/Makefile
  1732. libnetdata/aral/Makefile
  1733. libnetdata/avl/Makefile
  1734. libnetdata/buffer/Makefile
  1735. libnetdata/clocks/Makefile
  1736. libnetdata/completion/Makefile
  1737. libnetdata/config/Makefile
  1738. libnetdata/dictionary/Makefile
  1739. libnetdata/ebpf/Makefile
  1740. libnetdata/eval/Makefile
  1741. libnetdata/facets/Makefile
  1742. libnetdata/july/Makefile
  1743. libnetdata/locks/Makefile
  1744. libnetdata/log/Makefile
  1745. libnetdata/onewayalloc/Makefile
  1746. libnetdata/popen/Makefile
  1747. libnetdata/procfile/Makefile
  1748. libnetdata/simple_pattern/Makefile
  1749. libnetdata/socket/Makefile
  1750. libnetdata/statistical/Makefile
  1751. libnetdata/string/Makefile
  1752. libnetdata/storage_number/Makefile
  1753. libnetdata/storage_number/tests/Makefile
  1754. libnetdata/threads/Makefile
  1755. libnetdata/url/Makefile
  1756. libnetdata/json/Makefile
  1757. libnetdata/health/Makefile
  1758. libnetdata/worker_utilization/Makefile
  1759. registry/Makefile
  1760. streaming/Makefile
  1761. system/Makefile
  1762. tests/Makefile
  1763. web/Makefile
  1764. web/api/Makefile
  1765. web/api/badges/Makefile
  1766. web/api/exporters/Makefile
  1767. web/api/exporters/shell/Makefile
  1768. web/api/exporters/prometheus/Makefile
  1769. web/api/formatters/Makefile
  1770. web/api/formatters/csv/Makefile
  1771. web/api/formatters/json/Makefile
  1772. web/api/formatters/ssv/Makefile
  1773. web/api/formatters/value/Makefile
  1774. web/api/queries/Makefile
  1775. web/api/queries/average/Makefile
  1776. web/api/queries/countif/Makefile
  1777. web/api/queries/des/Makefile
  1778. web/api/queries/incremental_sum/Makefile
  1779. web/api/queries/max/Makefile
  1780. web/api/queries/median/Makefile
  1781. web/api/queries/min/Makefile
  1782. web/api/queries/percentile/Makefile
  1783. web/api/queries/ses/Makefile
  1784. web/api/queries/stddev/Makefile
  1785. web/api/queries/sum/Makefile
  1786. web/api/queries/trimmed_mean/Makefile
  1787. web/api/health/Makefile
  1788. web/gui/Makefile
  1789. web/gui/v1/Makefile
  1790. web/gui/v2/Makefile
  1791. web/rtc/Makefile
  1792. web/server/Makefile
  1793. web/server/static/Makefile
  1794. claim/Makefile
  1795. spawn/Makefile
  1796. ])
  1797. AC_OUTPUT
  1798. test "${with_math}" != "yes" && AC_MSG_WARN([You are building without math. math allows accurate calculations. It should be enabled.]) || :