aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-10-27 16:43:12 +0100
committerMans Rullgard <mans@mansr.com>2012-10-30 10:28:25 +0000
commitf454e879238ce317c6d905d187e7608c461a7087 (patch)
treeb6e1be59225a6660db30c2f604e79b86c9faac6f /configure
parent02e636425970fc9b9aebb31dcc7abbd36e54af2a (diff)
downloadffmpeg-f454e879238ce317c6d905d187e7608c461a7087.tar.gz
configure: rewrite print_config() function using awk
This is much faster with slow shells and noticeably faster even with bash on a fast Linux system. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure40
1 files changed, 19 insertions, 21 deletions
diff --git a/configure b/configure
index 2abc465296..f215c76c08 100755
--- a/configure
+++ b/configure
@@ -566,31 +566,29 @@ 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_asm(){
- enabled $1 && v=1 || v=0
- echo "%define $2 $v"
-}
-
print_config(){
pfx=$1
files=$2
shift 2
- for cfg; do
- ucname="$(toupper $cfg)"
- for f in $files; do
- "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
- done
- done
+ map 'eval echo "$v \${$v:-no}"' "$@" |
+ awk "BEGIN { split(\"$files\", files) }
+ {
+ c = \"$pfx\" toupper(\$1);
+ v = \$2;
+ sub(/yes/, 1, v);
+ sub(/no/, 0, v);
+ for (f in files) {
+ file = files[f];
+ if (file ~ /\\.h\$/) {
+ printf(\"#define %s %d\\n\", c, v) >>file;
+ } else if (file ~ /\\.asm\$/) {
+ printf(\"%%define %s %d\\n\", c, v) >>file;
+ } else if (file ~ /\\.mak\$/) {
+ n = +v ? \"\" : \"!\";
+ printf(\"%s%s=yes\\n\", n, c) >>file;
+ }
+ }
+ }"
}
print_enabled(){