mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
Check if atomic operations are supported
This commit is contained in:
parent
4c6f704084
commit
db97a35502
11
configure.ac
11
configure.ac
@ -660,6 +660,17 @@ AS_IF([test "x$aligned_access_required" = "xyes"],
|
|||||||
[AC_MSG_RESULT(no)
|
[AC_MSG_RESULT(no)
|
||||||
AC_DEFINE([CPU_UNALIGNED_ACCESS], [1], [unaligned memory access is supported])])
|
AC_DEFINE([CPU_UNALIGNED_ACCESS], [1], [unaligned memory access is supported])])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(if atomic operations are supported)
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
|
||||||
|
static volatile int _sodium_lock;
|
||||||
|
__sync_lock_test_and_set(&_sodium_lock, 1);
|
||||||
|
__sync_lock_release(&_sodium_lock);
|
||||||
|
]]
|
||||||
|
)],
|
||||||
|
[AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE([HAVE_ATOMIC_OPS], [1], [atomic operations are supported])],
|
||||||
|
[AC_MSG_RESULT(no)])
|
||||||
|
|
||||||
dnl Checks for functions and headers
|
dnl Checks for functions and headers
|
||||||
|
|
||||||
AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
||||||
|
@ -123,7 +123,7 @@ sodium_crit_leave(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__GNUC__) && !defined(__EMSCRIPTEN__) && !defined(__native_client__)
|
#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__) && !defined(__native_client__)
|
||||||
|
|
||||||
static volatile int _sodium_lock;
|
static volatile int _sodium_lock;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user