From 4de65ee303837504e6c05f5d71d94c8b23a0270d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 6 Sep 2016 14:06:20 +0200 Subject: Fix atomic configure test (hopefully for the last time). --- configure.ac | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e1fcec5..6a38c8a 100644 --- a/configure.ac +++ b/configure.ac @@ -469,25 +469,21 @@ AC_HAVE_LIBRARY([rt],[],[]) dnl ====================== dnl Check for the atomic library dnl ====================== +AC_MSG_CHECKING([for the need for linkage with libatomic]) AC_LANG_PUSH([C++]) -AC_COMPILE_IFELSE( - AC_LANG_SOURCE( +AC_LINK_IFELSE([AC_LANG_SOURCE[ #include int main() { struct Test { int val; }; std::atomic s; - s.is_lock_free(); + return s.is_lock_free()?1:0; } - ), - [needs_libatomic=no], - [needs_libatomic=yes]) - -ATOMIC_LIBS="" -if test x$needs_libatomic = xyes; then - AC_MSG_RESULT([Needs to link with libatomic]) - ATOMIC_LIBS="-latomic" -fi -AC_SUBST(ATOMIC_LIBS) + ]], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes]) + AC_HAVE_LIBRARY([atomic],[],[]) + ] +) AC_LANG_POP([C++]) dnl ====================== -- cgit v1.2.3