| 1 |
|
#! /bin/sh |
| 2 |
|
# Attempt to guess a canonical system name. |
| 3 |
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 4 |
< |
# 2000, 2001, 2002 Free Software Foundation, Inc. |
| 4 |
> |
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
| 5 |
|
|
| 6 |
< |
timestamp='2002-12-23' |
| 6 |
> |
timestamp='2003-10-03' |
| 7 |
|
|
| 8 |
|
# This file is free software; you can redistribute it and/or modify it |
| 9 |
|
# under the terms of the GNU General Public License as published by |
| 106 |
|
: ${TMPDIR=/tmp} ; |
| 107 |
|
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || |
| 108 |
|
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || |
| 109 |
+ |
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || |
| 110 |
|
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; |
| 111 |
|
dummy=$tmp/dummy ; |
| 112 |
|
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; |
| 240 |
|
if test $UNAME_RELEASE = "V4.0"; then |
| 241 |
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` |
| 242 |
|
fi |
| 243 |
+ |
# According to Compaq, /usr/sbin/psrinfo has been available on |
| 244 |
+ |
# OSF/1 and Tru64 systems produced since 1995. I hope that |
| 245 |
+ |
# covers most systems running today. This code pipes the CPU |
| 246 |
+ |
# types through head -n 1, so we only detect the type of CPU 0. |
| 247 |
+ |
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` |
| 248 |
+ |
case "$ALPHA_CPU_TYPE" in |
| 249 |
+ |
"EV4 (21064)") |
| 250 |
+ |
UNAME_MACHINE="alpha" ;; |
| 251 |
+ |
"EV4.5 (21064)") |
| 252 |
+ |
UNAME_MACHINE="alpha" ;; |
| 253 |
+ |
"LCA4 (21066/21068)") |
| 254 |
+ |
UNAME_MACHINE="alpha" ;; |
| 255 |
+ |
"EV5 (21164)") |
| 256 |
+ |
UNAME_MACHINE="alphaev5" ;; |
| 257 |
+ |
"EV5.6 (21164A)") |
| 258 |
+ |
UNAME_MACHINE="alphaev56" ;; |
| 259 |
+ |
"EV5.6 (21164PC)") |
| 260 |
+ |
UNAME_MACHINE="alphapca56" ;; |
| 261 |
+ |
"EV5.7 (21164PC)") |
| 262 |
+ |
UNAME_MACHINE="alphapca57" ;; |
| 263 |
+ |
"EV6 (21264)") |
| 264 |
+ |
UNAME_MACHINE="alphaev6" ;; |
| 265 |
+ |
"EV6.7 (21264A)") |
| 266 |
+ |
UNAME_MACHINE="alphaev67" ;; |
| 267 |
+ |
"EV6.8CB (21264C)") |
| 268 |
+ |
UNAME_MACHINE="alphaev68" ;; |
| 269 |
+ |
"EV6.8AL (21264B)") |
| 270 |
+ |
UNAME_MACHINE="alphaev68" ;; |
| 271 |
+ |
"EV6.8CX (21264D)") |
| 272 |
+ |
UNAME_MACHINE="alphaev68" ;; |
| 273 |
+ |
"EV6.9A (21264/EV69A)") |
| 274 |
+ |
UNAME_MACHINE="alphaev69" ;; |
| 275 |
+ |
"EV7 (21364)") |
| 276 |
+ |
UNAME_MACHINE="alphaev7" ;; |
| 277 |
+ |
"EV7.9 (21364A)") |
| 278 |
+ |
UNAME_MACHINE="alphaev79" ;; |
| 279 |
+ |
esac |
| 280 |
|
# A Vn.n version is a released version. |
| 281 |
|
# A Tn.n version is a released field test version. |
| 282 |
|
# A Xn.n version is an unreleased experimental baselevel. |
| 283 |
|
# 1.2 uses "1.2" for uname -r. |
| 284 |
< |
eval $set_cc_for_build |
| 247 |
< |
cat <<EOF >$dummy.s |
| 248 |
< |
.data |
| 249 |
< |
\$Lformat: |
| 250 |
< |
.byte 37,100,45,37,120,10,0 # "%d-%x\n" |
| 251 |
< |
|
| 252 |
< |
.text |
| 253 |
< |
.globl main |
| 254 |
< |
.align 4 |
| 255 |
< |
.ent main |
| 256 |
< |
main: |
| 257 |
< |
.frame \$30,16,\$26,0 |
| 258 |
< |
ldgp \$29,0(\$27) |
| 259 |
< |
.prologue 1 |
| 260 |
< |
.long 0x47e03d80 # implver \$0 |
| 261 |
< |
lda \$2,-1 |
| 262 |
< |
.long 0x47e20c21 # amask \$2,\$1 |
| 263 |
< |
lda \$16,\$Lformat |
| 264 |
< |
mov \$0,\$17 |
| 265 |
< |
not \$1,\$18 |
| 266 |
< |
jsr \$26,printf |
| 267 |
< |
ldgp \$29,0(\$26) |
| 268 |
< |
mov 0,\$16 |
| 269 |
< |
jsr \$26,exit |
| 270 |
< |
.end main |
| 271 |
< |
EOF |
| 272 |
< |
$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null |
| 273 |
< |
if test "$?" = 0 ; then |
| 274 |
< |
case `$dummy` in |
| 275 |
< |
0-0) |
| 276 |
< |
UNAME_MACHINE="alpha" |
| 277 |
< |
;; |
| 278 |
< |
1-0) |
| 279 |
< |
UNAME_MACHINE="alphaev5" |
| 280 |
< |
;; |
| 281 |
< |
1-1) |
| 282 |
< |
UNAME_MACHINE="alphaev56" |
| 283 |
< |
;; |
| 284 |
< |
1-101) |
| 285 |
< |
UNAME_MACHINE="alphapca56" |
| 286 |
< |
;; |
| 287 |
< |
2-303) |
| 288 |
< |
UNAME_MACHINE="alphaev6" |
| 289 |
< |
;; |
| 290 |
< |
2-307) |
| 291 |
< |
UNAME_MACHINE="alphaev67" |
| 292 |
< |
;; |
| 293 |
< |
2-1307) |
| 294 |
< |
UNAME_MACHINE="alphaev68" |
| 295 |
< |
;; |
| 296 |
< |
3-1307) |
| 297 |
< |
UNAME_MACHINE="alphaev7" |
| 298 |
< |
;; |
| 299 |
< |
esac |
| 300 |
< |
fi |
| 301 |
< |
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
| 284 |
> |
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
| 285 |
|
exit 0 ;; |
| 286 |
+ |
Alpha*:OpenVMS:*:*) |
| 287 |
+ |
echo alpha-hp-vms |
| 288 |
+ |
exit 0 ;; |
| 289 |
|
Alpha\ *:Windows_NT*:*) |
| 290 |
|
# How do we know it's Interix rather than the generic POSIX subsystem? |
| 291 |
|
# Should we change UNAME_MACHINE based on the output of uname instead |
| 323 |
|
exit 0 ;; |
| 324 |
|
NILE*:*:*:dcosx) |
| 325 |
|
echo pyramid-pyramid-svr4 |
| 326 |
+ |
exit 0 ;; |
| 327 |
+ |
DRS?6000:unix:4.0:6*) |
| 328 |
+ |
echo sparc-icl-nx6 |
| 329 |
|
exit 0 ;; |
| 330 |
|
DRS?6000:UNIX_SV:4.2*:7*) |
| 331 |
|
case `/usr/bin/uname -p` in |
| 727 |
|
CRAY*TS:*:*:*) |
| 728 |
|
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' |
| 729 |
|
exit 0 ;; |
| 741 |
– |
CRAY*T3D:*:*:*) |
| 742 |
– |
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' |
| 743 |
– |
exit 0 ;; |
| 730 |
|
CRAY*T3E:*:*:*) |
| 731 |
|
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' |
| 732 |
|
exit 0 ;; |
| 733 |
|
CRAY*SV1:*:*:*) |
| 734 |
|
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' |
| 735 |
|
exit 0 ;; |
| 736 |
+ |
*:UNICOS/mp:*:*) |
| 737 |
+ |
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' |
| 738 |
+ |
exit 0 ;; |
| 739 |
|
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) |
| 740 |
|
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
| 741 |
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` |
| 751 |
|
*:BSD/OS:*:*) |
| 752 |
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
| 753 |
|
exit 0 ;; |
| 754 |
< |
*:FreeBSD:*:*) |
| 754 |
> |
*:FreeBSD:*:*|*:GNU/FreeBSD:*:*) |
| 755 |
|
# Determine whether the default compiler uses glibc. |
| 756 |
|
eval $set_cc_for_build |
| 757 |
|
sed 's/^ //' << EOF >$dummy.c |
| 763 |
|
#endif |
| 764 |
|
EOF |
| 765 |
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` |
| 766 |
< |
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} |
| 766 |
> |
# GNU/FreeBSD systems have a "k" prefix to indicate we are using |
| 767 |
> |
# FreeBSD's kernel, but not the complete OS. |
| 768 |
> |
case ${LIBC} in gnu) kernel_only='k' ;; esac |
| 769 |
> |
echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} |
| 770 |
|
exit 0 ;; |
| 771 |
|
i*:CYGWIN*:*) |
| 772 |
|
echo ${UNAME_MACHINE}-pc-cygwin |
| 777 |
|
i*:PW*:*) |
| 778 |
|
echo ${UNAME_MACHINE}-pc-pw32 |
| 779 |
|
exit 0 ;; |
| 780 |
< |
x86:Interix*:3*) |
| 781 |
< |
echo i586-pc-interix3 |
| 780 |
> |
x86:Interix*:[34]*) |
| 781 |
> |
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' |
| 782 |
|
exit 0 ;; |
| 783 |
|
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
| 784 |
|
echo i${UNAME_MACHINE}-pc-mks |
| 807 |
|
arm*:Linux:*:*) |
| 808 |
|
echo ${UNAME_MACHINE}-unknown-linux-gnu |
| 809 |
|
exit 0 ;; |
| 810 |
+ |
cris:Linux:*:*) |
| 811 |
+ |
echo cris-axis-linux-gnu |
| 812 |
+ |
exit 0 ;; |
| 813 |
|
ia64:Linux:*:*) |
| 814 |
|
echo ${UNAME_MACHINE}-unknown-linux-gnu |
| 815 |
|
exit 0 ;; |
| 888 |
|
s390:Linux:*:* | s390x:Linux:*:*) |
| 889 |
|
echo ${UNAME_MACHINE}-ibm-linux |
| 890 |
|
exit 0 ;; |
| 891 |
+ |
sh64*:Linux:*:*) |
| 892 |
+ |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
| 893 |
+ |
exit 0 ;; |
| 894 |
|
sh*:Linux:*:*) |
| 895 |
|
echo ${UNAME_MACHINE}-unknown-linux-gnu |
| 896 |
|
exit 0 ;; |
| 947 |
|
#else |
| 948 |
|
LIBC=gnuaout |
| 949 |
|
#endif |
| 950 |
+ |
#endif |
| 951 |
+ |
#ifdef __dietlibc__ |
| 952 |
+ |
LIBC=dietlibc |
| 953 |
|
#endif |
| 954 |
|
EOF |
| 955 |
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` |
| 1052 |
|
exit 0 ;; |
| 1053 |
|
M68*:*:R3V[567]*:*) |
| 1054 |
|
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; |
| 1055 |
< |
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) |
| 1055 |
> |
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) |
| 1056 |
|
OS_REL='' |
| 1057 |
|
test -r /etc/.relid \ |
| 1058 |
|
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` |
| 1150 |
|
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
| 1151 |
|
exit 0 ;; |
| 1152 |
|
*:Darwin:*:*) |
| 1153 |
< |
echo `uname -p`-apple-darwin${UNAME_RELEASE} |
| 1153 |
> |
case `uname -p` in |
| 1154 |
> |
*86) UNAME_PROCESSOR=i686 ;; |
| 1155 |
> |
powerpc) UNAME_PROCESSOR=powerpc ;; |
| 1156 |
> |
esac |
| 1157 |
> |
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
| 1158 |
|
exit 0 ;; |
| 1159 |
|
*:procnto*:*:* | *:QNX:[0123456789]*:*) |
| 1160 |
|
UNAME_PROCESSOR=`uname -p` |
| 1167 |
|
*:QNX:*:4*) |
| 1168 |
|
echo i386-pc-qnx |
| 1169 |
|
exit 0 ;; |
| 1170 |
< |
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) |
| 1170 |
> |
NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) |
| 1171 |
|
echo nsr-tandem-nsk${UNAME_RELEASE} |
| 1172 |
|
exit 0 ;; |
| 1173 |
|
*:NonStop-UX:*:*) |
| 1208 |
|
*:ITS:*:*) |
| 1209 |
|
echo pdp10-unknown-its |
| 1210 |
|
exit 0 ;; |
| 1211 |
+ |
SEI:*:*:SEIUX) |
| 1212 |
+ |
echo mips-sei-seiux${UNAME_RELEASE} |
| 1213 |
+ |
exit 0 ;; |
| 1214 |
|
esac |
| 1215 |
|
|
| 1216 |
|
#echo '(No uname command or uname output not recognized.)' 1>&2 |