summaryrefslogtreecommitdiff
path: root/lib/fstream/uncompress
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-17 13:09:06 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-17 13:10:25 +0200
commitb52a9567520570bd6c850bcad3a6966f68639ef7 (patch)
treeb63e6515b25020b3abdfdd63731db0d44ac54925 /lib/fstream/uncompress
parentec38f4fa90d65362002a901b2d74be09fc6b128c (diff)
Add a check whether libzstd supports stream compression
Streaming compression was added fairly recently to zstd (and then the API was changed a few times). Rather than rely on libzstd versioning macros, this commit adds an m4 script to test at configure time if the enums/functions we need are available by trying to compile a small sample. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstream/uncompress')
-rw-r--r--lib/fstream/uncompress/istream_compressor.c2
-rw-r--r--lib/fstream/uncompress/zstd.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/fstream/uncompress/istream_compressor.c b/lib/fstream/uncompress/istream_compressor.c
index bc8ef39..75edd1b 100644
--- a/lib/fstream/uncompress/istream_compressor.c
+++ b/lib/fstream/uncompress/istream_compressor.c
@@ -40,7 +40,7 @@ istream_t *istream_compressor_create(istream_t *strm, int comp_id)
#endif
break;
case FSTREAM_COMPRESSOR_ZSTD:
-#ifdef WITH_ZSTD
+#if defined(WITH_ZSTD) && defined(HAVE_ZSTD_STREAM)
comp = istream_zstd_create(strm->get_filename(strm));
#endif
break;
diff --git a/lib/fstream/uncompress/zstd.c b/lib/fstream/uncompress/zstd.c
index 1838af5..fd22cbf 100644
--- a/lib/fstream/uncompress/zstd.c
+++ b/lib/fstream/uncompress/zstd.c
@@ -8,6 +8,7 @@
#include <zstd.h>
+#ifdef HAVE_ZSTD_STREAM
typedef struct {
istream_comp_t base;
@@ -77,3 +78,4 @@ istream_comp_t *istream_zstd_create(const char *filename)
base->cleanup = cleanup;
return base;
}
+#endif /* HAVE_ZSTD_STREAM */