1145b7b3cSmrg#! /bin/sh
2145b7b3cSmrg# Attempt to guess a canonical system name.
31d778f8eSmrg#   Copyright 1992-2024 Free Software Foundation, Inc.
4145b7b3cSmrg
5da2e2ef6Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6da2e2ef6Smrg
71d778f8eSmrgtimestamp='2024-01-01'
8145b7b3cSmrg
9145b7b3cSmrg# This file is free software; you can redistribute it and/or modify it
10145b7b3cSmrg# under the terms of the GNU General Public License as published by
114901b09eSmrg# the Free Software Foundation, either version 3 of the License, or
12145b7b3cSmrg# (at your option) any later version.
13145b7b3cSmrg#
14145b7b3cSmrg# This program is distributed in the hope that it will be useful, but
15145b7b3cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16145b7b3cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17145b7b3cSmrg# General Public License for more details.
18145b7b3cSmrg#
19145b7b3cSmrg# You should have received a copy of the GNU General Public License
20b7d26471Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21145b7b3cSmrg#
22145b7b3cSmrg# As a special exception to the GNU General Public License, if you
23145b7b3cSmrg# distribute this file as part of a program that contains a
24145b7b3cSmrg# configuration script generated by Autoconf, you may include it under
25b7d26471Smrg# the same distribution terms that you use for the rest of that
26b7d26471Smrg# program.  This Exception is an additional permission under section 7
27b7d26471Smrg# of the GNU General Public License, version 3 ("GPLv3").
28145b7b3cSmrg#
29b7d26471Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30145b7b3cSmrg#
315ffd6003Smrg# You can get the latest version of this script from:
32da2e2ef6Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33b7d26471Smrg#
34b7d26471Smrg# Please send patches to <config-patches@gnu.org>.
35b7d26471Smrg
36145b7b3cSmrg
37da2e2ef6Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38da2e2ef6Smrg# about features and limitations of the classic Bourne shell that were
39da2e2ef6Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40da2e2ef6Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41da2e2ef6Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42da2e2ef6Smrg# have a pre-POSIX /bin/sh.
43da2e2ef6Smrg
44da2e2ef6Smrg
45145b7b3cSmrgme=`echo "$0" | sed -e 's,.*/,,'`
46145b7b3cSmrg
47145b7b3cSmrgusage="\
48145b7b3cSmrgUsage: $0 [OPTION]
49145b7b3cSmrg
501d778f8eSmrgOutput the configuration name of the system '$me' is run on.
51145b7b3cSmrg
52b7d26471SmrgOptions:
53145b7b3cSmrg  -h, --help         print this help, then exit
54145b7b3cSmrg  -t, --time-stamp   print date of last modification, then exit
55145b7b3cSmrg  -v, --version      print version number, then exit
56145b7b3cSmrg
57145b7b3cSmrgReport bugs and patches to <config-patches@gnu.org>."
58145b7b3cSmrg
59145b7b3cSmrgversion="\
60145b7b3cSmrgGNU config.guess ($timestamp)
61145b7b3cSmrg
62145b7b3cSmrgOriginally written by Per Bothner.
631d778f8eSmrgCopyright 1992-2024 Free Software Foundation, Inc.
64145b7b3cSmrg
65145b7b3cSmrgThis is free software; see the source for copying conditions.  There is NO
66145b7b3cSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67145b7b3cSmrg
68145b7b3cSmrghelp="
691d778f8eSmrgTry '$me --help' for more information."
70145b7b3cSmrg
71145b7b3cSmrg# Parse command line
72145b7b3cSmrgwhile test $# -gt 0 ; do
73145b7b3cSmrg  case $1 in
74145b7b3cSmrg    --time-stamp | --time* | -t )
75145b7b3cSmrg       echo "$timestamp" ; exit ;;
76145b7b3cSmrg    --version | -v )
77145b7b3cSmrg       echo "$version" ; exit ;;
78145b7b3cSmrg    --help | --h* | -h )
79145b7b3cSmrg       echo "$usage"; exit ;;
80145b7b3cSmrg    -- )     # Stop option processing
81145b7b3cSmrg       shift; break ;;
82145b7b3cSmrg    - )	# Use stdin as input.
83145b7b3cSmrg       break ;;
84145b7b3cSmrg    -* )
85145b7b3cSmrg       echo "$me: invalid option $1$help" >&2
86145b7b3cSmrg       exit 1 ;;
87145b7b3cSmrg    * )
88145b7b3cSmrg       break ;;
89145b7b3cSmrg  esac
90145b7b3cSmrgdone
91145b7b3cSmrg
92145b7b3cSmrgif test $# != 0; then
93145b7b3cSmrg  echo "$me: too many arguments$help" >&2
94145b7b3cSmrg  exit 1
95145b7b3cSmrgfi
96145b7b3cSmrg
97da2e2ef6Smrg# Just in case it came from the environment.
98da2e2ef6SmrgGUESS=
99145b7b3cSmrg
100145b7b3cSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101145b7b3cSmrg# compiler to aid in system detection is discouraged as it requires
102145b7b3cSmrg# temporary files to be created and, as you can see below, it is a
103145b7b3cSmrg# headache to deal with in a portable fashion.
104145b7b3cSmrg
1051d778f8eSmrg# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
1061d778f8eSmrg# use 'HOST_CC' if defined, but it is deprecated.
107145b7b3cSmrg
108145b7b3cSmrg# Portable tmp directory creation inspired by the Autoconf team.
109145b7b3cSmrg
110da2e2ef6Smrgtmp=
111da2e2ef6Smrg# shellcheck disable=SC2172
112da2e2ef6Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113da2e2ef6Smrg
114da2e2ef6Smrgset_cc_for_build() {
115da2e2ef6Smrg    # prevent multiple calls if $tmp is already set
116da2e2ef6Smrg    test "$tmp" && return 0
117da2e2ef6Smrg    : "${TMPDIR=/tmp}"
118da2e2ef6Smrg    # shellcheck disable=SC2039,SC3028
119da2e2ef6Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120da2e2ef6Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121da2e2ef6Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122da2e2ef6Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123da2e2ef6Smrg    dummy=$tmp/dummy
124da2e2ef6Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125da2e2ef6Smrg	,,)    echo "int x;" > "$dummy.c"
126da2e2ef6Smrg	       for driver in cc gcc c89 c99 ; do
127da2e2ef6Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128da2e2ef6Smrg		       CC_FOR_BUILD=$driver
129da2e2ef6Smrg		       break
130da2e2ef6Smrg		   fi
131da2e2ef6Smrg	       done
132da2e2ef6Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133da2e2ef6Smrg		   CC_FOR_BUILD=no_compiler_found
134da2e2ef6Smrg	       fi
135da2e2ef6Smrg	       ;;
136da2e2ef6Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137da2e2ef6Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138da2e2ef6Smrg    esac
139da2e2ef6Smrg}
140145b7b3cSmrg
141145b7b3cSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142145b7b3cSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
143da2e2ef6Smrgif test -f /.attbin/uname ; then
144145b7b3cSmrg	PATH=$PATH:/.attbin ; export PATH
145145b7b3cSmrgfi
146145b7b3cSmrg
147145b7b3cSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148145b7b3cSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149da2e2ef6SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150145b7b3cSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151145b7b3cSmrg
152da2e2ef6Smrgcase $UNAME_SYSTEM in
153b7d26471SmrgLinux|GNU|GNU/*)
154da2e2ef6Smrg	LIBC=unknown
155b7d26471Smrg
156da2e2ef6Smrg	set_cc_for_build
157b7d26471Smrg	cat <<-EOF > "$dummy.c"
1581d778f8eSmrg	#if defined(__ANDROID__)
1591d778f8eSmrg	LIBC=android
1601d778f8eSmrg	#else
161b7d26471Smrg	#include <features.h>
162b7d26471Smrg	#if defined(__UCLIBC__)
163b7d26471Smrg	LIBC=uclibc
164b7d26471Smrg	#elif defined(__dietlibc__)
165b7d26471Smrg	LIBC=dietlibc
166da2e2ef6Smrg	#elif defined(__GLIBC__)
167b7d26471Smrg	LIBC=gnu
1681d778f8eSmrg	#elif defined(__LLVM_LIBC__)
1691d778f8eSmrg	LIBC=llvm
170da2e2ef6Smrg	#else
171da2e2ef6Smrg	#include <stdarg.h>
172da2e2ef6Smrg	/* First heuristic to detect musl libc.  */
173da2e2ef6Smrg	#ifdef __DEFINED_va_list
174da2e2ef6Smrg	LIBC=musl
175da2e2ef6Smrg	#endif
176b7d26471Smrg	#endif
1771d778f8eSmrg	#endif
178b7d26471Smrg	EOF
179da2e2ef6Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
180da2e2ef6Smrg	eval "$cc_set_libc"
181b7d26471Smrg
182da2e2ef6Smrg	# Second heuristic to detect musl libc.
183da2e2ef6Smrg	if [ "$LIBC" = unknown ] &&
184da2e2ef6Smrg	   command -v ldd >/dev/null &&
185da2e2ef6Smrg	   ldd --version 2>&1 | grep -q ^musl; then
186da2e2ef6Smrg		LIBC=musl
187da2e2ef6Smrg	fi
188da2e2ef6Smrg
189da2e2ef6Smrg	# If the system lacks a compiler, then just pick glibc.
190da2e2ef6Smrg	# We could probably try harder.
191da2e2ef6Smrg	if [ "$LIBC" = unknown ]; then
192da2e2ef6Smrg		LIBC=gnu
193b7d26471Smrg	fi
194b7d26471Smrg	;;
195b7d26471Smrgesac
196b7d26471Smrg
197145b7b3cSmrg# Note: order is significant - the case branches are not exclusive.
198145b7b3cSmrg
199da2e2ef6Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
200145b7b3cSmrg    *:NetBSD:*:*)
201145b7b3cSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
202b7d26471Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
203145b7b3cSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
204145b7b3cSmrg	# switched to ELF, *-*-netbsd* would select the old
205145b7b3cSmrg	# object file format.  This provides both forward
206145b7b3cSmrg	# compatibility and a consistent mechanism for selecting the
207145b7b3cSmrg	# object file format.
208145b7b3cSmrg	#
209145b7b3cSmrg	# Note: NetBSD doesn't particularly care about the vendor
210145b7b3cSmrg	# portion of the name.  We always set it to "unknown".
211b7d26471Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
212da2e2ef6Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
213da2e2ef6Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
214b7d26471Smrg	    echo unknown)`
215da2e2ef6Smrg	case $UNAME_MACHINE_ARCH in
216da2e2ef6Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
217145b7b3cSmrg	    armeb) machine=armeb-unknown ;;
218145b7b3cSmrg	    arm*) machine=arm-unknown ;;
219145b7b3cSmrg	    sh3el) machine=shl-unknown ;;
220145b7b3cSmrg	    sh3eb) machine=sh-unknown ;;
221578741aaSmrg	    sh5el) machine=sh5le-unknown ;;
222b7d26471Smrg	    earmv*)
223b7d26471Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
224b7d26471Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
225da2e2ef6Smrg		machine=${arch}${endian}-unknown
226b7d26471Smrg		;;
227da2e2ef6Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
228145b7b3cSmrg	esac
229145b7b3cSmrg	# The Operating System including object format, if it has switched
230b7d26471Smrg	# to ELF recently (or will in the future) and ABI.
231da2e2ef6Smrg	case $UNAME_MACHINE_ARCH in
232b7d26471Smrg	    earm*)
233b7d26471Smrg		os=netbsdelf
234b7d26471Smrg		;;
235145b7b3cSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
236da2e2ef6Smrg		set_cc_for_build
237145b7b3cSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2385ffd6003Smrg			| grep -q __ELF__
239145b7b3cSmrg		then
240145b7b3cSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
241145b7b3cSmrg		    # Return netbsd for either.  FIX?
242145b7b3cSmrg		    os=netbsd
243145b7b3cSmrg		else
244145b7b3cSmrg		    os=netbsdelf
245145b7b3cSmrg		fi
246145b7b3cSmrg		;;
247145b7b3cSmrg	    *)
248b7d26471Smrg		os=netbsd
249b7d26471Smrg		;;
250b7d26471Smrg	esac
251b7d26471Smrg	# Determine ABI tags.
252da2e2ef6Smrg	case $UNAME_MACHINE_ARCH in
253b7d26471Smrg	    earm*)
254b7d26471Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
255b7d26471Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
256145b7b3cSmrg		;;
257145b7b3cSmrg	esac
258145b7b3cSmrg	# The OS release
259145b7b3cSmrg	# Debian GNU/NetBSD machines have a different userland, and
260145b7b3cSmrg	# thus, need a distinct triplet. However, they do not need
261145b7b3cSmrg	# kernel version information, so it can be replaced with a
262145b7b3cSmrg	# suitable tag, in the style of linux-gnu.
263da2e2ef6Smrg	case $UNAME_VERSION in
264145b7b3cSmrg	    Debian*)
265145b7b3cSmrg		release='-gnu'
266145b7b3cSmrg		;;
267145b7b3cSmrg	    *)
268b7d26471Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
269145b7b3cSmrg		;;
270145b7b3cSmrg	esac
271145b7b3cSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
272145b7b3cSmrg	# contains redundant information, the shorter form:
273145b7b3cSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
274da2e2ef6Smrg	GUESS=$machine-${os}${release}${abi-}
275da2e2ef6Smrg	;;
276b7d26471Smrg    *:Bitrig:*:*)
277b7d26471Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
278da2e2ef6Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
279da2e2ef6Smrg	;;
280145b7b3cSmrg    *:OpenBSD:*:*)
281145b7b3cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
282da2e2ef6Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
283da2e2ef6Smrg	;;
284da2e2ef6Smrg    *:SecBSD:*:*)
285da2e2ef6Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
286da2e2ef6Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
287da2e2ef6Smrg	;;
288b7d26471Smrg    *:LibertyBSD:*:*)
289b7d26471Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
290da2e2ef6Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
291da2e2ef6Smrg	;;
292b7d26471Smrg    *:MidnightBSD:*:*)
293da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
294da2e2ef6Smrg	;;
295145b7b3cSmrg    *:ekkoBSD:*:*)
296da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
297da2e2ef6Smrg	;;
298578741aaSmrg    *:SolidBSD:*:*)
299da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
300da2e2ef6Smrg	;;
301da2e2ef6Smrg    *:OS108:*:*)
302da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
303da2e2ef6Smrg	;;
304145b7b3cSmrg    macppc:MirBSD:*:*)
305da2e2ef6Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
306da2e2ef6Smrg	;;
307145b7b3cSmrg    *:MirBSD:*:*)
308da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
309da2e2ef6Smrg	;;
310b7d26471Smrg    *:Sortix:*:*)
311da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
312da2e2ef6Smrg	;;
313da2e2ef6Smrg    *:Twizzler:*:*)
314da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
315da2e2ef6Smrg	;;
316b7d26471Smrg    *:Redox:*:*)
317da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-redox
318da2e2ef6Smrg	;;
319b7d26471Smrg    mips:OSF1:*.*)
320da2e2ef6Smrg	GUESS=mips-dec-osf1
321da2e2ef6Smrg	;;
322145b7b3cSmrg    alpha:OSF1:*:*)
323da2e2ef6Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
324da2e2ef6Smrg	trap '' 0
325145b7b3cSmrg	case $UNAME_RELEASE in
326145b7b3cSmrg	*4.0)
327145b7b3cSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
328145b7b3cSmrg		;;
329145b7b3cSmrg	*5.*)
330b7d26471Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
331145b7b3cSmrg		;;
332145b7b3cSmrg	esac
333145b7b3cSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
334145b7b3cSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
335145b7b3cSmrg	# covers most systems running today.  This code pipes the CPU
336145b7b3cSmrg	# types through head -n 1, so we only detect the type of CPU 0.
337145b7b3cSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
338da2e2ef6Smrg	case $ALPHA_CPU_TYPE in
339145b7b3cSmrg	    "EV4 (21064)")
340b7d26471Smrg		UNAME_MACHINE=alpha ;;
341145b7b3cSmrg	    "EV4.5 (21064)")
342b7d26471Smrg		UNAME_MACHINE=alpha ;;
343145b7b3cSmrg	    "LCA4 (21066/21068)")
344b7d26471Smrg		UNAME_MACHINE=alpha ;;
345145b7b3cSmrg	    "EV5 (21164)")
346b7d26471Smrg		UNAME_MACHINE=alphaev5 ;;
347145b7b3cSmrg	    "EV5.6 (21164A)")
348b7d26471Smrg		UNAME_MACHINE=alphaev56 ;;
349145b7b3cSmrg	    "EV5.6 (21164PC)")
350b7d26471Smrg		UNAME_MACHINE=alphapca56 ;;
351145b7b3cSmrg	    "EV5.7 (21164PC)")
352b7d26471Smrg		UNAME_MACHINE=alphapca57 ;;
353145b7b3cSmrg	    "EV6 (21264)")
354b7d26471Smrg		UNAME_MACHINE=alphaev6 ;;
355145b7b3cSmrg	    "EV6.7 (21264A)")
356b7d26471Smrg		UNAME_MACHINE=alphaev67 ;;
357145b7b3cSmrg	    "EV6.8CB (21264C)")
358b7d26471Smrg		UNAME_MACHINE=alphaev68 ;;
359145b7b3cSmrg	    "EV6.8AL (21264B)")
360b7d26471Smrg		UNAME_MACHINE=alphaev68 ;;
361145b7b3cSmrg	    "EV6.8CX (21264D)")
362b7d26471Smrg		UNAME_MACHINE=alphaev68 ;;
363145b7b3cSmrg	    "EV6.9A (21264/EV69A)")
364b7d26471Smrg		UNAME_MACHINE=alphaev69 ;;
365145b7b3cSmrg	    "EV7 (21364)")
366b7d26471Smrg		UNAME_MACHINE=alphaev7 ;;
367145b7b3cSmrg	    "EV7.9 (21364A)")
368b7d26471Smrg		UNAME_MACHINE=alphaev79 ;;
369145b7b3cSmrg	esac
370145b7b3cSmrg	# A Pn.n version is a patched version.
371145b7b3cSmrg	# A Vn.n version is a released version.
372145b7b3cSmrg	# A Tn.n version is a released field test version.
373145b7b3cSmrg	# A Xn.n version is an unreleased experimental baselevel.
374145b7b3cSmrg	# 1.2 uses "1.2" for uname -r.
375da2e2ef6Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
376da2e2ef6Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
377da2e2ef6Smrg	;;
378145b7b3cSmrg    Amiga*:UNIX_System_V:4.0:*)
379da2e2ef6Smrg	GUESS=m68k-unknown-sysv4
380da2e2ef6Smrg	;;
381145b7b3cSmrg    *:[Aa]miga[Oo][Ss]:*:*)
382da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
383da2e2ef6Smrg	;;
384145b7b3cSmrg    *:[Mm]orph[Oo][Ss]:*:*)
385da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
386da2e2ef6Smrg	;;
387145b7b3cSmrg    *:OS/390:*:*)
388da2e2ef6Smrg	GUESS=i370-ibm-openedition
389da2e2ef6Smrg	;;
390145b7b3cSmrg    *:z/VM:*:*)
391da2e2ef6Smrg	GUESS=s390-ibm-zvmoe
392da2e2ef6Smrg	;;
393145b7b3cSmrg    *:OS400:*:*)
394da2e2ef6Smrg	GUESS=powerpc-ibm-os400
395da2e2ef6Smrg	;;
396145b7b3cSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
397da2e2ef6Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
398da2e2ef6Smrg	;;
399b7d26471Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
400da2e2ef6Smrg	GUESS=arm-unknown-riscos
401da2e2ef6Smrg	;;
402145b7b3cSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
403da2e2ef6Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
404da2e2ef6Smrg	;;
405145b7b3cSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
406145b7b3cSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
407da2e2ef6Smrg	case `(/bin/universe) 2>/dev/null` in
408da2e2ef6Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
409da2e2ef6Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
410da2e2ef6Smrg	esac
411da2e2ef6Smrg	;;
412145b7b3cSmrg    NILE*:*:*:dcosx)
413da2e2ef6Smrg	GUESS=pyramid-pyramid-svr4
414da2e2ef6Smrg	;;
415145b7b3cSmrg    DRS?6000:unix:4.0:6*)
416da2e2ef6Smrg	GUESS=sparc-icl-nx6
417da2e2ef6Smrg	;;
418145b7b3cSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
419145b7b3cSmrg	case `/usr/bin/uname -p` in
420da2e2ef6Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
421da2e2ef6Smrg	esac
422da2e2ef6Smrg	;;
4235ffd6003Smrg    s390x:SunOS:*:*)
424da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
425da2e2ef6Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
426da2e2ef6Smrg	;;
427145b7b3cSmrg    sun4H:SunOS:5.*:*)
428da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
429da2e2ef6Smrg	GUESS=sparc-hal-solaris2$SUN_REL
430da2e2ef6Smrg	;;
431145b7b3cSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
432da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
433da2e2ef6Smrg	GUESS=sparc-sun-solaris2$SUN_REL
434da2e2ef6Smrg	;;
4355ffd6003Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
436da2e2ef6Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
437da2e2ef6Smrg	;;
438578741aaSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
439da2e2ef6Smrg	set_cc_for_build
440b7d26471Smrg	SUN_ARCH=i386
4415ffd6003Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
4425ffd6003Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4435ffd6003Smrg	# This test works for both compilers.
444da2e2ef6Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
4455ffd6003Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4464901b09eSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
4475ffd6003Smrg		grep IS_64BIT_ARCH >/dev/null
4485ffd6003Smrg	    then
449b7d26471Smrg		SUN_ARCH=x86_64
4505ffd6003Smrg	    fi
4515ffd6003Smrg	fi
452da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
453da2e2ef6Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
454da2e2ef6Smrg	;;
455145b7b3cSmrg    sun4*:SunOS:6*:*)
456145b7b3cSmrg	# According to config.sub, this is the proper way to canonicalize
457145b7b3cSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
458145b7b3cSmrg	# it's likely to be more like Solaris than SunOS4.
459da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
460da2e2ef6Smrg	GUESS=sparc-sun-solaris3$SUN_REL
461da2e2ef6Smrg	;;
462145b7b3cSmrg    sun4*:SunOS:*:*)
463da2e2ef6Smrg	case `/usr/bin/arch -k` in
464145b7b3cSmrg	    Series*|S4*)
465145b7b3cSmrg		UNAME_RELEASE=`uname -v`
466145b7b3cSmrg		;;
467145b7b3cSmrg	esac
4681d778f8eSmrg	# Japanese Language versions have a version number like '4.1.3-JL'.
469da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
470da2e2ef6Smrg	GUESS=sparc-sun-sunos$SUN_REL
471da2e2ef6Smrg	;;
472145b7b3cSmrg    sun3*:SunOS:*:*)
473da2e2ef6Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
474da2e2ef6Smrg	;;
475145b7b3cSmrg    sun*:*:4.2BSD:*)
476145b7b3cSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
477b7d26471Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
478da2e2ef6Smrg	case `/bin/arch` in
479145b7b3cSmrg	    sun3)
480da2e2ef6Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
481145b7b3cSmrg		;;
482145b7b3cSmrg	    sun4)
483da2e2ef6Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
484145b7b3cSmrg		;;
485145b7b3cSmrg	esac
486da2e2ef6Smrg	;;
487145b7b3cSmrg    aushp:SunOS:*:*)
488da2e2ef6Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
489da2e2ef6Smrg	;;
490145b7b3cSmrg    # The situation for MiNT is a little confusing.  The machine name
491145b7b3cSmrg    # can be virtually everything (everything which is not
492145b7b3cSmrg    # "atarist" or "atariste" at least should have a processor
493145b7b3cSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
494145b7b3cSmrg    # to the lowercase version "mint" (or "freemint").  Finally
495145b7b3cSmrg    # the system name "TOS" denotes a system which is actually not
496145b7b3cSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
497145b7b3cSmrg    # be no problem.
498145b7b3cSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
499da2e2ef6Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500da2e2ef6Smrg	;;
501145b7b3cSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
502da2e2ef6Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
503da2e2ef6Smrg	;;
504145b7b3cSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
505da2e2ef6Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
506da2e2ef6Smrg	;;
507145b7b3cSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
508da2e2ef6Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
509da2e2ef6Smrg	;;
510145b7b3cSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
511da2e2ef6Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
512da2e2ef6Smrg	;;
513145b7b3cSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
514da2e2ef6Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
515da2e2ef6Smrg	;;
516145b7b3cSmrg    m68k:machten:*:*)
517da2e2ef6Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
518da2e2ef6Smrg	;;
519145b7b3cSmrg    powerpc:machten:*:*)
520da2e2ef6Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
521da2e2ef6Smrg	;;
522145b7b3cSmrg    RISC*:Mach:*:*)
523da2e2ef6Smrg	GUESS=mips-dec-mach_bsd4.3
524da2e2ef6Smrg	;;
525145b7b3cSmrg    RISC*:ULTRIX:*:*)
526da2e2ef6Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
527da2e2ef6Smrg	;;
528145b7b3cSmrg    VAX*:ULTRIX*:*:*)
529da2e2ef6Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
530da2e2ef6Smrg	;;
531145b7b3cSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
532da2e2ef6Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
533da2e2ef6Smrg	;;
534145b7b3cSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
535da2e2ef6Smrg	set_cc_for_build
536b7d26471Smrg	sed 's/^	//' << EOF > "$dummy.c"
537145b7b3cSmrg#ifdef __cplusplus
538145b7b3cSmrg#include <stdio.h>  /* for printf() prototype */
539145b7b3cSmrg	int main (int argc, char *argv[]) {
540145b7b3cSmrg#else
541145b7b3cSmrg	int main (argc, argv) int argc; char *argv[]; {
542145b7b3cSmrg#endif
543145b7b3cSmrg	#if defined (host_mips) && defined (MIPSEB)
544145b7b3cSmrg	#if defined (SYSTYPE_SYSV)
545b7d26471Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
546145b7b3cSmrg	#endif
547145b7b3cSmrg	#if defined (SYSTYPE_SVR4)
548b7d26471Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
549145b7b3cSmrg	#endif
550145b7b3cSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
551b7d26471Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
552145b7b3cSmrg	#endif
553145b7b3cSmrg	#endif
554145b7b3cSmrg	  exit (-1);
555145b7b3cSmrg	}
556145b7b3cSmrgEOF
557b7d26471Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
558b7d26471Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
559b7d26471Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
560145b7b3cSmrg	    { echo "$SYSTEM_NAME"; exit; }
561da2e2ef6Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
562da2e2ef6Smrg	;;
563145b7b3cSmrg    Motorola:PowerMAX_OS:*:*)
564da2e2ef6Smrg	GUESS=powerpc-motorola-powermax
565da2e2ef6Smrg	;;
566145b7b3cSmrg    Motorola:*:4.3:PL8-*)
567da2e2ef6Smrg	GUESS=powerpc-harris-powermax
568da2e2ef6Smrg	;;
569145b7b3cSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
570da2e2ef6Smrg	GUESS=powerpc-harris-powermax
571da2e2ef6Smrg	;;
572145b7b3cSmrg    Night_Hawk:Power_UNIX:*:*)
573da2e2ef6Smrg	GUESS=powerpc-harris-powerunix
574da2e2ef6Smrg	;;
575145b7b3cSmrg    m88k:CX/UX:7*:*)
576da2e2ef6Smrg	GUESS=m88k-harris-cxux7
577da2e2ef6Smrg	;;
578145b7b3cSmrg    m88k:*:4*:R4*)
579da2e2ef6Smrg	GUESS=m88k-motorola-sysv4
580da2e2ef6Smrg	;;
581145b7b3cSmrg    m88k:*:3*:R3*)
582da2e2ef6Smrg	GUESS=m88k-motorola-sysv3
583da2e2ef6Smrg	;;
584145b7b3cSmrg    AViiON:dgux:*:*)
585b7d26471Smrg	# DG/UX returns AViiON for all architectures
586b7d26471Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
587da2e2ef6Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
588145b7b3cSmrg	then
589da2e2ef6Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
590da2e2ef6Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
591145b7b3cSmrg	    then
592da2e2ef6Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
593145b7b3cSmrg	    else
594da2e2ef6Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
595145b7b3cSmrg	    fi
596145b7b3cSmrg	else
597da2e2ef6Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
598145b7b3cSmrg	fi
599da2e2ef6Smrg	;;
600145b7b3cSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
601da2e2ef6Smrg	GUESS=m88k-dolphin-sysv3
602da2e2ef6Smrg	;;
603145b7b3cSmrg    M88*:*:R3*:*)
604145b7b3cSmrg	# Delta 88k system running SVR3
605da2e2ef6Smrg	GUESS=m88k-motorola-sysv3
606da2e2ef6Smrg	;;
607145b7b3cSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
608da2e2ef6Smrg	GUESS=m88k-tektronix-sysv3
609da2e2ef6Smrg	;;
610145b7b3cSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
611da2e2ef6Smrg	GUESS=m68k-tektronix-bsd
612da2e2ef6Smrg	;;
613145b7b3cSmrg    *:IRIX*:*:*)
614da2e2ef6Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
615da2e2ef6Smrg	GUESS=mips-sgi-irix$IRIX_REL
616da2e2ef6Smrg	;;
617145b7b3cSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
618da2e2ef6Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
619da2e2ef6Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
620145b7b3cSmrg    i*86:AIX:*:*)
621da2e2ef6Smrg	GUESS=i386-ibm-aix
622da2e2ef6Smrg	;;
623145b7b3cSmrg    ia64:AIX:*:*)
624da2e2ef6Smrg	if test -x /usr/bin/oslevel ; then
625145b7b3cSmrg		IBM_REV=`/usr/bin/oslevel`
626145b7b3cSmrg	else
627da2e2ef6Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
628145b7b3cSmrg	fi
629da2e2ef6Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
630da2e2ef6Smrg	;;
631145b7b3cSmrg    *:AIX:2:3)
632145b7b3cSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
633da2e2ef6Smrg		set_cc_for_build
634b7d26471Smrg		sed 's/^		//' << EOF > "$dummy.c"
635145b7b3cSmrg		#include <sys/systemcfg.h>
636145b7b3cSmrg
637145b7b3cSmrg		main()
638145b7b3cSmrg			{
639145b7b3cSmrg			if (!__power_pc())
640145b7b3cSmrg				exit(1);
641145b7b3cSmrg			puts("powerpc-ibm-aix3.2.5");
642145b7b3cSmrg			exit(0);
643145b7b3cSmrg			}
644145b7b3cSmrgEOF
645b7d26471Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
646145b7b3cSmrg		then
647da2e2ef6Smrg			GUESS=$SYSTEM_NAME
648145b7b3cSmrg		else
649da2e2ef6Smrg			GUESS=rs6000-ibm-aix3.2.5
650145b7b3cSmrg		fi
651145b7b3cSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
652da2e2ef6Smrg		GUESS=rs6000-ibm-aix3.2.4
653145b7b3cSmrg	else
654da2e2ef6Smrg		GUESS=rs6000-ibm-aix3.2
655145b7b3cSmrg	fi
656da2e2ef6Smrg	;;
657b7d26471Smrg    *:AIX:*:[4567])
658145b7b3cSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
659b7d26471Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
660145b7b3cSmrg		IBM_ARCH=rs6000
661145b7b3cSmrg	else
662145b7b3cSmrg		IBM_ARCH=powerpc
663145b7b3cSmrg	fi
664da2e2ef6Smrg	if test -x /usr/bin/lslpp ; then
665da2e2ef6Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
666b7d26471Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
667145b7b3cSmrg	else
668da2e2ef6Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
669145b7b3cSmrg	fi
670da2e2ef6Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
671da2e2ef6Smrg	;;
672145b7b3cSmrg    *:AIX:*:*)
673da2e2ef6Smrg	GUESS=rs6000-ibm-aix
674da2e2ef6Smrg	;;
675b7d26471Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
676da2e2ef6Smrg	GUESS=romp-ibm-bsd4.4
677da2e2ef6Smrg	;;
678145b7b3cSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
679da2e2ef6Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
680da2e2ef6Smrg	;;                                  # report: romp-ibm BSD 4.3
681145b7b3cSmrg    *:BOSX:*:*)
682da2e2ef6Smrg	GUESS=rs6000-bull-bosx
683da2e2ef6Smrg	;;
684145b7b3cSmrg    DPX/2?00:B.O.S.:*:*)
685da2e2ef6Smrg	GUESS=m68k-bull-sysv3
686da2e2ef6Smrg	;;
687145b7b3cSmrg    9000/[34]??:4.3bsd:1.*:*)
688da2e2ef6Smrg	GUESS=m68k-hp-bsd
689da2e2ef6Smrg	;;
690145b7b3cSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
691da2e2ef6Smrg	GUESS=m68k-hp-bsd4.4
692da2e2ef6Smrg	;;
693145b7b3cSmrg    9000/[34678]??:HP-UX:*:*)
694da2e2ef6Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
695da2e2ef6Smrg	case $UNAME_MACHINE in
696b7d26471Smrg	    9000/31?)            HP_ARCH=m68000 ;;
697b7d26471Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
698145b7b3cSmrg	    9000/[678][0-9][0-9])
699da2e2ef6Smrg		if test -x /usr/bin/getconf; then
700145b7b3cSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
701b7d26471Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
702da2e2ef6Smrg		    case $sc_cpu_version in
703b7d26471Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
704b7d26471Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
705b7d26471Smrg		      532)                      # CPU_PA_RISC2_0
706da2e2ef6Smrg			case $sc_kernel_bits in
707b7d26471Smrg			  32) HP_ARCH=hppa2.0n ;;
708b7d26471Smrg			  64) HP_ARCH=hppa2.0w ;;
709b7d26471Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
710b7d26471Smrg			esac ;;
711b7d26471Smrg		    esac
712145b7b3cSmrg		fi
713da2e2ef6Smrg		if test "$HP_ARCH" = ""; then
714da2e2ef6Smrg		    set_cc_for_build
715b7d26471Smrg		    sed 's/^		//' << EOF > "$dummy.c"
716145b7b3cSmrg
717b7d26471Smrg		#define _HPUX_SOURCE
718b7d26471Smrg		#include <stdlib.h>
719b7d26471Smrg		#include <unistd.h>
720145b7b3cSmrg
721b7d26471Smrg		int main ()
722b7d26471Smrg		{
723b7d26471Smrg		#if defined(_SC_KERNEL_BITS)
724b7d26471Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
725b7d26471Smrg		#endif
726b7d26471Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
727145b7b3cSmrg
728b7d26471Smrg		    switch (cpu)
729b7d26471Smrg			{
730b7d26471Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
731b7d26471Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
732b7d26471Smrg			case CPU_PA_RISC2_0:
733b7d26471Smrg		#if defined(_SC_KERNEL_BITS)
734b7d26471Smrg			    switch (bits)
735b7d26471Smrg				{
736b7d26471Smrg				case 64: puts ("hppa2.0w"); break;
737b7d26471Smrg				case 32: puts ("hppa2.0n"); break;
738b7d26471Smrg				default: puts ("hppa2.0"); break;
739b7d26471Smrg				} break;
740b7d26471Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
741b7d26471Smrg			    puts ("hppa2.0"); break;
742b7d26471Smrg		#endif
743b7d26471Smrg			default: puts ("hppa1.0"); break;
744b7d26471Smrg			}
745b7d26471Smrg		    exit (0);
746b7d26471Smrg		}
747145b7b3cSmrgEOF
748b7d26471Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
749145b7b3cSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
750145b7b3cSmrg		fi ;;
751145b7b3cSmrg	esac
752da2e2ef6Smrg	if test "$HP_ARCH" = hppa2.0w
753145b7b3cSmrg	then
754da2e2ef6Smrg	    set_cc_for_build
755145b7b3cSmrg
756145b7b3cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
757145b7b3cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
758145b7b3cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
759145b7b3cSmrg	    #
760145b7b3cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
761145b7b3cSmrg	    # => hppa2.0w-hp-hpux11.23
762145b7b3cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
763145b7b3cSmrg	    # => hppa64-hp-hpux11.23
764145b7b3cSmrg
765b7d26471Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7665ffd6003Smrg		grep -q __LP64__
767145b7b3cSmrg	    then
768b7d26471Smrg		HP_ARCH=hppa2.0w
769145b7b3cSmrg	    else
770b7d26471Smrg		HP_ARCH=hppa64
771145b7b3cSmrg	    fi
772145b7b3cSmrg	fi
773da2e2ef6Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
774da2e2ef6Smrg	;;
775145b7b3cSmrg    ia64:HP-UX:*:*)
776da2e2ef6Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
777da2e2ef6Smrg	GUESS=ia64-hp-hpux$HPUX_REV
778da2e2ef6Smrg	;;
779145b7b3cSmrg    3050*:HI-UX:*:*)
780da2e2ef6Smrg	set_cc_for_build
781b7d26471Smrg	sed 's/^	//' << EOF > "$dummy.c"
782145b7b3cSmrg	#include <unistd.h>
783145b7b3cSmrg	int
784145b7b3cSmrg	main ()
785145b7b3cSmrg	{
786145b7b3cSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
787145b7b3cSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
788145b7b3cSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
789145b7b3cSmrg	     results, however.  */
790145b7b3cSmrg	  if (CPU_IS_PA_RISC (cpu))
791145b7b3cSmrg	    {
792145b7b3cSmrg	      switch (cpu)
793145b7b3cSmrg		{
794145b7b3cSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
795145b7b3cSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
796145b7b3cSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
797145b7b3cSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
798145b7b3cSmrg		}
799145b7b3cSmrg	    }
800145b7b3cSmrg	  else if (CPU_IS_HP_MC68K (cpu))
801145b7b3cSmrg	    puts ("m68k-hitachi-hiuxwe2");
802145b7b3cSmrg	  else puts ("unknown-hitachi-hiuxwe2");
803145b7b3cSmrg	  exit (0);
804145b7b3cSmrg	}
805145b7b3cSmrgEOF
806b7d26471Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
807145b7b3cSmrg		{ echo "$SYSTEM_NAME"; exit; }
808da2e2ef6Smrg	GUESS=unknown-hitachi-hiuxwe2
809da2e2ef6Smrg	;;
810b7d26471Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
811da2e2ef6Smrg	GUESS=hppa1.1-hp-bsd
812da2e2ef6Smrg	;;
813145b7b3cSmrg    9000/8??:4.3bsd:*:*)
814da2e2ef6Smrg	GUESS=hppa1.0-hp-bsd
815da2e2ef6Smrg	;;
816145b7b3cSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
817da2e2ef6Smrg	GUESS=hppa1.0-hp-mpeix
818da2e2ef6Smrg	;;
819b7d26471Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
820da2e2ef6Smrg	GUESS=hppa1.1-hp-osf
821da2e2ef6Smrg	;;
822145b7b3cSmrg    hp8??:OSF1:*:*)
823da2e2ef6Smrg	GUESS=hppa1.0-hp-osf
824da2e2ef6Smrg	;;
825145b7b3cSmrg    i*86:OSF1:*:*)
826da2e2ef6Smrg	if test -x /usr/sbin/sysversion ; then
827da2e2ef6Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
828145b7b3cSmrg	else
829da2e2ef6Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
830145b7b3cSmrg	fi
831da2e2ef6Smrg	;;
832145b7b3cSmrg    parisc*:Lites*:*:*)
833da2e2ef6Smrg	GUESS=hppa1.1-hp-lites
834da2e2ef6Smrg	;;
835145b7b3cSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
836da2e2ef6Smrg	GUESS=c1-convex-bsd
837da2e2ef6Smrg	;;
838145b7b3cSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
839145b7b3cSmrg	if getsysinfo -f scalar_acc
840145b7b3cSmrg	then echo c32-convex-bsd
841145b7b3cSmrg	else echo c2-convex-bsd
842145b7b3cSmrg	fi
843b7d26471Smrg	exit ;;
844145b7b3cSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
845da2e2ef6Smrg	GUESS=c34-convex-bsd
846da2e2ef6Smrg	;;
847145b7b3cSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
848da2e2ef6Smrg	GUESS=c38-convex-bsd
849da2e2ef6Smrg	;;
850145b7b3cSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
851da2e2ef6Smrg	GUESS=c4-convex-bsd
852da2e2ef6Smrg	;;
853145b7b3cSmrg    CRAY*Y-MP:*:*:*)
854da2e2ef6Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
855da2e2ef6Smrg	GUESS=ymp-cray-unicos$CRAY_REL
856da2e2ef6Smrg	;;
857145b7b3cSmrg    CRAY*[A-Z]90:*:*:*)
858b7d26471Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
859145b7b3cSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
860145b7b3cSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
861145b7b3cSmrg	      -e 's/\.[^.]*$/.X/'
862145b7b3cSmrg	exit ;;
863145b7b3cSmrg    CRAY*TS:*:*:*)
864da2e2ef6Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
865da2e2ef6Smrg	GUESS=t90-cray-unicos$CRAY_REL
866da2e2ef6Smrg	;;
867145b7b3cSmrg    CRAY*T3E:*:*:*)
868da2e2ef6Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
869da2e2ef6Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
870da2e2ef6Smrg	;;
871145b7b3cSmrg    CRAY*SV1:*:*:*)
872da2e2ef6Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
873da2e2ef6Smrg	GUESS=sv1-cray-unicos$CRAY_REL
874da2e2ef6Smrg	;;
875145b7b3cSmrg    *:UNICOS/mp:*:*)
876da2e2ef6Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
877da2e2ef6Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
878da2e2ef6Smrg	;;
879145b7b3cSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
880b7d26471Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
881b7d26471Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
882b7d26471Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
883da2e2ef6Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
884da2e2ef6Smrg	;;
885145b7b3cSmrg    5000:UNIX_System_V:4.*:*)
886b7d26471Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
887b7d26471Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
888da2e2ef6Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
889da2e2ef6Smrg	;;
890145b7b3cSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
891da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
892da2e2ef6Smrg	;;
893145b7b3cSmrg    sparc*:BSD/OS:*:*)
894da2e2ef6Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
895da2e2ef6Smrg	;;
896145b7b3cSmrg    *:BSD/OS:*:*)
897da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
898da2e2ef6Smrg	;;
899da2e2ef6Smrg    arm:FreeBSD:*:*)
900da2e2ef6Smrg	UNAME_PROCESSOR=`uname -p`
901da2e2ef6Smrg	set_cc_for_build
902da2e2ef6Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
903da2e2ef6Smrg	    | grep -q __ARM_PCS_VFP
904da2e2ef6Smrg	then
905da2e2ef6Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
906da2e2ef6Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
907da2e2ef6Smrg	else
908da2e2ef6Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
909da2e2ef6Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
910da2e2ef6Smrg	fi
911da2e2ef6Smrg	;;
912145b7b3cSmrg    *:FreeBSD:*:*)
9131d778f8eSmrg	UNAME_PROCESSOR=`uname -p`
914da2e2ef6Smrg	case $UNAME_PROCESSOR in
915578741aaSmrg	    amd64)
916b7d26471Smrg		UNAME_PROCESSOR=x86_64 ;;
917b7d26471Smrg	    i386)
918b7d26471Smrg		UNAME_PROCESSOR=i586 ;;
919578741aaSmrg	esac
920da2e2ef6Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
921da2e2ef6Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
922da2e2ef6Smrg	;;
923145b7b3cSmrg    i*:CYGWIN*:*)
924da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
925da2e2ef6Smrg	;;
926b7d26471Smrg    *:MINGW64*:*)
927da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
928da2e2ef6Smrg	;;
929578741aaSmrg    *:MINGW*:*)
930da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
931da2e2ef6Smrg	;;
932b7d26471Smrg    *:MSYS*:*)
933da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-msys
934da2e2ef6Smrg	;;
935145b7b3cSmrg    i*:PW*:*)
936da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-pw32
937da2e2ef6Smrg	;;
9384901b09eSmrg    *:SerenityOS:*:*)
9394901b09eSmrg        GUESS=$UNAME_MACHINE-pc-serenity
9404901b09eSmrg        ;;
9415ffd6003Smrg    *:Interix*:*)
942da2e2ef6Smrg	case $UNAME_MACHINE in
943578741aaSmrg	    x86)
944da2e2ef6Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
945da2e2ef6Smrg		;;
9465ffd6003Smrg	    authenticamd | genuineintel | EM64T)
947da2e2ef6Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
948da2e2ef6Smrg		;;
949578741aaSmrg	    IA64)
950da2e2ef6Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
951da2e2ef6Smrg		;;
952578741aaSmrg	esac ;;
953145b7b3cSmrg    i*:UWIN*:*)
954da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-uwin
955da2e2ef6Smrg	;;
956145b7b3cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
957da2e2ef6Smrg	GUESS=x86_64-pc-cygwin
958da2e2ef6Smrg	;;
959145b7b3cSmrg    prep*:SunOS:5.*:*)
960da2e2ef6Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
961da2e2ef6Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
962da2e2ef6Smrg	;;
963145b7b3cSmrg    *:GNU:*:*)
964145b7b3cSmrg	# the GNU system
965da2e2ef6Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
966da2e2ef6Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
967da2e2ef6Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
968da2e2ef6Smrg	;;
969145b7b3cSmrg    *:GNU/*:*:*)
970145b7b3cSmrg	# other systems with GNU libc and userland
971da2e2ef6Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
972da2e2ef6Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
973da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
974da2e2ef6Smrg	;;
9754901b09eSmrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
9764901b09eSmrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
9774901b09eSmrg	;;
9784901b09eSmrg    *:[Mm]anagarm:*:*)
9794901b09eSmrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
9804901b09eSmrg	;;
981da2e2ef6Smrg    *:Minix:*:*)
982da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-minix
983da2e2ef6Smrg	;;
984b7d26471Smrg    aarch64:Linux:*:*)
9851d778f8eSmrg	set_cc_for_build
9861d778f8eSmrg	CPU=$UNAME_MACHINE
9871d778f8eSmrg	LIBCABI=$LIBC
9881d778f8eSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
9891d778f8eSmrg	    ABI=64
9901d778f8eSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
9911d778f8eSmrg	    #ifdef __ARM_EABI__
9921d778f8eSmrg	    #ifdef __ARM_PCS_VFP
9931d778f8eSmrg	    ABI=eabihf
9941d778f8eSmrg	    #else
9951d778f8eSmrg	    ABI=eabi
9961d778f8eSmrg	    #endif
9971d778f8eSmrg	    #endif
9981d778f8eSmrgEOF
9991d778f8eSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
10001d778f8eSmrg	    eval "$cc_set_abi"
10011d778f8eSmrg	    case $ABI in
10021d778f8eSmrg		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
10031d778f8eSmrg	    esac
10041d778f8eSmrg	fi
10051d778f8eSmrg	GUESS=$CPU-unknown-linux-$LIBCABI
1006da2e2ef6Smrg	;;
1007b7d26471Smrg    aarch64_be:Linux:*:*)
1008b7d26471Smrg	UNAME_MACHINE=aarch64_be
1009da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1010da2e2ef6Smrg	;;
10115ffd6003Smrg    alpha:Linux:*:*)
1012da2e2ef6Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
10135ffd6003Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
10145ffd6003Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
10155ffd6003Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
10165ffd6003Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
10175ffd6003Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
10185ffd6003Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
10195ffd6003Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
1020b7d26471Smrg	esac
10215ffd6003Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
1022b7d26471Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
1023da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1024da2e2ef6Smrg	;;
1025da2e2ef6Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1026da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1027da2e2ef6Smrg	;;
1028145b7b3cSmrg    arm*:Linux:*:*)
1029da2e2ef6Smrg	set_cc_for_build
1030578741aaSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1031578741aaSmrg	    | grep -q __ARM_EABI__
1032578741aaSmrg	then
1033da2e2ef6Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1034578741aaSmrg	else
1035b7d26471Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1036b7d26471Smrg		| grep -q __ARM_PCS_VFP
1037b7d26471Smrg	    then
1038da2e2ef6Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1039b7d26471Smrg	    else
1040da2e2ef6Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1041b7d26471Smrg	    fi
1042578741aaSmrg	fi
1043da2e2ef6Smrg	;;
1044578741aaSmrg    avr32*:Linux:*:*)
1045da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1046da2e2ef6Smrg	;;
1047145b7b3cSmrg    cris:Linux:*:*)
1048da2e2ef6Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1049da2e2ef6Smrg	;;
1050145b7b3cSmrg    crisv32:Linux:*:*)
1051da2e2ef6Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1052da2e2ef6Smrg	;;
1053b7d26471Smrg    e2k:Linux:*:*)
1054da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1055da2e2ef6Smrg	;;
1056145b7b3cSmrg    frv:Linux:*:*)
1057da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1058da2e2ef6Smrg	;;
1059b7d26471Smrg    hexagon:Linux:*:*)
1060da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1061da2e2ef6Smrg	;;
10625ffd6003Smrg    i*86:Linux:*:*)
1063da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1064da2e2ef6Smrg	;;
1065145b7b3cSmrg    ia64:Linux:*:*)
1066da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1067da2e2ef6Smrg	;;
1068b7d26471Smrg    k1om:Linux:*:*)
1069da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1070da2e2ef6Smrg	;;
10711d778f8eSmrg    kvx:Linux:*:*)
10721d778f8eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10731d778f8eSmrg	;;
10741d778f8eSmrg    kvx:cos:*:*)
10751d778f8eSmrg	GUESS=$UNAME_MACHINE-unknown-cos
10761d778f8eSmrg	;;
10771d778f8eSmrg    kvx:mbr:*:*)
10781d778f8eSmrg	GUESS=$UNAME_MACHINE-unknown-mbr
10791d778f8eSmrg	;;
10804901b09eSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1081da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1082da2e2ef6Smrg	;;
1083145b7b3cSmrg    m32r*:Linux:*:*)
1084da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1085da2e2ef6Smrg	;;
1086145b7b3cSmrg    m68*:Linux:*:*)
1087da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1088da2e2ef6Smrg	;;
10895ffd6003Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1090da2e2ef6Smrg	set_cc_for_build
1091da2e2ef6Smrg	IS_GLIBC=0
1092da2e2ef6Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1093b7d26471Smrg	sed 's/^	//' << EOF > "$dummy.c"
1094145b7b3cSmrg	#undef CPU
1095da2e2ef6Smrg	#undef mips
1096da2e2ef6Smrg	#undef mipsel
1097da2e2ef6Smrg	#undef mips64
1098da2e2ef6Smrg	#undef mips64el
1099da2e2ef6Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1100da2e2ef6Smrg	LIBCABI=gnuabi64
1101da2e2ef6Smrg	#else
1102da2e2ef6Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1103da2e2ef6Smrg	LIBCABI=gnuabin32
1104da2e2ef6Smrg	#else
1105da2e2ef6Smrg	LIBCABI=${LIBC}
1106da2e2ef6Smrg	#endif
1107da2e2ef6Smrg	#endif
1108da2e2ef6Smrg
1109da2e2ef6Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1110da2e2ef6Smrg	CPU=mipsisa64r6
1111da2e2ef6Smrg	#else
1112da2e2ef6Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1113da2e2ef6Smrg	CPU=mipsisa32r6
1114da2e2ef6Smrg	#else
1115da2e2ef6Smrg	#if defined(__mips64)
1116da2e2ef6Smrg	CPU=mips64
1117da2e2ef6Smrg	#else
1118da2e2ef6Smrg	CPU=mips
1119da2e2ef6Smrg	#endif
1120da2e2ef6Smrg	#endif
1121da2e2ef6Smrg	#endif
1122da2e2ef6Smrg
1123145b7b3cSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1124da2e2ef6Smrg	MIPS_ENDIAN=el
1125145b7b3cSmrg	#else
1126145b7b3cSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1127da2e2ef6Smrg	MIPS_ENDIAN=
1128145b7b3cSmrg	#else
1129da2e2ef6Smrg	MIPS_ENDIAN=
1130145b7b3cSmrg	#endif
1131145b7b3cSmrg	#endif
1132145b7b3cSmrgEOF
1133da2e2ef6Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1134da2e2ef6Smrg	eval "$cc_set_vars"
1135da2e2ef6Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1136145b7b3cSmrg	;;
1137b7d26471Smrg    mips64el:Linux:*:*)
1138da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139da2e2ef6Smrg	;;
1140b7d26471Smrg    openrisc*:Linux:*:*)
1141da2e2ef6Smrg	GUESS=or1k-unknown-linux-$LIBC
1142da2e2ef6Smrg	;;
1143b7d26471Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1144da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145da2e2ef6Smrg	;;
11465ffd6003Smrg    padre:Linux:*:*)
1147da2e2ef6Smrg	GUESS=sparc-unknown-linux-$LIBC
1148da2e2ef6Smrg	;;
11495ffd6003Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1150da2e2ef6Smrg	GUESS=hppa64-unknown-linux-$LIBC
1151da2e2ef6Smrg	;;
1152145b7b3cSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
1153145b7b3cSmrg	# Look for CPU level
1154145b7b3cSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1155da2e2ef6Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1156da2e2ef6Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1157da2e2ef6Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1158145b7b3cSmrg	esac
1159da2e2ef6Smrg	;;
11605ffd6003Smrg    ppc64:Linux:*:*)
1161da2e2ef6Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1162da2e2ef6Smrg	;;
11635ffd6003Smrg    ppc:Linux:*:*)
1164da2e2ef6Smrg	GUESS=powerpc-unknown-linux-$LIBC
1165da2e2ef6Smrg	;;
1166b7d26471Smrg    ppc64le:Linux:*:*)
1167da2e2ef6Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1168da2e2ef6Smrg	;;
1169b7d26471Smrg    ppcle:Linux:*:*)
1170da2e2ef6Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1171da2e2ef6Smrg	;;
1172da2e2ef6Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1173da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1174da2e2ef6Smrg	;;
1175145b7b3cSmrg    s390:Linux:*:* | s390x:Linux:*:*)
1176da2e2ef6Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1177da2e2ef6Smrg	;;
1178145b7b3cSmrg    sh64*:Linux:*:*)
1179da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1180da2e2ef6Smrg	;;
1181145b7b3cSmrg    sh*:Linux:*:*)
1182da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1183da2e2ef6Smrg	;;
1184145b7b3cSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1185da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1186da2e2ef6Smrg	;;
1187b7d26471Smrg    tile*:Linux:*:*)
1188da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1189da2e2ef6Smrg	;;
1190145b7b3cSmrg    vax:Linux:*:*)
1191da2e2ef6Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1192da2e2ef6Smrg	;;
1193145b7b3cSmrg    x86_64:Linux:*:*)
1194da2e2ef6Smrg	set_cc_for_build
11954901b09eSmrg	CPU=$UNAME_MACHINE
1196da2e2ef6Smrg	LIBCABI=$LIBC
1197da2e2ef6Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11984901b09eSmrg	    ABI=64
11994901b09eSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
12004901b09eSmrg	    #ifdef __i386__
12014901b09eSmrg	    ABI=x86
12024901b09eSmrg	    #else
12034901b09eSmrg	    #ifdef __ILP32__
12044901b09eSmrg	    ABI=x32
12054901b09eSmrg	    #endif
12064901b09eSmrg	    #endif
12074901b09eSmrgEOF
12084901b09eSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
12094901b09eSmrg	    eval "$cc_set_abi"
12104901b09eSmrg	    case $ABI in
12114901b09eSmrg		x86) CPU=i686 ;;
12124901b09eSmrg		x32) LIBCABI=${LIBC}x32 ;;
12134901b09eSmrg	    esac
1214da2e2ef6Smrg	fi
12154901b09eSmrg	GUESS=$CPU-pc-linux-$LIBCABI
1216da2e2ef6Smrg	;;
1217578741aaSmrg    xtensa*:Linux:*:*)
1218da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1219da2e2ef6Smrg	;;
1220145b7b3cSmrg    i*86:DYNIX/ptx:4*:*)
1221145b7b3cSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1222145b7b3cSmrg	# earlier versions are messed up and put the nodename in both
1223145b7b3cSmrg	# sysname and nodename.
1224da2e2ef6Smrg	GUESS=i386-sequent-sysv4
1225da2e2ef6Smrg	;;
1226145b7b3cSmrg    i*86:UNIX_SV:4.2MP:2.*)
1227b7d26471Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1228b7d26471Smrg	# number series starting with 2...
1229b7d26471Smrg	# I am not positive that other SVR4 systems won't match this,
1230145b7b3cSmrg	# I just have to hope.  -- rms.
1231b7d26471Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1232da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1233da2e2ef6Smrg	;;
1234145b7b3cSmrg    i*86:OS/2:*:*)
12351d778f8eSmrg	# If we were able to find 'uname', then EMX Unix compatibility
1236145b7b3cSmrg	# is probably installed.
1237da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1238da2e2ef6Smrg	;;
1239145b7b3cSmrg    i*86:XTS-300:*:STOP)
1240da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1241da2e2ef6Smrg	;;
1242145b7b3cSmrg    i*86:atheos:*:*)
1243da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1244da2e2ef6Smrg	;;
1245145b7b3cSmrg    i*86:syllable:*:*)
1246da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1247da2e2ef6Smrg	;;
12485ffd6003Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1249da2e2ef6Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1250da2e2ef6Smrg	;;
1251145b7b3cSmrg    i*86:*DOS:*:*)
1252da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1253da2e2ef6Smrg	;;
1254b7d26471Smrg    i*86:*:4.*:*)
1255b7d26471Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1256145b7b3cSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1257da2e2ef6Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1258145b7b3cSmrg	else
1259da2e2ef6Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1260145b7b3cSmrg	fi
1261da2e2ef6Smrg	;;
1262145b7b3cSmrg    i*86:*:5:[678]*)
1263b7d26471Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1264145b7b3cSmrg	case `/bin/uname -X | grep "^Machine"` in
1265145b7b3cSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1266145b7b3cSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1267145b7b3cSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1268145b7b3cSmrg	esac
1269da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1270da2e2ef6Smrg	;;
1271145b7b3cSmrg    i*86:*:3.2:*)
1272145b7b3cSmrg	if test -f /usr/options/cb.name; then
1273145b7b3cSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1274da2e2ef6Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1275145b7b3cSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1276145b7b3cSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1277145b7b3cSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1278145b7b3cSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1279145b7b3cSmrg			&& UNAME_MACHINE=i586
1280145b7b3cSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1281145b7b3cSmrg			&& UNAME_MACHINE=i686
1282145b7b3cSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1283145b7b3cSmrg			&& UNAME_MACHINE=i686
1284da2e2ef6Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1285145b7b3cSmrg	else
1286da2e2ef6Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
1287145b7b3cSmrg	fi
1288da2e2ef6Smrg	;;
1289145b7b3cSmrg    pc:*:*:*)
1290145b7b3cSmrg	# Left here for compatibility:
1291b7d26471Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1292b7d26471Smrg	# the processor, so we play safe by assuming i586.
12935ffd6003Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1294b7d26471Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
12955ffd6003Smrg	# this is a cross-build.
1296da2e2ef6Smrg	GUESS=i586-pc-msdosdjgpp
1297da2e2ef6Smrg	;;
1298145b7b3cSmrg    Intel:Mach:3*:*)
1299da2e2ef6Smrg	GUESS=i386-pc-mach3
1300da2e2ef6Smrg	;;
1301145b7b3cSmrg    paragon:*:*:*)
1302da2e2ef6Smrg	GUESS=i860-intel-osf1
1303da2e2ef6Smrg	;;
1304145b7b3cSmrg    i860:*:4.*:*) # i860-SVR4
1305145b7b3cSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1306da2e2ef6Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1307145b7b3cSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1308da2e2ef6Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1309145b7b3cSmrg	fi
1310da2e2ef6Smrg	;;
1311145b7b3cSmrg    mini*:CTIX:SYS*5:*)
1312145b7b3cSmrg	# "miniframe"
1313da2e2ef6Smrg	GUESS=m68010-convergent-sysv
1314da2e2ef6Smrg	;;
1315145b7b3cSmrg    mc68k:UNIX:SYSTEM5:3.51m)
1316da2e2ef6Smrg	GUESS=m68k-convergent-sysv
1317da2e2ef6Smrg	;;
1318145b7b3cSmrg    M680?0:D-NIX:5.3:*)
1319da2e2ef6Smrg	GUESS=m68k-diab-dnix
1320da2e2ef6Smrg	;;
1321145b7b3cSmrg    M68*:*:R3V[5678]*:*)
1322145b7b3cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1323145b7b3cSmrg    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)
1324145b7b3cSmrg	OS_REL=''
1325145b7b3cSmrg	test -r /etc/.relid \
1326145b7b3cSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1327145b7b3cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1328b7d26471Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1329145b7b3cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1330b7d26471Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1331145b7b3cSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1332b7d26471Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1333b7d26471Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
13345ffd6003Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
13355ffd6003Smrg	OS_REL='.3'
13365ffd6003Smrg	test -r /etc/.relid \
13375ffd6003Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
13385ffd6003Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1339b7d26471Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
13405ffd6003Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1341b7d26471Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
13425ffd6003Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1343b7d26471Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1344145b7b3cSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1345da2e2ef6Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1346da2e2ef6Smrg	;;
1347145b7b3cSmrg    mc68030:UNIX_System_V:4.*:*)
1348da2e2ef6Smrg	GUESS=m68k-atari-sysv4
1349da2e2ef6Smrg	;;
1350145b7b3cSmrg    TSUNAMI:LynxOS:2.*:*)
1351da2e2ef6Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1352da2e2ef6Smrg	;;
1353145b7b3cSmrg    rs6000:LynxOS:2.*:*)
1354da2e2ef6Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1355da2e2ef6Smrg	;;
13565ffd6003Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1357da2e2ef6Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1358da2e2ef6Smrg	;;
1359145b7b3cSmrg    SM[BE]S:UNIX_SV:*:*)
1360da2e2ef6Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1361da2e2ef6Smrg	;;
1362145b7b3cSmrg    RM*:ReliantUNIX-*:*:*)
1363da2e2ef6Smrg	GUESS=mips-sni-sysv4
1364da2e2ef6Smrg	;;
1365145b7b3cSmrg    RM*:SINIX-*:*:*)
1366da2e2ef6Smrg	GUESS=mips-sni-sysv4
1367da2e2ef6Smrg	;;
1368145b7b3cSmrg    *:SINIX-*:*:*)
1369145b7b3cSmrg	if uname -p 2>/dev/null >/dev/null ; then
1370145b7b3cSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1371da2e2ef6Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
1372145b7b3cSmrg	else
1373da2e2ef6Smrg		GUESS=ns32k-sni-sysv
1374145b7b3cSmrg	fi
1375da2e2ef6Smrg	;;
13761d778f8eSmrg    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
1377b7d26471Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1378da2e2ef6Smrg	GUESS=i586-unisys-sysv4
1379da2e2ef6Smrg	;;
1380145b7b3cSmrg    *:UNIX_System_V:4*:FTX*)
1381145b7b3cSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1382145b7b3cSmrg	# How about differentiating between stratus architectures? -djm
1383da2e2ef6Smrg	GUESS=hppa1.1-stratus-sysv4
1384da2e2ef6Smrg	;;
1385145b7b3cSmrg    *:*:*:FTX*)
1386145b7b3cSmrg	# From seanf@swdc.stratus.com.
1387da2e2ef6Smrg	GUESS=i860-stratus-sysv4
1388da2e2ef6Smrg	;;
1389145b7b3cSmrg    i*86:VOS:*:*)
1390145b7b3cSmrg	# From Paul.Green@stratus.com.
1391da2e2ef6Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1392da2e2ef6Smrg	;;
1393145b7b3cSmrg    *:VOS:*:*)
1394145b7b3cSmrg	# From Paul.Green@stratus.com.
1395da2e2ef6Smrg	GUESS=hppa1.1-stratus-vos
1396da2e2ef6Smrg	;;
1397145b7b3cSmrg    mc68*:A/UX:*:*)
1398da2e2ef6Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1399da2e2ef6Smrg	;;
1400145b7b3cSmrg    news*:NEWS-OS:6*:*)
1401da2e2ef6Smrg	GUESS=mips-sony-newsos6
1402da2e2ef6Smrg	;;
1403145b7b3cSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1404da2e2ef6Smrg	if test -d /usr/nec; then
1405da2e2ef6Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1406145b7b3cSmrg	else
1407da2e2ef6Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1408145b7b3cSmrg	fi
1409da2e2ef6Smrg	;;
1410145b7b3cSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1411da2e2ef6Smrg	GUESS=powerpc-be-beos
1412da2e2ef6Smrg	;;
1413145b7b3cSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1414da2e2ef6Smrg	GUESS=powerpc-apple-beos
1415da2e2ef6Smrg	;;
1416145b7b3cSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1417da2e2ef6Smrg	GUESS=i586-pc-beos
1418da2e2ef6Smrg	;;
14195ffd6003Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1420da2e2ef6Smrg	GUESS=i586-pc-haiku
1421da2e2ef6Smrg	;;
14224901b09eSmrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
14234901b09eSmrg	GUESS=powerpc-apple-haiku
14244901b09eSmrg	;;
14254901b09eSmrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
14264901b09eSmrg	GUESS=$UNAME_MACHINE-unknown-haiku
1427da2e2ef6Smrg	;;
1428145b7b3cSmrg    SX-4:SUPER-UX:*:*)
1429da2e2ef6Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1430da2e2ef6Smrg	;;
1431145b7b3cSmrg    SX-5:SUPER-UX:*:*)
1432da2e2ef6Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1433da2e2ef6Smrg	;;
1434145b7b3cSmrg    SX-6:SUPER-UX:*:*)
1435da2e2ef6Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1436da2e2ef6Smrg	;;
1437578741aaSmrg    SX-7:SUPER-UX:*:*)
1438da2e2ef6Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1439da2e2ef6Smrg	;;
1440578741aaSmrg    SX-8:SUPER-UX:*:*)
1441da2e2ef6Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1442da2e2ef6Smrg	;;
1443578741aaSmrg    SX-8R:SUPER-UX:*:*)
1444da2e2ef6Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1445da2e2ef6Smrg	;;
1446b7d26471Smrg    SX-ACE:SUPER-UX:*:*)
1447da2e2ef6Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1448da2e2ef6Smrg	;;
1449145b7b3cSmrg    Power*:Rhapsody:*:*)
1450da2e2ef6Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1451da2e2ef6Smrg	;;
1452145b7b3cSmrg    *:Rhapsody:*:*)
1453da2e2ef6Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1454da2e2ef6Smrg	;;
1455da2e2ef6Smrg    arm64:Darwin:*:*)
1456da2e2ef6Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1457da2e2ef6Smrg	;;
1458145b7b3cSmrg    *:Darwin:*:*)
1459da2e2ef6Smrg	UNAME_PROCESSOR=`uname -p`
1460da2e2ef6Smrg	case $UNAME_PROCESSOR in
1461da2e2ef6Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1462da2e2ef6Smrg	esac
1463da2e2ef6Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1464da2e2ef6Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1465da2e2ef6Smrg	    # Avoid executing cc if there is no toolchain installed as
1466da2e2ef6Smrg	    # cc will be a stub that puts up a graphical alert
1467da2e2ef6Smrg	    # prompting the user to install developer tools.
1468da2e2ef6Smrg	    CC_FOR_BUILD=no_compiler_found
1469da2e2ef6Smrg	else
1470da2e2ef6Smrg	    set_cc_for_build
1471b7d26471Smrg	fi
1472da2e2ef6Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1473da2e2ef6Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1474da2e2ef6Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1475da2e2ef6Smrg		   grep IS_64BIT_ARCH >/dev/null
1476da2e2ef6Smrg	    then
1477da2e2ef6Smrg		case $UNAME_PROCESSOR in
1478da2e2ef6Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1479da2e2ef6Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1480da2e2ef6Smrg		esac
1481da2e2ef6Smrg	    fi
1482da2e2ef6Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1483da2e2ef6Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1484da2e2ef6Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1485da2e2ef6Smrg		   grep IS_PPC >/dev/null
1486da2e2ef6Smrg	    then
1487da2e2ef6Smrg		UNAME_PROCESSOR=powerpc
1488b7d26471Smrg	    fi
1489b7d26471Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1490da2e2ef6Smrg	    # uname -m returns i386 or x86_64
1491da2e2ef6Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1492b7d26471Smrg	fi
1493da2e2ef6Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1494da2e2ef6Smrg	;;
1495145b7b3cSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1496145b7b3cSmrg	UNAME_PROCESSOR=`uname -p`
1497b7d26471Smrg	if test "$UNAME_PROCESSOR" = x86; then
1498145b7b3cSmrg		UNAME_PROCESSOR=i386
1499145b7b3cSmrg		UNAME_MACHINE=pc
1500145b7b3cSmrg	fi
1501da2e2ef6Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1502da2e2ef6Smrg	;;
1503145b7b3cSmrg    *:QNX:*:4*)
1504da2e2ef6Smrg	GUESS=i386-pc-qnx
1505da2e2ef6Smrg	;;
1506b7d26471Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1507da2e2ef6Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1508da2e2ef6Smrg	;;
1509b7d26471Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1510da2e2ef6Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1511da2e2ef6Smrg	;;
1512b7d26471Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1513da2e2ef6Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1514da2e2ef6Smrg	;;
1515b7d26471Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1516da2e2ef6Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1517da2e2ef6Smrg	;;
1518b7d26471Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1519da2e2ef6Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1520da2e2ef6Smrg	;;
1521145b7b3cSmrg    *:NonStop-UX:*:*)
1522da2e2ef6Smrg	GUESS=mips-compaq-nonstopux
1523da2e2ef6Smrg	;;
1524145b7b3cSmrg    BS2000:POSIX*:*:*)
1525da2e2ef6Smrg	GUESS=bs2000-siemens-sysv
1526da2e2ef6Smrg	;;
1527145b7b3cSmrg    DS/*:UNIX_System_V:*:*)
1528da2e2ef6Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1529da2e2ef6Smrg	;;
1530145b7b3cSmrg    *:Plan9:*:*)
1531145b7b3cSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1532145b7b3cSmrg	# is converted to i386 for consistency with other x86
1533145b7b3cSmrg	# operating systems.
1534da2e2ef6Smrg	if test "${cputype-}" = 386; then
1535145b7b3cSmrg	    UNAME_MACHINE=i386
1536da2e2ef6Smrg	elif test "x${cputype-}" != x; then
1537da2e2ef6Smrg	    UNAME_MACHINE=$cputype
1538145b7b3cSmrg	fi
1539da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1540da2e2ef6Smrg	;;
1541145b7b3cSmrg    *:TOPS-10:*:*)
1542da2e2ef6Smrg	GUESS=pdp10-unknown-tops10
1543da2e2ef6Smrg	;;
1544145b7b3cSmrg    *:TENEX:*:*)
1545da2e2ef6Smrg	GUESS=pdp10-unknown-tenex
1546da2e2ef6Smrg	;;
1547145b7b3cSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1548da2e2ef6Smrg	GUESS=pdp10-dec-tops20
1549da2e2ef6Smrg	;;
1550145b7b3cSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1551da2e2ef6Smrg	GUESS=pdp10-xkl-tops20
1552da2e2ef6Smrg	;;
1553145b7b3cSmrg    *:TOPS-20:*:*)
1554da2e2ef6Smrg	GUESS=pdp10-unknown-tops20
1555da2e2ef6Smrg	;;
1556145b7b3cSmrg    *:ITS:*:*)
1557da2e2ef6Smrg	GUESS=pdp10-unknown-its
1558da2e2ef6Smrg	;;
1559145b7b3cSmrg    SEI:*:*:SEIUX)
1560da2e2ef6Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1561da2e2ef6Smrg	;;
1562145b7b3cSmrg    *:DragonFly:*:*)
1563da2e2ef6Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1564da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1565da2e2ef6Smrg	;;
1566145b7b3cSmrg    *:*VMS:*:*)
1567b7d26471Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1568da2e2ef6Smrg	case $UNAME_MACHINE in
1569da2e2ef6Smrg	    A*) GUESS=alpha-dec-vms ;;
1570da2e2ef6Smrg	    I*) GUESS=ia64-dec-vms ;;
1571da2e2ef6Smrg	    V*) GUESS=vax-dec-vms ;;
1572145b7b3cSmrg	esac ;;
1573145b7b3cSmrg    *:XENIX:*:SysV)
1574da2e2ef6Smrg	GUESS=i386-pc-xenix
1575da2e2ef6Smrg	;;
1576145b7b3cSmrg    i*86:skyos:*:*)
1577da2e2ef6Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1578da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1579da2e2ef6Smrg	;;
1580145b7b3cSmrg    i*86:rdos:*:*)
1581da2e2ef6Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1582da2e2ef6Smrg	;;
15834901b09eSmrg    i*86:Fiwix:*:*)
15844901b09eSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
15854901b09eSmrg	;;
1586da2e2ef6Smrg    *:AROS:*:*)
1587da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1588da2e2ef6Smrg	;;
1589b7d26471Smrg    x86_64:VMkernel:*:*)
1590da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1591da2e2ef6Smrg	;;
1592b7d26471Smrg    amd64:Isilon\ OneFS:*:*)
1593da2e2ef6Smrg	GUESS=x86_64-unknown-onefs
1594da2e2ef6Smrg	;;
1595da2e2ef6Smrg    *:Unleashed:*:*)
1596da2e2ef6Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1597da2e2ef6Smrg	;;
15981d778f8eSmrg    *:Ironclad:*:*)
15991d778f8eSmrg	GUESS=$UNAME_MACHINE-unknown-ironclad
16001d778f8eSmrg	;;
1601145b7b3cSmrgesac
1602145b7b3cSmrg
1603da2e2ef6Smrg# Do we have a guess based on uname results?
1604da2e2ef6Smrgif test "x$GUESS" != x; then
1605da2e2ef6Smrg    echo "$GUESS"
1606da2e2ef6Smrg    exit
1607da2e2ef6Smrgfi
1608da2e2ef6Smrg
1609da2e2ef6Smrg# No uname command or uname output not recognized.
1610da2e2ef6Smrgset_cc_for_build
1611da2e2ef6Smrgcat > "$dummy.c" <<EOF
1612da2e2ef6Smrg#ifdef _SEQUENT_
1613da2e2ef6Smrg#include <sys/types.h>
1614da2e2ef6Smrg#include <sys/utsname.h>
1615da2e2ef6Smrg#endif
1616da2e2ef6Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1617da2e2ef6Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1618da2e2ef6Smrg#include <signal.h>
1619da2e2ef6Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1620da2e2ef6Smrg#include <sys/utsname.h>
1621da2e2ef6Smrg#endif
1622da2e2ef6Smrg#endif
1623da2e2ef6Smrg#endif
1624da2e2ef6Smrgmain ()
1625da2e2ef6Smrg{
1626da2e2ef6Smrg#if defined (sony)
1627da2e2ef6Smrg#if defined (MIPSEB)
1628da2e2ef6Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1629da2e2ef6Smrg     I don't know....  */
1630da2e2ef6Smrg  printf ("mips-sony-bsd\n"); exit (0);
1631da2e2ef6Smrg#else
1632da2e2ef6Smrg#include <sys/param.h>
1633da2e2ef6Smrg  printf ("m68k-sony-newsos%s\n",
1634da2e2ef6Smrg#ifdef NEWSOS4
1635da2e2ef6Smrg  "4"
1636da2e2ef6Smrg#else
1637da2e2ef6Smrg  ""
1638da2e2ef6Smrg#endif
1639da2e2ef6Smrg  ); exit (0);
1640da2e2ef6Smrg#endif
1641da2e2ef6Smrg#endif
1642da2e2ef6Smrg
1643da2e2ef6Smrg#if defined (NeXT)
1644da2e2ef6Smrg#if !defined (__ARCHITECTURE__)
1645da2e2ef6Smrg#define __ARCHITECTURE__ "m68k"
1646da2e2ef6Smrg#endif
1647da2e2ef6Smrg  int version;
1648da2e2ef6Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1649da2e2ef6Smrg  if (version < 4)
1650da2e2ef6Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1651da2e2ef6Smrg  else
1652da2e2ef6Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1653da2e2ef6Smrg  exit (0);
1654da2e2ef6Smrg#endif
1655da2e2ef6Smrg
1656da2e2ef6Smrg#if defined (MULTIMAX) || defined (n16)
1657da2e2ef6Smrg#if defined (UMAXV)
1658da2e2ef6Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1659da2e2ef6Smrg#else
1660da2e2ef6Smrg#if defined (CMU)
1661da2e2ef6Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1662da2e2ef6Smrg#else
1663da2e2ef6Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1664da2e2ef6Smrg#endif
1665da2e2ef6Smrg#endif
1666da2e2ef6Smrg#endif
1667da2e2ef6Smrg
1668da2e2ef6Smrg#if defined (__386BSD__)
1669da2e2ef6Smrg  printf ("i386-pc-bsd\n"); exit (0);
1670da2e2ef6Smrg#endif
1671da2e2ef6Smrg
1672da2e2ef6Smrg#if defined (sequent)
1673da2e2ef6Smrg#if defined (i386)
1674da2e2ef6Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1675da2e2ef6Smrg#endif
1676da2e2ef6Smrg#if defined (ns32000)
1677da2e2ef6Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1678da2e2ef6Smrg#endif
1679da2e2ef6Smrg#endif
1680da2e2ef6Smrg
1681da2e2ef6Smrg#if defined (_SEQUENT_)
1682da2e2ef6Smrg  struct utsname un;
1683da2e2ef6Smrg
1684da2e2ef6Smrg  uname(&un);
1685da2e2ef6Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1686da2e2ef6Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1687da2e2ef6Smrg  }
1688da2e2ef6Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1689da2e2ef6Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1690da2e2ef6Smrg  }
1691da2e2ef6Smrg  printf ("i386-sequent-ptx\n"); exit (0);
1692da2e2ef6Smrg#endif
1693da2e2ef6Smrg
1694da2e2ef6Smrg#if defined (vax)
1695da2e2ef6Smrg#if !defined (ultrix)
1696da2e2ef6Smrg#include <sys/param.h>
1697da2e2ef6Smrg#if defined (BSD)
1698da2e2ef6Smrg#if BSD == 43
1699da2e2ef6Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1700da2e2ef6Smrg#else
1701da2e2ef6Smrg#if BSD == 199006
1702da2e2ef6Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1703da2e2ef6Smrg#else
1704da2e2ef6Smrg  printf ("vax-dec-bsd\n"); exit (0);
1705da2e2ef6Smrg#endif
1706da2e2ef6Smrg#endif
1707da2e2ef6Smrg#else
1708da2e2ef6Smrg  printf ("vax-dec-bsd\n"); exit (0);
1709da2e2ef6Smrg#endif
1710da2e2ef6Smrg#else
1711da2e2ef6Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1712da2e2ef6Smrg  struct utsname un;
1713da2e2ef6Smrg  uname (&un);
1714da2e2ef6Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1715da2e2ef6Smrg#else
1716da2e2ef6Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1717da2e2ef6Smrg#endif
1718da2e2ef6Smrg#endif
1719da2e2ef6Smrg#endif
1720da2e2ef6Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1721da2e2ef6Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1722da2e2ef6Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1723da2e2ef6Smrg  struct utsname *un;
1724da2e2ef6Smrg  uname (&un);
1725da2e2ef6Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1726da2e2ef6Smrg#else
1727da2e2ef6Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1728da2e2ef6Smrg#endif
1729da2e2ef6Smrg#endif
1730da2e2ef6Smrg#endif
1731da2e2ef6Smrg
1732da2e2ef6Smrg#if defined (alliant) && defined (i860)
1733da2e2ef6Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1734da2e2ef6Smrg#endif
1735da2e2ef6Smrg
1736da2e2ef6Smrg  exit (1);
1737da2e2ef6Smrg}
1738da2e2ef6SmrgEOF
1739da2e2ef6Smrg
1740da2e2ef6Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1741da2e2ef6Smrg	{ echo "$SYSTEM_NAME"; exit; }
1742da2e2ef6Smrg
1743da2e2ef6Smrg# Apollos put the system type in the environment.
1744da2e2ef6Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1745da2e2ef6Smrg
1746b7d26471Smrgecho "$0: unable to guess system type" >&2
1747145b7b3cSmrg
1748da2e2ef6Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1749b7d26471Smrg    mips:Linux | mips64:Linux)
1750b7d26471Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1751b7d26471Smrg	cat >&2 <<EOF
1752145b7b3cSmrg
1753b7d26471SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1754b7d26471Smrgthe system type. Please install a C compiler and try again.
1755145b7b3cSmrgEOF
1756b7d26471Smrg	;;
1757b7d26471Smrgesac
1758145b7b3cSmrg
1759145b7b3cSmrgcat >&2 <<EOF
1760145b7b3cSmrg
1761b7d26471SmrgThis script (version $timestamp), has failed to recognize the
1762b7d26471Smrgoperating system you are using. If your script is old, overwrite *all*
1763b7d26471Smrgcopies of config.guess and config.sub with the latest versions from:
1764145b7b3cSmrg
1765da2e2ef6Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1766145b7b3cSmrgand
1767da2e2ef6Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1768da2e2ef6SmrgEOF
1769da2e2ef6Smrg
1770da2e2ef6Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1771da2e2ef6Smrgthisyear=`date +%Y`
1772da2e2ef6Smrg# shellcheck disable=SC2003
1773da2e2ef6Smrgscript_age=`expr "$thisyear" - "$our_year"`
1774da2e2ef6Smrgif test "$script_age" -lt 3 ; then
1775da2e2ef6Smrg   cat >&2 <<EOF
1776145b7b3cSmrg
1777b7d26471SmrgIf $0 has already been updated, send the following data and any
1778b7d26471Smrginformation you think might be pertinent to config-patches@gnu.org to
1779b7d26471Smrgprovide the necessary information to handle your system.
1780145b7b3cSmrg
1781145b7b3cSmrgconfig.guess timestamp = $timestamp
1782145b7b3cSmrg
1783145b7b3cSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1784145b7b3cSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1785145b7b3cSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1786145b7b3cSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1787145b7b3cSmrg
1788145b7b3cSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1789145b7b3cSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1790145b7b3cSmrg
1791145b7b3cSmrghostinfo               = `(hostinfo) 2>/dev/null`
1792145b7b3cSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1793145b7b3cSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1794145b7b3cSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1795145b7b3cSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1796145b7b3cSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1797145b7b3cSmrg
1798b7d26471SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1799b7d26471SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1800b7d26471SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1801b7d26471SmrgUNAME_VERSION = "$UNAME_VERSION"
1802145b7b3cSmrgEOF
1803da2e2ef6Smrgfi
1804145b7b3cSmrg
1805145b7b3cSmrgexit 1
1806145b7b3cSmrg
1807145b7b3cSmrg# Local variables:
1808da2e2ef6Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1809145b7b3cSmrg# time-stamp-start: "timestamp='"
1810145b7b3cSmrg# time-stamp-format: "%:y-%02m-%02d"
1811145b7b3cSmrg# time-stamp-end: "'"
1812145b7b3cSmrg# End:
1813