- if conf.options.jpeg == 'oj2':
- conf.check_cfg(package='libopenjp2', args='--cflags', atleast_version='2.1.0', uselib_store='OPENJPEG', mandatory=True)
- conf.env.STLIB_OPENJPEG = ['openjp2']
- elif conf.options.jpeg == 'oj1':
- conf.check_cfg(package='libopenjpeg1', args='--cflags', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
- conf.env.STLIB_OPENJPEG = ['openjpeg']
- conf.check_cfg(package='libasdcp-carl', atleast_version='0.1.3', args='--cflags', uselib_store='ASDCPLIB_CTH', mandatory=True)
+ conf.check_cfg(package='libopenjp2', args='--cflags', uselib_store='OPENJPEG', mandatory=True, msg='Checking for any version of libopenjp2')
+ else:
+ conf.check_cfg(package='libopenjp2', args='--cflags --libs', uselib_store='OPENJPEG', mandatory=True, msg='Checking for any version of libopenjp2')
+
+ patched_openjpeg = conf.check_cxx(fragment="""
+ #include <openjpeg.h>
+ int main() { opj_cparameters_t p; p.numgbits = 2; }\n
+ """,
+ msg='Checking for numgbits in opj_cparameters_t',
+ use='OPENJPEG',
+ mandatory=False,
+ define_name='LIBDCP_HAVE_NUMGBITS')
+
+ if not patched_openjpeg:
+ # We don't have our patched version so we need 2.5.0 to get the GUARD_BITS option
+ conf.check_cfg(package='libopenjp2', args='libopenjp2 >= 2.5.0', uselib_store='OPENJPEG', mandatory=True, msg='Checking for libopenjp2 >= 2.5.0')
+
+ if conf.options.static:
+ conf.env.STLIB_OPENJPEG = ['openjp2']
+ conf.check_cfg(package='libasdcp-carl', args='libasdcp-carl >= 0.1.3 --cflags', uselib_store='ASDCPLIB_CTH', mandatory=True)