From 5c064de10dc544ceeecfc63f6a781b9f71576f57 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 9 May 2016 20:00:46 -0500 Subject: [PATCH] Build: Don't allow jpeg-7+ emul. w/o arith coding The jpeg-7/jpeg-8 APIs/ABIs require arithmetic coding, and the jpeg-8 API/ABI requires the memory source/destination manager, so this commit causes the build system to ignore --with-arith-enc/--without-arith-enc and --with-arith-dec/--without-arith-dec (and the equivalent CMake variables-- WITH_ARITH_ENC and WITH_ARITH_DEC) when v7/v8 API/ABI emulation is enabled. Furthermore, the CMake build system now ignores WITH_MEM_SRCDST whenever WITH_JPEG8 is specified (the autotools build system already did that.) --- CMakeLists.txt | 12 ++++++++++-- configure.ac | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c4a46b..1ad29f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,8 @@ endif() message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") option(WITH_SIMD "Include SIMD extensions" TRUE) -option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE) -option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE) +option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE) +option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE) option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) @@ -57,6 +57,14 @@ else() set(BITS_IN_JSAMPLE 8) endif() +if(WITH_JPEG8 OR WITH_JPEG7) + set(WITH_ARITH_ENC 1) + set(WITH_ARITH_DEC 1) +endif() +if(WITH_JPEG8) + set(WITH_MEM_SRCDST 1) +endif() + if(WITH_ARITH_ENC) set(C_ARITH_CODING_SUPPORTED 1) message(STATUS "Arithmetic encoding support enabled") diff --git a/configure.ac b/configure.ac index d6a3e33..9b2c573 100644 --- a/configure.ac +++ b/configure.ac @@ -279,10 +279,13 @@ AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.]) AC_MSG_CHECKING([whether to include arithmetic encoding support]) AC_ARG_WITH([arith-enc], AC_HELP_STRING([--without-arith-enc], - [Do not include arithmetic encoding support])) + [Do not include arithmetic encoding support when emulating the libjpeg v6b API/ABI])) if test "x$with_12bit" = "xyes"; then with_arith_enc=no fi +if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then + with_arith_enc=yes +fi if test "x$with_arith_enc" = "xno"; then AC_MSG_RESULT(no) RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc" @@ -295,10 +298,13 @@ AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"]) AC_MSG_CHECKING([whether to include arithmetic decoding support]) AC_ARG_WITH([arith-dec], AC_HELP_STRING([--without-arith-dec], - [Do not include arithmetic decoding support])) + [Do not include arithmetic decoding support when emulating the libjpeg v6b API/ABI])) if test "x$with_12bit" = "xyes"; then with_arith_dec=no fi +if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then + with_arith_dec=yes +fi if test "x$with_arith_dec" = "xno"; then AC_MSG_RESULT(no) RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec" -- 2.40.0