[MPlayer-dev-eng] [PATCH] simplify x86 CPU flag/extension check

Diego Biurrun diego at biurrun.de
Mon Apr 24 01:06:00 CEST 2006


The attached patch works fine for me on my K6-III, but I'd appreciate
some testing on other processors.  Compare config.h and config.mak with
and without the patch, also when passing options like --disable-mmx etc.

Diego
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.1175
diff -u -r1.1175 configure
--- configure	23 Apr 2006 22:56:29 -0000	1.1175
+++ configure	23 Apr 2006 22:58:59 -0000
@@ -419,6 +419,13 @@
 
 
 # 1st pass checking for vital options
+_mmx=auto
+_3dnow=auto
+_3dnowext=auto
+_mmxext=auto
+_sse=auto
+_sse2=auto
+_mtrr=auto
 _install=install
 _ranlib=ranlib
 _cc=cc
@@ -784,34 +791,6 @@
   _cpuinfo="TOOLS/cpuinfo"
 fi
 
-x86_exts_check()
-{
-  pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | _head 1`
-  if test -z "$pparam" ; then
-    pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | _head 1`
-  fi
-
-  _mmx=no
-  _3dnow=no
-  _3dnowext=no
-  _mmxext=no
-  _sse=no
-  _sse2=no
-  _mtrr=no
-
-  for i in $pparam ; do
-    case "$i" in
-    3dnow)        _3dnow=yes               ;;
-    3dnowext)     _3dnowext=yes            ;;
-    mmx)          _mmx=yes                 ;;
-    mmxext)       _mmxext=yes              ;;
-    mtrr|k6_mtrr|cyrix_arr)   _mtrr=yes    ;;
-    xmm|sse|kni)  _sse=yes    _mmxext=yes  ;;
-    sse2)         _sse2=yes                ;;
-    esac
-  done
-}
-
 if x86 || x86_64 ; then
   # gather more CPU information
   pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | _head 1`
@@ -820,7 +799,14 @@
   pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
   pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
 
-  x86_exts_check
+  exts=`$_cpuinfo | grep 'features\|flags' | cut -d ':' -f 2 | _head 1`
+
+  pparam=`echo $exts | sed -e s/k6_mtrr/mtrr/ -e s/cyrix_arr/mtrr/ \
+                           -e s/xmm/sse/ -e s/kni/sse/`
+
+  for ext in $pparam ; do
+    eval _$ext=auto && eval _$ext=yes
+  done
 
   echocheck "CPU vendor"
   echores "$pvendor ($pfamily:$pmodel:$pstepping)"


More information about the MPlayer-dev-eng mailing list