config.guess revision a67f45c3
176910425Smrg#! /bin/sh
276910425Smrg# Attempt to guess a canonical system name.
3a67f45c3Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
476910425Smrg
5a67f45c3Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6a67f45c3Smrg
7a67f45c3Smrgtimestamp='2021-06-03'
876910425Smrg
976910425Smrg# This file is free software; you can redistribute it and/or modify it
1076910425Smrg# under the terms of the GNU General Public License as published by
119ff100acSmrg# the Free Software Foundation; either version 3 of the License, or
1276910425Smrg# (at your option) any later version.
1376910425Smrg#
1476910425Smrg# This program is distributed in the hope that it will be useful, but
1576910425Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1676910425Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1776910425Smrg# General Public License for more details.
1876910425Smrg#
1976910425Smrg# You should have received a copy of the GNU General Public License
20a67f45c3Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2176910425Smrg#
2276910425Smrg# As a special exception to the GNU General Public License, if you
2376910425Smrg# distribute this file as part of a program that contains a
2476910425Smrg# configuration script generated by Autoconf, you may include it under
259ff100acSmrg# the same distribution terms that you use for the rest of that
269ff100acSmrg# program.  This Exception is an additional permission under section 7
279ff100acSmrg# of the GNU General Public License, version 3 ("GPLv3").
2876910425Smrg#
299ff100acSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3076910425Smrg#
31482df631Smrg# You can get the latest version of this script from:
32a67f45c3Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
339ff100acSmrg#
349ff100acSmrg# Please send patches to <config-patches@gnu.org>.
359ff100acSmrg
3676910425Smrg
37a67f45c3Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38a67f45c3Smrg# about features and limitations of the classic Bourne shell that were
39a67f45c3Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40a67f45c3Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41a67f45c3Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42a67f45c3Smrg# have a pre-POSIX /bin/sh.
43a67f45c3Smrg
44a67f45c3Smrg
4576910425Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4676910425Smrg
4776910425Smrgusage="\
4876910425SmrgUsage: $0 [OPTION]
4976910425Smrg
5076910425SmrgOutput the configuration name of the system \`$me' is run on.
5176910425Smrg
52a67f45c3SmrgOptions:
5376910425Smrg  -h, --help         print this help, then exit
5476910425Smrg  -t, --time-stamp   print date of last modification, then exit
5576910425Smrg  -v, --version      print version number, then exit
5676910425Smrg
5776910425SmrgReport bugs and patches to <config-patches@gnu.org>."
5876910425Smrg
5976910425Smrgversion="\
6076910425SmrgGNU config.guess ($timestamp)
6176910425Smrg
6276910425SmrgOriginally written by Per Bothner.
63a67f45c3SmrgCopyright 1992-2021 Free Software Foundation, Inc.
6476910425Smrg
6576910425SmrgThis is free software; see the source for copying conditions.  There is NO
6676910425Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6776910425Smrg
6876910425Smrghelp="
6976910425SmrgTry \`$me --help' for more information."
7076910425Smrg
7176910425Smrg# Parse command line
7276910425Smrgwhile test $# -gt 0 ; do
7376910425Smrg  case $1 in
7476910425Smrg    --time-stamp | --time* | -t )
7576910425Smrg       echo "$timestamp" ; exit ;;
7676910425Smrg    --version | -v )
7776910425Smrg       echo "$version" ; exit ;;
7876910425Smrg    --help | --h* | -h )
7976910425Smrg       echo "$usage"; exit ;;
8076910425Smrg    -- )     # Stop option processing
8176910425Smrg       shift; break ;;
8276910425Smrg    - )	# Use stdin as input.
8376910425Smrg       break ;;
8476910425Smrg    -* )
8576910425Smrg       echo "$me: invalid option $1$help" >&2
8676910425Smrg       exit 1 ;;
8776910425Smrg    * )
8876910425Smrg       break ;;
8976910425Smrg  esac
9076910425Smrgdone
9176910425Smrg
9276910425Smrgif test $# != 0; then
9376910425Smrg  echo "$me: too many arguments$help" >&2
9476910425Smrg  exit 1
9576910425Smrgfi
9676910425Smrg
97a67f45c3Smrg# Just in case it came from the environment.
98a67f45c3SmrgGUESS=
9976910425Smrg
10076910425Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
10176910425Smrg# compiler to aid in system detection is discouraged as it requires
10276910425Smrg# temporary files to be created and, as you can see below, it is a
10376910425Smrg# headache to deal with in a portable fashion.
10476910425Smrg
10576910425Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10676910425Smrg# use `HOST_CC' if defined, but it is deprecated.
10776910425Smrg
10876910425Smrg# Portable tmp directory creation inspired by the Autoconf team.
10976910425Smrg
110a67f45c3Smrgtmp=
111a67f45c3Smrg# shellcheck disable=SC2172
112a67f45c3Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113a67f45c3Smrg
114a67f45c3Smrgset_cc_for_build() {
115a67f45c3Smrg    # prevent multiple calls if $tmp is already set
116a67f45c3Smrg    test "$tmp" && return 0
117a67f45c3Smrg    : "${TMPDIR=/tmp}"
118a67f45c3Smrg    # shellcheck disable=SC2039,SC3028
119a67f45c3Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120a67f45c3Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121a67f45c3Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122a67f45c3Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123a67f45c3Smrg    dummy=$tmp/dummy
124a67f45c3Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125a67f45c3Smrg	,,)    echo "int x;" > "$dummy.c"
126a67f45c3Smrg	       for driver in cc gcc c89 c99 ; do
127a67f45c3Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128a67f45c3Smrg		       CC_FOR_BUILD=$driver
129a67f45c3Smrg		       break
130a67f45c3Smrg		   fi
131a67f45c3Smrg	       done
132a67f45c3Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133a67f45c3Smrg		   CC_FOR_BUILD=no_compiler_found
134a67f45c3Smrg	       fi
135a67f45c3Smrg	       ;;
136a67f45c3Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137a67f45c3Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138a67f45c3Smrg    esac
139a67f45c3Smrg}
14076910425Smrg
14176910425Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14276910425Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143a67f45c3Smrgif test -f /.attbin/uname ; then
14476910425Smrg	PATH=$PATH:/.attbin ; export PATH
14576910425Smrgfi
14676910425Smrg
14776910425SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14876910425SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149a67f45c3SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15076910425SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15176910425Smrg
152a67f45c3Smrgcase $UNAME_SYSTEM in
1539ff100acSmrgLinux|GNU|GNU/*)
154a67f45c3Smrg	LIBC=unknown
1559ff100acSmrg
156a67f45c3Smrg	set_cc_for_build
157a67f45c3Smrg	cat <<-EOF > "$dummy.c"
1589ff100acSmrg	#include <features.h>
1599ff100acSmrg	#if defined(__UCLIBC__)
1609ff100acSmrg	LIBC=uclibc
1619ff100acSmrg	#elif defined(__dietlibc__)
1629ff100acSmrg	LIBC=dietlibc
163a67f45c3Smrg	#elif defined(__GLIBC__)
1649ff100acSmrg	LIBC=gnu
165a67f45c3Smrg	#else
166a67f45c3Smrg	#include <stdarg.h>
167a67f45c3Smrg	/* First heuristic to detect musl libc.  */
168a67f45c3Smrg	#ifdef __DEFINED_va_list
169a67f45c3Smrg	LIBC=musl
170a67f45c3Smrg	#endif
1719ff100acSmrg	#endif
1729ff100acSmrg	EOF
173a67f45c3Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174a67f45c3Smrg	eval "$cc_set_libc"
175a67f45c3Smrg
176a67f45c3Smrg	# Second heuristic to detect musl libc.
177a67f45c3Smrg	if [ "$LIBC" = unknown ] &&
178a67f45c3Smrg	   command -v ldd >/dev/null &&
179a67f45c3Smrg	   ldd --version 2>&1 | grep -q ^musl; then
180a67f45c3Smrg		LIBC=musl
181a67f45c3Smrg	fi
182a67f45c3Smrg
183a67f45c3Smrg	# If the system lacks a compiler, then just pick glibc.
184a67f45c3Smrg	# We could probably try harder.
185a67f45c3Smrg	if [ "$LIBC" = unknown ]; then
186a67f45c3Smrg		LIBC=gnu
187a67f45c3Smrg	fi
1889ff100acSmrg	;;
1899ff100acSmrgesac
1909ff100acSmrg
19176910425Smrg# Note: order is significant - the case branches are not exclusive.
19276910425Smrg
193a67f45c3Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19476910425Smrg    *:NetBSD:*:*)
19576910425Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
1969ff100acSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19776910425Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19876910425Smrg	# switched to ELF, *-*-netbsd* would select the old
19976910425Smrg	# object file format.  This provides both forward
20076910425Smrg	# compatibility and a consistent mechanism for selecting the
20176910425Smrg	# object file format.
20276910425Smrg	#
20376910425Smrg	# Note: NetBSD doesn't particularly care about the vendor
20476910425Smrg	# portion of the name.  We always set it to "unknown".
205a67f45c3Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206a67f45c3Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207a67f45c3Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208a67f45c3Smrg	    echo unknown)`
209a67f45c3Smrg	case $UNAME_MACHINE_ARCH in
210a67f45c3Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
21176910425Smrg	    armeb) machine=armeb-unknown ;;
21276910425Smrg	    arm*) machine=arm-unknown ;;
21376910425Smrg	    sh3el) machine=shl-unknown ;;
21476910425Smrg	    sh3eb) machine=sh-unknown ;;
215db17cd6dSmrg	    sh5el) machine=sh5le-unknown ;;
216a67f45c3Smrg	    earmv*)
217a67f45c3Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218a67f45c3Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219a67f45c3Smrg		machine=${arch}${endian}-unknown
220a67f45c3Smrg		;;
221a67f45c3Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22276910425Smrg	esac
22376910425Smrg	# The Operating System including object format, if it has switched
224a67f45c3Smrg	# to ELF recently (or will in the future) and ABI.
225a67f45c3Smrg	case $UNAME_MACHINE_ARCH in
226a67f45c3Smrg	    earm*)
227a67f45c3Smrg		os=netbsdelf
228a67f45c3Smrg		;;
22976910425Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230a67f45c3Smrg		set_cc_for_build
23176910425Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232482df631Smrg			| grep -q __ELF__
23376910425Smrg		then
23476910425Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23576910425Smrg		    # Return netbsd for either.  FIX?
23676910425Smrg		    os=netbsd
23776910425Smrg		else
23876910425Smrg		    os=netbsdelf
23976910425Smrg		fi
24076910425Smrg		;;
24176910425Smrg	    *)
2429ff100acSmrg		os=netbsd
24376910425Smrg		;;
24476910425Smrg	esac
245a67f45c3Smrg	# Determine ABI tags.
246a67f45c3Smrg	case $UNAME_MACHINE_ARCH in
247a67f45c3Smrg	    earm*)
248a67f45c3Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249a67f45c3Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250a67f45c3Smrg		;;
251a67f45c3Smrg	esac
25276910425Smrg	# The OS release
25376910425Smrg	# Debian GNU/NetBSD machines have a different userland, and
25476910425Smrg	# thus, need a distinct triplet. However, they do not need
25576910425Smrg	# kernel version information, so it can be replaced with a
25676910425Smrg	# suitable tag, in the style of linux-gnu.
257a67f45c3Smrg	case $UNAME_VERSION in
25876910425Smrg	    Debian*)
25976910425Smrg		release='-gnu'
26076910425Smrg		;;
26176910425Smrg	    *)
262a67f45c3Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
26376910425Smrg		;;
26476910425Smrg	esac
26576910425Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26676910425Smrg	# contains redundant information, the shorter form:
26776910425Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268a67f45c3Smrg	GUESS=$machine-${os}${release}${abi-}
269a67f45c3Smrg	;;
2709ff100acSmrg    *:Bitrig:*:*)
2719ff100acSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272a67f45c3Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273a67f45c3Smrg	;;
27476910425Smrg    *:OpenBSD:*:*)
27576910425Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276a67f45c3Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277a67f45c3Smrg	;;
278a67f45c3Smrg    *:SecBSD:*:*)
279a67f45c3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280a67f45c3Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281a67f45c3Smrg	;;
282a67f45c3Smrg    *:LibertyBSD:*:*)
283a67f45c3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284a67f45c3Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285a67f45c3Smrg	;;
286a67f45c3Smrg    *:MidnightBSD:*:*)
287a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288a67f45c3Smrg	;;
28976910425Smrg    *:ekkoBSD:*:*)
290a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291a67f45c3Smrg	;;
292db17cd6dSmrg    *:SolidBSD:*:*)
293a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294a67f45c3Smrg	;;
295a67f45c3Smrg    *:OS108:*:*)
296a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297a67f45c3Smrg	;;
29876910425Smrg    macppc:MirBSD:*:*)
299a67f45c3Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300a67f45c3Smrg	;;
30176910425Smrg    *:MirBSD:*:*)
302a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303a67f45c3Smrg	;;
304a67f45c3Smrg    *:Sortix:*:*)
305a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
306a67f45c3Smrg	;;
307a67f45c3Smrg    *:Twizzler:*:*)
308a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309a67f45c3Smrg	;;
310a67f45c3Smrg    *:Redox:*:*)
311a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-redox
312a67f45c3Smrg	;;
313a67f45c3Smrg    mips:OSF1:*.*)
314a67f45c3Smrg	GUESS=mips-dec-osf1
315a67f45c3Smrg	;;
31676910425Smrg    alpha:OSF1:*:*)
317a67f45c3Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318a67f45c3Smrg	trap '' 0
31976910425Smrg	case $UNAME_RELEASE in
32076910425Smrg	*4.0)
32176910425Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32276910425Smrg		;;
32376910425Smrg	*5.*)
3249ff100acSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
32576910425Smrg		;;
32676910425Smrg	esac
32776910425Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
32876910425Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
32976910425Smrg	# covers most systems running today.  This code pipes the CPU
33076910425Smrg	# types through head -n 1, so we only detect the type of CPU 0.
33176910425Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332a67f45c3Smrg	case $ALPHA_CPU_TYPE in
33376910425Smrg	    "EV4 (21064)")
334a67f45c3Smrg		UNAME_MACHINE=alpha ;;
33576910425Smrg	    "EV4.5 (21064)")
336a67f45c3Smrg		UNAME_MACHINE=alpha ;;
33776910425Smrg	    "LCA4 (21066/21068)")
338a67f45c3Smrg		UNAME_MACHINE=alpha ;;
33976910425Smrg	    "EV5 (21164)")
340a67f45c3Smrg		UNAME_MACHINE=alphaev5 ;;
34176910425Smrg	    "EV5.6 (21164A)")
342a67f45c3Smrg		UNAME_MACHINE=alphaev56 ;;
34376910425Smrg	    "EV5.6 (21164PC)")
344a67f45c3Smrg		UNAME_MACHINE=alphapca56 ;;
34576910425Smrg	    "EV5.7 (21164PC)")
346a67f45c3Smrg		UNAME_MACHINE=alphapca57 ;;
34776910425Smrg	    "EV6 (21264)")
348a67f45c3Smrg		UNAME_MACHINE=alphaev6 ;;
34976910425Smrg	    "EV6.7 (21264A)")
350a67f45c3Smrg		UNAME_MACHINE=alphaev67 ;;
35176910425Smrg	    "EV6.8CB (21264C)")
352a67f45c3Smrg		UNAME_MACHINE=alphaev68 ;;
35376910425Smrg	    "EV6.8AL (21264B)")
354a67f45c3Smrg		UNAME_MACHINE=alphaev68 ;;
35576910425Smrg	    "EV6.8CX (21264D)")
356a67f45c3Smrg		UNAME_MACHINE=alphaev68 ;;
35776910425Smrg	    "EV6.9A (21264/EV69A)")
358a67f45c3Smrg		UNAME_MACHINE=alphaev69 ;;
35976910425Smrg	    "EV7 (21364)")
360a67f45c3Smrg		UNAME_MACHINE=alphaev7 ;;
36176910425Smrg	    "EV7.9 (21364A)")
362a67f45c3Smrg		UNAME_MACHINE=alphaev79 ;;
36376910425Smrg	esac
36476910425Smrg	# A Pn.n version is a patched version.
36576910425Smrg	# A Vn.n version is a released version.
36676910425Smrg	# A Tn.n version is a released field test version.
36776910425Smrg	# A Xn.n version is an unreleased experimental baselevel.
36876910425Smrg	# 1.2 uses "1.2" for uname -r.
369a67f45c3Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370a67f45c3Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371a67f45c3Smrg	;;
37276910425Smrg    Amiga*:UNIX_System_V:4.0:*)
373a67f45c3Smrg	GUESS=m68k-unknown-sysv4
374a67f45c3Smrg	;;
37576910425Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377a67f45c3Smrg	;;
37876910425Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
380a67f45c3Smrg	;;
38176910425Smrg    *:OS/390:*:*)
382a67f45c3Smrg	GUESS=i370-ibm-openedition
383a67f45c3Smrg	;;
38476910425Smrg    *:z/VM:*:*)
385a67f45c3Smrg	GUESS=s390-ibm-zvmoe
386a67f45c3Smrg	;;
38776910425Smrg    *:OS400:*:*)
388a67f45c3Smrg	GUESS=powerpc-ibm-os400
389a67f45c3Smrg	;;
39076910425Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391a67f45c3Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392a67f45c3Smrg	;;
3939ff100acSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394a67f45c3Smrg	GUESS=arm-unknown-riscos
395a67f45c3Smrg	;;
39676910425Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397a67f45c3Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
398a67f45c3Smrg	;;
39976910425Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40076910425Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401a67f45c3Smrg	case `(/bin/universe) 2>/dev/null` in
402a67f45c3Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403a67f45c3Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404a67f45c3Smrg	esac
405a67f45c3Smrg	;;
40676910425Smrg    NILE*:*:*:dcosx)
407a67f45c3Smrg	GUESS=pyramid-pyramid-svr4
408a67f45c3Smrg	;;
40976910425Smrg    DRS?6000:unix:4.0:6*)
410a67f45c3Smrg	GUESS=sparc-icl-nx6
411a67f45c3Smrg	;;
41276910425Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
41376910425Smrg	case `/usr/bin/uname -p` in
414a67f45c3Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
415a67f45c3Smrg	esac
416a67f45c3Smrg	;;
417db17cd6dSmrg    s390x:SunOS:*:*)
418a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419a67f45c3Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420a67f45c3Smrg	;;
42176910425Smrg    sun4H:SunOS:5.*:*)
422a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423a67f45c3Smrg	GUESS=sparc-hal-solaris2$SUN_REL
424a67f45c3Smrg	;;
42576910425Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427a67f45c3Smrg	GUESS=sparc-sun-solaris2$SUN_REL
428a67f45c3Smrg	;;
429482df631Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430a67f45c3Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431a67f45c3Smrg	;;
432db17cd6dSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433a67f45c3Smrg	set_cc_for_build
434a67f45c3Smrg	SUN_ARCH=i386
435db17cd6dSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
436db17cd6dSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437db17cd6dSmrg	# This test works for both compilers.
438a67f45c3Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439db17cd6dSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440a67f45c3Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
441db17cd6dSmrg		grep IS_64BIT_ARCH >/dev/null
442db17cd6dSmrg	    then
443a67f45c3Smrg		SUN_ARCH=x86_64
444db17cd6dSmrg	    fi
445db17cd6dSmrg	fi
446a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447a67f45c3Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448a67f45c3Smrg	;;
44976910425Smrg    sun4*:SunOS:6*:*)
45076910425Smrg	# According to config.sub, this is the proper way to canonicalize
45176910425Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45276910425Smrg	# it's likely to be more like Solaris than SunOS4.
453a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454a67f45c3Smrg	GUESS=sparc-sun-solaris3$SUN_REL
455a67f45c3Smrg	;;
45676910425Smrg    sun4*:SunOS:*:*)
457a67f45c3Smrg	case `/usr/bin/arch -k` in
45876910425Smrg	    Series*|S4*)
45976910425Smrg		UNAME_RELEASE=`uname -v`
46076910425Smrg		;;
46176910425Smrg	esac
46276910425Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464a67f45c3Smrg	GUESS=sparc-sun-sunos$SUN_REL
465a67f45c3Smrg	;;
46676910425Smrg    sun3*:SunOS:*:*)
467a67f45c3Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468a67f45c3Smrg	;;
46976910425Smrg    sun*:*:4.2BSD:*)
47076910425Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471a67f45c3Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472a67f45c3Smrg	case `/bin/arch` in
47376910425Smrg	    sun3)
474a67f45c3Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
47576910425Smrg		;;
47676910425Smrg	    sun4)
477a67f45c3Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
47876910425Smrg		;;
47976910425Smrg	esac
480a67f45c3Smrg	;;
48176910425Smrg    aushp:SunOS:*:*)
482a67f45c3Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483a67f45c3Smrg	;;
48476910425Smrg    # The situation for MiNT is a little confusing.  The machine name
48576910425Smrg    # can be virtually everything (everything which is not
48676910425Smrg    # "atarist" or "atariste" at least should have a processor
48776910425Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48876910425Smrg    # to the lowercase version "mint" (or "freemint").  Finally
48976910425Smrg    # the system name "TOS" denotes a system which is actually not
49076910425Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
49176910425Smrg    # be no problem.
49276910425Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493a67f45c3Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494a67f45c3Smrg	;;
49576910425Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496a67f45c3Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497a67f45c3Smrg	;;
49876910425Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499a67f45c3Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500a67f45c3Smrg	;;
50176910425Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502a67f45c3Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503a67f45c3Smrg	;;
50476910425Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505a67f45c3Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506a67f45c3Smrg	;;
50776910425Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508a67f45c3Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509a67f45c3Smrg	;;
51076910425Smrg    m68k:machten:*:*)
511a67f45c3Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512a67f45c3Smrg	;;
51376910425Smrg    powerpc:machten:*:*)
514a67f45c3Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515a67f45c3Smrg	;;
51676910425Smrg    RISC*:Mach:*:*)
517a67f45c3Smrg	GUESS=mips-dec-mach_bsd4.3
518a67f45c3Smrg	;;
51976910425Smrg    RISC*:ULTRIX:*:*)
520a67f45c3Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521a67f45c3Smrg	;;
52276910425Smrg    VAX*:ULTRIX*:*:*)
523a67f45c3Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524a67f45c3Smrg	;;
52576910425Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526a67f45c3Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527a67f45c3Smrg	;;
52876910425Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529a67f45c3Smrg	set_cc_for_build
530a67f45c3Smrg	sed 's/^	//' << EOF > "$dummy.c"
53176910425Smrg#ifdef __cplusplus
53276910425Smrg#include <stdio.h>  /* for printf() prototype */
53376910425Smrg	int main (int argc, char *argv[]) {
53476910425Smrg#else
53576910425Smrg	int main (argc, argv) int argc; char *argv[]; {
53676910425Smrg#endif
53776910425Smrg	#if defined (host_mips) && defined (MIPSEB)
53876910425Smrg	#if defined (SYSTYPE_SYSV)
539a67f45c3Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54076910425Smrg	#endif
54176910425Smrg	#if defined (SYSTYPE_SVR4)
542a67f45c3Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54376910425Smrg	#endif
54476910425Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545a67f45c3Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54676910425Smrg	#endif
54776910425Smrg	#endif
54876910425Smrg	  exit (-1);
54976910425Smrg	}
55076910425SmrgEOF
551a67f45c3Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552a67f45c3Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553a67f45c3Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55476910425Smrg	    { echo "$SYSTEM_NAME"; exit; }
555a67f45c3Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556a67f45c3Smrg	;;
55776910425Smrg    Motorola:PowerMAX_OS:*:*)
558a67f45c3Smrg	GUESS=powerpc-motorola-powermax
559a67f45c3Smrg	;;
56076910425Smrg    Motorola:*:4.3:PL8-*)
561a67f45c3Smrg	GUESS=powerpc-harris-powermax
562a67f45c3Smrg	;;
56376910425Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564a67f45c3Smrg	GUESS=powerpc-harris-powermax
565a67f45c3Smrg	;;
56676910425Smrg    Night_Hawk:Power_UNIX:*:*)
567a67f45c3Smrg	GUESS=powerpc-harris-powerunix
568a67f45c3Smrg	;;
56976910425Smrg    m88k:CX/UX:7*:*)
570a67f45c3Smrg	GUESS=m88k-harris-cxux7
571a67f45c3Smrg	;;
57276910425Smrg    m88k:*:4*:R4*)
573a67f45c3Smrg	GUESS=m88k-motorola-sysv4
574a67f45c3Smrg	;;
57576910425Smrg    m88k:*:3*:R3*)
576a67f45c3Smrg	GUESS=m88k-motorola-sysv3
577a67f45c3Smrg	;;
57876910425Smrg    AViiON:dgux:*:*)
5799ff100acSmrg	# DG/UX returns AViiON for all architectures
5809ff100acSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581a67f45c3Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58276910425Smrg	then
583a67f45c3Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584a67f45c3Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
58576910425Smrg	    then
586a67f45c3Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
58776910425Smrg	    else
588a67f45c3Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58976910425Smrg	    fi
59076910425Smrg	else
591a67f45c3Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
59276910425Smrg	fi
593a67f45c3Smrg	;;
59476910425Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595a67f45c3Smrg	GUESS=m88k-dolphin-sysv3
596a67f45c3Smrg	;;
59776910425Smrg    M88*:*:R3*:*)
59876910425Smrg	# Delta 88k system running SVR3
599a67f45c3Smrg	GUESS=m88k-motorola-sysv3
600a67f45c3Smrg	;;
60176910425Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602a67f45c3Smrg	GUESS=m88k-tektronix-sysv3
603a67f45c3Smrg	;;
60476910425Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605a67f45c3Smrg	GUESS=m68k-tektronix-bsd
606a67f45c3Smrg	;;
60776910425Smrg    *:IRIX*:*:*)
608a67f45c3Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609a67f45c3Smrg	GUESS=mips-sgi-irix$IRIX_REL
610a67f45c3Smrg	;;
61176910425Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612a67f45c3Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613a67f45c3Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61476910425Smrg    i*86:AIX:*:*)
615a67f45c3Smrg	GUESS=i386-ibm-aix
616a67f45c3Smrg	;;
61776910425Smrg    ia64:AIX:*:*)
618a67f45c3Smrg	if test -x /usr/bin/oslevel ; then
61976910425Smrg		IBM_REV=`/usr/bin/oslevel`
62076910425Smrg	else
621a67f45c3Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62276910425Smrg	fi
623a67f45c3Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624a67f45c3Smrg	;;
62576910425Smrg    *:AIX:2:3)
62676910425Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627a67f45c3Smrg		set_cc_for_build
628a67f45c3Smrg		sed 's/^		//' << EOF > "$dummy.c"
62976910425Smrg		#include <sys/systemcfg.h>
63076910425Smrg
63176910425Smrg		main()
63276910425Smrg			{
63376910425Smrg			if (!__power_pc())
63476910425Smrg				exit(1);
63576910425Smrg			puts("powerpc-ibm-aix3.2.5");
63676910425Smrg			exit(0);
63776910425Smrg			}
63876910425SmrgEOF
639a67f45c3Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64076910425Smrg		then
641a67f45c3Smrg			GUESS=$SYSTEM_NAME
64276910425Smrg		else
643a67f45c3Smrg			GUESS=rs6000-ibm-aix3.2.5
64476910425Smrg		fi
64576910425Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646a67f45c3Smrg		GUESS=rs6000-ibm-aix3.2.4
64776910425Smrg	else
648a67f45c3Smrg		GUESS=rs6000-ibm-aix3.2
64976910425Smrg	fi
650a67f45c3Smrg	;;
651482df631Smrg    *:AIX:*:[4567])
65276910425Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653a67f45c3Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65476910425Smrg		IBM_ARCH=rs6000
65576910425Smrg	else
65676910425Smrg		IBM_ARCH=powerpc
65776910425Smrg	fi
658a67f45c3Smrg	if test -x /usr/bin/lslpp ; then
659a67f45c3Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6609ff100acSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66176910425Smrg	else
662a67f45c3Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66376910425Smrg	fi
664a67f45c3Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665a67f45c3Smrg	;;
66676910425Smrg    *:AIX:*:*)
667a67f45c3Smrg	GUESS=rs6000-ibm-aix
668a67f45c3Smrg	;;
669a67f45c3Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670a67f45c3Smrg	GUESS=romp-ibm-bsd4.4
671a67f45c3Smrg	;;
67276910425Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673a67f45c3Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674a67f45c3Smrg	;;                                  # report: romp-ibm BSD 4.3
67576910425Smrg    *:BOSX:*:*)
676a67f45c3Smrg	GUESS=rs6000-bull-bosx
677a67f45c3Smrg	;;
67876910425Smrg    DPX/2?00:B.O.S.:*:*)
679a67f45c3Smrg	GUESS=m68k-bull-sysv3
680a67f45c3Smrg	;;
68176910425Smrg    9000/[34]??:4.3bsd:1.*:*)
682a67f45c3Smrg	GUESS=m68k-hp-bsd
683a67f45c3Smrg	;;
68476910425Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685a67f45c3Smrg	GUESS=m68k-hp-bsd4.4
686a67f45c3Smrg	;;
68776910425Smrg    9000/[34678]??:HP-UX:*:*)
688a67f45c3Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689a67f45c3Smrg	case $UNAME_MACHINE in
690a67f45c3Smrg	    9000/31?)            HP_ARCH=m68000 ;;
691a67f45c3Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
69276910425Smrg	    9000/[678][0-9][0-9])
693a67f45c3Smrg		if test -x /usr/bin/getconf; then
69476910425Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6959ff100acSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696a67f45c3Smrg		    case $sc_cpu_version in
697a67f45c3Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698a67f45c3Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6999ff100acSmrg		      532)                      # CPU_PA_RISC2_0
700a67f45c3Smrg			case $sc_kernel_bits in
701a67f45c3Smrg			  32) HP_ARCH=hppa2.0n ;;
702a67f45c3Smrg			  64) HP_ARCH=hppa2.0w ;;
703a67f45c3Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7049ff100acSmrg			esac ;;
7059ff100acSmrg		    esac
70676910425Smrg		fi
707a67f45c3Smrg		if test "$HP_ARCH" = ""; then
708a67f45c3Smrg		    set_cc_for_build
709a67f45c3Smrg		    sed 's/^		//' << EOF > "$dummy.c"
71076910425Smrg
7119ff100acSmrg		#define _HPUX_SOURCE
7129ff100acSmrg		#include <stdlib.h>
7139ff100acSmrg		#include <unistd.h>
71476910425Smrg
7159ff100acSmrg		int main ()
7169ff100acSmrg		{
7179ff100acSmrg		#if defined(_SC_KERNEL_BITS)
7189ff100acSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
7199ff100acSmrg		#endif
7209ff100acSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
72176910425Smrg
7229ff100acSmrg		    switch (cpu)
7239ff100acSmrg			{
7249ff100acSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7259ff100acSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7269ff100acSmrg			case CPU_PA_RISC2_0:
7279ff100acSmrg		#if defined(_SC_KERNEL_BITS)
7289ff100acSmrg			    switch (bits)
7299ff100acSmrg				{
7309ff100acSmrg				case 64: puts ("hppa2.0w"); break;
7319ff100acSmrg				case 32: puts ("hppa2.0n"); break;
7329ff100acSmrg				default: puts ("hppa2.0"); break;
7339ff100acSmrg				} break;
7349ff100acSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
7359ff100acSmrg			    puts ("hppa2.0"); break;
7369ff100acSmrg		#endif
7379ff100acSmrg			default: puts ("hppa1.0"); break;
7389ff100acSmrg			}
7399ff100acSmrg		    exit (0);
7409ff100acSmrg		}
74176910425SmrgEOF
742a67f45c3Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
74376910425Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
74476910425Smrg		fi ;;
74576910425Smrg	esac
746a67f45c3Smrg	if test "$HP_ARCH" = hppa2.0w
74776910425Smrg	then
748a67f45c3Smrg	    set_cc_for_build
74976910425Smrg
75076910425Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75176910425Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75276910425Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
75376910425Smrg	    #
75476910425Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
75576910425Smrg	    # => hppa2.0w-hp-hpux11.23
75676910425Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75776910425Smrg	    # => hppa64-hp-hpux11.23
75876910425Smrg
759a67f45c3Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760482df631Smrg		grep -q __LP64__
76176910425Smrg	    then
762a67f45c3Smrg		HP_ARCH=hppa2.0w
76376910425Smrg	    else
764a67f45c3Smrg		HP_ARCH=hppa64
76576910425Smrg	    fi
76676910425Smrg	fi
767a67f45c3Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768a67f45c3Smrg	;;
76976910425Smrg    ia64:HP-UX:*:*)
770a67f45c3Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771a67f45c3Smrg	GUESS=ia64-hp-hpux$HPUX_REV
772a67f45c3Smrg	;;
77376910425Smrg    3050*:HI-UX:*:*)
774a67f45c3Smrg	set_cc_for_build
775a67f45c3Smrg	sed 's/^	//' << EOF > "$dummy.c"
77676910425Smrg	#include <unistd.h>
77776910425Smrg	int
77876910425Smrg	main ()
77976910425Smrg	{
78076910425Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
78176910425Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78276910425Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78376910425Smrg	     results, however.  */
78476910425Smrg	  if (CPU_IS_PA_RISC (cpu))
78576910425Smrg	    {
78676910425Smrg	      switch (cpu)
78776910425Smrg		{
78876910425Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78976910425Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79076910425Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79176910425Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79276910425Smrg		}
79376910425Smrg	    }
79476910425Smrg	  else if (CPU_IS_HP_MC68K (cpu))
79576910425Smrg	    puts ("m68k-hitachi-hiuxwe2");
79676910425Smrg	  else puts ("unknown-hitachi-hiuxwe2");
79776910425Smrg	  exit (0);
79876910425Smrg	}
79976910425SmrgEOF
800a67f45c3Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80176910425Smrg		{ echo "$SYSTEM_NAME"; exit; }
802a67f45c3Smrg	GUESS=unknown-hitachi-hiuxwe2
803a67f45c3Smrg	;;
804a67f45c3Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805a67f45c3Smrg	GUESS=hppa1.1-hp-bsd
806a67f45c3Smrg	;;
80776910425Smrg    9000/8??:4.3bsd:*:*)
808a67f45c3Smrg	GUESS=hppa1.0-hp-bsd
809a67f45c3Smrg	;;
81076910425Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811a67f45c3Smrg	GUESS=hppa1.0-hp-mpeix
812a67f45c3Smrg	;;
813a67f45c3Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814a67f45c3Smrg	GUESS=hppa1.1-hp-osf
815a67f45c3Smrg	;;
81676910425Smrg    hp8??:OSF1:*:*)
817a67f45c3Smrg	GUESS=hppa1.0-hp-osf
818a67f45c3Smrg	;;
81976910425Smrg    i*86:OSF1:*:*)
820a67f45c3Smrg	if test -x /usr/sbin/sysversion ; then
821a67f45c3Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82276910425Smrg	else
823a67f45c3Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
82476910425Smrg	fi
825a67f45c3Smrg	;;
82676910425Smrg    parisc*:Lites*:*:*)
827a67f45c3Smrg	GUESS=hppa1.1-hp-lites
828a67f45c3Smrg	;;
82976910425Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830a67f45c3Smrg	GUESS=c1-convex-bsd
831a67f45c3Smrg	;;
83276910425Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83376910425Smrg	if getsysinfo -f scalar_acc
83476910425Smrg	then echo c32-convex-bsd
83576910425Smrg	else echo c2-convex-bsd
83676910425Smrg	fi
8379ff100acSmrg	exit ;;
83876910425Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839a67f45c3Smrg	GUESS=c34-convex-bsd
840a67f45c3Smrg	;;
84176910425Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842a67f45c3Smrg	GUESS=c38-convex-bsd
843a67f45c3Smrg	;;
84476910425Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845a67f45c3Smrg	GUESS=c4-convex-bsd
846a67f45c3Smrg	;;
84776910425Smrg    CRAY*Y-MP:*:*:*)
848a67f45c3Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849a67f45c3Smrg	GUESS=ymp-cray-unicos$CRAY_REL
850a67f45c3Smrg	;;
85176910425Smrg    CRAY*[A-Z]90:*:*:*)
852a67f45c3Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85376910425Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85476910425Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85576910425Smrg	      -e 's/\.[^.]*$/.X/'
85676910425Smrg	exit ;;
85776910425Smrg    CRAY*TS:*:*:*)
858a67f45c3Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859a67f45c3Smrg	GUESS=t90-cray-unicos$CRAY_REL
860a67f45c3Smrg	;;
86176910425Smrg    CRAY*T3E:*:*:*)
862a67f45c3Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863a67f45c3Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864a67f45c3Smrg	;;
86576910425Smrg    CRAY*SV1:*:*:*)
866a67f45c3Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867a67f45c3Smrg	GUESS=sv1-cray-unicos$CRAY_REL
868a67f45c3Smrg	;;
86976910425Smrg    *:UNICOS/mp:*:*)
870a67f45c3Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871a67f45c3Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872a67f45c3Smrg	;;
87376910425Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874a67f45c3Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875a67f45c3Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876a67f45c3Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877a67f45c3Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878a67f45c3Smrg	;;
87976910425Smrg    5000:UNIX_System_V:4.*:*)
880a67f45c3Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881a67f45c3Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882a67f45c3Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883a67f45c3Smrg	;;
88476910425Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886a67f45c3Smrg	;;
88776910425Smrg    sparc*:BSD/OS:*:*)
888a67f45c3Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889a67f45c3Smrg	;;
89076910425Smrg    *:BSD/OS:*:*)
891a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892a67f45c3Smrg	;;
893a67f45c3Smrg    arm:FreeBSD:*:*)
894a67f45c3Smrg	UNAME_PROCESSOR=`uname -p`
895a67f45c3Smrg	set_cc_for_build
896a67f45c3Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897a67f45c3Smrg	    | grep -q __ARM_PCS_VFP
898a67f45c3Smrg	then
899a67f45c3Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900a67f45c3Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901a67f45c3Smrg	else
902a67f45c3Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903a67f45c3Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904a67f45c3Smrg	fi
905a67f45c3Smrg	;;
90676910425Smrg    *:FreeBSD:*:*)
9079ff100acSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908a67f45c3Smrg	case $UNAME_PROCESSOR in
909db17cd6dSmrg	    amd64)
910a67f45c3Smrg		UNAME_PROCESSOR=x86_64 ;;
911a67f45c3Smrg	    i386)
912a67f45c3Smrg		UNAME_PROCESSOR=i586 ;;
913db17cd6dSmrg	esac
914a67f45c3Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915a67f45c3Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916a67f45c3Smrg	;;
91776910425Smrg    i*:CYGWIN*:*)
918a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
919a67f45c3Smrg	;;
9209ff100acSmrg    *:MINGW64*:*)
921a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
922a67f45c3Smrg	;;
923db17cd6dSmrg    *:MINGW*:*)
924a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
925a67f45c3Smrg	;;
9269ff100acSmrg    *:MSYS*:*)
927a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-msys
928a67f45c3Smrg	;;
92976910425Smrg    i*:PW*:*)
930a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-pw32
931a67f45c3Smrg	;;
932482df631Smrg    *:Interix*:*)
933a67f45c3Smrg	case $UNAME_MACHINE in
934db17cd6dSmrg	    x86)
935a67f45c3Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
936a67f45c3Smrg		;;
937482df631Smrg	    authenticamd | genuineintel | EM64T)
938a67f45c3Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
939a67f45c3Smrg		;;
940db17cd6dSmrg	    IA64)
941a67f45c3Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
942a67f45c3Smrg		;;
943db17cd6dSmrg	esac ;;
94476910425Smrg    i*:UWIN*:*)
945a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-uwin
946a67f45c3Smrg	;;
947db17cd6dSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948a67f45c3Smrg	GUESS=x86_64-pc-cygwin
949a67f45c3Smrg	;;
95076910425Smrg    prep*:SunOS:5.*:*)
951a67f45c3Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952a67f45c3Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
953a67f45c3Smrg	;;
95476910425Smrg    *:GNU:*:*)
95576910425Smrg	# the GNU system
956a67f45c3Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957a67f45c3Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958a67f45c3Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959a67f45c3Smrg	;;
96076910425Smrg    *:GNU/*:*:*)
96176910425Smrg	# other systems with GNU libc and userland
962a67f45c3Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963a67f45c3Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965a67f45c3Smrg	;;
966a67f45c3Smrg    *:Minix:*:*)
967a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-minix
968a67f45c3Smrg	;;
9699ff100acSmrg    aarch64:Linux:*:*)
970a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971a67f45c3Smrg	;;
9729ff100acSmrg    aarch64_be:Linux:*:*)
9739ff100acSmrg	UNAME_MACHINE=aarch64_be
974a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975a67f45c3Smrg	;;
976482df631Smrg    alpha:Linux:*:*)
977a67f45c3Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978482df631Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979482df631Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980482df631Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981482df631Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982482df631Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983482df631Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984482df631Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9859ff100acSmrg	esac
986482df631Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
987a67f45c3Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989a67f45c3Smrg	;;
990a67f45c3Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992a67f45c3Smrg	;;
99376910425Smrg    arm*:Linux:*:*)
994a67f45c3Smrg	set_cc_for_build
995db17cd6dSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996db17cd6dSmrg	    | grep -q __ARM_EABI__
997db17cd6dSmrg	then
998a67f45c3Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999db17cd6dSmrg	else
10009ff100acSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10019ff100acSmrg		| grep -q __ARM_PCS_VFP
10029ff100acSmrg	    then
1003a67f45c3Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10049ff100acSmrg	    else
1005a67f45c3Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10069ff100acSmrg	    fi
1007db17cd6dSmrg	fi
1008a67f45c3Smrg	;;
1009db17cd6dSmrg    avr32*:Linux:*:*)
1010a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011a67f45c3Smrg	;;
101276910425Smrg    cris:Linux:*:*)
1013a67f45c3Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014a67f45c3Smrg	;;
101576910425Smrg    crisv32:Linux:*:*)
1016a67f45c3Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017a67f45c3Smrg	;;
1018a67f45c3Smrg    e2k:Linux:*:*)
1019a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020a67f45c3Smrg	;;
102176910425Smrg    frv:Linux:*:*)
1022a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023a67f45c3Smrg	;;
10249ff100acSmrg    hexagon:Linux:*:*)
1025a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026a67f45c3Smrg	;;
1027482df631Smrg    i*86:Linux:*:*)
1028a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029a67f45c3Smrg	;;
103076910425Smrg    ia64:Linux:*:*)
1031a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032a67f45c3Smrg	;;
1033a67f45c3Smrg    k1om:Linux:*:*)
1034a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035a67f45c3Smrg	;;
1036a67f45c3Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038a67f45c3Smrg	;;
103976910425Smrg    m32r*:Linux:*:*)
1040a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041a67f45c3Smrg	;;
104276910425Smrg    m68*:Linux:*:*)
1043a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044a67f45c3Smrg	;;
1045482df631Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1046a67f45c3Smrg	set_cc_for_build
1047a67f45c3Smrg	IS_GLIBC=0
1048a67f45c3Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049a67f45c3Smrg	sed 's/^	//' << EOF > "$dummy.c"
105076910425Smrg	#undef CPU
1051a67f45c3Smrg	#undef mips
1052a67f45c3Smrg	#undef mipsel
1053a67f45c3Smrg	#undef mips64
1054a67f45c3Smrg	#undef mips64el
1055a67f45c3Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1056a67f45c3Smrg	LIBCABI=gnuabi64
1057a67f45c3Smrg	#else
1058a67f45c3Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1059a67f45c3Smrg	LIBCABI=gnuabin32
1060a67f45c3Smrg	#else
1061a67f45c3Smrg	LIBCABI=${LIBC}
1062a67f45c3Smrg	#endif
1063a67f45c3Smrg	#endif
1064a67f45c3Smrg
1065a67f45c3Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1066a67f45c3Smrg	CPU=mipsisa64r6
1067a67f45c3Smrg	#else
1068a67f45c3Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069a67f45c3Smrg	CPU=mipsisa32r6
1070a67f45c3Smrg	#else
1071a67f45c3Smrg	#if defined(__mips64)
1072a67f45c3Smrg	CPU=mips64
1073a67f45c3Smrg	#else
1074a67f45c3Smrg	CPU=mips
1075a67f45c3Smrg	#endif
1076a67f45c3Smrg	#endif
1077a67f45c3Smrg	#endif
1078a67f45c3Smrg
107976910425Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1080a67f45c3Smrg	MIPS_ENDIAN=el
108176910425Smrg	#else
108276910425Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1083a67f45c3Smrg	MIPS_ENDIAN=
108476910425Smrg	#else
1085a67f45c3Smrg	MIPS_ENDIAN=
108676910425Smrg	#endif
108776910425Smrg	#endif
108876910425SmrgEOF
1089a67f45c3Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090a67f45c3Smrg	eval "$cc_set_vars"
1091a67f45c3Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092a67f45c3Smrg	;;
1093a67f45c3Smrg    mips64el:Linux:*:*)
1094a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
109576910425Smrg	;;
10969ff100acSmrg    openrisc*:Linux:*:*)
1097a67f45c3Smrg	GUESS=or1k-unknown-linux-$LIBC
1098a67f45c3Smrg	;;
10999ff100acSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1100a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1101a67f45c3Smrg	;;
1102db17cd6dSmrg    padre:Linux:*:*)
1103a67f45c3Smrg	GUESS=sparc-unknown-linux-$LIBC
1104a67f45c3Smrg	;;
1105482df631Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106a67f45c3Smrg	GUESS=hppa64-unknown-linux-$LIBC
1107a67f45c3Smrg	;;
110876910425Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
110976910425Smrg	# Look for CPU level
111076910425Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111a67f45c3Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112a67f45c3Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113a67f45c3Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
111476910425Smrg	esac
1115a67f45c3Smrg	;;
1116482df631Smrg    ppc64:Linux:*:*)
1117a67f45c3Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1118a67f45c3Smrg	;;
1119482df631Smrg    ppc:Linux:*:*)
1120a67f45c3Smrg	GUESS=powerpc-unknown-linux-$LIBC
1121a67f45c3Smrg	;;
11229ff100acSmrg    ppc64le:Linux:*:*)
1123a67f45c3Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1124a67f45c3Smrg	;;
11259ff100acSmrg    ppcle:Linux:*:*)
1126a67f45c3Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1127a67f45c3Smrg	;;
1128a67f45c3Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130a67f45c3Smrg	;;
113176910425Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1132a67f45c3Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133a67f45c3Smrg	;;
113476910425Smrg    sh64*:Linux:*:*)
1135a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136a67f45c3Smrg	;;
113776910425Smrg    sh*:Linux:*:*)
1138a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139a67f45c3Smrg	;;
114076910425Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1141a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142a67f45c3Smrg	;;
1143482df631Smrg    tile*:Linux:*:*)
1144a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145a67f45c3Smrg	;;
1146db17cd6dSmrg    vax:Linux:*:*)
1147a67f45c3Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148a67f45c3Smrg	;;
114976910425Smrg    x86_64:Linux:*:*)
1150a67f45c3Smrg	set_cc_for_build
1151a67f45c3Smrg	LIBCABI=$LIBC
1152a67f45c3Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1153a67f45c3Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1154a67f45c3Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1155a67f45c3Smrg		grep IS_X32 >/dev/null
1156a67f45c3Smrg	    then
1157a67f45c3Smrg		LIBCABI=${LIBC}x32
1158a67f45c3Smrg	    fi
1159a67f45c3Smrg	fi
1160a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161a67f45c3Smrg	;;
1162db17cd6dSmrg    xtensa*:Linux:*:*)
1163a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164a67f45c3Smrg	;;
116576910425Smrg    i*86:DYNIX/ptx:4*:*)
116676910425Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
116776910425Smrg	# earlier versions are messed up and put the nodename in both
116876910425Smrg	# sysname and nodename.
1169a67f45c3Smrg	GUESS=i386-sequent-sysv4
1170a67f45c3Smrg	;;
117176910425Smrg    i*86:UNIX_SV:4.2MP:2.*)
11729ff100acSmrg	# Unixware is an offshoot of SVR4, but it has its own version
11739ff100acSmrg	# number series starting with 2...
11749ff100acSmrg	# I am not positive that other SVR4 systems won't match this,
117576910425Smrg	# I just have to hope.  -- rms.
11769ff100acSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1177a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178a67f45c3Smrg	;;
117976910425Smrg    i*86:OS/2:*:*)
118076910425Smrg	# If we were able to find `uname', then EMX Unix compatibility
118176910425Smrg	# is probably installed.
1182a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1183a67f45c3Smrg	;;
118476910425Smrg    i*86:XTS-300:*:STOP)
1185a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1186a67f45c3Smrg	;;
118776910425Smrg    i*86:atheos:*:*)
1188a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1189a67f45c3Smrg	;;
119076910425Smrg    i*86:syllable:*:*)
1191a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1192a67f45c3Smrg	;;
1193482df631Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194a67f45c3Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195a67f45c3Smrg	;;
119676910425Smrg    i*86:*DOS:*:*)
1197a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198a67f45c3Smrg	;;
1199a67f45c3Smrg    i*86:*:4.*:*)
1200a67f45c3Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
120176910425Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202a67f45c3Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
120376910425Smrg	else
1204a67f45c3Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
120576910425Smrg	fi
1206a67f45c3Smrg	;;
120776910425Smrg    i*86:*:5:[678]*)
12089ff100acSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
120976910425Smrg	case `/bin/uname -X | grep "^Machine"` in
121076910425Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
121176910425Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
121276910425Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
121376910425Smrg	esac
1214a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215a67f45c3Smrg	;;
121676910425Smrg    i*86:*:3.2:*)
121776910425Smrg	if test -f /usr/options/cb.name; then
121876910425Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219a67f45c3Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
122076910425Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
122176910425Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
122276910425Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
122376910425Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
122476910425Smrg			&& UNAME_MACHINE=i586
122576910425Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
122676910425Smrg			&& UNAME_MACHINE=i686
122776910425Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
122876910425Smrg			&& UNAME_MACHINE=i686
1229a67f45c3Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
123076910425Smrg	else
1231a67f45c3Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
123276910425Smrg	fi
1233a67f45c3Smrg	;;
123476910425Smrg    pc:*:*:*)
123576910425Smrg	# Left here for compatibility:
12369ff100acSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12379ff100acSmrg	# the processor, so we play safe by assuming i586.
1238db17cd6dSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1239a67f45c3Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
1240db17cd6dSmrg	# this is a cross-build.
1241a67f45c3Smrg	GUESS=i586-pc-msdosdjgpp
1242a67f45c3Smrg	;;
124376910425Smrg    Intel:Mach:3*:*)
1244a67f45c3Smrg	GUESS=i386-pc-mach3
1245a67f45c3Smrg	;;
124676910425Smrg    paragon:*:*:*)
1247a67f45c3Smrg	GUESS=i860-intel-osf1
1248a67f45c3Smrg	;;
124976910425Smrg    i860:*:4.*:*) # i860-SVR4
125076910425Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251a67f45c3Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
125276910425Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1253a67f45c3Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
125476910425Smrg	fi
1255a67f45c3Smrg	;;
125676910425Smrg    mini*:CTIX:SYS*5:*)
125776910425Smrg	# "miniframe"
1258a67f45c3Smrg	GUESS=m68010-convergent-sysv
1259a67f45c3Smrg	;;
126076910425Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1261a67f45c3Smrg	GUESS=m68k-convergent-sysv
1262a67f45c3Smrg	;;
126376910425Smrg    M680?0:D-NIX:5.3:*)
1264a67f45c3Smrg	GUESS=m68k-diab-dnix
1265a67f45c3Smrg	;;
126676910425Smrg    M68*:*:R3V[5678]*:*)
126776910425Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
126876910425Smrg    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)
126976910425Smrg	OS_REL=''
127076910425Smrg	test -r /etc/.relid \
127176910425Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
127276910425Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273a67f45c3Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
127476910425Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275a67f45c3Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
127676910425Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12779ff100acSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12789ff100acSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1279db17cd6dSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280db17cd6dSmrg	OS_REL='.3'
1281db17cd6dSmrg	test -r /etc/.relid \
1282db17cd6dSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283db17cd6dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284a67f45c3Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285db17cd6dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286a67f45c3Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287db17cd6dSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288a67f45c3Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
128976910425Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290a67f45c3Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291a67f45c3Smrg	;;
129276910425Smrg    mc68030:UNIX_System_V:4.*:*)
1293a67f45c3Smrg	GUESS=m68k-atari-sysv4
1294a67f45c3Smrg	;;
129576910425Smrg    TSUNAMI:LynxOS:2.*:*)
1296a67f45c3Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297a67f45c3Smrg	;;
129876910425Smrg    rs6000:LynxOS:2.*:*)
1299a67f45c3Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300a67f45c3Smrg	;;
1301482df631Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302a67f45c3Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303a67f45c3Smrg	;;
130476910425Smrg    SM[BE]S:UNIX_SV:*:*)
1305a67f45c3Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1306a67f45c3Smrg	;;
130776910425Smrg    RM*:ReliantUNIX-*:*:*)
1308a67f45c3Smrg	GUESS=mips-sni-sysv4
1309a67f45c3Smrg	;;
131076910425Smrg    RM*:SINIX-*:*:*)
1311a67f45c3Smrg	GUESS=mips-sni-sysv4
1312a67f45c3Smrg	;;
131376910425Smrg    *:SINIX-*:*:*)
131476910425Smrg	if uname -p 2>/dev/null >/dev/null ; then
131576910425Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316a67f45c3Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
131776910425Smrg	else
1318a67f45c3Smrg		GUESS=ns32k-sni-sysv
131976910425Smrg	fi
1320a67f45c3Smrg	;;
13219ff100acSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13229ff100acSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1323a67f45c3Smrg	GUESS=i586-unisys-sysv4
1324a67f45c3Smrg	;;
132576910425Smrg    *:UNIX_System_V:4*:FTX*)
132676910425Smrg	# From Gerald Hewes <hewes@openmarket.com>.
132776910425Smrg	# How about differentiating between stratus architectures? -djm
1328a67f45c3Smrg	GUESS=hppa1.1-stratus-sysv4
1329a67f45c3Smrg	;;
133076910425Smrg    *:*:*:FTX*)
133176910425Smrg	# From seanf@swdc.stratus.com.
1332a67f45c3Smrg	GUESS=i860-stratus-sysv4
1333a67f45c3Smrg	;;
133476910425Smrg    i*86:VOS:*:*)
133576910425Smrg	# From Paul.Green@stratus.com.
1336a67f45c3Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1337a67f45c3Smrg	;;
133876910425Smrg    *:VOS:*:*)
133976910425Smrg	# From Paul.Green@stratus.com.
1340a67f45c3Smrg	GUESS=hppa1.1-stratus-vos
1341a67f45c3Smrg	;;
134276910425Smrg    mc68*:A/UX:*:*)
1343a67f45c3Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1344a67f45c3Smrg	;;
134576910425Smrg    news*:NEWS-OS:6*:*)
1346a67f45c3Smrg	GUESS=mips-sony-newsos6
1347a67f45c3Smrg	;;
134876910425Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1349a67f45c3Smrg	if test -d /usr/nec; then
1350a67f45c3Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
135176910425Smrg	else
1352a67f45c3Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
135376910425Smrg	fi
1354a67f45c3Smrg	;;
135576910425Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1356a67f45c3Smrg	GUESS=powerpc-be-beos
1357a67f45c3Smrg	;;
135876910425Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1359a67f45c3Smrg	GUESS=powerpc-apple-beos
1360a67f45c3Smrg	;;
136176910425Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1362a67f45c3Smrg	GUESS=i586-pc-beos
1363a67f45c3Smrg	;;
1364db17cd6dSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1365a67f45c3Smrg	GUESS=i586-pc-haiku
1366a67f45c3Smrg	;;
13679ff100acSmrg    x86_64:Haiku:*:*)
1368a67f45c3Smrg	GUESS=x86_64-unknown-haiku
1369a67f45c3Smrg	;;
137076910425Smrg    SX-4:SUPER-UX:*:*)
1371a67f45c3Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1372a67f45c3Smrg	;;
137376910425Smrg    SX-5:SUPER-UX:*:*)
1374a67f45c3Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1375a67f45c3Smrg	;;
137676910425Smrg    SX-6:SUPER-UX:*:*)
1377a67f45c3Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1378a67f45c3Smrg	;;
1379db17cd6dSmrg    SX-7:SUPER-UX:*:*)
1380a67f45c3Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1381a67f45c3Smrg	;;
1382db17cd6dSmrg    SX-8:SUPER-UX:*:*)
1383a67f45c3Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1384a67f45c3Smrg	;;
1385db17cd6dSmrg    SX-8R:SUPER-UX:*:*)
1386a67f45c3Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1387a67f45c3Smrg	;;
1388a67f45c3Smrg    SX-ACE:SUPER-UX:*:*)
1389a67f45c3Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1390a67f45c3Smrg	;;
139176910425Smrg    Power*:Rhapsody:*:*)
1392a67f45c3Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393a67f45c3Smrg	;;
139476910425Smrg    *:Rhapsody:*:*)
1395a67f45c3Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396a67f45c3Smrg	;;
1397a67f45c3Smrg    arm64:Darwin:*:*)
1398a67f45c3Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399a67f45c3Smrg	;;
140076910425Smrg    *:Darwin:*:*)
1401a67f45c3Smrg	UNAME_PROCESSOR=`uname -p`
1402a67f45c3Smrg	case $UNAME_PROCESSOR in
1403a67f45c3Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1404a67f45c3Smrg	esac
1405a67f45c3Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1406a67f45c3Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407a67f45c3Smrg	    # Avoid executing cc if there is no toolchain installed as
1408a67f45c3Smrg	    # cc will be a stub that puts up a graphical alert
1409a67f45c3Smrg	    # prompting the user to install developer tools.
1410a67f45c3Smrg	    CC_FOR_BUILD=no_compiler_found
1411a67f45c3Smrg	else
1412a67f45c3Smrg	    set_cc_for_build
14139ff100acSmrg	fi
1414a67f45c3Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1415a67f45c3Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416a67f45c3Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417a67f45c3Smrg		   grep IS_64BIT_ARCH >/dev/null
1418a67f45c3Smrg	    then
1419a67f45c3Smrg		case $UNAME_PROCESSOR in
1420a67f45c3Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1421a67f45c3Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1422a67f45c3Smrg		esac
1423a67f45c3Smrg	    fi
1424a67f45c3Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425a67f45c3Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426a67f45c3Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427a67f45c3Smrg		   grep IS_PPC >/dev/null
1428a67f45c3Smrg	    then
1429a67f45c3Smrg		UNAME_PROCESSOR=powerpc
14309ff100acSmrg	    fi
14319ff100acSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1432a67f45c3Smrg	    # uname -m returns i386 or x86_64
1433a67f45c3Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
14349ff100acSmrg	fi
1435a67f45c3Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436a67f45c3Smrg	;;
143776910425Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
143876910425Smrg	UNAME_PROCESSOR=`uname -p`
1439a67f45c3Smrg	if test "$UNAME_PROCESSOR" = x86; then
144076910425Smrg		UNAME_PROCESSOR=i386
144176910425Smrg		UNAME_MACHINE=pc
144276910425Smrg	fi
1443a67f45c3Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444a67f45c3Smrg	;;
144576910425Smrg    *:QNX:*:4*)
1446a67f45c3Smrg	GUESS=i386-pc-qnx
1447a67f45c3Smrg	;;
1448a67f45c3Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1449a67f45c3Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1450a67f45c3Smrg	;;
14519ff100acSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1452a67f45c3Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1453a67f45c3Smrg	;;
1454a67f45c3Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1455a67f45c3Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456a67f45c3Smrg	;;
1457a67f45c3Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1458a67f45c3Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459a67f45c3Smrg	;;
1460a67f45c3Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1461a67f45c3Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462a67f45c3Smrg	;;
146376910425Smrg    *:NonStop-UX:*:*)
1464a67f45c3Smrg	GUESS=mips-compaq-nonstopux
1465a67f45c3Smrg	;;
146676910425Smrg    BS2000:POSIX*:*:*)
1467a67f45c3Smrg	GUESS=bs2000-siemens-sysv
1468a67f45c3Smrg	;;
146976910425Smrg    DS/*:UNIX_System_V:*:*)
1470a67f45c3Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471a67f45c3Smrg	;;
147276910425Smrg    *:Plan9:*:*)
147376910425Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
147476910425Smrg	# is converted to i386 for consistency with other x86
147576910425Smrg	# operating systems.
1476a67f45c3Smrg	if test "${cputype-}" = 386; then
147776910425Smrg	    UNAME_MACHINE=i386
1478a67f45c3Smrg	elif test "x${cputype-}" != x; then
1479a67f45c3Smrg	    UNAME_MACHINE=$cputype
148076910425Smrg	fi
1481a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1482a67f45c3Smrg	;;
148376910425Smrg    *:TOPS-10:*:*)
1484a67f45c3Smrg	GUESS=pdp10-unknown-tops10
1485a67f45c3Smrg	;;
148676910425Smrg    *:TENEX:*:*)
1487a67f45c3Smrg	GUESS=pdp10-unknown-tenex
1488a67f45c3Smrg	;;
148976910425Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490a67f45c3Smrg	GUESS=pdp10-dec-tops20
1491a67f45c3Smrg	;;
149276910425Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493a67f45c3Smrg	GUESS=pdp10-xkl-tops20
1494a67f45c3Smrg	;;
149576910425Smrg    *:TOPS-20:*:*)
1496a67f45c3Smrg	GUESS=pdp10-unknown-tops20
1497a67f45c3Smrg	;;
149876910425Smrg    *:ITS:*:*)
1499a67f45c3Smrg	GUESS=pdp10-unknown-its
1500a67f45c3Smrg	;;
150176910425Smrg    SEI:*:*:SEIUX)
1502a67f45c3Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1503a67f45c3Smrg	;;
150476910425Smrg    *:DragonFly:*:*)
1505a67f45c3Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507a67f45c3Smrg	;;
150876910425Smrg    *:*VMS:*:*)
15099ff100acSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510a67f45c3Smrg	case $UNAME_MACHINE in
1511a67f45c3Smrg	    A*) GUESS=alpha-dec-vms ;;
1512a67f45c3Smrg	    I*) GUESS=ia64-dec-vms ;;
1513a67f45c3Smrg	    V*) GUESS=vax-dec-vms ;;
151476910425Smrg	esac ;;
151576910425Smrg    *:XENIX:*:SysV)
1516a67f45c3Smrg	GUESS=i386-pc-xenix
1517a67f45c3Smrg	;;
151876910425Smrg    i*86:skyos:*:*)
1519a67f45c3Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521a67f45c3Smrg	;;
1522db17cd6dSmrg    i*86:rdos:*:*)
1523a67f45c3Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1524a67f45c3Smrg	;;
1525a67f45c3Smrg    *:AROS:*:*)
1526a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1527a67f45c3Smrg	;;
15289ff100acSmrg    x86_64:VMkernel:*:*)
1529a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1530a67f45c3Smrg	;;
1531a67f45c3Smrg    amd64:Isilon\ OneFS:*:*)
1532a67f45c3Smrg	GUESS=x86_64-unknown-onefs
1533a67f45c3Smrg	;;
1534a67f45c3Smrg    *:Unleashed:*:*)
1535a67f45c3Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1536a67f45c3Smrg	;;
1537a67f45c3Smrgesac
1538a67f45c3Smrg
1539a67f45c3Smrg# Do we have a guess based on uname results?
1540a67f45c3Smrgif test "x$GUESS" != x; then
1541a67f45c3Smrg    echo "$GUESS"
1542a67f45c3Smrg    exit
1543a67f45c3Smrgfi
1544a67f45c3Smrg
1545a67f45c3Smrg# No uname command or uname output not recognized.
1546a67f45c3Smrgset_cc_for_build
1547a67f45c3Smrgcat > "$dummy.c" <<EOF
1548a67f45c3Smrg#ifdef _SEQUENT_
1549a67f45c3Smrg#include <sys/types.h>
1550a67f45c3Smrg#include <sys/utsname.h>
1551a67f45c3Smrg#endif
1552a67f45c3Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1553a67f45c3Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1554a67f45c3Smrg#include <signal.h>
1555a67f45c3Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1556a67f45c3Smrg#include <sys/utsname.h>
1557a67f45c3Smrg#endif
1558a67f45c3Smrg#endif
1559a67f45c3Smrg#endif
1560a67f45c3Smrgmain ()
1561a67f45c3Smrg{
1562a67f45c3Smrg#if defined (sony)
1563a67f45c3Smrg#if defined (MIPSEB)
1564a67f45c3Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1565a67f45c3Smrg     I don't know....  */
1566a67f45c3Smrg  printf ("mips-sony-bsd\n"); exit (0);
1567a67f45c3Smrg#else
1568a67f45c3Smrg#include <sys/param.h>
1569a67f45c3Smrg  printf ("m68k-sony-newsos%s\n",
1570a67f45c3Smrg#ifdef NEWSOS4
1571a67f45c3Smrg  "4"
1572a67f45c3Smrg#else
1573a67f45c3Smrg  ""
1574a67f45c3Smrg#endif
1575a67f45c3Smrg  ); exit (0);
1576a67f45c3Smrg#endif
1577a67f45c3Smrg#endif
1578a67f45c3Smrg
1579a67f45c3Smrg#if defined (NeXT)
1580a67f45c3Smrg#if !defined (__ARCHITECTURE__)
1581a67f45c3Smrg#define __ARCHITECTURE__ "m68k"
1582a67f45c3Smrg#endif
1583a67f45c3Smrg  int version;
1584a67f45c3Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1585a67f45c3Smrg  if (version < 4)
1586a67f45c3Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1587a67f45c3Smrg  else
1588a67f45c3Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1589a67f45c3Smrg  exit (0);
1590a67f45c3Smrg#endif
1591a67f45c3Smrg
1592a67f45c3Smrg#if defined (MULTIMAX) || defined (n16)
1593a67f45c3Smrg#if defined (UMAXV)
1594a67f45c3Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1595a67f45c3Smrg#else
1596a67f45c3Smrg#if defined (CMU)
1597a67f45c3Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1598a67f45c3Smrg#else
1599a67f45c3Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1600a67f45c3Smrg#endif
1601a67f45c3Smrg#endif
1602a67f45c3Smrg#endif
1603a67f45c3Smrg
1604a67f45c3Smrg#if defined (__386BSD__)
1605a67f45c3Smrg  printf ("i386-pc-bsd\n"); exit (0);
1606a67f45c3Smrg#endif
1607a67f45c3Smrg
1608a67f45c3Smrg#if defined (sequent)
1609a67f45c3Smrg#if defined (i386)
1610a67f45c3Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1611a67f45c3Smrg#endif
1612a67f45c3Smrg#if defined (ns32000)
1613a67f45c3Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1614a67f45c3Smrg#endif
1615a67f45c3Smrg#endif
1616a67f45c3Smrg
1617a67f45c3Smrg#if defined (_SEQUENT_)
1618a67f45c3Smrg  struct utsname un;
1619a67f45c3Smrg
1620a67f45c3Smrg  uname(&un);
1621a67f45c3Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1622a67f45c3Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1623a67f45c3Smrg  }
1624a67f45c3Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1625a67f45c3Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1626a67f45c3Smrg  }
1627a67f45c3Smrg  printf ("i386-sequent-ptx\n"); exit (0);
1628a67f45c3Smrg#endif
1629a67f45c3Smrg
1630a67f45c3Smrg#if defined (vax)
1631a67f45c3Smrg#if !defined (ultrix)
1632a67f45c3Smrg#include <sys/param.h>
1633a67f45c3Smrg#if defined (BSD)
1634a67f45c3Smrg#if BSD == 43
1635a67f45c3Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1636a67f45c3Smrg#else
1637a67f45c3Smrg#if BSD == 199006
1638a67f45c3Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1639a67f45c3Smrg#else
1640a67f45c3Smrg  printf ("vax-dec-bsd\n"); exit (0);
1641a67f45c3Smrg#endif
1642a67f45c3Smrg#endif
1643a67f45c3Smrg#else
1644a67f45c3Smrg  printf ("vax-dec-bsd\n"); exit (0);
1645a67f45c3Smrg#endif
1646a67f45c3Smrg#else
1647a67f45c3Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1648a67f45c3Smrg  struct utsname un;
1649a67f45c3Smrg  uname (&un);
1650a67f45c3Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1651a67f45c3Smrg#else
1652a67f45c3Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1653a67f45c3Smrg#endif
1654a67f45c3Smrg#endif
1655a67f45c3Smrg#endif
1656a67f45c3Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1657a67f45c3Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1658a67f45c3Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1659a67f45c3Smrg  struct utsname *un;
1660a67f45c3Smrg  uname (&un);
1661a67f45c3Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1662a67f45c3Smrg#else
1663a67f45c3Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1664a67f45c3Smrg#endif
1665a67f45c3Smrg#endif
1666a67f45c3Smrg#endif
1667a67f45c3Smrg
1668a67f45c3Smrg#if defined (alliant) && defined (i860)
1669a67f45c3Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1670a67f45c3Smrg#endif
1671a67f45c3Smrg
1672a67f45c3Smrg  exit (1);
1673a67f45c3Smrg}
1674a67f45c3SmrgEOF
1675a67f45c3Smrg
1676a67f45c3Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1677a67f45c3Smrg	{ echo "$SYSTEM_NAME"; exit; }
1678a67f45c3Smrg
1679a67f45c3Smrg# Apollos put the system type in the environment.
1680a67f45c3Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1681a67f45c3Smrg
1682a67f45c3Smrgecho "$0: unable to guess system type" >&2
1683a67f45c3Smrg
1684a67f45c3Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685a67f45c3Smrg    mips:Linux | mips64:Linux)
1686a67f45c3Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1687a67f45c3Smrg	cat >&2 <<EOF
1688a67f45c3Smrg
1689a67f45c3SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690a67f45c3Smrgthe system type. Please install a C compiler and try again.
1691a67f45c3SmrgEOF
1692a67f45c3Smrg	;;
16939ff100acSmrgesac
169476910425Smrg
169576910425Smrgcat >&2 <<EOF
169676910425Smrg
1697a67f45c3SmrgThis script (version $timestamp), has failed to recognize the
1698a67f45c3Smrgoperating system you are using. If your script is old, overwrite *all*
1699a67f45c3Smrgcopies of config.guess and config.sub with the latest versions from:
170076910425Smrg
1701a67f45c3Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
170276910425Smrgand
1703a67f45c3Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1704a67f45c3SmrgEOF
170576910425Smrg
1706a67f45c3Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1707a67f45c3Smrgthisyear=`date +%Y`
1708a67f45c3Smrg# shellcheck disable=SC2003
1709a67f45c3Smrgscript_age=`expr "$thisyear" - "$our_year"`
1710a67f45c3Smrgif test "$script_age" -lt 3 ; then
1711a67f45c3Smrg   cat >&2 <<EOF
1712a67f45c3Smrg
1713a67f45c3SmrgIf $0 has already been updated, send the following data and any
1714a67f45c3Smrginformation you think might be pertinent to config-patches@gnu.org to
1715a67f45c3Smrgprovide the necessary information to handle your system.
171676910425Smrg
171776910425Smrgconfig.guess timestamp = $timestamp
171876910425Smrg
171976910425Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
172076910425Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
172176910425Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
172276910425Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
172376910425Smrg
172476910425Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
172576910425Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
172676910425Smrg
172776910425Smrghostinfo               = `(hostinfo) 2>/dev/null`
172876910425Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
172976910425Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
173076910425Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
173176910425Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
173276910425Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
173376910425Smrg
1734a67f45c3SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735a67f45c3SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736a67f45c3SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737a67f45c3SmrgUNAME_VERSION = "$UNAME_VERSION"
173876910425SmrgEOF
1739a67f45c3Smrgfi
174076910425Smrg
174176910425Smrgexit 1
174276910425Smrg
174376910425Smrg# Local variables:
1744a67f45c3Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
174576910425Smrg# time-stamp-start: "timestamp='"
174676910425Smrg# time-stamp-format: "%:y-%02m-%02d"
174776910425Smrg# time-stamp-end: "'"
174876910425Smrg# End:
1749