Check if ACLK can be built (#8030)
* if ACLK enabled require libwebsockets.a
Timo committed
Feb 11, 2020 at 21:55 UTC
d06af6600a2a65cbc2e3131a86acb43317be0f30
3 files changed
+55
-10
Makefile.am
+1
-1
@@ -594,7 +594,7 @@ netdata_SOURCES = $(NETDATA_FILES)
594
595
if ENABLE_ACLK
596
netdata_LDADD = \
597
- mosquitto/lib/libmosquitto.a \
597
+ externaldeps/mosquitto/libmosquitto.a \
598
$(NETDATA_COMMON_LIBS) \
599
$(NULL)
600
else
aclk/mqtt.h
+1
-1
@@ -4,7 +4,7 @@
4
#define NETDATA_MQTT_H
5
6
#ifdef ENABLE_ACLK
7
-#include "mosquitto/lib/mosquitto.h"
7
+#include "externaldeps/mosquitto/mosquitto.h"
8
#endif
9
10
void _show_mqtt_info();
configure.ac
+53
-8
@@ -161,6 +161,14 @@ AC_ARG_ENABLE(
161
,
162
[enable_jsonc="detect"]
163
)
164
+if test "${ACLK}" = "yes"; then
165
+AC_ARG_ENABLE(
166
+ [aclk],
167
+ ,
168
+ [aclk_required="${enableval}"],
169
+ [aclk_required="detect"]
170
+)
171
+fi
172
173
# -----------------------------------------------------------------------------
174
# netdata required checks
@@ -295,6 +303,17 @@ AC_CHECK_LIB(
303
[LZ4_LIBS="-llz4"]
304
)
305
306
+# -----------------------------------------------------------------------------
307
+# libwebsockets pure C library for implementing modern network protocols
308
+
309
+if test "${ACLK}" = "yes"; then
310
+ AC_CHECK_LIB(
311
+ [websockets],
312
+ [lws_set_timer_usecs],
313
+ [LWS_LIBS="-lwebsockets"]
314
+ )
315
+fi
316
+
317
318
# -----------------------------------------------------------------------------
319
# Judy General purpose dynamic array
@@ -409,15 +428,41 @@ AM_CONDITIONAL([ENABLE_HTTPS], [test "${enable_https}" = "yes"])
428
429
# -----------------------------------------------------------------------------
430
# ACLK
412
-AC_MSG_CHECKING([if netdata ACLK should be enabled])
431
+
432
+#currenlty env var ACLK must be set to 'yes' to even consider building ACLK
433
if test "${ACLK}" = "yes"; then
414
- enable_aclk="yes"
415
- AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
416
- CFLAGS="${CFLAGS} -DENABLE_ACLK"
417
-else
418
- enable_aclk="no"
434
+ AC_MSG_CHECKING([if libmosquitto static lib is present])
435
+ if test -f "externaldeps/mosquitto/libmosquitto.a"; then
436
+ HAVE_libmosquitto_a="yes"
437
+ else
438
+ HAVE_libmosquitto_a="no"
439
+ fi
440
+ AC_MSG_RESULT([${HAVE_libmosquitto_a}])
441
+
442
+ AC_MSG_CHECKING([if netdata agent-cloud-link can be enabled])
443
+ if test "${HAVE_libmosquitto_a}" = "yes" -a -n "${LWS_LIBS}"; then
444
+ can_enable_aclk="yes"
445
+ else
446
+ can_enable_aclk="no"
447
+ fi
448
+ AC_MSG_RESULT([${can_enable_aclk}])
449
+
450
+ test "${aclk_required}" = "yes" -a "${can_enable_aclk}" = "no" && \
451
+ AC_MSG_ERROR([User required agent-cloud-link but it can't be built!])
452
+
453
+ AC_MSG_CHECKING([if netdata agent-cloud-link should/will be enabled])
454
+ if test "${aclk_required}" = "detect"; then
455
+ enable_aclk=$can_enable_aclk
456
+ else
457
+ enable_aclk=$aclk_required
458
+ fi
459
+
460
+ if test "${enable_aclk}" = "yes"; then
461
+ AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
462
+ fi
463
+
464
+ AC_MSG_RESULT([${enable_aclk}])
465
fi
420
-AC_MSG_RESULT([${enable_aclk}])
466
AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"])
467
468
# -----------------------------------------------------------------------------
@@ -1129,7 +1174,7 @@ AC_SUBST([webdir])
1174
1175
CFLAGS="${CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} ${OPTIONAL_ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \
1176
${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \
1132
- ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} ${OPTIONAL_MONGOC_CFLAGS}"
1177
+ ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} ${OPTIONAL_MONGOC_CFLAGS} ${LWS_LIBS}"
1178
1179
CXXFLAGS="${CFLAGS} ${CXX11FLAG}"
1180