From afc42e7f860aa0552560acec89cf4f57ea84f8a7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 15 Oct 2015 13:14:49 +0100 Subject: [PATCH] 128 bit integers are not very portable. --- src/libcryptobox/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libcryptobox/CMakeLists.txt b/src/libcryptobox/CMakeLists.txt index ccdfba279..3579ebc1a 100644 --- a/src/libcryptobox/CMakeLists.txt +++ b/src/libcryptobox/CMakeLists.txt @@ -13,7 +13,7 @@ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/ref.c ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519.c) # For now we support only x86_64 architecture with optimizations -IF(${ARCH} STREQUAL "x86_64") +IF("${ARCH}" STREQUAL "x86_64") SET(ASM_CODE "vpaddq %ymm0, %ymm0, %ymm0") ASM_OP(HAVE_AVX2 "avx2") SET(ASM_CODE "vpaddq %xmm0, %xmm0, %xmm0") @@ -43,9 +43,15 @@ IF(${ARCH} STREQUAL "x86_64") ") ASM_OP(HAVE_DOLLARMACRO "dollar macro convention") - SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-64.c) - SET(CURVESRC ${CURVESRC} ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna-c64.c) -ELSEIF(${ARCH} STREQUAL "i386") + if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-64.c) + SET(CURVESRC ${CURVESRC} ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna-c64.c) + else() + SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-32.c) + SET(CURVESRC ${CURVESRC} ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna.c) + endif() + +ELSEIF("${ARCH}" STREQUAL "i386") SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-32.c) SET(CURVESRC ${CURVESRC} ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna.c) ELSE() -- 2.39.5