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