@cryptotaxi247 / netdata-1 / commits / 8293d5ff5

Fix bundled protobuf linkage on systems needing -latomic (#11406)

* fix bundled protobuf on systems that need -latomic

Timotej S committed Aug 9, 2021 at 12:57 UTC 8293d5ff56873c2ae33c7b7903ebbcfd9756d3f2
2 files changed +31 -6
Makefile.am
+8 -6
@@ -863,15 +863,17 @@ netdata_LDADD = \
863 $(NULL)
864
865 if ACLK_NG
866 - netdata_LDADD += $(OPTIONAL_PROTOBUF_LIBS)
866 + netdata_LDADD += $(OPTIONAL_PROTOBUF_LIBS) \
867 + $(OPTIONAL_ATOMIC_LIBS) \
868 + $(NULL)
869 endif
870
871 if ACLK_LEGACY
870 -netdata_LDADD += \
871 - $(abs_top_srcdir)/externaldeps/mosquitto/libmosquitto.a \
872 - $(OPTIONAL_LWS_LIBS) \
873 - $(OPTIONAL_LIBCAP_LIBS) \
874 - $(NULL)
872 + netdata_LDADD += \
873 + $(abs_top_srcdir)/externaldeps/mosquitto/libmosquitto.a \
874 + $(OPTIONAL_LWS_LIBS) \
875 + $(OPTIONAL_LIBCAP_LIBS) \
876 + $(NULL)
877 endif #ACLK_LEGACY
878
879 if ENABLE_CXX_LINKER
configure.ac
+23
@@ -757,6 +757,29 @@ if test "$enable_cloud" != "no" -a "$aclk_ng" != "no"; then
757 else
758 AC_MSG_RESULT([yes])
759 fi
760 +
761 + if test "${with_bundled_protobuf}" = "yes"; then
762 + AC_LANG_PUSH([C++])
763 + CXXFLAGS="${CXXFLAGS} -std=c++11"
764 +
765 + # On some platforms, std::atomic needs a helper library
766 + AC_MSG_CHECKING(whether -latomic is needed for static protobuf)
767 + AC_LINK_IFELSE([AC_LANG_SOURCE([[
768 + #include <atomic>
769 + #include <cstdint>
770 + std::atomic<std::int64_t> v;
771 + int main() {
772 + return v;
773 + }
774 + ]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes)
775 + AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC)
776 + if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then
777 + OPTIONAL_ATOMIC_LIBS="-latomic"
778 + fi
779 + AC_SUBST([OPTIONAL_ATOMIC_LIBS])
780 + AC_LANG_POP([C++])
781 + fi
782 +
783 AC_MSG_CHECKING([ACLK Next Generation can be built])
784 AC_MSG_RESULT([${can_enable_ng}])
785 if test "$can_enable_ng" = "no" -a "$aclk_ng" = "yes"; then