diff --git a/CMakeLists.txt b/CMakeLists.txt index cd2e15f..93ec465 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,11 +37,21 @@ if(USE_PKGCONFIG) pkg_check_modules(LIBFTDI REQUIRED libftdi1) pkg_check_modules(LIBUSB REQUIRED libusb-1.0) pkg_check_modules(HIDAPI hidapi-hidraw) - pkg_check_modules(ZLIB zlib) # if hidraw not found try with libusb if(NOT HIDAPI_FOUND) pkg_check_modules(HIDAPI hidapi-libusb) endif() + # zlib support (gzip) + pkg_check_modules(ZLIB zlib) + if (NOT ZLIB_FOUND) + # try zlib-ng + pkg_check_modules(ZLIB zlib-ng) + if (ZLIB_FOUND) + add_definitions(-DHAS_ZLIBNG) + else() + message(FATAL_ERROR "Could find ZLIB") + endif() + endif(NOT ZLIB_FOUND) if(ENABLE_UDEV) pkg_check_modules(LIBUDEV libudev) diff --git a/src/configBitstreamParser.cpp b/src/configBitstreamParser.cpp index 3cb9289..92fb698 100644 --- a/src/configBitstreamParser.cpp +++ b/src/configBitstreamParser.cpp @@ -11,8 +11,16 @@ #include #ifdef HAS_ZLIB +#ifdef HAS_ZLIBNG +#include +#define z_stream zng_stream +#define inflateInit2(_strm, _windowBits) zng_inflateInit2(_strm, _windowBits) +#define inflate(_strm, __flush) zng_inflate(_strm, __flush) +#define inflateEnd(_strm) zng_inflateEnd(_strm) +#else #include #endif +#endif #include "display.hpp"