diff options
author | tege <tege@gmplib.org> | 2007-09-01 19:20:23 +0200 |
---|---|---|
committer | tege <tege@gmplib.org> | 2007-09-01 19:20:23 +0200 |
commit | b2f62191a4443b2f8164fd49357578f5e60b4834 (patch) | |
tree | 90a8927f88a0eed8f7be3eaed10a48f79f2f16ab /config.guess | |
parent | e45b41ef87937a6075ff527030ecd671adc29b6d (diff) | |
download | gmp-b2f62191a4443b2f8164fd49357578f5e60b4834.tar.gz |
Do two x86 variants, for 32-bit ABI and 64-bit ABI.
Return "athlon64" and "core2", not x86_64.
Diffstat (limited to 'config.guess')
-rwxr-xr-x | config.guess | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/config.guess b/config.guess index aa332c289..05c7f59a7 100755 --- a/config.guess +++ b/config.guess @@ -658,8 +658,8 @@ sparc-*-* | sparc64-*-*) fi ;; -i?86-*-*) - cat <<EOF >${dummy}1.s +i?86-*-* | amd64-*-* | x86_64-*-*) + cat <<EOF >${dummy}0.s .globl cpuid .globl _cpuid cpuid: @@ -677,6 +677,21 @@ _cpuid: popl %esi ret EOF + cat <<EOF >${dummy}1.s + .globl cpuid + .globl _cpuid +cpuid: +_cpuid: + push %rbx + mov %esi,%eax + .byte 0x0f + .byte 0xa2 + mov %ebx,(%rdi) + mov %edx,4(%rdi) + mov %ecx,8(%rdi) + pop %rbx + ret +EOF cat <<EOF >${dummy}2.c main () { @@ -707,7 +722,8 @@ main () case 6: if (model == 1) modelstr = "pentiumpro"; else if (model <= 6) modelstr = "pentium2"; - else modelstr = "pentium3"; + else if (model <= 14) modelstr = "pentium3"; + else modelstr = "core2"; break; case 15: modelstr = "pentium4"; @@ -728,9 +744,7 @@ main () modelstr = "athlon"; break; case 15: - /* We might want to return opteron, athlon64, or the CPU core name - hammer here instead of the architecture name x86_64. */ - modelstr = "x86_64"; + modelstr = "athlon64"; break; } } @@ -768,9 +782,25 @@ EOF fi fi + if test -z "$exact_cpu"; then + if ($CC_FOR_BUILD ${dummy}0.s ${dummy}2.c -o $dummy) >/dev/null 2>&1; then + # On 80386 and early 80486 cpuid is not available and will result in a + # SIGILL message, hence 2>/dev/null. + # + # On i386-unknown-freebsd4.9, "/bin/sh -c ./dummy" seems to send an + # "Illegal instruction (core dumped)" message to stdout, so we test $? + # to check if the program run was successful. + # + x=`$SHELL -c ./$dummy 2>/dev/null` + if test $? = 0 && test -n "$x"; then + exact_cpu=$x + fi + fi + fi + # We need to remove some .o files here since lame C compilers # generate these even when not asked. - rm -f ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o $dummy + rm -f ${dummy}0.s ${dummy}0.o ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o $dummy ;; esac |