diff --git a/GNUmakefile b/GNUmakefile index bbdfb2bf..c3c00e0e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -16,12 +16,21 @@ ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4 CXX = g++ endif -GCC33ORLATER = $(shell $(CXX) -v 2>&1 | grep -c "gcc version \(3.[3-9]\|[4-9]\)") +ifeq ($(ISX86),1) -ifeq ($(ISX86) $(GCC33ORLATER) $(ISMINGW),1 1 0) # MINGW32 is missing the memalign function +GCC33ORLATER = $(shell $(CXX) -v 2>&1 | grep -c "gcc version \(3.[3-9]\|[4-9]\)") +GAS210ORLATER = $(shell echo "" | $(AS) -v 2>&1 | grep -c "GNU assembler version \(2.[1-9][0-9]\|[3-9]\)") + +ifeq ($(GCC33ORLATER) $(ISMINGW),1 0) # MINGW32 is missing the memalign function CXXFLAGS += -msse2 endif +ifeq ($(GAS210ORLATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10 +CXXFLAGS += -DCRYPTOPP_DISABLE_X86ASM +endif + +endif + ifeq ($(ISMINGW),1) LDLIBS += -lws2_32 endif diff --git a/config.h b/config.h index ee4c7019..a0b98e69 100644 --- a/config.h +++ b/config.h @@ -181,6 +181,11 @@ NAMESPACE_END #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE #endif +// CodeWarrior defines _MSC_VER +#if !defined(CRYPTOPP_DISABLE_X86ASM) && (defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__)) +#define CRYPTOPP_X86ASM_AVAILABLE +#endif + // ***************** determine availability of OS features ******************** #ifndef NO_OS_DEPENDENCE diff --git a/integer.cpp b/integer.cpp index ecab41c5..79214a24 100644 --- a/integer.cpp +++ b/integer.cpp @@ -865,8 +865,7 @@ void Portable::Multiply8Bottom(word *R, const word *A, const word *B) #undef SquAcc #undef SaveSquAcc -// CodeWarrior defines _MSC_VER -#if (defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__)) +#ifdef CRYPTOPP_X86ASM_AVAILABLE // ************** x86 feature detection *************** diff --git a/integer.h b/integer.h index 9006278a..aebbb41a 100644 --- a/integer.h +++ b/integer.h @@ -9,6 +9,8 @@ #include #include +#ifdef CRYPTOPP_X86ASM_AVAILABLE + #ifdef _M_IX86 #if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) || (defined(__ICL) && (__ICL >= 500)) #define SSE2_INTRINSICS_AVAILABLE @@ -26,6 +28,8 @@ #define SSE2_INTRINSICS_AVAILABLE #endif +#endif + NAMESPACE_BEGIN(CryptoPP) #if defined(SSE2_INTRINSICS_AVAILABLE) || defined(_MSC_VER)