From: Heinrich Schuchardt Date: Thu, 8 Jul 2021 17:06:49 +0000 (+0000) Subject: Fix build on RISC-V (#856) X-Git-Tag: SQUID_6_0_1~315 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b98c6823c72aeb40e8fe3d61bd061234f341db3d;p=thirdparty%2Fsquid.git Fix build on RISC-V (#856) Compiling on RISC-V (without an explicit -latomic) fails with /usr/riscv64-linux-gnu/include/c++/10/ostream:611: undefined reference to __atomic_compare_exchange_1 Use std::atomic::exchange() to detect whether -latomic implements 1-byte compare-and-exchange API used by Squid. Signed-off-by: Heinrich Schuchardt --- diff --git a/configure.ac b/configure.ac index 85018e65a8..3ce45e1f36 100644 --- a/configure.ac +++ b/configure.ac @@ -450,8 +450,11 @@ AC_DEFUN([LIBATOMIC_CHECKER],[ #include #include int - main(int, char **) { - return std::atomic{}.is_lock_free() ? 0 : 1; + main(int argc, char **) { + return ( + std::atomic(uint8_t(argc)).exchange(0) && + std::atomic{}.is_lock_free() + ) ? 0 : 1; } ]])],[ AC_MSG_RESULT(yes)