From 66e63950907b6ce1683243a165d89c560a8bef6c Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 17 May 2021 10:50:22 +0200 Subject: Add Automake conditional for zstd stream compression support In addition to the preprocessor define, use an Automake conditional for optional compilation of the zstd stream tests. Signed-off-by: David Oberhollenzer --- m4/zstd.m4 | 8 +++++++- tests/libfstream/Makemodule.am | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/m4/zstd.m4 b/m4/zstd.m4 index f644264..37a7f35 100644 --- a/m4/zstd.m4 +++ b/m4/zstd.m4 @@ -1,11 +1,17 @@ AC_DEFUN([AC_TEST_ZSTD_STREAM], [ AC_MSG_CHECKING([whether zstd supports stream compression]) AC_LANG_PUSH([C]) + ac_zstd_have_stream="no" 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_zstd_have_stream="yes" AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) + + AS_IF([test "x$ac_zstd_have_stream" = "xyes"], + [AC_DEFINE(HAVE_ZSTD_STREAM, 1, [Does zstd support stream compression?])]) + + AM_CONDITIONAL([HAVE_ZSTD_STREAM], [test "x$ac_zstd_have_stream" = "xyes"]) CFLAGS=$ac_zstd_save_CFLAGS AC_LANG_POP([C]) ]) diff --git a/tests/libfstream/Makemodule.am b/tests/libfstream/Makemodule.am index d943686..c3af095 100644 --- a/tests/libfstream/Makemodule.am +++ b/tests/libfstream/Makemodule.am @@ -55,9 +55,11 @@ TESTS += test_xfrm_gzip endif if WITH_ZSTD +if HAVE_ZSTD_STREAM check_PROGRAMS += test_xfrm_zstd TESTS += test_xfrm_zstd endif endif +endif EXTRA_DIST += $(top_srcdir)/tests/libfstream/get_line.txt -- cgit v1.2.3