diff options
author | Timotej S <6674623+underhood@users.noreply.github.com> | 2021-08-09 12:57:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 12:57:18 +0200 |
commit | 8293d5ff56873c2ae33c7b7903ebbcfd9756d3f2 (patch) | |
tree | 10d6c7de6963aa3a6e214474eb89192cc306bb95 /configure.ac | |
parent | 115de859288d150d7db7f7a466ddc2e635962e8d (diff) |
Fix bundled protobuf linkage on systems needing -latomic (#11406)
* fix bundled protobuf on systems that need -latomic
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 23 |
1 files changed, 23 insertions, 0 deletions
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 <atomic> + #include <cstdint> + std::atomic<std::int64_t> 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 |