comparison configure @ 18266:2bf9ae91ff54

Simplify x86 CPU flag/extension check.
author diego
date Tue, 25 Apr 2006 01:38:02 +0000
parents 83f2f6cb329a
children 90ed0bbf0151
comparison
equal deleted inserted replaced
18265:1a14fde7680d 18266:2bf9ae91ff54
417 fi 417 fi
418 done # for parm in ... 418 done # for parm in ...
419 419
420 420
421 # 1st pass checking for vital options 421 # 1st pass checking for vital options
422 _mmx=auto
423 _3dnow=auto
424 _3dnowext=auto
425 _mmxext=auto
426 _sse=auto
427 _sse2=auto
428 _mtrr=auto
422 _install=install 429 _install=install
423 _ranlib=ranlib 430 _ranlib=ranlib
424 _cc=cc 431 _cc=cc
425 test "$CC" && _cc="$CC" 432 test "$CC" && _cc="$CC"
426 _as=auto 433 _as=auto
782 # program TOOLS/cpuinfo instead 789 # program TOOLS/cpuinfo instead
783 $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c 790 $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
784 _cpuinfo="TOOLS/cpuinfo" 791 _cpuinfo="TOOLS/cpuinfo"
785 fi 792 fi
786 793
787 x86_exts_check()
788 {
789 pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | _head 1`
790 if test -z "$pparam" ; then
791 pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | _head 1`
792 fi
793
794 _mmx=no
795 _3dnow=no
796 _3dnowext=no
797 _mmxext=no
798 _sse=no
799 _sse2=no
800 _mtrr=no
801
802 for i in $pparam ; do
803 case "$i" in
804 3dnow) _3dnow=yes ;;
805 3dnowext) _3dnowext=yes ;;
806 mmx) _mmx=yes ;;
807 mmxext) _mmxext=yes ;;
808 mtrr|k6_mtrr|cyrix_arr) _mtrr=yes ;;
809 xmm|sse|kni) _sse=yes _mmxext=yes ;;
810 sse2) _sse2=yes ;;
811 esac
812 done
813 }
814
815 if x86 || x86_64 ; then 794 if x86 || x86_64 ; then
816 # gather more CPU information 795 # gather more CPU information
817 pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | _head 1` 796 pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | _head 1`
818 pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` 797 pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
819 pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` 798 pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
820 pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` 799 pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
821 pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1` 800 pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
822 801
823 x86_exts_check 802 exts=`$_cpuinfo | grep 'features\|flags' | cut -d ':' -f 2 | _head 1`
803
804 pparam=`echo $exts | sed -e s/k6_mtrr/mtrr/ -e s/cyrix_arr/mtrr/ \
805 -e s/xmm/sse/ -e s/kni/sse/`
806
807 for ext in $pparam ; do
808 eval _$ext=auto && eval _$ext=yes
809 done
810
811 # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
812 test _sse=yes && _mmxext=yes
824 813
825 echocheck "CPU vendor" 814 echocheck "CPU vendor"
826 echores "$pvendor ($pfamily:$pmodel:$pstepping)" 815 echores "$pvendor ($pfamily:$pmodel:$pstepping)"
827 816
828 echocheck "CPU type" 817 echocheck "CPU type"