subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1298554 - in /subversion/branches/revprop-cache: build/ac-macros/svn-macros.m4 configure.ac
Date Thu, 08 Mar 2012 20:07:43 GMT
Author: stefan2
Date: Thu Mar  8 20:07:43 2012
New Revision: 1298554

URL: http://svn.apache.org/viewvc?rev=1298554&view=rev
Log:
Teach subversion to detect the availability of GCC's atomic built-ins
for 64 bit items. This code was taken from APR and tweaked slightly.

* build/ac-macros/svn-macros.m4
  (SVN_CHECK_FOR_ATOMIC_BUILTINS): new macro
* configure.ac
  call the new macro, set SVN_HAS_ATOMIC_BUILTINS #define

Modified:
    subversion/branches/revprop-cache/build/ac-macros/svn-macros.m4
    subversion/branches/revprop-cache/configure.ac

Modified: subversion/branches/revprop-cache/build/ac-macros/svn-macros.m4
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/build/ac-macros/svn-macros.m4?rev=1298554&r1=1298553&r2=1298554&view=diff
==============================================================================
--- subversion/branches/revprop-cache/build/ac-macros/svn-macros.m4 (original)
+++ subversion/branches/revprop-cache/build/ac-macros/svn-macros.m4 Thu Mar  8 20:07:43 2012
@@ -202,3 +202,44 @@ AC_DEFUN([SVN_REMOVE_STANDARD_LIB_DIRS],
     printf "%s" "${output_flags# }"
   fi
 ])
+
+AC_DEFUN([SVN_CHECK_FOR_ATOMIC_BUILTINS],
+[
+  AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins],
+  [AC_TRY_RUN([
+  int main()
+  {
+      unsigned long long val = 1010, tmp, *mem = &val;
+
+      if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
+          return 1;
+
+      tmp = val;
+
+      if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
+          return 1;
+
+      if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
+          return 1;
+
+      tmp = 3030;
+
+      if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
+          return 1;
+
+      if (__sync_lock_test_and_set(&val, 4040) != 3030)
+          return 1;
+
+      mem = &tmp;
+
+      if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
+          return 1;
+
+      __sync_synchronize();
+
+      if (mem != &val)
+          return 1;
+
+      return 0;
+  }], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])])
+])

Modified: subversion/branches/revprop-cache/configure.ac
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/configure.ac?rev=1298554&r1=1298553&r2=1298554&view=diff
==============================================================================
--- subversion/branches/revprop-cache/configure.ac (original)
+++ subversion/branches/revprop-cache/configure.ac Thu Mar  8 20:07:43 2012
@@ -184,6 +184,12 @@ if test -n "$sqlite_compat_ver" && test 
   CFLAGS="-DSVN_SQLITE_MIN_VERSION_NUMBER=$sqlite_compat_ver_num $CFLAGS"
 fi
 
+SVN_CHECK_FOR_ATOMIC_BUILTINS
+
+if test "$ap_cv_atomic_builtins" = "yes"; then
+    AC_DEFINE(SVN_HAS_ATOMIC_BUILTINS, 1, [Define if compiler provides atomic builtins])
+fi
+
 dnl Set up a number of directories ---------------------
 
 dnl Create SVN_BINDIR for proper substitution



Mime
View raw message