1b53e5eeaSmrg#! /bin/sh
2b53e5eeaSmrg# Attempt to guess a canonical system name.
347a4502cSmrg#   Copyright 1992-2024 Free Software Foundation, Inc.
4b53e5eeaSmrg
5e45ace2bSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6e45ace2bSmrg
747a4502cSmrgtimestamp='2024-01-01'
8b53e5eeaSmrg
9b53e5eeaSmrg# This file is free software; you can redistribute it and/or modify it
10b53e5eeaSmrg# under the terms of the GNU General Public License as published by
11e45ace2bSmrg# the Free Software Foundation, either version 3 of the License, or
12b53e5eeaSmrg# (at your option) any later version.
13b53e5eeaSmrg#
14b53e5eeaSmrg# This program is distributed in the hope that it will be useful, but
15b53e5eeaSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16b53e5eeaSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17b53e5eeaSmrg# General Public License for more details.
18b53e5eeaSmrg#
19b53e5eeaSmrg# You should have received a copy of the GNU General Public License
203d2ed3e3Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21b53e5eeaSmrg#
22b53e5eeaSmrg# As a special exception to the GNU General Public License, if you
23b53e5eeaSmrg# distribute this file as part of a program that contains a
24b53e5eeaSmrg# configuration script generated by Autoconf, you may include it under
2575ebec6dSmrg# the same distribution terms that you use for the rest of that
2675ebec6dSmrg# program.  This Exception is an additional permission under section 7
2775ebec6dSmrg# of the GNU General Public License, version 3 ("GPLv3").
28b53e5eeaSmrg#
293d2ed3e3Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30b53e5eeaSmrg#
31af928962Smrg# You can get the latest version of this script from:
32e45ace2bSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
3375ebec6dSmrg#
343d2ed3e3Smrg# Please send patches to <config-patches@gnu.org>.
3575ebec6dSmrg
36b53e5eeaSmrg
37e45ace2bSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
38e45ace2bSmrg# about features and limitations of the classic Bourne shell that were
39e45ace2bSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
40e45ace2bSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41e45ace2bSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42e45ace2bSmrg# have a pre-POSIX /bin/sh.
43e45ace2bSmrg
44e45ace2bSmrg
45b53e5eeaSmrgme=`echo "$0" | sed -e 's,.*/,,'`
46b53e5eeaSmrg
47b53e5eeaSmrgusage="\
48b53e5eeaSmrgUsage: $0 [OPTION]
49b53e5eeaSmrg
5047a4502cSmrgOutput the configuration name of the system '$me' is run on.
51b53e5eeaSmrg
523d2ed3e3SmrgOptions:
53b53e5eeaSmrg  -h, --help         print this help, then exit
54b53e5eeaSmrg  -t, --time-stamp   print date of last modification, then exit
55b53e5eeaSmrg  -v, --version      print version number, then exit
56b53e5eeaSmrg
57b53e5eeaSmrgReport bugs and patches to <config-patches@gnu.org>."
58b53e5eeaSmrg
59b53e5eeaSmrgversion="\
60b53e5eeaSmrgGNU config.guess ($timestamp)
61b53e5eeaSmrg
62b53e5eeaSmrgOriginally written by Per Bothner.
6347a4502cSmrgCopyright 1992-2024 Free Software Foundation, Inc.
64b53e5eeaSmrg
65b53e5eeaSmrgThis is free software; see the source for copying conditions.  There is NO
66b53e5eeaSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67b53e5eeaSmrg
68b53e5eeaSmrghelp="
6947a4502cSmrgTry '$me --help' for more information."
70b53e5eeaSmrg
71b53e5eeaSmrg# Parse command line
72b53e5eeaSmrgwhile test $# -gt 0 ; do
73b53e5eeaSmrg  case $1 in
74b53e5eeaSmrg    --time-stamp | --time* | -t )
75b53e5eeaSmrg       echo "$timestamp" ; exit ;;
76b53e5eeaSmrg    --version | -v )
77b53e5eeaSmrg       echo "$version" ; exit ;;
78b53e5eeaSmrg    --help | --h* | -h )
79b53e5eeaSmrg       echo "$usage"; exit ;;
80b53e5eeaSmrg    -- )     # Stop option processing
81b53e5eeaSmrg       shift; break ;;
82b53e5eeaSmrg    - )	# Use stdin as input.
83b53e5eeaSmrg       break ;;
84b53e5eeaSmrg    -* )
85b53e5eeaSmrg       echo "$me: invalid option $1$help" >&2
86b53e5eeaSmrg       exit 1 ;;
87b53e5eeaSmrg    * )
88b53e5eeaSmrg       break ;;
89b53e5eeaSmrg  esac
90b53e5eeaSmrgdone
91b53e5eeaSmrg
92b53e5eeaSmrgif test $# != 0; then
93b53e5eeaSmrg  echo "$me: too many arguments$help" >&2
94b53e5eeaSmrg  exit 1
95b53e5eeaSmrgfi
96b53e5eeaSmrg
97e45ace2bSmrg# Just in case it came from the environment.
98e45ace2bSmrgGUESS=
99b53e5eeaSmrg
100b53e5eeaSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101b53e5eeaSmrg# compiler to aid in system detection is discouraged as it requires
102b53e5eeaSmrg# temporary files to be created and, as you can see below, it is a
103b53e5eeaSmrg# headache to deal with in a portable fashion.
104b53e5eeaSmrg
10547a4502cSmrg# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
10647a4502cSmrg# use 'HOST_CC' if defined, but it is deprecated.
107b53e5eeaSmrg
108b53e5eeaSmrg# Portable tmp directory creation inspired by the Autoconf team.
109b53e5eeaSmrg
110e45ace2bSmrgtmp=
111e45ace2bSmrg# shellcheck disable=SC2172
112e45ace2bSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113e45ace2bSmrg
114e45ace2bSmrgset_cc_for_build() {
115e45ace2bSmrg    # prevent multiple calls if $tmp is already set
116e45ace2bSmrg    test "$tmp" && return 0
117e45ace2bSmrg    : "${TMPDIR=/tmp}"
118e45ace2bSmrg    # shellcheck disable=SC2039,SC3028
119e45ace2bSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120e45ace2bSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121e45ace2bSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122e45ace2bSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123e45ace2bSmrg    dummy=$tmp/dummy
124e45ace2bSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125e45ace2bSmrg	,,)    echo "int x;" > "$dummy.c"
126e45ace2bSmrg	       for driver in cc gcc c89 c99 ; do
127e45ace2bSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128e45ace2bSmrg		       CC_FOR_BUILD=$driver
129e45ace2bSmrg		       break
130e45ace2bSmrg		   fi
131e45ace2bSmrg	       done
132e45ace2bSmrg	       if test x"$CC_FOR_BUILD" = x ; then
133e45ace2bSmrg		   CC_FOR_BUILD=no_compiler_found
134e45ace2bSmrg	       fi
135e45ace2bSmrg	       ;;
136e45ace2bSmrg	,,*)   CC_FOR_BUILD=$CC ;;
137e45ace2bSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138e45ace2bSmrg    esac
139e45ace2bSmrg}
140b53e5eeaSmrg
141b53e5eeaSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142b53e5eeaSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
143e45ace2bSmrgif test -f /.attbin/uname ; then
144b53e5eeaSmrg	PATH=$PATH:/.attbin ; export PATH
145b53e5eeaSmrgfi
146b53e5eeaSmrg
147b53e5eeaSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148b53e5eeaSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149e45ace2bSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150b53e5eeaSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151b53e5eeaSmrg
152e45ace2bSmrgcase $UNAME_SYSTEM in
1536a3641a6SsnjLinux|GNU|GNU/*)
154e45ace2bSmrg	LIBC=unknown
1556a3641a6Ssnj
156e45ace2bSmrg	set_cc_for_build
1573d2ed3e3Smrg	cat <<-EOF > "$dummy.c"
15847a4502cSmrg	#if defined(__ANDROID__)
15947a4502cSmrg	LIBC=android
16047a4502cSmrg	#else
1616a3641a6Ssnj	#include <features.h>
1626a3641a6Ssnj	#if defined(__UCLIBC__)
1636a3641a6Ssnj	LIBC=uclibc
1646a3641a6Ssnj	#elif defined(__dietlibc__)
1656a3641a6Ssnj	LIBC=dietlibc
166e45ace2bSmrg	#elif defined(__GLIBC__)
1676a3641a6Ssnj	LIBC=gnu
16847a4502cSmrg	#elif defined(__LLVM_LIBC__)
16947a4502cSmrg	LIBC=llvm
170e45ace2bSmrg	#else
171e45ace2bSmrg	#include <stdarg.h>
172e45ace2bSmrg	/* First heuristic to detect musl libc.  */
173e45ace2bSmrg	#ifdef __DEFINED_va_list
174e45ace2bSmrg	LIBC=musl
175e45ace2bSmrg	#endif
1766a3641a6Ssnj	#endif
17747a4502cSmrg	#endif
1786a3641a6Ssnj	EOF
179e45ace2bSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
180e45ace2bSmrg	eval "$cc_set_libc"
1813d2ed3e3Smrg
182e45ace2bSmrg	# Second heuristic to detect musl libc.
183e45ace2bSmrg	if [ "$LIBC" = unknown ] &&
184e45ace2bSmrg	   command -v ldd >/dev/null &&
185e45ace2bSmrg	   ldd --version 2>&1 | grep -q ^musl; then
186e45ace2bSmrg		LIBC=musl
187e45ace2bSmrg	fi
188e45ace2bSmrg
189e45ace2bSmrg	# If the system lacks a compiler, then just pick glibc.
190e45ace2bSmrg	# We could probably try harder.
191e45ace2bSmrg	if [ "$LIBC" = unknown ]; then
192e45ace2bSmrg		LIBC=gnu
1933d2ed3e3Smrg	fi
1946a3641a6Ssnj	;;
1956a3641a6Ssnjesac
1966a3641a6Ssnj
197b53e5eeaSmrg# Note: order is significant - the case branches are not exclusive.
198b53e5eeaSmrg
199e45ace2bSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
200b53e5eeaSmrg    *:NetBSD:*:*)
201b53e5eeaSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
20275ebec6dSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
203b53e5eeaSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
204b53e5eeaSmrg	# switched to ELF, *-*-netbsd* would select the old
205b53e5eeaSmrg	# object file format.  This provides both forward
206b53e5eeaSmrg	# compatibility and a consistent mechanism for selecting the
207b53e5eeaSmrg	# object file format.
208b53e5eeaSmrg	#
209b53e5eeaSmrg	# Note: NetBSD doesn't particularly care about the vendor
210b53e5eeaSmrg	# portion of the name.  We always set it to "unknown".
2113d2ed3e3Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
212e45ace2bSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
213e45ace2bSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2143d2ed3e3Smrg	    echo unknown)`
215e45ace2bSmrg	case $UNAME_MACHINE_ARCH in
216e45ace2bSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
217b53e5eeaSmrg	    armeb) machine=armeb-unknown ;;
218b53e5eeaSmrg	    arm*) machine=arm-unknown ;;
219b53e5eeaSmrg	    sh3el) machine=shl-unknown ;;
220b53e5eeaSmrg	    sh3eb) machine=sh-unknown ;;
221b53e5eeaSmrg	    sh5el) machine=sh5le-unknown ;;
2223d2ed3e3Smrg	    earmv*)
2233d2ed3e3Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2243d2ed3e3Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
225e45ace2bSmrg		machine=${arch}${endian}-unknown
2263d2ed3e3Smrg		;;
227e45ace2bSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
228b53e5eeaSmrg	esac
229b53e5eeaSmrg	# The Operating System including object format, if it has switched
2303d2ed3e3Smrg	# to ELF recently (or will in the future) and ABI.
231e45ace2bSmrg	case $UNAME_MACHINE_ARCH in
2323d2ed3e3Smrg	    earm*)
2333d2ed3e3Smrg		os=netbsdelf
2343d2ed3e3Smrg		;;
235b53e5eeaSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
236e45ace2bSmrg		set_cc_for_build
237b53e5eeaSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
238af928962Smrg			| grep -q __ELF__
239b53e5eeaSmrg		then
240b53e5eeaSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
241b53e5eeaSmrg		    # Return netbsd for either.  FIX?
242b53e5eeaSmrg		    os=netbsd
243b53e5eeaSmrg		else
244b53e5eeaSmrg		    os=netbsdelf
245b53e5eeaSmrg		fi
246b53e5eeaSmrg		;;
247b53e5eeaSmrg	    *)
24875ebec6dSmrg		os=netbsd
249b53e5eeaSmrg		;;
250b53e5eeaSmrg	esac
2513d2ed3e3Smrg	# Determine ABI tags.
252e45ace2bSmrg	case $UNAME_MACHINE_ARCH in
2533d2ed3e3Smrg	    earm*)
2543d2ed3e3Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2553d2ed3e3Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2563d2ed3e3Smrg		;;
2573d2ed3e3Smrg	esac
258b53e5eeaSmrg	# The OS release
259b53e5eeaSmrg	# Debian GNU/NetBSD machines have a different userland, and
260b53e5eeaSmrg	# thus, need a distinct triplet. However, they do not need
261b53e5eeaSmrg	# kernel version information, so it can be replaced with a
262b53e5eeaSmrg	# suitable tag, in the style of linux-gnu.
263e45ace2bSmrg	case $UNAME_VERSION in
264b53e5eeaSmrg	    Debian*)
265b53e5eeaSmrg		release='-gnu'
266b53e5eeaSmrg		;;
267b53e5eeaSmrg	    *)
2683d2ed3e3Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
269b53e5eeaSmrg		;;
270b53e5eeaSmrg	esac
271b53e5eeaSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
272b53e5eeaSmrg	# contains redundant information, the shorter form:
273b53e5eeaSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
274e45ace2bSmrg	GUESS=$machine-${os}${release}${abi-}
275e45ace2bSmrg	;;
27675ebec6dSmrg    *:Bitrig:*:*)
27775ebec6dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
278e45ace2bSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
279e45ace2bSmrg	;;
280b53e5eeaSmrg    *:OpenBSD:*:*)
281b53e5eeaSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
282e45ace2bSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
283e45ace2bSmrg	;;
284e45ace2bSmrg    *:SecBSD:*:*)
285e45ace2bSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
286e45ace2bSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
287e45ace2bSmrg	;;
2883d2ed3e3Smrg    *:LibertyBSD:*:*)
2893d2ed3e3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
290e45ace2bSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
291e45ace2bSmrg	;;
2923d2ed3e3Smrg    *:MidnightBSD:*:*)
293e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
294e45ace2bSmrg	;;
295b53e5eeaSmrg    *:ekkoBSD:*:*)
296e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
297e45ace2bSmrg	;;
298b53e5eeaSmrg    *:SolidBSD:*:*)
299e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
300e45ace2bSmrg	;;
301e45ace2bSmrg    *:OS108:*:*)
302e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
303e45ace2bSmrg	;;
304b53e5eeaSmrg    macppc:MirBSD:*:*)
305e45ace2bSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
306e45ace2bSmrg	;;
307b53e5eeaSmrg    *:MirBSD:*:*)
308e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
309e45ace2bSmrg	;;
3103d2ed3e3Smrg    *:Sortix:*:*)
311e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
312e45ace2bSmrg	;;
313e45ace2bSmrg    *:Twizzler:*:*)
314e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
315e45ace2bSmrg	;;
3163d2ed3e3Smrg    *:Redox:*:*)
317e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-redox
318e45ace2bSmrg	;;
3193d2ed3e3Smrg    mips:OSF1:*.*)
320e45ace2bSmrg	GUESS=mips-dec-osf1
321e45ace2bSmrg	;;
322b53e5eeaSmrg    alpha:OSF1:*:*)
323e45ace2bSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
324e45ace2bSmrg	trap '' 0
325b53e5eeaSmrg	case $UNAME_RELEASE in
326b53e5eeaSmrg	*4.0)
327b53e5eeaSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
328b53e5eeaSmrg		;;
329b53e5eeaSmrg	*5.*)
33075ebec6dSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
331b53e5eeaSmrg		;;
332b53e5eeaSmrg	esac
333b53e5eeaSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
334b53e5eeaSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
335b53e5eeaSmrg	# covers most systems running today.  This code pipes the CPU
336b53e5eeaSmrg	# types through head -n 1, so we only detect the type of CPU 0.
337b53e5eeaSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
338e45ace2bSmrg	case $ALPHA_CPU_TYPE in
339b53e5eeaSmrg	    "EV4 (21064)")
3403d2ed3e3Smrg		UNAME_MACHINE=alpha ;;
341b53e5eeaSmrg	    "EV4.5 (21064)")
3423d2ed3e3Smrg		UNAME_MACHINE=alpha ;;
343b53e5eeaSmrg	    "LCA4 (21066/21068)")
3443d2ed3e3Smrg		UNAME_MACHINE=alpha ;;
345b53e5eeaSmrg	    "EV5 (21164)")
3463d2ed3e3Smrg		UNAME_MACHINE=alphaev5 ;;
347b53e5eeaSmrg	    "EV5.6 (21164A)")
3483d2ed3e3Smrg		UNAME_MACHINE=alphaev56 ;;
349b53e5eeaSmrg	    "EV5.6 (21164PC)")
3503d2ed3e3Smrg		UNAME_MACHINE=alphapca56 ;;
351b53e5eeaSmrg	    "EV5.7 (21164PC)")
3523d2ed3e3Smrg		UNAME_MACHINE=alphapca57 ;;
353b53e5eeaSmrg	    "EV6 (21264)")
3543d2ed3e3Smrg		UNAME_MACHINE=alphaev6 ;;
355b53e5eeaSmrg	    "EV6.7 (21264A)")
3563d2ed3e3Smrg		UNAME_MACHINE=alphaev67 ;;
357b53e5eeaSmrg	    "EV6.8CB (21264C)")
3583d2ed3e3Smrg		UNAME_MACHINE=alphaev68 ;;
359b53e5eeaSmrg	    "EV6.8AL (21264B)")
3603d2ed3e3Smrg		UNAME_MACHINE=alphaev68 ;;
361b53e5eeaSmrg	    "EV6.8CX (21264D)")
3623d2ed3e3Smrg		UNAME_MACHINE=alphaev68 ;;
363b53e5eeaSmrg	    "EV6.9A (21264/EV69A)")
3643d2ed3e3Smrg		UNAME_MACHINE=alphaev69 ;;
365b53e5eeaSmrg	    "EV7 (21364)")
3663d2ed3e3Smrg		UNAME_MACHINE=alphaev7 ;;
367b53e5eeaSmrg	    "EV7.9 (21364A)")
3683d2ed3e3Smrg		UNAME_MACHINE=alphaev79 ;;
369b53e5eeaSmrg	esac
370b53e5eeaSmrg	# A Pn.n version is a patched version.
371b53e5eeaSmrg	# A Vn.n version is a released version.
372b53e5eeaSmrg	# A Tn.n version is a released field test version.
373b53e5eeaSmrg	# A Xn.n version is an unreleased experimental baselevel.
374b53e5eeaSmrg	# 1.2 uses "1.2" for uname -r.
375e45ace2bSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
376e45ace2bSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
377e45ace2bSmrg	;;
378b53e5eeaSmrg    Amiga*:UNIX_System_V:4.0:*)
379e45ace2bSmrg	GUESS=m68k-unknown-sysv4
380e45ace2bSmrg	;;
381b53e5eeaSmrg    *:[Aa]miga[Oo][Ss]:*:*)
382e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
383e45ace2bSmrg	;;
384b53e5eeaSmrg    *:[Mm]orph[Oo][Ss]:*:*)
385e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
386e45ace2bSmrg	;;
387b53e5eeaSmrg    *:OS/390:*:*)
388e45ace2bSmrg	GUESS=i370-ibm-openedition
389e45ace2bSmrg	;;
390b53e5eeaSmrg    *:z/VM:*:*)
391e45ace2bSmrg	GUESS=s390-ibm-zvmoe
392e45ace2bSmrg	;;
393b53e5eeaSmrg    *:OS400:*:*)
394e45ace2bSmrg	GUESS=powerpc-ibm-os400
395e45ace2bSmrg	;;
396b53e5eeaSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
397e45ace2bSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
398e45ace2bSmrg	;;
39975ebec6dSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
400e45ace2bSmrg	GUESS=arm-unknown-riscos
401e45ace2bSmrg	;;
402b53e5eeaSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
403e45ace2bSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
404e45ace2bSmrg	;;
405b53e5eeaSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
406b53e5eeaSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
407e45ace2bSmrg	case `(/bin/universe) 2>/dev/null` in
408e45ace2bSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
409e45ace2bSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
410e45ace2bSmrg	esac
411e45ace2bSmrg	;;
412b53e5eeaSmrg    NILE*:*:*:dcosx)
413e45ace2bSmrg	GUESS=pyramid-pyramid-svr4
414e45ace2bSmrg	;;
415b53e5eeaSmrg    DRS?6000:unix:4.0:6*)
416e45ace2bSmrg	GUESS=sparc-icl-nx6
417e45ace2bSmrg	;;
418b53e5eeaSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
419b53e5eeaSmrg	case `/usr/bin/uname -p` in
420e45ace2bSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
421e45ace2bSmrg	esac
422e45ace2bSmrg	;;
423b53e5eeaSmrg    s390x:SunOS:*:*)
424e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
425e45ace2bSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
426e45ace2bSmrg	;;
427b53e5eeaSmrg    sun4H:SunOS:5.*:*)
428e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
429e45ace2bSmrg	GUESS=sparc-hal-solaris2$SUN_REL
430e45ace2bSmrg	;;
431b53e5eeaSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
432e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
433e45ace2bSmrg	GUESS=sparc-sun-solaris2$SUN_REL
434e45ace2bSmrg	;;
435af928962Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
436e45ace2bSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
437e45ace2bSmrg	;;
438b53e5eeaSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
439e45ace2bSmrg	set_cc_for_build
4403d2ed3e3Smrg	SUN_ARCH=i386
441b53e5eeaSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
442b53e5eeaSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
443b53e5eeaSmrg	# This test works for both compilers.
444e45ace2bSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
445b53e5eeaSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
446e45ace2bSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
447b53e5eeaSmrg		grep IS_64BIT_ARCH >/dev/null
448b53e5eeaSmrg	    then
4493d2ed3e3Smrg		SUN_ARCH=x86_64
450b53e5eeaSmrg	    fi
451b53e5eeaSmrg	fi
452e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
453e45ace2bSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
454e45ace2bSmrg	;;
455b53e5eeaSmrg    sun4*:SunOS:6*:*)
456b53e5eeaSmrg	# According to config.sub, this is the proper way to canonicalize
457b53e5eeaSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
458b53e5eeaSmrg	# it's likely to be more like Solaris than SunOS4.
459e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
460e45ace2bSmrg	GUESS=sparc-sun-solaris3$SUN_REL
461e45ace2bSmrg	;;
462b53e5eeaSmrg    sun4*:SunOS:*:*)
463e45ace2bSmrg	case `/usr/bin/arch -k` in
464b53e5eeaSmrg	    Series*|S4*)
465b53e5eeaSmrg		UNAME_RELEASE=`uname -v`
466b53e5eeaSmrg		;;
467b53e5eeaSmrg	esac
46847a4502cSmrg	# Japanese Language versions have a version number like '4.1.3-JL'.
469e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
470e45ace2bSmrg	GUESS=sparc-sun-sunos$SUN_REL
471e45ace2bSmrg	;;
472b53e5eeaSmrg    sun3*:SunOS:*:*)
473e45ace2bSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
474e45ace2bSmrg	;;
475b53e5eeaSmrg    sun*:*:4.2BSD:*)
476b53e5eeaSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4773d2ed3e3Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
478e45ace2bSmrg	case `/bin/arch` in
479b53e5eeaSmrg	    sun3)
480e45ace2bSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
481b53e5eeaSmrg		;;
482b53e5eeaSmrg	    sun4)
483e45ace2bSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
484b53e5eeaSmrg		;;
485b53e5eeaSmrg	esac
486e45ace2bSmrg	;;
487b53e5eeaSmrg    aushp:SunOS:*:*)
488e45ace2bSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
489e45ace2bSmrg	;;
490b53e5eeaSmrg    # The situation for MiNT is a little confusing.  The machine name
491b53e5eeaSmrg    # can be virtually everything (everything which is not
492b53e5eeaSmrg    # "atarist" or "atariste" at least should have a processor
493b53e5eeaSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
494b53e5eeaSmrg    # to the lowercase version "mint" (or "freemint").  Finally
495b53e5eeaSmrg    # the system name "TOS" denotes a system which is actually not
496b53e5eeaSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
497b53e5eeaSmrg    # be no problem.
498b53e5eeaSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
499e45ace2bSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500e45ace2bSmrg	;;
501b53e5eeaSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
502e45ace2bSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
503e45ace2bSmrg	;;
504b53e5eeaSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
505e45ace2bSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
506e45ace2bSmrg	;;
507b53e5eeaSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
508e45ace2bSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
509e45ace2bSmrg	;;
510b53e5eeaSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
511e45ace2bSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
512e45ace2bSmrg	;;
513b53e5eeaSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
514e45ace2bSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
515e45ace2bSmrg	;;
516b53e5eeaSmrg    m68k:machten:*:*)
517e45ace2bSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
518e45ace2bSmrg	;;
519b53e5eeaSmrg    powerpc:machten:*:*)
520e45ace2bSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
521e45ace2bSmrg	;;
522b53e5eeaSmrg    RISC*:Mach:*:*)
523e45ace2bSmrg	GUESS=mips-dec-mach_bsd4.3
524e45ace2bSmrg	;;
525b53e5eeaSmrg    RISC*:ULTRIX:*:*)
526e45ace2bSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
527e45ace2bSmrg	;;
528b53e5eeaSmrg    VAX*:ULTRIX*:*:*)
529e45ace2bSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
530e45ace2bSmrg	;;
531b53e5eeaSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
532e45ace2bSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
533e45ace2bSmrg	;;
534b53e5eeaSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
535e45ace2bSmrg	set_cc_for_build
5363d2ed3e3Smrg	sed 's/^	//' << EOF > "$dummy.c"
537b53e5eeaSmrg#ifdef __cplusplus
538b53e5eeaSmrg#include <stdio.h>  /* for printf() prototype */
539b53e5eeaSmrg	int main (int argc, char *argv[]) {
540b53e5eeaSmrg#else
541b53e5eeaSmrg	int main (argc, argv) int argc; char *argv[]; {
542b53e5eeaSmrg#endif
543b53e5eeaSmrg	#if defined (host_mips) && defined (MIPSEB)
544b53e5eeaSmrg	#if defined (SYSTYPE_SYSV)
5453d2ed3e3Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
546b53e5eeaSmrg	#endif
547b53e5eeaSmrg	#if defined (SYSTYPE_SVR4)
5483d2ed3e3Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
549b53e5eeaSmrg	#endif
550b53e5eeaSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5513d2ed3e3Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
552b53e5eeaSmrg	#endif
553b53e5eeaSmrg	#endif
554b53e5eeaSmrg	  exit (-1);
555b53e5eeaSmrg	}
556b53e5eeaSmrgEOF
5573d2ed3e3Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5583d2ed3e3Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5593d2ed3e3Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
560b53e5eeaSmrg	    { echo "$SYSTEM_NAME"; exit; }
561e45ace2bSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
562e45ace2bSmrg	;;
563b53e5eeaSmrg    Motorola:PowerMAX_OS:*:*)
564e45ace2bSmrg	GUESS=powerpc-motorola-powermax
565e45ace2bSmrg	;;
566b53e5eeaSmrg    Motorola:*:4.3:PL8-*)
567e45ace2bSmrg	GUESS=powerpc-harris-powermax
568e45ace2bSmrg	;;
569b53e5eeaSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
570e45ace2bSmrg	GUESS=powerpc-harris-powermax
571e45ace2bSmrg	;;
572b53e5eeaSmrg    Night_Hawk:Power_UNIX:*:*)
573e45ace2bSmrg	GUESS=powerpc-harris-powerunix
574e45ace2bSmrg	;;
575b53e5eeaSmrg    m88k:CX/UX:7*:*)
576e45ace2bSmrg	GUESS=m88k-harris-cxux7
577e45ace2bSmrg	;;
578b53e5eeaSmrg    m88k:*:4*:R4*)
579e45ace2bSmrg	GUESS=m88k-motorola-sysv4
580e45ace2bSmrg	;;
581b53e5eeaSmrg    m88k:*:3*:R3*)
582e45ace2bSmrg	GUESS=m88k-motorola-sysv3
583e45ace2bSmrg	;;
584b53e5eeaSmrg    AViiON:dgux:*:*)
58575ebec6dSmrg	# DG/UX returns AViiON for all architectures
58675ebec6dSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
587e45ace2bSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
588b53e5eeaSmrg	then
589e45ace2bSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
590e45ace2bSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
591b53e5eeaSmrg	    then
592e45ace2bSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
593b53e5eeaSmrg	    else
594e45ace2bSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
595b53e5eeaSmrg	    fi
596b53e5eeaSmrg	else
597e45ace2bSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
598b53e5eeaSmrg	fi
599e45ace2bSmrg	;;
600b53e5eeaSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
601e45ace2bSmrg	GUESS=m88k-dolphin-sysv3
602e45ace2bSmrg	;;
603b53e5eeaSmrg    M88*:*:R3*:*)
604b53e5eeaSmrg	# Delta 88k system running SVR3
605e45ace2bSmrg	GUESS=m88k-motorola-sysv3
606e45ace2bSmrg	;;
607b53e5eeaSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
608e45ace2bSmrg	GUESS=m88k-tektronix-sysv3
609e45ace2bSmrg	;;
610b53e5eeaSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
611e45ace2bSmrg	GUESS=m68k-tektronix-bsd
612e45ace2bSmrg	;;
613b53e5eeaSmrg    *:IRIX*:*:*)
614e45ace2bSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
615e45ace2bSmrg	GUESS=mips-sgi-irix$IRIX_REL
616e45ace2bSmrg	;;
617b53e5eeaSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
618e45ace2bSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
619e45ace2bSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
620b53e5eeaSmrg    i*86:AIX:*:*)
621e45ace2bSmrg	GUESS=i386-ibm-aix
622e45ace2bSmrg	;;
623b53e5eeaSmrg    ia64:AIX:*:*)
624e45ace2bSmrg	if test -x /usr/bin/oslevel ; then
625b53e5eeaSmrg		IBM_REV=`/usr/bin/oslevel`
626b53e5eeaSmrg	else
627e45ace2bSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
628b53e5eeaSmrg	fi
629e45ace2bSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
630e45ace2bSmrg	;;
631b53e5eeaSmrg    *:AIX:2:3)
632b53e5eeaSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
633e45ace2bSmrg		set_cc_for_build
6343d2ed3e3Smrg		sed 's/^		//' << EOF > "$dummy.c"
635b53e5eeaSmrg		#include <sys/systemcfg.h>
636b53e5eeaSmrg
637b53e5eeaSmrg		main()
638b53e5eeaSmrg			{
639b53e5eeaSmrg			if (!__power_pc())
640b53e5eeaSmrg				exit(1);
641b53e5eeaSmrg			puts("powerpc-ibm-aix3.2.5");
642b53e5eeaSmrg			exit(0);
643b53e5eeaSmrg			}
644b53e5eeaSmrgEOF
6453d2ed3e3Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
646b53e5eeaSmrg		then
647e45ace2bSmrg			GUESS=$SYSTEM_NAME
648b53e5eeaSmrg		else
649e45ace2bSmrg			GUESS=rs6000-ibm-aix3.2.5
650b53e5eeaSmrg		fi
651b53e5eeaSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
652e45ace2bSmrg		GUESS=rs6000-ibm-aix3.2.4
653b53e5eeaSmrg	else
654e45ace2bSmrg		GUESS=rs6000-ibm-aix3.2
655b53e5eeaSmrg	fi
656e45ace2bSmrg	;;
657af928962Smrg    *:AIX:*:[4567])
658b53e5eeaSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6593d2ed3e3Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
660b53e5eeaSmrg		IBM_ARCH=rs6000
661b53e5eeaSmrg	else
662b53e5eeaSmrg		IBM_ARCH=powerpc
663b53e5eeaSmrg	fi
664e45ace2bSmrg	if test -x /usr/bin/lslpp ; then
665e45ace2bSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6663d2ed3e3Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
667b53e5eeaSmrg	else
668e45ace2bSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
669b53e5eeaSmrg	fi
670e45ace2bSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
671e45ace2bSmrg	;;
672b53e5eeaSmrg    *:AIX:*:*)
673e45ace2bSmrg	GUESS=rs6000-ibm-aix
674e45ace2bSmrg	;;
6753d2ed3e3Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
676e45ace2bSmrg	GUESS=romp-ibm-bsd4.4
677e45ace2bSmrg	;;
678b53e5eeaSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
679e45ace2bSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
680e45ace2bSmrg	;;                                  # report: romp-ibm BSD 4.3
681b53e5eeaSmrg    *:BOSX:*:*)
682e45ace2bSmrg	GUESS=rs6000-bull-bosx
683e45ace2bSmrg	;;
684b53e5eeaSmrg    DPX/2?00:B.O.S.:*:*)
685e45ace2bSmrg	GUESS=m68k-bull-sysv3
686e45ace2bSmrg	;;
687b53e5eeaSmrg    9000/[34]??:4.3bsd:1.*:*)
688e45ace2bSmrg	GUESS=m68k-hp-bsd
689e45ace2bSmrg	;;
690b53e5eeaSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
691e45ace2bSmrg	GUESS=m68k-hp-bsd4.4
692e45ace2bSmrg	;;
693b53e5eeaSmrg    9000/[34678]??:HP-UX:*:*)
694e45ace2bSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
695e45ace2bSmrg	case $UNAME_MACHINE in
6963d2ed3e3Smrg	    9000/31?)            HP_ARCH=m68000 ;;
6973d2ed3e3Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
698b53e5eeaSmrg	    9000/[678][0-9][0-9])
699e45ace2bSmrg		if test -x /usr/bin/getconf; then
700b53e5eeaSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
70175ebec6dSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
702e45ace2bSmrg		    case $sc_cpu_version in
7033d2ed3e3Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
7043d2ed3e3Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
70575ebec6dSmrg		      532)                      # CPU_PA_RISC2_0
706e45ace2bSmrg			case $sc_kernel_bits in
7073d2ed3e3Smrg			  32) HP_ARCH=hppa2.0n ;;
7083d2ed3e3Smrg			  64) HP_ARCH=hppa2.0w ;;
7093d2ed3e3Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
71075ebec6dSmrg			esac ;;
71175ebec6dSmrg		    esac
712b53e5eeaSmrg		fi
713e45ace2bSmrg		if test "$HP_ARCH" = ""; then
714e45ace2bSmrg		    set_cc_for_build
7153d2ed3e3Smrg		    sed 's/^		//' << EOF > "$dummy.c"
716b53e5eeaSmrg
71775ebec6dSmrg		#define _HPUX_SOURCE
71875ebec6dSmrg		#include <stdlib.h>
71975ebec6dSmrg		#include <unistd.h>
720b53e5eeaSmrg
72175ebec6dSmrg		int main ()
72275ebec6dSmrg		{
72375ebec6dSmrg		#if defined(_SC_KERNEL_BITS)
72475ebec6dSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
72575ebec6dSmrg		#endif
72675ebec6dSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
727b53e5eeaSmrg
72875ebec6dSmrg		    switch (cpu)
72975ebec6dSmrg			{
73075ebec6dSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
73175ebec6dSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
73275ebec6dSmrg			case CPU_PA_RISC2_0:
73375ebec6dSmrg		#if defined(_SC_KERNEL_BITS)
73475ebec6dSmrg			    switch (bits)
73575ebec6dSmrg				{
73675ebec6dSmrg				case 64: puts ("hppa2.0w"); break;
73775ebec6dSmrg				case 32: puts ("hppa2.0n"); break;
73875ebec6dSmrg				default: puts ("hppa2.0"); break;
73975ebec6dSmrg				} break;
74075ebec6dSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
74175ebec6dSmrg			    puts ("hppa2.0"); break;
74275ebec6dSmrg		#endif
74375ebec6dSmrg			default: puts ("hppa1.0"); break;
74475ebec6dSmrg			}
74575ebec6dSmrg		    exit (0);
74675ebec6dSmrg		}
747b53e5eeaSmrgEOF
7483d2ed3e3Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
749b53e5eeaSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
750b53e5eeaSmrg		fi ;;
751b53e5eeaSmrg	esac
752e45ace2bSmrg	if test "$HP_ARCH" = hppa2.0w
753b53e5eeaSmrg	then
754e45ace2bSmrg	    set_cc_for_build
755b53e5eeaSmrg
756b53e5eeaSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
757b53e5eeaSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
758b53e5eeaSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
759b53e5eeaSmrg	    #
760b53e5eeaSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
761b53e5eeaSmrg	    # => hppa2.0w-hp-hpux11.23
762b53e5eeaSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
763b53e5eeaSmrg	    # => hppa64-hp-hpux11.23
764b53e5eeaSmrg
7653d2ed3e3Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
766af928962Smrg		grep -q __LP64__
767b53e5eeaSmrg	    then
7683d2ed3e3Smrg		HP_ARCH=hppa2.0w
769b53e5eeaSmrg	    else
7703d2ed3e3Smrg		HP_ARCH=hppa64
771b53e5eeaSmrg	    fi
772b53e5eeaSmrg	fi
773e45ace2bSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
774e45ace2bSmrg	;;
775b53e5eeaSmrg    ia64:HP-UX:*:*)
776e45ace2bSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
777e45ace2bSmrg	GUESS=ia64-hp-hpux$HPUX_REV
778e45ace2bSmrg	;;
779b53e5eeaSmrg    3050*:HI-UX:*:*)
780e45ace2bSmrg	set_cc_for_build
7813d2ed3e3Smrg	sed 's/^	//' << EOF > "$dummy.c"
782b53e5eeaSmrg	#include <unistd.h>
783b53e5eeaSmrg	int
784b53e5eeaSmrg	main ()
785b53e5eeaSmrg	{
786b53e5eeaSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
787b53e5eeaSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
788b53e5eeaSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
789b53e5eeaSmrg	     results, however.  */
790b53e5eeaSmrg	  if (CPU_IS_PA_RISC (cpu))
791b53e5eeaSmrg	    {
792b53e5eeaSmrg	      switch (cpu)
793b53e5eeaSmrg		{
794b53e5eeaSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
795b53e5eeaSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
796b53e5eeaSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
797b53e5eeaSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
798b53e5eeaSmrg		}
799b53e5eeaSmrg	    }
800b53e5eeaSmrg	  else if (CPU_IS_HP_MC68K (cpu))
801b53e5eeaSmrg	    puts ("m68k-hitachi-hiuxwe2");
802b53e5eeaSmrg	  else puts ("unknown-hitachi-hiuxwe2");
803b53e5eeaSmrg	  exit (0);
804b53e5eeaSmrg	}
805b53e5eeaSmrgEOF
8063d2ed3e3Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
807b53e5eeaSmrg		{ echo "$SYSTEM_NAME"; exit; }
808e45ace2bSmrg	GUESS=unknown-hitachi-hiuxwe2
809e45ace2bSmrg	;;
8103d2ed3e3Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
811e45ace2bSmrg	GUESS=hppa1.1-hp-bsd
812e45ace2bSmrg	;;
813b53e5eeaSmrg    9000/8??:4.3bsd:*:*)
814e45ace2bSmrg	GUESS=hppa1.0-hp-bsd
815e45ace2bSmrg	;;
816b53e5eeaSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
817e45ace2bSmrg	GUESS=hppa1.0-hp-mpeix
818e45ace2bSmrg	;;
8193d2ed3e3Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
820e45ace2bSmrg	GUESS=hppa1.1-hp-osf
821e45ace2bSmrg	;;
822b53e5eeaSmrg    hp8??:OSF1:*:*)
823e45ace2bSmrg	GUESS=hppa1.0-hp-osf
824e45ace2bSmrg	;;
825b53e5eeaSmrg    i*86:OSF1:*:*)
826e45ace2bSmrg	if test -x /usr/sbin/sysversion ; then
827e45ace2bSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
828b53e5eeaSmrg	else
829e45ace2bSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
830b53e5eeaSmrg	fi
831e45ace2bSmrg	;;
832b53e5eeaSmrg    parisc*:Lites*:*:*)
833e45ace2bSmrg	GUESS=hppa1.1-hp-lites
834e45ace2bSmrg	;;
835b53e5eeaSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
836e45ace2bSmrg	GUESS=c1-convex-bsd
837e45ace2bSmrg	;;
838b53e5eeaSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
839b53e5eeaSmrg	if getsysinfo -f scalar_acc
840b53e5eeaSmrg	then echo c32-convex-bsd
841b53e5eeaSmrg	else echo c2-convex-bsd
842b53e5eeaSmrg	fi
84375ebec6dSmrg	exit ;;
844b53e5eeaSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
845e45ace2bSmrg	GUESS=c34-convex-bsd
846e45ace2bSmrg	;;
847b53e5eeaSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
848e45ace2bSmrg	GUESS=c38-convex-bsd
849e45ace2bSmrg	;;
850b53e5eeaSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
851e45ace2bSmrg	GUESS=c4-convex-bsd
852e45ace2bSmrg	;;
853b53e5eeaSmrg    CRAY*Y-MP:*:*:*)
854e45ace2bSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
855e45ace2bSmrg	GUESS=ymp-cray-unicos$CRAY_REL
856e45ace2bSmrg	;;
857b53e5eeaSmrg    CRAY*[A-Z]90:*:*:*)
8583d2ed3e3Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
859b53e5eeaSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
860b53e5eeaSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
861b53e5eeaSmrg	      -e 's/\.[^.]*$/.X/'
862b53e5eeaSmrg	exit ;;
863b53e5eeaSmrg    CRAY*TS:*:*:*)
864e45ace2bSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
865e45ace2bSmrg	GUESS=t90-cray-unicos$CRAY_REL
866e45ace2bSmrg	;;
867b53e5eeaSmrg    CRAY*T3E:*:*:*)
868e45ace2bSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
869e45ace2bSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
870e45ace2bSmrg	;;
871b53e5eeaSmrg    CRAY*SV1:*:*:*)
872e45ace2bSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
873e45ace2bSmrg	GUESS=sv1-cray-unicos$CRAY_REL
874e45ace2bSmrg	;;
875b53e5eeaSmrg    *:UNICOS/mp:*:*)
876e45ace2bSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
877e45ace2bSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
878e45ace2bSmrg	;;
879b53e5eeaSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8803d2ed3e3Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8813d2ed3e3Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8823d2ed3e3Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
883e45ace2bSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
884e45ace2bSmrg	;;
885b53e5eeaSmrg    5000:UNIX_System_V:4.*:*)
8863d2ed3e3Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8873d2ed3e3Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
888e45ace2bSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
889e45ace2bSmrg	;;
890b53e5eeaSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
891e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
892e45ace2bSmrg	;;
893b53e5eeaSmrg    sparc*:BSD/OS:*:*)
894e45ace2bSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
895e45ace2bSmrg	;;
896b53e5eeaSmrg    *:BSD/OS:*:*)
897e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
898e45ace2bSmrg	;;
899e45ace2bSmrg    arm:FreeBSD:*:*)
900e45ace2bSmrg	UNAME_PROCESSOR=`uname -p`
901e45ace2bSmrg	set_cc_for_build
902e45ace2bSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
903e45ace2bSmrg	    | grep -q __ARM_PCS_VFP
904e45ace2bSmrg	then
905e45ace2bSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
906e45ace2bSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
907e45ace2bSmrg	else
908e45ace2bSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
909e45ace2bSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
910e45ace2bSmrg	fi
911e45ace2bSmrg	;;
912b53e5eeaSmrg    *:FreeBSD:*:*)
91347a4502cSmrg	UNAME_PROCESSOR=`uname -p`
914e45ace2bSmrg	case $UNAME_PROCESSOR in
915b53e5eeaSmrg	    amd64)
9163d2ed3e3Smrg		UNAME_PROCESSOR=x86_64 ;;
9173d2ed3e3Smrg	    i386)
9183d2ed3e3Smrg		UNAME_PROCESSOR=i586 ;;
919b53e5eeaSmrg	esac
920e45ace2bSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
921e45ace2bSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
922e45ace2bSmrg	;;
923b53e5eeaSmrg    i*:CYGWIN*:*)
924e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
925e45ace2bSmrg	;;
92675ebec6dSmrg    *:MINGW64*:*)
927e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
928e45ace2bSmrg	;;
929b53e5eeaSmrg    *:MINGW*:*)
930e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
931e45ace2bSmrg	;;
9323d2ed3e3Smrg    *:MSYS*:*)
933e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-msys
934e45ace2bSmrg	;;
935b53e5eeaSmrg    i*:PW*:*)
936e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-pw32
937e45ace2bSmrg	;;
938e45ace2bSmrg    *:SerenityOS:*:*)
939e45ace2bSmrg        GUESS=$UNAME_MACHINE-pc-serenity
940e45ace2bSmrg        ;;
941af928962Smrg    *:Interix*:*)
942e45ace2bSmrg	case $UNAME_MACHINE in
943b53e5eeaSmrg	    x86)
944e45ace2bSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
945e45ace2bSmrg		;;
946af928962Smrg	    authenticamd | genuineintel | EM64T)
947e45ace2bSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
948e45ace2bSmrg		;;
949b53e5eeaSmrg	    IA64)
950e45ace2bSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
951e45ace2bSmrg		;;
952b53e5eeaSmrg	esac ;;
953b53e5eeaSmrg    i*:UWIN*:*)
954e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-uwin
955e45ace2bSmrg	;;
956b53e5eeaSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
957e45ace2bSmrg	GUESS=x86_64-pc-cygwin
958e45ace2bSmrg	;;
959b53e5eeaSmrg    prep*:SunOS:5.*:*)
960e45ace2bSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
961e45ace2bSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
962e45ace2bSmrg	;;
963b53e5eeaSmrg    *:GNU:*:*)
964b53e5eeaSmrg	# the GNU system
965e45ace2bSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
966e45ace2bSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
967e45ace2bSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
968e45ace2bSmrg	;;
969b53e5eeaSmrg    *:GNU/*:*:*)
970b53e5eeaSmrg	# other systems with GNU libc and userland
971e45ace2bSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
972e45ace2bSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
973e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
974e45ace2bSmrg	;;
975e45ace2bSmrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
976e45ace2bSmrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
977e45ace2bSmrg	;;
978e45ace2bSmrg    *:[Mm]anagarm:*:*)
979e45ace2bSmrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
980e45ace2bSmrg	;;
981e45ace2bSmrg    *:Minix:*:*)
982e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-minix
983e45ace2bSmrg	;;
98475ebec6dSmrg    aarch64:Linux:*:*)
98547a4502cSmrg	set_cc_for_build
98647a4502cSmrg	CPU=$UNAME_MACHINE
98747a4502cSmrg	LIBCABI=$LIBC
98847a4502cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
98947a4502cSmrg	    ABI=64
99047a4502cSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
99147a4502cSmrg	    #ifdef __ARM_EABI__
99247a4502cSmrg	    #ifdef __ARM_PCS_VFP
99347a4502cSmrg	    ABI=eabihf
99447a4502cSmrg	    #else
99547a4502cSmrg	    ABI=eabi
99647a4502cSmrg	    #endif
99747a4502cSmrg	    #endif
99847a4502cSmrgEOF
99947a4502cSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
100047a4502cSmrg	    eval "$cc_set_abi"
100147a4502cSmrg	    case $ABI in
100247a4502cSmrg		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
100347a4502cSmrg	    esac
100447a4502cSmrg	fi
100547a4502cSmrg	GUESS=$CPU-unknown-linux-$LIBCABI
1006e45ace2bSmrg	;;
100775ebec6dSmrg    aarch64_be:Linux:*:*)
100875ebec6dSmrg	UNAME_MACHINE=aarch64_be
1009e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1010e45ace2bSmrg	;;
1011af928962Smrg    alpha:Linux:*:*)
1012e45ace2bSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
1013af928962Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
1014af928962Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
1015af928962Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
1016af928962Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
1017af928962Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
1018af928962Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
1019af928962Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
102075ebec6dSmrg	esac
1021af928962Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
10223d2ed3e3Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
1023e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1024e45ace2bSmrg	;;
1025e45ace2bSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1026e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1027e45ace2bSmrg	;;
1028b53e5eeaSmrg    arm*:Linux:*:*)
1029e45ace2bSmrg	set_cc_for_build
1030b53e5eeaSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1031b53e5eeaSmrg	    | grep -q __ARM_EABI__
1032b53e5eeaSmrg	then
1033e45ace2bSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1034b53e5eeaSmrg	else
103575ebec6dSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
103675ebec6dSmrg		| grep -q __ARM_PCS_VFP
103775ebec6dSmrg	    then
1038e45ace2bSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
103975ebec6dSmrg	    else
1040e45ace2bSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
104175ebec6dSmrg	    fi
1042b53e5eeaSmrg	fi
1043e45ace2bSmrg	;;
1044b53e5eeaSmrg    avr32*:Linux:*:*)
1045e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1046e45ace2bSmrg	;;
1047b53e5eeaSmrg    cris:Linux:*:*)
1048e45ace2bSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1049e45ace2bSmrg	;;
1050b53e5eeaSmrg    crisv32:Linux:*:*)
1051e45ace2bSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1052e45ace2bSmrg	;;
10533d2ed3e3Smrg    e2k:Linux:*:*)
1054e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1055e45ace2bSmrg	;;
1056b53e5eeaSmrg    frv:Linux:*:*)
1057e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1058e45ace2bSmrg	;;
105975ebec6dSmrg    hexagon:Linux:*:*)
1060e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1061e45ace2bSmrg	;;
1062af928962Smrg    i*86:Linux:*:*)
1063e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1064e45ace2bSmrg	;;
1065b53e5eeaSmrg    ia64:Linux:*:*)
1066e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1067e45ace2bSmrg	;;
10683d2ed3e3Smrg    k1om:Linux:*:*)
1069e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1070e45ace2bSmrg	;;
107147a4502cSmrg    kvx:Linux:*:*)
107247a4502cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
107347a4502cSmrg	;;
107447a4502cSmrg    kvx:cos:*:*)
107547a4502cSmrg	GUESS=$UNAME_MACHINE-unknown-cos
107647a4502cSmrg	;;
107747a4502cSmrg    kvx:mbr:*:*)
107847a4502cSmrg	GUESS=$UNAME_MACHINE-unknown-mbr
107947a4502cSmrg	;;
1080e45ace2bSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1081e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1082e45ace2bSmrg	;;
1083b53e5eeaSmrg    m32r*:Linux:*:*)
1084e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1085e45ace2bSmrg	;;
1086b53e5eeaSmrg    m68*:Linux:*:*)
1087e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1088e45ace2bSmrg	;;
1089af928962Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1090e45ace2bSmrg	set_cc_for_build
1091e45ace2bSmrg	IS_GLIBC=0
1092e45ace2bSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10933d2ed3e3Smrg	sed 's/^	//' << EOF > "$dummy.c"
1094b53e5eeaSmrg	#undef CPU
1095e45ace2bSmrg	#undef mips
1096e45ace2bSmrg	#undef mipsel
1097e45ace2bSmrg	#undef mips64
1098e45ace2bSmrg	#undef mips64el
1099e45ace2bSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1100e45ace2bSmrg	LIBCABI=gnuabi64
1101e45ace2bSmrg	#else
1102e45ace2bSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1103e45ace2bSmrg	LIBCABI=gnuabin32
1104e45ace2bSmrg	#else
1105e45ace2bSmrg	LIBCABI=${LIBC}
1106e45ace2bSmrg	#endif
1107e45ace2bSmrg	#endif
1108e45ace2bSmrg
1109e45ace2bSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1110e45ace2bSmrg	CPU=mipsisa64r6
1111e45ace2bSmrg	#else
1112e45ace2bSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1113e45ace2bSmrg	CPU=mipsisa32r6
1114e45ace2bSmrg	#else
1115e45ace2bSmrg	#if defined(__mips64)
1116e45ace2bSmrg	CPU=mips64
1117e45ace2bSmrg	#else
1118e45ace2bSmrg	CPU=mips
1119e45ace2bSmrg	#endif
1120e45ace2bSmrg	#endif
1121e45ace2bSmrg	#endif
1122e45ace2bSmrg
1123b53e5eeaSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1124e45ace2bSmrg	MIPS_ENDIAN=el
1125b53e5eeaSmrg	#else
1126b53e5eeaSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1127e45ace2bSmrg	MIPS_ENDIAN=
1128b53e5eeaSmrg	#else
1129e45ace2bSmrg	MIPS_ENDIAN=
1130b53e5eeaSmrg	#endif
1131b53e5eeaSmrg	#endif
1132b53e5eeaSmrgEOF
1133e45ace2bSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1134e45ace2bSmrg	eval "$cc_set_vars"
1135e45ace2bSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1136b53e5eeaSmrg	;;
11373d2ed3e3Smrg    mips64el:Linux:*:*)
1138e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139e45ace2bSmrg	;;
11403d2ed3e3Smrg    openrisc*:Linux:*:*)
1141e45ace2bSmrg	GUESS=or1k-unknown-linux-$LIBC
1142e45ace2bSmrg	;;
11433d2ed3e3Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1144e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145e45ace2bSmrg	;;
1146b53e5eeaSmrg    padre:Linux:*:*)
1147e45ace2bSmrg	GUESS=sparc-unknown-linux-$LIBC
1148e45ace2bSmrg	;;
1149af928962Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1150e45ace2bSmrg	GUESS=hppa64-unknown-linux-$LIBC
1151e45ace2bSmrg	;;
1152b53e5eeaSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
1153b53e5eeaSmrg	# Look for CPU level
1154b53e5eeaSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1155e45ace2bSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1156e45ace2bSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1157e45ace2bSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1158b53e5eeaSmrg	esac
1159e45ace2bSmrg	;;
1160af928962Smrg    ppc64:Linux:*:*)
1161e45ace2bSmrg	GUESS=powerpc64-unknown-linux-$LIBC
1162e45ace2bSmrg	;;
1163af928962Smrg    ppc:Linux:*:*)
1164e45ace2bSmrg	GUESS=powerpc-unknown-linux-$LIBC
1165e45ace2bSmrg	;;
11666a3641a6Ssnj    ppc64le:Linux:*:*)
1167e45ace2bSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
1168e45ace2bSmrg	;;
11696a3641a6Ssnj    ppcle:Linux:*:*)
1170e45ace2bSmrg	GUESS=powerpcle-unknown-linux-$LIBC
1171e45ace2bSmrg	;;
1172e45ace2bSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1173e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1174e45ace2bSmrg	;;
1175b53e5eeaSmrg    s390:Linux:*:* | s390x:Linux:*:*)
1176e45ace2bSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1177e45ace2bSmrg	;;
1178b53e5eeaSmrg    sh64*:Linux:*:*)
1179e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1180e45ace2bSmrg	;;
1181b53e5eeaSmrg    sh*:Linux:*:*)
1182e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1183e45ace2bSmrg	;;
1184b53e5eeaSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1185e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1186e45ace2bSmrg	;;
1187af928962Smrg    tile*:Linux:*:*)
1188e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1189e45ace2bSmrg	;;
1190b53e5eeaSmrg    vax:Linux:*:*)
1191e45ace2bSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1192e45ace2bSmrg	;;
1193b53e5eeaSmrg    x86_64:Linux:*:*)
1194e45ace2bSmrg	set_cc_for_build
1195e45ace2bSmrg	CPU=$UNAME_MACHINE
1196e45ace2bSmrg	LIBCABI=$LIBC
1197e45ace2bSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1198e45ace2bSmrg	    ABI=64
1199e45ace2bSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
1200e45ace2bSmrg	    #ifdef __i386__
1201e45ace2bSmrg	    ABI=x86
1202e45ace2bSmrg	    #else
1203e45ace2bSmrg	    #ifdef __ILP32__
1204e45ace2bSmrg	    ABI=x32
1205e45ace2bSmrg	    #endif
1206e45ace2bSmrg	    #endif
1207e45ace2bSmrgEOF
1208e45ace2bSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1209e45ace2bSmrg	    eval "$cc_set_abi"
1210e45ace2bSmrg	    case $ABI in
1211e45ace2bSmrg		x86) CPU=i686 ;;
1212e45ace2bSmrg		x32) LIBCABI=${LIBC}x32 ;;
1213e45ace2bSmrg	    esac
1214e45ace2bSmrg	fi
1215e45ace2bSmrg	GUESS=$CPU-pc-linux-$LIBCABI
1216e45ace2bSmrg	;;
1217b53e5eeaSmrg    xtensa*:Linux:*:*)
1218e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1219e45ace2bSmrg	;;
1220b53e5eeaSmrg    i*86:DYNIX/ptx:4*:*)
1221b53e5eeaSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1222b53e5eeaSmrg	# earlier versions are messed up and put the nodename in both
1223b53e5eeaSmrg	# sysname and nodename.
1224e45ace2bSmrg	GUESS=i386-sequent-sysv4
1225e45ace2bSmrg	;;
1226b53e5eeaSmrg    i*86:UNIX_SV:4.2MP:2.*)
122775ebec6dSmrg	# Unixware is an offshoot of SVR4, but it has its own version
122875ebec6dSmrg	# number series starting with 2...
122975ebec6dSmrg	# I am not positive that other SVR4 systems won't match this,
1230b53e5eeaSmrg	# I just have to hope.  -- rms.
123175ebec6dSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1232e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1233e45ace2bSmrg	;;
1234b53e5eeaSmrg    i*86:OS/2:*:*)
123547a4502cSmrg	# If we were able to find 'uname', then EMX Unix compatibility
1236b53e5eeaSmrg	# is probably installed.
1237e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1238e45ace2bSmrg	;;
1239b53e5eeaSmrg    i*86:XTS-300:*:STOP)
1240e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-stop
1241e45ace2bSmrg	;;
1242b53e5eeaSmrg    i*86:atheos:*:*)
1243e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
1244e45ace2bSmrg	;;
1245b53e5eeaSmrg    i*86:syllable:*:*)
1246e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-syllable
1247e45ace2bSmrg	;;
1248af928962Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1249e45ace2bSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1250e45ace2bSmrg	;;
1251b53e5eeaSmrg    i*86:*DOS:*:*)
1252e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1253e45ace2bSmrg	;;
12543d2ed3e3Smrg    i*86:*:4.*:*)
12553d2ed3e3Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1256b53e5eeaSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1257e45ace2bSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1258b53e5eeaSmrg	else
1259e45ace2bSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1260b53e5eeaSmrg	fi
1261e45ace2bSmrg	;;
1262b53e5eeaSmrg    i*86:*:5:[678]*)
126375ebec6dSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1264b53e5eeaSmrg	case `/bin/uname -X | grep "^Machine"` in
1265b53e5eeaSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1266b53e5eeaSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1267b53e5eeaSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1268b53e5eeaSmrg	esac
1269e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1270e45ace2bSmrg	;;
1271b53e5eeaSmrg    i*86:*:3.2:*)
1272b53e5eeaSmrg	if test -f /usr/options/cb.name; then
1273b53e5eeaSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1274e45ace2bSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1275b53e5eeaSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1276b53e5eeaSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1277b53e5eeaSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1278b53e5eeaSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1279b53e5eeaSmrg			&& UNAME_MACHINE=i586
1280b53e5eeaSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1281b53e5eeaSmrg			&& UNAME_MACHINE=i686
1282b53e5eeaSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1283b53e5eeaSmrg			&& UNAME_MACHINE=i686
1284e45ace2bSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1285b53e5eeaSmrg	else
1286e45ace2bSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
1287b53e5eeaSmrg	fi
1288e45ace2bSmrg	;;
1289b53e5eeaSmrg    pc:*:*:*)
1290b53e5eeaSmrg	# Left here for compatibility:
129175ebec6dSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
129275ebec6dSmrg	# the processor, so we play safe by assuming i586.
1293b53e5eeaSmrg	# Note: whatever this is, it MUST be the same as what config.sub
12943d2ed3e3Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
1295b53e5eeaSmrg	# this is a cross-build.
1296e45ace2bSmrg	GUESS=i586-pc-msdosdjgpp
1297e45ace2bSmrg	;;
1298b53e5eeaSmrg    Intel:Mach:3*:*)
1299e45ace2bSmrg	GUESS=i386-pc-mach3
1300e45ace2bSmrg	;;
1301b53e5eeaSmrg    paragon:*:*:*)
1302e45ace2bSmrg	GUESS=i860-intel-osf1
1303e45ace2bSmrg	;;
1304b53e5eeaSmrg    i860:*:4.*:*) # i860-SVR4
1305b53e5eeaSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1306e45ace2bSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1307b53e5eeaSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1308e45ace2bSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1309b53e5eeaSmrg	fi
1310e45ace2bSmrg	;;
1311b53e5eeaSmrg    mini*:CTIX:SYS*5:*)
1312b53e5eeaSmrg	# "miniframe"
1313e45ace2bSmrg	GUESS=m68010-convergent-sysv
1314e45ace2bSmrg	;;
1315b53e5eeaSmrg    mc68k:UNIX:SYSTEM5:3.51m)
1316e45ace2bSmrg	GUESS=m68k-convergent-sysv
1317e45ace2bSmrg	;;
1318b53e5eeaSmrg    M680?0:D-NIX:5.3:*)
1319e45ace2bSmrg	GUESS=m68k-diab-dnix
1320e45ace2bSmrg	;;
1321b53e5eeaSmrg    M68*:*:R3V[5678]*:*)
1322b53e5eeaSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1323b53e5eeaSmrg    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)
1324b53e5eeaSmrg	OS_REL=''
1325b53e5eeaSmrg	test -r /etc/.relid \
1326b53e5eeaSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1327b53e5eeaSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
13283d2ed3e3Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1329b53e5eeaSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
13303d2ed3e3Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1331b53e5eeaSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
133275ebec6dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
133375ebec6dSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1334b53e5eeaSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1335b53e5eeaSmrg	OS_REL='.3'
1336b53e5eeaSmrg	test -r /etc/.relid \
1337b53e5eeaSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1338b53e5eeaSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
13393d2ed3e3Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1340b53e5eeaSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
13413d2ed3e3Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1342b53e5eeaSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
13433d2ed3e3Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1344b53e5eeaSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1345e45ace2bSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1346e45ace2bSmrg	;;
1347b53e5eeaSmrg    mc68030:UNIX_System_V:4.*:*)
1348e45ace2bSmrg	GUESS=m68k-atari-sysv4
1349e45ace2bSmrg	;;
1350b53e5eeaSmrg    TSUNAMI:LynxOS:2.*:*)
1351e45ace2bSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1352e45ace2bSmrg	;;
1353b53e5eeaSmrg    rs6000:LynxOS:2.*:*)
1354e45ace2bSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1355e45ace2bSmrg	;;
1356af928962Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1357e45ace2bSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1358e45ace2bSmrg	;;
1359b53e5eeaSmrg    SM[BE]S:UNIX_SV:*:*)
1360e45ace2bSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1361e45ace2bSmrg	;;
1362b53e5eeaSmrg    RM*:ReliantUNIX-*:*:*)
1363e45ace2bSmrg	GUESS=mips-sni-sysv4
1364e45ace2bSmrg	;;
1365b53e5eeaSmrg    RM*:SINIX-*:*:*)
1366e45ace2bSmrg	GUESS=mips-sni-sysv4
1367e45ace2bSmrg	;;
1368b53e5eeaSmrg    *:SINIX-*:*:*)
1369b53e5eeaSmrg	if uname -p 2>/dev/null >/dev/null ; then
1370b53e5eeaSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1371e45ace2bSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
1372b53e5eeaSmrg	else
1373e45ace2bSmrg		GUESS=ns32k-sni-sysv
1374b53e5eeaSmrg	fi
1375e45ace2bSmrg	;;
137647a4502cSmrg    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
137775ebec6dSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1378e45ace2bSmrg	GUESS=i586-unisys-sysv4
1379e45ace2bSmrg	;;
1380b53e5eeaSmrg    *:UNIX_System_V:4*:FTX*)
1381b53e5eeaSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1382b53e5eeaSmrg	# How about differentiating between stratus architectures? -djm
1383e45ace2bSmrg	GUESS=hppa1.1-stratus-sysv4
1384e45ace2bSmrg	;;
1385b53e5eeaSmrg    *:*:*:FTX*)
1386b53e5eeaSmrg	# From seanf@swdc.stratus.com.
1387e45ace2bSmrg	GUESS=i860-stratus-sysv4
1388e45ace2bSmrg	;;
1389b53e5eeaSmrg    i*86:VOS:*:*)
1390b53e5eeaSmrg	# From Paul.Green@stratus.com.
1391e45ace2bSmrg	GUESS=$UNAME_MACHINE-stratus-vos
1392e45ace2bSmrg	;;
1393b53e5eeaSmrg    *:VOS:*:*)
1394b53e5eeaSmrg	# From Paul.Green@stratus.com.
1395e45ace2bSmrg	GUESS=hppa1.1-stratus-vos
1396e45ace2bSmrg	;;
1397b53e5eeaSmrg    mc68*:A/UX:*:*)
1398e45ace2bSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1399e45ace2bSmrg	;;
1400b53e5eeaSmrg    news*:NEWS-OS:6*:*)
1401e45ace2bSmrg	GUESS=mips-sony-newsos6
1402e45ace2bSmrg	;;
1403b53e5eeaSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1404e45ace2bSmrg	if test -d /usr/nec; then
1405e45ace2bSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1406b53e5eeaSmrg	else
1407e45ace2bSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1408b53e5eeaSmrg	fi
1409e45ace2bSmrg	;;
1410b53e5eeaSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1411e45ace2bSmrg	GUESS=powerpc-be-beos
1412e45ace2bSmrg	;;
1413b53e5eeaSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1414e45ace2bSmrg	GUESS=powerpc-apple-beos
1415e45ace2bSmrg	;;
1416b53e5eeaSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1417e45ace2bSmrg	GUESS=i586-pc-beos
1418e45ace2bSmrg	;;
1419b53e5eeaSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1420e45ace2bSmrg	GUESS=i586-pc-haiku
1421e45ace2bSmrg	;;
1422e45ace2bSmrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1423e45ace2bSmrg	GUESS=powerpc-apple-haiku
1424e45ace2bSmrg	;;
1425e45ace2bSmrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1426e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-haiku
1427e45ace2bSmrg	;;
1428b53e5eeaSmrg    SX-4:SUPER-UX:*:*)
1429e45ace2bSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1430e45ace2bSmrg	;;
1431b53e5eeaSmrg    SX-5:SUPER-UX:*:*)
1432e45ace2bSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1433e45ace2bSmrg	;;
1434b53e5eeaSmrg    SX-6:SUPER-UX:*:*)
1435e45ace2bSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1436e45ace2bSmrg	;;
1437b53e5eeaSmrg    SX-7:SUPER-UX:*:*)
1438e45ace2bSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1439e45ace2bSmrg	;;
1440b53e5eeaSmrg    SX-8:SUPER-UX:*:*)
1441e45ace2bSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1442e45ace2bSmrg	;;
1443b53e5eeaSmrg    SX-8R:SUPER-UX:*:*)
1444e45ace2bSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1445e45ace2bSmrg	;;
14463d2ed3e3Smrg    SX-ACE:SUPER-UX:*:*)
1447e45ace2bSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1448e45ace2bSmrg	;;
1449b53e5eeaSmrg    Power*:Rhapsody:*:*)
1450e45ace2bSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1451e45ace2bSmrg	;;
1452b53e5eeaSmrg    *:Rhapsody:*:*)
1453e45ace2bSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1454e45ace2bSmrg	;;
1455e45ace2bSmrg    arm64:Darwin:*:*)
1456e45ace2bSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1457e45ace2bSmrg	;;
1458b53e5eeaSmrg    *:Darwin:*:*)
1459e45ace2bSmrg	UNAME_PROCESSOR=`uname -p`
1460e45ace2bSmrg	case $UNAME_PROCESSOR in
1461e45ace2bSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1462e45ace2bSmrg	esac
1463e45ace2bSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1464e45ace2bSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1465e45ace2bSmrg	    # Avoid executing cc if there is no toolchain installed as
1466e45ace2bSmrg	    # cc will be a stub that puts up a graphical alert
1467e45ace2bSmrg	    # prompting the user to install developer tools.
1468e45ace2bSmrg	    CC_FOR_BUILD=no_compiler_found
1469e45ace2bSmrg	else
1470e45ace2bSmrg	    set_cc_for_build
14716a3641a6Ssnj	fi
1472e45ace2bSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1473e45ace2bSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1474e45ace2bSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1475e45ace2bSmrg		   grep IS_64BIT_ARCH >/dev/null
1476e45ace2bSmrg	    then
1477e45ace2bSmrg		case $UNAME_PROCESSOR in
1478e45ace2bSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1479e45ace2bSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1480e45ace2bSmrg		esac
1481e45ace2bSmrg	    fi
1482e45ace2bSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1483e45ace2bSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1484e45ace2bSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1485e45ace2bSmrg		   grep IS_PPC >/dev/null
1486e45ace2bSmrg	    then
1487e45ace2bSmrg		UNAME_PROCESSOR=powerpc
14886a3641a6Ssnj	    fi
14893d2ed3e3Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1490e45ace2bSmrg	    # uname -m returns i386 or x86_64
1491e45ace2bSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
14926a3641a6Ssnj	fi
1493e45ace2bSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1494e45ace2bSmrg	;;
1495b53e5eeaSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1496b53e5eeaSmrg	UNAME_PROCESSOR=`uname -p`
14973d2ed3e3Smrg	if test "$UNAME_PROCESSOR" = x86; then
1498b53e5eeaSmrg		UNAME_PROCESSOR=i386
1499b53e5eeaSmrg		UNAME_MACHINE=pc
1500b53e5eeaSmrg	fi
1501e45ace2bSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1502e45ace2bSmrg	;;
1503b53e5eeaSmrg    *:QNX:*:4*)
1504e45ace2bSmrg	GUESS=i386-pc-qnx
1505e45ace2bSmrg	;;
15063d2ed3e3Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1507e45ace2bSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1508e45ace2bSmrg	;;
150975ebec6dSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1510e45ace2bSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1511e45ace2bSmrg	;;
15123d2ed3e3Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1513e45ace2bSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1514e45ace2bSmrg	;;
15153d2ed3e3Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1516e45ace2bSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1517e45ace2bSmrg	;;
15183d2ed3e3Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1519e45ace2bSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1520e45ace2bSmrg	;;
1521b53e5eeaSmrg    *:NonStop-UX:*:*)
1522e45ace2bSmrg	GUESS=mips-compaq-nonstopux
1523e45ace2bSmrg	;;
1524b53e5eeaSmrg    BS2000:POSIX*:*:*)
1525e45ace2bSmrg	GUESS=bs2000-siemens-sysv
1526e45ace2bSmrg	;;
1527b53e5eeaSmrg    DS/*:UNIX_System_V:*:*)
1528e45ace2bSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1529e45ace2bSmrg	;;
1530b53e5eeaSmrg    *:Plan9:*:*)
1531b53e5eeaSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1532b53e5eeaSmrg	# is converted to i386 for consistency with other x86
1533b53e5eeaSmrg	# operating systems.
1534e45ace2bSmrg	if test "${cputype-}" = 386; then
1535b53e5eeaSmrg	    UNAME_MACHINE=i386
1536e45ace2bSmrg	elif test "x${cputype-}" != x; then
1537e45ace2bSmrg	    UNAME_MACHINE=$cputype
1538b53e5eeaSmrg	fi
1539e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
1540e45ace2bSmrg	;;
1541b53e5eeaSmrg    *:TOPS-10:*:*)
1542e45ace2bSmrg	GUESS=pdp10-unknown-tops10
1543e45ace2bSmrg	;;
1544b53e5eeaSmrg    *:TENEX:*:*)
1545e45ace2bSmrg	GUESS=pdp10-unknown-tenex
1546e45ace2bSmrg	;;
1547b53e5eeaSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1548e45ace2bSmrg	GUESS=pdp10-dec-tops20
1549e45ace2bSmrg	;;
1550b53e5eeaSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1551e45ace2bSmrg	GUESS=pdp10-xkl-tops20
1552e45ace2bSmrg	;;
1553b53e5eeaSmrg    *:TOPS-20:*:*)
1554e45ace2bSmrg	GUESS=pdp10-unknown-tops20
1555e45ace2bSmrg	;;
1556b53e5eeaSmrg    *:ITS:*:*)
1557e45ace2bSmrg	GUESS=pdp10-unknown-its
1558e45ace2bSmrg	;;
1559b53e5eeaSmrg    SEI:*:*:SEIUX)
1560e45ace2bSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1561e45ace2bSmrg	;;
1562b53e5eeaSmrg    *:DragonFly:*:*)
1563e45ace2bSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1564e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1565e45ace2bSmrg	;;
1566b53e5eeaSmrg    *:*VMS:*:*)
156775ebec6dSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1568e45ace2bSmrg	case $UNAME_MACHINE in
1569e45ace2bSmrg	    A*) GUESS=alpha-dec-vms ;;
1570e45ace2bSmrg	    I*) GUESS=ia64-dec-vms ;;
1571e45ace2bSmrg	    V*) GUESS=vax-dec-vms ;;
1572b53e5eeaSmrg	esac ;;
1573b53e5eeaSmrg    *:XENIX:*:SysV)
1574e45ace2bSmrg	GUESS=i386-pc-xenix
1575e45ace2bSmrg	;;
1576b53e5eeaSmrg    i*86:skyos:*:*)
1577e45ace2bSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1578e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1579e45ace2bSmrg	;;
1580b53e5eeaSmrg    i*86:rdos:*:*)
1581e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-rdos
1582e45ace2bSmrg	;;
1583e45ace2bSmrg    i*86:Fiwix:*:*)
1584e45ace2bSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
1585e45ace2bSmrg	;;
1586e45ace2bSmrg    *:AROS:*:*)
1587e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-aros
1588e45ace2bSmrg	;;
158975ebec6dSmrg    x86_64:VMkernel:*:*)
1590e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-esx
1591e45ace2bSmrg	;;
15923d2ed3e3Smrg    amd64:Isilon\ OneFS:*:*)
1593e45ace2bSmrg	GUESS=x86_64-unknown-onefs
1594e45ace2bSmrg	;;
1595e45ace2bSmrg    *:Unleashed:*:*)
1596e45ace2bSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1597e45ace2bSmrg	;;
159847a4502cSmrg    *:Ironclad:*:*)
159947a4502cSmrg	GUESS=$UNAME_MACHINE-unknown-ironclad
160047a4502cSmrg	;;
1601b53e5eeaSmrgesac
1602b53e5eeaSmrg
1603e45ace2bSmrg# Do we have a guess based on uname results?
1604e45ace2bSmrgif test "x$GUESS" != x; then
1605e45ace2bSmrg    echo "$GUESS"
1606e45ace2bSmrg    exit
1607e45ace2bSmrgfi
1608e45ace2bSmrg
1609e45ace2bSmrg# No uname command or uname output not recognized.
1610e45ace2bSmrgset_cc_for_build
1611e45ace2bSmrgcat > "$dummy.c" <<EOF
1612e45ace2bSmrg#ifdef _SEQUENT_
1613e45ace2bSmrg#include <sys/types.h>
1614e45ace2bSmrg#include <sys/utsname.h>
1615e45ace2bSmrg#endif
1616e45ace2bSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1617e45ace2bSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1618e45ace2bSmrg#include <signal.h>
1619e45ace2bSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1620e45ace2bSmrg#include <sys/utsname.h>
1621e45ace2bSmrg#endif
1622e45ace2bSmrg#endif
1623e45ace2bSmrg#endif
1624e45ace2bSmrgmain ()
1625e45ace2bSmrg{
1626e45ace2bSmrg#if defined (sony)
1627e45ace2bSmrg#if defined (MIPSEB)
1628e45ace2bSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1629e45ace2bSmrg     I don't know....  */
1630e45ace2bSmrg  printf ("mips-sony-bsd\n"); exit (0);
1631e45ace2bSmrg#else
1632e45ace2bSmrg#include <sys/param.h>
1633e45ace2bSmrg  printf ("m68k-sony-newsos%s\n",
1634e45ace2bSmrg#ifdef NEWSOS4
1635e45ace2bSmrg  "4"
1636e45ace2bSmrg#else
1637e45ace2bSmrg  ""
1638e45ace2bSmrg#endif
1639e45ace2bSmrg  ); exit (0);
1640e45ace2bSmrg#endif
1641e45ace2bSmrg#endif
1642e45ace2bSmrg
1643e45ace2bSmrg#if defined (NeXT)
1644e45ace2bSmrg#if !defined (__ARCHITECTURE__)
1645e45ace2bSmrg#define __ARCHITECTURE__ "m68k"
1646e45ace2bSmrg#endif
1647e45ace2bSmrg  int version;
1648e45ace2bSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1649e45ace2bSmrg  if (version < 4)
1650e45ace2bSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1651e45ace2bSmrg  else
1652e45ace2bSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1653e45ace2bSmrg  exit (0);
1654e45ace2bSmrg#endif
1655e45ace2bSmrg
1656e45ace2bSmrg#if defined (MULTIMAX) || defined (n16)
1657e45ace2bSmrg#if defined (UMAXV)
1658e45ace2bSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
1659e45ace2bSmrg#else
1660e45ace2bSmrg#if defined (CMU)
1661e45ace2bSmrg  printf ("ns32k-encore-mach\n"); exit (0);
1662e45ace2bSmrg#else
1663e45ace2bSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
1664e45ace2bSmrg#endif
1665e45ace2bSmrg#endif
1666e45ace2bSmrg#endif
1667e45ace2bSmrg
1668e45ace2bSmrg#if defined (__386BSD__)
1669e45ace2bSmrg  printf ("i386-pc-bsd\n"); exit (0);
1670e45ace2bSmrg#endif
1671e45ace2bSmrg
1672e45ace2bSmrg#if defined (sequent)
1673e45ace2bSmrg#if defined (i386)
1674e45ace2bSmrg  printf ("i386-sequent-dynix\n"); exit (0);
1675e45ace2bSmrg#endif
1676e45ace2bSmrg#if defined (ns32000)
1677e45ace2bSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1678e45ace2bSmrg#endif
1679e45ace2bSmrg#endif
1680e45ace2bSmrg
1681e45ace2bSmrg#if defined (_SEQUENT_)
1682e45ace2bSmrg  struct utsname un;
1683e45ace2bSmrg
1684e45ace2bSmrg  uname(&un);
1685e45ace2bSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1686e45ace2bSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1687e45ace2bSmrg  }
1688e45ace2bSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1689e45ace2bSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1690e45ace2bSmrg  }
1691e45ace2bSmrg  printf ("i386-sequent-ptx\n"); exit (0);
1692e45ace2bSmrg#endif
1693e45ace2bSmrg
1694e45ace2bSmrg#if defined (vax)
1695e45ace2bSmrg#if !defined (ultrix)
1696e45ace2bSmrg#include <sys/param.h>
1697e45ace2bSmrg#if defined (BSD)
1698e45ace2bSmrg#if BSD == 43
1699e45ace2bSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1700e45ace2bSmrg#else
1701e45ace2bSmrg#if BSD == 199006
1702e45ace2bSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1703e45ace2bSmrg#else
1704e45ace2bSmrg  printf ("vax-dec-bsd\n"); exit (0);
1705e45ace2bSmrg#endif
1706e45ace2bSmrg#endif
1707e45ace2bSmrg#else
1708e45ace2bSmrg  printf ("vax-dec-bsd\n"); exit (0);
1709e45ace2bSmrg#endif
1710e45ace2bSmrg#else
1711e45ace2bSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1712e45ace2bSmrg  struct utsname un;
1713e45ace2bSmrg  uname (&un);
1714e45ace2bSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1715e45ace2bSmrg#else
1716e45ace2bSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1717e45ace2bSmrg#endif
1718e45ace2bSmrg#endif
1719e45ace2bSmrg#endif
1720e45ace2bSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1721e45ace2bSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1722e45ace2bSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1723e45ace2bSmrg  struct utsname *un;
1724e45ace2bSmrg  uname (&un);
1725e45ace2bSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1726e45ace2bSmrg#else
1727e45ace2bSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1728e45ace2bSmrg#endif
1729e45ace2bSmrg#endif
1730e45ace2bSmrg#endif
1731e45ace2bSmrg
1732e45ace2bSmrg#if defined (alliant) && defined (i860)
1733e45ace2bSmrg  printf ("i860-alliant-bsd\n"); exit (0);
1734e45ace2bSmrg#endif
1735e45ace2bSmrg
1736e45ace2bSmrg  exit (1);
1737e45ace2bSmrg}
1738e45ace2bSmrgEOF
1739e45ace2bSmrg
1740e45ace2bSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1741e45ace2bSmrg	{ echo "$SYSTEM_NAME"; exit; }
1742e45ace2bSmrg
1743e45ace2bSmrg# Apollos put the system type in the environment.
1744e45ace2bSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1745e45ace2bSmrg
17463d2ed3e3Smrgecho "$0: unable to guess system type" >&2
1747b53e5eeaSmrg
1748e45ace2bSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
17493d2ed3e3Smrg    mips:Linux | mips64:Linux)
17503d2ed3e3Smrg	# If we got here on MIPS GNU/Linux, output extra information.
17513d2ed3e3Smrg	cat >&2 <<EOF
1752b53e5eeaSmrg
17533d2ed3e3SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
17543d2ed3e3Smrgthe system type. Please install a C compiler and try again.
1755b53e5eeaSmrgEOF
17563d2ed3e3Smrg	;;
17573d2ed3e3Smrgesac
1758b53e5eeaSmrg
1759b53e5eeaSmrgcat >&2 <<EOF
1760b53e5eeaSmrg
17613d2ed3e3SmrgThis script (version $timestamp), has failed to recognize the
17623d2ed3e3Smrgoperating system you are using. If your script is old, overwrite *all*
17633d2ed3e3Smrgcopies of config.guess and config.sub with the latest versions from:
1764b53e5eeaSmrg
1765e45ace2bSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1766b53e5eeaSmrgand
1767e45ace2bSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1768e45ace2bSmrgEOF
1769e45ace2bSmrg
1770e45ace2bSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
1771e45ace2bSmrgthisyear=`date +%Y`
1772e45ace2bSmrg# shellcheck disable=SC2003
1773e45ace2bSmrgscript_age=`expr "$thisyear" - "$our_year"`
1774e45ace2bSmrgif test "$script_age" -lt 3 ; then
1775e45ace2bSmrg   cat >&2 <<EOF
1776b53e5eeaSmrg
17773d2ed3e3SmrgIf $0 has already been updated, send the following data and any
17783d2ed3e3Smrginformation you think might be pertinent to config-patches@gnu.org to
17793d2ed3e3Smrgprovide the necessary information to handle your system.
1780b53e5eeaSmrg
1781b53e5eeaSmrgconfig.guess timestamp = $timestamp
1782b53e5eeaSmrg
1783b53e5eeaSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1784b53e5eeaSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1785b53e5eeaSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1786b53e5eeaSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1787b53e5eeaSmrg
1788b53e5eeaSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1789b53e5eeaSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1790b53e5eeaSmrg
1791b53e5eeaSmrghostinfo               = `(hostinfo) 2>/dev/null`
1792b53e5eeaSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1793b53e5eeaSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1794b53e5eeaSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1795b53e5eeaSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1796b53e5eeaSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1797b53e5eeaSmrg
17983d2ed3e3SmrgUNAME_MACHINE = "$UNAME_MACHINE"
17993d2ed3e3SmrgUNAME_RELEASE = "$UNAME_RELEASE"
18003d2ed3e3SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
18013d2ed3e3SmrgUNAME_VERSION = "$UNAME_VERSION"
1802b53e5eeaSmrgEOF
1803e45ace2bSmrgfi
1804b53e5eeaSmrg
1805b53e5eeaSmrgexit 1
1806b53e5eeaSmrg
1807b53e5eeaSmrg# Local variables:
1808e45ace2bSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
1809b53e5eeaSmrg# time-stamp-start: "timestamp='"
1810b53e5eeaSmrg# time-stamp-format: "%:y-%02m-%02d"
1811b53e5eeaSmrg# time-stamp-end: "'"
1812b53e5eeaSmrg# End:
1813