summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2022-09-14 14:37:07 +0000
committerChristos Zoulas <christos@zoulas.com>2022-09-14 14:37:07 +0000
commita8e7d84e16a46395fb69131f92dcbf3348186592 (patch)
treec348d38ee2f3bbbbb43015c55be33bef39f19351 /configure.ac
parent011778a2877f75597ed83c1a2716d917770920ee (diff)
downloadfile-git-a8e7d84e16a46395fb69131f92dcbf3348186592.tar.gz
Add built-in zstd decompression support from Martin Rodriguez Reboredo.
While here, GC snprintf() and use makeerror() instead.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 19 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 6629300f..f6593917 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,6 +49,11 @@ AC_ARG_ENABLE([xzlib],
[AS_HELP_STRING([--disable-xzlib], [disable liblzma/xz compression support @<:@default=auto@:>@])])
AC_MSG_RESULT($enable_xzlib)
+AC_MSG_CHECKING(for zstdlib support)
+AC_ARG_ENABLE([zstdlib],
+[AS_HELP_STRING([--disable-zstdlib], [disable zstdlib compression support @<:@default=auto@:>@])])
+AC_MSG_RESULT($enable_zstdlib)
+
AC_MSG_CHECKING(for libseccomp support)
AC_ARG_ENABLE([libseccomp],
[AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])])
@@ -112,6 +117,9 @@ fi
if test "$enable_xzlib" != "no"; then
AC_CHECK_HEADERS(lzma.h)
fi
+if test "$enable_zstdlib" != "no"; then
+ AC_CHECK_HEADERS(zstd.h zstd_errors.h)
+fi
AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -180,6 +188,9 @@ fi
if test "$enable_xzlib" != "no"; then
AC_CHECK_LIB(lzma, lzma_stream_decoder)
fi
+if test "$enable_zstdlib" != "no"; then
+ AC_CHECK_LIB(zstd, ZSTD_createDStream)
+fi
if test "$enable_libseccomp" != "no"; then
AC_CHECK_LIB(seccomp, seccomp_init)
fi
@@ -215,6 +226,14 @@ fi
if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" = "yesyes"; then
AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support])
fi
+if test "$enable_zstdlib" = "yes"; then
+ if test "$ac_cv_header_zstd_h$ac_cv_lib_zstd_ZSTD_createDStream" != "yesyes"; then
+ AC_MSG_ERROR([zstdlib support requested but not found])
+ fi
+fi
+if test "$ac_cv_header_zstd_h$ac_cv_lib_zstd_ZSTD_createDStream" = "yesyes"; then
+ AC_DEFINE([ZSTDLIBSUPPORT], 1, [Enable zstdlib compression support])
+fi
AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile libmagic.pc])
AC_OUTPUT