configure: make print_config() more flexible

Originally committed as revision 25037 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2010-09-03 21:27:12 +00:00
parent dab95c0584
commit 72cfcf4156

35
configure vendored
View File

@ -495,20 +495,25 @@ check_deps(){
done
}
print_config_h(){
enabled $1 && v=1 || v=0
echo "#define $2 $v"
}
print_config_mak(){
enabled $1 && v= || v=!
echo "$v$2=yes"
}
print_config(){
pfx=$1
header=$2
makefile=$3
shift 3
files=$2
shift 2
for cfg; do
ucname="$(toupper $cfg)"
if enabled $cfg; then
echo "#define ${pfx}${ucname} 1" >> $header
echo "${pfx}${ucname}=yes" >> $makefile
else
echo "#define ${pfx}${ucname} 0" >> $header
echo "!${pfx}${ucname}=yes" >> $makefile
fi
for f in $files; do
"print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
done
done
}
@ -3062,6 +3067,8 @@ fi
enabled stripping || strip="echo skipping strip"
config_files="$TMPH config.mak"
cat > config.mak <<EOF
# Automatically generated by configure - do not modify!
ifndef FFMPEG_CONFIG_MAK
@ -3177,9 +3184,9 @@ if enabled small || disabled optimizations; then
echo "#define av_always_inline" >> $TMPH
fi
print_config ARCH_ $TMPH config.mak $ARCH_LIST
print_config HAVE_ $TMPH config.mak $HAVE_LIST
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
print_config ARCH_ "$config_files" $ARCH_LIST
print_config HAVE_ "$config_files" $HAVE_LIST
print_config CONFIG_ "$config_files" $CONFIG_LIST \
$CONFIG_EXTRA \
$DECODER_LIST \
$ENCODER_LIST \
@ -3214,7 +3221,7 @@ cat > $TMPH <<EOF
#define AVUTIL_AVCONFIG_H
EOF
print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH