From 853408afb8b05ea0083c3fd5f4d0a1d86f3c45bf Mon Sep 17 00:00:00 2001
From: Oksana Shadura <oksana.shadura@cern.ch>
Date: Tue, 8 Aug 2017 13:32:05 +0200
Subject: [PATCH] Introducing "lz4" option (R__HAS_LZ4) for enabling LZ4 as
 default compr. algorithm

---
 cmake/modules/RootBuildOptions.cmake | 1 +
 config/RConfigure.in                 | 2 ++
 core/zip/src/Bits.h                  | 1 -
 test/MainEvent.cxx                   | 6 +++++-
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cmake/modules/RootBuildOptions.cmake b/cmake/modules/RootBuildOptions.cmake
index 122bf690155..94829d81214 100644
--- a/cmake/modules/RootBuildOptions.cmake
+++ b/cmake/modules/RootBuildOptions.cmake
@@ -128,6 +128,7 @@ ROOT_BUILD_OPTION(jemalloc OFF "Using the jemalloc allocator")
 ROOT_BUILD_OPTION(krb5 OFF "Kerberos5 support, requires Kerberos libs")
 ROOT_BUILD_OPTION(ldap OFF "LDAP support, requires (Open)LDAP libs")
 ROOT_BUILD_OPTION(libcxx OFF "Build using libc++, requires cxx11 option (MacOS X only, for the time being)")
+ROOT_BUILD_OPTION(lz4 OFF "LZ4 compression algorithm as a default, requires liblz4")
 ROOT_BUILD_OPTION(macos_native OFF "Disable looking for libraries, includes and binaries in locations other than a native installation (MacOS only)")
 ROOT_BUILD_OPTION(mathmore ON "Build the new libMathMore extended math library, requires GSL (vers. >= 1.8)")
 ROOT_BUILD_OPTION(memory_termination OFF "Free internal ROOT memory before process termination (experimental, used for leak checking)")
diff --git a/config/RConfigure.in b/config/RConfigure.in
index ddc0455d1e8..859c7913826 100644
--- a/config/RConfigure.in
+++ b/config/RConfigure.in
@@ -49,4 +49,6 @@
 #endif
 #endif
 
+#@haslz4compression@ R__HAS_LZ4   /**/
+
 #endif
diff --git a/core/zip/src/Bits.h b/core/zip/src/Bits.h
index bdfde4e6def..fe3b3663202 100644
--- a/core/zip/src/Bits.h
+++ b/core/zip/src/Bits.h
@@ -180,7 +180,6 @@ struct bits_internal_state {
  */
 int R__bi_init (bits_internal_state *state);
 
-
 /* ===========================================================================
  * Send a value on a given number of bits.
  * IN assertion: length <= 16 and value fits in length bits.
diff --git a/test/MainEvent.cxx b/test/MainEvent.cxx
index f31d664bd82..77cfec6dd62 100644
--- a/test/MainEvent.cxx
+++ b/test/MainEvent.cxx
@@ -121,7 +121,11 @@ int main(int argc, char **argv)
    Int_t arg4   = 1;
    Int_t arg5   = 600;     //default number of tracks per event
    Int_t enable_imt = 0;   // Whether to enable IMT mode.
-   Int_t compAlg = 4;      // Allow user to specify underlying compression algorithm.
+#ifdef R__HAS_LZ4
+   Int_t compAlg = 4; // Allow user to specify underlying compression algorithm.
+#else
+   Int_t compAlg = 1;
+#endif
    Int_t netf   = 0;
    Int_t punzip = 0;
 
-- 
GitLab