[MPlayer-dev-eng] [PATCH 1/3] configure: Drastically speed up generation of config.h/.asm/.mak

Alexander Strasser eclipse7 at gmx.net
Sat Nov 14 22:19:44 CET 2015


From: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

Avoid spawning grep for every item in the list.

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
---
 configure | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 0e37441..57e9cb7 100755
--- a/configure
+++ b/configure
@@ -8310,11 +8310,10 @@ list=$(echo $1 | toupper)
 item=$(echo $2 | toupper)
 nprefix=$3;
 for part in $list; do
-  if $(echo $item | grep -q -E "(^| )$part($| )"); then
-    echo "${nprefix}_$part = yes"
-  else
-    echo "${nprefix}_$part = no"
-  fi
+  echo "${nprefix}_$part = no"
+done
+for part in $item; do
+  echo "${nprefix}_$part = yes"
 done
 }
 
@@ -8731,11 +8730,11 @@ _defineprefix=$3;
 _postfix=$5;
 test -z "$_nprefix" && _nprefix='CONFIG'
 for part in $list; do
-  if $(echo $item | grep -q -E "(^| )$part($| )"); then
-    echo "${_defineprefix}define ${_nprefix}_${part}${_postfix} 1"
-  else
-    echo "${_defineprefix}define ${_nprefix}_${part}${_postfix} 0"
-  fi
+  echo "${_defineprefix}define ${_nprefix}_${part}${_postfix} 0"
+done
+for part in $item; do
+  echo "${_defineprefix}undef ${_nprefix}_${part}${_postfix}"
+  echo "${_defineprefix}define ${_nprefix}_${part}${_postfix} 1"
 done
 }
 
-- 


More information about the MPlayer-dev-eng mailing list