config.guess revision 2a75d1c4
1f7ec340bSmacallan#! /bin/sh
2f7ec340bSmacallan# Attempt to guess a canonical system name.
3f7ec340bSmacallan#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
42a75d1c4Smrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
52a75d1c4Smrg#   2011, 2012 Free Software Foundation, Inc.
6f7ec340bSmacallan
72a75d1c4Smrgtimestamp='2012-08-14'
8f7ec340bSmacallan
9f7ec340bSmacallan# This file is free software; you can redistribute it and/or modify it
10f7ec340bSmacallan# under the terms of the GNU General Public License as published by
11f7ec340bSmacallan# the Free Software Foundation; either version 2 of the License, or
12f7ec340bSmacallan# (at your option) any later version.
13f7ec340bSmacallan#
14f7ec340bSmacallan# This program is distributed in the hope that it will be useful, but
15f7ec340bSmacallan# WITHOUT ANY WARRANTY; without even the implied warranty of
16f7ec340bSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17f7ec340bSmacallan# General Public License for more details.
18f7ec340bSmacallan#
19f7ec340bSmacallan# You should have received a copy of the GNU General Public License
202a75d1c4Smrg# along with this program; if not, see <http://www.gnu.org/licenses/>.
21f7ec340bSmacallan#
22f7ec340bSmacallan# As a special exception to the GNU General Public License, if you
23f7ec340bSmacallan# distribute this file as part of a program that contains a
24f7ec340bSmacallan# configuration script generated by Autoconf, you may include it under
25f7ec340bSmacallan# the same distribution terms that you use for the rest of that program.
26f7ec340bSmacallan
277ce7e03cSmrg
282a75d1c4Smrg# Originally written by Per Bothner.  Please send patches (context
292a75d1c4Smrg# diff format) to <config-patches@gnu.org> and include a ChangeLog
302a75d1c4Smrg# entry.
31f7ec340bSmacallan#
32f7ec340bSmacallan# This script attempts to guess a canonical system name similar to
33f7ec340bSmacallan# config.sub.  If it succeeds, it prints the system name on stdout, and
34f7ec340bSmacallan# exits with 0.  Otherwise, it exits with 1.
35f7ec340bSmacallan#
362a75d1c4Smrg# You can get the latest version of this script from:
372a75d1c4Smrg# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
38f7ec340bSmacallan
39f7ec340bSmacallanme=`echo "$0" | sed -e 's,.*/,,'`
40f7ec340bSmacallan
41f7ec340bSmacallanusage="\
42f7ec340bSmacallanUsage: $0 [OPTION]
43f7ec340bSmacallan
44f7ec340bSmacallanOutput the configuration name of the system \`$me' is run on.
45f7ec340bSmacallan
46f7ec340bSmacallanOperation modes:
47f7ec340bSmacallan  -h, --help         print this help, then exit
48f7ec340bSmacallan  -t, --time-stamp   print date of last modification, then exit
49f7ec340bSmacallan  -v, --version      print version number, then exit
50f7ec340bSmacallan
51f7ec340bSmacallanReport bugs and patches to <config-patches@gnu.org>."
52f7ec340bSmacallan
53f7ec340bSmacallanversion="\
54f7ec340bSmacallanGNU config.guess ($timestamp)
55f7ec340bSmacallan
56f7ec340bSmacallanOriginally written by Per Bothner.
572a75d1c4SmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
582a75d1c4Smrg2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
592a75d1c4SmrgFree Software Foundation, Inc.
60f7ec340bSmacallan
61f7ec340bSmacallanThis is free software; see the source for copying conditions.  There is NO
62f7ec340bSmacallanwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
63f7ec340bSmacallan
64f7ec340bSmacallanhelp="
65f7ec340bSmacallanTry \`$me --help' for more information."
66f7ec340bSmacallan
67f7ec340bSmacallan# Parse command line
68f7ec340bSmacallanwhile test $# -gt 0 ; do
69f7ec340bSmacallan  case $1 in
70f7ec340bSmacallan    --time-stamp | --time* | -t )
717ce7e03cSmrg       echo "$timestamp" ; exit ;;
72f7ec340bSmacallan    --version | -v )
737ce7e03cSmrg       echo "$version" ; exit ;;
74f7ec340bSmacallan    --help | --h* | -h )
757ce7e03cSmrg       echo "$usage"; exit ;;
76f7ec340bSmacallan    -- )     # Stop option processing
77f7ec340bSmacallan       shift; break ;;
78f7ec340bSmacallan    - )	# Use stdin as input.
79f7ec340bSmacallan       break ;;
80f7ec340bSmacallan    -* )
81f7ec340bSmacallan       echo "$me: invalid option $1$help" >&2
82f7ec340bSmacallan       exit 1 ;;
83f7ec340bSmacallan    * )
84f7ec340bSmacallan       break ;;
85f7ec340bSmacallan  esac
86f7ec340bSmacallandone
87f7ec340bSmacallan
88f7ec340bSmacallanif test $# != 0; then
89f7ec340bSmacallan  echo "$me: too many arguments$help" >&2
90f7ec340bSmacallan  exit 1
91f7ec340bSmacallanfi
92f7ec340bSmacallan
93f7ec340bSmacallantrap 'exit 1' 1 2 15
94f7ec340bSmacallan
95f7ec340bSmacallan# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96f7ec340bSmacallan# compiler to aid in system detection is discouraged as it requires
97f7ec340bSmacallan# temporary files to be created and, as you can see below, it is a
98f7ec340bSmacallan# headache to deal with in a portable fashion.
99f7ec340bSmacallan
100f7ec340bSmacallan# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
101f7ec340bSmacallan# use `HOST_CC' if defined, but it is deprecated.
102f7ec340bSmacallan
103f7ec340bSmacallan# Portable tmp directory creation inspired by the Autoconf team.
104f7ec340bSmacallan
105f7ec340bSmacallanset_cc_for_build='
106f7ec340bSmacallantrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107f7ec340bSmacallantrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108f7ec340bSmacallan: ${TMPDIR=/tmp} ;
1097ce7e03cSmrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110f7ec340bSmacallan { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111f7ec340bSmacallan { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112f7ec340bSmacallan { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113f7ec340bSmacallandummy=$tmp/dummy ;
114f7ec340bSmacallantmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115f7ec340bSmacallancase $CC_FOR_BUILD,$HOST_CC,$CC in
116f7ec340bSmacallan ,,)    echo "int x;" > $dummy.c ;
117f7ec340bSmacallan	for c in cc gcc c89 c99 ; do
118f7ec340bSmacallan	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
119f7ec340bSmacallan	     CC_FOR_BUILD="$c"; break ;
120f7ec340bSmacallan	  fi ;
121f7ec340bSmacallan	done ;
122f7ec340bSmacallan	if test x"$CC_FOR_BUILD" = x ; then
123f7ec340bSmacallan	  CC_FOR_BUILD=no_compiler_found ;
124f7ec340bSmacallan	fi
125f7ec340bSmacallan	;;
126f7ec340bSmacallan ,,*)   CC_FOR_BUILD=$CC ;;
127f7ec340bSmacallan ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1287ce7e03cSmrgesac ; set_cc_for_build= ;'
129f7ec340bSmacallan
130f7ec340bSmacallan# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
131f7ec340bSmacallan# (ghazi@noc.rutgers.edu 1994-08-24)
132f7ec340bSmacallanif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
133f7ec340bSmacallan	PATH=$PATH:/.attbin ; export PATH
134f7ec340bSmacallanfi
135f7ec340bSmacallan
136f7ec340bSmacallanUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
137f7ec340bSmacallanUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
138f7ec340bSmacallanUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
139f7ec340bSmacallanUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
140f7ec340bSmacallan
1412a75d1c4Smrgcase "${UNAME_SYSTEM}" in
1422a75d1c4SmrgLinux|GNU/*)
1432a75d1c4Smrg	eval $set_cc_for_build
1442a75d1c4Smrg	cat <<-EOF > $dummy.c
1452a75d1c4Smrg	#include <features.h>
1462a75d1c4Smrg	#ifdef __UCLIBC__
1472a75d1c4Smrg	# ifdef __UCLIBC_CONFIG_VERSION__
1482a75d1c4Smrg	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
1492a75d1c4Smrg	# else
1502a75d1c4Smrg	LIBC=uclibc
1512a75d1c4Smrg	# endif
1522a75d1c4Smrg	#else
1532a75d1c4Smrg	# ifdef __dietlibc__
1542a75d1c4Smrg	LIBC=dietlibc
1552a75d1c4Smrg	# else
1562a75d1c4Smrg	LIBC=gnu
1572a75d1c4Smrg	# endif
1582a75d1c4Smrg	#endif
1592a75d1c4Smrg	EOF
1602a75d1c4Smrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
1612a75d1c4Smrg	;;
1622a75d1c4Smrgesac
1632a75d1c4Smrg
164f7ec340bSmacallan# Note: order is significant - the case branches are not exclusive.
165f7ec340bSmacallan
166f7ec340bSmacallancase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
167f7ec340bSmacallan    *:NetBSD:*:*)
168f7ec340bSmacallan	# NetBSD (nbsd) targets should (where applicable) match one or
1692a75d1c4Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
170f7ec340bSmacallan	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
171f7ec340bSmacallan	# switched to ELF, *-*-netbsd* would select the old
172f7ec340bSmacallan	# object file format.  This provides both forward
173f7ec340bSmacallan	# compatibility and a consistent mechanism for selecting the
174f7ec340bSmacallan	# object file format.
175f7ec340bSmacallan	#
176f7ec340bSmacallan	# Note: NetBSD doesn't particularly care about the vendor
177f7ec340bSmacallan	# portion of the name.  We always set it to "unknown".
178f7ec340bSmacallan	sysctl="sysctl -n hw.machine_arch"
179f7ec340bSmacallan	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
180f7ec340bSmacallan	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
181f7ec340bSmacallan	case "${UNAME_MACHINE_ARCH}" in
182f7ec340bSmacallan	    armeb) machine=armeb-unknown ;;
183f7ec340bSmacallan	    arm*) machine=arm-unknown ;;
184f7ec340bSmacallan	    sh3el) machine=shl-unknown ;;
185f7ec340bSmacallan	    sh3eb) machine=sh-unknown ;;
1867ce7e03cSmrg	    sh5el) machine=sh5le-unknown ;;
187f7ec340bSmacallan	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
188f7ec340bSmacallan	esac
189f7ec340bSmacallan	# The Operating System including object format, if it has switched
190f7ec340bSmacallan	# to ELF recently, or will in the future.
191f7ec340bSmacallan	case "${UNAME_MACHINE_ARCH}" in
192f7ec340bSmacallan	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
193f7ec340bSmacallan		eval $set_cc_for_build
194f7ec340bSmacallan		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1952a75d1c4Smrg			| grep -q __ELF__
196f7ec340bSmacallan		then
197f7ec340bSmacallan		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
198f7ec340bSmacallan		    # Return netbsd for either.  FIX?
199f7ec340bSmacallan		    os=netbsd
200f7ec340bSmacallan		else
201f7ec340bSmacallan		    os=netbsdelf
202f7ec340bSmacallan		fi
203f7ec340bSmacallan		;;
204f7ec340bSmacallan	    *)
2052a75d1c4Smrg		os=netbsd
206f7ec340bSmacallan		;;
207f7ec340bSmacallan	esac
208f7ec340bSmacallan	# The OS release
209f7ec340bSmacallan	# Debian GNU/NetBSD machines have a different userland, and
210f7ec340bSmacallan	# thus, need a distinct triplet. However, they do not need
211f7ec340bSmacallan	# kernel version information, so it can be replaced with a
212f7ec340bSmacallan	# suitable tag, in the style of linux-gnu.
213f7ec340bSmacallan	case "${UNAME_VERSION}" in
214f7ec340bSmacallan	    Debian*)
215f7ec340bSmacallan		release='-gnu'
216f7ec340bSmacallan		;;
217f7ec340bSmacallan	    *)
218f7ec340bSmacallan		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
219f7ec340bSmacallan		;;
220f7ec340bSmacallan	esac
221f7ec340bSmacallan	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
222f7ec340bSmacallan	# contains redundant information, the shorter form:
223f7ec340bSmacallan	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
224f7ec340bSmacallan	echo "${machine}-${os}${release}"
2257ce7e03cSmrg	exit ;;
2262a75d1c4Smrg    *:Bitrig:*:*)
2272a75d1c4Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2282a75d1c4Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
2292a75d1c4Smrg	exit ;;
230f7ec340bSmacallan    *:OpenBSD:*:*)
2317ce7e03cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2327ce7e03cSmrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
2337ce7e03cSmrg	exit ;;
2347ce7e03cSmrg    *:ekkoBSD:*:*)
2357ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
2367ce7e03cSmrg	exit ;;
2377ce7e03cSmrg    *:SolidBSD:*:*)
2387ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
2397ce7e03cSmrg	exit ;;
2407ce7e03cSmrg    macppc:MirBSD:*:*)
2417ce7e03cSmrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
2427ce7e03cSmrg	exit ;;
2437ce7e03cSmrg    *:MirBSD:*:*)
2447ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
2457ce7e03cSmrg	exit ;;
246f7ec340bSmacallan    alpha:OSF1:*:*)
2477ce7e03cSmrg	case $UNAME_RELEASE in
2487ce7e03cSmrg	*4.0)
249f7ec340bSmacallan		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2507ce7e03cSmrg		;;
2517ce7e03cSmrg	*5.*)
2522a75d1c4Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2537ce7e03cSmrg		;;
2547ce7e03cSmrg	esac
255f7ec340bSmacallan	# According to Compaq, /usr/sbin/psrinfo has been available on
256f7ec340bSmacallan	# OSF/1 and Tru64 systems produced since 1995.  I hope that
257f7ec340bSmacallan	# covers most systems running today.  This code pipes the CPU
258f7ec340bSmacallan	# types through head -n 1, so we only detect the type of CPU 0.
259f7ec340bSmacallan	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
260f7ec340bSmacallan	case "$ALPHA_CPU_TYPE" in
261f7ec340bSmacallan	    "EV4 (21064)")
262f7ec340bSmacallan		UNAME_MACHINE="alpha" ;;
263f7ec340bSmacallan	    "EV4.5 (21064)")
264f7ec340bSmacallan		UNAME_MACHINE="alpha" ;;
265f7ec340bSmacallan	    "LCA4 (21066/21068)")
266f7ec340bSmacallan		UNAME_MACHINE="alpha" ;;
267f7ec340bSmacallan	    "EV5 (21164)")
268f7ec340bSmacallan		UNAME_MACHINE="alphaev5" ;;
269f7ec340bSmacallan	    "EV5.6 (21164A)")
270f7ec340bSmacallan		UNAME_MACHINE="alphaev56" ;;
271f7ec340bSmacallan	    "EV5.6 (21164PC)")
272f7ec340bSmacallan		UNAME_MACHINE="alphapca56" ;;
273f7ec340bSmacallan	    "EV5.7 (21164PC)")
274f7ec340bSmacallan		UNAME_MACHINE="alphapca57" ;;
275f7ec340bSmacallan	    "EV6 (21264)")
276f7ec340bSmacallan		UNAME_MACHINE="alphaev6" ;;
277f7ec340bSmacallan	    "EV6.7 (21264A)")
278f7ec340bSmacallan		UNAME_MACHINE="alphaev67" ;;
279f7ec340bSmacallan	    "EV6.8CB (21264C)")
280f7ec340bSmacallan		UNAME_MACHINE="alphaev68" ;;
281f7ec340bSmacallan	    "EV6.8AL (21264B)")
282f7ec340bSmacallan		UNAME_MACHINE="alphaev68" ;;
283f7ec340bSmacallan	    "EV6.8CX (21264D)")
284f7ec340bSmacallan		UNAME_MACHINE="alphaev68" ;;
285f7ec340bSmacallan	    "EV6.9A (21264/EV69A)")
286f7ec340bSmacallan		UNAME_MACHINE="alphaev69" ;;
287f7ec340bSmacallan	    "EV7 (21364)")
288f7ec340bSmacallan		UNAME_MACHINE="alphaev7" ;;
289f7ec340bSmacallan	    "EV7.9 (21364A)")
290f7ec340bSmacallan		UNAME_MACHINE="alphaev79" ;;
291f7ec340bSmacallan	esac
2927ce7e03cSmrg	# A Pn.n version is a patched version.
293f7ec340bSmacallan	# A Vn.n version is a released version.
294f7ec340bSmacallan	# A Tn.n version is a released field test version.
295f7ec340bSmacallan	# A Xn.n version is an unreleased experimental baselevel.
296f7ec340bSmacallan	# 1.2 uses "1.2" for uname -r.
2977ce7e03cSmrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2982a75d1c4Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
2992a75d1c4Smrg	exitcode=$?
3002a75d1c4Smrg	trap '' 0
3012a75d1c4Smrg	exit $exitcode ;;
302f7ec340bSmacallan    Alpha\ *:Windows_NT*:*)
303f7ec340bSmacallan	# How do we know it's Interix rather than the generic POSIX subsystem?
304f7ec340bSmacallan	# Should we change UNAME_MACHINE based on the output of uname instead
305f7ec340bSmacallan	# of the specific Alpha model?
306f7ec340bSmacallan	echo alpha-pc-interix
3077ce7e03cSmrg	exit ;;
308f7ec340bSmacallan    21064:Windows_NT:50:3)
309f7ec340bSmacallan	echo alpha-dec-winnt3.5
3107ce7e03cSmrg	exit ;;
311f7ec340bSmacallan    Amiga*:UNIX_System_V:4.0:*)
312f7ec340bSmacallan	echo m68k-unknown-sysv4
3137ce7e03cSmrg	exit ;;
314f7ec340bSmacallan    *:[Aa]miga[Oo][Ss]:*:*)
315f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-amigaos
3167ce7e03cSmrg	exit ;;
317f7ec340bSmacallan    *:[Mm]orph[Oo][Ss]:*:*)
318f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-morphos
3197ce7e03cSmrg	exit ;;
320f7ec340bSmacallan    *:OS/390:*:*)
321f7ec340bSmacallan	echo i370-ibm-openedition
3227ce7e03cSmrg	exit ;;
3237ce7e03cSmrg    *:z/VM:*:*)
3247ce7e03cSmrg	echo s390-ibm-zvmoe
3257ce7e03cSmrg	exit ;;
3267ce7e03cSmrg    *:OS400:*:*)
3272a75d1c4Smrg	echo powerpc-ibm-os400
3287ce7e03cSmrg	exit ;;
329f7ec340bSmacallan    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
330f7ec340bSmacallan	echo arm-acorn-riscix${UNAME_RELEASE}
3317ce7e03cSmrg	exit ;;
3327ce7e03cSmrg    arm:riscos:*:*|arm:RISCOS:*:*)
3337ce7e03cSmrg	echo arm-unknown-riscos
3347ce7e03cSmrg	exit ;;
335f7ec340bSmacallan    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
336f7ec340bSmacallan	echo hppa1.1-hitachi-hiuxmpp
3377ce7e03cSmrg	exit ;;
338f7ec340bSmacallan    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
339f7ec340bSmacallan	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
340f7ec340bSmacallan	if test "`(/bin/universe) 2>/dev/null`" = att ; then
341f7ec340bSmacallan		echo pyramid-pyramid-sysv3
342f7ec340bSmacallan	else
343f7ec340bSmacallan		echo pyramid-pyramid-bsd
344f7ec340bSmacallan	fi
3457ce7e03cSmrg	exit ;;
346f7ec340bSmacallan    NILE*:*:*:dcosx)
347f7ec340bSmacallan	echo pyramid-pyramid-svr4
3487ce7e03cSmrg	exit ;;
349f7ec340bSmacallan    DRS?6000:unix:4.0:6*)
350f7ec340bSmacallan	echo sparc-icl-nx6
3517ce7e03cSmrg	exit ;;
3527ce7e03cSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
353f7ec340bSmacallan	case `/usr/bin/uname -p` in
3547ce7e03cSmrg	    sparc) echo sparc-icl-nx7; exit ;;
355f7ec340bSmacallan	esac ;;
3562a75d1c4Smrg    s390x:SunOS:*:*)
3572a75d1c4Smrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3582a75d1c4Smrg	exit ;;
359f7ec340bSmacallan    sun4H:SunOS:5.*:*)
360f7ec340bSmacallan	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3617ce7e03cSmrg	exit ;;
362f7ec340bSmacallan    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
363f7ec340bSmacallan	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3647ce7e03cSmrg	exit ;;
3652a75d1c4Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
3662a75d1c4Smrg	echo i386-pc-auroraux${UNAME_RELEASE}
3672a75d1c4Smrg	exit ;;
3687ce7e03cSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
3692a75d1c4Smrg	eval $set_cc_for_build
3702a75d1c4Smrg	SUN_ARCH="i386"
3712a75d1c4Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
3722a75d1c4Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
3732a75d1c4Smrg	# This test works for both compilers.
3742a75d1c4Smrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
3752a75d1c4Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
3762a75d1c4Smrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
3772a75d1c4Smrg		grep IS_64BIT_ARCH >/dev/null
3782a75d1c4Smrg	    then
3792a75d1c4Smrg		SUN_ARCH="x86_64"
3802a75d1c4Smrg	    fi
3812a75d1c4Smrg	fi
3822a75d1c4Smrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3837ce7e03cSmrg	exit ;;
384f7ec340bSmacallan    sun4*:SunOS:6*:*)
385f7ec340bSmacallan	# According to config.sub, this is the proper way to canonicalize
386f7ec340bSmacallan	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
387f7ec340bSmacallan	# it's likely to be more like Solaris than SunOS4.
388f7ec340bSmacallan	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3897ce7e03cSmrg	exit ;;
390f7ec340bSmacallan    sun4*:SunOS:*:*)
391f7ec340bSmacallan	case "`/usr/bin/arch -k`" in
392f7ec340bSmacallan	    Series*|S4*)
393f7ec340bSmacallan		UNAME_RELEASE=`uname -v`
394f7ec340bSmacallan		;;
395f7ec340bSmacallan	esac
396f7ec340bSmacallan	# Japanese Language versions have a version number like `4.1.3-JL'.
397f7ec340bSmacallan	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3987ce7e03cSmrg	exit ;;
399f7ec340bSmacallan    sun3*:SunOS:*:*)
400f7ec340bSmacallan	echo m68k-sun-sunos${UNAME_RELEASE}
4017ce7e03cSmrg	exit ;;
402f7ec340bSmacallan    sun*:*:4.2BSD:*)
403f7ec340bSmacallan	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
404f7ec340bSmacallan	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
405f7ec340bSmacallan	case "`/bin/arch`" in
406f7ec340bSmacallan	    sun3)
407f7ec340bSmacallan		echo m68k-sun-sunos${UNAME_RELEASE}
408f7ec340bSmacallan		;;
409f7ec340bSmacallan	    sun4)
410f7ec340bSmacallan		echo sparc-sun-sunos${UNAME_RELEASE}
411f7ec340bSmacallan		;;
412f7ec340bSmacallan	esac
4137ce7e03cSmrg	exit ;;
414f7ec340bSmacallan    aushp:SunOS:*:*)
415f7ec340bSmacallan	echo sparc-auspex-sunos${UNAME_RELEASE}
4167ce7e03cSmrg	exit ;;
417f7ec340bSmacallan    # The situation for MiNT is a little confusing.  The machine name
418f7ec340bSmacallan    # can be virtually everything (everything which is not
419f7ec340bSmacallan    # "atarist" or "atariste" at least should have a processor
420f7ec340bSmacallan    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
421f7ec340bSmacallan    # to the lowercase version "mint" (or "freemint").  Finally
422f7ec340bSmacallan    # the system name "TOS" denotes a system which is actually not
423f7ec340bSmacallan    # MiNT.  But MiNT is downward compatible to TOS, so this should
424f7ec340bSmacallan    # be no problem.
425f7ec340bSmacallan    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4262a75d1c4Smrg	echo m68k-atari-mint${UNAME_RELEASE}
4277ce7e03cSmrg	exit ;;
428f7ec340bSmacallan    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
429f7ec340bSmacallan	echo m68k-atari-mint${UNAME_RELEASE}
4302a75d1c4Smrg	exit ;;
431f7ec340bSmacallan    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4322a75d1c4Smrg	echo m68k-atari-mint${UNAME_RELEASE}
4337ce7e03cSmrg	exit ;;
434f7ec340bSmacallan    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
4352a75d1c4Smrg	echo m68k-milan-mint${UNAME_RELEASE}
4362a75d1c4Smrg	exit ;;
437f7ec340bSmacallan    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
4382a75d1c4Smrg	echo m68k-hades-mint${UNAME_RELEASE}
4392a75d1c4Smrg	exit ;;
440f7ec340bSmacallan    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
4412a75d1c4Smrg	echo m68k-unknown-mint${UNAME_RELEASE}
4422a75d1c4Smrg	exit ;;
4437ce7e03cSmrg    m68k:machten:*:*)
4447ce7e03cSmrg	echo m68k-apple-machten${UNAME_RELEASE}
4457ce7e03cSmrg	exit ;;
446f7ec340bSmacallan    powerpc:machten:*:*)
447f7ec340bSmacallan	echo powerpc-apple-machten${UNAME_RELEASE}
4487ce7e03cSmrg	exit ;;
449f7ec340bSmacallan    RISC*:Mach:*:*)
450f7ec340bSmacallan	echo mips-dec-mach_bsd4.3
4517ce7e03cSmrg	exit ;;
452f7ec340bSmacallan    RISC*:ULTRIX:*:*)
453f7ec340bSmacallan	echo mips-dec-ultrix${UNAME_RELEASE}
4547ce7e03cSmrg	exit ;;
455f7ec340bSmacallan    VAX*:ULTRIX*:*:*)
456f7ec340bSmacallan	echo vax-dec-ultrix${UNAME_RELEASE}
4577ce7e03cSmrg	exit ;;
458f7ec340bSmacallan    2020:CLIX:*:* | 2430:CLIX:*:*)
459f7ec340bSmacallan	echo clipper-intergraph-clix${UNAME_RELEASE}
4607ce7e03cSmrg	exit ;;
461f7ec340bSmacallan    mips:*:*:UMIPS | mips:*:*:RISCos)
462f7ec340bSmacallan	eval $set_cc_for_build
463f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
464f7ec340bSmacallan#ifdef __cplusplus
465f7ec340bSmacallan#include <stdio.h>  /* for printf() prototype */
466f7ec340bSmacallan	int main (int argc, char *argv[]) {
467f7ec340bSmacallan#else
468f7ec340bSmacallan	int main (argc, argv) int argc; char *argv[]; {
469f7ec340bSmacallan#endif
470f7ec340bSmacallan	#if defined (host_mips) && defined (MIPSEB)
471f7ec340bSmacallan	#if defined (SYSTYPE_SYSV)
472f7ec340bSmacallan	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
473f7ec340bSmacallan	#endif
474f7ec340bSmacallan	#if defined (SYSTYPE_SVR4)
475f7ec340bSmacallan	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
476f7ec340bSmacallan	#endif
477f7ec340bSmacallan	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
478f7ec340bSmacallan	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
479f7ec340bSmacallan	#endif
480f7ec340bSmacallan	#endif
481f7ec340bSmacallan	  exit (-1);
482f7ec340bSmacallan	}
483f7ec340bSmacallanEOF
4847ce7e03cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
4857ce7e03cSmrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
4867ce7e03cSmrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
4877ce7e03cSmrg	    { echo "$SYSTEM_NAME"; exit; }
488f7ec340bSmacallan	echo mips-mips-riscos${UNAME_RELEASE}
4897ce7e03cSmrg	exit ;;
490f7ec340bSmacallan    Motorola:PowerMAX_OS:*:*)
491f7ec340bSmacallan	echo powerpc-motorola-powermax
4927ce7e03cSmrg	exit ;;
493f7ec340bSmacallan    Motorola:*:4.3:PL8-*)
494f7ec340bSmacallan	echo powerpc-harris-powermax
4957ce7e03cSmrg	exit ;;
496f7ec340bSmacallan    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
497f7ec340bSmacallan	echo powerpc-harris-powermax
4987ce7e03cSmrg	exit ;;
499f7ec340bSmacallan    Night_Hawk:Power_UNIX:*:*)
500f7ec340bSmacallan	echo powerpc-harris-powerunix
5017ce7e03cSmrg	exit ;;
502f7ec340bSmacallan    m88k:CX/UX:7*:*)
503f7ec340bSmacallan	echo m88k-harris-cxux7
5047ce7e03cSmrg	exit ;;
505f7ec340bSmacallan    m88k:*:4*:R4*)
506f7ec340bSmacallan	echo m88k-motorola-sysv4
5077ce7e03cSmrg	exit ;;
508f7ec340bSmacallan    m88k:*:3*:R3*)
509f7ec340bSmacallan	echo m88k-motorola-sysv3
5107ce7e03cSmrg	exit ;;
511f7ec340bSmacallan    AViiON:dgux:*:*)
5122a75d1c4Smrg	# DG/UX returns AViiON for all architectures
5132a75d1c4Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
514f7ec340bSmacallan	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
515f7ec340bSmacallan	then
516f7ec340bSmacallan	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
517f7ec340bSmacallan	       [ ${TARGET_BINARY_INTERFACE}x = x ]
518f7ec340bSmacallan	    then
519f7ec340bSmacallan		echo m88k-dg-dgux${UNAME_RELEASE}
520f7ec340bSmacallan	    else
521f7ec340bSmacallan		echo m88k-dg-dguxbcs${UNAME_RELEASE}
522f7ec340bSmacallan	    fi
523f7ec340bSmacallan	else
524f7ec340bSmacallan	    echo i586-dg-dgux${UNAME_RELEASE}
525f7ec340bSmacallan	fi
5262a75d1c4Smrg	exit ;;
527f7ec340bSmacallan    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
528f7ec340bSmacallan	echo m88k-dolphin-sysv3
5297ce7e03cSmrg	exit ;;
530f7ec340bSmacallan    M88*:*:R3*:*)
531f7ec340bSmacallan	# Delta 88k system running SVR3
532f7ec340bSmacallan	echo m88k-motorola-sysv3
5337ce7e03cSmrg	exit ;;
534f7ec340bSmacallan    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
535f7ec340bSmacallan	echo m88k-tektronix-sysv3
5367ce7e03cSmrg	exit ;;
537f7ec340bSmacallan    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
538f7ec340bSmacallan	echo m68k-tektronix-bsd
5397ce7e03cSmrg	exit ;;
540f7ec340bSmacallan    *:IRIX*:*:*)
541f7ec340bSmacallan	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
5427ce7e03cSmrg	exit ;;
543f7ec340bSmacallan    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5447ce7e03cSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5457ce7e03cSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
546f7ec340bSmacallan    i*86:AIX:*:*)
547f7ec340bSmacallan	echo i386-ibm-aix
5487ce7e03cSmrg	exit ;;
549f7ec340bSmacallan    ia64:AIX:*:*)
550f7ec340bSmacallan	if [ -x /usr/bin/oslevel ] ; then
551f7ec340bSmacallan		IBM_REV=`/usr/bin/oslevel`
552f7ec340bSmacallan	else
553f7ec340bSmacallan		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
554f7ec340bSmacallan	fi
555f7ec340bSmacallan	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
5567ce7e03cSmrg	exit ;;
557f7ec340bSmacallan    *:AIX:2:3)
558f7ec340bSmacallan	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
559f7ec340bSmacallan		eval $set_cc_for_build
560f7ec340bSmacallan		sed 's/^		//' << EOF >$dummy.c
561f7ec340bSmacallan		#include <sys/systemcfg.h>
562f7ec340bSmacallan
563f7ec340bSmacallan		main()
564f7ec340bSmacallan			{
565f7ec340bSmacallan			if (!__power_pc())
566f7ec340bSmacallan				exit(1);
567f7ec340bSmacallan			puts("powerpc-ibm-aix3.2.5");
568f7ec340bSmacallan			exit(0);
569f7ec340bSmacallan			}
570f7ec340bSmacallanEOF
5717ce7e03cSmrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
5727ce7e03cSmrg		then
5737ce7e03cSmrg			echo "$SYSTEM_NAME"
5747ce7e03cSmrg		else
5757ce7e03cSmrg			echo rs6000-ibm-aix3.2.5
5767ce7e03cSmrg		fi
577f7ec340bSmacallan	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
578f7ec340bSmacallan		echo rs6000-ibm-aix3.2.4
579f7ec340bSmacallan	else
580f7ec340bSmacallan		echo rs6000-ibm-aix3.2
581f7ec340bSmacallan	fi
5827ce7e03cSmrg	exit ;;
5832a75d1c4Smrg    *:AIX:*:[4567])
584f7ec340bSmacallan	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
585f7ec340bSmacallan	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
586f7ec340bSmacallan		IBM_ARCH=rs6000
587f7ec340bSmacallan	else
588f7ec340bSmacallan		IBM_ARCH=powerpc
589f7ec340bSmacallan	fi
590f7ec340bSmacallan	if [ -x /usr/bin/oslevel ] ; then
591f7ec340bSmacallan		IBM_REV=`/usr/bin/oslevel`
592f7ec340bSmacallan	else
593f7ec340bSmacallan		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
594f7ec340bSmacallan	fi
595f7ec340bSmacallan	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5967ce7e03cSmrg	exit ;;
597f7ec340bSmacallan    *:AIX:*:*)
598f7ec340bSmacallan	echo rs6000-ibm-aix
5997ce7e03cSmrg	exit ;;
600f7ec340bSmacallan    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
601f7ec340bSmacallan	echo romp-ibm-bsd4.4
6027ce7e03cSmrg	exit ;;
603f7ec340bSmacallan    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
604f7ec340bSmacallan	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
6057ce7e03cSmrg	exit ;;                             # report: romp-ibm BSD 4.3
606f7ec340bSmacallan    *:BOSX:*:*)
607f7ec340bSmacallan	echo rs6000-bull-bosx
6087ce7e03cSmrg	exit ;;
609f7ec340bSmacallan    DPX/2?00:B.O.S.:*:*)
610f7ec340bSmacallan	echo m68k-bull-sysv3
6117ce7e03cSmrg	exit ;;
612f7ec340bSmacallan    9000/[34]??:4.3bsd:1.*:*)
613f7ec340bSmacallan	echo m68k-hp-bsd
6147ce7e03cSmrg	exit ;;
615f7ec340bSmacallan    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
616f7ec340bSmacallan	echo m68k-hp-bsd4.4
6177ce7e03cSmrg	exit ;;
618f7ec340bSmacallan    9000/[34678]??:HP-UX:*:*)
619f7ec340bSmacallan	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
620f7ec340bSmacallan	case "${UNAME_MACHINE}" in
621f7ec340bSmacallan	    9000/31? )            HP_ARCH=m68000 ;;
622f7ec340bSmacallan	    9000/[34]?? )         HP_ARCH=m68k ;;
623f7ec340bSmacallan	    9000/[678][0-9][0-9])
624f7ec340bSmacallan		if [ -x /usr/bin/getconf ]; then
625f7ec340bSmacallan		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6262a75d1c4Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6272a75d1c4Smrg		    case "${sc_cpu_version}" in
6282a75d1c4Smrg		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
6292a75d1c4Smrg		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
6302a75d1c4Smrg		      532)                      # CPU_PA_RISC2_0
6312a75d1c4Smrg			case "${sc_kernel_bits}" in
6322a75d1c4Smrg			  32) HP_ARCH="hppa2.0n" ;;
6332a75d1c4Smrg			  64) HP_ARCH="hppa2.0w" ;;
634f7ec340bSmacallan			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
6352a75d1c4Smrg			esac ;;
6362a75d1c4Smrg		    esac
637f7ec340bSmacallan		fi
638f7ec340bSmacallan		if [ "${HP_ARCH}" = "" ]; then
639f7ec340bSmacallan		    eval $set_cc_for_build
6402a75d1c4Smrg		    sed 's/^		//' << EOF >$dummy.c
641f7ec340bSmacallan
6422a75d1c4Smrg		#define _HPUX_SOURCE
6432a75d1c4Smrg		#include <stdlib.h>
6442a75d1c4Smrg		#include <unistd.h>
645f7ec340bSmacallan
6462a75d1c4Smrg		int main ()
6472a75d1c4Smrg		{
6482a75d1c4Smrg		#if defined(_SC_KERNEL_BITS)
6492a75d1c4Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
6502a75d1c4Smrg		#endif
6512a75d1c4Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
652f7ec340bSmacallan
6532a75d1c4Smrg		    switch (cpu)
6542a75d1c4Smrg			{
6552a75d1c4Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6562a75d1c4Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6572a75d1c4Smrg			case CPU_PA_RISC2_0:
6582a75d1c4Smrg		#if defined(_SC_KERNEL_BITS)
6592a75d1c4Smrg			    switch (bits)
6602a75d1c4Smrg				{
6612a75d1c4Smrg				case 64: puts ("hppa2.0w"); break;
6622a75d1c4Smrg				case 32: puts ("hppa2.0n"); break;
6632a75d1c4Smrg				default: puts ("hppa2.0"); break;
6642a75d1c4Smrg				} break;
6652a75d1c4Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
6662a75d1c4Smrg			    puts ("hppa2.0"); break;
6672a75d1c4Smrg		#endif
6682a75d1c4Smrg			default: puts ("hppa1.0"); break;
6692a75d1c4Smrg			}
6702a75d1c4Smrg		    exit (0);
6712a75d1c4Smrg		}
672f7ec340bSmacallanEOF
673f7ec340bSmacallan		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
674f7ec340bSmacallan		    test -z "$HP_ARCH" && HP_ARCH=hppa
675f7ec340bSmacallan		fi ;;
676f7ec340bSmacallan	esac
677f7ec340bSmacallan	if [ ${HP_ARCH} = "hppa2.0w" ]
678f7ec340bSmacallan	then
6797ce7e03cSmrg	    eval $set_cc_for_build
6807ce7e03cSmrg
6817ce7e03cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
6827ce7e03cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
6837ce7e03cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
6847ce7e03cSmrg	    #
6857ce7e03cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
6867ce7e03cSmrg	    # => hppa2.0w-hp-hpux11.23
6877ce7e03cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
6887ce7e03cSmrg	    # => hppa64-hp-hpux11.23
6897ce7e03cSmrg
6907ce7e03cSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
6912a75d1c4Smrg		grep -q __LP64__
692f7ec340bSmacallan	    then
693f7ec340bSmacallan		HP_ARCH="hppa2.0w"
694f7ec340bSmacallan	    else
695f7ec340bSmacallan		HP_ARCH="hppa64"
696f7ec340bSmacallan	    fi
697f7ec340bSmacallan	fi
698f7ec340bSmacallan	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6997ce7e03cSmrg	exit ;;
700f7ec340bSmacallan    ia64:HP-UX:*:*)
701f7ec340bSmacallan	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
702f7ec340bSmacallan	echo ia64-hp-hpux${HPUX_REV}
7037ce7e03cSmrg	exit ;;
704f7ec340bSmacallan    3050*:HI-UX:*:*)
705f7ec340bSmacallan	eval $set_cc_for_build
706f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
707f7ec340bSmacallan	#include <unistd.h>
708f7ec340bSmacallan	int
709f7ec340bSmacallan	main ()
710f7ec340bSmacallan	{
711f7ec340bSmacallan	  long cpu = sysconf (_SC_CPU_VERSION);
712f7ec340bSmacallan	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
713f7ec340bSmacallan	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
714f7ec340bSmacallan	     results, however.  */
715f7ec340bSmacallan	  if (CPU_IS_PA_RISC (cpu))
716f7ec340bSmacallan	    {
717f7ec340bSmacallan	      switch (cpu)
718f7ec340bSmacallan		{
719f7ec340bSmacallan		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
720f7ec340bSmacallan		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
721f7ec340bSmacallan		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
722f7ec340bSmacallan		  default: puts ("hppa-hitachi-hiuxwe2"); break;
723f7ec340bSmacallan		}
724f7ec340bSmacallan	    }
725f7ec340bSmacallan	  else if (CPU_IS_HP_MC68K (cpu))
726f7ec340bSmacallan	    puts ("m68k-hitachi-hiuxwe2");
727f7ec340bSmacallan	  else puts ("unknown-hitachi-hiuxwe2");
728f7ec340bSmacallan	  exit (0);
729f7ec340bSmacallan	}
730f7ec340bSmacallanEOF
7317ce7e03cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
7327ce7e03cSmrg		{ echo "$SYSTEM_NAME"; exit; }
733f7ec340bSmacallan	echo unknown-hitachi-hiuxwe2
7347ce7e03cSmrg	exit ;;
735f7ec340bSmacallan    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
736f7ec340bSmacallan	echo hppa1.1-hp-bsd
7377ce7e03cSmrg	exit ;;
738f7ec340bSmacallan    9000/8??:4.3bsd:*:*)
739f7ec340bSmacallan	echo hppa1.0-hp-bsd
7407ce7e03cSmrg	exit ;;
741f7ec340bSmacallan    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
742f7ec340bSmacallan	echo hppa1.0-hp-mpeix
7437ce7e03cSmrg	exit ;;
744f7ec340bSmacallan    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
745f7ec340bSmacallan	echo hppa1.1-hp-osf
7467ce7e03cSmrg	exit ;;
747f7ec340bSmacallan    hp8??:OSF1:*:*)
748f7ec340bSmacallan	echo hppa1.0-hp-osf
7497ce7e03cSmrg	exit ;;
750f7ec340bSmacallan    i*86:OSF1:*:*)
751f7ec340bSmacallan	if [ -x /usr/sbin/sysversion ] ; then
752f7ec340bSmacallan	    echo ${UNAME_MACHINE}-unknown-osf1mk
753f7ec340bSmacallan	else
754f7ec340bSmacallan	    echo ${UNAME_MACHINE}-unknown-osf1
755f7ec340bSmacallan	fi
7567ce7e03cSmrg	exit ;;
757f7ec340bSmacallan    parisc*:Lites*:*:*)
758f7ec340bSmacallan	echo hppa1.1-hp-lites
7597ce7e03cSmrg	exit ;;
760f7ec340bSmacallan    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
761f7ec340bSmacallan	echo c1-convex-bsd
7622a75d1c4Smrg	exit ;;
763f7ec340bSmacallan    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
764f7ec340bSmacallan	if getsysinfo -f scalar_acc
765f7ec340bSmacallan	then echo c32-convex-bsd
766f7ec340bSmacallan	else echo c2-convex-bsd
767f7ec340bSmacallan	fi
7682a75d1c4Smrg	exit ;;
769f7ec340bSmacallan    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
770f7ec340bSmacallan	echo c34-convex-bsd
7712a75d1c4Smrg	exit ;;
772f7ec340bSmacallan    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
773f7ec340bSmacallan	echo c38-convex-bsd
7742a75d1c4Smrg	exit ;;
775f7ec340bSmacallan    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
776f7ec340bSmacallan	echo c4-convex-bsd
7772a75d1c4Smrg	exit ;;
778f7ec340bSmacallan    CRAY*Y-MP:*:*:*)
779f7ec340bSmacallan	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7807ce7e03cSmrg	exit ;;
781f7ec340bSmacallan    CRAY*[A-Z]90:*:*:*)
782f7ec340bSmacallan	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
783f7ec340bSmacallan	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
784f7ec340bSmacallan	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
785f7ec340bSmacallan	      -e 's/\.[^.]*$/.X/'
7867ce7e03cSmrg	exit ;;
787f7ec340bSmacallan    CRAY*TS:*:*:*)
788f7ec340bSmacallan	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7897ce7e03cSmrg	exit ;;
790f7ec340bSmacallan    CRAY*T3E:*:*:*)
791f7ec340bSmacallan	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7927ce7e03cSmrg	exit ;;
793f7ec340bSmacallan    CRAY*SV1:*:*:*)
794f7ec340bSmacallan	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7957ce7e03cSmrg	exit ;;
796f7ec340bSmacallan    *:UNICOS/mp:*:*)
7977ce7e03cSmrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7987ce7e03cSmrg	exit ;;
799f7ec340bSmacallan    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
800f7ec340bSmacallan	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
8012a75d1c4Smrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
8022a75d1c4Smrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
8032a75d1c4Smrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8042a75d1c4Smrg	exit ;;
8057ce7e03cSmrg    5000:UNIX_System_V:4.*:*)
8062a75d1c4Smrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
8072a75d1c4Smrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
8082a75d1c4Smrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8097ce7e03cSmrg	exit ;;
810f7ec340bSmacallan    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
811f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
8127ce7e03cSmrg	exit ;;
813f7ec340bSmacallan    sparc*:BSD/OS:*:*)
814f7ec340bSmacallan	echo sparc-unknown-bsdi${UNAME_RELEASE}
8157ce7e03cSmrg	exit ;;
816f7ec340bSmacallan    *:BSD/OS:*:*)
817f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
8187ce7e03cSmrg	exit ;;
8197ce7e03cSmrg    *:FreeBSD:*:*)
8202a75d1c4Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
8212a75d1c4Smrg	case ${UNAME_PROCESSOR} in
8227ce7e03cSmrg	    amd64)
8237ce7e03cSmrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
8247ce7e03cSmrg	    *)
8252a75d1c4Smrg		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
8267ce7e03cSmrg	esac
8277ce7e03cSmrg	exit ;;
828f7ec340bSmacallan    i*:CYGWIN*:*)
829f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-cygwin
8307ce7e03cSmrg	exit ;;
8312a75d1c4Smrg    *:MINGW64*:*)
8322a75d1c4Smrg	echo ${UNAME_MACHINE}-pc-mingw64
8332a75d1c4Smrg	exit ;;
8347ce7e03cSmrg    *:MINGW*:*)
835f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-mingw32
8367ce7e03cSmrg	exit ;;
8372a75d1c4Smrg    i*:MSYS*:*)
8382a75d1c4Smrg	echo ${UNAME_MACHINE}-pc-msys
8392a75d1c4Smrg	exit ;;
8407ce7e03cSmrg    i*:windows32*:*)
8412a75d1c4Smrg	# uname -m includes "-pc" on this system.
8422a75d1c4Smrg	echo ${UNAME_MACHINE}-mingw32
8437ce7e03cSmrg	exit ;;
844f7ec340bSmacallan    i*:PW*:*)
845f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-pw32
8467ce7e03cSmrg	exit ;;
8472a75d1c4Smrg    *:Interix*:*)
8482a75d1c4Smrg	case ${UNAME_MACHINE} in
8497ce7e03cSmrg	    x86)
8507ce7e03cSmrg		echo i586-pc-interix${UNAME_RELEASE}
8517ce7e03cSmrg		exit ;;
8522a75d1c4Smrg	    authenticamd | genuineintel | EM64T)
8537ce7e03cSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
8547ce7e03cSmrg		exit ;;
8557ce7e03cSmrg	    IA64)
8567ce7e03cSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
8577ce7e03cSmrg		exit ;;
8587ce7e03cSmrg	esac ;;
859f7ec340bSmacallan    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
860f7ec340bSmacallan	echo i${UNAME_MACHINE}-pc-mks
8617ce7e03cSmrg	exit ;;
8622a75d1c4Smrg    8664:Windows_NT:*)
8632a75d1c4Smrg	echo x86_64-pc-mks
8642a75d1c4Smrg	exit ;;
865f7ec340bSmacallan    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
866f7ec340bSmacallan	# How do we know it's Interix rather than the generic POSIX subsystem?
867f7ec340bSmacallan	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
868f7ec340bSmacallan	# UNAME_MACHINE based on the output of uname instead of i386?
869f7ec340bSmacallan	echo i586-pc-interix
8707ce7e03cSmrg	exit ;;
871f7ec340bSmacallan    i*:UWIN*:*)
872f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-uwin
8737ce7e03cSmrg	exit ;;
8747ce7e03cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8757ce7e03cSmrg	echo x86_64-unknown-cygwin
8767ce7e03cSmrg	exit ;;
877f7ec340bSmacallan    p*:CYGWIN*:*)
878f7ec340bSmacallan	echo powerpcle-unknown-cygwin
8797ce7e03cSmrg	exit ;;
880f7ec340bSmacallan    prep*:SunOS:5.*:*)
881f7ec340bSmacallan	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
8827ce7e03cSmrg	exit ;;
883f7ec340bSmacallan    *:GNU:*:*)
8847ce7e03cSmrg	# the GNU system
8852a75d1c4Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
8867ce7e03cSmrg	exit ;;
8877ce7e03cSmrg    *:GNU/*:*:*)
8887ce7e03cSmrg	# other systems with GNU libc and userland
8892a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
8907ce7e03cSmrg	exit ;;
891f7ec340bSmacallan    i*86:Minix:*:*)
892f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-minix
8937ce7e03cSmrg	exit ;;
8942a75d1c4Smrg    aarch64:Linux:*:*)
8952a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
8962a75d1c4Smrg	exit ;;
8972a75d1c4Smrg    aarch64_be:Linux:*:*)
8982a75d1c4Smrg	UNAME_MACHINE=aarch64_be
8992a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9002a75d1c4Smrg	exit ;;
9012a75d1c4Smrg    alpha:Linux:*:*)
9022a75d1c4Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
9032a75d1c4Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9042a75d1c4Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9052a75d1c4Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9062a75d1c4Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9072a75d1c4Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9082a75d1c4Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9092a75d1c4Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9102a75d1c4Smrg	esac
9112a75d1c4Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9122a75d1c4Smrg	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
9132a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9142a75d1c4Smrg	exit ;;
915f7ec340bSmacallan    arm*:Linux:*:*)
9167ce7e03cSmrg	eval $set_cc_for_build
9177ce7e03cSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9187ce7e03cSmrg	    | grep -q __ARM_EABI__
9197ce7e03cSmrg	then
9202a75d1c4Smrg	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9217ce7e03cSmrg	else
9222a75d1c4Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
9232a75d1c4Smrg		| grep -q __ARM_PCS_VFP
9242a75d1c4Smrg	    then
9252a75d1c4Smrg		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
9262a75d1c4Smrg	    else
9272a75d1c4Smrg		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
9282a75d1c4Smrg	    fi
9297ce7e03cSmrg	fi
9307ce7e03cSmrg	exit ;;
9317ce7e03cSmrg    avr32*:Linux:*:*)
9322a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9337ce7e03cSmrg	exit ;;
934f7ec340bSmacallan    cris:Linux:*:*)
9352a75d1c4Smrg	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
9367ce7e03cSmrg	exit ;;
9377ce7e03cSmrg    crisv32:Linux:*:*)
9382a75d1c4Smrg	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
9397ce7e03cSmrg	exit ;;
9407ce7e03cSmrg    frv:Linux:*:*)
9412a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9422a75d1c4Smrg	exit ;;
9432a75d1c4Smrg    hexagon:Linux:*:*)
9442a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9452a75d1c4Smrg	exit ;;
9462a75d1c4Smrg    i*86:Linux:*:*)
9472a75d1c4Smrg	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
9487ce7e03cSmrg	exit ;;
949f7ec340bSmacallan    ia64:Linux:*:*)
9502a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9517ce7e03cSmrg	exit ;;
9527ce7e03cSmrg    m32r*:Linux:*:*)
9532a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9547ce7e03cSmrg	exit ;;
955f7ec340bSmacallan    m68*:Linux:*:*)
9562a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9577ce7e03cSmrg	exit ;;
9582a75d1c4Smrg    mips:Linux:*:* | mips64:Linux:*:*)
959f7ec340bSmacallan	eval $set_cc_for_build
960f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
961f7ec340bSmacallan	#undef CPU
9622a75d1c4Smrg	#undef ${UNAME_MACHINE}
9632a75d1c4Smrg	#undef ${UNAME_MACHINE}el
964f7ec340bSmacallan	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
9652a75d1c4Smrg	CPU=${UNAME_MACHINE}el
966f7ec340bSmacallan	#else
967f7ec340bSmacallan	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
9682a75d1c4Smrg	CPU=${UNAME_MACHINE}
969f7ec340bSmacallan	#else
970f7ec340bSmacallan	CPU=
971f7ec340bSmacallan	#endif
972f7ec340bSmacallan	#endif
973f7ec340bSmacallanEOF
9742a75d1c4Smrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
9752a75d1c4Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
976f7ec340bSmacallan	;;
9777ce7e03cSmrg    or32:Linux:*:*)
9782a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
9797ce7e03cSmrg	exit ;;
9802a75d1c4Smrg    padre:Linux:*:*)
9812a75d1c4Smrg	echo sparc-unknown-linux-${LIBC}
9827ce7e03cSmrg	exit ;;
9832a75d1c4Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
9842a75d1c4Smrg	echo hppa64-unknown-linux-${LIBC}
9857ce7e03cSmrg	exit ;;
986f7ec340bSmacallan    parisc:Linux:*:* | hppa:Linux:*:*)
987f7ec340bSmacallan	# Look for CPU level
988f7ec340bSmacallan	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
9892a75d1c4Smrg	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
9902a75d1c4Smrg	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
9912a75d1c4Smrg	  *)    echo hppa-unknown-linux-${LIBC} ;;
992f7ec340bSmacallan	esac
9937ce7e03cSmrg	exit ;;
9942a75d1c4Smrg    ppc64:Linux:*:*)
9952a75d1c4Smrg	echo powerpc64-unknown-linux-${LIBC}
9962a75d1c4Smrg	exit ;;
9972a75d1c4Smrg    ppc:Linux:*:*)
9982a75d1c4Smrg	echo powerpc-unknown-linux-${LIBC}
9997ce7e03cSmrg	exit ;;
1000f7ec340bSmacallan    s390:Linux:*:* | s390x:Linux:*:*)
10017ce7e03cSmrg	echo ${UNAME_MACHINE}-ibm-linux
10027ce7e03cSmrg	exit ;;
1003f7ec340bSmacallan    sh64*:Linux:*:*)
10042a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10057ce7e03cSmrg	exit ;;
1006f7ec340bSmacallan    sh*:Linux:*:*)
10072a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10087ce7e03cSmrg	exit ;;
1009f7ec340bSmacallan    sparc:Linux:*:* | sparc64:Linux:*:*)
10102a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10112a75d1c4Smrg	exit ;;
10122a75d1c4Smrg    tile*:Linux:*:*)
10132a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10147ce7e03cSmrg	exit ;;
10157ce7e03cSmrg    vax:Linux:*:*)
10162a75d1c4Smrg	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
10177ce7e03cSmrg	exit ;;
1018f7ec340bSmacallan    x86_64:Linux:*:*)
10192a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10207ce7e03cSmrg	exit ;;
10217ce7e03cSmrg    xtensa*:Linux:*:*)
10222a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10237ce7e03cSmrg	exit ;;
1024f7ec340bSmacallan    i*86:DYNIX/ptx:4*:*)
1025f7ec340bSmacallan	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1026f7ec340bSmacallan	# earlier versions are messed up and put the nodename in both
1027f7ec340bSmacallan	# sysname and nodename.
1028f7ec340bSmacallan	echo i386-sequent-sysv4
10297ce7e03cSmrg	exit ;;
1030f7ec340bSmacallan    i*86:UNIX_SV:4.2MP:2.*)
10312a75d1c4Smrg	# Unixware is an offshoot of SVR4, but it has its own version
10322a75d1c4Smrg	# number series starting with 2...
10332a75d1c4Smrg	# I am not positive that other SVR4 systems won't match this,
1034f7ec340bSmacallan	# I just have to hope.  -- rms.
10352a75d1c4Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1036f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10377ce7e03cSmrg	exit ;;
1038f7ec340bSmacallan    i*86:OS/2:*:*)
1039f7ec340bSmacallan	# If we were able to find `uname', then EMX Unix compatibility
1040f7ec340bSmacallan	# is probably installed.
1041f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-os2-emx
10427ce7e03cSmrg	exit ;;
1043f7ec340bSmacallan    i*86:XTS-300:*:STOP)
1044f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-stop
10457ce7e03cSmrg	exit ;;
1046f7ec340bSmacallan    i*86:atheos:*:*)
1047f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-atheos
10487ce7e03cSmrg	exit ;;
10497ce7e03cSmrg    i*86:syllable:*:*)
10507ce7e03cSmrg	echo ${UNAME_MACHINE}-pc-syllable
10517ce7e03cSmrg	exit ;;
10522a75d1c4Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1053f7ec340bSmacallan	echo i386-unknown-lynxos${UNAME_RELEASE}
10547ce7e03cSmrg	exit ;;
1055f7ec340bSmacallan    i*86:*DOS:*:*)
1056f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-msdosdjgpp
10577ce7e03cSmrg	exit ;;
1058f7ec340bSmacallan    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1059f7ec340bSmacallan	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1060f7ec340bSmacallan	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1061f7ec340bSmacallan		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1062f7ec340bSmacallan	else
1063f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1064f7ec340bSmacallan	fi
10657ce7e03cSmrg	exit ;;
10667ce7e03cSmrg    i*86:*:5:[678]*)
10672a75d1c4Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1068f7ec340bSmacallan	case `/bin/uname -X | grep "^Machine"` in
1069f7ec340bSmacallan	    *486*)	     UNAME_MACHINE=i486 ;;
1070f7ec340bSmacallan	    *Pentium)	     UNAME_MACHINE=i586 ;;
1071f7ec340bSmacallan	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1072f7ec340bSmacallan	esac
1073f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
10747ce7e03cSmrg	exit ;;
1075f7ec340bSmacallan    i*86:*:3.2:*)
1076f7ec340bSmacallan	if test -f /usr/options/cb.name; then
1077f7ec340bSmacallan		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1078f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1079f7ec340bSmacallan	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1080f7ec340bSmacallan		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1081f7ec340bSmacallan		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1082f7ec340bSmacallan		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1083f7ec340bSmacallan			&& UNAME_MACHINE=i586
1084f7ec340bSmacallan		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1085f7ec340bSmacallan			&& UNAME_MACHINE=i686
1086f7ec340bSmacallan		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1087f7ec340bSmacallan			&& UNAME_MACHINE=i686
1088f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1089f7ec340bSmacallan	else
1090f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-sysv32
1091f7ec340bSmacallan	fi
10927ce7e03cSmrg	exit ;;
1093f7ec340bSmacallan    pc:*:*:*)
1094f7ec340bSmacallan	# Left here for compatibility:
10952a75d1c4Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
10962a75d1c4Smrg	# the processor, so we play safe by assuming i586.
10972a75d1c4Smrg	# Note: whatever this is, it MUST be the same as what config.sub
10982a75d1c4Smrg	# prints for the "djgpp" host, or else GDB configury will decide that
10992a75d1c4Smrg	# this is a cross-build.
11002a75d1c4Smrg	echo i586-pc-msdosdjgpp
11012a75d1c4Smrg	exit ;;
1102f7ec340bSmacallan    Intel:Mach:3*:*)
1103f7ec340bSmacallan	echo i386-pc-mach3
11047ce7e03cSmrg	exit ;;
1105f7ec340bSmacallan    paragon:*:*:*)
1106f7ec340bSmacallan	echo i860-intel-osf1
11077ce7e03cSmrg	exit ;;
1108f7ec340bSmacallan    i860:*:4.*:*) # i860-SVR4
1109f7ec340bSmacallan	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1110f7ec340bSmacallan	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1111f7ec340bSmacallan	else # Add other i860-SVR4 vendors below as they are discovered.
1112f7ec340bSmacallan	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1113f7ec340bSmacallan	fi
11147ce7e03cSmrg	exit ;;
1115f7ec340bSmacallan    mini*:CTIX:SYS*5:*)
1116f7ec340bSmacallan	# "miniframe"
1117f7ec340bSmacallan	echo m68010-convergent-sysv
11187ce7e03cSmrg	exit ;;
1119f7ec340bSmacallan    mc68k:UNIX:SYSTEM5:3.51m)
1120f7ec340bSmacallan	echo m68k-convergent-sysv
11217ce7e03cSmrg	exit ;;
1122f7ec340bSmacallan    M680?0:D-NIX:5.3:*)
1123f7ec340bSmacallan	echo m68k-diab-dnix
11247ce7e03cSmrg	exit ;;
11257ce7e03cSmrg    M68*:*:R3V[5678]*:*)
11267ce7e03cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11277ce7e03cSmrg    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)
1128f7ec340bSmacallan	OS_REL=''
1129f7ec340bSmacallan	test -r /etc/.relid \
1130f7ec340bSmacallan	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1131f7ec340bSmacallan	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11327ce7e03cSmrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1133f7ec340bSmacallan	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11347ce7e03cSmrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1135f7ec340bSmacallan    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
11362a75d1c4Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11372a75d1c4Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
11382a75d1c4Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
11392a75d1c4Smrg	OS_REL='.3'
11402a75d1c4Smrg	test -r /etc/.relid \
11412a75d1c4Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11422a75d1c4Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11432a75d1c4Smrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11442a75d1c4Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11452a75d1c4Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
11462a75d1c4Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
11472a75d1c4Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1148f7ec340bSmacallan    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1149f7ec340bSmacallan	echo m68k-unknown-lynxos${UNAME_RELEASE}
11507ce7e03cSmrg	exit ;;
1151f7ec340bSmacallan    mc68030:UNIX_System_V:4.*:*)
1152f7ec340bSmacallan	echo m68k-atari-sysv4
11537ce7e03cSmrg	exit ;;
1154f7ec340bSmacallan    TSUNAMI:LynxOS:2.*:*)
1155f7ec340bSmacallan	echo sparc-unknown-lynxos${UNAME_RELEASE}
11567ce7e03cSmrg	exit ;;
1157f7ec340bSmacallan    rs6000:LynxOS:2.*:*)
1158f7ec340bSmacallan	echo rs6000-unknown-lynxos${UNAME_RELEASE}
11597ce7e03cSmrg	exit ;;
11602a75d1c4Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1161f7ec340bSmacallan	echo powerpc-unknown-lynxos${UNAME_RELEASE}
11627ce7e03cSmrg	exit ;;
1163f7ec340bSmacallan    SM[BE]S:UNIX_SV:*:*)
1164f7ec340bSmacallan	echo mips-dde-sysv${UNAME_RELEASE}
11657ce7e03cSmrg	exit ;;
1166f7ec340bSmacallan    RM*:ReliantUNIX-*:*:*)
1167f7ec340bSmacallan	echo mips-sni-sysv4
11687ce7e03cSmrg	exit ;;
1169f7ec340bSmacallan    RM*:SINIX-*:*:*)
1170f7ec340bSmacallan	echo mips-sni-sysv4
11717ce7e03cSmrg	exit ;;
1172f7ec340bSmacallan    *:SINIX-*:*:*)
1173f7ec340bSmacallan	if uname -p 2>/dev/null >/dev/null ; then
1174f7ec340bSmacallan		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1175f7ec340bSmacallan		echo ${UNAME_MACHINE}-sni-sysv4
1176f7ec340bSmacallan	else
1177f7ec340bSmacallan		echo ns32k-sni-sysv
1178f7ec340bSmacallan	fi
11797ce7e03cSmrg	exit ;;
11802a75d1c4Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
11812a75d1c4Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
11822a75d1c4Smrg	echo i586-unisys-sysv4
11832a75d1c4Smrg	exit ;;
1184f7ec340bSmacallan    *:UNIX_System_V:4*:FTX*)
1185f7ec340bSmacallan	# From Gerald Hewes <hewes@openmarket.com>.
1186f7ec340bSmacallan	# How about differentiating between stratus architectures? -djm
1187f7ec340bSmacallan	echo hppa1.1-stratus-sysv4
11887ce7e03cSmrg	exit ;;
1189f7ec340bSmacallan    *:*:*:FTX*)
1190f7ec340bSmacallan	# From seanf@swdc.stratus.com.
1191f7ec340bSmacallan	echo i860-stratus-sysv4
11927ce7e03cSmrg	exit ;;
11937ce7e03cSmrg    i*86:VOS:*:*)
11947ce7e03cSmrg	# From Paul.Green@stratus.com.
11957ce7e03cSmrg	echo ${UNAME_MACHINE}-stratus-vos
11967ce7e03cSmrg	exit ;;
1197f7ec340bSmacallan    *:VOS:*:*)
1198f7ec340bSmacallan	# From Paul.Green@stratus.com.
1199f7ec340bSmacallan	echo hppa1.1-stratus-vos
12007ce7e03cSmrg	exit ;;
1201f7ec340bSmacallan    mc68*:A/UX:*:*)
1202f7ec340bSmacallan	echo m68k-apple-aux${UNAME_RELEASE}
12037ce7e03cSmrg	exit ;;
1204f7ec340bSmacallan    news*:NEWS-OS:6*:*)
1205f7ec340bSmacallan	echo mips-sony-newsos6
12067ce7e03cSmrg	exit ;;
1207f7ec340bSmacallan    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1208f7ec340bSmacallan	if [ -d /usr/nec ]; then
12092a75d1c4Smrg		echo mips-nec-sysv${UNAME_RELEASE}
1210f7ec340bSmacallan	else
12112a75d1c4Smrg		echo mips-unknown-sysv${UNAME_RELEASE}
1212f7ec340bSmacallan	fi
12132a75d1c4Smrg	exit ;;
1214f7ec340bSmacallan    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1215f7ec340bSmacallan	echo powerpc-be-beos
12167ce7e03cSmrg	exit ;;
1217f7ec340bSmacallan    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1218f7ec340bSmacallan	echo powerpc-apple-beos
12197ce7e03cSmrg	exit ;;
1220f7ec340bSmacallan    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1221f7ec340bSmacallan	echo i586-pc-beos
12227ce7e03cSmrg	exit ;;
12232a75d1c4Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
12242a75d1c4Smrg	echo i586-pc-haiku
12252a75d1c4Smrg	exit ;;
12262a75d1c4Smrg    x86_64:Haiku:*:*)
12272a75d1c4Smrg	echo x86_64-unknown-haiku
12282a75d1c4Smrg	exit ;;
1229f7ec340bSmacallan    SX-4:SUPER-UX:*:*)
1230f7ec340bSmacallan	echo sx4-nec-superux${UNAME_RELEASE}
12317ce7e03cSmrg	exit ;;
1232f7ec340bSmacallan    SX-5:SUPER-UX:*:*)
1233f7ec340bSmacallan	echo sx5-nec-superux${UNAME_RELEASE}
12347ce7e03cSmrg	exit ;;
1235f7ec340bSmacallan    SX-6:SUPER-UX:*:*)
1236f7ec340bSmacallan	echo sx6-nec-superux${UNAME_RELEASE}
12377ce7e03cSmrg	exit ;;
12387ce7e03cSmrg    SX-7:SUPER-UX:*:*)
12397ce7e03cSmrg	echo sx7-nec-superux${UNAME_RELEASE}
12407ce7e03cSmrg	exit ;;
12417ce7e03cSmrg    SX-8:SUPER-UX:*:*)
12427ce7e03cSmrg	echo sx8-nec-superux${UNAME_RELEASE}
12437ce7e03cSmrg	exit ;;
12447ce7e03cSmrg    SX-8R:SUPER-UX:*:*)
12457ce7e03cSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
12467ce7e03cSmrg	exit ;;
1247f7ec340bSmacallan    Power*:Rhapsody:*:*)
1248f7ec340bSmacallan	echo powerpc-apple-rhapsody${UNAME_RELEASE}
12497ce7e03cSmrg	exit ;;
1250f7ec340bSmacallan    *:Rhapsody:*:*)
1251f7ec340bSmacallan	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12527ce7e03cSmrg	exit ;;
1253f7ec340bSmacallan    *:Darwin:*:*)
12547ce7e03cSmrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
12557ce7e03cSmrg	case $UNAME_PROCESSOR in
12562a75d1c4Smrg	    i386)
12572a75d1c4Smrg		eval $set_cc_for_build
12582a75d1c4Smrg		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
12592a75d1c4Smrg		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
12602a75d1c4Smrg		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
12612a75d1c4Smrg		      grep IS_64BIT_ARCH >/dev/null
12622a75d1c4Smrg		  then
12632a75d1c4Smrg		      UNAME_PROCESSOR="x86_64"
12642a75d1c4Smrg		  fi
12652a75d1c4Smrg		fi ;;
12667ce7e03cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1267f7ec340bSmacallan	esac
1268f7ec340bSmacallan	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12697ce7e03cSmrg	exit ;;
1270f7ec340bSmacallan    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1271f7ec340bSmacallan	UNAME_PROCESSOR=`uname -p`
1272f7ec340bSmacallan	if test "$UNAME_PROCESSOR" = "x86"; then
1273f7ec340bSmacallan		UNAME_PROCESSOR=i386
1274f7ec340bSmacallan		UNAME_MACHINE=pc
1275f7ec340bSmacallan	fi
1276f7ec340bSmacallan	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
12777ce7e03cSmrg	exit ;;
1278f7ec340bSmacallan    *:QNX:*:4*)
1279f7ec340bSmacallan	echo i386-pc-qnx
12807ce7e03cSmrg	exit ;;
12812a75d1c4Smrg    NEO-?:NONSTOP_KERNEL:*:*)
12822a75d1c4Smrg	echo neo-tandem-nsk${UNAME_RELEASE}
12832a75d1c4Smrg	exit ;;
12842a75d1c4Smrg    NSE-*:NONSTOP_KERNEL:*:*)
12857ce7e03cSmrg	echo nse-tandem-nsk${UNAME_RELEASE}
12867ce7e03cSmrg	exit ;;
12877ce7e03cSmrg    NSR-?:NONSTOP_KERNEL:*:*)
1288f7ec340bSmacallan	echo nsr-tandem-nsk${UNAME_RELEASE}
12897ce7e03cSmrg	exit ;;
1290f7ec340bSmacallan    *:NonStop-UX:*:*)
1291f7ec340bSmacallan	echo mips-compaq-nonstopux
12927ce7e03cSmrg	exit ;;
1293f7ec340bSmacallan    BS2000:POSIX*:*:*)
1294f7ec340bSmacallan	echo bs2000-siemens-sysv
12957ce7e03cSmrg	exit ;;
1296f7ec340bSmacallan    DS/*:UNIX_System_V:*:*)
1297f7ec340bSmacallan	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
12987ce7e03cSmrg	exit ;;
1299f7ec340bSmacallan    *:Plan9:*:*)
1300f7ec340bSmacallan	# "uname -m" is not consistent, so use $cputype instead. 386
1301f7ec340bSmacallan	# is converted to i386 for consistency with other x86
1302f7ec340bSmacallan	# operating systems.
1303f7ec340bSmacallan	if test "$cputype" = "386"; then
1304f7ec340bSmacallan	    UNAME_MACHINE=i386
1305f7ec340bSmacallan	else
1306f7ec340bSmacallan	    UNAME_MACHINE="$cputype"
1307f7ec340bSmacallan	fi
1308f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-plan9
13097ce7e03cSmrg	exit ;;
1310f7ec340bSmacallan    *:TOPS-10:*:*)
1311f7ec340bSmacallan	echo pdp10-unknown-tops10
13127ce7e03cSmrg	exit ;;
1313f7ec340bSmacallan    *:TENEX:*:*)
1314f7ec340bSmacallan	echo pdp10-unknown-tenex
13157ce7e03cSmrg	exit ;;
1316f7ec340bSmacallan    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1317f7ec340bSmacallan	echo pdp10-dec-tops20
13187ce7e03cSmrg	exit ;;
1319f7ec340bSmacallan    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1320f7ec340bSmacallan	echo pdp10-xkl-tops20
13217ce7e03cSmrg	exit ;;
1322f7ec340bSmacallan    *:TOPS-20:*:*)
1323f7ec340bSmacallan	echo pdp10-unknown-tops20
13247ce7e03cSmrg	exit ;;
1325f7ec340bSmacallan    *:ITS:*:*)
1326f7ec340bSmacallan	echo pdp10-unknown-its
13277ce7e03cSmrg	exit ;;
1328f7ec340bSmacallan    SEI:*:*:SEIUX)
13292a75d1c4Smrg	echo mips-sei-seiux${UNAME_RELEASE}
13307ce7e03cSmrg	exit ;;
13317ce7e03cSmrg    *:DragonFly:*:*)
13327ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13337ce7e03cSmrg	exit ;;
13347ce7e03cSmrg    *:*VMS:*:*)
13352a75d1c4Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
13367ce7e03cSmrg	case "${UNAME_MACHINE}" in
13377ce7e03cSmrg	    A*) echo alpha-dec-vms ; exit ;;
13387ce7e03cSmrg	    I*) echo ia64-dec-vms ; exit ;;
13397ce7e03cSmrg	    V*) echo vax-dec-vms ; exit ;;
13407ce7e03cSmrg	esac ;;
13417ce7e03cSmrg    *:XENIX:*:SysV)
13427ce7e03cSmrg	echo i386-pc-xenix
13437ce7e03cSmrg	exit ;;
13447ce7e03cSmrg    i*86:skyos:*:*)
13457ce7e03cSmrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
13467ce7e03cSmrg	exit ;;
13477ce7e03cSmrg    i*86:rdos:*:*)
13487ce7e03cSmrg	echo ${UNAME_MACHINE}-pc-rdos
13497ce7e03cSmrg	exit ;;
13502a75d1c4Smrg    i*86:AROS:*:*)
13512a75d1c4Smrg	echo ${UNAME_MACHINE}-pc-aros
13522a75d1c4Smrg	exit ;;
13532a75d1c4Smrg    x86_64:VMkernel:*:*)
13542a75d1c4Smrg	echo ${UNAME_MACHINE}-unknown-esx
13552a75d1c4Smrg	exit ;;
1356f7ec340bSmacallanesac
1357f7ec340bSmacallan
1358f7ec340bSmacallaneval $set_cc_for_build
1359f7ec340bSmacallancat >$dummy.c <<EOF
1360f7ec340bSmacallan#ifdef _SEQUENT_
1361f7ec340bSmacallan# include <sys/types.h>
1362f7ec340bSmacallan# include <sys/utsname.h>
1363f7ec340bSmacallan#endif
1364f7ec340bSmacallanmain ()
1365f7ec340bSmacallan{
1366f7ec340bSmacallan#if defined (sony)
1367f7ec340bSmacallan#if defined (MIPSEB)
1368f7ec340bSmacallan  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1369f7ec340bSmacallan     I don't know....  */
1370f7ec340bSmacallan  printf ("mips-sony-bsd\n"); exit (0);
1371f7ec340bSmacallan#else
1372f7ec340bSmacallan#include <sys/param.h>
1373f7ec340bSmacallan  printf ("m68k-sony-newsos%s\n",
1374f7ec340bSmacallan#ifdef NEWSOS4
13752a75d1c4Smrg	"4"
1376f7ec340bSmacallan#else
13772a75d1c4Smrg	""
1378f7ec340bSmacallan#endif
13792a75d1c4Smrg	); exit (0);
1380f7ec340bSmacallan#endif
1381f7ec340bSmacallan#endif
1382f7ec340bSmacallan
1383f7ec340bSmacallan#if defined (__arm) && defined (__acorn) && defined (__unix)
13847ce7e03cSmrg  printf ("arm-acorn-riscix\n"); exit (0);
1385f7ec340bSmacallan#endif
1386f7ec340bSmacallan
1387f7ec340bSmacallan#if defined (hp300) && !defined (hpux)
1388f7ec340bSmacallan  printf ("m68k-hp-bsd\n"); exit (0);
1389f7ec340bSmacallan#endif
1390f7ec340bSmacallan
1391f7ec340bSmacallan#if defined (NeXT)
1392f7ec340bSmacallan#if !defined (__ARCHITECTURE__)
1393f7ec340bSmacallan#define __ARCHITECTURE__ "m68k"
1394f7ec340bSmacallan#endif
1395f7ec340bSmacallan  int version;
1396f7ec340bSmacallan  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1397f7ec340bSmacallan  if (version < 4)
1398f7ec340bSmacallan    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1399f7ec340bSmacallan  else
1400f7ec340bSmacallan    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1401f7ec340bSmacallan  exit (0);
1402f7ec340bSmacallan#endif
1403f7ec340bSmacallan
1404f7ec340bSmacallan#if defined (MULTIMAX) || defined (n16)
1405f7ec340bSmacallan#if defined (UMAXV)
1406f7ec340bSmacallan  printf ("ns32k-encore-sysv\n"); exit (0);
1407f7ec340bSmacallan#else
1408f7ec340bSmacallan#if defined (CMU)
1409f7ec340bSmacallan  printf ("ns32k-encore-mach\n"); exit (0);
1410f7ec340bSmacallan#else
1411f7ec340bSmacallan  printf ("ns32k-encore-bsd\n"); exit (0);
1412f7ec340bSmacallan#endif
1413f7ec340bSmacallan#endif
1414f7ec340bSmacallan#endif
1415f7ec340bSmacallan
1416f7ec340bSmacallan#if defined (__386BSD__)
1417f7ec340bSmacallan  printf ("i386-pc-bsd\n"); exit (0);
1418f7ec340bSmacallan#endif
1419f7ec340bSmacallan
1420f7ec340bSmacallan#if defined (sequent)
1421f7ec340bSmacallan#if defined (i386)
1422f7ec340bSmacallan  printf ("i386-sequent-dynix\n"); exit (0);
1423f7ec340bSmacallan#endif
1424f7ec340bSmacallan#if defined (ns32000)
1425f7ec340bSmacallan  printf ("ns32k-sequent-dynix\n"); exit (0);
1426f7ec340bSmacallan#endif
1427f7ec340bSmacallan#endif
1428f7ec340bSmacallan
1429f7ec340bSmacallan#if defined (_SEQUENT_)
1430f7ec340bSmacallan    struct utsname un;
1431f7ec340bSmacallan
1432f7ec340bSmacallan    uname(&un);
1433f7ec340bSmacallan
1434f7ec340bSmacallan    if (strncmp(un.version, "V2", 2) == 0) {
1435f7ec340bSmacallan	printf ("i386-sequent-ptx2\n"); exit (0);
1436f7ec340bSmacallan    }
1437f7ec340bSmacallan    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1438f7ec340bSmacallan	printf ("i386-sequent-ptx1\n"); exit (0);
1439f7ec340bSmacallan    }
1440f7ec340bSmacallan    printf ("i386-sequent-ptx\n"); exit (0);
1441f7ec340bSmacallan
1442f7ec340bSmacallan#endif
1443f7ec340bSmacallan
1444f7ec340bSmacallan#if defined (vax)
1445f7ec340bSmacallan# if !defined (ultrix)
1446f7ec340bSmacallan#  include <sys/param.h>
1447f7ec340bSmacallan#  if defined (BSD)
1448f7ec340bSmacallan#   if BSD == 43
1449f7ec340bSmacallan      printf ("vax-dec-bsd4.3\n"); exit (0);
1450f7ec340bSmacallan#   else
1451f7ec340bSmacallan#    if BSD == 199006
1452f7ec340bSmacallan      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1453f7ec340bSmacallan#    else
1454f7ec340bSmacallan      printf ("vax-dec-bsd\n"); exit (0);
1455f7ec340bSmacallan#    endif
1456f7ec340bSmacallan#   endif
1457f7ec340bSmacallan#  else
1458f7ec340bSmacallan    printf ("vax-dec-bsd\n"); exit (0);
1459f7ec340bSmacallan#  endif
1460f7ec340bSmacallan# else
1461f7ec340bSmacallan    printf ("vax-dec-ultrix\n"); exit (0);
1462f7ec340bSmacallan# endif
1463f7ec340bSmacallan#endif
1464f7ec340bSmacallan
1465f7ec340bSmacallan#if defined (alliant) && defined (i860)
1466f7ec340bSmacallan  printf ("i860-alliant-bsd\n"); exit (0);
1467f7ec340bSmacallan#endif
1468f7ec340bSmacallan
1469f7ec340bSmacallan  exit (1);
1470f7ec340bSmacallan}
1471f7ec340bSmacallanEOF
1472f7ec340bSmacallan
14737ce7e03cSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
14747ce7e03cSmrg	{ echo "$SYSTEM_NAME"; exit; }
1475f7ec340bSmacallan
1476f7ec340bSmacallan# Apollos put the system type in the environment.
1477f7ec340bSmacallan
14787ce7e03cSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1479f7ec340bSmacallan
1480f7ec340bSmacallan# Convex versions that predate uname can use getsysinfo(1)
1481f7ec340bSmacallan
1482f7ec340bSmacallanif [ -x /usr/convex/getsysinfo ]
1483f7ec340bSmacallanthen
1484f7ec340bSmacallan    case `getsysinfo -f cpu_type` in
1485f7ec340bSmacallan    c1*)
1486f7ec340bSmacallan	echo c1-convex-bsd
14877ce7e03cSmrg	exit ;;
1488f7ec340bSmacallan    c2*)
1489f7ec340bSmacallan	if getsysinfo -f scalar_acc
1490f7ec340bSmacallan	then echo c32-convex-bsd
1491f7ec340bSmacallan	else echo c2-convex-bsd
1492f7ec340bSmacallan	fi
14937ce7e03cSmrg	exit ;;
1494f7ec340bSmacallan    c34*)
1495f7ec340bSmacallan	echo c34-convex-bsd
14967ce7e03cSmrg	exit ;;
1497f7ec340bSmacallan    c38*)
1498f7ec340bSmacallan	echo c38-convex-bsd
14997ce7e03cSmrg	exit ;;
1500f7ec340bSmacallan    c4*)
1501f7ec340bSmacallan	echo c4-convex-bsd
15027ce7e03cSmrg	exit ;;
1503f7ec340bSmacallan    esac
1504f7ec340bSmacallanfi
1505f7ec340bSmacallan
1506f7ec340bSmacallancat >&2 <<EOF
1507f7ec340bSmacallan$0: unable to guess system type
1508f7ec340bSmacallan
1509f7ec340bSmacallanThis script, last modified $timestamp, has failed to recognize
1510f7ec340bSmacallanthe operating system you are using. It is advised that you
1511f7ec340bSmacallandownload the most up to date version of the config scripts from
1512f7ec340bSmacallan
15137ce7e03cSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
15147ce7e03cSmrgand
15157ce7e03cSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1516f7ec340bSmacallan
1517f7ec340bSmacallanIf the version you run ($0) is already up to date, please
1518f7ec340bSmacallansend the following data and any information you think might be
1519f7ec340bSmacallanpertinent to <config-patches@gnu.org> in order to provide the needed
1520f7ec340bSmacallaninformation to handle your system.
1521f7ec340bSmacallan
1522f7ec340bSmacallanconfig.guess timestamp = $timestamp
1523f7ec340bSmacallan
1524f7ec340bSmacallanuname -m = `(uname -m) 2>/dev/null || echo unknown`
1525f7ec340bSmacallanuname -r = `(uname -r) 2>/dev/null || echo unknown`
1526f7ec340bSmacallanuname -s = `(uname -s) 2>/dev/null || echo unknown`
1527f7ec340bSmacallanuname -v = `(uname -v) 2>/dev/null || echo unknown`
1528f7ec340bSmacallan
1529f7ec340bSmacallan/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1530f7ec340bSmacallan/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1531f7ec340bSmacallan
1532f7ec340bSmacallanhostinfo               = `(hostinfo) 2>/dev/null`
1533f7ec340bSmacallan/bin/universe          = `(/bin/universe) 2>/dev/null`
1534f7ec340bSmacallan/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1535f7ec340bSmacallan/bin/arch              = `(/bin/arch) 2>/dev/null`
1536f7ec340bSmacallan/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1537f7ec340bSmacallan/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1538f7ec340bSmacallan
1539f7ec340bSmacallanUNAME_MACHINE = ${UNAME_MACHINE}
1540f7ec340bSmacallanUNAME_RELEASE = ${UNAME_RELEASE}
1541f7ec340bSmacallanUNAME_SYSTEM  = ${UNAME_SYSTEM}
1542f7ec340bSmacallanUNAME_VERSION = ${UNAME_VERSION}
1543f7ec340bSmacallanEOF
1544f7ec340bSmacallan
1545f7ec340bSmacallanexit 1
1546f7ec340bSmacallan
1547f7ec340bSmacallan# Local variables:
1548f7ec340bSmacallan# eval: (add-hook 'write-file-hooks 'time-stamp)
1549f7ec340bSmacallan# time-stamp-start: "timestamp='"
1550f7ec340bSmacallan# time-stamp-format: "%:y-%02m-%02d"
1551f7ec340bSmacallan# time-stamp-end: "'"
1552f7ec340bSmacallan# End:
1553