summaryrefslogtreecommitdiff
path: root/config.guess
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2013-10-16 19:55:27 +0200
committerTorbjorn Granlund <tege@gmplib.org>2013-10-16 19:55:27 +0200
commit273cf223eeefb8a352c5239551bf7b0c2571b2f9 (patch)
tree68b131a5f4714a39b731a5aaa198f343ba75c21b /config.guess
parent9df61f15849fee5699055227a3069d9b14c848e6 (diff)
downloadgmp-273cf223eeefb8a352c5239551bf7b0c2571b2f9.tar.gz
Let AMD64 cpuid bit override pessimistic cpu guesses.
Diffstat (limited to 'config.guess')
-rwxr-xr-xconfig.guess15
1 files changed, 10 insertions, 5 deletions
diff --git a/config.guess b/config.guess
index 6afc51b4b..ff9c0f128 100755
--- a/config.guess
+++ b/config.guess
@@ -747,6 +747,7 @@ main ()
int family, model, stepping;
const char *modelstr;
int cpu_64bit = 0;
+ int cpuid_64bit;
CPUID (vendor_string, 0);
vendor_string[12] = 0;
@@ -857,11 +858,15 @@ main ()
}
}
- /* If our cpuid-based exact guess is more conservative than the previous
- guess, revert. This is of course wrong, but it can happen in an emulator,
- so this workaround allows for successful 64-bit builds. */
- if (strcmp ("$guess_cpu", "x86_64") == 0 && ! cpu_64bit)
- modelstr = "$guess_cpu";
+ CPUID (dummy_string, 0x80000001);
+ cpuid_64bit = (dummy_string[7] >> 5) & 1;
+
+ /* If our cpuid-based CPU identification thinks this is a 32-bit CPU but
+ cpuid claims AMD64 capabilities, then revert to the generic "x86_64".
+ This is of course wrong, but it can happen in some emulators, so this
+ workaround allows for successful 64-bit builds. */
+ if (cpuid_64bit && ! cpu_64bit)
+ modelstr = "x86_64";
printf ("%s", modelstr);
return 0;