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
}
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
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 \
#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