From 467f28e98eb4e6540749b1754aeea88a41a06759 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 27 Nov 2012 18:55:28 +0100 Subject: [PATCH] clang: make atomics work --- configure.ac | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac index 80cf1129b5..8051e8a11d 100644 --- a/configure.ac +++ b/configure.ac @@ -37,6 +37,16 @@ AC_INIT(configure.ac) if test `basename $CC` = "clang"; then CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration" + AC_MSG_CHECKING([clang __sync_bool_compare_and_swap]) + AC_TRY_COMPILE([#include ], + [ unsigned int i = 0; (void)__sync_bool_compare_and_swap(&i, 1, 1);], + [ + AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1], [1], [Fake GCC atomic support]) + AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2], [1], [Fake GCC atomic support]) + AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], [1], [Fake GCC atomic support]) + AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8], [1], [Fake GCC atomic support]) + AC_MSG_RESULT([yes]) ], + [AC_MSG_RESULT([no])]) fi if test `basename $CC` = "gcc"; then dnl get gcc version -- 2.47.3