summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2021-11-08 07:49:18 -0500
committerGitHub <noreply@github.com>2021-11-08 07:49:18 -0500
commita67c830243a12ac7ce9d46aa5f5aef6c2374ec39 (patch)
treed6bdcd4699baf7a6c31a163a45b53eb9f1ca1b95
parent989c68cac8ae800e369ceac1abc825846982ff34 (diff)
Add protobuf to `-W buildinfo` output. (#11634)
* Re-sort buildinfo macros. * Add protobuf to buildinfo output. * Add info about whether protobuf is from the system or bundled. * Reorganize checks to be slightly saner. * Move declaration to the correct place.
-rw-r--r--configure.ac5
-rw-r--r--daemon/buildinfo.c57
2 files changed, 44 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index 4b42d8481b..f9d051548d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -700,6 +700,7 @@ AS_IF(
)
else
AC_MSG_NOTICE([using bundled protobuf])
+ AC_DEFINE([BUNDLED_PROTOBUF], [1], [Using a bundled copy of protobuf])
PROTOC="\$(abs_top_srcdir)/externaldeps/protobuf/src/protoc"
PROTOBUF_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/protobuf/src"
PROTOBUF_LIBS="\$(abs_top_srcdir)/externaldeps/protobuf/src/.libs/libprotobuf.a"
@@ -714,6 +715,10 @@ AS_IF(
[have_CXX_compiler=yes]
)
+if test "${have_libprotobuf}" == "yes" && test "${have_CXX_compiler}" == "yes"; then
+ AC_DEFINE([HAVE_PROTOBUF], [1], [Protobuf is available])
+fi
+
AC_MSG_CHECKING([if Cloud functionality should be enabled])
AC_MSG_RESULT([${enable_cloud}])
if test "$aclk_ng" = "no"; then
diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c
index 3974074645..a15250f481 100644
--- a/daemon/buildinfo.c
+++ b/daemon/buildinfo.c
@@ -19,6 +19,24 @@
#endif
#endif
+#ifdef ACLK_NG
+#define FEAT_ACLK_NG 1
+#else
+#define FEAT_ACLK_NG 0
+#endif
+
+#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
+#define NEW_CLOUD_PROTO 1
+#else
+#define NEW_CLOUD_PROTO 0
+#endif
+
+#ifdef ACLK_LEGACY
+#define FEAT_ACLK_LEGACY 1
+#else
+#define FEAT_ACLK_LEGACY 0
+#endif
+
#ifdef ENABLE_DBENGINE
#define FEAT_DBENGINE 1
#else
@@ -45,6 +63,23 @@
// Optional libraries
+#ifdef HAVE_PROTOBUF
+#if defined(ACLK_NG) || defined(ENABLE_PROMETHEUS_REMOTE_WRITE)
+#define FEAT_PROTOBUF 1
+#ifdef BUNDLED_PROTOBUF
+#define FEAT_PROTOBUF_BUNDLED " (bundled)"
+#else
+#define FEAT_PROTOBUF_BUNDLED " (system)"
+#endif
+#else
+#define FEAT_PROTOBUF 0
+#define FEAT_PROTOBUF_BUNDLED ""
+#endif
+#else
+#define FEAT_PROTOBUF 0
+#define FEAT_PROTOBUF_BUNDLED ""
+#endif
+
#ifdef ENABLE_JSONC
#define FEAT_JSONC 1
#else
@@ -199,24 +234,6 @@
#define FEAT_REMOTE_WRITE 0
#endif
-#ifdef ACLK_NG
-#define FEAT_ACLK_NG 1
-#else
-#define FEAT_ACLK_NG 0
-#endif
-
-#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
-#define NEW_CLOUD_PROTO 1
-#else
-#define NEW_CLOUD_PROTO 0
-#endif
-
-#ifdef ACLK_LEGACY
-#define FEAT_ACLK_LEGACY 1
-#else
-#define FEAT_ACLK_LEGACY 0
-#endif
-
#define FEAT_YES_NO(x) ((x) ? "YES" : "NO")
void print_build_info(void) {
@@ -233,6 +250,7 @@ void print_build_info(void) {
printf(" Machine Learning: %s\n", FEAT_YES_NO(FEAT_ML));
printf("Libraries:\n");
+ printf(" protobuf: %s%s\n", FEAT_YES_NO(FEAT_PROTOBUF), FEAT_PROTOBUF_BUNDLED);
printf(" jemalloc: %s\n", FEAT_YES_NO(FEAT_JEMALLOC));
printf(" JSON-C: %s\n", FEAT_YES_NO(FEAT_JSONC));
printf(" libcap: %s\n", FEAT_YES_NO(FEAT_LIBCAP));
@@ -294,6 +312,8 @@ void print_build_info_json(void) {
printf(" },\n");
printf(" \"libs\": {\n");
+ printf(" \"protobuf\": %s,\n", FEAT_JSON_BOOL(FEAT_PROTOBUF));
+ printf(" \"protobuf-source\": \"%s\",\n", FEAT_PROTOBUF_BUNDLED);
printf(" \"jemalloc\": %s,\n", FEAT_JSON_BOOL(FEAT_JEMALLOC));
printf(" \"jsonc\": %s,\n", FEAT_JSON_BOOL(FEAT_JSONC));
printf(" \"libcap\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBCAP));
@@ -347,6 +367,7 @@ void analytics_build_info(BUFFER *b) {
if(FEAT_TLS_HOST_VERIFY) buffer_strcat (b, "|TLS Host Verification");
if(FEAT_ML) buffer_strcat (b, "|Machine Learning");
+ if(FEAT_PROTOBUF) buffer_strcat (b, "|protobuf");
if(FEAT_JEMALLOC) buffer_strcat (b, "|jemalloc");
if(FEAT_JSONC) buffer_strcat (b, "|JSON-C");
if(FEAT_LIBCAP) buffer_strcat (b, "|libcap");