From: Martin Mares Date: Tue, 12 Apr 2005 20:57:49 +0000 (+0000) Subject: Configure: CPU type autodetection. X-Git-Tag: holmes-import~796 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=5c4102992c8c50d5fc145cdfc157a55cfd7d0d00;p=libucw.git Configure: CPU type autodetection. --- diff --git a/lib/autoconf.cfg b/lib/autoconf.cfg index 7bb50c70..e833836f 100644 --- a/lib/autoconf.cfg +++ b/lib/autoconf.cfg @@ -33,11 +33,36 @@ Test("CPU_ARCH", "Checking for CPU architecture", sub { /^([^\t]+)\t+:\s*(.*)$/ and $pc{$1}=$2; } close X; - if ($pc{'vendor_id'} eq "AuthenticAMD" && $pc{'cpu family'} >= 6) { - $arch = "i686"; + + # Try to understand CPU vendor, family and model [inspired by MPlayer's configure script] + my $vendor = $pc{'vendor_id'} || ""; + my $family = $pc{'cpu family'} || 0; + my $model = $pc{'model'} || 0; + if ($vendor eq "AuthenticAMD") { + if ($family >= 6) { + if ($model >= 31) { $arch = "athlon64"; } + elsif ($model >= 6) { $arch = "athlon-xp"; } + else { $arch = "athlon"; } + } + } elsif ($vendor eq "GenuineIntel") { + # We don't recognize Prescott and Nocona cores yet + if ($family >= 15) { $arch = "pentium4"; } + elsif ($family >= 6) { + if ($model >= 7) { $arch = "pentium3"; } + elsif ($model >= 3) { $arch = "pentium2"; } + } + } + + # No match on vendor, try the family + if ($arch eq "") { + if ($family >= 6) { + $arch = "i686"; + } elsif ($family >= 3) { + $arch = "i${family}86"; + } } if ($arch ne "") { - Log "(according to /proc/cpuinfo) "; + Log "(using /proc/cpuinfo) "; } else { Log "(don't understand /proc/cpuinfo) "; }