From 5a082ad15a0f46dc1cbfd8aa5cb3ad9d94b5f178 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Fri, 9 Feb 2018 20:57:31 -0600 Subject: [PATCH] configure.ac: check if lzma has MT support, fix deb build/etc. --- configure.ac | 2 ++ src/libutil/compression.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index 83b2346d0..c7498fb52 100644 --- a/configure.ac +++ b/configure.ac @@ -175,6 +175,8 @@ AC_SUBST(HAVE_SODIUM, [$have_sodium]) # Look for liblzma, a required dependency. PKG_CHECK_MODULES([LIBLZMA], [liblzma], [CXXFLAGS="$LIBLZMA_CFLAGS $CXXFLAGS"]) +AC_CHECK_LIB([lzma], [lzma_stream_encoder_mt], + [AC_DEFINE([HAVE_LZMA_MT], [1], [xz multithreaded compression support])]) # Look for libbrotli{enc,dec}, optional dependencies diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc index ed15761b3..c509472b3 100644 --- a/src/libutil/compression.cc +++ b/src/libutil/compression.cc @@ -192,6 +192,7 @@ struct XzSink : CompressionSink XzSink(Sink & nextSink, const bool parallel) : nextSink(nextSink) { lzma_ret ret; +#ifdef HAVE_LZMA_MT if (parallel) { lzma_mt mt_options = {}; mt_options.flags = 0; @@ -208,6 +209,7 @@ struct XzSink : CompressionSink ret = lzma_stream_encoder_mt( &strm, &mt_options); } else +#endif ret = lzma_easy_encoder( &strm, 6, LZMA_CHECK_CRC64);