mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
b66eebe64d
4de4221ab4b645ff77503c777c9b195a962e9fa1 build: Check for std::atomic::exchange rather than std::atomic_exchange (Andrew Chow) Pull request description: Our usage of std::atomic is with it's own exchange function, not std::atomic_exchange. So we should be looking specifically for that function. This removes the need for -latomic for riscv builds, which resolves a guix cross architecture reproducibility issue. ACKs for top commit: hebasto: ACK 4de4221ab4b645ff77503c777c9b195a962e9fa1 fanquake: ACK 4de4221ab4b645ff77503c777c9b195a962e9fa1 Tree-SHA512: dd8225fc9c6a335601f611700003d0249b9ef941efa502db39306129677929d013048e9221be1d6d7f0ea2d90313d4b87de239f441be21b25bea40a6c19a031e
59 lines
1.5 KiB
Plaintext
59 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.
|
|
|
|
# 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_ATOMIC_testbody], [[
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <chrono>
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
int main() {
|
|
std::atomic<bool> lock{true};
|
|
lock.exchange(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++)
|
|
TEMP_CXXFLAGS="$CXXFLAGS"
|
|
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
|
|
|
|
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])
|
|
])
|
|
])
|
|
|
|
CXXFLAGS="$TEMP_CXXFLAGS"
|
|
AC_LANG_POP
|
|
])
|