11f0ac6a5Smrg#! /bin/sh
21f0ac6a5Smrg# Attempt to guess a canonical system name.
36ee7d557Smrg#   Copyright 1992-2024 Free Software Foundation, Inc.
41f0ac6a5Smrg
5d21ab8bcSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6d21ab8bcSmrg
76ee7d557Smrgtimestamp='2024-01-01'
81f0ac6a5Smrg
91f0ac6a5Smrg# This file is free software; you can redistribute it and/or modify it
101f0ac6a5Smrg# under the terms of the GNU General Public License as published by
116ee7d557Smrg# the Free Software Foundation, either version 3 of the License, or
121f0ac6a5Smrg# (at your option) any later version.
131f0ac6a5Smrg#
141f0ac6a5Smrg# This program is distributed in the hope that it will be useful, but
151f0ac6a5Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
161f0ac6a5Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
171f0ac6a5Smrg# General Public License for more details.
181f0ac6a5Smrg#
191f0ac6a5Smrg# You should have received a copy of the GNU General Public License
20d21ab8bcSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
211f0ac6a5Smrg#
221f0ac6a5Smrg# As a special exception to the GNU General Public License, if you
231f0ac6a5Smrg# distribute this file as part of a program that contains a
241f0ac6a5Smrg# configuration script generated by Autoconf, you may include it under
2589c04b6cSmrg# the same distribution terms that you use for the rest of that
2689c04b6cSmrg# program.  This Exception is an additional permission under section 7
2789c04b6cSmrg# of the GNU General Public License, version 3 ("GPLv3").
281f0ac6a5Smrg#
29d21ab8bcSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
301f0ac6a5Smrg#
319c9ff80cSmrg# You can get the latest version of this script from:
32d21ab8bcSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
3389c04b6cSmrg#
34d21ab8bcSmrg# Please send patches to <config-patches@gnu.org>.
35d21ab8bcSmrg
36d21ab8bcSmrg
37d21ab8bcSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
38d21ab8bcSmrg# about features and limitations of the classic Bourne shell that were
39d21ab8bcSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
40d21ab8bcSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41d21ab8bcSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42d21ab8bcSmrg# have a pre-POSIX /bin/sh.
4389c04b6cSmrg
441f0ac6a5Smrg
451f0ac6a5Smrgme=`echo "$0" | sed -e 's,.*/,,'`
461f0ac6a5Smrg
471f0ac6a5Smrgusage="\
481f0ac6a5SmrgUsage: $0 [OPTION]
491f0ac6a5Smrg
506ee7d557SmrgOutput the configuration name of the system '$me' is run on.
511f0ac6a5Smrg
52d21ab8bcSmrgOptions:
531f0ac6a5Smrg  -h, --help         print this help, then exit
541f0ac6a5Smrg  -t, --time-stamp   print date of last modification, then exit
551f0ac6a5Smrg  -v, --version      print version number, then exit
561f0ac6a5Smrg
571f0ac6a5SmrgReport bugs and patches to <config-patches@gnu.org>."
581f0ac6a5Smrg
591f0ac6a5Smrgversion="\
601f0ac6a5SmrgGNU config.guess ($timestamp)
611f0ac6a5Smrg
621f0ac6a5SmrgOriginally written by Per Bothner.
636ee7d557SmrgCopyright 1992-2024 Free Software Foundation, Inc.
641f0ac6a5Smrg
651f0ac6a5SmrgThis is free software; see the source for copying conditions.  There is NO
661f0ac6a5Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
671f0ac6a5Smrg
681f0ac6a5Smrghelp="
696ee7d557SmrgTry '$me --help' for more information."
701f0ac6a5Smrg
711f0ac6a5Smrg# Parse command line
721f0ac6a5Smrgwhile test $# -gt 0 ; do
731f0ac6a5Smrg  case $1 in
741f0ac6a5Smrg    --time-stamp | --time* | -t )
75e5410a46Smrg       echo "$timestamp" ; exit ;;
761f0ac6a5Smrg    --version | -v )
77e5410a46Smrg       echo "$version" ; exit ;;
781f0ac6a5Smrg    --help | --h* | -h )
79e5410a46Smrg       echo "$usage"; exit ;;
801f0ac6a5Smrg    -- )     # Stop option processing
811f0ac6a5Smrg       shift; break ;;
821f0ac6a5Smrg    - )	# Use stdin as input.
831f0ac6a5Smrg       break ;;
841f0ac6a5Smrg    -* )
851f0ac6a5Smrg       echo "$me: invalid option $1$help" >&2
861f0ac6a5Smrg       exit 1 ;;
871f0ac6a5Smrg    * )
881f0ac6a5Smrg       break ;;
891f0ac6a5Smrg  esac
901f0ac6a5Smrgdone
911f0ac6a5Smrg
921f0ac6a5Smrgif test $# != 0; then
931f0ac6a5Smrg  echo "$me: too many arguments$help" >&2
941f0ac6a5Smrg  exit 1
951f0ac6a5Smrgfi
961f0ac6a5Smrg
97d21ab8bcSmrg# Just in case it came from the environment.
98d21ab8bcSmrgGUESS=
991f0ac6a5Smrg
1001f0ac6a5Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1011f0ac6a5Smrg# compiler to aid in system detection is discouraged as it requires
1021f0ac6a5Smrg# temporary files to be created and, as you can see below, it is a
1031f0ac6a5Smrg# headache to deal with in a portable fashion.
1041f0ac6a5Smrg
1056ee7d557Smrg# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
1066ee7d557Smrg# use 'HOST_CC' if defined, but it is deprecated.
1071f0ac6a5Smrg
1081f0ac6a5Smrg# Portable tmp directory creation inspired by the Autoconf team.
1091f0ac6a5Smrg
110d21ab8bcSmrgtmp=
111d21ab8bcSmrg# shellcheck disable=SC2172
112d21ab8bcSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113d21ab8bcSmrg
114d21ab8bcSmrgset_cc_for_build() {
115d21ab8bcSmrg    # prevent multiple calls if $tmp is already set
116d21ab8bcSmrg    test "$tmp" && return 0
117d21ab8bcSmrg    : "${TMPDIR=/tmp}"
118d21ab8bcSmrg    # shellcheck disable=SC2039,SC3028
119d21ab8bcSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120d21ab8bcSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121d21ab8bcSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122d21ab8bcSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123d21ab8bcSmrg    dummy=$tmp/dummy
124d21ab8bcSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125d21ab8bcSmrg	,,)    echo "int x;" > "$dummy.c"
126d21ab8bcSmrg	       for driver in cc gcc c89 c99 ; do
127d21ab8bcSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128d21ab8bcSmrg		       CC_FOR_BUILD=$driver
129d21ab8bcSmrg		       break
130d21ab8bcSmrg		   fi
131d21ab8bcSmrg	       done
132d21ab8bcSmrg	       if test x"$CC_FOR_BUILD" = x ; then
133d21ab8bcSmrg		   CC_FOR_BUILD=no_compiler_found
134d21ab8bcSmrg	       fi
135d21ab8bcSmrg	       ;;
136d21ab8bcSmrg	,,*)   CC_FOR_BUILD=$CC ;;
137d21ab8bcSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138d21ab8bcSmrg    esac
139d21ab8bcSmrg}
1401f0ac6a5Smrg
1411f0ac6a5Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1421f0ac6a5Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143d21ab8bcSmrgif test -f /.attbin/uname ; then
1441f0ac6a5Smrg	PATH=$PATH:/.attbin ; export PATH
1451f0ac6a5Smrgfi
1461f0ac6a5Smrg
1471f0ac6a5SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1481f0ac6a5SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149d21ab8bcSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1501f0ac6a5SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1511f0ac6a5Smrg
152d21ab8bcSmrgcase $UNAME_SYSTEM in
153b9867631SmrgLinux|GNU|GNU/*)
154d21ab8bcSmrg	LIBC=unknown
155b9867631Smrg
156d21ab8bcSmrg	set_cc_for_build
157d21ab8bcSmrg	cat <<-EOF > "$dummy.c"
1586ee7d557Smrg	#if defined(__ANDROID__)
1596ee7d557Smrg	LIBC=android
1606ee7d557Smrg	#else
161b9867631Smrg	#include <features.h>
162b9867631Smrg	#if defined(__UCLIBC__)
163b9867631Smrg	LIBC=uclibc
164b9867631Smrg	#elif defined(__dietlibc__)
165b9867631Smrg	LIBC=dietlibc
166d21ab8bcSmrg	#elif defined(__GLIBC__)
167b9867631Smrg	LIBC=gnu
1686ee7d557Smrg	#elif defined(__LLVM_LIBC__)
1696ee7d557Smrg	LIBC=llvm
170d21ab8bcSmrg	#else
171d21ab8bcSmrg	#include <stdarg.h>
172d21ab8bcSmrg	/* First heuristic to detect musl libc.  */
173d21ab8bcSmrg	#ifdef __DEFINED_va_list
174d21ab8bcSmrg	LIBC=musl
175d21ab8bcSmrg	#endif
176b9867631Smrg	#endif
1776ee7d557Smrg	#endif
178b9867631Smrg	EOF
179d21ab8bcSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
180d21ab8bcSmrg	eval "$cc_set_libc"
181d21ab8bcSmrg
182d21ab8bcSmrg	# Second heuristic to detect musl libc.
183d21ab8bcSmrg	if [ "$LIBC" = unknown ] &&
184d21ab8bcSmrg	   command -v ldd >/dev/null &&
185d21ab8bcSmrg	   ldd --version 2>&1 | grep -q ^musl; then
186d21ab8bcSmrg		LIBC=musl
187d21ab8bcSmrg	fi
188d21ab8bcSmrg
189d21ab8bcSmrg	# If the system lacks a compiler, then just pick glibc.
190d21ab8bcSmrg	# We could probably try harder.
191d21ab8bcSmrg	if [ "$LIBC" = unknown ]; then
192d21ab8bcSmrg		LIBC=gnu
193d21ab8bcSmrg	fi
194b9867631Smrg	;;
195b9867631Smrgesac
196b9867631Smrg
1971f0ac6a5Smrg# Note: order is significant - the case branches are not exclusive.
1981f0ac6a5Smrg
199d21ab8bcSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
2001f0ac6a5Smrg    *:NetBSD:*:*)
2011f0ac6a5Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
20289c04b6cSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
2031f0ac6a5Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
2041f0ac6a5Smrg	# switched to ELF, *-*-netbsd* would select the old
2051f0ac6a5Smrg	# object file format.  This provides both forward
2061f0ac6a5Smrg	# compatibility and a consistent mechanism for selecting the
2071f0ac6a5Smrg	# object file format.
2081f0ac6a5Smrg	#
2091f0ac6a5Smrg	# Note: NetBSD doesn't particularly care about the vendor
2101f0ac6a5Smrg	# portion of the name.  We always set it to "unknown".
211d21ab8bcSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
212d21ab8bcSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
213d21ab8bcSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
214d21ab8bcSmrg	    echo unknown)`
215d21ab8bcSmrg	case $UNAME_MACHINE_ARCH in
216d21ab8bcSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
2171f0ac6a5Smrg	    armeb) machine=armeb-unknown ;;
2181f0ac6a5Smrg	    arm*) machine=arm-unknown ;;
2191f0ac6a5Smrg	    sh3el) machine=shl-unknown ;;
2201f0ac6a5Smrg	    sh3eb) machine=sh-unknown ;;
221e5410a46Smrg	    sh5el) machine=sh5le-unknown ;;
222d21ab8bcSmrg	    earmv*)
223d21ab8bcSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
224d21ab8bcSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
225d21ab8bcSmrg		machine=${arch}${endian}-unknown
226d21ab8bcSmrg		;;
227d21ab8bcSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2281f0ac6a5Smrg	esac
2291f0ac6a5Smrg	# The Operating System including object format, if it has switched
230d21ab8bcSmrg	# to ELF recently (or will in the future) and ABI.
231d21ab8bcSmrg	case $UNAME_MACHINE_ARCH in
232d21ab8bcSmrg	    earm*)
233d21ab8bcSmrg		os=netbsdelf
234d21ab8bcSmrg		;;
2351f0ac6a5Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
236d21ab8bcSmrg		set_cc_for_build
2371f0ac6a5Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2389c9ff80cSmrg			| grep -q __ELF__
2391f0ac6a5Smrg		then
2401f0ac6a5Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2411f0ac6a5Smrg		    # Return netbsd for either.  FIX?
2421f0ac6a5Smrg		    os=netbsd
2431f0ac6a5Smrg		else
2441f0ac6a5Smrg		    os=netbsdelf
2451f0ac6a5Smrg		fi
2461f0ac6a5Smrg		;;
2471f0ac6a5Smrg	    *)
24889c04b6cSmrg		os=netbsd
2491f0ac6a5Smrg		;;
2501f0ac6a5Smrg	esac
251d21ab8bcSmrg	# Determine ABI tags.
252d21ab8bcSmrg	case $UNAME_MACHINE_ARCH in
253d21ab8bcSmrg	    earm*)
254d21ab8bcSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
255d21ab8bcSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
256d21ab8bcSmrg		;;
257d21ab8bcSmrg	esac
2581f0ac6a5Smrg	# The OS release
2591f0ac6a5Smrg	# Debian GNU/NetBSD machines have a different userland, and
2601f0ac6a5Smrg	# thus, need a distinct triplet. However, they do not need
2611f0ac6a5Smrg	# kernel version information, so it can be replaced with a
2621f0ac6a5Smrg	# suitable tag, in the style of linux-gnu.
263d21ab8bcSmrg	case $UNAME_VERSION in
2641f0ac6a5Smrg	    Debian*)
2651f0ac6a5Smrg		release='-gnu'
2661f0ac6a5Smrg		;;
2671f0ac6a5Smrg	    *)
268d21ab8bcSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2691f0ac6a5Smrg		;;
2701f0ac6a5Smrg	esac
2711f0ac6a5Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2721f0ac6a5Smrg	# contains redundant information, the shorter form:
2731f0ac6a5Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
274d21ab8bcSmrg	GUESS=$machine-${os}${release}${abi-}
275d21ab8bcSmrg	;;
27689c04b6cSmrg    *:Bitrig:*:*)
27789c04b6cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
278d21ab8bcSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
279d21ab8bcSmrg	;;
2801f0ac6a5Smrg    *:OpenBSD:*:*)
281e5410a46Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
282d21ab8bcSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
283d21ab8bcSmrg	;;
284d21ab8bcSmrg    *:SecBSD:*:*)
285d21ab8bcSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
286d21ab8bcSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
287d21ab8bcSmrg	;;
288d21ab8bcSmrg    *:LibertyBSD:*:*)
289d21ab8bcSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
290d21ab8bcSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
291d21ab8bcSmrg	;;
292d21ab8bcSmrg    *:MidnightBSD:*:*)
293d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
294d21ab8bcSmrg	;;
295e5410a46Smrg    *:ekkoBSD:*:*)
296d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
297d21ab8bcSmrg	;;
298e5410a46Smrg    *:SolidBSD:*:*)
299d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
300d21ab8bcSmrg	;;
301d21ab8bcSmrg    *:OS108:*:*)
302d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
303d21ab8bcSmrg	;;
304e5410a46Smrg    macppc:MirBSD:*:*)
305d21ab8bcSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
306d21ab8bcSmrg	;;
307e5410a46Smrg    *:MirBSD:*:*)
308d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
309d21ab8bcSmrg	;;
310d21ab8bcSmrg    *:Sortix:*:*)
311d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
312d21ab8bcSmrg	;;
313d21ab8bcSmrg    *:Twizzler:*:*)
314d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
315d21ab8bcSmrg	;;
316d21ab8bcSmrg    *:Redox:*:*)
317d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-redox
318d21ab8bcSmrg	;;
319d21ab8bcSmrg    mips:OSF1:*.*)
320d21ab8bcSmrg	GUESS=mips-dec-osf1
321d21ab8bcSmrg	;;
3221f0ac6a5Smrg    alpha:OSF1:*:*)
323d21ab8bcSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
324d21ab8bcSmrg	trap '' 0
325e5410a46Smrg	case $UNAME_RELEASE in
326e5410a46Smrg	*4.0)
3271f0ac6a5Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
328e5410a46Smrg		;;
329e5410a46Smrg	*5.*)
33089c04b6cSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
331e5410a46Smrg		;;
332e5410a46Smrg	esac
3331f0ac6a5Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3341f0ac6a5Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3351f0ac6a5Smrg	# covers most systems running today.  This code pipes the CPU
3361f0ac6a5Smrg	# types through head -n 1, so we only detect the type of CPU 0.
3371f0ac6a5Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
338d21ab8bcSmrg	case $ALPHA_CPU_TYPE in
3391f0ac6a5Smrg	    "EV4 (21064)")
340d21ab8bcSmrg		UNAME_MACHINE=alpha ;;
3411f0ac6a5Smrg	    "EV4.5 (21064)")
342d21ab8bcSmrg		UNAME_MACHINE=alpha ;;
3431f0ac6a5Smrg	    "LCA4 (21066/21068)")
344d21ab8bcSmrg		UNAME_MACHINE=alpha ;;
3451f0ac6a5Smrg	    "EV5 (21164)")
346d21ab8bcSmrg		UNAME_MACHINE=alphaev5 ;;
3471f0ac6a5Smrg	    "EV5.6 (21164A)")
348d21ab8bcSmrg		UNAME_MACHINE=alphaev56 ;;
3491f0ac6a5Smrg	    "EV5.6 (21164PC)")
350d21ab8bcSmrg		UNAME_MACHINE=alphapca56 ;;
3511f0ac6a5Smrg	    "EV5.7 (21164PC)")
352d21ab8bcSmrg		UNAME_MACHINE=alphapca57 ;;
3531f0ac6a5Smrg	    "EV6 (21264)")
354d21ab8bcSmrg		UNAME_MACHINE=alphaev6 ;;
3551f0ac6a5Smrg	    "EV6.7 (21264A)")
356d21ab8bcSmrg		UNAME_MACHINE=alphaev67 ;;
3571f0ac6a5Smrg	    "EV6.8CB (21264C)")
358d21ab8bcSmrg		UNAME_MACHINE=alphaev68 ;;
3591f0ac6a5Smrg	    "EV6.8AL (21264B)")
360d21ab8bcSmrg		UNAME_MACHINE=alphaev68 ;;
3611f0ac6a5Smrg	    "EV6.8CX (21264D)")
362d21ab8bcSmrg		UNAME_MACHINE=alphaev68 ;;
3631f0ac6a5Smrg	    "EV6.9A (21264/EV69A)")
364d21ab8bcSmrg		UNAME_MACHINE=alphaev69 ;;
3651f0ac6a5Smrg	    "EV7 (21364)")
366d21ab8bcSmrg		UNAME_MACHINE=alphaev7 ;;
3671f0ac6a5Smrg	    "EV7.9 (21364A)")
368d21ab8bcSmrg		UNAME_MACHINE=alphaev79 ;;
3691f0ac6a5Smrg	esac
370e5410a46Smrg	# A Pn.n version is a patched version.
3711f0ac6a5Smrg	# A Vn.n version is a released version.
3721f0ac6a5Smrg	# A Tn.n version is a released field test version.
3731f0ac6a5Smrg	# A Xn.n version is an unreleased experimental baselevel.
3741f0ac6a5Smrg	# 1.2 uses "1.2" for uname -r.
375d21ab8bcSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
376d21ab8bcSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
377d21ab8bcSmrg	;;
3781f0ac6a5Smrg    Amiga*:UNIX_System_V:4.0:*)
379d21ab8bcSmrg	GUESS=m68k-unknown-sysv4
380d21ab8bcSmrg	;;
3811f0ac6a5Smrg    *:[Aa]miga[Oo][Ss]:*:*)
382d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
383d21ab8bcSmrg	;;
3841f0ac6a5Smrg    *:[Mm]orph[Oo][Ss]:*:*)
385d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
386d21ab8bcSmrg	;;
3871f0ac6a5Smrg    *:OS/390:*:*)
388d21ab8bcSmrg	GUESS=i370-ibm-openedition
389d21ab8bcSmrg	;;
390e5410a46Smrg    *:z/VM:*:*)
391d21ab8bcSmrg	GUESS=s390-ibm-zvmoe
392d21ab8bcSmrg	;;
393e5410a46Smrg    *:OS400:*:*)
394d21ab8bcSmrg	GUESS=powerpc-ibm-os400
395d21ab8bcSmrg	;;
3961f0ac6a5Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
397d21ab8bcSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
398d21ab8bcSmrg	;;
39989c04b6cSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
400d21ab8bcSmrg	GUESS=arm-unknown-riscos
401d21ab8bcSmrg	;;
4021f0ac6a5Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
403d21ab8bcSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
404d21ab8bcSmrg	;;
4051f0ac6a5Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4061f0ac6a5Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
407d21ab8bcSmrg	case `(/bin/universe) 2>/dev/null` in
408d21ab8bcSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
409d21ab8bcSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
410d21ab8bcSmrg	esac
411d21ab8bcSmrg	;;
4121f0ac6a5Smrg    NILE*:*:*:dcosx)
413d21ab8bcSmrg	GUESS=pyramid-pyramid-svr4
414d21ab8bcSmrg	;;
4151f0ac6a5Smrg    DRS?6000:unix:4.0:6*)
416d21ab8bcSmrg	GUESS=sparc-icl-nx6
417d21ab8bcSmrg	;;
418e5410a46Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4191f0ac6a5Smrg	case `/usr/bin/uname -p` in
420d21ab8bcSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
421d21ab8bcSmrg	esac
422d21ab8bcSmrg	;;
4239c9ff80cSmrg    s390x:SunOS:*:*)
424d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
425d21ab8bcSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
426d21ab8bcSmrg	;;
4271f0ac6a5Smrg    sun4H:SunOS:5.*:*)
428d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
429d21ab8bcSmrg	GUESS=sparc-hal-solaris2$SUN_REL
430d21ab8bcSmrg	;;
4311f0ac6a5Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
432d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
433d21ab8bcSmrg	GUESS=sparc-sun-solaris2$SUN_REL
434d21ab8bcSmrg	;;
4359c9ff80cSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
436d21ab8bcSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
437d21ab8bcSmrg	;;
438e5410a46Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
439d21ab8bcSmrg	set_cc_for_build
440d21ab8bcSmrg	SUN_ARCH=i386
4419c9ff80cSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
4429c9ff80cSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4439c9ff80cSmrg	# This test works for both compilers.
444d21ab8bcSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
4459c9ff80cSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4466ee7d557Smrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
4479c9ff80cSmrg		grep IS_64BIT_ARCH >/dev/null
4489c9ff80cSmrg	    then
449d21ab8bcSmrg		SUN_ARCH=x86_64
4509c9ff80cSmrg	    fi
4519c9ff80cSmrg	fi
452d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
453d21ab8bcSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
454d21ab8bcSmrg	;;
4551f0ac6a5Smrg    sun4*:SunOS:6*:*)
4561f0ac6a5Smrg	# According to config.sub, this is the proper way to canonicalize
4571f0ac6a5Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4581f0ac6a5Smrg	# it's likely to be more like Solaris than SunOS4.
459d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
460d21ab8bcSmrg	GUESS=sparc-sun-solaris3$SUN_REL
461d21ab8bcSmrg	;;
4621f0ac6a5Smrg    sun4*:SunOS:*:*)
463d21ab8bcSmrg	case `/usr/bin/arch -k` in
4641f0ac6a5Smrg	    Series*|S4*)
4651f0ac6a5Smrg		UNAME_RELEASE=`uname -v`
4661f0ac6a5Smrg		;;
4671f0ac6a5Smrg	esac
4686ee7d557Smrg	# Japanese Language versions have a version number like '4.1.3-JL'.
469d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
470d21ab8bcSmrg	GUESS=sparc-sun-sunos$SUN_REL
471d21ab8bcSmrg	;;
4721f0ac6a5Smrg    sun3*:SunOS:*:*)
473d21ab8bcSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
474d21ab8bcSmrg	;;
4751f0ac6a5Smrg    sun*:*:4.2BSD:*)
4761f0ac6a5Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
477d21ab8bcSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
478d21ab8bcSmrg	case `/bin/arch` in
4791f0ac6a5Smrg	    sun3)
480d21ab8bcSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4811f0ac6a5Smrg		;;
4821f0ac6a5Smrg	    sun4)
483d21ab8bcSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4841f0ac6a5Smrg		;;
4851f0ac6a5Smrg	esac
486d21ab8bcSmrg	;;
4871f0ac6a5Smrg    aushp:SunOS:*:*)
488d21ab8bcSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
489d21ab8bcSmrg	;;
4901f0ac6a5Smrg    # The situation for MiNT is a little confusing.  The machine name
4911f0ac6a5Smrg    # can be virtually everything (everything which is not
4921f0ac6a5Smrg    # "atarist" or "atariste" at least should have a processor
4931f0ac6a5Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4941f0ac6a5Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4951f0ac6a5Smrg    # the system name "TOS" denotes a system which is actually not
4961f0ac6a5Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4971f0ac6a5Smrg    # be no problem.
4981f0ac6a5Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
499d21ab8bcSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500d21ab8bcSmrg	;;
5011f0ac6a5Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
502d21ab8bcSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
503d21ab8bcSmrg	;;
5041f0ac6a5Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
505d21ab8bcSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
506d21ab8bcSmrg	;;
5071f0ac6a5Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
508d21ab8bcSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
509d21ab8bcSmrg	;;
5101f0ac6a5Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
511d21ab8bcSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
512d21ab8bcSmrg	;;
5131f0ac6a5Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
514d21ab8bcSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
515d21ab8bcSmrg	;;
516e5410a46Smrg    m68k:machten:*:*)
517d21ab8bcSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
518d21ab8bcSmrg	;;
5191f0ac6a5Smrg    powerpc:machten:*:*)
520d21ab8bcSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
521d21ab8bcSmrg	;;
5221f0ac6a5Smrg    RISC*:Mach:*:*)
523d21ab8bcSmrg	GUESS=mips-dec-mach_bsd4.3
524d21ab8bcSmrg	;;
5251f0ac6a5Smrg    RISC*:ULTRIX:*:*)
526d21ab8bcSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
527d21ab8bcSmrg	;;
5281f0ac6a5Smrg    VAX*:ULTRIX*:*:*)
529d21ab8bcSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
530d21ab8bcSmrg	;;
5311f0ac6a5Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
532d21ab8bcSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
533d21ab8bcSmrg	;;
5341f0ac6a5Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
535d21ab8bcSmrg	set_cc_for_build
536d21ab8bcSmrg	sed 's/^	//' << EOF > "$dummy.c"
5371f0ac6a5Smrg#ifdef __cplusplus
5381f0ac6a5Smrg#include <stdio.h>  /* for printf() prototype */
5391f0ac6a5Smrg	int main (int argc, char *argv[]) {
5401f0ac6a5Smrg#else
5411f0ac6a5Smrg	int main (argc, argv) int argc; char *argv[]; {
5421f0ac6a5Smrg#endif
5431f0ac6a5Smrg	#if defined (host_mips) && defined (MIPSEB)
5441f0ac6a5Smrg	#if defined (SYSTYPE_SYSV)
545d21ab8bcSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5461f0ac6a5Smrg	#endif
5471f0ac6a5Smrg	#if defined (SYSTYPE_SVR4)
548d21ab8bcSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5491f0ac6a5Smrg	#endif
5501f0ac6a5Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
551d21ab8bcSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5521f0ac6a5Smrg	#endif
5531f0ac6a5Smrg	#endif
5541f0ac6a5Smrg	  exit (-1);
5551f0ac6a5Smrg	}
5561f0ac6a5SmrgEOF
557d21ab8bcSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
558d21ab8bcSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
559d21ab8bcSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
560e5410a46Smrg	    { echo "$SYSTEM_NAME"; exit; }
561d21ab8bcSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
562d21ab8bcSmrg	;;
5631f0ac6a5Smrg    Motorola:PowerMAX_OS:*:*)
564d21ab8bcSmrg	GUESS=powerpc-motorola-powermax
565d21ab8bcSmrg	;;
5661f0ac6a5Smrg    Motorola:*:4.3:PL8-*)
567d21ab8bcSmrg	GUESS=powerpc-harris-powermax
568d21ab8bcSmrg	;;
5691f0ac6a5Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
570d21ab8bcSmrg	GUESS=powerpc-harris-powermax
571d21ab8bcSmrg	;;
5721f0ac6a5Smrg    Night_Hawk:Power_UNIX:*:*)
573d21ab8bcSmrg	GUESS=powerpc-harris-powerunix
574d21ab8bcSmrg	;;
5751f0ac6a5Smrg    m88k:CX/UX:7*:*)
576d21ab8bcSmrg	GUESS=m88k-harris-cxux7
577d21ab8bcSmrg	;;
5781f0ac6a5Smrg    m88k:*:4*:R4*)
579d21ab8bcSmrg	GUESS=m88k-motorola-sysv4
580d21ab8bcSmrg	;;
5811f0ac6a5Smrg    m88k:*:3*:R3*)
582d21ab8bcSmrg	GUESS=m88k-motorola-sysv3
583d21ab8bcSmrg	;;
5841f0ac6a5Smrg    AViiON:dgux:*:*)
58589c04b6cSmrg	# DG/UX returns AViiON for all architectures
58689c04b6cSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
587d21ab8bcSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5881f0ac6a5Smrg	then
589d21ab8bcSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
590d21ab8bcSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
5911f0ac6a5Smrg	    then
592d21ab8bcSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5931f0ac6a5Smrg	    else
594d21ab8bcSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5951f0ac6a5Smrg	    fi
5961f0ac6a5Smrg	else
597d21ab8bcSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5981f0ac6a5Smrg	fi
599d21ab8bcSmrg	;;
6001f0ac6a5Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
601d21ab8bcSmrg	GUESS=m88k-dolphin-sysv3
602d21ab8bcSmrg	;;
6031f0ac6a5Smrg    M88*:*:R3*:*)
6041f0ac6a5Smrg	# Delta 88k system running SVR3
605d21ab8bcSmrg	GUESS=m88k-motorola-sysv3
606d21ab8bcSmrg	;;
6071f0ac6a5Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
608d21ab8bcSmrg	GUESS=m88k-tektronix-sysv3
609d21ab8bcSmrg	;;
6101f0ac6a5Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
611d21ab8bcSmrg	GUESS=m68k-tektronix-bsd
612d21ab8bcSmrg	;;
6131f0ac6a5Smrg    *:IRIX*:*:*)
614d21ab8bcSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
615d21ab8bcSmrg	GUESS=mips-sgi-irix$IRIX_REL
616d21ab8bcSmrg	;;
6171f0ac6a5Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
618d21ab8bcSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
619d21ab8bcSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6201f0ac6a5Smrg    i*86:AIX:*:*)
621d21ab8bcSmrg	GUESS=i386-ibm-aix
622d21ab8bcSmrg	;;
6231f0ac6a5Smrg    ia64:AIX:*:*)
624d21ab8bcSmrg	if test -x /usr/bin/oslevel ; then
6251f0ac6a5Smrg		IBM_REV=`/usr/bin/oslevel`
6261f0ac6a5Smrg	else
627d21ab8bcSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6281f0ac6a5Smrg	fi
629d21ab8bcSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
630d21ab8bcSmrg	;;
6311f0ac6a5Smrg    *:AIX:2:3)
6321f0ac6a5Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
633d21ab8bcSmrg		set_cc_for_build
634d21ab8bcSmrg		sed 's/^		//' << EOF > "$dummy.c"
6351f0ac6a5Smrg		#include <sys/systemcfg.h>
6361f0ac6a5Smrg
6371f0ac6a5Smrg		main()
6381f0ac6a5Smrg			{
6391f0ac6a5Smrg			if (!__power_pc())
6401f0ac6a5Smrg				exit(1);
6411f0ac6a5Smrg			puts("powerpc-ibm-aix3.2.5");
6421f0ac6a5Smrg			exit(0);
6431f0ac6a5Smrg			}
6441f0ac6a5SmrgEOF
645d21ab8bcSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
646e5410a46Smrg		then
647d21ab8bcSmrg			GUESS=$SYSTEM_NAME
648e5410a46Smrg		else
649d21ab8bcSmrg			GUESS=rs6000-ibm-aix3.2.5
650e5410a46Smrg		fi
6511f0ac6a5Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
652d21ab8bcSmrg		GUESS=rs6000-ibm-aix3.2.4
6531f0ac6a5Smrg	else
654d21ab8bcSmrg		GUESS=rs6000-ibm-aix3.2
6551f0ac6a5Smrg	fi
656d21ab8bcSmrg	;;
6576fae4e5dSmrg    *:AIX:*:[4567])
6581f0ac6a5Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
659d21ab8bcSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6601f0ac6a5Smrg		IBM_ARCH=rs6000
6611f0ac6a5Smrg	else
6621f0ac6a5Smrg		IBM_ARCH=powerpc
6631f0ac6a5Smrg	fi
664d21ab8bcSmrg	if test -x /usr/bin/lslpp ; then
665d21ab8bcSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
666d21ab8bcSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6671f0ac6a5Smrg	else
668d21ab8bcSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6691f0ac6a5Smrg	fi
670d21ab8bcSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
671d21ab8bcSmrg	;;
6721f0ac6a5Smrg    *:AIX:*:*)
673d21ab8bcSmrg	GUESS=rs6000-ibm-aix
674d21ab8bcSmrg	;;
675d21ab8bcSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
676d21ab8bcSmrg	GUESS=romp-ibm-bsd4.4
677d21ab8bcSmrg	;;
6781f0ac6a5Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
679d21ab8bcSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
680d21ab8bcSmrg	;;                                  # report: romp-ibm BSD 4.3
6811f0ac6a5Smrg    *:BOSX:*:*)
682d21ab8bcSmrg	GUESS=rs6000-bull-bosx
683d21ab8bcSmrg	;;
6841f0ac6a5Smrg    DPX/2?00:B.O.S.:*:*)
685d21ab8bcSmrg	GUESS=m68k-bull-sysv3
686d21ab8bcSmrg	;;
6871f0ac6a5Smrg    9000/[34]??:4.3bsd:1.*:*)
688d21ab8bcSmrg	GUESS=m68k-hp-bsd
689d21ab8bcSmrg	;;
6901f0ac6a5Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
691d21ab8bcSmrg	GUESS=m68k-hp-bsd4.4
692d21ab8bcSmrg	;;
6931f0ac6a5Smrg    9000/[34678]??:HP-UX:*:*)
694d21ab8bcSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
695d21ab8bcSmrg	case $UNAME_MACHINE in
696d21ab8bcSmrg	    9000/31?)            HP_ARCH=m68000 ;;
697d21ab8bcSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6981f0ac6a5Smrg	    9000/[678][0-9][0-9])
699d21ab8bcSmrg		if test -x /usr/bin/getconf; then
7001f0ac6a5Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
70189c04b6cSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
702d21ab8bcSmrg		    case $sc_cpu_version in
703d21ab8bcSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
704d21ab8bcSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
70589c04b6cSmrg		      532)                      # CPU_PA_RISC2_0
706d21ab8bcSmrg			case $sc_kernel_bits in
707d21ab8bcSmrg			  32) HP_ARCH=hppa2.0n ;;
708d21ab8bcSmrg			  64) HP_ARCH=hppa2.0w ;;
709d21ab8bcSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
71089c04b6cSmrg			esac ;;
71189c04b6cSmrg		    esac
7121f0ac6a5Smrg		fi
713d21ab8bcSmrg		if test "$HP_ARCH" = ""; then
714d21ab8bcSmrg		    set_cc_for_build
715d21ab8bcSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7161f0ac6a5Smrg
71789c04b6cSmrg		#define _HPUX_SOURCE
71889c04b6cSmrg		#include <stdlib.h>
71989c04b6cSmrg		#include <unistd.h>
7201f0ac6a5Smrg
72189c04b6cSmrg		int main ()
72289c04b6cSmrg		{
72389c04b6cSmrg		#if defined(_SC_KERNEL_BITS)
72489c04b6cSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
72589c04b6cSmrg		#endif
72689c04b6cSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7271f0ac6a5Smrg
72889c04b6cSmrg		    switch (cpu)
72989c04b6cSmrg			{
73089c04b6cSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
73189c04b6cSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
73289c04b6cSmrg			case CPU_PA_RISC2_0:
73389c04b6cSmrg		#if defined(_SC_KERNEL_BITS)
73489c04b6cSmrg			    switch (bits)
73589c04b6cSmrg				{
73689c04b6cSmrg				case 64: puts ("hppa2.0w"); break;
73789c04b6cSmrg				case 32: puts ("hppa2.0n"); break;
73889c04b6cSmrg				default: puts ("hppa2.0"); break;
73989c04b6cSmrg				} break;
74089c04b6cSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
74189c04b6cSmrg			    puts ("hppa2.0"); break;
74289c04b6cSmrg		#endif
74389c04b6cSmrg			default: puts ("hppa1.0"); break;
74489c04b6cSmrg			}
74589c04b6cSmrg		    exit (0);
74689c04b6cSmrg		}
7471f0ac6a5SmrgEOF
748d21ab8bcSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7491f0ac6a5Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7501f0ac6a5Smrg		fi ;;
7511f0ac6a5Smrg	esac
752d21ab8bcSmrg	if test "$HP_ARCH" = hppa2.0w
7531f0ac6a5Smrg	then
754d21ab8bcSmrg	    set_cc_for_build
755e5410a46Smrg
756e5410a46Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
757e5410a46Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
758e5410a46Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
759e5410a46Smrg	    #
760e5410a46Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
761e5410a46Smrg	    # => hppa2.0w-hp-hpux11.23
762e5410a46Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
763e5410a46Smrg	    # => hppa64-hp-hpux11.23
764e5410a46Smrg
765d21ab8bcSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7669c9ff80cSmrg		grep -q __LP64__
7671f0ac6a5Smrg	    then
768d21ab8bcSmrg		HP_ARCH=hppa2.0w
7691f0ac6a5Smrg	    else
770d21ab8bcSmrg		HP_ARCH=hppa64
7711f0ac6a5Smrg	    fi
7721f0ac6a5Smrg	fi
773d21ab8bcSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
774d21ab8bcSmrg	;;
7751f0ac6a5Smrg    ia64:HP-UX:*:*)
776d21ab8bcSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
777d21ab8bcSmrg	GUESS=ia64-hp-hpux$HPUX_REV
778d21ab8bcSmrg	;;
7791f0ac6a5Smrg    3050*:HI-UX:*:*)
780d21ab8bcSmrg	set_cc_for_build
781d21ab8bcSmrg	sed 's/^	//' << EOF > "$dummy.c"
7821f0ac6a5Smrg	#include <unistd.h>
7831f0ac6a5Smrg	int
7841f0ac6a5Smrg	main ()
7851f0ac6a5Smrg	{
7861f0ac6a5Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7871f0ac6a5Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7881f0ac6a5Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7891f0ac6a5Smrg	     results, however.  */
7901f0ac6a5Smrg	  if (CPU_IS_PA_RISC (cpu))
7911f0ac6a5Smrg	    {
7921f0ac6a5Smrg	      switch (cpu)
7931f0ac6a5Smrg		{
7941f0ac6a5Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7951f0ac6a5Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7961f0ac6a5Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7971f0ac6a5Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7981f0ac6a5Smrg		}
7991f0ac6a5Smrg	    }
8001f0ac6a5Smrg	  else if (CPU_IS_HP_MC68K (cpu))
8011f0ac6a5Smrg	    puts ("m68k-hitachi-hiuxwe2");
8021f0ac6a5Smrg	  else puts ("unknown-hitachi-hiuxwe2");
8031f0ac6a5Smrg	  exit (0);
8041f0ac6a5Smrg	}
8051f0ac6a5SmrgEOF
806d21ab8bcSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
807e5410a46Smrg		{ echo "$SYSTEM_NAME"; exit; }
808d21ab8bcSmrg	GUESS=unknown-hitachi-hiuxwe2
809d21ab8bcSmrg	;;
810d21ab8bcSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
811d21ab8bcSmrg	GUESS=hppa1.1-hp-bsd
812d21ab8bcSmrg	;;
8131f0ac6a5Smrg    9000/8??:4.3bsd:*:*)
814d21ab8bcSmrg	GUESS=hppa1.0-hp-bsd
815d21ab8bcSmrg	;;
8161f0ac6a5Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
817d21ab8bcSmrg	GUESS=hppa1.0-hp-mpeix
818d21ab8bcSmrg	;;
819d21ab8bcSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
820d21ab8bcSmrg	GUESS=hppa1.1-hp-osf
821d21ab8bcSmrg	;;
8221f0ac6a5Smrg    hp8??:OSF1:*:*)
823d21ab8bcSmrg	GUESS=hppa1.0-hp-osf
824d21ab8bcSmrg	;;
8251f0ac6a5Smrg    i*86:OSF1:*:*)
826d21ab8bcSmrg	if test -x /usr/sbin/sysversion ; then
827d21ab8bcSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8281f0ac6a5Smrg	else
829d21ab8bcSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8301f0ac6a5Smrg	fi
831d21ab8bcSmrg	;;
8321f0ac6a5Smrg    parisc*:Lites*:*:*)
833d21ab8bcSmrg	GUESS=hppa1.1-hp-lites
834d21ab8bcSmrg	;;
8351f0ac6a5Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
836d21ab8bcSmrg	GUESS=c1-convex-bsd
837d21ab8bcSmrg	;;
8381f0ac6a5Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8391f0ac6a5Smrg	if getsysinfo -f scalar_acc
8401f0ac6a5Smrg	then echo c32-convex-bsd
8411f0ac6a5Smrg	else echo c2-convex-bsd
8421f0ac6a5Smrg	fi
84389c04b6cSmrg	exit ;;
8441f0ac6a5Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
845d21ab8bcSmrg	GUESS=c34-convex-bsd
846d21ab8bcSmrg	;;
8471f0ac6a5Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
848d21ab8bcSmrg	GUESS=c38-convex-bsd
849d21ab8bcSmrg	;;
8501f0ac6a5Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
851d21ab8bcSmrg	GUESS=c4-convex-bsd
852d21ab8bcSmrg	;;
8531f0ac6a5Smrg    CRAY*Y-MP:*:*:*)
854d21ab8bcSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
855d21ab8bcSmrg	GUESS=ymp-cray-unicos$CRAY_REL
856d21ab8bcSmrg	;;
8571f0ac6a5Smrg    CRAY*[A-Z]90:*:*:*)
858d21ab8bcSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8591f0ac6a5Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8601f0ac6a5Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8611f0ac6a5Smrg	      -e 's/\.[^.]*$/.X/'
862e5410a46Smrg	exit ;;
8631f0ac6a5Smrg    CRAY*TS:*:*:*)
864d21ab8bcSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
865d21ab8bcSmrg	GUESS=t90-cray-unicos$CRAY_REL
866d21ab8bcSmrg	;;
8671f0ac6a5Smrg    CRAY*T3E:*:*:*)
868d21ab8bcSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
869d21ab8bcSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
870d21ab8bcSmrg	;;
8711f0ac6a5Smrg    CRAY*SV1:*:*:*)
872d21ab8bcSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
873d21ab8bcSmrg	GUESS=sv1-cray-unicos$CRAY_REL
874d21ab8bcSmrg	;;
8751f0ac6a5Smrg    *:UNICOS/mp:*:*)
876d21ab8bcSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
877d21ab8bcSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
878d21ab8bcSmrg	;;
8791f0ac6a5Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
880d21ab8bcSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
881d21ab8bcSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
882d21ab8bcSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
883d21ab8bcSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
884d21ab8bcSmrg	;;
885e5410a46Smrg    5000:UNIX_System_V:4.*:*)
886d21ab8bcSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
887d21ab8bcSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
888d21ab8bcSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
889d21ab8bcSmrg	;;
8901f0ac6a5Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
891d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
892d21ab8bcSmrg	;;
8931f0ac6a5Smrg    sparc*:BSD/OS:*:*)
894d21ab8bcSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
895d21ab8bcSmrg	;;
8961f0ac6a5Smrg    *:BSD/OS:*:*)
897d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
898d21ab8bcSmrg	;;
899d21ab8bcSmrg    arm:FreeBSD:*:*)
900d21ab8bcSmrg	UNAME_PROCESSOR=`uname -p`
901d21ab8bcSmrg	set_cc_for_build
902d21ab8bcSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
903d21ab8bcSmrg	    | grep -q __ARM_PCS_VFP
904d21ab8bcSmrg	then
905d21ab8bcSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
906d21ab8bcSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
907d21ab8bcSmrg	else
908d21ab8bcSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
909d21ab8bcSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
910d21ab8bcSmrg	fi
911d21ab8bcSmrg	;;
912e5410a46Smrg    *:FreeBSD:*:*)
9136ee7d557Smrg	UNAME_PROCESSOR=`uname -p`
914d21ab8bcSmrg	case $UNAME_PROCESSOR in
915e5410a46Smrg	    amd64)
916d21ab8bcSmrg		UNAME_PROCESSOR=x86_64 ;;
917d21ab8bcSmrg	    i386)
918d21ab8bcSmrg		UNAME_PROCESSOR=i586 ;;
919e5410a46Smrg	esac
920d21ab8bcSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
921d21ab8bcSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
922d21ab8bcSmrg	;;
9231f0ac6a5Smrg    i*:CYGWIN*:*)
924d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
925d21ab8bcSmrg	;;
92689c04b6cSmrg    *:MINGW64*:*)
927d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
928d21ab8bcSmrg	;;
929e5410a46Smrg    *:MINGW*:*)
930d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
931d21ab8bcSmrg	;;
932d21ab8bcSmrg    *:MSYS*:*)
933d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-msys
934d21ab8bcSmrg	;;
9351f0ac6a5Smrg    i*:PW*:*)
936d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-pw32
937d21ab8bcSmrg	;;
9386ee7d557Smrg    *:SerenityOS:*:*)
9396ee7d557Smrg        GUESS=$UNAME_MACHINE-pc-serenity
9406ee7d557Smrg        ;;
9419c9ff80cSmrg    *:Interix*:*)
942d21ab8bcSmrg	case $UNAME_MACHINE in
943e5410a46Smrg	    x86)
944d21ab8bcSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
945d21ab8bcSmrg		;;
9469c9ff80cSmrg	    authenticamd | genuineintel | EM64T)
947d21ab8bcSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
948d21ab8bcSmrg		;;
949e5410a46Smrg	    IA64)
950d21ab8bcSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
951d21ab8bcSmrg		;;
952e5410a46Smrg	esac ;;
9531f0ac6a5Smrg    i*:UWIN*:*)
954d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-uwin
955d21ab8bcSmrg	;;
956e5410a46Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
957d21ab8bcSmrg	GUESS=x86_64-pc-cygwin
958d21ab8bcSmrg	;;
9591f0ac6a5Smrg    prep*:SunOS:5.*:*)
960d21ab8bcSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
961d21ab8bcSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
962d21ab8bcSmrg	;;
9631f0ac6a5Smrg    *:GNU:*:*)
964e5410a46Smrg	# the GNU system
965d21ab8bcSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
966d21ab8bcSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
967d21ab8bcSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
968d21ab8bcSmrg	;;
969e5410a46Smrg    *:GNU/*:*:*)
970e5410a46Smrg	# other systems with GNU libc and userland
971d21ab8bcSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
972d21ab8bcSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
973d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
974d21ab8bcSmrg	;;
9756ee7d557Smrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
9766ee7d557Smrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
9776ee7d557Smrg	;;
9786ee7d557Smrg    *:[Mm]anagarm:*:*)
9796ee7d557Smrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
9806ee7d557Smrg	;;
981d21ab8bcSmrg    *:Minix:*:*)
982d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-minix
983d21ab8bcSmrg	;;
98489c04b6cSmrg    aarch64:Linux:*:*)
9856ee7d557Smrg	set_cc_for_build
9866ee7d557Smrg	CPU=$UNAME_MACHINE
9876ee7d557Smrg	LIBCABI=$LIBC
9886ee7d557Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
9896ee7d557Smrg	    ABI=64
9906ee7d557Smrg	    sed 's/^	    //' << EOF > "$dummy.c"
9916ee7d557Smrg	    #ifdef __ARM_EABI__
9926ee7d557Smrg	    #ifdef __ARM_PCS_VFP
9936ee7d557Smrg	    ABI=eabihf
9946ee7d557Smrg	    #else
9956ee7d557Smrg	    ABI=eabi
9966ee7d557Smrg	    #endif
9976ee7d557Smrg	    #endif
9986ee7d557SmrgEOF
9996ee7d557Smrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
10006ee7d557Smrg	    eval "$cc_set_abi"
10016ee7d557Smrg	    case $ABI in
10026ee7d557Smrg		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
10036ee7d557Smrg	    esac
10046ee7d557Smrg	fi
10056ee7d557Smrg	GUESS=$CPU-unknown-linux-$LIBCABI
1006d21ab8bcSmrg	;;
100789c04b6cSmrg    aarch64_be:Linux:*:*)
100889c04b6cSmrg	UNAME_MACHINE=aarch64_be
1009d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1010d21ab8bcSmrg	;;
10119c9ff80cSmrg    alpha:Linux:*:*)
1012d21ab8bcSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
10139c9ff80cSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
10149c9ff80cSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
10159c9ff80cSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
10169c9ff80cSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
10179c9ff80cSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
10189c9ff80cSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
10199c9ff80cSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
102089c04b6cSmrg	esac
10219c9ff80cSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
1022d21ab8bcSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
1023d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1024d21ab8bcSmrg	;;
1025d21ab8bcSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1026d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1027d21ab8bcSmrg	;;
10281f0ac6a5Smrg    arm*:Linux:*:*)
1029d21ab8bcSmrg	set_cc_for_build
1030e5410a46Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1031e5410a46Smrg	    | grep -q __ARM_EABI__
1032e5410a46Smrg	then
1033d21ab8bcSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1034e5410a46Smrg	else
103589c04b6cSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
103689c04b6cSmrg		| grep -q __ARM_PCS_VFP
103789c04b6cSmrg	    then
1038d21ab8bcSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
103989c04b6cSmrg	    else
1040d21ab8bcSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
104189c04b6cSmrg	    fi
1042e5410a46Smrg	fi
1043d21ab8bcSmrg	;;
1044e5410a46Smrg    avr32*:Linux:*:*)
1045d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1046d21ab8bcSmrg	;;
10471f0ac6a5Smrg    cris:Linux:*:*)
1048d21ab8bcSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1049d21ab8bcSmrg	;;
1050e5410a46Smrg    crisv32:Linux:*:*)
1051d21ab8bcSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1052d21ab8bcSmrg	;;
1053d21ab8bcSmrg    e2k:Linux:*:*)
1054d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1055d21ab8bcSmrg	;;
1056e5410a46Smrg    frv:Linux:*:*)
1057d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1058d21ab8bcSmrg	;;
105989c04b6cSmrg    hexagon:Linux:*:*)
1060d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1061d21ab8bcSmrg	;;
10629c9ff80cSmrg    i*86:Linux:*:*)
1063d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1064d21ab8bcSmrg	;;
10651f0ac6a5Smrg    ia64:Linux:*:*)
1066d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1067d21ab8bcSmrg	;;
1068d21ab8bcSmrg    k1om:Linux:*:*)
1069d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1070d21ab8bcSmrg	;;
10716ee7d557Smrg    kvx:Linux:*:*)
10726ee7d557Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10736ee7d557Smrg	;;
10746ee7d557Smrg    kvx:cos:*:*)
10756ee7d557Smrg	GUESS=$UNAME_MACHINE-unknown-cos
10766ee7d557Smrg	;;
10776ee7d557Smrg    kvx:mbr:*:*)
10786ee7d557Smrg	GUESS=$UNAME_MACHINE-unknown-mbr
10796ee7d557Smrg	;;
10806ee7d557Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1081d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1082d21ab8bcSmrg	;;
1083e5410a46Smrg    m32r*:Linux:*:*)
1084d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1085d21ab8bcSmrg	;;
10861f0ac6a5Smrg    m68*:Linux:*:*)
1087d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1088d21ab8bcSmrg	;;
10899c9ff80cSmrg    mips:Linux:*:* | mips64:Linux:*:*)
1090d21ab8bcSmrg	set_cc_for_build
1091d21ab8bcSmrg	IS_GLIBC=0
1092d21ab8bcSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1093d21ab8bcSmrg	sed 's/^	//' << EOF > "$dummy.c"
10941f0ac6a5Smrg	#undef CPU
1095d21ab8bcSmrg	#undef mips
1096d21ab8bcSmrg	#undef mipsel
1097d21ab8bcSmrg	#undef mips64
1098d21ab8bcSmrg	#undef mips64el
1099d21ab8bcSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1100d21ab8bcSmrg	LIBCABI=gnuabi64
1101d21ab8bcSmrg	#else
1102d21ab8bcSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1103d21ab8bcSmrg	LIBCABI=gnuabin32
1104d21ab8bcSmrg	#else
1105d21ab8bcSmrg	LIBCABI=${LIBC}
1106d21ab8bcSmrg	#endif
1107d21ab8bcSmrg	#endif
1108d21ab8bcSmrg
1109d21ab8bcSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1110d21ab8bcSmrg	CPU=mipsisa64r6
1111d21ab8bcSmrg	#else
1112d21ab8bcSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1113d21ab8bcSmrg	CPU=mipsisa32r6
1114d21ab8bcSmrg	#else
1115d21ab8bcSmrg	#if defined(__mips64)
1116d21ab8bcSmrg	CPU=mips64
1117d21ab8bcSmrg	#else
1118d21ab8bcSmrg	CPU=mips
1119d21ab8bcSmrg	#endif
1120d21ab8bcSmrg	#endif
1121d21ab8bcSmrg	#endif
1122d21ab8bcSmrg
11231f0ac6a5Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1124d21ab8bcSmrg	MIPS_ENDIAN=el
11251f0ac6a5Smrg	#else
11261f0ac6a5Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1127d21ab8bcSmrg	MIPS_ENDIAN=
11281f0ac6a5Smrg	#else
1129d21ab8bcSmrg	MIPS_ENDIAN=
11301f0ac6a5Smrg	#endif
11311f0ac6a5Smrg	#endif
11321f0ac6a5SmrgEOF
1133d21ab8bcSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1134d21ab8bcSmrg	eval "$cc_set_vars"
1135d21ab8bcSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1136d21ab8bcSmrg	;;
1137d21ab8bcSmrg    mips64el:Linux:*:*)
1138d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139d21ab8bcSmrg	;;
1140d21ab8bcSmrg    openrisc*:Linux:*:*)
1141d21ab8bcSmrg	GUESS=or1k-unknown-linux-$LIBC
1142d21ab8bcSmrg	;;
1143d21ab8bcSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1144d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11451f0ac6a5Smrg	;;
11469c9ff80cSmrg    padre:Linux:*:*)
1147d21ab8bcSmrg	GUESS=sparc-unknown-linux-$LIBC
1148d21ab8bcSmrg	;;
11499c9ff80cSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1150d21ab8bcSmrg	GUESS=hppa64-unknown-linux-$LIBC
1151d21ab8bcSmrg	;;
11521f0ac6a5Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
11531f0ac6a5Smrg	# Look for CPU level
11541f0ac6a5Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1155d21ab8bcSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1156d21ab8bcSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1157d21ab8bcSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11581f0ac6a5Smrg	esac
1159d21ab8bcSmrg	;;
11609c9ff80cSmrg    ppc64:Linux:*:*)
1161d21ab8bcSmrg	GUESS=powerpc64-unknown-linux-$LIBC
1162d21ab8bcSmrg	;;
11639c9ff80cSmrg    ppc:Linux:*:*)
1164d21ab8bcSmrg	GUESS=powerpc-unknown-linux-$LIBC
1165d21ab8bcSmrg	;;
1166b9867631Smrg    ppc64le:Linux:*:*)
1167d21ab8bcSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
1168d21ab8bcSmrg	;;
1169b9867631Smrg    ppcle:Linux:*:*)
1170d21ab8bcSmrg	GUESS=powerpcle-unknown-linux-$LIBC
1171d21ab8bcSmrg	;;
1172d21ab8bcSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1173d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1174d21ab8bcSmrg	;;
11751f0ac6a5Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1176d21ab8bcSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1177d21ab8bcSmrg	;;
11781f0ac6a5Smrg    sh64*:Linux:*:*)
1179d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1180d21ab8bcSmrg	;;
11811f0ac6a5Smrg    sh*:Linux:*:*)
1182d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1183d21ab8bcSmrg	;;
11841f0ac6a5Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1185d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1186d21ab8bcSmrg	;;
11876fae4e5dSmrg    tile*:Linux:*:*)
1188d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1189d21ab8bcSmrg	;;
1190e5410a46Smrg    vax:Linux:*:*)
1191d21ab8bcSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1192d21ab8bcSmrg	;;
11931f0ac6a5Smrg    x86_64:Linux:*:*)
1194d21ab8bcSmrg	set_cc_for_build
11956ee7d557Smrg	CPU=$UNAME_MACHINE
1196d21ab8bcSmrg	LIBCABI=$LIBC
1197d21ab8bcSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11986ee7d557Smrg	    ABI=64
11996ee7d557Smrg	    sed 's/^	    //' << EOF > "$dummy.c"
12006ee7d557Smrg	    #ifdef __i386__
12016ee7d557Smrg	    ABI=x86
12026ee7d557Smrg	    #else
12036ee7d557Smrg	    #ifdef __ILP32__
12046ee7d557Smrg	    ABI=x32
12056ee7d557Smrg	    #endif
12066ee7d557Smrg	    #endif
12076ee7d557SmrgEOF
12086ee7d557Smrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
12096ee7d557Smrg	    eval "$cc_set_abi"
12106ee7d557Smrg	    case $ABI in
12116ee7d557Smrg		x86) CPU=i686 ;;
12126ee7d557Smrg		x32) LIBCABI=${LIBC}x32 ;;
12136ee7d557Smrg	    esac
1214d21ab8bcSmrg	fi
12156ee7d557Smrg	GUESS=$CPU-pc-linux-$LIBCABI
1216d21ab8bcSmrg	;;
1217e5410a46Smrg    xtensa*:Linux:*:*)
1218d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1219d21ab8bcSmrg	;;
12201f0ac6a5Smrg    i*86:DYNIX/ptx:4*:*)
12211f0ac6a5Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
12221f0ac6a5Smrg	# earlier versions are messed up and put the nodename in both
12231f0ac6a5Smrg	# sysname and nodename.
1224d21ab8bcSmrg	GUESS=i386-sequent-sysv4
1225d21ab8bcSmrg	;;
12261f0ac6a5Smrg    i*86:UNIX_SV:4.2MP:2.*)
122789c04b6cSmrg	# Unixware is an offshoot of SVR4, but it has its own version
122889c04b6cSmrg	# number series starting with 2...
122989c04b6cSmrg	# I am not positive that other SVR4 systems won't match this,
12301f0ac6a5Smrg	# I just have to hope.  -- rms.
123189c04b6cSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1232d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1233d21ab8bcSmrg	;;
12341f0ac6a5Smrg    i*86:OS/2:*:*)
12356ee7d557Smrg	# If we were able to find 'uname', then EMX Unix compatibility
12361f0ac6a5Smrg	# is probably installed.
1237d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1238d21ab8bcSmrg	;;
12391f0ac6a5Smrg    i*86:XTS-300:*:STOP)
1240d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-stop
1241d21ab8bcSmrg	;;
12421f0ac6a5Smrg    i*86:atheos:*:*)
1243d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
1244d21ab8bcSmrg	;;
1245e5410a46Smrg    i*86:syllable:*:*)
1246d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-syllable
1247d21ab8bcSmrg	;;
12489c9ff80cSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1249d21ab8bcSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1250d21ab8bcSmrg	;;
12511f0ac6a5Smrg    i*86:*DOS:*:*)
1252d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1253d21ab8bcSmrg	;;
1254d21ab8bcSmrg    i*86:*:4.*:*)
1255d21ab8bcSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12561f0ac6a5Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1257d21ab8bcSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12581f0ac6a5Smrg	else
1259d21ab8bcSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12601f0ac6a5Smrg	fi
1261d21ab8bcSmrg	;;
1262e5410a46Smrg    i*86:*:5:[678]*)
126389c04b6cSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12641f0ac6a5Smrg	case `/bin/uname -X | grep "^Machine"` in
12651f0ac6a5Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
12661f0ac6a5Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12671f0ac6a5Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12681f0ac6a5Smrg	esac
1269d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1270d21ab8bcSmrg	;;
12711f0ac6a5Smrg    i*86:*:3.2:*)
12721f0ac6a5Smrg	if test -f /usr/options/cb.name; then
12731f0ac6a5Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1274d21ab8bcSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12751f0ac6a5Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12761f0ac6a5Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12771f0ac6a5Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12781f0ac6a5Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12791f0ac6a5Smrg			&& UNAME_MACHINE=i586
12801f0ac6a5Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12811f0ac6a5Smrg			&& UNAME_MACHINE=i686
12821f0ac6a5Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12831f0ac6a5Smrg			&& UNAME_MACHINE=i686
1284d21ab8bcSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12851f0ac6a5Smrg	else
1286d21ab8bcSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
12871f0ac6a5Smrg	fi
1288d21ab8bcSmrg	;;
12891f0ac6a5Smrg    pc:*:*:*)
12901f0ac6a5Smrg	# Left here for compatibility:
129189c04b6cSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
129289c04b6cSmrg	# the processor, so we play safe by assuming i586.
12939c9ff80cSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1294d21ab8bcSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
12959c9ff80cSmrg	# this is a cross-build.
1296d21ab8bcSmrg	GUESS=i586-pc-msdosdjgpp
1297d21ab8bcSmrg	;;
12981f0ac6a5Smrg    Intel:Mach:3*:*)
1299d21ab8bcSmrg	GUESS=i386-pc-mach3
1300d21ab8bcSmrg	;;
13011f0ac6a5Smrg    paragon:*:*:*)
1302d21ab8bcSmrg	GUESS=i860-intel-osf1
1303d21ab8bcSmrg	;;
13041f0ac6a5Smrg    i860:*:4.*:*) # i860-SVR4
13051f0ac6a5Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1306d21ab8bcSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
13071f0ac6a5Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1308d21ab8bcSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
13091f0ac6a5Smrg	fi
1310d21ab8bcSmrg	;;
13111f0ac6a5Smrg    mini*:CTIX:SYS*5:*)
13121f0ac6a5Smrg	# "miniframe"
1313d21ab8bcSmrg	GUESS=m68010-convergent-sysv
1314d21ab8bcSmrg	;;
13151f0ac6a5Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1316d21ab8bcSmrg	GUESS=m68k-convergent-sysv
1317d21ab8bcSmrg	;;
13181f0ac6a5Smrg    M680?0:D-NIX:5.3:*)
1319d21ab8bcSmrg	GUESS=m68k-diab-dnix
1320d21ab8bcSmrg	;;
1321e5410a46Smrg    M68*:*:R3V[5678]*:*)
1322e5410a46Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1323e5410a46Smrg    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)
13241f0ac6a5Smrg	OS_REL=''
13251f0ac6a5Smrg	test -r /etc/.relid \
13261f0ac6a5Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
13271f0ac6a5Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1328d21ab8bcSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
13291f0ac6a5Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1330d21ab8bcSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13311f0ac6a5Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
133289c04b6cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
133389c04b6cSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
13349c9ff80cSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
13359c9ff80cSmrg	OS_REL='.3'
13369c9ff80cSmrg	test -r /etc/.relid \
13379c9ff80cSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
13389c9ff80cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1339d21ab8bcSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
13409c9ff80cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1341d21ab8bcSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
13429c9ff80cSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1343d21ab8bcSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13441f0ac6a5Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1345d21ab8bcSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1346d21ab8bcSmrg	;;
13471f0ac6a5Smrg    mc68030:UNIX_System_V:4.*:*)
1348d21ab8bcSmrg	GUESS=m68k-atari-sysv4
1349d21ab8bcSmrg	;;
13501f0ac6a5Smrg    TSUNAMI:LynxOS:2.*:*)
1351d21ab8bcSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1352d21ab8bcSmrg	;;
13531f0ac6a5Smrg    rs6000:LynxOS:2.*:*)
1354d21ab8bcSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1355d21ab8bcSmrg	;;
13569c9ff80cSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1357d21ab8bcSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1358d21ab8bcSmrg	;;
13591f0ac6a5Smrg    SM[BE]S:UNIX_SV:*:*)
1360d21ab8bcSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1361d21ab8bcSmrg	;;
13621f0ac6a5Smrg    RM*:ReliantUNIX-*:*:*)
1363d21ab8bcSmrg	GUESS=mips-sni-sysv4
1364d21ab8bcSmrg	;;
13651f0ac6a5Smrg    RM*:SINIX-*:*:*)
1366d21ab8bcSmrg	GUESS=mips-sni-sysv4
1367d21ab8bcSmrg	;;
13681f0ac6a5Smrg    *:SINIX-*:*:*)
13691f0ac6a5Smrg	if uname -p 2>/dev/null >/dev/null ; then
13701f0ac6a5Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1371d21ab8bcSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
13721f0ac6a5Smrg	else
1373d21ab8bcSmrg		GUESS=ns32k-sni-sysv
13741f0ac6a5Smrg	fi
1375d21ab8bcSmrg	;;
13766ee7d557Smrg    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
137789c04b6cSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1378d21ab8bcSmrg	GUESS=i586-unisys-sysv4
1379d21ab8bcSmrg	;;
13801f0ac6a5Smrg    *:UNIX_System_V:4*:FTX*)
13811f0ac6a5Smrg	# From Gerald Hewes <hewes@openmarket.com>.
13821f0ac6a5Smrg	# How about differentiating between stratus architectures? -djm
1383d21ab8bcSmrg	GUESS=hppa1.1-stratus-sysv4
1384d21ab8bcSmrg	;;
13851f0ac6a5Smrg    *:*:*:FTX*)
13861f0ac6a5Smrg	# From seanf@swdc.stratus.com.
1387d21ab8bcSmrg	GUESS=i860-stratus-sysv4
1388d21ab8bcSmrg	;;
1389e5410a46Smrg    i*86:VOS:*:*)
1390e5410a46Smrg	# From Paul.Green@stratus.com.
1391d21ab8bcSmrg	GUESS=$UNAME_MACHINE-stratus-vos
1392d21ab8bcSmrg	;;
13931f0ac6a5Smrg    *:VOS:*:*)
13941f0ac6a5Smrg	# From Paul.Green@stratus.com.
1395d21ab8bcSmrg	GUESS=hppa1.1-stratus-vos
1396d21ab8bcSmrg	;;
13971f0ac6a5Smrg    mc68*:A/UX:*:*)
1398d21ab8bcSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1399d21ab8bcSmrg	;;
14001f0ac6a5Smrg    news*:NEWS-OS:6*:*)
1401d21ab8bcSmrg	GUESS=mips-sony-newsos6
1402d21ab8bcSmrg	;;
14031f0ac6a5Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1404d21ab8bcSmrg	if test -d /usr/nec; then
1405d21ab8bcSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
14061f0ac6a5Smrg	else
1407d21ab8bcSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
14081f0ac6a5Smrg	fi
1409d21ab8bcSmrg	;;
14101f0ac6a5Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1411d21ab8bcSmrg	GUESS=powerpc-be-beos
1412d21ab8bcSmrg	;;
14131f0ac6a5Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1414d21ab8bcSmrg	GUESS=powerpc-apple-beos
1415d21ab8bcSmrg	;;
14161f0ac6a5Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1417d21ab8bcSmrg	GUESS=i586-pc-beos
1418d21ab8bcSmrg	;;
14199c9ff80cSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1420d21ab8bcSmrg	GUESS=i586-pc-haiku
1421d21ab8bcSmrg	;;
14226ee7d557Smrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
14236ee7d557Smrg	GUESS=powerpc-apple-haiku
14246ee7d557Smrg	;;
14256ee7d557Smrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
14266ee7d557Smrg	GUESS=$UNAME_MACHINE-unknown-haiku
1427d21ab8bcSmrg	;;
14281f0ac6a5Smrg    SX-4:SUPER-UX:*:*)
1429d21ab8bcSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1430d21ab8bcSmrg	;;
14311f0ac6a5Smrg    SX-5:SUPER-UX:*:*)
1432d21ab8bcSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1433d21ab8bcSmrg	;;
14341f0ac6a5Smrg    SX-6:SUPER-UX:*:*)
1435d21ab8bcSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1436d21ab8bcSmrg	;;
1437e5410a46Smrg    SX-7:SUPER-UX:*:*)
1438d21ab8bcSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1439d21ab8bcSmrg	;;
1440e5410a46Smrg    SX-8:SUPER-UX:*:*)
1441d21ab8bcSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1442d21ab8bcSmrg	;;
1443e5410a46Smrg    SX-8R:SUPER-UX:*:*)
1444d21ab8bcSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1445d21ab8bcSmrg	;;
1446d21ab8bcSmrg    SX-ACE:SUPER-UX:*:*)
1447d21ab8bcSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1448d21ab8bcSmrg	;;
14491f0ac6a5Smrg    Power*:Rhapsody:*:*)
1450d21ab8bcSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1451d21ab8bcSmrg	;;
14521f0ac6a5Smrg    *:Rhapsody:*:*)
1453d21ab8bcSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1454d21ab8bcSmrg	;;
1455d21ab8bcSmrg    arm64:Darwin:*:*)
1456d21ab8bcSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1457d21ab8bcSmrg	;;
14581f0ac6a5Smrg    *:Darwin:*:*)
1459d21ab8bcSmrg	UNAME_PROCESSOR=`uname -p`
1460d21ab8bcSmrg	case $UNAME_PROCESSOR in
1461d21ab8bcSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1462d21ab8bcSmrg	esac
1463d21ab8bcSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1464d21ab8bcSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1465d21ab8bcSmrg	    # Avoid executing cc if there is no toolchain installed as
1466d21ab8bcSmrg	    # cc will be a stub that puts up a graphical alert
1467d21ab8bcSmrg	    # prompting the user to install developer tools.
1468d21ab8bcSmrg	    CC_FOR_BUILD=no_compiler_found
1469d21ab8bcSmrg	else
1470d21ab8bcSmrg	    set_cc_for_build
1471b9867631Smrg	fi
1472d21ab8bcSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14732fd96bc7Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1474d21ab8bcSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1475d21ab8bcSmrg		   grep IS_64BIT_ARCH >/dev/null
14762fd96bc7Smrg	    then
14772fd96bc7Smrg		case $UNAME_PROCESSOR in
14782fd96bc7Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14792fd96bc7Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14802fd96bc7Smrg		esac
1481b9867631Smrg	    fi
1482d21ab8bcSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1483d21ab8bcSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1484d21ab8bcSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1485d21ab8bcSmrg		   grep IS_PPC >/dev/null
1486d21ab8bcSmrg	    then
1487d21ab8bcSmrg		UNAME_PROCESSOR=powerpc
1488d21ab8bcSmrg	    fi
1489d21ab8bcSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1490d21ab8bcSmrg	    # uname -m returns i386 or x86_64
1491d21ab8bcSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1492b9867631Smrg	fi
1493d21ab8bcSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1494d21ab8bcSmrg	;;
14951f0ac6a5Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14961f0ac6a5Smrg	UNAME_PROCESSOR=`uname -p`
1497d21ab8bcSmrg	if test "$UNAME_PROCESSOR" = x86; then
14981f0ac6a5Smrg		UNAME_PROCESSOR=i386
14991f0ac6a5Smrg		UNAME_MACHINE=pc
15001f0ac6a5Smrg	fi
1501d21ab8bcSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1502d21ab8bcSmrg	;;
15031f0ac6a5Smrg    *:QNX:*:4*)
1504d21ab8bcSmrg	GUESS=i386-pc-qnx
1505d21ab8bcSmrg	;;
1506d21ab8bcSmrg    NEO-*:NONSTOP_KERNEL:*:*)
1507d21ab8bcSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1508d21ab8bcSmrg	;;
150989c04b6cSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1510d21ab8bcSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1511d21ab8bcSmrg	;;
1512d21ab8bcSmrg    NSR-*:NONSTOP_KERNEL:*:*)
1513d21ab8bcSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1514d21ab8bcSmrg	;;
1515d21ab8bcSmrg    NSV-*:NONSTOP_KERNEL:*:*)
1516d21ab8bcSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1517d21ab8bcSmrg	;;
1518d21ab8bcSmrg    NSX-*:NONSTOP_KERNEL:*:*)
1519d21ab8bcSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1520d21ab8bcSmrg	;;
15211f0ac6a5Smrg    *:NonStop-UX:*:*)
1522d21ab8bcSmrg	GUESS=mips-compaq-nonstopux
1523d21ab8bcSmrg	;;
15241f0ac6a5Smrg    BS2000:POSIX*:*:*)
1525d21ab8bcSmrg	GUESS=bs2000-siemens-sysv
1526d21ab8bcSmrg	;;
15271f0ac6a5Smrg    DS/*:UNIX_System_V:*:*)
1528d21ab8bcSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1529d21ab8bcSmrg	;;
15301f0ac6a5Smrg    *:Plan9:*:*)
15311f0ac6a5Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
15321f0ac6a5Smrg	# is converted to i386 for consistency with other x86
15331f0ac6a5Smrg	# operating systems.
1534d21ab8bcSmrg	if test "${cputype-}" = 386; then
15351f0ac6a5Smrg	    UNAME_MACHINE=i386
1536d21ab8bcSmrg	elif test "x${cputype-}" != x; then
1537d21ab8bcSmrg	    UNAME_MACHINE=$cputype
15381f0ac6a5Smrg	fi
1539d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
1540d21ab8bcSmrg	;;
15411f0ac6a5Smrg    *:TOPS-10:*:*)
1542d21ab8bcSmrg	GUESS=pdp10-unknown-tops10
1543d21ab8bcSmrg	;;
15441f0ac6a5Smrg    *:TENEX:*:*)
1545d21ab8bcSmrg	GUESS=pdp10-unknown-tenex
1546d21ab8bcSmrg	;;
15471f0ac6a5Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1548d21ab8bcSmrg	GUESS=pdp10-dec-tops20
1549d21ab8bcSmrg	;;
15501f0ac6a5Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1551d21ab8bcSmrg	GUESS=pdp10-xkl-tops20
1552d21ab8bcSmrg	;;
15531f0ac6a5Smrg    *:TOPS-20:*:*)
1554d21ab8bcSmrg	GUESS=pdp10-unknown-tops20
1555d21ab8bcSmrg	;;
15561f0ac6a5Smrg    *:ITS:*:*)
1557d21ab8bcSmrg	GUESS=pdp10-unknown-its
1558d21ab8bcSmrg	;;
15591f0ac6a5Smrg    SEI:*:*:SEIUX)
1560d21ab8bcSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1561d21ab8bcSmrg	;;
1562e5410a46Smrg    *:DragonFly:*:*)
1563d21ab8bcSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1564d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1565d21ab8bcSmrg	;;
1566e5410a46Smrg    *:*VMS:*:*)
156789c04b6cSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1568d21ab8bcSmrg	case $UNAME_MACHINE in
1569d21ab8bcSmrg	    A*) GUESS=alpha-dec-vms ;;
1570d21ab8bcSmrg	    I*) GUESS=ia64-dec-vms ;;
1571d21ab8bcSmrg	    V*) GUESS=vax-dec-vms ;;
1572e5410a46Smrg	esac ;;
1573e5410a46Smrg    *:XENIX:*:SysV)
1574d21ab8bcSmrg	GUESS=i386-pc-xenix
1575d21ab8bcSmrg	;;
1576e5410a46Smrg    i*86:skyos:*:*)
1577d21ab8bcSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1578d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1579d21ab8bcSmrg	;;
1580e5410a46Smrg    i*86:rdos:*:*)
1581d21ab8bcSmrg	GUESS=$UNAME_MACHINE-pc-rdos
1582d21ab8bcSmrg	;;
15836ee7d557Smrg    i*86:Fiwix:*:*)
15846ee7d557Smrg	GUESS=$UNAME_MACHINE-pc-fiwix
15856ee7d557Smrg	;;
1586d21ab8bcSmrg    *:AROS:*:*)
1587d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-aros
1588d21ab8bcSmrg	;;
158989c04b6cSmrg    x86_64:VMkernel:*:*)
1590d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-esx
1591d21ab8bcSmrg	;;
1592d21ab8bcSmrg    amd64:Isilon\ OneFS:*:*)
1593d21ab8bcSmrg	GUESS=x86_64-unknown-onefs
1594d21ab8bcSmrg	;;
1595d21ab8bcSmrg    *:Unleashed:*:*)
1596d21ab8bcSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1597d21ab8bcSmrg	;;
15986ee7d557Smrg    *:Ironclad:*:*)
15996ee7d557Smrg	GUESS=$UNAME_MACHINE-unknown-ironclad
16006ee7d557Smrg	;;
16011f0ac6a5Smrgesac
16021f0ac6a5Smrg
1603d21ab8bcSmrg# Do we have a guess based on uname results?
1604d21ab8bcSmrgif test "x$GUESS" != x; then
1605d21ab8bcSmrg    echo "$GUESS"
1606d21ab8bcSmrg    exit
1607d21ab8bcSmrgfi
1608d21ab8bcSmrg
1609d21ab8bcSmrg# No uname command or uname output not recognized.
1610d21ab8bcSmrgset_cc_for_build
1611d21ab8bcSmrgcat > "$dummy.c" <<EOF
16122fd96bc7Smrg#ifdef _SEQUENT_
1613d21ab8bcSmrg#include <sys/types.h>
1614d21ab8bcSmrg#include <sys/utsname.h>
1615d21ab8bcSmrg#endif
1616d21ab8bcSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1617d21ab8bcSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1618d21ab8bcSmrg#include <signal.h>
1619d21ab8bcSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1620d21ab8bcSmrg#include <sys/utsname.h>
1621d21ab8bcSmrg#endif
1622d21ab8bcSmrg#endif
16232fd96bc7Smrg#endif
16242fd96bc7Smrgmain ()
16252fd96bc7Smrg{
16262fd96bc7Smrg#if defined (sony)
16272fd96bc7Smrg#if defined (MIPSEB)
16282fd96bc7Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
16292fd96bc7Smrg     I don't know....  */
16302fd96bc7Smrg  printf ("mips-sony-bsd\n"); exit (0);
16312fd96bc7Smrg#else
16322fd96bc7Smrg#include <sys/param.h>
16332fd96bc7Smrg  printf ("m68k-sony-newsos%s\n",
16342fd96bc7Smrg#ifdef NEWSOS4
1635d21ab8bcSmrg  "4"
16362fd96bc7Smrg#else
1637d21ab8bcSmrg  ""
16382fd96bc7Smrg#endif
1639d21ab8bcSmrg  ); exit (0);
16402fd96bc7Smrg#endif
16412fd96bc7Smrg#endif
16422fd96bc7Smrg
16432fd96bc7Smrg#if defined (NeXT)
16442fd96bc7Smrg#if !defined (__ARCHITECTURE__)
16452fd96bc7Smrg#define __ARCHITECTURE__ "m68k"
16462fd96bc7Smrg#endif
16472fd96bc7Smrg  int version;
16482fd96bc7Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
16492fd96bc7Smrg  if (version < 4)
16502fd96bc7Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
16512fd96bc7Smrg  else
16522fd96bc7Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
16532fd96bc7Smrg  exit (0);
16542fd96bc7Smrg#endif
16552fd96bc7Smrg
16562fd96bc7Smrg#if defined (MULTIMAX) || defined (n16)
16572fd96bc7Smrg#if defined (UMAXV)
16582fd96bc7Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
16592fd96bc7Smrg#else
16602fd96bc7Smrg#if defined (CMU)
16612fd96bc7Smrg  printf ("ns32k-encore-mach\n"); exit (0);
16622fd96bc7Smrg#else
16632fd96bc7Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
16642fd96bc7Smrg#endif
16652fd96bc7Smrg#endif
16662fd96bc7Smrg#endif
16672fd96bc7Smrg
16682fd96bc7Smrg#if defined (__386BSD__)
16692fd96bc7Smrg  printf ("i386-pc-bsd\n"); exit (0);
16702fd96bc7Smrg#endif
16712fd96bc7Smrg
16722fd96bc7Smrg#if defined (sequent)
16732fd96bc7Smrg#if defined (i386)
16742fd96bc7Smrg  printf ("i386-sequent-dynix\n"); exit (0);
16752fd96bc7Smrg#endif
16762fd96bc7Smrg#if defined (ns32000)
16772fd96bc7Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16782fd96bc7Smrg#endif
16792fd96bc7Smrg#endif
16802fd96bc7Smrg
16812fd96bc7Smrg#if defined (_SEQUENT_)
1682d21ab8bcSmrg  struct utsname un;
16832fd96bc7Smrg
1684d21ab8bcSmrg  uname(&un);
1685d21ab8bcSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1686d21ab8bcSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1687d21ab8bcSmrg  }
1688d21ab8bcSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1689d21ab8bcSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1690d21ab8bcSmrg  }
1691d21ab8bcSmrg  printf ("i386-sequent-ptx\n"); exit (0);
16922fd96bc7Smrg#endif
16932fd96bc7Smrg
16942fd96bc7Smrg#if defined (vax)
1695d21ab8bcSmrg#if !defined (ultrix)
1696d21ab8bcSmrg#include <sys/param.h>
1697d21ab8bcSmrg#if defined (BSD)
1698d21ab8bcSmrg#if BSD == 43
1699d21ab8bcSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1700d21ab8bcSmrg#else
1701d21ab8bcSmrg#if BSD == 199006
1702d21ab8bcSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1703d21ab8bcSmrg#else
1704d21ab8bcSmrg  printf ("vax-dec-bsd\n"); exit (0);
1705d21ab8bcSmrg#endif
1706d21ab8bcSmrg#endif
1707d21ab8bcSmrg#else
1708d21ab8bcSmrg  printf ("vax-dec-bsd\n"); exit (0);
1709d21ab8bcSmrg#endif
1710d21ab8bcSmrg#else
1711d21ab8bcSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1712d21ab8bcSmrg  struct utsname un;
1713d21ab8bcSmrg  uname (&un);
1714d21ab8bcSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1715d21ab8bcSmrg#else
1716d21ab8bcSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1717d21ab8bcSmrg#endif
1718d21ab8bcSmrg#endif
1719d21ab8bcSmrg#endif
1720d21ab8bcSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1721d21ab8bcSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1722d21ab8bcSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1723d21ab8bcSmrg  struct utsname *un;
1724d21ab8bcSmrg  uname (&un);
1725d21ab8bcSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1726d21ab8bcSmrg#else
1727d21ab8bcSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1728d21ab8bcSmrg#endif
1729d21ab8bcSmrg#endif
17302fd96bc7Smrg#endif
17312fd96bc7Smrg
17322fd96bc7Smrg#if defined (alliant) && defined (i860)
17332fd96bc7Smrg  printf ("i860-alliant-bsd\n"); exit (0);
17342fd96bc7Smrg#endif
17352fd96bc7Smrg
17362fd96bc7Smrg  exit (1);
17372fd96bc7Smrg}
17382fd96bc7SmrgEOF
17392fd96bc7Smrg
1740d21ab8bcSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
17412fd96bc7Smrg	{ echo "$SYSTEM_NAME"; exit; }
17422fd96bc7Smrg
17432fd96bc7Smrg# Apollos put the system type in the environment.
1744d21ab8bcSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
17452fd96bc7Smrg
1746d21ab8bcSmrgecho "$0: unable to guess system type" >&2
17472fd96bc7Smrg
1748d21ab8bcSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1749d21ab8bcSmrg    mips:Linux | mips64:Linux)
1750d21ab8bcSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1751d21ab8bcSmrg	cat >&2 <<EOF
17522fd96bc7Smrg
1753d21ab8bcSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1754d21ab8bcSmrgthe system type. Please install a C compiler and try again.
1755d21ab8bcSmrgEOF
1756d21ab8bcSmrg	;;
1757d21ab8bcSmrgesac
17582fd96bc7Smrg
17591f0ac6a5Smrgcat >&2 <<EOF
17601f0ac6a5Smrg
1761d21ab8bcSmrgThis script (version $timestamp), has failed to recognize the
1762d21ab8bcSmrgoperating system you are using. If your script is old, overwrite *all*
1763d21ab8bcSmrgcopies of config.guess and config.sub with the latest versions from:
17641f0ac6a5Smrg
1765d21ab8bcSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1766e5410a46Smrgand
1767d21ab8bcSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1768d21ab8bcSmrgEOF
17691f0ac6a5Smrg
1770d21ab8bcSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
1771d21ab8bcSmrgthisyear=`date +%Y`
1772d21ab8bcSmrg# shellcheck disable=SC2003
1773d21ab8bcSmrgscript_age=`expr "$thisyear" - "$our_year"`
1774d21ab8bcSmrgif test "$script_age" -lt 3 ; then
1775d21ab8bcSmrg   cat >&2 <<EOF
1776d21ab8bcSmrg
1777d21ab8bcSmrgIf $0 has already been updated, send the following data and any
1778d21ab8bcSmrginformation you think might be pertinent to config-patches@gnu.org to
1779d21ab8bcSmrgprovide the necessary information to handle your system.
17801f0ac6a5Smrg
17811f0ac6a5Smrgconfig.guess timestamp = $timestamp
17821f0ac6a5Smrg
17831f0ac6a5Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17841f0ac6a5Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17851f0ac6a5Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17861f0ac6a5Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17871f0ac6a5Smrg
17881f0ac6a5Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17891f0ac6a5Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17901f0ac6a5Smrg
17911f0ac6a5Smrghostinfo               = `(hostinfo) 2>/dev/null`
17921f0ac6a5Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17931f0ac6a5Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17941f0ac6a5Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17951f0ac6a5Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17961f0ac6a5Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17971f0ac6a5Smrg
1798d21ab8bcSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1799d21ab8bcSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1800d21ab8bcSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1801d21ab8bcSmrgUNAME_VERSION = "$UNAME_VERSION"
18021f0ac6a5SmrgEOF
1803d21ab8bcSmrgfi
18041f0ac6a5Smrg
18051f0ac6a5Smrgexit 1
18061f0ac6a5Smrg
18071f0ac6a5Smrg# Local variables:
1808d21ab8bcSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
18091f0ac6a5Smrg# time-stamp-start: "timestamp='"
18101f0ac6a5Smrg# time-stamp-format: "%:y-%02m-%02d"
18111f0ac6a5Smrg# time-stamp-end: "'"
18121f0ac6a5Smrg# End:
1813