From 8293d5ff56873c2ae33c7b7903ebbcfd9756d3f2 Mon Sep 17 00:00:00 2001 From: Timotej S <6674623+underhood@users.noreply.github.com> Date: Mon, 9 Aug 2021 12:57:18 +0200 Subject: Fix bundled protobuf linkage on systems needing -latomic (#11406) * fix bundled protobuf on systems that need -latomic --- configure.ac | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 0c3a960525..d3b13231a1 100644 --- a/configure.ac +++ b/configure.ac @@ -757,6 +757,29 @@ if test "$enable_cloud" != "no" -a "$aclk_ng" != "no"; then else AC_MSG_RESULT([yes]) fi + + if test "${with_bundled_protobuf}" = "yes"; then + AC_LANG_PUSH([C++]) + CXXFLAGS="${CXXFLAGS} -std=c++11" + + # On some platforms, std::atomic needs a helper library + AC_MSG_CHECKING(whether -latomic is needed for static protobuf) + AC_LINK_IFELSE([AC_LANG_SOURCE([[ + #include + #include + std::atomic v; + int main() { + return v; + } + ]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes) + AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC) + if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then + OPTIONAL_ATOMIC_LIBS="-latomic" + fi + AC_SUBST([OPTIONAL_ATOMIC_LIBS]) + AC_LANG_POP([C++]) + fi + AC_MSG_CHECKING([ACLK Next Generation can be built]) AC_MSG_RESULT([${can_enable_ng}]) if test "$can_enable_ng" = "no" -a "$aclk_ng" = "yes"; then -- cgit v1.2.3