config.guess revision e3d74329
1c582b7e3Smrg#! /bin/sh
2c582b7e3Smrg# Attempt to guess a canonical system name.
3e3d74329Smrg#   Copyright 1992-2013 Free Software Foundation, Inc.
4c582b7e3Smrg
5e3d74329Smrgtimestamp='2013-11-29'
6c582b7e3Smrg
7c582b7e3Smrg# This file is free software; you can redistribute it and/or modify it
8c582b7e3Smrg# under the terms of the GNU General Public License as published by
9e3d74329Smrg# the Free Software Foundation; either version 3 of the License, or
10c582b7e3Smrg# (at your option) any later version.
11c582b7e3Smrg#
12c582b7e3Smrg# This program is distributed in the hope that it will be useful, but
13c582b7e3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
14c582b7e3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15c582b7e3Smrg# General Public License for more details.
16c582b7e3Smrg#
17c582b7e3Smrg# You should have received a copy of the GNU General Public License
180496e070Smrg# along with this program; if not, see <http://www.gnu.org/licenses/>.
19c582b7e3Smrg#
20c582b7e3Smrg# As a special exception to the GNU General Public License, if you
21c582b7e3Smrg# distribute this file as part of a program that contains a
22c582b7e3Smrg# configuration script generated by Autoconf, you may include it under
23e3d74329Smrg# the same distribution terms that you use for the rest of that
24e3d74329Smrg# program.  This Exception is an additional permission under section 7
25e3d74329Smrg# of the GNU General Public License, version 3 ("GPLv3").
26c582b7e3Smrg#
27e3d74329Smrg# Originally written by Per Bothner.
28c582b7e3Smrg#
2942a55b46Smrg# You can get the latest version of this script from:
3042a55b46Smrg# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
31e3d74329Smrg#
32e3d74329Smrg# Please send patches with a ChangeLog entry to config-patches@gnu.org.
33e3d74329Smrg
34c582b7e3Smrg
35c582b7e3Smrgme=`echo "$0" | sed -e 's,.*/,,'`
36c582b7e3Smrg
37c582b7e3Smrgusage="\
38c582b7e3SmrgUsage: $0 [OPTION]
39c582b7e3Smrg
40c582b7e3SmrgOutput the configuration name of the system \`$me' is run on.
41c582b7e3Smrg
42c582b7e3SmrgOperation modes:
43c582b7e3Smrg  -h, --help         print this help, then exit
44c582b7e3Smrg  -t, --time-stamp   print date of last modification, then exit
45c582b7e3Smrg  -v, --version      print version number, then exit
46c582b7e3Smrg
47c582b7e3SmrgReport bugs and patches to <config-patches@gnu.org>."
48c582b7e3Smrg
49c582b7e3Smrgversion="\
50c582b7e3SmrgGNU config.guess ($timestamp)
51c582b7e3Smrg
52c582b7e3SmrgOriginally written by Per Bothner.
53e3d74329SmrgCopyright 1992-2013 Free Software Foundation, Inc.
54c582b7e3Smrg
55c582b7e3SmrgThis is free software; see the source for copying conditions.  There is NO
56c582b7e3Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
57c582b7e3Smrg
58c582b7e3Smrghelp="
59c582b7e3SmrgTry \`$me --help' for more information."
60c582b7e3Smrg
61c582b7e3Smrg# Parse command line
62c582b7e3Smrgwhile test $# -gt 0 ; do
63c582b7e3Smrg  case $1 in
64c582b7e3Smrg    --time-stamp | --time* | -t )
65c582b7e3Smrg       echo "$timestamp" ; exit ;;
66c582b7e3Smrg    --version | -v )
67c582b7e3Smrg       echo "$version" ; exit ;;
68c582b7e3Smrg    --help | --h* | -h )
69c582b7e3Smrg       echo "$usage"; exit ;;
70c582b7e3Smrg    -- )     # Stop option processing
71c582b7e3Smrg       shift; break ;;
72c582b7e3Smrg    - )	# Use stdin as input.
73c582b7e3Smrg       break ;;
74c582b7e3Smrg    -* )
75c582b7e3Smrg       echo "$me: invalid option $1$help" >&2
76c582b7e3Smrg       exit 1 ;;
77c582b7e3Smrg    * )
78c582b7e3Smrg       break ;;
79c582b7e3Smrg  esac
80c582b7e3Smrgdone
81c582b7e3Smrg
82c582b7e3Smrgif test $# != 0; then
83c582b7e3Smrg  echo "$me: too many arguments$help" >&2
84c582b7e3Smrg  exit 1
85c582b7e3Smrgfi
86c582b7e3Smrg
87c582b7e3Smrgtrap 'exit 1' 1 2 15
88c582b7e3Smrg
89c582b7e3Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
90c582b7e3Smrg# compiler to aid in system detection is discouraged as it requires
91c582b7e3Smrg# temporary files to be created and, as you can see below, it is a
92c582b7e3Smrg# headache to deal with in a portable fashion.
93c582b7e3Smrg
94c582b7e3Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
95c582b7e3Smrg# use `HOST_CC' if defined, but it is deprecated.
96c582b7e3Smrg
97c582b7e3Smrg# Portable tmp directory creation inspired by the Autoconf team.
98c582b7e3Smrg
99c582b7e3Smrgset_cc_for_build='
100c582b7e3Smrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
101c582b7e3Smrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
102c582b7e3Smrg: ${TMPDIR=/tmp} ;
103c582b7e3Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
104c582b7e3Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
105c582b7e3Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
106c582b7e3Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
107c582b7e3Smrgdummy=$tmp/dummy ;
108c582b7e3Smrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
109c582b7e3Smrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
110c582b7e3Smrg ,,)    echo "int x;" > $dummy.c ;
111c582b7e3Smrg	for c in cc gcc c89 c99 ; do
112c582b7e3Smrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
113c582b7e3Smrg	     CC_FOR_BUILD="$c"; break ;
114c582b7e3Smrg	  fi ;
115c582b7e3Smrg	done ;
116c582b7e3Smrg	if test x"$CC_FOR_BUILD" = x ; then
117c582b7e3Smrg	  CC_FOR_BUILD=no_compiler_found ;
118c582b7e3Smrg	fi
119c582b7e3Smrg	;;
120c582b7e3Smrg ,,*)   CC_FOR_BUILD=$CC ;;
121c582b7e3Smrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
122c582b7e3Smrgesac ; set_cc_for_build= ;'
123c582b7e3Smrg
124c582b7e3Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
125c582b7e3Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
126c582b7e3Smrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
127c582b7e3Smrg	PATH=$PATH:/.attbin ; export PATH
128c582b7e3Smrgfi
129c582b7e3Smrg
130c582b7e3SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
131c582b7e3SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
132c582b7e3SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
133c582b7e3SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
134c582b7e3Smrg
135e3d74329Smrgcase "${UNAME_SYSTEM}" in
136e3d74329SmrgLinux|GNU|GNU/*)
137e3d74329Smrg	# If the system lacks a compiler, then just pick glibc.
138e3d74329Smrg	# We could probably try harder.
139e3d74329Smrg	LIBC=gnu
140e3d74329Smrg
141e3d74329Smrg	eval $set_cc_for_build
142e3d74329Smrg	cat <<-EOF > $dummy.c
143e3d74329Smrg	#include <features.h>
144e3d74329Smrg	#if defined(__UCLIBC__)
145e3d74329Smrg	LIBC=uclibc
146e3d74329Smrg	#elif defined(__dietlibc__)
147e3d74329Smrg	LIBC=dietlibc
148e3d74329Smrg	#else
149e3d74329Smrg	LIBC=gnu
150e3d74329Smrg	#endif
151e3d74329Smrg	EOF
152e3d74329Smrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
153e3d74329Smrg	;;
154e3d74329Smrgesac
155e3d74329Smrg
156c582b7e3Smrg# Note: order is significant - the case branches are not exclusive.
157c582b7e3Smrg
158c582b7e3Smrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
159c582b7e3Smrg    *:NetBSD:*:*)
160c582b7e3Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
16142a55b46Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
162c582b7e3Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
163c582b7e3Smrg	# switched to ELF, *-*-netbsd* would select the old
164c582b7e3Smrg	# object file format.  This provides both forward
165c582b7e3Smrg	# compatibility and a consistent mechanism for selecting the
166c582b7e3Smrg	# object file format.
167c582b7e3Smrg	#
168c582b7e3Smrg	# Note: NetBSD doesn't particularly care about the vendor
169c582b7e3Smrg	# portion of the name.  We always set it to "unknown".
170c582b7e3Smrg	sysctl="sysctl -n hw.machine_arch"
171c582b7e3Smrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
172c582b7e3Smrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
173c582b7e3Smrg	case "${UNAME_MACHINE_ARCH}" in
174c582b7e3Smrg	    armeb) machine=armeb-unknown ;;
175c582b7e3Smrg	    arm*) machine=arm-unknown ;;
176c582b7e3Smrg	    sh3el) machine=shl-unknown ;;
177c582b7e3Smrg	    sh3eb) machine=sh-unknown ;;
178c582b7e3Smrg	    sh5el) machine=sh5le-unknown ;;
179c582b7e3Smrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
180c582b7e3Smrg	esac
181c582b7e3Smrg	# The Operating System including object format, if it has switched
182c582b7e3Smrg	# to ELF recently, or will in the future.
183c582b7e3Smrg	case "${UNAME_MACHINE_ARCH}" in
184c582b7e3Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
185c582b7e3Smrg		eval $set_cc_for_build
186c582b7e3Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
18742a55b46Smrg			| grep -q __ELF__
188c582b7e3Smrg		then
189c582b7e3Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
190c582b7e3Smrg		    # Return netbsd for either.  FIX?
191c582b7e3Smrg		    os=netbsd
192c582b7e3Smrg		else
193c582b7e3Smrg		    os=netbsdelf
194c582b7e3Smrg		fi
195c582b7e3Smrg		;;
196c582b7e3Smrg	    *)
19742a55b46Smrg		os=netbsd
198c582b7e3Smrg		;;
199c582b7e3Smrg	esac
200c582b7e3Smrg	# The OS release
201c582b7e3Smrg	# Debian GNU/NetBSD machines have a different userland, and
202c582b7e3Smrg	# thus, need a distinct triplet. However, they do not need
203c582b7e3Smrg	# kernel version information, so it can be replaced with a
204c582b7e3Smrg	# suitable tag, in the style of linux-gnu.
205c582b7e3Smrg	case "${UNAME_VERSION}" in
206c582b7e3Smrg	    Debian*)
207c582b7e3Smrg		release='-gnu'
208c582b7e3Smrg		;;
209c582b7e3Smrg	    *)
210c582b7e3Smrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
211c582b7e3Smrg		;;
212c582b7e3Smrg	esac
213c582b7e3Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
214c582b7e3Smrg	# contains redundant information, the shorter form:
215c582b7e3Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
216c582b7e3Smrg	echo "${machine}-${os}${release}"
217c582b7e3Smrg	exit ;;
218e3d74329Smrg    *:Bitrig:*:*)
219e3d74329Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
220e3d74329Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
221e3d74329Smrg	exit ;;
222c582b7e3Smrg    *:OpenBSD:*:*)
223c582b7e3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
224c582b7e3Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
225c582b7e3Smrg	exit ;;
226c582b7e3Smrg    *:ekkoBSD:*:*)
227c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
228c582b7e3Smrg	exit ;;
229c582b7e3Smrg    *:SolidBSD:*:*)
230c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
231c582b7e3Smrg	exit ;;
232c582b7e3Smrg    macppc:MirBSD:*:*)
233c582b7e3Smrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
234c582b7e3Smrg	exit ;;
235c582b7e3Smrg    *:MirBSD:*:*)
236c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
237c582b7e3Smrg	exit ;;
238c582b7e3Smrg    alpha:OSF1:*:*)
239c582b7e3Smrg	case $UNAME_RELEASE in
240c582b7e3Smrg	*4.0)
241c582b7e3Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
242c582b7e3Smrg		;;
243c582b7e3Smrg	*5.*)
24442a55b46Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
245c582b7e3Smrg		;;
246c582b7e3Smrg	esac
247c582b7e3Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
248c582b7e3Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
249c582b7e3Smrg	# covers most systems running today.  This code pipes the CPU
250c582b7e3Smrg	# types through head -n 1, so we only detect the type of CPU 0.
251c582b7e3Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
252c582b7e3Smrg	case "$ALPHA_CPU_TYPE" in
253c582b7e3Smrg	    "EV4 (21064)")
254c582b7e3Smrg		UNAME_MACHINE="alpha" ;;
255c582b7e3Smrg	    "EV4.5 (21064)")
256c582b7e3Smrg		UNAME_MACHINE="alpha" ;;
257c582b7e3Smrg	    "LCA4 (21066/21068)")
258c582b7e3Smrg		UNAME_MACHINE="alpha" ;;
259c582b7e3Smrg	    "EV5 (21164)")
260c582b7e3Smrg		UNAME_MACHINE="alphaev5" ;;
261c582b7e3Smrg	    "EV5.6 (21164A)")
262c582b7e3Smrg		UNAME_MACHINE="alphaev56" ;;
263c582b7e3Smrg	    "EV5.6 (21164PC)")
264c582b7e3Smrg		UNAME_MACHINE="alphapca56" ;;
265c582b7e3Smrg	    "EV5.7 (21164PC)")
266c582b7e3Smrg		UNAME_MACHINE="alphapca57" ;;
267c582b7e3Smrg	    "EV6 (21264)")
268c582b7e3Smrg		UNAME_MACHINE="alphaev6" ;;
269c582b7e3Smrg	    "EV6.7 (21264A)")
270c582b7e3Smrg		UNAME_MACHINE="alphaev67" ;;
271c582b7e3Smrg	    "EV6.8CB (21264C)")
272c582b7e3Smrg		UNAME_MACHINE="alphaev68" ;;
273c582b7e3Smrg	    "EV6.8AL (21264B)")
274c582b7e3Smrg		UNAME_MACHINE="alphaev68" ;;
275c582b7e3Smrg	    "EV6.8CX (21264D)")
276c582b7e3Smrg		UNAME_MACHINE="alphaev68" ;;
277c582b7e3Smrg	    "EV6.9A (21264/EV69A)")
278c582b7e3Smrg		UNAME_MACHINE="alphaev69" ;;
279c582b7e3Smrg	    "EV7 (21364)")
280c582b7e3Smrg		UNAME_MACHINE="alphaev7" ;;
281c582b7e3Smrg	    "EV7.9 (21364A)")
282c582b7e3Smrg		UNAME_MACHINE="alphaev79" ;;
283c582b7e3Smrg	esac
284c582b7e3Smrg	# A Pn.n version is a patched version.
285c582b7e3Smrg	# A Vn.n version is a released version.
286c582b7e3Smrg	# A Tn.n version is a released field test version.
287c582b7e3Smrg	# A Xn.n version is an unreleased experimental baselevel.
288c582b7e3Smrg	# 1.2 uses "1.2" for uname -r.
289c582b7e3Smrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
29042a55b46Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
29142a55b46Smrg	exitcode=$?
29242a55b46Smrg	trap '' 0
29342a55b46Smrg	exit $exitcode ;;
294c582b7e3Smrg    Alpha\ *:Windows_NT*:*)
295c582b7e3Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
296c582b7e3Smrg	# Should we change UNAME_MACHINE based on the output of uname instead
297c582b7e3Smrg	# of the specific Alpha model?
298c582b7e3Smrg	echo alpha-pc-interix
299c582b7e3Smrg	exit ;;
300c582b7e3Smrg    21064:Windows_NT:50:3)
301c582b7e3Smrg	echo alpha-dec-winnt3.5
302c582b7e3Smrg	exit ;;
303c582b7e3Smrg    Amiga*:UNIX_System_V:4.0:*)
304c582b7e3Smrg	echo m68k-unknown-sysv4
305c582b7e3Smrg	exit ;;
306c582b7e3Smrg    *:[Aa]miga[Oo][Ss]:*:*)
307c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-amigaos
308c582b7e3Smrg	exit ;;
309c582b7e3Smrg    *:[Mm]orph[Oo][Ss]:*:*)
310c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-morphos
311c582b7e3Smrg	exit ;;
312c582b7e3Smrg    *:OS/390:*:*)
313c582b7e3Smrg	echo i370-ibm-openedition
314c582b7e3Smrg	exit ;;
315c582b7e3Smrg    *:z/VM:*:*)
316c582b7e3Smrg	echo s390-ibm-zvmoe
317c582b7e3Smrg	exit ;;
318c582b7e3Smrg    *:OS400:*:*)
31942a55b46Smrg	echo powerpc-ibm-os400
320c582b7e3Smrg	exit ;;
321c582b7e3Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
322c582b7e3Smrg	echo arm-acorn-riscix${UNAME_RELEASE}
323c582b7e3Smrg	exit ;;
324e3d74329Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
325c582b7e3Smrg	echo arm-unknown-riscos
326c582b7e3Smrg	exit ;;
327c582b7e3Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
328c582b7e3Smrg	echo hppa1.1-hitachi-hiuxmpp
329c582b7e3Smrg	exit ;;
330c582b7e3Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
331c582b7e3Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
332c582b7e3Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
333c582b7e3Smrg		echo pyramid-pyramid-sysv3
334c582b7e3Smrg	else
335c582b7e3Smrg		echo pyramid-pyramid-bsd
336c582b7e3Smrg	fi
337c582b7e3Smrg	exit ;;
338c582b7e3Smrg    NILE*:*:*:dcosx)
339c582b7e3Smrg	echo pyramid-pyramid-svr4
340c582b7e3Smrg	exit ;;
341c582b7e3Smrg    DRS?6000:unix:4.0:6*)
342c582b7e3Smrg	echo sparc-icl-nx6
343c582b7e3Smrg	exit ;;
344c582b7e3Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
345c582b7e3Smrg	case `/usr/bin/uname -p` in
346c582b7e3Smrg	    sparc) echo sparc-icl-nx7; exit ;;
347c582b7e3Smrg	esac ;;
34842a55b46Smrg    s390x:SunOS:*:*)
34942a55b46Smrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
35042a55b46Smrg	exit ;;
351c582b7e3Smrg    sun4H:SunOS:5.*:*)
352c582b7e3Smrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
353c582b7e3Smrg	exit ;;
354c582b7e3Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
355c582b7e3Smrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
356c582b7e3Smrg	exit ;;
35742a55b46Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
35842a55b46Smrg	echo i386-pc-auroraux${UNAME_RELEASE}
35942a55b46Smrg	exit ;;
36019019ffeSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
36142a55b46Smrg	eval $set_cc_for_build
36242a55b46Smrg	SUN_ARCH="i386"
36342a55b46Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
36442a55b46Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
36542a55b46Smrg	# This test works for both compilers.
36642a55b46Smrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
36742a55b46Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
36842a55b46Smrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
36942a55b46Smrg		grep IS_64BIT_ARCH >/dev/null
37042a55b46Smrg	    then
37142a55b46Smrg		SUN_ARCH="x86_64"
37242a55b46Smrg	    fi
37342a55b46Smrg	fi
37442a55b46Smrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
375c582b7e3Smrg	exit ;;
376c582b7e3Smrg    sun4*:SunOS:6*:*)
377c582b7e3Smrg	# According to config.sub, this is the proper way to canonicalize
378c582b7e3Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
379c582b7e3Smrg	# it's likely to be more like Solaris than SunOS4.
380c582b7e3Smrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
381c582b7e3Smrg	exit ;;
382c582b7e3Smrg    sun4*:SunOS:*:*)
383c582b7e3Smrg	case "`/usr/bin/arch -k`" in
384c582b7e3Smrg	    Series*|S4*)
385c582b7e3Smrg		UNAME_RELEASE=`uname -v`
386c582b7e3Smrg		;;
387c582b7e3Smrg	esac
388c582b7e3Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
389c582b7e3Smrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
390c582b7e3Smrg	exit ;;
391c582b7e3Smrg    sun3*:SunOS:*:*)
392c582b7e3Smrg	echo m68k-sun-sunos${UNAME_RELEASE}
393c582b7e3Smrg	exit ;;
394c582b7e3Smrg    sun*:*:4.2BSD:*)
395c582b7e3Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
396c582b7e3Smrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
397c582b7e3Smrg	case "`/bin/arch`" in
398c582b7e3Smrg	    sun3)
399c582b7e3Smrg		echo m68k-sun-sunos${UNAME_RELEASE}
400c582b7e3Smrg		;;
401c582b7e3Smrg	    sun4)
402c582b7e3Smrg		echo sparc-sun-sunos${UNAME_RELEASE}
403c582b7e3Smrg		;;
404c582b7e3Smrg	esac
405c582b7e3Smrg	exit ;;
406c582b7e3Smrg    aushp:SunOS:*:*)
407c582b7e3Smrg	echo sparc-auspex-sunos${UNAME_RELEASE}
408c582b7e3Smrg	exit ;;
409c582b7e3Smrg    # The situation for MiNT is a little confusing.  The machine name
410c582b7e3Smrg    # can be virtually everything (everything which is not
411c582b7e3Smrg    # "atarist" or "atariste" at least should have a processor
412c582b7e3Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
413c582b7e3Smrg    # to the lowercase version "mint" (or "freemint").  Finally
414c582b7e3Smrg    # the system name "TOS" denotes a system which is actually not
415c582b7e3Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
416c582b7e3Smrg    # be no problem.
417c582b7e3Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
41842a55b46Smrg	echo m68k-atari-mint${UNAME_RELEASE}
419c582b7e3Smrg	exit ;;
420c582b7e3Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
421c582b7e3Smrg	echo m68k-atari-mint${UNAME_RELEASE}
42242a55b46Smrg	exit ;;
423c582b7e3Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
42442a55b46Smrg	echo m68k-atari-mint${UNAME_RELEASE}
425c582b7e3Smrg	exit ;;
426c582b7e3Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
42742a55b46Smrg	echo m68k-milan-mint${UNAME_RELEASE}
42842a55b46Smrg	exit ;;
429c582b7e3Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
43042a55b46Smrg	echo m68k-hades-mint${UNAME_RELEASE}
43142a55b46Smrg	exit ;;
432c582b7e3Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
43342a55b46Smrg	echo m68k-unknown-mint${UNAME_RELEASE}
43442a55b46Smrg	exit ;;
435c582b7e3Smrg    m68k:machten:*:*)
436c582b7e3Smrg	echo m68k-apple-machten${UNAME_RELEASE}
437c582b7e3Smrg	exit ;;
438c582b7e3Smrg    powerpc:machten:*:*)
439c582b7e3Smrg	echo powerpc-apple-machten${UNAME_RELEASE}
440c582b7e3Smrg	exit ;;
441c582b7e3Smrg    RISC*:Mach:*:*)
442c582b7e3Smrg	echo mips-dec-mach_bsd4.3
443c582b7e3Smrg	exit ;;
444c582b7e3Smrg    RISC*:ULTRIX:*:*)
445c582b7e3Smrg	echo mips-dec-ultrix${UNAME_RELEASE}
446c582b7e3Smrg	exit ;;
447c582b7e3Smrg    VAX*:ULTRIX*:*:*)
448c582b7e3Smrg	echo vax-dec-ultrix${UNAME_RELEASE}
449c582b7e3Smrg	exit ;;
450c582b7e3Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
451c582b7e3Smrg	echo clipper-intergraph-clix${UNAME_RELEASE}
452c582b7e3Smrg	exit ;;
453c582b7e3Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
454c582b7e3Smrg	eval $set_cc_for_build
455c582b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
456c582b7e3Smrg#ifdef __cplusplus
457c582b7e3Smrg#include <stdio.h>  /* for printf() prototype */
458c582b7e3Smrg	int main (int argc, char *argv[]) {
459c582b7e3Smrg#else
460c582b7e3Smrg	int main (argc, argv) int argc; char *argv[]; {
461c582b7e3Smrg#endif
462c582b7e3Smrg	#if defined (host_mips) && defined (MIPSEB)
463c582b7e3Smrg	#if defined (SYSTYPE_SYSV)
464c582b7e3Smrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
465c582b7e3Smrg	#endif
466c582b7e3Smrg	#if defined (SYSTYPE_SVR4)
467c582b7e3Smrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
468c582b7e3Smrg	#endif
469c582b7e3Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
470c582b7e3Smrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
471c582b7e3Smrg	#endif
472c582b7e3Smrg	#endif
473c582b7e3Smrg	  exit (-1);
474c582b7e3Smrg	}
475c582b7e3SmrgEOF
476c582b7e3Smrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
477c582b7e3Smrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
478c582b7e3Smrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
479c582b7e3Smrg	    { echo "$SYSTEM_NAME"; exit; }
480c582b7e3Smrg	echo mips-mips-riscos${UNAME_RELEASE}
481c582b7e3Smrg	exit ;;
482c582b7e3Smrg    Motorola:PowerMAX_OS:*:*)
483c582b7e3Smrg	echo powerpc-motorola-powermax
484c582b7e3Smrg	exit ;;
485c582b7e3Smrg    Motorola:*:4.3:PL8-*)
486c582b7e3Smrg	echo powerpc-harris-powermax
487c582b7e3Smrg	exit ;;
488c582b7e3Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
489c582b7e3Smrg	echo powerpc-harris-powermax
490c582b7e3Smrg	exit ;;
491c582b7e3Smrg    Night_Hawk:Power_UNIX:*:*)
492c582b7e3Smrg	echo powerpc-harris-powerunix
493c582b7e3Smrg	exit ;;
494c582b7e3Smrg    m88k:CX/UX:7*:*)
495c582b7e3Smrg	echo m88k-harris-cxux7
496c582b7e3Smrg	exit ;;
497c582b7e3Smrg    m88k:*:4*:R4*)
498c582b7e3Smrg	echo m88k-motorola-sysv4
499c582b7e3Smrg	exit ;;
500c582b7e3Smrg    m88k:*:3*:R3*)
501c582b7e3Smrg	echo m88k-motorola-sysv3
502c582b7e3Smrg	exit ;;
503c582b7e3Smrg    AViiON:dgux:*:*)
50442a55b46Smrg	# DG/UX returns AViiON for all architectures
50542a55b46Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
506c582b7e3Smrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
507c582b7e3Smrg	then
508c582b7e3Smrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
509c582b7e3Smrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
510c582b7e3Smrg	    then
511c582b7e3Smrg		echo m88k-dg-dgux${UNAME_RELEASE}
512c582b7e3Smrg	    else
513c582b7e3Smrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
514c582b7e3Smrg	    fi
515c582b7e3Smrg	else
516c582b7e3Smrg	    echo i586-dg-dgux${UNAME_RELEASE}
517c582b7e3Smrg	fi
51842a55b46Smrg	exit ;;
519c582b7e3Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
520c582b7e3Smrg	echo m88k-dolphin-sysv3
521c582b7e3Smrg	exit ;;
522c582b7e3Smrg    M88*:*:R3*:*)
523c582b7e3Smrg	# Delta 88k system running SVR3
524c582b7e3Smrg	echo m88k-motorola-sysv3
525c582b7e3Smrg	exit ;;
526c582b7e3Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
527c582b7e3Smrg	echo m88k-tektronix-sysv3
528c582b7e3Smrg	exit ;;
529c582b7e3Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
530c582b7e3Smrg	echo m68k-tektronix-bsd
531c582b7e3Smrg	exit ;;
532c582b7e3Smrg    *:IRIX*:*:*)
533c582b7e3Smrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
534c582b7e3Smrg	exit ;;
535c582b7e3Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
536c582b7e3Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
537c582b7e3Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
538c582b7e3Smrg    i*86:AIX:*:*)
539c582b7e3Smrg	echo i386-ibm-aix
540c582b7e3Smrg	exit ;;
541c582b7e3Smrg    ia64:AIX:*:*)
542c582b7e3Smrg	if [ -x /usr/bin/oslevel ] ; then
543c582b7e3Smrg		IBM_REV=`/usr/bin/oslevel`
544c582b7e3Smrg	else
545c582b7e3Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
546c582b7e3Smrg	fi
547c582b7e3Smrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
548c582b7e3Smrg	exit ;;
549c582b7e3Smrg    *:AIX:2:3)
550c582b7e3Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
551c582b7e3Smrg		eval $set_cc_for_build
552c582b7e3Smrg		sed 's/^		//' << EOF >$dummy.c
553c582b7e3Smrg		#include <sys/systemcfg.h>
554c582b7e3Smrg
555c582b7e3Smrg		main()
556c582b7e3Smrg			{
557c582b7e3Smrg			if (!__power_pc())
558c582b7e3Smrg				exit(1);
559c582b7e3Smrg			puts("powerpc-ibm-aix3.2.5");
560c582b7e3Smrg			exit(0);
561c582b7e3Smrg			}
562c582b7e3SmrgEOF
563c582b7e3Smrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
564c582b7e3Smrg		then
565c582b7e3Smrg			echo "$SYSTEM_NAME"
566c582b7e3Smrg		else
567c582b7e3Smrg			echo rs6000-ibm-aix3.2.5
568c582b7e3Smrg		fi
569c582b7e3Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
570c582b7e3Smrg		echo rs6000-ibm-aix3.2.4
571c582b7e3Smrg	else
572c582b7e3Smrg		echo rs6000-ibm-aix3.2
573c582b7e3Smrg	fi
574c582b7e3Smrg	exit ;;
57542a55b46Smrg    *:AIX:*:[4567])
576c582b7e3Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
577c582b7e3Smrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
578c582b7e3Smrg		IBM_ARCH=rs6000
579c582b7e3Smrg	else
580c582b7e3Smrg		IBM_ARCH=powerpc
581c582b7e3Smrg	fi
582c582b7e3Smrg	if [ -x /usr/bin/oslevel ] ; then
583c582b7e3Smrg		IBM_REV=`/usr/bin/oslevel`
584c582b7e3Smrg	else
585c582b7e3Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
586c582b7e3Smrg	fi
587c582b7e3Smrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
588c582b7e3Smrg	exit ;;
589c582b7e3Smrg    *:AIX:*:*)
590c582b7e3Smrg	echo rs6000-ibm-aix
591c582b7e3Smrg	exit ;;
592c582b7e3Smrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
593c582b7e3Smrg	echo romp-ibm-bsd4.4
594c582b7e3Smrg	exit ;;
595c582b7e3Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
596c582b7e3Smrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
597c582b7e3Smrg	exit ;;                             # report: romp-ibm BSD 4.3
598c582b7e3Smrg    *:BOSX:*:*)
599c582b7e3Smrg	echo rs6000-bull-bosx
600c582b7e3Smrg	exit ;;
601c582b7e3Smrg    DPX/2?00:B.O.S.:*:*)
602c582b7e3Smrg	echo m68k-bull-sysv3
603c582b7e3Smrg	exit ;;
604c582b7e3Smrg    9000/[34]??:4.3bsd:1.*:*)
605c582b7e3Smrg	echo m68k-hp-bsd
606c582b7e3Smrg	exit ;;
607c582b7e3Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
608c582b7e3Smrg	echo m68k-hp-bsd4.4
609c582b7e3Smrg	exit ;;
610c582b7e3Smrg    9000/[34678]??:HP-UX:*:*)
611c582b7e3Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
612c582b7e3Smrg	case "${UNAME_MACHINE}" in
613c582b7e3Smrg	    9000/31? )            HP_ARCH=m68000 ;;
614c582b7e3Smrg	    9000/[34]?? )         HP_ARCH=m68k ;;
615c582b7e3Smrg	    9000/[678][0-9][0-9])
616c582b7e3Smrg		if [ -x /usr/bin/getconf ]; then
617c582b7e3Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
61842a55b46Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
61942a55b46Smrg		    case "${sc_cpu_version}" in
62042a55b46Smrg		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
62142a55b46Smrg		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
62242a55b46Smrg		      532)                      # CPU_PA_RISC2_0
62342a55b46Smrg			case "${sc_kernel_bits}" in
62442a55b46Smrg			  32) HP_ARCH="hppa2.0n" ;;
62542a55b46Smrg			  64) HP_ARCH="hppa2.0w" ;;
626c582b7e3Smrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
62742a55b46Smrg			esac ;;
62842a55b46Smrg		    esac
629c582b7e3Smrg		fi
630c582b7e3Smrg		if [ "${HP_ARCH}" = "" ]; then
631c582b7e3Smrg		    eval $set_cc_for_build
63242a55b46Smrg		    sed 's/^		//' << EOF >$dummy.c
633c582b7e3Smrg
63442a55b46Smrg		#define _HPUX_SOURCE
63542a55b46Smrg		#include <stdlib.h>
63642a55b46Smrg		#include <unistd.h>
637c582b7e3Smrg
63842a55b46Smrg		int main ()
63942a55b46Smrg		{
64042a55b46Smrg		#if defined(_SC_KERNEL_BITS)
64142a55b46Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
64242a55b46Smrg		#endif
64342a55b46Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
644c582b7e3Smrg
64542a55b46Smrg		    switch (cpu)
64642a55b46Smrg			{
64742a55b46Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
64842a55b46Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
64942a55b46Smrg			case CPU_PA_RISC2_0:
65042a55b46Smrg		#if defined(_SC_KERNEL_BITS)
65142a55b46Smrg			    switch (bits)
65242a55b46Smrg				{
65342a55b46Smrg				case 64: puts ("hppa2.0w"); break;
65442a55b46Smrg				case 32: puts ("hppa2.0n"); break;
65542a55b46Smrg				default: puts ("hppa2.0"); break;
65642a55b46Smrg				} break;
65742a55b46Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
65842a55b46Smrg			    puts ("hppa2.0"); break;
65942a55b46Smrg		#endif
66042a55b46Smrg			default: puts ("hppa1.0"); break;
66142a55b46Smrg			}
66242a55b46Smrg		    exit (0);
66342a55b46Smrg		}
664c582b7e3SmrgEOF
665c582b7e3Smrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
666c582b7e3Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
667c582b7e3Smrg		fi ;;
668c582b7e3Smrg	esac
669c582b7e3Smrg	if [ ${HP_ARCH} = "hppa2.0w" ]
670c582b7e3Smrg	then
671c582b7e3Smrg	    eval $set_cc_for_build
672c582b7e3Smrg
673c582b7e3Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
674c582b7e3Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
675c582b7e3Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
676c582b7e3Smrg	    #
677c582b7e3Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
678c582b7e3Smrg	    # => hppa2.0w-hp-hpux11.23
679c582b7e3Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
680c582b7e3Smrg	    # => hppa64-hp-hpux11.23
681c582b7e3Smrg
682c582b7e3Smrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
68342a55b46Smrg		grep -q __LP64__
684c582b7e3Smrg	    then
685c582b7e3Smrg		HP_ARCH="hppa2.0w"
686c582b7e3Smrg	    else
687c582b7e3Smrg		HP_ARCH="hppa64"
688c582b7e3Smrg	    fi
689c582b7e3Smrg	fi
690c582b7e3Smrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
691c582b7e3Smrg	exit ;;
692c582b7e3Smrg    ia64:HP-UX:*:*)
693c582b7e3Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
694c582b7e3Smrg	echo ia64-hp-hpux${HPUX_REV}
695c582b7e3Smrg	exit ;;
696c582b7e3Smrg    3050*:HI-UX:*:*)
697c582b7e3Smrg	eval $set_cc_for_build
698c582b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
699c582b7e3Smrg	#include <unistd.h>
700c582b7e3Smrg	int
701c582b7e3Smrg	main ()
702c582b7e3Smrg	{
703c582b7e3Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
704c582b7e3Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
705c582b7e3Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
706c582b7e3Smrg	     results, however.  */
707c582b7e3Smrg	  if (CPU_IS_PA_RISC (cpu))
708c582b7e3Smrg	    {
709c582b7e3Smrg	      switch (cpu)
710c582b7e3Smrg		{
711c582b7e3Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
712c582b7e3Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
713c582b7e3Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
714c582b7e3Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
715c582b7e3Smrg		}
716c582b7e3Smrg	    }
717c582b7e3Smrg	  else if (CPU_IS_HP_MC68K (cpu))
718c582b7e3Smrg	    puts ("m68k-hitachi-hiuxwe2");
719c582b7e3Smrg	  else puts ("unknown-hitachi-hiuxwe2");
720c582b7e3Smrg	  exit (0);
721c582b7e3Smrg	}
722c582b7e3SmrgEOF
723c582b7e3Smrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
724c582b7e3Smrg		{ echo "$SYSTEM_NAME"; exit; }
725c582b7e3Smrg	echo unknown-hitachi-hiuxwe2
726c582b7e3Smrg	exit ;;
727c582b7e3Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
728c582b7e3Smrg	echo hppa1.1-hp-bsd
729c582b7e3Smrg	exit ;;
730c582b7e3Smrg    9000/8??:4.3bsd:*:*)
731c582b7e3Smrg	echo hppa1.0-hp-bsd
732c582b7e3Smrg	exit ;;
733c582b7e3Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
734c582b7e3Smrg	echo hppa1.0-hp-mpeix
735c582b7e3Smrg	exit ;;
736c582b7e3Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
737c582b7e3Smrg	echo hppa1.1-hp-osf
738c582b7e3Smrg	exit ;;
739c582b7e3Smrg    hp8??:OSF1:*:*)
740c582b7e3Smrg	echo hppa1.0-hp-osf
741c582b7e3Smrg	exit ;;
742c582b7e3Smrg    i*86:OSF1:*:*)
743c582b7e3Smrg	if [ -x /usr/sbin/sysversion ] ; then
744c582b7e3Smrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
745c582b7e3Smrg	else
746c582b7e3Smrg	    echo ${UNAME_MACHINE}-unknown-osf1
747c582b7e3Smrg	fi
748c582b7e3Smrg	exit ;;
749c582b7e3Smrg    parisc*:Lites*:*:*)
750c582b7e3Smrg	echo hppa1.1-hp-lites
751c582b7e3Smrg	exit ;;
752c582b7e3Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
753c582b7e3Smrg	echo c1-convex-bsd
75442a55b46Smrg	exit ;;
755c582b7e3Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
756c582b7e3Smrg	if getsysinfo -f scalar_acc
757c582b7e3Smrg	then echo c32-convex-bsd
758c582b7e3Smrg	else echo c2-convex-bsd
759c582b7e3Smrg	fi
76042a55b46Smrg	exit ;;
761c582b7e3Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
762c582b7e3Smrg	echo c34-convex-bsd
76342a55b46Smrg	exit ;;
764c582b7e3Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
765c582b7e3Smrg	echo c38-convex-bsd
76642a55b46Smrg	exit ;;
767c582b7e3Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
768c582b7e3Smrg	echo c4-convex-bsd
76942a55b46Smrg	exit ;;
770c582b7e3Smrg    CRAY*Y-MP:*:*:*)
771c582b7e3Smrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
772c582b7e3Smrg	exit ;;
773c582b7e3Smrg    CRAY*[A-Z]90:*:*:*)
774c582b7e3Smrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
775c582b7e3Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
776c582b7e3Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
777c582b7e3Smrg	      -e 's/\.[^.]*$/.X/'
778c582b7e3Smrg	exit ;;
779c582b7e3Smrg    CRAY*TS:*:*:*)
780c582b7e3Smrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
781c582b7e3Smrg	exit ;;
782c582b7e3Smrg    CRAY*T3E:*:*:*)
783c582b7e3Smrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
784c582b7e3Smrg	exit ;;
785c582b7e3Smrg    CRAY*SV1:*:*:*)
786c582b7e3Smrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
787c582b7e3Smrg	exit ;;
788c582b7e3Smrg    *:UNICOS/mp:*:*)
789c582b7e3Smrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
790c582b7e3Smrg	exit ;;
791c582b7e3Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
792c582b7e3Smrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
79342a55b46Smrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
79442a55b46Smrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
79542a55b46Smrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
79642a55b46Smrg	exit ;;
797c582b7e3Smrg    5000:UNIX_System_V:4.*:*)
79842a55b46Smrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
79942a55b46Smrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
80042a55b46Smrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
801c582b7e3Smrg	exit ;;
802c582b7e3Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
803c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
804c582b7e3Smrg	exit ;;
805c582b7e3Smrg    sparc*:BSD/OS:*:*)
806c582b7e3Smrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
807c582b7e3Smrg	exit ;;
808c582b7e3Smrg    *:BSD/OS:*:*)
809c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
810c582b7e3Smrg	exit ;;
811c582b7e3Smrg    *:FreeBSD:*:*)
81242a55b46Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
81342a55b46Smrg	case ${UNAME_PROCESSOR} in
814c582b7e3Smrg	    amd64)
815c582b7e3Smrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
816c582b7e3Smrg	    *)
81742a55b46Smrg		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
818c582b7e3Smrg	esac
819c582b7e3Smrg	exit ;;
820c582b7e3Smrg    i*:CYGWIN*:*)
821c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-cygwin
822c582b7e3Smrg	exit ;;
823e3d74329Smrg    *:MINGW64*:*)
824e3d74329Smrg	echo ${UNAME_MACHINE}-pc-mingw64
825e3d74329Smrg	exit ;;
826c582b7e3Smrg    *:MINGW*:*)
827c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-mingw32
828c582b7e3Smrg	exit ;;
82942a55b46Smrg    i*:MSYS*:*)
83042a55b46Smrg	echo ${UNAME_MACHINE}-pc-msys
83142a55b46Smrg	exit ;;
832c582b7e3Smrg    i*:windows32*:*)
83342a55b46Smrg	# uname -m includes "-pc" on this system.
83442a55b46Smrg	echo ${UNAME_MACHINE}-mingw32
835c582b7e3Smrg	exit ;;
836c582b7e3Smrg    i*:PW*:*)
837c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-pw32
838c582b7e3Smrg	exit ;;
83942a55b46Smrg    *:Interix*:*)
84042a55b46Smrg	case ${UNAME_MACHINE} in
84119019ffeSmrg	    x86)
842c582b7e3Smrg		echo i586-pc-interix${UNAME_RELEASE}
843c582b7e3Smrg		exit ;;
84442a55b46Smrg	    authenticamd | genuineintel | EM64T)
845c582b7e3Smrg		echo x86_64-unknown-interix${UNAME_RELEASE}
846c582b7e3Smrg		exit ;;
84719019ffeSmrg	    IA64)
84819019ffeSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
84919019ffeSmrg		exit ;;
850c582b7e3Smrg	esac ;;
851c582b7e3Smrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
852c582b7e3Smrg	echo i${UNAME_MACHINE}-pc-mks
853c582b7e3Smrg	exit ;;
85442a55b46Smrg    8664:Windows_NT:*)
85542a55b46Smrg	echo x86_64-pc-mks
85642a55b46Smrg	exit ;;
857c582b7e3Smrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
858c582b7e3Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
859c582b7e3Smrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
860c582b7e3Smrg	# UNAME_MACHINE based on the output of uname instead of i386?
861c582b7e3Smrg	echo i586-pc-interix
862c582b7e3Smrg	exit ;;
863c582b7e3Smrg    i*:UWIN*:*)
864c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-uwin
865c582b7e3Smrg	exit ;;
866c582b7e3Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
867c582b7e3Smrg	echo x86_64-unknown-cygwin
868c582b7e3Smrg	exit ;;
869c582b7e3Smrg    p*:CYGWIN*:*)
870c582b7e3Smrg	echo powerpcle-unknown-cygwin
871c582b7e3Smrg	exit ;;
872c582b7e3Smrg    prep*:SunOS:5.*:*)
873c582b7e3Smrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
874c582b7e3Smrg	exit ;;
875c582b7e3Smrg    *:GNU:*:*)
876c582b7e3Smrg	# the GNU system
877e3d74329Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
878c582b7e3Smrg	exit ;;
879c582b7e3Smrg    *:GNU/*:*:*)
880c582b7e3Smrg	# other systems with GNU libc and userland
881e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
882c582b7e3Smrg	exit ;;
883c582b7e3Smrg    i*86:Minix:*:*)
884c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-minix
885c582b7e3Smrg	exit ;;
8860496e070Smrg    aarch64:Linux:*:*)
887e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
8880496e070Smrg	exit ;;
8890496e070Smrg    aarch64_be:Linux:*:*)
8900496e070Smrg	UNAME_MACHINE=aarch64_be
891e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
8920496e070Smrg	exit ;;
89342a55b46Smrg    alpha:Linux:*:*)
89442a55b46Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
89542a55b46Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
89642a55b46Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
89742a55b46Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
89842a55b46Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
89942a55b46Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
90042a55b46Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
90142a55b46Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
90242a55b46Smrg	esac
90342a55b46Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
904e3d74329Smrg	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
905e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
906e3d74329Smrg	exit ;;
907e3d74329Smrg    arc:Linux:*:* | arceb:Linux:*:*)
908e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
90942a55b46Smrg	exit ;;
910c582b7e3Smrg    arm*:Linux:*:*)
91119019ffeSmrg	eval $set_cc_for_build
91219019ffeSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
91319019ffeSmrg	    | grep -q __ARM_EABI__
91419019ffeSmrg	then
915e3d74329Smrg	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
91619019ffeSmrg	else
91742a55b46Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
91842a55b46Smrg		| grep -q __ARM_PCS_VFP
91942a55b46Smrg	    then
920e3d74329Smrg		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
92142a55b46Smrg	    else
922e3d74329Smrg		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
92342a55b46Smrg	    fi
92419019ffeSmrg	fi
925c582b7e3Smrg	exit ;;
926c582b7e3Smrg    avr32*:Linux:*:*)
927e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
928c582b7e3Smrg	exit ;;
929c582b7e3Smrg    cris:Linux:*:*)
930e3d74329Smrg	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
931c582b7e3Smrg	exit ;;
932c582b7e3Smrg    crisv32:Linux:*:*)
933e3d74329Smrg	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
934c582b7e3Smrg	exit ;;
935c582b7e3Smrg    frv:Linux:*:*)
936e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
93742a55b46Smrg	exit ;;
93842a55b46Smrg    hexagon:Linux:*:*)
939e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
94042a55b46Smrg	exit ;;
94142a55b46Smrg    i*86:Linux:*:*)
942e3d74329Smrg	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
943c582b7e3Smrg	exit ;;
944c582b7e3Smrg    ia64:Linux:*:*)
945e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
946c582b7e3Smrg	exit ;;
947c582b7e3Smrg    m32r*:Linux:*:*)
948e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
949c582b7e3Smrg	exit ;;
950c582b7e3Smrg    m68*:Linux:*:*)
951e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
952c582b7e3Smrg	exit ;;
95342a55b46Smrg    mips:Linux:*:* | mips64:Linux:*:*)
954c582b7e3Smrg	eval $set_cc_for_build
955c582b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
956c582b7e3Smrg	#undef CPU
95742a55b46Smrg	#undef ${UNAME_MACHINE}
95842a55b46Smrg	#undef ${UNAME_MACHINE}el
959c582b7e3Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
96042a55b46Smrg	CPU=${UNAME_MACHINE}el
961c582b7e3Smrg	#else
962c582b7e3Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
96342a55b46Smrg	CPU=${UNAME_MACHINE}
964c582b7e3Smrg	#else
965c582b7e3Smrg	CPU=
966c582b7e3Smrg	#endif
967c582b7e3Smrg	#endif
968c582b7e3SmrgEOF
96942a55b46Smrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
970e3d74329Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
971c582b7e3Smrg	;;
972e3d74329Smrg    or1k:Linux:*:*)
973e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
974e3d74329Smrg	exit ;;
975c582b7e3Smrg    or32:Linux:*:*)
976e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
977c582b7e3Smrg	exit ;;
97842a55b46Smrg    padre:Linux:*:*)
979e3d74329Smrg	echo sparc-unknown-linux-${LIBC}
980c582b7e3Smrg	exit ;;
98142a55b46Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
982e3d74329Smrg	echo hppa64-unknown-linux-${LIBC}
983c582b7e3Smrg	exit ;;
984c582b7e3Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
985c582b7e3Smrg	# Look for CPU level
986c582b7e3Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
987e3d74329Smrg	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
988e3d74329Smrg	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
989e3d74329Smrg	  *)    echo hppa-unknown-linux-${LIBC} ;;
990c582b7e3Smrg	esac
991c582b7e3Smrg	exit ;;
99242a55b46Smrg    ppc64:Linux:*:*)
993e3d74329Smrg	echo powerpc64-unknown-linux-${LIBC}
99442a55b46Smrg	exit ;;
99542a55b46Smrg    ppc:Linux:*:*)
996e3d74329Smrg	echo powerpc-unknown-linux-${LIBC}
997e3d74329Smrg	exit ;;
998e3d74329Smrg    ppc64le:Linux:*:*)
999e3d74329Smrg	echo powerpc64le-unknown-linux-${LIBC}
1000e3d74329Smrg	exit ;;
1001e3d74329Smrg    ppcle:Linux:*:*)
1002e3d74329Smrg	echo powerpcle-unknown-linux-${LIBC}
1003c582b7e3Smrg	exit ;;
1004c582b7e3Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1005e3d74329Smrg	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1006c582b7e3Smrg	exit ;;
1007c582b7e3Smrg    sh64*:Linux:*:*)
1008e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1009c582b7e3Smrg	exit ;;
1010c582b7e3Smrg    sh*:Linux:*:*)
1011e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1012c582b7e3Smrg	exit ;;
1013c582b7e3Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1014e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1015c582b7e3Smrg	exit ;;
101642a55b46Smrg    tile*:Linux:*:*)
1017e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
101842a55b46Smrg	exit ;;
1019c582b7e3Smrg    vax:Linux:*:*)
1020e3d74329Smrg	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1021c582b7e3Smrg	exit ;;
1022c582b7e3Smrg    x86_64:Linux:*:*)
1023e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1024c582b7e3Smrg	exit ;;
102519019ffeSmrg    xtensa*:Linux:*:*)
1026e3d74329Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1027c582b7e3Smrg	exit ;;
1028c582b7e3Smrg    i*86:DYNIX/ptx:4*:*)
1029c582b7e3Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1030c582b7e3Smrg	# earlier versions are messed up and put the nodename in both
1031c582b7e3Smrg	# sysname and nodename.
1032c582b7e3Smrg	echo i386-sequent-sysv4
1033c582b7e3Smrg	exit ;;
1034c582b7e3Smrg    i*86:UNIX_SV:4.2MP:2.*)
103542a55b46Smrg	# Unixware is an offshoot of SVR4, but it has its own version
103642a55b46Smrg	# number series starting with 2...
103742a55b46Smrg	# I am not positive that other SVR4 systems won't match this,
1038c582b7e3Smrg	# I just have to hope.  -- rms.
103942a55b46Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1040c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1041c582b7e3Smrg	exit ;;
1042c582b7e3Smrg    i*86:OS/2:*:*)
1043c582b7e3Smrg	# If we were able to find `uname', then EMX Unix compatibility
1044c582b7e3Smrg	# is probably installed.
1045c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-os2-emx
1046c582b7e3Smrg	exit ;;
1047c582b7e3Smrg    i*86:XTS-300:*:STOP)
1048c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-stop
1049c582b7e3Smrg	exit ;;
1050c582b7e3Smrg    i*86:atheos:*:*)
1051c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-atheos
1052c582b7e3Smrg	exit ;;
1053c582b7e3Smrg    i*86:syllable:*:*)
1054c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-syllable
1055c582b7e3Smrg	exit ;;
105642a55b46Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1057c582b7e3Smrg	echo i386-unknown-lynxos${UNAME_RELEASE}
1058c582b7e3Smrg	exit ;;
1059c582b7e3Smrg    i*86:*DOS:*:*)
1060c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1061c582b7e3Smrg	exit ;;
1062c582b7e3Smrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1063c582b7e3Smrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1064c582b7e3Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1065c582b7e3Smrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1066c582b7e3Smrg	else
1067c582b7e3Smrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1068c582b7e3Smrg	fi
1069c582b7e3Smrg	exit ;;
1070c582b7e3Smrg    i*86:*:5:[678]*)
107142a55b46Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1072c582b7e3Smrg	case `/bin/uname -X | grep "^Machine"` in
1073c582b7e3Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1074c582b7e3Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1075c582b7e3Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1076c582b7e3Smrg	esac
1077c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1078c582b7e3Smrg	exit ;;
1079c582b7e3Smrg    i*86:*:3.2:*)
1080c582b7e3Smrg	if test -f /usr/options/cb.name; then
1081c582b7e3Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1082c582b7e3Smrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1083c582b7e3Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1084c582b7e3Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1085c582b7e3Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1086c582b7e3Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1087c582b7e3Smrg			&& UNAME_MACHINE=i586
1088c582b7e3Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1089c582b7e3Smrg			&& UNAME_MACHINE=i686
1090c582b7e3Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1091c582b7e3Smrg			&& UNAME_MACHINE=i686
1092c582b7e3Smrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1093c582b7e3Smrg	else
1094c582b7e3Smrg		echo ${UNAME_MACHINE}-pc-sysv32
1095c582b7e3Smrg	fi
1096c582b7e3Smrg	exit ;;
1097c582b7e3Smrg    pc:*:*:*)
1098c582b7e3Smrg	# Left here for compatibility:
109942a55b46Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
110042a55b46Smrg	# the processor, so we play safe by assuming i586.
110142a55b46Smrg	# Note: whatever this is, it MUST be the same as what config.sub
110242a55b46Smrg	# prints for the "djgpp" host, or else GDB configury will decide that
110342a55b46Smrg	# this is a cross-build.
110442a55b46Smrg	echo i586-pc-msdosdjgpp
110542a55b46Smrg	exit ;;
1106c582b7e3Smrg    Intel:Mach:3*:*)
1107c582b7e3Smrg	echo i386-pc-mach3
1108c582b7e3Smrg	exit ;;
1109c582b7e3Smrg    paragon:*:*:*)
1110c582b7e3Smrg	echo i860-intel-osf1
1111c582b7e3Smrg	exit ;;
1112c582b7e3Smrg    i860:*:4.*:*) # i860-SVR4
1113c582b7e3Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1114c582b7e3Smrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1115c582b7e3Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1116c582b7e3Smrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1117c582b7e3Smrg	fi
1118c582b7e3Smrg	exit ;;
1119c582b7e3Smrg    mini*:CTIX:SYS*5:*)
1120c582b7e3Smrg	# "miniframe"
1121c582b7e3Smrg	echo m68010-convergent-sysv
1122c582b7e3Smrg	exit ;;
1123c582b7e3Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1124c582b7e3Smrg	echo m68k-convergent-sysv
1125c582b7e3Smrg	exit ;;
1126c582b7e3Smrg    M680?0:D-NIX:5.3:*)
1127c582b7e3Smrg	echo m68k-diab-dnix
1128c582b7e3Smrg	exit ;;
1129c582b7e3Smrg    M68*:*:R3V[5678]*:*)
1130c582b7e3Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1131c582b7e3Smrg    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)
1132c582b7e3Smrg	OS_REL=''
1133c582b7e3Smrg	test -r /etc/.relid \
1134c582b7e3Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1135c582b7e3Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1136c582b7e3Smrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1137c582b7e3Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1138c582b7e3Smrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1139c582b7e3Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
114042a55b46Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
114142a55b46Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
114242a55b46Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
114342a55b46Smrg	OS_REL='.3'
114442a55b46Smrg	test -r /etc/.relid \
114542a55b46Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
114642a55b46Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
114742a55b46Smrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
114842a55b46Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
114942a55b46Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
115042a55b46Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
115142a55b46Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1152c582b7e3Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1153c582b7e3Smrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
1154c582b7e3Smrg	exit ;;
1155c582b7e3Smrg    mc68030:UNIX_System_V:4.*:*)
1156c582b7e3Smrg	echo m68k-atari-sysv4
1157c582b7e3Smrg	exit ;;
1158c582b7e3Smrg    TSUNAMI:LynxOS:2.*:*)
1159c582b7e3Smrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
1160c582b7e3Smrg	exit ;;
1161c582b7e3Smrg    rs6000:LynxOS:2.*:*)
1162c582b7e3Smrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1163c582b7e3Smrg	exit ;;
116442a55b46Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1165c582b7e3Smrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1166c582b7e3Smrg	exit ;;
1167c582b7e3Smrg    SM[BE]S:UNIX_SV:*:*)
1168c582b7e3Smrg	echo mips-dde-sysv${UNAME_RELEASE}
1169c582b7e3Smrg	exit ;;
1170c582b7e3Smrg    RM*:ReliantUNIX-*:*:*)
1171c582b7e3Smrg	echo mips-sni-sysv4
1172c582b7e3Smrg	exit ;;
1173c582b7e3Smrg    RM*:SINIX-*:*:*)
1174c582b7e3Smrg	echo mips-sni-sysv4
1175c582b7e3Smrg	exit ;;
1176c582b7e3Smrg    *:SINIX-*:*:*)
1177c582b7e3Smrg	if uname -p 2>/dev/null >/dev/null ; then
1178c582b7e3Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1179c582b7e3Smrg		echo ${UNAME_MACHINE}-sni-sysv4
1180c582b7e3Smrg	else
1181c582b7e3Smrg		echo ns32k-sni-sysv
1182c582b7e3Smrg	fi
1183c582b7e3Smrg	exit ;;
118442a55b46Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
118542a55b46Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
118642a55b46Smrg	echo i586-unisys-sysv4
118742a55b46Smrg	exit ;;
1188c582b7e3Smrg    *:UNIX_System_V:4*:FTX*)
1189c582b7e3Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1190c582b7e3Smrg	# How about differentiating between stratus architectures? -djm
1191c582b7e3Smrg	echo hppa1.1-stratus-sysv4
1192c582b7e3Smrg	exit ;;
1193c582b7e3Smrg    *:*:*:FTX*)
1194c582b7e3Smrg	# From seanf@swdc.stratus.com.
1195c582b7e3Smrg	echo i860-stratus-sysv4
1196c582b7e3Smrg	exit ;;
1197c582b7e3Smrg    i*86:VOS:*:*)
1198c582b7e3Smrg	# From Paul.Green@stratus.com.
1199c582b7e3Smrg	echo ${UNAME_MACHINE}-stratus-vos
1200c582b7e3Smrg	exit ;;
1201c582b7e3Smrg    *:VOS:*:*)
1202c582b7e3Smrg	# From Paul.Green@stratus.com.
1203c582b7e3Smrg	echo hppa1.1-stratus-vos
1204c582b7e3Smrg	exit ;;
1205c582b7e3Smrg    mc68*:A/UX:*:*)
1206c582b7e3Smrg	echo m68k-apple-aux${UNAME_RELEASE}
1207c582b7e3Smrg	exit ;;
1208c582b7e3Smrg    news*:NEWS-OS:6*:*)
1209c582b7e3Smrg	echo mips-sony-newsos6
1210c582b7e3Smrg	exit ;;
1211c582b7e3Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1212c582b7e3Smrg	if [ -d /usr/nec ]; then
121342a55b46Smrg		echo mips-nec-sysv${UNAME_RELEASE}
1214c582b7e3Smrg	else
121542a55b46Smrg		echo mips-unknown-sysv${UNAME_RELEASE}
1216c582b7e3Smrg	fi
121742a55b46Smrg	exit ;;
1218c582b7e3Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1219c582b7e3Smrg	echo powerpc-be-beos
1220c582b7e3Smrg	exit ;;
1221c582b7e3Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1222c582b7e3Smrg	echo powerpc-apple-beos
1223c582b7e3Smrg	exit ;;
1224c582b7e3Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1225c582b7e3Smrg	echo i586-pc-beos
1226c582b7e3Smrg	exit ;;
122742a55b46Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
122842a55b46Smrg	echo i586-pc-haiku
122942a55b46Smrg	exit ;;
1230e3d74329Smrg    x86_64:Haiku:*:*)
1231e3d74329Smrg	echo x86_64-unknown-haiku
1232e3d74329Smrg	exit ;;
1233c582b7e3Smrg    SX-4:SUPER-UX:*:*)
1234c582b7e3Smrg	echo sx4-nec-superux${UNAME_RELEASE}
1235c582b7e3Smrg	exit ;;
1236c582b7e3Smrg    SX-5:SUPER-UX:*:*)
1237c582b7e3Smrg	echo sx5-nec-superux${UNAME_RELEASE}
1238c582b7e3Smrg	exit ;;
1239c582b7e3Smrg    SX-6:SUPER-UX:*:*)
1240c582b7e3Smrg	echo sx6-nec-superux${UNAME_RELEASE}
1241c582b7e3Smrg	exit ;;
1242c582b7e3Smrg    SX-7:SUPER-UX:*:*)
1243c582b7e3Smrg	echo sx7-nec-superux${UNAME_RELEASE}
1244c582b7e3Smrg	exit ;;
1245c582b7e3Smrg    SX-8:SUPER-UX:*:*)
1246c582b7e3Smrg	echo sx8-nec-superux${UNAME_RELEASE}
1247c582b7e3Smrg	exit ;;
1248c582b7e3Smrg    SX-8R:SUPER-UX:*:*)
1249c582b7e3Smrg	echo sx8r-nec-superux${UNAME_RELEASE}
1250c582b7e3Smrg	exit ;;
1251c582b7e3Smrg    Power*:Rhapsody:*:*)
1252c582b7e3Smrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1253c582b7e3Smrg	exit ;;
1254c582b7e3Smrg    *:Rhapsody:*:*)
1255c582b7e3Smrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1256c582b7e3Smrg	exit ;;
1257c582b7e3Smrg    *:Darwin:*:*)
1258c582b7e3Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1259e3d74329Smrg	eval $set_cc_for_build
1260e3d74329Smrg	if test "$UNAME_PROCESSOR" = unknown ; then
1261e3d74329Smrg	    UNAME_PROCESSOR=powerpc
1262e3d74329Smrg	fi
1263e3d74329Smrg	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
1264e3d74329Smrg	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1265e3d74329Smrg		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1266e3d74329Smrg		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1267e3d74329Smrg		    grep IS_64BIT_ARCH >/dev/null
1268e3d74329Smrg		then
1269e3d74329Smrg		    case $UNAME_PROCESSOR in
1270e3d74329Smrg			i386) UNAME_PROCESSOR=x86_64 ;;
1271e3d74329Smrg			powerpc) UNAME_PROCESSOR=powerpc64 ;;
1272e3d74329Smrg		    esac
1273e3d74329Smrg		fi
1274e3d74329Smrg	    fi
1275e3d74329Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1276e3d74329Smrg	    # Avoid executing cc on OS X 10.9, as it ships with a stub
1277e3d74329Smrg	    # that puts up a graphical alert prompting to install
1278e3d74329Smrg	    # developer tools.  Any system running Mac OS X 10.7 or
1279e3d74329Smrg	    # later (Darwin 11 and later) is required to have a 64-bit
1280e3d74329Smrg	    # processor. This is not true of the ARM version of Darwin
1281e3d74329Smrg	    # that Apple uses in portable devices.
1282e3d74329Smrg	    UNAME_PROCESSOR=x86_64
1283e3d74329Smrg	fi
1284c582b7e3Smrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1285c582b7e3Smrg	exit ;;
1286c582b7e3Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1287c582b7e3Smrg	UNAME_PROCESSOR=`uname -p`
1288c582b7e3Smrg	if test "$UNAME_PROCESSOR" = "x86"; then
1289c582b7e3Smrg		UNAME_PROCESSOR=i386
1290c582b7e3Smrg		UNAME_MACHINE=pc
1291c582b7e3Smrg	fi
1292c582b7e3Smrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1293c582b7e3Smrg	exit ;;
1294c582b7e3Smrg    *:QNX:*:4*)
1295c582b7e3Smrg	echo i386-pc-qnx
1296c582b7e3Smrg	exit ;;
129742a55b46Smrg    NEO-?:NONSTOP_KERNEL:*:*)
129842a55b46Smrg	echo neo-tandem-nsk${UNAME_RELEASE}
129942a55b46Smrg	exit ;;
1300e3d74329Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1301c582b7e3Smrg	echo nse-tandem-nsk${UNAME_RELEASE}
1302c582b7e3Smrg	exit ;;
1303c582b7e3Smrg    NSR-?:NONSTOP_KERNEL:*:*)
1304c582b7e3Smrg	echo nsr-tandem-nsk${UNAME_RELEASE}
1305c582b7e3Smrg	exit ;;
1306c582b7e3Smrg    *:NonStop-UX:*:*)
1307c582b7e3Smrg	echo mips-compaq-nonstopux
1308c582b7e3Smrg	exit ;;
1309c582b7e3Smrg    BS2000:POSIX*:*:*)
1310c582b7e3Smrg	echo bs2000-siemens-sysv
1311c582b7e3Smrg	exit ;;
1312c582b7e3Smrg    DS/*:UNIX_System_V:*:*)
1313c582b7e3Smrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1314c582b7e3Smrg	exit ;;
1315c582b7e3Smrg    *:Plan9:*:*)
1316c582b7e3Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1317c582b7e3Smrg	# is converted to i386 for consistency with other x86
1318c582b7e3Smrg	# operating systems.
1319c582b7e3Smrg	if test "$cputype" = "386"; then
1320c582b7e3Smrg	    UNAME_MACHINE=i386
1321c582b7e3Smrg	else
1322c582b7e3Smrg	    UNAME_MACHINE="$cputype"
1323c582b7e3Smrg	fi
1324c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-plan9
1325c582b7e3Smrg	exit ;;
1326c582b7e3Smrg    *:TOPS-10:*:*)
1327c582b7e3Smrg	echo pdp10-unknown-tops10
1328c582b7e3Smrg	exit ;;
1329c582b7e3Smrg    *:TENEX:*:*)
1330c582b7e3Smrg	echo pdp10-unknown-tenex
1331c582b7e3Smrg	exit ;;
1332c582b7e3Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1333c582b7e3Smrg	echo pdp10-dec-tops20
1334c582b7e3Smrg	exit ;;
1335c582b7e3Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1336c582b7e3Smrg	echo pdp10-xkl-tops20
1337c582b7e3Smrg	exit ;;
1338c582b7e3Smrg    *:TOPS-20:*:*)
1339c582b7e3Smrg	echo pdp10-unknown-tops20
1340c582b7e3Smrg	exit ;;
1341c582b7e3Smrg    *:ITS:*:*)
1342c582b7e3Smrg	echo pdp10-unknown-its
1343c582b7e3Smrg	exit ;;
1344c582b7e3Smrg    SEI:*:*:SEIUX)
134542a55b46Smrg	echo mips-sei-seiux${UNAME_RELEASE}
1346c582b7e3Smrg	exit ;;
1347c582b7e3Smrg    *:DragonFly:*:*)
1348c582b7e3Smrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1349c582b7e3Smrg	exit ;;
1350c582b7e3Smrg    *:*VMS:*:*)
135142a55b46Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1352c582b7e3Smrg	case "${UNAME_MACHINE}" in
1353c582b7e3Smrg	    A*) echo alpha-dec-vms ; exit ;;
1354c582b7e3Smrg	    I*) echo ia64-dec-vms ; exit ;;
1355c582b7e3Smrg	    V*) echo vax-dec-vms ; exit ;;
1356c582b7e3Smrg	esac ;;
1357c582b7e3Smrg    *:XENIX:*:SysV)
1358c582b7e3Smrg	echo i386-pc-xenix
1359c582b7e3Smrg	exit ;;
1360c582b7e3Smrg    i*86:skyos:*:*)
1361c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1362c582b7e3Smrg	exit ;;
1363c582b7e3Smrg    i*86:rdos:*:*)
1364c582b7e3Smrg	echo ${UNAME_MACHINE}-pc-rdos
1365c582b7e3Smrg	exit ;;
136642a55b46Smrg    i*86:AROS:*:*)
136742a55b46Smrg	echo ${UNAME_MACHINE}-pc-aros
136842a55b46Smrg	exit ;;
13690496e070Smrg    x86_64:VMkernel:*:*)
13700496e070Smrg	echo ${UNAME_MACHINE}-unknown-esx
13710496e070Smrg	exit ;;
1372c582b7e3Smrgesac
1373c582b7e3Smrg
1374c582b7e3Smrgeval $set_cc_for_build
1375c582b7e3Smrgcat >$dummy.c <<EOF
1376c582b7e3Smrg#ifdef _SEQUENT_
1377c582b7e3Smrg# include <sys/types.h>
1378c582b7e3Smrg# include <sys/utsname.h>
1379c582b7e3Smrg#endif
1380c582b7e3Smrgmain ()
1381c582b7e3Smrg{
1382c582b7e3Smrg#if defined (sony)
1383c582b7e3Smrg#if defined (MIPSEB)
1384c582b7e3Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1385c582b7e3Smrg     I don't know....  */
1386c582b7e3Smrg  printf ("mips-sony-bsd\n"); exit (0);
1387c582b7e3Smrg#else
1388c582b7e3Smrg#include <sys/param.h>
1389c582b7e3Smrg  printf ("m68k-sony-newsos%s\n",
1390c582b7e3Smrg#ifdef NEWSOS4
139142a55b46Smrg	"4"
1392c582b7e3Smrg#else
139342a55b46Smrg	""
1394c582b7e3Smrg#endif
139542a55b46Smrg	); exit (0);
1396c582b7e3Smrg#endif
1397c582b7e3Smrg#endif
1398c582b7e3Smrg
1399c582b7e3Smrg#if defined (__arm) && defined (__acorn) && defined (__unix)
1400c582b7e3Smrg  printf ("arm-acorn-riscix\n"); exit (0);
1401c582b7e3Smrg#endif
1402c582b7e3Smrg
1403c582b7e3Smrg#if defined (hp300) && !defined (hpux)
1404c582b7e3Smrg  printf ("m68k-hp-bsd\n"); exit (0);
1405c582b7e3Smrg#endif
1406c582b7e3Smrg
1407c582b7e3Smrg#if defined (NeXT)
1408c582b7e3Smrg#if !defined (__ARCHITECTURE__)
1409c582b7e3Smrg#define __ARCHITECTURE__ "m68k"
1410c582b7e3Smrg#endif
1411c582b7e3Smrg  int version;
1412c582b7e3Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1413c582b7e3Smrg  if (version < 4)
1414c582b7e3Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1415c582b7e3Smrg  else
1416c582b7e3Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1417c582b7e3Smrg  exit (0);
1418c582b7e3Smrg#endif
1419c582b7e3Smrg
1420c582b7e3Smrg#if defined (MULTIMAX) || defined (n16)
1421c582b7e3Smrg#if defined (UMAXV)
1422c582b7e3Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1423c582b7e3Smrg#else
1424c582b7e3Smrg#if defined (CMU)
1425c582b7e3Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1426c582b7e3Smrg#else
1427c582b7e3Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1428c582b7e3Smrg#endif
1429c582b7e3Smrg#endif
1430c582b7e3Smrg#endif
1431c582b7e3Smrg
1432c582b7e3Smrg#if defined (__386BSD__)
1433c582b7e3Smrg  printf ("i386-pc-bsd\n"); exit (0);
1434c582b7e3Smrg#endif
1435c582b7e3Smrg
1436c582b7e3Smrg#if defined (sequent)
1437c582b7e3Smrg#if defined (i386)
1438c582b7e3Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1439c582b7e3Smrg#endif
1440c582b7e3Smrg#if defined (ns32000)
1441c582b7e3Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1442c582b7e3Smrg#endif
1443c582b7e3Smrg#endif
1444c582b7e3Smrg
1445c582b7e3Smrg#if defined (_SEQUENT_)
1446c582b7e3Smrg    struct utsname un;
1447c582b7e3Smrg
1448c582b7e3Smrg    uname(&un);
1449c582b7e3Smrg
1450c582b7e3Smrg    if (strncmp(un.version, "V2", 2) == 0) {
1451c582b7e3Smrg	printf ("i386-sequent-ptx2\n"); exit (0);
1452c582b7e3Smrg    }
1453c582b7e3Smrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1454c582b7e3Smrg	printf ("i386-sequent-ptx1\n"); exit (0);
1455c582b7e3Smrg    }
1456c582b7e3Smrg    printf ("i386-sequent-ptx\n"); exit (0);
1457c582b7e3Smrg
1458c582b7e3Smrg#endif
1459c582b7e3Smrg
1460c582b7e3Smrg#if defined (vax)
1461c582b7e3Smrg# if !defined (ultrix)
1462c582b7e3Smrg#  include <sys/param.h>
1463c582b7e3Smrg#  if defined (BSD)
1464c582b7e3Smrg#   if BSD == 43
1465c582b7e3Smrg      printf ("vax-dec-bsd4.3\n"); exit (0);
1466c582b7e3Smrg#   else
1467c582b7e3Smrg#    if BSD == 199006
1468c582b7e3Smrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1469c582b7e3Smrg#    else
1470c582b7e3Smrg      printf ("vax-dec-bsd\n"); exit (0);
1471c582b7e3Smrg#    endif
1472c582b7e3Smrg#   endif
1473c582b7e3Smrg#  else
1474c582b7e3Smrg    printf ("vax-dec-bsd\n"); exit (0);
1475c582b7e3Smrg#  endif
1476c582b7e3Smrg# else
1477c582b7e3Smrg    printf ("vax-dec-ultrix\n"); exit (0);
1478c582b7e3Smrg# endif
1479c582b7e3Smrg#endif
1480c582b7e3Smrg
1481c582b7e3Smrg#if defined (alliant) && defined (i860)
1482c582b7e3Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1483c582b7e3Smrg#endif
1484c582b7e3Smrg
1485c582b7e3Smrg  exit (1);
1486c582b7e3Smrg}
1487c582b7e3SmrgEOF
1488c582b7e3Smrg
1489c582b7e3Smrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1490c582b7e3Smrg	{ echo "$SYSTEM_NAME"; exit; }
1491c582b7e3Smrg
1492c582b7e3Smrg# Apollos put the system type in the environment.
1493c582b7e3Smrg
1494c582b7e3Smrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1495c582b7e3Smrg
1496c582b7e3Smrg# Convex versions that predate uname can use getsysinfo(1)
1497c582b7e3Smrg
1498c582b7e3Smrgif [ -x /usr/convex/getsysinfo ]
1499c582b7e3Smrgthen
1500c582b7e3Smrg    case `getsysinfo -f cpu_type` in
1501c582b7e3Smrg    c1*)
1502c582b7e3Smrg	echo c1-convex-bsd
1503c582b7e3Smrg	exit ;;
1504c582b7e3Smrg    c2*)
1505c582b7e3Smrg	if getsysinfo -f scalar_acc
1506c582b7e3Smrg	then echo c32-convex-bsd
1507c582b7e3Smrg	else echo c2-convex-bsd
1508c582b7e3Smrg	fi
1509c582b7e3Smrg	exit ;;
1510c582b7e3Smrg    c34*)
1511c582b7e3Smrg	echo c34-convex-bsd
1512c582b7e3Smrg	exit ;;
1513c582b7e3Smrg    c38*)
1514c582b7e3Smrg	echo c38-convex-bsd
1515c582b7e3Smrg	exit ;;
1516c582b7e3Smrg    c4*)
1517c582b7e3Smrg	echo c4-convex-bsd
1518c582b7e3Smrg	exit ;;
1519c582b7e3Smrg    esac
1520c582b7e3Smrgfi
1521c582b7e3Smrg
1522c582b7e3Smrgcat >&2 <<EOF
1523c582b7e3Smrg$0: unable to guess system type
1524c582b7e3Smrg
1525c582b7e3SmrgThis script, last modified $timestamp, has failed to recognize
1526c582b7e3Smrgthe operating system you are using. It is advised that you
1527c582b7e3Smrgdownload the most up to date version of the config scripts from
1528c582b7e3Smrg
152919019ffeSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1530c582b7e3Smrgand
153119019ffeSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1532c582b7e3Smrg
1533c582b7e3SmrgIf the version you run ($0) is already up to date, please
1534c582b7e3Smrgsend the following data and any information you think might be
1535c582b7e3Smrgpertinent to <config-patches@gnu.org> in order to provide the needed
1536c582b7e3Smrginformation to handle your system.
1537c582b7e3Smrg
1538c582b7e3Smrgconfig.guess timestamp = $timestamp
1539c582b7e3Smrg
1540c582b7e3Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1541c582b7e3Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1542c582b7e3Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1543c582b7e3Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1544c582b7e3Smrg
1545c582b7e3Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1546c582b7e3Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1547c582b7e3Smrg
1548c582b7e3Smrghostinfo               = `(hostinfo) 2>/dev/null`
1549c582b7e3Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1550c582b7e3Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1551c582b7e3Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1552c582b7e3Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1553c582b7e3Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1554c582b7e3Smrg
1555c582b7e3SmrgUNAME_MACHINE = ${UNAME_MACHINE}
1556c582b7e3SmrgUNAME_RELEASE = ${UNAME_RELEASE}
1557c582b7e3SmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
1558c582b7e3SmrgUNAME_VERSION = ${UNAME_VERSION}
1559c582b7e3SmrgEOF
1560c582b7e3Smrg
1561c582b7e3Smrgexit 1
1562c582b7e3Smrg
1563c582b7e3Smrg# Local variables:
1564c582b7e3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
1565c582b7e3Smrg# time-stamp-start: "timestamp='"
1566c582b7e3Smrg# time-stamp-format: "%:y-%02m-%02d"
1567c582b7e3Smrg# time-stamp-end: "'"
1568c582b7e3Smrg# End:
1569