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