Skip to content

Commit

Permalink
CONFIGURE: Add initial virtual feature support.
Browse files Browse the repository at this point in the history
This is used to support features as dependencies, which can be supplied by
multiple sources, like it is the case for Vorbis support.
  • Loading branch information
Johannes Schickel committed Sep 4, 2012
1 parent 8208d72 commit a83bca7
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions configure
Expand Up @@ -78,6 +78,14 @@ add_engine() {
done
}

# Add a feature: id name settings-list
add_feature() {
set_var _feature_${1}_name "${2}"
# This is a list of settings, where one must be "yes" for the feature to
# be enabled
set_var _feature_${1}_settings "${3}"
}

_srcdir=`dirname $0`

# Read list of engines
Expand Down Expand Up @@ -163,6 +171,17 @@ _endian=unknown
_need_memalign=yes
_have_x86=no

# Add (virtual) features
add_feature 16bit "16bit color" "_16bit"
add_feature faad "libfaad" "_faad"
add_feature flac "FLAC" "_flac"
add_feature freetype2 "FreeType2" "_freetype2"
add_feature mad "MAD" "_mad"
add_feature png "PNG" "_png"
add_feature theoradec "libtheoradec" "_theoradec"
add_feature vorbis "Vorbis file support" "_vorbis _tremor"
add_feature zlib "zlib" "_zlib"



# Directories for installing ScummVM.
Expand Down Expand Up @@ -440,6 +459,26 @@ Try \`$0 --help' for more information." >&2
}


#
# Feature handling functions
#

# Get the name of the feature
get_feature_name() {
get_var _feature_$1_name
}

# Check whether the feature is enabled
get_feature_state() {
for i in `get_var _feature_$1_settings`; do
if test `get_var $i` = "yes"; then
echo "yes"
return
fi
done
echo "no"
}


#
# Engine handling functions
Expand Down Expand Up @@ -547,8 +586,9 @@ check_engine_deps() {
if test `get_engine_build $1` = yes ; then
# Collect unmet dependencies
for dep in `get_engine_dependencies $1`; do
if test `get_var _${dep}` = no ; then
unmet_deps="${unmet_deps}${dep} "
if test `get_feature_state $dep` = "no"; then
feature_name=`get_feature_name $dep`
unmet_deps="${unmet_deps}${feature_name} "
fi
done

Expand Down

0 comments on commit a83bca7

Please sign in to comment.