11a30de1fSmrg#! /bin/sh
21a30de1fSmrg# Attempt to guess a canonical system name.
36eaa481cSmrg#   Copyright 1992-2021 Free Software Foundation, Inc.
41a30de1fSmrg
56eaa481cSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
66eaa481cSmrg
76eaa481cSmrgtimestamp='2021-06-03'
81a30de1fSmrg
91a30de1fSmrg# This file is free software; you can redistribute it and/or modify it
101a30de1fSmrg# under the terms of the GNU General Public License as published by
11a733a5bfSmrg# the Free Software Foundation; either version 3 of the License, or
121a30de1fSmrg# (at your option) any later version.
131a30de1fSmrg#
141a30de1fSmrg# This program is distributed in the hope that it will be useful, but
151a30de1fSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
161a30de1fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
171a30de1fSmrg# General Public License for more details.
181a30de1fSmrg#
191a30de1fSmrg# You should have received a copy of the GNU General Public License
20423b239cSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
211a30de1fSmrg#
221a30de1fSmrg# As a special exception to the GNU General Public License, if you
231a30de1fSmrg# distribute this file as part of a program that contains a
241a30de1fSmrg# configuration script generated by Autoconf, you may include it under
25a733a5bfSmrg# the same distribution terms that you use for the rest of that
26a733a5bfSmrg# program.  This Exception is an additional permission under section 7
27a733a5bfSmrg# of the GNU General Public License, version 3 ("GPLv3").
281a30de1fSmrg#
291b983734Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
301a30de1fSmrg#
31ce62200cSmrg# You can get the latest version of this script from:
326eaa481cSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33a733a5bfSmrg#
341b983734Smrg# Please send patches to <config-patches@gnu.org>.
35a733a5bfSmrg
361a30de1fSmrg
376eaa481cSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
386eaa481cSmrg# about features and limitations of the classic Bourne shell that were
396eaa481cSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
406eaa481cSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
416eaa481cSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
426eaa481cSmrg# have a pre-POSIX /bin/sh.
436eaa481cSmrg
446eaa481cSmrg
451a30de1fSmrgme=`echo "$0" | sed -e 's,.*/,,'`
461a30de1fSmrg
471a30de1fSmrgusage="\
481a30de1fSmrgUsage: $0 [OPTION]
491a30de1fSmrg
501a30de1fSmrgOutput the configuration name of the system \`$me' is run on.
511a30de1fSmrg
52423b239cSmrgOptions:
531a30de1fSmrg  -h, --help         print this help, then exit
541a30de1fSmrg  -t, --time-stamp   print date of last modification, then exit
551a30de1fSmrg  -v, --version      print version number, then exit
561a30de1fSmrg
571a30de1fSmrgReport bugs and patches to <config-patches@gnu.org>."
581a30de1fSmrg
591a30de1fSmrgversion="\
601a30de1fSmrgGNU config.guess ($timestamp)
611a30de1fSmrg
621a30de1fSmrgOriginally written by Per Bothner.
636eaa481cSmrgCopyright 1992-2021 Free Software Foundation, Inc.
641a30de1fSmrg
651a30de1fSmrgThis is free software; see the source for copying conditions.  There is NO
661a30de1fSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
671a30de1fSmrg
681a30de1fSmrghelp="
691a30de1fSmrgTry \`$me --help' for more information."
701a30de1fSmrg
711a30de1fSmrg# Parse command line
721a30de1fSmrgwhile test $# -gt 0 ; do
731a30de1fSmrg  case $1 in
741a30de1fSmrg    --time-stamp | --time* | -t )
751a30de1fSmrg       echo "$timestamp" ; exit ;;
761a30de1fSmrg    --version | -v )
771a30de1fSmrg       echo "$version" ; exit ;;
781a30de1fSmrg    --help | --h* | -h )
791a30de1fSmrg       echo "$usage"; exit ;;
801a30de1fSmrg    -- )     # Stop option processing
811a30de1fSmrg       shift; break ;;
821a30de1fSmrg    - )	# Use stdin as input.
831a30de1fSmrg       break ;;
841a30de1fSmrg    -* )
851a30de1fSmrg       echo "$me: invalid option $1$help" >&2
861a30de1fSmrg       exit 1 ;;
871a30de1fSmrg    * )
881a30de1fSmrg       break ;;
891a30de1fSmrg  esac
901a30de1fSmrgdone
911a30de1fSmrg
921a30de1fSmrgif test $# != 0; then
931a30de1fSmrg  echo "$me: too many arguments$help" >&2
941a30de1fSmrg  exit 1
951a30de1fSmrgfi
961a30de1fSmrg
976eaa481cSmrg# Just in case it came from the environment.
986eaa481cSmrgGUESS=
991a30de1fSmrg
1001a30de1fSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1011a30de1fSmrg# compiler to aid in system detection is discouraged as it requires
1021a30de1fSmrg# temporary files to be created and, as you can see below, it is a
1031a30de1fSmrg# headache to deal with in a portable fashion.
1041a30de1fSmrg
1051a30de1fSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1061a30de1fSmrg# use `HOST_CC' if defined, but it is deprecated.
1071a30de1fSmrg
1081a30de1fSmrg# Portable tmp directory creation inspired by the Autoconf team.
1091a30de1fSmrg
1106eaa481cSmrgtmp=
1116eaa481cSmrg# shellcheck disable=SC2172
1126eaa481cSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1136eaa481cSmrg
1146eaa481cSmrgset_cc_for_build() {
1156eaa481cSmrg    # prevent multiple calls if $tmp is already set
1166eaa481cSmrg    test "$tmp" && return 0
1176eaa481cSmrg    : "${TMPDIR=/tmp}"
1186eaa481cSmrg    # shellcheck disable=SC2039,SC3028
1196eaa481cSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1206eaa481cSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1216eaa481cSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1226eaa481cSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1236eaa481cSmrg    dummy=$tmp/dummy
1246eaa481cSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1256eaa481cSmrg	,,)    echo "int x;" > "$dummy.c"
1266eaa481cSmrg	       for driver in cc gcc c89 c99 ; do
1276eaa481cSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1286eaa481cSmrg		       CC_FOR_BUILD=$driver
1296eaa481cSmrg		       break
1306eaa481cSmrg		   fi
1316eaa481cSmrg	       done
1326eaa481cSmrg	       if test x"$CC_FOR_BUILD" = x ; then
1336eaa481cSmrg		   CC_FOR_BUILD=no_compiler_found
1346eaa481cSmrg	       fi
1356eaa481cSmrg	       ;;
1366eaa481cSmrg	,,*)   CC_FOR_BUILD=$CC ;;
1376eaa481cSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1386eaa481cSmrg    esac
1396eaa481cSmrg}
1401a30de1fSmrg
1411a30de1fSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1421a30de1fSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
1436eaa481cSmrgif test -f /.attbin/uname ; then
1441a30de1fSmrg	PATH=$PATH:/.attbin ; export PATH
1451a30de1fSmrgfi
1461a30de1fSmrg
1471a30de1fSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1481a30de1fSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1496eaa481cSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1501a30de1fSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1511a30de1fSmrg
1526eaa481cSmrgcase $UNAME_SYSTEM in
153a733a5bfSmrgLinux|GNU|GNU/*)
1546eaa481cSmrg	LIBC=unknown
155a733a5bfSmrg
1566eaa481cSmrg	set_cc_for_build
157423b239cSmrg	cat <<-EOF > "$dummy.c"
158a733a5bfSmrg	#include <features.h>
159a733a5bfSmrg	#if defined(__UCLIBC__)
160a733a5bfSmrg	LIBC=uclibc
161a733a5bfSmrg	#elif defined(__dietlibc__)
162a733a5bfSmrg	LIBC=dietlibc
1636eaa481cSmrg	#elif defined(__GLIBC__)
164a733a5bfSmrg	LIBC=gnu
1656eaa481cSmrg	#else
1666eaa481cSmrg	#include <stdarg.h>
1676eaa481cSmrg	/* First heuristic to detect musl libc.  */
1686eaa481cSmrg	#ifdef __DEFINED_va_list
1696eaa481cSmrg	LIBC=musl
1706eaa481cSmrg	#endif
171a733a5bfSmrg	#endif
172a733a5bfSmrg	EOF
1736eaa481cSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
1746eaa481cSmrg	eval "$cc_set_libc"
175423b239cSmrg
1766eaa481cSmrg	# Second heuristic to detect musl libc.
1776eaa481cSmrg	if [ "$LIBC" = unknown ] &&
1786eaa481cSmrg	   command -v ldd >/dev/null &&
1796eaa481cSmrg	   ldd --version 2>&1 | grep -q ^musl; then
1806eaa481cSmrg		LIBC=musl
1816eaa481cSmrg	fi
1826eaa481cSmrg
1836eaa481cSmrg	# If the system lacks a compiler, then just pick glibc.
1846eaa481cSmrg	# We could probably try harder.
1856eaa481cSmrg	if [ "$LIBC" = unknown ]; then
1866eaa481cSmrg		LIBC=gnu
187423b239cSmrg	fi
188a733a5bfSmrg	;;
189a733a5bfSmrgesac
190a733a5bfSmrg
1911a30de1fSmrg# Note: order is significant - the case branches are not exclusive.
1921a30de1fSmrg
1936eaa481cSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
1941a30de1fSmrg    *:NetBSD:*:*)
1951a30de1fSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
196a733a5bfSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1971a30de1fSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1981a30de1fSmrg	# switched to ELF, *-*-netbsd* would select the old
1991a30de1fSmrg	# object file format.  This provides both forward
2001a30de1fSmrg	# compatibility and a consistent mechanism for selecting the
2011a30de1fSmrg	# object file format.
2021a30de1fSmrg	#
2031a30de1fSmrg	# Note: NetBSD doesn't particularly care about the vendor
2041a30de1fSmrg	# portion of the name.  We always set it to "unknown".
205423b239cSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2066eaa481cSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2076eaa481cSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208423b239cSmrg	    echo unknown)`
2096eaa481cSmrg	case $UNAME_MACHINE_ARCH in
2106eaa481cSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
2111a30de1fSmrg	    armeb) machine=armeb-unknown ;;
2121a30de1fSmrg	    arm*) machine=arm-unknown ;;
2131a30de1fSmrg	    sh3el) machine=shl-unknown ;;
2141a30de1fSmrg	    sh3eb) machine=sh-unknown ;;
215b7fb5eacSmrg	    sh5el) machine=sh5le-unknown ;;
216423b239cSmrg	    earmv*)
217423b239cSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218423b239cSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
2196eaa481cSmrg		machine=${arch}${endian}-unknown
220423b239cSmrg		;;
2216eaa481cSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2221a30de1fSmrg	esac
2231a30de1fSmrg	# The Operating System including object format, if it has switched
224423b239cSmrg	# to ELF recently (or will in the future) and ABI.
2256eaa481cSmrg	case $UNAME_MACHINE_ARCH in
226423b239cSmrg	    earm*)
227423b239cSmrg		os=netbsdelf
228423b239cSmrg		;;
2291a30de1fSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2306eaa481cSmrg		set_cc_for_build
2311a30de1fSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232ce62200cSmrg			| grep -q __ELF__
2331a30de1fSmrg		then
2341a30de1fSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2351a30de1fSmrg		    # Return netbsd for either.  FIX?
2361a30de1fSmrg		    os=netbsd
2371a30de1fSmrg		else
2381a30de1fSmrg		    os=netbsdelf
2391a30de1fSmrg		fi
2401a30de1fSmrg		;;
2411a30de1fSmrg	    *)
242a733a5bfSmrg		os=netbsd
2431a30de1fSmrg		;;
2441a30de1fSmrg	esac
245423b239cSmrg	# Determine ABI tags.
2466eaa481cSmrg	case $UNAME_MACHINE_ARCH in
247423b239cSmrg	    earm*)
248423b239cSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249423b239cSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250423b239cSmrg		;;
251423b239cSmrg	esac
2521a30de1fSmrg	# The OS release
2531a30de1fSmrg	# Debian GNU/NetBSD machines have a different userland, and
2541a30de1fSmrg	# thus, need a distinct triplet. However, they do not need
2551a30de1fSmrg	# kernel version information, so it can be replaced with a
2561a30de1fSmrg	# suitable tag, in the style of linux-gnu.
2576eaa481cSmrg	case $UNAME_VERSION in
2581a30de1fSmrg	    Debian*)
2591a30de1fSmrg		release='-gnu'
2601a30de1fSmrg		;;
2611a30de1fSmrg	    *)
262423b239cSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2631a30de1fSmrg		;;
2641a30de1fSmrg	esac
2651a30de1fSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2661a30de1fSmrg	# contains redundant information, the shorter form:
2671a30de1fSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2686eaa481cSmrg	GUESS=$machine-${os}${release}${abi-}
2696eaa481cSmrg	;;
270a733a5bfSmrg    *:Bitrig:*:*)
271a733a5bfSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2726eaa481cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
2736eaa481cSmrg	;;
2741a30de1fSmrg    *:OpenBSD:*:*)
2751a30de1fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2766eaa481cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
2776eaa481cSmrg	;;
2786eaa481cSmrg    *:SecBSD:*:*)
2796eaa481cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
2806eaa481cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
2816eaa481cSmrg	;;
282423b239cSmrg    *:LibertyBSD:*:*)
283423b239cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2846eaa481cSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
2856eaa481cSmrg	;;
286423b239cSmrg    *:MidnightBSD:*:*)
2876eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
2886eaa481cSmrg	;;
2891a30de1fSmrg    *:ekkoBSD:*:*)
2906eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
2916eaa481cSmrg	;;
2921a30de1fSmrg    *:SolidBSD:*:*)
2936eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
2946eaa481cSmrg	;;
2956eaa481cSmrg    *:OS108:*:*)
2966eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
2976eaa481cSmrg	;;
2981a30de1fSmrg    macppc:MirBSD:*:*)
2996eaa481cSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
3006eaa481cSmrg	;;
3011a30de1fSmrg    *:MirBSD:*:*)
3026eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
3036eaa481cSmrg	;;
304423b239cSmrg    *:Sortix:*:*)
3056eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
3066eaa481cSmrg	;;
3076eaa481cSmrg    *:Twizzler:*:*)
3086eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
3096eaa481cSmrg	;;
310423b239cSmrg    *:Redox:*:*)
3116eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-redox
3126eaa481cSmrg	;;
313423b239cSmrg    mips:OSF1:*.*)
3146eaa481cSmrg	GUESS=mips-dec-osf1
3156eaa481cSmrg	;;
3161a30de1fSmrg    alpha:OSF1:*:*)
3176eaa481cSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3186eaa481cSmrg	trap '' 0
3191a30de1fSmrg	case $UNAME_RELEASE in
3201a30de1fSmrg	*4.0)
3211a30de1fSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3221a30de1fSmrg		;;
3231a30de1fSmrg	*5.*)
324a733a5bfSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3251a30de1fSmrg		;;
3261a30de1fSmrg	esac
3271a30de1fSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3281a30de1fSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3291a30de1fSmrg	# covers most systems running today.  This code pipes the CPU
3301a30de1fSmrg	# types through head -n 1, so we only detect the type of CPU 0.
3311a30de1fSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3326eaa481cSmrg	case $ALPHA_CPU_TYPE in
3331a30de1fSmrg	    "EV4 (21064)")
334423b239cSmrg		UNAME_MACHINE=alpha ;;
3351a30de1fSmrg	    "EV4.5 (21064)")
336423b239cSmrg		UNAME_MACHINE=alpha ;;
3371a30de1fSmrg	    "LCA4 (21066/21068)")
338423b239cSmrg		UNAME_MACHINE=alpha ;;
3391a30de1fSmrg	    "EV5 (21164)")
340423b239cSmrg		UNAME_MACHINE=alphaev5 ;;
3411a30de1fSmrg	    "EV5.6 (21164A)")
342423b239cSmrg		UNAME_MACHINE=alphaev56 ;;
3431a30de1fSmrg	    "EV5.6 (21164PC)")
344423b239cSmrg		UNAME_MACHINE=alphapca56 ;;
3451a30de1fSmrg	    "EV5.7 (21164PC)")
346423b239cSmrg		UNAME_MACHINE=alphapca57 ;;
3471a30de1fSmrg	    "EV6 (21264)")
348423b239cSmrg		UNAME_MACHINE=alphaev6 ;;
3491a30de1fSmrg	    "EV6.7 (21264A)")
350423b239cSmrg		UNAME_MACHINE=alphaev67 ;;
3511a30de1fSmrg	    "EV6.8CB (21264C)")
352423b239cSmrg		UNAME_MACHINE=alphaev68 ;;
3531a30de1fSmrg	    "EV6.8AL (21264B)")
354423b239cSmrg		UNAME_MACHINE=alphaev68 ;;
3551a30de1fSmrg	    "EV6.8CX (21264D)")
356423b239cSmrg		UNAME_MACHINE=alphaev68 ;;
3571a30de1fSmrg	    "EV6.9A (21264/EV69A)")
358423b239cSmrg		UNAME_MACHINE=alphaev69 ;;
3591a30de1fSmrg	    "EV7 (21364)")
360423b239cSmrg		UNAME_MACHINE=alphaev7 ;;
3611a30de1fSmrg	    "EV7.9 (21364A)")
362423b239cSmrg		UNAME_MACHINE=alphaev79 ;;
3631a30de1fSmrg	esac
3641a30de1fSmrg	# A Pn.n version is a patched version.
3651a30de1fSmrg	# A Vn.n version is a released version.
3661a30de1fSmrg	# A Tn.n version is a released field test version.
3671a30de1fSmrg	# A Xn.n version is an unreleased experimental baselevel.
3681a30de1fSmrg	# 1.2 uses "1.2" for uname -r.
3696eaa481cSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
3706eaa481cSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
3716eaa481cSmrg	;;
3721a30de1fSmrg    Amiga*:UNIX_System_V:4.0:*)
3736eaa481cSmrg	GUESS=m68k-unknown-sysv4
3746eaa481cSmrg	;;
3751a30de1fSmrg    *:[Aa]miga[Oo][Ss]:*:*)
3766eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
3776eaa481cSmrg	;;
3781a30de1fSmrg    *:[Mm]orph[Oo][Ss]:*:*)
3796eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
3806eaa481cSmrg	;;
3811a30de1fSmrg    *:OS/390:*:*)
3826eaa481cSmrg	GUESS=i370-ibm-openedition
3836eaa481cSmrg	;;
3841a30de1fSmrg    *:z/VM:*:*)
3856eaa481cSmrg	GUESS=s390-ibm-zvmoe
3866eaa481cSmrg	;;
3871a30de1fSmrg    *:OS400:*:*)
3886eaa481cSmrg	GUESS=powerpc-ibm-os400
3896eaa481cSmrg	;;
3901a30de1fSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3916eaa481cSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
3926eaa481cSmrg	;;
393a733a5bfSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3946eaa481cSmrg	GUESS=arm-unknown-riscos
3956eaa481cSmrg	;;
3961a30de1fSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3976eaa481cSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
3986eaa481cSmrg	;;
3991a30de1fSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4001a30de1fSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
4016eaa481cSmrg	case `(/bin/universe) 2>/dev/null` in
4026eaa481cSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
4036eaa481cSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
4046eaa481cSmrg	esac
4056eaa481cSmrg	;;
4061a30de1fSmrg    NILE*:*:*:dcosx)
4076eaa481cSmrg	GUESS=pyramid-pyramid-svr4
4086eaa481cSmrg	;;
4091a30de1fSmrg    DRS?6000:unix:4.0:6*)
4106eaa481cSmrg	GUESS=sparc-icl-nx6
4116eaa481cSmrg	;;
4121a30de1fSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4131a30de1fSmrg	case `/usr/bin/uname -p` in
4146eaa481cSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
4156eaa481cSmrg	esac
4166eaa481cSmrg	;;
417b7fb5eacSmrg    s390x:SunOS:*:*)
4186eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4196eaa481cSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
4206eaa481cSmrg	;;
4211a30de1fSmrg    sun4H:SunOS:5.*:*)
4226eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4236eaa481cSmrg	GUESS=sparc-hal-solaris2$SUN_REL
4246eaa481cSmrg	;;
4251a30de1fSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
4266eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4276eaa481cSmrg	GUESS=sparc-sun-solaris2$SUN_REL
4286eaa481cSmrg	;;
429ce62200cSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
4306eaa481cSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
4316eaa481cSmrg	;;
432b7fb5eacSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4336eaa481cSmrg	set_cc_for_build
434423b239cSmrg	SUN_ARCH=i386
435b7fb5eacSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
436b7fb5eacSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437b7fb5eacSmrg	# This test works for both compilers.
4386eaa481cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439b7fb5eacSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440423b239cSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
441b7fb5eacSmrg		grep IS_64BIT_ARCH >/dev/null
442b7fb5eacSmrg	    then
443423b239cSmrg		SUN_ARCH=x86_64
444b7fb5eacSmrg	    fi
445b7fb5eacSmrg	fi
4466eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4476eaa481cSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
4486eaa481cSmrg	;;
4491a30de1fSmrg    sun4*:SunOS:6*:*)
4501a30de1fSmrg	# According to config.sub, this is the proper way to canonicalize
4511a30de1fSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4521a30de1fSmrg	# it's likely to be more like Solaris than SunOS4.
4536eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4546eaa481cSmrg	GUESS=sparc-sun-solaris3$SUN_REL
4556eaa481cSmrg	;;
4561a30de1fSmrg    sun4*:SunOS:*:*)
4576eaa481cSmrg	case `/usr/bin/arch -k` in
4581a30de1fSmrg	    Series*|S4*)
4591a30de1fSmrg		UNAME_RELEASE=`uname -v`
4601a30de1fSmrg		;;
4611a30de1fSmrg	esac
4621a30de1fSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4636eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
4646eaa481cSmrg	GUESS=sparc-sun-sunos$SUN_REL
4656eaa481cSmrg	;;
4661a30de1fSmrg    sun3*:SunOS:*:*)
4676eaa481cSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
4686eaa481cSmrg	;;
4691a30de1fSmrg    sun*:*:4.2BSD:*)
4701a30de1fSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471423b239cSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4726eaa481cSmrg	case `/bin/arch` in
4731a30de1fSmrg	    sun3)
4746eaa481cSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4751a30de1fSmrg		;;
4761a30de1fSmrg	    sun4)
4776eaa481cSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4781a30de1fSmrg		;;
4791a30de1fSmrg	esac
4806eaa481cSmrg	;;
4811a30de1fSmrg    aushp:SunOS:*:*)
4826eaa481cSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
4836eaa481cSmrg	;;
4841a30de1fSmrg    # The situation for MiNT is a little confusing.  The machine name
4851a30de1fSmrg    # can be virtually everything (everything which is not
4861a30de1fSmrg    # "atarist" or "atariste" at least should have a processor
4871a30de1fSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4881a30de1fSmrg    # to the lowercase version "mint" (or "freemint").  Finally
4891a30de1fSmrg    # the system name "TOS" denotes a system which is actually not
4901a30de1fSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4911a30de1fSmrg    # be no problem.
4921a30de1fSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4936eaa481cSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4946eaa481cSmrg	;;
4951a30de1fSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4966eaa481cSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4976eaa481cSmrg	;;
4981a30de1fSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4996eaa481cSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
5006eaa481cSmrg	;;
5011a30de1fSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
5026eaa481cSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
5036eaa481cSmrg	;;
5041a30de1fSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
5056eaa481cSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
5066eaa481cSmrg	;;
5071a30de1fSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
5086eaa481cSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
5096eaa481cSmrg	;;
5101a30de1fSmrg    m68k:machten:*:*)
5116eaa481cSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
5126eaa481cSmrg	;;
5131a30de1fSmrg    powerpc:machten:*:*)
5146eaa481cSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
5156eaa481cSmrg	;;
5161a30de1fSmrg    RISC*:Mach:*:*)
5176eaa481cSmrg	GUESS=mips-dec-mach_bsd4.3
5186eaa481cSmrg	;;
5191a30de1fSmrg    RISC*:ULTRIX:*:*)
5206eaa481cSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
5216eaa481cSmrg	;;
5221a30de1fSmrg    VAX*:ULTRIX*:*:*)
5236eaa481cSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
5246eaa481cSmrg	;;
5251a30de1fSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
5266eaa481cSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
5276eaa481cSmrg	;;
5281a30de1fSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
5296eaa481cSmrg	set_cc_for_build
530423b239cSmrg	sed 's/^	//' << EOF > "$dummy.c"
5311a30de1fSmrg#ifdef __cplusplus
5321a30de1fSmrg#include <stdio.h>  /* for printf() prototype */
5331a30de1fSmrg	int main (int argc, char *argv[]) {
5341a30de1fSmrg#else
5351a30de1fSmrg	int main (argc, argv) int argc; char *argv[]; {
5361a30de1fSmrg#endif
5371a30de1fSmrg	#if defined (host_mips) && defined (MIPSEB)
5381a30de1fSmrg	#if defined (SYSTYPE_SYSV)
539423b239cSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5401a30de1fSmrg	#endif
5411a30de1fSmrg	#if defined (SYSTYPE_SVR4)
542423b239cSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5431a30de1fSmrg	#endif
5441a30de1fSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545423b239cSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5461a30de1fSmrg	#endif
5471a30de1fSmrg	#endif
5481a30de1fSmrg	  exit (-1);
5491a30de1fSmrg	}
5501a30de1fSmrgEOF
551423b239cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552423b239cSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553423b239cSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5541a30de1fSmrg	    { echo "$SYSTEM_NAME"; exit; }
5556eaa481cSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
5566eaa481cSmrg	;;
5571a30de1fSmrg    Motorola:PowerMAX_OS:*:*)
5586eaa481cSmrg	GUESS=powerpc-motorola-powermax
5596eaa481cSmrg	;;
5601a30de1fSmrg    Motorola:*:4.3:PL8-*)
5616eaa481cSmrg	GUESS=powerpc-harris-powermax
5626eaa481cSmrg	;;
5631a30de1fSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5646eaa481cSmrg	GUESS=powerpc-harris-powermax
5656eaa481cSmrg	;;
5661a30de1fSmrg    Night_Hawk:Power_UNIX:*:*)
5676eaa481cSmrg	GUESS=powerpc-harris-powerunix
5686eaa481cSmrg	;;
5691a30de1fSmrg    m88k:CX/UX:7*:*)
5706eaa481cSmrg	GUESS=m88k-harris-cxux7
5716eaa481cSmrg	;;
5721a30de1fSmrg    m88k:*:4*:R4*)
5736eaa481cSmrg	GUESS=m88k-motorola-sysv4
5746eaa481cSmrg	;;
5751a30de1fSmrg    m88k:*:3*:R3*)
5766eaa481cSmrg	GUESS=m88k-motorola-sysv3
5776eaa481cSmrg	;;
5781a30de1fSmrg    AViiON:dgux:*:*)
579a733a5bfSmrg	# DG/UX returns AViiON for all architectures
580a733a5bfSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5816eaa481cSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5821a30de1fSmrg	then
5836eaa481cSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5846eaa481cSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
5851a30de1fSmrg	    then
5866eaa481cSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5871a30de1fSmrg	    else
5886eaa481cSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5891a30de1fSmrg	    fi
5901a30de1fSmrg	else
5916eaa481cSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5921a30de1fSmrg	fi
5936eaa481cSmrg	;;
5941a30de1fSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5956eaa481cSmrg	GUESS=m88k-dolphin-sysv3
5966eaa481cSmrg	;;
5971a30de1fSmrg    M88*:*:R3*:*)
5981a30de1fSmrg	# Delta 88k system running SVR3
5996eaa481cSmrg	GUESS=m88k-motorola-sysv3
6006eaa481cSmrg	;;
6011a30de1fSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
6026eaa481cSmrg	GUESS=m88k-tektronix-sysv3
6036eaa481cSmrg	;;
6041a30de1fSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
6056eaa481cSmrg	GUESS=m68k-tektronix-bsd
6066eaa481cSmrg	;;
6071a30de1fSmrg    *:IRIX*:*:*)
6086eaa481cSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
6096eaa481cSmrg	GUESS=mips-sgi-irix$IRIX_REL
6106eaa481cSmrg	;;
6111a30de1fSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
6126eaa481cSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
6136eaa481cSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6141a30de1fSmrg    i*86:AIX:*:*)
6156eaa481cSmrg	GUESS=i386-ibm-aix
6166eaa481cSmrg	;;
6171a30de1fSmrg    ia64:AIX:*:*)
6186eaa481cSmrg	if test -x /usr/bin/oslevel ; then
6191a30de1fSmrg		IBM_REV=`/usr/bin/oslevel`
6201a30de1fSmrg	else
6216eaa481cSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6221a30de1fSmrg	fi
6236eaa481cSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
6246eaa481cSmrg	;;
6251a30de1fSmrg    *:AIX:2:3)
6261a30de1fSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6276eaa481cSmrg		set_cc_for_build
628423b239cSmrg		sed 's/^		//' << EOF > "$dummy.c"
6291a30de1fSmrg		#include <sys/systemcfg.h>
6301a30de1fSmrg
6311a30de1fSmrg		main()
6321a30de1fSmrg			{
6331a30de1fSmrg			if (!__power_pc())
6341a30de1fSmrg				exit(1);
6351a30de1fSmrg			puts("powerpc-ibm-aix3.2.5");
6361a30de1fSmrg			exit(0);
6371a30de1fSmrg			}
6381a30de1fSmrgEOF
639423b239cSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6401a30de1fSmrg		then
6416eaa481cSmrg			GUESS=$SYSTEM_NAME
6421a30de1fSmrg		else
6436eaa481cSmrg			GUESS=rs6000-ibm-aix3.2.5
6441a30de1fSmrg		fi
6451a30de1fSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6466eaa481cSmrg		GUESS=rs6000-ibm-aix3.2.4
6471a30de1fSmrg	else
6486eaa481cSmrg		GUESS=rs6000-ibm-aix3.2
6491a30de1fSmrg	fi
6506eaa481cSmrg	;;
651ce62200cSmrg    *:AIX:*:[4567])
6521a30de1fSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653423b239cSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6541a30de1fSmrg		IBM_ARCH=rs6000
6551a30de1fSmrg	else
6561a30de1fSmrg		IBM_ARCH=powerpc
6571a30de1fSmrg	fi
6586eaa481cSmrg	if test -x /usr/bin/lslpp ; then
6596eaa481cSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6601b983734Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6611a30de1fSmrg	else
6626eaa481cSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6631a30de1fSmrg	fi
6646eaa481cSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
6656eaa481cSmrg	;;
6661a30de1fSmrg    *:AIX:*:*)
6676eaa481cSmrg	GUESS=rs6000-ibm-aix
6686eaa481cSmrg	;;
669423b239cSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6706eaa481cSmrg	GUESS=romp-ibm-bsd4.4
6716eaa481cSmrg	;;
6721a30de1fSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6736eaa481cSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
6746eaa481cSmrg	;;                                  # report: romp-ibm BSD 4.3
6751a30de1fSmrg    *:BOSX:*:*)
6766eaa481cSmrg	GUESS=rs6000-bull-bosx
6776eaa481cSmrg	;;
6781a30de1fSmrg    DPX/2?00:B.O.S.:*:*)
6796eaa481cSmrg	GUESS=m68k-bull-sysv3
6806eaa481cSmrg	;;
6811a30de1fSmrg    9000/[34]??:4.3bsd:1.*:*)
6826eaa481cSmrg	GUESS=m68k-hp-bsd
6836eaa481cSmrg	;;
6841a30de1fSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6856eaa481cSmrg	GUESS=m68k-hp-bsd4.4
6866eaa481cSmrg	;;
6871a30de1fSmrg    9000/[34678]??:HP-UX:*:*)
6886eaa481cSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
6896eaa481cSmrg	case $UNAME_MACHINE in
690423b239cSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691423b239cSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6921a30de1fSmrg	    9000/[678][0-9][0-9])
6936eaa481cSmrg		if test -x /usr/bin/getconf; then
6941a30de1fSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695a733a5bfSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6966eaa481cSmrg		    case $sc_cpu_version in
697423b239cSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698423b239cSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699a733a5bfSmrg		      532)                      # CPU_PA_RISC2_0
7006eaa481cSmrg			case $sc_kernel_bits in
701423b239cSmrg			  32) HP_ARCH=hppa2.0n ;;
702423b239cSmrg			  64) HP_ARCH=hppa2.0w ;;
703423b239cSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704a733a5bfSmrg			esac ;;
705a733a5bfSmrg		    esac
7061a30de1fSmrg		fi
7076eaa481cSmrg		if test "$HP_ARCH" = ""; then
7086eaa481cSmrg		    set_cc_for_build
709423b239cSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7101a30de1fSmrg
711a733a5bfSmrg		#define _HPUX_SOURCE
712a733a5bfSmrg		#include <stdlib.h>
713a733a5bfSmrg		#include <unistd.h>
7141a30de1fSmrg
715a733a5bfSmrg		int main ()
716a733a5bfSmrg		{
717a733a5bfSmrg		#if defined(_SC_KERNEL_BITS)
718a733a5bfSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
719a733a5bfSmrg		#endif
720a733a5bfSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7211a30de1fSmrg
722a733a5bfSmrg		    switch (cpu)
723a733a5bfSmrg			{
724a733a5bfSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725a733a5bfSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726a733a5bfSmrg			case CPU_PA_RISC2_0:
727a733a5bfSmrg		#if defined(_SC_KERNEL_BITS)
728a733a5bfSmrg			    switch (bits)
729a733a5bfSmrg				{
730a733a5bfSmrg				case 64: puts ("hppa2.0w"); break;
731a733a5bfSmrg				case 32: puts ("hppa2.0n"); break;
732a733a5bfSmrg				default: puts ("hppa2.0"); break;
733a733a5bfSmrg				} break;
734a733a5bfSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
735a733a5bfSmrg			    puts ("hppa2.0"); break;
736a733a5bfSmrg		#endif
737a733a5bfSmrg			default: puts ("hppa1.0"); break;
738a733a5bfSmrg			}
739a733a5bfSmrg		    exit (0);
740a733a5bfSmrg		}
7411a30de1fSmrgEOF
742423b239cSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7431a30de1fSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7441a30de1fSmrg		fi ;;
7451a30de1fSmrg	esac
7466eaa481cSmrg	if test "$HP_ARCH" = hppa2.0w
7471a30de1fSmrg	then
7486eaa481cSmrg	    set_cc_for_build
7491a30de1fSmrg
7501a30de1fSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7511a30de1fSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7521a30de1fSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7531a30de1fSmrg	    #
7541a30de1fSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
7551a30de1fSmrg	    # => hppa2.0w-hp-hpux11.23
7561a30de1fSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7571a30de1fSmrg	    # => hppa64-hp-hpux11.23
7581a30de1fSmrg
759423b239cSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760ce62200cSmrg		grep -q __LP64__
7611a30de1fSmrg	    then
762423b239cSmrg		HP_ARCH=hppa2.0w
7631a30de1fSmrg	    else
764423b239cSmrg		HP_ARCH=hppa64
7651a30de1fSmrg	    fi
7661a30de1fSmrg	fi
7676eaa481cSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
7686eaa481cSmrg	;;
7691a30de1fSmrg    ia64:HP-UX:*:*)
7706eaa481cSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
7716eaa481cSmrg	GUESS=ia64-hp-hpux$HPUX_REV
7726eaa481cSmrg	;;
7731a30de1fSmrg    3050*:HI-UX:*:*)
7746eaa481cSmrg	set_cc_for_build
775423b239cSmrg	sed 's/^	//' << EOF > "$dummy.c"
7761a30de1fSmrg	#include <unistd.h>
7771a30de1fSmrg	int
7781a30de1fSmrg	main ()
7791a30de1fSmrg	{
7801a30de1fSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
7811a30de1fSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7821a30de1fSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7831a30de1fSmrg	     results, however.  */
7841a30de1fSmrg	  if (CPU_IS_PA_RISC (cpu))
7851a30de1fSmrg	    {
7861a30de1fSmrg	      switch (cpu)
7871a30de1fSmrg		{
7881a30de1fSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7891a30de1fSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7901a30de1fSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7911a30de1fSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7921a30de1fSmrg		}
7931a30de1fSmrg	    }
7941a30de1fSmrg	  else if (CPU_IS_HP_MC68K (cpu))
7951a30de1fSmrg	    puts ("m68k-hitachi-hiuxwe2");
7961a30de1fSmrg	  else puts ("unknown-hitachi-hiuxwe2");
7971a30de1fSmrg	  exit (0);
7981a30de1fSmrg	}
7991a30de1fSmrgEOF
800423b239cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8011a30de1fSmrg		{ echo "$SYSTEM_NAME"; exit; }
8026eaa481cSmrg	GUESS=unknown-hitachi-hiuxwe2
8036eaa481cSmrg	;;
804423b239cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
8056eaa481cSmrg	GUESS=hppa1.1-hp-bsd
8066eaa481cSmrg	;;
8071a30de1fSmrg    9000/8??:4.3bsd:*:*)
8086eaa481cSmrg	GUESS=hppa1.0-hp-bsd
8096eaa481cSmrg	;;
8101a30de1fSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
8116eaa481cSmrg	GUESS=hppa1.0-hp-mpeix
8126eaa481cSmrg	;;
813423b239cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
8146eaa481cSmrg	GUESS=hppa1.1-hp-osf
8156eaa481cSmrg	;;
8161a30de1fSmrg    hp8??:OSF1:*:*)
8176eaa481cSmrg	GUESS=hppa1.0-hp-osf
8186eaa481cSmrg	;;
8191a30de1fSmrg    i*86:OSF1:*:*)
8206eaa481cSmrg	if test -x /usr/sbin/sysversion ; then
8216eaa481cSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8221a30de1fSmrg	else
8236eaa481cSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8241a30de1fSmrg	fi
8256eaa481cSmrg	;;
8261a30de1fSmrg    parisc*:Lites*:*:*)
8276eaa481cSmrg	GUESS=hppa1.1-hp-lites
8286eaa481cSmrg	;;
8291a30de1fSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
8306eaa481cSmrg	GUESS=c1-convex-bsd
8316eaa481cSmrg	;;
8321a30de1fSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8331a30de1fSmrg	if getsysinfo -f scalar_acc
8341a30de1fSmrg	then echo c32-convex-bsd
8351a30de1fSmrg	else echo c2-convex-bsd
8361a30de1fSmrg	fi
837a733a5bfSmrg	exit ;;
8381a30de1fSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8396eaa481cSmrg	GUESS=c34-convex-bsd
8406eaa481cSmrg	;;
8411a30de1fSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8426eaa481cSmrg	GUESS=c38-convex-bsd
8436eaa481cSmrg	;;
8441a30de1fSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8456eaa481cSmrg	GUESS=c4-convex-bsd
8466eaa481cSmrg	;;
8471a30de1fSmrg    CRAY*Y-MP:*:*:*)
8486eaa481cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8496eaa481cSmrg	GUESS=ymp-cray-unicos$CRAY_REL
8506eaa481cSmrg	;;
8511a30de1fSmrg    CRAY*[A-Z]90:*:*:*)
852423b239cSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8531a30de1fSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8541a30de1fSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8551a30de1fSmrg	      -e 's/\.[^.]*$/.X/'
8561a30de1fSmrg	exit ;;
8571a30de1fSmrg    CRAY*TS:*:*:*)
8586eaa481cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8596eaa481cSmrg	GUESS=t90-cray-unicos$CRAY_REL
8606eaa481cSmrg	;;
8611a30de1fSmrg    CRAY*T3E:*:*:*)
8626eaa481cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8636eaa481cSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
8646eaa481cSmrg	;;
8651a30de1fSmrg    CRAY*SV1:*:*:*)
8666eaa481cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8676eaa481cSmrg	GUESS=sv1-cray-unicos$CRAY_REL
8686eaa481cSmrg	;;
8691a30de1fSmrg    *:UNICOS/mp:*:*)
8706eaa481cSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8716eaa481cSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
8726eaa481cSmrg	;;
8731a30de1fSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874423b239cSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875423b239cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876423b239cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8776eaa481cSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8786eaa481cSmrg	;;
8791a30de1fSmrg    5000:UNIX_System_V:4.*:*)
880423b239cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881423b239cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8826eaa481cSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8836eaa481cSmrg	;;
8841a30de1fSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8856eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
8866eaa481cSmrg	;;
8871a30de1fSmrg    sparc*:BSD/OS:*:*)
8886eaa481cSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
8896eaa481cSmrg	;;
8901a30de1fSmrg    *:BSD/OS:*:*)
8916eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
8926eaa481cSmrg	;;
8936eaa481cSmrg    arm:FreeBSD:*:*)
8946eaa481cSmrg	UNAME_PROCESSOR=`uname -p`
8956eaa481cSmrg	set_cc_for_build
8966eaa481cSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8976eaa481cSmrg	    | grep -q __ARM_PCS_VFP
8986eaa481cSmrg	then
8996eaa481cSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9006eaa481cSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9016eaa481cSmrg	else
9026eaa481cSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9036eaa481cSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9046eaa481cSmrg	fi
9056eaa481cSmrg	;;
9061a30de1fSmrg    *:FreeBSD:*:*)
907a733a5bfSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
9086eaa481cSmrg	case $UNAME_PROCESSOR in
9091a30de1fSmrg	    amd64)
910423b239cSmrg		UNAME_PROCESSOR=x86_64 ;;
911423b239cSmrg	    i386)
912423b239cSmrg		UNAME_PROCESSOR=i586 ;;
9131a30de1fSmrg	esac
9146eaa481cSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9156eaa481cSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
9166eaa481cSmrg	;;
9171a30de1fSmrg    i*:CYGWIN*:*)
9186eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
9196eaa481cSmrg	;;
920a733a5bfSmrg    *:MINGW64*:*)
9216eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
9226eaa481cSmrg	;;
923b7fb5eacSmrg    *:MINGW*:*)
9246eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
9256eaa481cSmrg	;;
9261b983734Smrg    *:MSYS*:*)
9276eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-msys
9286eaa481cSmrg	;;
9291a30de1fSmrg    i*:PW*:*)
9306eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-pw32
9316eaa481cSmrg	;;
932ce62200cSmrg    *:Interix*:*)
9336eaa481cSmrg	case $UNAME_MACHINE in
934b7fb5eacSmrg	    x86)
9356eaa481cSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
9366eaa481cSmrg		;;
937ce62200cSmrg	    authenticamd | genuineintel | EM64T)
9386eaa481cSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
9396eaa481cSmrg		;;
940b7fb5eacSmrg	    IA64)
9416eaa481cSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
9426eaa481cSmrg		;;
943b7fb5eacSmrg	esac ;;
9441a30de1fSmrg    i*:UWIN*:*)
9456eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-uwin
9466eaa481cSmrg	;;
9471a30de1fSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9486eaa481cSmrg	GUESS=x86_64-pc-cygwin
9496eaa481cSmrg	;;
9501a30de1fSmrg    prep*:SunOS:5.*:*)
9516eaa481cSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
9526eaa481cSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
9536eaa481cSmrg	;;
9541a30de1fSmrg    *:GNU:*:*)
9551a30de1fSmrg	# the GNU system
9566eaa481cSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
9576eaa481cSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
9586eaa481cSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
9596eaa481cSmrg	;;
9601a30de1fSmrg    *:GNU/*:*:*)
9611a30de1fSmrg	# other systems with GNU libc and userland
9626eaa481cSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
9636eaa481cSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9646eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
9656eaa481cSmrg	;;
9666eaa481cSmrg    *:Minix:*:*)
9676eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-minix
9686eaa481cSmrg	;;
969a733a5bfSmrg    aarch64:Linux:*:*)
9706eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9716eaa481cSmrg	;;
972a733a5bfSmrg    aarch64_be:Linux:*:*)
973a733a5bfSmrg	UNAME_MACHINE=aarch64_be
9746eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9756eaa481cSmrg	;;
976ce62200cSmrg    alpha:Linux:*:*)
9776eaa481cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978ce62200cSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979ce62200cSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980ce62200cSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981ce62200cSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982ce62200cSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983ce62200cSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984ce62200cSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
985a733a5bfSmrg	esac
986ce62200cSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
987423b239cSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9886eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9896eaa481cSmrg	;;
9906eaa481cSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
9916eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9926eaa481cSmrg	;;
9931a30de1fSmrg    arm*:Linux:*:*)
9946eaa481cSmrg	set_cc_for_build
995b7fb5eacSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996b7fb5eacSmrg	    | grep -q __ARM_EABI__
997b7fb5eacSmrg	then
9986eaa481cSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999b7fb5eacSmrg	else
1000a733a5bfSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001a733a5bfSmrg		| grep -q __ARM_PCS_VFP
1002a733a5bfSmrg	    then
10036eaa481cSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004a733a5bfSmrg	    else
10056eaa481cSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006a733a5bfSmrg	    fi
1007b7fb5eacSmrg	fi
10086eaa481cSmrg	;;
10091a30de1fSmrg    avr32*:Linux:*:*)
10106eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10116eaa481cSmrg	;;
10121a30de1fSmrg    cris:Linux:*:*)
10136eaa481cSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10146eaa481cSmrg	;;
10151a30de1fSmrg    crisv32:Linux:*:*)
10166eaa481cSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10176eaa481cSmrg	;;
1018423b239cSmrg    e2k:Linux:*:*)
10196eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10206eaa481cSmrg	;;
10211a30de1fSmrg    frv:Linux:*:*)
10226eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10236eaa481cSmrg	;;
1024a733a5bfSmrg    hexagon:Linux:*:*)
10256eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10266eaa481cSmrg	;;
1027ce62200cSmrg    i*86:Linux:*:*)
10286eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
10296eaa481cSmrg	;;
10301a30de1fSmrg    ia64:Linux:*:*)
10316eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10326eaa481cSmrg	;;
1033423b239cSmrg    k1om:Linux:*:*)
10346eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10356eaa481cSmrg	;;
10366eaa481cSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
10376eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10386eaa481cSmrg	;;
10391a30de1fSmrg    m32r*:Linux:*:*)
10406eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10416eaa481cSmrg	;;
10421a30de1fSmrg    m68*:Linux:*:*)
10436eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10446eaa481cSmrg	;;
1045ce62200cSmrg    mips:Linux:*:* | mips64:Linux:*:*)
10466eaa481cSmrg	set_cc_for_build
10476eaa481cSmrg	IS_GLIBC=0
10486eaa481cSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049423b239cSmrg	sed 's/^	//' << EOF > "$dummy.c"
10501a30de1fSmrg	#undef CPU
10516eaa481cSmrg	#undef mips
10526eaa481cSmrg	#undef mipsel
10536eaa481cSmrg	#undef mips64
10546eaa481cSmrg	#undef mips64el
10556eaa481cSmrg	#if ${IS_GLIBC} && defined(_ABI64)
10566eaa481cSmrg	LIBCABI=gnuabi64
10576eaa481cSmrg	#else
10586eaa481cSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
10596eaa481cSmrg	LIBCABI=gnuabin32
10606eaa481cSmrg	#else
10616eaa481cSmrg	LIBCABI=${LIBC}
10626eaa481cSmrg	#endif
10636eaa481cSmrg	#endif
10646eaa481cSmrg
10656eaa481cSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10666eaa481cSmrg	CPU=mipsisa64r6
10676eaa481cSmrg	#else
10686eaa481cSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10696eaa481cSmrg	CPU=mipsisa32r6
10706eaa481cSmrg	#else
10716eaa481cSmrg	#if defined(__mips64)
10726eaa481cSmrg	CPU=mips64
10736eaa481cSmrg	#else
10746eaa481cSmrg	CPU=mips
10756eaa481cSmrg	#endif
10766eaa481cSmrg	#endif
10776eaa481cSmrg	#endif
10786eaa481cSmrg
10791a30de1fSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10806eaa481cSmrg	MIPS_ENDIAN=el
10811a30de1fSmrg	#else
10821a30de1fSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10836eaa481cSmrg	MIPS_ENDIAN=
10841a30de1fSmrg	#else
10856eaa481cSmrg	MIPS_ENDIAN=
10861a30de1fSmrg	#endif
10871a30de1fSmrg	#endif
10881a30de1fSmrgEOF
10896eaa481cSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
10906eaa481cSmrg	eval "$cc_set_vars"
10916eaa481cSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10921a30de1fSmrg	;;
1093423b239cSmrg    mips64el:Linux:*:*)
10946eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10956eaa481cSmrg	;;
10961b983734Smrg    openrisc*:Linux:*:*)
10976eaa481cSmrg	GUESS=or1k-unknown-linux-$LIBC
10986eaa481cSmrg	;;
10991b983734Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
11006eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11016eaa481cSmrg	;;
1102b7fb5eacSmrg    padre:Linux:*:*)
11036eaa481cSmrg	GUESS=sparc-unknown-linux-$LIBC
11046eaa481cSmrg	;;
1105ce62200cSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
11066eaa481cSmrg	GUESS=hppa64-unknown-linux-$LIBC
11076eaa481cSmrg	;;
11081a30de1fSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
11091a30de1fSmrg	# Look for CPU level
11101a30de1fSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
11116eaa481cSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
11126eaa481cSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
11136eaa481cSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11141a30de1fSmrg	esac
11156eaa481cSmrg	;;
1116ce62200cSmrg    ppc64:Linux:*:*)
11176eaa481cSmrg	GUESS=powerpc64-unknown-linux-$LIBC
11186eaa481cSmrg	;;
1119ce62200cSmrg    ppc:Linux:*:*)
11206eaa481cSmrg	GUESS=powerpc-unknown-linux-$LIBC
11216eaa481cSmrg	;;
1122a733a5bfSmrg    ppc64le:Linux:*:*)
11236eaa481cSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
11246eaa481cSmrg	;;
1125a733a5bfSmrg    ppcle:Linux:*:*)
11266eaa481cSmrg	GUESS=powerpcle-unknown-linux-$LIBC
11276eaa481cSmrg	;;
11286eaa481cSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
11296eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11306eaa481cSmrg	;;
11311a30de1fSmrg    s390:Linux:*:* | s390x:Linux:*:*)
11326eaa481cSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
11336eaa481cSmrg	;;
11341a30de1fSmrg    sh64*:Linux:*:*)
11356eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11366eaa481cSmrg	;;
11371a30de1fSmrg    sh*:Linux:*:*)
11386eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11396eaa481cSmrg	;;
11401a30de1fSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
11416eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11426eaa481cSmrg	;;
1143ce62200cSmrg    tile*:Linux:*:*)
11446eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11456eaa481cSmrg	;;
11461a30de1fSmrg    vax:Linux:*:*)
11476eaa481cSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
11486eaa481cSmrg	;;
11491a30de1fSmrg    x86_64:Linux:*:*)
11506eaa481cSmrg	set_cc_for_build
11516eaa481cSmrg	LIBCABI=$LIBC
11526eaa481cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11536eaa481cSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
11546eaa481cSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
11556eaa481cSmrg		grep IS_X32 >/dev/null
11566eaa481cSmrg	    then
11576eaa481cSmrg		LIBCABI=${LIBC}x32
11586eaa481cSmrg	    fi
11596eaa481cSmrg	fi
11606eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
11616eaa481cSmrg	;;
1162b7fb5eacSmrg    xtensa*:Linux:*:*)
11636eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11646eaa481cSmrg	;;
11651a30de1fSmrg    i*86:DYNIX/ptx:4*:*)
11661a30de1fSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11671a30de1fSmrg	# earlier versions are messed up and put the nodename in both
11681a30de1fSmrg	# sysname and nodename.
11696eaa481cSmrg	GUESS=i386-sequent-sysv4
11706eaa481cSmrg	;;
11711a30de1fSmrg    i*86:UNIX_SV:4.2MP:2.*)
1172a733a5bfSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1173a733a5bfSmrg	# number series starting with 2...
1174a733a5bfSmrg	# I am not positive that other SVR4 systems won't match this,
11751a30de1fSmrg	# I just have to hope.  -- rms.
1176a733a5bfSmrg	# Use sysv4.2uw... so that sysv4* matches it.
11776eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
11786eaa481cSmrg	;;
11791a30de1fSmrg    i*86:OS/2:*:*)
11801a30de1fSmrg	# If we were able to find `uname', then EMX Unix compatibility
11811a30de1fSmrg	# is probably installed.
11826eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
11836eaa481cSmrg	;;
11841a30de1fSmrg    i*86:XTS-300:*:STOP)
11856eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-stop
11866eaa481cSmrg	;;
11871a30de1fSmrg    i*86:atheos:*:*)
11886eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
11896eaa481cSmrg	;;
11901a30de1fSmrg    i*86:syllable:*:*)
11916eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-syllable
11926eaa481cSmrg	;;
1193ce62200cSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
11946eaa481cSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
11956eaa481cSmrg	;;
11961a30de1fSmrg    i*86:*DOS:*:*)
11976eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
11986eaa481cSmrg	;;
1199423b239cSmrg    i*86:*:4.*:*)
1200423b239cSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12011a30de1fSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
12026eaa481cSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12031a30de1fSmrg	else
12046eaa481cSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12051a30de1fSmrg	fi
12066eaa481cSmrg	;;
12071a30de1fSmrg    i*86:*:5:[678]*)
1208a733a5bfSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12091a30de1fSmrg	case `/bin/uname -X | grep "^Machine"` in
12101a30de1fSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
12111a30de1fSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12121a30de1fSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12131a30de1fSmrg	esac
12146eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
12156eaa481cSmrg	;;
12161a30de1fSmrg    i*86:*:3.2:*)
12171a30de1fSmrg	if test -f /usr/options/cb.name; then
12181a30de1fSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
12196eaa481cSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12201a30de1fSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12211a30de1fSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12221a30de1fSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12231a30de1fSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12241a30de1fSmrg			&& UNAME_MACHINE=i586
12251a30de1fSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12261a30de1fSmrg			&& UNAME_MACHINE=i686
12271a30de1fSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12281a30de1fSmrg			&& UNAME_MACHINE=i686
12296eaa481cSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12301a30de1fSmrg	else
12316eaa481cSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
12321a30de1fSmrg	fi
12336eaa481cSmrg	;;
12341a30de1fSmrg    pc:*:*:*)
12351a30de1fSmrg	# Left here for compatibility:
1236a733a5bfSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1237a733a5bfSmrg	# the processor, so we play safe by assuming i586.
1238b7fb5eacSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1239423b239cSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1240b7fb5eacSmrg	# this is a cross-build.
12416eaa481cSmrg	GUESS=i586-pc-msdosdjgpp
12426eaa481cSmrg	;;
12431a30de1fSmrg    Intel:Mach:3*:*)
12446eaa481cSmrg	GUESS=i386-pc-mach3
12456eaa481cSmrg	;;
12461a30de1fSmrg    paragon:*:*:*)
12476eaa481cSmrg	GUESS=i860-intel-osf1
12486eaa481cSmrg	;;
12491a30de1fSmrg    i860:*:4.*:*) # i860-SVR4
12501a30de1fSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
12516eaa481cSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12521a30de1fSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
12536eaa481cSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12541a30de1fSmrg	fi
12556eaa481cSmrg	;;
12561a30de1fSmrg    mini*:CTIX:SYS*5:*)
12571a30de1fSmrg	# "miniframe"
12586eaa481cSmrg	GUESS=m68010-convergent-sysv
12596eaa481cSmrg	;;
12601a30de1fSmrg    mc68k:UNIX:SYSTEM5:3.51m)
12616eaa481cSmrg	GUESS=m68k-convergent-sysv
12626eaa481cSmrg	;;
12631a30de1fSmrg    M680?0:D-NIX:5.3:*)
12646eaa481cSmrg	GUESS=m68k-diab-dnix
12656eaa481cSmrg	;;
12661a30de1fSmrg    M68*:*:R3V[5678]*:*)
12671a30de1fSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12681a30de1fSmrg    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)
12691a30de1fSmrg	OS_REL=''
12701a30de1fSmrg	test -r /etc/.relid \
12711a30de1fSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12721a30de1fSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273423b239cSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12741a30de1fSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275423b239cSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12761a30de1fSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277a733a5bfSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278a733a5bfSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1279b7fb5eacSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280b7fb5eacSmrg	OS_REL='.3'
1281b7fb5eacSmrg	test -r /etc/.relid \
1282b7fb5eacSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283b7fb5eacSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284423b239cSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285b7fb5eacSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286423b239cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287b7fb5eacSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288423b239cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12891a30de1fSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
12906eaa481cSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
12916eaa481cSmrg	;;
12921a30de1fSmrg    mc68030:UNIX_System_V:4.*:*)
12936eaa481cSmrg	GUESS=m68k-atari-sysv4
12946eaa481cSmrg	;;
12951a30de1fSmrg    TSUNAMI:LynxOS:2.*:*)
12966eaa481cSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
12976eaa481cSmrg	;;
12981a30de1fSmrg    rs6000:LynxOS:2.*:*)
12996eaa481cSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
13006eaa481cSmrg	;;
1301ce62200cSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
13026eaa481cSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
13036eaa481cSmrg	;;
13041a30de1fSmrg    SM[BE]S:UNIX_SV:*:*)
13056eaa481cSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
13066eaa481cSmrg	;;
13071a30de1fSmrg    RM*:ReliantUNIX-*:*:*)
13086eaa481cSmrg	GUESS=mips-sni-sysv4
13096eaa481cSmrg	;;
13101a30de1fSmrg    RM*:SINIX-*:*:*)
13116eaa481cSmrg	GUESS=mips-sni-sysv4
13126eaa481cSmrg	;;
13131a30de1fSmrg    *:SINIX-*:*:*)
13141a30de1fSmrg	if uname -p 2>/dev/null >/dev/null ; then
13151a30de1fSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
13166eaa481cSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
13171a30de1fSmrg	else
13186eaa481cSmrg		GUESS=ns32k-sni-sysv
13191a30de1fSmrg	fi
13206eaa481cSmrg	;;
1321a733a5bfSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322a733a5bfSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
13236eaa481cSmrg	GUESS=i586-unisys-sysv4
13246eaa481cSmrg	;;
13251a30de1fSmrg    *:UNIX_System_V:4*:FTX*)
13261a30de1fSmrg	# From Gerald Hewes <hewes@openmarket.com>.
13271a30de1fSmrg	# How about differentiating between stratus architectures? -djm
13286eaa481cSmrg	GUESS=hppa1.1-stratus-sysv4
13296eaa481cSmrg	;;
13301a30de1fSmrg    *:*:*:FTX*)
13311a30de1fSmrg	# From seanf@swdc.stratus.com.
13326eaa481cSmrg	GUESS=i860-stratus-sysv4
13336eaa481cSmrg	;;
13341a30de1fSmrg    i*86:VOS:*:*)
13351a30de1fSmrg	# From Paul.Green@stratus.com.
13366eaa481cSmrg	GUESS=$UNAME_MACHINE-stratus-vos
13376eaa481cSmrg	;;
13381a30de1fSmrg    *:VOS:*:*)
13391a30de1fSmrg	# From Paul.Green@stratus.com.
13406eaa481cSmrg	GUESS=hppa1.1-stratus-vos
13416eaa481cSmrg	;;
13421a30de1fSmrg    mc68*:A/UX:*:*)
13436eaa481cSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
13446eaa481cSmrg	;;
13451a30de1fSmrg    news*:NEWS-OS:6*:*)
13466eaa481cSmrg	GUESS=mips-sony-newsos6
13476eaa481cSmrg	;;
13481a30de1fSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13496eaa481cSmrg	if test -d /usr/nec; then
13506eaa481cSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
13511a30de1fSmrg	else
13526eaa481cSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
13531a30de1fSmrg	fi
13546eaa481cSmrg	;;
13551a30de1fSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13566eaa481cSmrg	GUESS=powerpc-be-beos
13576eaa481cSmrg	;;
13581a30de1fSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13596eaa481cSmrg	GUESS=powerpc-apple-beos
13606eaa481cSmrg	;;
13611a30de1fSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13626eaa481cSmrg	GUESS=i586-pc-beos
13636eaa481cSmrg	;;
1364b7fb5eacSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13656eaa481cSmrg	GUESS=i586-pc-haiku
13666eaa481cSmrg	;;
1367a733a5bfSmrg    x86_64:Haiku:*:*)
13686eaa481cSmrg	GUESS=x86_64-unknown-haiku
13696eaa481cSmrg	;;
13701a30de1fSmrg    SX-4:SUPER-UX:*:*)
13716eaa481cSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
13726eaa481cSmrg	;;
13731a30de1fSmrg    SX-5:SUPER-UX:*:*)
13746eaa481cSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
13756eaa481cSmrg	;;
13761a30de1fSmrg    SX-6:SUPER-UX:*:*)
13776eaa481cSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
13786eaa481cSmrg	;;
1379b7fb5eacSmrg    SX-7:SUPER-UX:*:*)
13806eaa481cSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
13816eaa481cSmrg	;;
1382b7fb5eacSmrg    SX-8:SUPER-UX:*:*)
13836eaa481cSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
13846eaa481cSmrg	;;
1385b7fb5eacSmrg    SX-8R:SUPER-UX:*:*)
13866eaa481cSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
13876eaa481cSmrg	;;
1388423b239cSmrg    SX-ACE:SUPER-UX:*:*)
13896eaa481cSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
13906eaa481cSmrg	;;
13911a30de1fSmrg    Power*:Rhapsody:*:*)
13926eaa481cSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
13936eaa481cSmrg	;;
13941a30de1fSmrg    *:Rhapsody:*:*)
13956eaa481cSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
13966eaa481cSmrg	;;
13976eaa481cSmrg    arm64:Darwin:*:*)
13986eaa481cSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
13996eaa481cSmrg	;;
14001a30de1fSmrg    *:Darwin:*:*)
14016eaa481cSmrg	UNAME_PROCESSOR=`uname -p`
14026eaa481cSmrg	case $UNAME_PROCESSOR in
14036eaa481cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14046eaa481cSmrg	esac
14056eaa481cSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
14066eaa481cSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
14076eaa481cSmrg	    # Avoid executing cc if there is no toolchain installed as
14086eaa481cSmrg	    # cc will be a stub that puts up a graphical alert
14096eaa481cSmrg	    # prompting the user to install developer tools.
14106eaa481cSmrg	    CC_FOR_BUILD=no_compiler_found
14116eaa481cSmrg	else
14126eaa481cSmrg	    set_cc_for_build
1413a733a5bfSmrg	fi
14146eaa481cSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14156eaa481cSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
14166eaa481cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14176eaa481cSmrg		   grep IS_64BIT_ARCH >/dev/null
14186eaa481cSmrg	    then
14196eaa481cSmrg		case $UNAME_PROCESSOR in
14206eaa481cSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14216eaa481cSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14226eaa481cSmrg		esac
14236eaa481cSmrg	    fi
14246eaa481cSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
14256eaa481cSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
14266eaa481cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14276eaa481cSmrg		   grep IS_PPC >/dev/null
14286eaa481cSmrg	    then
14296eaa481cSmrg		UNAME_PROCESSOR=powerpc
1430a733a5bfSmrg	    fi
14311b983734Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
14326eaa481cSmrg	    # uname -m returns i386 or x86_64
14336eaa481cSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1434a733a5bfSmrg	fi
14356eaa481cSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
14366eaa481cSmrg	;;
14371a30de1fSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14381a30de1fSmrg	UNAME_PROCESSOR=`uname -p`
1439423b239cSmrg	if test "$UNAME_PROCESSOR" = x86; then
14401a30de1fSmrg		UNAME_PROCESSOR=i386
14411a30de1fSmrg		UNAME_MACHINE=pc
14421a30de1fSmrg	fi
14436eaa481cSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
14446eaa481cSmrg	;;
14451a30de1fSmrg    *:QNX:*:4*)
14466eaa481cSmrg	GUESS=i386-pc-qnx
14476eaa481cSmrg	;;
1448423b239cSmrg    NEO-*:NONSTOP_KERNEL:*:*)
14496eaa481cSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
14506eaa481cSmrg	;;
1451a733a5bfSmrg    NSE-*:NONSTOP_KERNEL:*:*)
14526eaa481cSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
14536eaa481cSmrg	;;
1454423b239cSmrg    NSR-*:NONSTOP_KERNEL:*:*)
14556eaa481cSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
14566eaa481cSmrg	;;
1457423b239cSmrg    NSV-*:NONSTOP_KERNEL:*:*)
14586eaa481cSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
14596eaa481cSmrg	;;
1460423b239cSmrg    NSX-*:NONSTOP_KERNEL:*:*)
14616eaa481cSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
14626eaa481cSmrg	;;
14631a30de1fSmrg    *:NonStop-UX:*:*)
14646eaa481cSmrg	GUESS=mips-compaq-nonstopux
14656eaa481cSmrg	;;
14661a30de1fSmrg    BS2000:POSIX*:*:*)
14676eaa481cSmrg	GUESS=bs2000-siemens-sysv
14686eaa481cSmrg	;;
14691a30de1fSmrg    DS/*:UNIX_System_V:*:*)
14706eaa481cSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
14716eaa481cSmrg	;;
14721a30de1fSmrg    *:Plan9:*:*)
14731a30de1fSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
14741a30de1fSmrg	# is converted to i386 for consistency with other x86
14751a30de1fSmrg	# operating systems.
14766eaa481cSmrg	if test "${cputype-}" = 386; then
14771a30de1fSmrg	    UNAME_MACHINE=i386
14786eaa481cSmrg	elif test "x${cputype-}" != x; then
14796eaa481cSmrg	    UNAME_MACHINE=$cputype
14801a30de1fSmrg	fi
14816eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
14826eaa481cSmrg	;;
14831a30de1fSmrg    *:TOPS-10:*:*)
14846eaa481cSmrg	GUESS=pdp10-unknown-tops10
14856eaa481cSmrg	;;
14861a30de1fSmrg    *:TENEX:*:*)
14876eaa481cSmrg	GUESS=pdp10-unknown-tenex
14886eaa481cSmrg	;;
14891a30de1fSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14906eaa481cSmrg	GUESS=pdp10-dec-tops20
14916eaa481cSmrg	;;
14921a30de1fSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14936eaa481cSmrg	GUESS=pdp10-xkl-tops20
14946eaa481cSmrg	;;
14951a30de1fSmrg    *:TOPS-20:*:*)
14966eaa481cSmrg	GUESS=pdp10-unknown-tops20
14976eaa481cSmrg	;;
14981a30de1fSmrg    *:ITS:*:*)
14996eaa481cSmrg	GUESS=pdp10-unknown-its
15006eaa481cSmrg	;;
15011a30de1fSmrg    SEI:*:*:SEIUX)
15026eaa481cSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
15036eaa481cSmrg	;;
15041a30de1fSmrg    *:DragonFly:*:*)
15056eaa481cSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
15066eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
15076eaa481cSmrg	;;
15081a30de1fSmrg    *:*VMS:*:*)
1509a733a5bfSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
15106eaa481cSmrg	case $UNAME_MACHINE in
15116eaa481cSmrg	    A*) GUESS=alpha-dec-vms ;;
15126eaa481cSmrg	    I*) GUESS=ia64-dec-vms ;;
15136eaa481cSmrg	    V*) GUESS=vax-dec-vms ;;
15141a30de1fSmrg	esac ;;
15151a30de1fSmrg    *:XENIX:*:SysV)
15166eaa481cSmrg	GUESS=i386-pc-xenix
15176eaa481cSmrg	;;
15181a30de1fSmrg    i*86:skyos:*:*)
15196eaa481cSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
15206eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
15216eaa481cSmrg	;;
15221a30de1fSmrg    i*86:rdos:*:*)
15236eaa481cSmrg	GUESS=$UNAME_MACHINE-pc-rdos
15246eaa481cSmrg	;;
15256eaa481cSmrg    *:AROS:*:*)
15266eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-aros
15276eaa481cSmrg	;;
1528a733a5bfSmrg    x86_64:VMkernel:*:*)
15296eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-esx
15306eaa481cSmrg	;;
1531423b239cSmrg    amd64:Isilon\ OneFS:*:*)
15326eaa481cSmrg	GUESS=x86_64-unknown-onefs
15336eaa481cSmrg	;;
15346eaa481cSmrg    *:Unleashed:*:*)
15356eaa481cSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
15366eaa481cSmrg	;;
15371a30de1fSmrgesac
15381a30de1fSmrg
15396eaa481cSmrg# Do we have a guess based on uname results?
15406eaa481cSmrgif test "x$GUESS" != x; then
15416eaa481cSmrg    echo "$GUESS"
15426eaa481cSmrg    exit
15436eaa481cSmrgfi
15446eaa481cSmrg
15456eaa481cSmrg# No uname command or uname output not recognized.
15466eaa481cSmrgset_cc_for_build
15476eaa481cSmrgcat > "$dummy.c" <<EOF
15486eaa481cSmrg#ifdef _SEQUENT_
15496eaa481cSmrg#include <sys/types.h>
15506eaa481cSmrg#include <sys/utsname.h>
15516eaa481cSmrg#endif
15526eaa481cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15536eaa481cSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15546eaa481cSmrg#include <signal.h>
15556eaa481cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
15566eaa481cSmrg#include <sys/utsname.h>
15576eaa481cSmrg#endif
15586eaa481cSmrg#endif
15596eaa481cSmrg#endif
15606eaa481cSmrgmain ()
15616eaa481cSmrg{
15626eaa481cSmrg#if defined (sony)
15636eaa481cSmrg#if defined (MIPSEB)
15646eaa481cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15656eaa481cSmrg     I don't know....  */
15666eaa481cSmrg  printf ("mips-sony-bsd\n"); exit (0);
15676eaa481cSmrg#else
15686eaa481cSmrg#include <sys/param.h>
15696eaa481cSmrg  printf ("m68k-sony-newsos%s\n",
15706eaa481cSmrg#ifdef NEWSOS4
15716eaa481cSmrg  "4"
15726eaa481cSmrg#else
15736eaa481cSmrg  ""
15746eaa481cSmrg#endif
15756eaa481cSmrg  ); exit (0);
15766eaa481cSmrg#endif
15776eaa481cSmrg#endif
15786eaa481cSmrg
15796eaa481cSmrg#if defined (NeXT)
15806eaa481cSmrg#if !defined (__ARCHITECTURE__)
15816eaa481cSmrg#define __ARCHITECTURE__ "m68k"
15826eaa481cSmrg#endif
15836eaa481cSmrg  int version;
15846eaa481cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15856eaa481cSmrg  if (version < 4)
15866eaa481cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15876eaa481cSmrg  else
15886eaa481cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15896eaa481cSmrg  exit (0);
15906eaa481cSmrg#endif
15916eaa481cSmrg
15926eaa481cSmrg#if defined (MULTIMAX) || defined (n16)
15936eaa481cSmrg#if defined (UMAXV)
15946eaa481cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
15956eaa481cSmrg#else
15966eaa481cSmrg#if defined (CMU)
15976eaa481cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
15986eaa481cSmrg#else
15996eaa481cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
16006eaa481cSmrg#endif
16016eaa481cSmrg#endif
16026eaa481cSmrg#endif
16036eaa481cSmrg
16046eaa481cSmrg#if defined (__386BSD__)
16056eaa481cSmrg  printf ("i386-pc-bsd\n"); exit (0);
16066eaa481cSmrg#endif
16076eaa481cSmrg
16086eaa481cSmrg#if defined (sequent)
16096eaa481cSmrg#if defined (i386)
16106eaa481cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
16116eaa481cSmrg#endif
16126eaa481cSmrg#if defined (ns32000)
16136eaa481cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16146eaa481cSmrg#endif
16156eaa481cSmrg#endif
16166eaa481cSmrg
16176eaa481cSmrg#if defined (_SEQUENT_)
16186eaa481cSmrg  struct utsname un;
16196eaa481cSmrg
16206eaa481cSmrg  uname(&un);
16216eaa481cSmrg  if (strncmp(un.version, "V2", 2) == 0) {
16226eaa481cSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
16236eaa481cSmrg  }
16246eaa481cSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16256eaa481cSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
16266eaa481cSmrg  }
16276eaa481cSmrg  printf ("i386-sequent-ptx\n"); exit (0);
16286eaa481cSmrg#endif
16296eaa481cSmrg
16306eaa481cSmrg#if defined (vax)
16316eaa481cSmrg#if !defined (ultrix)
16326eaa481cSmrg#include <sys/param.h>
16336eaa481cSmrg#if defined (BSD)
16346eaa481cSmrg#if BSD == 43
16356eaa481cSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
16366eaa481cSmrg#else
16376eaa481cSmrg#if BSD == 199006
16386eaa481cSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16396eaa481cSmrg#else
16406eaa481cSmrg  printf ("vax-dec-bsd\n"); exit (0);
16416eaa481cSmrg#endif
16426eaa481cSmrg#endif
16436eaa481cSmrg#else
16446eaa481cSmrg  printf ("vax-dec-bsd\n"); exit (0);
16456eaa481cSmrg#endif
16466eaa481cSmrg#else
16476eaa481cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
16486eaa481cSmrg  struct utsname un;
16496eaa481cSmrg  uname (&un);
16506eaa481cSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16516eaa481cSmrg#else
16526eaa481cSmrg  printf ("vax-dec-ultrix\n"); exit (0);
16536eaa481cSmrg#endif
16546eaa481cSmrg#endif
16556eaa481cSmrg#endif
16566eaa481cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16576eaa481cSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16586eaa481cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
16596eaa481cSmrg  struct utsname *un;
16606eaa481cSmrg  uname (&un);
16616eaa481cSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16626eaa481cSmrg#else
16636eaa481cSmrg  printf ("mips-dec-ultrix\n"); exit (0);
16646eaa481cSmrg#endif
16656eaa481cSmrg#endif
16666eaa481cSmrg#endif
16676eaa481cSmrg
16686eaa481cSmrg#if defined (alliant) && defined (i860)
16696eaa481cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
16706eaa481cSmrg#endif
16716eaa481cSmrg
16726eaa481cSmrg  exit (1);
16736eaa481cSmrg}
16746eaa481cSmrgEOF
16756eaa481cSmrg
16766eaa481cSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16776eaa481cSmrg	{ echo "$SYSTEM_NAME"; exit; }
16786eaa481cSmrg
16796eaa481cSmrg# Apollos put the system type in the environment.
16806eaa481cSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16816eaa481cSmrg
1682423b239cSmrgecho "$0: unable to guess system type" >&2
1683423b239cSmrg
16846eaa481cSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685423b239cSmrg    mips:Linux | mips64:Linux)
1686423b239cSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1687423b239cSmrg	cat >&2 <<EOF
1688423b239cSmrg
1689423b239cSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690423b239cSmrgthe system type. Please install a C compiler and try again.
1691423b239cSmrgEOF
1692423b239cSmrg	;;
1693423b239cSmrgesac
1694423b239cSmrg
16951a30de1fSmrgcat >&2 <<EOF
16961a30de1fSmrg
1697423b239cSmrgThis script (version $timestamp), has failed to recognize the
1698423b239cSmrgoperating system you are using. If your script is old, overwrite *all*
1699423b239cSmrgcopies of config.guess and config.sub with the latest versions from:
17001a30de1fSmrg
17016eaa481cSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17021a30de1fSmrgand
17036eaa481cSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17046eaa481cSmrgEOF
17056eaa481cSmrg
17066eaa481cSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
17076eaa481cSmrgthisyear=`date +%Y`
17086eaa481cSmrg# shellcheck disable=SC2003
17096eaa481cSmrgscript_age=`expr "$thisyear" - "$our_year"`
17106eaa481cSmrgif test "$script_age" -lt 3 ; then
17116eaa481cSmrg   cat >&2 <<EOF
17121a30de1fSmrg
1713423b239cSmrgIf $0 has already been updated, send the following data and any
1714423b239cSmrginformation you think might be pertinent to config-patches@gnu.org to
1715423b239cSmrgprovide the necessary information to handle your system.
17161a30de1fSmrg
17171a30de1fSmrgconfig.guess timestamp = $timestamp
17181a30de1fSmrg
17191a30de1fSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17201a30de1fSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17211a30de1fSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17221a30de1fSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17231a30de1fSmrg
17241a30de1fSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17251a30de1fSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17261a30de1fSmrg
17271a30de1fSmrghostinfo               = `(hostinfo) 2>/dev/null`
17281a30de1fSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17291a30de1fSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17301a30de1fSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17311a30de1fSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17321a30de1fSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17331a30de1fSmrg
1734423b239cSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735423b239cSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736423b239cSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737423b239cSmrgUNAME_VERSION = "$UNAME_VERSION"
17381a30de1fSmrgEOF
17396eaa481cSmrgfi
17401a30de1fSmrg
17411a30de1fSmrgexit 1
17421a30de1fSmrg
17431a30de1fSmrg# Local variables:
17446eaa481cSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
17451a30de1fSmrg# time-stamp-start: "timestamp='"
17461a30de1fSmrg# time-stamp-format: "%:y-%02m-%02d"
17471a30de1fSmrg# time-stamp-end: "'"
17481a30de1fSmrg# End:
1749