1 |
|
#!/bin/sh |
2 |
|
|
3 |
< |
# WHICH_SPARC |
3 |
> |
# which_sparc |
4 |
|
# |
5 |
|
# This script generates a program that tests for a SPARC processor class |
6 |
|
# Program returns: |
7 |
< |
# 0 unknown SPARC processor |
8 |
< |
# 8 SPARC V8 `compliant' processor (umul instruction is legal) |
9 |
< |
# 9 SPARC V9 `compliant' processor (popc instruction is legal) |
7 |
> |
# 0 unknown SPARC processor |
8 |
> |
# 8 SPARC V8 `compliant' processor (umul instruction is legal) |
9 |
> |
# 9 SPARC V9 `compliant' processor (popc instruction is legal) |
10 |
> |
# |
11 |
> |
# The script prints: |
12 |
> |
# "unknown SPARC architecture" |
13 |
> |
# SPARC_V8 |
14 |
> |
# SPARC_V9 |
15 |
|
# |
16 |
|
# I hope this works for other machines and OS. Tested machines are: |
17 |
|
# Sun Ultra 10 (Solaris 7), SPARC Station 5 (Solaris 2.5.1) |
24 |
|
SOURCE=./conftest.c |
25 |
|
|
26 |
|
if [ ! -x $PROG ]; then |
22 |
– |
echo "Compiling the test program" |
27 |
|
cat > $SOURCE << EOF |
28 |
|
#include <stdio.h> |
29 |
|
#include <signal.h> |
111 |
|
$PROG |
112 |
|
case $? in |
113 |
|
0) echo "unknown SPARC architecture";; |
114 |
< |
8) echo "SPARC V8 compliant processor";; |
115 |
< |
9) echo "SPARC V9 compliant processor";; |
114 |
> |
8) echo "SPARC_V8";; |
115 |
> |
9) echo "SPARC_V9";; |
116 |
|
esac |
117 |
|
|
118 |
|
rm -f $PROG |