diff --git a/CMakeLists.txt b/CMakeLists.txt index 02b53a27..f213131c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ endif() option(DISABLE_ASM "Disable ASM" OFF) option(DISABLE_SSSE3 "Disable SSSE3" OFF) option(DISABLE_AESNI "Disable AES-NI" OFF) +option(DISABLE_SHA "Disable SHA" OFF) option(DISABLE_NATIVE_ARCH "Disable the addition of -march=native" OFF) set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory") @@ -102,6 +103,10 @@ if(DISABLE_AESNI) add_definitions(-DCRYPTOPP_DISABLE_AESNI) set(DISABLE_NATIVE_ARCH 1) endif() +if(DISABLE_SHA) + add_definitions(-DCRYPTOPP_DISABLE_SHA) + set(DISABLE_NATIVE_ARCH 1) +endif() if(NOT CRYPTOPP_DATA_DIR STREQUAL "") add_definitions(-DCRYPTOPP_DATA_DIR="${CRYPTOPP_DATA_DIR}") endif() @@ -153,6 +158,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") add_definitions(-DCRYPTOPP_DISABLE_AESNI) set(DISABLE_NATIVE_ARCH 1) endif() + + execute_process(COMMAND echo ${GAS_STRING} + COMMAND ${GREP_CMD} "GNU assembler version (2\\.2[3-9]|2\\.[3-9]|[3-9])" + OUTPUT_VARIABLE GAS223_OR_LATER) + if (GAS223_OR_LATER EQUAL 0) + add_definitions(-DCRYPTOPP_DISABLE_SHA) + set(DISABLE_NATIVE_ARCH 1) + endif() endif() endif() endif() @@ -238,9 +251,8 @@ if ((NOT CRYPTOPP_CROSS_COMPILE) AND "${UNAME_SYSTEM}" STREQUAL "SunOS") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -template=no%extdef") endif() - # Try this if you are encountering unexplained SIGBUS'es - # even when DBX reports the memory is aligned. - # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xmemalign=8i") + # Try this if you are encountering unexplained SIGBUS'es on SPARC + # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xmemalign=4i") endif() diff --git a/GNUmakefile b/GNUmakefile index dc987bce..b0b57c2e 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -148,6 +148,7 @@ ifneq ($(HAVE_GAS),0) GAS210_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])") GAS217_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])") GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])") + GAS223_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.2[3-9]|2\.[3-9]|[3-9])") endif ICC111_OR_LATER := $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])") @@ -172,6 +173,11 @@ else ifeq ($(HAVE_GAS)$(GAS219_OR_LATER),10) CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI DISABLE_NATIVE_ARCH := 1 +else +ifeq ($(HAVE_GAS)$(GAS223_OR_LATER),10) +CXXFLAGS += -DCRYPTOPP_DISABLE_SHA +DISABLE_NATIVE_ARCH := 1 +endif endif endif endif