Make configure fail on invalid (-no)-feature options

configure script has been silently accepting whatever flags that begin
with "-feature-" even if the feature name does not exist at all.

Since the script validates many other flags, this behavior can make
users believe flags they supply is valid when it isn't.
Besides, this option is currently not protected against typo in any way.

This commit verifies those flags against content of
"qtbase/src/corelib/global/qfeatures.txt" and fails if supplied
flag is not a valid feature name.

Change-Id: Ib19ec66dd5558fb5491e8e080ce07d4807d94c1f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
N.Sukegawa 2014-11-08 20:42:00 +09:00 committed by Nobuaki Sukegawa
parent c1081b9426
commit f1aafb595b

7
configure vendored
View File

@ -1409,7 +1409,8 @@ while [ "$#" -gt 0 ]; do
fi
;;
feature-*)
FEATURE=`echo $VAR | sed 's,^[^-]*-\([^-]*\),\1,' | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
FEATURE=`echo $VAR | sed 's,^[^-]*-\([^-]*\),\1,' | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
if grep "^Feature: *${FEATURE} *\$" "$relpath"/src/corelib/global/qfeatures.txt >/dev/null 2>&1; then
if [ "$VAL" = "no" ]; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
@ -1417,6 +1418,10 @@ while [ "$#" -gt 0 ]; do
else
UNKNOWN_OPT=yes
fi
else
echo "ERROR: Unknown feature $FEATURE"
UNKNOWN_OPT=yes
fi
;;
shared)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then