17a84e134Smrg#! /bin/sh
27a84e134Smrg# Attempt to guess a canonical system name.
3efbcb2bfSmrg#   Copyright 1992-2022 Free Software Foundation, Inc.
47a84e134Smrg
55b16253fSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
65b16253fSmrg
7efbcb2bfSmrgtimestamp='2022-01-09'
87a84e134Smrg
97a84e134Smrg# This file is free software; you can redistribute it and/or modify it
107a84e134Smrg# under the terms of the GNU General Public License as published by
115b16253fSmrg# the Free Software Foundation, either version 3 of the License, or
127a84e134Smrg# (at your option) any later version.
137a84e134Smrg#
147a84e134Smrg# This program is distributed in the hope that it will be useful, but
157a84e134Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
167a84e134Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
177a84e134Smrg# General Public License for more details.
187a84e134Smrg#
197a84e134Smrg# You should have received a copy of the GNU General Public License
205ec34c4cSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
217a84e134Smrg#
227a84e134Smrg# As a special exception to the GNU General Public License, if you
237a84e134Smrg# distribute this file as part of a program that contains a
247a84e134Smrg# configuration script generated by Autoconf, you may include it under
25c889a3bfSmrg# the same distribution terms that you use for the rest of that
26c889a3bfSmrg# program.  This Exception is an additional permission under section 7
27c889a3bfSmrg# of the GNU General Public License, version 3 ("GPLv3").
287a84e134Smrg#
29c8571806Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
307a84e134Smrg#
31994689c1Smrg# You can get the latest version of this script from:
325b16253fSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33c889a3bfSmrg#
34c8571806Smrg# Please send patches to <config-patches@gnu.org>.
35c889a3bfSmrg
367a84e134Smrg
375b16253fSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
385b16253fSmrg# about features and limitations of the classic Bourne shell that were
395b16253fSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
405b16253fSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
415b16253fSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
425b16253fSmrg# have a pre-POSIX /bin/sh.
435b16253fSmrg
445b16253fSmrg
457a84e134Smrgme=`echo "$0" | sed -e 's,.*/,,'`
467a84e134Smrg
477a84e134Smrgusage="\
487a84e134SmrgUsage: $0 [OPTION]
497a84e134Smrg
507a84e134SmrgOutput the configuration name of the system \`$me' is run on.
517a84e134Smrg
525ec34c4cSmrgOptions:
537a84e134Smrg  -h, --help         print this help, then exit
547a84e134Smrg  -t, --time-stamp   print date of last modification, then exit
557a84e134Smrg  -v, --version      print version number, then exit
567a84e134Smrg
577a84e134SmrgReport bugs and patches to <config-patches@gnu.org>."
587a84e134Smrg
597a84e134Smrgversion="\
607a84e134SmrgGNU config.guess ($timestamp)
617a84e134Smrg
627a84e134SmrgOriginally written by Per Bothner.
63efbcb2bfSmrgCopyright 1992-2022 Free Software Foundation, Inc.
647a84e134Smrg
657a84e134SmrgThis is free software; see the source for copying conditions.  There is NO
667a84e134Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
677a84e134Smrg
687a84e134Smrghelp="
697a84e134SmrgTry \`$me --help' for more information."
707a84e134Smrg
717a84e134Smrg# Parse command line
727a84e134Smrgwhile test $# -gt 0 ; do
737a84e134Smrg  case $1 in
747a84e134Smrg    --time-stamp | --time* | -t )
757a84e134Smrg       echo "$timestamp" ; exit ;;
767a84e134Smrg    --version | -v )
777a84e134Smrg       echo "$version" ; exit ;;
787a84e134Smrg    --help | --h* | -h )
797a84e134Smrg       echo "$usage"; exit ;;
807a84e134Smrg    -- )     # Stop option processing
817a84e134Smrg       shift; break ;;
827a84e134Smrg    - )	# Use stdin as input.
837a84e134Smrg       break ;;
847a84e134Smrg    -* )
857a84e134Smrg       echo "$me: invalid option $1$help" >&2
867a84e134Smrg       exit 1 ;;
877a84e134Smrg    * )
887a84e134Smrg       break ;;
897a84e134Smrg  esac
907a84e134Smrgdone
917a84e134Smrg
927a84e134Smrgif test $# != 0; then
937a84e134Smrg  echo "$me: too many arguments$help" >&2
947a84e134Smrg  exit 1
957a84e134Smrgfi
967a84e134Smrg
975b16253fSmrg# Just in case it came from the environment.
985b16253fSmrgGUESS=
995b16253fSmrg
1007a84e134Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1017a84e134Smrg# compiler to aid in system detection is discouraged as it requires
1027a84e134Smrg# temporary files to be created and, as you can see below, it is a
1037a84e134Smrg# headache to deal with in a portable fashion.
1047a84e134Smrg
1057a84e134Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1067a84e134Smrg# use `HOST_CC' if defined, but it is deprecated.
1077a84e134Smrg
1087a84e134Smrg# Portable tmp directory creation inspired by the Autoconf team.
1097a84e134Smrg
1105ec34c4cSmrgtmp=
1115ec34c4cSmrg# shellcheck disable=SC2172
1125ec34c4cSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1135ec34c4cSmrg
1145ec34c4cSmrgset_cc_for_build() {
1155ec34c4cSmrg    # prevent multiple calls if $tmp is already set
1165ec34c4cSmrg    test "$tmp" && return 0
1175ec34c4cSmrg    : "${TMPDIR=/tmp}"
1185b16253fSmrg    # shellcheck disable=SC2039,SC3028
1195ec34c4cSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1205ec34c4cSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1215ec34c4cSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1225ec34c4cSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1235ec34c4cSmrg    dummy=$tmp/dummy
1245ec34c4cSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1255ec34c4cSmrg	,,)    echo "int x;" > "$dummy.c"
1265ec34c4cSmrg	       for driver in cc gcc c89 c99 ; do
1275ec34c4cSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1285b16253fSmrg		       CC_FOR_BUILD=$driver
1295ec34c4cSmrg		       break
1305ec34c4cSmrg		   fi
1315ec34c4cSmrg	       done
1325ec34c4cSmrg	       if test x"$CC_FOR_BUILD" = x ; then
1335ec34c4cSmrg		   CC_FOR_BUILD=no_compiler_found
1345ec34c4cSmrg	       fi
1355ec34c4cSmrg	       ;;
1365ec34c4cSmrg	,,*)   CC_FOR_BUILD=$CC ;;
1375ec34c4cSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1385ec34c4cSmrg    esac
1395ec34c4cSmrg}
1407a84e134Smrg
1417a84e134Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1427a84e134Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
1435ec34c4cSmrgif test -f /.attbin/uname ; then
1447a84e134Smrg	PATH=$PATH:/.attbin ; export PATH
1457a84e134Smrgfi
1467a84e134Smrg
1477a84e134SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1487a84e134SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1495b16253fSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1507a84e134SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1517a84e134Smrg
1525b16253fSmrgcase $UNAME_SYSTEM in
153c889a3bfSmrgLinux|GNU|GNU/*)
1545b16253fSmrg	LIBC=unknown
155c889a3bfSmrg
1565ec34c4cSmrg	set_cc_for_build
1575ec34c4cSmrg	cat <<-EOF > "$dummy.c"
158c889a3bfSmrg	#include <features.h>
159c889a3bfSmrg	#if defined(__UCLIBC__)
160c889a3bfSmrg	LIBC=uclibc
161c889a3bfSmrg	#elif defined(__dietlibc__)
162c889a3bfSmrg	LIBC=dietlibc
1635b16253fSmrg	#elif defined(__GLIBC__)
164c889a3bfSmrg	LIBC=gnu
1655b16253fSmrg	#else
1665b16253fSmrg	#include <stdarg.h>
1675b16253fSmrg	/* First heuristic to detect musl libc.  */
1685b16253fSmrg	#ifdef __DEFINED_va_list
1695b16253fSmrg	LIBC=musl
1705b16253fSmrg	#endif
171c889a3bfSmrg	#endif
172c889a3bfSmrg	EOF
1735b16253fSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
1745b16253fSmrg	eval "$cc_set_libc"
1755ec34c4cSmrg
1765b16253fSmrg	# Second heuristic to detect musl libc.
1775b16253fSmrg	if [ "$LIBC" = unknown ] &&
1785b16253fSmrg	   command -v ldd >/dev/null &&
1795b16253fSmrg	   ldd --version 2>&1 | grep -q ^musl; then
1805b16253fSmrg		LIBC=musl
1815b16253fSmrg	fi
1825b16253fSmrg
1835b16253fSmrg	# If the system lacks a compiler, then just pick glibc.
1845b16253fSmrg	# We could probably try harder.
1855b16253fSmrg	if [ "$LIBC" = unknown ]; then
1865b16253fSmrg		LIBC=gnu
1875ec34c4cSmrg	fi
188c889a3bfSmrg	;;
189c889a3bfSmrgesac
190c889a3bfSmrg
1917a84e134Smrg# Note: order is significant - the case branches are not exclusive.
1927a84e134Smrg
1935b16253fSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
1947a84e134Smrg    *:NetBSD:*:*)
1957a84e134Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196c889a3bfSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1977a84e134Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1987a84e134Smrg	# switched to ELF, *-*-netbsd* would select the old
1997a84e134Smrg	# object file format.  This provides both forward
2007a84e134Smrg	# compatibility and a consistent mechanism for selecting the
2017a84e134Smrg	# object file format.
2027a84e134Smrg	#
2037a84e134Smrg	# Note: NetBSD doesn't particularly care about the vendor
2047a84e134Smrg	# portion of the name.  We always set it to "unknown".
2055ec34c4cSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2065b16253fSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2075b16253fSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2085ec34c4cSmrg	    echo unknown)`
2095b16253fSmrg	case $UNAME_MACHINE_ARCH in
2105b16253fSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
2117a84e134Smrg	    armeb) machine=armeb-unknown ;;
2127a84e134Smrg	    arm*) machine=arm-unknown ;;
2137a84e134Smrg	    sh3el) machine=shl-unknown ;;
2147a84e134Smrg	    sh3eb) machine=sh-unknown ;;
215ab902922Smrg	    sh5el) machine=sh5le-unknown ;;
2165ec34c4cSmrg	    earmv*)
2175ec34c4cSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2185ec34c4cSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
2195b16253fSmrg		machine=${arch}${endian}-unknown
2205ec34c4cSmrg		;;
2215b16253fSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2227a84e134Smrg	esac
2237a84e134Smrg	# The Operating System including object format, if it has switched
2245ec34c4cSmrg	# to ELF recently (or will in the future) and ABI.
2255b16253fSmrg	case $UNAME_MACHINE_ARCH in
2265ec34c4cSmrg	    earm*)
2275ec34c4cSmrg		os=netbsdelf
2285ec34c4cSmrg		;;
2297a84e134Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2305ec34c4cSmrg		set_cc_for_build
2317a84e134Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232994689c1Smrg			| grep -q __ELF__
2337a84e134Smrg		then
2347a84e134Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2357a84e134Smrg		    # Return netbsd for either.  FIX?
2367a84e134Smrg		    os=netbsd
2377a84e134Smrg		else
2387a84e134Smrg		    os=netbsdelf
2397a84e134Smrg		fi
2407a84e134Smrg		;;
2417a84e134Smrg	    *)
242421c997bSmrg		os=netbsd
2437a84e134Smrg		;;
2447a84e134Smrg	esac
2455ec34c4cSmrg	# Determine ABI tags.
2465b16253fSmrg	case $UNAME_MACHINE_ARCH in
2475ec34c4cSmrg	    earm*)
2485ec34c4cSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2495ec34c4cSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2505ec34c4cSmrg		;;
2515ec34c4cSmrg	esac
2527a84e134Smrg	# The OS release
2537a84e134Smrg	# Debian GNU/NetBSD machines have a different userland, and
2547a84e134Smrg	# thus, need a distinct triplet. However, they do not need
2557a84e134Smrg	# kernel version information, so it can be replaced with a
2567a84e134Smrg	# suitable tag, in the style of linux-gnu.
2575b16253fSmrg	case $UNAME_VERSION in
2587a84e134Smrg	    Debian*)
2597a84e134Smrg		release='-gnu'
2607a84e134Smrg		;;
2617a84e134Smrg	    *)
2625ec34c4cSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2637a84e134Smrg		;;
2647a84e134Smrg	esac
2657a84e134Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2667a84e134Smrg	# contains redundant information, the shorter form:
2677a84e134Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2685b16253fSmrg	GUESS=$machine-${os}${release}${abi-}
2695b16253fSmrg	;;
270c889a3bfSmrg    *:Bitrig:*:*)
271c889a3bfSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2725b16253fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
2735b16253fSmrg	;;
2747a84e134Smrg    *:OpenBSD:*:*)
2757a84e134Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2765b16253fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
2775b16253fSmrg	;;
2785b16253fSmrg    *:SecBSD:*:*)
2795b16253fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
2805b16253fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
2815b16253fSmrg	;;
2825ec34c4cSmrg    *:LibertyBSD:*:*)
2835ec34c4cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2845b16253fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
2855b16253fSmrg	;;
2865ec34c4cSmrg    *:MidnightBSD:*:*)
2875b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
2885b16253fSmrg	;;
2897a84e134Smrg    *:ekkoBSD:*:*)
2905b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
2915b16253fSmrg	;;
292ab902922Smrg    *:SolidBSD:*:*)
2935b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
2945b16253fSmrg	;;
2955ec34c4cSmrg    *:OS108:*:*)
2965b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
2975b16253fSmrg	;;
2987a84e134Smrg    macppc:MirBSD:*:*)
2995b16253fSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
3005b16253fSmrg	;;
3017a84e134Smrg    *:MirBSD:*:*)
3025b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
3035b16253fSmrg	;;
3045ec34c4cSmrg    *:Sortix:*:*)
3055b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
3065b16253fSmrg	;;
3075ec34c4cSmrg    *:Twizzler:*:*)
3085b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
3095b16253fSmrg	;;
3105ec34c4cSmrg    *:Redox:*:*)
3115b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-redox
3125b16253fSmrg	;;
3135ec34c4cSmrg    mips:OSF1:*.*)
3145b16253fSmrg	GUESS=mips-dec-osf1
3155b16253fSmrg	;;
3167a84e134Smrg    alpha:OSF1:*:*)
3175b16253fSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3185b16253fSmrg	trap '' 0
3197a84e134Smrg	case $UNAME_RELEASE in
3207a84e134Smrg	*4.0)
3217a84e134Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3227a84e134Smrg		;;
3237a84e134Smrg	*5.*)
324421c997bSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3257a84e134Smrg		;;
3267a84e134Smrg	esac
3277a84e134Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3287a84e134Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3297a84e134Smrg	# covers most systems running today.  This code pipes the CPU
3307a84e134Smrg	# types through head -n 1, so we only detect the type of CPU 0.
3317a84e134Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3325b16253fSmrg	case $ALPHA_CPU_TYPE in
3337a84e134Smrg	    "EV4 (21064)")
3345ec34c4cSmrg		UNAME_MACHINE=alpha ;;
3357a84e134Smrg	    "EV4.5 (21064)")
3365ec34c4cSmrg		UNAME_MACHINE=alpha ;;
3377a84e134Smrg	    "LCA4 (21066/21068)")
3385ec34c4cSmrg		UNAME_MACHINE=alpha ;;
3397a84e134Smrg	    "EV5 (21164)")
3405ec34c4cSmrg		UNAME_MACHINE=alphaev5 ;;
3417a84e134Smrg	    "EV5.6 (21164A)")
3425ec34c4cSmrg		UNAME_MACHINE=alphaev56 ;;
3437a84e134Smrg	    "EV5.6 (21164PC)")
3445ec34c4cSmrg		UNAME_MACHINE=alphapca56 ;;
3457a84e134Smrg	    "EV5.7 (21164PC)")
3465ec34c4cSmrg		UNAME_MACHINE=alphapca57 ;;
3477a84e134Smrg	    "EV6 (21264)")
3485ec34c4cSmrg		UNAME_MACHINE=alphaev6 ;;
3497a84e134Smrg	    "EV6.7 (21264A)")
3505ec34c4cSmrg		UNAME_MACHINE=alphaev67 ;;
3517a84e134Smrg	    "EV6.8CB (21264C)")
3525ec34c4cSmrg		UNAME_MACHINE=alphaev68 ;;
3537a84e134Smrg	    "EV6.8AL (21264B)")
3545ec34c4cSmrg		UNAME_MACHINE=alphaev68 ;;
3557a84e134Smrg	    "EV6.8CX (21264D)")
3565ec34c4cSmrg		UNAME_MACHINE=alphaev68 ;;
3577a84e134Smrg	    "EV6.9A (21264/EV69A)")
3585ec34c4cSmrg		UNAME_MACHINE=alphaev69 ;;
3597a84e134Smrg	    "EV7 (21364)")
3605ec34c4cSmrg		UNAME_MACHINE=alphaev7 ;;
3617a84e134Smrg	    "EV7.9 (21364A)")
3625ec34c4cSmrg		UNAME_MACHINE=alphaev79 ;;
3637a84e134Smrg	esac
3647a84e134Smrg	# A Pn.n version is a patched version.
3657a84e134Smrg	# A Vn.n version is a released version.
3667a84e134Smrg	# A Tn.n version is a released field test version.
3677a84e134Smrg	# A Xn.n version is an unreleased experimental baselevel.
3687a84e134Smrg	# 1.2 uses "1.2" for uname -r.
3695b16253fSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
3705b16253fSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
3715b16253fSmrg	;;
3727a84e134Smrg    Amiga*:UNIX_System_V:4.0:*)
3735b16253fSmrg	GUESS=m68k-unknown-sysv4
3745b16253fSmrg	;;
3757a84e134Smrg    *:[Aa]miga[Oo][Ss]:*:*)
3765b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
3775b16253fSmrg	;;
3787a84e134Smrg    *:[Mm]orph[Oo][Ss]:*:*)
3795b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
3805b16253fSmrg	;;
3817a84e134Smrg    *:OS/390:*:*)
3825b16253fSmrg	GUESS=i370-ibm-openedition
3835b16253fSmrg	;;
3847a84e134Smrg    *:z/VM:*:*)
3855b16253fSmrg	GUESS=s390-ibm-zvmoe
3865b16253fSmrg	;;
3877a84e134Smrg    *:OS400:*:*)
3885b16253fSmrg	GUESS=powerpc-ibm-os400
3895b16253fSmrg	;;
3907a84e134Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3915b16253fSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
3925b16253fSmrg	;;
393c889a3bfSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3945b16253fSmrg	GUESS=arm-unknown-riscos
3955b16253fSmrg	;;
3967a84e134Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3975b16253fSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
3985b16253fSmrg	;;
3997a84e134Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4007a84e134Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
4015b16253fSmrg	case `(/bin/universe) 2>/dev/null` in
4025b16253fSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
4035b16253fSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
4045b16253fSmrg	esac
4055b16253fSmrg	;;
4067a84e134Smrg    NILE*:*:*:dcosx)
4075b16253fSmrg	GUESS=pyramid-pyramid-svr4
4085b16253fSmrg	;;
4097a84e134Smrg    DRS?6000:unix:4.0:6*)
4105b16253fSmrg	GUESS=sparc-icl-nx6
4115b16253fSmrg	;;
4127a84e134Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4137a84e134Smrg	case `/usr/bin/uname -p` in
4145b16253fSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
4155b16253fSmrg	esac
4165b16253fSmrg	;;
417994689c1Smrg    s390x:SunOS:*:*)
4185b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4195b16253fSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
4205b16253fSmrg	;;
4217a84e134Smrg    sun4H:SunOS:5.*:*)
4225b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4235b16253fSmrg	GUESS=sparc-hal-solaris2$SUN_REL
4245b16253fSmrg	;;
4257a84e134Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
4265b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4275b16253fSmrg	GUESS=sparc-sun-solaris2$SUN_REL
4285b16253fSmrg	;;
429994689c1Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
4305b16253fSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
4315b16253fSmrg	;;
432ab902922Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4335ec34c4cSmrg	set_cc_for_build
4345ec34c4cSmrg	SUN_ARCH=i386
435994689c1Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436994689c1Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437994689c1Smrg	# This test works for both compilers.
4385b16253fSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439994689c1Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4405b16253fSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441994689c1Smrg		grep IS_64BIT_ARCH >/dev/null
442994689c1Smrg	    then
4435ec34c4cSmrg		SUN_ARCH=x86_64
444994689c1Smrg	    fi
445994689c1Smrg	fi
4465b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4475b16253fSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
4485b16253fSmrg	;;
4497a84e134Smrg    sun4*:SunOS:6*:*)
4507a84e134Smrg	# According to config.sub, this is the proper way to canonicalize
4517a84e134Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4527a84e134Smrg	# it's likely to be more like Solaris than SunOS4.
4535b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4545b16253fSmrg	GUESS=sparc-sun-solaris3$SUN_REL
4555b16253fSmrg	;;
4567a84e134Smrg    sun4*:SunOS:*:*)
4575b16253fSmrg	case `/usr/bin/arch -k` in
4587a84e134Smrg	    Series*|S4*)
4597a84e134Smrg		UNAME_RELEASE=`uname -v`
4607a84e134Smrg		;;
4617a84e134Smrg	esac
4627a84e134Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4635b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
4645b16253fSmrg	GUESS=sparc-sun-sunos$SUN_REL
4655b16253fSmrg	;;
4667a84e134Smrg    sun3*:SunOS:*:*)
4675b16253fSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
4685b16253fSmrg	;;
4697a84e134Smrg    sun*:*:4.2BSD:*)
4707a84e134Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4715ec34c4cSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4725b16253fSmrg	case `/bin/arch` in
4737a84e134Smrg	    sun3)
4745b16253fSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4757a84e134Smrg		;;
4767a84e134Smrg	    sun4)
4775b16253fSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4787a84e134Smrg		;;
4797a84e134Smrg	esac
4805b16253fSmrg	;;
4817a84e134Smrg    aushp:SunOS:*:*)
4825b16253fSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
4835b16253fSmrg	;;
4847a84e134Smrg    # The situation for MiNT is a little confusing.  The machine name
4857a84e134Smrg    # can be virtually everything (everything which is not
4867a84e134Smrg    # "atarist" or "atariste" at least should have a processor
4877a84e134Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4887a84e134Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4897a84e134Smrg    # the system name "TOS" denotes a system which is actually not
4907a84e134Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4917a84e134Smrg    # be no problem.
4927a84e134Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4935b16253fSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4945b16253fSmrg	;;
4957a84e134Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4965b16253fSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4975b16253fSmrg	;;
4987a84e134Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4995b16253fSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
5005b16253fSmrg	;;
5017a84e134Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
5025b16253fSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
5035b16253fSmrg	;;
5047a84e134Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
5055b16253fSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
5065b16253fSmrg	;;
5077a84e134Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
5085b16253fSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
5095b16253fSmrg	;;
5107a84e134Smrg    m68k:machten:*:*)
5115b16253fSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
5125b16253fSmrg	;;
5137a84e134Smrg    powerpc:machten:*:*)
5145b16253fSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
5155b16253fSmrg	;;
5167a84e134Smrg    RISC*:Mach:*:*)
5175b16253fSmrg	GUESS=mips-dec-mach_bsd4.3
5185b16253fSmrg	;;
5197a84e134Smrg    RISC*:ULTRIX:*:*)
5205b16253fSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
5215b16253fSmrg	;;
5227a84e134Smrg    VAX*:ULTRIX*:*:*)
5235b16253fSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
5245b16253fSmrg	;;
5257a84e134Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
5265b16253fSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
5275b16253fSmrg	;;
5287a84e134Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
5295ec34c4cSmrg	set_cc_for_build
5305ec34c4cSmrg	sed 's/^	//' << EOF > "$dummy.c"
5317a84e134Smrg#ifdef __cplusplus
5327a84e134Smrg#include <stdio.h>  /* for printf() prototype */
5337a84e134Smrg	int main (int argc, char *argv[]) {
5347a84e134Smrg#else
5357a84e134Smrg	int main (argc, argv) int argc; char *argv[]; {
5367a84e134Smrg#endif
5377a84e134Smrg	#if defined (host_mips) && defined (MIPSEB)
5387a84e134Smrg	#if defined (SYSTYPE_SYSV)
5395ec34c4cSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5407a84e134Smrg	#endif
5417a84e134Smrg	#if defined (SYSTYPE_SVR4)
5425ec34c4cSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5437a84e134Smrg	#endif
5447a84e134Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5455ec34c4cSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5467a84e134Smrg	#endif
5477a84e134Smrg	#endif
5487a84e134Smrg	  exit (-1);
5497a84e134Smrg	}
5507a84e134SmrgEOF
5515ec34c4cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5525ec34c4cSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5535ec34c4cSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5547a84e134Smrg	    { echo "$SYSTEM_NAME"; exit; }
5555b16253fSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
5565b16253fSmrg	;;
5577a84e134Smrg    Motorola:PowerMAX_OS:*:*)
5585b16253fSmrg	GUESS=powerpc-motorola-powermax
5595b16253fSmrg	;;
5607a84e134Smrg    Motorola:*:4.3:PL8-*)
5615b16253fSmrg	GUESS=powerpc-harris-powermax
5625b16253fSmrg	;;
5637a84e134Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5645b16253fSmrg	GUESS=powerpc-harris-powermax
5655b16253fSmrg	;;
5667a84e134Smrg    Night_Hawk:Power_UNIX:*:*)
5675b16253fSmrg	GUESS=powerpc-harris-powerunix
5685b16253fSmrg	;;
5697a84e134Smrg    m88k:CX/UX:7*:*)
5705b16253fSmrg	GUESS=m88k-harris-cxux7
5715b16253fSmrg	;;
5727a84e134Smrg    m88k:*:4*:R4*)
5735b16253fSmrg	GUESS=m88k-motorola-sysv4
5745b16253fSmrg	;;
5757a84e134Smrg    m88k:*:3*:R3*)
5765b16253fSmrg	GUESS=m88k-motorola-sysv3
5775b16253fSmrg	;;
5787a84e134Smrg    AViiON:dgux:*:*)
579421c997bSmrg	# DG/UX returns AViiON for all architectures
580421c997bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5815b16253fSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5827a84e134Smrg	then
5835b16253fSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5845b16253fSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
5857a84e134Smrg	    then
5865b16253fSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5877a84e134Smrg	    else
5885b16253fSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5897a84e134Smrg	    fi
5907a84e134Smrg	else
5915b16253fSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5927a84e134Smrg	fi
5935b16253fSmrg	;;
5947a84e134Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5955b16253fSmrg	GUESS=m88k-dolphin-sysv3
5965b16253fSmrg	;;
5977a84e134Smrg    M88*:*:R3*:*)
5987a84e134Smrg	# Delta 88k system running SVR3
5995b16253fSmrg	GUESS=m88k-motorola-sysv3
6005b16253fSmrg	;;
6017a84e134Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
6025b16253fSmrg	GUESS=m88k-tektronix-sysv3
6035b16253fSmrg	;;
6047a84e134Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
6055b16253fSmrg	GUESS=m68k-tektronix-bsd
6065b16253fSmrg	;;
6077a84e134Smrg    *:IRIX*:*:*)
6085b16253fSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
6095b16253fSmrg	GUESS=mips-sgi-irix$IRIX_REL
6105b16253fSmrg	;;
6117a84e134Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
6125b16253fSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
6135b16253fSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6147a84e134Smrg    i*86:AIX:*:*)
6155b16253fSmrg	GUESS=i386-ibm-aix
6165b16253fSmrg	;;
6177a84e134Smrg    ia64:AIX:*:*)
6185b16253fSmrg	if test -x /usr/bin/oslevel ; then
6197a84e134Smrg		IBM_REV=`/usr/bin/oslevel`
6207a84e134Smrg	else
6215b16253fSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6227a84e134Smrg	fi
6235b16253fSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
6245b16253fSmrg	;;
6257a84e134Smrg    *:AIX:2:3)
6267a84e134Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6275ec34c4cSmrg		set_cc_for_build
6285ec34c4cSmrg		sed 's/^		//' << EOF > "$dummy.c"
6297a84e134Smrg		#include <sys/systemcfg.h>
6307a84e134Smrg
6317a84e134Smrg		main()
6327a84e134Smrg			{
6337a84e134Smrg			if (!__power_pc())
6347a84e134Smrg				exit(1);
6357a84e134Smrg			puts("powerpc-ibm-aix3.2.5");
6367a84e134Smrg			exit(0);
6377a84e134Smrg			}
6387a84e134SmrgEOF
6395ec34c4cSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6407a84e134Smrg		then
6415b16253fSmrg			GUESS=$SYSTEM_NAME
6427a84e134Smrg		else
6435b16253fSmrg			GUESS=rs6000-ibm-aix3.2.5
6447a84e134Smrg		fi
6457a84e134Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6465b16253fSmrg		GUESS=rs6000-ibm-aix3.2.4
6477a84e134Smrg	else
6485b16253fSmrg		GUESS=rs6000-ibm-aix3.2
6497a84e134Smrg	fi
6505b16253fSmrg	;;
651994689c1Smrg    *:AIX:*:[4567])
6527a84e134Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6535ec34c4cSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6547a84e134Smrg		IBM_ARCH=rs6000
6557a84e134Smrg	else
6567a84e134Smrg		IBM_ARCH=powerpc
6577a84e134Smrg	fi
6585b16253fSmrg	if test -x /usr/bin/lslpp ; then
6595b16253fSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660c8571806Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6617a84e134Smrg	else
6625b16253fSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6637a84e134Smrg	fi
6645b16253fSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
6655b16253fSmrg	;;
6667a84e134Smrg    *:AIX:*:*)
6675b16253fSmrg	GUESS=rs6000-ibm-aix
6685b16253fSmrg	;;
6695ec34c4cSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6705b16253fSmrg	GUESS=romp-ibm-bsd4.4
6715b16253fSmrg	;;
6727a84e134Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6735b16253fSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
6745b16253fSmrg	;;                                  # report: romp-ibm BSD 4.3
6757a84e134Smrg    *:BOSX:*:*)
6765b16253fSmrg	GUESS=rs6000-bull-bosx
6775b16253fSmrg	;;
6787a84e134Smrg    DPX/2?00:B.O.S.:*:*)
6795b16253fSmrg	GUESS=m68k-bull-sysv3
6805b16253fSmrg	;;
6817a84e134Smrg    9000/[34]??:4.3bsd:1.*:*)
6825b16253fSmrg	GUESS=m68k-hp-bsd
6835b16253fSmrg	;;
6847a84e134Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6855b16253fSmrg	GUESS=m68k-hp-bsd4.4
6865b16253fSmrg	;;
6877a84e134Smrg    9000/[34678]??:HP-UX:*:*)
6885b16253fSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
6895b16253fSmrg	case $UNAME_MACHINE in
6905ec34c4cSmrg	    9000/31?)            HP_ARCH=m68000 ;;
6915ec34c4cSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6927a84e134Smrg	    9000/[678][0-9][0-9])
6935b16253fSmrg		if test -x /usr/bin/getconf; then
6947a84e134Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695421c997bSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6965b16253fSmrg		    case $sc_cpu_version in
6975ec34c4cSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6985ec34c4cSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699421c997bSmrg		      532)                      # CPU_PA_RISC2_0
7005b16253fSmrg			case $sc_kernel_bits in
7015ec34c4cSmrg			  32) HP_ARCH=hppa2.0n ;;
7025ec34c4cSmrg			  64) HP_ARCH=hppa2.0w ;;
7035ec34c4cSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704421c997bSmrg			esac ;;
705421c997bSmrg		    esac
7067a84e134Smrg		fi
7075b16253fSmrg		if test "$HP_ARCH" = ""; then
7085ec34c4cSmrg		    set_cc_for_build
7095ec34c4cSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7107a84e134Smrg
711421c997bSmrg		#define _HPUX_SOURCE
712421c997bSmrg		#include <stdlib.h>
713421c997bSmrg		#include <unistd.h>
7147a84e134Smrg
715421c997bSmrg		int main ()
716421c997bSmrg		{
717421c997bSmrg		#if defined(_SC_KERNEL_BITS)
718421c997bSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
719421c997bSmrg		#endif
720421c997bSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7217a84e134Smrg
722421c997bSmrg		    switch (cpu)
723421c997bSmrg			{
724421c997bSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725421c997bSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726421c997bSmrg			case CPU_PA_RISC2_0:
727421c997bSmrg		#if defined(_SC_KERNEL_BITS)
728421c997bSmrg			    switch (bits)
729421c997bSmrg				{
730421c997bSmrg				case 64: puts ("hppa2.0w"); break;
731421c997bSmrg				case 32: puts ("hppa2.0n"); break;
732421c997bSmrg				default: puts ("hppa2.0"); break;
733421c997bSmrg				} break;
734421c997bSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
735421c997bSmrg			    puts ("hppa2.0"); break;
736421c997bSmrg		#endif
737421c997bSmrg			default: puts ("hppa1.0"); break;
738421c997bSmrg			}
739421c997bSmrg		    exit (0);
740421c997bSmrg		}
7417a84e134SmrgEOF
7425ec34c4cSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7437a84e134Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7447a84e134Smrg		fi ;;
7457a84e134Smrg	esac
7465b16253fSmrg	if test "$HP_ARCH" = hppa2.0w
7477a84e134Smrg	then
7485ec34c4cSmrg	    set_cc_for_build
7497a84e134Smrg
7507a84e134Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7517a84e134Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7527a84e134Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7537a84e134Smrg	    #
7547a84e134Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
7557a84e134Smrg	    # => hppa2.0w-hp-hpux11.23
7567a84e134Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7577a84e134Smrg	    # => hppa64-hp-hpux11.23
7587a84e134Smrg
7595ec34c4cSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760994689c1Smrg		grep -q __LP64__
7617a84e134Smrg	    then
7625ec34c4cSmrg		HP_ARCH=hppa2.0w
7637a84e134Smrg	    else
7645ec34c4cSmrg		HP_ARCH=hppa64
7657a84e134Smrg	    fi
7667a84e134Smrg	fi
7675b16253fSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
7685b16253fSmrg	;;
7697a84e134Smrg    ia64:HP-UX:*:*)
7705b16253fSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
7715b16253fSmrg	GUESS=ia64-hp-hpux$HPUX_REV
7725b16253fSmrg	;;
7737a84e134Smrg    3050*:HI-UX:*:*)
7745ec34c4cSmrg	set_cc_for_build
7755ec34c4cSmrg	sed 's/^	//' << EOF > "$dummy.c"
7767a84e134Smrg	#include <unistd.h>
7777a84e134Smrg	int
7787a84e134Smrg	main ()
7797a84e134Smrg	{
7807a84e134Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7817a84e134Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7827a84e134Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7837a84e134Smrg	     results, however.  */
7847a84e134Smrg	  if (CPU_IS_PA_RISC (cpu))
7857a84e134Smrg	    {
7867a84e134Smrg	      switch (cpu)
7877a84e134Smrg		{
7887a84e134Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7897a84e134Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7907a84e134Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7917a84e134Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7927a84e134Smrg		}
7937a84e134Smrg	    }
7947a84e134Smrg	  else if (CPU_IS_HP_MC68K (cpu))
7957a84e134Smrg	    puts ("m68k-hitachi-hiuxwe2");
7967a84e134Smrg	  else puts ("unknown-hitachi-hiuxwe2");
7977a84e134Smrg	  exit (0);
7987a84e134Smrg	}
7997a84e134SmrgEOF
8005ec34c4cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8017a84e134Smrg		{ echo "$SYSTEM_NAME"; exit; }
8025b16253fSmrg	GUESS=unknown-hitachi-hiuxwe2
8035b16253fSmrg	;;
8045ec34c4cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
8055b16253fSmrg	GUESS=hppa1.1-hp-bsd
8065b16253fSmrg	;;
8077a84e134Smrg    9000/8??:4.3bsd:*:*)
8085b16253fSmrg	GUESS=hppa1.0-hp-bsd
8095b16253fSmrg	;;
8107a84e134Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
8115b16253fSmrg	GUESS=hppa1.0-hp-mpeix
8125b16253fSmrg	;;
8135ec34c4cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
8145b16253fSmrg	GUESS=hppa1.1-hp-osf
8155b16253fSmrg	;;
8167a84e134Smrg    hp8??:OSF1:*:*)
8175b16253fSmrg	GUESS=hppa1.0-hp-osf
8185b16253fSmrg	;;
8197a84e134Smrg    i*86:OSF1:*:*)
8205b16253fSmrg	if test -x /usr/sbin/sysversion ; then
8215b16253fSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8227a84e134Smrg	else
8235b16253fSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8247a84e134Smrg	fi
8255b16253fSmrg	;;
8267a84e134Smrg    parisc*:Lites*:*:*)
8275b16253fSmrg	GUESS=hppa1.1-hp-lites
8285b16253fSmrg	;;
8297a84e134Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
8305b16253fSmrg	GUESS=c1-convex-bsd
8315b16253fSmrg	;;
8327a84e134Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8337a84e134Smrg	if getsysinfo -f scalar_acc
8347a84e134Smrg	then echo c32-convex-bsd
8357a84e134Smrg	else echo c2-convex-bsd
8367a84e134Smrg	fi
837421c997bSmrg	exit ;;
8387a84e134Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8395b16253fSmrg	GUESS=c34-convex-bsd
8405b16253fSmrg	;;
8417a84e134Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8425b16253fSmrg	GUESS=c38-convex-bsd
8435b16253fSmrg	;;
8447a84e134Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8455b16253fSmrg	GUESS=c4-convex-bsd
8465b16253fSmrg	;;
8477a84e134Smrg    CRAY*Y-MP:*:*:*)
8485b16253fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8495b16253fSmrg	GUESS=ymp-cray-unicos$CRAY_REL
8505b16253fSmrg	;;
8517a84e134Smrg    CRAY*[A-Z]90:*:*:*)
8525ec34c4cSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8537a84e134Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8547a84e134Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8557a84e134Smrg	      -e 's/\.[^.]*$/.X/'
8567a84e134Smrg	exit ;;
8577a84e134Smrg    CRAY*TS:*:*:*)
8585b16253fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8595b16253fSmrg	GUESS=t90-cray-unicos$CRAY_REL
8605b16253fSmrg	;;
8617a84e134Smrg    CRAY*T3E:*:*:*)
8625b16253fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8635b16253fSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
8645b16253fSmrg	;;
8657a84e134Smrg    CRAY*SV1:*:*:*)
8665b16253fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8675b16253fSmrg	GUESS=sv1-cray-unicos$CRAY_REL
8685b16253fSmrg	;;
8697a84e134Smrg    *:UNICOS/mp:*:*)
8705b16253fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8715b16253fSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
8725b16253fSmrg	;;
8737a84e134Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8745ec34c4cSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8755ec34c4cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8765ec34c4cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8775b16253fSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8785b16253fSmrg	;;
8797a84e134Smrg    5000:UNIX_System_V:4.*:*)
8805ec34c4cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8815ec34c4cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8825b16253fSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8835b16253fSmrg	;;
8847a84e134Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8855b16253fSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
8865b16253fSmrg	;;
8877a84e134Smrg    sparc*:BSD/OS:*:*)
8885b16253fSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
8895b16253fSmrg	;;
8907a84e134Smrg    *:BSD/OS:*:*)
8915b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
8925b16253fSmrg	;;
8935ec34c4cSmrg    arm:FreeBSD:*:*)
8945ec34c4cSmrg	UNAME_PROCESSOR=`uname -p`
8955ec34c4cSmrg	set_cc_for_build
8965ec34c4cSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8975ec34c4cSmrg	    | grep -q __ARM_PCS_VFP
8985ec34c4cSmrg	then
8995b16253fSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9005b16253fSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9015ec34c4cSmrg	else
9025b16253fSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9035b16253fSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9045ec34c4cSmrg	fi
9055b16253fSmrg	;;
9067a84e134Smrg    *:FreeBSD:*:*)
907421c997bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
9085b16253fSmrg	case $UNAME_PROCESSOR in
909ab902922Smrg	    amd64)
9105ec34c4cSmrg		UNAME_PROCESSOR=x86_64 ;;
9115ec34c4cSmrg	    i386)
9125ec34c4cSmrg		UNAME_PROCESSOR=i586 ;;
913ab902922Smrg	esac
9145b16253fSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9155b16253fSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
9165b16253fSmrg	;;
9177a84e134Smrg    i*:CYGWIN*:*)
9185b16253fSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
9195b16253fSmrg	;;
920c889a3bfSmrg    *:MINGW64*:*)
9215b16253fSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
9225b16253fSmrg	;;
923ab902922Smrg    *:MINGW*:*)
9245b16253fSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
9255b16253fSmrg	;;
926c8571806Smrg    *:MSYS*:*)
9275b16253fSmrg	GUESS=$UNAME_MACHINE-pc-msys
9285b16253fSmrg	;;
9297a84e134Smrg    i*:PW*:*)
9305b16253fSmrg	GUESS=$UNAME_MACHINE-pc-pw32
9315b16253fSmrg	;;
9325b16253fSmrg    *:SerenityOS:*:*)
9335b16253fSmrg        GUESS=$UNAME_MACHINE-pc-serenity
9345b16253fSmrg        ;;
935994689c1Smrg    *:Interix*:*)
9365b16253fSmrg	case $UNAME_MACHINE in
937ab902922Smrg	    x86)
9385b16253fSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
9395b16253fSmrg		;;
940994689c1Smrg	    authenticamd | genuineintel | EM64T)
9415b16253fSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
9425b16253fSmrg		;;
943ab902922Smrg	    IA64)
9445b16253fSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
9455b16253fSmrg		;;
946ab902922Smrg	esac ;;
9477a84e134Smrg    i*:UWIN*:*)
9485b16253fSmrg	GUESS=$UNAME_MACHINE-pc-uwin
9495b16253fSmrg	;;
9507a84e134Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9515b16253fSmrg	GUESS=x86_64-pc-cygwin
9525b16253fSmrg	;;
9537a84e134Smrg    prep*:SunOS:5.*:*)
9545b16253fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
9555b16253fSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
9565b16253fSmrg	;;
9577a84e134Smrg    *:GNU:*:*)
9587a84e134Smrg	# the GNU system
9595b16253fSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
9605b16253fSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
9615b16253fSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
9625b16253fSmrg	;;
9637a84e134Smrg    *:GNU/*:*:*)
9647a84e134Smrg	# other systems with GNU libc and userland
9655b16253fSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
9665b16253fSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9675b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
9685b16253fSmrg	;;
9695ec34c4cSmrg    *:Minix:*:*)
9705b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-minix
9715b16253fSmrg	;;
972c889a3bfSmrg    aarch64:Linux:*:*)
9735b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9745b16253fSmrg	;;
975c889a3bfSmrg    aarch64_be:Linux:*:*)
976c889a3bfSmrg	UNAME_MACHINE=aarch64_be
9775b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9785b16253fSmrg	;;
979994689c1Smrg    alpha:Linux:*:*)
9805ec34c4cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
981994689c1Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
982994689c1Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
983994689c1Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
984994689c1Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
985994689c1Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
986994689c1Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
987994689c1Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
988421c997bSmrg	esac
989994689c1Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9905ec34c4cSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9915b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9925b16253fSmrg	;;
9935b16253fSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
9945b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9955b16253fSmrg	;;
9967a84e134Smrg    arm*:Linux:*:*)
9975ec34c4cSmrg	set_cc_for_build
998ab902922Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
999ab902922Smrg	    | grep -q __ARM_EABI__
1000ab902922Smrg	then
10015b16253fSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1002ab902922Smrg	else
1003421c997bSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1004421c997bSmrg		| grep -q __ARM_PCS_VFP
1005421c997bSmrg	    then
10065b16253fSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1007421c997bSmrg	    else
10085b16253fSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1009421c997bSmrg	    fi
1010ab902922Smrg	fi
10115b16253fSmrg	;;
1012ab902922Smrg    avr32*:Linux:*:*)
10135b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10145b16253fSmrg	;;
10157a84e134Smrg    cris:Linux:*:*)
10165b16253fSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10175b16253fSmrg	;;
10187a84e134Smrg    crisv32:Linux:*:*)
10195b16253fSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10205b16253fSmrg	;;
10215ec34c4cSmrg    e2k:Linux:*:*)
10225b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10235b16253fSmrg	;;
10247a84e134Smrg    frv:Linux:*:*)
10255b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10265b16253fSmrg	;;
1027421c997bSmrg    hexagon:Linux:*:*)
10285b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10295b16253fSmrg	;;
1030994689c1Smrg    i*86:Linux:*:*)
10315b16253fSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
10325b16253fSmrg	;;
10337a84e134Smrg    ia64:Linux:*:*)
10345b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10355b16253fSmrg	;;
10365ec34c4cSmrg    k1om:Linux:*:*)
10375b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10385b16253fSmrg	;;
1039efbcb2bfSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
10405b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10415b16253fSmrg	;;
10427a84e134Smrg    m32r*:Linux:*:*)
10435b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10445b16253fSmrg	;;
10457a84e134Smrg    m68*:Linux:*:*)
10465b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10475b16253fSmrg	;;
1048994689c1Smrg    mips:Linux:*:* | mips64:Linux:*:*)
10495ec34c4cSmrg	set_cc_for_build
10505ec34c4cSmrg	IS_GLIBC=0
10515ec34c4cSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10525ec34c4cSmrg	sed 's/^	//' << EOF > "$dummy.c"
10537a84e134Smrg	#undef CPU
10545ec34c4cSmrg	#undef mips
10555ec34c4cSmrg	#undef mipsel
10565ec34c4cSmrg	#undef mips64
10575ec34c4cSmrg	#undef mips64el
10585ec34c4cSmrg	#if ${IS_GLIBC} && defined(_ABI64)
10595ec34c4cSmrg	LIBCABI=gnuabi64
10605ec34c4cSmrg	#else
10615ec34c4cSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
10625ec34c4cSmrg	LIBCABI=gnuabin32
10635ec34c4cSmrg	#else
10645ec34c4cSmrg	LIBCABI=${LIBC}
10655ec34c4cSmrg	#endif
10665ec34c4cSmrg	#endif
10675ec34c4cSmrg
10685ec34c4cSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10695ec34c4cSmrg	CPU=mipsisa64r6
10705ec34c4cSmrg	#else
10715ec34c4cSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10725ec34c4cSmrg	CPU=mipsisa32r6
10735ec34c4cSmrg	#else
10745ec34c4cSmrg	#if defined(__mips64)
10755ec34c4cSmrg	CPU=mips64
10765ec34c4cSmrg	#else
10775ec34c4cSmrg	CPU=mips
10785ec34c4cSmrg	#endif
10795ec34c4cSmrg	#endif
10805ec34c4cSmrg	#endif
10815ec34c4cSmrg
10827a84e134Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10835ec34c4cSmrg	MIPS_ENDIAN=el
10847a84e134Smrg	#else
10857a84e134Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10865ec34c4cSmrg	MIPS_ENDIAN=
10877a84e134Smrg	#else
10885ec34c4cSmrg	MIPS_ENDIAN=
10897a84e134Smrg	#endif
10907a84e134Smrg	#endif
10917a84e134SmrgEOF
10925b16253fSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
10935b16253fSmrg	eval "$cc_set_vars"
10945ec34c4cSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10957a84e134Smrg	;;
10965ec34c4cSmrg    mips64el:Linux:*:*)
10975b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10985b16253fSmrg	;;
1099c8571806Smrg    openrisc*:Linux:*:*)
11005b16253fSmrg	GUESS=or1k-unknown-linux-$LIBC
11015b16253fSmrg	;;
1102c8571806Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
11035b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11045b16253fSmrg	;;
1105994689c1Smrg    padre:Linux:*:*)
11065b16253fSmrg	GUESS=sparc-unknown-linux-$LIBC
11075b16253fSmrg	;;
1108994689c1Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
11095b16253fSmrg	GUESS=hppa64-unknown-linux-$LIBC
11105b16253fSmrg	;;
11117a84e134Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
11127a84e134Smrg	# Look for CPU level
11137a84e134Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
11145b16253fSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
11155b16253fSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
11165b16253fSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11177a84e134Smrg	esac
11185b16253fSmrg	;;
1119994689c1Smrg    ppc64:Linux:*:*)
11205b16253fSmrg	GUESS=powerpc64-unknown-linux-$LIBC
11215b16253fSmrg	;;
1122994689c1Smrg    ppc:Linux:*:*)
11235b16253fSmrg	GUESS=powerpc-unknown-linux-$LIBC
11245b16253fSmrg	;;
1125c889a3bfSmrg    ppc64le:Linux:*:*)
11265b16253fSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
11275b16253fSmrg	;;
1128c889a3bfSmrg    ppcle:Linux:*:*)
11295b16253fSmrg	GUESS=powerpcle-unknown-linux-$LIBC
11305b16253fSmrg	;;
11315b16253fSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
11325b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11335b16253fSmrg	;;
11347a84e134Smrg    s390:Linux:*:* | s390x:Linux:*:*)
11355b16253fSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
11365b16253fSmrg	;;
11377a84e134Smrg    sh64*:Linux:*:*)
11385b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11395b16253fSmrg	;;
11407a84e134Smrg    sh*:Linux:*:*)
11415b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11425b16253fSmrg	;;
11437a84e134Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
11445b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11455b16253fSmrg	;;
1146994689c1Smrg    tile*:Linux:*:*)
11475b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11485b16253fSmrg	;;
11497a84e134Smrg    vax:Linux:*:*)
11505b16253fSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
11515b16253fSmrg	;;
11527a84e134Smrg    x86_64:Linux:*:*)
11535ec34c4cSmrg	set_cc_for_build
11545ec34c4cSmrg	LIBCABI=$LIBC
11555b16253fSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1156efbcb2bfSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1157efbcb2bfSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1158efbcb2bfSmrg		grep IS_X32 >/dev/null
1159efbcb2bfSmrg	    then
1160efbcb2bfSmrg		LIBCABI=${LIBC}x32
1161efbcb2bfSmrg	    fi
11625ec34c4cSmrg	fi
1163efbcb2bfSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
11645b16253fSmrg	;;
1165ab902922Smrg    xtensa*:Linux:*:*)
11665b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11675b16253fSmrg	;;
11687a84e134Smrg    i*86:DYNIX/ptx:4*:*)
11697a84e134Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11707a84e134Smrg	# earlier versions are messed up and put the nodename in both
11717a84e134Smrg	# sysname and nodename.
11725b16253fSmrg	GUESS=i386-sequent-sysv4
11735b16253fSmrg	;;
11747a84e134Smrg    i*86:UNIX_SV:4.2MP:2.*)
1175421c997bSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1176421c997bSmrg	# number series starting with 2...
1177421c997bSmrg	# I am not positive that other SVR4 systems won't match this,
11787a84e134Smrg	# I just have to hope.  -- rms.
1179421c997bSmrg	# Use sysv4.2uw... so that sysv4* matches it.
11805b16253fSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
11815b16253fSmrg	;;
11827a84e134Smrg    i*86:OS/2:*:*)
11837a84e134Smrg	# If we were able to find `uname', then EMX Unix compatibility
11847a84e134Smrg	# is probably installed.
11855b16253fSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
11865b16253fSmrg	;;
11877a84e134Smrg    i*86:XTS-300:*:STOP)
11885b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-stop
11895b16253fSmrg	;;
11907a84e134Smrg    i*86:atheos:*:*)
11915b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
11925b16253fSmrg	;;
11937a84e134Smrg    i*86:syllable:*:*)
11945b16253fSmrg	GUESS=$UNAME_MACHINE-pc-syllable
11955b16253fSmrg	;;
1196994689c1Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
11975b16253fSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
11985b16253fSmrg	;;
11997a84e134Smrg    i*86:*DOS:*:*)
12005b16253fSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
12015b16253fSmrg	;;
12025ec34c4cSmrg    i*86:*:4.*:*)
12035ec34c4cSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12047a84e134Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
12055b16253fSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12067a84e134Smrg	else
12075b16253fSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12087a84e134Smrg	fi
12095b16253fSmrg	;;
12107a84e134Smrg    i*86:*:5:[678]*)
1211421c997bSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12127a84e134Smrg	case `/bin/uname -X | grep "^Machine"` in
12137a84e134Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
12147a84e134Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12157a84e134Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12167a84e134Smrg	esac
12175b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
12185b16253fSmrg	;;
12197a84e134Smrg    i*86:*:3.2:*)
12207a84e134Smrg	if test -f /usr/options/cb.name; then
12217a84e134Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
12225b16253fSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12237a84e134Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12247a84e134Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12257a84e134Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12267a84e134Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12277a84e134Smrg			&& UNAME_MACHINE=i586
12287a84e134Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12297a84e134Smrg			&& UNAME_MACHINE=i686
12307a84e134Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12317a84e134Smrg			&& UNAME_MACHINE=i686
12325b16253fSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12337a84e134Smrg	else
12345b16253fSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
12357a84e134Smrg	fi
12365b16253fSmrg	;;
12377a84e134Smrg    pc:*:*:*)
12387a84e134Smrg	# Left here for compatibility:
1239421c997bSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1240421c997bSmrg	# the processor, so we play safe by assuming i586.
1241994689c1Smrg	# Note: whatever this is, it MUST be the same as what config.sub
12425ec34c4cSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1243994689c1Smrg	# this is a cross-build.
12445b16253fSmrg	GUESS=i586-pc-msdosdjgpp
12455b16253fSmrg	;;
12467a84e134Smrg    Intel:Mach:3*:*)
12475b16253fSmrg	GUESS=i386-pc-mach3
12485b16253fSmrg	;;
12497a84e134Smrg    paragon:*:*:*)
12505b16253fSmrg	GUESS=i860-intel-osf1
12515b16253fSmrg	;;
12527a84e134Smrg    i860:*:4.*:*) # i860-SVR4
12537a84e134Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
12545b16253fSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12557a84e134Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
12565b16253fSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12577a84e134Smrg	fi
12585b16253fSmrg	;;
12597a84e134Smrg    mini*:CTIX:SYS*5:*)
12607a84e134Smrg	# "miniframe"
12615b16253fSmrg	GUESS=m68010-convergent-sysv
12625b16253fSmrg	;;
12637a84e134Smrg    mc68k:UNIX:SYSTEM5:3.51m)
12645b16253fSmrg	GUESS=m68k-convergent-sysv
12655b16253fSmrg	;;
12667a84e134Smrg    M680?0:D-NIX:5.3:*)
12675b16253fSmrg	GUESS=m68k-diab-dnix
12685b16253fSmrg	;;
12697a84e134Smrg    M68*:*:R3V[5678]*:*)
12707a84e134Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12717a84e134Smrg    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)
12727a84e134Smrg	OS_REL=''
12737a84e134Smrg	test -r /etc/.relid \
12747a84e134Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12757a84e134Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12765ec34c4cSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12777a84e134Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12785ec34c4cSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12797a84e134Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1280421c997bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1281421c997bSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1282994689c1Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1283994689c1Smrg	OS_REL='.3'
1284994689c1Smrg	test -r /etc/.relid \
1285994689c1Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1286994689c1Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12875ec34c4cSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1288994689c1Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12895ec34c4cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1290994689c1Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12915ec34c4cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12927a84e134Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
12935b16253fSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
12945b16253fSmrg	;;
12957a84e134Smrg    mc68030:UNIX_System_V:4.*:*)
12965b16253fSmrg	GUESS=m68k-atari-sysv4
12975b16253fSmrg	;;
12987a84e134Smrg    TSUNAMI:LynxOS:2.*:*)
12995b16253fSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
13005b16253fSmrg	;;
13017a84e134Smrg    rs6000:LynxOS:2.*:*)
13025b16253fSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
13035b16253fSmrg	;;
1304994689c1Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
13055b16253fSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
13065b16253fSmrg	;;
13077a84e134Smrg    SM[BE]S:UNIX_SV:*:*)
13085b16253fSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
13095b16253fSmrg	;;
13107a84e134Smrg    RM*:ReliantUNIX-*:*:*)
13115b16253fSmrg	GUESS=mips-sni-sysv4
13125b16253fSmrg	;;
13137a84e134Smrg    RM*:SINIX-*:*:*)
13145b16253fSmrg	GUESS=mips-sni-sysv4
13155b16253fSmrg	;;
13167a84e134Smrg    *:SINIX-*:*:*)
13177a84e134Smrg	if uname -p 2>/dev/null >/dev/null ; then
13187a84e134Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
13195b16253fSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
13207a84e134Smrg	else
13215b16253fSmrg		GUESS=ns32k-sni-sysv
13227a84e134Smrg	fi
13235b16253fSmrg	;;
1324421c997bSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1325421c997bSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
13265b16253fSmrg	GUESS=i586-unisys-sysv4
13275b16253fSmrg	;;
13287a84e134Smrg    *:UNIX_System_V:4*:FTX*)
13297a84e134Smrg	# From Gerald Hewes <hewes@openmarket.com>.
13307a84e134Smrg	# How about differentiating between stratus architectures? -djm
13315b16253fSmrg	GUESS=hppa1.1-stratus-sysv4
13325b16253fSmrg	;;
13337a84e134Smrg    *:*:*:FTX*)
13347a84e134Smrg	# From seanf@swdc.stratus.com.
13355b16253fSmrg	GUESS=i860-stratus-sysv4
13365b16253fSmrg	;;
13377a84e134Smrg    i*86:VOS:*:*)
13387a84e134Smrg	# From Paul.Green@stratus.com.
13395b16253fSmrg	GUESS=$UNAME_MACHINE-stratus-vos
13405b16253fSmrg	;;
13417a84e134Smrg    *:VOS:*:*)
13427a84e134Smrg	# From Paul.Green@stratus.com.
13435b16253fSmrg	GUESS=hppa1.1-stratus-vos
13445b16253fSmrg	;;
13457a84e134Smrg    mc68*:A/UX:*:*)
13465b16253fSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
13475b16253fSmrg	;;
13487a84e134Smrg    news*:NEWS-OS:6*:*)
13495b16253fSmrg	GUESS=mips-sony-newsos6
13505b16253fSmrg	;;
13517a84e134Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13525b16253fSmrg	if test -d /usr/nec; then
13535b16253fSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
13547a84e134Smrg	else
13555b16253fSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
13567a84e134Smrg	fi
13575b16253fSmrg	;;
13587a84e134Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13595b16253fSmrg	GUESS=powerpc-be-beos
13605b16253fSmrg	;;
13617a84e134Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13625b16253fSmrg	GUESS=powerpc-apple-beos
13635b16253fSmrg	;;
13647a84e134Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13655b16253fSmrg	GUESS=i586-pc-beos
13665b16253fSmrg	;;
1367994689c1Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13685b16253fSmrg	GUESS=i586-pc-haiku
13695b16253fSmrg	;;
1370efbcb2bfSmrg    x86_64:Haiku:*:*)
1371efbcb2bfSmrg	GUESS=x86_64-unknown-haiku
13725b16253fSmrg	;;
13737a84e134Smrg    SX-4:SUPER-UX:*:*)
13745b16253fSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
13755b16253fSmrg	;;
13767a84e134Smrg    SX-5:SUPER-UX:*:*)
13775b16253fSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
13785b16253fSmrg	;;
13797a84e134Smrg    SX-6:SUPER-UX:*:*)
13805b16253fSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
13815b16253fSmrg	;;
1382ab902922Smrg    SX-7:SUPER-UX:*:*)
13835b16253fSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
13845b16253fSmrg	;;
1385ab902922Smrg    SX-8:SUPER-UX:*:*)
13865b16253fSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
13875b16253fSmrg	;;
1388ab902922Smrg    SX-8R:SUPER-UX:*:*)
13895b16253fSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
13905b16253fSmrg	;;
13915ec34c4cSmrg    SX-ACE:SUPER-UX:*:*)
13925b16253fSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
13935b16253fSmrg	;;
13947a84e134Smrg    Power*:Rhapsody:*:*)
13955b16253fSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
13965b16253fSmrg	;;
13977a84e134Smrg    *:Rhapsody:*:*)
13985b16253fSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
13995b16253fSmrg	;;
14005b16253fSmrg    arm64:Darwin:*:*)
14015b16253fSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
14025b16253fSmrg	;;
14037a84e134Smrg    *:Darwin:*:*)
14045ec34c4cSmrg	UNAME_PROCESSOR=`uname -p`
14055ec34c4cSmrg	case $UNAME_PROCESSOR in
14065ec34c4cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14075ec34c4cSmrg	esac
14085ec34c4cSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
14095ec34c4cSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
14105ec34c4cSmrg	    # Avoid executing cc if there is no toolchain installed as
14115ec34c4cSmrg	    # cc will be a stub that puts up a graphical alert
14125ec34c4cSmrg	    # prompting the user to install developer tools.
14135ec34c4cSmrg	    CC_FOR_BUILD=no_compiler_found
14145ec34c4cSmrg	else
14155ec34c4cSmrg	    set_cc_for_build
1416c889a3bfSmrg	fi
14175b16253fSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14185ec34c4cSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
14195ec34c4cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14205ec34c4cSmrg		   grep IS_64BIT_ARCH >/dev/null
14215ec34c4cSmrg	    then
14225ec34c4cSmrg		case $UNAME_PROCESSOR in
14235ec34c4cSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14245ec34c4cSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14255ec34c4cSmrg		esac
14265ec34c4cSmrg	    fi
14275ec34c4cSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
14285ec34c4cSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
14295ec34c4cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14305ec34c4cSmrg		   grep IS_PPC >/dev/null
14315ec34c4cSmrg	    then
14325ec34c4cSmrg		UNAME_PROCESSOR=powerpc
1433c889a3bfSmrg	    fi
1434c8571806Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
14355ec34c4cSmrg	    # uname -m returns i386 or x86_64
14365ec34c4cSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1437c889a3bfSmrg	fi
14385b16253fSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
14395b16253fSmrg	;;
14407a84e134Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14417a84e134Smrg	UNAME_PROCESSOR=`uname -p`
14425ec34c4cSmrg	if test "$UNAME_PROCESSOR" = x86; then
14437a84e134Smrg		UNAME_PROCESSOR=i386
14447a84e134Smrg		UNAME_MACHINE=pc
14457a84e134Smrg	fi
14465b16253fSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
14475b16253fSmrg	;;
14487a84e134Smrg    *:QNX:*:4*)
14495b16253fSmrg	GUESS=i386-pc-qnx
14505b16253fSmrg	;;
14515ec34c4cSmrg    NEO-*:NONSTOP_KERNEL:*:*)
14525b16253fSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
14535b16253fSmrg	;;
1454c889a3bfSmrg    NSE-*:NONSTOP_KERNEL:*:*)
14555b16253fSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
14565b16253fSmrg	;;
14575ec34c4cSmrg    NSR-*:NONSTOP_KERNEL:*:*)
14585b16253fSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
14595b16253fSmrg	;;
14605ec34c4cSmrg    NSV-*:NONSTOP_KERNEL:*:*)
14615b16253fSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
14625b16253fSmrg	;;
14635ec34c4cSmrg    NSX-*:NONSTOP_KERNEL:*:*)
14645b16253fSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
14655b16253fSmrg	;;
14667a84e134Smrg    *:NonStop-UX:*:*)
14675b16253fSmrg	GUESS=mips-compaq-nonstopux
14685b16253fSmrg	;;
14697a84e134Smrg    BS2000:POSIX*:*:*)
14705b16253fSmrg	GUESS=bs2000-siemens-sysv
14715b16253fSmrg	;;
14727a84e134Smrg    DS/*:UNIX_System_V:*:*)
14735b16253fSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
14745b16253fSmrg	;;
14757a84e134Smrg    *:Plan9:*:*)
14767a84e134Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
14777a84e134Smrg	# is converted to i386 for consistency with other x86
14787a84e134Smrg	# operating systems.
14795b16253fSmrg	if test "${cputype-}" = 386; then
14807a84e134Smrg	    UNAME_MACHINE=i386
14815b16253fSmrg	elif test "x${cputype-}" != x; then
14825b16253fSmrg	    UNAME_MACHINE=$cputype
14837a84e134Smrg	fi
14845b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
14855b16253fSmrg	;;
14867a84e134Smrg    *:TOPS-10:*:*)
14875b16253fSmrg	GUESS=pdp10-unknown-tops10
14885b16253fSmrg	;;
14897a84e134Smrg    *:TENEX:*:*)
14905b16253fSmrg	GUESS=pdp10-unknown-tenex
14915b16253fSmrg	;;
14927a84e134Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14935b16253fSmrg	GUESS=pdp10-dec-tops20
14945b16253fSmrg	;;
14957a84e134Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14965b16253fSmrg	GUESS=pdp10-xkl-tops20
14975b16253fSmrg	;;
14987a84e134Smrg    *:TOPS-20:*:*)
14995b16253fSmrg	GUESS=pdp10-unknown-tops20
15005b16253fSmrg	;;
15017a84e134Smrg    *:ITS:*:*)
15025b16253fSmrg	GUESS=pdp10-unknown-its
15035b16253fSmrg	;;
15047a84e134Smrg    SEI:*:*:SEIUX)
15055b16253fSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
15065b16253fSmrg	;;
15077a84e134Smrg    *:DragonFly:*:*)
15085b16253fSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
15095b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
15105b16253fSmrg	;;
15117a84e134Smrg    *:*VMS:*:*)
1512421c997bSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
15135b16253fSmrg	case $UNAME_MACHINE in
15145b16253fSmrg	    A*) GUESS=alpha-dec-vms ;;
15155b16253fSmrg	    I*) GUESS=ia64-dec-vms ;;
15165b16253fSmrg	    V*) GUESS=vax-dec-vms ;;
15177a84e134Smrg	esac ;;
15187a84e134Smrg    *:XENIX:*:SysV)
15195b16253fSmrg	GUESS=i386-pc-xenix
15205b16253fSmrg	;;
15217a84e134Smrg    i*86:skyos:*:*)
15225b16253fSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
15235b16253fSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
15245b16253fSmrg	;;
15257a84e134Smrg    i*86:rdos:*:*)
15265b16253fSmrg	GUESS=$UNAME_MACHINE-pc-rdos
15275b16253fSmrg	;;
15285b16253fSmrg    i*86:Fiwix:*:*)
15295b16253fSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
15305b16253fSmrg	;;
15315b16253fSmrg    *:AROS:*:*)
15325b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-aros
15335b16253fSmrg	;;
1534c889a3bfSmrg    x86_64:VMkernel:*:*)
15355b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-esx
15365b16253fSmrg	;;
15375ec34c4cSmrg    amd64:Isilon\ OneFS:*:*)
15385b16253fSmrg	GUESS=x86_64-unknown-onefs
15395b16253fSmrg	;;
15405ec34c4cSmrg    *:Unleashed:*:*)
15415b16253fSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
15425b16253fSmrg	;;
15437a84e134Smrgesac
15447a84e134Smrg
15455b16253fSmrg# Do we have a guess based on uname results?
15465b16253fSmrgif test "x$GUESS" != x; then
15475b16253fSmrg    echo "$GUESS"
15485b16253fSmrg    exit
15495b16253fSmrgfi
15505b16253fSmrg
15515ec34c4cSmrg# No uname command or uname output not recognized.
15525ec34c4cSmrgset_cc_for_build
15535ec34c4cSmrgcat > "$dummy.c" <<EOF
15545ec34c4cSmrg#ifdef _SEQUENT_
15555ec34c4cSmrg#include <sys/types.h>
15565ec34c4cSmrg#include <sys/utsname.h>
15575ec34c4cSmrg#endif
15585ec34c4cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15595ec34c4cSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15605ec34c4cSmrg#include <signal.h>
15615ec34c4cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
15625ec34c4cSmrg#include <sys/utsname.h>
15635ec34c4cSmrg#endif
15645ec34c4cSmrg#endif
15655ec34c4cSmrg#endif
15665ec34c4cSmrgmain ()
15675ec34c4cSmrg{
15685ec34c4cSmrg#if defined (sony)
15695ec34c4cSmrg#if defined (MIPSEB)
15705ec34c4cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15715ec34c4cSmrg     I don't know....  */
15725ec34c4cSmrg  printf ("mips-sony-bsd\n"); exit (0);
15735ec34c4cSmrg#else
15745ec34c4cSmrg#include <sys/param.h>
15755ec34c4cSmrg  printf ("m68k-sony-newsos%s\n",
15765ec34c4cSmrg#ifdef NEWSOS4
15775ec34c4cSmrg  "4"
15785ec34c4cSmrg#else
15795ec34c4cSmrg  ""
15805ec34c4cSmrg#endif
15815ec34c4cSmrg  ); exit (0);
15825ec34c4cSmrg#endif
15835ec34c4cSmrg#endif
15845ec34c4cSmrg
15855ec34c4cSmrg#if defined (NeXT)
15865ec34c4cSmrg#if !defined (__ARCHITECTURE__)
15875ec34c4cSmrg#define __ARCHITECTURE__ "m68k"
15885ec34c4cSmrg#endif
15895ec34c4cSmrg  int version;
15905ec34c4cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15915ec34c4cSmrg  if (version < 4)
15925ec34c4cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15935ec34c4cSmrg  else
15945ec34c4cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15955ec34c4cSmrg  exit (0);
15965ec34c4cSmrg#endif
15975ec34c4cSmrg
15985ec34c4cSmrg#if defined (MULTIMAX) || defined (n16)
15995ec34c4cSmrg#if defined (UMAXV)
16005ec34c4cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
16015ec34c4cSmrg#else
16025ec34c4cSmrg#if defined (CMU)
16035ec34c4cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
16045ec34c4cSmrg#else
16055ec34c4cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
16065ec34c4cSmrg#endif
16075ec34c4cSmrg#endif
16085ec34c4cSmrg#endif
16095ec34c4cSmrg
16105ec34c4cSmrg#if defined (__386BSD__)
16115ec34c4cSmrg  printf ("i386-pc-bsd\n"); exit (0);
16125ec34c4cSmrg#endif
16135ec34c4cSmrg
16145ec34c4cSmrg#if defined (sequent)
16155ec34c4cSmrg#if defined (i386)
16165ec34c4cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
16175ec34c4cSmrg#endif
16185ec34c4cSmrg#if defined (ns32000)
16195ec34c4cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16205ec34c4cSmrg#endif
16215ec34c4cSmrg#endif
16225ec34c4cSmrg
16235ec34c4cSmrg#if defined (_SEQUENT_)
16245ec34c4cSmrg  struct utsname un;
16255ec34c4cSmrg
16265ec34c4cSmrg  uname(&un);
16275ec34c4cSmrg  if (strncmp(un.version, "V2", 2) == 0) {
16285ec34c4cSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
16295ec34c4cSmrg  }
16305ec34c4cSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16315ec34c4cSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
16325ec34c4cSmrg  }
16335ec34c4cSmrg  printf ("i386-sequent-ptx\n"); exit (0);
16345ec34c4cSmrg#endif
16355ec34c4cSmrg
16365ec34c4cSmrg#if defined (vax)
16375ec34c4cSmrg#if !defined (ultrix)
16385ec34c4cSmrg#include <sys/param.h>
16395ec34c4cSmrg#if defined (BSD)
16405ec34c4cSmrg#if BSD == 43
16415ec34c4cSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
16425ec34c4cSmrg#else
16435ec34c4cSmrg#if BSD == 199006
16445ec34c4cSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16455ec34c4cSmrg#else
16465ec34c4cSmrg  printf ("vax-dec-bsd\n"); exit (0);
16475ec34c4cSmrg#endif
16485ec34c4cSmrg#endif
16495ec34c4cSmrg#else
16505ec34c4cSmrg  printf ("vax-dec-bsd\n"); exit (0);
16515ec34c4cSmrg#endif
16525ec34c4cSmrg#else
16535ec34c4cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
16545ec34c4cSmrg  struct utsname un;
16555ec34c4cSmrg  uname (&un);
16565ec34c4cSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16575ec34c4cSmrg#else
16585ec34c4cSmrg  printf ("vax-dec-ultrix\n"); exit (0);
16595ec34c4cSmrg#endif
16605ec34c4cSmrg#endif
16615ec34c4cSmrg#endif
16625ec34c4cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16635ec34c4cSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16645ec34c4cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
16655ec34c4cSmrg  struct utsname *un;
16665ec34c4cSmrg  uname (&un);
16675ec34c4cSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16685ec34c4cSmrg#else
16695ec34c4cSmrg  printf ("mips-dec-ultrix\n"); exit (0);
16705ec34c4cSmrg#endif
16715ec34c4cSmrg#endif
16725ec34c4cSmrg#endif
16735ec34c4cSmrg
16745ec34c4cSmrg#if defined (alliant) && defined (i860)
16755ec34c4cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
16765ec34c4cSmrg#endif
16775ec34c4cSmrg
16785ec34c4cSmrg  exit (1);
16795ec34c4cSmrg}
16805ec34c4cSmrgEOF
16815ec34c4cSmrg
16825b16253fSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16835ec34c4cSmrg	{ echo "$SYSTEM_NAME"; exit; }
16845ec34c4cSmrg
16855ec34c4cSmrg# Apollos put the system type in the environment.
16865ec34c4cSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16875ec34c4cSmrg
16885ec34c4cSmrgecho "$0: unable to guess system type" >&2
16895ec34c4cSmrg
16905b16253fSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
16915ec34c4cSmrg    mips:Linux | mips64:Linux)
16925ec34c4cSmrg	# If we got here on MIPS GNU/Linux, output extra information.
16935ec34c4cSmrg	cat >&2 <<EOF
16945ec34c4cSmrg
16955ec34c4cSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
16965ec34c4cSmrgthe system type. Please install a C compiler and try again.
16975ec34c4cSmrgEOF
16985ec34c4cSmrg	;;
16995ec34c4cSmrgesac
17005ec34c4cSmrg
17017a84e134Smrgcat >&2 <<EOF
17027a84e134Smrg
17035ec34c4cSmrgThis script (version $timestamp), has failed to recognize the
17045ec34c4cSmrgoperating system you are using. If your script is old, overwrite *all*
17055ec34c4cSmrgcopies of config.guess and config.sub with the latest versions from:
17067a84e134Smrg
17075b16253fSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17087a84e134Smrgand
17095b16253fSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17105ec34c4cSmrgEOF
17115ec34c4cSmrg
17125b16253fSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
17135b16253fSmrgthisyear=`date +%Y`
17145ec34c4cSmrg# shellcheck disable=SC2003
17155b16253fSmrgscript_age=`expr "$thisyear" - "$our_year"`
17165b16253fSmrgif test "$script_age" -lt 3 ; then
17175ec34c4cSmrg   cat >&2 <<EOF
17187a84e134Smrg
17195ec34c4cSmrgIf $0 has already been updated, send the following data and any
17205ec34c4cSmrginformation you think might be pertinent to config-patches@gnu.org to
17215ec34c4cSmrgprovide the necessary information to handle your system.
17227a84e134Smrg
17237a84e134Smrgconfig.guess timestamp = $timestamp
17247a84e134Smrg
17257a84e134Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17267a84e134Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17277a84e134Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17287a84e134Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17297a84e134Smrg
17307a84e134Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17317a84e134Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17327a84e134Smrg
17337a84e134Smrghostinfo               = `(hostinfo) 2>/dev/null`
17347a84e134Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17357a84e134Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17367a84e134Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17377a84e134Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17387a84e134Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17397a84e134Smrg
17405ec34c4cSmrgUNAME_MACHINE = "$UNAME_MACHINE"
17415ec34c4cSmrgUNAME_RELEASE = "$UNAME_RELEASE"
17425ec34c4cSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
17435ec34c4cSmrgUNAME_VERSION = "$UNAME_VERSION"
17447a84e134SmrgEOF
17455ec34c4cSmrgfi
17467a84e134Smrg
17477a84e134Smrgexit 1
17487a84e134Smrg
17497a84e134Smrg# Local variables:
17505ec34c4cSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
17517a84e134Smrg# time-stamp-start: "timestamp='"
17527a84e134Smrg# time-stamp-format: "%:y-%02m-%02d"
17537a84e134Smrg# time-stamp-end: "'"
17547a84e134Smrg# End:
1755