config.guess revision 635a5eb8
1ffe57424Smrg#!/usr/bin/sh
217ca54c3Smrg# Attempt to guess a canonical system name.
3635a5eb8Smrg#   Copyright 1992-2023 Free Software Foundation, Inc.
417ca54c3Smrg
5452262e1Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6452262e1Smrg
7635a5eb8Smrgtimestamp='2023-06-23'
817ca54c3Smrg
917ca54c3Smrg# This file is free software; you can redistribute it and/or modify it
1017ca54c3Smrg# under the terms of the GNU General Public License as published by
11452262e1Smrg# the Free Software Foundation, either version 3 of the License, or
1217ca54c3Smrg# (at your option) any later version.
1317ca54c3Smrg#
1417ca54c3Smrg# This program is distributed in the hope that it will be useful, but
1517ca54c3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1617ca54c3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1717ca54c3Smrg# General Public License for more details.
1817ca54c3Smrg#
1917ca54c3Smrg# You should have received a copy of the GNU General Public License
20452262e1Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2117ca54c3Smrg#
2217ca54c3Smrg# As a special exception to the GNU General Public License, if you
2317ca54c3Smrg# distribute this file as part of a program that contains a
2417ca54c3Smrg# configuration script generated by Autoconf, you may include it under
2517ca54c3Smrg# the same distribution terms that you use for the rest of that
2617ca54c3Smrg# program.  This Exception is an additional permission under section 7
2717ca54c3Smrg# of the GNU General Public License, version 3 ("GPLv3").
2817ca54c3Smrg#
2917ca54c3Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3017ca54c3Smrg#
3117ca54c3Smrg# You can get the latest version of this script from:
32452262e1Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
3317ca54c3Smrg#
3417ca54c3Smrg# Please send patches to <config-patches@gnu.org>.
3517ca54c3Smrg
3617ca54c3Smrg
37452262e1Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38452262e1Smrg# about features and limitations of the classic Bourne shell that were
39452262e1Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40452262e1Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41452262e1Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42452262e1Smrg# have a pre-POSIX /bin/sh.
43452262e1Smrg
44452262e1Smrg
4517ca54c3Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4617ca54c3Smrg
4717ca54c3Smrgusage="\
4817ca54c3SmrgUsage: $0 [OPTION]
4917ca54c3Smrg
50635a5eb8SmrgOutput the configuration name of the system '$me' is run on.
5117ca54c3Smrg
52452262e1SmrgOptions:
5317ca54c3Smrg  -h, --help         print this help, then exit
5417ca54c3Smrg  -t, --time-stamp   print date of last modification, then exit
5517ca54c3Smrg  -v, --version      print version number, then exit
5617ca54c3Smrg
5717ca54c3SmrgReport bugs and patches to <config-patches@gnu.org>."
5817ca54c3Smrg
5917ca54c3Smrgversion="\
6017ca54c3SmrgGNU config.guess ($timestamp)
6117ca54c3Smrg
6217ca54c3SmrgOriginally written by Per Bothner.
63635a5eb8SmrgCopyright 1992-2023 Free Software Foundation, Inc.
6417ca54c3Smrg
6517ca54c3SmrgThis is free software; see the source for copying conditions.  There is NO
6617ca54c3Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6717ca54c3Smrg
6817ca54c3Smrghelp="
69635a5eb8SmrgTry '$me --help' for more information."
7017ca54c3Smrg
7117ca54c3Smrg# Parse command line
7217ca54c3Smrgwhile test $# -gt 0 ; do
7317ca54c3Smrg  case $1 in
7417ca54c3Smrg    --time-stamp | --time* | -t )
7517ca54c3Smrg       echo "$timestamp" ; exit ;;
7617ca54c3Smrg    --version | -v )
7717ca54c3Smrg       echo "$version" ; exit ;;
7817ca54c3Smrg    --help | --h* | -h )
7917ca54c3Smrg       echo "$usage"; exit ;;
8017ca54c3Smrg    -- )     # Stop option processing
8117ca54c3Smrg       shift; break ;;
8217ca54c3Smrg    - )	# Use stdin as input.
8317ca54c3Smrg       break ;;
8417ca54c3Smrg    -* )
8517ca54c3Smrg       echo "$me: invalid option $1$help" >&2
8617ca54c3Smrg       exit 1 ;;
8717ca54c3Smrg    * )
8817ca54c3Smrg       break ;;
8917ca54c3Smrg  esac
9017ca54c3Smrgdone
9117ca54c3Smrg
9217ca54c3Smrgif test $# != 0; then
9317ca54c3Smrg  echo "$me: too many arguments$help" >&2
9417ca54c3Smrg  exit 1
9517ca54c3Smrgfi
9617ca54c3Smrg
97452262e1Smrg# Just in case it came from the environment.
98452262e1SmrgGUESS=
99f2ea6e01Smrg
10017ca54c3Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
10117ca54c3Smrg# compiler to aid in system detection is discouraged as it requires
10217ca54c3Smrg# temporary files to be created and, as you can see below, it is a
10317ca54c3Smrg# headache to deal with in a portable fashion.
10417ca54c3Smrg
105635a5eb8Smrg# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
106635a5eb8Smrg# use 'HOST_CC' if defined, but it is deprecated.
10717ca54c3Smrg
10817ca54c3Smrg# Portable tmp directory creation inspired by the Autoconf team.
10917ca54c3Smrg
110452262e1Smrgtmp=
111452262e1Smrg# shellcheck disable=SC2172
112452262e1Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113452262e1Smrg
114452262e1Smrgset_cc_for_build() {
115452262e1Smrg    # prevent multiple calls if $tmp is already set
116452262e1Smrg    test "$tmp" && return 0
117452262e1Smrg    : "${TMPDIR=/tmp}"
118452262e1Smrg    # shellcheck disable=SC2039,SC3028
119452262e1Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120452262e1Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121452262e1Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122452262e1Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123452262e1Smrg    dummy=$tmp/dummy
124452262e1Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125452262e1Smrg	,,)    echo "int x;" > "$dummy.c"
126452262e1Smrg	       for driver in cc gcc c89 c99 ; do
127452262e1Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128452262e1Smrg		       CC_FOR_BUILD=$driver
129452262e1Smrg		       break
130452262e1Smrg		   fi
131452262e1Smrg	       done
132452262e1Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133452262e1Smrg		   CC_FOR_BUILD=no_compiler_found
134452262e1Smrg	       fi
135452262e1Smrg	       ;;
136452262e1Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137452262e1Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138452262e1Smrg    esac
139452262e1Smrg}
14017ca54c3Smrg
14117ca54c3Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14217ca54c3Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143452262e1Smrgif test -f /.attbin/uname ; then
14417ca54c3Smrg	PATH=$PATH:/.attbin ; export PATH
14517ca54c3Smrgfi
14617ca54c3Smrg
14717ca54c3SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14817ca54c3SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149452262e1SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15017ca54c3SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15117ca54c3Smrg
152452262e1Smrgcase $UNAME_SYSTEM in
15317ca54c3SmrgLinux|GNU|GNU/*)
154452262e1Smrg	LIBC=unknown
15517ca54c3Smrg
156452262e1Smrg	set_cc_for_build
157452262e1Smrg	cat <<-EOF > "$dummy.c"
15817ca54c3Smrg	#include <features.h>
15917ca54c3Smrg	#if defined(__UCLIBC__)
16017ca54c3Smrg	LIBC=uclibc
16117ca54c3Smrg	#elif defined(__dietlibc__)
16217ca54c3Smrg	LIBC=dietlibc
163452262e1Smrg	#elif defined(__GLIBC__)
16417ca54c3Smrg	LIBC=gnu
165452262e1Smrg	#else
166452262e1Smrg	#include <stdarg.h>
167452262e1Smrg	/* First heuristic to detect musl libc.  */
168452262e1Smrg	#ifdef __DEFINED_va_list
169452262e1Smrg	LIBC=musl
170452262e1Smrg	#endif
17117ca54c3Smrg	#endif
17217ca54c3Smrg	EOF
173452262e1Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174452262e1Smrg	eval "$cc_set_libc"
175452262e1Smrg
176452262e1Smrg	# Second heuristic to detect musl libc.
177452262e1Smrg	if [ "$LIBC" = unknown ] &&
178452262e1Smrg	   command -v ldd >/dev/null &&
179452262e1Smrg	   ldd --version 2>&1 | grep -q ^musl; then
180452262e1Smrg		LIBC=musl
181452262e1Smrg	fi
182452262e1Smrg
183452262e1Smrg	# If the system lacks a compiler, then just pick glibc.
184452262e1Smrg	# We could probably try harder.
185452262e1Smrg	if [ "$LIBC" = unknown ]; then
186452262e1Smrg		LIBC=gnu
187452262e1Smrg	fi
18817ca54c3Smrg	;;
18917ca54c3Smrgesac
19017ca54c3Smrg
19117ca54c3Smrg# Note: order is significant - the case branches are not exclusive.
19217ca54c3Smrg
193452262e1Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19417ca54c3Smrg    *:NetBSD:*:*)
19517ca54c3Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
19617ca54c3Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19717ca54c3Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19817ca54c3Smrg	# switched to ELF, *-*-netbsd* would select the old
19917ca54c3Smrg	# object file format.  This provides both forward
20017ca54c3Smrg	# compatibility and a consistent mechanism for selecting the
20117ca54c3Smrg	# object file format.
20217ca54c3Smrg	#
20317ca54c3Smrg	# Note: NetBSD doesn't particularly care about the vendor
20417ca54c3Smrg	# portion of the name.  We always set it to "unknown".
20517ca54c3Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206452262e1Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207452262e1Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20817ca54c3Smrg	    echo unknown)`
209452262e1Smrg	case $UNAME_MACHINE_ARCH in
210452262e1Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
21117ca54c3Smrg	    armeb) machine=armeb-unknown ;;
21217ca54c3Smrg	    arm*) machine=arm-unknown ;;
21317ca54c3Smrg	    sh3el) machine=shl-unknown ;;
21417ca54c3Smrg	    sh3eb) machine=sh-unknown ;;
21517ca54c3Smrg	    sh5el) machine=sh5le-unknown ;;
21617ca54c3Smrg	    earmv*)
217452262e1Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218452262e1Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219ffe57424Smrg		machine=${arch}${endian}-unknown
22017ca54c3Smrg		;;
221452262e1Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22217ca54c3Smrg	esac
22317ca54c3Smrg	# The Operating System including object format, if it has switched
22417ca54c3Smrg	# to ELF recently (or will in the future) and ABI.
225452262e1Smrg	case $UNAME_MACHINE_ARCH in
22617ca54c3Smrg	    earm*)
22717ca54c3Smrg		os=netbsdelf
22817ca54c3Smrg		;;
22917ca54c3Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230452262e1Smrg		set_cc_for_build
23117ca54c3Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
23217ca54c3Smrg			| grep -q __ELF__
23317ca54c3Smrg		then
23417ca54c3Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23517ca54c3Smrg		    # Return netbsd for either.  FIX?
23617ca54c3Smrg		    os=netbsd
23717ca54c3Smrg		else
23817ca54c3Smrg		    os=netbsdelf
23917ca54c3Smrg		fi
24017ca54c3Smrg		;;
24117ca54c3Smrg	    *)
24217ca54c3Smrg		os=netbsd
24317ca54c3Smrg		;;
24417ca54c3Smrg	esac
24517ca54c3Smrg	# Determine ABI tags.
246452262e1Smrg	case $UNAME_MACHINE_ARCH in
24717ca54c3Smrg	    earm*)
24817ca54c3Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249452262e1Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
25017ca54c3Smrg		;;
25117ca54c3Smrg	esac
25217ca54c3Smrg	# The OS release
25317ca54c3Smrg	# Debian GNU/NetBSD machines have a different userland, and
25417ca54c3Smrg	# thus, need a distinct triplet. However, they do not need
25517ca54c3Smrg	# kernel version information, so it can be replaced with a
25617ca54c3Smrg	# suitable tag, in the style of linux-gnu.
257452262e1Smrg	case $UNAME_VERSION in
25817ca54c3Smrg	    Debian*)
25917ca54c3Smrg		release='-gnu'
26017ca54c3Smrg		;;
26117ca54c3Smrg	    *)
262452262e1Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
26317ca54c3Smrg		;;
26417ca54c3Smrg	esac
26517ca54c3Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26617ca54c3Smrg	# contains redundant information, the shorter form:
26717ca54c3Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268452262e1Smrg	GUESS=$machine-${os}${release}${abi-}
269452262e1Smrg	;;
27017ca54c3Smrg    *:Bitrig:*:*)
27117ca54c3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272452262e1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273452262e1Smrg	;;
27417ca54c3Smrg    *:OpenBSD:*:*)
27517ca54c3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276452262e1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277452262e1Smrg	;;
278452262e1Smrg    *:SecBSD:*:*)
279452262e1Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280452262e1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281452262e1Smrg	;;
28217ca54c3Smrg    *:LibertyBSD:*:*)
28317ca54c3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284452262e1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285452262e1Smrg	;;
286452262e1Smrg    *:MidnightBSD:*:*)
287452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288452262e1Smrg	;;
28917ca54c3Smrg    *:ekkoBSD:*:*)
290452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291452262e1Smrg	;;
29217ca54c3Smrg    *:SolidBSD:*:*)
293452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294452262e1Smrg	;;
295452262e1Smrg    *:OS108:*:*)
296452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297452262e1Smrg	;;
29817ca54c3Smrg    macppc:MirBSD:*:*)
299452262e1Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300452262e1Smrg	;;
30117ca54c3Smrg    *:MirBSD:*:*)
302452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303452262e1Smrg	;;
30417ca54c3Smrg    *:Sortix:*:*)
305452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
306452262e1Smrg	;;
307452262e1Smrg    *:Twizzler:*:*)
308452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309452262e1Smrg	;;
310452262e1Smrg    *:Redox:*:*)
311452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-redox
312452262e1Smrg	;;
313452262e1Smrg    mips:OSF1:*.*)
314452262e1Smrg	GUESS=mips-dec-osf1
315452262e1Smrg	;;
31617ca54c3Smrg    alpha:OSF1:*:*)
317452262e1Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318452262e1Smrg	trap '' 0
31917ca54c3Smrg	case $UNAME_RELEASE in
32017ca54c3Smrg	*4.0)
32117ca54c3Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32217ca54c3Smrg		;;
32317ca54c3Smrg	*5.*)
32417ca54c3Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
32517ca54c3Smrg		;;
32617ca54c3Smrg	esac
32717ca54c3Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
32817ca54c3Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
32917ca54c3Smrg	# covers most systems running today.  This code pipes the CPU
33017ca54c3Smrg	# types through head -n 1, so we only detect the type of CPU 0.
33117ca54c3Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332452262e1Smrg	case $ALPHA_CPU_TYPE in
33317ca54c3Smrg	    "EV4 (21064)")
33417ca54c3Smrg		UNAME_MACHINE=alpha ;;
33517ca54c3Smrg	    "EV4.5 (21064)")
33617ca54c3Smrg		UNAME_MACHINE=alpha ;;
33717ca54c3Smrg	    "LCA4 (21066/21068)")
33817ca54c3Smrg		UNAME_MACHINE=alpha ;;
33917ca54c3Smrg	    "EV5 (21164)")
34017ca54c3Smrg		UNAME_MACHINE=alphaev5 ;;
34117ca54c3Smrg	    "EV5.6 (21164A)")
34217ca54c3Smrg		UNAME_MACHINE=alphaev56 ;;
34317ca54c3Smrg	    "EV5.6 (21164PC)")
34417ca54c3Smrg		UNAME_MACHINE=alphapca56 ;;
34517ca54c3Smrg	    "EV5.7 (21164PC)")
34617ca54c3Smrg		UNAME_MACHINE=alphapca57 ;;
34717ca54c3Smrg	    "EV6 (21264)")
34817ca54c3Smrg		UNAME_MACHINE=alphaev6 ;;
34917ca54c3Smrg	    "EV6.7 (21264A)")
35017ca54c3Smrg		UNAME_MACHINE=alphaev67 ;;
35117ca54c3Smrg	    "EV6.8CB (21264C)")
35217ca54c3Smrg		UNAME_MACHINE=alphaev68 ;;
35317ca54c3Smrg	    "EV6.8AL (21264B)")
35417ca54c3Smrg		UNAME_MACHINE=alphaev68 ;;
35517ca54c3Smrg	    "EV6.8CX (21264D)")
35617ca54c3Smrg		UNAME_MACHINE=alphaev68 ;;
35717ca54c3Smrg	    "EV6.9A (21264/EV69A)")
35817ca54c3Smrg		UNAME_MACHINE=alphaev69 ;;
35917ca54c3Smrg	    "EV7 (21364)")
36017ca54c3Smrg		UNAME_MACHINE=alphaev7 ;;
36117ca54c3Smrg	    "EV7.9 (21364A)")
36217ca54c3Smrg		UNAME_MACHINE=alphaev79 ;;
36317ca54c3Smrg	esac
36417ca54c3Smrg	# A Pn.n version is a patched version.
36517ca54c3Smrg	# A Vn.n version is a released version.
36617ca54c3Smrg	# A Tn.n version is a released field test version.
36717ca54c3Smrg	# A Xn.n version is an unreleased experimental baselevel.
36817ca54c3Smrg	# 1.2 uses "1.2" for uname -r.
369452262e1Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370452262e1Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371452262e1Smrg	;;
37217ca54c3Smrg    Amiga*:UNIX_System_V:4.0:*)
373452262e1Smrg	GUESS=m68k-unknown-sysv4
374452262e1Smrg	;;
37517ca54c3Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377452262e1Smrg	;;
37817ca54c3Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
380452262e1Smrg	;;
38117ca54c3Smrg    *:OS/390:*:*)
382452262e1Smrg	GUESS=i370-ibm-openedition
383452262e1Smrg	;;
38417ca54c3Smrg    *:z/VM:*:*)
385452262e1Smrg	GUESS=s390-ibm-zvmoe
386452262e1Smrg	;;
38717ca54c3Smrg    *:OS400:*:*)
388452262e1Smrg	GUESS=powerpc-ibm-os400
389452262e1Smrg	;;
39017ca54c3Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391452262e1Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392452262e1Smrg	;;
39317ca54c3Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394452262e1Smrg	GUESS=arm-unknown-riscos
395452262e1Smrg	;;
39617ca54c3Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397452262e1Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
398452262e1Smrg	;;
39917ca54c3Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40017ca54c3Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401452262e1Smrg	case `(/bin/universe) 2>/dev/null` in
402452262e1Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403452262e1Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404452262e1Smrg	esac
405452262e1Smrg	;;
40617ca54c3Smrg    NILE*:*:*:dcosx)
407452262e1Smrg	GUESS=pyramid-pyramid-svr4
408452262e1Smrg	;;
40917ca54c3Smrg    DRS?6000:unix:4.0:6*)
410452262e1Smrg	GUESS=sparc-icl-nx6
411452262e1Smrg	;;
41217ca54c3Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
41317ca54c3Smrg	case `/usr/bin/uname -p` in
414452262e1Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
415452262e1Smrg	esac
416452262e1Smrg	;;
41717ca54c3Smrg    s390x:SunOS:*:*)
418452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419452262e1Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420452262e1Smrg	;;
42117ca54c3Smrg    sun4H:SunOS:5.*:*)
422452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423452262e1Smrg	GUESS=sparc-hal-solaris2$SUN_REL
424452262e1Smrg	;;
42517ca54c3Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427452262e1Smrg	GUESS=sparc-sun-solaris2$SUN_REL
428452262e1Smrg	;;
42917ca54c3Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430452262e1Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431452262e1Smrg	;;
43217ca54c3Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433452262e1Smrg	set_cc_for_build
434f2ea6e01Smrg	SUN_ARCH=i386
435f2ea6e01Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436f2ea6e01Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437f2ea6e01Smrg	# This test works for both compilers.
438452262e1Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439f2ea6e01Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440452262e1Smrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441f2ea6e01Smrg		grep IS_64BIT_ARCH >/dev/null
442f2ea6e01Smrg	    then
443f2ea6e01Smrg		SUN_ARCH=x86_64
444f2ea6e01Smrg	    fi
445f2ea6e01Smrg	fi
446452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447452262e1Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448452262e1Smrg	;;
44917ca54c3Smrg    sun4*:SunOS:6*:*)
45017ca54c3Smrg	# According to config.sub, this is the proper way to canonicalize
45117ca54c3Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45217ca54c3Smrg	# it's likely to be more like Solaris than SunOS4.
453452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454452262e1Smrg	GUESS=sparc-sun-solaris3$SUN_REL
455452262e1Smrg	;;
45617ca54c3Smrg    sun4*:SunOS:*:*)
457452262e1Smrg	case `/usr/bin/arch -k` in
45817ca54c3Smrg	    Series*|S4*)
45917ca54c3Smrg		UNAME_RELEASE=`uname -v`
46017ca54c3Smrg		;;
46117ca54c3Smrg	esac
462635a5eb8Smrg	# Japanese Language versions have a version number like '4.1.3-JL'.
463452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464452262e1Smrg	GUESS=sparc-sun-sunos$SUN_REL
465452262e1Smrg	;;
46617ca54c3Smrg    sun3*:SunOS:*:*)
467452262e1Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468452262e1Smrg	;;
46917ca54c3Smrg    sun*:*:4.2BSD:*)
47017ca54c3Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471452262e1Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472452262e1Smrg	case `/bin/arch` in
47317ca54c3Smrg	    sun3)
474452262e1Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
47517ca54c3Smrg		;;
47617ca54c3Smrg	    sun4)
477452262e1Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
47817ca54c3Smrg		;;
47917ca54c3Smrg	esac
480452262e1Smrg	;;
48117ca54c3Smrg    aushp:SunOS:*:*)
482452262e1Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483452262e1Smrg	;;
48417ca54c3Smrg    # The situation for MiNT is a little confusing.  The machine name
48517ca54c3Smrg    # can be virtually everything (everything which is not
48617ca54c3Smrg    # "atarist" or "atariste" at least should have a processor
48717ca54c3Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48817ca54c3Smrg    # to the lowercase version "mint" (or "freemint").  Finally
48917ca54c3Smrg    # the system name "TOS" denotes a system which is actually not
49017ca54c3Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
49117ca54c3Smrg    # be no problem.
49217ca54c3Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493452262e1Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494452262e1Smrg	;;
49517ca54c3Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496452262e1Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497452262e1Smrg	;;
49817ca54c3Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499452262e1Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500452262e1Smrg	;;
50117ca54c3Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502452262e1Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503452262e1Smrg	;;
50417ca54c3Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505452262e1Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506452262e1Smrg	;;
50717ca54c3Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508452262e1Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509452262e1Smrg	;;
51017ca54c3Smrg    m68k:machten:*:*)
511452262e1Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512452262e1Smrg	;;
51317ca54c3Smrg    powerpc:machten:*:*)
514452262e1Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515452262e1Smrg	;;
51617ca54c3Smrg    RISC*:Mach:*:*)
517452262e1Smrg	GUESS=mips-dec-mach_bsd4.3
518452262e1Smrg	;;
51917ca54c3Smrg    RISC*:ULTRIX:*:*)
520452262e1Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521452262e1Smrg	;;
52217ca54c3Smrg    VAX*:ULTRIX*:*:*)
523452262e1Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524452262e1Smrg	;;
52517ca54c3Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526452262e1Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527452262e1Smrg	;;
52817ca54c3Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529452262e1Smrg	set_cc_for_build
530452262e1Smrg	sed 's/^	//' << EOF > "$dummy.c"
53117ca54c3Smrg#ifdef __cplusplus
53217ca54c3Smrg#include <stdio.h>  /* for printf() prototype */
53317ca54c3Smrg	int main (int argc, char *argv[]) {
53417ca54c3Smrg#else
53517ca54c3Smrg	int main (argc, argv) int argc; char *argv[]; {
53617ca54c3Smrg#endif
53717ca54c3Smrg	#if defined (host_mips) && defined (MIPSEB)
53817ca54c3Smrg	#if defined (SYSTYPE_SYSV)
539452262e1Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54017ca54c3Smrg	#endif
54117ca54c3Smrg	#if defined (SYSTYPE_SVR4)
542452262e1Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54317ca54c3Smrg	#endif
54417ca54c3Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545452262e1Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54617ca54c3Smrg	#endif
54717ca54c3Smrg	#endif
54817ca54c3Smrg	  exit (-1);
54917ca54c3Smrg	}
55017ca54c3SmrgEOF
551452262e1Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552452262e1Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553452262e1Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55417ca54c3Smrg	    { echo "$SYSTEM_NAME"; exit; }
555452262e1Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556452262e1Smrg	;;
55717ca54c3Smrg    Motorola:PowerMAX_OS:*:*)
558452262e1Smrg	GUESS=powerpc-motorola-powermax
559452262e1Smrg	;;
56017ca54c3Smrg    Motorola:*:4.3:PL8-*)
561452262e1Smrg	GUESS=powerpc-harris-powermax
562452262e1Smrg	;;
56317ca54c3Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564452262e1Smrg	GUESS=powerpc-harris-powermax
565452262e1Smrg	;;
56617ca54c3Smrg    Night_Hawk:Power_UNIX:*:*)
567452262e1Smrg	GUESS=powerpc-harris-powerunix
568452262e1Smrg	;;
56917ca54c3Smrg    m88k:CX/UX:7*:*)
570452262e1Smrg	GUESS=m88k-harris-cxux7
571452262e1Smrg	;;
57217ca54c3Smrg    m88k:*:4*:R4*)
573452262e1Smrg	GUESS=m88k-motorola-sysv4
574452262e1Smrg	;;
57517ca54c3Smrg    m88k:*:3*:R3*)
576452262e1Smrg	GUESS=m88k-motorola-sysv3
577452262e1Smrg	;;
57817ca54c3Smrg    AViiON:dgux:*:*)
57917ca54c3Smrg	# DG/UX returns AViiON for all architectures
58017ca54c3Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581452262e1Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58217ca54c3Smrg	then
583452262e1Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584452262e1Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
58517ca54c3Smrg	    then
586452262e1Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
58717ca54c3Smrg	    else
588452262e1Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58917ca54c3Smrg	    fi
59017ca54c3Smrg	else
591452262e1Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
59217ca54c3Smrg	fi
593452262e1Smrg	;;
59417ca54c3Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595452262e1Smrg	GUESS=m88k-dolphin-sysv3
596452262e1Smrg	;;
59717ca54c3Smrg    M88*:*:R3*:*)
59817ca54c3Smrg	# Delta 88k system running SVR3
599452262e1Smrg	GUESS=m88k-motorola-sysv3
600452262e1Smrg	;;
60117ca54c3Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602452262e1Smrg	GUESS=m88k-tektronix-sysv3
603452262e1Smrg	;;
60417ca54c3Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605452262e1Smrg	GUESS=m68k-tektronix-bsd
606452262e1Smrg	;;
60717ca54c3Smrg    *:IRIX*:*:*)
608452262e1Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609452262e1Smrg	GUESS=mips-sgi-irix$IRIX_REL
610452262e1Smrg	;;
61117ca54c3Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612452262e1Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613452262e1Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61417ca54c3Smrg    i*86:AIX:*:*)
615452262e1Smrg	GUESS=i386-ibm-aix
616452262e1Smrg	;;
61717ca54c3Smrg    ia64:AIX:*:*)
618452262e1Smrg	if test -x /usr/bin/oslevel ; then
61917ca54c3Smrg		IBM_REV=`/usr/bin/oslevel`
62017ca54c3Smrg	else
621452262e1Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62217ca54c3Smrg	fi
623452262e1Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624452262e1Smrg	;;
62517ca54c3Smrg    *:AIX:2:3)
62617ca54c3Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627452262e1Smrg		set_cc_for_build
628452262e1Smrg		sed 's/^		//' << EOF > "$dummy.c"
62917ca54c3Smrg		#include <sys/systemcfg.h>
63017ca54c3Smrg
63117ca54c3Smrg		main()
63217ca54c3Smrg			{
63317ca54c3Smrg			if (!__power_pc())
63417ca54c3Smrg				exit(1);
63517ca54c3Smrg			puts("powerpc-ibm-aix3.2.5");
63617ca54c3Smrg			exit(0);
63717ca54c3Smrg			}
63817ca54c3SmrgEOF
639452262e1Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64017ca54c3Smrg		then
641452262e1Smrg			GUESS=$SYSTEM_NAME
64217ca54c3Smrg		else
643452262e1Smrg			GUESS=rs6000-ibm-aix3.2.5
64417ca54c3Smrg		fi
64517ca54c3Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646452262e1Smrg		GUESS=rs6000-ibm-aix3.2.4
64717ca54c3Smrg	else
648452262e1Smrg		GUESS=rs6000-ibm-aix3.2
64917ca54c3Smrg	fi
650452262e1Smrg	;;
65117ca54c3Smrg    *:AIX:*:[4567])
65217ca54c3Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653452262e1Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65417ca54c3Smrg		IBM_ARCH=rs6000
65517ca54c3Smrg	else
65617ca54c3Smrg		IBM_ARCH=powerpc
65717ca54c3Smrg	fi
658452262e1Smrg	if test -x /usr/bin/lslpp ; then
659452262e1Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
66017ca54c3Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66117ca54c3Smrg	else
662452262e1Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66317ca54c3Smrg	fi
664452262e1Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665452262e1Smrg	;;
66617ca54c3Smrg    *:AIX:*:*)
667452262e1Smrg	GUESS=rs6000-ibm-aix
668452262e1Smrg	;;
669452262e1Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670452262e1Smrg	GUESS=romp-ibm-bsd4.4
671452262e1Smrg	;;
67217ca54c3Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673452262e1Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674452262e1Smrg	;;                                  # report: romp-ibm BSD 4.3
67517ca54c3Smrg    *:BOSX:*:*)
676452262e1Smrg	GUESS=rs6000-bull-bosx
677452262e1Smrg	;;
67817ca54c3Smrg    DPX/2?00:B.O.S.:*:*)
679452262e1Smrg	GUESS=m68k-bull-sysv3
680452262e1Smrg	;;
68117ca54c3Smrg    9000/[34]??:4.3bsd:1.*:*)
682452262e1Smrg	GUESS=m68k-hp-bsd
683452262e1Smrg	;;
68417ca54c3Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685452262e1Smrg	GUESS=m68k-hp-bsd4.4
686452262e1Smrg	;;
68717ca54c3Smrg    9000/[34678]??:HP-UX:*:*)
688452262e1Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689452262e1Smrg	case $UNAME_MACHINE in
690452262e1Smrg	    9000/31?)            HP_ARCH=m68000 ;;
691452262e1Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
69217ca54c3Smrg	    9000/[678][0-9][0-9])
693452262e1Smrg		if test -x /usr/bin/getconf; then
69417ca54c3Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
69517ca54c3Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696452262e1Smrg		    case $sc_cpu_version in
69717ca54c3Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
69817ca54c3Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
69917ca54c3Smrg		      532)                      # CPU_PA_RISC2_0
700452262e1Smrg			case $sc_kernel_bits in
70117ca54c3Smrg			  32) HP_ARCH=hppa2.0n ;;
70217ca54c3Smrg			  64) HP_ARCH=hppa2.0w ;;
70317ca54c3Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
70417ca54c3Smrg			esac ;;
70517ca54c3Smrg		    esac
70617ca54c3Smrg		fi
707452262e1Smrg		if test "$HP_ARCH" = ""; then
708452262e1Smrg		    set_cc_for_build
709452262e1Smrg		    sed 's/^		//' << EOF > "$dummy.c"
71017ca54c3Smrg
71117ca54c3Smrg		#define _HPUX_SOURCE
71217ca54c3Smrg		#include <stdlib.h>
71317ca54c3Smrg		#include <unistd.h>
71417ca54c3Smrg
71517ca54c3Smrg		int main ()
71617ca54c3Smrg		{
71717ca54c3Smrg		#if defined(_SC_KERNEL_BITS)
71817ca54c3Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
71917ca54c3Smrg		#endif
72017ca54c3Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
72117ca54c3Smrg
72217ca54c3Smrg		    switch (cpu)
72317ca54c3Smrg			{
72417ca54c3Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
72517ca54c3Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
72617ca54c3Smrg			case CPU_PA_RISC2_0:
72717ca54c3Smrg		#if defined(_SC_KERNEL_BITS)
72817ca54c3Smrg			    switch (bits)
72917ca54c3Smrg				{
73017ca54c3Smrg				case 64: puts ("hppa2.0w"); break;
73117ca54c3Smrg				case 32: puts ("hppa2.0n"); break;
73217ca54c3Smrg				default: puts ("hppa2.0"); break;
73317ca54c3Smrg				} break;
73417ca54c3Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
73517ca54c3Smrg			    puts ("hppa2.0"); break;
73617ca54c3Smrg		#endif
73717ca54c3Smrg			default: puts ("hppa1.0"); break;
73817ca54c3Smrg			}
73917ca54c3Smrg		    exit (0);
74017ca54c3Smrg		}
74117ca54c3SmrgEOF
742452262e1Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
74317ca54c3Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
74417ca54c3Smrg		fi ;;
74517ca54c3Smrg	esac
746452262e1Smrg	if test "$HP_ARCH" = hppa2.0w
74717ca54c3Smrg	then
748452262e1Smrg	    set_cc_for_build
74917ca54c3Smrg
75017ca54c3Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75117ca54c3Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75217ca54c3Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
75317ca54c3Smrg	    #
75417ca54c3Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
75517ca54c3Smrg	    # => hppa2.0w-hp-hpux11.23
75617ca54c3Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75717ca54c3Smrg	    # => hppa64-hp-hpux11.23
75817ca54c3Smrg
75917ca54c3Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
76017ca54c3Smrg		grep -q __LP64__
76117ca54c3Smrg	    then
76217ca54c3Smrg		HP_ARCH=hppa2.0w
76317ca54c3Smrg	    else
76417ca54c3Smrg		HP_ARCH=hppa64
76517ca54c3Smrg	    fi
76617ca54c3Smrg	fi
767452262e1Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768452262e1Smrg	;;
76917ca54c3Smrg    ia64:HP-UX:*:*)
770452262e1Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771452262e1Smrg	GUESS=ia64-hp-hpux$HPUX_REV
772452262e1Smrg	;;
77317ca54c3Smrg    3050*:HI-UX:*:*)
774452262e1Smrg	set_cc_for_build
775452262e1Smrg	sed 's/^	//' << EOF > "$dummy.c"
77617ca54c3Smrg	#include <unistd.h>
77717ca54c3Smrg	int
77817ca54c3Smrg	main ()
77917ca54c3Smrg	{
78017ca54c3Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
78117ca54c3Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78217ca54c3Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78317ca54c3Smrg	     results, however.  */
78417ca54c3Smrg	  if (CPU_IS_PA_RISC (cpu))
78517ca54c3Smrg	    {
78617ca54c3Smrg	      switch (cpu)
78717ca54c3Smrg		{
78817ca54c3Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78917ca54c3Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79017ca54c3Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79117ca54c3Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79217ca54c3Smrg		}
79317ca54c3Smrg	    }
79417ca54c3Smrg	  else if (CPU_IS_HP_MC68K (cpu))
79517ca54c3Smrg	    puts ("m68k-hitachi-hiuxwe2");
79617ca54c3Smrg	  else puts ("unknown-hitachi-hiuxwe2");
79717ca54c3Smrg	  exit (0);
79817ca54c3Smrg	}
79917ca54c3SmrgEOF
800452262e1Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80117ca54c3Smrg		{ echo "$SYSTEM_NAME"; exit; }
802452262e1Smrg	GUESS=unknown-hitachi-hiuxwe2
803452262e1Smrg	;;
804452262e1Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805452262e1Smrg	GUESS=hppa1.1-hp-bsd
806452262e1Smrg	;;
80717ca54c3Smrg    9000/8??:4.3bsd:*:*)
808452262e1Smrg	GUESS=hppa1.0-hp-bsd
809452262e1Smrg	;;
81017ca54c3Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811452262e1Smrg	GUESS=hppa1.0-hp-mpeix
812452262e1Smrg	;;
813452262e1Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814452262e1Smrg	GUESS=hppa1.1-hp-osf
815452262e1Smrg	;;
81617ca54c3Smrg    hp8??:OSF1:*:*)
817452262e1Smrg	GUESS=hppa1.0-hp-osf
818452262e1Smrg	;;
81917ca54c3Smrg    i*86:OSF1:*:*)
820452262e1Smrg	if test -x /usr/sbin/sysversion ; then
821452262e1Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82217ca54c3Smrg	else
823452262e1Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
82417ca54c3Smrg	fi
825452262e1Smrg	;;
82617ca54c3Smrg    parisc*:Lites*:*:*)
827452262e1Smrg	GUESS=hppa1.1-hp-lites
828452262e1Smrg	;;
82917ca54c3Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830452262e1Smrg	GUESS=c1-convex-bsd
831452262e1Smrg	;;
83217ca54c3Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83317ca54c3Smrg	if getsysinfo -f scalar_acc
83417ca54c3Smrg	then echo c32-convex-bsd
83517ca54c3Smrg	else echo c2-convex-bsd
83617ca54c3Smrg	fi
83717ca54c3Smrg	exit ;;
83817ca54c3Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839452262e1Smrg	GUESS=c34-convex-bsd
840452262e1Smrg	;;
84117ca54c3Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842452262e1Smrg	GUESS=c38-convex-bsd
843452262e1Smrg	;;
84417ca54c3Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845452262e1Smrg	GUESS=c4-convex-bsd
846452262e1Smrg	;;
84717ca54c3Smrg    CRAY*Y-MP:*:*:*)
848452262e1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849452262e1Smrg	GUESS=ymp-cray-unicos$CRAY_REL
850452262e1Smrg	;;
85117ca54c3Smrg    CRAY*[A-Z]90:*:*:*)
852452262e1Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85317ca54c3Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85417ca54c3Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85517ca54c3Smrg	      -e 's/\.[^.]*$/.X/'
85617ca54c3Smrg	exit ;;
85717ca54c3Smrg    CRAY*TS:*:*:*)
858452262e1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859452262e1Smrg	GUESS=t90-cray-unicos$CRAY_REL
860452262e1Smrg	;;
86117ca54c3Smrg    CRAY*T3E:*:*:*)
862452262e1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863452262e1Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864452262e1Smrg	;;
86517ca54c3Smrg    CRAY*SV1:*:*:*)
866452262e1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867452262e1Smrg	GUESS=sv1-cray-unicos$CRAY_REL
868452262e1Smrg	;;
86917ca54c3Smrg    *:UNICOS/mp:*:*)
870452262e1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871452262e1Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872452262e1Smrg	;;
87317ca54c3Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
87417ca54c3Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
87517ca54c3Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876452262e1Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877452262e1Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878452262e1Smrg	;;
87917ca54c3Smrg    5000:UNIX_System_V:4.*:*)
88017ca54c3Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881452262e1Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882452262e1Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883452262e1Smrg	;;
88417ca54c3Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885452262e1Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886452262e1Smrg	;;
88717ca54c3Smrg    sparc*:BSD/OS:*:*)
888452262e1Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889452262e1Smrg	;;
89017ca54c3Smrg    *:BSD/OS:*:*)
891452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892452262e1Smrg	;;
893452262e1Smrg    arm:FreeBSD:*:*)
894452262e1Smrg	UNAME_PROCESSOR=`uname -p`
895452262e1Smrg	set_cc_for_build
896452262e1Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897452262e1Smrg	    | grep -q __ARM_PCS_VFP
898452262e1Smrg	then
899452262e1Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900452262e1Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901452262e1Smrg	else
902452262e1Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903452262e1Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904452262e1Smrg	fi
905452262e1Smrg	;;
90617ca54c3Smrg    *:FreeBSD:*:*)
90717ca54c3Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908452262e1Smrg	case $UNAME_PROCESSOR in
90917ca54c3Smrg	    amd64)
910452262e1Smrg		UNAME_PROCESSOR=x86_64 ;;
911452262e1Smrg	    i386)
912452262e1Smrg		UNAME_PROCESSOR=i586 ;;
91317ca54c3Smrg	esac
914452262e1Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915452262e1Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916452262e1Smrg	;;
91717ca54c3Smrg    i*:CYGWIN*:*)
918452262e1Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
919452262e1Smrg	;;
92017ca54c3Smrg    *:MINGW64*:*)
921452262e1Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
922452262e1Smrg	;;
92317ca54c3Smrg    *:MINGW*:*)
924452262e1Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
925452262e1Smrg	;;
92617ca54c3Smrg    *:MSYS*:*)
927452262e1Smrg	GUESS=$UNAME_MACHINE-pc-msys
928452262e1Smrg	;;
92917ca54c3Smrg    i*:PW*:*)
930452262e1Smrg	GUESS=$UNAME_MACHINE-pc-pw32
931452262e1Smrg	;;
932452262e1Smrg    *:SerenityOS:*:*)
933452262e1Smrg        GUESS=$UNAME_MACHINE-pc-serenity
934452262e1Smrg        ;;
93517ca54c3Smrg    *:Interix*:*)
936452262e1Smrg	case $UNAME_MACHINE in
93717ca54c3Smrg	    x86)
938452262e1Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
939452262e1Smrg		;;
94017ca54c3Smrg	    authenticamd | genuineintel | EM64T)
941452262e1Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
942452262e1Smrg		;;
94317ca54c3Smrg	    IA64)
944452262e1Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
945452262e1Smrg		;;
94617ca54c3Smrg	esac ;;
94717ca54c3Smrg    i*:UWIN*:*)
948452262e1Smrg	GUESS=$UNAME_MACHINE-pc-uwin
949452262e1Smrg	;;
95017ca54c3Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
951452262e1Smrg	GUESS=x86_64-pc-cygwin
952452262e1Smrg	;;
95317ca54c3Smrg    prep*:SunOS:5.*:*)
954452262e1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
955452262e1Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
956452262e1Smrg	;;
95717ca54c3Smrg    *:GNU:*:*)
95817ca54c3Smrg	# the GNU system
959452262e1Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
960452262e1Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
961452262e1Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
962452262e1Smrg	;;
96317ca54c3Smrg    *:GNU/*:*:*)
96417ca54c3Smrg	# other systems with GNU libc and userland
965452262e1Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
966452262e1Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
967452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
968452262e1Smrg	;;
969635a5eb8Smrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
970635a5eb8Smrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
971635a5eb8Smrg	;;
972635a5eb8Smrg    *:[Mm]anagarm:*:*)
973635a5eb8Smrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
974635a5eb8Smrg	;;
975452262e1Smrg    *:Minix:*:*)
976452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-minix
977452262e1Smrg	;;
978452262e1Smrg    aarch64:Linux:*:*)
979452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
980452262e1Smrg	;;
98117ca54c3Smrg    aarch64_be:Linux:*:*)
98217ca54c3Smrg	UNAME_MACHINE=aarch64_be
983452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
984452262e1Smrg	;;
98517ca54c3Smrg    alpha:Linux:*:*)
986452262e1Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
98717ca54c3Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
98817ca54c3Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
98917ca54c3Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
99017ca54c3Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
99117ca54c3Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
99217ca54c3Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
99317ca54c3Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
99417ca54c3Smrg	esac
99517ca54c3Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
99617ca54c3Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
997452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
998452262e1Smrg	;;
999452262e1Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1000452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1001452262e1Smrg	;;
100217ca54c3Smrg    arm*:Linux:*:*)
1003452262e1Smrg	set_cc_for_build
100417ca54c3Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
100517ca54c3Smrg	    | grep -q __ARM_EABI__
100617ca54c3Smrg	then
1007452262e1Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
100817ca54c3Smrg	else
100917ca54c3Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
101017ca54c3Smrg		| grep -q __ARM_PCS_VFP
101117ca54c3Smrg	    then
1012452262e1Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
101317ca54c3Smrg	    else
1014452262e1Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
101517ca54c3Smrg	    fi
101617ca54c3Smrg	fi
1017452262e1Smrg	;;
101817ca54c3Smrg    avr32*:Linux:*:*)
1019452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020452262e1Smrg	;;
102117ca54c3Smrg    cris:Linux:*:*)
1022452262e1Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1023452262e1Smrg	;;
102417ca54c3Smrg    crisv32:Linux:*:*)
1025452262e1Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1026452262e1Smrg	;;
102717ca54c3Smrg    e2k:Linux:*:*)
1028452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1029452262e1Smrg	;;
103017ca54c3Smrg    frv:Linux:*:*)
1031452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032452262e1Smrg	;;
103317ca54c3Smrg    hexagon:Linux:*:*)
1034452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035452262e1Smrg	;;
103617ca54c3Smrg    i*86:Linux:*:*)
1037452262e1Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1038452262e1Smrg	;;
103917ca54c3Smrg    ia64:Linux:*:*)
1040452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041452262e1Smrg	;;
104217ca54c3Smrg    k1om:Linux:*:*)
1043452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044452262e1Smrg	;;
1045635a5eb8Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1046452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1047452262e1Smrg	;;
104817ca54c3Smrg    m32r*:Linux:*:*)
1049452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1050452262e1Smrg	;;
105117ca54c3Smrg    m68*:Linux:*:*)
1052452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1053452262e1Smrg	;;
105417ca54c3Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1055452262e1Smrg	set_cc_for_build
1056452262e1Smrg	IS_GLIBC=0
1057452262e1Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1058452262e1Smrg	sed 's/^	//' << EOF > "$dummy.c"
105917ca54c3Smrg	#undef CPU
1060452262e1Smrg	#undef mips
1061452262e1Smrg	#undef mipsel
1062452262e1Smrg	#undef mips64
1063452262e1Smrg	#undef mips64el
1064452262e1Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1065452262e1Smrg	LIBCABI=gnuabi64
1066452262e1Smrg	#else
1067452262e1Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1068452262e1Smrg	LIBCABI=gnuabin32
1069452262e1Smrg	#else
1070452262e1Smrg	LIBCABI=${LIBC}
1071452262e1Smrg	#endif
1072452262e1Smrg	#endif
1073452262e1Smrg
1074452262e1Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1075452262e1Smrg	CPU=mipsisa64r6
1076452262e1Smrg	#else
1077452262e1Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1078452262e1Smrg	CPU=mipsisa32r6
1079452262e1Smrg	#else
1080452262e1Smrg	#if defined(__mips64)
1081452262e1Smrg	CPU=mips64
1082452262e1Smrg	#else
1083452262e1Smrg	CPU=mips
1084452262e1Smrg	#endif
1085452262e1Smrg	#endif
1086452262e1Smrg	#endif
1087452262e1Smrg
108817ca54c3Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1089452262e1Smrg	MIPS_ENDIAN=el
109017ca54c3Smrg	#else
109117ca54c3Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1092452262e1Smrg	MIPS_ENDIAN=
109317ca54c3Smrg	#else
1094452262e1Smrg	MIPS_ENDIAN=
109517ca54c3Smrg	#endif
109617ca54c3Smrg	#endif
109717ca54c3SmrgEOF
1098452262e1Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1099452262e1Smrg	eval "$cc_set_vars"
1100452262e1Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
110117ca54c3Smrg	;;
110217ca54c3Smrg    mips64el:Linux:*:*)
1103452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1104452262e1Smrg	;;
110517ca54c3Smrg    openrisc*:Linux:*:*)
1106452262e1Smrg	GUESS=or1k-unknown-linux-$LIBC
1107452262e1Smrg	;;
110817ca54c3Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1109452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1110452262e1Smrg	;;
111117ca54c3Smrg    padre:Linux:*:*)
1112452262e1Smrg	GUESS=sparc-unknown-linux-$LIBC
1113452262e1Smrg	;;
111417ca54c3Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1115452262e1Smrg	GUESS=hppa64-unknown-linux-$LIBC
1116452262e1Smrg	;;
111717ca54c3Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
111817ca54c3Smrg	# Look for CPU level
111917ca54c3Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1120452262e1Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1121452262e1Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1122452262e1Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
112317ca54c3Smrg	esac
1124452262e1Smrg	;;
112517ca54c3Smrg    ppc64:Linux:*:*)
1126452262e1Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1127452262e1Smrg	;;
112817ca54c3Smrg    ppc:Linux:*:*)
1129452262e1Smrg	GUESS=powerpc-unknown-linux-$LIBC
1130452262e1Smrg	;;
113117ca54c3Smrg    ppc64le:Linux:*:*)
1132452262e1Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1133452262e1Smrg	;;
113417ca54c3Smrg    ppcle:Linux:*:*)
1135452262e1Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1136452262e1Smrg	;;
1137452262e1Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1138452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139452262e1Smrg	;;
114017ca54c3Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1141452262e1Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1142452262e1Smrg	;;
114317ca54c3Smrg    sh64*:Linux:*:*)
1144452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145452262e1Smrg	;;
114617ca54c3Smrg    sh*:Linux:*:*)
1147452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1148452262e1Smrg	;;
114917ca54c3Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1150452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1151452262e1Smrg	;;
115217ca54c3Smrg    tile*:Linux:*:*)
1153452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1154452262e1Smrg	;;
115517ca54c3Smrg    vax:Linux:*:*)
1156452262e1Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1157452262e1Smrg	;;
115817ca54c3Smrg    x86_64:Linux:*:*)
1159452262e1Smrg	set_cc_for_build
1160452262e1Smrg	CPU=$UNAME_MACHINE
1161452262e1Smrg	LIBCABI=$LIBC
1162452262e1Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1163452262e1Smrg	    ABI=64
1164452262e1Smrg	    sed 's/^	    //' << EOF > "$dummy.c"
1165452262e1Smrg	    #ifdef __i386__
1166452262e1Smrg	    ABI=x86
1167452262e1Smrg	    #else
1168452262e1Smrg	    #ifdef __ILP32__
1169452262e1Smrg	    ABI=x32
1170452262e1Smrg	    #endif
1171452262e1Smrg	    #endif
1172452262e1SmrgEOF
1173452262e1Smrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1174452262e1Smrg	    eval "$cc_set_abi"
1175452262e1Smrg	    case $ABI in
1176452262e1Smrg		x86) CPU=i686 ;;
1177452262e1Smrg		x32) LIBCABI=${LIBC}x32 ;;
1178452262e1Smrg	    esac
1179452262e1Smrg	fi
1180452262e1Smrg	GUESS=$CPU-pc-linux-$LIBCABI
1181452262e1Smrg	;;
118217ca54c3Smrg    xtensa*:Linux:*:*)
1183452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1184452262e1Smrg	;;
118517ca54c3Smrg    i*86:DYNIX/ptx:4*:*)
118617ca54c3Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
118717ca54c3Smrg	# earlier versions are messed up and put the nodename in both
118817ca54c3Smrg	# sysname and nodename.
1189452262e1Smrg	GUESS=i386-sequent-sysv4
1190452262e1Smrg	;;
119117ca54c3Smrg    i*86:UNIX_SV:4.2MP:2.*)
119217ca54c3Smrg	# Unixware is an offshoot of SVR4, but it has its own version
119317ca54c3Smrg	# number series starting with 2...
119417ca54c3Smrg	# I am not positive that other SVR4 systems won't match this,
119517ca54c3Smrg	# I just have to hope.  -- rms.
119617ca54c3Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1197452262e1Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1198452262e1Smrg	;;
119917ca54c3Smrg    i*86:OS/2:*:*)
1200635a5eb8Smrg	# If we were able to find 'uname', then EMX Unix compatibility
120117ca54c3Smrg	# is probably installed.
1202452262e1Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1203452262e1Smrg	;;
120417ca54c3Smrg    i*86:XTS-300:*:STOP)
1205452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1206452262e1Smrg	;;
120717ca54c3Smrg    i*86:atheos:*:*)
1208452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1209452262e1Smrg	;;
121017ca54c3Smrg    i*86:syllable:*:*)
1211452262e1Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1212452262e1Smrg	;;
121317ca54c3Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1214452262e1Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1215452262e1Smrg	;;
121617ca54c3Smrg    i*86:*DOS:*:*)
1217452262e1Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1218452262e1Smrg	;;
1219452262e1Smrg    i*86:*:4.*:*)
1220452262e1Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
122117ca54c3Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1222452262e1Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
122317ca54c3Smrg	else
1224452262e1Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
122517ca54c3Smrg	fi
1226452262e1Smrg	;;
122717ca54c3Smrg    i*86:*:5:[678]*)
122817ca54c3Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
122917ca54c3Smrg	case `/bin/uname -X | grep "^Machine"` in
123017ca54c3Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
123117ca54c3Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
123217ca54c3Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
123317ca54c3Smrg	esac
1234452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1235452262e1Smrg	;;
123617ca54c3Smrg    i*86:*:3.2:*)
123717ca54c3Smrg	if test -f /usr/options/cb.name; then
123817ca54c3Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1239452262e1Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
124017ca54c3Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
124117ca54c3Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
124217ca54c3Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
124317ca54c3Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
124417ca54c3Smrg			&& UNAME_MACHINE=i586
124517ca54c3Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
124617ca54c3Smrg			&& UNAME_MACHINE=i686
124717ca54c3Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
124817ca54c3Smrg			&& UNAME_MACHINE=i686
1249452262e1Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
125017ca54c3Smrg	else
1251452262e1Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
125217ca54c3Smrg	fi
1253452262e1Smrg	;;
125417ca54c3Smrg    pc:*:*:*)
125517ca54c3Smrg	# Left here for compatibility:
125617ca54c3Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
125717ca54c3Smrg	# the processor, so we play safe by assuming i586.
125817ca54c3Smrg	# Note: whatever this is, it MUST be the same as what config.sub
125917ca54c3Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
126017ca54c3Smrg	# this is a cross-build.
1261452262e1Smrg	GUESS=i586-pc-msdosdjgpp
1262452262e1Smrg	;;
126317ca54c3Smrg    Intel:Mach:3*:*)
1264452262e1Smrg	GUESS=i386-pc-mach3
1265452262e1Smrg	;;
126617ca54c3Smrg    paragon:*:*:*)
1267452262e1Smrg	GUESS=i860-intel-osf1
1268452262e1Smrg	;;
126917ca54c3Smrg    i860:*:4.*:*) # i860-SVR4
127017ca54c3Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1271452262e1Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
127217ca54c3Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1273452262e1Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
127417ca54c3Smrg	fi
1275452262e1Smrg	;;
127617ca54c3Smrg    mini*:CTIX:SYS*5:*)
127717ca54c3Smrg	# "miniframe"
1278452262e1Smrg	GUESS=m68010-convergent-sysv
1279452262e1Smrg	;;
128017ca54c3Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1281452262e1Smrg	GUESS=m68k-convergent-sysv
1282452262e1Smrg	;;
128317ca54c3Smrg    M680?0:D-NIX:5.3:*)
1284452262e1Smrg	GUESS=m68k-diab-dnix
1285452262e1Smrg	;;
128617ca54c3Smrg    M68*:*:R3V[5678]*:*)
128717ca54c3Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
128817ca54c3Smrg    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)
128917ca54c3Smrg	OS_REL=''
129017ca54c3Smrg	test -r /etc/.relid \
129117ca54c3Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
129217ca54c3Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1293452262e1Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
129417ca54c3Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1295452262e1Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
129617ca54c3Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
129717ca54c3Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
129817ca54c3Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
129917ca54c3Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
130017ca54c3Smrg	OS_REL='.3'
130117ca54c3Smrg	test -r /etc/.relid \
130217ca54c3Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
130317ca54c3Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1304452262e1Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
130517ca54c3Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1306452262e1Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
130717ca54c3Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1308452262e1Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
130917ca54c3Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1310452262e1Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1311452262e1Smrg	;;
131217ca54c3Smrg    mc68030:UNIX_System_V:4.*:*)
1313452262e1Smrg	GUESS=m68k-atari-sysv4
1314452262e1Smrg	;;
131517ca54c3Smrg    TSUNAMI:LynxOS:2.*:*)
1316452262e1Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1317452262e1Smrg	;;
131817ca54c3Smrg    rs6000:LynxOS:2.*:*)
1319452262e1Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1320452262e1Smrg	;;
132117ca54c3Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1322452262e1Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1323452262e1Smrg	;;
132417ca54c3Smrg    SM[BE]S:UNIX_SV:*:*)
1325452262e1Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1326452262e1Smrg	;;
132717ca54c3Smrg    RM*:ReliantUNIX-*:*:*)
1328452262e1Smrg	GUESS=mips-sni-sysv4
1329452262e1Smrg	;;
133017ca54c3Smrg    RM*:SINIX-*:*:*)
1331452262e1Smrg	GUESS=mips-sni-sysv4
1332452262e1Smrg	;;
133317ca54c3Smrg    *:SINIX-*:*:*)
133417ca54c3Smrg	if uname -p 2>/dev/null >/dev/null ; then
133517ca54c3Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1336452262e1Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
133717ca54c3Smrg	else
1338452262e1Smrg		GUESS=ns32k-sni-sysv
133917ca54c3Smrg	fi
1340452262e1Smrg	;;
1341635a5eb8Smrg    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
134217ca54c3Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1343452262e1Smrg	GUESS=i586-unisys-sysv4
1344452262e1Smrg	;;
134517ca54c3Smrg    *:UNIX_System_V:4*:FTX*)
134617ca54c3Smrg	# From Gerald Hewes <hewes@openmarket.com>.
134717ca54c3Smrg	# How about differentiating between stratus architectures? -djm
1348452262e1Smrg	GUESS=hppa1.1-stratus-sysv4
1349452262e1Smrg	;;
135017ca54c3Smrg    *:*:*:FTX*)
135117ca54c3Smrg	# From seanf@swdc.stratus.com.
1352452262e1Smrg	GUESS=i860-stratus-sysv4
1353452262e1Smrg	;;
135417ca54c3Smrg    i*86:VOS:*:*)
135517ca54c3Smrg	# From Paul.Green@stratus.com.
1356452262e1Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1357452262e1Smrg	;;
135817ca54c3Smrg    *:VOS:*:*)
135917ca54c3Smrg	# From Paul.Green@stratus.com.
1360452262e1Smrg	GUESS=hppa1.1-stratus-vos
1361452262e1Smrg	;;
136217ca54c3Smrg    mc68*:A/UX:*:*)
1363452262e1Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1364452262e1Smrg	;;
136517ca54c3Smrg    news*:NEWS-OS:6*:*)
1366452262e1Smrg	GUESS=mips-sony-newsos6
1367452262e1Smrg	;;
136817ca54c3Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1369452262e1Smrg	if test -d /usr/nec; then
1370452262e1Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
137117ca54c3Smrg	else
1372452262e1Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
137317ca54c3Smrg	fi
1374452262e1Smrg	;;
137517ca54c3Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1376452262e1Smrg	GUESS=powerpc-be-beos
1377452262e1Smrg	;;
137817ca54c3Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1379452262e1Smrg	GUESS=powerpc-apple-beos
1380452262e1Smrg	;;
138117ca54c3Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1382452262e1Smrg	GUESS=i586-pc-beos
1383452262e1Smrg	;;
138417ca54c3Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1385452262e1Smrg	GUESS=i586-pc-haiku
1386452262e1Smrg	;;
1387452262e1Smrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1388452262e1Smrg	GUESS=powerpc-apple-haiku
1389452262e1Smrg	;;
1390452262e1Smrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1391452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-haiku
1392452262e1Smrg	;;
139317ca54c3Smrg    SX-4:SUPER-UX:*:*)
1394452262e1Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1395452262e1Smrg	;;
139617ca54c3Smrg    SX-5:SUPER-UX:*:*)
1397452262e1Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1398452262e1Smrg	;;
139917ca54c3Smrg    SX-6:SUPER-UX:*:*)
1400452262e1Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1401452262e1Smrg	;;
140217ca54c3Smrg    SX-7:SUPER-UX:*:*)
1403452262e1Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1404452262e1Smrg	;;
140517ca54c3Smrg    SX-8:SUPER-UX:*:*)
1406452262e1Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1407452262e1Smrg	;;
140817ca54c3Smrg    SX-8R:SUPER-UX:*:*)
1409452262e1Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1410452262e1Smrg	;;
141117ca54c3Smrg    SX-ACE:SUPER-UX:*:*)
1412452262e1Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1413452262e1Smrg	;;
141417ca54c3Smrg    Power*:Rhapsody:*:*)
1415452262e1Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1416452262e1Smrg	;;
141717ca54c3Smrg    *:Rhapsody:*:*)
1418452262e1Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1419452262e1Smrg	;;
1420452262e1Smrg    arm64:Darwin:*:*)
1421452262e1Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1422452262e1Smrg	;;
142317ca54c3Smrg    *:Darwin:*:*)
1424452262e1Smrg	UNAME_PROCESSOR=`uname -p`
1425452262e1Smrg	case $UNAME_PROCESSOR in
1426452262e1Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1427452262e1Smrg	esac
1428452262e1Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1429452262e1Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1430452262e1Smrg	    # Avoid executing cc if there is no toolchain installed as
1431452262e1Smrg	    # cc will be a stub that puts up a graphical alert
1432452262e1Smrg	    # prompting the user to install developer tools.
1433452262e1Smrg	    CC_FOR_BUILD=no_compiler_found
1434452262e1Smrg	else
1435452262e1Smrg	    set_cc_for_build
143617ca54c3Smrg	fi
1437452262e1Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1438452262e1Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1439452262e1Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1440452262e1Smrg		   grep IS_64BIT_ARCH >/dev/null
1441452262e1Smrg	    then
1442452262e1Smrg		case $UNAME_PROCESSOR in
1443452262e1Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1444452262e1Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1445452262e1Smrg		esac
1446452262e1Smrg	    fi
1447452262e1Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1448452262e1Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1449452262e1Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1450452262e1Smrg		   grep IS_PPC >/dev/null
1451452262e1Smrg	    then
1452452262e1Smrg		UNAME_PROCESSOR=powerpc
145317ca54c3Smrg	    fi
145417ca54c3Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1455452262e1Smrg	    # uname -m returns i386 or x86_64
1456452262e1Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
145717ca54c3Smrg	fi
1458452262e1Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1459452262e1Smrg	;;
146017ca54c3Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
146117ca54c3Smrg	UNAME_PROCESSOR=`uname -p`
146217ca54c3Smrg	if test "$UNAME_PROCESSOR" = x86; then
146317ca54c3Smrg		UNAME_PROCESSOR=i386
146417ca54c3Smrg		UNAME_MACHINE=pc
146517ca54c3Smrg	fi
1466452262e1Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1467452262e1Smrg	;;
146817ca54c3Smrg    *:QNX:*:4*)
1469452262e1Smrg	GUESS=i386-pc-qnx
1470452262e1Smrg	;;
1471452262e1Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1472452262e1Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1473452262e1Smrg	;;
147417ca54c3Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1475452262e1Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1476452262e1Smrg	;;
1477452262e1Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1478452262e1Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1479452262e1Smrg	;;
1480452262e1Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1481452262e1Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1482452262e1Smrg	;;
1483452262e1Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1484452262e1Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1485452262e1Smrg	;;
148617ca54c3Smrg    *:NonStop-UX:*:*)
1487452262e1Smrg	GUESS=mips-compaq-nonstopux
1488452262e1Smrg	;;
148917ca54c3Smrg    BS2000:POSIX*:*:*)
1490452262e1Smrg	GUESS=bs2000-siemens-sysv
1491452262e1Smrg	;;
149217ca54c3Smrg    DS/*:UNIX_System_V:*:*)
1493452262e1Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1494452262e1Smrg	;;
149517ca54c3Smrg    *:Plan9:*:*)
149617ca54c3Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
149717ca54c3Smrg	# is converted to i386 for consistency with other x86
149817ca54c3Smrg	# operating systems.
1499452262e1Smrg	if test "${cputype-}" = 386; then
150017ca54c3Smrg	    UNAME_MACHINE=i386
1501452262e1Smrg	elif test "x${cputype-}" != x; then
1502452262e1Smrg	    UNAME_MACHINE=$cputype
150317ca54c3Smrg	fi
1504452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1505452262e1Smrg	;;
150617ca54c3Smrg    *:TOPS-10:*:*)
1507452262e1Smrg	GUESS=pdp10-unknown-tops10
1508452262e1Smrg	;;
150917ca54c3Smrg    *:TENEX:*:*)
1510452262e1Smrg	GUESS=pdp10-unknown-tenex
1511452262e1Smrg	;;
151217ca54c3Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1513452262e1Smrg	GUESS=pdp10-dec-tops20
1514452262e1Smrg	;;
151517ca54c3Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1516452262e1Smrg	GUESS=pdp10-xkl-tops20
1517452262e1Smrg	;;
151817ca54c3Smrg    *:TOPS-20:*:*)
1519452262e1Smrg	GUESS=pdp10-unknown-tops20
1520452262e1Smrg	;;
152117ca54c3Smrg    *:ITS:*:*)
1522452262e1Smrg	GUESS=pdp10-unknown-its
1523452262e1Smrg	;;
152417ca54c3Smrg    SEI:*:*:SEIUX)
1525452262e1Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1526452262e1Smrg	;;
152717ca54c3Smrg    *:DragonFly:*:*)
1528452262e1Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1529452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1530452262e1Smrg	;;
153117ca54c3Smrg    *:*VMS:*:*)
153217ca54c3Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1533452262e1Smrg	case $UNAME_MACHINE in
1534452262e1Smrg	    A*) GUESS=alpha-dec-vms ;;
1535452262e1Smrg	    I*) GUESS=ia64-dec-vms ;;
1536452262e1Smrg	    V*) GUESS=vax-dec-vms ;;
153717ca54c3Smrg	esac ;;
153817ca54c3Smrg    *:XENIX:*:SysV)
1539452262e1Smrg	GUESS=i386-pc-xenix
1540452262e1Smrg	;;
154117ca54c3Smrg    i*86:skyos:*:*)
1542452262e1Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1543452262e1Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1544452262e1Smrg	;;
154517ca54c3Smrg    i*86:rdos:*:*)
1546452262e1Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1547452262e1Smrg	;;
1548452262e1Smrg    i*86:Fiwix:*:*)
1549452262e1Smrg	GUESS=$UNAME_MACHINE-pc-fiwix
1550452262e1Smrg	;;
1551452262e1Smrg    *:AROS:*:*)
1552452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1553452262e1Smrg	;;
155417ca54c3Smrg    x86_64:VMkernel:*:*)
1555452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1556452262e1Smrg	;;
155717ca54c3Smrg    amd64:Isilon\ OneFS:*:*)
1558452262e1Smrg	GUESS=x86_64-unknown-onefs
1559452262e1Smrg	;;
1560452262e1Smrg    *:Unleashed:*:*)
1561452262e1Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1562452262e1Smrg	;;
1563452262e1Smrgesac
1564452262e1Smrg
1565452262e1Smrg# Do we have a guess based on uname results?
1566452262e1Smrgif test "x$GUESS" != x; then
1567452262e1Smrg    echo "$GUESS"
1568452262e1Smrg    exit
1569452262e1Smrgfi
1570452262e1Smrg
1571452262e1Smrg# No uname command or uname output not recognized.
1572452262e1Smrgset_cc_for_build
1573452262e1Smrgcat > "$dummy.c" <<EOF
1574452262e1Smrg#ifdef _SEQUENT_
1575452262e1Smrg#include <sys/types.h>
1576452262e1Smrg#include <sys/utsname.h>
1577452262e1Smrg#endif
1578452262e1Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1579452262e1Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1580452262e1Smrg#include <signal.h>
1581452262e1Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1582452262e1Smrg#include <sys/utsname.h>
1583452262e1Smrg#endif
1584452262e1Smrg#endif
1585452262e1Smrg#endif
1586452262e1Smrgmain ()
1587452262e1Smrg{
1588452262e1Smrg#if defined (sony)
1589452262e1Smrg#if defined (MIPSEB)
1590452262e1Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1591452262e1Smrg     I don't know....  */
1592452262e1Smrg  printf ("mips-sony-bsd\n"); exit (0);
1593452262e1Smrg#else
1594452262e1Smrg#include <sys/param.h>
1595452262e1Smrg  printf ("m68k-sony-newsos%s\n",
1596452262e1Smrg#ifdef NEWSOS4
1597452262e1Smrg  "4"
1598452262e1Smrg#else
1599452262e1Smrg  ""
1600452262e1Smrg#endif
1601452262e1Smrg  ); exit (0);
1602452262e1Smrg#endif
1603452262e1Smrg#endif
1604452262e1Smrg
1605452262e1Smrg#if defined (NeXT)
1606452262e1Smrg#if !defined (__ARCHITECTURE__)
1607452262e1Smrg#define __ARCHITECTURE__ "m68k"
1608452262e1Smrg#endif
1609452262e1Smrg  int version;
1610452262e1Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1611452262e1Smrg  if (version < 4)
1612452262e1Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1613452262e1Smrg  else
1614452262e1Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1615452262e1Smrg  exit (0);
1616452262e1Smrg#endif
1617452262e1Smrg
1618452262e1Smrg#if defined (MULTIMAX) || defined (n16)
1619452262e1Smrg#if defined (UMAXV)
1620452262e1Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1621452262e1Smrg#else
1622452262e1Smrg#if defined (CMU)
1623452262e1Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1624452262e1Smrg#else
1625452262e1Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1626452262e1Smrg#endif
1627452262e1Smrg#endif
1628452262e1Smrg#endif
1629452262e1Smrg
1630452262e1Smrg#if defined (__386BSD__)
1631452262e1Smrg  printf ("i386-pc-bsd\n"); exit (0);
1632452262e1Smrg#endif
1633452262e1Smrg
1634452262e1Smrg#if defined (sequent)
1635452262e1Smrg#if defined (i386)
1636452262e1Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1637452262e1Smrg#endif
1638452262e1Smrg#if defined (ns32000)
1639452262e1Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1640452262e1Smrg#endif
1641452262e1Smrg#endif
1642452262e1Smrg
1643452262e1Smrg#if defined (_SEQUENT_)
1644452262e1Smrg  struct utsname un;
1645452262e1Smrg
1646452262e1Smrg  uname(&un);
1647452262e1Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1648452262e1Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1649452262e1Smrg  }
1650452262e1Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1651452262e1Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1652452262e1Smrg  }
1653452262e1Smrg  printf ("i386-sequent-ptx\n"); exit (0);
1654452262e1Smrg#endif
1655452262e1Smrg
1656452262e1Smrg#if defined (vax)
1657452262e1Smrg#if !defined (ultrix)
1658452262e1Smrg#include <sys/param.h>
1659452262e1Smrg#if defined (BSD)
1660452262e1Smrg#if BSD == 43
1661452262e1Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1662452262e1Smrg#else
1663452262e1Smrg#if BSD == 199006
1664452262e1Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1665452262e1Smrg#else
1666452262e1Smrg  printf ("vax-dec-bsd\n"); exit (0);
1667452262e1Smrg#endif
1668452262e1Smrg#endif
1669452262e1Smrg#else
1670452262e1Smrg  printf ("vax-dec-bsd\n"); exit (0);
1671452262e1Smrg#endif
1672452262e1Smrg#else
1673452262e1Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1674452262e1Smrg  struct utsname un;
1675452262e1Smrg  uname (&un);
1676452262e1Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1677452262e1Smrg#else
1678452262e1Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1679452262e1Smrg#endif
1680452262e1Smrg#endif
1681452262e1Smrg#endif
1682452262e1Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1683452262e1Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1684452262e1Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1685452262e1Smrg  struct utsname *un;
1686452262e1Smrg  uname (&un);
1687452262e1Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1688452262e1Smrg#else
1689452262e1Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1690452262e1Smrg#endif
1691452262e1Smrg#endif
1692452262e1Smrg#endif
1693452262e1Smrg
1694452262e1Smrg#if defined (alliant) && defined (i860)
1695452262e1Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1696452262e1Smrg#endif
1697452262e1Smrg
1698452262e1Smrg  exit (1);
1699452262e1Smrg}
1700452262e1SmrgEOF
1701452262e1Smrg
1702452262e1Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1703452262e1Smrg	{ echo "$SYSTEM_NAME"; exit; }
1704452262e1Smrg
1705452262e1Smrg# Apollos put the system type in the environment.
1706452262e1Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1707452262e1Smrg
1708452262e1Smrgecho "$0: unable to guess system type" >&2
1709452262e1Smrg
1710452262e1Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1711452262e1Smrg    mips:Linux | mips64:Linux)
1712452262e1Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1713452262e1Smrg	cat >&2 <<EOF
1714452262e1Smrg
1715452262e1SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1716452262e1Smrgthe system type. Please install a C compiler and try again.
1717452262e1SmrgEOF
1718452262e1Smrg	;;
171917ca54c3Smrgesac
172017ca54c3Smrg
172117ca54c3Smrgcat >&2 <<EOF
172217ca54c3Smrg
172317ca54c3SmrgThis script (version $timestamp), has failed to recognize the
1724452262e1Smrgoperating system you are using. If your script is old, overwrite *all*
1725452262e1Smrgcopies of config.guess and config.sub with the latest versions from:
172617ca54c3Smrg
1727452262e1Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
172817ca54c3Smrgand
1729452262e1Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1730452262e1SmrgEOF
1731452262e1Smrg
1732452262e1Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1733452262e1Smrgthisyear=`date +%Y`
1734452262e1Smrg# shellcheck disable=SC2003
1735452262e1Smrgscript_age=`expr "$thisyear" - "$our_year"`
1736452262e1Smrgif test "$script_age" -lt 3 ; then
1737452262e1Smrg   cat >&2 <<EOF
173817ca54c3Smrg
173917ca54c3SmrgIf $0 has already been updated, send the following data and any
174017ca54c3Smrginformation you think might be pertinent to config-patches@gnu.org to
174117ca54c3Smrgprovide the necessary information to handle your system.
174217ca54c3Smrg
174317ca54c3Smrgconfig.guess timestamp = $timestamp
174417ca54c3Smrg
174517ca54c3Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
174617ca54c3Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
174717ca54c3Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
174817ca54c3Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
174917ca54c3Smrg
175017ca54c3Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
175117ca54c3Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
175217ca54c3Smrg
175317ca54c3Smrghostinfo               = `(hostinfo) 2>/dev/null`
175417ca54c3Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
175517ca54c3Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
175617ca54c3Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
175717ca54c3Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
175817ca54c3Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
175917ca54c3Smrg
1760452262e1SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1761452262e1SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1762452262e1SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1763452262e1SmrgUNAME_VERSION = "$UNAME_VERSION"
176417ca54c3SmrgEOF
1765452262e1Smrgfi
176617ca54c3Smrg
176717ca54c3Smrgexit 1
176817ca54c3Smrg
176917ca54c3Smrg# Local variables:
1770452262e1Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
177117ca54c3Smrg# time-stamp-start: "timestamp='"
177217ca54c3Smrg# time-stamp-format: "%:y-%02m-%02d"
177317ca54c3Smrg# time-stamp-end: "'"
177417ca54c3Smrg# End:
1775