summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorunknown <davi@mysql.com/endora.local>2008-01-11 20:34:36 -0200
committerunknown <davi@mysql.com/endora.local>2008-01-11 20:34:36 -0200
commit26af3c7e351483496db87ba08394cad4ae034a95 (patch)
tree115e267d95776235581c61a21bf888c7e7690075 /configure.in
parent44101143f7668cc753f9f78057f164469b051760 (diff)
downloadmariadb-git-26af3c7e351483496db87ba08394cad4ae034a95.tar.gz
Bug#33728 Atomic builtins
Use compiler provided atomic builtins as a 'backend' for MySQL's atomic primitives. The builtins are available on a handful of platforms and compilers. configure.in: Check if the compiler provides atomic builtins and that __sync_lock_test_and_set stores the correct value. include/atomic/nolock.h: Use the atomic builtins if available. include/atomic/gcc_builtins.h: Implement the atomic ADD, SWAP, CAS, STORE (or operation optimized away) and LOAD primitives using atomic builtins provided by the compiler.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in24
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 1ad79c398fb..e5d228cc017 100644
--- a/configure.in
+++ b/configure.in
@@ -1688,6 +1688,30 @@ case "$with_atomic_ops" in
*) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
esac
+AC_CACHE_CHECK([whether the compiler provides atomic builtins],
+ [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
+ int main()
+ {
+ int foo= -10; int bar= 10;
+ if (!__sync_fetch_and_add(&foo, bar) || foo)
+ return -1;
+ bar= __sync_lock_test_and_set(&foo, bar);
+ if (bar || foo != 10)
+ return -1;
+ bar= __sync_val_compare_and_swap(&bar, foo, 15);
+ if (bar)
+ return -1;
+ return 0;
+ }
+], [mysql_cv_gcc_atomic_builtins=yes],
+ [mysql_cv_gcc_atomic_builtins=no],
+ [mysql_cv_gcc_atomic_builtins=no])])
+
+if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
+ AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
+ [Define to 1 if compiler provides atomic builtins.])
+fi
+
# Force static compilation to avoid linking problems/get more speed
AC_ARG_WITH(mysqld-ldflags,
[ --with-mysqld-ldflags Extra linking arguments for mysqld],