From bf3fb4e5c969db276553eab5c9da9abb792b36e3 Mon Sep 17 00:00:00 2001 From: Jeremie Courreges-Anglas Date: Mon, 28 Aug 2023 19:47:19 +0200 Subject: [PATCH] On riscv64 require libatomic if actually needed clang and newer gcc releases support byte-sized atomic accesses on riscv64 through inline builtins. In both cases the hard dependency on libatomic added by GH-11321 isn't useful. Stop using AC_CHECK_LIB() which is too naive to notice that libatomic isn't needed. Instead, PHP_CHECK_FUNC() will retry the check with -latomic if required. Closes GH-11790 --- NEWS | 2 ++ configure.ac | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index a4d3499a583..f5c7d0c199b 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ PHP NEWS - Core: . Fixed bug GH-11937 (Constant ASTs containing objects). (ilutov) + . Fixed bug GH-11790 (On riscv64 require libatomic if actually needed). + (Jeremie Courreges-Anglas) - DOM: . Fix memory leak when setting an invalid DOMDocument encoding. (nielsdos) diff --git a/configure.ac b/configure.ac index 0c723046adf..93e8bd96b76 100644 --- a/configure.ac +++ b/configure.ac @@ -369,11 +369,7 @@ AC_CHECK_LIB(m, sin) case $host_alias in riscv64*) - AC_CHECK_LIB(atomic, __atomic_exchange_1, [ - PHP_ADD_LIBRARY(atomic) - ], [ - AC_MSG_ERROR([Problem with enabling atomic. Please check config.log for details.]) - ]) + PHP_CHECK_FUNC(__atomic_exchange_1, atomic) ;; esac