1c76ae52dSmrg#! /bin/sh
2c76ae52dSmrg# Attempt to guess a canonical system name.
325420f97Smrg#   Copyright 1992-2022 Free Software Foundation, Inc.
4c76ae52dSmrg
525420f97Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
625420f97Smrg
7de301c82Smrgtimestamp='2022-01-09'
8c76ae52dSmrg
9c76ae52dSmrg# This file is free software; you can redistribute it and/or modify it
10c76ae52dSmrg# under the terms of the GNU General Public License as published by
1125420f97Smrg# the Free Software Foundation, either version 3 of the License, or
12c76ae52dSmrg# (at your option) any later version.
13c76ae52dSmrg#
14c76ae52dSmrg# This program is distributed in the hope that it will be useful, but
15c76ae52dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16c76ae52dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17c76ae52dSmrg# General Public License for more details.
18c76ae52dSmrg#
19c76ae52dSmrg# You should have received a copy of the GNU General Public License
208292847cSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21c76ae52dSmrg#
22c76ae52dSmrg# As a special exception to the GNU General Public License, if you
23c76ae52dSmrg# distribute this file as part of a program that contains a
24c76ae52dSmrg# configuration script generated by Autoconf, you may include it under
25dff01e5aSmrg# the same distribution terms that you use for the rest of that
26dff01e5aSmrg# program.  This Exception is an additional permission under section 7
27dff01e5aSmrg# of the GNU General Public License, version 3 ("GPLv3").
28c76ae52dSmrg#
298292847cSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30c76ae52dSmrg#
31c2939121Smrg# You can get the latest version of this script from:
3225420f97Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33dff01e5aSmrg#
348292847cSmrg# Please send patches to <config-patches@gnu.org>.
35dff01e5aSmrg
36c76ae52dSmrg
3725420f97Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
3825420f97Smrg# about features and limitations of the classic Bourne shell that were
3925420f97Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
4025420f97Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
4125420f97Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
4225420f97Smrg# have a pre-POSIX /bin/sh.
4325420f97Smrg
4425420f97Smrg
45c76ae52dSmrgme=`echo "$0" | sed -e 's,.*/,,'`
46c76ae52dSmrg
47c76ae52dSmrgusage="\
48c76ae52dSmrgUsage: $0 [OPTION]
49c76ae52dSmrg
50c76ae52dSmrgOutput the configuration name of the system \`$me' is run on.
51c76ae52dSmrg
528292847cSmrgOptions:
53c76ae52dSmrg  -h, --help         print this help, then exit
54c76ae52dSmrg  -t, --time-stamp   print date of last modification, then exit
55c76ae52dSmrg  -v, --version      print version number, then exit
56c76ae52dSmrg
57c76ae52dSmrgReport bugs and patches to <config-patches@gnu.org>."
58c76ae52dSmrg
59c76ae52dSmrgversion="\
60c76ae52dSmrgGNU config.guess ($timestamp)
61c76ae52dSmrg
62c76ae52dSmrgOriginally written by Per Bothner.
6325420f97SmrgCopyright 1992-2022 Free Software Foundation, Inc.
64c76ae52dSmrg
65c76ae52dSmrgThis is free software; see the source for copying conditions.  There is NO
66c76ae52dSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67c76ae52dSmrg
68c76ae52dSmrghelp="
69c76ae52dSmrgTry \`$me --help' for more information."
70c76ae52dSmrg
71c76ae52dSmrg# Parse command line
72c76ae52dSmrgwhile test $# -gt 0 ; do
73c76ae52dSmrg  case $1 in
74c76ae52dSmrg    --time-stamp | --time* | -t )
75c76ae52dSmrg       echo "$timestamp" ; exit ;;
76c76ae52dSmrg    --version | -v )
77c76ae52dSmrg       echo "$version" ; exit ;;
78c76ae52dSmrg    --help | --h* | -h )
79c76ae52dSmrg       echo "$usage"; exit ;;
80c76ae52dSmrg    -- )     # Stop option processing
81c76ae52dSmrg       shift; break ;;
82c76ae52dSmrg    - )	# Use stdin as input.
83c76ae52dSmrg       break ;;
84c76ae52dSmrg    -* )
85c76ae52dSmrg       echo "$me: invalid option $1$help" >&2
86c76ae52dSmrg       exit 1 ;;
87c76ae52dSmrg    * )
88c76ae52dSmrg       break ;;
89c76ae52dSmrg  esac
90c76ae52dSmrgdone
91c76ae52dSmrg
92c76ae52dSmrgif test $# != 0; then
93c76ae52dSmrg  echo "$me: too many arguments$help" >&2
94c76ae52dSmrg  exit 1
95c76ae52dSmrgfi
96c76ae52dSmrg
9725420f97Smrg# Just in case it came from the environment.
9825420f97SmrgGUESS=
99c76ae52dSmrg
100c76ae52dSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101c76ae52dSmrg# compiler to aid in system detection is discouraged as it requires
102c76ae52dSmrg# temporary files to be created and, as you can see below, it is a
103c76ae52dSmrg# headache to deal with in a portable fashion.
104c76ae52dSmrg
105c76ae52dSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106c76ae52dSmrg# use `HOST_CC' if defined, but it is deprecated.
107c76ae52dSmrg
108c76ae52dSmrg# Portable tmp directory creation inspired by the Autoconf team.
109c76ae52dSmrg
11025420f97Smrgtmp=
11125420f97Smrg# shellcheck disable=SC2172
11225420f97Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
11325420f97Smrg
11425420f97Smrgset_cc_for_build() {
11525420f97Smrg    # prevent multiple calls if $tmp is already set
11625420f97Smrg    test "$tmp" && return 0
11725420f97Smrg    : "${TMPDIR=/tmp}"
11825420f97Smrg    # shellcheck disable=SC2039,SC3028
11925420f97Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
12025420f97Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
12125420f97Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
12225420f97Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
12325420f97Smrg    dummy=$tmp/dummy
12425420f97Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
12525420f97Smrg	,,)    echo "int x;" > "$dummy.c"
12625420f97Smrg	       for driver in cc gcc c89 c99 ; do
12725420f97Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
12825420f97Smrg		       CC_FOR_BUILD=$driver
12925420f97Smrg		       break
13025420f97Smrg		   fi
13125420f97Smrg	       done
13225420f97Smrg	       if test x"$CC_FOR_BUILD" = x ; then
13325420f97Smrg		   CC_FOR_BUILD=no_compiler_found
13425420f97Smrg	       fi
13525420f97Smrg	       ;;
13625420f97Smrg	,,*)   CC_FOR_BUILD=$CC ;;
13725420f97Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13825420f97Smrg    esac
13925420f97Smrg}
140c76ae52dSmrg
141c76ae52dSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142c76ae52dSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
14325420f97Smrgif test -f /.attbin/uname ; then
144c76ae52dSmrg	PATH=$PATH:/.attbin ; export PATH
145c76ae52dSmrgfi
146c76ae52dSmrg
147c76ae52dSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148c76ae52dSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14925420f97SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150c76ae52dSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151c76ae52dSmrg
15225420f97Smrgcase $UNAME_SYSTEM in
153dff01e5aSmrgLinux|GNU|GNU/*)
15425420f97Smrg	LIBC=unknown
155dff01e5aSmrg
15625420f97Smrg	set_cc_for_build
1578292847cSmrg	cat <<-EOF > "$dummy.c"
158dff01e5aSmrg	#include <features.h>
159dff01e5aSmrg	#if defined(__UCLIBC__)
160dff01e5aSmrg	LIBC=uclibc
161dff01e5aSmrg	#elif defined(__dietlibc__)
162dff01e5aSmrg	LIBC=dietlibc
16325420f97Smrg	#elif defined(__GLIBC__)
164de3c0529Smrg	LIBC=gnu
16525420f97Smrg	#else
16625420f97Smrg	#include <stdarg.h>
16725420f97Smrg	/* First heuristic to detect musl libc.  */
16825420f97Smrg	#ifdef __DEFINED_va_list
16925420f97Smrg	LIBC=musl
17025420f97Smrg	#endif
171dff01e5aSmrg	#endif
172dff01e5aSmrg	EOF
17325420f97Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
17425420f97Smrg	eval "$cc_set_libc"
1758292847cSmrg
17625420f97Smrg	# Second heuristic to detect musl libc.
17725420f97Smrg	if [ "$LIBC" = unknown ] &&
17825420f97Smrg	   command -v ldd >/dev/null &&
17925420f97Smrg	   ldd --version 2>&1 | grep -q ^musl; then
18025420f97Smrg		LIBC=musl
18125420f97Smrg	fi
18225420f97Smrg
18325420f97Smrg	# If the system lacks a compiler, then just pick glibc.
18425420f97Smrg	# We could probably try harder.
18525420f97Smrg	if [ "$LIBC" = unknown ]; then
18625420f97Smrg		LIBC=gnu
1878292847cSmrg	fi
188dff01e5aSmrg	;;
189dff01e5aSmrgesac
190dff01e5aSmrg
191c76ae52dSmrg# Note: order is significant - the case branches are not exclusive.
192c76ae52dSmrg
19325420f97Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194c76ae52dSmrg    *:NetBSD:*:*)
195c76ae52dSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
196dff01e5aSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197c76ae52dSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198c76ae52dSmrg	# switched to ELF, *-*-netbsd* would select the old
199c76ae52dSmrg	# object file format.  This provides both forward
200c76ae52dSmrg	# compatibility and a consistent mechanism for selecting the
201c76ae52dSmrg	# object file format.
202c76ae52dSmrg	#
203c76ae52dSmrg	# Note: NetBSD doesn't particularly care about the vendor
204c76ae52dSmrg	# portion of the name.  We always set it to "unknown".
2058292847cSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
20625420f97Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20725420f97Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2088292847cSmrg	    echo unknown)`
20925420f97Smrg	case $UNAME_MACHINE_ARCH in
21025420f97Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
211c76ae52dSmrg	    armeb) machine=armeb-unknown ;;
212c76ae52dSmrg	    arm*) machine=arm-unknown ;;
213c76ae52dSmrg	    sh3el) machine=shl-unknown ;;
214c76ae52dSmrg	    sh3eb) machine=sh-unknown ;;
2150d590c07Smrg	    sh5el) machine=sh5le-unknown ;;
2168292847cSmrg	    earmv*)
2178292847cSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2188292847cSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
21925420f97Smrg		machine=${arch}${endian}-unknown
2208292847cSmrg		;;
22125420f97Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222c76ae52dSmrg	esac
223c76ae52dSmrg	# The Operating System including object format, if it has switched
2248292847cSmrg	# to ELF recently (or will in the future) and ABI.
22525420f97Smrg	case $UNAME_MACHINE_ARCH in
2268292847cSmrg	    earm*)
2278292847cSmrg		os=netbsdelf
2288292847cSmrg		;;
229c76ae52dSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
23025420f97Smrg		set_cc_for_build
231c76ae52dSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232c2939121Smrg			| grep -q __ELF__
233c76ae52dSmrg		then
234c76ae52dSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235c76ae52dSmrg		    # Return netbsd for either.  FIX?
236c76ae52dSmrg		    os=netbsd
237c76ae52dSmrg		else
238c76ae52dSmrg		    os=netbsdelf
239c76ae52dSmrg		fi
240c76ae52dSmrg		;;
241c76ae52dSmrg	    *)
2422836776bSmrg		os=netbsd
243c76ae52dSmrg		;;
244c76ae52dSmrg	esac
2458292847cSmrg	# Determine ABI tags.
24625420f97Smrg	case $UNAME_MACHINE_ARCH in
2478292847cSmrg	    earm*)
2488292847cSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2498292847cSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2508292847cSmrg		;;
2518292847cSmrg	esac
252c76ae52dSmrg	# The OS release
253c76ae52dSmrg	# Debian GNU/NetBSD machines have a different userland, and
254c76ae52dSmrg	# thus, need a distinct triplet. However, they do not need
255c76ae52dSmrg	# kernel version information, so it can be replaced with a
256c76ae52dSmrg	# suitable tag, in the style of linux-gnu.
25725420f97Smrg	case $UNAME_VERSION in
258c76ae52dSmrg	    Debian*)
259c76ae52dSmrg		release='-gnu'
260c76ae52dSmrg		;;
261c76ae52dSmrg	    *)
2628292847cSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263c76ae52dSmrg		;;
264c76ae52dSmrg	esac
265c76ae52dSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266c76ae52dSmrg	# contains redundant information, the shorter form:
267c76ae52dSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
26825420f97Smrg	GUESS=$machine-${os}${release}${abi-}
26925420f97Smrg	;;
270dff01e5aSmrg    *:Bitrig:*:*)
271dff01e5aSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
27225420f97Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
27325420f97Smrg	;;
274c76ae52dSmrg    *:OpenBSD:*:*)
275c76ae52dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
27625420f97Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
27725420f97Smrg	;;
27825420f97Smrg    *:SecBSD:*:*)
27925420f97Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
28025420f97Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
28125420f97Smrg	;;
2828292847cSmrg    *:LibertyBSD:*:*)
2838292847cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
28425420f97Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
28525420f97Smrg	;;
2868292847cSmrg    *:MidnightBSD:*:*)
28725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
28825420f97Smrg	;;
289c76ae52dSmrg    *:ekkoBSD:*:*)
29025420f97Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
29125420f97Smrg	;;
292c76ae52dSmrg    *:SolidBSD:*:*)
29325420f97Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
29425420f97Smrg	;;
29525420f97Smrg    *:OS108:*:*)
29625420f97Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
29725420f97Smrg	;;
298c76ae52dSmrg    macppc:MirBSD:*:*)
29925420f97Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
30025420f97Smrg	;;
301c76ae52dSmrg    *:MirBSD:*:*)
30225420f97Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
30325420f97Smrg	;;
3048292847cSmrg    *:Sortix:*:*)
30525420f97Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
30625420f97Smrg	;;
30725420f97Smrg    *:Twizzler:*:*)
30825420f97Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
30925420f97Smrg	;;
3108292847cSmrg    *:Redox:*:*)
31125420f97Smrg	GUESS=$UNAME_MACHINE-unknown-redox
31225420f97Smrg	;;
3138292847cSmrg    mips:OSF1:*.*)
31425420f97Smrg	GUESS=mips-dec-osf1
31525420f97Smrg	;;
316c76ae52dSmrg    alpha:OSF1:*:*)
31725420f97Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
31825420f97Smrg	trap '' 0
319c76ae52dSmrg	case $UNAME_RELEASE in
320c76ae52dSmrg	*4.0)
321c76ae52dSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322c76ae52dSmrg		;;
323c76ae52dSmrg	*5.*)
3242836776bSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325c76ae52dSmrg		;;
326c76ae52dSmrg	esac
327c76ae52dSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328c76ae52dSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329c76ae52dSmrg	# covers most systems running today.  This code pipes the CPU
330c76ae52dSmrg	# types through head -n 1, so we only detect the type of CPU 0.
331c76ae52dSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
33225420f97Smrg	case $ALPHA_CPU_TYPE in
333c76ae52dSmrg	    "EV4 (21064)")
3348292847cSmrg		UNAME_MACHINE=alpha ;;
335c76ae52dSmrg	    "EV4.5 (21064)")
3368292847cSmrg		UNAME_MACHINE=alpha ;;
337c76ae52dSmrg	    "LCA4 (21066/21068)")
3388292847cSmrg		UNAME_MACHINE=alpha ;;
339c76ae52dSmrg	    "EV5 (21164)")
3408292847cSmrg		UNAME_MACHINE=alphaev5 ;;
341c76ae52dSmrg	    "EV5.6 (21164A)")
3428292847cSmrg		UNAME_MACHINE=alphaev56 ;;
343c76ae52dSmrg	    "EV5.6 (21164PC)")
3448292847cSmrg		UNAME_MACHINE=alphapca56 ;;
345c76ae52dSmrg	    "EV5.7 (21164PC)")
3468292847cSmrg		UNAME_MACHINE=alphapca57 ;;
347c76ae52dSmrg	    "EV6 (21264)")
3488292847cSmrg		UNAME_MACHINE=alphaev6 ;;
349c76ae52dSmrg	    "EV6.7 (21264A)")
3508292847cSmrg		UNAME_MACHINE=alphaev67 ;;
351c76ae52dSmrg	    "EV6.8CB (21264C)")
3528292847cSmrg		UNAME_MACHINE=alphaev68 ;;
353c76ae52dSmrg	    "EV6.8AL (21264B)")
3548292847cSmrg		UNAME_MACHINE=alphaev68 ;;
355c76ae52dSmrg	    "EV6.8CX (21264D)")
3568292847cSmrg		UNAME_MACHINE=alphaev68 ;;
357c76ae52dSmrg	    "EV6.9A (21264/EV69A)")
3588292847cSmrg		UNAME_MACHINE=alphaev69 ;;
359c76ae52dSmrg	    "EV7 (21364)")
3608292847cSmrg		UNAME_MACHINE=alphaev7 ;;
361c76ae52dSmrg	    "EV7.9 (21364A)")
3628292847cSmrg		UNAME_MACHINE=alphaev79 ;;
363c76ae52dSmrg	esac
364c76ae52dSmrg	# A Pn.n version is a patched version.
365c76ae52dSmrg	# A Vn.n version is a released version.
366c76ae52dSmrg	# A Tn.n version is a released field test version.
367c76ae52dSmrg	# A Xn.n version is an unreleased experimental baselevel.
368c76ae52dSmrg	# 1.2 uses "1.2" for uname -r.
36925420f97Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
37025420f97Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
37125420f97Smrg	;;
372c76ae52dSmrg    Amiga*:UNIX_System_V:4.0:*)
37325420f97Smrg	GUESS=m68k-unknown-sysv4
37425420f97Smrg	;;
375c76ae52dSmrg    *:[Aa]miga[Oo][Ss]:*:*)
37625420f97Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
37725420f97Smrg	;;
378c76ae52dSmrg    *:[Mm]orph[Oo][Ss]:*:*)
37925420f97Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
38025420f97Smrg	;;
381c76ae52dSmrg    *:OS/390:*:*)
38225420f97Smrg	GUESS=i370-ibm-openedition
38325420f97Smrg	;;
384c76ae52dSmrg    *:z/VM:*:*)
38525420f97Smrg	GUESS=s390-ibm-zvmoe
38625420f97Smrg	;;
387c76ae52dSmrg    *:OS400:*:*)
38825420f97Smrg	GUESS=powerpc-ibm-os400
38925420f97Smrg	;;
390c76ae52dSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
39125420f97Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
39225420f97Smrg	;;
393dff01e5aSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
39425420f97Smrg	GUESS=arm-unknown-riscos
39525420f97Smrg	;;
396c76ae52dSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
39725420f97Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
39825420f97Smrg	;;
399c76ae52dSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400c76ae52dSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
40125420f97Smrg	case `(/bin/universe) 2>/dev/null` in
40225420f97Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
40325420f97Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
40425420f97Smrg	esac
40525420f97Smrg	;;
406c76ae52dSmrg    NILE*:*:*:dcosx)
40725420f97Smrg	GUESS=pyramid-pyramid-svr4
40825420f97Smrg	;;
409c76ae52dSmrg    DRS?6000:unix:4.0:6*)
41025420f97Smrg	GUESS=sparc-icl-nx6
41125420f97Smrg	;;
412c76ae52dSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413c76ae52dSmrg	case `/usr/bin/uname -p` in
41425420f97Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
41525420f97Smrg	esac
41625420f97Smrg	;;
417c2939121Smrg    s390x:SunOS:*:*)
41825420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
41925420f97Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
42025420f97Smrg	;;
421c76ae52dSmrg    sun4H:SunOS:5.*:*)
42225420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42325420f97Smrg	GUESS=sparc-hal-solaris2$SUN_REL
42425420f97Smrg	;;
425c76ae52dSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
42625420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42725420f97Smrg	GUESS=sparc-sun-solaris2$SUN_REL
42825420f97Smrg	;;
429c2939121Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
43025420f97Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
43125420f97Smrg	;;
4320d590c07Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
43325420f97Smrg	set_cc_for_build
4348292847cSmrg	SUN_ARCH=i386
435c2939121Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436c2939121Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437c2939121Smrg	# This test works for both compilers.
43825420f97Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439c2939121Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
44025420f97Smrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441c2939121Smrg		grep IS_64BIT_ARCH >/dev/null
442c2939121Smrg	    then
4438292847cSmrg		SUN_ARCH=x86_64
444c2939121Smrg	    fi
445c2939121Smrg	fi
44625420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
44725420f97Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
44825420f97Smrg	;;
449c76ae52dSmrg    sun4*:SunOS:6*:*)
450c76ae52dSmrg	# According to config.sub, this is the proper way to canonicalize
451c76ae52dSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452c76ae52dSmrg	# it's likely to be more like Solaris than SunOS4.
45325420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
45425420f97Smrg	GUESS=sparc-sun-solaris3$SUN_REL
45525420f97Smrg	;;
456c76ae52dSmrg    sun4*:SunOS:*:*)
45725420f97Smrg	case `/usr/bin/arch -k` in
458c76ae52dSmrg	    Series*|S4*)
459c76ae52dSmrg		UNAME_RELEASE=`uname -v`
460c76ae52dSmrg		;;
461c76ae52dSmrg	esac
462c76ae52dSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
46325420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
46425420f97Smrg	GUESS=sparc-sun-sunos$SUN_REL
46525420f97Smrg	;;
466c76ae52dSmrg    sun3*:SunOS:*:*)
46725420f97Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
46825420f97Smrg	;;
469c76ae52dSmrg    sun*:*:4.2BSD:*)
470c76ae52dSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4718292847cSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
47225420f97Smrg	case `/bin/arch` in
473c76ae52dSmrg	    sun3)
47425420f97Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475c76ae52dSmrg		;;
476c76ae52dSmrg	    sun4)
47725420f97Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478c76ae52dSmrg		;;
479c76ae52dSmrg	esac
48025420f97Smrg	;;
481c76ae52dSmrg    aushp:SunOS:*:*)
48225420f97Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
48325420f97Smrg	;;
484c76ae52dSmrg    # The situation for MiNT is a little confusing.  The machine name
485c76ae52dSmrg    # can be virtually everything (everything which is not
486c76ae52dSmrg    # "atarist" or "atariste" at least should have a processor
487c76ae52dSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488c76ae52dSmrg    # to the lowercase version "mint" (or "freemint").  Finally
489c76ae52dSmrg    # the system name "TOS" denotes a system which is actually not
490c76ae52dSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491c76ae52dSmrg    # be no problem.
492c76ae52dSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
49325420f97Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49425420f97Smrg	;;
495c76ae52dSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
49625420f97Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49725420f97Smrg	;;
498c76ae52dSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
49925420f97Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
50025420f97Smrg	;;
501c76ae52dSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
50225420f97Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
50325420f97Smrg	;;
504c76ae52dSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
50525420f97Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
50625420f97Smrg	;;
507c76ae52dSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
50825420f97Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
50925420f97Smrg	;;
510c76ae52dSmrg    m68k:machten:*:*)
51125420f97Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
51225420f97Smrg	;;
513c76ae52dSmrg    powerpc:machten:*:*)
51425420f97Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
51525420f97Smrg	;;
516c76ae52dSmrg    RISC*:Mach:*:*)
51725420f97Smrg	GUESS=mips-dec-mach_bsd4.3
51825420f97Smrg	;;
519c76ae52dSmrg    RISC*:ULTRIX:*:*)
52025420f97Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
52125420f97Smrg	;;
522c76ae52dSmrg    VAX*:ULTRIX*:*:*)
52325420f97Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
52425420f97Smrg	;;
525c76ae52dSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
52625420f97Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
52725420f97Smrg	;;
528c76ae52dSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
52925420f97Smrg	set_cc_for_build
5308292847cSmrg	sed 's/^	//' << EOF > "$dummy.c"
531c76ae52dSmrg#ifdef __cplusplus
532c76ae52dSmrg#include <stdio.h>  /* for printf() prototype */
533c76ae52dSmrg	int main (int argc, char *argv[]) {
534c76ae52dSmrg#else
535c76ae52dSmrg	int main (argc, argv) int argc; char *argv[]; {
536c76ae52dSmrg#endif
537c76ae52dSmrg	#if defined (host_mips) && defined (MIPSEB)
538c76ae52dSmrg	#if defined (SYSTYPE_SYSV)
5398292847cSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540c76ae52dSmrg	#endif
541c76ae52dSmrg	#if defined (SYSTYPE_SVR4)
5428292847cSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543c76ae52dSmrg	#endif
544c76ae52dSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5458292847cSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546c76ae52dSmrg	#endif
547c76ae52dSmrg	#endif
548c76ae52dSmrg	  exit (-1);
549c76ae52dSmrg	}
550c76ae52dSmrgEOF
5518292847cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5528292847cSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5538292847cSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554c76ae52dSmrg	    { echo "$SYSTEM_NAME"; exit; }
55525420f97Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
55625420f97Smrg	;;
557c76ae52dSmrg    Motorola:PowerMAX_OS:*:*)
55825420f97Smrg	GUESS=powerpc-motorola-powermax
55925420f97Smrg	;;
560c76ae52dSmrg    Motorola:*:4.3:PL8-*)
56125420f97Smrg	GUESS=powerpc-harris-powermax
56225420f97Smrg	;;
563c76ae52dSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
56425420f97Smrg	GUESS=powerpc-harris-powermax
56525420f97Smrg	;;
566c76ae52dSmrg    Night_Hawk:Power_UNIX:*:*)
56725420f97Smrg	GUESS=powerpc-harris-powerunix
56825420f97Smrg	;;
569c76ae52dSmrg    m88k:CX/UX:7*:*)
57025420f97Smrg	GUESS=m88k-harris-cxux7
57125420f97Smrg	;;
572c76ae52dSmrg    m88k:*:4*:R4*)
57325420f97Smrg	GUESS=m88k-motorola-sysv4
57425420f97Smrg	;;
575c76ae52dSmrg    m88k:*:3*:R3*)
57625420f97Smrg	GUESS=m88k-motorola-sysv3
57725420f97Smrg	;;
578c76ae52dSmrg    AViiON:dgux:*:*)
5792836776bSmrg	# DG/UX returns AViiON for all architectures
5802836776bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
58125420f97Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582c76ae52dSmrg	then
58325420f97Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
58425420f97Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
585c76ae52dSmrg	    then
58625420f97Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587c76ae52dSmrg	    else
58825420f97Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589c76ae52dSmrg	    fi
590c76ae52dSmrg	else
59125420f97Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592c76ae52dSmrg	fi
59325420f97Smrg	;;
594c76ae52dSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
59525420f97Smrg	GUESS=m88k-dolphin-sysv3
59625420f97Smrg	;;
597c76ae52dSmrg    M88*:*:R3*:*)
598c76ae52dSmrg	# Delta 88k system running SVR3
59925420f97Smrg	GUESS=m88k-motorola-sysv3
60025420f97Smrg	;;
601c76ae52dSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
60225420f97Smrg	GUESS=m88k-tektronix-sysv3
60325420f97Smrg	;;
604c76ae52dSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
60525420f97Smrg	GUESS=m68k-tektronix-bsd
60625420f97Smrg	;;
607c76ae52dSmrg    *:IRIX*:*:*)
60825420f97Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
60925420f97Smrg	GUESS=mips-sgi-irix$IRIX_REL
61025420f97Smrg	;;
611c76ae52dSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
61225420f97Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
61325420f97Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614c76ae52dSmrg    i*86:AIX:*:*)
61525420f97Smrg	GUESS=i386-ibm-aix
61625420f97Smrg	;;
617c76ae52dSmrg    ia64:AIX:*:*)
61825420f97Smrg	if test -x /usr/bin/oslevel ; then
619c76ae52dSmrg		IBM_REV=`/usr/bin/oslevel`
620c76ae52dSmrg	else
62125420f97Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622c76ae52dSmrg	fi
62325420f97Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
62425420f97Smrg	;;
625c76ae52dSmrg    *:AIX:2:3)
626c76ae52dSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
62725420f97Smrg		set_cc_for_build
6288292847cSmrg		sed 's/^		//' << EOF > "$dummy.c"
629c76ae52dSmrg		#include <sys/systemcfg.h>
630c76ae52dSmrg
631c76ae52dSmrg		main()
632c76ae52dSmrg			{
633c76ae52dSmrg			if (!__power_pc())
634c76ae52dSmrg				exit(1);
635c76ae52dSmrg			puts("powerpc-ibm-aix3.2.5");
636c76ae52dSmrg			exit(0);
637c76ae52dSmrg			}
638c76ae52dSmrgEOF
6398292847cSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640c76ae52dSmrg		then
64125420f97Smrg			GUESS=$SYSTEM_NAME
642c76ae52dSmrg		else
64325420f97Smrg			GUESS=rs6000-ibm-aix3.2.5
644c76ae52dSmrg		fi
645c76ae52dSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
64625420f97Smrg		GUESS=rs6000-ibm-aix3.2.4
647c76ae52dSmrg	else
64825420f97Smrg		GUESS=rs6000-ibm-aix3.2
649c76ae52dSmrg	fi
65025420f97Smrg	;;
651c2939121Smrg    *:AIX:*:[4567])
652c76ae52dSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6538292847cSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654c76ae52dSmrg		IBM_ARCH=rs6000
655c76ae52dSmrg	else
656c76ae52dSmrg		IBM_ARCH=powerpc
657c76ae52dSmrg	fi
65825420f97Smrg	if test -x /usr/bin/lslpp ; then
65925420f97Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6608292847cSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661c76ae52dSmrg	else
66225420f97Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663c76ae52dSmrg	fi
66425420f97Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
66525420f97Smrg	;;
666c76ae52dSmrg    *:AIX:*:*)
66725420f97Smrg	GUESS=rs6000-ibm-aix
66825420f97Smrg	;;
6698292847cSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
67025420f97Smrg	GUESS=romp-ibm-bsd4.4
67125420f97Smrg	;;
672c76ae52dSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
67325420f97Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
67425420f97Smrg	;;                                  # report: romp-ibm BSD 4.3
675c76ae52dSmrg    *:BOSX:*:*)
67625420f97Smrg	GUESS=rs6000-bull-bosx
67725420f97Smrg	;;
678c76ae52dSmrg    DPX/2?00:B.O.S.:*:*)
67925420f97Smrg	GUESS=m68k-bull-sysv3
68025420f97Smrg	;;
681c76ae52dSmrg    9000/[34]??:4.3bsd:1.*:*)
68225420f97Smrg	GUESS=m68k-hp-bsd
68325420f97Smrg	;;
684c76ae52dSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
68525420f97Smrg	GUESS=m68k-hp-bsd4.4
68625420f97Smrg	;;
687c76ae52dSmrg    9000/[34678]??:HP-UX:*:*)
68825420f97Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
68925420f97Smrg	case $UNAME_MACHINE in
6908292847cSmrg	    9000/31?)            HP_ARCH=m68000 ;;
6918292847cSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
692c76ae52dSmrg	    9000/[678][0-9][0-9])
69325420f97Smrg		if test -x /usr/bin/getconf; then
694c76ae52dSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6952836776bSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
69625420f97Smrg		    case $sc_cpu_version in
6978292847cSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6988292847cSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6992836776bSmrg		      532)                      # CPU_PA_RISC2_0
70025420f97Smrg			case $sc_kernel_bits in
7018292847cSmrg			  32) HP_ARCH=hppa2.0n ;;
7028292847cSmrg			  64) HP_ARCH=hppa2.0w ;;
7038292847cSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7042836776bSmrg			esac ;;
7052836776bSmrg		    esac
706c76ae52dSmrg		fi
70725420f97Smrg		if test "$HP_ARCH" = ""; then
70825420f97Smrg		    set_cc_for_build
7098292847cSmrg		    sed 's/^		//' << EOF > "$dummy.c"
710c76ae52dSmrg
7112836776bSmrg		#define _HPUX_SOURCE
7122836776bSmrg		#include <stdlib.h>
7132836776bSmrg		#include <unistd.h>
714c76ae52dSmrg
7152836776bSmrg		int main ()
7162836776bSmrg		{
7172836776bSmrg		#if defined(_SC_KERNEL_BITS)
7182836776bSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
7192836776bSmrg		#endif
7202836776bSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721c76ae52dSmrg
7222836776bSmrg		    switch (cpu)
7232836776bSmrg			{
7242836776bSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7252836776bSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7262836776bSmrg			case CPU_PA_RISC2_0:
7272836776bSmrg		#if defined(_SC_KERNEL_BITS)
7282836776bSmrg			    switch (bits)
7292836776bSmrg				{
7302836776bSmrg				case 64: puts ("hppa2.0w"); break;
7312836776bSmrg				case 32: puts ("hppa2.0n"); break;
7322836776bSmrg				default: puts ("hppa2.0"); break;
7332836776bSmrg				} break;
7342836776bSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
7352836776bSmrg			    puts ("hppa2.0"); break;
7362836776bSmrg		#endif
7372836776bSmrg			default: puts ("hppa1.0"); break;
7382836776bSmrg			}
7392836776bSmrg		    exit (0);
7402836776bSmrg		}
741c76ae52dSmrgEOF
7428292847cSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743c76ae52dSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744c76ae52dSmrg		fi ;;
745c76ae52dSmrg	esac
74625420f97Smrg	if test "$HP_ARCH" = hppa2.0w
747c76ae52dSmrg	then
74825420f97Smrg	    set_cc_for_build
749c76ae52dSmrg
750c76ae52dSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751c76ae52dSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752c76ae52dSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753c76ae52dSmrg	    #
754c76ae52dSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
755c76ae52dSmrg	    # => hppa2.0w-hp-hpux11.23
756c76ae52dSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757c76ae52dSmrg	    # => hppa64-hp-hpux11.23
758c76ae52dSmrg
7598292847cSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760c2939121Smrg		grep -q __LP64__
761c76ae52dSmrg	    then
7628292847cSmrg		HP_ARCH=hppa2.0w
763c76ae52dSmrg	    else
7648292847cSmrg		HP_ARCH=hppa64
765c76ae52dSmrg	    fi
766c76ae52dSmrg	fi
76725420f97Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
76825420f97Smrg	;;
769c76ae52dSmrg    ia64:HP-UX:*:*)
77025420f97Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
77125420f97Smrg	GUESS=ia64-hp-hpux$HPUX_REV
77225420f97Smrg	;;
773c76ae52dSmrg    3050*:HI-UX:*:*)
77425420f97Smrg	set_cc_for_build
7758292847cSmrg	sed 's/^	//' << EOF > "$dummy.c"
776c76ae52dSmrg	#include <unistd.h>
777c76ae52dSmrg	int
778c76ae52dSmrg	main ()
779c76ae52dSmrg	{
780c76ae52dSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
781c76ae52dSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782c76ae52dSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783c76ae52dSmrg	     results, however.  */
784c76ae52dSmrg	  if (CPU_IS_PA_RISC (cpu))
785c76ae52dSmrg	    {
786c76ae52dSmrg	      switch (cpu)
787c76ae52dSmrg		{
788c76ae52dSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789c76ae52dSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790c76ae52dSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791c76ae52dSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792c76ae52dSmrg		}
793c76ae52dSmrg	    }
794c76ae52dSmrg	  else if (CPU_IS_HP_MC68K (cpu))
795c76ae52dSmrg	    puts ("m68k-hitachi-hiuxwe2");
796c76ae52dSmrg	  else puts ("unknown-hitachi-hiuxwe2");
797c76ae52dSmrg	  exit (0);
798c76ae52dSmrg	}
799c76ae52dSmrgEOF
8008292847cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801c76ae52dSmrg		{ echo "$SYSTEM_NAME"; exit; }
80225420f97Smrg	GUESS=unknown-hitachi-hiuxwe2
80325420f97Smrg	;;
8048292847cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
80525420f97Smrg	GUESS=hppa1.1-hp-bsd
80625420f97Smrg	;;
807c76ae52dSmrg    9000/8??:4.3bsd:*:*)
80825420f97Smrg	GUESS=hppa1.0-hp-bsd
80925420f97Smrg	;;
810c76ae52dSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
81125420f97Smrg	GUESS=hppa1.0-hp-mpeix
81225420f97Smrg	;;
8138292847cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
81425420f97Smrg	GUESS=hppa1.1-hp-osf
81525420f97Smrg	;;
816c76ae52dSmrg    hp8??:OSF1:*:*)
81725420f97Smrg	GUESS=hppa1.0-hp-osf
81825420f97Smrg	;;
819c76ae52dSmrg    i*86:OSF1:*:*)
82025420f97Smrg	if test -x /usr/sbin/sysversion ; then
82125420f97Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822c76ae52dSmrg	else
82325420f97Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824c76ae52dSmrg	fi
82525420f97Smrg	;;
826c76ae52dSmrg    parisc*:Lites*:*:*)
82725420f97Smrg	GUESS=hppa1.1-hp-lites
82825420f97Smrg	;;
829c76ae52dSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
83025420f97Smrg	GUESS=c1-convex-bsd
83125420f97Smrg	;;
832c76ae52dSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833c76ae52dSmrg	if getsysinfo -f scalar_acc
834c76ae52dSmrg	then echo c32-convex-bsd
835c76ae52dSmrg	else echo c2-convex-bsd
836c76ae52dSmrg	fi
8372836776bSmrg	exit ;;
838c76ae52dSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
83925420f97Smrg	GUESS=c34-convex-bsd
84025420f97Smrg	;;
841c76ae52dSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
84225420f97Smrg	GUESS=c38-convex-bsd
84325420f97Smrg	;;
844c76ae52dSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
84525420f97Smrg	GUESS=c4-convex-bsd
84625420f97Smrg	;;
847c76ae52dSmrg    CRAY*Y-MP:*:*:*)
84825420f97Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
84925420f97Smrg	GUESS=ymp-cray-unicos$CRAY_REL
85025420f97Smrg	;;
851c76ae52dSmrg    CRAY*[A-Z]90:*:*:*)
8528292847cSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853c76ae52dSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854c76ae52dSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855c76ae52dSmrg	      -e 's/\.[^.]*$/.X/'
856c76ae52dSmrg	exit ;;
857c76ae52dSmrg    CRAY*TS:*:*:*)
85825420f97Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
85925420f97Smrg	GUESS=t90-cray-unicos$CRAY_REL
86025420f97Smrg	;;
861c76ae52dSmrg    CRAY*T3E:*:*:*)
86225420f97Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86325420f97Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
86425420f97Smrg	;;
865c76ae52dSmrg    CRAY*SV1:*:*:*)
86625420f97Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86725420f97Smrg	GUESS=sv1-cray-unicos$CRAY_REL
86825420f97Smrg	;;
869c76ae52dSmrg    *:UNICOS/mp:*:*)
87025420f97Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
87125420f97Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
87225420f97Smrg	;;
873c76ae52dSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8748292847cSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8758292847cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8768292847cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
87725420f97Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
87825420f97Smrg	;;
879c76ae52dSmrg    5000:UNIX_System_V:4.*:*)
8808292847cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8818292847cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
88225420f97Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
88325420f97Smrg	;;
884c76ae52dSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
88525420f97Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
88625420f97Smrg	;;
887c76ae52dSmrg    sparc*:BSD/OS:*:*)
88825420f97Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
88925420f97Smrg	;;
890c76ae52dSmrg    *:BSD/OS:*:*)
89125420f97Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
89225420f97Smrg	;;
89325420f97Smrg    arm:FreeBSD:*:*)
89425420f97Smrg	UNAME_PROCESSOR=`uname -p`
89525420f97Smrg	set_cc_for_build
89625420f97Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
89725420f97Smrg	    | grep -q __ARM_PCS_VFP
89825420f97Smrg	then
89925420f97Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90025420f97Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
90125420f97Smrg	else
90225420f97Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90325420f97Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
90425420f97Smrg	fi
90525420f97Smrg	;;
906c76ae52dSmrg    *:FreeBSD:*:*)
9072836776bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
90825420f97Smrg	case $UNAME_PROCESSOR in
9090d590c07Smrg	    amd64)
9108292847cSmrg		UNAME_PROCESSOR=x86_64 ;;
9118292847cSmrg	    i386)
9128292847cSmrg		UNAME_PROCESSOR=i586 ;;
913c76ae52dSmrg	esac
91425420f97Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
91525420f97Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
91625420f97Smrg	;;
917c76ae52dSmrg    i*:CYGWIN*:*)
91825420f97Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
91925420f97Smrg	;;
920dff01e5aSmrg    *:MINGW64*:*)
92125420f97Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
92225420f97Smrg	;;
9230d590c07Smrg    *:MINGW*:*)
92425420f97Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
92525420f97Smrg	;;
9268292847cSmrg    *:MSYS*:*)
92725420f97Smrg	GUESS=$UNAME_MACHINE-pc-msys
92825420f97Smrg	;;
929c76ae52dSmrg    i*:PW*:*)
93025420f97Smrg	GUESS=$UNAME_MACHINE-pc-pw32
93125420f97Smrg	;;
93225420f97Smrg    *:SerenityOS:*:*)
93325420f97Smrg        GUESS=$UNAME_MACHINE-pc-serenity
93425420f97Smrg        ;;
935c2939121Smrg    *:Interix*:*)
93625420f97Smrg	case $UNAME_MACHINE in
9370d590c07Smrg	    x86)
93825420f97Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
93925420f97Smrg		;;
940c2939121Smrg	    authenticamd | genuineintel | EM64T)
94125420f97Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
94225420f97Smrg		;;
9430d590c07Smrg	    IA64)
94425420f97Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
94525420f97Smrg		;;
9460d590c07Smrg	esac ;;
947c76ae52dSmrg    i*:UWIN*:*)
94825420f97Smrg	GUESS=$UNAME_MACHINE-pc-uwin
94925420f97Smrg	;;
950c76ae52dSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
95125420f97Smrg	GUESS=x86_64-pc-cygwin
95225420f97Smrg	;;
953c76ae52dSmrg    prep*:SunOS:5.*:*)
95425420f97Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
95525420f97Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
95625420f97Smrg	;;
957c76ae52dSmrg    *:GNU:*:*)
958c76ae52dSmrg	# the GNU system
95925420f97Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
96025420f97Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
96125420f97Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
96225420f97Smrg	;;
963c76ae52dSmrg    *:GNU/*:*:*)
964c76ae52dSmrg	# other systems with GNU libc and userland
96525420f97Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
96625420f97Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
96725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
96825420f97Smrg	;;
96925420f97Smrg    *:Minix:*:*)
97025420f97Smrg	GUESS=$UNAME_MACHINE-unknown-minix
97125420f97Smrg	;;
972dff01e5aSmrg    aarch64:Linux:*:*)
97325420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97425420f97Smrg	;;
975dff01e5aSmrg    aarch64_be:Linux:*:*)
976dff01e5aSmrg	UNAME_MACHINE=aarch64_be
97725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97825420f97Smrg	;;
979c2939121Smrg    alpha:Linux:*:*)
98025420f97Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
981c2939121Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
982c2939121Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
983c2939121Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
984c2939121Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
985c2939121Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
986c2939121Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
987c2939121Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9882836776bSmrg	esac
989c2939121Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9908292847cSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
99125420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99225420f97Smrg	;;
99325420f97Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
99425420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99525420f97Smrg	;;
996c76ae52dSmrg    arm*:Linux:*:*)
99725420f97Smrg	set_cc_for_build
9980d590c07Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9990d590c07Smrg	    | grep -q __ARM_EABI__
10000d590c07Smrg	then
100125420f97Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10020d590c07Smrg	else
10032836776bSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10042836776bSmrg		| grep -q __ARM_PCS_VFP
10052836776bSmrg	    then
100625420f97Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10072836776bSmrg	    else
100825420f97Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10092836776bSmrg	    fi
10100d590c07Smrg	fi
101125420f97Smrg	;;
10120d590c07Smrg    avr32*:Linux:*:*)
101325420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
101425420f97Smrg	;;
1015c76ae52dSmrg    cris:Linux:*:*)
101625420f97Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101725420f97Smrg	;;
1018c76ae52dSmrg    crisv32:Linux:*:*)
101925420f97Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
102025420f97Smrg	;;
10218292847cSmrg    e2k:Linux:*:*)
102225420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102325420f97Smrg	;;
1024c76ae52dSmrg    frv:Linux:*:*)
102525420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102625420f97Smrg	;;
10272836776bSmrg    hexagon:Linux:*:*)
102825420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102925420f97Smrg	;;
1030c2939121Smrg    i*86:Linux:*:*)
103125420f97Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
103225420f97Smrg	;;
1033c76ae52dSmrg    ia64:Linux:*:*)
103425420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103525420f97Smrg	;;
10368292847cSmrg    k1om:Linux:*:*)
103725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103825420f97Smrg	;;
1039de301c82Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
104025420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104125420f97Smrg	;;
1042c76ae52dSmrg    m32r*:Linux:*:*)
104325420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104425420f97Smrg	;;
1045c76ae52dSmrg    m68*:Linux:*:*)
104625420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104725420f97Smrg	;;
1048c2939121Smrg    mips:Linux:*:* | mips64:Linux:*:*)
104925420f97Smrg	set_cc_for_build
105025420f97Smrg	IS_GLIBC=0
105125420f97Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10528292847cSmrg	sed 's/^	//' << EOF > "$dummy.c"
1053c76ae52dSmrg	#undef CPU
105425420f97Smrg	#undef mips
105525420f97Smrg	#undef mipsel
105625420f97Smrg	#undef mips64
105725420f97Smrg	#undef mips64el
105825420f97Smrg	#if ${IS_GLIBC} && defined(_ABI64)
105925420f97Smrg	LIBCABI=gnuabi64
106025420f97Smrg	#else
106125420f97Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
106225420f97Smrg	LIBCABI=gnuabin32
106325420f97Smrg	#else
106425420f97Smrg	LIBCABI=${LIBC}
106525420f97Smrg	#endif
106625420f97Smrg	#endif
106725420f97Smrg
106825420f97Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106925420f97Smrg	CPU=mipsisa64r6
107025420f97Smrg	#else
107125420f97Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
107225420f97Smrg	CPU=mipsisa32r6
107325420f97Smrg	#else
107425420f97Smrg	#if defined(__mips64)
107525420f97Smrg	CPU=mips64
107625420f97Smrg	#else
107725420f97Smrg	CPU=mips
107825420f97Smrg	#endif
107925420f97Smrg	#endif
108025420f97Smrg	#endif
108125420f97Smrg
1082c76ae52dSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
108325420f97Smrg	MIPS_ENDIAN=el
1084c76ae52dSmrg	#else
1085c76ae52dSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
108625420f97Smrg	MIPS_ENDIAN=
1087c76ae52dSmrg	#else
108825420f97Smrg	MIPS_ENDIAN=
1089c76ae52dSmrg	#endif
1090c76ae52dSmrg	#endif
1091c76ae52dSmrgEOF
109225420f97Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
109325420f97Smrg	eval "$cc_set_vars"
109425420f97Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1095c76ae52dSmrg	;;
10968292847cSmrg    mips64el:Linux:*:*)
109725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
109825420f97Smrg	;;
10998292847cSmrg    openrisc*:Linux:*:*)
110025420f97Smrg	GUESS=or1k-unknown-linux-$LIBC
110125420f97Smrg	;;
11028292847cSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
110325420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
110425420f97Smrg	;;
1105c2939121Smrg    padre:Linux:*:*)
110625420f97Smrg	GUESS=sparc-unknown-linux-$LIBC
110725420f97Smrg	;;
1108c2939121Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
110925420f97Smrg	GUESS=hppa64-unknown-linux-$LIBC
111025420f97Smrg	;;
1111c76ae52dSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
1112c76ae52dSmrg	# Look for CPU level
1113c76ae52dSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
111425420f97Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
111525420f97Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
111625420f97Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1117c76ae52dSmrg	esac
111825420f97Smrg	;;
1119c2939121Smrg    ppc64:Linux:*:*)
112025420f97Smrg	GUESS=powerpc64-unknown-linux-$LIBC
112125420f97Smrg	;;
1122c2939121Smrg    ppc:Linux:*:*)
112325420f97Smrg	GUESS=powerpc-unknown-linux-$LIBC
112425420f97Smrg	;;
1125dff01e5aSmrg    ppc64le:Linux:*:*)
112625420f97Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
112725420f97Smrg	;;
1128dff01e5aSmrg    ppcle:Linux:*:*)
112925420f97Smrg	GUESS=powerpcle-unknown-linux-$LIBC
113025420f97Smrg	;;
113125420f97Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
113225420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113325420f97Smrg	;;
1134c76ae52dSmrg    s390:Linux:*:* | s390x:Linux:*:*)
113525420f97Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
113625420f97Smrg	;;
1137c76ae52dSmrg    sh64*:Linux:*:*)
113825420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113925420f97Smrg	;;
1140c76ae52dSmrg    sh*:Linux:*:*)
114125420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114225420f97Smrg	;;
1143c76ae52dSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
114425420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114525420f97Smrg	;;
1146c2939121Smrg    tile*:Linux:*:*)
114725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114825420f97Smrg	;;
1149c76ae52dSmrg    vax:Linux:*:*)
115025420f97Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
115125420f97Smrg	;;
1152c76ae52dSmrg    x86_64:Linux:*:*)
115325420f97Smrg	set_cc_for_build
115425420f97Smrg	LIBCABI=$LIBC
115525420f97Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1156de301c82Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1157de301c82Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1158de301c82Smrg		grep IS_X32 >/dev/null
1159de301c82Smrg	    then
1160de301c82Smrg		LIBCABI=${LIBC}x32
1161de301c82Smrg	    fi
116284febdacSmrg	fi
1163de301c82Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
116425420f97Smrg	;;
11650d590c07Smrg    xtensa*:Linux:*:*)
116625420f97Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
116725420f97Smrg	;;
1168c76ae52dSmrg    i*86:DYNIX/ptx:4*:*)
1169c76ae52dSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1170c76ae52dSmrg	# earlier versions are messed up and put the nodename in both
1171c76ae52dSmrg	# sysname and nodename.
117225420f97Smrg	GUESS=i386-sequent-sysv4
117325420f97Smrg	;;
1174c76ae52dSmrg    i*86:UNIX_SV:4.2MP:2.*)
11752836776bSmrg	# Unixware is an offshoot of SVR4, but it has its own version
11762836776bSmrg	# number series starting with 2...
11772836776bSmrg	# I am not positive that other SVR4 systems won't match this,
1178c76ae52dSmrg	# I just have to hope.  -- rms.
11792836776bSmrg	# Use sysv4.2uw... so that sysv4* matches it.
118025420f97Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
118125420f97Smrg	;;
1182c76ae52dSmrg    i*86:OS/2:*:*)
1183c76ae52dSmrg	# If we were able to find `uname', then EMX Unix compatibility
1184c76ae52dSmrg	# is probably installed.
118525420f97Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
118625420f97Smrg	;;
1187c76ae52dSmrg    i*86:XTS-300:*:STOP)
118825420f97Smrg	GUESS=$UNAME_MACHINE-unknown-stop
118925420f97Smrg	;;
1190c76ae52dSmrg    i*86:atheos:*:*)
119125420f97Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
119225420f97Smrg	;;
1193c76ae52dSmrg    i*86:syllable:*:*)
119425420f97Smrg	GUESS=$UNAME_MACHINE-pc-syllable
119525420f97Smrg	;;
1196c2939121Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
119725420f97Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
119825420f97Smrg	;;
1199c76ae52dSmrg    i*86:*DOS:*:*)
120025420f97Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
120125420f97Smrg	;;
12028292847cSmrg    i*86:*:4.*:*)
12038292847cSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1204c76ae52dSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
120525420f97Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1206c76ae52dSmrg	else
120725420f97Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1208c76ae52dSmrg	fi
120925420f97Smrg	;;
1210c76ae52dSmrg    i*86:*:5:[678]*)
12112836776bSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1212c76ae52dSmrg	case `/bin/uname -X | grep "^Machine"` in
1213c76ae52dSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1214c76ae52dSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1215c76ae52dSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1216c76ae52dSmrg	esac
121725420f97Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
121825420f97Smrg	;;
1219c76ae52dSmrg    i*86:*:3.2:*)
1220c76ae52dSmrg	if test -f /usr/options/cb.name; then
1221c76ae52dSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
122225420f97Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1223c76ae52dSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1224c76ae52dSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1225c76ae52dSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1226c76ae52dSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1227c76ae52dSmrg			&& UNAME_MACHINE=i586
1228c76ae52dSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1229c76ae52dSmrg			&& UNAME_MACHINE=i686
1230c76ae52dSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1231c76ae52dSmrg			&& UNAME_MACHINE=i686
123225420f97Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1233c76ae52dSmrg	else
123425420f97Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
1235c76ae52dSmrg	fi
123625420f97Smrg	;;
1237c76ae52dSmrg    pc:*:*:*)
1238c76ae52dSmrg	# Left here for compatibility:
12392836776bSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12402836776bSmrg	# the processor, so we play safe by assuming i586.
1241c2939121Smrg	# Note: whatever this is, it MUST be the same as what config.sub
12428292847cSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1243c2939121Smrg	# this is a cross-build.
124425420f97Smrg	GUESS=i586-pc-msdosdjgpp
124525420f97Smrg	;;
1246c76ae52dSmrg    Intel:Mach:3*:*)
124725420f97Smrg	GUESS=i386-pc-mach3
124825420f97Smrg	;;
1249c76ae52dSmrg    paragon:*:*:*)
125025420f97Smrg	GUESS=i860-intel-osf1
125125420f97Smrg	;;
1252c76ae52dSmrg    i860:*:4.*:*) # i860-SVR4
1253c76ae52dSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
125425420f97Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1255c76ae52dSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
125625420f97Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1257c76ae52dSmrg	fi
125825420f97Smrg	;;
1259c76ae52dSmrg    mini*:CTIX:SYS*5:*)
1260c76ae52dSmrg	# "miniframe"
126125420f97Smrg	GUESS=m68010-convergent-sysv
126225420f97Smrg	;;
1263c76ae52dSmrg    mc68k:UNIX:SYSTEM5:3.51m)
126425420f97Smrg	GUESS=m68k-convergent-sysv
126525420f97Smrg	;;
1266c76ae52dSmrg    M680?0:D-NIX:5.3:*)
126725420f97Smrg	GUESS=m68k-diab-dnix
126825420f97Smrg	;;
1269c76ae52dSmrg    M68*:*:R3V[5678]*:*)
1270c76ae52dSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1271c76ae52dSmrg    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)
1272c76ae52dSmrg	OS_REL=''
1273c76ae52dSmrg	test -r /etc/.relid \
1274c76ae52dSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1275c76ae52dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12768292847cSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1277c76ae52dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12788292847cSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1279c76ae52dSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12802836776bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12812836776bSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1282c2939121Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1283c2939121Smrg	OS_REL='.3'
1284c2939121Smrg	test -r /etc/.relid \
1285c2939121Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1286c2939121Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12878292847cSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1288c2939121Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12898292847cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1290c2939121Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12918292847cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1292c76ae52dSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
129325420f97Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
129425420f97Smrg	;;
1295c76ae52dSmrg    mc68030:UNIX_System_V:4.*:*)
129625420f97Smrg	GUESS=m68k-atari-sysv4
129725420f97Smrg	;;
1298c76ae52dSmrg    TSUNAMI:LynxOS:2.*:*)
129925420f97Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
130025420f97Smrg	;;
1301c76ae52dSmrg    rs6000:LynxOS:2.*:*)
130225420f97Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
130325420f97Smrg	;;
1304c2939121Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
130525420f97Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
130625420f97Smrg	;;
1307c76ae52dSmrg    SM[BE]S:UNIX_SV:*:*)
130825420f97Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
130925420f97Smrg	;;
1310c76ae52dSmrg    RM*:ReliantUNIX-*:*:*)
131125420f97Smrg	GUESS=mips-sni-sysv4
131225420f97Smrg	;;
1313c76ae52dSmrg    RM*:SINIX-*:*:*)
131425420f97Smrg	GUESS=mips-sni-sysv4
131525420f97Smrg	;;
1316c76ae52dSmrg    *:SINIX-*:*:*)
1317c76ae52dSmrg	if uname -p 2>/dev/null >/dev/null ; then
1318c76ae52dSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
131925420f97Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
1320c76ae52dSmrg	else
132125420f97Smrg		GUESS=ns32k-sni-sysv
1322c76ae52dSmrg	fi
132325420f97Smrg	;;
13242836776bSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13252836776bSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
132625420f97Smrg	GUESS=i586-unisys-sysv4
132725420f97Smrg	;;
1328c76ae52dSmrg    *:UNIX_System_V:4*:FTX*)
1329c76ae52dSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1330c76ae52dSmrg	# How about differentiating between stratus architectures? -djm
133125420f97Smrg	GUESS=hppa1.1-stratus-sysv4
133225420f97Smrg	;;
1333c76ae52dSmrg    *:*:*:FTX*)
1334c76ae52dSmrg	# From seanf@swdc.stratus.com.
133525420f97Smrg	GUESS=i860-stratus-sysv4
133625420f97Smrg	;;
1337c76ae52dSmrg    i*86:VOS:*:*)
1338c76ae52dSmrg	# From Paul.Green@stratus.com.
133925420f97Smrg	GUESS=$UNAME_MACHINE-stratus-vos
134025420f97Smrg	;;
1341c76ae52dSmrg    *:VOS:*:*)
1342c76ae52dSmrg	# From Paul.Green@stratus.com.
134325420f97Smrg	GUESS=hppa1.1-stratus-vos
134425420f97Smrg	;;
1345c76ae52dSmrg    mc68*:A/UX:*:*)
134625420f97Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
134725420f97Smrg	;;
1348c76ae52dSmrg    news*:NEWS-OS:6*:*)
134925420f97Smrg	GUESS=mips-sony-newsos6
135025420f97Smrg	;;
1351c76ae52dSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
135225420f97Smrg	if test -d /usr/nec; then
135325420f97Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1354c76ae52dSmrg	else
135525420f97Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1356c76ae52dSmrg	fi
135725420f97Smrg	;;
1358c76ae52dSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
135925420f97Smrg	GUESS=powerpc-be-beos
136025420f97Smrg	;;
1361c76ae52dSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
136225420f97Smrg	GUESS=powerpc-apple-beos
136325420f97Smrg	;;
1364c76ae52dSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
136525420f97Smrg	GUESS=i586-pc-beos
136625420f97Smrg	;;
1367c2939121Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
136825420f97Smrg	GUESS=i586-pc-haiku
136925420f97Smrg	;;
1370de301c82Smrg    x86_64:Haiku:*:*)
1371de301c82Smrg	GUESS=x86_64-unknown-haiku
137225420f97Smrg	;;
1373c76ae52dSmrg    SX-4:SUPER-UX:*:*)
137425420f97Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
137525420f97Smrg	;;
1376c76ae52dSmrg    SX-5:SUPER-UX:*:*)
137725420f97Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
137825420f97Smrg	;;
1379c76ae52dSmrg    SX-6:SUPER-UX:*:*)
138025420f97Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
138125420f97Smrg	;;
13820d590c07Smrg    SX-7:SUPER-UX:*:*)
138325420f97Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
138425420f97Smrg	;;
13850d590c07Smrg    SX-8:SUPER-UX:*:*)
138625420f97Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
138725420f97Smrg	;;
13880d590c07Smrg    SX-8R:SUPER-UX:*:*)
138925420f97Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
139025420f97Smrg	;;
13918292847cSmrg    SX-ACE:SUPER-UX:*:*)
139225420f97Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
139325420f97Smrg	;;
1394c76ae52dSmrg    Power*:Rhapsody:*:*)
139525420f97Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
139625420f97Smrg	;;
1397c76ae52dSmrg    *:Rhapsody:*:*)
139825420f97Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
139925420f97Smrg	;;
140025420f97Smrg    arm64:Darwin:*:*)
140125420f97Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
140225420f97Smrg	;;
1403c76ae52dSmrg    *:Darwin:*:*)
140425420f97Smrg	UNAME_PROCESSOR=`uname -p`
140525420f97Smrg	case $UNAME_PROCESSOR in
140625420f97Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
140725420f97Smrg	esac
140825420f97Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
140925420f97Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
141025420f97Smrg	    # Avoid executing cc if there is no toolchain installed as
141125420f97Smrg	    # cc will be a stub that puts up a graphical alert
141225420f97Smrg	    # prompting the user to install developer tools.
141325420f97Smrg	    CC_FOR_BUILD=no_compiler_found
141425420f97Smrg	else
141525420f97Smrg	    set_cc_for_build
1416dff01e5aSmrg	fi
141725420f97Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
141825420f97Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
141925420f97Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
142025420f97Smrg		   grep IS_64BIT_ARCH >/dev/null
142125420f97Smrg	    then
142225420f97Smrg		case $UNAME_PROCESSOR in
142325420f97Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
142425420f97Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
142525420f97Smrg		esac
142625420f97Smrg	    fi
142725420f97Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
142825420f97Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
142925420f97Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
143025420f97Smrg		   grep IS_PPC >/dev/null
143125420f97Smrg	    then
143225420f97Smrg		UNAME_PROCESSOR=powerpc
1433dff01e5aSmrg	    fi
14348292847cSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
143525420f97Smrg	    # uname -m returns i386 or x86_64
143625420f97Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1437dff01e5aSmrg	fi
143825420f97Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
143925420f97Smrg	;;
1440c76ae52dSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1441c76ae52dSmrg	UNAME_PROCESSOR=`uname -p`
14428292847cSmrg	if test "$UNAME_PROCESSOR" = x86; then
1443c76ae52dSmrg		UNAME_PROCESSOR=i386
1444c76ae52dSmrg		UNAME_MACHINE=pc
1445c76ae52dSmrg	fi
144625420f97Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
144725420f97Smrg	;;
1448c76ae52dSmrg    *:QNX:*:4*)
144925420f97Smrg	GUESS=i386-pc-qnx
145025420f97Smrg	;;
14518292847cSmrg    NEO-*:NONSTOP_KERNEL:*:*)
145225420f97Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
145325420f97Smrg	;;
1454dff01e5aSmrg    NSE-*:NONSTOP_KERNEL:*:*)
145525420f97Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
145625420f97Smrg	;;
14578292847cSmrg    NSR-*:NONSTOP_KERNEL:*:*)
145825420f97Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
145925420f97Smrg	;;
14608292847cSmrg    NSV-*:NONSTOP_KERNEL:*:*)
146125420f97Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
146225420f97Smrg	;;
14638292847cSmrg    NSX-*:NONSTOP_KERNEL:*:*)
146425420f97Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
146525420f97Smrg	;;
1466c76ae52dSmrg    *:NonStop-UX:*:*)
146725420f97Smrg	GUESS=mips-compaq-nonstopux
146825420f97Smrg	;;
1469c76ae52dSmrg    BS2000:POSIX*:*:*)
147025420f97Smrg	GUESS=bs2000-siemens-sysv
147125420f97Smrg	;;
1472c76ae52dSmrg    DS/*:UNIX_System_V:*:*)
147325420f97Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
147425420f97Smrg	;;
1475c76ae52dSmrg    *:Plan9:*:*)
1476c76ae52dSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1477c76ae52dSmrg	# is converted to i386 for consistency with other x86
1478c76ae52dSmrg	# operating systems.
147925420f97Smrg	if test "${cputype-}" = 386; then
1480c76ae52dSmrg	    UNAME_MACHINE=i386
148125420f97Smrg	elif test "x${cputype-}" != x; then
148225420f97Smrg	    UNAME_MACHINE=$cputype
1483c76ae52dSmrg	fi
148425420f97Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
148525420f97Smrg	;;
1486c76ae52dSmrg    *:TOPS-10:*:*)
148725420f97Smrg	GUESS=pdp10-unknown-tops10
148825420f97Smrg	;;
1489c76ae52dSmrg    *:TENEX:*:*)
149025420f97Smrg	GUESS=pdp10-unknown-tenex
149125420f97Smrg	;;
1492c76ae52dSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
149325420f97Smrg	GUESS=pdp10-dec-tops20
149425420f97Smrg	;;
1495c76ae52dSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
149625420f97Smrg	GUESS=pdp10-xkl-tops20
149725420f97Smrg	;;
1498c76ae52dSmrg    *:TOPS-20:*:*)
149925420f97Smrg	GUESS=pdp10-unknown-tops20
150025420f97Smrg	;;
1501c76ae52dSmrg    *:ITS:*:*)
150225420f97Smrg	GUESS=pdp10-unknown-its
150325420f97Smrg	;;
1504c76ae52dSmrg    SEI:*:*:SEIUX)
150525420f97Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
150625420f97Smrg	;;
1507c76ae52dSmrg    *:DragonFly:*:*)
150825420f97Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
150925420f97Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
151025420f97Smrg	;;
1511c76ae52dSmrg    *:*VMS:*:*)
15122836776bSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
151325420f97Smrg	case $UNAME_MACHINE in
151425420f97Smrg	    A*) GUESS=alpha-dec-vms ;;
151525420f97Smrg	    I*) GUESS=ia64-dec-vms ;;
151625420f97Smrg	    V*) GUESS=vax-dec-vms ;;
1517c76ae52dSmrg	esac ;;
1518c76ae52dSmrg    *:XENIX:*:SysV)
151925420f97Smrg	GUESS=i386-pc-xenix
152025420f97Smrg	;;
1521c76ae52dSmrg    i*86:skyos:*:*)
152225420f97Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
152325420f97Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
152425420f97Smrg	;;
1525c76ae52dSmrg    i*86:rdos:*:*)
152625420f97Smrg	GUESS=$UNAME_MACHINE-pc-rdos
152725420f97Smrg	;;
152825420f97Smrg    i*86:Fiwix:*:*)
152925420f97Smrg	GUESS=$UNAME_MACHINE-pc-fiwix
153025420f97Smrg	;;
153125420f97Smrg    *:AROS:*:*)
153225420f97Smrg	GUESS=$UNAME_MACHINE-unknown-aros
153325420f97Smrg	;;
1534dff01e5aSmrg    x86_64:VMkernel:*:*)
153525420f97Smrg	GUESS=$UNAME_MACHINE-unknown-esx
153625420f97Smrg	;;
15378292847cSmrg    amd64:Isilon\ OneFS:*:*)
153825420f97Smrg	GUESS=x86_64-unknown-onefs
153925420f97Smrg	;;
154025420f97Smrg    *:Unleashed:*:*)
154125420f97Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
154225420f97Smrg	;;
1543c76ae52dSmrgesac
1544c76ae52dSmrg
154525420f97Smrg# Do we have a guess based on uname results?
154625420f97Smrgif test "x$GUESS" != x; then
154725420f97Smrg    echo "$GUESS"
154825420f97Smrg    exit
154925420f97Smrgfi
155025420f97Smrg
155125420f97Smrg# No uname command or uname output not recognized.
155225420f97Smrgset_cc_for_build
155325420f97Smrgcat > "$dummy.c" <<EOF
155425420f97Smrg#ifdef _SEQUENT_
155525420f97Smrg#include <sys/types.h>
155625420f97Smrg#include <sys/utsname.h>
155725420f97Smrg#endif
155825420f97Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
155925420f97Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
156025420f97Smrg#include <signal.h>
156125420f97Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
156225420f97Smrg#include <sys/utsname.h>
156325420f97Smrg#endif
156425420f97Smrg#endif
156525420f97Smrg#endif
156625420f97Smrgmain ()
156725420f97Smrg{
156825420f97Smrg#if defined (sony)
156925420f97Smrg#if defined (MIPSEB)
157025420f97Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
157125420f97Smrg     I don't know....  */
157225420f97Smrg  printf ("mips-sony-bsd\n"); exit (0);
157325420f97Smrg#else
157425420f97Smrg#include <sys/param.h>
157525420f97Smrg  printf ("m68k-sony-newsos%s\n",
157625420f97Smrg#ifdef NEWSOS4
157725420f97Smrg  "4"
157825420f97Smrg#else
157925420f97Smrg  ""
158025420f97Smrg#endif
158125420f97Smrg  ); exit (0);
158225420f97Smrg#endif
158325420f97Smrg#endif
158425420f97Smrg
158525420f97Smrg#if defined (NeXT)
158625420f97Smrg#if !defined (__ARCHITECTURE__)
158725420f97Smrg#define __ARCHITECTURE__ "m68k"
158825420f97Smrg#endif
158925420f97Smrg  int version;
159025420f97Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
159125420f97Smrg  if (version < 4)
159225420f97Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
159325420f97Smrg  else
159425420f97Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
159525420f97Smrg  exit (0);
159625420f97Smrg#endif
159725420f97Smrg
159825420f97Smrg#if defined (MULTIMAX) || defined (n16)
159925420f97Smrg#if defined (UMAXV)
160025420f97Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
160125420f97Smrg#else
160225420f97Smrg#if defined (CMU)
160325420f97Smrg  printf ("ns32k-encore-mach\n"); exit (0);
160425420f97Smrg#else
160525420f97Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
160625420f97Smrg#endif
160725420f97Smrg#endif
160825420f97Smrg#endif
160925420f97Smrg
161025420f97Smrg#if defined (__386BSD__)
161125420f97Smrg  printf ("i386-pc-bsd\n"); exit (0);
161225420f97Smrg#endif
161325420f97Smrg
161425420f97Smrg#if defined (sequent)
161525420f97Smrg#if defined (i386)
161625420f97Smrg  printf ("i386-sequent-dynix\n"); exit (0);
161725420f97Smrg#endif
161825420f97Smrg#if defined (ns32000)
161925420f97Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
162025420f97Smrg#endif
162125420f97Smrg#endif
162225420f97Smrg
162325420f97Smrg#if defined (_SEQUENT_)
162425420f97Smrg  struct utsname un;
162525420f97Smrg
162625420f97Smrg  uname(&un);
162725420f97Smrg  if (strncmp(un.version, "V2", 2) == 0) {
162825420f97Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
162925420f97Smrg  }
163025420f97Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
163125420f97Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
163225420f97Smrg  }
163325420f97Smrg  printf ("i386-sequent-ptx\n"); exit (0);
163425420f97Smrg#endif
163525420f97Smrg
163625420f97Smrg#if defined (vax)
163725420f97Smrg#if !defined (ultrix)
163825420f97Smrg#include <sys/param.h>
163925420f97Smrg#if defined (BSD)
164025420f97Smrg#if BSD == 43
164125420f97Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
164225420f97Smrg#else
164325420f97Smrg#if BSD == 199006
164425420f97Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
164525420f97Smrg#else
164625420f97Smrg  printf ("vax-dec-bsd\n"); exit (0);
164725420f97Smrg#endif
164825420f97Smrg#endif
164925420f97Smrg#else
165025420f97Smrg  printf ("vax-dec-bsd\n"); exit (0);
165125420f97Smrg#endif
165225420f97Smrg#else
165325420f97Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
165425420f97Smrg  struct utsname un;
165525420f97Smrg  uname (&un);
165625420f97Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
165725420f97Smrg#else
165825420f97Smrg  printf ("vax-dec-ultrix\n"); exit (0);
165925420f97Smrg#endif
166025420f97Smrg#endif
166125420f97Smrg#endif
166225420f97Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
166325420f97Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
166425420f97Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
166525420f97Smrg  struct utsname *un;
166625420f97Smrg  uname (&un);
166725420f97Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
166825420f97Smrg#else
166925420f97Smrg  printf ("mips-dec-ultrix\n"); exit (0);
167025420f97Smrg#endif
167125420f97Smrg#endif
167225420f97Smrg#endif
167325420f97Smrg
167425420f97Smrg#if defined (alliant) && defined (i860)
167525420f97Smrg  printf ("i860-alliant-bsd\n"); exit (0);
167625420f97Smrg#endif
167725420f97Smrg
167825420f97Smrg  exit (1);
167925420f97Smrg}
168025420f97SmrgEOF
168125420f97Smrg
168225420f97Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
168325420f97Smrg	{ echo "$SYSTEM_NAME"; exit; }
168425420f97Smrg
168525420f97Smrg# Apollos put the system type in the environment.
168625420f97Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
168725420f97Smrg
16888292847cSmrgecho "$0: unable to guess system type" >&2
1689c76ae52dSmrg
169025420f97Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
16918292847cSmrg    mips:Linux | mips64:Linux)
16928292847cSmrg	# If we got here on MIPS GNU/Linux, output extra information.
16938292847cSmrg	cat >&2 <<EOF
1694c76ae52dSmrg
16958292847cSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
16968292847cSmrgthe system type. Please install a C compiler and try again.
1697c76ae52dSmrgEOF
16988292847cSmrg	;;
16998292847cSmrgesac
1700c76ae52dSmrg
1701c76ae52dSmrgcat >&2 <<EOF
1702c76ae52dSmrg
17038292847cSmrgThis script (version $timestamp), has failed to recognize the
17048292847cSmrgoperating system you are using. If your script is old, overwrite *all*
17058292847cSmrgcopies of config.guess and config.sub with the latest versions from:
1706c76ae52dSmrg
170725420f97Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1708c76ae52dSmrgand
170925420f97Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
171025420f97SmrgEOF
171125420f97Smrg
171225420f97Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
171325420f97Smrgthisyear=`date +%Y`
171425420f97Smrg# shellcheck disable=SC2003
171525420f97Smrgscript_age=`expr "$thisyear" - "$our_year"`
171625420f97Smrgif test "$script_age" -lt 3 ; then
171725420f97Smrg   cat >&2 <<EOF
1718c76ae52dSmrg
17198292847cSmrgIf $0 has already been updated, send the following data and any
17208292847cSmrginformation you think might be pertinent to config-patches@gnu.org to
17218292847cSmrgprovide the necessary information to handle your system.
1722c76ae52dSmrg
1723c76ae52dSmrgconfig.guess timestamp = $timestamp
1724c76ae52dSmrg
1725c76ae52dSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1726c76ae52dSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1727c76ae52dSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1728c76ae52dSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1729c76ae52dSmrg
1730c76ae52dSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1731c76ae52dSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1732c76ae52dSmrg
1733c76ae52dSmrghostinfo               = `(hostinfo) 2>/dev/null`
1734c76ae52dSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1735c76ae52dSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1736c76ae52dSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1737c76ae52dSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1738c76ae52dSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1739c76ae52dSmrg
17408292847cSmrgUNAME_MACHINE = "$UNAME_MACHINE"
17418292847cSmrgUNAME_RELEASE = "$UNAME_RELEASE"
17428292847cSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
17438292847cSmrgUNAME_VERSION = "$UNAME_VERSION"
1744c76ae52dSmrgEOF
174525420f97Smrgfi
1746c76ae52dSmrg
1747c76ae52dSmrgexit 1
1748c76ae52dSmrg
1749c76ae52dSmrg# Local variables:
175025420f97Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1751c76ae52dSmrg# time-stamp-start: "timestamp='"
1752c76ae52dSmrg# time-stamp-format: "%:y-%02m-%02d"
1753c76ae52dSmrg# time-stamp-end: "'"
1754c76ae52dSmrg# End:
1755