[ovs-dev] [PATCH] Add check for -latomic
James Page
james.page at ubuntu.com
Thu Dec 5 10:43:09 UTC 2013
Later versions of gcc on some architectures push atomic functions
out into a separate atomic library; add a check to see when this
is required.
Signed-off-by: James Page <james.page at ubuntu.com>
---
configure.ac | 1 +
m4/openvswitch.m4 | 6 ++++++
tests/automake.mk | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 13d2d31..167cc71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,7 @@ OVS_CHECK_XENSERVER_VERSION
OVS_CHECK_GROFF
OVS_CHECK_GNU_MAKE
OVS_CHECK_TLS
+OVS_CHECK_ATOMIC_LIBS
OVS_CHECK_GCC4_ATOMICS
OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(1)
OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(2)
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 7c37985..86bd254 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -432,6 +432,12 @@ static thread_local int var;], [return var;])],
fi
fi])
+dnl OVS_CHECK_ATOMIC_LIBS
+dnl
+dnl Check to see if -latomic is need for GCC atomic built-ins.
+AC_DEFUN([OVS_CHECK_ATOMIC_LIBS],
+ [AC_SEARCH_LIBS([__atomic_load_8], [atomic], [ATOMIC_LIBS=-latomic])])
+
dnl OVS_CHECK_GCC4_ATOMICS
dnl
dnl Checks whether the compiler and linker support GCC 4.0+ atomic built-ins.
diff --git a/tests/automake.mk b/tests/automake.mk
index 099398a..485ea8d 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -180,7 +180,7 @@ tests_test_aes128_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
noinst_PROGRAMS += tests/test-atomic
tests_test_atomic_SOURCES = tests/test-atomic.c
-tests_test_atomic_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_atomic_LDADD = lib/libopenvswitch.a $(SSL_LIBS) $(ATOMIC_LIBS)
noinst_PROGRAMS += tests/test-bundle
tests_test_bundle_SOURCES = tests/test-bundle.c
--
1.8.4.4
More information about the dev
mailing list