Fixed #317 - unresolved reference to __atomic_is_lock_free
authorBruno Goncalves <bruno.slackware@gmail.com>
Wed, 7 Oct 2015 22:02:56 +0000 (15:02 -0700)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Wed, 7 Oct 2015 22:20:17 +0000 (15:20 -0700)
Summary: Tested in:
Distro: Fedora 20 - x86_64
kernel: 3.19
compiler: gcc version 4.8.3
Closes https://github.com/facebook/folly/pull/320

Reviewed By: @sgolemon

Differential Revision: D2519083

fb-gh-sync-id: 07b1437326c393c99feeb6e0764d664d3e22faea

folly/configure.ac

index 0a2b10a9fa591794038b501369aad995dd386fb5..bceb1e5856e8fe53318a6eea9119b7c3e37a7c6f 100644 (file)
@@ -231,6 +231,26 @@ if test "$folly_cv_lib_libcpp" = yes; then
   AC_DEFINE([USE_LIBCPP], [1], [Define to 1 if we are using libc++.])
 fi
 
+AC_CACHE_CHECK(
+  [for c++11 atomic support without GNU Atomic library],
+  [folly_cv_lib_libatomic],
+  [AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM[
+      #include <atomic>
+      int main() {
+        struct Test { int val; };
+        std::atomic<Test> s;
+        s.is_lock_free();
+      }
+    ]],
+    [folly_cv_lib_libatomic=yes],
+    [folly_cv_lib_libatomic=no])])
+
+if test "$folly_cv_lib_libatomic" = no; then
+  AC_HAVE_LIBRARY([atomic],[],[AC_MSG_ERROR(
+                  [Please install the GNU Atomic library])])
+fi
+
 AC_CACHE_CHECK(
   [for usable std::is_trivially_copyable],
   [folly_cv_decl_std_is_trivially_copyable],