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.
This commit is contained in:
orbea 2019-06-19 22:19:30 -07:00
parent d50a6b6bd2
commit 4c7aa40a17
2 changed files with 11 additions and 9 deletions

View File

@ -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

View File

@ -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\"")"