[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Add configure option to control ZSTD_STATIC_LINKING_ONLY



commit a03488954c15b2fe2643d19c5530d9c927665b6f
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Feb 6 11:58:05 2018 -0500

    Add configure option to control ZSTD_STATIC_LINKING_ONLY
---
 configure.ac               | 6 ++++++
 src/common/compress_zstd.c | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3cb187b0e..2063e9a83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,8 @@ AC_ARG_ENABLE(cargo-online-mode,
    AS_HELP_STRING(--enable-cargo-online-mode, [Allow cargo to make network requests to fetch crates. For builds with rust only.]))
 AC_ARG_ENABLE(restart-debugging,
    AS_HELP_STRING(--enable-restart-debugging, [Build Tor with support for debugging in-process restart. Developers only.]))
+AC_ARG_ENABLE(zstd-advanced-apis,
+   AS_HELP_STRING(--disable-zstd-advanced-apis, [Build without support for zstd's "static-only" APIs.]))
 
 if test "x$enable_coverage" != "xyes" -a "x$enable_asserts_in_tests" = "xno" ; then
     AC_MSG_ERROR([Can't disable assertions outside of coverage build])
@@ -114,6 +116,10 @@ if test "$enable_restart_debugging" = "yes"; then
             [Defined if we're building with support for in-process restart debugging.])
 fi
 
+if test "$enable_zstd_advanced_apis" != "no"; then
+   AC_DEFINE(ENABLE_ZSTD_ADVANCED_APIS, 1,
+             [Defined if we're going to try to use zstd's "static-only" APIs.])
+fi
 
 # systemd support
 if test "x$enable_systemd" = "xno"; then
diff --git a/src/common/compress_zstd.c b/src/common/compress_zstd.c
index 96906efb9..0c3e7104f 100644
--- a/src/common/compress_zstd.c
+++ b/src/common/compress_zstd.c
@@ -18,12 +18,12 @@
 #include "compress.h"
 #include "compress_zstd.h"
 
+#ifdef ENABLE_ZSTD_ADVANCED_APIS
 /* This is a lie, but we make sure it doesn't get us in trouble by wrapping
  * all invocations of zstd's static-only functions in a check to make sure
- * that the compile-time version matches the run-time version.
- *
- * Note: Make sure that this file still builds with this macro disabled. */
+ * that the compile-time version matches the run-time version. */
 #define ZSTD_STATIC_LINKING_ONLY
+#endif
 
 #ifdef HAVE_ZSTD
 #include <zstd.h>
@@ -499,7 +499,7 @@ tor_zstd_init(void)
 void
 tor_zstd_warn_if_version_mismatched(void)
 {
-#ifdef HAVE_ZSTD
+#if defined(HAVE_ZSTD) && defined(ENABLE_ZSTD_ADVANCED_APIS)
   if (! tor_zstd_can_use_static_apis()) {
     char header_version[VERSION_STR_MAX_LEN];
     char runtime_version[VERSION_STR_MAX_LEN];



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits