commit:     79560e44184ed0241f7199722cf8c1dd3207b256
Author:     Matthew Smith <matthew <AT> gentoo <DOT> org>
AuthorDate: Fri May 17 08:57:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 20 08:10:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79560e44

dev-libs/mimalloc: conditionally add -latomic

Some systems do not have libatomic, so forcing its use causes build
errors.

Bug: https://bugs.gentoo.org/931778
Signed-off-by: Matthew Smith <matthew <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/36716
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/mimalloc/mimalloc-2.1.4.ebuild | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/dev-libs/mimalloc/mimalloc-2.1.4.ebuild 
b/dev-libs/mimalloc/mimalloc-2.1.4.ebuild
index bd26f566a18c..a09a864cbf24 100644
--- a/dev-libs/mimalloc/mimalloc-2.1.4.ebuild
+++ b/dev-libs/mimalloc/mimalloc-2.1.4.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit cmake-multilib
+inherit cmake-multilib flag-o-matic
 
 DESCRIPTION="A compact general purpose allocator with excellent performance"
 HOMEPAGE="https://github.com/microsoft/mimalloc";
@@ -25,13 +25,12 @@ src_configure() {
                -DMI_BUILD_OBJECT=OFF
                -DMI_BUILD_STATIC=OFF
                -DMI_TRACK_VALGRIND=$(usex valgrind)
-
-               # Bug #923177
-               # find_library(... atomic) appears to not work. Fall back to 
-latomic
-               -DMI_USE_LIBATOMIC=ON
-
                -DMI_LIBC_MUSL=$(usex elibc_musl)
        )
 
+       # Bug #923177, #931778: append -latomic if it is available
+       test-flags-CCLD "-latomic" &>/dev/null &&
+               mycmakeargs+=( -DMI_USE_LIBATOMIC=ON )
+
        cmake-multilib_src_configure
 }

Reply via email to