mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
a9021db4ec
ebc7063c80135dd6f3e7b9418e8f4bf217bd8db7 doc: update docs for CHECK_ATOMIC macro (fanquake) Pull request description: Clarify that supported versions of GCC are not affected, and that Clang prior to version 15 still requires the explicit `-latomic` linking, when compiling for 32-bit. ACKs for top commit: hebasto: ACK ebc7063c80135dd6f3e7b9418e8f4bf217bd8db7. Tree-SHA512: 6044dc28547431cfde7e89b663b5f9a86a4cb801212a21c3dbb18a1c41a53640480c3e4e944050dc3ec4cded9bc4c1f8eae8dbb60596289fef49bb13a8b53b76
58 lines
1.5 KiB
Plaintext
58 lines
1.5 KiB
Plaintext
dnl Copyright (c) 2015 Tim Kosse <tim.kosse@filezilla-project.org>
|
|
dnl Copying and distribution of this file, with or without modification, are
|
|
dnl permitted in any medium without royalty provided the copyright notice
|
|
dnl and this notice are preserved. This file is offered as-is, without any
|
|
dnl warranty.
|
|
|
|
# Clang prior to version 15, when building for 32-bit,
|
|
# and linking against libstdc++, requires linking with
|
|
# -latomic if using the C++ atomic library.
|
|
# Can be tested with: clang++ test.cpp -m32
|
|
#
|
|
# Sourced from http://bugs.debian.org/797228
|
|
|
|
m4_define([_CHECK_ATOMIC_testbody], [[
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <chrono>
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
int main() {
|
|
std::atomic<bool> lock{true};
|
|
std::atomic_exchange(&lock, false);
|
|
|
|
std::atomic<std::chrono::seconds> t{0s};
|
|
t.store(2s);
|
|
|
|
std::atomic<int64_t> a{};
|
|
|
|
int64_t v = 5;
|
|
int64_t r = a.fetch_add(v);
|
|
return static_cast<int>(r);
|
|
}
|
|
]])
|
|
|
|
AC_DEFUN([CHECK_ATOMIC], [
|
|
|
|
AC_LANG_PUSH(C++)
|
|
|
|
AC_MSG_CHECKING([whether std::atomic can be used without link library])
|
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_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_ATOMIC_testbody])],[
|
|
AC_MSG_RESULT([yes])
|
|
],[
|
|
AC_MSG_RESULT([no])
|
|
AC_MSG_FAILURE([cannot figure out how to use std::atomic])
|
|
])
|
|
])
|
|
|
|
AC_LANG_POP
|
|
])
|