diff options
Diffstat (limited to 'BUILD/check-cpu')
-rwxr-xr-x | BUILD/check-cpu | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 7429a955ac0..48a5b5371e3 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -113,6 +113,17 @@ check_cpu () { *Athlon*) cpu_arg="athlon"; ;; + *Opteron*) + cpu_arg="opteron"; + ;; + # MacOSX / Intel + *i386*i486*) + cpu_arg="pentium-m"; + ;; + #Core 2 Duo + *Intel*Core\(TM\)2*) + cpu_arg="nocona"; + ;; # Intel ia64 *Itanium*) @@ -158,25 +169,36 @@ check_cpu () { fi cc_ver=`$cc --version | sed 1q` - cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'` + cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` + set -- `echo $cc_verno | tr '.' ' '` + cc_major=$1 + cc_minor=$2 + cc_patch=$3 + cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` case "$cc_ver--$cc_verno" in *GCC*) # different gcc backends (and versions) have different CPU flags case `gcc -dumpmachine` in i?86-*) - case "$cc_verno" in - 3.4*|3.5*|4.*) - check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg' - ;; - *) - check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg' - ;; - esac + if test "$cc_comp" -lt 304 + then + check_cpu_args='-mcpu=$cpu_arg' + else + check_cpu_args='-mtune=$cpu_arg' + fi ;; ppc-*) check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg' ;; + x86_64-*) + if test "$cc_comp" -lt 304 + then + check_cpu_args='-mcpu=$cpu_arg' + else + check_cpu_args='-mtune=$cpu_arg' + fi + ;; *) check_cpu_cflags="" return @@ -224,8 +246,8 @@ check_cpu () { pentium) cpu_arg=i486 ;; i486) cpu_arg=i386 ;; - # power / powerPC - 7450) cpu_arg=7400 ;; + # power / powerPC + 7450) cpu_arg=7400 ;; *) cpu_arg="" ;; esac |