]> git.ipfire.org Git - thirdparty/bash.git/blame - support/config.guess
Imported from ../bash-2.05.tar.gz.
[thirdparty/bash.git] / support / config.guess
CommitLineData
ccc6cda3
JA
1#! /bin/sh
2# Attempt to guess a canonical system name.
d166f048 3# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
ccc6cda3
JA
4#
5# This file is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18#
19# As a special exception to the GNU General Public License, if you
20# distribute this file as part of a program that contains a
21# configuration script generated by Autoconf, you may include it under
22# the same distribution terms that you use for the rest of that program.
23
24# Written by Per Bothner <bothner@cygnus.com>.
25# The master version of this file is at the FSF in /home/gd/gnu/lib.
26#
27# This script attempts to guess a canonical system name similar to
28# config.sub. If it succeeds, it prints the system name on stdout, and
29# exits with 0. Otherwise, it exits with 1.
30#
31# The plan is that this can be called by configure scripts if you
32# don't specify an explicit system type (host/target name).
33#
34# Only a few systems have been added to this list; please add others
35# (but try to keep the structure clean).
36#
37
bb70624e
JA
38# Use $HOST_CC if defined. $CC may point to a cross-compiler
39if test x"$CC_FOR_BUILD" = x; then
40 if test x"$HOST_CC" != x; then
41 CC_FOR_BUILD="$HOST_CC"
42 else
43 if test x"$CC" != x; then
44 CC_FOR_BUILD="$CC"
45 else
46 CC_FOR_BUILD=cc
47 fi
48 fi
49fi
50
ccc6cda3
JA
51# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
52# (ghazi@noc.rutgers.edu 8/24/94.)
53if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
54 PATH=$PATH:/.attbin ; export PATH
55elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
56 PATH=$PATH:/usr/5bin
57fi
58
d166f048
JA
59UNAME=`(uname) 2>/dev/null` || UNAME=unknown
60UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
61UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
62UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
63UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
ccc6cda3
JA
64
65RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
66case "$RELEASE" in
67"") RELEASE=0 ;;
68*) RELEASE=`expr "$RELEASE" + 0` ;;
69esac
70REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
71REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
72
bb70624e
JA
73dummy=dummy-$$
74trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
ccc6cda3
JA
75
76# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
77# is contrary to all other versions of uname
78if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
79 UNAME=UNIX_SV
80fi
81
82# Note: order is significant - the case branches are not exclusive.
83
84case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
d166f048 85 # Begin cases added for Bash
ccc6cda3
JA
86 alpha:NetBSD:*:*)
87 echo alpha-dec-netbsd${UNAME_RELEASE}
88 exit 0 ;;
d166f048
JA
89 alpha:OpenBSD:*:*)
90 echo alpha-dec-openbsd${UNAME_RELEASE}
ccc6cda3 91 exit 0 ;;
d166f048
JA
92 i?86:NetBSD:*:*)
93 echo ${UNAME_MACHINE}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
ccc6cda3 94 exit 0 ;;
d166f048
JA
95 i?86:OpenBSD:*:*)
96 echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
ccc6cda3 97 exit 0 ;;
d166f048
JA
98 sparc:NetBSD:*:*)
99 echo sparc-unknown-netbsd${UNAME_RELEASE}
ccc6cda3 100 exit 0 ;;
d166f048
JA
101 sparc:OpenBSD:*:*)
102 echo sparc-unknown-openbsd${UNAME_RELEASE}
ccc6cda3
JA
103 exit 0 ;;
104 vax:NetBSD:*:*)
105 echo vax-dec-netbsd${UNAME_RELEASE}
106 exit 0 ;;
d166f048
JA
107 vax:OpenBSD:*:*)
108 echo vax-dec-openbsd${UNAME_RELEASE}
ccc6cda3 109 exit 0 ;;
d166f048
JA
110 mac68k:machten:*:*)
111 echo mac68k-apple-machten${UNAME_RELEASE}
ccc6cda3 112 exit 0 ;;
d166f048
JA
113 concurrent*:*:*:*)
114 if test "`(/bin/universe) 2>/dev/null`" = att ; then
115 echo concurrent-concurrent-sysv3
116 else
117 echo concurrent-concurrent-bsd
118 fi
ccc6cda3 119 exit 0 ;;
d166f048
JA
120 ppc*:SunOS:5.*:*)
121 echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ccc6cda3 122 exit 0 ;;
d166f048
JA
123 sparc:UNIX_SV:4.*:*)
124 echo sparc-unknown-sysv${UNAME_RELEASE}
ccc6cda3 125 exit 0 ;;
d166f048
JA
126 mips:UNIX_SV:4.*:*)
127 echo mips-mips-sysv${UNAME_RELEASE}
ccc6cda3 128 exit 0 ;;
d166f048
JA
129 mips:OSF*1:*:*)
130 echo mips-mips-osf1
ccc6cda3 131 exit 0 ;;
d166f048
JA
132 mips:4.4BSD:*:*)
133 echo mips-mips-bsd4.4
ccc6cda3 134 exit 0 ;;
d166f048
JA
135 MIServer-S:SMP_DC.OSx:*:dcosx)
136 echo mips-pyramid-sysv4
ccc6cda3 137 exit 0 ;;
d166f048
JA
138 news*:NEWS*:*:*)
139 echo mips-sony-newsos${UNAME_RELEASE}
ccc6cda3 140 exit 0 ;;
d166f048
JA
141 i?86:NEXTSTEP:*:*)
142 echo i386-next-nextstep${RELEASE}
143 exit 0 ;;
144 *680?0:NEXTSTEP:*:*)
145 echo m68k-next-nextstep${RELEASE}
146 exit 0 ;;
147 *370:AIX:*:*)
148 echo ibm370-ibm-aix
149 exit 0 ;;
150 ksr1:OSF*1:*:*)
151 echo ksr1-ksr-osf1
152 exit 0 ;;
153 esa:OSF*1:*:* | ESA:OSF*:*:*)
154 echo esa-ibm-osf1
155 exit 0 ;;
156 DNP*:DNIX:*:*)
157 echo m68k-dnix-sysv
158 exit 0 ;;
159 *3b2*:*:*:*)
160 echo we32k-att-sysv3
161 exit 0 ;;
162 *:QNX:*:42*)
163 echo i386-qssl-qnx`echo ${UNAME_VERSION}`
164 exit 0 ;;
bb70624e
JA
165 Alpha*:Windows:NT:*:SP*)
166 echo alpha-pc-opennt
b72432fd 167 exit 0 ;;
bb70624e
JA
168 *:Windows:NT:*:SP*)
169 echo intel-pc-opennt
b72432fd 170 exit 0 ;;
28ef6c31
JA
171 *:NonStop-UX:*:*)
172 echo mips-compaq-nonstopux
173 exit 0 ;;
d166f048
JA
174 # end cases added for Bash
175 alpha:OSF1:*:*)
28ef6c31
JA
176 # TEST CHANGED FOR BASH to handle `letter version' releases
177 UNAME_MAJOR=`echo "$UNAME_RELEASE" | sed -e 's/^.\([0-9]\).*/\1/'`
178 if test X"$UNAME_MAJOR" != X"" && test $UNAME_MAJOR = 4 ; then
cce855bc 179 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
28ef6c31
JA
180 elif test X"$UNAME_MAJOR" != X"" && test $UNAME_MAJOR -gt 4 ; then
181 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
cce855bc 182 fi
d166f048
JA
183 # A Vn.n version is a released version.
184 # A Tn.n version is a released field test version.
185 # A Xn.n version is an unreleased experimental baselevel.
186 # 1.2 uses "1.2" for uname -r.
bb70624e 187 cat <<EOF >$dummy.s
cce855bc
JA
188 .globl main
189 .ent main
190main:
191 .frame \$30,0,\$26,0
192 .prologue 0
193 .long 0x47e03d80 # implver $0
194 lda \$2,259
195 .long 0x47e20c21 # amask $2,$1
196 srl \$1,8,\$2
197 sll \$2,2,\$2
198 sll \$0,3,\$0
199 addl \$1,\$0,\$0
200 addl \$2,\$0,\$0
201 ret \$31,(\$26),1
202 .end main
203EOF
bb70624e 204 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
cce855bc 205 if test "$?" = 0 ; then
bb70624e 206 ./$dummy
cce855bc
JA
207 case "$?" in
208 7)
209 UNAME_MACHINE="alpha"
210 ;;
211 15)
212 UNAME_MACHINE="alphaev5"
213 ;;
214 14)
215 UNAME_MACHINE="alphaev56"
216 ;;
217 10)
218 UNAME_MACHINE="alphapca56"
219 ;;
220 16)
221 UNAME_MACHINE="alphaev6"
222 ;;
223 esac
224 fi
bb70624e
JA
225 rm -f $dummy.s $dummy
226 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
227 exit 0 ;;
228 Alpha\ *:Windows_NT*:*)
229 # How do we know it's Interix rather than the generic POSIX subsystem?
230 # Should we change UNAME_MACHINE based on the output of uname instead
231 # of the specific Alpha model?
232 echo alpha-pc-interix
233 exit 0 ;;
ccc6cda3
JA
234 21064:Windows_NT:50:3)
235 echo alpha-dec-winnt3.5
236 exit 0 ;;
d166f048
JA
237 Amiga*:UNIX_System_V:4.0:*)
238 echo m68k-cbm-sysv4
239 exit 0;;
240 amiga:NetBSD:*:*)
241 echo m68k-cbm-netbsd${UNAME_RELEASE}
242 exit 0 ;;
243 amiga:OpenBSD:*:*)
244 echo m68k-cbm-openbsd${UNAME_RELEASE}
ccc6cda3 245 exit 0 ;;
b72432fd
JA
246 *:[Aa]miga[Oo][Ss]:*:*)
247 echo ${UNAME_MACHINE}-unknown-amigaos
248 exit 0 ;;
cce855bc
JA
249 arc64:OpenBSD:*:*)
250 echo mips64el-unknown-openbsd${UNAME_RELEASE}
251 exit 0 ;;
252 arc:OpenBSD:*:*)
253 echo mipsel-unknown-openbsd${UNAME_RELEASE}
254 exit 0 ;;
255 hkmips:OpenBSD:*:*)
256 echo mips-unknown-openbsd${UNAME_RELEASE}
257 exit 0 ;;
258 pmax:OpenBSD:*:*)
259 echo mipsel-unknown-openbsd${UNAME_RELEASE}
260 exit 0 ;;
261 sgi:OpenBSD:*:*)
262 echo mips-unknown-openbsd${UNAME_RELEASE}
263 exit 0 ;;
264 wgrisc:OpenBSD:*:*)
265 echo mipsel-unknown-openbsd${UNAME_RELEASE}
266 exit 0 ;;
ccc6cda3
JA
267 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
268 echo arm-acorn-riscix${UNAME_RELEASE}
269 exit 0;;
cce855bc
JA
270 arm32:NetBSD:*:*)
271 echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
272 exit 0 ;;
273 SR2?01:HI-UX/MPP:*:*)
274 echo hppa1.1-hitachi-hiuxmpp
275 exit 0;;
bb70624e 276 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
d166f048 277 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
ccc6cda3
JA
278 if test "`(/bin/universe) 2>/dev/null`" = att ; then
279 echo pyramid-pyramid-sysv3
280 else
281 echo pyramid-pyramid-bsd
282 fi
283 exit 0 ;;
bb70624e 284 NILE:*:*:*:dcosx)
d166f048 285 echo pyramid-pyramid-svr4
ccc6cda3 286 exit 0 ;;
bb70624e
JA
287 sun4H:SunOS:5.*:*)
288 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
289 exit 0 ;;
ccc6cda3
JA
290 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
291 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
292 exit 0 ;;
d166f048
JA
293 i86pc:SunOS:5.*:*)
294 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
295 exit 0 ;;
ccc6cda3
JA
296 sun4*:SunOS:6*:*)
297 # According to config.sub, this is the proper way to canonicalize
298 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
299 # it's likely to be more like Solaris than SunOS4.
300 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
301 exit 0 ;;
302 sun4*:SunOS:*:*)
303 case "`/usr/bin/arch -k`" in
304 Series*|S4*)
305 UNAME_RELEASE=`uname -v`
306 ;;
307 esac
308 # Japanese Language versions have a version number like `4.1.3-JL'.
309 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
310 exit 0 ;;
bb70624e 311 sun3*:SunOS:*:*)
ccc6cda3
JA
312 echo m68k-sun-sunos${UNAME_RELEASE}
313 exit 0 ;;
cce855bc
JA
314 sun*:*:4.2BSD:*)
315 UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
316 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
317 case "`/bin/arch`" in
318 sun3)
319 echo m68k-sun-sunos${UNAME_RELEASE}
320 ;;
321 sun4)
322 echo sparc-sun-sunos${UNAME_RELEASE}
323 ;;
324 esac
325 exit 0 ;;
ccc6cda3 326 aushp:SunOS:*:*)
d166f048 327 echo sparc-auspex-sunos${UNAME_RELEASE}
ccc6cda3 328 exit 0 ;;
d166f048
JA
329 atari*:NetBSD:*:*)
330 echo m68k-atari-netbsd${UNAME_RELEASE}
ccc6cda3 331 exit 0 ;;
d166f048 332 atari*:OpenBSD:*:*)
bb70624e 333 echo m68k-unknown-openbsd${UNAME_RELEASE}
ccc6cda3 334 exit 0 ;;
bb70624e
JA
335 # The situation for MiNT is a little confusing. The machine name
336 # can be virtually everything (everything which is not
337 # "atarist" or "atariste" at least should have a processor
338 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
339 # to the lowercase version "mint" (or "freemint"). Finally
340 # the system name "TOS" denotes a system which is actually not
341 # MiNT. But MiNT is downward compatible to TOS, so this should
342 # be no problem.
343 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
344 echo m68k-atari-mint${UNAME_RELEASE}
345 exit 0 ;;
346 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
347 echo m68k-atari-mint${UNAME_RELEASE}
348 exit 0 ;;
349 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
350 echo m68k-atari-mint${UNAME_RELEASE}
351 exit 0 ;;
352 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
353 echo m68k-milan-mint${UNAME_RELEASE}
354 exit 0 ;;
355 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
356 echo m68k-hades-mint${UNAME_RELEASE}
357 exit 0 ;;
358 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
359 echo m68k-unknown-mint${UNAME_RELEASE}
360 exit 0 ;;
d166f048
JA
361 sun3*:NetBSD:*:*)
362 echo m68k-sun-netbsd${UNAME_RELEASE}
ccc6cda3 363 exit 0 ;;
d166f048 364 sun3*:OpenBSD:*:*)
bb70624e 365 echo m68k-unknown-openbsd${UNAME_RELEASE}
ccc6cda3 366 exit 0 ;;
d166f048
JA
367 mac68k:NetBSD:*:*)
368 echo m68k-apple-netbsd${UNAME_RELEASE}
369 exit 0 ;;
370 mac68k:OpenBSD:*:*)
bb70624e 371 echo m68k-unknown-openbsd${UNAME_RELEASE}
d166f048 372 exit 0 ;;
cce855bc
JA
373 mvme68k:OpenBSD:*:*)
374 echo m68k-unknown-openbsd${UNAME_RELEASE}
375 exit 0 ;;
376 mvme88k:OpenBSD:*:*)
377 echo m88k-unknown-openbsd${UNAME_RELEASE}
378 exit 0 ;;
bb70624e
JA
379 *:"Mac OS":*:*)
380 echo `uname -p`-apple-macos${UNAME_RELEASE}
381 exit 0 ;;
d166f048
JA
382 powerpc:machten:*:*)
383 echo powerpc-apple-machten${UNAME_RELEASE}
384 exit 0 ;;
bb70624e
JA
385 macppc:NetBSD:*:*)
386 echo powerpc-apple-netbsd${UNAME_RELEASE}
387 exit 0 ;;
d166f048
JA
388 RISC*:Mach:*:*)
389 echo mips-dec-mach_bsd4.3
390 exit 0 ;;
391 RISC*:ULTRIX:*:*)
392 echo mips-dec-ultrix${UNAME_RELEASE}
393 exit 0 ;;
394 VAX*:ULTRIX*:*:*)
395 echo vax-dec-ultrix${UNAME_RELEASE}
ccc6cda3 396 exit 0 ;;
bb70624e 397 2020:CLIX:*:* | 2430:CLIX:*:*)
cce855bc
JA
398 echo clipper-intergraph-clix${UNAME_RELEASE}
399 exit 0 ;;
ccc6cda3 400 mips:*:*:UMIPS | mips:*:*:RISCos)
bb70624e
JA
401 sed 's/^ //' << EOF >$dummy.c
402#ifdef __cplusplus
403 int main (int argc, char *argv[]) {
404#else
405 int main (argc, argv) int argc; char *argv[]; {
406#endif
d166f048
JA
407 #if defined (host_mips) && defined (MIPSEB)
408 #if defined (SYSTYPE_SYSV)
409 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
410 #endif
411 #if defined (SYSTYPE_SVR4)
412 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
413 #endif
414 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
415 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
416 #endif
417 #endif
418 exit (-1);
419 }
ccc6cda3 420EOF
bb70624e
JA
421 $CC_FOR_BUILD $dummy.c -o $dummy \
422 && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
423 && rm $dummy.c $dummy && exit 0
424 rm -f $dummy.c $dummy
d166f048 425 echo mips-mips-riscos${UNAME_RELEASE}
ccc6cda3
JA
426 exit 0 ;;
427 Night_Hawk:Power_UNIX:*:*)
cce855bc 428 echo powerpc-harris-powerunix
ccc6cda3
JA
429 exit 0 ;;
430 m88k:CX/UX:7*:*)
431 echo m88k-harris-cxux7
432 exit 0 ;;
433 m88k:*:4*:R4*)
434 echo m88k-motorola-sysv4
435 exit 0 ;;
436 m88k:*:3*:R3*)
437 echo m88k-motorola-sysv3
438 exit 0 ;;
439 AViiON:dgux:*:*)
d166f048
JA
440 # DG/UX returns AViiON for all architectures
441 UNAME_PROCESSOR=`/usr/bin/uname -p`
442 if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
bb70624e 443 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
ccc6cda3
JA
444 -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
445 echo m88k-dg-dgux${UNAME_RELEASE}
bb70624e 446 else
ccc6cda3 447 echo m88k-dg-dguxbcs${UNAME_RELEASE}
bb70624e
JA
448 fi
449 else
450 echo i586-dg-dgux${UNAME_RELEASE}
d166f048 451 fi
ccc6cda3
JA
452 exit 0 ;;
453 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
454 echo m88k-dolphin-sysv3
455 exit 0 ;;
456 M88*:*:R3*:*)
457 # Delta 88k system running SVR3
458 echo m88k-motorola-sysv3
459 exit 0 ;;
460 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
461 echo m88k-tektronix-sysv3
462 exit 0 ;;
463 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
464 echo m68k-tektronix-bsd
465 exit 0 ;;
ccc6cda3
JA
466 *:IRIX*:*:*)
467 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
468 exit 0 ;;
469 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
470 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
471 exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
472 i?86:AIX:*:*)
473 echo i386-ibm-aix
474 exit 0 ;;
ccc6cda3
JA
475 *:AIX:2:3)
476 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
bb70624e 477 sed 's/^ //' << EOF >$dummy.c
ccc6cda3
JA
478 #include <sys/systemcfg.h>
479
480 main()
481 {
482 if (!__power_pc())
483 exit(1);
484 puts("powerpc-ibm-aix3.2.5");
485 exit(0);
486 }
487EOF
bb70624e
JA
488 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
489 rm -f $dummy.c $dummy
ccc6cda3
JA
490 echo rs6000-ibm-aix3.2.5
491 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
492 echo rs6000-ibm-aix3.2.4
493 else
494 echo rs6000-ibm-aix3.2
495 fi
496 exit 0 ;;
497 *:AIX:*:4)
bb70624e
JA
498 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
499 if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
ccc6cda3
JA
500 IBM_ARCH=rs6000
501 else
502 IBM_ARCH=powerpc
503 fi
504 if [ -x /usr/bin/oslevel ] ; then
505 IBM_REV=`/usr/bin/oslevel`
506 elif grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
507 IBM_REV=4.1
508 elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
509 IBM_REV=4.1.1
510 else
511 IBM_REV=4.${UNAME_RELEASE}
512 fi
513 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
514 exit 0 ;;
515 *:AIX:*:*)
516 echo rs6000-ibm-aix
517 exit 0 ;;
518 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
519 echo romp-ibm-bsd4.4
520 exit 0 ;;
521 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
d166f048 522 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
ccc6cda3
JA
523 exit 0 ;; # report: romp-ibm BSD 4.3
524 *:BOSX:*:*)
525 echo rs6000-bull-bosx
526 exit 0 ;;
527 DPX/2?00:B.O.S.:*:*)
528 echo m68k-bull-sysv3
529 exit 0 ;;
530 9000/[34]??:4.3bsd:1.*:*)
531 echo m68k-hp-bsd
532 exit 0 ;;
533 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
534 echo m68k-hp-bsd4.4
535 exit 0 ;;
e8ce775d 536 9000/[34678]??:HP-UX:*:*)
ccc6cda3 537 case "${UNAME_MACHINE}" in
e8ce775d
JA
538 9000/31? ) HP_ARCH=m68000 ;;
539 9000/[34]?? ) HP_ARCH=m68k ;;
bb70624e
JA
540 9000/[678][0-9][0-9])
541 sed 's/^ //' << EOF >$dummy.c
542 #include <stdlib.h>
543 #include <unistd.h>
544
545 int main ()
546 {
547 #if defined(_SC_KERNEL_BITS)
548 long bits = sysconf(_SC_KERNEL_BITS);
549 #endif
550 long cpu = sysconf (_SC_CPU_VERSION);
551
552 switch (cpu)
553 {
554 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
555 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
556 case CPU_PA_RISC2_0:
557 #if defined(_SC_KERNEL_BITS)
558 switch (bits)
559 {
560 case 64: puts ("hppa2.0w"); break;
561 case 32: puts ("hppa2.0n"); break;
562 default: puts ("hppa2.0"); break;
563 } break;
564 #else /* !defined(_SC_KERNEL_BITS) */
565 puts ("hppa2.0"); break;
566 #endif
567 default: puts ("hppa1.0"); break;
568 }
569 exit (0);
570 }
571EOF
572 ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
573 rm -f $dummy.c $dummy
ccc6cda3
JA
574 esac
575 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
576 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
577 exit 0 ;;
578 3050*:HI-UX:*:*)
bb70624e 579 sed 's/^ //' << EOF >$dummy.c
ccc6cda3
JA
580 #include <unistd.h>
581 int
582 main ()
583 {
584 long cpu = sysconf (_SC_CPU_VERSION);
585 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
586 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
587 results, however. */
588 if (CPU_IS_PA_RISC (cpu))
589 {
590 switch (cpu)
591 {
592 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
593 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
594 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
595 default: puts ("hppa-hitachi-hiuxwe2"); break;
596 }
597 }
598 else if (CPU_IS_HP_MC68K (cpu))
599 puts ("m68k-hitachi-hiuxwe2");
600 else puts ("unknown-hitachi-hiuxwe2");
601 exit (0);
602 }
603EOF
bb70624e
JA
604 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
605 rm -f $dummy.c $dummy
ccc6cda3
JA
606 echo unknown-hitachi-hiuxwe2
607 exit 0 ;;
608 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
609 echo hppa1.1-hp-bsd
610 exit 0 ;;
611 9000/8??:4.3bsd:*:*)
612 echo hppa1.0-hp-bsd
613 exit 0 ;;
bb70624e
JA
614 *9??*:MPE/iX:*:*)
615 echo hppa1.0-hp-mpeix
616 exit 0 ;;
ccc6cda3
JA
617 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
618 echo hppa1.1-hp-osf
619 exit 0 ;;
620 hp8??:OSF1:*:*)
621 echo hppa1.0-hp-osf
622 exit 0 ;;
d166f048
JA
623 i?86:OSF1:*:*)
624 if [ -x /usr/sbin/sysversion ] ; then
bb70624e 625 echo ${UNAME_MACHINE}-unknown-osf1mk
d166f048 626 else
bb70624e 627 echo ${UNAME_MACHINE}-unknown-osf1
d166f048
JA
628 fi
629 exit 0 ;;
ccc6cda3
JA
630 parisc*:Lites*:*:*)
631 echo hppa1.1-hp-lites
632 exit 0 ;;
bb70624e
JA
633 hppa*:OpenBSD:*:*)
634 echo hppa-unknown-openbsd
635 exit 0 ;;
ccc6cda3
JA
636 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
637 echo c1-convex-bsd
638 exit 0 ;;
639 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
640 if getsysinfo -f scalar_acc
641 then echo c32-convex-bsd
642 else echo c2-convex-bsd
643 fi
644 exit 0 ;;
645 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
646 echo c34-convex-bsd
647 exit 0 ;;
648 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
649 echo c38-convex-bsd
650 exit 0 ;;
651 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
652 echo c4-convex-bsd
653 exit 0 ;;
654 CRAY*X-MP:*:*:*)
655 echo xmp-cray-unicos
656 exit 0 ;;
657 CRAY*Y-MP:*:*:*)
658 echo ymp-cray-unicos${UNAME_RELEASE}
659 exit 0 ;;
660 CRAY*[A-Z]90:*:*:*)
661 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
662 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
663 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
664 exit 0 ;;
665 CRAY*TS:*:*:*)
666 echo t90-cray-unicos${UNAME_RELEASE}
667 exit 0 ;;
bb70624e
JA
668 CRAY*T3E:*:*:*)
669 echo alpha-cray-unicosmk${UNAME_RELEASE}
670 exit 0 ;;
ccc6cda3
JA
671 CRAY-2:*:*:*)
672 echo cray2-cray-unicos
673 exit 0 ;;
674 F300:UNIX_System_V:*:*)
bb70624e 675 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
ccc6cda3
JA
676 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
677 echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
678 exit 0 ;;
679 F301:UNIX_System_V:*:*)
680 echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
681 exit 0 ;;
d166f048
JA
682 hp3[0-9][05]:NetBSD:*:*)
683 echo m68k-hp-netbsd${UNAME_RELEASE}
684 exit 0 ;;
bb70624e
JA
685 hp300:OpenBSD:*:*)
686 echo m68k-unknown-openbsd${UNAME_RELEASE}
687 exit 0 ;;
688 i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
d166f048 689 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
ccc6cda3 690 exit 0 ;;
bb70624e
JA
691 sparc*:BSD/OS:*:*)
692 echo sparc-unknown-bsdi${UNAME_RELEASE}
693 exit 0 ;;
694 *:BSD/OS:*:*)
695 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
696 exit 0 ;;
ccc6cda3 697 *:FreeBSD:*:*)
bb70624e
JA
698 if test -x /usr/bin/objformat; then
699 if test "elf" = "`/usr/bin/objformat`"; then
700 echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
701 exit 0
702 fi
703 fi
704 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-=(].*//'`
ccc6cda3
JA
705 exit 0 ;;
706 *:NetBSD:*:*)
707 echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
708 exit 0 ;;
709 *:OpenBSD:*:*)
710 echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
711 exit 0 ;;
712 i*:CYGWIN*:*)
28ef6c31 713 echo ${UNAME_MACHINE}-pc-cygwin
d166f048 714 exit 0 ;;
cce855bc 715 i*:MINGW*:*)
bb70624e 716 echo ${UNAME_MACHINE}-pc-mingw32
cce855bc 717 exit 0 ;;
bb70624e
JA
718 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
719 # How do we know it's Interix rather than the generic POSIX subsystem?
720 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
721 # UNAME_MACHINE based on the output of uname instead of i386?
722 echo i386-pc-interix
723 exit 0 ;;
724 i*:UWIN*:*)
725 echo ${UNAME_MACHINE}-pc-uwin
726 exit 0 ;;
ccc6cda3 727 p*:CYGWIN*:*)
bb70624e
JA
728 echo powerpcle-unknown-cygwin
729 exit 0 ;;
d166f048
JA
730 prep*:SunOS:5.*:*)
731 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
732 exit 0 ;;
ccc6cda3 733 *:GNU:*:*)
cce855bc 734 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
ccc6cda3
JA
735 exit 0 ;;
736 *:Linux:*:*)
bb70624e
JA
737 # uname on the ARM produces all sorts of strangeness, and we need to
738 # filter it out.
739 case "$UNAME_MACHINE" in
740 armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
741 arm* | sa110*) UNAME_MACHINE="arm" ;;
742 esac
743
ccc6cda3 744 # The BFD linker knows what the default object file format is, so
bb70624e
JA
745 # first see if it will tell us. cd to the root directory to prevent
746 # problems with other programs or directories called `ld' in the path.
747 ld_help_string=`cd /; ld --help 2>&1`
cce855bc
JA
748 ld_supported_emulations=`echo $ld_help_string \
749 | sed -ne '/supported emulations:/!d
750 s/[ ][ ]*/ /g
751 s/.*supported emulations: *//
752 s/ .*//
753 p'`
754 case "$ld_supported_emulations" in
bb70624e 755 *ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;;
cce855bc
JA
756 i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
757 i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
758 sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
bb70624e 759 armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
cce855bc 760 m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
bb70624e
JA
761 elf32ppc | elf32ppclinux)
762 # Determine Lib Version
763 cat >$dummy.c <<EOF
764#include <features.h>
765#if defined(__GLIBC__)
766extern char __libc_version[];
767extern char __libc_release[];
768#endif
769main(argc, argv)
770 int argc;
771 char *argv[];
772{
773#if defined(__GLIBC__)
774 printf("%s %s\n", __libc_version, __libc_release);
775#else
776 printf("unkown\n");
777#endif
778 return 0;
779}
780EOF
781 LIBC=""
782 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
783 if test "$?" = 0 ; then
784 ./$dummy | grep 1\.99 > /dev/null
785 if test "$?" = 0 ; then
786 LIBC="libc1"
787 fi
788 fi
789 rm -f $dummy.c $dummy
790 echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
791 esac
cce855bc
JA
792
793 if test "${UNAME_MACHINE}" = "alpha" ; then
bb70624e 794 sed 's/^ //' <<EOF >$dummy.s
cce855bc
JA
795 .globl main
796 .ent main
797 main:
798 .frame \$30,0,\$26,0
799 .prologue 0
800 .long 0x47e03d80 # implver $0
801 lda \$2,259
802 .long 0x47e20c21 # amask $2,$1
803 srl \$1,8,\$2
804 sll \$2,2,\$2
805 sll \$0,3,\$0
806 addl \$1,\$0,\$0
807 addl \$2,\$0,\$0
808 ret \$31,(\$26),1
809 .end main
810EOF
811 LIBC=""
bb70624e 812 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
cce855bc 813 if test "$?" = 0 ; then
bb70624e 814 ./$dummy
cce855bc
JA
815 case "$?" in
816 7)
817 UNAME_MACHINE="alpha"
818 ;;
819 15)
820 UNAME_MACHINE="alphaev5"
821 ;;
822 14)
823 UNAME_MACHINE="alphaev56"
824 ;;
825 10)
826 UNAME_MACHINE="alphapca56"
827 ;;
828 16)
829 UNAME_MACHINE="alphaev6"
830 ;;
831 esac
832
bb70624e 833 objdump --private-headers $dummy | \
cce855bc
JA
834 grep ld.so.1 > /dev/null
835 if test "$?" = 0 ; then
836 LIBC="libc1"
837 fi
838 fi
bb70624e 839 rm -f $dummy.s $dummy
cce855bc
JA
840 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
841 elif test "${UNAME_MACHINE}" = "mips" ; then
bb70624e
JA
842 cat >$dummy.c <<EOF
843#ifdef __cplusplus
844int main (int argc, char *argv[]) {
845#else
846int main (argc, argv) int argc; char *argv[]; {
847#endif
cce855bc
JA
848#ifdef __MIPSEB__
849 printf ("%s-unknown-linux-gnu\n", argv[1]);
850#endif
851#ifdef __MIPSEL__
852 printf ("%sel-unknown-linux-gnu\n", argv[1]);
853#endif
854 return 0;
855}
856EOF
bb70624e
JA
857 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
858 rm -f $dummy.c $dummy
ccc6cda3 859 else
cce855bc
JA
860 # Either a pre-BFD a.out linker (linux-gnuoldld)
861 # or one that does not give us useful --help.
862 # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
863 # If ld does not provide *any* "supported emulations:"
864 # that means it is gnuoldld.
865 echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
866 test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
867
868 case "${UNAME_MACHINE}" in
869 i?86)
870 VENDOR=pc;
871 ;;
872 *)
873 VENDOR=unknown;
874 ;;
875 esac
ccc6cda3 876 # Determine whether the default compiler is a.out or elf
bb70624e 877 cat >$dummy.c <<EOF
cce855bc 878#include <features.h>
bb70624e
JA
879#ifdef __cplusplus
880 int main (int argc, char *argv[]) {
881#else
882 int main (argc, argv) int argc; char *argv[]; {
883#endif
ccc6cda3 884#ifdef __ELF__
cce855bc
JA
885# ifdef __GLIBC__
886# if __GLIBC__ >= 2
887 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
888# else
889 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
890# endif
891# else
892 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
893# endif
ccc6cda3 894#else
cce855bc 895 printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
ccc6cda3
JA
896#endif
897 return 0;
898}
899EOF
bb70624e
JA
900 ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
901 rm -f $dummy.c $dummy
ccc6cda3
JA
902 fi ;;
903# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
904# are messed up and put the nodename in both sysname and nodename.
905 i?86:DYNIX/ptx:4*:*)
906 echo i386-sequent-sysv4
907 exit 0 ;;
bc4cd23c
JA
908# added by chet for bash based on usenet posting from <hops@sco.com> and
909# documentation on SCO's web site -- UnixWare 7 (SVR5)
bb70624e
JA
910# i?86:UnixWare:5*:*)
911# echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
912# exit 0 ;;
cce855bc
JA
913 i?86:UNIX_SV:4.2MP:2.*)
914 # Unixware is an offshoot of SVR4, but it has its own version
915 # number series starting with 2...
916 # I am not positive that other SVR4 systems won't match this,
917 # I just have to hope. -- rms.
918 # Use sysv4.2uw... so that sysv4* matches it.
919 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
920 exit 0 ;;
921 i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i?86:UNIX_SV:4.*:*)
ccc6cda3
JA
922 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
923 echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
924 else
d166f048 925 echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
ccc6cda3
JA
926 fi
927 exit 0 ;;
bb70624e
JA
928 i?86:*:5:7*)
929 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
930 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
931 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
932 (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
933 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
934 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
935 exit 0 ;;
ccc6cda3
JA
936 i?86:*:3.2:*)
937 if test -f /usr/options/cb.name; then
938 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
d166f048 939 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
ccc6cda3
JA
940 elif /bin/uname -X 2>/dev/null >/dev/null ; then
941 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
942 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
943 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
944 && UNAME_MACHINE=i586
bb70624e
JA
945 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
946 && UNAME_MACHINE=i686
947 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
948 && UNAME_MACHINE=i686
d166f048 949 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
ccc6cda3 950 else
d166f048 951 echo ${UNAME_MACHINE}-pc-sysv32
ccc6cda3
JA
952 fi
953 exit 0 ;;
cce855bc
JA
954 pc:*:*:*)
955 # uname -m prints for DJGPP always 'pc', but it prints nothing about
956 # the processor, so we play safe by assuming i386.
957 echo i386-pc-msdosdjgpp
958 exit 0 ;;
ccc6cda3 959 Intel:Mach:3*:*)
d166f048 960 echo i386-pc-mach3
ccc6cda3
JA
961 exit 0 ;;
962 paragon:*:*:*)
963 echo i860-intel-osf1
964 exit 0 ;;
965 i860:*:4.*:*) # i860-SVR4
966 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
967 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
968 else # Add other i860-SVR4 vendors below as they are discovered.
969 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
970 fi
971 exit 0 ;;
ccc6cda3
JA
972 mini*:CTIX:SYS*5:*)
973 # "miniframe"
974 echo m68010-convergent-sysv
975 exit 0 ;;
976 M68*:*:R3V[567]*:*)
977 test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
978 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
979 OS_REL=''
980 test -r /etc/.relid \
981 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
982 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
d166f048
JA
983 && echo i486-ncr-sysv4.3${OS_REL} && exit 0
984 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
985 && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
ccc6cda3
JA
986 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
987 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
988 && echo i486-ncr-sysv4 && exit 0 ;;
989 mc68030:UNIX_System_V:4.*:*)
990 echo m68k-atari-sysv4
991 exit 0 ;;
992 m68*:LynxOS:2.*:*)
d166f048 993 echo m68k-unknown-lynxos${UNAME_RELEASE}
ccc6cda3 994 exit 0 ;;
bb70624e 995 i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
d166f048 996 echo i386-pc-lynxos${UNAME_RELEASE}
ccc6cda3
JA
997 exit 0 ;;
998 TSUNAMI:LynxOS:2.*:*)
d166f048 999 echo sparc-unknown-lynxos${UNAME_RELEASE}
ccc6cda3
JA
1000 exit 0 ;;
1001 rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
d166f048 1002 echo rs6000-unknown-lynxos${UNAME_RELEASE}
ccc6cda3
JA
1003 exit 0 ;;
1004 *:LynxOS:*:*)
1005 echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
1006 exit 0 ;;
1007 SM[BE]S:UNIX_SV:*:*)
d166f048 1008 echo mips-dde-sysv${UNAME_RELEASE}
ccc6cda3 1009 exit 0 ;;
cce855bc 1010 RM*:SINIX-*:*:* | RM*:ReliantUNIX-*:*:*)
ccc6cda3
JA
1011 echo mips-sni-sysv4
1012 exit 0 ;;
1013 *:SINIX-*:*:*)
1014 if uname -p 2>/dev/null >/dev/null ; then
1015 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1016 echo ${UNAME_MACHINE}-sni-sysv4
1017 else
1018 echo ns32k-sni-sysv
1019 fi
1020 exit 0 ;;
cce855bc
JA
1021 PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1022 # says <Richard.M.Bartel@ccMail.Census.GOV>
1023 echo i586-unisys-sysv4
1024 exit 0 ;;
ccc6cda3 1025 *:UNIX_System_V:4*:FTX*)
d166f048
JA
1026 # From Gerald Hewes <hewes@openmarket.com>.
1027 # How about differentiating between stratus architectures? -djm
1028 echo hppa1.1-stratus-sysv4
1029 exit 0 ;;
ccc6cda3 1030 *:*:*:FTX*)
d166f048
JA
1031 # From seanf@swdc.stratus.com.
1032 echo i860-stratus-sysv4
1033 exit 0 ;;
ccc6cda3
JA
1034 mc68*:A/UX:*:*)
1035 echo m68k-apple-aux${UNAME_RELEASE}
1036 exit 0 ;;
cce855bc
JA
1037 news*:NEWS-OS:*:6*)
1038 echo mips-sony-newsos6
1039 exit 0 ;;
bb70624e 1040 R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
ccc6cda3
JA
1041 if [ -d /usr/nec ]; then
1042 echo mips-nec-sysv${UNAME_RELEASE}
1043 else
1044 echo mips-unknown-sysv${UNAME_RELEASE}
1045 fi
1046 exit 0 ;;
bb70624e
JA
1047 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1048 echo powerpc-apple-beos
1049 exit 0 ;;
1050 BeMac:BeOS:*:*)
1051 echo powerpc-apple-beos
1052 exit 0 ;;
1053 BePC:BeOS:*:*)
1054 echo i586-pc-beos
1055 exit 0 ;;
1056 SX-4:SUPER-UX:*:*)
1057 echo sx4-nec-superux${UNAME_RELEASE}
1058 exit 0 ;;
1059 SX-5:SUPER-UX:*:*)
1060 echo sx5-nec-superux${UNAME_RELEASE}
1061 exit 0 ;;
1062 Power*:Rhapsody:*:*)
1063 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1064 exit 0 ;;
1065 *:Rhapsody:*:*)
1066 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
b72432fd 1067 exit 0 ;;
28ef6c31
JA
1068 Power*:Darwin:*:*)
1069 echo powerpc-apple-darwin${UNAME_RELEASE}
1070 exit 0 ;;
1071 *:Darwin:*:*)
1072 echo ${UNAME_MACHINE}-apple-darwin${UNAME_RELEASE}
1073 exit 0 ;;
ccc6cda3
JA
1074esac
1075
1076#echo '(No uname command or uname output not recognized.)' 1>&2
1077#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1078
bb70624e 1079cat >$dummy.c <<EOF
ccc6cda3
JA
1080#ifdef _SEQUENT_
1081# include <sys/types.h>
1082# include <sys/utsname.h>
1083#endif
1084main ()
1085{
1086#if defined (sony)
1087#if defined (MIPSEB)
1088 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1089 I don't know.... */
1090 printf ("mips-sony-bsd\n"); exit (0);
1091#else
1092#include <sys/param.h>
1093 printf ("m68k-sony-newsos%s\n",
1094#ifdef NEWSOS4
1095 "4"
1096#else
1097 ""
1098#endif
1099 ); exit (0);
1100#endif
1101#endif
1102
1103#if defined (__arm) && defined (__acorn) && defined (__unix)
1104 printf ("arm-acorn-riscix\n"); exit (0);
1105#endif
1106
1107#if defined (hp9000) && !defined (hpux)
1108 printf ("m68k-hp-bsd\n"); exit (0);
1109#endif
1110
1111#if defined (hp300) && !defined (hpux)
1112 printf ("m68k-hp-bsd\n"); exit (0);
1113#endif
1114
1115#if defined (NeXT)
1116#if !defined (__ARCHITECTURE__)
1117#define __ARCHITECTURE__ "m68k"
1118#endif
1119 int version;
1120 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
bb70624e
JA
1121 if (version < 4)
1122 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1123 else
1124 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
ccc6cda3
JA
1125 exit (0);
1126#endif
1127
1128#if defined (MULTIMAX) || defined (n16)
1129#if defined (UMAXV)
1130 printf ("ns32k-encore-sysv\n"); exit (0);
1131#else
1132#if defined (CMU)
1133 printf ("ns32k-encore-mach\n"); exit (0);
1134#else
1135 printf ("ns32k-encore-bsd\n"); exit (0);
1136#endif
1137#endif
1138#endif
1139
1140#if defined (__386BSD__)
d166f048 1141 printf ("i386-pc-bsd\n"); exit (0);
ccc6cda3
JA
1142#endif
1143
1144#if defined (sequent)
1145#if defined (i386)
1146 printf ("i386-sequent-dynix\n"); exit (0);
1147#endif
1148#if defined (ns32000)
1149 printf ("ns32k-sequent-dynix\n"); exit (0);
1150#endif
1151#endif
1152
1153#if defined (_SEQUENT_)
1154 struct utsname un;
1155
1156 uname(&un);
1157
1158 if (strncmp(un.version, "V2", 2) == 0) {
1159 printf ("i386-sequent-ptx2\n"); exit (0);
1160 }
1161 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1162 printf ("i386-sequent-ptx1\n"); exit (0);
1163 }
1164 printf ("i386-sequent-ptx\n"); exit (0);
1165
1166#endif
1167
1168#if defined (vax)
1169#if !defined (ultrix)
1170 printf ("vax-dec-bsd\n"); exit (0);
1171#else
1172 printf ("vax-dec-ultrix\n"); exit (0);
1173#endif
1174#endif
1175
1176#if defined (alliant) && defined (i860)
1177 printf ("i860-alliant-bsd\n"); exit (0);
1178#endif
1179
d166f048 1180/* Begin cases added for Bash */
ccc6cda3
JA
1181#if defined (tahoe)
1182 printf ("tahoe-cci-bsd\n"); exit (0);
1183#endif
1184
1185#if defined (nec_ews)
1186# if defined (SYSTYPE_SYSV)
1187 printf ("ews4800-nec-sysv4\n"); exit 0;
1188# else
1189 printf ("ews4800-nec-bsd\n"); exit (0);
1190# endif
1191#endif
1192
1193#if defined (sony)
1194# if defined (SYSTYPE_SYSV)
1195 printf ("mips-sony-sysv4\n"); exit 0;
1196# else
1197 printf ("mips-sony-bsd\n"); exit (0);
1198# endif
1199#endif
1200
1201#if defined (ardent)
1202 printf ("titan-ardent-bsd\n"); exit (0);
1203#endif
1204
1205#if defined (stardent)
1206 printf ("stardent-stardent-sysv\n"); exit (0);
1207#endif
1208
1209#if defined (ibm032)
1210 printf ("ibmrt-ibm-bsd4.3\n"); exit (0);
1211#endif
1212
1213#if defined (sequent) && defined (i386)
1214 printf ("i386-sequent-bsd\n"); exit (0);
1215#endif
1216
1217#if defined (qnx) && defined (i386)
d166f048 1218 printf ("i386-pc-qnx\n"); exit (0);
ccc6cda3
JA
1219#endif
1220
1221#if defined (gould)
1222 printf ("gould-gould-bsd\n"); exit (0);
1223#endif
1224
1225#if defined (unixpc)
1226 printf ("unixpc-att-sysv\n"); exit (0);
1227#endif
1228
1229#if defined (att386)
1230 printf ("i386-att-sysv3\n"); exit (0);
1231#endif
1232
1233#if defined (__m88k) && defined (__UMAXV__)
1234 printf ("m88k-encore-sysv3\n"); exit (0);
1235#endif
1236
1237#if defined (drs6000)
1238 printf ("drs6000-icl-sysv4.2\n"); exit (0);
1239#endif
1240
1241#if defined (clipper)
1242 printf ("clipper-orion-bsd\n"); exit (0);
1243#endif
1244
1245#if defined (is68k)
1246 printf ("m68k-isi-bsd\n"); exit (0);
1247#endif
1248
1249#if defined (luna88k)
1250 printf ("luna88k-omron-bsd\n"); exit (0);
1251#endif
1252
1253#if defined (butterfly) && defined (BFLY1)
1254 printf ("butterfly-bbn-mach\n"); exit (0);
1255#endif
1256
1257#if defined (tower32)
1258 printf ("tower32-ncr-sysv4\n"); exit (0);
1259#endif
1260
1261#if defined (MagicStation)
1262 printf ("magicstation-unknown-bsd\n"); exit (0);
1263#endif
1264
1265#if defined (scs)
1266 printf ("symmetric-scs-bsd4.2\n"); exit (0);
1267#endif
1268
1269#if defined (tandem)
1270 printf ("tandem-tandem-sysv\n"); exit (0);
1271#endif
1272
1273#if defined (cadmus)
1274 printf ("cadmus-pcs-sysv\n"); exit (0);
1275#endif
1276
1277#if defined (masscomp)
1278 printf ("masscomp-masscomp-sysv3\n"); exit (0);
1279#endif
1280
1281#if defined (hbullx20)
1282 printf ("hbullx20-bull-sysv3\n"); exit (0);
1283#endif
1284
d166f048
JA
1285/* End cases added for Bash */
1286
ccc6cda3
JA
1287 exit (1);
1288}
1289EOF
1290
bb70624e
JA
1291${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
1292rm -f $dummy.c $dummy
ccc6cda3
JA
1293
1294# Apollos put the system type in the environment.
1295
1296test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1297
1298# Convex versions that predate uname can use getsysinfo(1)
1299
1300if [ -x /usr/convex/getsysinfo ]
1301then
1302 case `getsysinfo -f cpu_type` in
1303 c1*)
1304 echo c1-convex-bsd
1305 exit 0 ;;
1306 c2*)
1307 if getsysinfo -f scalar_acc
1308 then echo c32-convex-bsd
1309 else echo c2-convex-bsd
1310 fi
1311 exit 0 ;;
1312 c34*)
1313 echo c34-convex-bsd
1314 exit 0 ;;
1315 c38*)
1316 echo c38-convex-bsd
1317 exit 0 ;;
1318 c4*)
1319 echo c4-convex-bsd
1320 exit 0 ;;
1321 esac
1322fi
1323
d166f048 1324# Begin cases added for Bash
ccc6cda3
JA
1325case "$UNAME" in
1326uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
1327esac
1328
1329if [ -d /usr/amiga ]; then
1330 echo m68k-cbm-sysv${UNAME_RELEASE}; exit 0;
1331fi
1332
1333if [ -f /bin/fxc.info ]; then
1334 echo fxc-alliant-concentrix
1335 exit 0
1336fi
d166f048 1337# end cases added for Bash
ccc6cda3
JA
1338
1339#echo '(Unable to guess system type)' 1>&2
1340
1341exit 1