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], [[
11 std::atomic<int64_t> a{};
14 int64_t r = a.fetch_add(v);
15 return static_cast<int>(r);
19 AC_DEFUN([CHECK_L_ATOMIC], [
23 AC_MSG_CHECKING([whether std::atomic can be used without link library])
25 AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
30 AC_MSG_CHECKING([whether std::atomic needs -latomic])
31 AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
36 AC_MSG_FAILURE([cannot figure our how to use std::atomic])