1428d7b3dSmrg#! /bin/sh
2428d7b3dSmrg# Attempt to guess a canonical system name.
3428d7b3dSmrg#   Copyright 1992-2013 Free Software Foundation, Inc.
4428d7b3dSmrg
5428d7b3dSmrgtimestamp='2013-06-10'
6428d7b3dSmrg
7428d7b3dSmrg# This file is free software; you can redistribute it and/or modify it
8428d7b3dSmrg# under the terms of the GNU General Public License as published by
9428d7b3dSmrg# the Free Software Foundation; either version 3 of the License, or
10428d7b3dSmrg# (at your option) any later version.
11428d7b3dSmrg#
12428d7b3dSmrg# This program is distributed in the hope that it will be useful, but
13428d7b3dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
14428d7b3dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15428d7b3dSmrg# General Public License for more details.
16428d7b3dSmrg#
17428d7b3dSmrg# You should have received a copy of the GNU General Public License
18428d7b3dSmrg# along with this program; if not, see <http://www.gnu.org/licenses/>.
19428d7b3dSmrg#
20428d7b3dSmrg# As a special exception to the GNU General Public License, if you
21428d7b3dSmrg# distribute this file as part of a program that contains a
22428d7b3dSmrg# configuration script generated by Autoconf, you may include it under
23428d7b3dSmrg# the same distribution terms that you use for the rest of that
24428d7b3dSmrg# program.  This Exception is an additional permission under section 7
25428d7b3dSmrg# of the GNU General Public License, version 3 ("GPLv3").
26428d7b3dSmrg#
27428d7b3dSmrg# Originally written by Per Bothner.
28428d7b3dSmrg#
29428d7b3dSmrg# You can get the latest version of this script from:
30428d7b3dSmrg# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
31428d7b3dSmrg#
32428d7b3dSmrg# Please send patches with a ChangeLog entry to config-patches@gnu.org.
33428d7b3dSmrg
34428d7b3dSmrg
35428d7b3dSmrgme=`echo "$0" | sed -e 's,.*/,,'`
36428d7b3dSmrg
37428d7b3dSmrgusage="\
38428d7b3dSmrgUsage: $0 [OPTION]
39428d7b3dSmrg
40428d7b3dSmrgOutput the configuration name of the system \`$me' is run on.
41428d7b3dSmrg
42428d7b3dSmrgOperation modes:
43428d7b3dSmrg  -h, --help         print this help, then exit
44428d7b3dSmrg  -t, --time-stamp   print date of last modification, then exit
45428d7b3dSmrg  -v, --version      print version number, then exit
46428d7b3dSmrg
47428d7b3dSmrgReport bugs and patches to <config-patches@gnu.org>."
48428d7b3dSmrg
49428d7b3dSmrgversion="\
50428d7b3dSmrgGNU config.guess ($timestamp)
51428d7b3dSmrg
52428d7b3dSmrgOriginally written by Per Bothner.
53428d7b3dSmrgCopyright 1992-2013 Free Software Foundation, Inc.
54428d7b3dSmrg
55428d7b3dSmrgThis is free software; see the source for copying conditions.  There is NO
56428d7b3dSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
57428d7b3dSmrg
58428d7b3dSmrghelp="
59428d7b3dSmrgTry \`$me --help' for more information."
60428d7b3dSmrg
61428d7b3dSmrg# Parse command line
62428d7b3dSmrgwhile test $# -gt 0 ; do
63428d7b3dSmrg  case $1 in
64428d7b3dSmrg    --time-stamp | --time* | -t )
65428d7b3dSmrg       echo "$timestamp" ; exit ;;
66428d7b3dSmrg    --version | -v )
67428d7b3dSmrg       echo "$version" ; exit ;;
68428d7b3dSmrg    --help | --h* | -h )
69428d7b3dSmrg       echo "$usage"; exit ;;
70428d7b3dSmrg    -- )     # Stop option processing
71428d7b3dSmrg       shift; break ;;
72428d7b3dSmrg    - )	# Use stdin as input.
73428d7b3dSmrg       break ;;
74428d7b3dSmrg    -* )
75428d7b3dSmrg       echo "$me: invalid option $1$help" >&2
76428d7b3dSmrg       exit 1 ;;
77428d7b3dSmrg    * )
78428d7b3dSmrg       break ;;
79428d7b3dSmrg  esac
80428d7b3dSmrgdone
81428d7b3dSmrg
82428d7b3dSmrgif test $# != 0; then
83428d7b3dSmrg  echo "$me: too many arguments$help" >&2
84428d7b3dSmrg  exit 1
85428d7b3dSmrgfi
86428d7b3dSmrg
87428d7b3dSmrgtrap 'exit 1' 1 2 15
88428d7b3dSmrg
89428d7b3dSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
90428d7b3dSmrg# compiler to aid in system detection is discouraged as it requires
91428d7b3dSmrg# temporary files to be created and, as you can see below, it is a
92428d7b3dSmrg# headache to deal with in a portable fashion.
93428d7b3dSmrg
94428d7b3dSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
95428d7b3dSmrg# use `HOST_CC' if defined, but it is deprecated.
96428d7b3dSmrg
97428d7b3dSmrg# Portable tmp directory creation inspired by the Autoconf team.
98428d7b3dSmrg
99428d7b3dSmrgset_cc_for_build='
100428d7b3dSmrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
101428d7b3dSmrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
102428d7b3dSmrg: ${TMPDIR=/tmp} ;
103428d7b3dSmrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
104428d7b3dSmrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
105428d7b3dSmrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
106428d7b3dSmrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
107428d7b3dSmrgdummy=$tmp/dummy ;
108428d7b3dSmrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
109428d7b3dSmrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
110428d7b3dSmrg ,,)    echo "int x;" > $dummy.c ;
111428d7b3dSmrg	for c in cc gcc c89 c99 ; do
112428d7b3dSmrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
113428d7b3dSmrg	     CC_FOR_BUILD="$c"; break ;
114428d7b3dSmrg	  fi ;
115428d7b3dSmrg	done ;
116428d7b3dSmrg	if test x"$CC_FOR_BUILD" = x ; then
117428d7b3dSmrg	  CC_FOR_BUILD=no_compiler_found ;
118428d7b3dSmrg	fi
119428d7b3dSmrg	;;
120428d7b3dSmrg ,,*)   CC_FOR_BUILD=$CC ;;
121428d7b3dSmrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
122428d7b3dSmrgesac ; set_cc_for_build= ;'
123428d7b3dSmrg
124428d7b3dSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
125428d7b3dSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
126428d7b3dSmrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
127428d7b3dSmrg	PATH=$PATH:/.attbin ; export PATH
128428d7b3dSmrgfi
129428d7b3dSmrg
130428d7b3dSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
131428d7b3dSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
132428d7b3dSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
133428d7b3dSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
134428d7b3dSmrg
135428d7b3dSmrgcase "${UNAME_SYSTEM}" in
136428d7b3dSmrgLinux|GNU|GNU/*)
137428d7b3dSmrg	# If the system lacks a compiler, then just pick glibc.
138428d7b3dSmrg	# We could probably try harder.
139428d7b3dSmrg	LIBC=gnu
140428d7b3dSmrg
141428d7b3dSmrg	eval $set_cc_for_build
142428d7b3dSmrg	cat <<-EOF > $dummy.c
143428d7b3dSmrg	#include <features.h>
144428d7b3dSmrg	#if defined(__UCLIBC__)
145428d7b3dSmrg	LIBC=uclibc
146428d7b3dSmrg	#elif defined(__dietlibc__)
147428d7b3dSmrg	LIBC=dietlibc
148428d7b3dSmrg	#else
149428d7b3dSmrg	LIBC=gnu
150428d7b3dSmrg	#endif
151428d7b3dSmrg	EOF
152428d7b3dSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
153428d7b3dSmrg	;;
154428d7b3dSmrgesac
155428d7b3dSmrg
156428d7b3dSmrg# Note: order is significant - the case branches are not exclusive.
157428d7b3dSmrg
158428d7b3dSmrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
159428d7b3dSmrg    *:NetBSD:*:*)
160428d7b3dSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
161428d7b3dSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
162428d7b3dSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
163428d7b3dSmrg	# switched to ELF, *-*-netbsd* would select the old
164428d7b3dSmrg	# object file format.  This provides both forward
165428d7b3dSmrg	# compatibility and a consistent mechanism for selecting the
166428d7b3dSmrg	# object file format.
167428d7b3dSmrg	#
168428d7b3dSmrg	# Note: NetBSD doesn't particularly care about the vendor
169428d7b3dSmrg	# portion of the name.  We always set it to "unknown".
170428d7b3dSmrg	sysctl="sysctl -n hw.machine_arch"
171428d7b3dSmrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
172428d7b3dSmrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
173428d7b3dSmrg	case "${UNAME_MACHINE_ARCH}" in
174428d7b3dSmrg	    armeb) machine=armeb-unknown ;;
175428d7b3dSmrg	    arm*) machine=arm-unknown ;;
176428d7b3dSmrg	    sh3el) machine=shl-unknown ;;
177428d7b3dSmrg	    sh3eb) machine=sh-unknown ;;
178428d7b3dSmrg	    sh5el) machine=sh5le-unknown ;;
179428d7b3dSmrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
180428d7b3dSmrg	esac
181428d7b3dSmrg	# The Operating System including object format, if it has switched
182428d7b3dSmrg	# to ELF recently, or will in the future.
183428d7b3dSmrg	case "${UNAME_MACHINE_ARCH}" in
184428d7b3dSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
185428d7b3dSmrg		eval $set_cc_for_build
186428d7b3dSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
187428d7b3dSmrg			| grep -q __ELF__
188428d7b3dSmrg		then
189428d7b3dSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
190428d7b3dSmrg		    # Return netbsd for either.  FIX?
191428d7b3dSmrg		    os=netbsd
192428d7b3dSmrg		else
193428d7b3dSmrg		    os=netbsdelf
194428d7b3dSmrg		fi
195428d7b3dSmrg		;;
196428d7b3dSmrg	    *)
197428d7b3dSmrg		os=netbsd
198428d7b3dSmrg		;;
199428d7b3dSmrg	esac
200428d7b3dSmrg	# The OS release
201428d7b3dSmrg	# Debian GNU/NetBSD machines have a different userland, and
202428d7b3dSmrg	# thus, need a distinct triplet. However, they do not need
203428d7b3dSmrg	# kernel version information, so it can be replaced with a
204428d7b3dSmrg	# suitable tag, in the style of linux-gnu.
205428d7b3dSmrg	case "${UNAME_VERSION}" in
206428d7b3dSmrg	    Debian*)
207428d7b3dSmrg		release='-gnu'
208428d7b3dSmrg		;;
209428d7b3dSmrg	    *)
210428d7b3dSmrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
211428d7b3dSmrg		;;
212428d7b3dSmrg	esac
213428d7b3dSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
214428d7b3dSmrg	# contains redundant information, the shorter form:
215428d7b3dSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
216428d7b3dSmrg	echo "${machine}-${os}${release}"
217428d7b3dSmrg	exit ;;
218428d7b3dSmrg    *:Bitrig:*:*)
219428d7b3dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
220428d7b3dSmrg	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
221428d7b3dSmrg	exit ;;
222428d7b3dSmrg    *:OpenBSD:*:*)
223428d7b3dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
224428d7b3dSmrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
225428d7b3dSmrg	exit ;;
226428d7b3dSmrg    *:ekkoBSD:*:*)
227428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
228428d7b3dSmrg	exit ;;
229428d7b3dSmrg    *:SolidBSD:*:*)
230428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
231428d7b3dSmrg	exit ;;
232428d7b3dSmrg    macppc:MirBSD:*:*)
233428d7b3dSmrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
234428d7b3dSmrg	exit ;;
235428d7b3dSmrg    *:MirBSD:*:*)
236428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
237428d7b3dSmrg	exit ;;
238428d7b3dSmrg    alpha:OSF1:*:*)
239428d7b3dSmrg	case $UNAME_RELEASE in
240428d7b3dSmrg	*4.0)
241428d7b3dSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
242428d7b3dSmrg		;;
243428d7b3dSmrg	*5.*)
244428d7b3dSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
245428d7b3dSmrg		;;
246428d7b3dSmrg	esac
247428d7b3dSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
248428d7b3dSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
249428d7b3dSmrg	# covers most systems running today.  This code pipes the CPU
250428d7b3dSmrg	# types through head -n 1, so we only detect the type of CPU 0.
251428d7b3dSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
252428d7b3dSmrg	case "$ALPHA_CPU_TYPE" in
253428d7b3dSmrg	    "EV4 (21064)")
254428d7b3dSmrg		UNAME_MACHINE="alpha" ;;
255428d7b3dSmrg	    "EV4.5 (21064)")
256428d7b3dSmrg		UNAME_MACHINE="alpha" ;;
257428d7b3dSmrg	    "LCA4 (21066/21068)")
258428d7b3dSmrg		UNAME_MACHINE="alpha" ;;
259428d7b3dSmrg	    "EV5 (21164)")
260428d7b3dSmrg		UNAME_MACHINE="alphaev5" ;;
261428d7b3dSmrg	    "EV5.6 (21164A)")
262428d7b3dSmrg		UNAME_MACHINE="alphaev56" ;;
263428d7b3dSmrg	    "EV5.6 (21164PC)")
264428d7b3dSmrg		UNAME_MACHINE="alphapca56" ;;
265428d7b3dSmrg	    "EV5.7 (21164PC)")
266428d7b3dSmrg		UNAME_MACHINE="alphapca57" ;;
267428d7b3dSmrg	    "EV6 (21264)")
268428d7b3dSmrg		UNAME_MACHINE="alphaev6" ;;
269428d7b3dSmrg	    "EV6.7 (21264A)")
270428d7b3dSmrg		UNAME_MACHINE="alphaev67" ;;
271428d7b3dSmrg	    "EV6.8CB (21264C)")
272428d7b3dSmrg		UNAME_MACHINE="alphaev68" ;;
273428d7b3dSmrg	    "EV6.8AL (21264B)")
274428d7b3dSmrg		UNAME_MACHINE="alphaev68" ;;
275428d7b3dSmrg	    "EV6.8CX (21264D)")
276428d7b3dSmrg		UNAME_MACHINE="alphaev68" ;;
277428d7b3dSmrg	    "EV6.9A (21264/EV69A)")
278428d7b3dSmrg		UNAME_MACHINE="alphaev69" ;;
279428d7b3dSmrg	    "EV7 (21364)")
280428d7b3dSmrg		UNAME_MACHINE="alphaev7" ;;
281428d7b3dSmrg	    "EV7.9 (21364A)")
282428d7b3dSmrg		UNAME_MACHINE="alphaev79" ;;
283428d7b3dSmrg	esac
284428d7b3dSmrg	# A Pn.n version is a patched version.
285428d7b3dSmrg	# A Vn.n version is a released version.
286428d7b3dSmrg	# A Tn.n version is a released field test version.
287428d7b3dSmrg	# A Xn.n version is an unreleased experimental baselevel.
288428d7b3dSmrg	# 1.2 uses "1.2" for uname -r.
289428d7b3dSmrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
290428d7b3dSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
291428d7b3dSmrg	exitcode=$?
292428d7b3dSmrg	trap '' 0
293428d7b3dSmrg	exit $exitcode ;;
294428d7b3dSmrg    Alpha\ *:Windows_NT*:*)
295428d7b3dSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
296428d7b3dSmrg	# Should we change UNAME_MACHINE based on the output of uname instead
297428d7b3dSmrg	# of the specific Alpha model?
298428d7b3dSmrg	echo alpha-pc-interix
299428d7b3dSmrg	exit ;;
300428d7b3dSmrg    21064:Windows_NT:50:3)
301428d7b3dSmrg	echo alpha-dec-winnt3.5
302428d7b3dSmrg	exit ;;
303428d7b3dSmrg    Amiga*:UNIX_System_V:4.0:*)
304428d7b3dSmrg	echo m68k-unknown-sysv4
305428d7b3dSmrg	exit ;;
306428d7b3dSmrg    *:[Aa]miga[Oo][Ss]:*:*)
307428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-amigaos
308428d7b3dSmrg	exit ;;
309428d7b3dSmrg    *:[Mm]orph[Oo][Ss]:*:*)
310428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-morphos
311428d7b3dSmrg	exit ;;
312428d7b3dSmrg    *:OS/390:*:*)
313428d7b3dSmrg	echo i370-ibm-openedition
314428d7b3dSmrg	exit ;;
315428d7b3dSmrg    *:z/VM:*:*)
316428d7b3dSmrg	echo s390-ibm-zvmoe
317428d7b3dSmrg	exit ;;
318428d7b3dSmrg    *:OS400:*:*)
319428d7b3dSmrg	echo powerpc-ibm-os400
320428d7b3dSmrg	exit ;;
321428d7b3dSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
322428d7b3dSmrg	echo arm-acorn-riscix${UNAME_RELEASE}
323428d7b3dSmrg	exit ;;
324428d7b3dSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
325428d7b3dSmrg	echo arm-unknown-riscos
326428d7b3dSmrg	exit ;;
327428d7b3dSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
328428d7b3dSmrg	echo hppa1.1-hitachi-hiuxmpp
329428d7b3dSmrg	exit ;;
330428d7b3dSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
331428d7b3dSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
332428d7b3dSmrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
333428d7b3dSmrg		echo pyramid-pyramid-sysv3
334428d7b3dSmrg	else
335428d7b3dSmrg		echo pyramid-pyramid-bsd
336428d7b3dSmrg	fi
337428d7b3dSmrg	exit ;;
338428d7b3dSmrg    NILE*:*:*:dcosx)
339428d7b3dSmrg	echo pyramid-pyramid-svr4
340428d7b3dSmrg	exit ;;
341428d7b3dSmrg    DRS?6000:unix:4.0:6*)
342428d7b3dSmrg	echo sparc-icl-nx6
343428d7b3dSmrg	exit ;;
344428d7b3dSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
345428d7b3dSmrg	case `/usr/bin/uname -p` in
346428d7b3dSmrg	    sparc) echo sparc-icl-nx7; exit ;;
347428d7b3dSmrg	esac ;;
348428d7b3dSmrg    s390x:SunOS:*:*)
349428d7b3dSmrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
350428d7b3dSmrg	exit ;;
351428d7b3dSmrg    sun4H:SunOS:5.*:*)
352428d7b3dSmrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
353428d7b3dSmrg	exit ;;
354428d7b3dSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
355428d7b3dSmrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
356428d7b3dSmrg	exit ;;
357428d7b3dSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
358428d7b3dSmrg	echo i386-pc-auroraux${UNAME_RELEASE}
359428d7b3dSmrg	exit ;;
360428d7b3dSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
361428d7b3dSmrg	eval $set_cc_for_build
362428d7b3dSmrg	SUN_ARCH="i386"
363428d7b3dSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
364428d7b3dSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
365428d7b3dSmrg	# This test works for both compilers.
366428d7b3dSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
367428d7b3dSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
368428d7b3dSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
369428d7b3dSmrg		grep IS_64BIT_ARCH >/dev/null
370428d7b3dSmrg	    then
371428d7b3dSmrg		SUN_ARCH="x86_64"
372428d7b3dSmrg	    fi
373428d7b3dSmrg	fi
374428d7b3dSmrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
375428d7b3dSmrg	exit ;;
376428d7b3dSmrg    sun4*:SunOS:6*:*)
377428d7b3dSmrg	# According to config.sub, this is the proper way to canonicalize
378428d7b3dSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
379428d7b3dSmrg	# it's likely to be more like Solaris than SunOS4.
380428d7b3dSmrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
381428d7b3dSmrg	exit ;;
382428d7b3dSmrg    sun4*:SunOS:*:*)
383428d7b3dSmrg	case "`/usr/bin/arch -k`" in
384428d7b3dSmrg	    Series*|S4*)
385428d7b3dSmrg		UNAME_RELEASE=`uname -v`
386428d7b3dSmrg		;;
387428d7b3dSmrg	esac
388428d7b3dSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
389428d7b3dSmrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
390428d7b3dSmrg	exit ;;
391428d7b3dSmrg    sun3*:SunOS:*:*)
392428d7b3dSmrg	echo m68k-sun-sunos${UNAME_RELEASE}
393428d7b3dSmrg	exit ;;
394428d7b3dSmrg    sun*:*:4.2BSD:*)
395428d7b3dSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
396428d7b3dSmrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
397428d7b3dSmrg	case "`/bin/arch`" in
398428d7b3dSmrg	    sun3)
399428d7b3dSmrg		echo m68k-sun-sunos${UNAME_RELEASE}
400428d7b3dSmrg		;;
401428d7b3dSmrg	    sun4)
402428d7b3dSmrg		echo sparc-sun-sunos${UNAME_RELEASE}
403428d7b3dSmrg		;;
404428d7b3dSmrg	esac
405428d7b3dSmrg	exit ;;
406428d7b3dSmrg    aushp:SunOS:*:*)
407428d7b3dSmrg	echo sparc-auspex-sunos${UNAME_RELEASE}
408428d7b3dSmrg	exit ;;
409428d7b3dSmrg    # The situation for MiNT is a little confusing.  The machine name
410428d7b3dSmrg    # can be virtually everything (everything which is not
411428d7b3dSmrg    # "atarist" or "atariste" at least should have a processor
412428d7b3dSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
413428d7b3dSmrg    # to the lowercase version "mint" (or "freemint").  Finally
414428d7b3dSmrg    # the system name "TOS" denotes a system which is actually not
415428d7b3dSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
416428d7b3dSmrg    # be no problem.
417428d7b3dSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
418428d7b3dSmrg	echo m68k-atari-mint${UNAME_RELEASE}
419428d7b3dSmrg	exit ;;
420428d7b3dSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
421428d7b3dSmrg	echo m68k-atari-mint${UNAME_RELEASE}
422428d7b3dSmrg	exit ;;
423428d7b3dSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
424428d7b3dSmrg	echo m68k-atari-mint${UNAME_RELEASE}
425428d7b3dSmrg	exit ;;
426428d7b3dSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
427428d7b3dSmrg	echo m68k-milan-mint${UNAME_RELEASE}
428428d7b3dSmrg	exit ;;
429428d7b3dSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
430428d7b3dSmrg	echo m68k-hades-mint${UNAME_RELEASE}
431428d7b3dSmrg	exit ;;
432428d7b3dSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
433428d7b3dSmrg	echo m68k-unknown-mint${UNAME_RELEASE}
434428d7b3dSmrg	exit ;;
435428d7b3dSmrg    m68k:machten:*:*)
436428d7b3dSmrg	echo m68k-apple-machten${UNAME_RELEASE}
437428d7b3dSmrg	exit ;;
438428d7b3dSmrg    powerpc:machten:*:*)
439428d7b3dSmrg	echo powerpc-apple-machten${UNAME_RELEASE}
440428d7b3dSmrg	exit ;;
441428d7b3dSmrg    RISC*:Mach:*:*)
442428d7b3dSmrg	echo mips-dec-mach_bsd4.3
443428d7b3dSmrg	exit ;;
444428d7b3dSmrg    RISC*:ULTRIX:*:*)
445428d7b3dSmrg	echo mips-dec-ultrix${UNAME_RELEASE}
446428d7b3dSmrg	exit ;;
447428d7b3dSmrg    VAX*:ULTRIX*:*:*)
448428d7b3dSmrg	echo vax-dec-ultrix${UNAME_RELEASE}
449428d7b3dSmrg	exit ;;
450428d7b3dSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
451428d7b3dSmrg	echo clipper-intergraph-clix${UNAME_RELEASE}
452428d7b3dSmrg	exit ;;
453428d7b3dSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
454428d7b3dSmrg	eval $set_cc_for_build
455428d7b3dSmrg	sed 's/^	//' << EOF >$dummy.c
456428d7b3dSmrg#ifdef __cplusplus
457428d7b3dSmrg#include <stdio.h>  /* for printf() prototype */
458428d7b3dSmrg	int main (int argc, char *argv[]) {
459428d7b3dSmrg#else
460428d7b3dSmrg	int main (argc, argv) int argc; char *argv[]; {
461428d7b3dSmrg#endif
462428d7b3dSmrg	#if defined (host_mips) && defined (MIPSEB)
463428d7b3dSmrg	#if defined (SYSTYPE_SYSV)
464428d7b3dSmrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
465428d7b3dSmrg	#endif
466428d7b3dSmrg	#if defined (SYSTYPE_SVR4)
467428d7b3dSmrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
468428d7b3dSmrg	#endif
469428d7b3dSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
470428d7b3dSmrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
471428d7b3dSmrg	#endif
472428d7b3dSmrg	#endif
473428d7b3dSmrg	  exit (-1);
474428d7b3dSmrg	}
475428d7b3dSmrgEOF
476428d7b3dSmrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
477428d7b3dSmrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
478428d7b3dSmrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
479428d7b3dSmrg	    { echo "$SYSTEM_NAME"; exit; }
480428d7b3dSmrg	echo mips-mips-riscos${UNAME_RELEASE}
481428d7b3dSmrg	exit ;;
482428d7b3dSmrg    Motorola:PowerMAX_OS:*:*)
483428d7b3dSmrg	echo powerpc-motorola-powermax
484428d7b3dSmrg	exit ;;
485428d7b3dSmrg    Motorola:*:4.3:PL8-*)
486428d7b3dSmrg	echo powerpc-harris-powermax
487428d7b3dSmrg	exit ;;
488428d7b3dSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
489428d7b3dSmrg	echo powerpc-harris-powermax
490428d7b3dSmrg	exit ;;
491428d7b3dSmrg    Night_Hawk:Power_UNIX:*:*)
492428d7b3dSmrg	echo powerpc-harris-powerunix
493428d7b3dSmrg	exit ;;
494428d7b3dSmrg    m88k:CX/UX:7*:*)
495428d7b3dSmrg	echo m88k-harris-cxux7
496428d7b3dSmrg	exit ;;
497428d7b3dSmrg    m88k:*:4*:R4*)
498428d7b3dSmrg	echo m88k-motorola-sysv4
499428d7b3dSmrg	exit ;;
500428d7b3dSmrg    m88k:*:3*:R3*)
501428d7b3dSmrg	echo m88k-motorola-sysv3
502428d7b3dSmrg	exit ;;
503428d7b3dSmrg    AViiON:dgux:*:*)
504428d7b3dSmrg	# DG/UX returns AViiON for all architectures
505428d7b3dSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
506428d7b3dSmrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
507428d7b3dSmrg	then
508428d7b3dSmrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
509428d7b3dSmrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
510428d7b3dSmrg	    then
511428d7b3dSmrg		echo m88k-dg-dgux${UNAME_RELEASE}
512428d7b3dSmrg	    else
513428d7b3dSmrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
514428d7b3dSmrg	    fi
515428d7b3dSmrg	else
516428d7b3dSmrg	    echo i586-dg-dgux${UNAME_RELEASE}
517428d7b3dSmrg	fi
518428d7b3dSmrg	exit ;;
519428d7b3dSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
520428d7b3dSmrg	echo m88k-dolphin-sysv3
521428d7b3dSmrg	exit ;;
522428d7b3dSmrg    M88*:*:R3*:*)
523428d7b3dSmrg	# Delta 88k system running SVR3
524428d7b3dSmrg	echo m88k-motorola-sysv3
525428d7b3dSmrg	exit ;;
526428d7b3dSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
527428d7b3dSmrg	echo m88k-tektronix-sysv3
528428d7b3dSmrg	exit ;;
529428d7b3dSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
530428d7b3dSmrg	echo m68k-tektronix-bsd
531428d7b3dSmrg	exit ;;
532428d7b3dSmrg    *:IRIX*:*:*)
533428d7b3dSmrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
534428d7b3dSmrg	exit ;;
535428d7b3dSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
536428d7b3dSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
537428d7b3dSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
538428d7b3dSmrg    i*86:AIX:*:*)
539428d7b3dSmrg	echo i386-ibm-aix
540428d7b3dSmrg	exit ;;
541428d7b3dSmrg    ia64:AIX:*:*)
542428d7b3dSmrg	if [ -x /usr/bin/oslevel ] ; then
543428d7b3dSmrg		IBM_REV=`/usr/bin/oslevel`
544428d7b3dSmrg	else
545428d7b3dSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
546428d7b3dSmrg	fi
547428d7b3dSmrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
548428d7b3dSmrg	exit ;;
549428d7b3dSmrg    *:AIX:2:3)
550428d7b3dSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
551428d7b3dSmrg		eval $set_cc_for_build
552428d7b3dSmrg		sed 's/^		//' << EOF >$dummy.c
553428d7b3dSmrg		#include <sys/systemcfg.h>
554428d7b3dSmrg
555428d7b3dSmrg		main()
556428d7b3dSmrg			{
557428d7b3dSmrg			if (!__power_pc())
558428d7b3dSmrg				exit(1);
559428d7b3dSmrg			puts("powerpc-ibm-aix3.2.5");
560428d7b3dSmrg			exit(0);
561428d7b3dSmrg			}
562428d7b3dSmrgEOF
563428d7b3dSmrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
564428d7b3dSmrg		then
565428d7b3dSmrg			echo "$SYSTEM_NAME"
566428d7b3dSmrg		else
567428d7b3dSmrg			echo rs6000-ibm-aix3.2.5
568428d7b3dSmrg		fi
569428d7b3dSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
570428d7b3dSmrg		echo rs6000-ibm-aix3.2.4
571428d7b3dSmrg	else
572428d7b3dSmrg		echo rs6000-ibm-aix3.2
573428d7b3dSmrg	fi
574428d7b3dSmrg	exit ;;
575428d7b3dSmrg    *:AIX:*:[4567])
576428d7b3dSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
577428d7b3dSmrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
578428d7b3dSmrg		IBM_ARCH=rs6000
579428d7b3dSmrg	else
580428d7b3dSmrg		IBM_ARCH=powerpc
581428d7b3dSmrg	fi
582428d7b3dSmrg	if [ -x /usr/bin/oslevel ] ; then
583428d7b3dSmrg		IBM_REV=`/usr/bin/oslevel`
584428d7b3dSmrg	else
585428d7b3dSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
586428d7b3dSmrg	fi
587428d7b3dSmrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
588428d7b3dSmrg	exit ;;
589428d7b3dSmrg    *:AIX:*:*)
590428d7b3dSmrg	echo rs6000-ibm-aix
591428d7b3dSmrg	exit ;;
592428d7b3dSmrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
593428d7b3dSmrg	echo romp-ibm-bsd4.4
594428d7b3dSmrg	exit ;;
595428d7b3dSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
596428d7b3dSmrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
597428d7b3dSmrg	exit ;;                             # report: romp-ibm BSD 4.3
598428d7b3dSmrg    *:BOSX:*:*)
599428d7b3dSmrg	echo rs6000-bull-bosx
600428d7b3dSmrg	exit ;;
601428d7b3dSmrg    DPX/2?00:B.O.S.:*:*)
602428d7b3dSmrg	echo m68k-bull-sysv3
603428d7b3dSmrg	exit ;;
604428d7b3dSmrg    9000/[34]??:4.3bsd:1.*:*)
605428d7b3dSmrg	echo m68k-hp-bsd
606428d7b3dSmrg	exit ;;
607428d7b3dSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
608428d7b3dSmrg	echo m68k-hp-bsd4.4
609428d7b3dSmrg	exit ;;
610428d7b3dSmrg    9000/[34678]??:HP-UX:*:*)
611428d7b3dSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
612428d7b3dSmrg	case "${UNAME_MACHINE}" in
613428d7b3dSmrg	    9000/31? )            HP_ARCH=m68000 ;;
614428d7b3dSmrg	    9000/[34]?? )         HP_ARCH=m68k ;;
615428d7b3dSmrg	    9000/[678][0-9][0-9])
616428d7b3dSmrg		if [ -x /usr/bin/getconf ]; then
617428d7b3dSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
618428d7b3dSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
619428d7b3dSmrg		    case "${sc_cpu_version}" in
620428d7b3dSmrg		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
621428d7b3dSmrg		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
622428d7b3dSmrg		      532)                      # CPU_PA_RISC2_0
623428d7b3dSmrg			case "${sc_kernel_bits}" in
624428d7b3dSmrg			  32) HP_ARCH="hppa2.0n" ;;
625428d7b3dSmrg			  64) HP_ARCH="hppa2.0w" ;;
626428d7b3dSmrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
627428d7b3dSmrg			esac ;;
628428d7b3dSmrg		    esac
629428d7b3dSmrg		fi
630428d7b3dSmrg		if [ "${HP_ARCH}" = "" ]; then
631428d7b3dSmrg		    eval $set_cc_for_build
632428d7b3dSmrg		    sed 's/^		//' << EOF >$dummy.c
633428d7b3dSmrg
634428d7b3dSmrg		#define _HPUX_SOURCE
635428d7b3dSmrg		#include <stdlib.h>
636428d7b3dSmrg		#include <unistd.h>
637428d7b3dSmrg
638428d7b3dSmrg		int main ()
639428d7b3dSmrg		{
640428d7b3dSmrg		#if defined(_SC_KERNEL_BITS)
641428d7b3dSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
642428d7b3dSmrg		#endif
643428d7b3dSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
644428d7b3dSmrg
645428d7b3dSmrg		    switch (cpu)
646428d7b3dSmrg			{
647428d7b3dSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
648428d7b3dSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
649428d7b3dSmrg			case CPU_PA_RISC2_0:
650428d7b3dSmrg		#if defined(_SC_KERNEL_BITS)
651428d7b3dSmrg			    switch (bits)
652428d7b3dSmrg				{
653428d7b3dSmrg				case 64: puts ("hppa2.0w"); break;
654428d7b3dSmrg				case 32: puts ("hppa2.0n"); break;
655428d7b3dSmrg				default: puts ("hppa2.0"); break;
656428d7b3dSmrg				} break;
657428d7b3dSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
658428d7b3dSmrg			    puts ("hppa2.0"); break;
659428d7b3dSmrg		#endif
660428d7b3dSmrg			default: puts ("hppa1.0"); break;
661428d7b3dSmrg			}
662428d7b3dSmrg		    exit (0);
663428d7b3dSmrg		}
664428d7b3dSmrgEOF
665428d7b3dSmrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
666428d7b3dSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
667428d7b3dSmrg		fi ;;
668428d7b3dSmrg	esac
669428d7b3dSmrg	if [ ${HP_ARCH} = "hppa2.0w" ]
670428d7b3dSmrg	then
671428d7b3dSmrg	    eval $set_cc_for_build
672428d7b3dSmrg
673428d7b3dSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
674428d7b3dSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
675428d7b3dSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
676428d7b3dSmrg	    #
677428d7b3dSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
678428d7b3dSmrg	    # => hppa2.0w-hp-hpux11.23
679428d7b3dSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
680428d7b3dSmrg	    # => hppa64-hp-hpux11.23
681428d7b3dSmrg
682428d7b3dSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
683428d7b3dSmrg		grep -q __LP64__
684428d7b3dSmrg	    then
685428d7b3dSmrg		HP_ARCH="hppa2.0w"
686428d7b3dSmrg	    else
687428d7b3dSmrg		HP_ARCH="hppa64"
688428d7b3dSmrg	    fi
689428d7b3dSmrg	fi
690428d7b3dSmrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
691428d7b3dSmrg	exit ;;
692428d7b3dSmrg    ia64:HP-UX:*:*)
693428d7b3dSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
694428d7b3dSmrg	echo ia64-hp-hpux${HPUX_REV}
695428d7b3dSmrg	exit ;;
696428d7b3dSmrg    3050*:HI-UX:*:*)
697428d7b3dSmrg	eval $set_cc_for_build
698428d7b3dSmrg	sed 's/^	//' << EOF >$dummy.c
699428d7b3dSmrg	#include <unistd.h>
700428d7b3dSmrg	int
701428d7b3dSmrg	main ()
702428d7b3dSmrg	{
703428d7b3dSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
704428d7b3dSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
705428d7b3dSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
706428d7b3dSmrg	     results, however.  */
707428d7b3dSmrg	  if (CPU_IS_PA_RISC (cpu))
708428d7b3dSmrg	    {
709428d7b3dSmrg	      switch (cpu)
710428d7b3dSmrg		{
711428d7b3dSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
712428d7b3dSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
713428d7b3dSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
714428d7b3dSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
715428d7b3dSmrg		}
716428d7b3dSmrg	    }
717428d7b3dSmrg	  else if (CPU_IS_HP_MC68K (cpu))
718428d7b3dSmrg	    puts ("m68k-hitachi-hiuxwe2");
719428d7b3dSmrg	  else puts ("unknown-hitachi-hiuxwe2");
720428d7b3dSmrg	  exit (0);
721428d7b3dSmrg	}
722428d7b3dSmrgEOF
723428d7b3dSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
724428d7b3dSmrg		{ echo "$SYSTEM_NAME"; exit; }
725428d7b3dSmrg	echo unknown-hitachi-hiuxwe2
726428d7b3dSmrg	exit ;;
727428d7b3dSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
728428d7b3dSmrg	echo hppa1.1-hp-bsd
729428d7b3dSmrg	exit ;;
730428d7b3dSmrg    9000/8??:4.3bsd:*:*)
731428d7b3dSmrg	echo hppa1.0-hp-bsd
732428d7b3dSmrg	exit ;;
733428d7b3dSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
734428d7b3dSmrg	echo hppa1.0-hp-mpeix
735428d7b3dSmrg	exit ;;
736428d7b3dSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
737428d7b3dSmrg	echo hppa1.1-hp-osf
738428d7b3dSmrg	exit ;;
739428d7b3dSmrg    hp8??:OSF1:*:*)
740428d7b3dSmrg	echo hppa1.0-hp-osf
741428d7b3dSmrg	exit ;;
742428d7b3dSmrg    i*86:OSF1:*:*)
743428d7b3dSmrg	if [ -x /usr/sbin/sysversion ] ; then
744428d7b3dSmrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
745428d7b3dSmrg	else
746428d7b3dSmrg	    echo ${UNAME_MACHINE}-unknown-osf1
747428d7b3dSmrg	fi
748428d7b3dSmrg	exit ;;
749428d7b3dSmrg    parisc*:Lites*:*:*)
750428d7b3dSmrg	echo hppa1.1-hp-lites
751428d7b3dSmrg	exit ;;
752428d7b3dSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
753428d7b3dSmrg	echo c1-convex-bsd
754428d7b3dSmrg	exit ;;
755428d7b3dSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
756428d7b3dSmrg	if getsysinfo -f scalar_acc
757428d7b3dSmrg	then echo c32-convex-bsd
758428d7b3dSmrg	else echo c2-convex-bsd
759428d7b3dSmrg	fi
760428d7b3dSmrg	exit ;;
761428d7b3dSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
762428d7b3dSmrg	echo c34-convex-bsd
763428d7b3dSmrg	exit ;;
764428d7b3dSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
765428d7b3dSmrg	echo c38-convex-bsd
766428d7b3dSmrg	exit ;;
767428d7b3dSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
768428d7b3dSmrg	echo c4-convex-bsd
769428d7b3dSmrg	exit ;;
770428d7b3dSmrg    CRAY*Y-MP:*:*:*)
771428d7b3dSmrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
772428d7b3dSmrg	exit ;;
773428d7b3dSmrg    CRAY*[A-Z]90:*:*:*)
774428d7b3dSmrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
775428d7b3dSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
776428d7b3dSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
777428d7b3dSmrg	      -e 's/\.[^.]*$/.X/'
778428d7b3dSmrg	exit ;;
779428d7b3dSmrg    CRAY*TS:*:*:*)
780428d7b3dSmrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
781428d7b3dSmrg	exit ;;
782428d7b3dSmrg    CRAY*T3E:*:*:*)
783428d7b3dSmrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
784428d7b3dSmrg	exit ;;
785428d7b3dSmrg    CRAY*SV1:*:*:*)
786428d7b3dSmrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
787428d7b3dSmrg	exit ;;
788428d7b3dSmrg    *:UNICOS/mp:*:*)
789428d7b3dSmrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
790428d7b3dSmrg	exit ;;
791428d7b3dSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
792428d7b3dSmrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
793428d7b3dSmrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
794428d7b3dSmrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
795428d7b3dSmrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
796428d7b3dSmrg	exit ;;
797428d7b3dSmrg    5000:UNIX_System_V:4.*:*)
798428d7b3dSmrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
799428d7b3dSmrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
800428d7b3dSmrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
801428d7b3dSmrg	exit ;;
802428d7b3dSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
803428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
804428d7b3dSmrg	exit ;;
805428d7b3dSmrg    sparc*:BSD/OS:*:*)
806428d7b3dSmrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
807428d7b3dSmrg	exit ;;
808428d7b3dSmrg    *:BSD/OS:*:*)
809428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
810428d7b3dSmrg	exit ;;
811428d7b3dSmrg    *:FreeBSD:*:*)
812428d7b3dSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
813428d7b3dSmrg	case ${UNAME_PROCESSOR} in
814428d7b3dSmrg	    amd64)
815428d7b3dSmrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
816428d7b3dSmrg	    *)
817428d7b3dSmrg		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
818428d7b3dSmrg	esac
819428d7b3dSmrg	exit ;;
820428d7b3dSmrg    i*:CYGWIN*:*)
821428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-cygwin
822428d7b3dSmrg	exit ;;
823428d7b3dSmrg    *:MINGW64*:*)
824428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-mingw64
825428d7b3dSmrg	exit ;;
826428d7b3dSmrg    *:MINGW*:*)
827428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-mingw32
828428d7b3dSmrg	exit ;;
829428d7b3dSmrg    i*:MSYS*:*)
830428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-msys
831428d7b3dSmrg	exit ;;
832428d7b3dSmrg    i*:windows32*:*)
833428d7b3dSmrg	# uname -m includes "-pc" on this system.
834428d7b3dSmrg	echo ${UNAME_MACHINE}-mingw32
835428d7b3dSmrg	exit ;;
836428d7b3dSmrg    i*:PW*:*)
837428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-pw32
838428d7b3dSmrg	exit ;;
839428d7b3dSmrg    *:Interix*:*)
840428d7b3dSmrg	case ${UNAME_MACHINE} in
841428d7b3dSmrg	    x86)
842428d7b3dSmrg		echo i586-pc-interix${UNAME_RELEASE}
843428d7b3dSmrg		exit ;;
844428d7b3dSmrg	    authenticamd | genuineintel | EM64T)
845428d7b3dSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
846428d7b3dSmrg		exit ;;
847428d7b3dSmrg	    IA64)
848428d7b3dSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
849428d7b3dSmrg		exit ;;
850428d7b3dSmrg	esac ;;
851428d7b3dSmrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
852428d7b3dSmrg	echo i${UNAME_MACHINE}-pc-mks
853428d7b3dSmrg	exit ;;
854428d7b3dSmrg    8664:Windows_NT:*)
855428d7b3dSmrg	echo x86_64-pc-mks
856428d7b3dSmrg	exit ;;
857428d7b3dSmrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
858428d7b3dSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
859428d7b3dSmrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
860428d7b3dSmrg	# UNAME_MACHINE based on the output of uname instead of i386?
861428d7b3dSmrg	echo i586-pc-interix
862428d7b3dSmrg	exit ;;
863428d7b3dSmrg    i*:UWIN*:*)
864428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-uwin
865428d7b3dSmrg	exit ;;
866428d7b3dSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
867428d7b3dSmrg	echo x86_64-unknown-cygwin
868428d7b3dSmrg	exit ;;
869428d7b3dSmrg    p*:CYGWIN*:*)
870428d7b3dSmrg	echo powerpcle-unknown-cygwin
871428d7b3dSmrg	exit ;;
872428d7b3dSmrg    prep*:SunOS:5.*:*)
873428d7b3dSmrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
874428d7b3dSmrg	exit ;;
875428d7b3dSmrg    *:GNU:*:*)
876428d7b3dSmrg	# the GNU system
877428d7b3dSmrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
878428d7b3dSmrg	exit ;;
879428d7b3dSmrg    *:GNU/*:*:*)
880428d7b3dSmrg	# other systems with GNU libc and userland
881428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
882428d7b3dSmrg	exit ;;
883428d7b3dSmrg    i*86:Minix:*:*)
884428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-minix
885428d7b3dSmrg	exit ;;
886428d7b3dSmrg    aarch64:Linux:*:*)
887428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
888428d7b3dSmrg	exit ;;
889428d7b3dSmrg    aarch64_be:Linux:*:*)
890428d7b3dSmrg	UNAME_MACHINE=aarch64_be
891428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
892428d7b3dSmrg	exit ;;
893428d7b3dSmrg    alpha:Linux:*:*)
894428d7b3dSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
895428d7b3dSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
896428d7b3dSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
897428d7b3dSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
898428d7b3dSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
899428d7b3dSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
900428d7b3dSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
901428d7b3dSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
902428d7b3dSmrg	esac
903428d7b3dSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
904428d7b3dSmrg	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
905428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
906428d7b3dSmrg	exit ;;
907428d7b3dSmrg    arc:Linux:*:* | arceb:Linux:*:*)
908428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
909428d7b3dSmrg	exit ;;
910428d7b3dSmrg    arm*:Linux:*:*)
911428d7b3dSmrg	eval $set_cc_for_build
912428d7b3dSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
913428d7b3dSmrg	    | grep -q __ARM_EABI__
914428d7b3dSmrg	then
915428d7b3dSmrg	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
916428d7b3dSmrg	else
917428d7b3dSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
918428d7b3dSmrg		| grep -q __ARM_PCS_VFP
919428d7b3dSmrg	    then
920428d7b3dSmrg		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
921428d7b3dSmrg	    else
922428d7b3dSmrg		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
923428d7b3dSmrg	    fi
924428d7b3dSmrg	fi
925428d7b3dSmrg	exit ;;
926428d7b3dSmrg    avr32*:Linux:*:*)
927428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
928428d7b3dSmrg	exit ;;
929428d7b3dSmrg    cris:Linux:*:*)
930428d7b3dSmrg	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
931428d7b3dSmrg	exit ;;
932428d7b3dSmrg    crisv32:Linux:*:*)
933428d7b3dSmrg	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
934428d7b3dSmrg	exit ;;
935428d7b3dSmrg    frv:Linux:*:*)
936428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
937428d7b3dSmrg	exit ;;
938428d7b3dSmrg    hexagon:Linux:*:*)
939428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
940428d7b3dSmrg	exit ;;
941428d7b3dSmrg    i*86:Linux:*:*)
942428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
943428d7b3dSmrg	exit ;;
944428d7b3dSmrg    ia64:Linux:*:*)
945428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
946428d7b3dSmrg	exit ;;
947428d7b3dSmrg    m32r*:Linux:*:*)
948428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
949428d7b3dSmrg	exit ;;
950428d7b3dSmrg    m68*:Linux:*:*)
951428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
952428d7b3dSmrg	exit ;;
953428d7b3dSmrg    mips:Linux:*:* | mips64:Linux:*:*)
954428d7b3dSmrg	eval $set_cc_for_build
955428d7b3dSmrg	sed 's/^	//' << EOF >$dummy.c
956428d7b3dSmrg	#undef CPU
957428d7b3dSmrg	#undef ${UNAME_MACHINE}
958428d7b3dSmrg	#undef ${UNAME_MACHINE}el
959428d7b3dSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
960428d7b3dSmrg	CPU=${UNAME_MACHINE}el
961428d7b3dSmrg	#else
962428d7b3dSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
963428d7b3dSmrg	CPU=${UNAME_MACHINE}
964428d7b3dSmrg	#else
965428d7b3dSmrg	CPU=
966428d7b3dSmrg	#endif
967428d7b3dSmrg	#endif
968428d7b3dSmrgEOF
969428d7b3dSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
970428d7b3dSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
971428d7b3dSmrg	;;
972428d7b3dSmrg    or1k:Linux:*:*)
973428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
974428d7b3dSmrg	exit ;;
975428d7b3dSmrg    or32:Linux:*:*)
976428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
977428d7b3dSmrg	exit ;;
978428d7b3dSmrg    padre:Linux:*:*)
979428d7b3dSmrg	echo sparc-unknown-linux-${LIBC}
980428d7b3dSmrg	exit ;;
981428d7b3dSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
982428d7b3dSmrg	echo hppa64-unknown-linux-${LIBC}
983428d7b3dSmrg	exit ;;
984428d7b3dSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
985428d7b3dSmrg	# Look for CPU level
986428d7b3dSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
987428d7b3dSmrg	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
988428d7b3dSmrg	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
989428d7b3dSmrg	  *)    echo hppa-unknown-linux-${LIBC} ;;
990428d7b3dSmrg	esac
991428d7b3dSmrg	exit ;;
992428d7b3dSmrg    ppc64:Linux:*:*)
993428d7b3dSmrg	echo powerpc64-unknown-linux-${LIBC}
994428d7b3dSmrg	exit ;;
995428d7b3dSmrg    ppc:Linux:*:*)
996428d7b3dSmrg	echo powerpc-unknown-linux-${LIBC}
997428d7b3dSmrg	exit ;;
998428d7b3dSmrg    ppc64le:Linux:*:*)
999428d7b3dSmrg	echo powerpc64le-unknown-linux-${LIBC}
1000428d7b3dSmrg	exit ;;
1001428d7b3dSmrg    ppcle:Linux:*:*)
1002428d7b3dSmrg	echo powerpcle-unknown-linux-${LIBC}
1003428d7b3dSmrg	exit ;;
1004428d7b3dSmrg    s390:Linux:*:* | s390x:Linux:*:*)
1005428d7b3dSmrg	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1006428d7b3dSmrg	exit ;;
1007428d7b3dSmrg    sh64*:Linux:*:*)
1008428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1009428d7b3dSmrg	exit ;;
1010428d7b3dSmrg    sh*:Linux:*:*)
1011428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1012428d7b3dSmrg	exit ;;
1013428d7b3dSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1014428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1015428d7b3dSmrg	exit ;;
1016428d7b3dSmrg    tile*:Linux:*:*)
1017428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1018428d7b3dSmrg	exit ;;
1019428d7b3dSmrg    vax:Linux:*:*)
1020428d7b3dSmrg	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1021428d7b3dSmrg	exit ;;
1022428d7b3dSmrg    x86_64:Linux:*:*)
1023428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1024428d7b3dSmrg	exit ;;
1025428d7b3dSmrg    xtensa*:Linux:*:*)
1026428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1027428d7b3dSmrg	exit ;;
1028428d7b3dSmrg    i*86:DYNIX/ptx:4*:*)
1029428d7b3dSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1030428d7b3dSmrg	# earlier versions are messed up and put the nodename in both
1031428d7b3dSmrg	# sysname and nodename.
1032428d7b3dSmrg	echo i386-sequent-sysv4
1033428d7b3dSmrg	exit ;;
1034428d7b3dSmrg    i*86:UNIX_SV:4.2MP:2.*)
1035428d7b3dSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1036428d7b3dSmrg	# number series starting with 2...
1037428d7b3dSmrg	# I am not positive that other SVR4 systems won't match this,
1038428d7b3dSmrg	# I just have to hope.  -- rms.
1039428d7b3dSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1040428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1041428d7b3dSmrg	exit ;;
1042428d7b3dSmrg    i*86:OS/2:*:*)
1043428d7b3dSmrg	# If we were able to find `uname', then EMX Unix compatibility
1044428d7b3dSmrg	# is probably installed.
1045428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-os2-emx
1046428d7b3dSmrg	exit ;;
1047428d7b3dSmrg    i*86:XTS-300:*:STOP)
1048428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-stop
1049428d7b3dSmrg	exit ;;
1050428d7b3dSmrg    i*86:atheos:*:*)
1051428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-atheos
1052428d7b3dSmrg	exit ;;
1053428d7b3dSmrg    i*86:syllable:*:*)
1054428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-syllable
1055428d7b3dSmrg	exit ;;
1056428d7b3dSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1057428d7b3dSmrg	echo i386-unknown-lynxos${UNAME_RELEASE}
1058428d7b3dSmrg	exit ;;
1059428d7b3dSmrg    i*86:*DOS:*:*)
1060428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1061428d7b3dSmrg	exit ;;
1062428d7b3dSmrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1063428d7b3dSmrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1064428d7b3dSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1065428d7b3dSmrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1066428d7b3dSmrg	else
1067428d7b3dSmrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1068428d7b3dSmrg	fi
1069428d7b3dSmrg	exit ;;
1070428d7b3dSmrg    i*86:*:5:[678]*)
1071428d7b3dSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1072428d7b3dSmrg	case `/bin/uname -X | grep "^Machine"` in
1073428d7b3dSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1074428d7b3dSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1075428d7b3dSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1076428d7b3dSmrg	esac
1077428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1078428d7b3dSmrg	exit ;;
1079428d7b3dSmrg    i*86:*:3.2:*)
1080428d7b3dSmrg	if test -f /usr/options/cb.name; then
1081428d7b3dSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1082428d7b3dSmrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1083428d7b3dSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1084428d7b3dSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1085428d7b3dSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1086428d7b3dSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1087428d7b3dSmrg			&& UNAME_MACHINE=i586
1088428d7b3dSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1089428d7b3dSmrg			&& UNAME_MACHINE=i686
1090428d7b3dSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1091428d7b3dSmrg			&& UNAME_MACHINE=i686
1092428d7b3dSmrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1093428d7b3dSmrg	else
1094428d7b3dSmrg		echo ${UNAME_MACHINE}-pc-sysv32
1095428d7b3dSmrg	fi
1096428d7b3dSmrg	exit ;;
1097428d7b3dSmrg    pc:*:*:*)
1098428d7b3dSmrg	# Left here for compatibility:
1099428d7b3dSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1100428d7b3dSmrg	# the processor, so we play safe by assuming i586.
1101428d7b3dSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1102428d7b3dSmrg	# prints for the "djgpp" host, or else GDB configury will decide that
1103428d7b3dSmrg	# this is a cross-build.
1104428d7b3dSmrg	echo i586-pc-msdosdjgpp
1105428d7b3dSmrg	exit ;;
1106428d7b3dSmrg    Intel:Mach:3*:*)
1107428d7b3dSmrg	echo i386-pc-mach3
1108428d7b3dSmrg	exit ;;
1109428d7b3dSmrg    paragon:*:*:*)
1110428d7b3dSmrg	echo i860-intel-osf1
1111428d7b3dSmrg	exit ;;
1112428d7b3dSmrg    i860:*:4.*:*) # i860-SVR4
1113428d7b3dSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1114428d7b3dSmrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1115428d7b3dSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1116428d7b3dSmrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1117428d7b3dSmrg	fi
1118428d7b3dSmrg	exit ;;
1119428d7b3dSmrg    mini*:CTIX:SYS*5:*)
1120428d7b3dSmrg	# "miniframe"
1121428d7b3dSmrg	echo m68010-convergent-sysv
1122428d7b3dSmrg	exit ;;
1123428d7b3dSmrg    mc68k:UNIX:SYSTEM5:3.51m)
1124428d7b3dSmrg	echo m68k-convergent-sysv
1125428d7b3dSmrg	exit ;;
1126428d7b3dSmrg    M680?0:D-NIX:5.3:*)
1127428d7b3dSmrg	echo m68k-diab-dnix
1128428d7b3dSmrg	exit ;;
1129428d7b3dSmrg    M68*:*:R3V[5678]*:*)
1130428d7b3dSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1131428d7b3dSmrg    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)
1132428d7b3dSmrg	OS_REL=''
1133428d7b3dSmrg	test -r /etc/.relid \
1134428d7b3dSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1135428d7b3dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1136428d7b3dSmrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1137428d7b3dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1138428d7b3dSmrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1139428d7b3dSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1140428d7b3dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1141428d7b3dSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1142428d7b3dSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1143428d7b3dSmrg	OS_REL='.3'
1144428d7b3dSmrg	test -r /etc/.relid \
1145428d7b3dSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1146428d7b3dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1147428d7b3dSmrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1148428d7b3dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1149428d7b3dSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1150428d7b3dSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1151428d7b3dSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1152428d7b3dSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1153428d7b3dSmrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
1154428d7b3dSmrg	exit ;;
1155428d7b3dSmrg    mc68030:UNIX_System_V:4.*:*)
1156428d7b3dSmrg	echo m68k-atari-sysv4
1157428d7b3dSmrg	exit ;;
1158428d7b3dSmrg    TSUNAMI:LynxOS:2.*:*)
1159428d7b3dSmrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
1160428d7b3dSmrg	exit ;;
1161428d7b3dSmrg    rs6000:LynxOS:2.*:*)
1162428d7b3dSmrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1163428d7b3dSmrg	exit ;;
1164428d7b3dSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1165428d7b3dSmrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1166428d7b3dSmrg	exit ;;
1167428d7b3dSmrg    SM[BE]S:UNIX_SV:*:*)
1168428d7b3dSmrg	echo mips-dde-sysv${UNAME_RELEASE}
1169428d7b3dSmrg	exit ;;
1170428d7b3dSmrg    RM*:ReliantUNIX-*:*:*)
1171428d7b3dSmrg	echo mips-sni-sysv4
1172428d7b3dSmrg	exit ;;
1173428d7b3dSmrg    RM*:SINIX-*:*:*)
1174428d7b3dSmrg	echo mips-sni-sysv4
1175428d7b3dSmrg	exit ;;
1176428d7b3dSmrg    *:SINIX-*:*:*)
1177428d7b3dSmrg	if uname -p 2>/dev/null >/dev/null ; then
1178428d7b3dSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1179428d7b3dSmrg		echo ${UNAME_MACHINE}-sni-sysv4
1180428d7b3dSmrg	else
1181428d7b3dSmrg		echo ns32k-sni-sysv
1182428d7b3dSmrg	fi
1183428d7b3dSmrg	exit ;;
1184428d7b3dSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1185428d7b3dSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1186428d7b3dSmrg	echo i586-unisys-sysv4
1187428d7b3dSmrg	exit ;;
1188428d7b3dSmrg    *:UNIX_System_V:4*:FTX*)
1189428d7b3dSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1190428d7b3dSmrg	# How about differentiating between stratus architectures? -djm
1191428d7b3dSmrg	echo hppa1.1-stratus-sysv4
1192428d7b3dSmrg	exit ;;
1193428d7b3dSmrg    *:*:*:FTX*)
1194428d7b3dSmrg	# From seanf@swdc.stratus.com.
1195428d7b3dSmrg	echo i860-stratus-sysv4
1196428d7b3dSmrg	exit ;;
1197428d7b3dSmrg    i*86:VOS:*:*)
1198428d7b3dSmrg	# From Paul.Green@stratus.com.
1199428d7b3dSmrg	echo ${UNAME_MACHINE}-stratus-vos
1200428d7b3dSmrg	exit ;;
1201428d7b3dSmrg    *:VOS:*:*)
1202428d7b3dSmrg	# From Paul.Green@stratus.com.
1203428d7b3dSmrg	echo hppa1.1-stratus-vos
1204428d7b3dSmrg	exit ;;
1205428d7b3dSmrg    mc68*:A/UX:*:*)
1206428d7b3dSmrg	echo m68k-apple-aux${UNAME_RELEASE}
1207428d7b3dSmrg	exit ;;
1208428d7b3dSmrg    news*:NEWS-OS:6*:*)
1209428d7b3dSmrg	echo mips-sony-newsos6
1210428d7b3dSmrg	exit ;;
1211428d7b3dSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1212428d7b3dSmrg	if [ -d /usr/nec ]; then
1213428d7b3dSmrg		echo mips-nec-sysv${UNAME_RELEASE}
1214428d7b3dSmrg	else
1215428d7b3dSmrg		echo mips-unknown-sysv${UNAME_RELEASE}
1216428d7b3dSmrg	fi
1217428d7b3dSmrg	exit ;;
1218428d7b3dSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1219428d7b3dSmrg	echo powerpc-be-beos
1220428d7b3dSmrg	exit ;;
1221428d7b3dSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1222428d7b3dSmrg	echo powerpc-apple-beos
1223428d7b3dSmrg	exit ;;
1224428d7b3dSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1225428d7b3dSmrg	echo i586-pc-beos
1226428d7b3dSmrg	exit ;;
1227428d7b3dSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1228428d7b3dSmrg	echo i586-pc-haiku
1229428d7b3dSmrg	exit ;;
1230428d7b3dSmrg    x86_64:Haiku:*:*)
1231428d7b3dSmrg	echo x86_64-unknown-haiku
1232428d7b3dSmrg	exit ;;
1233428d7b3dSmrg    SX-4:SUPER-UX:*:*)
1234428d7b3dSmrg	echo sx4-nec-superux${UNAME_RELEASE}
1235428d7b3dSmrg	exit ;;
1236428d7b3dSmrg    SX-5:SUPER-UX:*:*)
1237428d7b3dSmrg	echo sx5-nec-superux${UNAME_RELEASE}
1238428d7b3dSmrg	exit ;;
1239428d7b3dSmrg    SX-6:SUPER-UX:*:*)
1240428d7b3dSmrg	echo sx6-nec-superux${UNAME_RELEASE}
1241428d7b3dSmrg	exit ;;
1242428d7b3dSmrg    SX-7:SUPER-UX:*:*)
1243428d7b3dSmrg	echo sx7-nec-superux${UNAME_RELEASE}
1244428d7b3dSmrg	exit ;;
1245428d7b3dSmrg    SX-8:SUPER-UX:*:*)
1246428d7b3dSmrg	echo sx8-nec-superux${UNAME_RELEASE}
1247428d7b3dSmrg	exit ;;
1248428d7b3dSmrg    SX-8R:SUPER-UX:*:*)
1249428d7b3dSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
1250428d7b3dSmrg	exit ;;
1251428d7b3dSmrg    Power*:Rhapsody:*:*)
1252428d7b3dSmrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1253428d7b3dSmrg	exit ;;
1254428d7b3dSmrg    *:Rhapsody:*:*)
1255428d7b3dSmrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1256428d7b3dSmrg	exit ;;
1257428d7b3dSmrg    *:Darwin:*:*)
1258428d7b3dSmrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1259428d7b3dSmrg	eval $set_cc_for_build
1260428d7b3dSmrg	if test "$UNAME_PROCESSOR" = unknown ; then
1261428d7b3dSmrg	    UNAME_PROCESSOR=powerpc
1262428d7b3dSmrg	fi
1263428d7b3dSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1264428d7b3dSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1265428d7b3dSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1266428d7b3dSmrg		grep IS_64BIT_ARCH >/dev/null
1267428d7b3dSmrg	    then
1268428d7b3dSmrg		case $UNAME_PROCESSOR in
1269428d7b3dSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1270428d7b3dSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1271428d7b3dSmrg		esac
1272428d7b3dSmrg	    fi
1273428d7b3dSmrg	fi
1274428d7b3dSmrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1275428d7b3dSmrg	exit ;;
1276428d7b3dSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1277428d7b3dSmrg	UNAME_PROCESSOR=`uname -p`
1278428d7b3dSmrg	if test "$UNAME_PROCESSOR" = "x86"; then
1279428d7b3dSmrg		UNAME_PROCESSOR=i386
1280428d7b3dSmrg		UNAME_MACHINE=pc
1281428d7b3dSmrg	fi
1282428d7b3dSmrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1283428d7b3dSmrg	exit ;;
1284428d7b3dSmrg    *:QNX:*:4*)
1285428d7b3dSmrg	echo i386-pc-qnx
1286428d7b3dSmrg	exit ;;
1287428d7b3dSmrg    NEO-?:NONSTOP_KERNEL:*:*)
1288428d7b3dSmrg	echo neo-tandem-nsk${UNAME_RELEASE}
1289428d7b3dSmrg	exit ;;
1290428d7b3dSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1291428d7b3dSmrg	echo nse-tandem-nsk${UNAME_RELEASE}
1292428d7b3dSmrg	exit ;;
1293428d7b3dSmrg    NSR-?:NONSTOP_KERNEL:*:*)
1294428d7b3dSmrg	echo nsr-tandem-nsk${UNAME_RELEASE}
1295428d7b3dSmrg	exit ;;
1296428d7b3dSmrg    *:NonStop-UX:*:*)
1297428d7b3dSmrg	echo mips-compaq-nonstopux
1298428d7b3dSmrg	exit ;;
1299428d7b3dSmrg    BS2000:POSIX*:*:*)
1300428d7b3dSmrg	echo bs2000-siemens-sysv
1301428d7b3dSmrg	exit ;;
1302428d7b3dSmrg    DS/*:UNIX_System_V:*:*)
1303428d7b3dSmrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1304428d7b3dSmrg	exit ;;
1305428d7b3dSmrg    *:Plan9:*:*)
1306428d7b3dSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1307428d7b3dSmrg	# is converted to i386 for consistency with other x86
1308428d7b3dSmrg	# operating systems.
1309428d7b3dSmrg	if test "$cputype" = "386"; then
1310428d7b3dSmrg	    UNAME_MACHINE=i386
1311428d7b3dSmrg	else
1312428d7b3dSmrg	    UNAME_MACHINE="$cputype"
1313428d7b3dSmrg	fi
1314428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-plan9
1315428d7b3dSmrg	exit ;;
1316428d7b3dSmrg    *:TOPS-10:*:*)
1317428d7b3dSmrg	echo pdp10-unknown-tops10
1318428d7b3dSmrg	exit ;;
1319428d7b3dSmrg    *:TENEX:*:*)
1320428d7b3dSmrg	echo pdp10-unknown-tenex
1321428d7b3dSmrg	exit ;;
1322428d7b3dSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1323428d7b3dSmrg	echo pdp10-dec-tops20
1324428d7b3dSmrg	exit ;;
1325428d7b3dSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1326428d7b3dSmrg	echo pdp10-xkl-tops20
1327428d7b3dSmrg	exit ;;
1328428d7b3dSmrg    *:TOPS-20:*:*)
1329428d7b3dSmrg	echo pdp10-unknown-tops20
1330428d7b3dSmrg	exit ;;
1331428d7b3dSmrg    *:ITS:*:*)
1332428d7b3dSmrg	echo pdp10-unknown-its
1333428d7b3dSmrg	exit ;;
1334428d7b3dSmrg    SEI:*:*:SEIUX)
1335428d7b3dSmrg	echo mips-sei-seiux${UNAME_RELEASE}
1336428d7b3dSmrg	exit ;;
1337428d7b3dSmrg    *:DragonFly:*:*)
1338428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1339428d7b3dSmrg	exit ;;
1340428d7b3dSmrg    *:*VMS:*:*)
1341428d7b3dSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1342428d7b3dSmrg	case "${UNAME_MACHINE}" in
1343428d7b3dSmrg	    A*) echo alpha-dec-vms ; exit ;;
1344428d7b3dSmrg	    I*) echo ia64-dec-vms ; exit ;;
1345428d7b3dSmrg	    V*) echo vax-dec-vms ; exit ;;
1346428d7b3dSmrg	esac ;;
1347428d7b3dSmrg    *:XENIX:*:SysV)
1348428d7b3dSmrg	echo i386-pc-xenix
1349428d7b3dSmrg	exit ;;
1350428d7b3dSmrg    i*86:skyos:*:*)
1351428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1352428d7b3dSmrg	exit ;;
1353428d7b3dSmrg    i*86:rdos:*:*)
1354428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-rdos
1355428d7b3dSmrg	exit ;;
1356428d7b3dSmrg    i*86:AROS:*:*)
1357428d7b3dSmrg	echo ${UNAME_MACHINE}-pc-aros
1358428d7b3dSmrg	exit ;;
1359428d7b3dSmrg    x86_64:VMkernel:*:*)
1360428d7b3dSmrg	echo ${UNAME_MACHINE}-unknown-esx
1361428d7b3dSmrg	exit ;;
1362428d7b3dSmrgesac
1363428d7b3dSmrg
1364428d7b3dSmrgeval $set_cc_for_build
1365428d7b3dSmrgcat >$dummy.c <<EOF
1366428d7b3dSmrg#ifdef _SEQUENT_
1367428d7b3dSmrg# include <sys/types.h>
1368428d7b3dSmrg# include <sys/utsname.h>
1369428d7b3dSmrg#endif
1370428d7b3dSmrgmain ()
1371428d7b3dSmrg{
1372428d7b3dSmrg#if defined (sony)
1373428d7b3dSmrg#if defined (MIPSEB)
1374428d7b3dSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1375428d7b3dSmrg     I don't know....  */
1376428d7b3dSmrg  printf ("mips-sony-bsd\n"); exit (0);
1377428d7b3dSmrg#else
1378428d7b3dSmrg#include <sys/param.h>
1379428d7b3dSmrg  printf ("m68k-sony-newsos%s\n",
1380428d7b3dSmrg#ifdef NEWSOS4
1381428d7b3dSmrg	"4"
1382428d7b3dSmrg#else
1383428d7b3dSmrg	""
1384428d7b3dSmrg#endif
1385428d7b3dSmrg	); exit (0);
1386428d7b3dSmrg#endif
1387428d7b3dSmrg#endif
1388428d7b3dSmrg
1389428d7b3dSmrg#if defined (__arm) && defined (__acorn) && defined (__unix)
1390428d7b3dSmrg  printf ("arm-acorn-riscix\n"); exit (0);
1391428d7b3dSmrg#endif
1392428d7b3dSmrg
1393428d7b3dSmrg#if defined (hp300) && !defined (hpux)
1394428d7b3dSmrg  printf ("m68k-hp-bsd\n"); exit (0);
1395428d7b3dSmrg#endif
1396428d7b3dSmrg
1397428d7b3dSmrg#if defined (NeXT)
1398428d7b3dSmrg#if !defined (__ARCHITECTURE__)
1399428d7b3dSmrg#define __ARCHITECTURE__ "m68k"
1400428d7b3dSmrg#endif
1401428d7b3dSmrg  int version;
1402428d7b3dSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1403428d7b3dSmrg  if (version < 4)
1404428d7b3dSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1405428d7b3dSmrg  else
1406428d7b3dSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1407428d7b3dSmrg  exit (0);
1408428d7b3dSmrg#endif
1409428d7b3dSmrg
1410428d7b3dSmrg#if defined (MULTIMAX) || defined (n16)
1411428d7b3dSmrg#if defined (UMAXV)
1412428d7b3dSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
1413428d7b3dSmrg#else
1414428d7b3dSmrg#if defined (CMU)
1415428d7b3dSmrg  printf ("ns32k-encore-mach\n"); exit (0);
1416428d7b3dSmrg#else
1417428d7b3dSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
1418428d7b3dSmrg#endif
1419428d7b3dSmrg#endif
1420428d7b3dSmrg#endif
1421428d7b3dSmrg
1422428d7b3dSmrg#if defined (__386BSD__)
1423428d7b3dSmrg  printf ("i386-pc-bsd\n"); exit (0);
1424428d7b3dSmrg#endif
1425428d7b3dSmrg
1426428d7b3dSmrg#if defined (sequent)
1427428d7b3dSmrg#if defined (i386)
1428428d7b3dSmrg  printf ("i386-sequent-dynix\n"); exit (0);
1429428d7b3dSmrg#endif
1430428d7b3dSmrg#if defined (ns32000)
1431428d7b3dSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1432428d7b3dSmrg#endif
1433428d7b3dSmrg#endif
1434428d7b3dSmrg
1435428d7b3dSmrg#if defined (_SEQUENT_)
1436428d7b3dSmrg    struct utsname un;
1437428d7b3dSmrg
1438428d7b3dSmrg    uname(&un);
1439428d7b3dSmrg
1440428d7b3dSmrg    if (strncmp(un.version, "V2", 2) == 0) {
1441428d7b3dSmrg	printf ("i386-sequent-ptx2\n"); exit (0);
1442428d7b3dSmrg    }
1443428d7b3dSmrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1444428d7b3dSmrg	printf ("i386-sequent-ptx1\n"); exit (0);
1445428d7b3dSmrg    }
1446428d7b3dSmrg    printf ("i386-sequent-ptx\n"); exit (0);
1447428d7b3dSmrg
1448428d7b3dSmrg#endif
1449428d7b3dSmrg
1450428d7b3dSmrg#if defined (vax)
1451428d7b3dSmrg# if !defined (ultrix)
1452428d7b3dSmrg#  include <sys/param.h>
1453428d7b3dSmrg#  if defined (BSD)
1454428d7b3dSmrg#   if BSD == 43
1455428d7b3dSmrg      printf ("vax-dec-bsd4.3\n"); exit (0);
1456428d7b3dSmrg#   else
1457428d7b3dSmrg#    if BSD == 199006
1458428d7b3dSmrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1459428d7b3dSmrg#    else
1460428d7b3dSmrg      printf ("vax-dec-bsd\n"); exit (0);
1461428d7b3dSmrg#    endif
1462428d7b3dSmrg#   endif
1463428d7b3dSmrg#  else
1464428d7b3dSmrg    printf ("vax-dec-bsd\n"); exit (0);
1465428d7b3dSmrg#  endif
1466428d7b3dSmrg# else
1467428d7b3dSmrg    printf ("vax-dec-ultrix\n"); exit (0);
1468428d7b3dSmrg# endif
1469428d7b3dSmrg#endif
1470428d7b3dSmrg
1471428d7b3dSmrg#if defined (alliant) && defined (i860)
1472428d7b3dSmrg  printf ("i860-alliant-bsd\n"); exit (0);
1473428d7b3dSmrg#endif
1474428d7b3dSmrg
1475428d7b3dSmrg  exit (1);
1476428d7b3dSmrg}
1477428d7b3dSmrgEOF
1478428d7b3dSmrg
1479428d7b3dSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1480428d7b3dSmrg	{ echo "$SYSTEM_NAME"; exit; }
1481428d7b3dSmrg
1482428d7b3dSmrg# Apollos put the system type in the environment.
1483428d7b3dSmrg
1484428d7b3dSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1485428d7b3dSmrg
1486428d7b3dSmrg# Convex versions that predate uname can use getsysinfo(1)
1487428d7b3dSmrg
1488428d7b3dSmrgif [ -x /usr/convex/getsysinfo ]
1489428d7b3dSmrgthen
1490428d7b3dSmrg    case `getsysinfo -f cpu_type` in
1491428d7b3dSmrg    c1*)
1492428d7b3dSmrg	echo c1-convex-bsd
1493428d7b3dSmrg	exit ;;
1494428d7b3dSmrg    c2*)
1495428d7b3dSmrg	if getsysinfo -f scalar_acc
1496428d7b3dSmrg	then echo c32-convex-bsd
1497428d7b3dSmrg	else echo c2-convex-bsd
1498428d7b3dSmrg	fi
1499428d7b3dSmrg	exit ;;
1500428d7b3dSmrg    c34*)
1501428d7b3dSmrg	echo c34-convex-bsd
1502428d7b3dSmrg	exit ;;
1503428d7b3dSmrg    c38*)
1504428d7b3dSmrg	echo c38-convex-bsd
1505428d7b3dSmrg	exit ;;
1506428d7b3dSmrg    c4*)
1507428d7b3dSmrg	echo c4-convex-bsd
1508428d7b3dSmrg	exit ;;
1509428d7b3dSmrg    esac
1510428d7b3dSmrgfi
1511428d7b3dSmrg
1512428d7b3dSmrgcat >&2 <<EOF
1513428d7b3dSmrg$0: unable to guess system type
1514428d7b3dSmrg
1515428d7b3dSmrgThis script, last modified $timestamp, has failed to recognize
1516428d7b3dSmrgthe operating system you are using. It is advised that you
1517428d7b3dSmrgdownload the most up to date version of the config scripts from
1518428d7b3dSmrg
1519428d7b3dSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1520428d7b3dSmrgand
1521428d7b3dSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1522428d7b3dSmrg
1523428d7b3dSmrgIf the version you run ($0) is already up to date, please
1524428d7b3dSmrgsend the following data and any information you think might be
1525428d7b3dSmrgpertinent to <config-patches@gnu.org> in order to provide the needed
1526428d7b3dSmrginformation to handle your system.
1527428d7b3dSmrg
1528428d7b3dSmrgconfig.guess timestamp = $timestamp
1529428d7b3dSmrg
1530428d7b3dSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1531428d7b3dSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1532428d7b3dSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1533428d7b3dSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1534428d7b3dSmrg
1535428d7b3dSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1536428d7b3dSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1537428d7b3dSmrg
1538428d7b3dSmrghostinfo               = `(hostinfo) 2>/dev/null`
1539428d7b3dSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1540428d7b3dSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1541428d7b3dSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1542428d7b3dSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1543428d7b3dSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1544428d7b3dSmrg
1545428d7b3dSmrgUNAME_MACHINE = ${UNAME_MACHINE}
1546428d7b3dSmrgUNAME_RELEASE = ${UNAME_RELEASE}
1547428d7b3dSmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
1548428d7b3dSmrgUNAME_VERSION = ${UNAME_VERSION}
1549428d7b3dSmrgEOF
1550428d7b3dSmrg
1551428d7b3dSmrgexit 1
1552428d7b3dSmrg
1553428d7b3dSmrg# Local variables:
1554428d7b3dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
1555428d7b3dSmrg# time-stamp-start: "timestamp='"
1556428d7b3dSmrg# time-stamp-format: "%:y-%02m-%02d"
1557428d7b3dSmrg# time-stamp-end: "'"
1558428d7b3dSmrg# End:
1559