From b52a9567520570bd6c850bcad3a6966f68639ef7 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 17 Sep 2020 13:09:06 +0200 Subject: 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 --- m4/zstd.m4 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 m4/zstd.m4 (limited to 'm4') diff --git a/m4/zstd.m4 b/m4/zstd.m4 new file mode 100644 index 0000000..f644264 --- /dev/null +++ b/m4/zstd.m4 @@ -0,0 +1,11 @@ +AC_DEFUN([AC_TEST_ZSTD_STREAM], [ + AC_MSG_CHECKING([whether zstd supports stream compression]) + AC_LANG_PUSH([C]) + ac_zstd_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ZSTD_CFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ZSTD_EndDirective op = ZSTD_e_end; ZSTD_compressStream2(NULL, NULL, NULL, op);])], + AC_DEFINE(HAVE_ZSTD_STREAM, 1, [Does zstd support stream compression?]) + AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) + CFLAGS=$ac_zstd_save_CFLAGS + AC_LANG_POP([C]) +]) -- cgit v1.2.3