16c321187Smrg#! /bin/sh
26c321187Smrg# Attempt to guess a canonical system name.
39dedec0cSmrg#   Copyright 1992-2021 Free Software Foundation, Inc.
46c321187Smrg
59dedec0cSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
69dedec0cSmrg
79dedec0cSmrgtimestamp='2021-06-03'
86c321187Smrg
96c321187Smrg# This file is free software; you can redistribute it and/or modify it
106c321187Smrg# under the terms of the GNU General Public License as published by
119d0b5e55Smrg# the Free Software Foundation; either version 3 of the License, or
126c321187Smrg# (at your option) any later version.
136c321187Smrg#
146c321187Smrg# This program is distributed in the hope that it will be useful, but
156c321187Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
166c321187Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
176c321187Smrg# General Public License for more details.
186c321187Smrg#
196c321187Smrg# You should have received a copy of the GNU General Public License
20198e4c3cSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
216c321187Smrg#
226c321187Smrg# As a special exception to the GNU General Public License, if you
236c321187Smrg# distribute this file as part of a program that contains a
246c321187Smrg# configuration script generated by Autoconf, you may include it under
259d0b5e55Smrg# the same distribution terms that you use for the rest of that
269d0b5e55Smrg# program.  This Exception is an additional permission under section 7
279d0b5e55Smrg# of the GNU General Public License, version 3 ("GPLv3").
286c321187Smrg#
29198e4c3cSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
306c321187Smrg#
31e120bd27Smrg# You can get the latest version of this script from:
329dedec0cSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
339d0b5e55Smrg#
34198e4c3cSmrg# Please send patches to <config-patches@gnu.org>.
359d0b5e55Smrg
366c321187Smrg
379dedec0cSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
389dedec0cSmrg# about features and limitations of the classic Bourne shell that were
399dedec0cSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
409dedec0cSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
419dedec0cSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
429dedec0cSmrg# have a pre-POSIX /bin/sh.
439dedec0cSmrg
449dedec0cSmrg
456c321187Smrgme=`echo "$0" | sed -e 's,.*/,,'`
466c321187Smrg
476c321187Smrgusage="\
486c321187SmrgUsage: $0 [OPTION]
496c321187Smrg
506c321187SmrgOutput the configuration name of the system \`$me' is run on.
516c321187Smrg
52198e4c3cSmrgOptions:
536c321187Smrg  -h, --help         print this help, then exit
546c321187Smrg  -t, --time-stamp   print date of last modification, then exit
556c321187Smrg  -v, --version      print version number, then exit
566c321187Smrg
576c321187SmrgReport bugs and patches to <config-patches@gnu.org>."
586c321187Smrg
596c321187Smrgversion="\
606c321187SmrgGNU config.guess ($timestamp)
616c321187Smrg
626c321187SmrgOriginally written by Per Bothner.
639dedec0cSmrgCopyright 1992-2021 Free Software Foundation, Inc.
646c321187Smrg
656c321187SmrgThis is free software; see the source for copying conditions.  There is NO
666c321187Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
676c321187Smrg
686c321187Smrghelp="
696c321187SmrgTry \`$me --help' for more information."
706c321187Smrg
716c321187Smrg# Parse command line
726c321187Smrgwhile test $# -gt 0 ; do
736c321187Smrg  case $1 in
746c321187Smrg    --time-stamp | --time* | -t )
756c321187Smrg       echo "$timestamp" ; exit ;;
766c321187Smrg    --version | -v )
776c321187Smrg       echo "$version" ; exit ;;
786c321187Smrg    --help | --h* | -h )
796c321187Smrg       echo "$usage"; exit ;;
806c321187Smrg    -- )     # Stop option processing
816c321187Smrg       shift; break ;;
826c321187Smrg    - )	# Use stdin as input.
836c321187Smrg       break ;;
846c321187Smrg    -* )
856c321187Smrg       echo "$me: invalid option $1$help" >&2
866c321187Smrg       exit 1 ;;
876c321187Smrg    * )
886c321187Smrg       break ;;
896c321187Smrg  esac
906c321187Smrgdone
916c321187Smrg
926c321187Smrgif test $# != 0; then
936c321187Smrg  echo "$me: too many arguments$help" >&2
946c321187Smrg  exit 1
956c321187Smrgfi
966c321187Smrg
979dedec0cSmrg# Just in case it came from the environment.
989dedec0cSmrgGUESS=
996c321187Smrg
1006c321187Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1016c321187Smrg# compiler to aid in system detection is discouraged as it requires
1026c321187Smrg# temporary files to be created and, as you can see below, it is a
1036c321187Smrg# headache to deal with in a portable fashion.
1046c321187Smrg
1056c321187Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1066c321187Smrg# use `HOST_CC' if defined, but it is deprecated.
1076c321187Smrg
1086c321187Smrg# Portable tmp directory creation inspired by the Autoconf team.
1096c321187Smrg
1109dedec0cSmrgtmp=
1119dedec0cSmrg# shellcheck disable=SC2172
1129dedec0cSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1139dedec0cSmrg
1149dedec0cSmrgset_cc_for_build() {
1159dedec0cSmrg    # prevent multiple calls if $tmp is already set
1169dedec0cSmrg    test "$tmp" && return 0
1179dedec0cSmrg    : "${TMPDIR=/tmp}"
1189dedec0cSmrg    # shellcheck disable=SC2039,SC3028
1199dedec0cSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1209dedec0cSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1219dedec0cSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1229dedec0cSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1239dedec0cSmrg    dummy=$tmp/dummy
1249dedec0cSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1259dedec0cSmrg	,,)    echo "int x;" > "$dummy.c"
1269dedec0cSmrg	       for driver in cc gcc c89 c99 ; do
1279dedec0cSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1289dedec0cSmrg		       CC_FOR_BUILD=$driver
1299dedec0cSmrg		       break
1309dedec0cSmrg		   fi
1319dedec0cSmrg	       done
1329dedec0cSmrg	       if test x"$CC_FOR_BUILD" = x ; then
1339dedec0cSmrg		   CC_FOR_BUILD=no_compiler_found
1349dedec0cSmrg	       fi
1359dedec0cSmrg	       ;;
1369dedec0cSmrg	,,*)   CC_FOR_BUILD=$CC ;;
1379dedec0cSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1389dedec0cSmrg    esac
1399dedec0cSmrg}
1406c321187Smrg
1416c321187Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1426c321187Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
1439dedec0cSmrgif test -f /.attbin/uname ; then
1446c321187Smrg	PATH=$PATH:/.attbin ; export PATH
1456c321187Smrgfi
1466c321187Smrg
1476c321187SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1486c321187SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1499dedec0cSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1506c321187SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1516c321187Smrg
1529dedec0cSmrgcase $UNAME_SYSTEM in
1539d0b5e55SmrgLinux|GNU|GNU/*)
1549dedec0cSmrg	LIBC=unknown
1559d0b5e55Smrg
1569dedec0cSmrg	set_cc_for_build
157198e4c3cSmrg	cat <<-EOF > "$dummy.c"
1589d0b5e55Smrg	#include <features.h>
1599d0b5e55Smrg	#if defined(__UCLIBC__)
1609d0b5e55Smrg	LIBC=uclibc
1619d0b5e55Smrg	#elif defined(__dietlibc__)
1629d0b5e55Smrg	LIBC=dietlibc
1639dedec0cSmrg	#elif defined(__GLIBC__)
1649d0b5e55Smrg	LIBC=gnu
1659dedec0cSmrg	#else
1669dedec0cSmrg	#include <stdarg.h>
1679dedec0cSmrg	/* First heuristic to detect musl libc.  */
1689dedec0cSmrg	#ifdef __DEFINED_va_list
1699dedec0cSmrg	LIBC=musl
1709dedec0cSmrg	#endif
1719d0b5e55Smrg	#endif
1729d0b5e55Smrg	EOF
1739dedec0cSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
1749dedec0cSmrg	eval "$cc_set_libc"
175198e4c3cSmrg
1769dedec0cSmrg	# Second heuristic to detect musl libc.
1779dedec0cSmrg	if [ "$LIBC" = unknown ] &&
1789dedec0cSmrg	   command -v ldd >/dev/null &&
1799dedec0cSmrg	   ldd --version 2>&1 | grep -q ^musl; then
1809dedec0cSmrg		LIBC=musl
1819dedec0cSmrg	fi
1829dedec0cSmrg
1839dedec0cSmrg	# If the system lacks a compiler, then just pick glibc.
1849dedec0cSmrg	# We could probably try harder.
1859dedec0cSmrg	if [ "$LIBC" = unknown ]; then
1869dedec0cSmrg		LIBC=gnu
187198e4c3cSmrg	fi
1889d0b5e55Smrg	;;
1899d0b5e55Smrgesac
1909d0b5e55Smrg
1916c321187Smrg# Note: order is significant - the case branches are not exclusive.
1926c321187Smrg
1939dedec0cSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
1946c321187Smrg    *:NetBSD:*:*)
1956c321187Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
1969d0b5e55Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1976c321187Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1986c321187Smrg	# switched to ELF, *-*-netbsd* would select the old
1996c321187Smrg	# object file format.  This provides both forward
2006c321187Smrg	# compatibility and a consistent mechanism for selecting the
2016c321187Smrg	# object file format.
2026c321187Smrg	#
2036c321187Smrg	# Note: NetBSD doesn't particularly care about the vendor
2046c321187Smrg	# portion of the name.  We always set it to "unknown".
205198e4c3cSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2069dedec0cSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2079dedec0cSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208198e4c3cSmrg	    echo unknown)`
2099dedec0cSmrg	case $UNAME_MACHINE_ARCH in
2109dedec0cSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
2116c321187Smrg	    armeb) machine=armeb-unknown ;;
2126c321187Smrg	    arm*) machine=arm-unknown ;;
2136c321187Smrg	    sh3el) machine=shl-unknown ;;
2146c321187Smrg	    sh3eb) machine=sh-unknown ;;
21593493779Smrg	    sh5el) machine=sh5le-unknown ;;
216198e4c3cSmrg	    earmv*)
217198e4c3cSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218198e4c3cSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
2199dedec0cSmrg		machine=${arch}${endian}-unknown
220198e4c3cSmrg		;;
2219dedec0cSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2226c321187Smrg	esac
2236c321187Smrg	# The Operating System including object format, if it has switched
224198e4c3cSmrg	# to ELF recently (or will in the future) and ABI.
2259dedec0cSmrg	case $UNAME_MACHINE_ARCH in
226198e4c3cSmrg	    earm*)
227198e4c3cSmrg		os=netbsdelf
228198e4c3cSmrg		;;
2296c321187Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2309dedec0cSmrg		set_cc_for_build
2316c321187Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232e120bd27Smrg			| grep -q __ELF__
2336c321187Smrg		then
2346c321187Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2356c321187Smrg		    # Return netbsd for either.  FIX?
2366c321187Smrg		    os=netbsd
2376c321187Smrg		else
2386c321187Smrg		    os=netbsdelf
2396c321187Smrg		fi
2406c321187Smrg		;;
2416c321187Smrg	    *)
2429d0b5e55Smrg		os=netbsd
2436c321187Smrg		;;
2446c321187Smrg	esac
245198e4c3cSmrg	# Determine ABI tags.
2469dedec0cSmrg	case $UNAME_MACHINE_ARCH in
247198e4c3cSmrg	    earm*)
248198e4c3cSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249198e4c3cSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250198e4c3cSmrg		;;
251198e4c3cSmrg	esac
2526c321187Smrg	# The OS release
2536c321187Smrg	# Debian GNU/NetBSD machines have a different userland, and
2546c321187Smrg	# thus, need a distinct triplet. However, they do not need
2556c321187Smrg	# kernel version information, so it can be replaced with a
2566c321187Smrg	# suitable tag, in the style of linux-gnu.
2579dedec0cSmrg	case $UNAME_VERSION in
2586c321187Smrg	    Debian*)
2596c321187Smrg		release='-gnu'
2606c321187Smrg		;;
2616c321187Smrg	    *)
262198e4c3cSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2636c321187Smrg		;;
2646c321187Smrg	esac
2656c321187Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2666c321187Smrg	# contains redundant information, the shorter form:
2676c321187Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2689dedec0cSmrg	GUESS=$machine-${os}${release}${abi-}
2699dedec0cSmrg	;;
2709d0b5e55Smrg    *:Bitrig:*:*)
2719d0b5e55Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2729dedec0cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
2739dedec0cSmrg	;;
2746c321187Smrg    *:OpenBSD:*:*)
2756c321187Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2769dedec0cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
2779dedec0cSmrg	;;
2789dedec0cSmrg    *:SecBSD:*:*)
2799dedec0cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
2809dedec0cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
2819dedec0cSmrg	;;
282198e4c3cSmrg    *:LibertyBSD:*:*)
283198e4c3cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2849dedec0cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
2859dedec0cSmrg	;;
286198e4c3cSmrg    *:MidnightBSD:*:*)
2879dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
2889dedec0cSmrg	;;
2896c321187Smrg    *:ekkoBSD:*:*)
2909dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
2919dedec0cSmrg	;;
29293493779Smrg    *:SolidBSD:*:*)
2939dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
2949dedec0cSmrg	;;
2959dedec0cSmrg    *:OS108:*:*)
2969dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
2979dedec0cSmrg	;;
2986c321187Smrg    macppc:MirBSD:*:*)
2999dedec0cSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
3009dedec0cSmrg	;;
3016c321187Smrg    *:MirBSD:*:*)
3029dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
3039dedec0cSmrg	;;
304198e4c3cSmrg    *:Sortix:*:*)
3059dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
3069dedec0cSmrg	;;
3079dedec0cSmrg    *:Twizzler:*:*)
3089dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
3099dedec0cSmrg	;;
310198e4c3cSmrg    *:Redox:*:*)
3119dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-redox
3129dedec0cSmrg	;;
313198e4c3cSmrg    mips:OSF1:*.*)
3149dedec0cSmrg	GUESS=mips-dec-osf1
3159dedec0cSmrg	;;
3166c321187Smrg    alpha:OSF1:*:*)
3179dedec0cSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3189dedec0cSmrg	trap '' 0
3196c321187Smrg	case $UNAME_RELEASE in
3206c321187Smrg	*4.0)
3216c321187Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3226c321187Smrg		;;
3236c321187Smrg	*5.*)
3249d0b5e55Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3256c321187Smrg		;;
3266c321187Smrg	esac
3276c321187Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3286c321187Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3296c321187Smrg	# covers most systems running today.  This code pipes the CPU
3306c321187Smrg	# types through head -n 1, so we only detect the type of CPU 0.
3316c321187Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3329dedec0cSmrg	case $ALPHA_CPU_TYPE in
3336c321187Smrg	    "EV4 (21064)")
334198e4c3cSmrg		UNAME_MACHINE=alpha ;;
3356c321187Smrg	    "EV4.5 (21064)")
336198e4c3cSmrg		UNAME_MACHINE=alpha ;;
3376c321187Smrg	    "LCA4 (21066/21068)")
338198e4c3cSmrg		UNAME_MACHINE=alpha ;;
3396c321187Smrg	    "EV5 (21164)")
340198e4c3cSmrg		UNAME_MACHINE=alphaev5 ;;
3416c321187Smrg	    "EV5.6 (21164A)")
342198e4c3cSmrg		UNAME_MACHINE=alphaev56 ;;
3436c321187Smrg	    "EV5.6 (21164PC)")
344198e4c3cSmrg		UNAME_MACHINE=alphapca56 ;;
3456c321187Smrg	    "EV5.7 (21164PC)")
346198e4c3cSmrg		UNAME_MACHINE=alphapca57 ;;
3476c321187Smrg	    "EV6 (21264)")
348198e4c3cSmrg		UNAME_MACHINE=alphaev6 ;;
3496c321187Smrg	    "EV6.7 (21264A)")
350198e4c3cSmrg		UNAME_MACHINE=alphaev67 ;;
3516c321187Smrg	    "EV6.8CB (21264C)")
352198e4c3cSmrg		UNAME_MACHINE=alphaev68 ;;
3536c321187Smrg	    "EV6.8AL (21264B)")
354198e4c3cSmrg		UNAME_MACHINE=alphaev68 ;;
3556c321187Smrg	    "EV6.8CX (21264D)")
356198e4c3cSmrg		UNAME_MACHINE=alphaev68 ;;
3576c321187Smrg	    "EV6.9A (21264/EV69A)")
358198e4c3cSmrg		UNAME_MACHINE=alphaev69 ;;
3596c321187Smrg	    "EV7 (21364)")
360198e4c3cSmrg		UNAME_MACHINE=alphaev7 ;;
3616c321187Smrg	    "EV7.9 (21364A)")
362198e4c3cSmrg		UNAME_MACHINE=alphaev79 ;;
3636c321187Smrg	esac
3646c321187Smrg	# A Pn.n version is a patched version.
3656c321187Smrg	# A Vn.n version is a released version.
3666c321187Smrg	# A Tn.n version is a released field test version.
3676c321187Smrg	# A Xn.n version is an unreleased experimental baselevel.
3686c321187Smrg	# 1.2 uses "1.2" for uname -r.
3699dedec0cSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
3709dedec0cSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
3719dedec0cSmrg	;;
3726c321187Smrg    Amiga*:UNIX_System_V:4.0:*)
3739dedec0cSmrg	GUESS=m68k-unknown-sysv4
3749dedec0cSmrg	;;
3756c321187Smrg    *:[Aa]miga[Oo][Ss]:*:*)
3769dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
3779dedec0cSmrg	;;
3786c321187Smrg    *:[Mm]orph[Oo][Ss]:*:*)
3799dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
3809dedec0cSmrg	;;
3816c321187Smrg    *:OS/390:*:*)
3829dedec0cSmrg	GUESS=i370-ibm-openedition
3839dedec0cSmrg	;;
3846c321187Smrg    *:z/VM:*:*)
3859dedec0cSmrg	GUESS=s390-ibm-zvmoe
3869dedec0cSmrg	;;
3876c321187Smrg    *:OS400:*:*)
3889dedec0cSmrg	GUESS=powerpc-ibm-os400
3899dedec0cSmrg	;;
3906c321187Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3919dedec0cSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
3929dedec0cSmrg	;;
3939d0b5e55Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3949dedec0cSmrg	GUESS=arm-unknown-riscos
3959dedec0cSmrg	;;
3966c321187Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3979dedec0cSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
3989dedec0cSmrg	;;
3996c321187Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4006c321187Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
4019dedec0cSmrg	case `(/bin/universe) 2>/dev/null` in
4029dedec0cSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
4039dedec0cSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
4049dedec0cSmrg	esac
4059dedec0cSmrg	;;
4066c321187Smrg    NILE*:*:*:dcosx)
4079dedec0cSmrg	GUESS=pyramid-pyramid-svr4
4089dedec0cSmrg	;;
4096c321187Smrg    DRS?6000:unix:4.0:6*)
4109dedec0cSmrg	GUESS=sparc-icl-nx6
4119dedec0cSmrg	;;
4126c321187Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4136c321187Smrg	case `/usr/bin/uname -p` in
4149dedec0cSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
4159dedec0cSmrg	esac
4169dedec0cSmrg	;;
417e120bd27Smrg    s390x:SunOS:*:*)
4189dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4199dedec0cSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
4209dedec0cSmrg	;;
4216c321187Smrg    sun4H:SunOS:5.*:*)
4229dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4239dedec0cSmrg	GUESS=sparc-hal-solaris2$SUN_REL
4249dedec0cSmrg	;;
4256c321187Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
4269dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4279dedec0cSmrg	GUESS=sparc-sun-solaris2$SUN_REL
4289dedec0cSmrg	;;
429e120bd27Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
4309dedec0cSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
4319dedec0cSmrg	;;
43293493779Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4339dedec0cSmrg	set_cc_for_build
434198e4c3cSmrg	SUN_ARCH=i386
435e120bd27Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436e120bd27Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437e120bd27Smrg	# This test works for both compilers.
4389dedec0cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439e120bd27Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440198e4c3cSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
441e120bd27Smrg		grep IS_64BIT_ARCH >/dev/null
442e120bd27Smrg	    then
443198e4c3cSmrg		SUN_ARCH=x86_64
444e120bd27Smrg	    fi
445e120bd27Smrg	fi
4469dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4479dedec0cSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
4489dedec0cSmrg	;;
4496c321187Smrg    sun4*:SunOS:6*:*)
4506c321187Smrg	# According to config.sub, this is the proper way to canonicalize
4516c321187Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4526c321187Smrg	# it's likely to be more like Solaris than SunOS4.
4539dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4549dedec0cSmrg	GUESS=sparc-sun-solaris3$SUN_REL
4559dedec0cSmrg	;;
4566c321187Smrg    sun4*:SunOS:*:*)
4579dedec0cSmrg	case `/usr/bin/arch -k` in
4586c321187Smrg	    Series*|S4*)
4596c321187Smrg		UNAME_RELEASE=`uname -v`
4606c321187Smrg		;;
4616c321187Smrg	esac
4626c321187Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4639dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
4649dedec0cSmrg	GUESS=sparc-sun-sunos$SUN_REL
4659dedec0cSmrg	;;
4666c321187Smrg    sun3*:SunOS:*:*)
4679dedec0cSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
4689dedec0cSmrg	;;
4696c321187Smrg    sun*:*:4.2BSD:*)
4706c321187Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471198e4c3cSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4729dedec0cSmrg	case `/bin/arch` in
4736c321187Smrg	    sun3)
4749dedec0cSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4756c321187Smrg		;;
4766c321187Smrg	    sun4)
4779dedec0cSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4786c321187Smrg		;;
4796c321187Smrg	esac
4809dedec0cSmrg	;;
4816c321187Smrg    aushp:SunOS:*:*)
4829dedec0cSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
4839dedec0cSmrg	;;
4846c321187Smrg    # The situation for MiNT is a little confusing.  The machine name
4856c321187Smrg    # can be virtually everything (everything which is not
4866c321187Smrg    # "atarist" or "atariste" at least should have a processor
4876c321187Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4886c321187Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4896c321187Smrg    # the system name "TOS" denotes a system which is actually not
4906c321187Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4916c321187Smrg    # be no problem.
4926c321187Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4939dedec0cSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4949dedec0cSmrg	;;
4956c321187Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4969dedec0cSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4979dedec0cSmrg	;;
4986c321187Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4999dedec0cSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
5009dedec0cSmrg	;;
5016c321187Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
5029dedec0cSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
5039dedec0cSmrg	;;
5046c321187Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
5059dedec0cSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
5069dedec0cSmrg	;;
5076c321187Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
5089dedec0cSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
5099dedec0cSmrg	;;
5106c321187Smrg    m68k:machten:*:*)
5119dedec0cSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
5129dedec0cSmrg	;;
5136c321187Smrg    powerpc:machten:*:*)
5149dedec0cSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
5159dedec0cSmrg	;;
5166c321187Smrg    RISC*:Mach:*:*)
5179dedec0cSmrg	GUESS=mips-dec-mach_bsd4.3
5189dedec0cSmrg	;;
5196c321187Smrg    RISC*:ULTRIX:*:*)
5209dedec0cSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
5219dedec0cSmrg	;;
5226c321187Smrg    VAX*:ULTRIX*:*:*)
5239dedec0cSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
5249dedec0cSmrg	;;
5256c321187Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
5269dedec0cSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
5279dedec0cSmrg	;;
5286c321187Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
5299dedec0cSmrg	set_cc_for_build
530198e4c3cSmrg	sed 's/^	//' << EOF > "$dummy.c"
5316c321187Smrg#ifdef __cplusplus
5326c321187Smrg#include <stdio.h>  /* for printf() prototype */
5336c321187Smrg	int main (int argc, char *argv[]) {
5346c321187Smrg#else
5356c321187Smrg	int main (argc, argv) int argc; char *argv[]; {
5366c321187Smrg#endif
5376c321187Smrg	#if defined (host_mips) && defined (MIPSEB)
5386c321187Smrg	#if defined (SYSTYPE_SYSV)
539198e4c3cSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5406c321187Smrg	#endif
5416c321187Smrg	#if defined (SYSTYPE_SVR4)
542198e4c3cSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5436c321187Smrg	#endif
5446c321187Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545198e4c3cSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5466c321187Smrg	#endif
5476c321187Smrg	#endif
5486c321187Smrg	  exit (-1);
5496c321187Smrg	}
5506c321187SmrgEOF
551198e4c3cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552198e4c3cSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553198e4c3cSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5546c321187Smrg	    { echo "$SYSTEM_NAME"; exit; }
5559dedec0cSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
5569dedec0cSmrg	;;
5576c321187Smrg    Motorola:PowerMAX_OS:*:*)
5589dedec0cSmrg	GUESS=powerpc-motorola-powermax
5599dedec0cSmrg	;;
5606c321187Smrg    Motorola:*:4.3:PL8-*)
5619dedec0cSmrg	GUESS=powerpc-harris-powermax
5629dedec0cSmrg	;;
5636c321187Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5649dedec0cSmrg	GUESS=powerpc-harris-powermax
5659dedec0cSmrg	;;
5666c321187Smrg    Night_Hawk:Power_UNIX:*:*)
5679dedec0cSmrg	GUESS=powerpc-harris-powerunix
5689dedec0cSmrg	;;
5696c321187Smrg    m88k:CX/UX:7*:*)
5709dedec0cSmrg	GUESS=m88k-harris-cxux7
5719dedec0cSmrg	;;
5726c321187Smrg    m88k:*:4*:R4*)
5739dedec0cSmrg	GUESS=m88k-motorola-sysv4
5749dedec0cSmrg	;;
5756c321187Smrg    m88k:*:3*:R3*)
5769dedec0cSmrg	GUESS=m88k-motorola-sysv3
5779dedec0cSmrg	;;
5786c321187Smrg    AViiON:dgux:*:*)
5799d0b5e55Smrg	# DG/UX returns AViiON for all architectures
5809d0b5e55Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5819dedec0cSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5826c321187Smrg	then
5839dedec0cSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5849dedec0cSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
5856c321187Smrg	    then
5869dedec0cSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5876c321187Smrg	    else
5889dedec0cSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5896c321187Smrg	    fi
5906c321187Smrg	else
5919dedec0cSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5926c321187Smrg	fi
5939dedec0cSmrg	;;
5946c321187Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5959dedec0cSmrg	GUESS=m88k-dolphin-sysv3
5969dedec0cSmrg	;;
5976c321187Smrg    M88*:*:R3*:*)
5986c321187Smrg	# Delta 88k system running SVR3
5999dedec0cSmrg	GUESS=m88k-motorola-sysv3
6009dedec0cSmrg	;;
6016c321187Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
6029dedec0cSmrg	GUESS=m88k-tektronix-sysv3
6039dedec0cSmrg	;;
6046c321187Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
6059dedec0cSmrg	GUESS=m68k-tektronix-bsd
6069dedec0cSmrg	;;
6076c321187Smrg    *:IRIX*:*:*)
6089dedec0cSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
6099dedec0cSmrg	GUESS=mips-sgi-irix$IRIX_REL
6109dedec0cSmrg	;;
6116c321187Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
6129dedec0cSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
6139dedec0cSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6146c321187Smrg    i*86:AIX:*:*)
6159dedec0cSmrg	GUESS=i386-ibm-aix
6169dedec0cSmrg	;;
6176c321187Smrg    ia64:AIX:*:*)
6189dedec0cSmrg	if test -x /usr/bin/oslevel ; then
6196c321187Smrg		IBM_REV=`/usr/bin/oslevel`
6206c321187Smrg	else
6219dedec0cSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6226c321187Smrg	fi
6239dedec0cSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
6249dedec0cSmrg	;;
6256c321187Smrg    *:AIX:2:3)
6266c321187Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6279dedec0cSmrg		set_cc_for_build
628198e4c3cSmrg		sed 's/^		//' << EOF > "$dummy.c"
6296c321187Smrg		#include <sys/systemcfg.h>
6306c321187Smrg
6316c321187Smrg		main()
6326c321187Smrg			{
6336c321187Smrg			if (!__power_pc())
6346c321187Smrg				exit(1);
6356c321187Smrg			puts("powerpc-ibm-aix3.2.5");
6366c321187Smrg			exit(0);
6376c321187Smrg			}
6386c321187SmrgEOF
639198e4c3cSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6406c321187Smrg		then
6419dedec0cSmrg			GUESS=$SYSTEM_NAME
6426c321187Smrg		else
6439dedec0cSmrg			GUESS=rs6000-ibm-aix3.2.5
6446c321187Smrg		fi
6456c321187Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6469dedec0cSmrg		GUESS=rs6000-ibm-aix3.2.4
6476c321187Smrg	else
6489dedec0cSmrg		GUESS=rs6000-ibm-aix3.2
6496c321187Smrg	fi
6509dedec0cSmrg	;;
651e120bd27Smrg    *:AIX:*:[4567])
6526c321187Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653198e4c3cSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6546c321187Smrg		IBM_ARCH=rs6000
6556c321187Smrg	else
6566c321187Smrg		IBM_ARCH=powerpc
6576c321187Smrg	fi
6589dedec0cSmrg	if test -x /usr/bin/lslpp ; then
6599dedec0cSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660198e4c3cSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6616c321187Smrg	else
6629dedec0cSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6636c321187Smrg	fi
6649dedec0cSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
6659dedec0cSmrg	;;
6666c321187Smrg    *:AIX:*:*)
6679dedec0cSmrg	GUESS=rs6000-ibm-aix
6689dedec0cSmrg	;;
669198e4c3cSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6709dedec0cSmrg	GUESS=romp-ibm-bsd4.4
6719dedec0cSmrg	;;
6726c321187Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6739dedec0cSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
6749dedec0cSmrg	;;                                  # report: romp-ibm BSD 4.3
6756c321187Smrg    *:BOSX:*:*)
6769dedec0cSmrg	GUESS=rs6000-bull-bosx
6779dedec0cSmrg	;;
6786c321187Smrg    DPX/2?00:B.O.S.:*:*)
6799dedec0cSmrg	GUESS=m68k-bull-sysv3
6809dedec0cSmrg	;;
6816c321187Smrg    9000/[34]??:4.3bsd:1.*:*)
6829dedec0cSmrg	GUESS=m68k-hp-bsd
6839dedec0cSmrg	;;
6846c321187Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6859dedec0cSmrg	GUESS=m68k-hp-bsd4.4
6869dedec0cSmrg	;;
6876c321187Smrg    9000/[34678]??:HP-UX:*:*)
6889dedec0cSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
6899dedec0cSmrg	case $UNAME_MACHINE in
690198e4c3cSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691198e4c3cSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6926c321187Smrg	    9000/[678][0-9][0-9])
6939dedec0cSmrg		if test -x /usr/bin/getconf; then
6946c321187Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6959d0b5e55Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6969dedec0cSmrg		    case $sc_cpu_version in
697198e4c3cSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698198e4c3cSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6999d0b5e55Smrg		      532)                      # CPU_PA_RISC2_0
7009dedec0cSmrg			case $sc_kernel_bits in
701198e4c3cSmrg			  32) HP_ARCH=hppa2.0n ;;
702198e4c3cSmrg			  64) HP_ARCH=hppa2.0w ;;
703198e4c3cSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7049d0b5e55Smrg			esac ;;
7059d0b5e55Smrg		    esac
7066c321187Smrg		fi
7079dedec0cSmrg		if test "$HP_ARCH" = ""; then
7089dedec0cSmrg		    set_cc_for_build
709198e4c3cSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7106c321187Smrg
7119d0b5e55Smrg		#define _HPUX_SOURCE
7129d0b5e55Smrg		#include <stdlib.h>
7139d0b5e55Smrg		#include <unistd.h>
7146c321187Smrg
7159d0b5e55Smrg		int main ()
7169d0b5e55Smrg		{
7179d0b5e55Smrg		#if defined(_SC_KERNEL_BITS)
7189d0b5e55Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
7199d0b5e55Smrg		#endif
7209d0b5e55Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7216c321187Smrg
7229d0b5e55Smrg		    switch (cpu)
7239d0b5e55Smrg			{
7249d0b5e55Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7259d0b5e55Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7269d0b5e55Smrg			case CPU_PA_RISC2_0:
7279d0b5e55Smrg		#if defined(_SC_KERNEL_BITS)
7289d0b5e55Smrg			    switch (bits)
7299d0b5e55Smrg				{
7309d0b5e55Smrg				case 64: puts ("hppa2.0w"); break;
7319d0b5e55Smrg				case 32: puts ("hppa2.0n"); break;
7329d0b5e55Smrg				default: puts ("hppa2.0"); break;
7339d0b5e55Smrg				} break;
7349d0b5e55Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
7359d0b5e55Smrg			    puts ("hppa2.0"); break;
7369d0b5e55Smrg		#endif
7379d0b5e55Smrg			default: puts ("hppa1.0"); break;
7389d0b5e55Smrg			}
7399d0b5e55Smrg		    exit (0);
7409d0b5e55Smrg		}
7416c321187SmrgEOF
742198e4c3cSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7436c321187Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7446c321187Smrg		fi ;;
7456c321187Smrg	esac
7469dedec0cSmrg	if test "$HP_ARCH" = hppa2.0w
7476c321187Smrg	then
7489dedec0cSmrg	    set_cc_for_build
7496c321187Smrg
7506c321187Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7516c321187Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7526c321187Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7536c321187Smrg	    #
7546c321187Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
7556c321187Smrg	    # => hppa2.0w-hp-hpux11.23
7566c321187Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7576c321187Smrg	    # => hppa64-hp-hpux11.23
7586c321187Smrg
759198e4c3cSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760e120bd27Smrg		grep -q __LP64__
7616c321187Smrg	    then
762198e4c3cSmrg		HP_ARCH=hppa2.0w
7636c321187Smrg	    else
764198e4c3cSmrg		HP_ARCH=hppa64
7656c321187Smrg	    fi
7666c321187Smrg	fi
7679dedec0cSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
7689dedec0cSmrg	;;
7696c321187Smrg    ia64:HP-UX:*:*)
7709dedec0cSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
7719dedec0cSmrg	GUESS=ia64-hp-hpux$HPUX_REV
7729dedec0cSmrg	;;
7736c321187Smrg    3050*:HI-UX:*:*)
7749dedec0cSmrg	set_cc_for_build
775198e4c3cSmrg	sed 's/^	//' << EOF > "$dummy.c"
7766c321187Smrg	#include <unistd.h>
7776c321187Smrg	int
7786c321187Smrg	main ()
7796c321187Smrg	{
7806c321187Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7816c321187Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7826c321187Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7836c321187Smrg	     results, however.  */
7846c321187Smrg	  if (CPU_IS_PA_RISC (cpu))
7856c321187Smrg	    {
7866c321187Smrg	      switch (cpu)
7876c321187Smrg		{
7886c321187Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7896c321187Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7906c321187Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7916c321187Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7926c321187Smrg		}
7936c321187Smrg	    }
7946c321187Smrg	  else if (CPU_IS_HP_MC68K (cpu))
7956c321187Smrg	    puts ("m68k-hitachi-hiuxwe2");
7966c321187Smrg	  else puts ("unknown-hitachi-hiuxwe2");
7976c321187Smrg	  exit (0);
7986c321187Smrg	}
7996c321187SmrgEOF
800198e4c3cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8016c321187Smrg		{ echo "$SYSTEM_NAME"; exit; }
8029dedec0cSmrg	GUESS=unknown-hitachi-hiuxwe2
8039dedec0cSmrg	;;
804198e4c3cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
8059dedec0cSmrg	GUESS=hppa1.1-hp-bsd
8069dedec0cSmrg	;;
8076c321187Smrg    9000/8??:4.3bsd:*:*)
8089dedec0cSmrg	GUESS=hppa1.0-hp-bsd
8099dedec0cSmrg	;;
8106c321187Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
8119dedec0cSmrg	GUESS=hppa1.0-hp-mpeix
8129dedec0cSmrg	;;
813198e4c3cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
8149dedec0cSmrg	GUESS=hppa1.1-hp-osf
8159dedec0cSmrg	;;
8166c321187Smrg    hp8??:OSF1:*:*)
8179dedec0cSmrg	GUESS=hppa1.0-hp-osf
8189dedec0cSmrg	;;
8196c321187Smrg    i*86:OSF1:*:*)
8209dedec0cSmrg	if test -x /usr/sbin/sysversion ; then
8219dedec0cSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8226c321187Smrg	else
8239dedec0cSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8246c321187Smrg	fi
8259dedec0cSmrg	;;
8266c321187Smrg    parisc*:Lites*:*:*)
8279dedec0cSmrg	GUESS=hppa1.1-hp-lites
8289dedec0cSmrg	;;
8296c321187Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
8309dedec0cSmrg	GUESS=c1-convex-bsd
8319dedec0cSmrg	;;
8326c321187Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8336c321187Smrg	if getsysinfo -f scalar_acc
8346c321187Smrg	then echo c32-convex-bsd
8356c321187Smrg	else echo c2-convex-bsd
8366c321187Smrg	fi
8379d0b5e55Smrg	exit ;;
8386c321187Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8399dedec0cSmrg	GUESS=c34-convex-bsd
8409dedec0cSmrg	;;
8416c321187Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8429dedec0cSmrg	GUESS=c38-convex-bsd
8439dedec0cSmrg	;;
8446c321187Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8459dedec0cSmrg	GUESS=c4-convex-bsd
8469dedec0cSmrg	;;
8476c321187Smrg    CRAY*Y-MP:*:*:*)
8489dedec0cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8499dedec0cSmrg	GUESS=ymp-cray-unicos$CRAY_REL
8509dedec0cSmrg	;;
8516c321187Smrg    CRAY*[A-Z]90:*:*:*)
852198e4c3cSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8536c321187Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8546c321187Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8556c321187Smrg	      -e 's/\.[^.]*$/.X/'
8566c321187Smrg	exit ;;
8576c321187Smrg    CRAY*TS:*:*:*)
8589dedec0cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8599dedec0cSmrg	GUESS=t90-cray-unicos$CRAY_REL
8609dedec0cSmrg	;;
8616c321187Smrg    CRAY*T3E:*:*:*)
8629dedec0cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8639dedec0cSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
8649dedec0cSmrg	;;
8656c321187Smrg    CRAY*SV1:*:*:*)
8669dedec0cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8679dedec0cSmrg	GUESS=sv1-cray-unicos$CRAY_REL
8689dedec0cSmrg	;;
8696c321187Smrg    *:UNICOS/mp:*:*)
8709dedec0cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8719dedec0cSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
8729dedec0cSmrg	;;
8736c321187Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874198e4c3cSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875198e4c3cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876198e4c3cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8779dedec0cSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8789dedec0cSmrg	;;
8796c321187Smrg    5000:UNIX_System_V:4.*:*)
880198e4c3cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881198e4c3cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8829dedec0cSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8839dedec0cSmrg	;;
8846c321187Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8859dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
8869dedec0cSmrg	;;
8876c321187Smrg    sparc*:BSD/OS:*:*)
8889dedec0cSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
8899dedec0cSmrg	;;
8906c321187Smrg    *:BSD/OS:*:*)
8919dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
8929dedec0cSmrg	;;
8939dedec0cSmrg    arm:FreeBSD:*:*)
8949dedec0cSmrg	UNAME_PROCESSOR=`uname -p`
8959dedec0cSmrg	set_cc_for_build
8969dedec0cSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8979dedec0cSmrg	    | grep -q __ARM_PCS_VFP
8989dedec0cSmrg	then
8999dedec0cSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9009dedec0cSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9019dedec0cSmrg	else
9029dedec0cSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9039dedec0cSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9049dedec0cSmrg	fi
9059dedec0cSmrg	;;
9066c321187Smrg    *:FreeBSD:*:*)
9079d0b5e55Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
9089dedec0cSmrg	case $UNAME_PROCESSOR in
90993493779Smrg	    amd64)
910198e4c3cSmrg		UNAME_PROCESSOR=x86_64 ;;
911198e4c3cSmrg	    i386)
912198e4c3cSmrg		UNAME_PROCESSOR=i586 ;;
91393493779Smrg	esac
9149dedec0cSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9159dedec0cSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
9169dedec0cSmrg	;;
9176c321187Smrg    i*:CYGWIN*:*)
9189dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
9199dedec0cSmrg	;;
9209d0b5e55Smrg    *:MINGW64*:*)
9219dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
9229dedec0cSmrg	;;
92393493779Smrg    *:MINGW*:*)
9249dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
9259dedec0cSmrg	;;
926198e4c3cSmrg    *:MSYS*:*)
9279dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-msys
9289dedec0cSmrg	;;
9296c321187Smrg    i*:PW*:*)
9309dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-pw32
9319dedec0cSmrg	;;
932e120bd27Smrg    *:Interix*:*)
9339dedec0cSmrg	case $UNAME_MACHINE in
93493493779Smrg	    x86)
9359dedec0cSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
9369dedec0cSmrg		;;
937e120bd27Smrg	    authenticamd | genuineintel | EM64T)
9389dedec0cSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
9399dedec0cSmrg		;;
94093493779Smrg	    IA64)
9419dedec0cSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
9429dedec0cSmrg		;;
94393493779Smrg	esac ;;
9446c321187Smrg    i*:UWIN*:*)
9459dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-uwin
9469dedec0cSmrg	;;
9476c321187Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9489dedec0cSmrg	GUESS=x86_64-pc-cygwin
9499dedec0cSmrg	;;
9506c321187Smrg    prep*:SunOS:5.*:*)
9519dedec0cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
9529dedec0cSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
9539dedec0cSmrg	;;
9546c321187Smrg    *:GNU:*:*)
9556c321187Smrg	# the GNU system
9569dedec0cSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
9579dedec0cSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
9589dedec0cSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
9599dedec0cSmrg	;;
9606c321187Smrg    *:GNU/*:*:*)
9616c321187Smrg	# other systems with GNU libc and userland
9629dedec0cSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
9639dedec0cSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9649dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
9659dedec0cSmrg	;;
9669dedec0cSmrg    *:Minix:*:*)
9679dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-minix
9689dedec0cSmrg	;;
9699d0b5e55Smrg    aarch64:Linux:*:*)
9709dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9719dedec0cSmrg	;;
9729d0b5e55Smrg    aarch64_be:Linux:*:*)
9739d0b5e55Smrg	UNAME_MACHINE=aarch64_be
9749dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9759dedec0cSmrg	;;
976e120bd27Smrg    alpha:Linux:*:*)
9779dedec0cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978e120bd27Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979e120bd27Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980e120bd27Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981e120bd27Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982e120bd27Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983e120bd27Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984e120bd27Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9859d0b5e55Smrg	esac
986e120bd27Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
987198e4c3cSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9889dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9899dedec0cSmrg	;;
9909dedec0cSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
9919dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9929dedec0cSmrg	;;
9936c321187Smrg    arm*:Linux:*:*)
9949dedec0cSmrg	set_cc_for_build
99593493779Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
99693493779Smrg	    | grep -q __ARM_EABI__
99793493779Smrg	then
9989dedec0cSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99993493779Smrg	else
10009d0b5e55Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10019d0b5e55Smrg		| grep -q __ARM_PCS_VFP
10029d0b5e55Smrg	    then
10039dedec0cSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10049d0b5e55Smrg	    else
10059dedec0cSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10069d0b5e55Smrg	    fi
100793493779Smrg	fi
10089dedec0cSmrg	;;
100993493779Smrg    avr32*:Linux:*:*)
10109dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10119dedec0cSmrg	;;
10126c321187Smrg    cris:Linux:*:*)
10139dedec0cSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10149dedec0cSmrg	;;
10156c321187Smrg    crisv32:Linux:*:*)
10169dedec0cSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10179dedec0cSmrg	;;
1018198e4c3cSmrg    e2k:Linux:*:*)
10199dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10209dedec0cSmrg	;;
10216c321187Smrg    frv:Linux:*:*)
10229dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10239dedec0cSmrg	;;
10249d0b5e55Smrg    hexagon:Linux:*:*)
10259dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10269dedec0cSmrg	;;
1027e120bd27Smrg    i*86:Linux:*:*)
10289dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
10299dedec0cSmrg	;;
10306c321187Smrg    ia64:Linux:*:*)
10319dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10329dedec0cSmrg	;;
1033198e4c3cSmrg    k1om:Linux:*:*)
10349dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10359dedec0cSmrg	;;
10369dedec0cSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
10379dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10389dedec0cSmrg	;;
10396c321187Smrg    m32r*:Linux:*:*)
10409dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10419dedec0cSmrg	;;
10426c321187Smrg    m68*:Linux:*:*)
10439dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10449dedec0cSmrg	;;
1045e120bd27Smrg    mips:Linux:*:* | mips64:Linux:*:*)
10469dedec0cSmrg	set_cc_for_build
10479dedec0cSmrg	IS_GLIBC=0
10489dedec0cSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049198e4c3cSmrg	sed 's/^	//' << EOF > "$dummy.c"
10506c321187Smrg	#undef CPU
10519dedec0cSmrg	#undef mips
10529dedec0cSmrg	#undef mipsel
10539dedec0cSmrg	#undef mips64
10549dedec0cSmrg	#undef mips64el
10559dedec0cSmrg	#if ${IS_GLIBC} && defined(_ABI64)
10569dedec0cSmrg	LIBCABI=gnuabi64
10579dedec0cSmrg	#else
10589dedec0cSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
10599dedec0cSmrg	LIBCABI=gnuabin32
10609dedec0cSmrg	#else
10619dedec0cSmrg	LIBCABI=${LIBC}
10629dedec0cSmrg	#endif
10639dedec0cSmrg	#endif
10649dedec0cSmrg
10659dedec0cSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10669dedec0cSmrg	CPU=mipsisa64r6
10679dedec0cSmrg	#else
10689dedec0cSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10699dedec0cSmrg	CPU=mipsisa32r6
10709dedec0cSmrg	#else
10719dedec0cSmrg	#if defined(__mips64)
10729dedec0cSmrg	CPU=mips64
10739dedec0cSmrg	#else
10749dedec0cSmrg	CPU=mips
10759dedec0cSmrg	#endif
10769dedec0cSmrg	#endif
10779dedec0cSmrg	#endif
10789dedec0cSmrg
10796c321187Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10809dedec0cSmrg	MIPS_ENDIAN=el
10816c321187Smrg	#else
10826c321187Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10839dedec0cSmrg	MIPS_ENDIAN=
10846c321187Smrg	#else
10859dedec0cSmrg	MIPS_ENDIAN=
10866c321187Smrg	#endif
10876c321187Smrg	#endif
10886c321187SmrgEOF
10899dedec0cSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
10909dedec0cSmrg	eval "$cc_set_vars"
10919dedec0cSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10926c321187Smrg	;;
1093198e4c3cSmrg    mips64el:Linux:*:*)
10949dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10959dedec0cSmrg	;;
1096198e4c3cSmrg    openrisc*:Linux:*:*)
10979dedec0cSmrg	GUESS=or1k-unknown-linux-$LIBC
10989dedec0cSmrg	;;
1099198e4c3cSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
11009dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11019dedec0cSmrg	;;
1102e120bd27Smrg    padre:Linux:*:*)
11039dedec0cSmrg	GUESS=sparc-unknown-linux-$LIBC
11049dedec0cSmrg	;;
1105e120bd27Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
11069dedec0cSmrg	GUESS=hppa64-unknown-linux-$LIBC
11079dedec0cSmrg	;;
11086c321187Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
11096c321187Smrg	# Look for CPU level
11106c321187Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
11119dedec0cSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
11129dedec0cSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
11139dedec0cSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11146c321187Smrg	esac
11159dedec0cSmrg	;;
1116e120bd27Smrg    ppc64:Linux:*:*)
11179dedec0cSmrg	GUESS=powerpc64-unknown-linux-$LIBC
11189dedec0cSmrg	;;
1119e120bd27Smrg    ppc:Linux:*:*)
11209dedec0cSmrg	GUESS=powerpc-unknown-linux-$LIBC
11219dedec0cSmrg	;;
11229d0b5e55Smrg    ppc64le:Linux:*:*)
11239dedec0cSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
11249dedec0cSmrg	;;
11259d0b5e55Smrg    ppcle:Linux:*:*)
11269dedec0cSmrg	GUESS=powerpcle-unknown-linux-$LIBC
11279dedec0cSmrg	;;
11289dedec0cSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
11299dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11309dedec0cSmrg	;;
11316c321187Smrg    s390:Linux:*:* | s390x:Linux:*:*)
11329dedec0cSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
11339dedec0cSmrg	;;
11346c321187Smrg    sh64*:Linux:*:*)
11359dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11369dedec0cSmrg	;;
11376c321187Smrg    sh*:Linux:*:*)
11389dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11399dedec0cSmrg	;;
11406c321187Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
11419dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11429dedec0cSmrg	;;
1143e120bd27Smrg    tile*:Linux:*:*)
11449dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11459dedec0cSmrg	;;
11466c321187Smrg    vax:Linux:*:*)
11479dedec0cSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
11489dedec0cSmrg	;;
11496c321187Smrg    x86_64:Linux:*:*)
11509dedec0cSmrg	set_cc_for_build
11519dedec0cSmrg	LIBCABI=$LIBC
11529dedec0cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11539dedec0cSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
11549dedec0cSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
11559dedec0cSmrg		grep IS_X32 >/dev/null
11569dedec0cSmrg	    then
11579dedec0cSmrg		LIBCABI=${LIBC}x32
11589dedec0cSmrg	    fi
11599dedec0cSmrg	fi
11609dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
11619dedec0cSmrg	;;
116293493779Smrg    xtensa*:Linux:*:*)
11639dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11649dedec0cSmrg	;;
11656c321187Smrg    i*86:DYNIX/ptx:4*:*)
11666c321187Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11676c321187Smrg	# earlier versions are messed up and put the nodename in both
11686c321187Smrg	# sysname and nodename.
11699dedec0cSmrg	GUESS=i386-sequent-sysv4
11709dedec0cSmrg	;;
11716c321187Smrg    i*86:UNIX_SV:4.2MP:2.*)
11729d0b5e55Smrg	# Unixware is an offshoot of SVR4, but it has its own version
11739d0b5e55Smrg	# number series starting with 2...
11749d0b5e55Smrg	# I am not positive that other SVR4 systems won't match this,
11756c321187Smrg	# I just have to hope.  -- rms.
11769d0b5e55Smrg	# Use sysv4.2uw... so that sysv4* matches it.
11779dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
11789dedec0cSmrg	;;
11796c321187Smrg    i*86:OS/2:*:*)
11806c321187Smrg	# If we were able to find `uname', then EMX Unix compatibility
11816c321187Smrg	# is probably installed.
11829dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
11839dedec0cSmrg	;;
11846c321187Smrg    i*86:XTS-300:*:STOP)
11859dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-stop
11869dedec0cSmrg	;;
11876c321187Smrg    i*86:atheos:*:*)
11889dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
11899dedec0cSmrg	;;
11906c321187Smrg    i*86:syllable:*:*)
11919dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-syllable
11929dedec0cSmrg	;;
1193e120bd27Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
11949dedec0cSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
11959dedec0cSmrg	;;
11966c321187Smrg    i*86:*DOS:*:*)
11979dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
11989dedec0cSmrg	;;
1199198e4c3cSmrg    i*86:*:4.*:*)
1200198e4c3cSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12016c321187Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
12029dedec0cSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12036c321187Smrg	else
12049dedec0cSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12056c321187Smrg	fi
12069dedec0cSmrg	;;
12076c321187Smrg    i*86:*:5:[678]*)
12089d0b5e55Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12096c321187Smrg	case `/bin/uname -X | grep "^Machine"` in
12106c321187Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
12116c321187Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12126c321187Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12136c321187Smrg	esac
12149dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
12159dedec0cSmrg	;;
12166c321187Smrg    i*86:*:3.2:*)
12176c321187Smrg	if test -f /usr/options/cb.name; then
12186c321187Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
12199dedec0cSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12206c321187Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12216c321187Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12226c321187Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12236c321187Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12246c321187Smrg			&& UNAME_MACHINE=i586
12256c321187Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12266c321187Smrg			&& UNAME_MACHINE=i686
12276c321187Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12286c321187Smrg			&& UNAME_MACHINE=i686
12299dedec0cSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12306c321187Smrg	else
12319dedec0cSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
12326c321187Smrg	fi
12339dedec0cSmrg	;;
12346c321187Smrg    pc:*:*:*)
12356c321187Smrg	# Left here for compatibility:
12369d0b5e55Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12379d0b5e55Smrg	# the processor, so we play safe by assuming i586.
1238e120bd27Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1239198e4c3cSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1240e120bd27Smrg	# this is a cross-build.
12419dedec0cSmrg	GUESS=i586-pc-msdosdjgpp
12429dedec0cSmrg	;;
12436c321187Smrg    Intel:Mach:3*:*)
12449dedec0cSmrg	GUESS=i386-pc-mach3
12459dedec0cSmrg	;;
12466c321187Smrg    paragon:*:*:*)
12479dedec0cSmrg	GUESS=i860-intel-osf1
12489dedec0cSmrg	;;
12496c321187Smrg    i860:*:4.*:*) # i860-SVR4
12506c321187Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
12519dedec0cSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12526c321187Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
12539dedec0cSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12546c321187Smrg	fi
12559dedec0cSmrg	;;
12566c321187Smrg    mini*:CTIX:SYS*5:*)
12576c321187Smrg	# "miniframe"
12589dedec0cSmrg	GUESS=m68010-convergent-sysv
12599dedec0cSmrg	;;
12606c321187Smrg    mc68k:UNIX:SYSTEM5:3.51m)
12619dedec0cSmrg	GUESS=m68k-convergent-sysv
12629dedec0cSmrg	;;
12636c321187Smrg    M680?0:D-NIX:5.3:*)
12649dedec0cSmrg	GUESS=m68k-diab-dnix
12659dedec0cSmrg	;;
12666c321187Smrg    M68*:*:R3V[5678]*:*)
12676c321187Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12686c321187Smrg    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)
12696c321187Smrg	OS_REL=''
12706c321187Smrg	test -r /etc/.relid \
12716c321187Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12726c321187Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273198e4c3cSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12746c321187Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275198e4c3cSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12766c321187Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12779d0b5e55Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12789d0b5e55Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1279e120bd27Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280e120bd27Smrg	OS_REL='.3'
1281e120bd27Smrg	test -r /etc/.relid \
1282e120bd27Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283e120bd27Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284198e4c3cSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285e120bd27Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286198e4c3cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287e120bd27Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288198e4c3cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12896c321187Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
12909dedec0cSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
12919dedec0cSmrg	;;
12926c321187Smrg    mc68030:UNIX_System_V:4.*:*)
12939dedec0cSmrg	GUESS=m68k-atari-sysv4
12949dedec0cSmrg	;;
12956c321187Smrg    TSUNAMI:LynxOS:2.*:*)
12969dedec0cSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
12979dedec0cSmrg	;;
12986c321187Smrg    rs6000:LynxOS:2.*:*)
12999dedec0cSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
13009dedec0cSmrg	;;
1301e120bd27Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
13029dedec0cSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
13039dedec0cSmrg	;;
13046c321187Smrg    SM[BE]S:UNIX_SV:*:*)
13059dedec0cSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
13069dedec0cSmrg	;;
13076c321187Smrg    RM*:ReliantUNIX-*:*:*)
13089dedec0cSmrg	GUESS=mips-sni-sysv4
13099dedec0cSmrg	;;
13106c321187Smrg    RM*:SINIX-*:*:*)
13119dedec0cSmrg	GUESS=mips-sni-sysv4
13129dedec0cSmrg	;;
13136c321187Smrg    *:SINIX-*:*:*)
13146c321187Smrg	if uname -p 2>/dev/null >/dev/null ; then
13156c321187Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
13169dedec0cSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
13176c321187Smrg	else
13189dedec0cSmrg		GUESS=ns32k-sni-sysv
13196c321187Smrg	fi
13209dedec0cSmrg	;;
13219d0b5e55Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13229d0b5e55Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
13239dedec0cSmrg	GUESS=i586-unisys-sysv4
13249dedec0cSmrg	;;
13256c321187Smrg    *:UNIX_System_V:4*:FTX*)
13266c321187Smrg	# From Gerald Hewes <hewes@openmarket.com>.
13276c321187Smrg	# How about differentiating between stratus architectures? -djm
13289dedec0cSmrg	GUESS=hppa1.1-stratus-sysv4
13299dedec0cSmrg	;;
13306c321187Smrg    *:*:*:FTX*)
13316c321187Smrg	# From seanf@swdc.stratus.com.
13329dedec0cSmrg	GUESS=i860-stratus-sysv4
13339dedec0cSmrg	;;
13346c321187Smrg    i*86:VOS:*:*)
13356c321187Smrg	# From Paul.Green@stratus.com.
13369dedec0cSmrg	GUESS=$UNAME_MACHINE-stratus-vos
13379dedec0cSmrg	;;
13386c321187Smrg    *:VOS:*:*)
13396c321187Smrg	# From Paul.Green@stratus.com.
13409dedec0cSmrg	GUESS=hppa1.1-stratus-vos
13419dedec0cSmrg	;;
13426c321187Smrg    mc68*:A/UX:*:*)
13439dedec0cSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
13449dedec0cSmrg	;;
13456c321187Smrg    news*:NEWS-OS:6*:*)
13469dedec0cSmrg	GUESS=mips-sony-newsos6
13479dedec0cSmrg	;;
13486c321187Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13499dedec0cSmrg	if test -d /usr/nec; then
13509dedec0cSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
13516c321187Smrg	else
13529dedec0cSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
13536c321187Smrg	fi
13549dedec0cSmrg	;;
13556c321187Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13569dedec0cSmrg	GUESS=powerpc-be-beos
13579dedec0cSmrg	;;
13586c321187Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13599dedec0cSmrg	GUESS=powerpc-apple-beos
13609dedec0cSmrg	;;
13616c321187Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13629dedec0cSmrg	GUESS=i586-pc-beos
13639dedec0cSmrg	;;
1364e120bd27Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13659dedec0cSmrg	GUESS=i586-pc-haiku
13669dedec0cSmrg	;;
13679d0b5e55Smrg    x86_64:Haiku:*:*)
13689dedec0cSmrg	GUESS=x86_64-unknown-haiku
13699dedec0cSmrg	;;
13706c321187Smrg    SX-4:SUPER-UX:*:*)
13719dedec0cSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
13729dedec0cSmrg	;;
13736c321187Smrg    SX-5:SUPER-UX:*:*)
13749dedec0cSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
13759dedec0cSmrg	;;
13766c321187Smrg    SX-6:SUPER-UX:*:*)
13779dedec0cSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
13789dedec0cSmrg	;;
137993493779Smrg    SX-7:SUPER-UX:*:*)
13809dedec0cSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
13819dedec0cSmrg	;;
138293493779Smrg    SX-8:SUPER-UX:*:*)
13839dedec0cSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
13849dedec0cSmrg	;;
138593493779Smrg    SX-8R:SUPER-UX:*:*)
13869dedec0cSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
13879dedec0cSmrg	;;
1388198e4c3cSmrg    SX-ACE:SUPER-UX:*:*)
13899dedec0cSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
13909dedec0cSmrg	;;
13916c321187Smrg    Power*:Rhapsody:*:*)
13929dedec0cSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
13939dedec0cSmrg	;;
13946c321187Smrg    *:Rhapsody:*:*)
13959dedec0cSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
13969dedec0cSmrg	;;
13979dedec0cSmrg    arm64:Darwin:*:*)
13989dedec0cSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
13999dedec0cSmrg	;;
14006c321187Smrg    *:Darwin:*:*)
14019dedec0cSmrg	UNAME_PROCESSOR=`uname -p`
14029dedec0cSmrg	case $UNAME_PROCESSOR in
14039dedec0cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14049dedec0cSmrg	esac
14059dedec0cSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
14069dedec0cSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
14079dedec0cSmrg	    # Avoid executing cc if there is no toolchain installed as
14089dedec0cSmrg	    # cc will be a stub that puts up a graphical alert
14099dedec0cSmrg	    # prompting the user to install developer tools.
14109dedec0cSmrg	    CC_FOR_BUILD=no_compiler_found
14119dedec0cSmrg	else
14129dedec0cSmrg	    set_cc_for_build
14139d0b5e55Smrg	fi
14149dedec0cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14159dedec0cSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
14169dedec0cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14179dedec0cSmrg		   grep IS_64BIT_ARCH >/dev/null
14189dedec0cSmrg	    then
14199dedec0cSmrg		case $UNAME_PROCESSOR in
14209dedec0cSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14219dedec0cSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14229dedec0cSmrg		esac
14239dedec0cSmrg	    fi
14249dedec0cSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
14259dedec0cSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
14269dedec0cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14279dedec0cSmrg		   grep IS_PPC >/dev/null
14289dedec0cSmrg	    then
14299dedec0cSmrg		UNAME_PROCESSOR=powerpc
14309d0b5e55Smrg	    fi
1431198e4c3cSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
14329dedec0cSmrg	    # uname -m returns i386 or x86_64
14339dedec0cSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
14349d0b5e55Smrg	fi
14359dedec0cSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
14369dedec0cSmrg	;;
14376c321187Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14386c321187Smrg	UNAME_PROCESSOR=`uname -p`
1439198e4c3cSmrg	if test "$UNAME_PROCESSOR" = x86; then
14406c321187Smrg		UNAME_PROCESSOR=i386
14416c321187Smrg		UNAME_MACHINE=pc
14426c321187Smrg	fi
14439dedec0cSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
14449dedec0cSmrg	;;
14456c321187Smrg    *:QNX:*:4*)
14469dedec0cSmrg	GUESS=i386-pc-qnx
14479dedec0cSmrg	;;
1448198e4c3cSmrg    NEO-*:NONSTOP_KERNEL:*:*)
14499dedec0cSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
14509dedec0cSmrg	;;
14519d0b5e55Smrg    NSE-*:NONSTOP_KERNEL:*:*)
14529dedec0cSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
14539dedec0cSmrg	;;
1454198e4c3cSmrg    NSR-*:NONSTOP_KERNEL:*:*)
14559dedec0cSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
14569dedec0cSmrg	;;
1457198e4c3cSmrg    NSV-*:NONSTOP_KERNEL:*:*)
14589dedec0cSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
14599dedec0cSmrg	;;
1460198e4c3cSmrg    NSX-*:NONSTOP_KERNEL:*:*)
14619dedec0cSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
14629dedec0cSmrg	;;
14636c321187Smrg    *:NonStop-UX:*:*)
14649dedec0cSmrg	GUESS=mips-compaq-nonstopux
14659dedec0cSmrg	;;
14666c321187Smrg    BS2000:POSIX*:*:*)
14679dedec0cSmrg	GUESS=bs2000-siemens-sysv
14689dedec0cSmrg	;;
14696c321187Smrg    DS/*:UNIX_System_V:*:*)
14709dedec0cSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
14719dedec0cSmrg	;;
14726c321187Smrg    *:Plan9:*:*)
14736c321187Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
14746c321187Smrg	# is converted to i386 for consistency with other x86
14756c321187Smrg	# operating systems.
14769dedec0cSmrg	if test "${cputype-}" = 386; then
14776c321187Smrg	    UNAME_MACHINE=i386
14789dedec0cSmrg	elif test "x${cputype-}" != x; then
14799dedec0cSmrg	    UNAME_MACHINE=$cputype
14806c321187Smrg	fi
14819dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
14829dedec0cSmrg	;;
14836c321187Smrg    *:TOPS-10:*:*)
14849dedec0cSmrg	GUESS=pdp10-unknown-tops10
14859dedec0cSmrg	;;
14866c321187Smrg    *:TENEX:*:*)
14879dedec0cSmrg	GUESS=pdp10-unknown-tenex
14889dedec0cSmrg	;;
14896c321187Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14909dedec0cSmrg	GUESS=pdp10-dec-tops20
14919dedec0cSmrg	;;
14926c321187Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14939dedec0cSmrg	GUESS=pdp10-xkl-tops20
14949dedec0cSmrg	;;
14956c321187Smrg    *:TOPS-20:*:*)
14969dedec0cSmrg	GUESS=pdp10-unknown-tops20
14979dedec0cSmrg	;;
14986c321187Smrg    *:ITS:*:*)
14999dedec0cSmrg	GUESS=pdp10-unknown-its
15009dedec0cSmrg	;;
15016c321187Smrg    SEI:*:*:SEIUX)
15029dedec0cSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
15039dedec0cSmrg	;;
15046c321187Smrg    *:DragonFly:*:*)
15059dedec0cSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
15069dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
15079dedec0cSmrg	;;
15086c321187Smrg    *:*VMS:*:*)
15099d0b5e55Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
15109dedec0cSmrg	case $UNAME_MACHINE in
15119dedec0cSmrg	    A*) GUESS=alpha-dec-vms ;;
15129dedec0cSmrg	    I*) GUESS=ia64-dec-vms ;;
15139dedec0cSmrg	    V*) GUESS=vax-dec-vms ;;
15146c321187Smrg	esac ;;
15156c321187Smrg    *:XENIX:*:SysV)
15169dedec0cSmrg	GUESS=i386-pc-xenix
15179dedec0cSmrg	;;
15186c321187Smrg    i*86:skyos:*:*)
15199dedec0cSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
15209dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
15219dedec0cSmrg	;;
15226c321187Smrg    i*86:rdos:*:*)
15239dedec0cSmrg	GUESS=$UNAME_MACHINE-pc-rdos
15249dedec0cSmrg	;;
15259dedec0cSmrg    *:AROS:*:*)
15269dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-aros
15279dedec0cSmrg	;;
15289d0b5e55Smrg    x86_64:VMkernel:*:*)
15299dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-esx
15309dedec0cSmrg	;;
1531198e4c3cSmrg    amd64:Isilon\ OneFS:*:*)
15329dedec0cSmrg	GUESS=x86_64-unknown-onefs
15339dedec0cSmrg	;;
15349dedec0cSmrg    *:Unleashed:*:*)
15359dedec0cSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
15369dedec0cSmrg	;;
15376c321187Smrgesac
15386c321187Smrg
15399dedec0cSmrg# Do we have a guess based on uname results?
15409dedec0cSmrgif test "x$GUESS" != x; then
15419dedec0cSmrg    echo "$GUESS"
15429dedec0cSmrg    exit
15439dedec0cSmrgfi
15449dedec0cSmrg
15459dedec0cSmrg# No uname command or uname output not recognized.
15469dedec0cSmrgset_cc_for_build
15479dedec0cSmrgcat > "$dummy.c" <<EOF
15489dedec0cSmrg#ifdef _SEQUENT_
15499dedec0cSmrg#include <sys/types.h>
15509dedec0cSmrg#include <sys/utsname.h>
15519dedec0cSmrg#endif
15529dedec0cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15539dedec0cSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15549dedec0cSmrg#include <signal.h>
15559dedec0cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
15569dedec0cSmrg#include <sys/utsname.h>
15579dedec0cSmrg#endif
15589dedec0cSmrg#endif
15599dedec0cSmrg#endif
15609dedec0cSmrgmain ()
15619dedec0cSmrg{
15629dedec0cSmrg#if defined (sony)
15639dedec0cSmrg#if defined (MIPSEB)
15649dedec0cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15659dedec0cSmrg     I don't know....  */
15669dedec0cSmrg  printf ("mips-sony-bsd\n"); exit (0);
15679dedec0cSmrg#else
15689dedec0cSmrg#include <sys/param.h>
15699dedec0cSmrg  printf ("m68k-sony-newsos%s\n",
15709dedec0cSmrg#ifdef NEWSOS4
15719dedec0cSmrg  "4"
15729dedec0cSmrg#else
15739dedec0cSmrg  ""
15749dedec0cSmrg#endif
15759dedec0cSmrg  ); exit (0);
15769dedec0cSmrg#endif
15779dedec0cSmrg#endif
15789dedec0cSmrg
15799dedec0cSmrg#if defined (NeXT)
15809dedec0cSmrg#if !defined (__ARCHITECTURE__)
15819dedec0cSmrg#define __ARCHITECTURE__ "m68k"
15829dedec0cSmrg#endif
15839dedec0cSmrg  int version;
15849dedec0cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15859dedec0cSmrg  if (version < 4)
15869dedec0cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15879dedec0cSmrg  else
15889dedec0cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15899dedec0cSmrg  exit (0);
15909dedec0cSmrg#endif
15919dedec0cSmrg
15929dedec0cSmrg#if defined (MULTIMAX) || defined (n16)
15939dedec0cSmrg#if defined (UMAXV)
15949dedec0cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
15959dedec0cSmrg#else
15969dedec0cSmrg#if defined (CMU)
15979dedec0cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
15989dedec0cSmrg#else
15999dedec0cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
16009dedec0cSmrg#endif
16019dedec0cSmrg#endif
16029dedec0cSmrg#endif
16039dedec0cSmrg
16049dedec0cSmrg#if defined (__386BSD__)
16059dedec0cSmrg  printf ("i386-pc-bsd\n"); exit (0);
16069dedec0cSmrg#endif
16079dedec0cSmrg
16089dedec0cSmrg#if defined (sequent)
16099dedec0cSmrg#if defined (i386)
16109dedec0cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
16119dedec0cSmrg#endif
16129dedec0cSmrg#if defined (ns32000)
16139dedec0cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16149dedec0cSmrg#endif
16159dedec0cSmrg#endif
16169dedec0cSmrg
16179dedec0cSmrg#if defined (_SEQUENT_)
16189dedec0cSmrg  struct utsname un;
16199dedec0cSmrg
16209dedec0cSmrg  uname(&un);
16219dedec0cSmrg  if (strncmp(un.version, "V2", 2) == 0) {
16229dedec0cSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
16239dedec0cSmrg  }
16249dedec0cSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16259dedec0cSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
16269dedec0cSmrg  }
16279dedec0cSmrg  printf ("i386-sequent-ptx\n"); exit (0);
16289dedec0cSmrg#endif
16299dedec0cSmrg
16309dedec0cSmrg#if defined (vax)
16319dedec0cSmrg#if !defined (ultrix)
16329dedec0cSmrg#include <sys/param.h>
16339dedec0cSmrg#if defined (BSD)
16349dedec0cSmrg#if BSD == 43
16359dedec0cSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
16369dedec0cSmrg#else
16379dedec0cSmrg#if BSD == 199006
16389dedec0cSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16399dedec0cSmrg#else
16409dedec0cSmrg  printf ("vax-dec-bsd\n"); exit (0);
16419dedec0cSmrg#endif
16429dedec0cSmrg#endif
16439dedec0cSmrg#else
16449dedec0cSmrg  printf ("vax-dec-bsd\n"); exit (0);
16459dedec0cSmrg#endif
16469dedec0cSmrg#else
16479dedec0cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
16489dedec0cSmrg  struct utsname un;
16499dedec0cSmrg  uname (&un);
16509dedec0cSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16519dedec0cSmrg#else
16529dedec0cSmrg  printf ("vax-dec-ultrix\n"); exit (0);
16539dedec0cSmrg#endif
16549dedec0cSmrg#endif
16559dedec0cSmrg#endif
16569dedec0cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16579dedec0cSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16589dedec0cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
16599dedec0cSmrg  struct utsname *un;
16609dedec0cSmrg  uname (&un);
16619dedec0cSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16629dedec0cSmrg#else
16639dedec0cSmrg  printf ("mips-dec-ultrix\n"); exit (0);
16649dedec0cSmrg#endif
16659dedec0cSmrg#endif
16669dedec0cSmrg#endif
16679dedec0cSmrg
16689dedec0cSmrg#if defined (alliant) && defined (i860)
16699dedec0cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
16709dedec0cSmrg#endif
16719dedec0cSmrg
16729dedec0cSmrg  exit (1);
16739dedec0cSmrg}
16749dedec0cSmrgEOF
16759dedec0cSmrg
16769dedec0cSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16779dedec0cSmrg	{ echo "$SYSTEM_NAME"; exit; }
16789dedec0cSmrg
16799dedec0cSmrg# Apollos put the system type in the environment.
16809dedec0cSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16819dedec0cSmrg
1682198e4c3cSmrgecho "$0: unable to guess system type" >&2
16836c321187Smrg
16849dedec0cSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685198e4c3cSmrg    mips:Linux | mips64:Linux)
1686198e4c3cSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1687198e4c3cSmrg	cat >&2 <<EOF
16886c321187Smrg
1689198e4c3cSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690198e4c3cSmrgthe system type. Please install a C compiler and try again.
16916c321187SmrgEOF
1692198e4c3cSmrg	;;
1693198e4c3cSmrgesac
16946c321187Smrg
16956c321187Smrgcat >&2 <<EOF
16966c321187Smrg
1697198e4c3cSmrgThis script (version $timestamp), has failed to recognize the
1698198e4c3cSmrgoperating system you are using. If your script is old, overwrite *all*
1699198e4c3cSmrgcopies of config.guess and config.sub with the latest versions from:
17006c321187Smrg
17019dedec0cSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17026c321187Smrgand
17039dedec0cSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17049dedec0cSmrgEOF
17059dedec0cSmrg
17069dedec0cSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
17079dedec0cSmrgthisyear=`date +%Y`
17089dedec0cSmrg# shellcheck disable=SC2003
17099dedec0cSmrgscript_age=`expr "$thisyear" - "$our_year"`
17109dedec0cSmrgif test "$script_age" -lt 3 ; then
17119dedec0cSmrg   cat >&2 <<EOF
17126c321187Smrg
1713198e4c3cSmrgIf $0 has already been updated, send the following data and any
1714198e4c3cSmrginformation you think might be pertinent to config-patches@gnu.org to
1715198e4c3cSmrgprovide the necessary information to handle your system.
17166c321187Smrg
17176c321187Smrgconfig.guess timestamp = $timestamp
17186c321187Smrg
17196c321187Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17206c321187Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17216c321187Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17226c321187Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17236c321187Smrg
17246c321187Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17256c321187Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17266c321187Smrg
17276c321187Smrghostinfo               = `(hostinfo) 2>/dev/null`
17286c321187Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17296c321187Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17306c321187Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17316c321187Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17326c321187Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17336c321187Smrg
1734198e4c3cSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735198e4c3cSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736198e4c3cSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737198e4c3cSmrgUNAME_VERSION = "$UNAME_VERSION"
17386c321187SmrgEOF
17399dedec0cSmrgfi
17406c321187Smrg
17416c321187Smrgexit 1
17426c321187Smrg
17436c321187Smrg# Local variables:
17449dedec0cSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
17456c321187Smrg# time-stamp-start: "timestamp='"
17466c321187Smrg# time-stamp-format: "%:y-%02m-%02d"
17476c321187Smrg# time-stamp-end: "'"
17486c321187Smrg# End:
1749