198937Sdes#! /bin/sh
298937Sdes# Attempt to guess a canonical system name.
398937Sdes#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4226046Sdes#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5255767Sdes#   2011, 2012, 2013 Free Software Foundation, Inc.
698937Sdes
7255767Sdestimestamp='2012-12-23'
898937Sdes
998937Sdes# This file is free software; you can redistribute it and/or modify it
1098937Sdes# under the terms of the GNU General Public License as published by
1198937Sdes# the Free Software Foundation; either version 2 of the License, or
1298937Sdes# (at your option) any later version.
1398937Sdes#
1498937Sdes# This program is distributed in the hope that it will be useful, but
1598937Sdes# WITHOUT ANY WARRANTY; without even the implied warranty of
1698937Sdes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1798937Sdes# General Public License for more details.
1898937Sdes#
1998937Sdes# You should have received a copy of the GNU General Public License
20255767Sdes# along with this program; if not, see <http://www.gnu.org/licenses/>.
2198937Sdes#
2298937Sdes# As a special exception to the GNU General Public License, if you
2398937Sdes# distribute this file as part of a program that contains a
2498937Sdes# configuration script generated by Autoconf, you may include it under
2598937Sdes# the same distribution terms that you use for the rest of that program.
2698937Sdes
27149749Sdes
28204917Sdes# Originally written by Per Bothner.  Please send patches (context
29204917Sdes# diff format) to <config-patches@gnu.org> and include a ChangeLog
30204917Sdes# entry.
3198937Sdes#
3298937Sdes# This script attempts to guess a canonical system name similar to
3398937Sdes# config.sub.  If it succeeds, it prints the system name on stdout, and
3498937Sdes# exits with 0.  Otherwise, it exits with 1.
3598937Sdes#
36204917Sdes# You can get the latest version of this script from:
37204917Sdes# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
3898937Sdes
3998937Sdesme=`echo "$0" | sed -e 's,.*/,,'`
4098937Sdes
4198937Sdesusage="\
4298937SdesUsage: $0 [OPTION]
4398937Sdes
4498937SdesOutput the configuration name of the system \`$me' is run on.
4598937Sdes
4698937SdesOperation modes:
4798937Sdes  -h, --help         print this help, then exit
4898937Sdes  -t, --time-stamp   print date of last modification, then exit
4998937Sdes  -v, --version      print version number, then exit
5098937Sdes
5198937SdesReport bugs and patches to <config-patches@gnu.org>."
5298937Sdes
5398937Sdesversion="\
5498937SdesGNU config.guess ($timestamp)
5598937Sdes
5698937SdesOriginally written by Per Bothner.
57204917SdesCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
58255767Sdes2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
59255767Sdes2012, 2013 Free Software Foundation, Inc.
6098937Sdes
6198937SdesThis is free software; see the source for copying conditions.  There is NO
6298937Sdeswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6398937Sdes
6498937Sdeshelp="
6598937SdesTry \`$me --help' for more information."
6698937Sdes
6798937Sdes# Parse command line
6898937Sdeswhile test $# -gt 0 ; do
6998937Sdes  case $1 in
7098937Sdes    --time-stamp | --time* | -t )
71149749Sdes       echo "$timestamp" ; exit ;;
7298937Sdes    --version | -v )
73149749Sdes       echo "$version" ; exit ;;
7498937Sdes    --help | --h* | -h )
75149749Sdes       echo "$usage"; exit ;;
7698937Sdes    -- )     # Stop option processing
7798937Sdes       shift; break ;;
7898937Sdes    - )	# Use stdin as input.
7998937Sdes       break ;;
8098937Sdes    -* )
8198937Sdes       echo "$me: invalid option $1$help" >&2
8298937Sdes       exit 1 ;;
8398937Sdes    * )
8498937Sdes       break ;;
8598937Sdes  esac
8698937Sdesdone
8798937Sdes
8898937Sdesif test $# != 0; then
8998937Sdes  echo "$me: too many arguments$help" >&2
9098937Sdes  exit 1
9198937Sdesfi
9298937Sdes
93106121Sdestrap 'exit 1' 1 2 15
9498937Sdes
95106121Sdes# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96106121Sdes# compiler to aid in system detection is discouraged as it requires
97106121Sdes# temporary files to be created and, as you can see below, it is a
98106121Sdes# headache to deal with in a portable fashion.
9998937Sdes
10098937Sdes# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10198937Sdes# use `HOST_CC' if defined, but it is deprecated.
10298937Sdes
103137015Sdes# Portable tmp directory creation inspired by the Autoconf team.
104106121Sdes
105137015Sdesset_cc_for_build='
106137015Sdestrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107137015Sdestrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108137015Sdes: ${TMPDIR=/tmp} ;
109192595Sdes { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110137015Sdes { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111137015Sdes { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112137015Sdes { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113137015Sdesdummy=$tmp/dummy ;
114137015Sdestmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115106121Sdescase $CC_FOR_BUILD,$HOST_CC,$CC in
116106121Sdes ,,)    echo "int x;" > $dummy.c ;
117106121Sdes	for c in cc gcc c89 c99 ; do
118137015Sdes	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
11998937Sdes	     CC_FOR_BUILD="$c"; break ;
12098937Sdes	  fi ;
12198937Sdes	done ;
12298937Sdes	if test x"$CC_FOR_BUILD" = x ; then
12398937Sdes	  CC_FOR_BUILD=no_compiler_found ;
12498937Sdes	fi
12598937Sdes	;;
12698937Sdes ,,*)   CC_FOR_BUILD=$CC ;;
12798937Sdes ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
128192595Sdesesac ; set_cc_for_build= ;'
12998937Sdes
13098937Sdes# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
13198937Sdes# (ghazi@noc.rutgers.edu 1994-08-24)
13298937Sdesif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
13398937Sdes	PATH=$PATH:/.attbin ; export PATH
13498937Sdesfi
13598937Sdes
13698937SdesUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13798937SdesUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
13898937SdesUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
13998937SdesUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
14098937Sdes
14198937Sdes# Note: order is significant - the case branches are not exclusive.
14298937Sdes
14398937Sdescase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14498937Sdes    *:NetBSD:*:*)
14598937Sdes	# NetBSD (nbsd) targets should (where applicable) match one or
146255767Sdes	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
14798937Sdes	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
14898937Sdes	# switched to ELF, *-*-netbsd* would select the old
14998937Sdes	# object file format.  This provides both forward
15098937Sdes	# compatibility and a consistent mechanism for selecting the
15198937Sdes	# object file format.
15298937Sdes	#
15398937Sdes	# Note: NetBSD doesn't particularly care about the vendor
15498937Sdes	# portion of the name.  We always set it to "unknown".
155106121Sdes	sysctl="sysctl -n hw.machine_arch"
156106121Sdes	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
157106121Sdes	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
15898937Sdes	case "${UNAME_MACHINE_ARCH}" in
159106121Sdes	    armeb) machine=armeb-unknown ;;
16098937Sdes	    arm*) machine=arm-unknown ;;
16198937Sdes	    sh3el) machine=shl-unknown ;;
16298937Sdes	    sh3eb) machine=sh-unknown ;;
163192595Sdes	    sh5el) machine=sh5le-unknown ;;
16498937Sdes	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16598937Sdes	esac
16698937Sdes	# The Operating System including object format, if it has switched
16798937Sdes	# to ELF recently, or will in the future.
16898937Sdes	case "${UNAME_MACHINE_ARCH}" in
16998937Sdes	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
17098937Sdes		eval $set_cc_for_build
17198937Sdes		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
172204917Sdes			| grep -q __ELF__
17398937Sdes		then
17498937Sdes		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17598937Sdes		    # Return netbsd for either.  FIX?
17698937Sdes		    os=netbsd
17798937Sdes		else
17898937Sdes		    os=netbsdelf
17998937Sdes		fi
18098937Sdes		;;
18198937Sdes	    *)
182255767Sdes		os=netbsd
18398937Sdes		;;
18498937Sdes	esac
18598937Sdes	# The OS release
186137015Sdes	# Debian GNU/NetBSD machines have a different userland, and
187137015Sdes	# thus, need a distinct triplet. However, they do not need
188137015Sdes	# kernel version information, so it can be replaced with a
189137015Sdes	# suitable tag, in the style of linux-gnu.
190137015Sdes	case "${UNAME_VERSION}" in
191137015Sdes	    Debian*)
192137015Sdes		release='-gnu'
193137015Sdes		;;
194137015Sdes	    *)
195137015Sdes		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
196137015Sdes		;;
197137015Sdes	esac
19898937Sdes	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
19998937Sdes	# contains redundant information, the shorter form:
20098937Sdes	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
20198937Sdes	echo "${machine}-${os}${release}"
202149749Sdes	exit ;;
203255767Sdes    *:Bitrig:*:*)
204255767Sdes	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
205255767Sdes	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
206255767Sdes	exit ;;
20798937Sdes    *:OpenBSD:*:*)
208192595Sdes	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
209192595Sdes	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
210149749Sdes	exit ;;
211149749Sdes    *:ekkoBSD:*:*)
212149749Sdes	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
213149749Sdes	exit ;;
214192595Sdes    *:SolidBSD:*:*)
215192595Sdes	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
216192595Sdes	exit ;;
217149749Sdes    macppc:MirBSD:*:*)
218192595Sdes	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
219149749Sdes	exit ;;
220149749Sdes    *:MirBSD:*:*)
221149749Sdes	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
222149749Sdes	exit ;;
22398937Sdes    alpha:OSF1:*:*)
224149749Sdes	case $UNAME_RELEASE in
225149749Sdes	*4.0)
22698937Sdes		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
227149749Sdes		;;
228149749Sdes	*5.*)
229255767Sdes		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
230149749Sdes		;;
231149749Sdes	esac
232137015Sdes	# According to Compaq, /usr/sbin/psrinfo has been available on
233137015Sdes	# OSF/1 and Tru64 systems produced since 1995.  I hope that
234137015Sdes	# covers most systems running today.  This code pipes the CPU
235137015Sdes	# types through head -n 1, so we only detect the type of CPU 0.
236137015Sdes	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
237137015Sdes	case "$ALPHA_CPU_TYPE" in
238137015Sdes	    "EV4 (21064)")
239137015Sdes		UNAME_MACHINE="alpha" ;;
240137015Sdes	    "EV4.5 (21064)")
241137015Sdes		UNAME_MACHINE="alpha" ;;
242137015Sdes	    "LCA4 (21066/21068)")
243137015Sdes		UNAME_MACHINE="alpha" ;;
244137015Sdes	    "EV5 (21164)")
245137015Sdes		UNAME_MACHINE="alphaev5" ;;
246137015Sdes	    "EV5.6 (21164A)")
247137015Sdes		UNAME_MACHINE="alphaev56" ;;
248137015Sdes	    "EV5.6 (21164PC)")
249137015Sdes		UNAME_MACHINE="alphapca56" ;;
250137015Sdes	    "EV5.7 (21164PC)")
251137015Sdes		UNAME_MACHINE="alphapca57" ;;
252137015Sdes	    "EV6 (21264)")
253137015Sdes		UNAME_MACHINE="alphaev6" ;;
254137015Sdes	    "EV6.7 (21264A)")
255137015Sdes		UNAME_MACHINE="alphaev67" ;;
256137015Sdes	    "EV6.8CB (21264C)")
257137015Sdes		UNAME_MACHINE="alphaev68" ;;
258137015Sdes	    "EV6.8AL (21264B)")
259137015Sdes		UNAME_MACHINE="alphaev68" ;;
260137015Sdes	    "EV6.8CX (21264D)")
261137015Sdes		UNAME_MACHINE="alphaev68" ;;
262137015Sdes	    "EV6.9A (21264/EV69A)")
263137015Sdes		UNAME_MACHINE="alphaev69" ;;
264137015Sdes	    "EV7 (21364)")
265137015Sdes		UNAME_MACHINE="alphaev7" ;;
266137015Sdes	    "EV7.9 (21364A)")
267137015Sdes		UNAME_MACHINE="alphaev79" ;;
268137015Sdes	esac
269149749Sdes	# A Pn.n version is a patched version.
27098937Sdes	# A Vn.n version is a released version.
27198937Sdes	# A Tn.n version is a released field test version.
27298937Sdes	# A Xn.n version is an unreleased experimental baselevel.
27398937Sdes	# 1.2 uses "1.2" for uname -r.
274149749Sdes	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
275226046Sdes	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
276226046Sdes	exitcode=$?
277226046Sdes	trap '' 0
278226046Sdes	exit $exitcode ;;
27998937Sdes    Alpha\ *:Windows_NT*:*)
28098937Sdes	# How do we know it's Interix rather than the generic POSIX subsystem?
28198937Sdes	# Should we change UNAME_MACHINE based on the output of uname instead
28298937Sdes	# of the specific Alpha model?
28398937Sdes	echo alpha-pc-interix
284149749Sdes	exit ;;
28598937Sdes    21064:Windows_NT:50:3)
28698937Sdes	echo alpha-dec-winnt3.5
287149749Sdes	exit ;;
28898937Sdes    Amiga*:UNIX_System_V:4.0:*)
28998937Sdes	echo m68k-unknown-sysv4
290149749Sdes	exit ;;
29198937Sdes    *:[Aa]miga[Oo][Ss]:*:*)
29298937Sdes	echo ${UNAME_MACHINE}-unknown-amigaos
293149749Sdes	exit ;;
29498937Sdes    *:[Mm]orph[Oo][Ss]:*:*)
29598937Sdes	echo ${UNAME_MACHINE}-unknown-morphos
296149749Sdes	exit ;;
29798937Sdes    *:OS/390:*:*)
29898937Sdes	echo i370-ibm-openedition
299149749Sdes	exit ;;
300149749Sdes    *:z/VM:*:*)
301149749Sdes	echo s390-ibm-zvmoe
302149749Sdes	exit ;;
303149749Sdes    *:OS400:*:*)
304255767Sdes	echo powerpc-ibm-os400
305149749Sdes	exit ;;
30698937Sdes    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
30798937Sdes	echo arm-acorn-riscix${UNAME_RELEASE}
308149749Sdes	exit ;;
309255767Sdes    arm*:riscos:*:*|arm*:RISCOS:*:*)
310149749Sdes	echo arm-unknown-riscos
311149749Sdes	exit ;;
31298937Sdes    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
31398937Sdes	echo hppa1.1-hitachi-hiuxmpp
314149749Sdes	exit ;;
31598937Sdes    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
31698937Sdes	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
31798937Sdes	if test "`(/bin/universe) 2>/dev/null`" = att ; then
31898937Sdes		echo pyramid-pyramid-sysv3
31998937Sdes	else
32098937Sdes		echo pyramid-pyramid-bsd
32198937Sdes	fi
322149749Sdes	exit ;;
32398937Sdes    NILE*:*:*:dcosx)
32498937Sdes	echo pyramid-pyramid-svr4
325149749Sdes	exit ;;
326137015Sdes    DRS?6000:unix:4.0:6*)
327137015Sdes	echo sparc-icl-nx6
328149749Sdes	exit ;;
329149749Sdes    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
330106121Sdes	case `/usr/bin/uname -p` in
331149749Sdes	    sparc) echo sparc-icl-nx7; exit ;;
332106121Sdes	esac ;;
333204917Sdes    s390x:SunOS:*:*)
334204917Sdes	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335204917Sdes	exit ;;
33698937Sdes    sun4H:SunOS:5.*:*)
33798937Sdes	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
338149749Sdes	exit ;;
33998937Sdes    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
34098937Sdes	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
341149749Sdes	exit ;;
342204917Sdes    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
343204917Sdes	echo i386-pc-auroraux${UNAME_RELEASE}
344204917Sdes	exit ;;
345192595Sdes    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
346204917Sdes	eval $set_cc_for_build
347204917Sdes	SUN_ARCH="i386"
348204917Sdes	# If there is a compiler, see if it is configured for 64-bit objects.
349204917Sdes	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
350204917Sdes	# This test works for both compilers.
351204917Sdes	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
352204917Sdes	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
353204917Sdes		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
354204917Sdes		grep IS_64BIT_ARCH >/dev/null
355204917Sdes	    then
356204917Sdes		SUN_ARCH="x86_64"
357204917Sdes	    fi
358204917Sdes	fi
359204917Sdes	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
360149749Sdes	exit ;;
36198937Sdes    sun4*:SunOS:6*:*)
36298937Sdes	# According to config.sub, this is the proper way to canonicalize
36398937Sdes	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
36498937Sdes	# it's likely to be more like Solaris than SunOS4.
36598937Sdes	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
366149749Sdes	exit ;;
36798937Sdes    sun4*:SunOS:*:*)
36898937Sdes	case "`/usr/bin/arch -k`" in
36998937Sdes	    Series*|S4*)
37098937Sdes		UNAME_RELEASE=`uname -v`
37198937Sdes		;;
37298937Sdes	esac
37398937Sdes	# Japanese Language versions have a version number like `4.1.3-JL'.
37498937Sdes	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
375149749Sdes	exit ;;
37698937Sdes    sun3*:SunOS:*:*)
37798937Sdes	echo m68k-sun-sunos${UNAME_RELEASE}
378149749Sdes	exit ;;
37998937Sdes    sun*:*:4.2BSD:*)
380106121Sdes	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
38198937Sdes	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
38298937Sdes	case "`/bin/arch`" in
38398937Sdes	    sun3)
38498937Sdes		echo m68k-sun-sunos${UNAME_RELEASE}
38598937Sdes		;;
38698937Sdes	    sun4)
38798937Sdes		echo sparc-sun-sunos${UNAME_RELEASE}
38898937Sdes		;;
38998937Sdes	esac
390149749Sdes	exit ;;
39198937Sdes    aushp:SunOS:*:*)
39298937Sdes	echo sparc-auspex-sunos${UNAME_RELEASE}
393149749Sdes	exit ;;
39498937Sdes    # The situation for MiNT is a little confusing.  The machine name
39598937Sdes    # can be virtually everything (everything which is not
39698937Sdes    # "atarist" or "atariste" at least should have a processor
39798937Sdes    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
39898937Sdes    # to the lowercase version "mint" (or "freemint").  Finally
39998937Sdes    # the system name "TOS" denotes a system which is actually not
40098937Sdes    # MiNT.  But MiNT is downward compatible to TOS, so this should
40198937Sdes    # be no problem.
40298937Sdes    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
403255767Sdes	echo m68k-atari-mint${UNAME_RELEASE}
404149749Sdes	exit ;;
40598937Sdes    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
40698937Sdes	echo m68k-atari-mint${UNAME_RELEASE}
407255767Sdes	exit ;;
40898937Sdes    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
409255767Sdes	echo m68k-atari-mint${UNAME_RELEASE}
410149749Sdes	exit ;;
41198937Sdes    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
412255767Sdes	echo m68k-milan-mint${UNAME_RELEASE}
413255767Sdes	exit ;;
41498937Sdes    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
415255767Sdes	echo m68k-hades-mint${UNAME_RELEASE}
416255767Sdes	exit ;;
41798937Sdes    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
418255767Sdes	echo m68k-unknown-mint${UNAME_RELEASE}
419255767Sdes	exit ;;
420149749Sdes    m68k:machten:*:*)
421149749Sdes	echo m68k-apple-machten${UNAME_RELEASE}
422149749Sdes	exit ;;
42398937Sdes    powerpc:machten:*:*)
42498937Sdes	echo powerpc-apple-machten${UNAME_RELEASE}
425149749Sdes	exit ;;
42698937Sdes    RISC*:Mach:*:*)
42798937Sdes	echo mips-dec-mach_bsd4.3
428149749Sdes	exit ;;
42998937Sdes    RISC*:ULTRIX:*:*)
43098937Sdes	echo mips-dec-ultrix${UNAME_RELEASE}
431149749Sdes	exit ;;
43298937Sdes    VAX*:ULTRIX*:*:*)
43398937Sdes	echo vax-dec-ultrix${UNAME_RELEASE}
434149749Sdes	exit ;;
43598937Sdes    2020:CLIX:*:* | 2430:CLIX:*:*)
43698937Sdes	echo clipper-intergraph-clix${UNAME_RELEASE}
437149749Sdes	exit ;;
43898937Sdes    mips:*:*:UMIPS | mips:*:*:RISCos)
43998937Sdes	eval $set_cc_for_build
44098937Sdes	sed 's/^	//' << EOF >$dummy.c
44198937Sdes#ifdef __cplusplus
44298937Sdes#include <stdio.h>  /* for printf() prototype */
44398937Sdes	int main (int argc, char *argv[]) {
44498937Sdes#else
44598937Sdes	int main (argc, argv) int argc; char *argv[]; {
44698937Sdes#endif
44798937Sdes	#if defined (host_mips) && defined (MIPSEB)
44898937Sdes	#if defined (SYSTYPE_SYSV)
44998937Sdes	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
45098937Sdes	#endif
45198937Sdes	#if defined (SYSTYPE_SVR4)
45298937Sdes	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
45398937Sdes	#endif
45498937Sdes	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
45598937Sdes	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
45698937Sdes	#endif
45798937Sdes	#endif
45898937Sdes	  exit (-1);
45998937Sdes	}
46098937SdesEOF
461149749Sdes	$CC_FOR_BUILD -o $dummy $dummy.c &&
462149749Sdes	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
463149749Sdes	  SYSTEM_NAME=`$dummy $dummyarg` &&
464149749Sdes	    { echo "$SYSTEM_NAME"; exit; }
46598937Sdes	echo mips-mips-riscos${UNAME_RELEASE}
466149749Sdes	exit ;;
46798937Sdes    Motorola:PowerMAX_OS:*:*)
46898937Sdes	echo powerpc-motorola-powermax
469149749Sdes	exit ;;
470137015Sdes    Motorola:*:4.3:PL8-*)
471106121Sdes	echo powerpc-harris-powermax
472149749Sdes	exit ;;
473137015Sdes    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
474137015Sdes	echo powerpc-harris-powermax
475149749Sdes	exit ;;
47698937Sdes    Night_Hawk:Power_UNIX:*:*)
47798937Sdes	echo powerpc-harris-powerunix
478149749Sdes	exit ;;
47998937Sdes    m88k:CX/UX:7*:*)
48098937Sdes	echo m88k-harris-cxux7
481149749Sdes	exit ;;
48298937Sdes    m88k:*:4*:R4*)
48398937Sdes	echo m88k-motorola-sysv4
484149749Sdes	exit ;;
48598937Sdes    m88k:*:3*:R3*)
48698937Sdes	echo m88k-motorola-sysv3
487149749Sdes	exit ;;
48898937Sdes    AViiON:dgux:*:*)
489255767Sdes	# DG/UX returns AViiON for all architectures
490255767Sdes	UNAME_PROCESSOR=`/usr/bin/uname -p`
49198937Sdes	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
49298937Sdes	then
49398937Sdes	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
49498937Sdes	       [ ${TARGET_BINARY_INTERFACE}x = x ]
49598937Sdes	    then
49698937Sdes		echo m88k-dg-dgux${UNAME_RELEASE}
49798937Sdes	    else
49898937Sdes		echo m88k-dg-dguxbcs${UNAME_RELEASE}
49998937Sdes	    fi
50098937Sdes	else
50198937Sdes	    echo i586-dg-dgux${UNAME_RELEASE}
50298937Sdes	fi
503255767Sdes	exit ;;
50498937Sdes    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
50598937Sdes	echo m88k-dolphin-sysv3
506149749Sdes	exit ;;
50798937Sdes    M88*:*:R3*:*)
50898937Sdes	# Delta 88k system running SVR3
50998937Sdes	echo m88k-motorola-sysv3
510149749Sdes	exit ;;
51198937Sdes    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
51298937Sdes	echo m88k-tektronix-sysv3
513149749Sdes	exit ;;
51498937Sdes    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
51598937Sdes	echo m68k-tektronix-bsd
516149749Sdes	exit ;;
51798937Sdes    *:IRIX*:*:*)
51898937Sdes	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
519149749Sdes	exit ;;
52098937Sdes    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
521149749Sdes	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
522149749Sdes	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
52398937Sdes    i*86:AIX:*:*)
52498937Sdes	echo i386-ibm-aix
525149749Sdes	exit ;;
52698937Sdes    ia64:AIX:*:*)
52798937Sdes	if [ -x /usr/bin/oslevel ] ; then
52898937Sdes		IBM_REV=`/usr/bin/oslevel`
52998937Sdes	else
53098937Sdes		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
53198937Sdes	fi
53298937Sdes	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
533149749Sdes	exit ;;
53498937Sdes    *:AIX:2:3)
53598937Sdes	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
53698937Sdes		eval $set_cc_for_build
53798937Sdes		sed 's/^		//' << EOF >$dummy.c
53898937Sdes		#include <sys/systemcfg.h>
53998937Sdes
54098937Sdes		main()
54198937Sdes			{
54298937Sdes			if (!__power_pc())
54398937Sdes				exit(1);
54498937Sdes			puts("powerpc-ibm-aix3.2.5");
54598937Sdes			exit(0);
54698937Sdes			}
54798937SdesEOF
548149749Sdes		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
549149749Sdes		then
550149749Sdes			echo "$SYSTEM_NAME"
551149749Sdes		else
552149749Sdes			echo rs6000-ibm-aix3.2.5
553149749Sdes		fi
55498937Sdes	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
55598937Sdes		echo rs6000-ibm-aix3.2.4
55698937Sdes	else
55798937Sdes		echo rs6000-ibm-aix3.2
55898937Sdes	fi
559149749Sdes	exit ;;
560226046Sdes    *:AIX:*:[4567])
561106121Sdes	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
56298937Sdes	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
56398937Sdes		IBM_ARCH=rs6000
56498937Sdes	else
56598937Sdes		IBM_ARCH=powerpc
56698937Sdes	fi
56798937Sdes	if [ -x /usr/bin/oslevel ] ; then
56898937Sdes		IBM_REV=`/usr/bin/oslevel`
56998937Sdes	else
57098937Sdes		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
57198937Sdes	fi
57298937Sdes	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
573149749Sdes	exit ;;
57498937Sdes    *:AIX:*:*)
57598937Sdes	echo rs6000-ibm-aix
576149749Sdes	exit ;;
57798937Sdes    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
57898937Sdes	echo romp-ibm-bsd4.4
579149749Sdes	exit ;;
58098937Sdes    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
58198937Sdes	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
582149749Sdes	exit ;;                             # report: romp-ibm BSD 4.3
58398937Sdes    *:BOSX:*:*)
58498937Sdes	echo rs6000-bull-bosx
585149749Sdes	exit ;;
58698937Sdes    DPX/2?00:B.O.S.:*:*)
58798937Sdes	echo m68k-bull-sysv3
588149749Sdes	exit ;;
58998937Sdes    9000/[34]??:4.3bsd:1.*:*)
59098937Sdes	echo m68k-hp-bsd
591149749Sdes	exit ;;
59298937Sdes    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
59398937Sdes	echo m68k-hp-bsd4.4
594149749Sdes	exit ;;
59598937Sdes    9000/[34678]??:HP-UX:*:*)
59698937Sdes	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
59798937Sdes	case "${UNAME_MACHINE}" in
59898937Sdes	    9000/31? )            HP_ARCH=m68000 ;;
59998937Sdes	    9000/[34]?? )         HP_ARCH=m68k ;;
60098937Sdes	    9000/[678][0-9][0-9])
60198937Sdes		if [ -x /usr/bin/getconf ]; then
60298937Sdes		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
603255767Sdes		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
604255767Sdes		    case "${sc_cpu_version}" in
605255767Sdes		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
606255767Sdes		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
607255767Sdes		      532)                      # CPU_PA_RISC2_0
608255767Sdes			case "${sc_kernel_bits}" in
609255767Sdes			  32) HP_ARCH="hppa2.0n" ;;
610255767Sdes			  64) HP_ARCH="hppa2.0w" ;;
61198937Sdes			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
612255767Sdes			esac ;;
613255767Sdes		    esac
61498937Sdes		fi
61598937Sdes		if [ "${HP_ARCH}" = "" ]; then
61698937Sdes		    eval $set_cc_for_build
617255767Sdes		    sed 's/^		//' << EOF >$dummy.c
61898937Sdes
619255767Sdes		#define _HPUX_SOURCE
620255767Sdes		#include <stdlib.h>
621255767Sdes		#include <unistd.h>
62298937Sdes
623255767Sdes		int main ()
624255767Sdes		{
625255767Sdes		#if defined(_SC_KERNEL_BITS)
626255767Sdes		    long bits = sysconf(_SC_KERNEL_BITS);
627255767Sdes		#endif
628255767Sdes		    long cpu  = sysconf (_SC_CPU_VERSION);
62998937Sdes
630255767Sdes		    switch (cpu)
631255767Sdes			{
632255767Sdes			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
633255767Sdes			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
634255767Sdes			case CPU_PA_RISC2_0:
635255767Sdes		#if defined(_SC_KERNEL_BITS)
636255767Sdes			    switch (bits)
637255767Sdes				{
638255767Sdes				case 64: puts ("hppa2.0w"); break;
639255767Sdes				case 32: puts ("hppa2.0n"); break;
640255767Sdes				default: puts ("hppa2.0"); break;
641255767Sdes				} break;
642255767Sdes		#else  /* !defined(_SC_KERNEL_BITS) */
643255767Sdes			    puts ("hppa2.0"); break;
644255767Sdes		#endif
645255767Sdes			default: puts ("hppa1.0"); break;
646255767Sdes			}
647255767Sdes		    exit (0);
648255767Sdes		}
64998937SdesEOF
650137015Sdes		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
651137015Sdes		    test -z "$HP_ARCH" && HP_ARCH=hppa
65298937Sdes		fi ;;
65398937Sdes	esac
654137015Sdes	if [ ${HP_ARCH} = "hppa2.0w" ]
655137015Sdes	then
656192595Sdes	    eval $set_cc_for_build
657149749Sdes
658149749Sdes	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
659149749Sdes	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
660149749Sdes	    # generating 64-bit code.  GNU and HP use different nomenclature:
661149749Sdes	    #
662149749Sdes	    # $ CC_FOR_BUILD=cc ./config.guess
663149749Sdes	    # => hppa2.0w-hp-hpux11.23
664149749Sdes	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
665149749Sdes	    # => hppa64-hp-hpux11.23
666149749Sdes
667149749Sdes	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
668204917Sdes		grep -q __LP64__
669137015Sdes	    then
670137015Sdes		HP_ARCH="hppa2.0w"
671137015Sdes	    else
672137015Sdes		HP_ARCH="hppa64"
673137015Sdes	    fi
674137015Sdes	fi
67598937Sdes	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
676149749Sdes	exit ;;
67798937Sdes    ia64:HP-UX:*:*)
67898937Sdes	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
67998937Sdes	echo ia64-hp-hpux${HPUX_REV}
680149749Sdes	exit ;;
68198937Sdes    3050*:HI-UX:*:*)
68298937Sdes	eval $set_cc_for_build
68398937Sdes	sed 's/^	//' << EOF >$dummy.c
68498937Sdes	#include <unistd.h>
68598937Sdes	int
68698937Sdes	main ()
68798937Sdes	{
68898937Sdes	  long cpu = sysconf (_SC_CPU_VERSION);
68998937Sdes	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
69098937Sdes	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
69198937Sdes	     results, however.  */
69298937Sdes	  if (CPU_IS_PA_RISC (cpu))
69398937Sdes	    {
69498937Sdes	      switch (cpu)
69598937Sdes		{
69698937Sdes		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
69798937Sdes		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
69898937Sdes		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
69998937Sdes		  default: puts ("hppa-hitachi-hiuxwe2"); break;
70098937Sdes		}
70198937Sdes	    }
70298937Sdes	  else if (CPU_IS_HP_MC68K (cpu))
70398937Sdes	    puts ("m68k-hitachi-hiuxwe2");
70498937Sdes	  else puts ("unknown-hitachi-hiuxwe2");
70598937Sdes	  exit (0);
70698937Sdes	}
70798937SdesEOF
708149749Sdes	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
709149749Sdes		{ echo "$SYSTEM_NAME"; exit; }
71098937Sdes	echo unknown-hitachi-hiuxwe2
711149749Sdes	exit ;;
71298937Sdes    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
71398937Sdes	echo hppa1.1-hp-bsd
714149749Sdes	exit ;;
71598937Sdes    9000/8??:4.3bsd:*:*)
71698937Sdes	echo hppa1.0-hp-bsd
717149749Sdes	exit ;;
71898937Sdes    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
71998937Sdes	echo hppa1.0-hp-mpeix
720149749Sdes	exit ;;
72198937Sdes    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
72298937Sdes	echo hppa1.1-hp-osf
723149749Sdes	exit ;;
72498937Sdes    hp8??:OSF1:*:*)
72598937Sdes	echo hppa1.0-hp-osf
726149749Sdes	exit ;;
72798937Sdes    i*86:OSF1:*:*)
72898937Sdes	if [ -x /usr/sbin/sysversion ] ; then
72998937Sdes	    echo ${UNAME_MACHINE}-unknown-osf1mk
73098937Sdes	else
73198937Sdes	    echo ${UNAME_MACHINE}-unknown-osf1
73298937Sdes	fi
733149749Sdes	exit ;;
73498937Sdes    parisc*:Lites*:*:*)
73598937Sdes	echo hppa1.1-hp-lites
736149749Sdes	exit ;;
73798937Sdes    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
73898937Sdes	echo c1-convex-bsd
739255767Sdes	exit ;;
74098937Sdes    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
74198937Sdes	if getsysinfo -f scalar_acc
74298937Sdes	then echo c32-convex-bsd
74398937Sdes	else echo c2-convex-bsd
74498937Sdes	fi
745255767Sdes	exit ;;
74698937Sdes    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
74798937Sdes	echo c34-convex-bsd
748255767Sdes	exit ;;
74998937Sdes    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
75098937Sdes	echo c38-convex-bsd
751255767Sdes	exit ;;
75298937Sdes    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
75398937Sdes	echo c4-convex-bsd
754255767Sdes	exit ;;
75598937Sdes    CRAY*Y-MP:*:*:*)
75698937Sdes	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
757149749Sdes	exit ;;
75898937Sdes    CRAY*[A-Z]90:*:*:*)
75998937Sdes	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
76098937Sdes	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
76198937Sdes	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
76298937Sdes	      -e 's/\.[^.]*$/.X/'
763149749Sdes	exit ;;
76498937Sdes    CRAY*TS:*:*:*)
76598937Sdes	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
766149749Sdes	exit ;;
76798937Sdes    CRAY*T3E:*:*:*)
76898937Sdes	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
769149749Sdes	exit ;;
77098937Sdes    CRAY*SV1:*:*:*)
77198937Sdes	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
772149749Sdes	exit ;;
773113908Sdes    *:UNICOS/mp:*:*)
774149749Sdes	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
775149749Sdes	exit ;;
77698937Sdes    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
77798937Sdes	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
778255767Sdes	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
779255767Sdes	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
780255767Sdes	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
781255767Sdes	exit ;;
782149749Sdes    5000:UNIX_System_V:4.*:*)
783255767Sdes	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
784255767Sdes	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
785255767Sdes	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
786149749Sdes	exit ;;
78798937Sdes    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
78898937Sdes	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
789149749Sdes	exit ;;
79098937Sdes    sparc*:BSD/OS:*:*)
79198937Sdes	echo sparc-unknown-bsdi${UNAME_RELEASE}
792149749Sdes	exit ;;
79398937Sdes    *:BSD/OS:*:*)
79498937Sdes	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
795149749Sdes	exit ;;
796149749Sdes    *:FreeBSD:*:*)
797255767Sdes	UNAME_PROCESSOR=`/usr/bin/uname -p`
798255767Sdes	case ${UNAME_PROCESSOR} in
799192595Sdes	    amd64)
800192595Sdes		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
801192595Sdes	    *)
802255767Sdes		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
803192595Sdes	esac
804149749Sdes	exit ;;
80598937Sdes    i*:CYGWIN*:*)
80698937Sdes	echo ${UNAME_MACHINE}-pc-cygwin
807149749Sdes	exit ;;
808255767Sdes    *:MINGW64*:*)
809255767Sdes	echo ${UNAME_MACHINE}-pc-mingw64
810255767Sdes	exit ;;
811192595Sdes    *:MINGW*:*)
81298937Sdes	echo ${UNAME_MACHINE}-pc-mingw32
813149749Sdes	exit ;;
814255767Sdes    i*:MSYS*:*)
815255767Sdes	echo ${UNAME_MACHINE}-pc-msys
816255767Sdes	exit ;;
817149749Sdes    i*:windows32*:*)
818255767Sdes	# uname -m includes "-pc" on this system.
819255767Sdes	echo ${UNAME_MACHINE}-mingw32
820149749Sdes	exit ;;
82198937Sdes    i*:PW*:*)
82298937Sdes	echo ${UNAME_MACHINE}-pc-pw32
823149749Sdes	exit ;;
824204917Sdes    *:Interix*:*)
825255767Sdes	case ${UNAME_MACHINE} in
826192595Sdes	    x86)
827192595Sdes		echo i586-pc-interix${UNAME_RELEASE}
828192595Sdes		exit ;;
829204917Sdes	    authenticamd | genuineintel | EM64T)
830192595Sdes		echo x86_64-unknown-interix${UNAME_RELEASE}
831192595Sdes		exit ;;
832192595Sdes	    IA64)
833192595Sdes		echo ia64-unknown-interix${UNAME_RELEASE}
834192595Sdes		exit ;;
835192595Sdes	esac ;;
836137015Sdes    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
837137015Sdes	echo i${UNAME_MACHINE}-pc-mks
838149749Sdes	exit ;;
839204917Sdes    8664:Windows_NT:*)
840204917Sdes	echo x86_64-pc-mks
841204917Sdes	exit ;;
84298937Sdes    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
84398937Sdes	# How do we know it's Interix rather than the generic POSIX subsystem?
84498937Sdes	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
84598937Sdes	# UNAME_MACHINE based on the output of uname instead of i386?
846137015Sdes	echo i586-pc-interix
847149749Sdes	exit ;;
84898937Sdes    i*:UWIN*:*)
84998937Sdes	echo ${UNAME_MACHINE}-pc-uwin
850149749Sdes	exit ;;
851192595Sdes    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
852149749Sdes	echo x86_64-unknown-cygwin
853149749Sdes	exit ;;
85498937Sdes    p*:CYGWIN*:*)
85598937Sdes	echo powerpcle-unknown-cygwin
856149749Sdes	exit ;;
85798937Sdes    prep*:SunOS:5.*:*)
85898937Sdes	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
859149749Sdes	exit ;;
86098937Sdes    *:GNU:*:*)
861149749Sdes	# the GNU system
86298937Sdes	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
863149749Sdes	exit ;;
864149749Sdes    *:GNU/*:*:*)
865149749Sdes	# other systems with GNU libc and userland
866149749Sdes	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
867149749Sdes	exit ;;
86898937Sdes    i*86:Minix:*:*)
86998937Sdes	echo ${UNAME_MACHINE}-pc-minix
870149749Sdes	exit ;;
871255767Sdes    aarch64:Linux:*:*)
872255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
873255767Sdes	exit ;;
874255767Sdes    aarch64_be:Linux:*:*)
875255767Sdes	UNAME_MACHINE=aarch64_be
876255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
877255767Sdes	exit ;;
878204917Sdes    alpha:Linux:*:*)
879204917Sdes	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
880204917Sdes	  EV5)   UNAME_MACHINE=alphaev5 ;;
881204917Sdes	  EV56)  UNAME_MACHINE=alphaev56 ;;
882204917Sdes	  PCA56) UNAME_MACHINE=alphapca56 ;;
883204917Sdes	  PCA57) UNAME_MACHINE=alphapca56 ;;
884204917Sdes	  EV6)   UNAME_MACHINE=alphaev6 ;;
885204917Sdes	  EV67)  UNAME_MACHINE=alphaev67 ;;
886204917Sdes	  EV68*) UNAME_MACHINE=alphaev68 ;;
887255767Sdes	esac
888204917Sdes	objdump --private-headers /bin/sh | grep -q ld.so.1
889204917Sdes	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
890204917Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
891204917Sdes	exit ;;
89298937Sdes    arm*:Linux:*:*)
893192595Sdes	eval $set_cc_for_build
894192595Sdes	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
895192595Sdes	    | grep -q __ARM_EABI__
896192595Sdes	then
897192595Sdes	    echo ${UNAME_MACHINE}-unknown-linux-gnu
898192595Sdes	else
899255767Sdes	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
900255767Sdes		| grep -q __ARM_PCS_VFP
901255767Sdes	    then
902255767Sdes		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
903255767Sdes	    else
904255767Sdes		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
905255767Sdes	    fi
906192595Sdes	fi
907192595Sdes	exit ;;
908192595Sdes    avr32*:Linux:*:*)
90998937Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
910149749Sdes	exit ;;
911137015Sdes    cris:Linux:*:*)
912255767Sdes	echo ${UNAME_MACHINE}-axis-linux-gnu
913149749Sdes	exit ;;
914149749Sdes    crisv32:Linux:*:*)
915255767Sdes	echo ${UNAME_MACHINE}-axis-linux-gnu
916149749Sdes	exit ;;
917149749Sdes    frv:Linux:*:*)
918255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
919149749Sdes	exit ;;
920255767Sdes    hexagon:Linux:*:*)
921255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
922255767Sdes	exit ;;
923204917Sdes    i*86:Linux:*:*)
924204917Sdes	LIBC=gnu
925204917Sdes	eval $set_cc_for_build
926204917Sdes	sed 's/^	//' << EOF >$dummy.c
927204917Sdes	#ifdef __dietlibc__
928204917Sdes	LIBC=dietlibc
929204917Sdes	#endif
930204917SdesEOF
931204917Sdes	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
932204917Sdes	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
933204917Sdes	exit ;;
93498937Sdes    ia64:Linux:*:*)
935106121Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
936149749Sdes	exit ;;
937149749Sdes    m32r*:Linux:*:*)
938149749Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
939149749Sdes	exit ;;
94098937Sdes    m68*:Linux:*:*)
94198937Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
942149749Sdes	exit ;;
943204917Sdes    mips:Linux:*:* | mips64:Linux:*:*)
94498937Sdes	eval $set_cc_for_build
94598937Sdes	sed 's/^	//' << EOF >$dummy.c
94698937Sdes	#undef CPU
947204917Sdes	#undef ${UNAME_MACHINE}
948204917Sdes	#undef ${UNAME_MACHINE}el
949106121Sdes	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
950204917Sdes	CPU=${UNAME_MACHINE}el
95198937Sdes	#else
952106121Sdes	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
953204917Sdes	CPU=${UNAME_MACHINE}
95498937Sdes	#else
95598937Sdes	CPU=
95698937Sdes	#endif
957106121Sdes	#endif
95898937SdesEOF
959204917Sdes	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
960149749Sdes	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
96198937Sdes	;;
962192595Sdes    or32:Linux:*:*)
963255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
964192595Sdes	exit ;;
965204917Sdes    padre:Linux:*:*)
966204917Sdes	echo sparc-unknown-linux-gnu
967149749Sdes	exit ;;
968204917Sdes    parisc64:Linux:*:* | hppa64:Linux:*:*)
969204917Sdes	echo hppa64-unknown-linux-gnu
970149749Sdes	exit ;;
97198937Sdes    parisc:Linux:*:* | hppa:Linux:*:*)
97298937Sdes	# Look for CPU level
97398937Sdes	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
97498937Sdes	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
97598937Sdes	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
97698937Sdes	  *)    echo hppa-unknown-linux-gnu ;;
97798937Sdes	esac
978149749Sdes	exit ;;
979204917Sdes    ppc64:Linux:*:*)
980204917Sdes	echo powerpc64-unknown-linux-gnu
981149749Sdes	exit ;;
982204917Sdes    ppc:Linux:*:*)
983204917Sdes	echo powerpc-unknown-linux-gnu
984204917Sdes	exit ;;
985295367Sdes    ppc64le:Linux:*:*)
986295367Sdes	echo powerpc64le-unknown-linux-gnu
987295367Sdes	exit ;;
988295367Sdes    ppcle:Linux:*:*)
989295367Sdes	echo powerpcle-unknown-linux-gnu
990295367Sdes	exit ;;
99198937Sdes    s390:Linux:*:* | s390x:Linux:*:*)
99298937Sdes	echo ${UNAME_MACHINE}-ibm-linux
993149749Sdes	exit ;;
994137015Sdes    sh64*:Linux:*:*)
995255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
996149749Sdes	exit ;;
99798937Sdes    sh*:Linux:*:*)
99898937Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
999149749Sdes	exit ;;
100098937Sdes    sparc:Linux:*:* | sparc64:Linux:*:*)
100198937Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
1002149749Sdes	exit ;;
1003226046Sdes    tile*:Linux:*:*)
1004255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
1005226046Sdes	exit ;;
1006192595Sdes    vax:Linux:*:*)
1007192595Sdes	echo ${UNAME_MACHINE}-dec-linux-gnu
1008192595Sdes	exit ;;
100998937Sdes    x86_64:Linux:*:*)
1010255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
1011149749Sdes	exit ;;
1012192595Sdes    xtensa*:Linux:*:*)
1013255767Sdes	echo ${UNAME_MACHINE}-unknown-linux-gnu
1014192595Sdes	exit ;;
101598937Sdes    i*86:DYNIX/ptx:4*:*)
101698937Sdes	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
101798937Sdes	# earlier versions are messed up and put the nodename in both
101898937Sdes	# sysname and nodename.
101998937Sdes	echo i386-sequent-sysv4
1020149749Sdes	exit ;;
102198937Sdes    i*86:UNIX_SV:4.2MP:2.*)
1022255767Sdes	# Unixware is an offshoot of SVR4, but it has its own version
1023255767Sdes	# number series starting with 2...
1024255767Sdes	# I am not positive that other SVR4 systems won't match this,
102598937Sdes	# I just have to hope.  -- rms.
1026255767Sdes	# Use sysv4.2uw... so that sysv4* matches it.
102798937Sdes	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1028149749Sdes	exit ;;
1029137015Sdes    i*86:OS/2:*:*)
1030137015Sdes	# If we were able to find `uname', then EMX Unix compatibility
1031137015Sdes	# is probably installed.
1032137015Sdes	echo ${UNAME_MACHINE}-pc-os2-emx
1033149749Sdes	exit ;;
1034137015Sdes    i*86:XTS-300:*:STOP)
1035137015Sdes	echo ${UNAME_MACHINE}-unknown-stop
1036149749Sdes	exit ;;
1037137015Sdes    i*86:atheos:*:*)
1038137015Sdes	echo ${UNAME_MACHINE}-unknown-atheos
1039149749Sdes	exit ;;
1040149749Sdes    i*86:syllable:*:*)
1041149749Sdes	echo ${UNAME_MACHINE}-pc-syllable
1042149749Sdes	exit ;;
1043204917Sdes    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1044137015Sdes	echo i386-unknown-lynxos${UNAME_RELEASE}
1045149749Sdes	exit ;;
1046137015Sdes    i*86:*DOS:*:*)
1047137015Sdes	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1048149749Sdes	exit ;;
104998937Sdes    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
105098937Sdes	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
105198937Sdes	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
105298937Sdes		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
105398937Sdes	else
105498937Sdes		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
105598937Sdes	fi
1056149749Sdes	exit ;;
1057147001Sdes    i*86:*:5:[678]*)
1058255767Sdes	# UnixWare 7.x, OpenUNIX and OpenServer 6.
105998937Sdes	case `/bin/uname -X | grep "^Machine"` in
106098937Sdes	    *486*)	     UNAME_MACHINE=i486 ;;
106198937Sdes	    *Pentium)	     UNAME_MACHINE=i586 ;;
106298937Sdes	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
106398937Sdes	esac
106498937Sdes	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1065149749Sdes	exit ;;
106698937Sdes    i*86:*:3.2:*)
106798937Sdes	if test -f /usr/options/cb.name; then
106898937Sdes		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
106998937Sdes		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
107098937Sdes	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1071106121Sdes		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1072106121Sdes		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1073106121Sdes		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
107498937Sdes			&& UNAME_MACHINE=i586
1075106121Sdes		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
107698937Sdes			&& UNAME_MACHINE=i686
1077106121Sdes		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
107898937Sdes			&& UNAME_MACHINE=i686
107998937Sdes		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
108098937Sdes	else
108198937Sdes		echo ${UNAME_MACHINE}-pc-sysv32
108298937Sdes	fi
1083149749Sdes	exit ;;
108498937Sdes    pc:*:*:*)
108598937Sdes	# Left here for compatibility:
1086255767Sdes	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1087255767Sdes	# the processor, so we play safe by assuming i586.
1088204917Sdes	# Note: whatever this is, it MUST be the same as what config.sub
1089204917Sdes	# prints for the "djgpp" host, or else GDB configury will decide that
1090204917Sdes	# this is a cross-build.
1091204917Sdes	echo i586-pc-msdosdjgpp
1092255767Sdes	exit ;;
109398937Sdes    Intel:Mach:3*:*)
109498937Sdes	echo i386-pc-mach3
1095149749Sdes	exit ;;
109698937Sdes    paragon:*:*:*)
109798937Sdes	echo i860-intel-osf1
1098149749Sdes	exit ;;
109998937Sdes    i860:*:4.*:*) # i860-SVR4
110098937Sdes	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
110198937Sdes	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
110298937Sdes	else # Add other i860-SVR4 vendors below as they are discovered.
110398937Sdes	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
110498937Sdes	fi
1105149749Sdes	exit ;;
110698937Sdes    mini*:CTIX:SYS*5:*)
110798937Sdes	# "miniframe"
110898937Sdes	echo m68010-convergent-sysv
1109149749Sdes	exit ;;
1110137015Sdes    mc68k:UNIX:SYSTEM5:3.51m)
1111137015Sdes	echo m68k-convergent-sysv
1112149749Sdes	exit ;;
1113137015Sdes    M680?0:D-NIX:5.3:*)
1114137015Sdes	echo m68k-diab-dnix
1115149749Sdes	exit ;;
1116149749Sdes    M68*:*:R3V[5678]*:*)
1117149749Sdes	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1118149749Sdes    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)
111998937Sdes	OS_REL=''
112098937Sdes	test -r /etc/.relid \
112198937Sdes	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
112298937Sdes	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1123149749Sdes	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
112498937Sdes	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1125149749Sdes	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
112698937Sdes    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1127255767Sdes	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1128255767Sdes	  && { echo i486-ncr-sysv4; exit; } ;;
1129204917Sdes    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1130204917Sdes	OS_REL='.3'
1131204917Sdes	test -r /etc/.relid \
1132204917Sdes	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1133204917Sdes	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1134204917Sdes	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1135204917Sdes	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1136204917Sdes	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1137204917Sdes	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1138204917Sdes	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
113998937Sdes    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
114098937Sdes	echo m68k-unknown-lynxos${UNAME_RELEASE}
1141149749Sdes	exit ;;
114298937Sdes    mc68030:UNIX_System_V:4.*:*)
114398937Sdes	echo m68k-atari-sysv4
1144149749Sdes	exit ;;
114598937Sdes    TSUNAMI:LynxOS:2.*:*)
114698937Sdes	echo sparc-unknown-lynxos${UNAME_RELEASE}
1147149749Sdes	exit ;;
114898937Sdes    rs6000:LynxOS:2.*:*)
114998937Sdes	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1150149749Sdes	exit ;;
1151204917Sdes    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
115298937Sdes	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1153149749Sdes	exit ;;
115498937Sdes    SM[BE]S:UNIX_SV:*:*)
115598937Sdes	echo mips-dde-sysv${UNAME_RELEASE}
1156149749Sdes	exit ;;
115798937Sdes    RM*:ReliantUNIX-*:*:*)
115898937Sdes	echo mips-sni-sysv4
1159149749Sdes	exit ;;
116098937Sdes    RM*:SINIX-*:*:*)
116198937Sdes	echo mips-sni-sysv4
1162149749Sdes	exit ;;
116398937Sdes    *:SINIX-*:*:*)
116498937Sdes	if uname -p 2>/dev/null >/dev/null ; then
116598937Sdes		UNAME_MACHINE=`(uname -p) 2>/dev/null`
116698937Sdes		echo ${UNAME_MACHINE}-sni-sysv4
116798937Sdes	else
116898937Sdes		echo ns32k-sni-sysv
116998937Sdes	fi
1170149749Sdes	exit ;;
1171255767Sdes    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1172255767Sdes			# says <Richard.M.Bartel@ccMail.Census.GOV>
1173255767Sdes	echo i586-unisys-sysv4
1174255767Sdes	exit ;;
117598937Sdes    *:UNIX_System_V:4*:FTX*)
117698937Sdes	# From Gerald Hewes <hewes@openmarket.com>.
117798937Sdes	# How about differentiating between stratus architectures? -djm
117898937Sdes	echo hppa1.1-stratus-sysv4
1179149749Sdes	exit ;;
118098937Sdes    *:*:*:FTX*)
118198937Sdes	# From seanf@swdc.stratus.com.
118298937Sdes	echo i860-stratus-sysv4
1183149749Sdes	exit ;;
1184149749Sdes    i*86:VOS:*:*)
1185149749Sdes	# From Paul.Green@stratus.com.
1186149749Sdes	echo ${UNAME_MACHINE}-stratus-vos
1187149749Sdes	exit ;;
118898937Sdes    *:VOS:*:*)
118998937Sdes	# From Paul.Green@stratus.com.
119098937Sdes	echo hppa1.1-stratus-vos
1191149749Sdes	exit ;;
119298937Sdes    mc68*:A/UX:*:*)
119398937Sdes	echo m68k-apple-aux${UNAME_RELEASE}
1194149749Sdes	exit ;;
119598937Sdes    news*:NEWS-OS:6*:*)
119698937Sdes	echo mips-sony-newsos6
1197149749Sdes	exit ;;
119898937Sdes    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
119998937Sdes	if [ -d /usr/nec ]; then
1200255767Sdes		echo mips-nec-sysv${UNAME_RELEASE}
120198937Sdes	else
1202255767Sdes		echo mips-unknown-sysv${UNAME_RELEASE}
120398937Sdes	fi
1204255767Sdes	exit ;;
120598937Sdes    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
120698937Sdes	echo powerpc-be-beos
1207149749Sdes	exit ;;
120898937Sdes    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
120998937Sdes	echo powerpc-apple-beos
1210149749Sdes	exit ;;
121198937Sdes    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
121298937Sdes	echo i586-pc-beos
1213149749Sdes	exit ;;
1214192595Sdes    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1215192595Sdes	echo i586-pc-haiku
1216192595Sdes	exit ;;
1217255767Sdes    x86_64:Haiku:*:*)
1218255767Sdes	echo x86_64-unknown-haiku
1219255767Sdes	exit ;;
122098937Sdes    SX-4:SUPER-UX:*:*)
122198937Sdes	echo sx4-nec-superux${UNAME_RELEASE}
1222149749Sdes	exit ;;
122398937Sdes    SX-5:SUPER-UX:*:*)
122498937Sdes	echo sx5-nec-superux${UNAME_RELEASE}
1225149749Sdes	exit ;;
1226137015Sdes    SX-6:SUPER-UX:*:*)
1227137015Sdes	echo sx6-nec-superux${UNAME_RELEASE}
1228149749Sdes	exit ;;
1229192595Sdes    SX-7:SUPER-UX:*:*)
1230192595Sdes	echo sx7-nec-superux${UNAME_RELEASE}
1231192595Sdes	exit ;;
1232192595Sdes    SX-8:SUPER-UX:*:*)
1233192595Sdes	echo sx8-nec-superux${UNAME_RELEASE}
1234192595Sdes	exit ;;
1235192595Sdes    SX-8R:SUPER-UX:*:*)
1236192595Sdes	echo sx8r-nec-superux${UNAME_RELEASE}
1237192595Sdes	exit ;;
123898937Sdes    Power*:Rhapsody:*:*)
123998937Sdes	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1240149749Sdes	exit ;;
124198937Sdes    *:Rhapsody:*:*)
124298937Sdes	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1243149749Sdes	exit ;;
124498937Sdes    *:Darwin:*:*)
1245149749Sdes	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1246149749Sdes	case $UNAME_PROCESSOR in
1247204917Sdes	    i386)
1248204917Sdes		eval $set_cc_for_build
1249204917Sdes		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1250204917Sdes		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1251204917Sdes		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1252204917Sdes		      grep IS_64BIT_ARCH >/dev/null
1253204917Sdes		  then
1254204917Sdes		      UNAME_PROCESSOR="x86_64"
1255204917Sdes		  fi
1256204917Sdes		fi ;;
1257149749Sdes	    unknown) UNAME_PROCESSOR=powerpc ;;
1258137015Sdes	esac
1259137015Sdes	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1260149749Sdes	exit ;;
126198937Sdes    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1262106121Sdes	UNAME_PROCESSOR=`uname -p`
1263106121Sdes	if test "$UNAME_PROCESSOR" = "x86"; then
1264106121Sdes		UNAME_PROCESSOR=i386
126598937Sdes		UNAME_MACHINE=pc
126698937Sdes	fi
1267106121Sdes	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1268149749Sdes	exit ;;
126998937Sdes    *:QNX:*:4*)
127098937Sdes	echo i386-pc-qnx
1271149749Sdes	exit ;;
1272226046Sdes    NEO-?:NONSTOP_KERNEL:*:*)
1273226046Sdes	echo neo-tandem-nsk${UNAME_RELEASE}
1274226046Sdes	exit ;;
1275255767Sdes    NSE-*:NONSTOP_KERNEL:*:*)
1276149749Sdes	echo nse-tandem-nsk${UNAME_RELEASE}
1277149749Sdes	exit ;;
1278149749Sdes    NSR-?:NONSTOP_KERNEL:*:*)
127998937Sdes	echo nsr-tandem-nsk${UNAME_RELEASE}
1280149749Sdes	exit ;;
128198937Sdes    *:NonStop-UX:*:*)
128298937Sdes	echo mips-compaq-nonstopux
1283149749Sdes	exit ;;
128498937Sdes    BS2000:POSIX*:*:*)
128598937Sdes	echo bs2000-siemens-sysv
1286149749Sdes	exit ;;
128798937Sdes    DS/*:UNIX_System_V:*:*)
128898937Sdes	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1289149749Sdes	exit ;;
129098937Sdes    *:Plan9:*:*)
129198937Sdes	# "uname -m" is not consistent, so use $cputype instead. 386
129298937Sdes	# is converted to i386 for consistency with other x86
129398937Sdes	# operating systems.
129498937Sdes	if test "$cputype" = "386"; then
129598937Sdes	    UNAME_MACHINE=i386
129698937Sdes	else
129798937Sdes	    UNAME_MACHINE="$cputype"
129898937Sdes	fi
129998937Sdes	echo ${UNAME_MACHINE}-unknown-plan9
1300149749Sdes	exit ;;
130198937Sdes    *:TOPS-10:*:*)
130298937Sdes	echo pdp10-unknown-tops10
1303149749Sdes	exit ;;
130498937Sdes    *:TENEX:*:*)
130598937Sdes	echo pdp10-unknown-tenex
1306149749Sdes	exit ;;
130798937Sdes    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
130898937Sdes	echo pdp10-dec-tops20
1309149749Sdes	exit ;;
131098937Sdes    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
131198937Sdes	echo pdp10-xkl-tops20
1312149749Sdes	exit ;;
131398937Sdes    *:TOPS-20:*:*)
131498937Sdes	echo pdp10-unknown-tops20
1315149749Sdes	exit ;;
131698937Sdes    *:ITS:*:*)
131798937Sdes	echo pdp10-unknown-its
1318149749Sdes	exit ;;
1319137015Sdes    SEI:*:*:SEIUX)
1320255767Sdes	echo mips-sei-seiux${UNAME_RELEASE}
1321149749Sdes	exit ;;
1322149749Sdes    *:DragonFly:*:*)
1323149749Sdes	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1324149749Sdes	exit ;;
1325149749Sdes    *:*VMS:*:*)
1326255767Sdes	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1327149749Sdes	case "${UNAME_MACHINE}" in
1328149749Sdes	    A*) echo alpha-dec-vms ; exit ;;
1329149749Sdes	    I*) echo ia64-dec-vms ; exit ;;
1330149749Sdes	    V*) echo vax-dec-vms ; exit ;;
1331149749Sdes	esac ;;
1332149749Sdes    *:XENIX:*:SysV)
1333149749Sdes	echo i386-pc-xenix
1334149749Sdes	exit ;;
1335149749Sdes    i*86:skyos:*:*)
1336149749Sdes	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1337149749Sdes	exit ;;
1338192595Sdes    i*86:rdos:*:*)
1339192595Sdes	echo ${UNAME_MACHINE}-pc-rdos
1340192595Sdes	exit ;;
1341204917Sdes    i*86:AROS:*:*)
1342204917Sdes	echo ${UNAME_MACHINE}-pc-aros
1343204917Sdes	exit ;;
1344255767Sdes    x86_64:VMkernel:*:*)
1345255767Sdes	echo ${UNAME_MACHINE}-unknown-esx
1346255767Sdes	exit ;;
134798937Sdesesac
134898937Sdes
134998937Sdeseval $set_cc_for_build
135098937Sdescat >$dummy.c <<EOF
135198937Sdes#ifdef _SEQUENT_
135298937Sdes# include <sys/types.h>
135398937Sdes# include <sys/utsname.h>
135498937Sdes#endif
135598937Sdesmain ()
135698937Sdes{
135798937Sdes#if defined (sony)
135898937Sdes#if defined (MIPSEB)
135998937Sdes  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
136098937Sdes     I don't know....  */
136198937Sdes  printf ("mips-sony-bsd\n"); exit (0);
136298937Sdes#else
136398937Sdes#include <sys/param.h>
136498937Sdes  printf ("m68k-sony-newsos%s\n",
136598937Sdes#ifdef NEWSOS4
1366255767Sdes	"4"
136798937Sdes#else
1368255767Sdes	""
136998937Sdes#endif
1370255767Sdes	); exit (0);
137198937Sdes#endif
137298937Sdes#endif
137398937Sdes
137498937Sdes#if defined (__arm) && defined (__acorn) && defined (__unix)
1375149749Sdes  printf ("arm-acorn-riscix\n"); exit (0);
137698937Sdes#endif
137798937Sdes
137898937Sdes#if defined (hp300) && !defined (hpux)
137998937Sdes  printf ("m68k-hp-bsd\n"); exit (0);
138098937Sdes#endif
138198937Sdes
138298937Sdes#if defined (NeXT)
138398937Sdes#if !defined (__ARCHITECTURE__)
138498937Sdes#define __ARCHITECTURE__ "m68k"
138598937Sdes#endif
138698937Sdes  int version;
138798937Sdes  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
138898937Sdes  if (version < 4)
138998937Sdes    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
139098937Sdes  else
139198937Sdes    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
139298937Sdes  exit (0);
139398937Sdes#endif
139498937Sdes
139598937Sdes#if defined (MULTIMAX) || defined (n16)
139698937Sdes#if defined (UMAXV)
139798937Sdes  printf ("ns32k-encore-sysv\n"); exit (0);
139898937Sdes#else
139998937Sdes#if defined (CMU)
140098937Sdes  printf ("ns32k-encore-mach\n"); exit (0);
140198937Sdes#else
140298937Sdes  printf ("ns32k-encore-bsd\n"); exit (0);
140398937Sdes#endif
140498937Sdes#endif
140598937Sdes#endif
140698937Sdes
140798937Sdes#if defined (__386BSD__)
140898937Sdes  printf ("i386-pc-bsd\n"); exit (0);
140998937Sdes#endif
141098937Sdes
141198937Sdes#if defined (sequent)
141298937Sdes#if defined (i386)
141398937Sdes  printf ("i386-sequent-dynix\n"); exit (0);
141498937Sdes#endif
141598937Sdes#if defined (ns32000)
141698937Sdes  printf ("ns32k-sequent-dynix\n"); exit (0);
141798937Sdes#endif
141898937Sdes#endif
141998937Sdes
142098937Sdes#if defined (_SEQUENT_)
142198937Sdes    struct utsname un;
142298937Sdes
142398937Sdes    uname(&un);
142498937Sdes
142598937Sdes    if (strncmp(un.version, "V2", 2) == 0) {
142698937Sdes	printf ("i386-sequent-ptx2\n"); exit (0);
142798937Sdes    }
142898937Sdes    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
142998937Sdes	printf ("i386-sequent-ptx1\n"); exit (0);
143098937Sdes    }
143198937Sdes    printf ("i386-sequent-ptx\n"); exit (0);
143298937Sdes
143398937Sdes#endif
143498937Sdes
143598937Sdes#if defined (vax)
143698937Sdes# if !defined (ultrix)
143798937Sdes#  include <sys/param.h>
143898937Sdes#  if defined (BSD)
143998937Sdes#   if BSD == 43
144098937Sdes      printf ("vax-dec-bsd4.3\n"); exit (0);
144198937Sdes#   else
144298937Sdes#    if BSD == 199006
144398937Sdes      printf ("vax-dec-bsd4.3reno\n"); exit (0);
144498937Sdes#    else
144598937Sdes      printf ("vax-dec-bsd\n"); exit (0);
144698937Sdes#    endif
144798937Sdes#   endif
144898937Sdes#  else
144998937Sdes    printf ("vax-dec-bsd\n"); exit (0);
145098937Sdes#  endif
145198937Sdes# else
145298937Sdes    printf ("vax-dec-ultrix\n"); exit (0);
145398937Sdes# endif
145498937Sdes#endif
145598937Sdes
145698937Sdes#if defined (alliant) && defined (i860)
145798937Sdes  printf ("i860-alliant-bsd\n"); exit (0);
145898937Sdes#endif
145998937Sdes
146098937Sdes  exit (1);
146198937Sdes}
146298937SdesEOF
146398937Sdes
1464149749Sdes$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1465149749Sdes	{ echo "$SYSTEM_NAME"; exit; }
146698937Sdes
146798937Sdes# Apollos put the system type in the environment.
146898937Sdes
1469149749Sdestest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
147098937Sdes
147198937Sdes# Convex versions that predate uname can use getsysinfo(1)
147298937Sdes
147398937Sdesif [ -x /usr/convex/getsysinfo ]
147498937Sdesthen
147598937Sdes    case `getsysinfo -f cpu_type` in
147698937Sdes    c1*)
147798937Sdes	echo c1-convex-bsd
1478149749Sdes	exit ;;
147998937Sdes    c2*)
148098937Sdes	if getsysinfo -f scalar_acc
148198937Sdes	then echo c32-convex-bsd
148298937Sdes	else echo c2-convex-bsd
148398937Sdes	fi
1484149749Sdes	exit ;;
148598937Sdes    c34*)
148698937Sdes	echo c34-convex-bsd
1487149749Sdes	exit ;;
148898937Sdes    c38*)
148998937Sdes	echo c38-convex-bsd
1490149749Sdes	exit ;;
149198937Sdes    c4*)
149298937Sdes	echo c4-convex-bsd
1493149749Sdes	exit ;;
149498937Sdes    esac
149598937Sdesfi
149698937Sdes
149798937Sdescat >&2 <<EOF
149898937Sdes$0: unable to guess system type
149998937Sdes
150098937SdesThis script, last modified $timestamp, has failed to recognize
150198937Sdesthe operating system you are using. It is advised that you
150298937Sdesdownload the most up to date version of the config scripts from
150398937Sdes
1504192595Sdes  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1505149749Sdesand
1506192595Sdes  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
150798937Sdes
150898937SdesIf the version you run ($0) is already up to date, please
150998937Sdessend the following data and any information you think might be
151098937Sdespertinent to <config-patches@gnu.org> in order to provide the needed
151198937Sdesinformation to handle your system.
151298937Sdes
151398937Sdesconfig.guess timestamp = $timestamp
151498937Sdes
151598937Sdesuname -m = `(uname -m) 2>/dev/null || echo unknown`
151698937Sdesuname -r = `(uname -r) 2>/dev/null || echo unknown`
151798937Sdesuname -s = `(uname -s) 2>/dev/null || echo unknown`
151898937Sdesuname -v = `(uname -v) 2>/dev/null || echo unknown`
151998937Sdes
152098937Sdes/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
152198937Sdes/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
152298937Sdes
152398937Sdeshostinfo               = `(hostinfo) 2>/dev/null`
152498937Sdes/bin/universe          = `(/bin/universe) 2>/dev/null`
152598937Sdes/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
152698937Sdes/bin/arch              = `(/bin/arch) 2>/dev/null`
152798937Sdes/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
152898937Sdes/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
152998937Sdes
153098937SdesUNAME_MACHINE = ${UNAME_MACHINE}
153198937SdesUNAME_RELEASE = ${UNAME_RELEASE}
153298937SdesUNAME_SYSTEM  = ${UNAME_SYSTEM}
153398937SdesUNAME_VERSION = ${UNAME_VERSION}
153498937SdesEOF
153598937Sdes
153698937Sdesexit 1
153798937Sdes
153898937Sdes# Local variables:
153998937Sdes# eval: (add-hook 'write-file-hooks 'time-stamp)
154098937Sdes# time-stamp-start: "timestamp='"
154198937Sdes# time-stamp-format: "%:y-%02m-%02d"
154298937Sdes# time-stamp-end: "'"
154398937Sdes# End:
1544