summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorRene Engelhard <rene@debian.org>2019-08-30 21:00:55 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-09-03 10:41:12 +0200
commit68fee5424f9c149aaabc44952b9a699367a66adf (patch)
treeb6468a0ad1a0551a8702032f08bf05f58f6d7a8c /m4
parentassert on selecting text from end to start in shape with a11y enabled (diff)
downloadcore-68fee5424f9c149aaabc44952b9a699367a66adf.tar.gz
core-68fee5424f9c149aaabc44952b9a699367a66adf.zip
add -latomic configure check...
...in preparation for <https://gerrit.libreoffice.org/#/c/78380/> "Add -latomic to the end of Linux C++ linker command lines" (copied from https://github.com/zelcash/zelcash/blob/master/build-aux/m4/l_atomic.m4) Change-Id: I8879a72d730cc08a72c2d8b132ff9f5d2efe7b9f Reviewed-on: https://gerrit.libreoffice.org/78336 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 098bf3b243bdbb3257fda97a54caa6c403f63df6) Reviewed-on: https://gerrit.libreoffice.org/78412 Tested-by: Rene Engelhard <rene@debian.org> Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'm4')
-rw-r--r--m4/l_atomic.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/l_atomic.m4 b/m4/l_atomic.m4
new file mode 100644
index 000000000000..6e011ebabe3d
--- /dev/null
+++ b/m4/l_atomic.m4
@@ -0,0 +1,41 @@
+# Some versions of gcc/libstdc++ require linking with -latomic if
+# using the C++ atomic library.
+#
+# Sourced from http://bugs.debian.org/797228
+
+m4_define([_CHECK_L_ATOMIC_testbody], [[
+ #include <atomic>
+ #include <cstdint>
+
+ int main() {
+ std::atomic<int64_t> a{};
+
+ int64_t v = 5;
+ int64_t r = a.fetch_add(v);
+ return static_cast<int>(r);
+ }
+]])
+
+AC_DEFUN([CHECK_L_ATOMIC], [
+
+ AC_LANG_PUSH(C++)
+
+ AC_MSG_CHECKING([whether std::atomic can be used without link library])
+
+ AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ LIBS="$LIBS -latomic"
+ AC_MSG_CHECKING([whether std::atomic needs -latomic])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
+ AC_MSG_RESULT([yes])
+ ATOMIC_LIB=-latomic
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([cannot figure our how to use std::atomic])
+ ])
+ ])
+
+ AC_LANG_POP
+])