aboutsummaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorCory Fields <foss@atlastechnologiesinc.com>2012-10-19 12:52:34 -0700
committerCory Fields <foss@atlastechnologiesinc.com>2012-10-19 12:52:34 -0700
commitacae1706a98e9cc36a777e1b32bab0b938173ddb (patch)
treec770f8a85fb2c15fff1c1242fccb0a578ae01a46 /configure.in
parent3d6cc48bd796858d46b455f9d28ef4aaddb7bcd5 (diff)
parentc3adf6738cb94764d0fbccdd3c08b20788a5218c (diff)
Merge pull request #1626 from theuni/intrinsics-check
build: quit guessing about intrinsics, check specifics
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in31
1 files changed, 31 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 4983a45997..6bfb034b1e 100644
--- a/configure.in
+++ b/configure.in
@@ -811,6 +811,37 @@ AC_CHECK_FUNCS([atexit dup2 fdatasync floor fs_stat_dev ftime ftruncate getcwd g
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([size_t])
+# Check for intrinsics
+AC_MSG_CHECKING([for __sync_add_and_fetch(temp, 1)])
+AC_TRY_COMPILE([],[long* temp=0; __sync_add_and_fetch(temp, 1);],
+ [have_builtin_sync_add_and_fetch=yes],
+ [have_builtin_sync_add_and_fetch=no])
+AC_MSG_RESULT($have_builtin_sync_add_and_fetch)
+if test "x$have_builtin_sync_add_and_fetch" = "xyes"; then
+ AC_DEFINE(HAS_BUILTIN_SYNC_ADD_AND_FETCH, 1,
+ [Define to 1 if your compiler supports the __sync_add_and_fetch() intrinsic.])
+fi
+
+AC_MSG_CHECKING([for __sync_sub_and_fetch(temp, 1)])
+AC_TRY_COMPILE([],[long* temp=0; __sync_sub_and_fetch(temp, 1);],
+ [have_builtin_sync_sub_and_fetch=yes],
+ [have_builtin_sync_sub_and_fetch=no])
+AC_MSG_RESULT($have_builtin_sync_sub_and_fetch)
+if test "x$have_builtin_sync_sub_and_fetch" = "xyes"; then
+ AC_DEFINE(HAS_BUILTIN_SYNC_SUB_AND_FETCH, 1,
+ [Define to 1 if your compiler supports the __sync_sub_and_fetch() intrinsic.])
+fi
+
+AC_MSG_CHECKING([for __sync_val_compare_and_swap(temp, 1, 1)])
+AC_TRY_COMPILE([],[long *temp = 0; __sync_val_compare_and_swap(temp, 1, 1);],
+ [have_builtin_sync_val_compare_and_swap=yes],
+ [have_builtin_sync_val_compare_and_swap=no])
+AC_MSG_RESULT($have_builtin_sync_val_compare_and_swap)
+if test "x$have_builtin_sync_val_compare_and_swap" = "xyes"; then
+ AC_DEFINE(HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP, 1,
+ [Define to 1 if your compiler supports the __sync_val_compare_and_swap() intrinsic.])
+fi
+
# Add top source directory for all builds so we can use config.h
INCLUDES="$INCLUDES -I\$(abs_top_srcdir)"