diff --git a/configure.ac b/configure.ac index e05f2023..0686f9f5 100644 --- a/configure.ac +++ b/configure.ac @@ -446,21 +446,26 @@ AC_SUBST(HAVE_AVX_ASM_V) AC_MSG_CHECKING(for 128-bit arithmetic) HAVE_TI_MODE_V=0 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifndef __GNUC__ -# error mode(TI) is a gcc extension +#if !defined(__GNUC__) && !defined(__SIZEOF_INT128__) +# error mode(TI) is a gcc extension, and __int128 is not available #endif #if defined(__clang__) && !defined(__x86_64__) -# error clang does not properly compile smult_curve25519_donna_c64.c +# error clang does not properly handle the 128-bit type on 32-bit systems #endif #ifndef NATIVE_LITTLE_ENDIAN -# error donna_c64 currently requires a little endian CPU +# error libsodium currently expects a little endian CPU for the 128-bit type #endif #ifdef __EMSCRIPTEN__ # error emscripten currently supports only shift operations on integers \ # larger than 64 bits #endif +#include #include +#if defined(__SIZEOF_INT128__) +typedef unsigned __int128 uint128_t; +#else typedef unsigned uint128_t __attribute__((mode(TI))); +#endif void fcontract(uint128_t *t) { *t += 0x8000000000000 - 1; }