wscript: allow linking with system-wide opus 1.6.1 which has a fix for custom modes

This commit is contained in:
Alibek Omarov
2026-02-05 07:46:32 +05:00
parent 732bc50a3a
commit f01818a3f8

View File

@@ -528,7 +528,13 @@ int main(int argc, char **argv) { return opus_tagcompare(argv[0], argv[1]); }'''
# search for opus 1.4 only, it has fixes for custom modes
# 1.5 breaks custom modes: https://github.com/xiph/opus/issues/374
if conf.check_cfg(package='opus', uselib_store='opus', args='opus = 1.4 --cflags --libs', mandatory=False):
have_opus = conf.check_cfg(package='opus', uselib_store='opus', args=['opus = 1.4', '--cflags', '--libs'], mandatory=False)
# 1.6.1 fixes them again
if not have_opus:
have_opus = conf.check_cfg(package='opus', uselib_store='opus', args=['opus >= 1.6.1', '--cflags', '--libs'], mandatory=False)
if have_opus:
# now try to link with export that only exists with CUSTOM_MODES defined
frag='''#include <opus_custom.h>
int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''