1219820Sjeff#! /bin/sh
2219820Sjeff# Attempt to guess a canonical system name.
3219820Sjeff#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4219820Sjeff#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5219820Sjeff
6219820Sjefftimestamp='2005-08-03'
7219820Sjeff
8219820Sjeff# This file is free software; you can redistribute it and/or modify it
9219820Sjeff# under the terms of the GNU General Public License as published by
10219820Sjeff# the Free Software Foundation; either version 2 of the License, or
11219820Sjeff# (at your option) any later version.
12219820Sjeff#
13219820Sjeff# This program is distributed in the hope that it will be useful, but
14219820Sjeff# WITHOUT ANY WARRANTY; without even the implied warranty of
15219820Sjeff# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16219820Sjeff# General Public License for more details.
17219820Sjeff#
18219820Sjeff# You should have received a copy of the GNU General Public License
19219820Sjeff# along with this program; if not, write to the Free Software
20219820Sjeff# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21219820Sjeff# 02110-1301, USA.
22219820Sjeff#
23219820Sjeff# As a special exception to the GNU General Public License, if you
24219820Sjeff# distribute this file as part of a program that contains a
25219820Sjeff# configuration script generated by Autoconf, you may include it under
26219820Sjeff# the same distribution terms that you use for the rest of that program.
27219820Sjeff
28219820Sjeff
29219820Sjeff# Originally written by Per Bothner <per@bothner.com>.
30219820Sjeff# Please send patches to <config-patches@gnu.org>.  Submit a context
31219820Sjeff# diff and a properly formatted ChangeLog entry.
32219820Sjeff#
33219820Sjeff# This script attempts to guess a canonical system name similar to
34219820Sjeff# config.sub.  If it succeeds, it prints the system name on stdout, and
35219820Sjeff# exits with 0.  Otherwise, it exits with 1.
36219820Sjeff#
37219820Sjeff# The plan is that this can be called by configure scripts if you
38219820Sjeff# don't specify an explicit build system type.
39219820Sjeff
40219820Sjeffme=`echo "$0" | sed -e 's,.*/,,'`
41219820Sjeff
42219820Sjeffusage="\
43219820SjeffUsage: $0 [OPTION]
44219820Sjeff
45219820SjeffOutput the configuration name of the system \`$me' is run on.
46219820Sjeff
47219820SjeffOperation modes:
48219820Sjeff  -h, --help         print this help, then exit
49219820Sjeff  -t, --time-stamp   print date of last modification, then exit
50219820Sjeff  -v, --version      print version number, then exit
51219820Sjeff
52219820SjeffReport bugs and patches to <config-patches@gnu.org>."
53219820Sjeff
54219820Sjeffversion="\
55219820SjeffGNU config.guess ($timestamp)
56219820Sjeff
57219820SjeffOriginally written by Per Bothner.
58219820SjeffCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
59219820SjeffFree Software Foundation, Inc.
60219820Sjeff
61219820SjeffThis is free software; see the source for copying conditions.  There is NO
62219820Sjeffwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
63219820Sjeff
64219820Sjeffhelp="
65219820SjeffTry \`$me --help' for more information."
66219820Sjeff
67219820Sjeff# Parse command line
68219820Sjeffwhile test $# -gt 0 ; do
69219820Sjeff  case $1 in
70219820Sjeff    --time-stamp | --time* | -t )
71219820Sjeff       echo "$timestamp" ; exit ;;
72219820Sjeff    --version | -v )
73219820Sjeff       echo "$version" ; exit ;;
74219820Sjeff    --help | --h* | -h )
75219820Sjeff       echo "$usage"; exit ;;
76219820Sjeff    -- )     # Stop option processing
77219820Sjeff       shift; break ;;
78219820Sjeff    - )	# Use stdin as input.
79219820Sjeff       break ;;
80219820Sjeff    -* )
81219820Sjeff       echo "$me: invalid option $1$help" >&2
82219820Sjeff       exit 1 ;;
83219820Sjeff    * )
84219820Sjeff       break ;;
85219820Sjeff  esac
86219820Sjeffdone
87219820Sjeff
88219820Sjeffif test $# != 0; then
89219820Sjeff  echo "$me: too many arguments$help" >&2
90219820Sjeff  exit 1
91219820Sjefffi
92219820Sjeff
93219820Sjefftrap 'exit 1' 1 2 15
94219820Sjeff
95219820Sjeff# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96219820Sjeff# compiler to aid in system detection is discouraged as it requires
97219820Sjeff# temporary files to be created and, as you can see below, it is a
98219820Sjeff# headache to deal with in a portable fashion.
99219820Sjeff
100219820Sjeff# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
101219820Sjeff# use `HOST_CC' if defined, but it is deprecated.
102219820Sjeff
103219820Sjeff# Portable tmp directory creation inspired by the Autoconf team.
104219820Sjeff
105219820Sjeffset_cc_for_build='
106219820Sjefftrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107219820Sjefftrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108219820Sjeff: ${TMPDIR=/tmp} ;
109219820Sjeff { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110219820Sjeff { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111219820Sjeff { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112219820Sjeff { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113219820Sjeffdummy=$tmp/dummy ;
114219820Sjefftmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115219820Sjeffcase $CC_FOR_BUILD,$HOST_CC,$CC in
116219820Sjeff ,,)    echo "int x;" > $dummy.c ;
117219820Sjeff	for c in cc gcc c89 c99 ; do
118219820Sjeff	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
119219820Sjeff	     CC_FOR_BUILD="$c"; break ;
120219820Sjeff	  fi ;
121219820Sjeff	done ;
122219820Sjeff	if test x"$CC_FOR_BUILD" = x ; then
123219820Sjeff	  CC_FOR_BUILD=no_compiler_found ;
124219820Sjeff	fi
125219820Sjeff	;;
126219820Sjeff ,,*)   CC_FOR_BUILD=$CC ;;
127219820Sjeff ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
128219820Sjeffesac ; set_cc_for_build= ;'
129219820Sjeff
130219820Sjeff# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
131219820Sjeff# (ghazi@noc.rutgers.edu 1994-08-24)
132219820Sjeffif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
133219820Sjeff	PATH=$PATH:/.attbin ; export PATH
134219820Sjefffi
135219820Sjeff
136219820SjeffUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
137219820SjeffUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
138219820SjeffUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
139219820SjeffUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
140219820Sjeff
141219820Sjeff# Note: order is significant - the case branches are not exclusive.
142219820Sjeff
143219820Sjeffcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
144219820Sjeff    *:NetBSD:*:*)
145219820Sjeff	# NetBSD (nbsd) targets should (where applicable) match one or
146219820Sjeff	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
147219820Sjeff	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
148219820Sjeff	# switched to ELF, *-*-netbsd* would select the old
149219820Sjeff	# object file format.  This provides both forward
150219820Sjeff	# compatibility and a consistent mechanism for selecting the
151219820Sjeff	# object file format.
152219820Sjeff	#
153219820Sjeff	# Note: NetBSD doesn't particularly care about the vendor
154219820Sjeff	# portion of the name.  We always set it to "unknown".
155219820Sjeff	sysctl="sysctl -n hw.machine_arch"
156219820Sjeff	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
157219820Sjeff	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
158219820Sjeff	case "${UNAME_MACHINE_ARCH}" in
159219820Sjeff	    armeb) machine=armeb-unknown ;;
160219820Sjeff	    arm*) machine=arm-unknown ;;
161219820Sjeff	    sh3el) machine=shl-unknown ;;
162219820Sjeff	    sh3eb) machine=sh-unknown ;;
163219820Sjeff	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
164219820Sjeff	esac
165219820Sjeff	# The Operating System including object format, if it has switched
166219820Sjeff	# to ELF recently, or will in the future.
167219820Sjeff	case "${UNAME_MACHINE_ARCH}" in
168219820Sjeff	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
169219820Sjeff		eval $set_cc_for_build
170219820Sjeff		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
171219820Sjeff			| grep __ELF__ >/dev/null
172219820Sjeff		then
173219820Sjeff		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
174219820Sjeff		    # Return netbsd for either.  FIX?
175219820Sjeff		    os=netbsd
176219820Sjeff		else
177219820Sjeff		    os=netbsdelf
178219820Sjeff		fi
179219820Sjeff		;;
180219820Sjeff	    *)
181219820Sjeff	        os=netbsd
182219820Sjeff		;;
183219820Sjeff	esac
184219820Sjeff	# The OS release
185219820Sjeff	# Debian GNU/NetBSD machines have a different userland, and
186219820Sjeff	# thus, need a distinct triplet. However, they do not need
187219820Sjeff	# kernel version information, so it can be replaced with a
188219820Sjeff	# suitable tag, in the style of linux-gnu.
189219820Sjeff	case "${UNAME_VERSION}" in
190219820Sjeff	    Debian*)
191219820Sjeff		release='-gnu'
192219820Sjeff		;;
193219820Sjeff	    *)
194219820Sjeff		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
195219820Sjeff		;;
196219820Sjeff	esac
197219820Sjeff	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
198219820Sjeff	# contains redundant information, the shorter form:
199219820Sjeff	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
200219820Sjeff	echo "${machine}-${os}${release}"
201219820Sjeff	exit ;;
202219820Sjeff    *:OpenBSD:*:*)
203219820Sjeff	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
204219820Sjeff	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
205219820Sjeff	exit ;;
206219820Sjeff    *:ekkoBSD:*:*)
207219820Sjeff	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
208219820Sjeff	exit ;;
209219820Sjeff    macppc:MirBSD:*:*)
210219820Sjeff	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
211219820Sjeff	exit ;;
212219820Sjeff    *:MirBSD:*:*)
213219820Sjeff	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
214219820Sjeff	exit ;;
215219820Sjeff    alpha:OSF1:*:*)
216219820Sjeff	case $UNAME_RELEASE in
217219820Sjeff	*4.0)
218219820Sjeff		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
219219820Sjeff		;;
220219820Sjeff	*5.*)
221219820Sjeff	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
222219820Sjeff		;;
223219820Sjeff	esac
224219820Sjeff	# According to Compaq, /usr/sbin/psrinfo has been available on
225219820Sjeff	# OSF/1 and Tru64 systems produced since 1995.  I hope that
226219820Sjeff	# covers most systems running today.  This code pipes the CPU
227219820Sjeff	# types through head -n 1, so we only detect the type of CPU 0.
228219820Sjeff	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
229219820Sjeff	case "$ALPHA_CPU_TYPE" in
230219820Sjeff	    "EV4 (21064)")
231219820Sjeff		UNAME_MACHINE="alpha" ;;
232219820Sjeff	    "EV4.5 (21064)")
233219820Sjeff		UNAME_MACHINE="alpha" ;;
234219820Sjeff	    "LCA4 (21066/21068)")
235219820Sjeff		UNAME_MACHINE="alpha" ;;
236219820Sjeff	    "EV5 (21164)")
237219820Sjeff		UNAME_MACHINE="alphaev5" ;;
238219820Sjeff	    "EV5.6 (21164A)")
239219820Sjeff		UNAME_MACHINE="alphaev56" ;;
240219820Sjeff	    "EV5.6 (21164PC)")
241219820Sjeff		UNAME_MACHINE="alphapca56" ;;
242219820Sjeff	    "EV5.7 (21164PC)")
243219820Sjeff		UNAME_MACHINE="alphapca57" ;;
244219820Sjeff	    "EV6 (21264)")
245219820Sjeff		UNAME_MACHINE="alphaev6" ;;
246219820Sjeff	    "EV6.7 (21264A)")
247219820Sjeff		UNAME_MACHINE="alphaev67" ;;
248219820Sjeff	    "EV6.8CB (21264C)")
249219820Sjeff		UNAME_MACHINE="alphaev68" ;;
250219820Sjeff	    "EV6.8AL (21264B)")
251219820Sjeff		UNAME_MACHINE="alphaev68" ;;
252219820Sjeff	    "EV6.8CX (21264D)")
253219820Sjeff		UNAME_MACHINE="alphaev68" ;;
254219820Sjeff	    "EV6.9A (21264/EV69A)")
255219820Sjeff		UNAME_MACHINE="alphaev69" ;;
256219820Sjeff	    "EV7 (21364)")
257219820Sjeff		UNAME_MACHINE="alphaev7" ;;
258219820Sjeff	    "EV7.9 (21364A)")
259219820Sjeff		UNAME_MACHINE="alphaev79" ;;
260219820Sjeff	esac
261219820Sjeff	# A Pn.n version is a patched version.
262219820Sjeff	# A Vn.n version is a released version.
263219820Sjeff	# A Tn.n version is a released field test version.
264219820Sjeff	# A Xn.n version is an unreleased experimental baselevel.
265219820Sjeff	# 1.2 uses "1.2" for uname -r.
266219820Sjeff	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
267219820Sjeff	exit ;;
268219820Sjeff    Alpha\ *:Windows_NT*:*)
269219820Sjeff	# How do we know it's Interix rather than the generic POSIX subsystem?
270219820Sjeff	# Should we change UNAME_MACHINE based on the output of uname instead
271219820Sjeff	# of the specific Alpha model?
272219820Sjeff	echo alpha-pc-interix
273219820Sjeff	exit ;;
274219820Sjeff    21064:Windows_NT:50:3)
275219820Sjeff	echo alpha-dec-winnt3.5
276219820Sjeff	exit ;;
277219820Sjeff    Amiga*:UNIX_System_V:4.0:*)
278219820Sjeff	echo m68k-unknown-sysv4
279219820Sjeff	exit ;;
280219820Sjeff    *:[Aa]miga[Oo][Ss]:*:*)
281219820Sjeff	echo ${UNAME_MACHINE}-unknown-amigaos
282219820Sjeff	exit ;;
283219820Sjeff    *:[Mm]orph[Oo][Ss]:*:*)
284219820Sjeff	echo ${UNAME_MACHINE}-unknown-morphos
285219820Sjeff	exit ;;
286219820Sjeff    *:OS/390:*:*)
287219820Sjeff	echo i370-ibm-openedition
288219820Sjeff	exit ;;
289219820Sjeff    *:z/VM:*:*)
290219820Sjeff	echo s390-ibm-zvmoe
291219820Sjeff	exit ;;
292219820Sjeff    *:OS400:*:*)
293219820Sjeff        echo powerpc-ibm-os400
294219820Sjeff	exit ;;
295219820Sjeff    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
296219820Sjeff	echo arm-acorn-riscix${UNAME_RELEASE}
297219820Sjeff	exit ;;
298219820Sjeff    arm:riscos:*:*|arm:RISCOS:*:*)
299219820Sjeff	echo arm-unknown-riscos
300219820Sjeff	exit ;;
301219820Sjeff    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
302219820Sjeff	echo hppa1.1-hitachi-hiuxmpp
303219820Sjeff	exit ;;
304219820Sjeff    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
305219820Sjeff	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
306219820Sjeff	if test "`(/bin/universe) 2>/dev/null`" = att ; then
307219820Sjeff		echo pyramid-pyramid-sysv3
308219820Sjeff	else
309219820Sjeff		echo pyramid-pyramid-bsd
310219820Sjeff	fi
311219820Sjeff	exit ;;
312219820Sjeff    NILE*:*:*:dcosx)
313219820Sjeff	echo pyramid-pyramid-svr4
314219820Sjeff	exit ;;
315219820Sjeff    DRS?6000:unix:4.0:6*)
316219820Sjeff	echo sparc-icl-nx6
317219820Sjeff	exit ;;
318219820Sjeff    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
319219820Sjeff	case `/usr/bin/uname -p` in
320219820Sjeff	    sparc) echo sparc-icl-nx7; exit ;;
321219820Sjeff	esac ;;
322219820Sjeff    sun4H:SunOS:5.*:*)
323219820Sjeff	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
324219820Sjeff	exit ;;
325219820Sjeff    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
326219820Sjeff	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
327219820Sjeff	exit ;;
328219820Sjeff    i86pc:SunOS:5.*:*)
329219820Sjeff	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
330219820Sjeff	exit ;;
331219820Sjeff    sun4*:SunOS:6*:*)
332219820Sjeff	# According to config.sub, this is the proper way to canonicalize
333219820Sjeff	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
334219820Sjeff	# it's likely to be more like Solaris than SunOS4.
335219820Sjeff	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336219820Sjeff	exit ;;
337219820Sjeff    sun4*:SunOS:*:*)
338219820Sjeff	case "`/usr/bin/arch -k`" in
339219820Sjeff	    Series*|S4*)
340219820Sjeff		UNAME_RELEASE=`uname -v`
341219820Sjeff		;;
342219820Sjeff	esac
343219820Sjeff	# Japanese Language versions have a version number like `4.1.3-JL'.
344219820Sjeff	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
345219820Sjeff	exit ;;
346219820Sjeff    sun3*:SunOS:*:*)
347219820Sjeff	echo m68k-sun-sunos${UNAME_RELEASE}
348219820Sjeff	exit ;;
349219820Sjeff    sun*:*:4.2BSD:*)
350219820Sjeff	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
351219820Sjeff	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
352219820Sjeff	case "`/bin/arch`" in
353219820Sjeff	    sun3)
354219820Sjeff		echo m68k-sun-sunos${UNAME_RELEASE}
355219820Sjeff		;;
356219820Sjeff	    sun4)
357219820Sjeff		echo sparc-sun-sunos${UNAME_RELEASE}
358219820Sjeff		;;
359219820Sjeff	esac
360219820Sjeff	exit ;;
361219820Sjeff    aushp:SunOS:*:*)
362219820Sjeff	echo sparc-auspex-sunos${UNAME_RELEASE}
363219820Sjeff	exit ;;
364219820Sjeff    # The situation for MiNT is a little confusing.  The machine name
365219820Sjeff    # can be virtually everything (everything which is not
366219820Sjeff    # "atarist" or "atariste" at least should have a processor
367219820Sjeff    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
368219820Sjeff    # to the lowercase version "mint" (or "freemint").  Finally
369219820Sjeff    # the system name "TOS" denotes a system which is actually not
370219820Sjeff    # MiNT.  But MiNT is downward compatible to TOS, so this should
371219820Sjeff    # be no problem.
372219820Sjeff    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
373219820Sjeff        echo m68k-atari-mint${UNAME_RELEASE}
374219820Sjeff	exit ;;
375219820Sjeff    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
376219820Sjeff	echo m68k-atari-mint${UNAME_RELEASE}
377219820Sjeff        exit ;;
378219820Sjeff    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
379219820Sjeff        echo m68k-atari-mint${UNAME_RELEASE}
380219820Sjeff	exit ;;
381219820Sjeff    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
382219820Sjeff        echo m68k-milan-mint${UNAME_RELEASE}
383219820Sjeff        exit ;;
384219820Sjeff    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
385219820Sjeff        echo m68k-hades-mint${UNAME_RELEASE}
386219820Sjeff        exit ;;
387219820Sjeff    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
388219820Sjeff        echo m68k-unknown-mint${UNAME_RELEASE}
389219820Sjeff        exit ;;
390219820Sjeff    m68k:machten:*:*)
391219820Sjeff	echo m68k-apple-machten${UNAME_RELEASE}
392219820Sjeff	exit ;;
393219820Sjeff    powerpc:machten:*:*)
394219820Sjeff	echo powerpc-apple-machten${UNAME_RELEASE}
395219820Sjeff	exit ;;
396219820Sjeff    RISC*:Mach:*:*)
397219820Sjeff	echo mips-dec-mach_bsd4.3
398219820Sjeff	exit ;;
399219820Sjeff    RISC*:ULTRIX:*:*)
400219820Sjeff	echo mips-dec-ultrix${UNAME_RELEASE}
401219820Sjeff	exit ;;
402219820Sjeff    VAX*:ULTRIX*:*:*)
403219820Sjeff	echo vax-dec-ultrix${UNAME_RELEASE}
404219820Sjeff	exit ;;
405219820Sjeff    2020:CLIX:*:* | 2430:CLIX:*:*)
406219820Sjeff	echo clipper-intergraph-clix${UNAME_RELEASE}
407219820Sjeff	exit ;;
408219820Sjeff    mips:*:*:UMIPS | mips:*:*:RISCos)
409219820Sjeff	eval $set_cc_for_build
410219820Sjeff	sed 's/^	//' << EOF >$dummy.c
411219820Sjeff#ifdef __cplusplus
412219820Sjeff#include <stdio.h>  /* for printf() prototype */
413219820Sjeff	int main (int argc, char *argv[]) {
414219820Sjeff#else
415219820Sjeff	int main (argc, argv) int argc; char *argv[]; {
416219820Sjeff#endif
417219820Sjeff	#if defined (host_mips) && defined (MIPSEB)
418219820Sjeff	#if defined (SYSTYPE_SYSV)
419219820Sjeff	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
420219820Sjeff	#endif
421219820Sjeff	#if defined (SYSTYPE_SVR4)
422219820Sjeff	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
423219820Sjeff	#endif
424219820Sjeff	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
425219820Sjeff	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
426219820Sjeff	#endif
427219820Sjeff	#endif
428219820Sjeff	  exit (-1);
429219820Sjeff	}
430219820SjeffEOF
431219820Sjeff	$CC_FOR_BUILD -o $dummy $dummy.c &&
432219820Sjeff	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
433219820Sjeff	  SYSTEM_NAME=`$dummy $dummyarg` &&
434219820Sjeff	    { echo "$SYSTEM_NAME"; exit; }
435219820Sjeff	echo mips-mips-riscos${UNAME_RELEASE}
436219820Sjeff	exit ;;
437219820Sjeff    Motorola:PowerMAX_OS:*:*)
438219820Sjeff	echo powerpc-motorola-powermax
439219820Sjeff	exit ;;
440219820Sjeff    Motorola:*:4.3:PL8-*)
441219820Sjeff	echo powerpc-harris-powermax
442219820Sjeff	exit ;;
443219820Sjeff    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
444219820Sjeff	echo powerpc-harris-powermax
445219820Sjeff	exit ;;
446219820Sjeff    Night_Hawk:Power_UNIX:*:*)
447219820Sjeff	echo powerpc-harris-powerunix
448219820Sjeff	exit ;;
449219820Sjeff    m88k:CX/UX:7*:*)
450219820Sjeff	echo m88k-harris-cxux7
451219820Sjeff	exit ;;
452219820Sjeff    m88k:*:4*:R4*)
453219820Sjeff	echo m88k-motorola-sysv4
454219820Sjeff	exit ;;
455219820Sjeff    m88k:*:3*:R3*)
456219820Sjeff	echo m88k-motorola-sysv3
457219820Sjeff	exit ;;
458219820Sjeff    AViiON:dgux:*:*)
459219820Sjeff        # DG/UX returns AViiON for all architectures
460219820Sjeff        UNAME_PROCESSOR=`/usr/bin/uname -p`
461219820Sjeff	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
462219820Sjeff	then
463219820Sjeff	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
464219820Sjeff	       [ ${TARGET_BINARY_INTERFACE}x = x ]
465219820Sjeff	    then
466219820Sjeff		echo m88k-dg-dgux${UNAME_RELEASE}
467219820Sjeff	    else
468219820Sjeff		echo m88k-dg-dguxbcs${UNAME_RELEASE}
469219820Sjeff	    fi
470219820Sjeff	else
471219820Sjeff	    echo i586-dg-dgux${UNAME_RELEASE}
472219820Sjeff	fi
473219820Sjeff 	exit ;;
474219820Sjeff    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
475219820Sjeff	echo m88k-dolphin-sysv3
476219820Sjeff	exit ;;
477219820Sjeff    M88*:*:R3*:*)
478219820Sjeff	# Delta 88k system running SVR3
479219820Sjeff	echo m88k-motorola-sysv3
480219820Sjeff	exit ;;
481219820Sjeff    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
482219820Sjeff	echo m88k-tektronix-sysv3
483219820Sjeff	exit ;;
484219820Sjeff    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
485219820Sjeff	echo m68k-tektronix-bsd
486219820Sjeff	exit ;;
487219820Sjeff    *:IRIX*:*:*)
488219820Sjeff	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
489219820Sjeff	exit ;;
490219820Sjeff    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
491219820Sjeff	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
492219820Sjeff	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
493219820Sjeff    i*86:AIX:*:*)
494219820Sjeff	echo i386-ibm-aix
495219820Sjeff	exit ;;
496219820Sjeff    ia64:AIX:*:*)
497219820Sjeff	if [ -x /usr/bin/oslevel ] ; then
498219820Sjeff		IBM_REV=`/usr/bin/oslevel`
499219820Sjeff	else
500219820Sjeff		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
501219820Sjeff	fi
502219820Sjeff	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
503219820Sjeff	exit ;;
504219820Sjeff    *:AIX:2:3)
505219820Sjeff	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
506219820Sjeff		eval $set_cc_for_build
507219820Sjeff		sed 's/^		//' << EOF >$dummy.c
508219820Sjeff		#include <sys/systemcfg.h>
509219820Sjeff
510219820Sjeff		main()
511219820Sjeff			{
512219820Sjeff			if (!__power_pc())
513219820Sjeff				exit(1);
514219820Sjeff			puts("powerpc-ibm-aix3.2.5");
515219820Sjeff			exit(0);
516219820Sjeff			}
517219820SjeffEOF
518219820Sjeff		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
519219820Sjeff		then
520219820Sjeff			echo "$SYSTEM_NAME"
521219820Sjeff		else
522219820Sjeff			echo rs6000-ibm-aix3.2.5
523219820Sjeff		fi
524219820Sjeff	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
525219820Sjeff		echo rs6000-ibm-aix3.2.4
526219820Sjeff	else
527219820Sjeff		echo rs6000-ibm-aix3.2
528219820Sjeff	fi
529219820Sjeff	exit ;;
530219820Sjeff    *:AIX:*:[45])
531219820Sjeff	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
532219820Sjeff	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
533219820Sjeff		IBM_ARCH=rs6000
534219820Sjeff	else
535219820Sjeff		IBM_ARCH=powerpc
536219820Sjeff	fi
537219820Sjeff	if [ -x /usr/bin/oslevel ] ; then
538219820Sjeff		IBM_REV=`/usr/bin/oslevel`
539219820Sjeff	else
540219820Sjeff		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
541219820Sjeff	fi
542219820Sjeff	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
543219820Sjeff	exit ;;
544219820Sjeff    *:AIX:*:*)
545219820Sjeff	echo rs6000-ibm-aix
546219820Sjeff	exit ;;
547219820Sjeff    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
548219820Sjeff	echo romp-ibm-bsd4.4
549219820Sjeff	exit ;;
550219820Sjeff    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
551219820Sjeff	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
552219820Sjeff	exit ;;                             # report: romp-ibm BSD 4.3
553219820Sjeff    *:BOSX:*:*)
554219820Sjeff	echo rs6000-bull-bosx
555219820Sjeff	exit ;;
556219820Sjeff    DPX/2?00:B.O.S.:*:*)
557219820Sjeff	echo m68k-bull-sysv3
558219820Sjeff	exit ;;
559219820Sjeff    9000/[34]??:4.3bsd:1.*:*)
560219820Sjeff	echo m68k-hp-bsd
561219820Sjeff	exit ;;
562219820Sjeff    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
563219820Sjeff	echo m68k-hp-bsd4.4
564219820Sjeff	exit ;;
565219820Sjeff    9000/[34678]??:HP-UX:*:*)
566219820Sjeff	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
567219820Sjeff	case "${UNAME_MACHINE}" in
568219820Sjeff	    9000/31? )            HP_ARCH=m68000 ;;
569219820Sjeff	    9000/[34]?? )         HP_ARCH=m68k ;;
570219820Sjeff	    9000/[678][0-9][0-9])
571219820Sjeff		if [ -x /usr/bin/getconf ]; then
572219820Sjeff		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
573219820Sjeff                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
574219820Sjeff                    case "${sc_cpu_version}" in
575219820Sjeff                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
576219820Sjeff                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
577219820Sjeff                      532)                      # CPU_PA_RISC2_0
578219820Sjeff                        case "${sc_kernel_bits}" in
579219820Sjeff                          32) HP_ARCH="hppa2.0n" ;;
580219820Sjeff                          64) HP_ARCH="hppa2.0w" ;;
581219820Sjeff			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
582219820Sjeff                        esac ;;
583219820Sjeff                    esac
584219820Sjeff		fi
585219820Sjeff		if [ "${HP_ARCH}" = "" ]; then
586219820Sjeff		    eval $set_cc_for_build
587219820Sjeff		    sed 's/^              //' << EOF >$dummy.c
588219820Sjeff
589219820Sjeff              #define _HPUX_SOURCE
590219820Sjeff              #include <stdlib.h>
591219820Sjeff              #include <unistd.h>
592219820Sjeff
593219820Sjeff              int main ()
594219820Sjeff              {
595219820Sjeff              #if defined(_SC_KERNEL_BITS)
596219820Sjeff                  long bits = sysconf(_SC_KERNEL_BITS);
597219820Sjeff              #endif
598219820Sjeff                  long cpu  = sysconf (_SC_CPU_VERSION);
599219820Sjeff
600219820Sjeff                  switch (cpu)
601219820Sjeff              	{
602219820Sjeff              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
603219820Sjeff              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
604219820Sjeff              	case CPU_PA_RISC2_0:
605219820Sjeff              #if defined(_SC_KERNEL_BITS)
606219820Sjeff              	    switch (bits)
607219820Sjeff              		{
608219820Sjeff              		case 64: puts ("hppa2.0w"); break;
609219820Sjeff              		case 32: puts ("hppa2.0n"); break;
610219820Sjeff              		default: puts ("hppa2.0"); break;
611219820Sjeff              		} break;
612219820Sjeff              #else  /* !defined(_SC_KERNEL_BITS) */
613219820Sjeff              	    puts ("hppa2.0"); break;
614219820Sjeff              #endif
615219820Sjeff              	default: puts ("hppa1.0"); break;
616219820Sjeff              	}
617219820Sjeff                  exit (0);
618219820Sjeff              }
619219820SjeffEOF
620219820Sjeff		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
621219820Sjeff		    test -z "$HP_ARCH" && HP_ARCH=hppa
622219820Sjeff		fi ;;
623219820Sjeff	esac
624219820Sjeff	if [ ${HP_ARCH} = "hppa2.0w" ]
625219820Sjeff	then
626219820Sjeff	    eval $set_cc_for_build
627219820Sjeff
628219820Sjeff	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
629219820Sjeff	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
630219820Sjeff	    # generating 64-bit code.  GNU and HP use different nomenclature:
631219820Sjeff	    #
632219820Sjeff	    # $ CC_FOR_BUILD=cc ./config.guess
633219820Sjeff	    # => hppa2.0w-hp-hpux11.23
634219820Sjeff	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
635219820Sjeff	    # => hppa64-hp-hpux11.23
636219820Sjeff
637219820Sjeff	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
638219820Sjeff		grep __LP64__ >/dev/null
639219820Sjeff	    then
640219820Sjeff		HP_ARCH="hppa2.0w"
641219820Sjeff	    else
642219820Sjeff		HP_ARCH="hppa64"
643219820Sjeff	    fi
644219820Sjeff	fi
645219820Sjeff	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
646219820Sjeff	exit ;;
647219820Sjeff    ia64:HP-UX:*:*)
648219820Sjeff	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
649219820Sjeff	echo ia64-hp-hpux${HPUX_REV}
650219820Sjeff	exit ;;
651219820Sjeff    3050*:HI-UX:*:*)
652219820Sjeff	eval $set_cc_for_build
653219820Sjeff	sed 's/^	//' << EOF >$dummy.c
654219820Sjeff	#include <unistd.h>
655219820Sjeff	int
656219820Sjeff	main ()
657219820Sjeff	{
658219820Sjeff	  long cpu = sysconf (_SC_CPU_VERSION);
659219820Sjeff	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
660219820Sjeff	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
661219820Sjeff	     results, however.  */
662219820Sjeff	  if (CPU_IS_PA_RISC (cpu))
663219820Sjeff	    {
664219820Sjeff	      switch (cpu)
665219820Sjeff		{
666219820Sjeff		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
667219820Sjeff		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
668219820Sjeff		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
669219820Sjeff		  default: puts ("hppa-hitachi-hiuxwe2"); break;
670219820Sjeff		}
671219820Sjeff	    }
672219820Sjeff	  else if (CPU_IS_HP_MC68K (cpu))
673219820Sjeff	    puts ("m68k-hitachi-hiuxwe2");
674219820Sjeff	  else puts ("unknown-hitachi-hiuxwe2");
675219820Sjeff	  exit (0);
676219820Sjeff	}
677219820SjeffEOF
678219820Sjeff	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
679219820Sjeff		{ echo "$SYSTEM_NAME"; exit; }
680219820Sjeff	echo unknown-hitachi-hiuxwe2
681219820Sjeff	exit ;;
682219820Sjeff    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
683219820Sjeff	echo hppa1.1-hp-bsd
684219820Sjeff	exit ;;
685219820Sjeff    9000/8??:4.3bsd:*:*)
686219820Sjeff	echo hppa1.0-hp-bsd
687219820Sjeff	exit ;;
688219820Sjeff    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
689219820Sjeff	echo hppa1.0-hp-mpeix
690219820Sjeff	exit ;;
691219820Sjeff    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
692219820Sjeff	echo hppa1.1-hp-osf
693219820Sjeff	exit ;;
694219820Sjeff    hp8??:OSF1:*:*)
695219820Sjeff	echo hppa1.0-hp-osf
696219820Sjeff	exit ;;
697219820Sjeff    i*86:OSF1:*:*)
698219820Sjeff	if [ -x /usr/sbin/sysversion ] ; then
699219820Sjeff	    echo ${UNAME_MACHINE}-unknown-osf1mk
700219820Sjeff	else
701219820Sjeff	    echo ${UNAME_MACHINE}-unknown-osf1
702219820Sjeff	fi
703219820Sjeff	exit ;;
704219820Sjeff    parisc*:Lites*:*:*)
705219820Sjeff	echo hppa1.1-hp-lites
706219820Sjeff	exit ;;
707219820Sjeff    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
708219820Sjeff	echo c1-convex-bsd
709219820Sjeff        exit ;;
710219820Sjeff    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
711219820Sjeff	if getsysinfo -f scalar_acc
712219820Sjeff	then echo c32-convex-bsd
713219820Sjeff	else echo c2-convex-bsd
714219820Sjeff	fi
715219820Sjeff        exit ;;
716219820Sjeff    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
717219820Sjeff	echo c34-convex-bsd
718219820Sjeff        exit ;;
719219820Sjeff    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
720219820Sjeff	echo c38-convex-bsd
721219820Sjeff        exit ;;
722219820Sjeff    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
723219820Sjeff	echo c4-convex-bsd
724219820Sjeff        exit ;;
725219820Sjeff    CRAY*Y-MP:*:*:*)
726219820Sjeff	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
727219820Sjeff	exit ;;
728219820Sjeff    CRAY*[A-Z]90:*:*:*)
729219820Sjeff	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
730219820Sjeff	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
731219820Sjeff	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
732219820Sjeff	      -e 's/\.[^.]*$/.X/'
733219820Sjeff	exit ;;
734219820Sjeff    CRAY*TS:*:*:*)
735219820Sjeff	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
736219820Sjeff	exit ;;
737219820Sjeff    CRAY*T3E:*:*:*)
738219820Sjeff	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
739219820Sjeff	exit ;;
740219820Sjeff    CRAY*SV1:*:*:*)
741219820Sjeff	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
742219820Sjeff	exit ;;
743219820Sjeff    *:UNICOS/mp:*:*)
744219820Sjeff	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
745219820Sjeff	exit ;;
746219820Sjeff    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
747219820Sjeff	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
748219820Sjeff        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
749219820Sjeff        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
750219820Sjeff        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
751219820Sjeff        exit ;;
752219820Sjeff    5000:UNIX_System_V:4.*:*)
753219820Sjeff        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
754219820Sjeff        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
755219820Sjeff        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
756219820Sjeff	exit ;;
757219820Sjeff    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
758219820Sjeff	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
759219820Sjeff	exit ;;
760219820Sjeff    sparc*:BSD/OS:*:*)
761219820Sjeff	echo sparc-unknown-bsdi${UNAME_RELEASE}
762219820Sjeff	exit ;;
763219820Sjeff    *:BSD/OS:*:*)
764219820Sjeff	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
765219820Sjeff	exit ;;
766219820Sjeff    *:FreeBSD:*:*)
767219820Sjeff	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
768219820Sjeff	exit ;;
769219820Sjeff    i*:CYGWIN*:*)
770219820Sjeff	echo ${UNAME_MACHINE}-pc-cygwin
771219820Sjeff	exit ;;
772219820Sjeff    i*:MINGW*:*)
773219820Sjeff	echo ${UNAME_MACHINE}-pc-mingw32
774219820Sjeff	exit ;;
775219820Sjeff    i*:windows32*:*)
776219820Sjeff    	# uname -m includes "-pc" on this system.
777219820Sjeff    	echo ${UNAME_MACHINE}-mingw32
778219820Sjeff	exit ;;
779219820Sjeff    i*:PW*:*)
780219820Sjeff	echo ${UNAME_MACHINE}-pc-pw32
781219820Sjeff	exit ;;
782219820Sjeff    x86:Interix*:[34]*)
783219820Sjeff	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
784219820Sjeff	exit ;;
785219820Sjeff    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
786219820Sjeff	echo i${UNAME_MACHINE}-pc-mks
787219820Sjeff	exit ;;
788219820Sjeff    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
789219820Sjeff	# How do we know it's Interix rather than the generic POSIX subsystem?
790219820Sjeff	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
791219820Sjeff	# UNAME_MACHINE based on the output of uname instead of i386?
792219820Sjeff	echo i586-pc-interix
793219820Sjeff	exit ;;
794219820Sjeff    i*:UWIN*:*)
795219820Sjeff	echo ${UNAME_MACHINE}-pc-uwin
796219820Sjeff	exit ;;
797219820Sjeff    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
798219820Sjeff	echo x86_64-unknown-cygwin
799219820Sjeff	exit ;;
800219820Sjeff    p*:CYGWIN*:*)
801219820Sjeff	echo powerpcle-unknown-cygwin
802219820Sjeff	exit ;;
803219820Sjeff    prep*:SunOS:5.*:*)
804219820Sjeff	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
805219820Sjeff	exit ;;
806219820Sjeff    *:GNU:*:*)
807219820Sjeff	# the GNU system
808219820Sjeff	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
809219820Sjeff	exit ;;
810219820Sjeff    *:GNU/*:*:*)
811219820Sjeff	# other systems with GNU libc and userland
812219820Sjeff	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
813219820Sjeff	exit ;;
814219820Sjeff    i*86:Minix:*:*)
815219820Sjeff	echo ${UNAME_MACHINE}-pc-minix
816219820Sjeff	exit ;;
817219820Sjeff    arm*:Linux:*:*)
818219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu
819219820Sjeff	exit ;;
820219820Sjeff    cris:Linux:*:*)
821219820Sjeff	echo cris-axis-linux-gnu
822219820Sjeff	exit ;;
823219820Sjeff    crisv32:Linux:*:*)
824219820Sjeff	echo crisv32-axis-linux-gnu
825219820Sjeff	exit ;;
826219820Sjeff    frv:Linux:*:*)
827219820Sjeff    	echo frv-unknown-linux-gnu
828219820Sjeff	exit ;;
829219820Sjeff    ia64:Linux:*:*)
830219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu
831219820Sjeff	exit ;;
832219820Sjeff    m32r*:Linux:*:*)
833219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu
834219820Sjeff	exit ;;
835219820Sjeff    m68*:Linux:*:*)
836219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu
837219820Sjeff	exit ;;
838219820Sjeff    mips:Linux:*:*)
839219820Sjeff	eval $set_cc_for_build
840219820Sjeff	sed 's/^	//' << EOF >$dummy.c
841219820Sjeff	#undef CPU
842219820Sjeff	#undef mips
843219820Sjeff	#undef mipsel
844219820Sjeff	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
845219820Sjeff	CPU=mipsel
846219820Sjeff	#else
847219820Sjeff	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
848219820Sjeff	CPU=mips
849219820Sjeff	#else
850219820Sjeff	CPU=
851219820Sjeff	#endif
852219820Sjeff	#endif
853219820SjeffEOF
854219820Sjeff	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
855219820Sjeff	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
856219820Sjeff	;;
857219820Sjeff    mips64:Linux:*:*)
858219820Sjeff	eval $set_cc_for_build
859219820Sjeff	sed 's/^	//' << EOF >$dummy.c
860219820Sjeff	#undef CPU
861219820Sjeff	#undef mips64
862219820Sjeff	#undef mips64el
863219820Sjeff	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
864219820Sjeff	CPU=mips64el
865219820Sjeff	#else
866219820Sjeff	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
867219820Sjeff	CPU=mips64
868219820Sjeff	#else
869219820Sjeff	CPU=
870219820Sjeff	#endif
871219820Sjeff	#endif
872219820SjeffEOF
873219820Sjeff	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
874219820Sjeff	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
875219820Sjeff	;;
876219820Sjeff    or32:Linux:*:*)
877219820Sjeff	echo or32-unknown-linux-gnu
878219820Sjeff	exit ;;
879219820Sjeff    ppc:Linux:*:*)
880219820Sjeff	echo powerpc-unknown-linux-gnu
881219820Sjeff	exit ;;
882219820Sjeff    ppc64:Linux:*:*)
883219820Sjeff	echo powerpc64-unknown-linux-gnu
884219820Sjeff	exit ;;
885219820Sjeff    alpha:Linux:*:*)
886219820Sjeff	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
887219820Sjeff	  EV5)   UNAME_MACHINE=alphaev5 ;;
888219820Sjeff	  EV56)  UNAME_MACHINE=alphaev56 ;;
889219820Sjeff	  PCA56) UNAME_MACHINE=alphapca56 ;;
890219820Sjeff	  PCA57) UNAME_MACHINE=alphapca56 ;;
891219820Sjeff	  EV6)   UNAME_MACHINE=alphaev6 ;;
892219820Sjeff	  EV67)  UNAME_MACHINE=alphaev67 ;;
893219820Sjeff	  EV68*) UNAME_MACHINE=alphaev68 ;;
894219820Sjeff        esac
895219820Sjeff	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
896219820Sjeff	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
897219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
898219820Sjeff	exit ;;
899219820Sjeff    parisc:Linux:*:* | hppa:Linux:*:*)
900219820Sjeff	# Look for CPU level
901219820Sjeff	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
902219820Sjeff	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
903219820Sjeff	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
904219820Sjeff	  *)    echo hppa-unknown-linux-gnu ;;
905219820Sjeff	esac
906219820Sjeff	exit ;;
907219820Sjeff    parisc64:Linux:*:* | hppa64:Linux:*:*)
908219820Sjeff	echo hppa64-unknown-linux-gnu
909219820Sjeff	exit ;;
910219820Sjeff    s390:Linux:*:* | s390x:Linux:*:*)
911219820Sjeff	echo ${UNAME_MACHINE}-ibm-linux
912219820Sjeff	exit ;;
913219820Sjeff    sh64*:Linux:*:*)
914219820Sjeff    	echo ${UNAME_MACHINE}-unknown-linux-gnu
915219820Sjeff	exit ;;
916219820Sjeff    sh*:Linux:*:*)
917219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu
918219820Sjeff	exit ;;
919219820Sjeff    sparc:Linux:*:* | sparc64:Linux:*:*)
920219820Sjeff	echo ${UNAME_MACHINE}-unknown-linux-gnu
921219820Sjeff	exit ;;
922219820Sjeff    x86_64:Linux:*:*)
923219820Sjeff	echo x86_64-unknown-linux-gnu
924219820Sjeff	exit ;;
925219820Sjeff    i*86:Linux:*:*)
926219820Sjeff	# The BFD linker knows what the default object file format is, so
927219820Sjeff	# first see if it will tell us. cd to the root directory to prevent
928219820Sjeff	# problems with other programs or directories called `ld' in the path.
929219820Sjeff	# Set LC_ALL=C to ensure ld outputs messages in English.
930219820Sjeff	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
931219820Sjeff			 | sed -ne '/supported targets:/!d
932219820Sjeff				    s/[ 	][ 	]*/ /g
933219820Sjeff				    s/.*supported targets: *//
934219820Sjeff				    s/ .*//
935219820Sjeff				    p'`
936219820Sjeff        case "$ld_supported_targets" in
937219820Sjeff	  elf32-i386)
938219820Sjeff		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
939219820Sjeff		;;
940219820Sjeff	  a.out-i386-linux)
941219820Sjeff		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
942219820Sjeff		exit ;;
943219820Sjeff	  coff-i386)
944219820Sjeff		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
945219820Sjeff		exit ;;
946219820Sjeff	  "")
947219820Sjeff		# Either a pre-BFD a.out linker (linux-gnuoldld) or
948219820Sjeff		# one that does not give us useful --help.
949219820Sjeff		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
950219820Sjeff		exit ;;
951219820Sjeff	esac
952219820Sjeff	# Determine whether the default compiler is a.out or elf
953219820Sjeff	eval $set_cc_for_build
954219820Sjeff	sed 's/^	//' << EOF >$dummy.c
955219820Sjeff	#include <features.h>
956219820Sjeff	#ifdef __ELF__
957219820Sjeff	# ifdef __GLIBC__
958219820Sjeff	#  if __GLIBC__ >= 2
959219820Sjeff	LIBC=gnu
960219820Sjeff	#  else
961219820Sjeff	LIBC=gnulibc1
962219820Sjeff	#  endif
963219820Sjeff	# else
964219820Sjeff	LIBC=gnulibc1
965219820Sjeff	# endif
966219820Sjeff	#else
967219820Sjeff	#ifdef __INTEL_COMPILER
968219820Sjeff	LIBC=gnu
969219820Sjeff	#else
970219820Sjeff	LIBC=gnuaout
971219820Sjeff	#endif
972219820Sjeff	#endif
973219820Sjeff	#ifdef __dietlibc__
974219820Sjeff	LIBC=dietlibc
975219820Sjeff	#endif
976219820SjeffEOF
977219820Sjeff	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
978219820Sjeff	test x"${LIBC}" != x && {
979219820Sjeff		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
980219820Sjeff		exit
981219820Sjeff	}
982219820Sjeff	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
983219820Sjeff	;;
984219820Sjeff    i*86:DYNIX/ptx:4*:*)
985219820Sjeff	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
986219820Sjeff	# earlier versions are messed up and put the nodename in both
987219820Sjeff	# sysname and nodename.
988219820Sjeff	echo i386-sequent-sysv4
989219820Sjeff	exit ;;
990219820Sjeff    i*86:UNIX_SV:4.2MP:2.*)
991219820Sjeff        # Unixware is an offshoot of SVR4, but it has its own version
992219820Sjeff        # number series starting with 2...
993219820Sjeff        # I am not positive that other SVR4 systems won't match this,
994219820Sjeff	# I just have to hope.  -- rms.
995219820Sjeff        # Use sysv4.2uw... so that sysv4* matches it.
996219820Sjeff	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
997219820Sjeff	exit ;;
998219820Sjeff    i*86:OS/2:*:*)
999219820Sjeff	# If we were able to find `uname', then EMX Unix compatibility
1000219820Sjeff	# is probably installed.
1001219820Sjeff	echo ${UNAME_MACHINE}-pc-os2-emx
1002219820Sjeff	exit ;;
1003219820Sjeff    i*86:XTS-300:*:STOP)
1004219820Sjeff	echo ${UNAME_MACHINE}-unknown-stop
1005219820Sjeff	exit ;;
1006219820Sjeff    i*86:atheos:*:*)
1007219820Sjeff	echo ${UNAME_MACHINE}-unknown-atheos
1008219820Sjeff	exit ;;
1009219820Sjeff    i*86:syllable:*:*)
1010219820Sjeff	echo ${UNAME_MACHINE}-pc-syllable
1011219820Sjeff	exit ;;
1012219820Sjeff    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1013219820Sjeff	echo i386-unknown-lynxos${UNAME_RELEASE}
1014219820Sjeff	exit ;;
1015219820Sjeff    i*86:*DOS:*:*)
1016219820Sjeff	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1017219820Sjeff	exit ;;
1018219820Sjeff    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1019219820Sjeff	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1020219820Sjeff	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1021219820Sjeff		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1022219820Sjeff	else
1023219820Sjeff		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1024219820Sjeff	fi
1025219820Sjeff	exit ;;
1026219820Sjeff    i*86:*:5:[678]*)
1027219820Sjeff    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1028219820Sjeff	case `/bin/uname -X | grep "^Machine"` in
1029219820Sjeff	    *486*)	     UNAME_MACHINE=i486 ;;
1030219820Sjeff	    *Pentium)	     UNAME_MACHINE=i586 ;;
1031219820Sjeff	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1032219820Sjeff	esac
1033219820Sjeff	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1034219820Sjeff	exit ;;
1035219820Sjeff    i*86:*:3.2:*)
1036219820Sjeff	if test -f /usr/options/cb.name; then
1037219820Sjeff		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1038219820Sjeff		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1039219820Sjeff	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1040219820Sjeff		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1041219820Sjeff		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1042219820Sjeff		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1043219820Sjeff			&& UNAME_MACHINE=i586
1044219820Sjeff		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1045219820Sjeff			&& UNAME_MACHINE=i686
1046219820Sjeff		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1047219820Sjeff			&& UNAME_MACHINE=i686
1048219820Sjeff		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1049219820Sjeff	else
1050219820Sjeff		echo ${UNAME_MACHINE}-pc-sysv32
1051219820Sjeff	fi
1052219820Sjeff	exit ;;
1053219820Sjeff    pc:*:*:*)
1054219820Sjeff	# Left here for compatibility:
1055219820Sjeff        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1056219820Sjeff        # the processor, so we play safe by assuming i386.
1057219820Sjeff	echo i386-pc-msdosdjgpp
1058219820Sjeff        exit ;;
1059219820Sjeff    Intel:Mach:3*:*)
1060219820Sjeff	echo i386-pc-mach3
1061219820Sjeff	exit ;;
1062219820Sjeff    paragon:*:*:*)
1063219820Sjeff	echo i860-intel-osf1
1064219820Sjeff	exit ;;
1065219820Sjeff    i860:*:4.*:*) # i860-SVR4
1066219820Sjeff	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1067219820Sjeff	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1068219820Sjeff	else # Add other i860-SVR4 vendors below as they are discovered.
1069219820Sjeff	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1070219820Sjeff	fi
1071219820Sjeff	exit ;;
1072219820Sjeff    mini*:CTIX:SYS*5:*)
1073219820Sjeff	# "miniframe"
1074219820Sjeff	echo m68010-convergent-sysv
1075219820Sjeff	exit ;;
1076219820Sjeff    mc68k:UNIX:SYSTEM5:3.51m)
1077219820Sjeff	echo m68k-convergent-sysv
1078219820Sjeff	exit ;;
1079219820Sjeff    M680?0:D-NIX:5.3:*)
1080219820Sjeff	echo m68k-diab-dnix
1081219820Sjeff	exit ;;
1082219820Sjeff    M68*:*:R3V[5678]*:*)
1083219820Sjeff	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1084219820Sjeff    3[345]??:*: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 | S7501*:*:4.0:3.0)
1085219820Sjeff	OS_REL=''
1086219820Sjeff	test -r /etc/.relid \
1087219820Sjeff	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1088219820Sjeff	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1089219820Sjeff	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1090219820Sjeff	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1091219820Sjeff	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1092219820Sjeff    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1093219820Sjeff        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1094219820Sjeff          && { echo i486-ncr-sysv4; exit; } ;;
1095219820Sjeff    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1096219820Sjeff	echo m68k-unknown-lynxos${UNAME_RELEASE}
1097219820Sjeff	exit ;;
1098219820Sjeff    mc68030:UNIX_System_V:4.*:*)
1099219820Sjeff	echo m68k-atari-sysv4
1100219820Sjeff	exit ;;
1101219820Sjeff    TSUNAMI:LynxOS:2.*:*)
1102219820Sjeff	echo sparc-unknown-lynxos${UNAME_RELEASE}
1103219820Sjeff	exit ;;
1104219820Sjeff    rs6000:LynxOS:2.*:*)
1105219820Sjeff	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1106219820Sjeff	exit ;;
1107219820Sjeff    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1108219820Sjeff	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1109219820Sjeff	exit ;;
1110219820Sjeff    SM[BE]S:UNIX_SV:*:*)
1111219820Sjeff	echo mips-dde-sysv${UNAME_RELEASE}
1112219820Sjeff	exit ;;
1113219820Sjeff    RM*:ReliantUNIX-*:*:*)
1114219820Sjeff	echo mips-sni-sysv4
1115219820Sjeff	exit ;;
1116219820Sjeff    RM*:SINIX-*:*:*)
1117219820Sjeff	echo mips-sni-sysv4
1118219820Sjeff	exit ;;
1119219820Sjeff    *:SINIX-*:*:*)
1120219820Sjeff	if uname -p 2>/dev/null >/dev/null ; then
1121219820Sjeff		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1122219820Sjeff		echo ${UNAME_MACHINE}-sni-sysv4
1123219820Sjeff	else
1124219820Sjeff		echo ns32k-sni-sysv
1125219820Sjeff	fi
1126219820Sjeff	exit ;;
1127219820Sjeff    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1128219820Sjeff                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1129219820Sjeff        echo i586-unisys-sysv4
1130219820Sjeff        exit ;;
1131219820Sjeff    *:UNIX_System_V:4*:FTX*)
1132219820Sjeff	# From Gerald Hewes <hewes@openmarket.com>.
1133219820Sjeff	# How about differentiating between stratus architectures? -djm
1134219820Sjeff	echo hppa1.1-stratus-sysv4
1135219820Sjeff	exit ;;
1136219820Sjeff    *:*:*:FTX*)
1137219820Sjeff	# From seanf@swdc.stratus.com.
1138219820Sjeff	echo i860-stratus-sysv4
1139219820Sjeff	exit ;;
1140219820Sjeff    i*86:VOS:*:*)
1141219820Sjeff	# From Paul.Green@stratus.com.
1142219820Sjeff	echo ${UNAME_MACHINE}-stratus-vos
1143219820Sjeff	exit ;;
1144219820Sjeff    *:VOS:*:*)
1145219820Sjeff	# From Paul.Green@stratus.com.
1146219820Sjeff	echo hppa1.1-stratus-vos
1147219820Sjeff	exit ;;
1148219820Sjeff    mc68*:A/UX:*:*)
1149219820Sjeff	echo m68k-apple-aux${UNAME_RELEASE}
1150219820Sjeff	exit ;;
1151219820Sjeff    news*:NEWS-OS:6*:*)
1152219820Sjeff	echo mips-sony-newsos6
1153219820Sjeff	exit ;;
1154219820Sjeff    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1155219820Sjeff	if [ -d /usr/nec ]; then
1156219820Sjeff	        echo mips-nec-sysv${UNAME_RELEASE}
1157219820Sjeff	else
1158219820Sjeff	        echo mips-unknown-sysv${UNAME_RELEASE}
1159219820Sjeff	fi
1160219820Sjeff        exit ;;
1161219820Sjeff    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1162219820Sjeff	echo powerpc-be-beos
1163219820Sjeff	exit ;;
1164219820Sjeff    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1165219820Sjeff	echo powerpc-apple-beos
1166219820Sjeff	exit ;;
1167219820Sjeff    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1168219820Sjeff	echo i586-pc-beos
1169219820Sjeff	exit ;;
1170219820Sjeff    SX-4:SUPER-UX:*:*)
1171219820Sjeff	echo sx4-nec-superux${UNAME_RELEASE}
1172219820Sjeff	exit ;;
1173219820Sjeff    SX-5:SUPER-UX:*:*)
1174219820Sjeff	echo sx5-nec-superux${UNAME_RELEASE}
1175219820Sjeff	exit ;;
1176219820Sjeff    SX-6:SUPER-UX:*:*)
1177219820Sjeff	echo sx6-nec-superux${UNAME_RELEASE}
1178219820Sjeff	exit ;;
1179219820Sjeff    Power*:Rhapsody:*:*)
1180219820Sjeff	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1181219820Sjeff	exit ;;
1182219820Sjeff    *:Rhapsody:*:*)
1183219820Sjeff	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1184219820Sjeff	exit ;;
1185219820Sjeff    *:Darwin:*:*)
1186219820Sjeff	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1187219820Sjeff	case $UNAME_PROCESSOR in
1188219820Sjeff	    *86) UNAME_PROCESSOR=i686 ;;
1189219820Sjeff	    unknown) UNAME_PROCESSOR=powerpc ;;
1190219820Sjeff	esac
1191219820Sjeff	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1192219820Sjeff	exit ;;
1193219820Sjeff    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1194219820Sjeff	UNAME_PROCESSOR=`uname -p`
1195219820Sjeff	if test "$UNAME_PROCESSOR" = "x86"; then
1196219820Sjeff		UNAME_PROCESSOR=i386
1197219820Sjeff		UNAME_MACHINE=pc
1198219820Sjeff	fi
1199219820Sjeff	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1200219820Sjeff	exit ;;
1201219820Sjeff    *:QNX:*:4*)
1202219820Sjeff	echo i386-pc-qnx
1203219820Sjeff	exit ;;
1204219820Sjeff    NSE-?:NONSTOP_KERNEL:*:*)
1205219820Sjeff	echo nse-tandem-nsk${UNAME_RELEASE}
1206219820Sjeff	exit ;;
1207219820Sjeff    NSR-?:NONSTOP_KERNEL:*:*)
1208219820Sjeff	echo nsr-tandem-nsk${UNAME_RELEASE}
1209219820Sjeff	exit ;;
1210219820Sjeff    *:NonStop-UX:*:*)
1211219820Sjeff	echo mips-compaq-nonstopux
1212219820Sjeff	exit ;;
1213219820Sjeff    BS2000:POSIX*:*:*)
1214219820Sjeff	echo bs2000-siemens-sysv
1215219820Sjeff	exit ;;
1216219820Sjeff    DS/*:UNIX_System_V:*:*)
1217219820Sjeff	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1218219820Sjeff	exit ;;
1219219820Sjeff    *:Plan9:*:*)
1220219820Sjeff	# "uname -m" is not consistent, so use $cputype instead. 386
1221219820Sjeff	# is converted to i386 for consistency with other x86
1222219820Sjeff	# operating systems.
1223219820Sjeff	if test "$cputype" = "386"; then
1224219820Sjeff	    UNAME_MACHINE=i386
1225219820Sjeff	else
1226219820Sjeff	    UNAME_MACHINE="$cputype"
1227219820Sjeff	fi
1228219820Sjeff	echo ${UNAME_MACHINE}-unknown-plan9
1229219820Sjeff	exit ;;
1230219820Sjeff    *:TOPS-10:*:*)
1231219820Sjeff	echo pdp10-unknown-tops10
1232219820Sjeff	exit ;;
1233219820Sjeff    *:TENEX:*:*)
1234219820Sjeff	echo pdp10-unknown-tenex
1235219820Sjeff	exit ;;
1236219820Sjeff    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1237219820Sjeff	echo pdp10-dec-tops20
1238219820Sjeff	exit ;;
1239219820Sjeff    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1240219820Sjeff	echo pdp10-xkl-tops20
1241219820Sjeff	exit ;;
1242219820Sjeff    *:TOPS-20:*:*)
1243219820Sjeff	echo pdp10-unknown-tops20
1244219820Sjeff	exit ;;
1245219820Sjeff    *:ITS:*:*)
1246219820Sjeff	echo pdp10-unknown-its
1247219820Sjeff	exit ;;
1248219820Sjeff    SEI:*:*:SEIUX)
1249219820Sjeff        echo mips-sei-seiux${UNAME_RELEASE}
1250219820Sjeff	exit ;;
1251219820Sjeff    *:DragonFly:*:*)
1252219820Sjeff	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1253219820Sjeff	exit ;;
1254219820Sjeff    *:*VMS:*:*)
1255219820Sjeff    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1256219820Sjeff	case "${UNAME_MACHINE}" in
1257219820Sjeff	    A*) echo alpha-dec-vms ; exit ;;
1258219820Sjeff	    I*) echo ia64-dec-vms ; exit ;;
1259219820Sjeff	    V*) echo vax-dec-vms ; exit ;;
1260219820Sjeff	esac ;;
1261219820Sjeff    *:XENIX:*:SysV)
1262219820Sjeff	echo i386-pc-xenix
1263219820Sjeff	exit ;;
1264219820Sjeff    i*86:skyos:*:*)
1265219820Sjeff	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1266219820Sjeff	exit ;;
1267219820Sjeffesac
1268219820Sjeff
1269219820Sjeff#echo '(No uname command or uname output not recognized.)' 1>&2
1270219820Sjeff#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1271219820Sjeff
1272219820Sjeffeval $set_cc_for_build
1273219820Sjeffcat >$dummy.c <<EOF
1274219820Sjeff#ifdef _SEQUENT_
1275219820Sjeff# include <sys/types.h>
1276219820Sjeff# include <sys/utsname.h>
1277219820Sjeff#endif
1278219820Sjeffmain ()
1279219820Sjeff{
1280219820Sjeff#if defined (sony)
1281219820Sjeff#if defined (MIPSEB)
1282219820Sjeff  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1283219820Sjeff     I don't know....  */
1284219820Sjeff  printf ("mips-sony-bsd\n"); exit (0);
1285219820Sjeff#else
1286219820Sjeff#include <sys/param.h>
1287219820Sjeff  printf ("m68k-sony-newsos%s\n",
1288219820Sjeff#ifdef NEWSOS4
1289219820Sjeff          "4"
1290219820Sjeff#else
1291219820Sjeff	  ""
1292219820Sjeff#endif
1293219820Sjeff         ); exit (0);
1294219820Sjeff#endif
1295219820Sjeff#endif
1296219820Sjeff
1297219820Sjeff#if defined (__arm) && defined (__acorn) && defined (__unix)
1298219820Sjeff  printf ("arm-acorn-riscix\n"); exit (0);
1299219820Sjeff#endif
1300219820Sjeff
1301219820Sjeff#if defined (hp300) && !defined (hpux)
1302219820Sjeff  printf ("m68k-hp-bsd\n"); exit (0);
1303219820Sjeff#endif
1304219820Sjeff
1305219820Sjeff#if defined (NeXT)
1306219820Sjeff#if !defined (__ARCHITECTURE__)
1307219820Sjeff#define __ARCHITECTURE__ "m68k"
1308219820Sjeff#endif
1309219820Sjeff  int version;
1310219820Sjeff  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1311219820Sjeff  if (version < 4)
1312219820Sjeff    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1313219820Sjeff  else
1314219820Sjeff    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1315219820Sjeff  exit (0);
1316219820Sjeff#endif
1317219820Sjeff
1318219820Sjeff#if defined (MULTIMAX) || defined (n16)
1319219820Sjeff#if defined (UMAXV)
1320219820Sjeff  printf ("ns32k-encore-sysv\n"); exit (0);
1321219820Sjeff#else
1322219820Sjeff#if defined (CMU)
1323219820Sjeff  printf ("ns32k-encore-mach\n"); exit (0);
1324219820Sjeff#else
1325219820Sjeff  printf ("ns32k-encore-bsd\n"); exit (0);
1326219820Sjeff#endif
1327219820Sjeff#endif
1328219820Sjeff#endif
1329219820Sjeff
1330219820Sjeff#if defined (__386BSD__)
1331219820Sjeff  printf ("i386-pc-bsd\n"); exit (0);
1332219820Sjeff#endif
1333219820Sjeff
1334219820Sjeff#if defined (sequent)
1335219820Sjeff#if defined (i386)
1336219820Sjeff  printf ("i386-sequent-dynix\n"); exit (0);
1337219820Sjeff#endif
1338219820Sjeff#if defined (ns32000)
1339219820Sjeff  printf ("ns32k-sequent-dynix\n"); exit (0);
1340219820Sjeff#endif
1341219820Sjeff#endif
1342219820Sjeff
1343219820Sjeff#if defined (_SEQUENT_)
1344219820Sjeff    struct utsname un;
1345219820Sjeff
1346219820Sjeff    uname(&un);
1347219820Sjeff
1348219820Sjeff    if (strncmp(un.version, "V2", 2) == 0) {
1349219820Sjeff	printf ("i386-sequent-ptx2\n"); exit (0);
1350219820Sjeff    }
1351219820Sjeff    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1352219820Sjeff	printf ("i386-sequent-ptx1\n"); exit (0);
1353219820Sjeff    }
1354219820Sjeff    printf ("i386-sequent-ptx\n"); exit (0);
1355219820Sjeff
1356219820Sjeff#endif
1357219820Sjeff
1358219820Sjeff#if defined (vax)
1359219820Sjeff# if !defined (ultrix)
1360219820Sjeff#  include <sys/param.h>
1361219820Sjeff#  if defined (BSD)
1362219820Sjeff#   if BSD == 43
1363219820Sjeff      printf ("vax-dec-bsd4.3\n"); exit (0);
1364219820Sjeff#   else
1365219820Sjeff#    if BSD == 199006
1366219820Sjeff      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1367219820Sjeff#    else
1368219820Sjeff      printf ("vax-dec-bsd\n"); exit (0);
1369219820Sjeff#    endif
1370219820Sjeff#   endif
1371219820Sjeff#  else
1372219820Sjeff    printf ("vax-dec-bsd\n"); exit (0);
1373219820Sjeff#  endif
1374219820Sjeff# else
1375219820Sjeff    printf ("vax-dec-ultrix\n"); exit (0);
1376219820Sjeff# endif
1377219820Sjeff#endif
1378219820Sjeff
1379219820Sjeff#if defined (alliant) && defined (i860)
1380219820Sjeff  printf ("i860-alliant-bsd\n"); exit (0);
1381219820Sjeff#endif
1382219820Sjeff
1383219820Sjeff  exit (1);
1384219820Sjeff}
1385219820SjeffEOF
1386219820Sjeff
1387219820Sjeff$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1388219820Sjeff	{ echo "$SYSTEM_NAME"; exit; }
1389219820Sjeff
1390219820Sjeff# Apollos put the system type in the environment.
1391219820Sjeff
1392219820Sjefftest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1393219820Sjeff
1394219820Sjeff# Convex versions that predate uname can use getsysinfo(1)
1395219820Sjeff
1396219820Sjeffif [ -x /usr/convex/getsysinfo ]
1397219820Sjeffthen
1398219820Sjeff    case `getsysinfo -f cpu_type` in
1399219820Sjeff    c1*)
1400219820Sjeff	echo c1-convex-bsd
1401219820Sjeff	exit ;;
1402219820Sjeff    c2*)
1403219820Sjeff	if getsysinfo -f scalar_acc
1404219820Sjeff	then echo c32-convex-bsd
1405219820Sjeff	else echo c2-convex-bsd
1406219820Sjeff	fi
1407219820Sjeff	exit ;;
1408219820Sjeff    c34*)
1409219820Sjeff	echo c34-convex-bsd
1410219820Sjeff	exit ;;
1411219820Sjeff    c38*)
1412219820Sjeff	echo c38-convex-bsd
1413219820Sjeff	exit ;;
1414219820Sjeff    c4*)
1415219820Sjeff	echo c4-convex-bsd
1416219820Sjeff	exit ;;
1417219820Sjeff    esac
1418219820Sjefffi
1419219820Sjeff
1420219820Sjeffcat >&2 <<EOF
1421219820Sjeff$0: unable to guess system type
1422219820Sjeff
1423219820SjeffThis script, last modified $timestamp, has failed to recognize
1424219820Sjeffthe operating system you are using. It is advised that you
1425219820Sjeffdownload the most up to date version of the config scripts from
1426219820Sjeff
1427219820Sjeff  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
1428219820Sjeffand
1429219820Sjeff  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
1430219820Sjeff
1431219820SjeffIf the version you run ($0) is already up to date, please
1432219820Sjeffsend the following data and any information you think might be
1433219820Sjeffpertinent to <config-patches@gnu.org> in order to provide the needed
1434219820Sjeffinformation to handle your system.
1435219820Sjeff
1436219820Sjeffconfig.guess timestamp = $timestamp
1437219820Sjeff
1438219820Sjeffuname -m = `(uname -m) 2>/dev/null || echo unknown`
1439219820Sjeffuname -r = `(uname -r) 2>/dev/null || echo unknown`
1440219820Sjeffuname -s = `(uname -s) 2>/dev/null || echo unknown`
1441219820Sjeffuname -v = `(uname -v) 2>/dev/null || echo unknown`
1442219820Sjeff
1443219820Sjeff/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1444219820Sjeff/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1445219820Sjeff
1446219820Sjeffhostinfo               = `(hostinfo) 2>/dev/null`
1447219820Sjeff/bin/universe          = `(/bin/universe) 2>/dev/null`
1448219820Sjeff/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1449219820Sjeff/bin/arch              = `(/bin/arch) 2>/dev/null`
1450219820Sjeff/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1451219820Sjeff/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1452219820Sjeff
1453219820SjeffUNAME_MACHINE = ${UNAME_MACHINE}
1454219820SjeffUNAME_RELEASE = ${UNAME_RELEASE}
1455219820SjeffUNAME_SYSTEM  = ${UNAME_SYSTEM}
1456219820SjeffUNAME_VERSION = ${UNAME_VERSION}
1457219820SjeffEOF
1458219820Sjeff
1459219820Sjeffexit 1
1460219820Sjeff
1461219820Sjeff# Local variables:
1462219820Sjeff# eval: (add-hook 'write-file-hooks 'time-stamp)
1463219820Sjeff# time-stamp-start: "timestamp='"
1464219820Sjeff# time-stamp-format: "%:y-%02m-%02d"
1465219820Sjeff# time-stamp-end: "'"
1466219820Sjeff# End:
1467