tdf#62032 use style list level when changing style
[LibreOffice.git] / m4 / l_atomic.m4
blob6e011ebabe3d83b0af2b85787a5c0eb6ab9d9268
1 # Some versions of gcc/libstdc++ require linking with -latomic if
2 # using the C++ atomic library.
4 # Sourced from http://bugs.debian.org/797228
6 m4_define([_CHECK_L_ATOMIC_testbody], [[
7   #include <atomic>
8   #include <cstdint>
10   int main() {
11     std::atomic<int64_t> a{};
13     int64_t v = 5;
14     int64_t r = a.fetch_add(v);
15     return static_cast<int>(r);
16   }
17 ]])
19 AC_DEFUN([CHECK_L_ATOMIC], [
21   AC_LANG_PUSH(C++)
23   AC_MSG_CHECKING([whether std::atomic can be used without link library])
25   AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
26       AC_MSG_RESULT([yes])
27     ],[
28       AC_MSG_RESULT([no])
29       LIBS="$LIBS -latomic"
30       AC_MSG_CHECKING([whether std::atomic needs -latomic])
31       AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
32           AC_MSG_RESULT([yes])
33           ATOMIC_LIB=-latomic
34         ],[
35           AC_MSG_RESULT([no])
36           AC_MSG_FAILURE([cannot figure our how to use std::atomic])
37         ])
38     ])
40   AC_LANG_POP