comparison configure @ 21739:e75482a7009a

Run less CPU checks when runtime CPU detection is enabled. inspired by a patch from Zuxy Meng, zuxy.meng gmail com
author diego
date Sun, 24 Dec 2006 00:43:09 +0000
parents f0d5f349a2ea
children 6f7d4885744d
comparison
equal deleted inserted replaced
21738:f0d5f349a2ea 21739:e75482a7009a
823 test -z "$_as" && _as=as 823 test -z "$_as" && _as=as
824 fi 824 fi
825 825
826 # XXX: this should be ok.. 826 # XXX: this should be ok..
827 _cpuinfo="echo" 827 _cpuinfo="echo"
828
829 if test "$_runtime_cpudetection" = no
830
828 # Cygwin has /proc/cpuinfo, but only supports Intel CPUs 831 # Cygwin has /proc/cpuinfo, but only supports Intel CPUs
829 # FIXME: Remove the cygwin check once AMD CPUs are supported 832 # FIXME: Remove the cygwin check once AMD CPUs are supported
830 if test -r /proc/cpuinfo && not cygwin; then 833 if test -r /proc/cpuinfo && not cygwin; then
831 # Linux with /proc mounted, extract CPU information from it 834 # Linux with /proc mounted, extract CPU information from it
832 _cpuinfo="cat /proc/cpuinfo" 835 _cpuinfo="cat /proc/cpuinfo"
872 875
873 echocheck "CPU type" 876 echocheck "CPU type"
874 echores "$pname" 877 echores "$pname"
875 fi 878 fi
876 879
880 fi # test "$_runtime_cpudetection" = no
881
882
877 case "$host_arch" in 883 case "$host_arch" in
878 i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) 884 i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
879 _def_arch_x86="#define ARCH_X86 1" 885 _def_arch_x86="#define ARCH_X86 1"
880 _target_arch_x86="TARGET_ARCH_X86 = yes" 886 _target_arch_x86="TARGET_ARCH_X86 = yes"
881 _def_arch="#define ARCH_X86_32 1" 887 _def_arch="#define ARCH_X86_32 1"
882 _target_arch="TARGET_ARCH_X86_32 = yes" 888 _target_arch="TARGET_ARCH_X86_32 = yes"
883 889
884 890
891 if test "$_runtime_cpudetection" = no ; then
885 case "$pvendor" in 892 case "$pvendor" in
886 AuthenticAMD) 893 AuthenticAMD)
887 case "$pfamily" in 894 case "$pfamily" in
888 3) proc=i386 iproc=386 ;; 895 3) proc=i386 iproc=386 ;;
889 4) proc=i486 iproc=486 ;; 896 4) proc=i486 iproc=486 ;;
987 esac 994 esac
988 ;; 995 ;;
989 *) 996 *)
990 proc=i586 iproc=586 ;; 997 proc=i586 iproc=586 ;;
991 esac 998 esac
999 fi # test "$_runtime_cpudetection" = no
1000
992 1001
993 # check that gcc supports our CPU, if not, fall back to earlier ones 1002 # check that gcc supports our CPU, if not, fall back to earlier ones
994 # LGB: check -mcpu and -march swithing step by step with enabling 1003 # LGB: check -mcpu and -march swithing step by step with enabling
995 # to fall back till 386. 1004 # to fall back till 386.
996 1005
1116 if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then 1125 if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then
1117 cpuopt=-mtune 1126 cpuopt=-mtune
1118 else 1127 else
1119 cpuopt=-mcpu 1128 cpuopt=-mcpu
1120 fi 1129 fi
1130 if test "$_runtime_cpudetection" = no ; then
1121 case "$pvendor" in 1131 case "$pvendor" in
1122 AuthenticAMD) 1132 AuthenticAMD)
1123 proc=k8;; 1133 proc=k8;;
1124 GenuineIntel) 1134 GenuineIntel)
1125 case "$pmodel" in 1135 case "$pmodel" in
1131 esac 1141 esac
1132 ;; 1142 ;;
1133 *) 1143 *)
1134 proc=error;; 1144 proc=error;;
1135 esac 1145 esac
1146 fi # test "$_runtime_cpudetection" = no
1136 1147
1137 echocheck "GCC & CPU optimization abilities" 1148 echocheck "GCC & CPU optimization abilities"
1138 cat > $TMPC << EOF 1149 cat > $TMPC << EOF
1139 int main(void) { return 0; } 1150 int main(void) { return 0; }
1140 EOF 1151 EOF