3 # GMP config.guess wrapper.
6 # Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software
9 # This file is part of the GNU MP Library.
11 # The GNU MP Library is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU Lesser General Public License as published
13 # by the Free Software Foundation; either version 3 of the License, or (at
14 # your option) any later version.
16 # The GNU MP Library is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19 # License for more details.
21 # You should have received a copy of the GNU Lesser General Public License
22 # along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
27 # Print the host system CPU-VENDOR-OS.
29 # configfsf.guess is run and its guess then sharpened up to take advantage
30 # of the finer grained CPU types that GMP knows.
33 # Expect to find configfsf.guess in the same directory as this config.guess
34 configfsf_guess
="`echo \"$0\" | sed 's/config.guess$/configfsf.guess/'`"
35 if test "$configfsf_guess" = "$0"; then
36 echo "Cannot derive configfsf.guess from $0" 1>&2
39 if test -f "$configfsf_guess"; then
42 echo "$configfsf_guess not found" 1>&2
46 # Setup a $SHELL with which to run configfsf.guess, using the same
47 # $CONFIG_SHELL or /bin/sh as autoconf does when running config.guess
48 SHELL
=${CONFIG_SHELL-/bin/sh}
50 # Identify ourselves on --version, --help or errors
52 echo "(GNU MP wrapped config.guess)"
53 $SHELL $configfsf_guess "$@"
57 guess_full
=`$SHELL $configfsf_guess`
62 guess_cpu
=`echo "$guess_full" | sed 's/-.*$//'`
63 guess_rest
=`echo "$guess_full" | sed 's/^[^-]*//'`
67 # -------------------------------------------------------------------------
68 # The following should look at the current guess and probe the system to
69 # establish a better guess in exact_cpu. Leave exact_cpu empty if probes
70 # can't be done, or don't work.
72 # When a number of probes are done, test -z "$exact_cpu" can be used instead
73 # of putting each probe under an "else" of the preceeding. That can stop
74 # the code getting horribly nested and marching off the right side of the
77 # Note that when a compile-and-link is done in one step we need to remove .o
78 # files, since lame C compilers generate these even when not asked.
82 trap 'rm -f $dummy.c $dummy.o $dummy.core $dummy ${dummy}1.s ${dummy}2.c ; exit 1' 1 2 15
84 # Use $HOST_CC if defined. $CC may point to a cross-compiler
85 if test x
"$CC_FOR_BUILD" = x
; then
86 if test x
"$HOST_CC" != x
; then
87 CC_FOR_BUILD
="$HOST_CC"
89 if test x
"$CC" != x
; then
92 echo 'dummy(){}' >$dummy.c
93 for c
in cc gcc c89 c99
; do
94 ($c $dummy.c
-c) >/dev
/null
2>&1
96 CC_FOR_BUILD
="$c"; break
99 rm -f $dummy.c
$dummy.o
100 if test x
"$CC_FOR_BUILD" = x
; then
101 CC_FOR_BUILD
=no_compiler_found
108 case "$guess_full" in
111 # configfsf.guess detects exact alpha cpu types for OSF and GNU/Linux, but
112 # not for *BSD and other systems. We try to get an exact type for any
113 # plain "alpha" it leaves.
115 # configfsf.guess used to have a block of code not unlike this, but these
116 # days does its thing with Linux kernel /proc/cpuinfo or OSF psrinfo.
121 .byte 37,100,45,37,120,10,0 # "%d-%x\n"
127 .frame \$30,16,\$26,0
130 .long 0x47e03d91 # implver \$17
132 .long 0x47e20c21 # amask \$2,\$1
141 $CC_FOR_BUILD $dummy.s
-o $dummy 2>/dev
/null
142 if test "$?" = 0 ; then
144 0-0) exact_cpu
=alpha
;;
145 1-0) exact_cpu
=alphaev5
;;
146 1-1) exact_cpu
=alphaev56
;;
147 1-101) exact_cpu
=alphapca56
;;
148 2-303) exact_cpu
=alphaev6
;;
149 2-307) exact_cpu
=alphaev67
;;
150 2-1307) exact_cpu
=alphaev68
;;
153 rm -f $dummy.s
$dummy.o
$dummy
157 # CPUID[3] bits 24 to 31 is the processor family. itanium2 is documented
158 # as 0x1f, plain itanium has been seen returning 0x07 on two systems, but
159 # haven't found any documentation on it as such.
161 # Defining both getcpuid and _getcpuid lets us ignore whether the system
162 # expects underscores or not.
164 # "unsigned long long" is always 64 bits, in fact on hpux in ilp32 mode
165 # (which is the default there), it's the only 64-bit type.
167 cat >${dummy}a.s
<<EOF
172 mov r8 = CPUID[r32] ;;
173 br.ret.sptk.many rp ;;
178 mov r8 = CPUID[r32] ;;
179 br.ret.sptk.many rp ;;
182 cat >${dummy}b.c
<<EOF
184 unsigned long long getcpuid ();
188 if (getcpuid(0LL) == 0x49656E69756E6547LL && getcpuid(1LL) == 0x6C65746ELL)
191 switch ((getcpuid(3LL) >> 24) & 0xFF) {
192 case 0x07: puts ("itanium"); break;
193 case 0x1F: puts ("itanium2"); break; /* McKinley, Madison */
194 case 0x20: puts ("itanium2"); break; /* Montecito */
200 if $CC_FOR_BUILD ${dummy}a.s
${dummy}b.c
-o $dummy >/dev
/null
2>&1; then
203 rm -f ${dummy}a.s ${dummy}a.o ${dummy}b.c ${dummy}b.o
$dummy $dummy.core core
207 # IRIX 6 and up always has a 64-bit mips cpu
212 # NetBSD (and presumably other *BSD) "sysctl hw.model" gives for example
213 # hw.model = Apple Macintosh Quadra 610 (68040)
214 exact_cpu
=`(sysctl hw.model) 2>/dev/null | sed -n 's/^.*\(680[012346]0\).*$/m\1/p'`
215 if test -z "$exact_cpu"; then
216 # Linux kernel 2.2 gives for example "CPU: 68020" (tabs in between).
217 exact_cpu
=`sed -n 's/^CPU:.*\(680[012346]0\).*$/m\1/p' /proc/cpuinfo 2>/dev/null`
219 if test -z "$exact_cpu"; then
220 # Try: movel #0,%d0; rts
221 # This is to check the compiler and our asm code works etc, before
222 # assuming failures below indicate cpu characteristics.
223 # .byte is used to avoid problems with assembler syntax variations.
224 # For testing, provoke failures by adding "illegal" possibly as
235 if ($CC_FOR_BUILD $dummy.s
-o $dummy && .
/$dummy) >/dev
/null
2>&1; then
237 # $SHELL -c is used to execute ./$dummy below, since (./$dummy)
238 # 2>/dev/null still prints the SIGILL message on some shells.
249 .byte 0x4e, 0x74, 0x00, 0x00
251 if $CC_FOR_BUILD $dummy.s
-o $dummy >/dev
/null
2>&1; then
252 $SHELL -c .
/$dummy >/dev
/null
2>&1
253 if test $?
!= 0; then
254 exact_cpu
=m68000
# because rtd didn't work
259 if test -z "$exact_cpu"; then
263 # Another possibility for identifying 68000 and 68010 is the
264 # different value stored by "movem a0,(a0)+"
275 if $CC_FOR_BUILD $dummy.s
-o $dummy >/dev
/null
2>&1; then
276 $SHELL -c .
/$dummy >/dev
/null
2>&1
277 if test $?
!= 0; then
278 exact_cpu
=m68010
# because trapf didn't work
283 if test -z "$exact_cpu"; then
284 # Try: bfffo %d1{0:31},%d0
293 .byte 0xED, 0xC1, 0x00, 0x1F
297 if $CC_FOR_BUILD $dummy.s
-o $dummy >/dev
/null
2>&1; then
298 $SHELL -c .
/$dummy >/dev
/null
2>&1
299 if test $?
!= 0; then
300 exact_cpu
=m68360
# cpu32, because bfffo didn't work
305 if test -z "$exact_cpu"; then
306 # FIXME: Now we know 68020 or up, but how to detect 030, 040 and 060?
310 rm -f $dummy.s
$dummy.o
$dummy $dummy.core core
312 if test -z "$exact_cpu"; then
313 case "$guess_full" in
314 *-*-next* |
*-*-openstep*) # NeXTs are 68020 or better
321 rs6000-
*-* | powerpc
*-*-*)
322 # Enhancement: On MacOS the "machine" command prints for instance
323 # "ppc750". Interestingly on powerpc970-apple-darwin6.8.5 it prints
324 # "ppc970" where there's no actual #define for 970 from NXGetLocalArchInfo
325 # (as noted below). But the man page says the command is still "under
326 # development", so it doesn't seem wise to use it just yet, not while
327 # there's an alternative.
329 # Try to read the PVR. mfpvr is a protected instruction, NetBSD, MacOS
330 # and AIX don't allow it in user mode, but the Linux kernel does.
332 # Using explicit bytes for mfpvr avoids worrying about assembler syntax
333 # and underscores. "char"s are used instead of "int"s to avoid worrying
334 # whether sizeof(int)==4 or if it's the right endianness.
336 # Note this is no good on AIX, since a C function there is the address of
337 # a function descriptor, not actual code. But this doesn't matter since
338 # AIX doesn't allow mfpvr anyway.
343 int n
; /* force
4-byte alignment
*/
348 0x7c, 0x7f, 0x42, 0xa6, /* mfpvr r3
*/
349 0x4e, 0x80, 0x00, 0x20, /* blr
*/
358 /* a separate
"fun" variable is necessary
for gcc
2.95.2 on MacOS
,
359 it gets a compiler error on a combined cast and call
*/
360 fun
= (unsigned
(*)()) getpvr.a
;
364 case 0x0001: puts
("powerpc601"); break;
365 case 0x0003: puts
("powerpc603"); break;
366 case 0x0004: puts
("powerpc604"); break;
367 case 0x0006: puts
("powerpc603e"); break;
368 case 0x0007: puts
("powerpc603e"); break; /* 603ev
*/
369 case 0x0008: puts
("powerpc750"); break;
370 case 0x0009: puts
("powerpc604e"); break;
371 case 0x000a: puts
("powerpc604e"); break; /* 604ev5
*/
372 case 0x000c: puts
("powerpc7400"); break;
373 case 0x0041: puts
("powerpc630"); break;
374 case 0x0050: puts
("powerpc860"); break;
375 case 0x8000: puts
("powerpc7450"); break;
376 case 0x8001: puts
("powerpc7455"); break;
377 case 0x8002: puts
("powerpc7457"); break;
378 case 0x8003: puts
("powerpc7447"); break; /* really
7447A
*/
379 case 0x800c: puts
("powerpc7410"); break;
384 if ($CC_FOR_BUILD $dummy.c
-o $dummy) >/dev
/null
2>&1; then
385 # This style construct is needed on AIX 4.3 to suppress the SIGILL error
386 # from (*fun)(). Using $SHELL -c ./$dummy 2>/dev/null doesn't work.
387 { x
=`./$dummy`; } 2>/dev
/null
388 if test -n "$x"; then
392 rm -f $dummy.c
$dummy.o
$dummy $dummy.core
394 # Grep the linux kernel /proc/cpuinfo pseudo-file.
395 # Anything unrecognised is ignored, since of course we mustn't spit out
396 # a cpu type config.sub doesn't know.
397 if test -z "$exact_cpu" && test -f /proc
/cpuinfo
; then
398 x
=`grep "^cpu[ ]" /proc/cpuinfo | head -n 1`
399 x
=`echo $x | sed -n 's/^cpu[ ]*:[ ]*\([A-Za-z0-9]*\).*/\1/p'`
400 x
=`echo $x | sed 's/PPC//'`
402 601) exact_cpu
="power" ;;
403 603ev
) exact_cpu
="powerpc603e" ;;
404 604ev5
) exact_cpu
="powerpc604e" ;;
405 603 |
603e |
604 |
604e |
750 |
821 |
860 |
970)
406 exact_cpu
="powerpc$x" ;;
408 exact_cpu
=`echo $x | sed "s;POWER;power;"` ;;
412 if test -z "$exact_cpu"; then
413 # On AIX, try looking at _system_configuration. This is present in
414 # version 4 at least.
417 #include <sys/systemcfg.h>
421 switch (_system_configuration.implementation) {
422 /* Old versions of AIX don't have all these constants,
423 use ifdef for safety. */
425 case POWER_RS2: puts ("power2"); break;
428 case POWER_601: puts ("power"); break;
431 case POWER_603: puts ("powerpc603"); break;
434 case POWER_604: puts ("powerpc604"); break;
437 case POWER_620: puts ("powerpc620"); break;
440 case POWER_630: puts ("powerpc630"); break;
442 /* Dunno what this is, leave it out for now.
443 case POWER_A35: puts ("powerpca35"); break;
445 /* This is waiting for a bit more info.
446 case POWER_RS64II: puts ("powerpcrs64ii"); break;
449 case POWER_4: puts ("power4"); break;
452 case POWER_5: puts ("power5"); break;
455 case POWER_6: puts ("power6"); break;
458 if (_system_configuration.architecture == POWER_RS)
460 else if (_system_configuration.width == 64)
466 if ($CC_FOR_BUILD $dummy.c
-o $dummy) >/dev
/null
2>&1; then
468 if test -n "$x"; then
472 rm -f $dummy.c
$dummy.o
$dummy
475 if test -z "$exact_cpu"; then
476 # On MacOS X (or any Mach-O presumably), NXGetLocalArchInfo cpusubtype
477 # can tell us the exact cpu.
480 #include <mach-o/arch.h>
484 const NXArchInfo *a = NXGetLocalArchInfo();
485 if (a->cputype == CPU_TYPE_POWERPC)
487 switch (a->cpusubtype) {
488 /* The following known to Darwin 1.3. */
489 case CPU_SUBTYPE_POWERPC_601: puts ("powerpc601"); break;
490 case CPU_SUBTYPE_POWERPC_602: puts ("powerpc602"); break;
491 case CPU_SUBTYPE_POWERPC_603: puts ("powerpc603"); break;
492 case CPU_SUBTYPE_POWERPC_603e: puts ("powerpc603e"); break;
493 case CPU_SUBTYPE_POWERPC_603ev: puts ("powerpc603e"); break;
494 case CPU_SUBTYPE_POWERPC_604: puts ("powerpc604"); break;
495 case CPU_SUBTYPE_POWERPC_604e: puts ("powerpc604e"); break;
496 case CPU_SUBTYPE_POWERPC_620: puts ("powerpc620"); break;
497 case CPU_SUBTYPE_POWERPC_750: puts ("powerpc750"); break;
498 case CPU_SUBTYPE_POWERPC_7400: puts ("powerpc7400"); break;
499 case CPU_SUBTYPE_POWERPC_7450: puts ("powerpc7450"); break;
500 /* Darwin 6.8.5 doesn't define the following */
501 case 0x8001: puts ("powerpc7455"); break;
502 case 0x8002: puts ("powerpc7457"); break;
503 case 0x8003: puts ("powerpc7447"); break;
504 case 100: puts ("powerpc970"); break;
510 if ($CC_FOR_BUILD $dummy.c
-o $dummy) >/dev
/null
2>&1; then
512 if test -n "$x"; then
516 rm -f $dummy.c
$dummy.o
$dummy
520 sparc-
*-* | sparc64-
*-*)
521 # If we can recognise an actual v7 then $exact_cpu is set to "sparc" so as
522 # to short-circuit subsequent tests.
524 # Grep the linux kernel /proc/cpuinfo pseudo-file.
525 # A typical line is "cpu\t\t: TI UltraSparc II (BlackBird)"
526 # See arch/sparc/kernel/cpu.c and arch/sparc64/kernel/cpu.c.
528 if test -f /proc
/cpuinfo
; then
529 if grep 'cpu.*Cypress' /proc
/cpuinfo
>/dev
/null
; then
530 exact_cpu
="sparc" # ie. v7
531 elif grep 'cpu.*Power-UP' /proc
/cpuinfo
>/dev
/null
; then
532 exact_cpu
="sparc" # ie. v7
533 elif grep 'cpu.*HyperSparc' /proc
/cpuinfo
>/dev
/null
; then
535 elif grep 'cpu.*SuperSparc' /proc
/cpuinfo
>/dev
/null
; then
536 exact_cpu
="supersparc"
537 elif grep 'cpu.*MicroSparc' /proc
/cpuinfo
>/dev
/null
; then
538 exact_cpu
="microsparc"
539 elif grep 'cpu.*MB86904' /proc
/cpuinfo
>/dev
/null
; then
540 # actually MicroSPARC-II
542 elif grep 'cpu.*UltraSparc T1' /proc
/cpuinfo
>/dev
/null
; then
543 # this grep pattern has not been tested against any Linux
544 exact_cpu
="ultrasparct1"
545 elif grep 'cpu.*UltraSparc III' /proc
/cpuinfo
>/dev
/null
; then
546 exact_cpu
="ultrasparc3"
547 elif grep 'cpu.*UltraSparc IIi' /proc
/cpuinfo
>/dev
/null
; then
548 exact_cpu
="ultrasparc2i"
549 elif grep 'cpu.*UltraSparc II' /proc
/cpuinfo
>/dev
/null
; then
550 exact_cpu
="ultrasparc2"
551 elif grep 'cpu.*UltraSparc' /proc
/cpuinfo
>/dev
/null
; then
552 exact_cpu
="ultrasparc"
556 # Grep the output from sysinfo on SunOS.
557 # sysinfo has been seen living in /bin or in /usr/kvm
558 # cpu0 is a "SuperSPARC Model 41 SPARCmodule" CPU
559 # cpu0 is a "75 MHz TI,TMS390Z55" CPU
561 if test -z "$exact_cpu"; then
562 for i
in sysinfo
/usr
/kvm
/sysinfo
; do
563 if $SHELL -c $i 2>/dev
/null
>conftest.dat
; then
564 if grep 'cpu0 is a "SuperSPARC' conftest.dat
>/dev
/null
; then
567 elif grep 'cpu0 is a .*TMS390Z5.' conftest.dat
>/dev
/null
; then
568 # TMS390Z50 and TMS390Z55
577 # Grep the output from prtconf on Solaris.
578 # Use an explicit /usr/sbin, since that directory might not be in a normal
581 # SUNW,UltraSPARC (driver not attached)
582 # SUNW,UltraSPARC-II (driver not attached)
583 # SUNW,UltraSPARC-IIi (driver not attached)
584 # SUNW,UltraSPARC-III+ (driver not attached)
585 # Ross,RT625 (driver not attached)
586 # TI,TMS390Z50 (driver not attached)
588 # /usr/sbin/sysdef prints similar information, but includes all loadable
589 # cpu modules, not just the real cpu.
591 # We first try a plain prtconf, since that is known to work on older systems.
592 # But for newer T1 systems, that doesn't produce any useful output, we need
593 # "prtconf -vp" there.
595 for prtconfopt
in "" "-vp"; do
596 if test -z "$exact_cpu"; then
597 if $SHELL -c "/usr/sbin/prtconf $prtconfopt" 2>/dev
/null
>conftest.dat
; then
598 if grep 'SUNW,UltraSPARC-T1' conftest.dat
>/dev
/null
; then
599 exact_cpu
=ultrasparct1
600 elif grep 'SUNW,UltraSPARC-III' conftest.dat
>/dev
/null
; then
601 exact_cpu
=ultrasparc3
602 elif grep 'SUNW,UltraSPARC-IIi' conftest.dat
>/dev
/null
; then
603 exact_cpu
=ultrasparc2i
604 elif grep 'SUNW,UltraSPARC-II' conftest.dat
>/dev
/null
; then
605 exact_cpu
=ultrasparc2
606 elif grep 'SUNW,UltraSPARC' conftest.dat
>/dev
/null
; then
608 elif grep 'Ross,RT62.' conftest.dat
>/dev
/null
; then
609 # RT620, RT625, RT626 hypersparcs (v8).
611 elif grep 'TI,TMS390Z5.' conftest.dat
>/dev
/null
; then
612 # TMS390Z50 and TMS390Z55
614 elif grep 'TI,TMS390S10' conftest.dat
>/dev
/null
; then
616 elif grep 'FMI,MB86904' conftest.dat
>/dev
/null
; then
617 # actually MicroSPARC-II
625 # Grep the output from sysctl hw.model on sparc or sparc64 *BSD.
626 # Use an explicit /sbin, since that directory might not be in a normal
627 # user's path. Example outputs,
629 # hw.model: Sun Microsystems UltraSparc-IIi
631 if test -z "$exact_cpu"; then
632 if $SHELL -c "/sbin/sysctl hw.model" 2>/dev
/null
>conftest.dat
; then
633 if grep 'UltraSparc-T1' conftest.dat
>/dev
/null
; then
634 # this grep pattern has not been tested against any BSD
635 exact_cpu
=ultrasparct1
636 elif grep 'UltraSparc-III' conftest.dat
>/dev
/null
; then
637 exact_cpu
=ultrasparc3
638 elif grep 'UltraSparc-IIi' conftest.dat
>/dev
/null
; then
639 exact_cpu
=ultrasparc2i
640 elif grep 'UltraSparc-II' conftest.dat
>/dev
/null
; then
641 exact_cpu
=ultrasparc2
642 elif grep 'UltraSparc' conftest.dat
>/dev
/null
; then
644 elif grep 'TMS390Z5.' conftest.dat
>/dev
/null
; then
645 # TMS390Z50 and TMS390Z55
647 elif grep 'TMS390S10' conftest.dat
>/dev
/null
; then
649 elif grep 'MB86904' conftest.dat
>/dev
/null
; then
650 # actually MicroSPARC-II
652 elif grep 'MB86907' conftest.dat
>/dev
/null
; then
659 # sun4m and sun4d are v8s of some sort, sun4u is a v9 of some sort
661 if test -z "$exact_cpu"; then
663 sun4
[md
]) exact_cpu
=sparcv8
;;
664 sun4u
) exact_cpu
=sparcv9
;;
669 i?
86-*-* | amd64-
*-* | x86_64-
*-*)
670 cat <<EOF >${dummy}0.s
688 cat <<EOF >${dummy}1.s
703 cat <<EOF >${dummy}2.c
706 char vendor_string[13];
707 char dummy_string[12];
709 int family, model, stepping;
712 cpuid (vendor_string, 0);
713 vendor_string[12] = 0;
715 fms = cpuid (dummy_string, 1);
717 family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
718 model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
719 stepping = fms & 0xf;
721 modelstr = "$guess_cpu";
722 if (strcmp (vendor_string, "GenuineIntel") == 0)
727 if (model <= 2) modelstr = "pentium";
728 else if (model >= 4) modelstr = "pentiummmx";
731 if (model <= 1) modelstr = "pentiumpro";
732 else if (model <= 6) modelstr = "pentium2";
733 else if (model <= 8) modelstr = "pentium3";
734 else if (model <= 9) modelstr = "pentiumm";
735 else if (model <= 12) modelstr = "pentium3";
736 else if (model <= 14) modelstr = "pentiumm";
737 else if (model <= 27) modelstr = "core2";
738 else modelstr = "atom";
741 modelstr = "pentium4";
745 else if (strcmp (vendor_string, "AuthenticAMD") == 0)
750 if (model <= 3) modelstr = "k5";
751 else if (model <= 7) modelstr = "k6";
752 else if (model == 8) modelstr = "k62";
753 else if (model == 9) modelstr = "k63";
754 else if (model == 10) modelstr = "geode";
755 else if (model == 13) modelstr = "k63";
762 modelstr = "athlon64";
766 else if (strcmp (vendor_string, "CyrixInstead") == 0)
768 /* Should recognize Cyrix' processors too. */
770 else if (strcmp (vendor_string, "CentaurHauls") == 0)
775 if (model < 9) modelstr = "viac3";
776 else modelstr = "viac32";
781 printf ("%s\n", modelstr);
786 if ($CC_FOR_BUILD ${dummy}1.s
${dummy}2.c
-o $dummy) >/dev
/null
2>&1; then
787 # On 80386 and early 80486 cpuid is not available and will result in a
788 # SIGILL message, hence 2>/dev/null.
790 # On i386-unknown-freebsd4.9, "/bin/sh -c ./dummy" seems to send an
791 # "Illegal instruction (core dumped)" message to stdout, so we test $?
792 # to check if the program run was successful.
794 x
=`$SHELL -c ./$dummy 2>/dev/null`
795 if test $?
= 0 && test -n "$x"; then
800 if test -z "$exact_cpu"; then
801 if ($CC_FOR_BUILD ${dummy}0.s
${dummy}2.c
-o $dummy) >/dev
/null
2>&1; then
802 # On 80386 and early 80486 cpuid is not available and will result in a
803 # SIGILL message, hence 2>/dev/null.
805 # On i386-unknown-freebsd4.9, "/bin/sh -c ./dummy" seems to send an
806 # "Illegal instruction (core dumped)" message to stdout, so we test $?
807 # to check if the program run was successful.
809 x
=`$SHELL -c ./$dummy 2>/dev/null`
810 if test $?
= 0 && test -n "$x"; then
816 # We need to remove some .o files here since lame C compilers
817 # generate these even when not asked.
818 rm -f ${dummy}0.s ${dummy}0.o ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o
$dummy
825 # -------------------------------------------------------------------------
826 # Use an exact cpu, if possible
828 if test -n "$exact_cpu"; then
829 echo "$exact_cpu$guess_rest"