17914d74bSmrg#! /bin/sh
27914d74bSmrg# Attempt to guess a canonical system name.
36b7436aeSmrg#   Copyright 1992-2022 Free Software Foundation, Inc.
47914d74bSmrg
50ea508b1Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
60ea508b1Smrg
76b7436aeSmrgtimestamp='2022-01-09'
87914d74bSmrg
97914d74bSmrg# This file is free software; you can redistribute it and/or modify it
107914d74bSmrg# under the terms of the GNU General Public License as published by
110ea508b1Smrg# the Free Software Foundation, either version 3 of the License, or
127914d74bSmrg# (at your option) any later version.
137914d74bSmrg#
147914d74bSmrg# This program is distributed in the hope that it will be useful, but
157914d74bSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
167914d74bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
177914d74bSmrg# General Public License for more details.
187914d74bSmrg#
197914d74bSmrg# You should have received a copy of the GNU General Public License
20cdce750aSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
217914d74bSmrg#
227914d74bSmrg# As a special exception to the GNU General Public License, if you
237914d74bSmrg# distribute this file as part of a program that contains a
247914d74bSmrg# configuration script generated by Autoconf, you may include it under
25e6d5e4e0Smrg# the same distribution terms that you use for the rest of that
26e6d5e4e0Smrg# program.  This Exception is an additional permission under section 7
27e6d5e4e0Smrg# of the GNU General Public License, version 3 ("GPLv3").
287914d74bSmrg#
299d0ccd10Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
307914d74bSmrg#
31e8ead290Smrg# You can get the latest version of this script from:
320ea508b1Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33e6d5e4e0Smrg#
349d0ccd10Smrg# Please send patches to <config-patches@gnu.org>.
35e6d5e4e0Smrg
367914d74bSmrg
370ea508b1Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
380ea508b1Smrg# about features and limitations of the classic Bourne shell that were
390ea508b1Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
400ea508b1Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
410ea508b1Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
420ea508b1Smrg# have a pre-POSIX /bin/sh.
430ea508b1Smrg
440ea508b1Smrg
457914d74bSmrgme=`echo "$0" | sed -e 's,.*/,,'`
467914d74bSmrg
477914d74bSmrgusage="\
487914d74bSmrgUsage: $0 [OPTION]
497914d74bSmrg
507914d74bSmrgOutput the configuration name of the system \`$me' is run on.
517914d74bSmrg
52cdce750aSmrgOptions:
537914d74bSmrg  -h, --help         print this help, then exit
547914d74bSmrg  -t, --time-stamp   print date of last modification, then exit
557914d74bSmrg  -v, --version      print version number, then exit
567914d74bSmrg
577914d74bSmrgReport bugs and patches to <config-patches@gnu.org>."
587914d74bSmrg
597914d74bSmrgversion="\
607914d74bSmrgGNU config.guess ($timestamp)
617914d74bSmrg
627914d74bSmrgOriginally written by Per Bothner.
636b7436aeSmrgCopyright 1992-2022 Free Software Foundation, Inc.
647914d74bSmrg
657914d74bSmrgThis is free software; see the source for copying conditions.  There is NO
667914d74bSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
677914d74bSmrg
687914d74bSmrghelp="
697914d74bSmrgTry \`$me --help' for more information."
707914d74bSmrg
717914d74bSmrg# Parse command line
727914d74bSmrgwhile test $# -gt 0 ; do
737914d74bSmrg  case $1 in
747914d74bSmrg    --time-stamp | --time* | -t )
757914d74bSmrg       echo "$timestamp" ; exit ;;
767914d74bSmrg    --version | -v )
777914d74bSmrg       echo "$version" ; exit ;;
787914d74bSmrg    --help | --h* | -h )
797914d74bSmrg       echo "$usage"; exit ;;
807914d74bSmrg    -- )     # Stop option processing
817914d74bSmrg       shift; break ;;
827914d74bSmrg    - )	# Use stdin as input.
837914d74bSmrg       break ;;
847914d74bSmrg    -* )
857914d74bSmrg       echo "$me: invalid option $1$help" >&2
867914d74bSmrg       exit 1 ;;
877914d74bSmrg    * )
887914d74bSmrg       break ;;
897914d74bSmrg  esac
907914d74bSmrgdone
917914d74bSmrg
927914d74bSmrgif test $# != 0; then
937914d74bSmrg  echo "$me: too many arguments$help" >&2
947914d74bSmrg  exit 1
957914d74bSmrgfi
967914d74bSmrg
970ea508b1Smrg# Just in case it came from the environment.
980ea508b1SmrgGUESS=
997914d74bSmrg
1007914d74bSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1017914d74bSmrg# compiler to aid in system detection is discouraged as it requires
1027914d74bSmrg# temporary files to be created and, as you can see below, it is a
1037914d74bSmrg# headache to deal with in a portable fashion.
1047914d74bSmrg
1057914d74bSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1067914d74bSmrg# use `HOST_CC' if defined, but it is deprecated.
1077914d74bSmrg
1087914d74bSmrg# Portable tmp directory creation inspired by the Autoconf team.
1097914d74bSmrg
1100ea508b1Smrgtmp=
1110ea508b1Smrg# shellcheck disable=SC2172
1120ea508b1Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1130ea508b1Smrg
1140ea508b1Smrgset_cc_for_build() {
1150ea508b1Smrg    # prevent multiple calls if $tmp is already set
1160ea508b1Smrg    test "$tmp" && return 0
1170ea508b1Smrg    : "${TMPDIR=/tmp}"
1180ea508b1Smrg    # shellcheck disable=SC2039,SC3028
1190ea508b1Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1200ea508b1Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1210ea508b1Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1220ea508b1Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1230ea508b1Smrg    dummy=$tmp/dummy
1240ea508b1Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1250ea508b1Smrg	,,)    echo "int x;" > "$dummy.c"
1260ea508b1Smrg	       for driver in cc gcc c89 c99 ; do
1270ea508b1Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1280ea508b1Smrg		       CC_FOR_BUILD=$driver
1290ea508b1Smrg		       break
1300ea508b1Smrg		   fi
1310ea508b1Smrg	       done
1320ea508b1Smrg	       if test x"$CC_FOR_BUILD" = x ; then
1330ea508b1Smrg		   CC_FOR_BUILD=no_compiler_found
1340ea508b1Smrg	       fi
1350ea508b1Smrg	       ;;
1360ea508b1Smrg	,,*)   CC_FOR_BUILD=$CC ;;
1370ea508b1Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1380ea508b1Smrg    esac
1390ea508b1Smrg}
1407914d74bSmrg
1417914d74bSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1427914d74bSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
1430ea508b1Smrgif test -f /.attbin/uname ; then
1447914d74bSmrg	PATH=$PATH:/.attbin ; export PATH
1457914d74bSmrgfi
1467914d74bSmrg
1477914d74bSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1487914d74bSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1490ea508b1SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1507914d74bSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1517914d74bSmrg
1520ea508b1Smrgcase $UNAME_SYSTEM in
1539d0ccd10SmrgLinux|GNU|GNU/*)
1540ea508b1Smrg	LIBC=unknown
1559d0ccd10Smrg
1560ea508b1Smrg	set_cc_for_build
157cdce750aSmrg	cat <<-EOF > "$dummy.c"
1589d0ccd10Smrg	#include <features.h>
1599d0ccd10Smrg	#if defined(__UCLIBC__)
1609d0ccd10Smrg	LIBC=uclibc
1619d0ccd10Smrg	#elif defined(__dietlibc__)
1629d0ccd10Smrg	LIBC=dietlibc
1630ea508b1Smrg	#elif defined(__GLIBC__)
1649d0ccd10Smrg	LIBC=gnu
1650ea508b1Smrg	#else
1660ea508b1Smrg	#include <stdarg.h>
1670ea508b1Smrg	/* First heuristic to detect musl libc.  */
1680ea508b1Smrg	#ifdef __DEFINED_va_list
1690ea508b1Smrg	LIBC=musl
1700ea508b1Smrg	#endif
1719d0ccd10Smrg	#endif
1729d0ccd10Smrg	EOF
1730ea508b1Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
1740ea508b1Smrg	eval "$cc_set_libc"
175cdce750aSmrg
1760ea508b1Smrg	# Second heuristic to detect musl libc.
1770ea508b1Smrg	if [ "$LIBC" = unknown ] &&
1780ea508b1Smrg	   command -v ldd >/dev/null &&
1790ea508b1Smrg	   ldd --version 2>&1 | grep -q ^musl; then
1800ea508b1Smrg		LIBC=musl
1810ea508b1Smrg	fi
1820ea508b1Smrg
1830ea508b1Smrg	# If the system lacks a compiler, then just pick glibc.
1840ea508b1Smrg	# We could probably try harder.
1850ea508b1Smrg	if [ "$LIBC" = unknown ]; then
1860ea508b1Smrg		LIBC=gnu
187cdce750aSmrg	fi
1889d0ccd10Smrg	;;
1899d0ccd10Smrgesac
1909d0ccd10Smrg
1917914d74bSmrg# Note: order is significant - the case branches are not exclusive.
1927914d74bSmrg
1930ea508b1Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
1947914d74bSmrg    *:NetBSD:*:*)
1957914d74bSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
196e6d5e4e0Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1977914d74bSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1987914d74bSmrg	# switched to ELF, *-*-netbsd* would select the old
1997914d74bSmrg	# object file format.  This provides both forward
2007914d74bSmrg	# compatibility and a consistent mechanism for selecting the
2017914d74bSmrg	# object file format.
2027914d74bSmrg	#
2037914d74bSmrg	# Note: NetBSD doesn't particularly care about the vendor
2047914d74bSmrg	# portion of the name.  We always set it to "unknown".
2059d0ccd10Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2060ea508b1Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2070ea508b1Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2089d0ccd10Smrg	    echo unknown)`
2090ea508b1Smrg	case $UNAME_MACHINE_ARCH in
2100ea508b1Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
2117914d74bSmrg	    armeb) machine=armeb-unknown ;;
2127914d74bSmrg	    arm*) machine=arm-unknown ;;
2137914d74bSmrg	    sh3el) machine=shl-unknown ;;
2147914d74bSmrg	    sh3eb) machine=sh-unknown ;;
2157914d74bSmrg	    sh5el) machine=sh5le-unknown ;;
2169d0ccd10Smrg	    earmv*)
217cdce750aSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218cdce750aSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
2190ea508b1Smrg		machine=${arch}${endian}-unknown
2209d0ccd10Smrg		;;
2210ea508b1Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2227914d74bSmrg	esac
2237914d74bSmrg	# The Operating System including object format, if it has switched
224cdce750aSmrg	# to ELF recently (or will in the future) and ABI.
2250ea508b1Smrg	case $UNAME_MACHINE_ARCH in
226cdce750aSmrg	    earm*)
227cdce750aSmrg		os=netbsdelf
228cdce750aSmrg		;;
229cdce750aSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2300ea508b1Smrg		set_cc_for_build
2317914d74bSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232e8ead290Smrg			| grep -q __ELF__
2337914d74bSmrg		then
2347914d74bSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2357914d74bSmrg		    # Return netbsd for either.  FIX?
2367914d74bSmrg		    os=netbsd
2377914d74bSmrg		else
2387914d74bSmrg		    os=netbsdelf
2397914d74bSmrg		fi
2407914d74bSmrg		;;
2417914d74bSmrg	    *)
242e6d5e4e0Smrg		os=netbsd
2437914d74bSmrg		;;
2447914d74bSmrg	esac
2459d0ccd10Smrg	# Determine ABI tags.
2460ea508b1Smrg	case $UNAME_MACHINE_ARCH in
2479d0ccd10Smrg	    earm*)
2489d0ccd10Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249cdce750aSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2509d0ccd10Smrg		;;
2519d0ccd10Smrg	esac
2527914d74bSmrg	# The OS release
2537914d74bSmrg	# Debian GNU/NetBSD machines have a different userland, and
2547914d74bSmrg	# thus, need a distinct triplet. However, they do not need
2557914d74bSmrg	# kernel version information, so it can be replaced with a
2567914d74bSmrg	# suitable tag, in the style of linux-gnu.
2570ea508b1Smrg	case $UNAME_VERSION in
2587914d74bSmrg	    Debian*)
2597914d74bSmrg		release='-gnu'
2607914d74bSmrg		;;
2617914d74bSmrg	    *)
262cdce750aSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2637914d74bSmrg		;;
2647914d74bSmrg	esac
2657914d74bSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2667914d74bSmrg	# contains redundant information, the shorter form:
2677914d74bSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2680ea508b1Smrg	GUESS=$machine-${os}${release}${abi-}
2690ea508b1Smrg	;;
270e6d5e4e0Smrg    *:Bitrig:*:*)
271e6d5e4e0Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2720ea508b1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
2730ea508b1Smrg	;;
2747914d74bSmrg    *:OpenBSD:*:*)
2757914d74bSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2760ea508b1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
2770ea508b1Smrg	;;
2780ea508b1Smrg    *:SecBSD:*:*)
2790ea508b1Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
2800ea508b1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
2810ea508b1Smrg	;;
282cdce750aSmrg    *:LibertyBSD:*:*)
283cdce750aSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2840ea508b1Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
2850ea508b1Smrg	;;
286cdce750aSmrg    *:MidnightBSD:*:*)
2870ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
2880ea508b1Smrg	;;
2897914d74bSmrg    *:ekkoBSD:*:*)
2900ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
2910ea508b1Smrg	;;
2927914d74bSmrg    *:SolidBSD:*:*)
2930ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
2940ea508b1Smrg	;;
2950ea508b1Smrg    *:OS108:*:*)
2960ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
2970ea508b1Smrg	;;
2987914d74bSmrg    macppc:MirBSD:*:*)
2990ea508b1Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
3000ea508b1Smrg	;;
3017914d74bSmrg    *:MirBSD:*:*)
3020ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
3030ea508b1Smrg	;;
3049d0ccd10Smrg    *:Sortix:*:*)
3050ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
3060ea508b1Smrg	;;
3070ea508b1Smrg    *:Twizzler:*:*)
3080ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
3090ea508b1Smrg	;;
310cdce750aSmrg    *:Redox:*:*)
3110ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-redox
3120ea508b1Smrg	;;
313cdce750aSmrg    mips:OSF1:*.*)
3140ea508b1Smrg	GUESS=mips-dec-osf1
3150ea508b1Smrg	;;
3167914d74bSmrg    alpha:OSF1:*:*)
3170ea508b1Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3180ea508b1Smrg	trap '' 0
3197914d74bSmrg	case $UNAME_RELEASE in
3207914d74bSmrg	*4.0)
3217914d74bSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3227914d74bSmrg		;;
3237914d74bSmrg	*5.*)
324e6d5e4e0Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3257914d74bSmrg		;;
3267914d74bSmrg	esac
3277914d74bSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3287914d74bSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3297914d74bSmrg	# covers most systems running today.  This code pipes the CPU
3307914d74bSmrg	# types through head -n 1, so we only detect the type of CPU 0.
3317914d74bSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3320ea508b1Smrg	case $ALPHA_CPU_TYPE in
3337914d74bSmrg	    "EV4 (21064)")
334cdce750aSmrg		UNAME_MACHINE=alpha ;;
3357914d74bSmrg	    "EV4.5 (21064)")
336cdce750aSmrg		UNAME_MACHINE=alpha ;;
3377914d74bSmrg	    "LCA4 (21066/21068)")
338cdce750aSmrg		UNAME_MACHINE=alpha ;;
3397914d74bSmrg	    "EV5 (21164)")
340cdce750aSmrg		UNAME_MACHINE=alphaev5 ;;
3417914d74bSmrg	    "EV5.6 (21164A)")
342cdce750aSmrg		UNAME_MACHINE=alphaev56 ;;
3437914d74bSmrg	    "EV5.6 (21164PC)")
344cdce750aSmrg		UNAME_MACHINE=alphapca56 ;;
3457914d74bSmrg	    "EV5.7 (21164PC)")
346cdce750aSmrg		UNAME_MACHINE=alphapca57 ;;
3477914d74bSmrg	    "EV6 (21264)")
348cdce750aSmrg		UNAME_MACHINE=alphaev6 ;;
3497914d74bSmrg	    "EV6.7 (21264A)")
350cdce750aSmrg		UNAME_MACHINE=alphaev67 ;;
3517914d74bSmrg	    "EV6.8CB (21264C)")
352cdce750aSmrg		UNAME_MACHINE=alphaev68 ;;
3537914d74bSmrg	    "EV6.8AL (21264B)")
354cdce750aSmrg		UNAME_MACHINE=alphaev68 ;;
3557914d74bSmrg	    "EV6.8CX (21264D)")
356cdce750aSmrg		UNAME_MACHINE=alphaev68 ;;
3577914d74bSmrg	    "EV6.9A (21264/EV69A)")
358cdce750aSmrg		UNAME_MACHINE=alphaev69 ;;
3597914d74bSmrg	    "EV7 (21364)")
360cdce750aSmrg		UNAME_MACHINE=alphaev7 ;;
3617914d74bSmrg	    "EV7.9 (21364A)")
362cdce750aSmrg		UNAME_MACHINE=alphaev79 ;;
3637914d74bSmrg	esac
3647914d74bSmrg	# A Pn.n version is a patched version.
3657914d74bSmrg	# A Vn.n version is a released version.
3667914d74bSmrg	# A Tn.n version is a released field test version.
3677914d74bSmrg	# A Xn.n version is an unreleased experimental baselevel.
3687914d74bSmrg	# 1.2 uses "1.2" for uname -r.
3690ea508b1Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
3700ea508b1Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
3710ea508b1Smrg	;;
3727914d74bSmrg    Amiga*:UNIX_System_V:4.0:*)
3730ea508b1Smrg	GUESS=m68k-unknown-sysv4
3740ea508b1Smrg	;;
3757914d74bSmrg    *:[Aa]miga[Oo][Ss]:*:*)
3760ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
3770ea508b1Smrg	;;
3787914d74bSmrg    *:[Mm]orph[Oo][Ss]:*:*)
3790ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
3800ea508b1Smrg	;;
3817914d74bSmrg    *:OS/390:*:*)
3820ea508b1Smrg	GUESS=i370-ibm-openedition
3830ea508b1Smrg	;;
3847914d74bSmrg    *:z/VM:*:*)
3850ea508b1Smrg	GUESS=s390-ibm-zvmoe
3860ea508b1Smrg	;;
3877914d74bSmrg    *:OS400:*:*)
3880ea508b1Smrg	GUESS=powerpc-ibm-os400
3890ea508b1Smrg	;;
3907914d74bSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3910ea508b1Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
3920ea508b1Smrg	;;
393e6d5e4e0Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3940ea508b1Smrg	GUESS=arm-unknown-riscos
3950ea508b1Smrg	;;
3967914d74bSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3970ea508b1Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
3980ea508b1Smrg	;;
3997914d74bSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4007914d74bSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
4010ea508b1Smrg	case `(/bin/universe) 2>/dev/null` in
4020ea508b1Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
4030ea508b1Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
4040ea508b1Smrg	esac
4050ea508b1Smrg	;;
4067914d74bSmrg    NILE*:*:*:dcosx)
4070ea508b1Smrg	GUESS=pyramid-pyramid-svr4
4080ea508b1Smrg	;;
4097914d74bSmrg    DRS?6000:unix:4.0:6*)
4100ea508b1Smrg	GUESS=sparc-icl-nx6
4110ea508b1Smrg	;;
4127914d74bSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4137914d74bSmrg	case `/usr/bin/uname -p` in
4140ea508b1Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
4150ea508b1Smrg	esac
4160ea508b1Smrg	;;
417e8ead290Smrg    s390x:SunOS:*:*)
4180ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4190ea508b1Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
4200ea508b1Smrg	;;
4217914d74bSmrg    sun4H:SunOS:5.*:*)
4220ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4230ea508b1Smrg	GUESS=sparc-hal-solaris2$SUN_REL
4240ea508b1Smrg	;;
4257914d74bSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
4260ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4270ea508b1Smrg	GUESS=sparc-sun-solaris2$SUN_REL
4280ea508b1Smrg	;;
429e8ead290Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
4300ea508b1Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
4310ea508b1Smrg	;;
4327914d74bSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4330ea508b1Smrg	set_cc_for_build
434cdce750aSmrg	SUN_ARCH=i386
435e8ead290Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436e8ead290Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437e8ead290Smrg	# This test works for both compilers.
4380ea508b1Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439e8ead290Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4400ea508b1Smrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441e8ead290Smrg		grep IS_64BIT_ARCH >/dev/null
442e8ead290Smrg	    then
443cdce750aSmrg		SUN_ARCH=x86_64
444e8ead290Smrg	    fi
445e8ead290Smrg	fi
4460ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4470ea508b1Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
4480ea508b1Smrg	;;
4497914d74bSmrg    sun4*:SunOS:6*:*)
4507914d74bSmrg	# According to config.sub, this is the proper way to canonicalize
4517914d74bSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4527914d74bSmrg	# it's likely to be more like Solaris than SunOS4.
4530ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4540ea508b1Smrg	GUESS=sparc-sun-solaris3$SUN_REL
4550ea508b1Smrg	;;
4567914d74bSmrg    sun4*:SunOS:*:*)
4570ea508b1Smrg	case `/usr/bin/arch -k` in
4587914d74bSmrg	    Series*|S4*)
4597914d74bSmrg		UNAME_RELEASE=`uname -v`
4607914d74bSmrg		;;
4617914d74bSmrg	esac
4627914d74bSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4630ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
4640ea508b1Smrg	GUESS=sparc-sun-sunos$SUN_REL
4650ea508b1Smrg	;;
4667914d74bSmrg    sun3*:SunOS:*:*)
4670ea508b1Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
4680ea508b1Smrg	;;
4697914d74bSmrg    sun*:*:4.2BSD:*)
4707914d74bSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471cdce750aSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4720ea508b1Smrg	case `/bin/arch` in
4737914d74bSmrg	    sun3)
4740ea508b1Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4757914d74bSmrg		;;
4767914d74bSmrg	    sun4)
4770ea508b1Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4787914d74bSmrg		;;
4797914d74bSmrg	esac
4800ea508b1Smrg	;;
4817914d74bSmrg    aushp:SunOS:*:*)
4820ea508b1Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
4830ea508b1Smrg	;;
4847914d74bSmrg    # The situation for MiNT is a little confusing.  The machine name
4857914d74bSmrg    # can be virtually everything (everything which is not
4867914d74bSmrg    # "atarist" or "atariste" at least should have a processor
4877914d74bSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4887914d74bSmrg    # to the lowercase version "mint" (or "freemint").  Finally
4897914d74bSmrg    # the system name "TOS" denotes a system which is actually not
4907914d74bSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4917914d74bSmrg    # be no problem.
4927914d74bSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4930ea508b1Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4940ea508b1Smrg	;;
4957914d74bSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4960ea508b1Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4970ea508b1Smrg	;;
4987914d74bSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4990ea508b1Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
5000ea508b1Smrg	;;
5017914d74bSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
5020ea508b1Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
5030ea508b1Smrg	;;
5047914d74bSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
5050ea508b1Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
5060ea508b1Smrg	;;
5077914d74bSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
5080ea508b1Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
5090ea508b1Smrg	;;
5107914d74bSmrg    m68k:machten:*:*)
5110ea508b1Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
5120ea508b1Smrg	;;
5137914d74bSmrg    powerpc:machten:*:*)
5140ea508b1Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
5150ea508b1Smrg	;;
5167914d74bSmrg    RISC*:Mach:*:*)
5170ea508b1Smrg	GUESS=mips-dec-mach_bsd4.3
5180ea508b1Smrg	;;
5197914d74bSmrg    RISC*:ULTRIX:*:*)
5200ea508b1Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
5210ea508b1Smrg	;;
5227914d74bSmrg    VAX*:ULTRIX*:*:*)
5230ea508b1Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
5240ea508b1Smrg	;;
5257914d74bSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
5260ea508b1Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
5270ea508b1Smrg	;;
5287914d74bSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
5290ea508b1Smrg	set_cc_for_build
530cdce750aSmrg	sed 's/^	//' << EOF > "$dummy.c"
5317914d74bSmrg#ifdef __cplusplus
5327914d74bSmrg#include <stdio.h>  /* for printf() prototype */
5337914d74bSmrg	int main (int argc, char *argv[]) {
5347914d74bSmrg#else
5357914d74bSmrg	int main (argc, argv) int argc; char *argv[]; {
5367914d74bSmrg#endif
5377914d74bSmrg	#if defined (host_mips) && defined (MIPSEB)
5387914d74bSmrg	#if defined (SYSTYPE_SYSV)
539cdce750aSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5407914d74bSmrg	#endif
5417914d74bSmrg	#if defined (SYSTYPE_SVR4)
542cdce750aSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5437914d74bSmrg	#endif
5447914d74bSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545cdce750aSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5467914d74bSmrg	#endif
5477914d74bSmrg	#endif
5487914d74bSmrg	  exit (-1);
5497914d74bSmrg	}
5507914d74bSmrgEOF
551cdce750aSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552cdce750aSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553cdce750aSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5547914d74bSmrg	    { echo "$SYSTEM_NAME"; exit; }
5550ea508b1Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
5560ea508b1Smrg	;;
5577914d74bSmrg    Motorola:PowerMAX_OS:*:*)
5580ea508b1Smrg	GUESS=powerpc-motorola-powermax
5590ea508b1Smrg	;;
5607914d74bSmrg    Motorola:*:4.3:PL8-*)
5610ea508b1Smrg	GUESS=powerpc-harris-powermax
5620ea508b1Smrg	;;
5637914d74bSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5640ea508b1Smrg	GUESS=powerpc-harris-powermax
5650ea508b1Smrg	;;
5667914d74bSmrg    Night_Hawk:Power_UNIX:*:*)
5670ea508b1Smrg	GUESS=powerpc-harris-powerunix
5680ea508b1Smrg	;;
5697914d74bSmrg    m88k:CX/UX:7*:*)
5700ea508b1Smrg	GUESS=m88k-harris-cxux7
5710ea508b1Smrg	;;
5727914d74bSmrg    m88k:*:4*:R4*)
5730ea508b1Smrg	GUESS=m88k-motorola-sysv4
5740ea508b1Smrg	;;
5757914d74bSmrg    m88k:*:3*:R3*)
5760ea508b1Smrg	GUESS=m88k-motorola-sysv3
5770ea508b1Smrg	;;
5787914d74bSmrg    AViiON:dgux:*:*)
579e6d5e4e0Smrg	# DG/UX returns AViiON for all architectures
580e6d5e4e0Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5810ea508b1Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5827914d74bSmrg	then
5830ea508b1Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5840ea508b1Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
5857914d74bSmrg	    then
5860ea508b1Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5877914d74bSmrg	    else
5880ea508b1Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5897914d74bSmrg	    fi
5907914d74bSmrg	else
5910ea508b1Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5927914d74bSmrg	fi
5930ea508b1Smrg	;;
5947914d74bSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5950ea508b1Smrg	GUESS=m88k-dolphin-sysv3
5960ea508b1Smrg	;;
5977914d74bSmrg    M88*:*:R3*:*)
5987914d74bSmrg	# Delta 88k system running SVR3
5990ea508b1Smrg	GUESS=m88k-motorola-sysv3
6000ea508b1Smrg	;;
6017914d74bSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
6020ea508b1Smrg	GUESS=m88k-tektronix-sysv3
6030ea508b1Smrg	;;
6047914d74bSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
6050ea508b1Smrg	GUESS=m68k-tektronix-bsd
6060ea508b1Smrg	;;
6077914d74bSmrg    *:IRIX*:*:*)
6080ea508b1Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
6090ea508b1Smrg	GUESS=mips-sgi-irix$IRIX_REL
6100ea508b1Smrg	;;
6117914d74bSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
6120ea508b1Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
6130ea508b1Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6147914d74bSmrg    i*86:AIX:*:*)
6150ea508b1Smrg	GUESS=i386-ibm-aix
6160ea508b1Smrg	;;
6177914d74bSmrg    ia64:AIX:*:*)
6180ea508b1Smrg	if test -x /usr/bin/oslevel ; then
6197914d74bSmrg		IBM_REV=`/usr/bin/oslevel`
6207914d74bSmrg	else
6210ea508b1Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6227914d74bSmrg	fi
6230ea508b1Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
6240ea508b1Smrg	;;
6257914d74bSmrg    *:AIX:2:3)
6267914d74bSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6270ea508b1Smrg		set_cc_for_build
628cdce750aSmrg		sed 's/^		//' << EOF > "$dummy.c"
6297914d74bSmrg		#include <sys/systemcfg.h>
6307914d74bSmrg
6317914d74bSmrg		main()
6327914d74bSmrg			{
6337914d74bSmrg			if (!__power_pc())
6347914d74bSmrg				exit(1);
6357914d74bSmrg			puts("powerpc-ibm-aix3.2.5");
6367914d74bSmrg			exit(0);
6377914d74bSmrg			}
6387914d74bSmrgEOF
639cdce750aSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6407914d74bSmrg		then
6410ea508b1Smrg			GUESS=$SYSTEM_NAME
6427914d74bSmrg		else
6430ea508b1Smrg			GUESS=rs6000-ibm-aix3.2.5
6447914d74bSmrg		fi
6457914d74bSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6460ea508b1Smrg		GUESS=rs6000-ibm-aix3.2.4
6477914d74bSmrg	else
6480ea508b1Smrg		GUESS=rs6000-ibm-aix3.2
6497914d74bSmrg	fi
6500ea508b1Smrg	;;
651e8ead290Smrg    *:AIX:*:[4567])
6527914d74bSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653cdce750aSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6547914d74bSmrg		IBM_ARCH=rs6000
6557914d74bSmrg	else
6567914d74bSmrg		IBM_ARCH=powerpc
6577914d74bSmrg	fi
6580ea508b1Smrg	if test -x /usr/bin/lslpp ; then
6590ea508b1Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6609d0ccd10Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6617914d74bSmrg	else
6620ea508b1Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6637914d74bSmrg	fi
6640ea508b1Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
6650ea508b1Smrg	;;
6667914d74bSmrg    *:AIX:*:*)
6670ea508b1Smrg	GUESS=rs6000-ibm-aix
6680ea508b1Smrg	;;
669cdce750aSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6700ea508b1Smrg	GUESS=romp-ibm-bsd4.4
6710ea508b1Smrg	;;
6727914d74bSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6730ea508b1Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
6740ea508b1Smrg	;;                                  # report: romp-ibm BSD 4.3
6757914d74bSmrg    *:BOSX:*:*)
6760ea508b1Smrg	GUESS=rs6000-bull-bosx
6770ea508b1Smrg	;;
6787914d74bSmrg    DPX/2?00:B.O.S.:*:*)
6790ea508b1Smrg	GUESS=m68k-bull-sysv3
6800ea508b1Smrg	;;
6817914d74bSmrg    9000/[34]??:4.3bsd:1.*:*)
6820ea508b1Smrg	GUESS=m68k-hp-bsd
6830ea508b1Smrg	;;
6847914d74bSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6850ea508b1Smrg	GUESS=m68k-hp-bsd4.4
6860ea508b1Smrg	;;
6877914d74bSmrg    9000/[34678]??:HP-UX:*:*)
6880ea508b1Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
6890ea508b1Smrg	case $UNAME_MACHINE in
690cdce750aSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691cdce750aSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6927914d74bSmrg	    9000/[678][0-9][0-9])
6930ea508b1Smrg		if test -x /usr/bin/getconf; then
6947914d74bSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695e6d5e4e0Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6960ea508b1Smrg		    case $sc_cpu_version in
697cdce750aSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698cdce750aSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699e6d5e4e0Smrg		      532)                      # CPU_PA_RISC2_0
7000ea508b1Smrg			case $sc_kernel_bits in
701cdce750aSmrg			  32) HP_ARCH=hppa2.0n ;;
702cdce750aSmrg			  64) HP_ARCH=hppa2.0w ;;
703cdce750aSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704e6d5e4e0Smrg			esac ;;
705e6d5e4e0Smrg		    esac
7067914d74bSmrg		fi
7070ea508b1Smrg		if test "$HP_ARCH" = ""; then
7080ea508b1Smrg		    set_cc_for_build
709cdce750aSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7107914d74bSmrg
711e6d5e4e0Smrg		#define _HPUX_SOURCE
712e6d5e4e0Smrg		#include <stdlib.h>
713e6d5e4e0Smrg		#include <unistd.h>
7147914d74bSmrg
715e6d5e4e0Smrg		int main ()
716e6d5e4e0Smrg		{
717e6d5e4e0Smrg		#if defined(_SC_KERNEL_BITS)
718e6d5e4e0Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
719e6d5e4e0Smrg		#endif
720e6d5e4e0Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7217914d74bSmrg
722e6d5e4e0Smrg		    switch (cpu)
723e6d5e4e0Smrg			{
724e6d5e4e0Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725e6d5e4e0Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726e6d5e4e0Smrg			case CPU_PA_RISC2_0:
727e6d5e4e0Smrg		#if defined(_SC_KERNEL_BITS)
728e6d5e4e0Smrg			    switch (bits)
729e6d5e4e0Smrg				{
730e6d5e4e0Smrg				case 64: puts ("hppa2.0w"); break;
731e6d5e4e0Smrg				case 32: puts ("hppa2.0n"); break;
732e6d5e4e0Smrg				default: puts ("hppa2.0"); break;
733e6d5e4e0Smrg				} break;
734e6d5e4e0Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
735e6d5e4e0Smrg			    puts ("hppa2.0"); break;
736e6d5e4e0Smrg		#endif
737e6d5e4e0Smrg			default: puts ("hppa1.0"); break;
738e6d5e4e0Smrg			}
739e6d5e4e0Smrg		    exit (0);
740e6d5e4e0Smrg		}
7417914d74bSmrgEOF
742cdce750aSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7437914d74bSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7447914d74bSmrg		fi ;;
7457914d74bSmrg	esac
7460ea508b1Smrg	if test "$HP_ARCH" = hppa2.0w
7477914d74bSmrg	then
7480ea508b1Smrg	    set_cc_for_build
7497914d74bSmrg
7507914d74bSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7517914d74bSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7527914d74bSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7537914d74bSmrg	    #
7547914d74bSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
7557914d74bSmrg	    # => hppa2.0w-hp-hpux11.23
7567914d74bSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7577914d74bSmrg	    # => hppa64-hp-hpux11.23
7587914d74bSmrg
759cdce750aSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760e8ead290Smrg		grep -q __LP64__
7617914d74bSmrg	    then
762cdce750aSmrg		HP_ARCH=hppa2.0w
7637914d74bSmrg	    else
764cdce750aSmrg		HP_ARCH=hppa64
7657914d74bSmrg	    fi
7667914d74bSmrg	fi
7670ea508b1Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
7680ea508b1Smrg	;;
7697914d74bSmrg    ia64:HP-UX:*:*)
7700ea508b1Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
7710ea508b1Smrg	GUESS=ia64-hp-hpux$HPUX_REV
7720ea508b1Smrg	;;
7737914d74bSmrg    3050*:HI-UX:*:*)
7740ea508b1Smrg	set_cc_for_build
775cdce750aSmrg	sed 's/^	//' << EOF > "$dummy.c"
7767914d74bSmrg	#include <unistd.h>
7777914d74bSmrg	int
7787914d74bSmrg	main ()
7797914d74bSmrg	{
7807914d74bSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
7817914d74bSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7827914d74bSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7837914d74bSmrg	     results, however.  */
7847914d74bSmrg	  if (CPU_IS_PA_RISC (cpu))
7857914d74bSmrg	    {
7867914d74bSmrg	      switch (cpu)
7877914d74bSmrg		{
7887914d74bSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7897914d74bSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7907914d74bSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7917914d74bSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7927914d74bSmrg		}
7937914d74bSmrg	    }
7947914d74bSmrg	  else if (CPU_IS_HP_MC68K (cpu))
7957914d74bSmrg	    puts ("m68k-hitachi-hiuxwe2");
7967914d74bSmrg	  else puts ("unknown-hitachi-hiuxwe2");
7977914d74bSmrg	  exit (0);
7987914d74bSmrg	}
7997914d74bSmrgEOF
800cdce750aSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8017914d74bSmrg		{ echo "$SYSTEM_NAME"; exit; }
8020ea508b1Smrg	GUESS=unknown-hitachi-hiuxwe2
8030ea508b1Smrg	;;
804cdce750aSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
8050ea508b1Smrg	GUESS=hppa1.1-hp-bsd
8060ea508b1Smrg	;;
8077914d74bSmrg    9000/8??:4.3bsd:*:*)
8080ea508b1Smrg	GUESS=hppa1.0-hp-bsd
8090ea508b1Smrg	;;
8107914d74bSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
8110ea508b1Smrg	GUESS=hppa1.0-hp-mpeix
8120ea508b1Smrg	;;
813cdce750aSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
8140ea508b1Smrg	GUESS=hppa1.1-hp-osf
8150ea508b1Smrg	;;
8167914d74bSmrg    hp8??:OSF1:*:*)
8170ea508b1Smrg	GUESS=hppa1.0-hp-osf
8180ea508b1Smrg	;;
8197914d74bSmrg    i*86:OSF1:*:*)
8200ea508b1Smrg	if test -x /usr/sbin/sysversion ; then
8210ea508b1Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8227914d74bSmrg	else
8230ea508b1Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8247914d74bSmrg	fi
8250ea508b1Smrg	;;
8267914d74bSmrg    parisc*:Lites*:*:*)
8270ea508b1Smrg	GUESS=hppa1.1-hp-lites
8280ea508b1Smrg	;;
8297914d74bSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
8300ea508b1Smrg	GUESS=c1-convex-bsd
8310ea508b1Smrg	;;
8327914d74bSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8337914d74bSmrg	if getsysinfo -f scalar_acc
8347914d74bSmrg	then echo c32-convex-bsd
8357914d74bSmrg	else echo c2-convex-bsd
8367914d74bSmrg	fi
837e6d5e4e0Smrg	exit ;;
8387914d74bSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8390ea508b1Smrg	GUESS=c34-convex-bsd
8400ea508b1Smrg	;;
8417914d74bSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8420ea508b1Smrg	GUESS=c38-convex-bsd
8430ea508b1Smrg	;;
8447914d74bSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8450ea508b1Smrg	GUESS=c4-convex-bsd
8460ea508b1Smrg	;;
8477914d74bSmrg    CRAY*Y-MP:*:*:*)
8480ea508b1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8490ea508b1Smrg	GUESS=ymp-cray-unicos$CRAY_REL
8500ea508b1Smrg	;;
8517914d74bSmrg    CRAY*[A-Z]90:*:*:*)
852cdce750aSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8537914d74bSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8547914d74bSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8557914d74bSmrg	      -e 's/\.[^.]*$/.X/'
8567914d74bSmrg	exit ;;
8577914d74bSmrg    CRAY*TS:*:*:*)
8580ea508b1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8590ea508b1Smrg	GUESS=t90-cray-unicos$CRAY_REL
8600ea508b1Smrg	;;
8617914d74bSmrg    CRAY*T3E:*:*:*)
8620ea508b1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8630ea508b1Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
8640ea508b1Smrg	;;
8657914d74bSmrg    CRAY*SV1:*:*:*)
8660ea508b1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8670ea508b1Smrg	GUESS=sv1-cray-unicos$CRAY_REL
8680ea508b1Smrg	;;
8697914d74bSmrg    *:UNICOS/mp:*:*)
8700ea508b1Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8710ea508b1Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
8720ea508b1Smrg	;;
8737914d74bSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874cdce750aSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875cdce750aSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876cdce750aSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8770ea508b1Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8780ea508b1Smrg	;;
8797914d74bSmrg    5000:UNIX_System_V:4.*:*)
880cdce750aSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881cdce750aSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8820ea508b1Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8830ea508b1Smrg	;;
8847914d74bSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8850ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
8860ea508b1Smrg	;;
8877914d74bSmrg    sparc*:BSD/OS:*:*)
8880ea508b1Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
8890ea508b1Smrg	;;
8907914d74bSmrg    *:BSD/OS:*:*)
8910ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
8920ea508b1Smrg	;;
8930ea508b1Smrg    arm:FreeBSD:*:*)
8940ea508b1Smrg	UNAME_PROCESSOR=`uname -p`
8950ea508b1Smrg	set_cc_for_build
8960ea508b1Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8970ea508b1Smrg	    | grep -q __ARM_PCS_VFP
8980ea508b1Smrg	then
8990ea508b1Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9000ea508b1Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9010ea508b1Smrg	else
9020ea508b1Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9030ea508b1Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9040ea508b1Smrg	fi
9050ea508b1Smrg	;;
9067914d74bSmrg    *:FreeBSD:*:*)
907e6d5e4e0Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
9080ea508b1Smrg	case $UNAME_PROCESSOR in
9097914d74bSmrg	    amd64)
910cdce750aSmrg		UNAME_PROCESSOR=x86_64 ;;
911cdce750aSmrg	    i386)
912cdce750aSmrg		UNAME_PROCESSOR=i586 ;;
9137914d74bSmrg	esac
9140ea508b1Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9150ea508b1Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
9160ea508b1Smrg	;;
9177914d74bSmrg    i*:CYGWIN*:*)
9180ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
9190ea508b1Smrg	;;
920e6d5e4e0Smrg    *:MINGW64*:*)
9210ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
9220ea508b1Smrg	;;
9237914d74bSmrg    *:MINGW*:*)
9240ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
9250ea508b1Smrg	;;
9269d0ccd10Smrg    *:MSYS*:*)
9270ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-msys
9280ea508b1Smrg	;;
9297914d74bSmrg    i*:PW*:*)
9300ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-pw32
9310ea508b1Smrg	;;
9320ea508b1Smrg    *:SerenityOS:*:*)
9330ea508b1Smrg        GUESS=$UNAME_MACHINE-pc-serenity
9340ea508b1Smrg        ;;
935e8ead290Smrg    *:Interix*:*)
9360ea508b1Smrg	case $UNAME_MACHINE in
9377914d74bSmrg	    x86)
9380ea508b1Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
9390ea508b1Smrg		;;
940e8ead290Smrg	    authenticamd | genuineintel | EM64T)
9410ea508b1Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
9420ea508b1Smrg		;;
943e169010aSmrg	    IA64)
9440ea508b1Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
9450ea508b1Smrg		;;
9467914d74bSmrg	esac ;;
9477914d74bSmrg    i*:UWIN*:*)
9480ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-uwin
9490ea508b1Smrg	;;
9507914d74bSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9510ea508b1Smrg	GUESS=x86_64-pc-cygwin
9520ea508b1Smrg	;;
9537914d74bSmrg    prep*:SunOS:5.*:*)
9540ea508b1Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
9550ea508b1Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
9560ea508b1Smrg	;;
9577914d74bSmrg    *:GNU:*:*)
9587914d74bSmrg	# the GNU system
9590ea508b1Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
9600ea508b1Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
9610ea508b1Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
9620ea508b1Smrg	;;
9637914d74bSmrg    *:GNU/*:*:*)
9647914d74bSmrg	# other systems with GNU libc and userland
9650ea508b1Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
9660ea508b1Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9670ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
9680ea508b1Smrg	;;
9690ea508b1Smrg    *:Minix:*:*)
9700ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-minix
9710ea508b1Smrg	;;
972e6d5e4e0Smrg    aarch64:Linux:*:*)
9730ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9740ea508b1Smrg	;;
975e6d5e4e0Smrg    aarch64_be:Linux:*:*)
976e6d5e4e0Smrg	UNAME_MACHINE=aarch64_be
9770ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9780ea508b1Smrg	;;
979e8ead290Smrg    alpha:Linux:*:*)
9800ea508b1Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
981e8ead290Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
982e8ead290Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
983e8ead290Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
984e8ead290Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
985e8ead290Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
986e8ead290Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
987e8ead290Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
988e6d5e4e0Smrg	esac
989e8ead290Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
990cdce750aSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9910ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9920ea508b1Smrg	;;
9930ea508b1Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
9940ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9950ea508b1Smrg	;;
9967914d74bSmrg    arm*:Linux:*:*)
9970ea508b1Smrg	set_cc_for_build
998e169010aSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
999e169010aSmrg	    | grep -q __ARM_EABI__
1000e169010aSmrg	then
10010ea508b1Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1002e169010aSmrg	else
1003e6d5e4e0Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1004e6d5e4e0Smrg		| grep -q __ARM_PCS_VFP
1005e6d5e4e0Smrg	    then
10060ea508b1Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1007e6d5e4e0Smrg	    else
10080ea508b1Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1009e6d5e4e0Smrg	    fi
1010e169010aSmrg	fi
10110ea508b1Smrg	;;
10127914d74bSmrg    avr32*:Linux:*:*)
10130ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10140ea508b1Smrg	;;
10157914d74bSmrg    cris:Linux:*:*)
10160ea508b1Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10170ea508b1Smrg	;;
10187914d74bSmrg    crisv32:Linux:*:*)
10190ea508b1Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10200ea508b1Smrg	;;
10219d0ccd10Smrg    e2k:Linux:*:*)
10220ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10230ea508b1Smrg	;;
10247914d74bSmrg    frv:Linux:*:*)
10250ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10260ea508b1Smrg	;;
1027e6d5e4e0Smrg    hexagon:Linux:*:*)
10280ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10290ea508b1Smrg	;;
1030e8ead290Smrg    i*86:Linux:*:*)
10310ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
10320ea508b1Smrg	;;
10337914d74bSmrg    ia64:Linux:*:*)
10340ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10350ea508b1Smrg	;;
1036cdce750aSmrg    k1om:Linux:*:*)
10370ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10380ea508b1Smrg	;;
10396b7436aeSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
10400ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10410ea508b1Smrg	;;
10427914d74bSmrg    m32r*:Linux:*:*)
10430ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10440ea508b1Smrg	;;
10457914d74bSmrg    m68*:Linux:*:*)
10460ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10470ea508b1Smrg	;;
1048e8ead290Smrg    mips:Linux:*:* | mips64:Linux:*:*)
10490ea508b1Smrg	set_cc_for_build
10500ea508b1Smrg	IS_GLIBC=0
10510ea508b1Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1052cdce750aSmrg	sed 's/^	//' << EOF > "$dummy.c"
10537914d74bSmrg	#undef CPU
10540ea508b1Smrg	#undef mips
10550ea508b1Smrg	#undef mipsel
10560ea508b1Smrg	#undef mips64
10570ea508b1Smrg	#undef mips64el
10580ea508b1Smrg	#if ${IS_GLIBC} && defined(_ABI64)
10590ea508b1Smrg	LIBCABI=gnuabi64
10600ea508b1Smrg	#else
10610ea508b1Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
10620ea508b1Smrg	LIBCABI=gnuabin32
10630ea508b1Smrg	#else
10640ea508b1Smrg	LIBCABI=${LIBC}
10650ea508b1Smrg	#endif
10660ea508b1Smrg	#endif
10670ea508b1Smrg
10680ea508b1Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10690ea508b1Smrg	CPU=mipsisa64r6
10700ea508b1Smrg	#else
10710ea508b1Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10720ea508b1Smrg	CPU=mipsisa32r6
10730ea508b1Smrg	#else
10740ea508b1Smrg	#if defined(__mips64)
10750ea508b1Smrg	CPU=mips64
10760ea508b1Smrg	#else
10770ea508b1Smrg	CPU=mips
10780ea508b1Smrg	#endif
10790ea508b1Smrg	#endif
10800ea508b1Smrg	#endif
10810ea508b1Smrg
10827914d74bSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10830ea508b1Smrg	MIPS_ENDIAN=el
10847914d74bSmrg	#else
10857914d74bSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10860ea508b1Smrg	MIPS_ENDIAN=
10877914d74bSmrg	#else
10880ea508b1Smrg	MIPS_ENDIAN=
10897914d74bSmrg	#endif
10907914d74bSmrg	#endif
10917914d74bSmrgEOF
10920ea508b1Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
10930ea508b1Smrg	eval "$cc_set_vars"
10940ea508b1Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10957914d74bSmrg	;;
1096cdce750aSmrg    mips64el:Linux:*:*)
10970ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10980ea508b1Smrg	;;
10999d0ccd10Smrg    openrisc*:Linux:*:*)
11000ea508b1Smrg	GUESS=or1k-unknown-linux-$LIBC
11010ea508b1Smrg	;;
11029d0ccd10Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
11030ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11040ea508b1Smrg	;;
1105e8ead290Smrg    padre:Linux:*:*)
11060ea508b1Smrg	GUESS=sparc-unknown-linux-$LIBC
11070ea508b1Smrg	;;
1108e8ead290Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
11090ea508b1Smrg	GUESS=hppa64-unknown-linux-$LIBC
11100ea508b1Smrg	;;
11117914d74bSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
11127914d74bSmrg	# Look for CPU level
11137914d74bSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
11140ea508b1Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
11150ea508b1Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
11160ea508b1Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11177914d74bSmrg	esac
11180ea508b1Smrg	;;
1119e8ead290Smrg    ppc64:Linux:*:*)
11200ea508b1Smrg	GUESS=powerpc64-unknown-linux-$LIBC
11210ea508b1Smrg	;;
1122e8ead290Smrg    ppc:Linux:*:*)
11230ea508b1Smrg	GUESS=powerpc-unknown-linux-$LIBC
11240ea508b1Smrg	;;
11259d0ccd10Smrg    ppc64le:Linux:*:*)
11260ea508b1Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
11270ea508b1Smrg	;;
11289d0ccd10Smrg    ppcle:Linux:*:*)
11290ea508b1Smrg	GUESS=powerpcle-unknown-linux-$LIBC
11300ea508b1Smrg	;;
11310ea508b1Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
11320ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11330ea508b1Smrg	;;
11347914d74bSmrg    s390:Linux:*:* | s390x:Linux:*:*)
11350ea508b1Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
11360ea508b1Smrg	;;
11377914d74bSmrg    sh64*:Linux:*:*)
11380ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11390ea508b1Smrg	;;
11407914d74bSmrg    sh*:Linux:*:*)
11410ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11420ea508b1Smrg	;;
11437914d74bSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
11440ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11450ea508b1Smrg	;;
1146e8ead290Smrg    tile*:Linux:*:*)
11470ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11480ea508b1Smrg	;;
11497914d74bSmrg    vax:Linux:*:*)
11500ea508b1Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
11510ea508b1Smrg	;;
11527914d74bSmrg    x86_64:Linux:*:*)
11530ea508b1Smrg	set_cc_for_build
11540ea508b1Smrg	LIBCABI=$LIBC
11550ea508b1Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11566b7436aeSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
11576b7436aeSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
11586b7436aeSmrg		grep IS_X32 >/dev/null
11596b7436aeSmrg	    then
11606b7436aeSmrg		LIBCABI=${LIBC}x32
11616b7436aeSmrg	    fi
11620ea508b1Smrg	fi
11636b7436aeSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
11640ea508b1Smrg	;;
1165e169010aSmrg    xtensa*:Linux:*:*)
11660ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11670ea508b1Smrg	;;
11687914d74bSmrg    i*86:DYNIX/ptx:4*:*)
11697914d74bSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11707914d74bSmrg	# earlier versions are messed up and put the nodename in both
11717914d74bSmrg	# sysname and nodename.
11720ea508b1Smrg	GUESS=i386-sequent-sysv4
11730ea508b1Smrg	;;
11747914d74bSmrg    i*86:UNIX_SV:4.2MP:2.*)
1175e6d5e4e0Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1176e6d5e4e0Smrg	# number series starting with 2...
1177e6d5e4e0Smrg	# I am not positive that other SVR4 systems won't match this,
11787914d74bSmrg	# I just have to hope.  -- rms.
1179e6d5e4e0Smrg	# Use sysv4.2uw... so that sysv4* matches it.
11800ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
11810ea508b1Smrg	;;
11827914d74bSmrg    i*86:OS/2:*:*)
11837914d74bSmrg	# If we were able to find `uname', then EMX Unix compatibility
11847914d74bSmrg	# is probably installed.
11850ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
11860ea508b1Smrg	;;
11877914d74bSmrg    i*86:XTS-300:*:STOP)
11880ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-stop
11890ea508b1Smrg	;;
11907914d74bSmrg    i*86:atheos:*:*)
11910ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
11920ea508b1Smrg	;;
11937914d74bSmrg    i*86:syllable:*:*)
11940ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-syllable
11950ea508b1Smrg	;;
1196e8ead290Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
11970ea508b1Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
11980ea508b1Smrg	;;
11997914d74bSmrg    i*86:*DOS:*:*)
12000ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
12010ea508b1Smrg	;;
1202cdce750aSmrg    i*86:*:4.*:*)
1203cdce750aSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12047914d74bSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
12050ea508b1Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12067914d74bSmrg	else
12070ea508b1Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12087914d74bSmrg	fi
12090ea508b1Smrg	;;
12107914d74bSmrg    i*86:*:5:[678]*)
1211e6d5e4e0Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12127914d74bSmrg	case `/bin/uname -X | grep "^Machine"` in
12137914d74bSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
12147914d74bSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12157914d74bSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12167914d74bSmrg	esac
12170ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
12180ea508b1Smrg	;;
12197914d74bSmrg    i*86:*:3.2:*)
12207914d74bSmrg	if test -f /usr/options/cb.name; then
12217914d74bSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
12220ea508b1Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12237914d74bSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12247914d74bSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12257914d74bSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12267914d74bSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12277914d74bSmrg			&& UNAME_MACHINE=i586
12287914d74bSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12297914d74bSmrg			&& UNAME_MACHINE=i686
12307914d74bSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12317914d74bSmrg			&& UNAME_MACHINE=i686
12320ea508b1Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12337914d74bSmrg	else
12340ea508b1Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
12357914d74bSmrg	fi
12360ea508b1Smrg	;;
12377914d74bSmrg    pc:*:*:*)
12387914d74bSmrg	# Left here for compatibility:
1239e6d5e4e0Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1240e6d5e4e0Smrg	# the processor, so we play safe by assuming i586.
1241e8ead290Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1242cdce750aSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1243e8ead290Smrg	# this is a cross-build.
12440ea508b1Smrg	GUESS=i586-pc-msdosdjgpp
12450ea508b1Smrg	;;
12467914d74bSmrg    Intel:Mach:3*:*)
12470ea508b1Smrg	GUESS=i386-pc-mach3
12480ea508b1Smrg	;;
12497914d74bSmrg    paragon:*:*:*)
12500ea508b1Smrg	GUESS=i860-intel-osf1
12510ea508b1Smrg	;;
12527914d74bSmrg    i860:*:4.*:*) # i860-SVR4
12537914d74bSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
12540ea508b1Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12557914d74bSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
12560ea508b1Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12577914d74bSmrg	fi
12580ea508b1Smrg	;;
12597914d74bSmrg    mini*:CTIX:SYS*5:*)
12607914d74bSmrg	# "miniframe"
12610ea508b1Smrg	GUESS=m68010-convergent-sysv
12620ea508b1Smrg	;;
12637914d74bSmrg    mc68k:UNIX:SYSTEM5:3.51m)
12640ea508b1Smrg	GUESS=m68k-convergent-sysv
12650ea508b1Smrg	;;
12667914d74bSmrg    M680?0:D-NIX:5.3:*)
12670ea508b1Smrg	GUESS=m68k-diab-dnix
12680ea508b1Smrg	;;
12697914d74bSmrg    M68*:*:R3V[5678]*:*)
12707914d74bSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12717914d74bSmrg    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)
12727914d74bSmrg	OS_REL=''
12737914d74bSmrg	test -r /etc/.relid \
12747914d74bSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12757914d74bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1276cdce750aSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12777914d74bSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1278cdce750aSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12797914d74bSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1280e6d5e4e0Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1281e6d5e4e0Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1282e8ead290Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1283e8ead290Smrg	OS_REL='.3'
1284e8ead290Smrg	test -r /etc/.relid \
1285e8ead290Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1286e8ead290Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1287cdce750aSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1288e8ead290Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1289cdce750aSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1290e8ead290Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1291cdce750aSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12927914d74bSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
12930ea508b1Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
12940ea508b1Smrg	;;
12957914d74bSmrg    mc68030:UNIX_System_V:4.*:*)
12960ea508b1Smrg	GUESS=m68k-atari-sysv4
12970ea508b1Smrg	;;
12987914d74bSmrg    TSUNAMI:LynxOS:2.*:*)
12990ea508b1Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
13000ea508b1Smrg	;;
13017914d74bSmrg    rs6000:LynxOS:2.*:*)
13020ea508b1Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
13030ea508b1Smrg	;;
1304e8ead290Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
13050ea508b1Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
13060ea508b1Smrg	;;
13077914d74bSmrg    SM[BE]S:UNIX_SV:*:*)
13080ea508b1Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
13090ea508b1Smrg	;;
13107914d74bSmrg    RM*:ReliantUNIX-*:*:*)
13110ea508b1Smrg	GUESS=mips-sni-sysv4
13120ea508b1Smrg	;;
13137914d74bSmrg    RM*:SINIX-*:*:*)
13140ea508b1Smrg	GUESS=mips-sni-sysv4
13150ea508b1Smrg	;;
13167914d74bSmrg    *:SINIX-*:*:*)
13177914d74bSmrg	if uname -p 2>/dev/null >/dev/null ; then
13187914d74bSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
13190ea508b1Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
13207914d74bSmrg	else
13210ea508b1Smrg		GUESS=ns32k-sni-sysv
13227914d74bSmrg	fi
13230ea508b1Smrg	;;
1324e6d5e4e0Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1325e6d5e4e0Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
13260ea508b1Smrg	GUESS=i586-unisys-sysv4
13270ea508b1Smrg	;;
13287914d74bSmrg    *:UNIX_System_V:4*:FTX*)
13297914d74bSmrg	# From Gerald Hewes <hewes@openmarket.com>.
13307914d74bSmrg	# How about differentiating between stratus architectures? -djm
13310ea508b1Smrg	GUESS=hppa1.1-stratus-sysv4
13320ea508b1Smrg	;;
13337914d74bSmrg    *:*:*:FTX*)
13347914d74bSmrg	# From seanf@swdc.stratus.com.
13350ea508b1Smrg	GUESS=i860-stratus-sysv4
13360ea508b1Smrg	;;
13377914d74bSmrg    i*86:VOS:*:*)
13387914d74bSmrg	# From Paul.Green@stratus.com.
13390ea508b1Smrg	GUESS=$UNAME_MACHINE-stratus-vos
13400ea508b1Smrg	;;
13417914d74bSmrg    *:VOS:*:*)
13427914d74bSmrg	# From Paul.Green@stratus.com.
13430ea508b1Smrg	GUESS=hppa1.1-stratus-vos
13440ea508b1Smrg	;;
13457914d74bSmrg    mc68*:A/UX:*:*)
13460ea508b1Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
13470ea508b1Smrg	;;
13487914d74bSmrg    news*:NEWS-OS:6*:*)
13490ea508b1Smrg	GUESS=mips-sony-newsos6
13500ea508b1Smrg	;;
13517914d74bSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13520ea508b1Smrg	if test -d /usr/nec; then
13530ea508b1Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
13547914d74bSmrg	else
13550ea508b1Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
13567914d74bSmrg	fi
13570ea508b1Smrg	;;
13587914d74bSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13590ea508b1Smrg	GUESS=powerpc-be-beos
13600ea508b1Smrg	;;
13617914d74bSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13620ea508b1Smrg	GUESS=powerpc-apple-beos
13630ea508b1Smrg	;;
13647914d74bSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13650ea508b1Smrg	GUESS=i586-pc-beos
13660ea508b1Smrg	;;
1367e8ead290Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13680ea508b1Smrg	GUESS=i586-pc-haiku
13690ea508b1Smrg	;;
13706b7436aeSmrg    x86_64:Haiku:*:*)
13716b7436aeSmrg	GUESS=x86_64-unknown-haiku
13720ea508b1Smrg	;;
13737914d74bSmrg    SX-4:SUPER-UX:*:*)
13740ea508b1Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
13750ea508b1Smrg	;;
13767914d74bSmrg    SX-5:SUPER-UX:*:*)
13770ea508b1Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
13780ea508b1Smrg	;;
13797914d74bSmrg    SX-6:SUPER-UX:*:*)
13800ea508b1Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
13810ea508b1Smrg	;;
13827914d74bSmrg    SX-7:SUPER-UX:*:*)
13830ea508b1Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
13840ea508b1Smrg	;;
13857914d74bSmrg    SX-8:SUPER-UX:*:*)
13860ea508b1Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
13870ea508b1Smrg	;;
13887914d74bSmrg    SX-8R:SUPER-UX:*:*)
13890ea508b1Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
13900ea508b1Smrg	;;
1391cdce750aSmrg    SX-ACE:SUPER-UX:*:*)
13920ea508b1Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
13930ea508b1Smrg	;;
13947914d74bSmrg    Power*:Rhapsody:*:*)
13950ea508b1Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
13960ea508b1Smrg	;;
13977914d74bSmrg    *:Rhapsody:*:*)
13980ea508b1Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
13990ea508b1Smrg	;;
14000ea508b1Smrg    arm64:Darwin:*:*)
14010ea508b1Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
14020ea508b1Smrg	;;
14037914d74bSmrg    *:Darwin:*:*)
14040ea508b1Smrg	UNAME_PROCESSOR=`uname -p`
14050ea508b1Smrg	case $UNAME_PROCESSOR in
14060ea508b1Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14070ea508b1Smrg	esac
14080ea508b1Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
14090ea508b1Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
14100ea508b1Smrg	    # Avoid executing cc if there is no toolchain installed as
14110ea508b1Smrg	    # cc will be a stub that puts up a graphical alert
14120ea508b1Smrg	    # prompting the user to install developer tools.
14130ea508b1Smrg	    CC_FOR_BUILD=no_compiler_found
14140ea508b1Smrg	else
14150ea508b1Smrg	    set_cc_for_build
14169d0ccd10Smrg	fi
14170ea508b1Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14180ea508b1Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
14190ea508b1Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14200ea508b1Smrg		   grep IS_64BIT_ARCH >/dev/null
14210ea508b1Smrg	    then
14220ea508b1Smrg		case $UNAME_PROCESSOR in
14230ea508b1Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14240ea508b1Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14250ea508b1Smrg		esac
14260ea508b1Smrg	    fi
14270ea508b1Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
14280ea508b1Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
14290ea508b1Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14300ea508b1Smrg		   grep IS_PPC >/dev/null
14310ea508b1Smrg	    then
14320ea508b1Smrg		UNAME_PROCESSOR=powerpc
14339d0ccd10Smrg	    fi
14349d0ccd10Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
14350ea508b1Smrg	    # uname -m returns i386 or x86_64
14360ea508b1Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
14379d0ccd10Smrg	fi
14380ea508b1Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
14390ea508b1Smrg	;;
14407914d74bSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14417914d74bSmrg	UNAME_PROCESSOR=`uname -p`
1442cdce750aSmrg	if test "$UNAME_PROCESSOR" = x86; then
14437914d74bSmrg		UNAME_PROCESSOR=i386
14447914d74bSmrg		UNAME_MACHINE=pc
14457914d74bSmrg	fi
14460ea508b1Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
14470ea508b1Smrg	;;
14487914d74bSmrg    *:QNX:*:4*)
14490ea508b1Smrg	GUESS=i386-pc-qnx
14500ea508b1Smrg	;;
1451cdce750aSmrg    NEO-*:NONSTOP_KERNEL:*:*)
14520ea508b1Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
14530ea508b1Smrg	;;
1454e6d5e4e0Smrg    NSE-*:NONSTOP_KERNEL:*:*)
14550ea508b1Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
14560ea508b1Smrg	;;
1457cdce750aSmrg    NSR-*:NONSTOP_KERNEL:*:*)
14580ea508b1Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
14590ea508b1Smrg	;;
1460cdce750aSmrg    NSV-*:NONSTOP_KERNEL:*:*)
14610ea508b1Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
14620ea508b1Smrg	;;
1463cdce750aSmrg    NSX-*:NONSTOP_KERNEL:*:*)
14640ea508b1Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
14650ea508b1Smrg	;;
14667914d74bSmrg    *:NonStop-UX:*:*)
14670ea508b1Smrg	GUESS=mips-compaq-nonstopux
14680ea508b1Smrg	;;
14697914d74bSmrg    BS2000:POSIX*:*:*)
14700ea508b1Smrg	GUESS=bs2000-siemens-sysv
14710ea508b1Smrg	;;
14727914d74bSmrg    DS/*:UNIX_System_V:*:*)
14730ea508b1Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
14740ea508b1Smrg	;;
14757914d74bSmrg    *:Plan9:*:*)
14767914d74bSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
14777914d74bSmrg	# is converted to i386 for consistency with other x86
14787914d74bSmrg	# operating systems.
14790ea508b1Smrg	if test "${cputype-}" = 386; then
14807914d74bSmrg	    UNAME_MACHINE=i386
14810ea508b1Smrg	elif test "x${cputype-}" != x; then
14820ea508b1Smrg	    UNAME_MACHINE=$cputype
14837914d74bSmrg	fi
14840ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
14850ea508b1Smrg	;;
14867914d74bSmrg    *:TOPS-10:*:*)
14870ea508b1Smrg	GUESS=pdp10-unknown-tops10
14880ea508b1Smrg	;;
14897914d74bSmrg    *:TENEX:*:*)
14900ea508b1Smrg	GUESS=pdp10-unknown-tenex
14910ea508b1Smrg	;;
14927914d74bSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14930ea508b1Smrg	GUESS=pdp10-dec-tops20
14940ea508b1Smrg	;;
14957914d74bSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14960ea508b1Smrg	GUESS=pdp10-xkl-tops20
14970ea508b1Smrg	;;
14987914d74bSmrg    *:TOPS-20:*:*)
14990ea508b1Smrg	GUESS=pdp10-unknown-tops20
15000ea508b1Smrg	;;
15017914d74bSmrg    *:ITS:*:*)
15020ea508b1Smrg	GUESS=pdp10-unknown-its
15030ea508b1Smrg	;;
15047914d74bSmrg    SEI:*:*:SEIUX)
15050ea508b1Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
15060ea508b1Smrg	;;
15077914d74bSmrg    *:DragonFly:*:*)
15080ea508b1Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
15090ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
15100ea508b1Smrg	;;
15117914d74bSmrg    *:*VMS:*:*)
1512e6d5e4e0Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
15130ea508b1Smrg	case $UNAME_MACHINE in
15140ea508b1Smrg	    A*) GUESS=alpha-dec-vms ;;
15150ea508b1Smrg	    I*) GUESS=ia64-dec-vms ;;
15160ea508b1Smrg	    V*) GUESS=vax-dec-vms ;;
15177914d74bSmrg	esac ;;
15187914d74bSmrg    *:XENIX:*:SysV)
15190ea508b1Smrg	GUESS=i386-pc-xenix
15200ea508b1Smrg	;;
15217914d74bSmrg    i*86:skyos:*:*)
15220ea508b1Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
15230ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
15240ea508b1Smrg	;;
15257914d74bSmrg    i*86:rdos:*:*)
15260ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-rdos
15270ea508b1Smrg	;;
15280ea508b1Smrg    i*86:Fiwix:*:*)
15290ea508b1Smrg	GUESS=$UNAME_MACHINE-pc-fiwix
15300ea508b1Smrg	;;
15310ea508b1Smrg    *:AROS:*:*)
15320ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-aros
15330ea508b1Smrg	;;
1534e6d5e4e0Smrg    x86_64:VMkernel:*:*)
15350ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-esx
15360ea508b1Smrg	;;
1537cdce750aSmrg    amd64:Isilon\ OneFS:*:*)
15380ea508b1Smrg	GUESS=x86_64-unknown-onefs
15390ea508b1Smrg	;;
15400ea508b1Smrg    *:Unleashed:*:*)
15410ea508b1Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
15420ea508b1Smrg	;;
1543cdce750aSmrgesac
1544cdce750aSmrg
15450ea508b1Smrg# Do we have a guess based on uname results?
15460ea508b1Smrgif test "x$GUESS" != x; then
15470ea508b1Smrg    echo "$GUESS"
15480ea508b1Smrg    exit
15490ea508b1Smrgfi
15500ea508b1Smrg
15510ea508b1Smrg# No uname command or uname output not recognized.
15520ea508b1Smrgset_cc_for_build
15530ea508b1Smrgcat > "$dummy.c" <<EOF
15540ea508b1Smrg#ifdef _SEQUENT_
15550ea508b1Smrg#include <sys/types.h>
15560ea508b1Smrg#include <sys/utsname.h>
15570ea508b1Smrg#endif
15580ea508b1Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15590ea508b1Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15600ea508b1Smrg#include <signal.h>
15610ea508b1Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
15620ea508b1Smrg#include <sys/utsname.h>
15630ea508b1Smrg#endif
15640ea508b1Smrg#endif
15650ea508b1Smrg#endif
15660ea508b1Smrgmain ()
15670ea508b1Smrg{
15680ea508b1Smrg#if defined (sony)
15690ea508b1Smrg#if defined (MIPSEB)
15700ea508b1Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15710ea508b1Smrg     I don't know....  */
15720ea508b1Smrg  printf ("mips-sony-bsd\n"); exit (0);
15730ea508b1Smrg#else
15740ea508b1Smrg#include <sys/param.h>
15750ea508b1Smrg  printf ("m68k-sony-newsos%s\n",
15760ea508b1Smrg#ifdef NEWSOS4
15770ea508b1Smrg  "4"
15780ea508b1Smrg#else
15790ea508b1Smrg  ""
15800ea508b1Smrg#endif
15810ea508b1Smrg  ); exit (0);
15820ea508b1Smrg#endif
15830ea508b1Smrg#endif
15840ea508b1Smrg
15850ea508b1Smrg#if defined (NeXT)
15860ea508b1Smrg#if !defined (__ARCHITECTURE__)
15870ea508b1Smrg#define __ARCHITECTURE__ "m68k"
15880ea508b1Smrg#endif
15890ea508b1Smrg  int version;
15900ea508b1Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15910ea508b1Smrg  if (version < 4)
15920ea508b1Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15930ea508b1Smrg  else
15940ea508b1Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15950ea508b1Smrg  exit (0);
15960ea508b1Smrg#endif
15970ea508b1Smrg
15980ea508b1Smrg#if defined (MULTIMAX) || defined (n16)
15990ea508b1Smrg#if defined (UMAXV)
16000ea508b1Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
16010ea508b1Smrg#else
16020ea508b1Smrg#if defined (CMU)
16030ea508b1Smrg  printf ("ns32k-encore-mach\n"); exit (0);
16040ea508b1Smrg#else
16050ea508b1Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
16060ea508b1Smrg#endif
16070ea508b1Smrg#endif
16080ea508b1Smrg#endif
16090ea508b1Smrg
16100ea508b1Smrg#if defined (__386BSD__)
16110ea508b1Smrg  printf ("i386-pc-bsd\n"); exit (0);
16120ea508b1Smrg#endif
16130ea508b1Smrg
16140ea508b1Smrg#if defined (sequent)
16150ea508b1Smrg#if defined (i386)
16160ea508b1Smrg  printf ("i386-sequent-dynix\n"); exit (0);
16170ea508b1Smrg#endif
16180ea508b1Smrg#if defined (ns32000)
16190ea508b1Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16200ea508b1Smrg#endif
16210ea508b1Smrg#endif
16220ea508b1Smrg
16230ea508b1Smrg#if defined (_SEQUENT_)
16240ea508b1Smrg  struct utsname un;
16250ea508b1Smrg
16260ea508b1Smrg  uname(&un);
16270ea508b1Smrg  if (strncmp(un.version, "V2", 2) == 0) {
16280ea508b1Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
16290ea508b1Smrg  }
16300ea508b1Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16310ea508b1Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
16320ea508b1Smrg  }
16330ea508b1Smrg  printf ("i386-sequent-ptx\n"); exit (0);
16340ea508b1Smrg#endif
16350ea508b1Smrg
16360ea508b1Smrg#if defined (vax)
16370ea508b1Smrg#if !defined (ultrix)
16380ea508b1Smrg#include <sys/param.h>
16390ea508b1Smrg#if defined (BSD)
16400ea508b1Smrg#if BSD == 43
16410ea508b1Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
16420ea508b1Smrg#else
16430ea508b1Smrg#if BSD == 199006
16440ea508b1Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16450ea508b1Smrg#else
16460ea508b1Smrg  printf ("vax-dec-bsd\n"); exit (0);
16470ea508b1Smrg#endif
16480ea508b1Smrg#endif
16490ea508b1Smrg#else
16500ea508b1Smrg  printf ("vax-dec-bsd\n"); exit (0);
16510ea508b1Smrg#endif
16520ea508b1Smrg#else
16530ea508b1Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
16540ea508b1Smrg  struct utsname un;
16550ea508b1Smrg  uname (&un);
16560ea508b1Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16570ea508b1Smrg#else
16580ea508b1Smrg  printf ("vax-dec-ultrix\n"); exit (0);
16590ea508b1Smrg#endif
16600ea508b1Smrg#endif
16610ea508b1Smrg#endif
16620ea508b1Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16630ea508b1Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16640ea508b1Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
16650ea508b1Smrg  struct utsname *un;
16660ea508b1Smrg  uname (&un);
16670ea508b1Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16680ea508b1Smrg#else
16690ea508b1Smrg  printf ("mips-dec-ultrix\n"); exit (0);
16700ea508b1Smrg#endif
16710ea508b1Smrg#endif
16720ea508b1Smrg#endif
16730ea508b1Smrg
16740ea508b1Smrg#if defined (alliant) && defined (i860)
16750ea508b1Smrg  printf ("i860-alliant-bsd\n"); exit (0);
16760ea508b1Smrg#endif
16770ea508b1Smrg
16780ea508b1Smrg  exit (1);
16790ea508b1Smrg}
16800ea508b1SmrgEOF
16810ea508b1Smrg
16820ea508b1Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16830ea508b1Smrg	{ echo "$SYSTEM_NAME"; exit; }
16840ea508b1Smrg
16850ea508b1Smrg# Apollos put the system type in the environment.
16860ea508b1Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16870ea508b1Smrg
1688cdce750aSmrgecho "$0: unable to guess system type" >&2
1689cdce750aSmrg
16900ea508b1Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1691cdce750aSmrg    mips:Linux | mips64:Linux)
1692cdce750aSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1693cdce750aSmrg	cat >&2 <<EOF
1694cdce750aSmrg
1695cdce750aSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1696cdce750aSmrgthe system type. Please install a C compiler and try again.
1697cdce750aSmrgEOF
1698cdce750aSmrg	;;
16997914d74bSmrgesac
17007914d74bSmrg
17017914d74bSmrgcat >&2 <<EOF
17027914d74bSmrg
1703cdce750aSmrgThis script (version $timestamp), has failed to recognize the
1704cdce750aSmrgoperating system you are using. If your script is old, overwrite *all*
1705cdce750aSmrgcopies of config.guess and config.sub with the latest versions from:
17067914d74bSmrg
17070ea508b1Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17087914d74bSmrgand
17090ea508b1Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17100ea508b1SmrgEOF
17110ea508b1Smrg
17120ea508b1Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
17130ea508b1Smrgthisyear=`date +%Y`
17140ea508b1Smrg# shellcheck disable=SC2003
17150ea508b1Smrgscript_age=`expr "$thisyear" - "$our_year"`
17160ea508b1Smrgif test "$script_age" -lt 3 ; then
17170ea508b1Smrg   cat >&2 <<EOF
17187914d74bSmrg
1719cdce750aSmrgIf $0 has already been updated, send the following data and any
1720cdce750aSmrginformation you think might be pertinent to config-patches@gnu.org to
1721cdce750aSmrgprovide the necessary information to handle your system.
17227914d74bSmrg
17237914d74bSmrgconfig.guess timestamp = $timestamp
17247914d74bSmrg
17257914d74bSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17267914d74bSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17277914d74bSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17287914d74bSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17297914d74bSmrg
17307914d74bSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17317914d74bSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17327914d74bSmrg
17337914d74bSmrghostinfo               = `(hostinfo) 2>/dev/null`
17347914d74bSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17357914d74bSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17367914d74bSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17377914d74bSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17387914d74bSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17397914d74bSmrg
1740cdce750aSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1741cdce750aSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1742cdce750aSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1743cdce750aSmrgUNAME_VERSION = "$UNAME_VERSION"
17447914d74bSmrgEOF
17450ea508b1Smrgfi
17467914d74bSmrg
17477914d74bSmrgexit 1
17487914d74bSmrg
17497914d74bSmrg# Local variables:
17500ea508b1Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
17517914d74bSmrg# time-stamp-start: "timestamp='"
17527914d74bSmrg# time-stamp-format: "%:y-%02m-%02d"
17537914d74bSmrg# time-stamp-end: "'"
17547914d74bSmrg# End:
1755