From 9e5ba86d7bb673075ba2f4fd72503edb33e602f1 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 1 Dec 2018 06:04:45 -0500 Subject: [PATCH] Fix Macports build on old hardware We needed to detect MacPorts earlier so the flags are used in TCXXFLAGS --- GNUmakefile | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index d5f4b530..854fd1fd 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -92,7 +92,7 @@ endif # Enable shared object versioning for Linux and Solaris HAS_SOLIB_VERSION ?= 0 ifneq ($(IS_LINUX)$(IS_SUN),00) -HAS_SOLIB_VERSION := 1 + HAS_SOLIB_VERSION := 1 endif # Formely adhoc.cpp was created from adhoc.cpp.proto when needed. @@ -100,6 +100,17 @@ ifeq ($(wildcard adhoc.cpp),) $(shell cp adhoc.cpp.proto adhoc.cpp) endif +# Tell MacPorts and Homebrew GCC to use Clang integrated assembler +# http://github.com/weidai11/cryptopp/issues/190 +ifeq ($(GCC_COMPILER)$(OSXPORT_COMPILER),11) + ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),) + CXXFLAGS += -Wa,-q + endif + ifeq ($(findstring -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER,$(CXXFLAGS)),) + CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1 + endif +endif + # Hack to skip CPU feature tests for some recipes DETECT_FEATURES ?= 1 ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),-DCRYPTOPP_DISABLE_ASM) @@ -223,17 +234,6 @@ endif ifneq ($(IS_X86)$(IS_X64),00) ifeq ($(DETECT_FEATURES),1) - # Tell MacPorts and Homebrew GCC to use Clang integrated assembler - # http://github.com/weidai11/cryptopp/issues/190 - ifeq ($(GCC_COMPILER)$(OSXPORT_COMPILER),11) - ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),) - CXXFLAGS += -Wa,-q - endif - ifeq ($(findstring -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1 - endif - endif - ifeq ($(SUN_COMPILER),1) SSE2_FLAG = -xarch=sse2 SSE3_FLAG = -xarch=sse3 @@ -373,15 +373,25 @@ ifeq ($(DETECT_FEATURES),1) CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4 else ifeq ($(SSE42_FLAG),) CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4 - else ifeq ($(AESNI_FLAG),) + endif + + # Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL. + # test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0' + ifeq ($(CLMUL_FLAG),) CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL + endif + ifeq ($(AESNI_FLAG),) CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI - else ifeq ($(AVX_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_AVX - else ifeq ($(AVX2_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 - else ifeq ($(SHANI_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI + endif + + ifneq ($(SSE42_FLAG),) + ifeq ($(AVX_FLAG),) + CXXFLAGS += -DCRYPTOPP_DISABLE_AVX + else ifeq ($(AVX2_FLAG),) + CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 + else ifeq ($(SHANI_FLAG),) + CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI + endif endif # DETECT_FEATURES