]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
clang: make atomics work
authorVictor Julien <victor@inliniac.net>
Tue, 27 Nov 2012 17:55:28 +0000 (18:55 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 27 Nov 2012 17:55:28 +0000 (18:55 +0100)
configure.ac

index 80cf1129b53ce646c10efb4073c312747f7b2277..8051e8a11df83a84520ae1bf14be018a4f687aae 100644 (file)
@@ -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 <stdio.h>],
+                [ 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