Commit 42ab401f authored by James Zern's avatar James Zern

configure: rename enable() to enable_feature()

+ disable() -> disable_feature() for balance

this avoids shadowing the bash builtin 'enable' allowing the scripts to
be linted with checkbashisms

Change-Id: Ia11cf86c92ec25bd14e69427b0ac0a9a61a5f7a5
parent 3286abd8
...@@ -198,11 +198,11 @@ add_extralibs() { ...@@ -198,11 +198,11 @@ add_extralibs() {
# #
# Boolean Manipulation Functions # Boolean Manipulation Functions
# #
enable(){ enable_feature(){
set_all yes $* set_all yes $*
} }
disable(){ disable_feature(){
set_all no $* set_all no $*
} }
...@@ -219,7 +219,7 @@ soft_enable() { ...@@ -219,7 +219,7 @@ soft_enable() {
for var in $*; do for var in $*; do
if ! disabled $var; then if ! disabled $var; then
log_echo " enabling $var" log_echo " enabling $var"
enable $var enable_feature $var
fi fi
done done
} }
...@@ -228,7 +228,7 @@ soft_disable() { ...@@ -228,7 +228,7 @@ soft_disable() {
for var in $*; do for var in $*; do
if ! enabled $var; then if ! enabled $var; then
log_echo " disabling $var" log_echo " disabling $var"
disable $var disable_feature $var
fi fi
done done
} }
...@@ -251,10 +251,10 @@ tolower(){ ...@@ -251,10 +251,10 @@ tolower(){
# Temporary File Functions # Temporary File Functions
# #
source_path=${0%/*} source_path=${0%/*}
enable source_path_used enable_feature source_path_used
if test -z "$source_path" -o "$source_path" = "." ; then if test -z "$source_path" -o "$source_path" = "." ; then
source_path="`pwd`" source_path="`pwd`"
disable source_path_used disable_feature source_path_used
fi fi
if test ! -z "$TMPDIR" ; then if test ! -z "$TMPDIR" ; then
...@@ -317,8 +317,8 @@ check_header(){ ...@@ -317,8 +317,8 @@ check_header(){
header=$1 header=$1
shift shift
var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
disable $var disable_feature $var
check_cpp "$@" <<EOF && enable $var check_cpp "$@" <<EOF && enable_feature $var
#include "$header" #include "$header"
int x; int x;
EOF EOF
...@@ -480,7 +480,7 @@ process_common_cmdline() { ...@@ -480,7 +480,7 @@ process_common_cmdline() {
for opt in "$@"; do for opt in "$@"; do
optval="${opt#*=}" optval="${opt#*=}"
case "$opt" in case "$opt" in
--child) enable child --child) enable_feature child
;; ;;
--log*) --log*)
logging="$optval" logging="$optval"
...@@ -492,7 +492,7 @@ process_common_cmdline() { ...@@ -492,7 +492,7 @@ process_common_cmdline() {
;; ;;
--target=*) toolchain="${toolchain:-${optval}}" --target=*) toolchain="${toolchain:-${optval}}"
;; ;;
--force-target=*) toolchain="${toolchain:-${optval}}"; enable force_toolchain --force-target=*) toolchain="${toolchain:-${optval}}"; enable_feature force_toolchain
;; ;;
--cpu) --cpu)
;; ;;
...@@ -528,7 +528,7 @@ process_common_cmdline() { ...@@ -528,7 +528,7 @@ process_common_cmdline() {
;; ;;
--libc=*) --libc=*)
[ -d "${optval}" ] || die "Not a directory: ${optval}" [ -d "${optval}" ] || die "Not a directory: ${optval}"
disable builtin_libc disable_feature builtin_libc
alt_libc="${optval}" alt_libc="${optval}"
;; ;;
--as=*) --as=*)
...@@ -697,13 +697,13 @@ process_common_toolchain() { ...@@ -697,13 +697,13 @@ process_common_toolchain() {
# Mark the specific ISA requested as enabled # Mark the specific ISA requested as enabled
soft_enable ${tgt_isa} soft_enable ${tgt_isa}
enable ${tgt_os} enable_feature ${tgt_os}
enable ${tgt_cc} enable_feature ${tgt_cc}
# Enable the architecture family # Enable the architecture family
case ${tgt_isa} in case ${tgt_isa} in
arm*) enable arm;; arm*) enable_feature arm;;
mips*) enable mips;; mips*) enable_feature mips;;
esac esac
# PIC is probably what we want when building shared libs # PIC is probably what we want when building shared libs
...@@ -766,7 +766,7 @@ process_common_toolchain() { ...@@ -766,7 +766,7 @@ process_common_toolchain() {
case ${toolchain} in case ${toolchain} in
sparc-solaris-*) sparc-solaris-*)
add_extralibs -lposix4 add_extralibs -lposix4
disable fast_unaligned disable_feature fast_unaligned
;; ;;
*-solaris-*) *-solaris-*)
add_extralibs -lposix4 add_extralibs -lposix4
...@@ -791,7 +791,7 @@ process_common_toolchain() { ...@@ -791,7 +791,7 @@ process_common_toolchain() {
;; ;;
armv5te) armv5te)
soft_enable edsp soft_enable edsp
disable fast_unaligned disable_feature fast_unaligned
;; ;;
esac esac
...@@ -843,8 +843,8 @@ EOF ...@@ -843,8 +843,8 @@ EOF
asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl"
AS_SFX=.s AS_SFX=.s
msvs_arch_dir=arm-msvs msvs_arch_dir=arm-msvs
disable multithread disable_feature multithread
disable unit_tests disable_feature unit_tests
;; ;;
rvct) rvct)
CC=armcc CC=armcc
...@@ -881,8 +881,8 @@ EOF ...@@ -881,8 +881,8 @@ EOF
case ${tgt_os} in case ${tgt_os} in
none*) none*)
disable multithread disable_feature multithread
disable os_support disable_feature os_support
;; ;;
android*) android*)
...@@ -914,7 +914,7 @@ EOF ...@@ -914,7 +914,7 @@ EOF
# Cortex-A8 implementations (NDK Dev Guide) # Cortex-A8 implementations (NDK Dev Guide)
add_ldflags "-Wl,--fix-cortex-a8" add_ldflags "-Wl,--fix-cortex-a8"
enable pic enable_feature pic
soft_enable realtime_only soft_enable realtime_only
if [ ${tgt_isa} = "armv7" ]; then if [ ${tgt_isa} = "armv7" ]; then
soft_enable runtime_cpu_detect soft_enable runtime_cpu_detect
...@@ -970,7 +970,7 @@ EOF ...@@ -970,7 +970,7 @@ EOF
;; ;;
linux*) linux*)
enable linux enable_feature linux
if enabled rvct; then if enabled rvct; then
# Check if we have CodeSourcery GCC in PATH. Needed for # Check if we have CodeSourcery GCC in PATH. Needed for
# libraries # libraries
...@@ -1001,14 +1001,14 @@ EOF ...@@ -1001,14 +1001,14 @@ EOF
tune_cflags="-mtune=" tune_cflags="-mtune="
if enabled dspr2; then if enabled dspr2; then
check_add_cflags -mips32r2 -mdspr2 check_add_cflags -mips32r2 -mdspr2
disable fast_unaligned disable_feature fast_unaligned
fi fi
check_add_cflags -march=${tgt_isa} check_add_cflags -march=${tgt_isa}
check_add_asflags -march=${tgt_isa} check_add_asflags -march=${tgt_isa}
check_add_asflags -KPIC check_add_asflags -KPIC
;; ;;
ppc*) ppc*)
enable ppc enable_feature ppc
bits=${tgt_isa##ppc} bits=${tgt_isa##ppc}
link_with_cc=gcc link_with_cc=gcc
setup_gnu_toolchain setup_gnu_toolchain
...@@ -1156,7 +1156,7 @@ EOF ...@@ -1156,7 +1156,7 @@ EOF
;; ;;
universal*|*-gcc|generic-gnu) universal*|*-gcc|generic-gnu)
link_with_cc=gcc link_with_cc=gcc
enable gcc enable_feature gcc
setup_gnu_toolchain setup_gnu_toolchain
;; ;;
esac esac
...@@ -1205,14 +1205,14 @@ EOF ...@@ -1205,14 +1205,14 @@ EOF
enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
# Check for strip utility variant # Check for strip utility variant
${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable gnu_strip ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip
# Try to determine target endianness # Try to determine target endianness
check_cc <<EOF check_cc <<EOF
unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E';
EOF EOF
[ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' |
grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian grep '4f *32 *42 *45' >/dev/null 2>&1 && enable_feature big_endian
# Try to find which inline keywords are supported # Try to find which inline keywords are supported
check_cc <<EOF && INLINE="inline" check_cc <<EOF && INLINE="inline"
...@@ -1237,7 +1237,7 @@ EOF ...@@ -1237,7 +1237,7 @@ EOF
if enabled dspr2; then if enabled dspr2; then
if enabled big_endian; then if enabled big_endian; then
echo "dspr2 optimizations are available only for little endian platforms" echo "dspr2 optimizations are available only for little endian platforms"
disable dspr2 disable_feature dspr2
fi fi
fi fi
;; ;;
...@@ -1310,7 +1310,7 @@ process_detect() { ...@@ -1310,7 +1310,7 @@ process_detect() {
true; true;
} }
enable logging enable_feature logging
logfile="config.log" logfile="config.log"
self=$0 self=$0
process() { process() {
......
...@@ -153,7 +153,7 @@ all_targets="libs examples docs" ...@@ -153,7 +153,7 @@ all_targets="libs examples docs"
# all targets available are enabled, by default. # all targets available are enabled, by default.
for t in ${all_targets}; do for t in ${all_targets}; do
[ -f ${source_path}/${t}.mk ] && enable ${t} [ -f ${source_path}/${t}.mk ] && enable_feature ${t}
done done
# check installed doxygen version # check installed doxygen version
...@@ -164,30 +164,30 @@ if [ ${doxy_major:-0} -ge 1 ]; then ...@@ -164,30 +164,30 @@ if [ ${doxy_major:-0} -ge 1 ]; then
doxy_minor=${doxy_version%%.*} doxy_minor=${doxy_version%%.*}
doxy_patch=${doxy_version##*.} doxy_patch=${doxy_version##*.}
[ $doxy_major -gt 1 ] && enable doxygen [ $doxy_major -gt 1 ] && enable_feature doxygen
[ $doxy_minor -gt 5 ] && enable doxygen [ $doxy_minor -gt 5 ] && enable_feature doxygen
[ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen
fi fi
# install everything except the sources, by default. sources will have # install everything except the sources, by default. sources will have
# to be enabled when doing dist builds, since that's no longer a common # to be enabled when doing dist builds, since that's no longer a common
# case. # case.
enabled doxygen && php -v >/dev/null 2>&1 && enable install_docs enabled doxygen && php -v >/dev/null 2>&1 && enable_feature install_docs
enable install_bins enable_feature install_bins
enable install_libs enable_feature install_libs
enable static enable_feature static
enable optimizations enable_feature optimizations
enable fast_unaligned #allow unaligned accesses, if supported by hw enable_feature fast_unaligned #allow unaligned accesses, if supported by hw
enable md5 enable_feature md5
enable spatial_resampling enable_feature spatial_resampling
enable multithread enable_feature multithread
enable os_support enable_feature os_support
enable temporal_denoising enable_feature temporal_denoising
[ -d ${source_path}/../include ] && enable alt_tree_layout [ -d ${source_path}/../include ] && enable_feature alt_tree_layout
for d in vp8 vp9; do for d in vp8 vp9; do
[ -d ${source_path}/${d} ] && disable alt_tree_layout; [ -d ${source_path}/${d} ] && disable_feature alt_tree_layout;
done done
if ! enabled alt_tree_layout; then if ! enabled alt_tree_layout; then
...@@ -200,10 +200,10 @@ else ...@@ -200,10 +200,10 @@ else
[ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder" [ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
[ -f ${source_path}/../include/vpx/vp9cx.h ] && CODECS="${CODECS} vp9_encoder" [ -f ${source_path}/../include/vpx/vp9cx.h ] && CODECS="${CODECS} vp9_encoder"
[ -f ${source_path}/../include/vpx/vp9dx.h ] && CODECS="${CODECS} vp9_decoder" [ -f ${source_path}/../include/vpx/vp9dx.h ] && CODECS="${CODECS} vp9_decoder"
[ -f ${source_path}/../include/vpx/vp8cx.h ] || disable vp8_encoder [ -f ${source_path}/../include/vpx/vp8cx.h ] || disable_feature vp8_encoder
[ -f ${source_path}/../include/vpx/vp8dx.h ] || disable vp8_decoder [ -f ${source_path}/../include/vpx/vp8dx.h ] || disable_feature vp8_decoder
[ -f ${source_path}/../include/vpx/vp9cx.h ] || disable vp9_encoder [ -f ${source_path}/../include/vpx/vp9cx.h ] || disable_feature vp9_encoder
[ -f ${source_path}/../include/vpx/vp9dx.h ] || disable vp9_decoder [ -f ${source_path}/../include/vpx/vp9dx.h ] || disable_feature vp9_decoder
[ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt [ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt
fi fi
...@@ -358,7 +358,7 @@ process_cmdline() { ...@@ -358,7 +358,7 @@ process_cmdline() {
for opt do for opt do
optval="${opt#*=}" optval="${opt#*=}"
case "$opt" in case "$opt" in
--disable-codecs) for c in ${CODECS}; do disable $c; done ;; --disable-codecs) for c in ${CODECS}; do disable_feature $c; done ;;
--enable-?*|--disable-?*) --enable-?*|--disable-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then
...@@ -384,8 +384,8 @@ post_process_cmdline() { ...@@ -384,8 +384,8 @@ post_process_cmdline() {
# If the codec family is enabled, enable all components of that family. # If the codec family is enabled, enable all components of that family.
log_echo "Configuring selected codecs" log_echo "Configuring selected codecs"
for c in ${CODECS}; do for c in ${CODECS}; do
disabled ${c%%_*} && disable ${c} disabled ${c%%_*} && disable_feature ${c}
enabled ${c%%_*} && enable ${c} enabled ${c%%_*} && enable_feature ${c}
done done
# Enable all detected codecs, if they haven't been disabled # Enable all detected codecs, if they haven't been disabled
...@@ -393,12 +393,12 @@ post_process_cmdline() { ...@@ -393,12 +393,12 @@ post_process_cmdline() {
# Enable the codec family if any component of that family is enabled # Enable the codec family if any component of that family is enabled
for c in ${CODECS}; do for c in ${CODECS}; do
enabled $c && enable ${c%_*} enabled $c && enable_feature ${c%_*}
done done
# Set the {en,de}coders variable if any algorithm in that class is enabled # Set the {en,de}coders variable if any algorithm in that class is enabled
for c in ${CODECS}; do for c in ${CODECS}; do
enabled ${c} && enable ${c##*_}s enabled ${c} && enable_feature ${c##*_}s
done done
} }
...@@ -508,13 +508,13 @@ process_detect() { ...@@ -508,13 +508,13 @@ process_detect() {
fi fi
if [ -z "$CC" ] || enabled external_build; then if [ -z "$CC" ] || enabled external_build; then
echo "Bypassing toolchain for environment detection." echo "Bypassing toolchain for environment detection."
enable external_build enable_feature external_build
check_header() { check_header() {
log fake_check_header "$@" log fake_check_header "$@"
header=$1 header=$1
shift shift
var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
disable $var disable_feature $var
# Headers common to all environments # Headers common to all environments
case $header in case $header in
stdio.h) stdio.h)
...@@ -526,7 +526,7 @@ process_detect() { ...@@ -526,7 +526,7 @@ process_detect() {
[ -f "${d##-I}/$header" ] && result=true && break [ -f "${d##-I}/$header" ] && result=true && break
done done
${result:-true} ${result:-true}
esac && enable $var esac && enable_feature $var
# Specialize windows and POSIX environments. # Specialize windows and POSIX environments.
case $toolchain in case $toolchain in
...@@ -534,7 +534,7 @@ process_detect() { ...@@ -534,7 +534,7 @@ process_detect() {
case $header-$toolchain in case $header-$toolchain in
stdint*-gcc) true;; stdint*-gcc) true;;
*) false;; *) false;;
esac && enable $var esac && enable_feature $var
;; ;;
*) *)
case $header in case $header in
...@@ -543,7 +543,7 @@ process_detect() { ...@@ -543,7 +543,7 @@ process_detect() {
sys/mman.h) true;; sys/mman.h) true;;
unistd.h) true;; unistd.h) true;;
*) false;; *) false;;
esac && enable $var esac && enable_feature $var
esac esac
enabled $var enabled $var
} }
...@@ -561,7 +561,7 @@ EOF ...@@ -561,7 +561,7 @@ EOF
check_header sys/mman.h check_header sys/mman.h
check_header unistd.h # for sysconf(3) and friends. check_header unistd.h # for sysconf(3) and friends.
check_header vpx/vpx_integer.h -I${source_path} && enable vpx_ports check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports
} }
process_toolchain() { process_toolchain() {
...@@ -643,14 +643,14 @@ process_toolchain() { ...@@ -643,14 +643,14 @@ process_toolchain() {
# ccache only really works on gcc toolchains # ccache only really works on gcc toolchains
enabled gcc || soft_disable ccache enabled gcc || soft_disable ccache
if enabled mips; then if enabled mips; then
enable dequant_tokens enable_feature dequant_tokens
enable dc_recon enable_feature dc_recon
fi fi
# Enable the postbuild target if building for visual studio. # Enable the postbuild target if building for visual studio.
case "$tgt_cc" in case "$tgt_cc" in
vs*) enable msvs vs*) enable_feature msvs
enable solution enable_feature solution
vs_version=${tgt_cc##vs} vs_version=${tgt_cc##vs}
case $vs_version in case $vs_version in
[789]) [789])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment