diff options
author | Mans Rullgard <mans@mansr.com> | 2012-10-27 16:43:12 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-10-30 10:28:25 +0000 |
commit | f454e879238ce317c6d905d187e7608c461a7087 (patch) | |
tree | b6e1be59225a6660db30c2f604e79b86c9faac6f /configure | |
parent | 02e636425970fc9b9aebb31dcc7abbd36e54af2a (diff) | |
download | ffmpeg-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-x | configure | 40 |
1 files changed, 19 insertions, 21 deletions
@@ -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(){ |