1067610f1Smrg#! /bin/sh
2067610f1Smrg# Attempt to guess a canonical system name.
358105723Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4067610f1Smrg
558105723Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
658105723Smrg
758105723Smrgtimestamp='2021-06-03'
8067610f1Smrg
9067610f1Smrg# This file is free software; you can redistribute it and/or modify it
10067610f1Smrg# under the terms of the GNU General Public License as published by
11e7fdea5fSmrg# the Free Software Foundation; either version 3 of the License, or
12067610f1Smrg# (at your option) any later version.
13067610f1Smrg#
14067610f1Smrg# This program is distributed in the hope that it will be useful, but
15067610f1Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16067610f1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17067610f1Smrg# General Public License for more details.
18067610f1Smrg#
19067610f1Smrg# You should have received a copy of the GNU General Public License
204d9306dbSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21067610f1Smrg#
22067610f1Smrg# As a special exception to the GNU General Public License, if you
23067610f1Smrg# distribute this file as part of a program that contains a
24067610f1Smrg# configuration script generated by Autoconf, you may include it under
25e7fdea5fSmrg# the same distribution terms that you use for the rest of that
26e7fdea5fSmrg# program.  This Exception is an additional permission under section 7
27e7fdea5fSmrg# of the GNU General Public License, version 3 ("GPLv3").
28067610f1Smrg#
294d9306dbSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30067610f1Smrg#
317e6533d5Smrg# You can get the latest version of this script from:
3258105723Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33e7fdea5fSmrg#
344d9306dbSmrg# Please send patches to <config-patches@gnu.org>.
35e7fdea5fSmrg
36067610f1Smrg
3758105723Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
3858105723Smrg# about features and limitations of the classic Bourne shell that were
3958105723Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
4058105723Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
4158105723Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
4258105723Smrg# have a pre-POSIX /bin/sh.
4358105723Smrg
4458105723Smrg
45067610f1Smrgme=`echo "$0" | sed -e 's,.*/,,'`
46067610f1Smrg
47067610f1Smrgusage="\
48067610f1SmrgUsage: $0 [OPTION]
49067610f1Smrg
50067610f1SmrgOutput the configuration name of the system \`$me' is run on.
51067610f1Smrg
524d9306dbSmrgOptions:
53067610f1Smrg  -h, --help         print this help, then exit
54067610f1Smrg  -t, --time-stamp   print date of last modification, then exit
55067610f1Smrg  -v, --version      print version number, then exit
56067610f1Smrg
57067610f1SmrgReport bugs and patches to <config-patches@gnu.org>."
58067610f1Smrg
59067610f1Smrgversion="\
60067610f1SmrgGNU config.guess ($timestamp)
61067610f1Smrg
62067610f1SmrgOriginally written by Per Bothner.
6358105723SmrgCopyright 1992-2021 Free Software Foundation, Inc.
64067610f1Smrg
65067610f1SmrgThis is free software; see the source for copying conditions.  There is NO
66067610f1Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67067610f1Smrg
68067610f1Smrghelp="
69067610f1SmrgTry \`$me --help' for more information."
70067610f1Smrg
71067610f1Smrg# Parse command line
72067610f1Smrgwhile test $# -gt 0 ; do
73067610f1Smrg  case $1 in
74067610f1Smrg    --time-stamp | --time* | -t )
75067610f1Smrg       echo "$timestamp" ; exit ;;
76067610f1Smrg    --version | -v )
77067610f1Smrg       echo "$version" ; exit ;;
78067610f1Smrg    --help | --h* | -h )
79067610f1Smrg       echo "$usage"; exit ;;
80067610f1Smrg    -- )     # Stop option processing
81067610f1Smrg       shift; break ;;
82067610f1Smrg    - )	# Use stdin as input.
83067610f1Smrg       break ;;
84067610f1Smrg    -* )
85067610f1Smrg       echo "$me: invalid option $1$help" >&2
86067610f1Smrg       exit 1 ;;
87067610f1Smrg    * )
88067610f1Smrg       break ;;
89067610f1Smrg  esac
90067610f1Smrgdone
91067610f1Smrg
92067610f1Smrgif test $# != 0; then
93067610f1Smrg  echo "$me: too many arguments$help" >&2
94067610f1Smrg  exit 1
95067610f1Smrgfi
96067610f1Smrg
9758105723Smrg# Just in case it came from the environment.
9858105723SmrgGUESS=
99067610f1Smrg
100067610f1Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101067610f1Smrg# compiler to aid in system detection is discouraged as it requires
102067610f1Smrg# temporary files to be created and, as you can see below, it is a
103067610f1Smrg# headache to deal with in a portable fashion.
104067610f1Smrg
105067610f1Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106067610f1Smrg# use `HOST_CC' if defined, but it is deprecated.
107067610f1Smrg
108067610f1Smrg# Portable tmp directory creation inspired by the Autoconf team.
109067610f1Smrg
11058105723Smrgtmp=
11158105723Smrg# shellcheck disable=SC2172
11258105723Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
11358105723Smrg
11458105723Smrgset_cc_for_build() {
11558105723Smrg    # prevent multiple calls if $tmp is already set
11658105723Smrg    test "$tmp" && return 0
11758105723Smrg    : "${TMPDIR=/tmp}"
11858105723Smrg    # shellcheck disable=SC2039,SC3028
11958105723Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
12058105723Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
12158105723Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
12258105723Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
12358105723Smrg    dummy=$tmp/dummy
12458105723Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
12558105723Smrg	,,)    echo "int x;" > "$dummy.c"
12658105723Smrg	       for driver in cc gcc c89 c99 ; do
12758105723Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
12858105723Smrg		       CC_FOR_BUILD=$driver
12958105723Smrg		       break
13058105723Smrg		   fi
13158105723Smrg	       done
13258105723Smrg	       if test x"$CC_FOR_BUILD" = x ; then
13358105723Smrg		   CC_FOR_BUILD=no_compiler_found
13458105723Smrg	       fi
13558105723Smrg	       ;;
13658105723Smrg	,,*)   CC_FOR_BUILD=$CC ;;
13758105723Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13858105723Smrg    esac
13958105723Smrg}
140067610f1Smrg
141067610f1Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142067610f1Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
14358105723Smrgif test -f /.attbin/uname ; then
144067610f1Smrg	PATH=$PATH:/.attbin ; export PATH
145067610f1Smrgfi
146067610f1Smrg
147067610f1SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148067610f1SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14958105723SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150067610f1SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151067610f1Smrg
15258105723Smrgcase $UNAME_SYSTEM in
153e7fdea5fSmrgLinux|GNU|GNU/*)
15458105723Smrg	LIBC=unknown
155e7fdea5fSmrg
15658105723Smrg	set_cc_for_build
1574d9306dbSmrg	cat <<-EOF > "$dummy.c"
158e7fdea5fSmrg	#include <features.h>
159e7fdea5fSmrg	#if defined(__UCLIBC__)
160e7fdea5fSmrg	LIBC=uclibc
161e7fdea5fSmrg	#elif defined(__dietlibc__)
162e7fdea5fSmrg	LIBC=dietlibc
16358105723Smrg	#elif defined(__GLIBC__)
164e7fdea5fSmrg	LIBC=gnu
16558105723Smrg	#else
16658105723Smrg	#include <stdarg.h>
16758105723Smrg	/* First heuristic to detect musl libc.  */
16858105723Smrg	#ifdef __DEFINED_va_list
16958105723Smrg	LIBC=musl
17058105723Smrg	#endif
171e7fdea5fSmrg	#endif
172e7fdea5fSmrg	EOF
17358105723Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
17458105723Smrg	eval "$cc_set_libc"
1754d9306dbSmrg
17658105723Smrg	# Second heuristic to detect musl libc.
17758105723Smrg	if [ "$LIBC" = unknown ] &&
17858105723Smrg	   command -v ldd >/dev/null &&
17958105723Smrg	   ldd --version 2>&1 | grep -q ^musl; then
18058105723Smrg		LIBC=musl
18158105723Smrg	fi
18258105723Smrg
18358105723Smrg	# If the system lacks a compiler, then just pick glibc.
18458105723Smrg	# We could probably try harder.
18558105723Smrg	if [ "$LIBC" = unknown ]; then
18658105723Smrg		LIBC=gnu
1874d9306dbSmrg	fi
188e7fdea5fSmrg	;;
189e7fdea5fSmrgesac
190e7fdea5fSmrg
191067610f1Smrg# Note: order is significant - the case branches are not exclusive.
192067610f1Smrg
19358105723Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194067610f1Smrg    *:NetBSD:*:*)
195067610f1Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196e7fdea5fSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197067610f1Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198067610f1Smrg	# switched to ELF, *-*-netbsd* would select the old
199067610f1Smrg	# object file format.  This provides both forward
200067610f1Smrg	# compatibility and a consistent mechanism for selecting the
201067610f1Smrg	# object file format.
202067610f1Smrg	#
203067610f1Smrg	# Note: NetBSD doesn't particularly care about the vendor
204067610f1Smrg	# portion of the name.  We always set it to "unknown".
2054d9306dbSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
20658105723Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20758105723Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2084d9306dbSmrg	    echo unknown)`
20958105723Smrg	case $UNAME_MACHINE_ARCH in
21058105723Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
211067610f1Smrg	    armeb) machine=armeb-unknown ;;
212067610f1Smrg	    arm*) machine=arm-unknown ;;
213067610f1Smrg	    sh3el) machine=shl-unknown ;;
214067610f1Smrg	    sh3eb) machine=sh-unknown ;;
215067610f1Smrg	    sh5el) machine=sh5le-unknown ;;
2164d9306dbSmrg	    earmv*)
2174d9306dbSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2184d9306dbSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
21958105723Smrg		machine=${arch}${endian}-unknown
2204d9306dbSmrg		;;
22158105723Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222067610f1Smrg	esac
223067610f1Smrg	# The Operating System including object format, if it has switched
2244d9306dbSmrg	# to ELF recently (or will in the future) and ABI.
22558105723Smrg	case $UNAME_MACHINE_ARCH in
2264d9306dbSmrg	    earm*)
2274d9306dbSmrg		os=netbsdelf
2284d9306dbSmrg		;;
229067610f1Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
23058105723Smrg		set_cc_for_build
231067610f1Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2327e6533d5Smrg			| grep -q __ELF__
233067610f1Smrg		then
234067610f1Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235067610f1Smrg		    # Return netbsd for either.  FIX?
236067610f1Smrg		    os=netbsd
237067610f1Smrg		else
238067610f1Smrg		    os=netbsdelf
239067610f1Smrg		fi
240067610f1Smrg		;;
241067610f1Smrg	    *)
242aea1d7ffSmrg		os=netbsd
243067610f1Smrg		;;
244067610f1Smrg	esac
2454d9306dbSmrg	# Determine ABI tags.
24658105723Smrg	case $UNAME_MACHINE_ARCH in
2474d9306dbSmrg	    earm*)
2484d9306dbSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2494d9306dbSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2504d9306dbSmrg		;;
2514d9306dbSmrg	esac
252067610f1Smrg	# The OS release
253067610f1Smrg	# Debian GNU/NetBSD machines have a different userland, and
254067610f1Smrg	# thus, need a distinct triplet. However, they do not need
255067610f1Smrg	# kernel version information, so it can be replaced with a
256067610f1Smrg	# suitable tag, in the style of linux-gnu.
25758105723Smrg	case $UNAME_VERSION in
258067610f1Smrg	    Debian*)
259067610f1Smrg		release='-gnu'
260067610f1Smrg		;;
261067610f1Smrg	    *)
2624d9306dbSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263067610f1Smrg		;;
264067610f1Smrg	esac
265067610f1Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266067610f1Smrg	# contains redundant information, the shorter form:
267067610f1Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
26858105723Smrg	GUESS=$machine-${os}${release}${abi-}
26958105723Smrg	;;
270e7fdea5fSmrg    *:Bitrig:*:*)
271e7fdea5fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
27258105723Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
27358105723Smrg	;;
274067610f1Smrg    *:OpenBSD:*:*)
275067610f1Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
27658105723Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
27758105723Smrg	;;
27858105723Smrg    *:SecBSD:*:*)
27958105723Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
28058105723Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
28158105723Smrg	;;
2824d9306dbSmrg    *:LibertyBSD:*:*)
2834d9306dbSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
28458105723Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
28558105723Smrg	;;
2864d9306dbSmrg    *:MidnightBSD:*:*)
28758105723Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
28858105723Smrg	;;
289067610f1Smrg    *:ekkoBSD:*:*)
29058105723Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
29158105723Smrg	;;
292067610f1Smrg    *:SolidBSD:*:*)
29358105723Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
29458105723Smrg	;;
29558105723Smrg    *:OS108:*:*)
29658105723Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
29758105723Smrg	;;
298067610f1Smrg    macppc:MirBSD:*:*)
29958105723Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
30058105723Smrg	;;
301067610f1Smrg    *:MirBSD:*:*)
30258105723Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
30358105723Smrg	;;
3044d9306dbSmrg    *:Sortix:*:*)
30558105723Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
30658105723Smrg	;;
30758105723Smrg    *:Twizzler:*:*)
30858105723Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
30958105723Smrg	;;
3104d9306dbSmrg    *:Redox:*:*)
31158105723Smrg	GUESS=$UNAME_MACHINE-unknown-redox
31258105723Smrg	;;
3134d9306dbSmrg    mips:OSF1:*.*)
31458105723Smrg	GUESS=mips-dec-osf1
31558105723Smrg	;;
316067610f1Smrg    alpha:OSF1:*:*)
31758105723Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
31858105723Smrg	trap '' 0
319067610f1Smrg	case $UNAME_RELEASE in
320067610f1Smrg	*4.0)
321067610f1Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322067610f1Smrg		;;
323067610f1Smrg	*5.*)
324aea1d7ffSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325067610f1Smrg		;;
326067610f1Smrg	esac
327067610f1Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328067610f1Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329067610f1Smrg	# covers most systems running today.  This code pipes the CPU
330067610f1Smrg	# types through head -n 1, so we only detect the type of CPU 0.
331067610f1Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
33258105723Smrg	case $ALPHA_CPU_TYPE in
333067610f1Smrg	    "EV4 (21064)")
3344d9306dbSmrg		UNAME_MACHINE=alpha ;;
335067610f1Smrg	    "EV4.5 (21064)")
3364d9306dbSmrg		UNAME_MACHINE=alpha ;;
337067610f1Smrg	    "LCA4 (21066/21068)")
3384d9306dbSmrg		UNAME_MACHINE=alpha ;;
339067610f1Smrg	    "EV5 (21164)")
3404d9306dbSmrg		UNAME_MACHINE=alphaev5 ;;
341067610f1Smrg	    "EV5.6 (21164A)")
3424d9306dbSmrg		UNAME_MACHINE=alphaev56 ;;
343067610f1Smrg	    "EV5.6 (21164PC)")
3444d9306dbSmrg		UNAME_MACHINE=alphapca56 ;;
345067610f1Smrg	    "EV5.7 (21164PC)")
3464d9306dbSmrg		UNAME_MACHINE=alphapca57 ;;
347067610f1Smrg	    "EV6 (21264)")
3484d9306dbSmrg		UNAME_MACHINE=alphaev6 ;;
349067610f1Smrg	    "EV6.7 (21264A)")
3504d9306dbSmrg		UNAME_MACHINE=alphaev67 ;;
351067610f1Smrg	    "EV6.8CB (21264C)")
3524d9306dbSmrg		UNAME_MACHINE=alphaev68 ;;
353067610f1Smrg	    "EV6.8AL (21264B)")
3544d9306dbSmrg		UNAME_MACHINE=alphaev68 ;;
355067610f1Smrg	    "EV6.8CX (21264D)")
3564d9306dbSmrg		UNAME_MACHINE=alphaev68 ;;
357067610f1Smrg	    "EV6.9A (21264/EV69A)")
3584d9306dbSmrg		UNAME_MACHINE=alphaev69 ;;
359067610f1Smrg	    "EV7 (21364)")
3604d9306dbSmrg		UNAME_MACHINE=alphaev7 ;;
361067610f1Smrg	    "EV7.9 (21364A)")
3624d9306dbSmrg		UNAME_MACHINE=alphaev79 ;;
363067610f1Smrg	esac
364067610f1Smrg	# A Pn.n version is a patched version.
365067610f1Smrg	# A Vn.n version is a released version.
366067610f1Smrg	# A Tn.n version is a released field test version.
367067610f1Smrg	# A Xn.n version is an unreleased experimental baselevel.
368067610f1Smrg	# 1.2 uses "1.2" for uname -r.
36958105723Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
37058105723Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
37158105723Smrg	;;
372067610f1Smrg    Amiga*:UNIX_System_V:4.0:*)
37358105723Smrg	GUESS=m68k-unknown-sysv4
37458105723Smrg	;;
375067610f1Smrg    *:[Aa]miga[Oo][Ss]:*:*)
37658105723Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
37758105723Smrg	;;
378067610f1Smrg    *:[Mm]orph[Oo][Ss]:*:*)
37958105723Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
38058105723Smrg	;;
381067610f1Smrg    *:OS/390:*:*)
38258105723Smrg	GUESS=i370-ibm-openedition
38358105723Smrg	;;
384067610f1Smrg    *:z/VM:*:*)
38558105723Smrg	GUESS=s390-ibm-zvmoe
38658105723Smrg	;;
387067610f1Smrg    *:OS400:*:*)
38858105723Smrg	GUESS=powerpc-ibm-os400
38958105723Smrg	;;
390067610f1Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
39158105723Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
39258105723Smrg	;;
393e7fdea5fSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
39458105723Smrg	GUESS=arm-unknown-riscos
39558105723Smrg	;;
396067610f1Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
39758105723Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
39858105723Smrg	;;
399067610f1Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400067610f1Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
40158105723Smrg	case `(/bin/universe) 2>/dev/null` in
40258105723Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
40358105723Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
40458105723Smrg	esac
40558105723Smrg	;;
406067610f1Smrg    NILE*:*:*:dcosx)
40758105723Smrg	GUESS=pyramid-pyramid-svr4
40858105723Smrg	;;
409067610f1Smrg    DRS?6000:unix:4.0:6*)
41058105723Smrg	GUESS=sparc-icl-nx6
41158105723Smrg	;;
412067610f1Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413067610f1Smrg	case `/usr/bin/uname -p` in
41458105723Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
41558105723Smrg	esac
41658105723Smrg	;;
4177e6533d5Smrg    s390x:SunOS:*:*)
41858105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
41958105723Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
42058105723Smrg	;;
421067610f1Smrg    sun4H:SunOS:5.*:*)
42258105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42358105723Smrg	GUESS=sparc-hal-solaris2$SUN_REL
42458105723Smrg	;;
425067610f1Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
42658105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42758105723Smrg	GUESS=sparc-sun-solaris2$SUN_REL
42858105723Smrg	;;
4297e6533d5Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
43058105723Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
43158105723Smrg	;;
432067610f1Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
43358105723Smrg	set_cc_for_build
4344d9306dbSmrg	SUN_ARCH=i386
4357e6533d5Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
4367e6533d5Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4377e6533d5Smrg	# This test works for both compilers.
43858105723Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
4397e6533d5Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4404d9306dbSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
4417e6533d5Smrg		grep IS_64BIT_ARCH >/dev/null
4427e6533d5Smrg	    then
4434d9306dbSmrg		SUN_ARCH=x86_64
4447e6533d5Smrg	    fi
4457e6533d5Smrg	fi
44658105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
44758105723Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
44858105723Smrg	;;
449067610f1Smrg    sun4*:SunOS:6*:*)
450067610f1Smrg	# According to config.sub, this is the proper way to canonicalize
451067610f1Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452067610f1Smrg	# it's likely to be more like Solaris than SunOS4.
45358105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
45458105723Smrg	GUESS=sparc-sun-solaris3$SUN_REL
45558105723Smrg	;;
456067610f1Smrg    sun4*:SunOS:*:*)
45758105723Smrg	case `/usr/bin/arch -k` in
458067610f1Smrg	    Series*|S4*)
459067610f1Smrg		UNAME_RELEASE=`uname -v`
460067610f1Smrg		;;
461067610f1Smrg	esac
462067610f1Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
46358105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
46458105723Smrg	GUESS=sparc-sun-sunos$SUN_REL
46558105723Smrg	;;
466067610f1Smrg    sun3*:SunOS:*:*)
46758105723Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
46858105723Smrg	;;
469067610f1Smrg    sun*:*:4.2BSD:*)
470067610f1Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4714d9306dbSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
47258105723Smrg	case `/bin/arch` in
473067610f1Smrg	    sun3)
47458105723Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475067610f1Smrg		;;
476067610f1Smrg	    sun4)
47758105723Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478067610f1Smrg		;;
479067610f1Smrg	esac
48058105723Smrg	;;
481067610f1Smrg    aushp:SunOS:*:*)
48258105723Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
48358105723Smrg	;;
484067610f1Smrg    # The situation for MiNT is a little confusing.  The machine name
485067610f1Smrg    # can be virtually everything (everything which is not
486067610f1Smrg    # "atarist" or "atariste" at least should have a processor
487067610f1Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488067610f1Smrg    # to the lowercase version "mint" (or "freemint").  Finally
489067610f1Smrg    # the system name "TOS" denotes a system which is actually not
490067610f1Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491067610f1Smrg    # be no problem.
492067610f1Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
49358105723Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49458105723Smrg	;;
495067610f1Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
49658105723Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49758105723Smrg	;;
498067610f1Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
49958105723Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
50058105723Smrg	;;
501067610f1Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
50258105723Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
50358105723Smrg	;;
504067610f1Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
50558105723Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
50658105723Smrg	;;
507067610f1Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
50858105723Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
50958105723Smrg	;;
510067610f1Smrg    m68k:machten:*:*)
51158105723Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
51258105723Smrg	;;
513067610f1Smrg    powerpc:machten:*:*)
51458105723Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
51558105723Smrg	;;
516067610f1Smrg    RISC*:Mach:*:*)
51758105723Smrg	GUESS=mips-dec-mach_bsd4.3
51858105723Smrg	;;
519067610f1Smrg    RISC*:ULTRIX:*:*)
52058105723Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
52158105723Smrg	;;
522067610f1Smrg    VAX*:ULTRIX*:*:*)
52358105723Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
52458105723Smrg	;;
525067610f1Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
52658105723Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
52758105723Smrg	;;
528067610f1Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
52958105723Smrg	set_cc_for_build
5304d9306dbSmrg	sed 's/^	//' << EOF > "$dummy.c"
531067610f1Smrg#ifdef __cplusplus
532067610f1Smrg#include <stdio.h>  /* for printf() prototype */
533067610f1Smrg	int main (int argc, char *argv[]) {
534067610f1Smrg#else
535067610f1Smrg	int main (argc, argv) int argc; char *argv[]; {
536067610f1Smrg#endif
537067610f1Smrg	#if defined (host_mips) && defined (MIPSEB)
538067610f1Smrg	#if defined (SYSTYPE_SYSV)
5394d9306dbSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540067610f1Smrg	#endif
541067610f1Smrg	#if defined (SYSTYPE_SVR4)
5424d9306dbSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543067610f1Smrg	#endif
544067610f1Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5454d9306dbSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546067610f1Smrg	#endif
547067610f1Smrg	#endif
548067610f1Smrg	  exit (-1);
549067610f1Smrg	}
550067610f1SmrgEOF
5514d9306dbSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5524d9306dbSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5534d9306dbSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554067610f1Smrg	    { echo "$SYSTEM_NAME"; exit; }
55558105723Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
55658105723Smrg	;;
557067610f1Smrg    Motorola:PowerMAX_OS:*:*)
55858105723Smrg	GUESS=powerpc-motorola-powermax
55958105723Smrg	;;
560067610f1Smrg    Motorola:*:4.3:PL8-*)
56158105723Smrg	GUESS=powerpc-harris-powermax
56258105723Smrg	;;
563067610f1Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
56458105723Smrg	GUESS=powerpc-harris-powermax
56558105723Smrg	;;
566067610f1Smrg    Night_Hawk:Power_UNIX:*:*)
56758105723Smrg	GUESS=powerpc-harris-powerunix
56858105723Smrg	;;
569067610f1Smrg    m88k:CX/UX:7*:*)
57058105723Smrg	GUESS=m88k-harris-cxux7
57158105723Smrg	;;
572067610f1Smrg    m88k:*:4*:R4*)
57358105723Smrg	GUESS=m88k-motorola-sysv4
57458105723Smrg	;;
575067610f1Smrg    m88k:*:3*:R3*)
57658105723Smrg	GUESS=m88k-motorola-sysv3
57758105723Smrg	;;
578067610f1Smrg    AViiON:dgux:*:*)
579aea1d7ffSmrg	# DG/UX returns AViiON for all architectures
580aea1d7ffSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
58158105723Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582067610f1Smrg	then
58358105723Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
58458105723Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
585067610f1Smrg	    then
58658105723Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587067610f1Smrg	    else
58858105723Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589067610f1Smrg	    fi
590067610f1Smrg	else
59158105723Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592067610f1Smrg	fi
59358105723Smrg	;;
594067610f1Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
59558105723Smrg	GUESS=m88k-dolphin-sysv3
59658105723Smrg	;;
597067610f1Smrg    M88*:*:R3*:*)
598067610f1Smrg	# Delta 88k system running SVR3
59958105723Smrg	GUESS=m88k-motorola-sysv3
60058105723Smrg	;;
601067610f1Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
60258105723Smrg	GUESS=m88k-tektronix-sysv3
60358105723Smrg	;;
604067610f1Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
60558105723Smrg	GUESS=m68k-tektronix-bsd
60658105723Smrg	;;
607067610f1Smrg    *:IRIX*:*:*)
60858105723Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
60958105723Smrg	GUESS=mips-sgi-irix$IRIX_REL
61058105723Smrg	;;
611067610f1Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
61258105723Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
61358105723Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614067610f1Smrg    i*86:AIX:*:*)
61558105723Smrg	GUESS=i386-ibm-aix
61658105723Smrg	;;
617067610f1Smrg    ia64:AIX:*:*)
61858105723Smrg	if test -x /usr/bin/oslevel ; then
619067610f1Smrg		IBM_REV=`/usr/bin/oslevel`
620067610f1Smrg	else
62158105723Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622067610f1Smrg	fi
62358105723Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
62458105723Smrg	;;
625067610f1Smrg    *:AIX:2:3)
626067610f1Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
62758105723Smrg		set_cc_for_build
6284d9306dbSmrg		sed 's/^		//' << EOF > "$dummy.c"
629067610f1Smrg		#include <sys/systemcfg.h>
630067610f1Smrg
631067610f1Smrg		main()
632067610f1Smrg			{
633067610f1Smrg			if (!__power_pc())
634067610f1Smrg				exit(1);
635067610f1Smrg			puts("powerpc-ibm-aix3.2.5");
636067610f1Smrg			exit(0);
637067610f1Smrg			}
638067610f1SmrgEOF
6394d9306dbSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640067610f1Smrg		then
64158105723Smrg			GUESS=$SYSTEM_NAME
642067610f1Smrg		else
64358105723Smrg			GUESS=rs6000-ibm-aix3.2.5
644067610f1Smrg		fi
645067610f1Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
64658105723Smrg		GUESS=rs6000-ibm-aix3.2.4
647067610f1Smrg	else
64858105723Smrg		GUESS=rs6000-ibm-aix3.2
649067610f1Smrg	fi
65058105723Smrg	;;
6517e6533d5Smrg    *:AIX:*:[4567])
652067610f1Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6534d9306dbSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654067610f1Smrg		IBM_ARCH=rs6000
655067610f1Smrg	else
656067610f1Smrg		IBM_ARCH=powerpc
657067610f1Smrg	fi
65858105723Smrg	if test -x /usr/bin/lslpp ; then
65958105723Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6604d9306dbSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661067610f1Smrg	else
66258105723Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663067610f1Smrg	fi
66458105723Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
66558105723Smrg	;;
666067610f1Smrg    *:AIX:*:*)
66758105723Smrg	GUESS=rs6000-ibm-aix
66858105723Smrg	;;
6694d9306dbSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
67058105723Smrg	GUESS=romp-ibm-bsd4.4
67158105723Smrg	;;
672067610f1Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
67358105723Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
67458105723Smrg	;;                                  # report: romp-ibm BSD 4.3
675067610f1Smrg    *:BOSX:*:*)
67658105723Smrg	GUESS=rs6000-bull-bosx
67758105723Smrg	;;
678067610f1Smrg    DPX/2?00:B.O.S.:*:*)
67958105723Smrg	GUESS=m68k-bull-sysv3
68058105723Smrg	;;
681067610f1Smrg    9000/[34]??:4.3bsd:1.*:*)
68258105723Smrg	GUESS=m68k-hp-bsd
68358105723Smrg	;;
684067610f1Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
68558105723Smrg	GUESS=m68k-hp-bsd4.4
68658105723Smrg	;;
687067610f1Smrg    9000/[34678]??:HP-UX:*:*)
68858105723Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
68958105723Smrg	case $UNAME_MACHINE in
6904d9306dbSmrg	    9000/31?)            HP_ARCH=m68000 ;;
6914d9306dbSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
692067610f1Smrg	    9000/[678][0-9][0-9])
69358105723Smrg		if test -x /usr/bin/getconf; then
694067610f1Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695aea1d7ffSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
69658105723Smrg		    case $sc_cpu_version in
6974d9306dbSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6984d9306dbSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699aea1d7ffSmrg		      532)                      # CPU_PA_RISC2_0
70058105723Smrg			case $sc_kernel_bits in
7014d9306dbSmrg			  32) HP_ARCH=hppa2.0n ;;
7024d9306dbSmrg			  64) HP_ARCH=hppa2.0w ;;
7034d9306dbSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704aea1d7ffSmrg			esac ;;
705aea1d7ffSmrg		    esac
706067610f1Smrg		fi
70758105723Smrg		if test "$HP_ARCH" = ""; then
70858105723Smrg		    set_cc_for_build
7094d9306dbSmrg		    sed 's/^		//' << EOF > "$dummy.c"
710067610f1Smrg
711aea1d7ffSmrg		#define _HPUX_SOURCE
712aea1d7ffSmrg		#include <stdlib.h>
713aea1d7ffSmrg		#include <unistd.h>
714067610f1Smrg
715aea1d7ffSmrg		int main ()
716aea1d7ffSmrg		{
717aea1d7ffSmrg		#if defined(_SC_KERNEL_BITS)
718aea1d7ffSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
719aea1d7ffSmrg		#endif
720aea1d7ffSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721067610f1Smrg
722aea1d7ffSmrg		    switch (cpu)
723aea1d7ffSmrg			{
724aea1d7ffSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725aea1d7ffSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726aea1d7ffSmrg			case CPU_PA_RISC2_0:
727aea1d7ffSmrg		#if defined(_SC_KERNEL_BITS)
728aea1d7ffSmrg			    switch (bits)
729aea1d7ffSmrg				{
730aea1d7ffSmrg				case 64: puts ("hppa2.0w"); break;
731aea1d7ffSmrg				case 32: puts ("hppa2.0n"); break;
732aea1d7ffSmrg				default: puts ("hppa2.0"); break;
733aea1d7ffSmrg				} break;
734aea1d7ffSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
735aea1d7ffSmrg			    puts ("hppa2.0"); break;
736aea1d7ffSmrg		#endif
737aea1d7ffSmrg			default: puts ("hppa1.0"); break;
738aea1d7ffSmrg			}
739aea1d7ffSmrg		    exit (0);
740aea1d7ffSmrg		}
741067610f1SmrgEOF
7424d9306dbSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743067610f1Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744067610f1Smrg		fi ;;
745067610f1Smrg	esac
74658105723Smrg	if test "$HP_ARCH" = hppa2.0w
747067610f1Smrg	then
74858105723Smrg	    set_cc_for_build
749067610f1Smrg
750067610f1Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751067610f1Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752067610f1Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753067610f1Smrg	    #
754067610f1Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
755067610f1Smrg	    # => hppa2.0w-hp-hpux11.23
756067610f1Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757067610f1Smrg	    # => hppa64-hp-hpux11.23
758067610f1Smrg
7594d9306dbSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7607e6533d5Smrg		grep -q __LP64__
761067610f1Smrg	    then
7624d9306dbSmrg		HP_ARCH=hppa2.0w
763067610f1Smrg	    else
7644d9306dbSmrg		HP_ARCH=hppa64
765067610f1Smrg	    fi
766067610f1Smrg	fi
76758105723Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
76858105723Smrg	;;
769067610f1Smrg    ia64:HP-UX:*:*)
77058105723Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
77158105723Smrg	GUESS=ia64-hp-hpux$HPUX_REV
77258105723Smrg	;;
773067610f1Smrg    3050*:HI-UX:*:*)
77458105723Smrg	set_cc_for_build
7754d9306dbSmrg	sed 's/^	//' << EOF > "$dummy.c"
776067610f1Smrg	#include <unistd.h>
777067610f1Smrg	int
778067610f1Smrg	main ()
779067610f1Smrg	{
780067610f1Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
781067610f1Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782067610f1Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783067610f1Smrg	     results, however.  */
784067610f1Smrg	  if (CPU_IS_PA_RISC (cpu))
785067610f1Smrg	    {
786067610f1Smrg	      switch (cpu)
787067610f1Smrg		{
788067610f1Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789067610f1Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790067610f1Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791067610f1Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792067610f1Smrg		}
793067610f1Smrg	    }
794067610f1Smrg	  else if (CPU_IS_HP_MC68K (cpu))
795067610f1Smrg	    puts ("m68k-hitachi-hiuxwe2");
796067610f1Smrg	  else puts ("unknown-hitachi-hiuxwe2");
797067610f1Smrg	  exit (0);
798067610f1Smrg	}
799067610f1SmrgEOF
8004d9306dbSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801067610f1Smrg		{ echo "$SYSTEM_NAME"; exit; }
80258105723Smrg	GUESS=unknown-hitachi-hiuxwe2
80358105723Smrg	;;
8044d9306dbSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
80558105723Smrg	GUESS=hppa1.1-hp-bsd
80658105723Smrg	;;
807067610f1Smrg    9000/8??:4.3bsd:*:*)
80858105723Smrg	GUESS=hppa1.0-hp-bsd
80958105723Smrg	;;
810067610f1Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
81158105723Smrg	GUESS=hppa1.0-hp-mpeix
81258105723Smrg	;;
8134d9306dbSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
81458105723Smrg	GUESS=hppa1.1-hp-osf
81558105723Smrg	;;
816067610f1Smrg    hp8??:OSF1:*:*)
81758105723Smrg	GUESS=hppa1.0-hp-osf
81858105723Smrg	;;
819067610f1Smrg    i*86:OSF1:*:*)
82058105723Smrg	if test -x /usr/sbin/sysversion ; then
82158105723Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822067610f1Smrg	else
82358105723Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824067610f1Smrg	fi
82558105723Smrg	;;
826067610f1Smrg    parisc*:Lites*:*:*)
82758105723Smrg	GUESS=hppa1.1-hp-lites
82858105723Smrg	;;
829067610f1Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
83058105723Smrg	GUESS=c1-convex-bsd
83158105723Smrg	;;
832067610f1Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833067610f1Smrg	if getsysinfo -f scalar_acc
834067610f1Smrg	then echo c32-convex-bsd
835067610f1Smrg	else echo c2-convex-bsd
836067610f1Smrg	fi
837aea1d7ffSmrg	exit ;;
838067610f1Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
83958105723Smrg	GUESS=c34-convex-bsd
84058105723Smrg	;;
841067610f1Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
84258105723Smrg	GUESS=c38-convex-bsd
84358105723Smrg	;;
844067610f1Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
84558105723Smrg	GUESS=c4-convex-bsd
84658105723Smrg	;;
847067610f1Smrg    CRAY*Y-MP:*:*:*)
84858105723Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
84958105723Smrg	GUESS=ymp-cray-unicos$CRAY_REL
85058105723Smrg	;;
851067610f1Smrg    CRAY*[A-Z]90:*:*:*)
8524d9306dbSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853067610f1Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854067610f1Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855067610f1Smrg	      -e 's/\.[^.]*$/.X/'
856067610f1Smrg	exit ;;
857067610f1Smrg    CRAY*TS:*:*:*)
85858105723Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
85958105723Smrg	GUESS=t90-cray-unicos$CRAY_REL
86058105723Smrg	;;
861067610f1Smrg    CRAY*T3E:*:*:*)
86258105723Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86358105723Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
86458105723Smrg	;;
865067610f1Smrg    CRAY*SV1:*:*:*)
86658105723Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86758105723Smrg	GUESS=sv1-cray-unicos$CRAY_REL
86858105723Smrg	;;
869067610f1Smrg    *:UNICOS/mp:*:*)
87058105723Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
87158105723Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
87258105723Smrg	;;
873067610f1Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8744d9306dbSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8754d9306dbSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8764d9306dbSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
87758105723Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
87858105723Smrg	;;
879067610f1Smrg    5000:UNIX_System_V:4.*:*)
8804d9306dbSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8814d9306dbSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
88258105723Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
88358105723Smrg	;;
884067610f1Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
88558105723Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
88658105723Smrg	;;
887067610f1Smrg    sparc*:BSD/OS:*:*)
88858105723Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
88958105723Smrg	;;
890067610f1Smrg    *:BSD/OS:*:*)
89158105723Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
89258105723Smrg	;;
89358105723Smrg    arm:FreeBSD:*:*)
89458105723Smrg	UNAME_PROCESSOR=`uname -p`
89558105723Smrg	set_cc_for_build
89658105723Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
89758105723Smrg	    | grep -q __ARM_PCS_VFP
89858105723Smrg	then
89958105723Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90058105723Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
90158105723Smrg	else
90258105723Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90358105723Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
90458105723Smrg	fi
90558105723Smrg	;;
906067610f1Smrg    *:FreeBSD:*:*)
907aea1d7ffSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
90858105723Smrg	case $UNAME_PROCESSOR in
909067610f1Smrg	    amd64)
9104d9306dbSmrg		UNAME_PROCESSOR=x86_64 ;;
9114d9306dbSmrg	    i386)
9124d9306dbSmrg		UNAME_PROCESSOR=i586 ;;
913067610f1Smrg	esac
91458105723Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
91558105723Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
91658105723Smrg	;;
917067610f1Smrg    i*:CYGWIN*:*)
91858105723Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
91958105723Smrg	;;
920e7fdea5fSmrg    *:MINGW64*:*)
92158105723Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
92258105723Smrg	;;
923067610f1Smrg    *:MINGW*:*)
92458105723Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
92558105723Smrg	;;
9264d9306dbSmrg    *:MSYS*:*)
92758105723Smrg	GUESS=$UNAME_MACHINE-pc-msys
92858105723Smrg	;;
929067610f1Smrg    i*:PW*:*)
93058105723Smrg	GUESS=$UNAME_MACHINE-pc-pw32
93158105723Smrg	;;
9327e6533d5Smrg    *:Interix*:*)
93358105723Smrg	case $UNAME_MACHINE in
934067610f1Smrg	    x86)
93558105723Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
93658105723Smrg		;;
9377e6533d5Smrg	    authenticamd | genuineintel | EM64T)
93858105723Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
93958105723Smrg		;;
940067610f1Smrg	    IA64)
94158105723Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
94258105723Smrg		;;
943067610f1Smrg	esac ;;
944067610f1Smrg    i*:UWIN*:*)
94558105723Smrg	GUESS=$UNAME_MACHINE-pc-uwin
94658105723Smrg	;;
947067610f1Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
94858105723Smrg	GUESS=x86_64-pc-cygwin
94958105723Smrg	;;
950067610f1Smrg    prep*:SunOS:5.*:*)
95158105723Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
95258105723Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
95358105723Smrg	;;
954067610f1Smrg    *:GNU:*:*)
955067610f1Smrg	# the GNU system
95658105723Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
95758105723Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
95858105723Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
95958105723Smrg	;;
960067610f1Smrg    *:GNU/*:*:*)
961067610f1Smrg	# other systems with GNU libc and userland
96258105723Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
96358105723Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
96458105723Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
96558105723Smrg	;;
96658105723Smrg    *:Minix:*:*)
96758105723Smrg	GUESS=$UNAME_MACHINE-unknown-minix
96858105723Smrg	;;
969e7fdea5fSmrg    aarch64:Linux:*:*)
97058105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97158105723Smrg	;;
972e7fdea5fSmrg    aarch64_be:Linux:*:*)
973e7fdea5fSmrg	UNAME_MACHINE=aarch64_be
97458105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97558105723Smrg	;;
9767e6533d5Smrg    alpha:Linux:*:*)
97758105723Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
9787e6533d5Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9797e6533d5Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9807e6533d5Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9817e6533d5Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9827e6533d5Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9837e6533d5Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9847e6533d5Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
985aea1d7ffSmrg	esac
9867e6533d5Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9874d9306dbSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
98858105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
98958105723Smrg	;;
99058105723Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
99158105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99258105723Smrg	;;
993067610f1Smrg    arm*:Linux:*:*)
99458105723Smrg	set_cc_for_build
995067610f1Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996067610f1Smrg	    | grep -q __ARM_EABI__
997067610f1Smrg	then
99858105723Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999067610f1Smrg	else
1000aea1d7ffSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001aea1d7ffSmrg		| grep -q __ARM_PCS_VFP
1002aea1d7ffSmrg	    then
100358105723Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004aea1d7ffSmrg	    else
100558105723Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006aea1d7ffSmrg	    fi
1007067610f1Smrg	fi
100858105723Smrg	;;
1009067610f1Smrg    avr32*:Linux:*:*)
101058105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
101158105723Smrg	;;
1012067610f1Smrg    cris:Linux:*:*)
101358105723Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101458105723Smrg	;;
1015067610f1Smrg    crisv32:Linux:*:*)
101658105723Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101758105723Smrg	;;
10184d9306dbSmrg    e2k:Linux:*:*)
101958105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102058105723Smrg	;;
1021067610f1Smrg    frv:Linux:*:*)
102258105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102358105723Smrg	;;
1024aea1d7ffSmrg    hexagon:Linux:*:*)
102558105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102658105723Smrg	;;
10277e6533d5Smrg    i*86:Linux:*:*)
102858105723Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
102958105723Smrg	;;
1030067610f1Smrg    ia64:Linux:*:*)
103158105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103258105723Smrg	;;
10334d9306dbSmrg    k1om:Linux:*:*)
103458105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103558105723Smrg	;;
103658105723Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
103758105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103858105723Smrg	;;
1039067610f1Smrg    m32r*:Linux:*:*)
104058105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104158105723Smrg	;;
1042067610f1Smrg    m68*:Linux:*:*)
104358105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104458105723Smrg	;;
10457e6533d5Smrg    mips:Linux:*:* | mips64:Linux:*:*)
104658105723Smrg	set_cc_for_build
104758105723Smrg	IS_GLIBC=0
104858105723Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10494d9306dbSmrg	sed 's/^	//' << EOF > "$dummy.c"
1050067610f1Smrg	#undef CPU
105158105723Smrg	#undef mips
105258105723Smrg	#undef mipsel
105358105723Smrg	#undef mips64
105458105723Smrg	#undef mips64el
105558105723Smrg	#if ${IS_GLIBC} && defined(_ABI64)
105658105723Smrg	LIBCABI=gnuabi64
105758105723Smrg	#else
105858105723Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
105958105723Smrg	LIBCABI=gnuabin32
106058105723Smrg	#else
106158105723Smrg	LIBCABI=${LIBC}
106258105723Smrg	#endif
106358105723Smrg	#endif
106458105723Smrg
106558105723Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106658105723Smrg	CPU=mipsisa64r6
106758105723Smrg	#else
106858105723Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106958105723Smrg	CPU=mipsisa32r6
107058105723Smrg	#else
107158105723Smrg	#if defined(__mips64)
107258105723Smrg	CPU=mips64
107358105723Smrg	#else
107458105723Smrg	CPU=mips
107558105723Smrg	#endif
107658105723Smrg	#endif
107758105723Smrg	#endif
107858105723Smrg
1079067610f1Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
108058105723Smrg	MIPS_ENDIAN=el
1081067610f1Smrg	#else
1082067610f1Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
108358105723Smrg	MIPS_ENDIAN=
1084067610f1Smrg	#else
108558105723Smrg	MIPS_ENDIAN=
1086067610f1Smrg	#endif
1087067610f1Smrg	#endif
1088067610f1SmrgEOF
108958105723Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
109058105723Smrg	eval "$cc_set_vars"
109158105723Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092067610f1Smrg	;;
10934d9306dbSmrg    mips64el:Linux:*:*)
109458105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
109558105723Smrg	;;
10964d9306dbSmrg    openrisc*:Linux:*:*)
109758105723Smrg	GUESS=or1k-unknown-linux-$LIBC
109858105723Smrg	;;
10994d9306dbSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
110058105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
110158105723Smrg	;;
11027e6533d5Smrg    padre:Linux:*:*)
110358105723Smrg	GUESS=sparc-unknown-linux-$LIBC
110458105723Smrg	;;
11057e6533d5Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
110658105723Smrg	GUESS=hppa64-unknown-linux-$LIBC
110758105723Smrg	;;
1108067610f1Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
1109067610f1Smrg	# Look for CPU level
1110067610f1Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
111158105723Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
111258105723Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
111358105723Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1114067610f1Smrg	esac
111558105723Smrg	;;
11167e6533d5Smrg    ppc64:Linux:*:*)
111758105723Smrg	GUESS=powerpc64-unknown-linux-$LIBC
111858105723Smrg	;;
11197e6533d5Smrg    ppc:Linux:*:*)
112058105723Smrg	GUESS=powerpc-unknown-linux-$LIBC
112158105723Smrg	;;
1122e7fdea5fSmrg    ppc64le:Linux:*:*)
112358105723Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
112458105723Smrg	;;
1125e7fdea5fSmrg    ppcle:Linux:*:*)
112658105723Smrg	GUESS=powerpcle-unknown-linux-$LIBC
112758105723Smrg	;;
112858105723Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
112958105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113058105723Smrg	;;
1131067610f1Smrg    s390:Linux:*:* | s390x:Linux:*:*)
113258105723Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
113358105723Smrg	;;
1134067610f1Smrg    sh64*:Linux:*:*)
113558105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113658105723Smrg	;;
1137067610f1Smrg    sh*:Linux:*:*)
113858105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113958105723Smrg	;;
1140067610f1Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
114158105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114258105723Smrg	;;
11437e6533d5Smrg    tile*:Linux:*:*)
114458105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114558105723Smrg	;;
1146067610f1Smrg    vax:Linux:*:*)
114758105723Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
114858105723Smrg	;;
1149067610f1Smrg    x86_64:Linux:*:*)
115058105723Smrg	set_cc_for_build
115158105723Smrg	LIBCABI=$LIBC
115258105723Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
115358105723Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
115458105723Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
115558105723Smrg		grep IS_X32 >/dev/null
115658105723Smrg	    then
115758105723Smrg		LIBCABI=${LIBC}x32
115858105723Smrg	    fi
115958105723Smrg	fi
116058105723Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
116158105723Smrg	;;
1162067610f1Smrg    xtensa*:Linux:*:*)
116358105723Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
116458105723Smrg	;;
1165067610f1Smrg    i*86:DYNIX/ptx:4*:*)
1166067610f1Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1167067610f1Smrg	# earlier versions are messed up and put the nodename in both
1168067610f1Smrg	# sysname and nodename.
116958105723Smrg	GUESS=i386-sequent-sysv4
117058105723Smrg	;;
1171067610f1Smrg    i*86:UNIX_SV:4.2MP:2.*)
1172aea1d7ffSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1173aea1d7ffSmrg	# number series starting with 2...
1174aea1d7ffSmrg	# I am not positive that other SVR4 systems won't match this,
1175067610f1Smrg	# I just have to hope.  -- rms.
1176aea1d7ffSmrg	# Use sysv4.2uw... so that sysv4* matches it.
117758105723Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
117858105723Smrg	;;
1179067610f1Smrg    i*86:OS/2:*:*)
1180067610f1Smrg	# If we were able to find `uname', then EMX Unix compatibility
1181067610f1Smrg	# is probably installed.
118258105723Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
118358105723Smrg	;;
1184067610f1Smrg    i*86:XTS-300:*:STOP)
118558105723Smrg	GUESS=$UNAME_MACHINE-unknown-stop
118658105723Smrg	;;
1187067610f1Smrg    i*86:atheos:*:*)
118858105723Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
118958105723Smrg	;;
1190067610f1Smrg    i*86:syllable:*:*)
119158105723Smrg	GUESS=$UNAME_MACHINE-pc-syllable
119258105723Smrg	;;
11937e6533d5Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
119458105723Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
119558105723Smrg	;;
1196067610f1Smrg    i*86:*DOS:*:*)
119758105723Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
119858105723Smrg	;;
11994d9306dbSmrg    i*86:*:4.*:*)
12004d9306dbSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1201067610f1Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
120258105723Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1203067610f1Smrg	else
120458105723Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1205067610f1Smrg	fi
120658105723Smrg	;;
1207067610f1Smrg    i*86:*:5:[678]*)
1208aea1d7ffSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1209067610f1Smrg	case `/bin/uname -X | grep "^Machine"` in
1210067610f1Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1211067610f1Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1212067610f1Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1213067610f1Smrg	esac
121458105723Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
121558105723Smrg	;;
1216067610f1Smrg    i*86:*:3.2:*)
1217067610f1Smrg	if test -f /usr/options/cb.name; then
1218067610f1Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
121958105723Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1220067610f1Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1221067610f1Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1222067610f1Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1223067610f1Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1224067610f1Smrg			&& UNAME_MACHINE=i586
1225067610f1Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1226067610f1Smrg			&& UNAME_MACHINE=i686
1227067610f1Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1228067610f1Smrg			&& UNAME_MACHINE=i686
122958105723Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1230067610f1Smrg	else
123158105723Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
1232067610f1Smrg	fi
123358105723Smrg	;;
1234067610f1Smrg    pc:*:*:*)
1235067610f1Smrg	# Left here for compatibility:
1236aea1d7ffSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1237aea1d7ffSmrg	# the processor, so we play safe by assuming i586.
12387e6533d5Smrg	# Note: whatever this is, it MUST be the same as what config.sub
12394d9306dbSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
12407e6533d5Smrg	# this is a cross-build.
124158105723Smrg	GUESS=i586-pc-msdosdjgpp
124258105723Smrg	;;
1243067610f1Smrg    Intel:Mach:3*:*)
124458105723Smrg	GUESS=i386-pc-mach3
124558105723Smrg	;;
1246067610f1Smrg    paragon:*:*:*)
124758105723Smrg	GUESS=i860-intel-osf1
124858105723Smrg	;;
1249067610f1Smrg    i860:*:4.*:*) # i860-SVR4
1250067610f1Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
125158105723Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1252067610f1Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
125358105723Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1254067610f1Smrg	fi
125558105723Smrg	;;
1256067610f1Smrg    mini*:CTIX:SYS*5:*)
1257067610f1Smrg	# "miniframe"
125858105723Smrg	GUESS=m68010-convergent-sysv
125958105723Smrg	;;
1260067610f1Smrg    mc68k:UNIX:SYSTEM5:3.51m)
126158105723Smrg	GUESS=m68k-convergent-sysv
126258105723Smrg	;;
1263067610f1Smrg    M680?0:D-NIX:5.3:*)
126458105723Smrg	GUESS=m68k-diab-dnix
126558105723Smrg	;;
1266067610f1Smrg    M68*:*:R3V[5678]*:*)
1267067610f1Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1268067610f1Smrg    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)
1269067610f1Smrg	OS_REL=''
1270067610f1Smrg	test -r /etc/.relid \
1271067610f1Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1272067610f1Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12734d9306dbSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1274067610f1Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12754d9306dbSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1276067610f1Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277aea1d7ffSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278aea1d7ffSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
12797e6533d5Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
12807e6533d5Smrg	OS_REL='.3'
12817e6533d5Smrg	test -r /etc/.relid \
12827e6533d5Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12837e6533d5Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12844d9306dbSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12857e6533d5Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12864d9306dbSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
12877e6533d5Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12884d9306dbSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1289067610f1Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
129058105723Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
129158105723Smrg	;;
1292067610f1Smrg    mc68030:UNIX_System_V:4.*:*)
129358105723Smrg	GUESS=m68k-atari-sysv4
129458105723Smrg	;;
1295067610f1Smrg    TSUNAMI:LynxOS:2.*:*)
129658105723Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
129758105723Smrg	;;
1298067610f1Smrg    rs6000:LynxOS:2.*:*)
129958105723Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
130058105723Smrg	;;
13017e6533d5Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
130258105723Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
130358105723Smrg	;;
1304067610f1Smrg    SM[BE]S:UNIX_SV:*:*)
130558105723Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
130658105723Smrg	;;
1307067610f1Smrg    RM*:ReliantUNIX-*:*:*)
130858105723Smrg	GUESS=mips-sni-sysv4
130958105723Smrg	;;
1310067610f1Smrg    RM*:SINIX-*:*:*)
131158105723Smrg	GUESS=mips-sni-sysv4
131258105723Smrg	;;
1313067610f1Smrg    *:SINIX-*:*:*)
1314067610f1Smrg	if uname -p 2>/dev/null >/dev/null ; then
1315067610f1Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
131658105723Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
1317067610f1Smrg	else
131858105723Smrg		GUESS=ns32k-sni-sysv
1319067610f1Smrg	fi
132058105723Smrg	;;
1321aea1d7ffSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322aea1d7ffSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
132358105723Smrg	GUESS=i586-unisys-sysv4
132458105723Smrg	;;
1325067610f1Smrg    *:UNIX_System_V:4*:FTX*)
1326067610f1Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1327067610f1Smrg	# How about differentiating between stratus architectures? -djm
132858105723Smrg	GUESS=hppa1.1-stratus-sysv4
132958105723Smrg	;;
1330067610f1Smrg    *:*:*:FTX*)
1331067610f1Smrg	# From seanf@swdc.stratus.com.
133258105723Smrg	GUESS=i860-stratus-sysv4
133358105723Smrg	;;
1334067610f1Smrg    i*86:VOS:*:*)
1335067610f1Smrg	# From Paul.Green@stratus.com.
133658105723Smrg	GUESS=$UNAME_MACHINE-stratus-vos
133758105723Smrg	;;
1338067610f1Smrg    *:VOS:*:*)
1339067610f1Smrg	# From Paul.Green@stratus.com.
134058105723Smrg	GUESS=hppa1.1-stratus-vos
134158105723Smrg	;;
1342067610f1Smrg    mc68*:A/UX:*:*)
134358105723Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
134458105723Smrg	;;
1345067610f1Smrg    news*:NEWS-OS:6*:*)
134658105723Smrg	GUESS=mips-sony-newsos6
134758105723Smrg	;;
1348067610f1Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
134958105723Smrg	if test -d /usr/nec; then
135058105723Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1351067610f1Smrg	else
135258105723Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1353067610f1Smrg	fi
135458105723Smrg	;;
1355067610f1Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
135658105723Smrg	GUESS=powerpc-be-beos
135758105723Smrg	;;
1358067610f1Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
135958105723Smrg	GUESS=powerpc-apple-beos
136058105723Smrg	;;
1361067610f1Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
136258105723Smrg	GUESS=i586-pc-beos
136358105723Smrg	;;
13647e6533d5Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
136558105723Smrg	GUESS=i586-pc-haiku
136658105723Smrg	;;
1367e7fdea5fSmrg    x86_64:Haiku:*:*)
136858105723Smrg	GUESS=x86_64-unknown-haiku
136958105723Smrg	;;
1370067610f1Smrg    SX-4:SUPER-UX:*:*)
137158105723Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
137258105723Smrg	;;
1373067610f1Smrg    SX-5:SUPER-UX:*:*)
137458105723Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
137558105723Smrg	;;
1376067610f1Smrg    SX-6:SUPER-UX:*:*)
137758105723Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
137858105723Smrg	;;
1379067610f1Smrg    SX-7:SUPER-UX:*:*)
138058105723Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
138158105723Smrg	;;
1382067610f1Smrg    SX-8:SUPER-UX:*:*)
138358105723Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
138458105723Smrg	;;
1385067610f1Smrg    SX-8R:SUPER-UX:*:*)
138658105723Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
138758105723Smrg	;;
13884d9306dbSmrg    SX-ACE:SUPER-UX:*:*)
138958105723Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
139058105723Smrg	;;
1391067610f1Smrg    Power*:Rhapsody:*:*)
139258105723Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
139358105723Smrg	;;
1394067610f1Smrg    *:Rhapsody:*:*)
139558105723Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
139658105723Smrg	;;
139758105723Smrg    arm64:Darwin:*:*)
139858105723Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
139958105723Smrg	;;
1400067610f1Smrg    *:Darwin:*:*)
140158105723Smrg	UNAME_PROCESSOR=`uname -p`
140258105723Smrg	case $UNAME_PROCESSOR in
140358105723Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
140458105723Smrg	esac
140558105723Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
140658105723Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
140758105723Smrg	    # Avoid executing cc if there is no toolchain installed as
140858105723Smrg	    # cc will be a stub that puts up a graphical alert
140958105723Smrg	    # prompting the user to install developer tools.
141058105723Smrg	    CC_FOR_BUILD=no_compiler_found
141158105723Smrg	else
141258105723Smrg	    set_cc_for_build
1413e7fdea5fSmrg	fi
141458105723Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
141558105723Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
141658105723Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
141758105723Smrg		   grep IS_64BIT_ARCH >/dev/null
141858105723Smrg	    then
141958105723Smrg		case $UNAME_PROCESSOR in
142058105723Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
142158105723Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
142258105723Smrg		esac
142358105723Smrg	    fi
142458105723Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
142558105723Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
142658105723Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
142758105723Smrg		   grep IS_PPC >/dev/null
142858105723Smrg	    then
142958105723Smrg		UNAME_PROCESSOR=powerpc
1430e7fdea5fSmrg	    fi
1431e7fdea5fSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
143258105723Smrg	    # uname -m returns i386 or x86_64
143358105723Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1434e7fdea5fSmrg	fi
143558105723Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
143658105723Smrg	;;
1437067610f1Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1438067610f1Smrg	UNAME_PROCESSOR=`uname -p`
14394d9306dbSmrg	if test "$UNAME_PROCESSOR" = x86; then
1440067610f1Smrg		UNAME_PROCESSOR=i386
1441067610f1Smrg		UNAME_MACHINE=pc
1442067610f1Smrg	fi
144358105723Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
144458105723Smrg	;;
1445067610f1Smrg    *:QNX:*:4*)
144658105723Smrg	GUESS=i386-pc-qnx
144758105723Smrg	;;
14484d9306dbSmrg    NEO-*:NONSTOP_KERNEL:*:*)
144958105723Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
145058105723Smrg	;;
1451e7fdea5fSmrg    NSE-*:NONSTOP_KERNEL:*:*)
145258105723Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
145358105723Smrg	;;
14544d9306dbSmrg    NSR-*:NONSTOP_KERNEL:*:*)
145558105723Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
145658105723Smrg	;;
14574d9306dbSmrg    NSV-*:NONSTOP_KERNEL:*:*)
145858105723Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
145958105723Smrg	;;
14604d9306dbSmrg    NSX-*:NONSTOP_KERNEL:*:*)
146158105723Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
146258105723Smrg	;;
1463067610f1Smrg    *:NonStop-UX:*:*)
146458105723Smrg	GUESS=mips-compaq-nonstopux
146558105723Smrg	;;
1466067610f1Smrg    BS2000:POSIX*:*:*)
146758105723Smrg	GUESS=bs2000-siemens-sysv
146858105723Smrg	;;
1469067610f1Smrg    DS/*:UNIX_System_V:*:*)
147058105723Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
147158105723Smrg	;;
1472067610f1Smrg    *:Plan9:*:*)
1473067610f1Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1474067610f1Smrg	# is converted to i386 for consistency with other x86
1475067610f1Smrg	# operating systems.
147658105723Smrg	if test "${cputype-}" = 386; then
1477067610f1Smrg	    UNAME_MACHINE=i386
147858105723Smrg	elif test "x${cputype-}" != x; then
147958105723Smrg	    UNAME_MACHINE=$cputype
1480067610f1Smrg	fi
148158105723Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
148258105723Smrg	;;
1483067610f1Smrg    *:TOPS-10:*:*)
148458105723Smrg	GUESS=pdp10-unknown-tops10
148558105723Smrg	;;
1486067610f1Smrg    *:TENEX:*:*)
148758105723Smrg	GUESS=pdp10-unknown-tenex
148858105723Smrg	;;
1489067610f1Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
149058105723Smrg	GUESS=pdp10-dec-tops20
149158105723Smrg	;;
1492067610f1Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
149358105723Smrg	GUESS=pdp10-xkl-tops20
149458105723Smrg	;;
1495067610f1Smrg    *:TOPS-20:*:*)
149658105723Smrg	GUESS=pdp10-unknown-tops20
149758105723Smrg	;;
1498067610f1Smrg    *:ITS:*:*)
149958105723Smrg	GUESS=pdp10-unknown-its
150058105723Smrg	;;
1501067610f1Smrg    SEI:*:*:SEIUX)
150258105723Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
150358105723Smrg	;;
1504067610f1Smrg    *:DragonFly:*:*)
150558105723Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
150658105723Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
150758105723Smrg	;;
1508067610f1Smrg    *:*VMS:*:*)
1509aea1d7ffSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
151058105723Smrg	case $UNAME_MACHINE in
151158105723Smrg	    A*) GUESS=alpha-dec-vms ;;
151258105723Smrg	    I*) GUESS=ia64-dec-vms ;;
151358105723Smrg	    V*) GUESS=vax-dec-vms ;;
1514067610f1Smrg	esac ;;
1515067610f1Smrg    *:XENIX:*:SysV)
151658105723Smrg	GUESS=i386-pc-xenix
151758105723Smrg	;;
1518067610f1Smrg    i*86:skyos:*:*)
151958105723Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
152058105723Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
152158105723Smrg	;;
1522067610f1Smrg    i*86:rdos:*:*)
152358105723Smrg	GUESS=$UNAME_MACHINE-pc-rdos
152458105723Smrg	;;
152558105723Smrg    *:AROS:*:*)
152658105723Smrg	GUESS=$UNAME_MACHINE-unknown-aros
152758105723Smrg	;;
1528e7fdea5fSmrg    x86_64:VMkernel:*:*)
152958105723Smrg	GUESS=$UNAME_MACHINE-unknown-esx
153058105723Smrg	;;
15314d9306dbSmrg    amd64:Isilon\ OneFS:*:*)
153258105723Smrg	GUESS=x86_64-unknown-onefs
153358105723Smrg	;;
153458105723Smrg    *:Unleashed:*:*)
153558105723Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
153658105723Smrg	;;
1537067610f1Smrgesac
1538067610f1Smrg
153958105723Smrg# Do we have a guess based on uname results?
154058105723Smrgif test "x$GUESS" != x; then
154158105723Smrg    echo "$GUESS"
154258105723Smrg    exit
154358105723Smrgfi
154458105723Smrg
154558105723Smrg# No uname command or uname output not recognized.
154658105723Smrgset_cc_for_build
154758105723Smrgcat > "$dummy.c" <<EOF
154858105723Smrg#ifdef _SEQUENT_
154958105723Smrg#include <sys/types.h>
155058105723Smrg#include <sys/utsname.h>
155158105723Smrg#endif
155258105723Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
155358105723Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
155458105723Smrg#include <signal.h>
155558105723Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
155658105723Smrg#include <sys/utsname.h>
155758105723Smrg#endif
155858105723Smrg#endif
155958105723Smrg#endif
156058105723Smrgmain ()
156158105723Smrg{
156258105723Smrg#if defined (sony)
156358105723Smrg#if defined (MIPSEB)
156458105723Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
156558105723Smrg     I don't know....  */
156658105723Smrg  printf ("mips-sony-bsd\n"); exit (0);
156758105723Smrg#else
156858105723Smrg#include <sys/param.h>
156958105723Smrg  printf ("m68k-sony-newsos%s\n",
157058105723Smrg#ifdef NEWSOS4
157158105723Smrg  "4"
157258105723Smrg#else
157358105723Smrg  ""
157458105723Smrg#endif
157558105723Smrg  ); exit (0);
157658105723Smrg#endif
157758105723Smrg#endif
157858105723Smrg
157958105723Smrg#if defined (NeXT)
158058105723Smrg#if !defined (__ARCHITECTURE__)
158158105723Smrg#define __ARCHITECTURE__ "m68k"
158258105723Smrg#endif
158358105723Smrg  int version;
158458105723Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
158558105723Smrg  if (version < 4)
158658105723Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
158758105723Smrg  else
158858105723Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
158958105723Smrg  exit (0);
159058105723Smrg#endif
159158105723Smrg
159258105723Smrg#if defined (MULTIMAX) || defined (n16)
159358105723Smrg#if defined (UMAXV)
159458105723Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
159558105723Smrg#else
159658105723Smrg#if defined (CMU)
159758105723Smrg  printf ("ns32k-encore-mach\n"); exit (0);
159858105723Smrg#else
159958105723Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
160058105723Smrg#endif
160158105723Smrg#endif
160258105723Smrg#endif
160358105723Smrg
160458105723Smrg#if defined (__386BSD__)
160558105723Smrg  printf ("i386-pc-bsd\n"); exit (0);
160658105723Smrg#endif
160758105723Smrg
160858105723Smrg#if defined (sequent)
160958105723Smrg#if defined (i386)
161058105723Smrg  printf ("i386-sequent-dynix\n"); exit (0);
161158105723Smrg#endif
161258105723Smrg#if defined (ns32000)
161358105723Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
161458105723Smrg#endif
161558105723Smrg#endif
161658105723Smrg
161758105723Smrg#if defined (_SEQUENT_)
161858105723Smrg  struct utsname un;
161958105723Smrg
162058105723Smrg  uname(&un);
162158105723Smrg  if (strncmp(un.version, "V2", 2) == 0) {
162258105723Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
162358105723Smrg  }
162458105723Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
162558105723Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
162658105723Smrg  }
162758105723Smrg  printf ("i386-sequent-ptx\n"); exit (0);
162858105723Smrg#endif
162958105723Smrg
163058105723Smrg#if defined (vax)
163158105723Smrg#if !defined (ultrix)
163258105723Smrg#include <sys/param.h>
163358105723Smrg#if defined (BSD)
163458105723Smrg#if BSD == 43
163558105723Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
163658105723Smrg#else
163758105723Smrg#if BSD == 199006
163858105723Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
163958105723Smrg#else
164058105723Smrg  printf ("vax-dec-bsd\n"); exit (0);
164158105723Smrg#endif
164258105723Smrg#endif
164358105723Smrg#else
164458105723Smrg  printf ("vax-dec-bsd\n"); exit (0);
164558105723Smrg#endif
164658105723Smrg#else
164758105723Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
164858105723Smrg  struct utsname un;
164958105723Smrg  uname (&un);
165058105723Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
165158105723Smrg#else
165258105723Smrg  printf ("vax-dec-ultrix\n"); exit (0);
165358105723Smrg#endif
165458105723Smrg#endif
165558105723Smrg#endif
165658105723Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
165758105723Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
165858105723Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
165958105723Smrg  struct utsname *un;
166058105723Smrg  uname (&un);
166158105723Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
166258105723Smrg#else
166358105723Smrg  printf ("mips-dec-ultrix\n"); exit (0);
166458105723Smrg#endif
166558105723Smrg#endif
166658105723Smrg#endif
166758105723Smrg
166858105723Smrg#if defined (alliant) && defined (i860)
166958105723Smrg  printf ("i860-alliant-bsd\n"); exit (0);
167058105723Smrg#endif
167158105723Smrg
167258105723Smrg  exit (1);
167358105723Smrg}
167458105723SmrgEOF
167558105723Smrg
167658105723Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
167758105723Smrg	{ echo "$SYSTEM_NAME"; exit; }
167858105723Smrg
167958105723Smrg# Apollos put the system type in the environment.
168058105723Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
168158105723Smrg
16824d9306dbSmrgecho "$0: unable to guess system type" >&2
1683067610f1Smrg
168458105723Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
16854d9306dbSmrg    mips:Linux | mips64:Linux)
16864d9306dbSmrg	# If we got here on MIPS GNU/Linux, output extra information.
16874d9306dbSmrg	cat >&2 <<EOF
1688067610f1Smrg
16894d9306dbSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
16904d9306dbSmrgthe system type. Please install a C compiler and try again.
1691067610f1SmrgEOF
16924d9306dbSmrg	;;
16934d9306dbSmrgesac
1694067610f1Smrg
1695067610f1Smrgcat >&2 <<EOF
1696067610f1Smrg
16974d9306dbSmrgThis script (version $timestamp), has failed to recognize the
16984d9306dbSmrgoperating system you are using. If your script is old, overwrite *all*
16994d9306dbSmrgcopies of config.guess and config.sub with the latest versions from:
1700067610f1Smrg
170158105723Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1702067610f1Smrgand
170358105723Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
170458105723SmrgEOF
170558105723Smrg
170658105723Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
170758105723Smrgthisyear=`date +%Y`
170858105723Smrg# shellcheck disable=SC2003
170958105723Smrgscript_age=`expr "$thisyear" - "$our_year"`
171058105723Smrgif test "$script_age" -lt 3 ; then
171158105723Smrg   cat >&2 <<EOF
1712067610f1Smrg
17134d9306dbSmrgIf $0 has already been updated, send the following data and any
17144d9306dbSmrginformation you think might be pertinent to config-patches@gnu.org to
17154d9306dbSmrgprovide the necessary information to handle your system.
1716067610f1Smrg
1717067610f1Smrgconfig.guess timestamp = $timestamp
1718067610f1Smrg
1719067610f1Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1720067610f1Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1721067610f1Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1722067610f1Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1723067610f1Smrg
1724067610f1Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1725067610f1Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1726067610f1Smrg
1727067610f1Smrghostinfo               = `(hostinfo) 2>/dev/null`
1728067610f1Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1729067610f1Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1730067610f1Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1731067610f1Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1732067610f1Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1733067610f1Smrg
17344d9306dbSmrgUNAME_MACHINE = "$UNAME_MACHINE"
17354d9306dbSmrgUNAME_RELEASE = "$UNAME_RELEASE"
17364d9306dbSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
17374d9306dbSmrgUNAME_VERSION = "$UNAME_VERSION"
1738067610f1SmrgEOF
173958105723Smrgfi
1740067610f1Smrg
1741067610f1Smrgexit 1
1742067610f1Smrg
1743067610f1Smrg# Local variables:
174458105723Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1745067610f1Smrg# time-stamp-start: "timestamp='"
1746067610f1Smrg# time-stamp-format: "%:y-%02m-%02d"
1747067610f1Smrg# time-stamp-end: "'"
1748067610f1Smrg# End:
1749