1 | #! /bin/sh |
---|
2 | # Attempt to guess a canonical system name. |
---|
3 | # |
---|
4 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 |
---|
5 | # Free Software Foundation, Inc. |
---|
6 | # |
---|
7 | # This file is free software; you can redistribute it and/or modify it |
---|
8 | # under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation; either version 2 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # This program is distributed in the hope that it will be useful, but |
---|
13 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
15 | # General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with this program; if not, write to the Free Software |
---|
19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
20 | # |
---|
21 | # As a special exception to the GNU General Public License, if you |
---|
22 | # distribute this file as part of a program that contains a |
---|
23 | # configuration script generated by Autoconf, you may include it under |
---|
24 | # the same distribution terms that you use for the rest of that program. |
---|
25 | |
---|
26 | # Written by Per Bothner <bothner@cygnus.com>. |
---|
27 | # The master version of this file is at the FSF in /home/gd/gnu/lib. |
---|
28 | # |
---|
29 | # This script attempts to guess a canonical system name similar to |
---|
30 | # config.sub. If it succeeds, it prints the system name on stdout, and |
---|
31 | # exits with 0. Otherwise, it exits with 1. |
---|
32 | # |
---|
33 | # The plan is that this can be called by configure scripts if you |
---|
34 | # don't specify an explicit system type (host/target name). |
---|
35 | # |
---|
36 | # Only a few systems have been added to this list; please add others |
---|
37 | # (but try to keep the structure clean). |
---|
38 | # |
---|
39 | |
---|
40 | # This is needed to find uname on a Pyramid OSx when run in the BSD universe. |
---|
41 | # (ghazi@noc.rutgers.edu 8/24/94.) |
---|
42 | if (test -f /.attbin/uname) >/dev/null 2>&1 ; then |
---|
43 | PATH=$PATH:/.attbin ; export PATH |
---|
44 | fi |
---|
45 | |
---|
46 | UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown |
---|
47 | UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown |
---|
48 | UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
---|
49 | UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown |
---|
50 | |
---|
51 | trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 |
---|
52 | |
---|
53 | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in |
---|
54 | i?86:*:*:*) |
---|
55 | echo 'xwqilkn(){}' >dummy.c |
---|
56 | ${CC-cc} dummy.c -S 2>/dev/null |
---|
57 | if test "$?" = 0 ; then |
---|
58 | u=`grep xwqilkn dummy.s | head -1 | sed 's;[^_]*\([_]*\)xwqilkn;\1;'` |
---|
59 | cat <<EOF >dummy1.s |
---|
60 | .globl ${u}cpuid |
---|
61 | ${u}cpuid: |
---|
62 | pushl %esi |
---|
63 | pushl %ebx |
---|
64 | movl 16(%esp),%eax |
---|
65 | .word 0xa20f |
---|
66 | movl 12(%esp),%esi |
---|
67 | movl %ebx,(%esi) |
---|
68 | movl %edx,4(%esi) |
---|
69 | movl %ecx,8(%esi) |
---|
70 | popl %ebx |
---|
71 | popl %esi |
---|
72 | ret |
---|
73 | EOF |
---|
74 | cat <<EOF >dummy2.c |
---|
75 | main () |
---|
76 | { |
---|
77 | char vendor_string[13]; |
---|
78 | char dummy_string[12]; |
---|
79 | long fms; |
---|
80 | int family, model; |
---|
81 | char *modelstr; |
---|
82 | |
---|
83 | cpuid (vendor_string, 0); |
---|
84 | vendor_string[12] = 0; |
---|
85 | |
---|
86 | fms = cpuid (dummy_string, 1); |
---|
87 | |
---|
88 | family = (fms >> 8) & 15; |
---|
89 | model = (fms >> 4) & 15; |
---|
90 | |
---|
91 | modelstr = "i486"; |
---|
92 | if (strcmp (vendor_string, "GenuineIntel") == 0) |
---|
93 | { |
---|
94 | switch (family) |
---|
95 | { |
---|
96 | case 5: |
---|
97 | if (model <= 2) |
---|
98 | modelstr = "pentium"; |
---|
99 | else if (model >= 4) |
---|
100 | modelstr = "pentiummmx"; |
---|
101 | break; |
---|
102 | case 6: |
---|
103 | if (model == 1) |
---|
104 | modelstr = "pentiumpro"; |
---|
105 | else if (model <= 5) |
---|
106 | modelstr = "pentium2"; |
---|
107 | else |
---|
108 | modelstr = "pentium3"; |
---|
109 | break; |
---|
110 | } |
---|
111 | } |
---|
112 | else if (strcmp (vendor_string, "AuthenticAMD") == 0) |
---|
113 | { |
---|
114 | switch (family) |
---|
115 | { |
---|
116 | case 5: |
---|
117 | if (model <= 3) |
---|
118 | modelstr = "k5"; |
---|
119 | else if (model <= 7) |
---|
120 | modelstr = "k6"; |
---|
121 | else if (model <= 8) |
---|
122 | modelstr = "k62"; |
---|
123 | else if (model <= 9) |
---|
124 | modelstr = "k63"; |
---|
125 | break; |
---|
126 | case 6: |
---|
127 | modelstr = "athlon"; |
---|
128 | break; |
---|
129 | } |
---|
130 | } |
---|
131 | else if (strcmp (vendor_string, "CyrixInstead") == 0) |
---|
132 | { |
---|
133 | /* Should recognize Cyrix' processors too. */ |
---|
134 | } |
---|
135 | |
---|
136 | printf ("%s\n", modelstr); |
---|
137 | return 0; |
---|
138 | } |
---|
139 | EOF |
---|
140 | ${CC-cc} dummy1.s dummy2.c -o dummy 2>/dev/null |
---|
141 | if test "$?" = 0 ; then |
---|
142 | X86CPU=`./dummy` |
---|
143 | fi |
---|
144 | fi |
---|
145 | |
---|
146 | # Default to believing uname -m if the program fails to compile or |
---|
147 | # run. Will fail to run on 386 since cpuid was only added on 486. |
---|
148 | if test -z "$X86CPU" |
---|
149 | then |
---|
150 | X86CPU="$UNAME_MACHINE" |
---|
151 | fi |
---|
152 | rm -f dummy.c dummy.s dummy1.s dummy2.c dummy |
---|
153 | ;; |
---|
154 | esac |
---|
155 | |
---|
156 | # Note: order is significant - the case branches are not exclusive. |
---|
157 | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in |
---|
158 | alpha:OSF1:*:*) |
---|
159 | if test $UNAME_RELEASE = "V4.0"; then |
---|
160 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` |
---|
161 | fi |
---|
162 | # A Vn.n version is a released version. |
---|
163 | # A Tn.n version is a released field test version. |
---|
164 | # A Xn.n version is an unreleased experimental baselevel. |
---|
165 | # 1.2 uses "1.2" for uname -r. |
---|
166 | cat <<EOF >dummy.s |
---|
167 | .globl main |
---|
168 | .ent main |
---|
169 | main: |
---|
170 | .frame \$30,0,\$26,0 |
---|
171 | .prologue 0 |
---|
172 | .long 0x47e03d80 # implver $0 |
---|
173 | lda \$2,259 |
---|
174 | .long 0x47e20c21 # amask $2,$1 |
---|
175 | srl \$1,8,\$2 |
---|
176 | sll \$2,2,\$2 |
---|
177 | sll \$0,3,\$0 |
---|
178 | addl \$1,\$0,\$0 |
---|
179 | addl \$2,\$0,\$0 |
---|
180 | ret \$31,(\$26),1 |
---|
181 | .end main |
---|
182 | EOF |
---|
183 | ${CC-cc} dummy.s -o dummy 2>/dev/null |
---|
184 | if test "$?" = 0 ; then |
---|
185 | ./dummy |
---|
186 | case "$?" in |
---|
187 | 7) |
---|
188 | UNAME_MACHINE="alpha" |
---|
189 | ;; |
---|
190 | 15) |
---|
191 | UNAME_MACHINE="alphaev5" |
---|
192 | ;; |
---|
193 | 14) |
---|
194 | UNAME_MACHINE="alphaev56" |
---|
195 | ;; |
---|
196 | 10) |
---|
197 | UNAME_MACHINE="alphapca56" |
---|
198 | ;; |
---|
199 | 16) |
---|
200 | UNAME_MACHINE="alphaev6" |
---|
201 | ;; |
---|
202 | esac |
---|
203 | fi |
---|
204 | rm -f dummy.s dummy |
---|
205 | echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` |
---|
206 | exit 0 ;; |
---|
207 | alpha:NetBSD:*:* | alpha:FreeBSD:*:*) |
---|
208 | cat <<EOF >dummy.s |
---|
209 | .globl main |
---|
210 | .ent main |
---|
211 | main: |
---|
212 | .frame \$30,0,\$26,0 |
---|
213 | .prologue 0 |
---|
214 | .long 0x47e03d80 # implver $0 |
---|
215 | lda \$2,259 |
---|
216 | .long 0x47e20c21 # amask $2,$1 |
---|
217 | srl \$1,8,\$2 |
---|
218 | sll \$2,2,\$2 |
---|
219 | sll \$0,3,\$0 |
---|
220 | addl \$1,\$0,\$0 |
---|
221 | addl \$2,\$0,\$0 |
---|
222 | ret \$31,(\$26),1 |
---|
223 | .end main |
---|
224 | EOF |
---|
225 | ${CC-cc} dummy.s -o dummy 2>/dev/null |
---|
226 | if test "$?" = 0 ; then |
---|
227 | ./dummy |
---|
228 | case "$?" in |
---|
229 | 7) |
---|
230 | UNAME_MACHINE="alpha" |
---|
231 | ;; |
---|
232 | 15) |
---|
233 | UNAME_MACHINE="alphaev5" |
---|
234 | ;; |
---|
235 | 14) |
---|
236 | UNAME_MACHINE="alphaev56" |
---|
237 | ;; |
---|
238 | 10) |
---|
239 | UNAME_MACHINE="alphapca56" |
---|
240 | ;; |
---|
241 | 16) |
---|
242 | UNAME_MACHINE="alphaev6" |
---|
243 | ;; |
---|
244 | esac |
---|
245 | fi |
---|
246 | rm -f dummy.s dummy |
---|
247 | echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM}${UNAME_RELEASE} | sed -e 's/^[VTX]//' -e 's/[-(].*//' | tr [[A-Z]] [[a-z]]` |
---|
248 | exit 0 ;; |
---|
249 | 21064:Windows_NT:50:3) |
---|
250 | echo alpha-dec-winnt3.5 |
---|
251 | exit 0 ;; |
---|
252 | Amiga*:UNIX_System_V:4.0:*) |
---|
253 | echo m68k-cbm-sysv4 |
---|
254 | exit 0;; |
---|
255 | amiga:NetBSD:*:*) |
---|
256 | echo m68k-cbm-netbsd${UNAME_RELEASE} |
---|
257 | exit 0 ;; |
---|
258 | amiga:OpenBSD:*:*) |
---|
259 | echo m68k-unknown-openbsd${UNAME_RELEASE} |
---|
260 | exit 0 ;; |
---|
261 | arc64:OpenBSD:*:*) |
---|
262 | echo mips64el-unknown-openbsd${UNAME_RELEASE} |
---|
263 | exit 0 ;; |
---|
264 | arc:OpenBSD:*:*) |
---|
265 | echo mipsel-unknown-openbsd${UNAME_RELEASE} |
---|
266 | exit 0 ;; |
---|
267 | hkmips:OpenBSD:*:*) |
---|
268 | echo mips-unknown-openbsd${UNAME_RELEASE} |
---|
269 | exit 0 ;; |
---|
270 | pmax:OpenBSD:*:*) |
---|
271 | echo mipsel-unknown-openbsd${UNAME_RELEASE} |
---|
272 | exit 0 ;; |
---|
273 | sgi:OpenBSD:*:*) |
---|
274 | echo mips-unknown-openbsd${UNAME_RELEASE} |
---|
275 | exit 0 ;; |
---|
276 | wgrisc:OpenBSD:*:*) |
---|
277 | echo mipsel-unknown-openbsd${UNAME_RELEASE} |
---|
278 | exit 0 ;; |
---|
279 | arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) |
---|
280 | echo arm-acorn-riscix${UNAME_RELEASE} |
---|
281 | exit 0;; |
---|
282 | arm32:NetBSD:*:*) |
---|
283 | echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` |
---|
284 | exit 0 ;; |
---|
285 | SR2?01:HI-UX/MPP:*:*) |
---|
286 | echo hppa1.1-hitachi-hiuxmpp |
---|
287 | exit 0;; |
---|
288 | Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) |
---|
289 | # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. |
---|
290 | if test "`(/bin/universe) 2>/dev/null`" = att ; then |
---|
291 | echo pyramid-pyramid-sysv3 |
---|
292 | else |
---|
293 | echo pyramid-pyramid-bsd |
---|
294 | fi |
---|
295 | exit 0 ;; |
---|
296 | NILE:*:*:dcosx) |
---|
297 | echo pyramid-pyramid-svr4 |
---|
298 | exit 0 ;; |
---|
299 | sun4[md]:SunOS:5.*:*) |
---|
300 | echo sparcv8-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
---|
301 | exit 0 ;; |
---|
302 | sun4u:SunOS:5.*:*) |
---|
303 | echo sparcv9-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
---|
304 | exit 0 ;; |
---|
305 | sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) |
---|
306 | echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
---|
307 | exit 0 ;; |
---|
308 | i86pc:SunOS:5.*:*) |
---|
309 | echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
---|
310 | exit 0 ;; |
---|
311 | sun4[md]:SunOS:*:*) |
---|
312 | case "`/usr/bin/arch -k`" in |
---|
313 | Series*|S4*) |
---|
314 | UNAME_RELEASE=`uname -v` |
---|
315 | ;; |
---|
316 | esac |
---|
317 | # Japanese Language versions have a version number like `4.1.3-JL'. |
---|
318 | echo sparcv8-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` |
---|
319 | exit 0 ;; |
---|
320 | sun4*:SunOS:*:*) |
---|
321 | case "`/usr/bin/arch -k`" in |
---|
322 | Series*|S4*) |
---|
323 | UNAME_RELEASE=`uname -v` |
---|
324 | ;; |
---|
325 | esac |
---|
326 | # Japanese Language versions have a version number like `4.1.3-JL'. |
---|
327 | echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` |
---|
328 | exit 0 ;; |
---|
329 | sun3*:SunOS:*:*) |
---|
330 | echo m68k-sun-sunos${UNAME_RELEASE} |
---|
331 | exit 0 ;; |
---|
332 | sun*:*:4.2BSD:*) |
---|
333 | UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` |
---|
334 | test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 |
---|
335 | case "`/bin/arch`" in |
---|
336 | sun3) |
---|
337 | echo m68k-sun-sunos${UNAME_RELEASE} |
---|
338 | ;; |
---|
339 | sun4) |
---|
340 | echo sparc-sun-sunos${UNAME_RELEASE} |
---|
341 | ;; |
---|
342 | esac |
---|
343 | exit 0 ;; |
---|
344 | aushp:SunOS:*:*) |
---|
345 | echo sparc-auspex-sunos${UNAME_RELEASE} |
---|
346 | exit 0 ;; |
---|
347 | atari*:NetBSD:*:*) |
---|
348 | echo m68k-atari-netbsd${UNAME_RELEASE} |
---|
349 | exit 0 ;; |
---|
350 | atari*:OpenBSD:*:*) |
---|
351 | echo m68k-unknown-openbsd${UNAME_RELEASE} |
---|
352 | exit 0 ;; |
---|
353 | sun3*:NetBSD:*:*) |
---|
354 | echo m68k-sun-netbsd${UNAME_RELEASE} |
---|
355 | exit 0 ;; |
---|
356 | sun3*:OpenBSD:*:*) |
---|
357 | echo m68k-unknown-openbsd${UNAME_RELEASE} |
---|
358 | exit 0 ;; |
---|
359 | mac68k:NetBSD:*:*) |
---|
360 | echo m68k-apple-netbsd${UNAME_RELEASE} |
---|
361 | exit 0 ;; |
---|
362 | mac68k:OpenBSD:*:*) |
---|
363 | echo m68k-unknown-openbsd${UNAME_RELEASE} |
---|
364 | exit 0 ;; |
---|
365 | macppc:NetBSD:*:*) |
---|
366 | echo powerpc-apple-netbsd${UNAME_RELEASE} |
---|
367 | exit 0 ;; |
---|
368 | mvme68k:OpenBSD:*:*) |
---|
369 | echo m68k-unknown-openbsd${UNAME_RELEASE} |
---|
370 | exit 0 ;; |
---|
371 | mvme88k:OpenBSD:*:*) |
---|
372 | echo m88k-unknown-openbsd${UNAME_RELEASE} |
---|
373 | exit 0 ;; |
---|
374 | powerpc:machten:*:*) |
---|
375 | echo powerpc-apple-machten${UNAME_RELEASE} |
---|
376 | exit 0 ;; |
---|
377 | RISC*:Mach:*:*) |
---|
378 | echo mips-dec-mach_bsd4.3 |
---|
379 | exit 0 ;; |
---|
380 | RISC*:ULTRIX:*:*) |
---|
381 | echo mips-dec-ultrix${UNAME_RELEASE} |
---|
382 | exit 0 ;; |
---|
383 | VAX*:ULTRIX*:*:*) |
---|
384 | echo vax-dec-ultrix${UNAME_RELEASE} |
---|
385 | exit 0 ;; |
---|
386 | 2020:CLIX:*:*) |
---|
387 | echo clipper-intergraph-clix${UNAME_RELEASE} |
---|
388 | exit 0 ;; |
---|
389 | mips:*:*:UMIPS | mips:*:*:RISCos) |
---|
390 | sed 's/^ //' << EOF >dummy.c |
---|
391 | int main (argc, argv) int argc; char **argv; { |
---|
392 | #if defined (host_mips) && defined (MIPSEB) |
---|
393 | #if defined (SYSTYPE_SYSV) |
---|
394 | printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); |
---|
395 | #endif |
---|
396 | #if defined (SYSTYPE_SVR4) |
---|
397 | printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); |
---|
398 | #endif |
---|
399 | #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) |
---|
400 | printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); |
---|
401 | #endif |
---|
402 | #endif |
---|
403 | exit (-1); |
---|
404 | } |
---|
405 | EOF |
---|
406 | ${CC-cc} dummy.c -o dummy \ |
---|
407 | && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ |
---|
408 | && rm dummy.c dummy && exit 0 |
---|
409 | rm -f dummy.c dummy |
---|
410 | echo mips-mips-riscos${UNAME_RELEASE} |
---|
411 | exit 0 ;; |
---|
412 | Night_Hawk:Power_UNIX:*:*) |
---|
413 | echo powerpc-harris-powerunix |
---|
414 | exit 0 ;; |
---|
415 | m88k:CX/UX:7*:*) |
---|
416 | echo m88k-harris-cxux7 |
---|
417 | exit 0 ;; |
---|
418 | m88k:*:4*:R4*) |
---|
419 | echo m88k-motorola-sysv4 |
---|
420 | exit 0 ;; |
---|
421 | m88k:*:3*:R3*) |
---|
422 | echo m88k-motorola-sysv3 |
---|
423 | exit 0 ;; |
---|
424 | AViiON:dgux:*:*) |
---|
425 | # DG/UX returns AViiON for all architectures |
---|
426 | UNAME_PROCESSOR=`/usr/bin/uname -p` |
---|
427 | if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then |
---|
428 | if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ |
---|
429 | -o ${TARGET_BINARY_INTERFACE}x = x ] ; then |
---|
430 | echo m88k-dg-dgux${UNAME_RELEASE} |
---|
431 | else |
---|
432 | echo m88k-dg-dguxbcs${UNAME_RELEASE} |
---|
433 | fi |
---|
434 | else echo i586-dg-dgux${UNAME_RELEASE} |
---|
435 | fi |
---|
436 | exit 0 ;; |
---|
437 | M88*:DolphinOS:*:*) # DolphinOS (SVR3) |
---|
438 | echo m88k-dolphin-sysv3 |
---|
439 | exit 0 ;; |
---|
440 | M88*:*:R3*:*) |
---|
441 | # Delta 88k system running SVR3 |
---|
442 | echo m88k-motorola-sysv3 |
---|
443 | exit 0 ;; |
---|
444 | XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) |
---|
445 | echo m88k-tektronix-sysv3 |
---|
446 | exit 0 ;; |
---|
447 | Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) |
---|
448 | echo m68k-tektronix-bsd |
---|
449 | exit 0 ;; |
---|
450 | *:IRIX*:*:*) |
---|
451 | echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` |
---|
452 | exit 0 ;; |
---|
453 | ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. |
---|
454 | echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id |
---|
455 | exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' |
---|
456 | i?86:AIX:*:*) |
---|
457 | echo i386-ibm-aix |
---|
458 | exit 0 ;; |
---|
459 | *:AIX:2:3) |
---|
460 | if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then |
---|
461 | sed 's/^ //' << EOF >dummy.c |
---|
462 | #include <sys/systemcfg.h> |
---|
463 | |
---|
464 | main() |
---|
465 | { |
---|
466 | if (!__power_pc()) |
---|
467 | exit(1); |
---|
468 | puts("powerpc-ibm-aix3.2.5"); |
---|
469 | exit(0); |
---|
470 | } |
---|
471 | EOF |
---|
472 | ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 |
---|
473 | rm -f dummy.c dummy |
---|
474 | echo rs6000-ibm-aix3.2.5 |
---|
475 | elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then |
---|
476 | echo rs6000-ibm-aix3.2.4 |
---|
477 | else |
---|
478 | echo rs6000-ibm-aix3.2 |
---|
479 | fi |
---|
480 | exit 0 ;; |
---|
481 | *:AIX:*:4) |
---|
482 | sed 's/^ //' << EOF >dummy.c |
---|
483 | #include <stdio.h> |
---|
484 | #include <sys/systemcfg.h> |
---|
485 | main () |
---|
486 | { |
---|
487 | if (_system_configuration.architecture == POWER_RS |
---|
488 | || _system_configuration.implementation == POWER_601) |
---|
489 | puts ("power"); |
---|
490 | else |
---|
491 | { |
---|
492 | if (_system_configuration.width == 64) |
---|
493 | puts ("powerpc64"); |
---|
494 | else |
---|
495 | puts ("powerpc"); |
---|
496 | } |
---|
497 | exit (0); |
---|
498 | } |
---|
499 | EOF |
---|
500 | ${CC-cc} dummy.c -o dummy |
---|
501 | IBM_ARCH=`./dummy` |
---|
502 | rm -f dummy.c dummy |
---|
503 | if [ -x /usr/bin/oslevel ] ; then |
---|
504 | IBM_REV=`/usr/bin/oslevel` |
---|
505 | else |
---|
506 | IBM_REV=4.${UNAME_RELEASE} |
---|
507 | fi |
---|
508 | echo ${IBM_ARCH}-ibm-aix${IBM_REV} |
---|
509 | exit 0 ;; |
---|
510 | *:AIX:*:*) |
---|
511 | echo rs6000-ibm-aix |
---|
512 | exit 0 ;; |
---|
513 | ibmrt:4.4BSD:*|romp-ibm:BSD:*) |
---|
514 | echo romp-ibm-bsd4.4 |
---|
515 | exit 0 ;; |
---|
516 | ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and |
---|
517 | echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to |
---|
518 | exit 0 ;; # report: romp-ibm BSD 4.3 |
---|
519 | *:BOSX:*:*) |
---|
520 | echo rs6000-bull-bosx |
---|
521 | exit 0 ;; |
---|
522 | DPX/2?00:B.O.S.:*:*) |
---|
523 | echo m68k-bull-sysv3 |
---|
524 | exit 0 ;; |
---|
525 | 9000/[34]??:4.3bsd:1.*:*) |
---|
526 | echo m68k-hp-bsd |
---|
527 | exit 0 ;; |
---|
528 | hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) |
---|
529 | echo m68k-hp-bsd4.4 |
---|
530 | exit 0 ;; |
---|
531 | 9000/[3478]??:HP-UX:*:*) |
---|
532 | case "${UNAME_MACHINE}" in |
---|
533 | 9000/31? ) HP_ARCH=m68000 ;; |
---|
534 | 9000/[34]?? ) HP_ARCH=m68k ;; |
---|
535 | 9000/6?? ) HP_ARCH=hppa1.0 ;; |
---|
536 | 9000/78? ) HP_ARCH=hppa2.0 ;; |
---|
537 | 9000/7?? ) HP_ARCH=hppa1.1 ;; |
---|
538 | 9000/8[67]1 | 9000/80[24] | 9000/8[10]0 | 9000/8[78]9 | 9000/893 ) |
---|
539 | HP_ARCH=hppa2.0 ;; |
---|
540 | 9000/8?[13679] ) HP_ARCH=hppa1.1 ;; |
---|
541 | 9000/8?? ) HP_ARCH=hppa1.0 ;; |
---|
542 | esac |
---|
543 | HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` |
---|
544 | echo ${HP_ARCH}-hp-hpux${HPUX_REV} |
---|
545 | exit 0 ;; |
---|
546 | 3050*:HI-UX:*:*) |
---|
547 | sed 's/^ //' << EOF >dummy.c |
---|
548 | #include <unistd.h> |
---|
549 | int |
---|
550 | main () |
---|
551 | { |
---|
552 | long cpu = sysconf (_SC_CPU_VERSION); |
---|
553 | /* The order matters, because CPU_IS_HP_MC68K erroneously returns |
---|
554 | true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct |
---|
555 | results, however. */ |
---|
556 | if (CPU_IS_PA_RISC (cpu)) |
---|
557 | { |
---|
558 | switch (cpu) |
---|
559 | { |
---|
560 | case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; |
---|
561 | case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; |
---|
562 | case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; |
---|
563 | default: puts ("hppa-hitachi-hiuxwe2"); break; |
---|
564 | } |
---|
565 | } |
---|
566 | else if (CPU_IS_HP_MC68K (cpu)) |
---|
567 | puts ("m68k-hitachi-hiuxwe2"); |
---|
568 | else puts ("unknown-hitachi-hiuxwe2"); |
---|
569 | exit (0); |
---|
570 | } |
---|
571 | EOF |
---|
572 | ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 |
---|
573 | rm -f dummy.c dummy |
---|
574 | echo unknown-hitachi-hiuxwe2 |
---|
575 | exit 0 ;; |
---|
576 | 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) |
---|
577 | echo hppa1.1-hp-bsd |
---|
578 | exit 0 ;; |
---|
579 | 9000/8??:4.3bsd:*:*) |
---|
580 | echo hppa1.0-hp-bsd |
---|
581 | exit 0 ;; |
---|
582 | hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) |
---|
583 | echo hppa1.1-hp-osf |
---|
584 | exit 0 ;; |
---|
585 | hp8??:OSF1:*:*) |
---|
586 | echo hppa1.0-hp-osf |
---|
587 | exit 0 ;; |
---|
588 | i?86:OSF1:*:*) |
---|
589 | if [ -x /usr/sbin/sysversion ] ; then |
---|
590 | echo ${UNAME_MACHINE}-unknown-osf1mk |
---|
591 | else |
---|
592 | echo ${UNAME_MACHINE}-unknown-osf1 |
---|
593 | fi |
---|
594 | exit 0 ;; |
---|
595 | parisc*:Lites*:*:*) |
---|
596 | echo hppa1.1-hp-lites |
---|
597 | exit 0 ;; |
---|
598 | C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) |
---|
599 | echo c1-convex-bsd |
---|
600 | exit 0 ;; |
---|
601 | C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) |
---|
602 | if getsysinfo -f scalar_acc |
---|
603 | then echo c32-convex-bsd |
---|
604 | else echo c2-convex-bsd |
---|
605 | fi |
---|
606 | exit 0 ;; |
---|
607 | C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) |
---|
608 | echo c34-convex-bsd |
---|
609 | exit 0 ;; |
---|
610 | C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) |
---|
611 | echo c38-convex-bsd |
---|
612 | exit 0 ;; |
---|
613 | C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) |
---|
614 | echo c4-convex-bsd |
---|
615 | exit 0 ;; |
---|
616 | CRAY*X-MP:*:*:*) |
---|
617 | echo xmp-cray-unicos |
---|
618 | exit 0 ;; |
---|
619 | CRAY*Y-MP:*:*:*) |
---|
620 | echo ymp-cray-unicos${UNAME_RELEASE} |
---|
621 | exit 0 ;; |
---|
622 | CRAY*[A-Z]90:*:*:*) |
---|
623 | echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ |
---|
624 | | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ |
---|
625 | -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ |
---|
626 | exit 0 ;; |
---|
627 | CRAY*TS:*:*:*) |
---|
628 | echo t90-cray-unicos${UNAME_RELEASE} |
---|
629 | exit 0 ;; |
---|
630 | CRAY-2:*:*:*) |
---|
631 | echo cray2-cray-unicos |
---|
632 | exit 0 ;; |
---|
633 | CRAY*T3D:*:*) |
---|
634 | echo alpha-cray-unicos |
---|
635 | exit 0 ;; |
---|
636 | CRAY*T3E:*:*) |
---|
637 | echo alphaev5-cray-unicos |
---|
638 | exit 0 ;; |
---|
639 | F300:UNIX_System_V:*:*) |
---|
640 | FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` |
---|
641 | FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` |
---|
642 | echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" |
---|
643 | exit 0 ;; |
---|
644 | F301:UNIX_System_V:*:*) |
---|
645 | echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` |
---|
646 | exit 0 ;; |
---|
647 | hp3[0-9][05]:NetBSD:*:*) |
---|
648 | echo m68k-hp-netbsd${UNAME_RELEASE} |
---|
649 | exit 0 ;; |
---|
650 | hp300:OpenBSD:*:*) |
---|
651 | echo m68k-unknown-openbsd${UNAME_RELEASE} |
---|
652 | exit 0 ;; |
---|
653 | i?86:BSD/386:*:* | *:BSD/OS:*:*) |
---|
654 | echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} |
---|
655 | exit 0 ;; |
---|
656 | i386:FreeBSD:*:*) |
---|
657 | echo ${X86CPU}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
---|
658 | exit 0 ;; |
---|
659 | *:FreeBSD:*:*) |
---|
660 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
---|
661 | exit 0 ;; |
---|
662 | i386:NetBSD:*:*) |
---|
663 | echo ${X86CPU}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` |
---|
664 | exit 0 ;; |
---|
665 | *:NetBSD:*:*) |
---|
666 | echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` |
---|
667 | exit 0 ;; |
---|
668 | i386:OpenBSD:*:*) |
---|
669 | echo ${X86CPU}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` |
---|
670 | exit 0 ;; |
---|
671 | *:OpenBSD:*:*) |
---|
672 | echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` |
---|
673 | exit 0 ;; |
---|
674 | i*:CYGWIN*:*) |
---|
675 | echo ${UNAME_MACHINE}-pc-cygwin32 |
---|
676 | exit 0 ;; |
---|
677 | i*:MINGW*:*) |
---|
678 | echo ${UNAME_MACHINE}-pc-mingw32 |
---|
679 | exit 0 ;; |
---|
680 | p*:CYGWIN*:*) |
---|
681 | echo powerpcle-unknown-cygwin32 |
---|
682 | exit 0 ;; |
---|
683 | prep*:SunOS:5.*:*) |
---|
684 | echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
---|
685 | exit 0 ;; |
---|
686 | *:GNU:*:*) |
---|
687 | echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` |
---|
688 | exit 0 ;; |
---|
689 | *:Linux:*:*) |
---|
690 | # uname on the ARM produces all sorts of strangeness, and we need to |
---|
691 | # filter it out. |
---|
692 | case "$UNAME_MACHINE" in |
---|
693 | arm* | sa110*) UNAME_MACHINE="arm" ;; |
---|
694 | esac |
---|
695 | |
---|
696 | # The BFD linker knows what the default object file format is, so |
---|
697 | # first see if it will tell us. |
---|
698 | ld_help_string=`ld --help 2>&1` |
---|
699 | ld_supported_emulations=`echo $ld_help_string \ |
---|
700 | | sed -ne '/supported emulations:/!d |
---|
701 | s/[ ][ ]*/ /g |
---|
702 | s/.*supported emulations: *// |
---|
703 | s/ .*// |
---|
704 | p'` |
---|
705 | case "$ld_supported_emulations" in |
---|
706 | i?86linux) echo "${X86CPU}-pc-linux-gnuaout" ; exit 0 ;; |
---|
707 | i?86coff) echo "${X86CPU}-pc-linux-gnucoff" ; exit 0 ;; |
---|
708 | sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; |
---|
709 | armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; |
---|
710 | m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; |
---|
711 | elf32ppc) |
---|
712 | # Determine Lib Version |
---|
713 | cat >dummy.c <<EOF |
---|
714 | #include <features.h> |
---|
715 | #if defined(__GLIBC__) |
---|
716 | extern char __libc_version[]; |
---|
717 | extern char __libc_release[]; |
---|
718 | #endif |
---|
719 | main(argc, argv) |
---|
720 | int argc; |
---|
721 | char *argv[]; |
---|
722 | { |
---|
723 | #if defined(__GLIBC__) |
---|
724 | printf("%s %s\n", __libc_version, __libc_release); |
---|
725 | #else |
---|
726 | printf("unkown\n"); |
---|
727 | #endif |
---|
728 | return 0; |
---|
729 | } |
---|
730 | EOF |
---|
731 | LIBC="" |
---|
732 | ${CC-cc} dummy.c -o dummy 2>/dev/null |
---|
733 | if test "$?" = 0 ; then |
---|
734 | ./dummy | grep 1\.99 > /dev/null |
---|
735 | if test "$?" = 0 ; then |
---|
736 | LIBC="libc1" |
---|
737 | fi |
---|
738 | fi |
---|
739 | rm -f dummy.c dummy |
---|
740 | echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;; |
---|
741 | esac |
---|
742 | |
---|
743 | if test "${UNAME_MACHINE}" = "alpha" ; then |
---|
744 | sed 's/^ //' <<EOF >dummy.s |
---|
745 | .globl main |
---|
746 | .ent main |
---|
747 | main: |
---|
748 | .frame \$30,0,\$26,0 |
---|
749 | .prologue 0 |
---|
750 | .long 0x47e03d80 # implver $0 |
---|
751 | lda \$2,259 |
---|
752 | .long 0x47e20c21 # amask $2,$1 |
---|
753 | srl \$1,8,\$2 |
---|
754 | sll \$2,2,\$2 |
---|
755 | sll \$0,3,\$0 |
---|
756 | addl \$1,\$0,\$0 |
---|
757 | addl \$2,\$0,\$0 |
---|
758 | ret \$31,(\$26),1 |
---|
759 | .end main |
---|
760 | EOF |
---|
761 | LIBC="" |
---|
762 | ${CC-cc} dummy.s -o dummy 2>/dev/null |
---|
763 | if test "$?" = 0 ; then |
---|
764 | ./dummy |
---|
765 | case "$?" in |
---|
766 | 7) |
---|
767 | UNAME_MACHINE="alpha" |
---|
768 | ;; |
---|
769 | 15) |
---|
770 | UNAME_MACHINE="alphaev5" |
---|
771 | ;; |
---|
772 | 14) |
---|
773 | UNAME_MACHINE="alphaev56" |
---|
774 | ;; |
---|
775 | 10) |
---|
776 | UNAME_MACHINE="alphapca56" |
---|
777 | ;; |
---|
778 | 16) |
---|
779 | UNAME_MACHINE="alphaev6" |
---|
780 | ;; |
---|
781 | esac |
---|
782 | |
---|
783 | objdump --private-headers dummy | \ |
---|
784 | grep ld.so.1 > /dev/null |
---|
785 | if test "$?" = 0 ; then |
---|
786 | LIBC="libc1" |
---|
787 | fi |
---|
788 | fi |
---|
789 | rm -f dummy.s dummy |
---|
790 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 |
---|
791 | elif test "${UNAME_MACHINE}" = "mips" ; then |
---|
792 | cat >dummy.c <<EOF |
---|
793 | main(argc, argv) |
---|
794 | int argc; |
---|
795 | char *argv[]; |
---|
796 | { |
---|
797 | #ifdef __MIPSEB__ |
---|
798 | printf ("%s-unknown-linux-gnu\n", argv[1]); |
---|
799 | #endif |
---|
800 | #ifdef __MIPSEL__ |
---|
801 | printf ("%sel-unknown-linux-gnu\n", argv[1]); |
---|
802 | #endif |
---|
803 | return 0; |
---|
804 | } |
---|
805 | EOF |
---|
806 | ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 |
---|
807 | rm -f dummy.c dummy |
---|
808 | else |
---|
809 | # Either a pre-BFD a.out linker (linux-gnuoldld) |
---|
810 | # or one that does not give us useful --help. |
---|
811 | # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. |
---|
812 | # If ld does not provide *any* "supported emulations:" |
---|
813 | # that means it is gnuoldld. |
---|
814 | echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" |
---|
815 | test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 |
---|
816 | |
---|
817 | case "${UNAME_MACHINE}" in |
---|
818 | i?86) |
---|
819 | VENDOR=pc; |
---|
820 | UNAME_MACHINE=${X86CPU} |
---|
821 | ;; |
---|
822 | *) |
---|
823 | VENDOR=unknown; |
---|
824 | ;; |
---|
825 | esac |
---|
826 | # Determine whether the default compiler is a.out or elf |
---|
827 | cat >dummy.c <<EOF |
---|
828 | #include <features.h> |
---|
829 | main(argc, argv) |
---|
830 | int argc; |
---|
831 | char *argv[]; |
---|
832 | { |
---|
833 | #ifdef __ELF__ |
---|
834 | # ifdef __GLIBC__ |
---|
835 | # if __GLIBC__ >= 2 |
---|
836 | printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); |
---|
837 | # else |
---|
838 | printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); |
---|
839 | # endif |
---|
840 | # else |
---|
841 | printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); |
---|
842 | # endif |
---|
843 | #else |
---|
844 | printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); |
---|
845 | #endif |
---|
846 | return 0; |
---|
847 | } |
---|
848 | EOF |
---|
849 | ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 |
---|
850 | rm -f dummy.c dummy |
---|
851 | fi ;; |
---|
852 | # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions |
---|
853 | # are messed up and put the nodename in both sysname and nodename. |
---|
854 | i?86:DYNIX/ptx:4*:*) |
---|
855 | echo i386-sequent-sysv4 |
---|
856 | exit 0 ;; |
---|
857 | i?86:UNIX_SV:4.2MP:2.*) |
---|
858 | # Unixware is an offshoot of SVR4, but it has its own version |
---|
859 | # number series starting with 2... |
---|
860 | # I am not positive that other SVR4 systems won't match this, |
---|
861 | # I just have to hope. -- rms. |
---|
862 | # Use sysv4.2uw... so that sysv4* matches it. |
---|
863 | echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} |
---|
864 | exit 0 ;; |
---|
865 | i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) |
---|
866 | if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then |
---|
867 | echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} |
---|
868 | else |
---|
869 | echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} |
---|
870 | fi |
---|
871 | exit 0 ;; |
---|
872 | i?86:*:5:7) |
---|
873 | UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` |
---|
874 | (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 |
---|
875 | (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ |
---|
876 | && UNAME_MACHINE=i586 |
---|
877 | (/bin/uname -X|egrep '^Machine.*PentII' >/dev/null) \ |
---|
878 | && UNAME_MACHINE=i686 |
---|
879 | (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ |
---|
880 | && UNAME_MACHINE=i686 |
---|
881 | echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} |
---|
882 | exit 0 ;; |
---|
883 | i?86:*:3.2:*) |
---|
884 | if test -f /usr/options/cb.name; then |
---|
885 | UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` |
---|
886 | echo ${UNAME_MACHINE}-pc-isc$UNAME_REL |
---|
887 | elif /bin/uname -X 2>/dev/null >/dev/null ; then |
---|
888 | UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` |
---|
889 | (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 |
---|
890 | (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ |
---|
891 | && UNAME_MACHINE=i586 |
---|
892 | (/bin/uname -X|egrep '^Machine.*PentII' >/dev/null) \ |
---|
893 | && UNAME_MACHINE=i686 |
---|
894 | (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ |
---|
895 | && UNAME_MACHINE=i686 |
---|
896 | echo ${UNAME_MACHINE}-pc-sco$UNAME_REL |
---|
897 | else |
---|
898 | echo ${UNAME_MACHINE}-pc-sysv32 |
---|
899 | fi |
---|
900 | exit 0 ;; |
---|
901 | pc:*:*:*) |
---|
902 | # uname -m prints for DJGPP always 'pc', but it prints nothing about |
---|
903 | # the processor, so we play safe by assuming i386. |
---|
904 | echo i386-pc-msdosdjgpp |
---|
905 | exit 0 ;; |
---|
906 | Intel:Mach:3*:*) |
---|
907 | echo i386-pc-mach3 |
---|
908 | exit 0 ;; |
---|
909 | paragon:*:*:*) |
---|
910 | echo i860-intel-osf1 |
---|
911 | exit 0 ;; |
---|
912 | i860:*:4.*:*) # i860-SVR4 |
---|
913 | if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then |
---|
914 | echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 |
---|
915 | else # Add other i860-SVR4 vendors below as they are discovered. |
---|
916 | echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 |
---|
917 | fi |
---|
918 | exit 0 ;; |
---|
919 | mini*:CTIX:SYS*5:*) |
---|
920 | # "miniframe" |
---|
921 | echo m68010-convergent-sysv |
---|
922 | exit 0 ;; |
---|
923 | M68*:*:R3V[567]*:*) |
---|
924 | test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; |
---|
925 | 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) |
---|
926 | OS_REL='' |
---|
927 | test -r /etc/.relid \ |
---|
928 | && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` |
---|
929 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ |
---|
930 | && echo i486-ncr-sysv4.3${OS_REL} && exit 0 |
---|
931 | /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ |
---|
932 | && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; |
---|
933 | 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) |
---|
934 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ |
---|
935 | && echo i486-ncr-sysv4 && exit 0 ;; |
---|
936 | m68*:LynxOS:2.*:*) |
---|
937 | echo m68k-unknown-lynxos${UNAME_RELEASE} |
---|
938 | exit 0 ;; |
---|
939 | mc68030:UNIX_System_V:4.*:*) |
---|
940 | echo m68k-atari-sysv4 |
---|
941 | exit 0 ;; |
---|
942 | i?86:LynxOS:2.*:*) |
---|
943 | echo i386-unknown-lynxos${UNAME_RELEASE} |
---|
944 | exit 0 ;; |
---|
945 | TSUNAMI:LynxOS:2.*:*) |
---|
946 | echo sparc-unknown-lynxos${UNAME_RELEASE} |
---|
947 | exit 0 ;; |
---|
948 | rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) |
---|
949 | echo rs6000-unknown-lynxos${UNAME_RELEASE} |
---|
950 | exit 0 ;; |
---|
951 | SM[BE]S:UNIX_SV:*:*) |
---|
952 | echo mips-dde-sysv${UNAME_RELEASE} |
---|
953 | exit 0 ;; |
---|
954 | RM*:SINIX-*:*:*) |
---|
955 | echo mips-sni-sysv4 |
---|
956 | exit 0 ;; |
---|
957 | *:SINIX-*:*:*) |
---|
958 | if uname -p 2>/dev/null >/dev/null ; then |
---|
959 | UNAME_MACHINE=`(uname -p) 2>/dev/null` |
---|
960 | echo ${UNAME_MACHINE}-sni-sysv4 |
---|
961 | else |
---|
962 | echo ns32k-sni-sysv |
---|
963 | fi |
---|
964 | exit 0 ;; |
---|
965 | PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort |
---|
966 | # says <Richard.M.Bartel@ccMail.Census.GOV> |
---|
967 | echo i586-unisys-sysv4 |
---|
968 | exit 0 ;; |
---|
969 | *:UNIX_System_V:4*:FTX*) |
---|
970 | # From Gerald Hewes <hewes@openmarket.com>. |
---|
971 | # How about differentiating between stratus architectures? -djm |
---|
972 | echo hppa1.1-stratus-sysv4 |
---|
973 | exit 0 ;; |
---|
974 | *:*:*:FTX*) |
---|
975 | # From seanf@swdc.stratus.com. |
---|
976 | echo i860-stratus-sysv4 |
---|
977 | exit 0 ;; |
---|
978 | mc68*:A/UX:*:*) |
---|
979 | echo m68k-apple-aux${UNAME_RELEASE} |
---|
980 | exit 0 ;; |
---|
981 | news*:NEWS-OS:*:6*) |
---|
982 | echo mips-sony-newsos6 |
---|
983 | exit 0 ;; |
---|
984 | R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) |
---|
985 | if [ -d /usr/nec ]; then |
---|
986 | echo mips-nec-sysv${UNAME_RELEASE} |
---|
987 | else |
---|
988 | echo mips-unknown-sysv${UNAME_RELEASE} |
---|
989 | fi |
---|
990 | exit 0 ;; |
---|
991 | BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. |
---|
992 | echo powerpc-be-beos |
---|
993 | exit 0 ;; |
---|
994 | BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. |
---|
995 | echo powerpc-apple-beos |
---|
996 | exit 0 ;; |
---|
997 | esac |
---|
998 | |
---|
999 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
---|
1000 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |
---|
1001 | |
---|
1002 | cat >dummy.c <<EOF |
---|
1003 | #ifdef _SEQUENT_ |
---|
1004 | # include <sys/types.h> |
---|
1005 | # include <sys/utsname.h> |
---|
1006 | #endif |
---|
1007 | main () |
---|
1008 | { |
---|
1009 | #if defined (sony) |
---|
1010 | #if defined (MIPSEB) |
---|
1011 | /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, |
---|
1012 | I don't know.... */ |
---|
1013 | printf ("mips-sony-bsd\n"); exit (0); |
---|
1014 | #else |
---|
1015 | #include <sys/param.h> |
---|
1016 | printf ("m68k-sony-newsos%s\n", |
---|
1017 | #ifdef NEWSOS4 |
---|
1018 | "4" |
---|
1019 | #else |
---|
1020 | "" |
---|
1021 | #endif |
---|
1022 | ); exit (0); |
---|
1023 | #endif |
---|
1024 | #endif |
---|
1025 | |
---|
1026 | #if defined (__arm) && defined (__acorn) && defined (__unix) |
---|
1027 | printf ("arm-acorn-riscix"); exit (0); |
---|
1028 | #endif |
---|
1029 | |
---|
1030 | #if defined (hp300) && !defined (hpux) |
---|
1031 | printf ("m68k-hp-bsd\n"); exit (0); |
---|
1032 | #endif |
---|
1033 | |
---|
1034 | #if defined (NeXT) |
---|
1035 | #if !defined (__ARCHITECTURE__) |
---|
1036 | #define __ARCHITECTURE__ "m68k" |
---|
1037 | #endif |
---|
1038 | int version; |
---|
1039 | version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; |
---|
1040 | printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); |
---|
1041 | exit (0); |
---|
1042 | #endif |
---|
1043 | |
---|
1044 | #if defined (MULTIMAX) || defined (n16) |
---|
1045 | #if defined (UMAXV) |
---|
1046 | printf ("ns32k-encore-sysv\n"); exit (0); |
---|
1047 | #else |
---|
1048 | #if defined (CMU) |
---|
1049 | printf ("ns32k-encore-mach\n"); exit (0); |
---|
1050 | #else |
---|
1051 | printf ("ns32k-encore-bsd\n"); exit (0); |
---|
1052 | #endif |
---|
1053 | #endif |
---|
1054 | #endif |
---|
1055 | |
---|
1056 | #if defined (__386BSD__) |
---|
1057 | printf ("i386-pc-bsd\n"); exit (0); |
---|
1058 | #endif |
---|
1059 | |
---|
1060 | #if defined (sequent) |
---|
1061 | #if defined (i386) |
---|
1062 | printf ("i386-sequent-dynix\n"); exit (0); |
---|
1063 | #endif |
---|
1064 | #if defined (ns32000) |
---|
1065 | printf ("ns32k-sequent-dynix\n"); exit (0); |
---|
1066 | #endif |
---|
1067 | #endif |
---|
1068 | |
---|
1069 | #if defined (_SEQUENT_) |
---|
1070 | struct utsname un; |
---|
1071 | |
---|
1072 | uname(&un); |
---|
1073 | |
---|
1074 | if (strncmp(un.version, "V2", 2) == 0) { |
---|
1075 | printf ("i386-sequent-ptx2\n"); exit (0); |
---|
1076 | } |
---|
1077 | if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ |
---|
1078 | printf ("i386-sequent-ptx1\n"); exit (0); |
---|
1079 | } |
---|
1080 | printf ("i386-sequent-ptx\n"); exit (0); |
---|
1081 | |
---|
1082 | #endif |
---|
1083 | |
---|
1084 | #if defined (vax) |
---|
1085 | #if !defined (ultrix) |
---|
1086 | printf ("vax-dec-bsd\n"); exit (0); |
---|
1087 | #else |
---|
1088 | printf ("vax-dec-ultrix\n"); exit (0); |
---|
1089 | #endif |
---|
1090 | #endif |
---|
1091 | |
---|
1092 | #if defined (alliant) && defined (i860) |
---|
1093 | printf ("i860-alliant-bsd\n"); exit (0); |
---|
1094 | #endif |
---|
1095 | |
---|
1096 | exit (1); |
---|
1097 | } |
---|
1098 | EOF |
---|
1099 | |
---|
1100 | ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 |
---|
1101 | rm -f dummy.c dummy |
---|
1102 | |
---|
1103 | # Apollos put the system type in the environment. |
---|
1104 | |
---|
1105 | test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } |
---|
1106 | |
---|
1107 | # Convex versions that predate uname can use getsysinfo(1) |
---|
1108 | |
---|
1109 | if [ -x /usr/convex/getsysinfo ] |
---|
1110 | then |
---|
1111 | case `getsysinfo -f cpu_type` in |
---|
1112 | c1*) |
---|
1113 | echo c1-convex-bsd |
---|
1114 | exit 0 ;; |
---|
1115 | c2*) |
---|
1116 | if getsysinfo -f scalar_acc |
---|
1117 | then echo c32-convex-bsd |
---|
1118 | else echo c2-convex-bsd |
---|
1119 | fi |
---|
1120 | exit 0 ;; |
---|
1121 | c34*) |
---|
1122 | echo c34-convex-bsd |
---|
1123 | exit 0 ;; |
---|
1124 | c38*) |
---|
1125 | echo c38-convex-bsd |
---|
1126 | exit 0 ;; |
---|
1127 | c4*) |
---|
1128 | echo c4-convex-bsd |
---|
1129 | exit 0 ;; |
---|
1130 | esac |
---|
1131 | fi |
---|
1132 | |
---|
1133 | #echo '(Unable to guess system type)' 1>&2 |
---|
1134 | |
---|
1135 | exit 1 |
---|