include(CheckIncludeFile)
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
+include(CMakeDependentOption)
include(FeatureSummary)
# make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact
MFPU_NEON_AVAILABLE FAIL_REGEX "not supported")
set(CMAKE_REQUIRED_FLAGS)
+# FORCE_SSE2 option will only be shown if HAVE_SSE2_INTRIN is true
+if("${ARCH}" MATCHES "i[3-6]86")
+ cmake_dependent_option(FORCE_SSE2 "Always assume CPU is SSE2 capable" OFF "HAVE_SSE2_INTRIN" OFF)
+endif()
+
#
# Enable deflate_medium at level 4-6
#
if("${ARCH}" MATCHES "x86_64" OR "${ARCH}" MATCHES "AMD64" OR "${ARCH}" MATCHES "i[3-6]86")
set(ARCHDIR "arch/x86")
add_definitions(-DUNALIGNED_OK)
- if("${ARCH}" MATCHES "x86_64" OR "${ARCH}" MATCHES "AMD64")
- add_definitions(-DX86_NOCHECK_SSE2)
- endif()
add_feature_info(SSE2 1 "Support the SSE2 instruction set, using \"${SSE2FLAG}\"")
elseif("${ARCH}" MATCHES "arm")
set(ARCHDIR "arch/arm")
set(ZLIB_ARCH_SRCS ${ZLIB_ARCH_SRCS} ${ARCHDIR}/fill_window_sse.c)
if(NOT ${ARCH} MATCHES "x86_64")
add_intrinsics_option("${SSE2FLAG}")
+ add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable")
+ if(FORCE_SSE2)
+ add_definitions(-DX86_NOCHECK_SSE2)
+ endif()
endif()
endif()
if(HAVE_PCLMULQDQ_INTRIN)
with_fuzzers=0
floatabi=
native=0
+forcesse2=0
sse2flag="-msse2"
sse4flag="-msse4"
sse42flag="-msse4.2"
echo ' [--without-optimizations] Compiles without support for optional instruction sets' | tee -a configure.log
echo ' [--without-new-strategies] Compiles without using new additional deflate strategies' | tee -a configure.log
echo ' [--acle] [--neon] Compiles with additional instruction set enabled' | tee -a configure.log
+ echo ' [--force-sse2] Assume SSE2 instructions are always available (disabled by default on x86, enabled on x86_64)' | tee -a configure.log
echo ' [--with-sanitizers] Build with address sanitizer and all supported sanitizers other than memory sanitizer (disabled by default)' | tee -a configure.log
echo ' [--with-msan] Build with memory sanitizer (disabled by default)' | tee -a configure.log
echo ' [--with-fuzzers] Build test/fuzz (disabled by default)' | tee -a configure.log
-6* | --64) build64=1; shift ;;
--without-acle) buildacle=0; shift ;;
--without-neon) buildneon=0; shift ;;
+ --force-sse2) forcesse2=1; shift ;;
-n | --native) native=1; shift ;;
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} fill_window_sse.o"
ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} fill_window_sse.lo"
+ if test $forcesse2 -eq 1; then
+ CFLAGS="${CFLAGS} -DX86_NOCHECK_SSE2"
+ SFLAGS="${SFLAGS} -DX86_NOCHECK_SSE2"
+ fi
+
# Enable deflate_quick at level 1?
# requires SSE2: code uses fill_window_sse
if test $without_new_strategies -eq 0; then
x86_64)
ARCHDIR=arch/x86
- CFLAGS="${CFLAGS} -DX86_NOCHECK_SSE2 -DUNALIGNED_OK"
- SFLAGS="${SFLAGS} -DX86_NOCHECK_SSE2 -DUNALIGNED_OK"
+ CFLAGS="${CFLAGS} -DUNALIGNED_OK"
+ SFLAGS="${SFLAGS} -DUNALIGNED_OK"
# Enable arch-specific optimizations?
if test $without_optimizations -eq 0; then