* 'master' of https://github.com/jedisct1/libsodium:
  Check if atomic operations are supported
  Remove a whitespace following trailing backslash in a Makefile
This commit is contained in:
Frank Denis 2016-12-17 19:00:59 +01:00
commit c5735ef215
2 changed files with 12 additions and 1 deletions

View File

@ -660,6 +660,17 @@ AS_IF([test "x$aligned_access_required" = "xyes"],
[AC_MSG_RESULT(no)
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
AS_IF([test "x$EMSCRIPTEN" = "x"],[

View File

@ -123,7 +123,7 @@ sodium_crit_leave(void)
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;