@cryptotaxi247 / netdata-1 / commits / a67c83024

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.

Austin S. Hemmelgarn committed Nov 8, 2021 at 07:49 UTC a67c830243a12ac7ce9d46aa5f5aef6c2374ec39
2 files changed +44 -18
configure.ac
+5
@@ -700,6 +700,7 @@ AS_IF(
700 )
701 else
702 AC_MSG_NOTICE([using bundled protobuf])
703 + AC_DEFINE([BUNDLED_PROTOBUF], [1], [Using a bundled copy of protobuf])
704 PROTOC="\$(abs_top_srcdir)/externaldeps/protobuf/src/protoc"
705 PROTOBUF_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/protobuf/src"
706 PROTOBUF_LIBS="\$(abs_top_srcdir)/externaldeps/protobuf/src/.libs/libprotobuf.a"
@@ -714,6 +715,10 @@ AS_IF(
715 [have_CXX_compiler=yes]
716 )
717
718 +if test "${have_libprotobuf}" == "yes" && test "${have_CXX_compiler}" == "yes"; then
719 + AC_DEFINE([HAVE_PROTOBUF], [1], [Protobuf is available])
720 +fi
721 +
722 AC_MSG_CHECKING([if Cloud functionality should be enabled])
723 AC_MSG_RESULT([${enable_cloud}])
724 if test "$aclk_ng" = "no"; then
daemon/buildinfo.c
+39 -18
@@ -19,6 +19,24 @@
19 #endif
20 #endif
21
22 +#ifdef ACLK_NG
23 +#define FEAT_ACLK_NG 1
24 +#else
25 +#define FEAT_ACLK_NG 0
26 +#endif
27 +
28 +#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
29 +#define NEW_CLOUD_PROTO 1
30 +#else
31 +#define NEW_CLOUD_PROTO 0
32 +#endif
33 +
34 +#ifdef ACLK_LEGACY
35 +#define FEAT_ACLK_LEGACY 1
36 +#else
37 +#define FEAT_ACLK_LEGACY 0
38 +#endif
39 +
40 #ifdef ENABLE_DBENGINE
41 #define FEAT_DBENGINE 1
42 #else
@@ -45,6 +63,23 @@
63
64 // Optional libraries
65
66 +#ifdef HAVE_PROTOBUF
67 +#if defined(ACLK_NG) || defined(ENABLE_PROMETHEUS_REMOTE_WRITE)
68 +#define FEAT_PROTOBUF 1
69 +#ifdef BUNDLED_PROTOBUF
70 +#define FEAT_PROTOBUF_BUNDLED " (bundled)"
71 +#else
72 +#define FEAT_PROTOBUF_BUNDLED " (system)"
73 +#endif
74 +#else
75 +#define FEAT_PROTOBUF 0
76 +#define FEAT_PROTOBUF_BUNDLED ""
77 +#endif
78 +#else
79 +#define FEAT_PROTOBUF 0
80 +#define FEAT_PROTOBUF_BUNDLED ""
81 +#endif
82 +
83 #ifdef ENABLE_JSONC
84 #define FEAT_JSONC 1
85 #else
@@ -199,24 +234,6 @@
234 #define FEAT_REMOTE_WRITE 0
235 #endif
236
202 -#ifdef ACLK_NG
203 -#define FEAT_ACLK_NG 1
204 -#else
205 -#define FEAT_ACLK_NG 0
206 -#endif
207 -
208 -#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
209 -#define NEW_CLOUD_PROTO 1
210 -#else
211 -#define NEW_CLOUD_PROTO 0
212 -#endif
213 -
214 -#ifdef ACLK_LEGACY
215 -#define FEAT_ACLK_LEGACY 1
216 -#else
217 -#define FEAT_ACLK_LEGACY 0
218 -#endif
219 -
237 #define FEAT_YES_NO(x) ((x) ? "YES" : "NO")
238
239 void print_build_info(void) {
@@ -233,6 +250,7 @@ void print_build_info(void) {
250 printf(" Machine Learning: %s\n", FEAT_YES_NO(FEAT_ML));
251
252 printf("Libraries:\n");
253 + printf(" protobuf: %s%s\n", FEAT_YES_NO(FEAT_PROTOBUF), FEAT_PROTOBUF_BUNDLED);
254 printf(" jemalloc: %s\n", FEAT_YES_NO(FEAT_JEMALLOC));
255 printf(" JSON-C: %s\n", FEAT_YES_NO(FEAT_JSONC));
256 printf(" libcap: %s\n", FEAT_YES_NO(FEAT_LIBCAP));
@@ -294,6 +312,8 @@ void print_build_info_json(void) {
312 printf(" },\n");
313
314 printf(" \"libs\": {\n");
315 + printf(" \"protobuf\": %s,\n", FEAT_JSON_BOOL(FEAT_PROTOBUF));
316 + printf(" \"protobuf-source\": \"%s\",\n", FEAT_PROTOBUF_BUNDLED);
317 printf(" \"jemalloc\": %s,\n", FEAT_JSON_BOOL(FEAT_JEMALLOC));
318 printf(" \"jsonc\": %s,\n", FEAT_JSON_BOOL(FEAT_JSONC));
319 printf(" \"libcap\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBCAP));
@@ -347,6 +367,7 @@ void analytics_build_info(BUFFER *b) {
367 if(FEAT_TLS_HOST_VERIFY) buffer_strcat (b, "|TLS Host Verification");
368 if(FEAT_ML) buffer_strcat (b, "|Machine Learning");
369
370 + if(FEAT_PROTOBUF) buffer_strcat (b, "|protobuf");
371 if(FEAT_JEMALLOC) buffer_strcat (b, "|jemalloc");
372 if(FEAT_JSONC) buffer_strcat (b, "|JSON-C");
373 if(FEAT_LIBCAP) buffer_strcat (b, "|libcap");