|
From: <sv...@va...> - 2011-12-17 12:58:05
|
Author: bart
Date: 2011-12-17 12:53:23 +0000 (Sat, 17 Dec 2011)
New Revision: 12309
Log:
Add a configure test for detecting whether gcc supports atomic operations on
64-bit integers on 32-bit platforms. Apparently newer gcc versions support
this but older versions not. Thanks to Philippe Waroquiers for reporting this.
Modified:
trunk/configure.in
trunk/drd/tests/Makefile.am
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2011-12-14 20:05:51 UTC (rev 12308)
+++ trunk/configure.in 2011-12-17 12:53:23 UTC (rev 12309)
@@ -1911,7 +1911,56 @@
AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
[test x$ac_have_builtin_atomic_secondary = xyes])
+# does this compiler have built-in functions for atomic memory access on
+# 64-bit integers for all targets ?
+AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
+
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <stdint.h>
+]], [[
+ uint64_t variable = 1;
+ return __sync_add_and_fetch(&variable, 1)
+]])], [
+ ac_have_builtin_atomic64_primary=yes
+], [
+ ac_have_builtin_atomic64_primary=no
+])
+
+if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="$mflag_secondary"
+
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <stdint.h>
+]], [[
+ uint64_t variable = 1;
+ return __sync_add_and_fetch(&variable, 1)
+]])], [
+ ac_have_builtin_atomic64_secondary=yes
+], [
+ ac_have_builtin_atomic64_secondary=no
+])
+
+CFLAGS=$safe_CFLAGS
+
+fi
+
+if test x$ac_have_builtin_atomic64_primary = xyes && \
+ test x$VGCONF_PLATFORM_SEC_CAPS = x \
+ -o x$ac_have_builtin_atomic64_secondary = xyes; then
+ AC_MSG_RESULT([yes])
+ ac_have_builtin_atomic64=yes
+else
+ AC_MSG_RESULT([no])
+ ac_have_builtin_atomic64=no
+fi
+
+AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
+ [test x$ac_have_builtin_atomic64 = xyes])
+
+
# does g++ have built-in functions for atomic memory access ?
AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
Modified: trunk/drd/tests/Makefile.am
===================================================================
--- trunk/drd/tests/Makefile.am 2011-12-14 20:05:51 UTC (rev 12308)
+++ trunk/drd/tests/Makefile.am 2011-12-17 12:53:23 UTC (rev 12309)
@@ -339,11 +339,15 @@
check_PROGRAMS += \
annotate_barrier \
annotate_rwlock \
- annotate_trace_memory \
atomic_var \
circular_buffer
endif
+if HAVE_BUILTIN_ATOMIC64
+check_PROGRAMS += \
+ annotate_trace_memory
+endif
+
if HAVE_BUILTIN_ATOMIC_CXX
check_PROGRAMS += \
annotate_smart_pointer \
|