From 4c7aa40a171f5c07274c551ca7e03e22516855a2 Mon Sep 17 00:00:00 2001 From: orbea Date: Wed, 19 Jun 2019 22:19:30 -0700 Subject: [PATCH] qb: Extend the check_enabled function. This extends the check_enabled function to be able to check more than one feature. In the case of RPNG it depends on either the builtin or system zlib, but if the system zlib was not available while the builtin zlib was it would still be disabled erroneously. Now it will only be disabled if both the system and builtin zlib are disabled. --- qb/config.libs.sh | 2 +- qb/qb.libs.sh | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index d8d3e3f1e0..462a37ebb3 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -524,5 +524,5 @@ if [ "$HAVE_DEBUG" = 'yes' ]; then fi check_enabled MENU MENU_WIDGETS 'menu widgets' 'The menu is' false -check_enabled ZLIB RPNG RPNG 'zlib is' false +check_enabled 'ZLIB BUILTINZLIB' RPNG RPNG 'zlib is' false check_enabled V4L2 VIDEOPROCESSOR 'video processor' 'Video4linux2 is' true diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index 9e56ef5feb..74c193a92c 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -48,21 +48,23 @@ check_compiler() } # check_enabled: -# $1 = HAVE_$1 [Disabled feature] +# $1 = HAVE_$1 [Disabled 'feature' or 'feature feature1 feature2', $1 = name] # $2 = USER_$2 [Enabled feature] # $3 = lib # $4 = feature # $5 = enable lib when true [checked only if non-empty] check_enabled() -{ tmpvar="$(eval "printf %s \"\$HAVE_$1\"")" - setval="$(eval "printf %s \"\$HAVE_$2\"")" +{ setval="$(eval "printf %s \"\$HAVE_$2\"")" - if [ "$tmpvar" != 'no' ]; then - if [ "$setval" != 'no' ] && [ "${5:-}" = 'true' ]; then - eval "HAVE_$2=yes" + for val in $(printf %s "$1"); do + tmpvar="$(eval "printf %s \"\$HAVE_$val\"")" + if [ "$tmpvar" != 'no' ]; then + if [ "$setval" != 'no' ] && [ "${5:-}" = 'true' ]; then + eval "HAVE_$2=yes" + fi + return 0 fi - return 0 - fi + done tmpval="$(eval "printf %s \"\$USER_$2\"")"