diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-04-20 02:16:16 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-04-20 02:16:16 +0200 |
commit | fee3085fd9406236d8b4f1c4a4489bee612a5715 (patch) | |
tree | b3474d057e817fbf8e1427ac3c1be8a330a77d12 /config.guess | |
parent | 8e7ee1c4192200eb24b12de5e05ac8677b693885 (diff) | |
download | gmp-fee3085fd9406236d8b4f1c4a4489bee612a5715.tar.gz |
* config.guess (m68k-*-*): Detect m68010, return m68360 for cpu32,
cleanup the nesting a bit.
Actually there's no current use for differentiating 68000 and 68010,
but it's nice have it exact, and who knows, maybe this stuff will get
into the real config.guess one day.
Diffstat (limited to 'config.guess')
-rwxr-xr-x | config.guess | 93 |
1 files changed, 60 insertions, 33 deletions
diff --git a/config.guess b/config.guess index e6ef6c87c..f7c4f6c4e 100755 --- a/config.guess +++ b/config.guess @@ -68,6 +68,11 @@ exact_cpu= # The following should look at the current guess and probe the system to # establish a better guess in exact_cpu. Leave exact_cpu empty if probes # can't be done, or don't work. +# +# When a number of probes are done, test -z "$exact_cpu" can be used instead +# of putting each probe under an "else" of the preceeding. That can stop +# the code getting horribly nested and marching of the right side of the +# screen. dummy=dummy-$$ @@ -149,10 +154,12 @@ m68k-*-*) exact_cpu=`sed -n 's/^CPU:.*\(680[012346]0\).*$/m\1/p' /proc/cpuinfo 2>/dev/null` fi if test -z "$exact_cpu"; then - # See if we can run: movel #0,%d0, rts + # Try: movel #0,%d0; rts + # This is to check the compiler and our asm code works etc, before + # assuming failures below indicate cpu characteristics. # .byte is used to avoid problems with assembler syntax variations. - # For testing, add "illegal" possibly with ".byte 0x4A, 0xFC" to provoke - # failures. + # For testing, provoke failures by adding "illegal" possibly as + # ".byte 0x4A, 0xFC" cat >$dummy.s <<EOF .text .globl main @@ -162,10 +169,34 @@ _main: .byte 0x70, 0x00 .byte 0x4e, 0x75 EOF - ($CC_FOR_BUILD $dummy.s -o $dummy && ./$dummy) >/dev/null 2>&1 - if test "$?" = 0; then - # Now try: trapf, movel #0,%d0, rts - cat >$dummy.s <<EOF + if ($CC_FOR_BUILD $dummy.s -o $dummy && ./$dummy) >/dev/null 2>&1; then + + # sh -c is used to execute ./$dummy below, since (./$dummy) 2>/dev/null + # still prints the SIGILL message on some shells. + # + # Try: movel #0,%d0; rtd #0 + cat >$dummy.s <<EOF + .text + .globl main + .globl _main +main: +_main: + .byte 0x70, 0x00 + .byte 0x4e, 0x74, 0x00, 0x00 +EOF + if $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1; then + sh -c ./$dummy >/dev/null 2>&1 + if test $? != 0; then + exact_cpu=m68000 # because rtd didn't work + fi + fi + # + + if test -z "$exact_cpu"; then + # Try: trapf, movel #0,%d0, rts + # Another possibility for identifying 68000 and 68010 is the + # different value stored by "movem a0,(a0)+" + cat >$dummy.s <<EOF .text .globl main .globl _main @@ -175,20 +206,17 @@ _main: .byte 0x70, 0x00 .byte 0x4e, 0x75 EOF - $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1 - if test "$?" = 0; then - # Use sh -c here, since (./$dummy) 2>/dev/null still prints the - # SIGILL message. - sh -c ./$dummy >/dev/null 2>&1 - if test "$?" != 0; then - # trapf didn't work, must have 68000. - # Another possibility for identifying 68000 and 68010 is the - # different behaviour of "movem a0,(a0)+" compared to cpu32 and - # m68020 and up. - exact_cpu=m68000 - else - # now try: bfffo %d1{0:31},%d0, movel #0,%d0, rts - cat >$dummy.s <<EOF + if $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1; then + sh -c ./$dummy >/dev/null 2>&1 + if test $? != 0; then + exact_cpu=m68010 # because trapf didn't work + fi + fi + fi + + if test -z "$exact_cpu"; then + # Try: bfffo %d1{0:31},%d0; movel #0,%d0; rts + cat >$dummy.s <<EOF .text .globl main .globl _main @@ -198,21 +226,20 @@ _main: .byte 0x70, 0x00 .byte 0x4e, 0x75 EOF - $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1 - if test "$?" = 0; then - sh -c ./$dummy >/dev/null 2>&1 - if test "$?" != 0; then - # bfffo didn't work, must have CPU32 - exact_cpu=m68302 - else - # Now we know m68020 or up, which is how gmp interprets plain - # m68k, so just leave that. - # FIXME: Do some tests for 030, 040 and 060. But how? - : - fi + if $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1; then + sh -c ./$dummy >/dev/null 2>&1 + if test $? != 0; then + exact_cpu=m68360 # cpu32, because bfffo didn't work fi fi fi + + if test -z "$exact_cpu"; then + # Now we know 68020 or up, which is how gmp interprets plain m68k, + # so just leave that. + # FIXME: Tests for 030, 040 and 060. But how? + : + fi fi rm -f $dummy.s $dummy $dummy.core core fi |