1From e0de0d9e981ddb53bdeb4a4b9dc43046c9ff4ff9 Mon Sep 17 00:00:00 2001 2From: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3Date: Thu, 6 May 2021 23:08:36 +0200 4Subject: [PATCH] link with -latomic if needed 5 6numactl unconditionally uses __atomic_fetch_and but some architectures 7(e.g. sparc) needs to link with -latomic to be able to use it. So check 8if -latomic is needed and update numa.pc accordingly 9 10Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 11[Retrieved from: 12https://github.com/numactl/numactl/commit/e0de0d9e981ddb53bdeb4a4b9dc43046c9ff4ff9] 13--- 14 Makefile.am | 1 + 15 configure.ac | 2 ++ 16 numa.pc.in | 1 + 17 3 files changed, 4 insertions(+) 18 19diff --git a/Makefile.am b/Makefile.am 20index 44d0d76..34f6815 100644 21--- a/Makefile.am 22+++ b/Makefile.am 23@@ -151,6 +151,7 @@ SED_PROCESS = \ 24 -e 's,@exec_prefix\@,$(exec_prefix),g' \ 25 -e 's,@libdir\@,$(libdir),g' \ 26 -e 's,@includedir\@,$(includedir),g' \ 27+ -e 's,@LIBS\@,$(LIBS),g' \ 28 < $< > $@ || rm $@ 29 30 %.pc: %.pc.in Makefile 31diff --git a/configure.ac b/configure.ac 32index 659a765..e3b0eb3 100644 33--- a/configure.ac 34+++ b/configure.ac 35@@ -24,6 +24,8 @@ AM_CONDITIONAL([HAVE_TREE_VECTORIZE], [test x"${tree_vectorize}" = x"true"]) 36 37 AC_CONFIG_FILES([Makefile]) 38 39+AC_SEARCH_LIBS([__atomic_fetch_and_1], [atomic]) 40+ 41 # GCC tries to be "helpful" and only issue a warning for unrecognized 42 # attributes. So we compile the test with Werror, so that if the 43 # attribute is not recognized the compilation fails 44diff --git a/numa.pc.in b/numa.pc.in 45index 8a0f202..cc04d50 100644 46--- a/numa.pc.in 47+++ b/numa.pc.in 48@@ -8,3 +8,4 @@ Description: NUMA policy library 49 Version: @VERSION@ 50 Cflags: -I${includedir} 51 Libs: -L${libdir} -lnuma 52+Libs.Private: @LIBS@ 53