[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Use autoconf to check for optional zstd functionality.
commit 5199b9b33747ddcf787cf97d5e14b3b50a579802
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Sun Feb 18 16:19:43 2018 -0500
Use autoconf to check for optional zstd functionality.
Fixes a bug in our zstd-static code. Bug not in any released
version of Tor.
---
configure.ac | 10 ++++++++++
src/common/compress_zstd.c | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/configure.ac b/configure.ac
index 1f43650b0..22c8a5613 100644
--- a/configure.ac
+++ b/configure.ac
@@ -977,6 +977,16 @@ if test "x$have_zstd" = "xyes"; then
AC_DEFINE(HAVE_ZSTD,1,[Have Zstd])
TOR_ZSTD_CFLAGS="${ZSTD_CFLAGS}"
TOR_ZSTD_LIBS="${ZSTD_LIBS}"
+
+ dnl now check for zstd functions
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$LIBS $ZSTD_LIBS"
+ CFLAGS="$CFLAGS $ZSTD_CFLAGS"
+ AC_CHECK_FUNCS(ZSTD_estimateCStreamSize \
+ ZSTD_estimateDCtxSize)
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
fi
AC_SUBST(TOR_ZSTD_CFLAGS)
AC_SUBST(TOR_ZSTD_LIBS)
diff --git a/src/common/compress_zstd.c b/src/common/compress_zstd.c
index 4e26c724e..4024f5594 100644
--- a/src/common/compress_zstd.c
+++ b/src/common/compress_zstd.c
@@ -219,10 +219,14 @@ tor_zstd_state_size_precalc(int compress, int preset)
#ifdef ZSTD_STATIC_LINKING_ONLY
if (tor_zstd_can_use_static_apis()) {
if (compress) {
+#ifdef HAVE_ZSTD_ESTIMATECSTREAMSIZE
return ZSTD_estimateCStreamSize(preset);
+#endif
} else {
+#ifdef HAVE_ZSTD_ESTIMATEDCTXSIZE
/* Could use DStream, but that takes a windowSize. */
return ZSTD_estimateDCtxSize();
+#endif
}
}
#endif
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits