12c393a42Smrg#! /bin/sh
22c393a42Smrg# Attempt to guess a canonical system name.
3a32e9e42Smrg#   Copyright 1992-2018 Free Software Foundation, Inc.
42c393a42Smrg
5a4e54154Smrgtimestamp='2018-08-29'
62c393a42Smrg
72c393a42Smrg# This file is free software; you can redistribute it and/or modify it
82c393a42Smrg# under the terms of the GNU General Public License as published by
96fc018e4Smrg# the Free Software Foundation; either version 3 of the License, or
102c393a42Smrg# (at your option) any later version.
112c393a42Smrg#
122c393a42Smrg# This program is distributed in the hope that it will be useful, but
132c393a42Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
142c393a42Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
152c393a42Smrg# General Public License for more details.
162c393a42Smrg#
172c393a42Smrg# You should have received a copy of the GNU General Public License
18a32e9e42Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
192c393a42Smrg#
202c393a42Smrg# As a special exception to the GNU General Public License, if you
212c393a42Smrg# distribute this file as part of a program that contains a
222c393a42Smrg# configuration script generated by Autoconf, you may include it under
236fc018e4Smrg# the same distribution terms that you use for the rest of that
246fc018e4Smrg# program.  This Exception is an additional permission under section 7
256fc018e4Smrg# of the GNU General Public License, version 3 ("GPLv3").
262c393a42Smrg#
27953daebaSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
282c393a42Smrg#
29ca08ab68Smrg# You can get the latest version of this script from:
30a32e9e42Smrg# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
316fc018e4Smrg#
32953daebaSmrg# Please send patches to <config-patches@gnu.org>.
336fc018e4Smrg
342c393a42Smrg
352c393a42Smrgme=`echo "$0" | sed -e 's,.*/,,'`
362c393a42Smrg
372c393a42Smrgusage="\
382c393a42SmrgUsage: $0 [OPTION]
392c393a42Smrg
402c393a42SmrgOutput the configuration name of the system \`$me' is run on.
412c393a42Smrg
42a32e9e42SmrgOptions:
432c393a42Smrg  -h, --help         print this help, then exit
442c393a42Smrg  -t, --time-stamp   print date of last modification, then exit
452c393a42Smrg  -v, --version      print version number, then exit
462c393a42Smrg
472c393a42SmrgReport bugs and patches to <config-patches@gnu.org>."
482c393a42Smrg
492c393a42Smrgversion="\
502c393a42SmrgGNU config.guess ($timestamp)
512c393a42Smrg
522c393a42SmrgOriginally written by Per Bothner.
53a32e9e42SmrgCopyright 1992-2018 Free Software Foundation, Inc.
542c393a42Smrg
552c393a42SmrgThis is free software; see the source for copying conditions.  There is NO
562c393a42Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
572c393a42Smrg
582c393a42Smrghelp="
592c393a42SmrgTry \`$me --help' for more information."
602c393a42Smrg
612c393a42Smrg# Parse command line
622c393a42Smrgwhile test $# -gt 0 ; do
632c393a42Smrg  case $1 in
642c393a42Smrg    --time-stamp | --time* | -t )
652c393a42Smrg       echo "$timestamp" ; exit ;;
662c393a42Smrg    --version | -v )
672c393a42Smrg       echo "$version" ; exit ;;
682c393a42Smrg    --help | --h* | -h )
692c393a42Smrg       echo "$usage"; exit ;;
702c393a42Smrg    -- )     # Stop option processing
712c393a42Smrg       shift; break ;;
722c393a42Smrg    - )	# Use stdin as input.
732c393a42Smrg       break ;;
742c393a42Smrg    -* )
752c393a42Smrg       echo "$me: invalid option $1$help" >&2
762c393a42Smrg       exit 1 ;;
772c393a42Smrg    * )
782c393a42Smrg       break ;;
792c393a42Smrg  esac
802c393a42Smrgdone
812c393a42Smrg
822c393a42Smrgif test $# != 0; then
832c393a42Smrg  echo "$me: too many arguments$help" >&2
842c393a42Smrg  exit 1
852c393a42Smrgfi
862c393a42Smrg
872c393a42Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
882c393a42Smrg# compiler to aid in system detection is discouraged as it requires
892c393a42Smrg# temporary files to be created and, as you can see below, it is a
902c393a42Smrg# headache to deal with in a portable fashion.
912c393a42Smrg
922c393a42Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
932c393a42Smrg# use `HOST_CC' if defined, but it is deprecated.
942c393a42Smrg
952c393a42Smrg# Portable tmp directory creation inspired by the Autoconf team.
962c393a42Smrg
97a4e54154Smrgtmp=
98a4e54154Smrg# shellcheck disable=SC2172
99a4e54154Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15
100a4e54154Smrgtrap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0
101a4e54154Smrg
102a4e54154Smrgset_cc_for_build() {
103a4e54154Smrg    : "${TMPDIR=/tmp}"
104a4e54154Smrg    # shellcheck disable=SC2039
105a4e54154Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
106a4e54154Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
107a4e54154Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
108a4e54154Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
109a4e54154Smrg    dummy=$tmp/dummy
110a4e54154Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
111a4e54154Smrg	,,)    echo "int x;" > "$dummy.c"
112a4e54154Smrg	       for driver in cc gcc c89 c99 ; do
113a4e54154Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
114a4e54154Smrg		       CC_FOR_BUILD="$driver"
115a4e54154Smrg		       break
116a4e54154Smrg		   fi
117a4e54154Smrg	       done
118a4e54154Smrg	       if test x"$CC_FOR_BUILD" = x ; then
119a4e54154Smrg		   CC_FOR_BUILD=no_compiler_found
120a4e54154Smrg	       fi
121a4e54154Smrg	       ;;
122a4e54154Smrg	,,*)   CC_FOR_BUILD=$CC ;;
123a4e54154Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
124a4e54154Smrg    esac
125a4e54154Smrg}
1262c393a42Smrg
1272c393a42Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1282c393a42Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
129a4e54154Smrgif test -f /.attbin/uname ; then
1302c393a42Smrg	PATH=$PATH:/.attbin ; export PATH
1312c393a42Smrgfi
1322c393a42Smrg
1332c393a42SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1342c393a42SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1352c393a42SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1362c393a42SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1372c393a42Smrg
138a32e9e42Smrgcase "$UNAME_SYSTEM" in
139953daebaSmrgLinux|GNU|GNU/*)
140953daebaSmrg	# If the system lacks a compiler, then just pick glibc.
141953daebaSmrg	# We could probably try harder.
142953daebaSmrg	LIBC=gnu
143953daebaSmrg
144a4e54154Smrg	set_cc_for_build
145a32e9e42Smrg	cat <<-EOF > "$dummy.c"
146953daebaSmrg	#include <features.h>
147953daebaSmrg	#if defined(__UCLIBC__)
148953daebaSmrg	LIBC=uclibc
149953daebaSmrg	#elif defined(__dietlibc__)
150953daebaSmrg	LIBC=dietlibc
151953daebaSmrg	#else
152953daebaSmrg	LIBC=gnu
153953daebaSmrg	#endif
154953daebaSmrg	EOF
155a32e9e42Smrg	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
156a32e9e42Smrg
157a32e9e42Smrg	# If ldd exists, use it to detect musl libc.
158a32e9e42Smrg	if command -v ldd >/dev/null && \
159a32e9e42Smrg		ldd --version 2>&1 | grep -q ^musl
160a32e9e42Smrg	then
161a32e9e42Smrg	    LIBC=musl
162a32e9e42Smrg	fi
163953daebaSmrg	;;
164953daebaSmrgesac
165953daebaSmrg
1662c393a42Smrg# Note: order is significant - the case branches are not exclusive.
1672c393a42Smrg
168a32e9e42Smrgcase "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
1692c393a42Smrg    *:NetBSD:*:*)
1702c393a42Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
171ca08ab68Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1722c393a42Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1732c393a42Smrg	# switched to ELF, *-*-netbsd* would select the old
1742c393a42Smrg	# object file format.  This provides both forward
1752c393a42Smrg	# compatibility and a consistent mechanism for selecting the
1762c393a42Smrg	# object file format.
1772c393a42Smrg	#
1782c393a42Smrg	# Note: NetBSD doesn't particularly care about the vendor
1792c393a42Smrg	# portion of the name.  We always set it to "unknown".
1802c393a42Smrg	sysctl="sysctl -n hw.machine_arch"
181a32e9e42Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
182a32e9e42Smrg	    "/sbin/$sysctl" 2>/dev/null || \
183a32e9e42Smrg	    "/usr/sbin/$sysctl" 2>/dev/null || \
184a32e9e42Smrg	    echo unknown)`
185a32e9e42Smrg	case "$UNAME_MACHINE_ARCH" in
1862c393a42Smrg	    armeb) machine=armeb-unknown ;;
1872c393a42Smrg	    arm*) machine=arm-unknown ;;
1882c393a42Smrg	    sh3el) machine=shl-unknown ;;
1892c393a42Smrg	    sh3eb) machine=sh-unknown ;;
1902c393a42Smrg	    sh5el) machine=sh5le-unknown ;;
191a32e9e42Smrg	    earmv*)
192a32e9e42Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
193a32e9e42Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
194a32e9e42Smrg		machine="${arch}${endian}"-unknown
195a32e9e42Smrg		;;
196a32e9e42Smrg	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
1972c393a42Smrg	esac
1982c393a42Smrg	# The Operating System including object format, if it has switched
199a32e9e42Smrg	# to ELF recently (or will in the future) and ABI.
200a32e9e42Smrg	case "$UNAME_MACHINE_ARCH" in
201a32e9e42Smrg	    earm*)
202a32e9e42Smrg		os=netbsdelf
203a32e9e42Smrg		;;
2042c393a42Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
205a4e54154Smrg		set_cc_for_build
2062c393a42Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
207ca08ab68Smrg			| grep -q __ELF__
2082c393a42Smrg		then
2092c393a42Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2102c393a42Smrg		    # Return netbsd for either.  FIX?
2112c393a42Smrg		    os=netbsd
2122c393a42Smrg		else
2132c393a42Smrg		    os=netbsdelf
2142c393a42Smrg		fi
2152c393a42Smrg		;;
2162c393a42Smrg	    *)
217ca08ab68Smrg		os=netbsd
2182c393a42Smrg		;;
2192c393a42Smrg	esac
220a32e9e42Smrg	# Determine ABI tags.
221a32e9e42Smrg	case "$UNAME_MACHINE_ARCH" in
222a32e9e42Smrg	    earm*)
223a32e9e42Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
224a32e9e42Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
225a32e9e42Smrg		;;
226a32e9e42Smrg	esac
2272c393a42Smrg	# The OS release
2282c393a42Smrg	# Debian GNU/NetBSD machines have a different userland, and
2292c393a42Smrg	# thus, need a distinct triplet. However, they do not need
2302c393a42Smrg	# kernel version information, so it can be replaced with a
2312c393a42Smrg	# suitable tag, in the style of linux-gnu.
232a32e9e42Smrg	case "$UNAME_VERSION" in
2332c393a42Smrg	    Debian*)
2342c393a42Smrg		release='-gnu'
2352c393a42Smrg		;;
2362c393a42Smrg	    *)
237a32e9e42Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2382c393a42Smrg		;;
2392c393a42Smrg	esac
2402c393a42Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2412c393a42Smrg	# contains redundant information, the shorter form:
2422c393a42Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
243a4e54154Smrg	echo "$machine-${os}${release}${abi-}"
2442c393a42Smrg	exit ;;
2456fc018e4Smrg    *:Bitrig:*:*)
2466fc018e4Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
247a32e9e42Smrg	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
2486fc018e4Smrg	exit ;;
2492c393a42Smrg    *:OpenBSD:*:*)
2502c393a42Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
251a32e9e42Smrg	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
252a32e9e42Smrg	exit ;;
253a32e9e42Smrg    *:LibertyBSD:*:*)
254a32e9e42Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
255a32e9e42Smrg	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
256a32e9e42Smrg	exit ;;
257a32e9e42Smrg    *:MidnightBSD:*:*)
258a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
2592c393a42Smrg	exit ;;
2602c393a42Smrg    *:ekkoBSD:*:*)
261a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
2622c393a42Smrg	exit ;;
2632c393a42Smrg    *:SolidBSD:*:*)
264a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
2652c393a42Smrg	exit ;;
2662c393a42Smrg    macppc:MirBSD:*:*)
267a32e9e42Smrg	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
2682c393a42Smrg	exit ;;
2692c393a42Smrg    *:MirBSD:*:*)
270a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
2712c393a42Smrg	exit ;;
272a32e9e42Smrg    *:Sortix:*:*)
273a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-sortix
274a32e9e42Smrg	exit ;;
275a32e9e42Smrg    *:Redox:*:*)
276a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-redox
277a32e9e42Smrg	exit ;;
278a32e9e42Smrg    mips:OSF1:*.*)
279a32e9e42Smrg        echo mips-dec-osf1
280a32e9e42Smrg        exit ;;
2812c393a42Smrg    alpha:OSF1:*:*)
2822c393a42Smrg	case $UNAME_RELEASE in
2832c393a42Smrg	*4.0)
2842c393a42Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2852c393a42Smrg		;;
2862c393a42Smrg	*5.*)
287ca08ab68Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2882c393a42Smrg		;;
2892c393a42Smrg	esac
2902c393a42Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
2912c393a42Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2922c393a42Smrg	# covers most systems running today.  This code pipes the CPU
2932c393a42Smrg	# types through head -n 1, so we only detect the type of CPU 0.
2942c393a42Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
2952c393a42Smrg	case "$ALPHA_CPU_TYPE" in
2962c393a42Smrg	    "EV4 (21064)")
297a32e9e42Smrg		UNAME_MACHINE=alpha ;;
2982c393a42Smrg	    "EV4.5 (21064)")
299a32e9e42Smrg		UNAME_MACHINE=alpha ;;
3002c393a42Smrg	    "LCA4 (21066/21068)")
301a32e9e42Smrg		UNAME_MACHINE=alpha ;;
3022c393a42Smrg	    "EV5 (21164)")
303a32e9e42Smrg		UNAME_MACHINE=alphaev5 ;;
3042c393a42Smrg	    "EV5.6 (21164A)")
305a32e9e42Smrg		UNAME_MACHINE=alphaev56 ;;
3062c393a42Smrg	    "EV5.6 (21164PC)")
307a32e9e42Smrg		UNAME_MACHINE=alphapca56 ;;
3082c393a42Smrg	    "EV5.7 (21164PC)")
309a32e9e42Smrg		UNAME_MACHINE=alphapca57 ;;
3102c393a42Smrg	    "EV6 (21264)")
311a32e9e42Smrg		UNAME_MACHINE=alphaev6 ;;
3122c393a42Smrg	    "EV6.7 (21264A)")
313a32e9e42Smrg		UNAME_MACHINE=alphaev67 ;;
3142c393a42Smrg	    "EV6.8CB (21264C)")
315a32e9e42Smrg		UNAME_MACHINE=alphaev68 ;;
3162c393a42Smrg	    "EV6.8AL (21264B)")
317a32e9e42Smrg		UNAME_MACHINE=alphaev68 ;;
3182c393a42Smrg	    "EV6.8CX (21264D)")
319a32e9e42Smrg		UNAME_MACHINE=alphaev68 ;;
3202c393a42Smrg	    "EV6.9A (21264/EV69A)")
321a32e9e42Smrg		UNAME_MACHINE=alphaev69 ;;
3222c393a42Smrg	    "EV7 (21364)")
323a32e9e42Smrg		UNAME_MACHINE=alphaev7 ;;
3242c393a42Smrg	    "EV7.9 (21364A)")
325a32e9e42Smrg		UNAME_MACHINE=alphaev79 ;;
3262c393a42Smrg	esac
3272c393a42Smrg	# A Pn.n version is a patched version.
3282c393a42Smrg	# A Vn.n version is a released version.
3292c393a42Smrg	# A Tn.n version is a released field test version.
3302c393a42Smrg	# A Xn.n version is an unreleased experimental baselevel.
3312c393a42Smrg	# 1.2 uses "1.2" for uname -r.
332a32e9e42Smrg	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
333ca08ab68Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
334ca08ab68Smrg	exitcode=$?
335ca08ab68Smrg	trap '' 0
336ca08ab68Smrg	exit $exitcode ;;
3372c393a42Smrg    Amiga*:UNIX_System_V:4.0:*)
3382c393a42Smrg	echo m68k-unknown-sysv4
3392c393a42Smrg	exit ;;
3402c393a42Smrg    *:[Aa]miga[Oo][Ss]:*:*)
341a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-amigaos
3422c393a42Smrg	exit ;;
3432c393a42Smrg    *:[Mm]orph[Oo][Ss]:*:*)
344a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-morphos
3452c393a42Smrg	exit ;;
3462c393a42Smrg    *:OS/390:*:*)
3472c393a42Smrg	echo i370-ibm-openedition
3482c393a42Smrg	exit ;;
3492c393a42Smrg    *:z/VM:*:*)
3502c393a42Smrg	echo s390-ibm-zvmoe
3512c393a42Smrg	exit ;;
3522c393a42Smrg    *:OS400:*:*)
353ca08ab68Smrg	echo powerpc-ibm-os400
3542c393a42Smrg	exit ;;
3552c393a42Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
356a32e9e42Smrg	echo arm-acorn-riscix"$UNAME_RELEASE"
3572c393a42Smrg	exit ;;
3586fc018e4Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3592c393a42Smrg	echo arm-unknown-riscos
3602c393a42Smrg	exit ;;
3612c393a42Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3622c393a42Smrg	echo hppa1.1-hitachi-hiuxmpp
3632c393a42Smrg	exit ;;
3642c393a42Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3652c393a42Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3662c393a42Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3672c393a42Smrg		echo pyramid-pyramid-sysv3
3682c393a42Smrg	else
3692c393a42Smrg		echo pyramid-pyramid-bsd
3702c393a42Smrg	fi
3712c393a42Smrg	exit ;;
3722c393a42Smrg    NILE*:*:*:dcosx)
3732c393a42Smrg	echo pyramid-pyramid-svr4
3742c393a42Smrg	exit ;;
3752c393a42Smrg    DRS?6000:unix:4.0:6*)
3762c393a42Smrg	echo sparc-icl-nx6
3772c393a42Smrg	exit ;;
3782c393a42Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3792c393a42Smrg	case `/usr/bin/uname -p` in
3802c393a42Smrg	    sparc) echo sparc-icl-nx7; exit ;;
3812c393a42Smrg	esac ;;
382ca08ab68Smrg    s390x:SunOS:*:*)
383a32e9e42Smrg	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
384ca08ab68Smrg	exit ;;
3852c393a42Smrg    sun4H:SunOS:5.*:*)
386a32e9e42Smrg	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
3872c393a42Smrg	exit ;;
3882c393a42Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
389a32e9e42Smrg	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
3902c393a42Smrg	exit ;;
391ca08ab68Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
392a32e9e42Smrg	echo i386-pc-auroraux"$UNAME_RELEASE"
393ca08ab68Smrg	exit ;;
3942c393a42Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
395a4e54154Smrg	UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
396a4e54154Smrg	case `isainfo -b` in
397a4e54154Smrg	    32)
398a4e54154Smrg		echo i386-pc-solaris2"$UNAME_REL"
399a4e54154Smrg		;;
400a4e54154Smrg	    64)
401a4e54154Smrg		echo x86_64-pc-solaris2"$UNAME_REL"
402a4e54154Smrg		;;
403a4e54154Smrg	esac
4042c393a42Smrg	exit ;;
4052c393a42Smrg    sun4*:SunOS:6*:*)
4062c393a42Smrg	# According to config.sub, this is the proper way to canonicalize
4072c393a42Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4082c393a42Smrg	# it's likely to be more like Solaris than SunOS4.
409a32e9e42Smrg	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4102c393a42Smrg	exit ;;
4112c393a42Smrg    sun4*:SunOS:*:*)
4122c393a42Smrg	case "`/usr/bin/arch -k`" in
4132c393a42Smrg	    Series*|S4*)
4142c393a42Smrg		UNAME_RELEASE=`uname -v`
4152c393a42Smrg		;;
4162c393a42Smrg	esac
4172c393a42Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
418a32e9e42Smrg	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
4192c393a42Smrg	exit ;;
4202c393a42Smrg    sun3*:SunOS:*:*)
421a32e9e42Smrg	echo m68k-sun-sunos"$UNAME_RELEASE"
4222c393a42Smrg	exit ;;
4232c393a42Smrg    sun*:*:4.2BSD:*)
4242c393a42Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
425a32e9e42Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4262c393a42Smrg	case "`/bin/arch`" in
4272c393a42Smrg	    sun3)
428a32e9e42Smrg		echo m68k-sun-sunos"$UNAME_RELEASE"
4292c393a42Smrg		;;
4302c393a42Smrg	    sun4)
431a32e9e42Smrg		echo sparc-sun-sunos"$UNAME_RELEASE"
4322c393a42Smrg		;;
4332c393a42Smrg	esac
4342c393a42Smrg	exit ;;
4352c393a42Smrg    aushp:SunOS:*:*)
436a32e9e42Smrg	echo sparc-auspex-sunos"$UNAME_RELEASE"
4372c393a42Smrg	exit ;;
4382c393a42Smrg    # The situation for MiNT is a little confusing.  The machine name
4392c393a42Smrg    # can be virtually everything (everything which is not
4402c393a42Smrg    # "atarist" or "atariste" at least should have a processor
4412c393a42Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4422c393a42Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4432c393a42Smrg    # the system name "TOS" denotes a system which is actually not
4442c393a42Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4452c393a42Smrg    # be no problem.
4462c393a42Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
447a32e9e42Smrg	echo m68k-atari-mint"$UNAME_RELEASE"
4482c393a42Smrg	exit ;;
4492c393a42Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
450a32e9e42Smrg	echo m68k-atari-mint"$UNAME_RELEASE"
451ca08ab68Smrg	exit ;;
4522c393a42Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
453a32e9e42Smrg	echo m68k-atari-mint"$UNAME_RELEASE"
4542c393a42Smrg	exit ;;
4552c393a42Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
456a32e9e42Smrg	echo m68k-milan-mint"$UNAME_RELEASE"
457ca08ab68Smrg	exit ;;
4582c393a42Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
459a32e9e42Smrg	echo m68k-hades-mint"$UNAME_RELEASE"
460ca08ab68Smrg	exit ;;
4612c393a42Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
462a32e9e42Smrg	echo m68k-unknown-mint"$UNAME_RELEASE"
463ca08ab68Smrg	exit ;;
4642c393a42Smrg    m68k:machten:*:*)
465a32e9e42Smrg	echo m68k-apple-machten"$UNAME_RELEASE"
4662c393a42Smrg	exit ;;
4672c393a42Smrg    powerpc:machten:*:*)
468a32e9e42Smrg	echo powerpc-apple-machten"$UNAME_RELEASE"
4692c393a42Smrg	exit ;;
4702c393a42Smrg    RISC*:Mach:*:*)
4712c393a42Smrg	echo mips-dec-mach_bsd4.3
4722c393a42Smrg	exit ;;
4732c393a42Smrg    RISC*:ULTRIX:*:*)
474a32e9e42Smrg	echo mips-dec-ultrix"$UNAME_RELEASE"
4752c393a42Smrg	exit ;;
4762c393a42Smrg    VAX*:ULTRIX*:*:*)
477a32e9e42Smrg	echo vax-dec-ultrix"$UNAME_RELEASE"
4782c393a42Smrg	exit ;;
4792c393a42Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
480a32e9e42Smrg	echo clipper-intergraph-clix"$UNAME_RELEASE"
4812c393a42Smrg	exit ;;
4822c393a42Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
483a4e54154Smrg	set_cc_for_build
484a32e9e42Smrg	sed 's/^	//' << EOF > "$dummy.c"
4852c393a42Smrg#ifdef __cplusplus
4862c393a42Smrg#include <stdio.h>  /* for printf() prototype */
4872c393a42Smrg	int main (int argc, char *argv[]) {
4882c393a42Smrg#else
4892c393a42Smrg	int main (argc, argv) int argc; char *argv[]; {
4902c393a42Smrg#endif
4912c393a42Smrg	#if defined (host_mips) && defined (MIPSEB)
4922c393a42Smrg	#if defined (SYSTYPE_SYSV)
493a32e9e42Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
4942c393a42Smrg	#endif
4952c393a42Smrg	#if defined (SYSTYPE_SVR4)
496a32e9e42Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
4972c393a42Smrg	#endif
4982c393a42Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
499a32e9e42Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5002c393a42Smrg	#endif
5012c393a42Smrg	#endif
5022c393a42Smrg	  exit (-1);
5032c393a42Smrg	}
5042c393a42SmrgEOF
505a32e9e42Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
506a32e9e42Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
507a32e9e42Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5082c393a42Smrg	    { echo "$SYSTEM_NAME"; exit; }
509a32e9e42Smrg	echo mips-mips-riscos"$UNAME_RELEASE"
5102c393a42Smrg	exit ;;
5112c393a42Smrg    Motorola:PowerMAX_OS:*:*)
5122c393a42Smrg	echo powerpc-motorola-powermax
5132c393a42Smrg	exit ;;
5142c393a42Smrg    Motorola:*:4.3:PL8-*)
5152c393a42Smrg	echo powerpc-harris-powermax
5162c393a42Smrg	exit ;;
5172c393a42Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5182c393a42Smrg	echo powerpc-harris-powermax
5192c393a42Smrg	exit ;;
5202c393a42Smrg    Night_Hawk:Power_UNIX:*:*)
5212c393a42Smrg	echo powerpc-harris-powerunix
5222c393a42Smrg	exit ;;
5232c393a42Smrg    m88k:CX/UX:7*:*)
5242c393a42Smrg	echo m88k-harris-cxux7
5252c393a42Smrg	exit ;;
5262c393a42Smrg    m88k:*:4*:R4*)
5272c393a42Smrg	echo m88k-motorola-sysv4
5282c393a42Smrg	exit ;;
5292c393a42Smrg    m88k:*:3*:R3*)
5302c393a42Smrg	echo m88k-motorola-sysv3
5312c393a42Smrg	exit ;;
5322c393a42Smrg    AViiON:dgux:*:*)
533ca08ab68Smrg	# DG/UX returns AViiON for all architectures
534ca08ab68Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
535a32e9e42Smrg	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
5362c393a42Smrg	then
537a32e9e42Smrg	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
538a32e9e42Smrg	       [ "$TARGET_BINARY_INTERFACE"x = x ]
5392c393a42Smrg	    then
540a32e9e42Smrg		echo m88k-dg-dgux"$UNAME_RELEASE"
5412c393a42Smrg	    else
542a32e9e42Smrg		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
5432c393a42Smrg	    fi
5442c393a42Smrg	else
545a32e9e42Smrg	    echo i586-dg-dgux"$UNAME_RELEASE"
5462c393a42Smrg	fi
547ca08ab68Smrg	exit ;;
5482c393a42Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5492c393a42Smrg	echo m88k-dolphin-sysv3
5502c393a42Smrg	exit ;;
5512c393a42Smrg    M88*:*:R3*:*)
5522c393a42Smrg	# Delta 88k system running SVR3
5532c393a42Smrg	echo m88k-motorola-sysv3
5542c393a42Smrg	exit ;;
5552c393a42Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5562c393a42Smrg	echo m88k-tektronix-sysv3
5572c393a42Smrg	exit ;;
5582c393a42Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5592c393a42Smrg	echo m68k-tektronix-bsd
5602c393a42Smrg	exit ;;
5612c393a42Smrg    *:IRIX*:*:*)
562a32e9e42Smrg	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
5632c393a42Smrg	exit ;;
5642c393a42Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5652c393a42Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5662c393a42Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5672c393a42Smrg    i*86:AIX:*:*)
5682c393a42Smrg	echo i386-ibm-aix
5692c393a42Smrg	exit ;;
5702c393a42Smrg    ia64:AIX:*:*)
5712c393a42Smrg	if [ -x /usr/bin/oslevel ] ; then
5722c393a42Smrg		IBM_REV=`/usr/bin/oslevel`
5732c393a42Smrg	else
574a32e9e42Smrg		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
5752c393a42Smrg	fi
576a32e9e42Smrg	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
5772c393a42Smrg	exit ;;
5782c393a42Smrg    *:AIX:2:3)
5792c393a42Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
580a4e54154Smrg		set_cc_for_build
581a32e9e42Smrg		sed 's/^		//' << EOF > "$dummy.c"
5822c393a42Smrg		#include <sys/systemcfg.h>
5832c393a42Smrg
5842c393a42Smrg		main()
5852c393a42Smrg			{
5862c393a42Smrg			if (!__power_pc())
5872c393a42Smrg				exit(1);
5882c393a42Smrg			puts("powerpc-ibm-aix3.2.5");
5892c393a42Smrg			exit(0);
5902c393a42Smrg			}
5912c393a42SmrgEOF
592a32e9e42Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
5932c393a42Smrg		then
5942c393a42Smrg			echo "$SYSTEM_NAME"
5952c393a42Smrg		else
5962c393a42Smrg			echo rs6000-ibm-aix3.2.5
5972c393a42Smrg		fi
5982c393a42Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
5992c393a42Smrg		echo rs6000-ibm-aix3.2.4
6002c393a42Smrg	else
6012c393a42Smrg		echo rs6000-ibm-aix3.2
6022c393a42Smrg	fi
6032c393a42Smrg	exit ;;
604ca08ab68Smrg    *:AIX:*:[4567])
6052c393a42Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
606a32e9e42Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6072c393a42Smrg		IBM_ARCH=rs6000
6082c393a42Smrg	else
6092c393a42Smrg		IBM_ARCH=powerpc
6102c393a42Smrg	fi
611953daebaSmrg	if [ -x /usr/bin/lslpp ] ; then
612953daebaSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
613953daebaSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6142c393a42Smrg	else
615a32e9e42Smrg		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
6162c393a42Smrg	fi
617a32e9e42Smrg	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
6182c393a42Smrg	exit ;;
6192c393a42Smrg    *:AIX:*:*)
6202c393a42Smrg	echo rs6000-ibm-aix
6212c393a42Smrg	exit ;;
622a32e9e42Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6232c393a42Smrg	echo romp-ibm-bsd4.4
6242c393a42Smrg	exit ;;
6252c393a42Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
626a32e9e42Smrg	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
6272c393a42Smrg	exit ;;                             # report: romp-ibm BSD 4.3
6282c393a42Smrg    *:BOSX:*:*)
6292c393a42Smrg	echo rs6000-bull-bosx
6302c393a42Smrg	exit ;;
6312c393a42Smrg    DPX/2?00:B.O.S.:*:*)
6322c393a42Smrg	echo m68k-bull-sysv3
6332c393a42Smrg	exit ;;
6342c393a42Smrg    9000/[34]??:4.3bsd:1.*:*)
6352c393a42Smrg	echo m68k-hp-bsd
6362c393a42Smrg	exit ;;
6372c393a42Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6382c393a42Smrg	echo m68k-hp-bsd4.4
6392c393a42Smrg	exit ;;
6402c393a42Smrg    9000/[34678]??:HP-UX:*:*)
641a32e9e42Smrg	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
642a32e9e42Smrg	case "$UNAME_MACHINE" in
643a32e9e42Smrg	    9000/31?)            HP_ARCH=m68000 ;;
644a32e9e42Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
6452c393a42Smrg	    9000/[678][0-9][0-9])
6462c393a42Smrg		if [ -x /usr/bin/getconf ]; then
6472c393a42Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
648ca08ab68Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
649a32e9e42Smrg		    case "$sc_cpu_version" in
650a32e9e42Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
651a32e9e42Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
652ca08ab68Smrg		      532)                      # CPU_PA_RISC2_0
653a32e9e42Smrg			case "$sc_kernel_bits" in
654a32e9e42Smrg			  32) HP_ARCH=hppa2.0n ;;
655a32e9e42Smrg			  64) HP_ARCH=hppa2.0w ;;
656a32e9e42Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
657ca08ab68Smrg			esac ;;
658ca08ab68Smrg		    esac
6592c393a42Smrg		fi
660a32e9e42Smrg		if [ "$HP_ARCH" = "" ]; then
661a4e54154Smrg		    set_cc_for_build
662a32e9e42Smrg		    sed 's/^		//' << EOF > "$dummy.c"
6632c393a42Smrg
664ca08ab68Smrg		#define _HPUX_SOURCE
665ca08ab68Smrg		#include <stdlib.h>
666ca08ab68Smrg		#include <unistd.h>
6672c393a42Smrg
668ca08ab68Smrg		int main ()
669ca08ab68Smrg		{
670ca08ab68Smrg		#if defined(_SC_KERNEL_BITS)
671ca08ab68Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
672ca08ab68Smrg		#endif
673ca08ab68Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
6742c393a42Smrg
675ca08ab68Smrg		    switch (cpu)
676ca08ab68Smrg			{
677ca08ab68Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
678ca08ab68Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
679ca08ab68Smrg			case CPU_PA_RISC2_0:
680ca08ab68Smrg		#if defined(_SC_KERNEL_BITS)
681ca08ab68Smrg			    switch (bits)
682ca08ab68Smrg				{
683ca08ab68Smrg				case 64: puts ("hppa2.0w"); break;
684ca08ab68Smrg				case 32: puts ("hppa2.0n"); break;
685ca08ab68Smrg				default: puts ("hppa2.0"); break;
686ca08ab68Smrg				} break;
687ca08ab68Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
688ca08ab68Smrg			    puts ("hppa2.0"); break;
689ca08ab68Smrg		#endif
690ca08ab68Smrg			default: puts ("hppa1.0"); break;
691ca08ab68Smrg			}
692ca08ab68Smrg		    exit (0);
693ca08ab68Smrg		}
6942c393a42SmrgEOF
695a32e9e42Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
6962c393a42Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
6972c393a42Smrg		fi ;;
6982c393a42Smrg	esac
699a32e9e42Smrg	if [ "$HP_ARCH" = hppa2.0w ]
7002c393a42Smrg	then
701a4e54154Smrg	    set_cc_for_build
7022c393a42Smrg
7032c393a42Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7042c393a42Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7052c393a42Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7062c393a42Smrg	    #
7072c393a42Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
7082c393a42Smrg	    # => hppa2.0w-hp-hpux11.23
7092c393a42Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7102c393a42Smrg	    # => hppa64-hp-hpux11.23
7112c393a42Smrg
712a32e9e42Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
713ca08ab68Smrg		grep -q __LP64__
7142c393a42Smrg	    then
715a32e9e42Smrg		HP_ARCH=hppa2.0w
7162c393a42Smrg	    else
717a32e9e42Smrg		HP_ARCH=hppa64
7182c393a42Smrg	    fi
7192c393a42Smrg	fi
720a32e9e42Smrg	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
7212c393a42Smrg	exit ;;
7222c393a42Smrg    ia64:HP-UX:*:*)
723a32e9e42Smrg	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
724a32e9e42Smrg	echo ia64-hp-hpux"$HPUX_REV"
7252c393a42Smrg	exit ;;
7262c393a42Smrg    3050*:HI-UX:*:*)
727a4e54154Smrg	set_cc_for_build
728a32e9e42Smrg	sed 's/^	//' << EOF > "$dummy.c"
7292c393a42Smrg	#include <unistd.h>
7302c393a42Smrg	int
7312c393a42Smrg	main ()
7322c393a42Smrg	{
7332c393a42Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7342c393a42Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7352c393a42Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7362c393a42Smrg	     results, however.  */
7372c393a42Smrg	  if (CPU_IS_PA_RISC (cpu))
7382c393a42Smrg	    {
7392c393a42Smrg	      switch (cpu)
7402c393a42Smrg		{
7412c393a42Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7422c393a42Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7432c393a42Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7442c393a42Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7452c393a42Smrg		}
7462c393a42Smrg	    }
7472c393a42Smrg	  else if (CPU_IS_HP_MC68K (cpu))
7482c393a42Smrg	    puts ("m68k-hitachi-hiuxwe2");
7492c393a42Smrg	  else puts ("unknown-hitachi-hiuxwe2");
7502c393a42Smrg	  exit (0);
7512c393a42Smrg	}
7522c393a42SmrgEOF
753a32e9e42Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
7542c393a42Smrg		{ echo "$SYSTEM_NAME"; exit; }
7552c393a42Smrg	echo unknown-hitachi-hiuxwe2
7562c393a42Smrg	exit ;;
757a32e9e42Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
7582c393a42Smrg	echo hppa1.1-hp-bsd
7592c393a42Smrg	exit ;;
7602c393a42Smrg    9000/8??:4.3bsd:*:*)
7612c393a42Smrg	echo hppa1.0-hp-bsd
7622c393a42Smrg	exit ;;
7632c393a42Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7642c393a42Smrg	echo hppa1.0-hp-mpeix
7652c393a42Smrg	exit ;;
766a32e9e42Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
7672c393a42Smrg	echo hppa1.1-hp-osf
7682c393a42Smrg	exit ;;
7692c393a42Smrg    hp8??:OSF1:*:*)
7702c393a42Smrg	echo hppa1.0-hp-osf
7712c393a42Smrg	exit ;;
7722c393a42Smrg    i*86:OSF1:*:*)
7732c393a42Smrg	if [ -x /usr/sbin/sysversion ] ; then
774a32e9e42Smrg	    echo "$UNAME_MACHINE"-unknown-osf1mk
7752c393a42Smrg	else
776a32e9e42Smrg	    echo "$UNAME_MACHINE"-unknown-osf1
7772c393a42Smrg	fi
7782c393a42Smrg	exit ;;
7792c393a42Smrg    parisc*:Lites*:*:*)
7802c393a42Smrg	echo hppa1.1-hp-lites
7812c393a42Smrg	exit ;;
7822c393a42Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7832c393a42Smrg	echo c1-convex-bsd
784ca08ab68Smrg	exit ;;
7852c393a42Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7862c393a42Smrg	if getsysinfo -f scalar_acc
7872c393a42Smrg	then echo c32-convex-bsd
7882c393a42Smrg	else echo c2-convex-bsd
7892c393a42Smrg	fi
790ca08ab68Smrg	exit ;;
7912c393a42Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
7922c393a42Smrg	echo c34-convex-bsd
793ca08ab68Smrg	exit ;;
7942c393a42Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
7952c393a42Smrg	echo c38-convex-bsd
796ca08ab68Smrg	exit ;;
7972c393a42Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
7982c393a42Smrg	echo c4-convex-bsd
799ca08ab68Smrg	exit ;;
8002c393a42Smrg    CRAY*Y-MP:*:*:*)
801a32e9e42Smrg	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8022c393a42Smrg	exit ;;
8032c393a42Smrg    CRAY*[A-Z]90:*:*:*)
804a32e9e42Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8052c393a42Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8062c393a42Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8072c393a42Smrg	      -e 's/\.[^.]*$/.X/'
8082c393a42Smrg	exit ;;
8092c393a42Smrg    CRAY*TS:*:*:*)
810a32e9e42Smrg	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8112c393a42Smrg	exit ;;
8122c393a42Smrg    CRAY*T3E:*:*:*)
813a32e9e42Smrg	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8142c393a42Smrg	exit ;;
8152c393a42Smrg    CRAY*SV1:*:*:*)
816a32e9e42Smrg	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8172c393a42Smrg	exit ;;
8182c393a42Smrg    *:UNICOS/mp:*:*)
819a32e9e42Smrg	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8202c393a42Smrg	exit ;;
8212c393a42Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
822a32e9e42Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
823a32e9e42Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
824a32e9e42Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
825ca08ab68Smrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
826ca08ab68Smrg	exit ;;
8272c393a42Smrg    5000:UNIX_System_V:4.*:*)
828a32e9e42Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
829a32e9e42Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
830ca08ab68Smrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8312c393a42Smrg	exit ;;
8322c393a42Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
833a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
8342c393a42Smrg	exit ;;
8352c393a42Smrg    sparc*:BSD/OS:*:*)
836a32e9e42Smrg	echo sparc-unknown-bsdi"$UNAME_RELEASE"
8372c393a42Smrg	exit ;;
8382c393a42Smrg    *:BSD/OS:*:*)
839a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
8402c393a42Smrg	exit ;;
841a4e54154Smrg    arm:FreeBSD:*:*)
842a4e54154Smrg	UNAME_PROCESSOR=`uname -p`
843a4e54154Smrg	set_cc_for_build
844a4e54154Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
845a4e54154Smrg	    | grep -q __ARM_PCS_VFP
846a4e54154Smrg	then
847a4e54154Smrg	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
848a4e54154Smrg	else
849a4e54154Smrg	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
850a4e54154Smrg	fi
851a4e54154Smrg	exit ;;
8522c393a42Smrg    *:FreeBSD:*:*)
853ca08ab68Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
854a32e9e42Smrg	case "$UNAME_PROCESSOR" in
8552c393a42Smrg	    amd64)
856a32e9e42Smrg		UNAME_PROCESSOR=x86_64 ;;
857a32e9e42Smrg	    i386)
858a32e9e42Smrg		UNAME_PROCESSOR=i586 ;;
8592c393a42Smrg	esac
860a32e9e42Smrg	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
8612c393a42Smrg	exit ;;
8622c393a42Smrg    i*:CYGWIN*:*)
863a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-cygwin
8642c393a42Smrg	exit ;;
8656fc018e4Smrg    *:MINGW64*:*)
866a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-mingw64
8676fc018e4Smrg	exit ;;
8682c393a42Smrg    *:MINGW*:*)
869a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-mingw32
8702c393a42Smrg	exit ;;
871953daebaSmrg    *:MSYS*:*)
872a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-msys
8732c393a42Smrg	exit ;;
8742c393a42Smrg    i*:PW*:*)
875a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-pw32
8762c393a42Smrg	exit ;;
877ca08ab68Smrg    *:Interix*:*)
878a32e9e42Smrg	case "$UNAME_MACHINE" in
8792c393a42Smrg	    x86)
880a32e9e42Smrg		echo i586-pc-interix"$UNAME_RELEASE"
8812c393a42Smrg		exit ;;
882ca08ab68Smrg	    authenticamd | genuineintel | EM64T)
883a32e9e42Smrg		echo x86_64-unknown-interix"$UNAME_RELEASE"
8842c393a42Smrg		exit ;;
8852c393a42Smrg	    IA64)
886a32e9e42Smrg		echo ia64-unknown-interix"$UNAME_RELEASE"
8872c393a42Smrg		exit ;;
8882c393a42Smrg	esac ;;
8892c393a42Smrg    i*:UWIN*:*)
890a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-uwin
8912c393a42Smrg	exit ;;
8922c393a42Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8932c393a42Smrg	echo x86_64-unknown-cygwin
8942c393a42Smrg	exit ;;
8952c393a42Smrg    prep*:SunOS:5.*:*)
896a32e9e42Smrg	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
8972c393a42Smrg	exit ;;
8982c393a42Smrg    *:GNU:*:*)
8992c393a42Smrg	# the GNU system
900a32e9e42Smrg	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
9012c393a42Smrg	exit ;;
9022c393a42Smrg    *:GNU/*:*:*)
9032c393a42Smrg	# other systems with GNU libc and userland
904a32e9e42Smrg	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
9052c393a42Smrg	exit ;;
906a4e54154Smrg    *:Minix:*:*)
907a4e54154Smrg	echo "$UNAME_MACHINE"-unknown-minix
9082c393a42Smrg	exit ;;
909ca08ab68Smrg    aarch64:Linux:*:*)
910a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
911ca08ab68Smrg	exit ;;
912ca08ab68Smrg    aarch64_be:Linux:*:*)
913ca08ab68Smrg	UNAME_MACHINE=aarch64_be
914a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
915ca08ab68Smrg	exit ;;
916ca08ab68Smrg    alpha:Linux:*:*)
917ca08ab68Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
918ca08ab68Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
919ca08ab68Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
920ca08ab68Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
921ca08ab68Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
922ca08ab68Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
923ca08ab68Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
924ca08ab68Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
925ca08ab68Smrg	esac
926ca08ab68Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
927a32e9e42Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
928a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
929953daebaSmrg	exit ;;
930953daebaSmrg    arc:Linux:*:* | arceb:Linux:*:*)
931a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
932ca08ab68Smrg	exit ;;
9332c393a42Smrg    arm*:Linux:*:*)
934a4e54154Smrg	set_cc_for_build
9352c393a42Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9362c393a42Smrg	    | grep -q __ARM_EABI__
9372c393a42Smrg	then
938a32e9e42Smrg	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9392c393a42Smrg	else
940ca08ab68Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
941ca08ab68Smrg		| grep -q __ARM_PCS_VFP
942ca08ab68Smrg	    then
943a32e9e42Smrg		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
944ca08ab68Smrg	    else
945a32e9e42Smrg		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
946ca08ab68Smrg	    fi
9472c393a42Smrg	fi
9482c393a42Smrg	exit ;;
9492c393a42Smrg    avr32*:Linux:*:*)
950a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9512c393a42Smrg	exit ;;
9522c393a42Smrg    cris:Linux:*:*)
953a32e9e42Smrg	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
9542c393a42Smrg	exit ;;
9552c393a42Smrg    crisv32:Linux:*:*)
956a32e9e42Smrg	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
957a32e9e42Smrg	exit ;;
958a32e9e42Smrg    e2k:Linux:*:*)
959a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9602c393a42Smrg	exit ;;
9612c393a42Smrg    frv:Linux:*:*)
962a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
963ca08ab68Smrg	exit ;;
964ca08ab68Smrg    hexagon:Linux:*:*)
965a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
966ca08ab68Smrg	exit ;;
967ca08ab68Smrg    i*86:Linux:*:*)
968a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
9692c393a42Smrg	exit ;;
9702c393a42Smrg    ia64:Linux:*:*)
971a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
972a32e9e42Smrg	exit ;;
973a32e9e42Smrg    k1om:Linux:*:*)
974a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9752c393a42Smrg	exit ;;
9762c393a42Smrg    m32r*:Linux:*:*)
977a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9782c393a42Smrg	exit ;;
9792c393a42Smrg    m68*:Linux:*:*)
980a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9812c393a42Smrg	exit ;;
982ca08ab68Smrg    mips:Linux:*:* | mips64:Linux:*:*)
983a4e54154Smrg	set_cc_for_build
984a32e9e42Smrg	sed 's/^	//' << EOF > "$dummy.c"
9852c393a42Smrg	#undef CPU
986ca08ab68Smrg	#undef ${UNAME_MACHINE}
987ca08ab68Smrg	#undef ${UNAME_MACHINE}el
9882c393a42Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
989ca08ab68Smrg	CPU=${UNAME_MACHINE}el
9902c393a42Smrg	#else
9912c393a42Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
992ca08ab68Smrg	CPU=${UNAME_MACHINE}
9932c393a42Smrg	#else
9942c393a42Smrg	CPU=
9952c393a42Smrg	#endif
9962c393a42Smrg	#endif
9972c393a42SmrgEOF
998a32e9e42Smrg	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
999a32e9e42Smrg	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
10002c393a42Smrg	;;
1001a32e9e42Smrg    mips64el:Linux:*:*)
1002a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1003a32e9e42Smrg	exit ;;
1004953daebaSmrg    openrisc*:Linux:*:*)
1005a32e9e42Smrg	echo or1k-unknown-linux-"$LIBC"
1006953daebaSmrg	exit ;;
1007953daebaSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1008a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10092c393a42Smrg	exit ;;
1010ca08ab68Smrg    padre:Linux:*:*)
1011a32e9e42Smrg	echo sparc-unknown-linux-"$LIBC"
10122c393a42Smrg	exit ;;
1013ca08ab68Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1014a32e9e42Smrg	echo hppa64-unknown-linux-"$LIBC"
10152c393a42Smrg	exit ;;
10162c393a42Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
10172c393a42Smrg	# Look for CPU level
10182c393a42Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1019a32e9e42Smrg	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1020a32e9e42Smrg	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1021a32e9e42Smrg	  *)    echo hppa-unknown-linux-"$LIBC" ;;
10222c393a42Smrg	esac
10232c393a42Smrg	exit ;;
1024ca08ab68Smrg    ppc64:Linux:*:*)
1025a32e9e42Smrg	echo powerpc64-unknown-linux-"$LIBC"
1026ca08ab68Smrg	exit ;;
1027ca08ab68Smrg    ppc:Linux:*:*)
1028a32e9e42Smrg	echo powerpc-unknown-linux-"$LIBC"
1029953daebaSmrg	exit ;;
1030953daebaSmrg    ppc64le:Linux:*:*)
1031a32e9e42Smrg	echo powerpc64le-unknown-linux-"$LIBC"
1032953daebaSmrg	exit ;;
1033953daebaSmrg    ppcle:Linux:*:*)
1034a32e9e42Smrg	echo powerpcle-unknown-linux-"$LIBC"
1035a32e9e42Smrg	exit ;;
1036a32e9e42Smrg    riscv32:Linux:*:* | riscv64:Linux:*:*)
1037a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10382c393a42Smrg	exit ;;
10392c393a42Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1040a32e9e42Smrg	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
10412c393a42Smrg	exit ;;
10422c393a42Smrg    sh64*:Linux:*:*)
1043a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10442c393a42Smrg	exit ;;
10452c393a42Smrg    sh*:Linux:*:*)
1046a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10472c393a42Smrg	exit ;;
10482c393a42Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1049a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10502c393a42Smrg	exit ;;
1051ca08ab68Smrg    tile*:Linux:*:*)
1052a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1053ca08ab68Smrg	exit ;;
10542c393a42Smrg    vax:Linux:*:*)
1055a32e9e42Smrg	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
10562c393a42Smrg	exit ;;
10572c393a42Smrg    x86_64:Linux:*:*)
1058a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
10592c393a42Smrg	exit ;;
10602c393a42Smrg    xtensa*:Linux:*:*)
1061a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10622c393a42Smrg	exit ;;
10632c393a42Smrg    i*86:DYNIX/ptx:4*:*)
10642c393a42Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
10652c393a42Smrg	# earlier versions are messed up and put the nodename in both
10662c393a42Smrg	# sysname and nodename.
10672c393a42Smrg	echo i386-sequent-sysv4
10682c393a42Smrg	exit ;;
10692c393a42Smrg    i*86:UNIX_SV:4.2MP:2.*)
1070ca08ab68Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1071ca08ab68Smrg	# number series starting with 2...
1072ca08ab68Smrg	# I am not positive that other SVR4 systems won't match this,
10732c393a42Smrg	# I just have to hope.  -- rms.
1074ca08ab68Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1075a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
10762c393a42Smrg	exit ;;
10772c393a42Smrg    i*86:OS/2:*:*)
10782c393a42Smrg	# If we were able to find `uname', then EMX Unix compatibility
10792c393a42Smrg	# is probably installed.
1080a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-os2-emx
10812c393a42Smrg	exit ;;
10822c393a42Smrg    i*86:XTS-300:*:STOP)
1083a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-stop
10842c393a42Smrg	exit ;;
10852c393a42Smrg    i*86:atheos:*:*)
1086a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-atheos
10872c393a42Smrg	exit ;;
10882c393a42Smrg    i*86:syllable:*:*)
1089a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-syllable
10902c393a42Smrg	exit ;;
1091ca08ab68Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1092a32e9e42Smrg	echo i386-unknown-lynxos"$UNAME_RELEASE"
10932c393a42Smrg	exit ;;
10942c393a42Smrg    i*86:*DOS:*:*)
1095a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-msdosdjgpp
10962c393a42Smrg	exit ;;
1097a32e9e42Smrg    i*86:*:4.*:*)
1098a32e9e42Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
10992c393a42Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1100a32e9e42Smrg		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
11012c393a42Smrg	else
1102a32e9e42Smrg		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
11032c393a42Smrg	fi
11042c393a42Smrg	exit ;;
11052c393a42Smrg    i*86:*:5:[678]*)
1106ca08ab68Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
11072c393a42Smrg	case `/bin/uname -X | grep "^Machine"` in
11082c393a42Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
11092c393a42Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
11102c393a42Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
11112c393a42Smrg	esac
1112a32e9e42Smrg	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
11132c393a42Smrg	exit ;;
11142c393a42Smrg    i*86:*:3.2:*)
11152c393a42Smrg	if test -f /usr/options/cb.name; then
11162c393a42Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1117a32e9e42Smrg		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
11182c393a42Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11192c393a42Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11202c393a42Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11212c393a42Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11222c393a42Smrg			&& UNAME_MACHINE=i586
11232c393a42Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11242c393a42Smrg			&& UNAME_MACHINE=i686
11252c393a42Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11262c393a42Smrg			&& UNAME_MACHINE=i686
1127a32e9e42Smrg		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
11282c393a42Smrg	else
1129a32e9e42Smrg		echo "$UNAME_MACHINE"-pc-sysv32
11302c393a42Smrg	fi
11312c393a42Smrg	exit ;;
11322c393a42Smrg    pc:*:*:*)
11332c393a42Smrg	# Left here for compatibility:
1134ca08ab68Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1135ca08ab68Smrg	# the processor, so we play safe by assuming i586.
1136ca08ab68Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1137a32e9e42Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
1138ca08ab68Smrg	# this is a cross-build.
1139ca08ab68Smrg	echo i586-pc-msdosdjgpp
1140ca08ab68Smrg	exit ;;
11412c393a42Smrg    Intel:Mach:3*:*)
11422c393a42Smrg	echo i386-pc-mach3
11432c393a42Smrg	exit ;;
11442c393a42Smrg    paragon:*:*:*)
11452c393a42Smrg	echo i860-intel-osf1
11462c393a42Smrg	exit ;;
11472c393a42Smrg    i860:*:4.*:*) # i860-SVR4
11482c393a42Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1149a32e9e42Smrg	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
11502c393a42Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1151a32e9e42Smrg	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
11522c393a42Smrg	fi
11532c393a42Smrg	exit ;;
11542c393a42Smrg    mini*:CTIX:SYS*5:*)
11552c393a42Smrg	# "miniframe"
11562c393a42Smrg	echo m68010-convergent-sysv
11572c393a42Smrg	exit ;;
11582c393a42Smrg    mc68k:UNIX:SYSTEM5:3.51m)
11592c393a42Smrg	echo m68k-convergent-sysv
11602c393a42Smrg	exit ;;
11612c393a42Smrg    M680?0:D-NIX:5.3:*)
11622c393a42Smrg	echo m68k-diab-dnix
11632c393a42Smrg	exit ;;
11642c393a42Smrg    M68*:*:R3V[5678]*:*)
11652c393a42Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11662c393a42Smrg    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)
11672c393a42Smrg	OS_REL=''
11682c393a42Smrg	test -r /etc/.relid \
11692c393a42Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11702c393a42Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1171a32e9e42Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
11722c393a42Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1173a32e9e42Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
11742c393a42Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1175ca08ab68Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1176ca08ab68Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1177ca08ab68Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1178ca08ab68Smrg	OS_REL='.3'
1179ca08ab68Smrg	test -r /etc/.relid \
1180ca08ab68Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1181ca08ab68Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1182a32e9e42Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1183ca08ab68Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1184a32e9e42Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1185ca08ab68Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1186a32e9e42Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
11872c393a42Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1188a32e9e42Smrg	echo m68k-unknown-lynxos"$UNAME_RELEASE"
11892c393a42Smrg	exit ;;
11902c393a42Smrg    mc68030:UNIX_System_V:4.*:*)
11912c393a42Smrg	echo m68k-atari-sysv4
11922c393a42Smrg	exit ;;
11932c393a42Smrg    TSUNAMI:LynxOS:2.*:*)
1194a32e9e42Smrg	echo sparc-unknown-lynxos"$UNAME_RELEASE"
11952c393a42Smrg	exit ;;
11962c393a42Smrg    rs6000:LynxOS:2.*:*)
1197a32e9e42Smrg	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
11982c393a42Smrg	exit ;;
1199ca08ab68Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1200a32e9e42Smrg	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
12012c393a42Smrg	exit ;;
12022c393a42Smrg    SM[BE]S:UNIX_SV:*:*)
1203a32e9e42Smrg	echo mips-dde-sysv"$UNAME_RELEASE"
12042c393a42Smrg	exit ;;
12052c393a42Smrg    RM*:ReliantUNIX-*:*:*)
12062c393a42Smrg	echo mips-sni-sysv4
12072c393a42Smrg	exit ;;
12082c393a42Smrg    RM*:SINIX-*:*:*)
12092c393a42Smrg	echo mips-sni-sysv4
12102c393a42Smrg	exit ;;
12112c393a42Smrg    *:SINIX-*:*:*)
12122c393a42Smrg	if uname -p 2>/dev/null >/dev/null ; then
12132c393a42Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1214a32e9e42Smrg		echo "$UNAME_MACHINE"-sni-sysv4
12152c393a42Smrg	else
12162c393a42Smrg		echo ns32k-sni-sysv
12172c393a42Smrg	fi
12182c393a42Smrg	exit ;;
1219ca08ab68Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1220ca08ab68Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1221ca08ab68Smrg	echo i586-unisys-sysv4
1222ca08ab68Smrg	exit ;;
12232c393a42Smrg    *:UNIX_System_V:4*:FTX*)
12242c393a42Smrg	# From Gerald Hewes <hewes@openmarket.com>.
12252c393a42Smrg	# How about differentiating between stratus architectures? -djm
12262c393a42Smrg	echo hppa1.1-stratus-sysv4
12272c393a42Smrg	exit ;;
12282c393a42Smrg    *:*:*:FTX*)
12292c393a42Smrg	# From seanf@swdc.stratus.com.
12302c393a42Smrg	echo i860-stratus-sysv4
12312c393a42Smrg	exit ;;
12322c393a42Smrg    i*86:VOS:*:*)
12332c393a42Smrg	# From Paul.Green@stratus.com.
1234a32e9e42Smrg	echo "$UNAME_MACHINE"-stratus-vos
12352c393a42Smrg	exit ;;
12362c393a42Smrg    *:VOS:*:*)
12372c393a42Smrg	# From Paul.Green@stratus.com.
12382c393a42Smrg	echo hppa1.1-stratus-vos
12392c393a42Smrg	exit ;;
12402c393a42Smrg    mc68*:A/UX:*:*)
1241a32e9e42Smrg	echo m68k-apple-aux"$UNAME_RELEASE"
12422c393a42Smrg	exit ;;
12432c393a42Smrg    news*:NEWS-OS:6*:*)
12442c393a42Smrg	echo mips-sony-newsos6
12452c393a42Smrg	exit ;;
12462c393a42Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12472c393a42Smrg	if [ -d /usr/nec ]; then
1248a32e9e42Smrg		echo mips-nec-sysv"$UNAME_RELEASE"
12492c393a42Smrg	else
1250a32e9e42Smrg		echo mips-unknown-sysv"$UNAME_RELEASE"
12512c393a42Smrg	fi
1252ca08ab68Smrg	exit ;;
12532c393a42Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
12542c393a42Smrg	echo powerpc-be-beos
12552c393a42Smrg	exit ;;
12562c393a42Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
12572c393a42Smrg	echo powerpc-apple-beos
12582c393a42Smrg	exit ;;
12592c393a42Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
12602c393a42Smrg	echo i586-pc-beos
12612c393a42Smrg	exit ;;
1262ca08ab68Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1263ca08ab68Smrg	echo i586-pc-haiku
1264ca08ab68Smrg	exit ;;
12656fc018e4Smrg    x86_64:Haiku:*:*)
12666fc018e4Smrg	echo x86_64-unknown-haiku
12676fc018e4Smrg	exit ;;
12682c393a42Smrg    SX-4:SUPER-UX:*:*)
1269a32e9e42Smrg	echo sx4-nec-superux"$UNAME_RELEASE"
12702c393a42Smrg	exit ;;
12712c393a42Smrg    SX-5:SUPER-UX:*:*)
1272a32e9e42Smrg	echo sx5-nec-superux"$UNAME_RELEASE"
12732c393a42Smrg	exit ;;
12742c393a42Smrg    SX-6:SUPER-UX:*:*)
1275a32e9e42Smrg	echo sx6-nec-superux"$UNAME_RELEASE"
12762c393a42Smrg	exit ;;
12772c393a42Smrg    SX-7:SUPER-UX:*:*)
1278a32e9e42Smrg	echo sx7-nec-superux"$UNAME_RELEASE"
12792c393a42Smrg	exit ;;
12802c393a42Smrg    SX-8:SUPER-UX:*:*)
1281a32e9e42Smrg	echo sx8-nec-superux"$UNAME_RELEASE"
12822c393a42Smrg	exit ;;
12832c393a42Smrg    SX-8R:SUPER-UX:*:*)
1284a32e9e42Smrg	echo sx8r-nec-superux"$UNAME_RELEASE"
1285a32e9e42Smrg	exit ;;
1286a32e9e42Smrg    SX-ACE:SUPER-UX:*:*)
1287a32e9e42Smrg	echo sxace-nec-superux"$UNAME_RELEASE"
12882c393a42Smrg	exit ;;
12892c393a42Smrg    Power*:Rhapsody:*:*)
1290a32e9e42Smrg	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
12912c393a42Smrg	exit ;;
12922c393a42Smrg    *:Rhapsody:*:*)
1293a32e9e42Smrg	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
12942c393a42Smrg	exit ;;
12952c393a42Smrg    *:Darwin:*:*)
12962c393a42Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1297a4e54154Smrg	set_cc_for_build
1298953daebaSmrg	if test "$UNAME_PROCESSOR" = unknown ; then
1299953daebaSmrg	    UNAME_PROCESSOR=powerpc
1300953daebaSmrg	fi
1301a32e9e42Smrg	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
1302a32e9e42Smrg	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1303953daebaSmrg		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1304a32e9e42Smrg		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1305a32e9e42Smrg		       grep IS_64BIT_ARCH >/dev/null
1306953daebaSmrg		then
1307953daebaSmrg		    case $UNAME_PROCESSOR in
1308953daebaSmrg			i386) UNAME_PROCESSOR=x86_64 ;;
1309953daebaSmrg			powerpc) UNAME_PROCESSOR=powerpc64 ;;
1310953daebaSmrg		    esac
1311953daebaSmrg		fi
1312a32e9e42Smrg		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1313a32e9e42Smrg		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1314a32e9e42Smrg		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1315a32e9e42Smrg		       grep IS_PPC >/dev/null
1316a32e9e42Smrg		then
1317a32e9e42Smrg		    UNAME_PROCESSOR=powerpc
1318a32e9e42Smrg		fi
1319953daebaSmrg	    fi
1320953daebaSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1321953daebaSmrg	    # Avoid executing cc on OS X 10.9, as it ships with a stub
1322953daebaSmrg	    # that puts up a graphical alert prompting to install
1323953daebaSmrg	    # developer tools.  Any system running Mac OS X 10.7 or
1324953daebaSmrg	    # later (Darwin 11 and later) is required to have a 64-bit
1325953daebaSmrg	    # processor. This is not true of the ARM version of Darwin
1326953daebaSmrg	    # that Apple uses in portable devices.
1327953daebaSmrg	    UNAME_PROCESSOR=x86_64
1328953daebaSmrg	fi
1329a32e9e42Smrg	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
13302c393a42Smrg	exit ;;
13312c393a42Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
13322c393a42Smrg	UNAME_PROCESSOR=`uname -p`
1333a32e9e42Smrg	if test "$UNAME_PROCESSOR" = x86; then
13342c393a42Smrg		UNAME_PROCESSOR=i386
13352c393a42Smrg		UNAME_MACHINE=pc
13362c393a42Smrg	fi
1337a32e9e42Smrg	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
13382c393a42Smrg	exit ;;
13392c393a42Smrg    *:QNX:*:4*)
13402c393a42Smrg	echo i386-pc-qnx
13412c393a42Smrg	exit ;;
1342a32e9e42Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1343a32e9e42Smrg	echo neo-tandem-nsk"$UNAME_RELEASE"
1344ca08ab68Smrg	exit ;;
1345c9710b42Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1346a32e9e42Smrg	echo nse-tandem-nsk"$UNAME_RELEASE"
1347a32e9e42Smrg	exit ;;
1348a32e9e42Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1349a32e9e42Smrg	echo nsr-tandem-nsk"$UNAME_RELEASE"
13502c393a42Smrg	exit ;;
1351a32e9e42Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1352a32e9e42Smrg	echo nsv-tandem-nsk"$UNAME_RELEASE"
1353a32e9e42Smrg	exit ;;
1354a32e9e42Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1355a32e9e42Smrg	echo nsx-tandem-nsk"$UNAME_RELEASE"
13562c393a42Smrg	exit ;;
13572c393a42Smrg    *:NonStop-UX:*:*)
13582c393a42Smrg	echo mips-compaq-nonstopux
13592c393a42Smrg	exit ;;
13602c393a42Smrg    BS2000:POSIX*:*:*)
13612c393a42Smrg	echo bs2000-siemens-sysv
13622c393a42Smrg	exit ;;
13632c393a42Smrg    DS/*:UNIX_System_V:*:*)
1364a32e9e42Smrg	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
13652c393a42Smrg	exit ;;
13662c393a42Smrg    *:Plan9:*:*)
13672c393a42Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
13682c393a42Smrg	# is converted to i386 for consistency with other x86
13692c393a42Smrg	# operating systems.
1370a4e54154Smrg	# shellcheck disable=SC2154
1371a32e9e42Smrg	if test "$cputype" = 386; then
13722c393a42Smrg	    UNAME_MACHINE=i386
13732c393a42Smrg	else
13742c393a42Smrg	    UNAME_MACHINE="$cputype"
13752c393a42Smrg	fi
1376a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-plan9
13772c393a42Smrg	exit ;;
13782c393a42Smrg    *:TOPS-10:*:*)
13792c393a42Smrg	echo pdp10-unknown-tops10
13802c393a42Smrg	exit ;;
13812c393a42Smrg    *:TENEX:*:*)
13822c393a42Smrg	echo pdp10-unknown-tenex
13832c393a42Smrg	exit ;;
13842c393a42Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
13852c393a42Smrg	echo pdp10-dec-tops20
13862c393a42Smrg	exit ;;
13872c393a42Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
13882c393a42Smrg	echo pdp10-xkl-tops20
13892c393a42Smrg	exit ;;
13902c393a42Smrg    *:TOPS-20:*:*)
13912c393a42Smrg	echo pdp10-unknown-tops20
13922c393a42Smrg	exit ;;
13932c393a42Smrg    *:ITS:*:*)
13942c393a42Smrg	echo pdp10-unknown-its
13952c393a42Smrg	exit ;;
13962c393a42Smrg    SEI:*:*:SEIUX)
1397a32e9e42Smrg	echo mips-sei-seiux"$UNAME_RELEASE"
13982c393a42Smrg	exit ;;
13992c393a42Smrg    *:DragonFly:*:*)
1400a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
14012c393a42Smrg	exit ;;
14022c393a42Smrg    *:*VMS:*:*)
1403ca08ab68Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1404a32e9e42Smrg	case "$UNAME_MACHINE" in
14052c393a42Smrg	    A*) echo alpha-dec-vms ; exit ;;
14062c393a42Smrg	    I*) echo ia64-dec-vms ; exit ;;
14072c393a42Smrg	    V*) echo vax-dec-vms ; exit ;;
14082c393a42Smrg	esac ;;
14092c393a42Smrg    *:XENIX:*:SysV)
14102c393a42Smrg	echo i386-pc-xenix
14112c393a42Smrg	exit ;;
14122c393a42Smrg    i*86:skyos:*:*)
1413a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
14142c393a42Smrg	exit ;;
14152c393a42Smrg    i*86:rdos:*:*)
1416a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-rdos
14172c393a42Smrg	exit ;;
1418ca08ab68Smrg    i*86:AROS:*:*)
1419a32e9e42Smrg	echo "$UNAME_MACHINE"-pc-aros
1420ca08ab68Smrg	exit ;;
1421ca08ab68Smrg    x86_64:VMkernel:*:*)
1422a32e9e42Smrg	echo "$UNAME_MACHINE"-unknown-esx
1423a32e9e42Smrg	exit ;;
1424a32e9e42Smrg    amd64:Isilon\ OneFS:*:*)
1425a32e9e42Smrg	echo x86_64-unknown-onefs
1426ca08ab68Smrg	exit ;;
14272c393a42Smrgesac
14282c393a42Smrg
1429a32e9e42Smrgecho "$0: unable to guess system type" >&2
1430a32e9e42Smrg
1431a32e9e42Smrgcase "$UNAME_MACHINE:$UNAME_SYSTEM" in
1432a32e9e42Smrg    mips:Linux | mips64:Linux)
1433a32e9e42Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1434a32e9e42Smrg	cat >&2 <<EOF
1435a32e9e42Smrg
1436a32e9e42SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1437a32e9e42Smrgthe system type. Please install a C compiler and try again.
1438a32e9e42SmrgEOF
1439a32e9e42Smrg	;;
1440a32e9e42Smrgesac
1441a32e9e42Smrg
14422c393a42Smrgcat >&2 <<EOF
14432c393a42Smrg
1444a32e9e42SmrgThis script (version $timestamp), has failed to recognize the
1445a32e9e42Smrgoperating system you are using. If your script is old, overwrite *all*
1446a32e9e42Smrgcopies of config.guess and config.sub with the latest versions from:
14472c393a42Smrg
1448a32e9e42Smrg  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
14492c393a42Smrgand
1450a32e9e42Smrg  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
14512c393a42Smrg
1452a32e9e42SmrgIf $0 has already been updated, send the following data and any
1453a32e9e42Smrginformation you think might be pertinent to config-patches@gnu.org to
1454a32e9e42Smrgprovide the necessary information to handle your system.
14552c393a42Smrg
14562c393a42Smrgconfig.guess timestamp = $timestamp
14572c393a42Smrg
14582c393a42Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
14592c393a42Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
14602c393a42Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
14612c393a42Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
14622c393a42Smrg
14632c393a42Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
14642c393a42Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
14652c393a42Smrg
14662c393a42Smrghostinfo               = `(hostinfo) 2>/dev/null`
14672c393a42Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
14682c393a42Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
14692c393a42Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
14702c393a42Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
14712c393a42Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
14722c393a42Smrg
1473a32e9e42SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1474a32e9e42SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1475a32e9e42SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1476a32e9e42SmrgUNAME_VERSION = "$UNAME_VERSION"
14772c393a42SmrgEOF
14782c393a42Smrg
14792c393a42Smrgexit 1
14802c393a42Smrg
14812c393a42Smrg# Local variables:
1482a32e9e42Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
14832c393a42Smrg# time-stamp-start: "timestamp='"
14842c393a42Smrg# time-stamp-format: "%:y-%02m-%02d"
14852c393a42Smrg# time-stamp-end: "'"
14862c393a42Smrg# End:
1487