diff options
author | Timotej S <6674623+underhood@users.noreply.github.com> | 2021-05-06 18:06:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-06 18:06:00 +0200 |
commit | 2973275191176fad8d2c3a2a3d9a917dd8746168 (patch) | |
tree | 1af9ad7e26b18788eab38e9f26b905f1c210cb04 | |
parent | 673bd3a5026417af2b0ab029dbece0abe283accc (diff) |
build mqtt_websockets with netdata autotools (#11083)
* build mqtt_websockets with netdata autotools
* avoids handwritten makefiles in submodules
-rw-r--r-- | Makefile.am | 29 | ||||
-rw-r--r-- | configure.ac | 49 | ||||
m--------- | mqtt_websockets | 36 |
3 files changed, 68 insertions, 46 deletions
diff --git a/Makefile.am b/Makefile.am index 2e3fe4c842..ba2ce1d05b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -117,11 +117,7 @@ SUBDIRS += \ spawn \ $(NULL) -if ACLK_NG -SUBDIRS += \ - mqtt_websockets \ - $(NULL) -else +if !ACLK_NG SUBDIRS += \ aclk/legacy \ $(NULL) @@ -562,6 +558,17 @@ ACLK_FILES = \ aclk/aclk_rx_msgs.h \ aclk/https_client.c \ aclk/https_client.h \ + mqtt_websockets/src/mqtt_wss_client.c \ + mqtt_websockets/src/include/mqtt_wss_client.h \ + mqtt_websockets/src/mqtt_wss_log.c \ + mqtt_websockets/src/include/mqtt_wss_log.h \ + mqtt_websockets/src/ws_client.c \ + mqtt_websockets/src/include/ws_client.h \ + mqtt_websockets/c-rbuf/src/ringbuffer.c \ + mqtt_websockets/c-rbuf/include/ringbuffer.h \ + mqtt_websockets/c-rbuf/src/ringbuffer_internal.h \ + mqtt_websockets/MQTT-C/src/mqtt.c \ + mqtt_websockets/MQTT-C/include/mqtt.h \ $(NULL) else #ACLK_NG ACLK_FILES = \ @@ -755,23 +762,19 @@ NETDATACLI_FILES = \ sbin_PROGRAMS += netdata netdata_SOURCES = $(NETDATA_FILES) -if ACLK_NG + netdata_LDADD = \ - mqtt_websockets/libmqttwebsockets.a \ $(NETDATA_COMMON_LIBS) \ $(NULL) -else #ACLK_NG + +if !ACLK_NG if ENABLE_ACLK -netdata_LDADD = \ +netdata_LDADD += \ externaldeps/mosquitto/libmosquitto.a \ $(OPTIONAL_LIBCAP_LIBS) \ $(OPTIONAL_LWS_LIBS) \ $(NETDATA_COMMON_LIBS) \ $(NULL) -else #ENABLE_ACLK -netdata_LDADD = \ - $(NETDATA_COMMON_LIBS) \ - $(NULL) endif #ENABLE_ACLK endif #ACLK_NG diff --git a/configure.ac b/configure.ac index 031351ab74..7bf0a9c7ba 100644 --- a/configure.ac +++ b/configure.ac @@ -738,24 +738,43 @@ if test "$enable_cloud" = "no" -a "$aclk_ng" = "yes"; then fi if test "$enable_cloud" != "no" -a "$aclk_ng" != "no"; then + can_enable_ng="yes" + AC_MSG_CHECKING([if git submodules present for ACLK Next Generation]) + if test -f "mqtt_websockets/src/mqtt_wss_client.c"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + can_enable_ng="no" + fi + AC_MSG_CHECKING([if SSL available for ACLK Next Generation]) + if test -n "${SSL_LIBS}"; then + AC_MSG_RESULT([yes]) + OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}" + OPTIONAL_SSL_LIBS="${SSL_LIBS}" + else + AC_MSG_RESULT([no]) + fi AC_MSG_CHECKING([if JSON-C available for ACLK Next Generation]) if test "$enable_jsonc" != "yes"; then AC_MSG_RESULT([no]) + can_enable_ng="no" else AC_MSG_RESULT([yes]) - if test "$aclk_ng" != "yes" -a "$enable_aclk" == "no"; then #default "fallback" - AC_MSG_NOTICE([ACLK Legacy could not be built. Trying ACLK-NG as fallback.]) - aclk_ng="yes" - fi - if test "$aclk_ng" = "yes"; then - #TODO Check OpenSSL and JSON-C - AC_MSG_CHECKING([if ACLK Next Generation can be built]) - AC_DEFINE([ACLK_NG], [1], [ACLK Next Generation Should be used]) - AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK]) - enable_aclk="yes" - AC_MSG_RESULT([yes]) - OPTIONAL_MQTT_WSS_CFLAGS="-Imqtt_websockets/src/include" - fi + fi + AC_MSG_CHECKING([ACLK Next Generation can be built]) + AC_MSG_RESULT([${can_enable_ng}]) + if test "$aclk_ng" = "yes" -a "$can_enable_ng" != "yes"; then + AC_MSG_ERROR([ACLK-NG requested but can't be built]) + fi + if test "$aclk_ng" != "yes" -a "$enable_aclk" == "no" -a "$can_enable_ng" = "yes"; then #default "fallback" + AC_MSG_NOTICE([ACLK Legacy could not be built. Trying ACLK-NG as fallback.]) + aclk_ng="yes" + fi + if test "$aclk_ng" = "yes"; then + AC_DEFINE([ACLK_NG], [1], [ACLK Next Generation Should be used]) + AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK]) + enable_aclk="yes" + OPTIONAL_ACLK_NG_CFLAGS="-Imqtt_websockets/src/include -Imqtt_websockets/c-rbuf/include -Imqtt_websockets/MQTT-C/include" fi fi AC_SUBST([enable_cloud]) @@ -1458,7 +1477,7 @@ CFLAGS="${CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} ${OPTIONAL_Z ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \ ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PUBSUB_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} \ ${OPTIONAL_MONGOC_CFLAGS} ${LWS_CFLAGS} ${OPTIONAL_JSONC_STATIC_CFLAGS} ${OPTIONAL_BPF_CFLAGS} ${OPTIONAL_JUDY_CFLAGS} \ - ${OPTIONAL_MQTT_WSS_CFLAGS}" + ${OPTIONAL_ACLK_NG_CFLAGS}" CXXFLAGS="${CFLAGS} ${CXX11FLAG}" @@ -1508,7 +1527,7 @@ AC_SUBST([OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS]) AC_SUBST([OPTIONAL_MONGOC_CFLAGS]) AC_SUBST([OPTIONAL_MONGOC_LIBS]) AC_SUBST([OPTIONAL_LWS_LIBS]) -AC_SUBST([OPTIONAL_MQTT_WSS_CFLAGS]) +AC_SUBST([OPTIONAL_ACLK_NG_CFLAGS]) # ----------------------------------------------------------------------------- # Check if cmocka is available - needed for unit testing diff --git a/mqtt_websockets b/mqtt_websockets -Subproject 232c7618305eb4f4ec25d3217de145b49eb04c4 +Subproject 613089e91ed0779dc8ebba60394e648400560b0 |