disable x86 assembly on systems without GNU as 2.10 or later

pull/2/head
weidai 2004-06-19 11:00:52 +00:00
parent 7f2eb60bca
commit 5bee373ff3
4 changed files with 21 additions and 4 deletions

View File

@ -16,12 +16,21 @@ ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4
CXX = g++ CXX = g++
endif 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 CXXFLAGS += -msse2
endif endif
ifeq ($(GAS210ORLATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10
CXXFLAGS += -DCRYPTOPP_DISABLE_X86ASM
endif
endif
ifeq ($(ISMINGW),1) ifeq ($(ISMINGW),1)
LDLIBS += -lws2_32 LDLIBS += -lws2_32
endif endif

View File

@ -181,6 +181,11 @@ NAMESPACE_END
#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
#endif #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 ******************** // ***************** determine availability of OS features ********************
#ifndef NO_OS_DEPENDENCE #ifndef NO_OS_DEPENDENCE

View File

@ -865,8 +865,7 @@ void Portable::Multiply8Bottom(word *R, const word *A, const word *B)
#undef SquAcc #undef SquAcc
#undef SaveSquAcc #undef SaveSquAcc
// CodeWarrior defines _MSC_VER #ifdef CRYPTOPP_X86ASM_AVAILABLE
#if (defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__))
// ************** x86 feature detection *************** // ************** x86 feature detection ***************

View File

@ -9,6 +9,8 @@
#include <iosfwd> #include <iosfwd>
#include <algorithm> #include <algorithm>
#ifdef CRYPTOPP_X86ASM_AVAILABLE
#ifdef _M_IX86 #ifdef _M_IX86
#if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) || (defined(__ICL) && (__ICL >= 500)) #if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) || (defined(__ICL) && (__ICL >= 500))
#define SSE2_INTRINSICS_AVAILABLE #define SSE2_INTRINSICS_AVAILABLE
@ -26,6 +28,8 @@
#define SSE2_INTRINSICS_AVAILABLE #define SSE2_INTRINSICS_AVAILABLE
#endif #endif
#endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(SSE2_INTRINSICS_AVAILABLE) || defined(_MSC_VER) #if defined(SSE2_INTRINSICS_AVAILABLE) || defined(_MSC_VER)