support various compression schemes
refs: #5061, #4917
Change-Id: Icba04b8693e40c4f065293b8d688ba32c63bd7bb
diff --git a/wscript b/wscript
index 8c89ab5..ee0e754 100644
--- a/wscript
+++ b/wscript
@@ -7,6 +7,13 @@
APPNAME = 'PSync'
GIT_TAG_PREFIX = ''
+BOOST_COMPRESSION_CODE = '''
+#include <boost/iostreams/filter/{0}.hpp>
+int main() {{ boost::iostreams::{0}_compressor test; }}
+'''
+
+COMPRESSION_SCHEMES = ['zlib', 'gzip', 'bzip2', 'lzma', 'zstd']
+
def options(opt):
opt.load(['compiler_c', 'compiler_cxx', 'gnu_dirs'])
opt.load(['default-compiler-flags', 'coverage', 'sanitizers',
@@ -19,6 +26,10 @@
optgrp.add_option('--with-tests', action='store_true', default=False,
help='Build unit tests')
+ for scheme in COMPRESSION_SCHEMES:
+ optgrp.add_option('--without-{}'.format(scheme), action='store_true', default=False,
+ help='Build without {}'.format(scheme))
+
def configure(conf):
conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs',
'default-compiler-flags', 'boost',
@@ -36,6 +47,14 @@
conf.check_boost(lib=boost_libs, mt=True)
+ for scheme in COMPRESSION_SCHEMES:
+ if getattr(conf.options, 'without_{}'.format(scheme)):
+ continue
+ conf.check_cxx(fragment=BOOST_COMPRESSION_CODE.format(scheme),
+ use='BOOST', execute=False, mandatory=False,
+ msg='Checking for {} support in boost iostreams'.format(scheme),
+ define_name='HAVE_{}'.format(scheme.upper()))
+
conf.check_compiler_flags()
# Loading "late" to prevent tests from being compiled with profiling flags