diff --git a/lzf/lzf_filter.c b/lzf/lzf_filter.c index 951b1e4cc..67c2b95a1 100644 --- a/lzf/lzf_filter.c +++ b/lzf/lzf_filter.c @@ -26,7 +26,7 @@ #include #include #include "hdf5.h" -#include "lzf/lzf.h" +#include "lzf.h" #include "lzf_filter.h" /* Our own versions of H5Epush_sim, as it changed in 1.8 */ diff --git a/setup_build.py b/setup_build.py index 03c47fa0a..3c7c7adba 100644 --- a/setup_build.py +++ b/setup_build.py @@ -33,10 +33,6 @@ def localpath(*args): 'h5ds', 'h5ac', 'h5pl'] -EXTRA_SRC = {'h5z': [ localpath("lzf/lzf_filter.c"), - localpath("lzf/lzf/lzf_c.c"), - localpath("lzf/lzf/lzf_d.c")]} - COMPILER_SETTINGS = { 'libraries' : ['hdf5', 'hdf5_hl'], 'include_dirs' : [localpath('lzf')], @@ -46,6 +42,22 @@ def localpath(*args): ] } +EXTRA_SRC = {'h5z': [ localpath("lzf/lzf_filter.c") ]} + +# Set the environment variable H5PY_SYSTEM_LZF=1 if we want to +# use the system lzf library +if os.environ.get('H5PY_SYSTEM_LZF', '0') == '1': + EXTRA_LIBRARIES = { + 'h5z': [ 'lzf' ] + } +else: + COMPILER_SETTINGS['include_dirs'] += [localpath('lzf/lzf')] + + EXTRA_SRC['h5z'] += [localpath("lzf/lzf/lzf_c.c"), + localpath("lzf/lzf/lzf_d.c")] + + EXTRA_LIBRARIES = {} + if sys.platform.startswith('win'): COMPILER_SETTINGS['include_dirs'].append(localpath('windows')) COMPILER_SETTINGS['define_macros'].extend([ @@ -98,6 +110,7 @@ def _make_extensions(config): def make_extension(module): sources = [localpath('h5py', module + '.pyx')] + EXTRA_SRC.get(module, []) + settings['libraries'] += EXTRA_LIBRARIES.get(module, []) return Extension('h5py.' + module, sources, **settings) return [make_extension(m) for m in MODULES]