config.guess revision 95b7a5c8
127702724Smrg#! /bin/sh
227702724Smrg# Attempt to guess a canonical system name.
395b7a5c8Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
427702724Smrg
595b7a5c8Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
695b7a5c8Smrg
795b7a5c8Smrgtimestamp='2021-06-03'
827702724Smrg
927702724Smrg# This file is free software; you can redistribute it and/or modify it
1027702724Smrg# under the terms of the GNU General Public License as published by
11313a12fdSmrg# the Free Software Foundation; either version 3 of the License, or
1227702724Smrg# (at your option) any later version.
1327702724Smrg#
1427702724Smrg# This program is distributed in the hope that it will be useful, but
1527702724Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1627702724Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1727702724Smrg# General Public License for more details.
1827702724Smrg#
1927702724Smrg# You should have received a copy of the GNU General Public License
207cea3689Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2127702724Smrg#
2227702724Smrg# As a special exception to the GNU General Public License, if you
2327702724Smrg# distribute this file as part of a program that contains a
2427702724Smrg# configuration script generated by Autoconf, you may include it under
25313a12fdSmrg# the same distribution terms that you use for the rest of that
26313a12fdSmrg# program.  This Exception is an additional permission under section 7
27313a12fdSmrg# of the GNU General Public License, version 3 ("GPLv3").
2827702724Smrg#
297cea3689Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3027702724Smrg#
3100084f2cSmrg# You can get the latest version of this script from:
3295b7a5c8Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33313a12fdSmrg#
347cea3689Smrg# Please send patches to <config-patches@gnu.org>.
35313a12fdSmrg
3627702724Smrg
3795b7a5c8Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
3895b7a5c8Smrg# about features and limitations of the classic Bourne shell that were
3995b7a5c8Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
4095b7a5c8Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
4195b7a5c8Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
4295b7a5c8Smrg# have a pre-POSIX /bin/sh.
4395b7a5c8Smrg
4495b7a5c8Smrg
4527702724Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4627702724Smrg
4727702724Smrgusage="\
4827702724SmrgUsage: $0 [OPTION]
4927702724Smrg
5027702724SmrgOutput the configuration name of the system \`$me' is run on.
5127702724Smrg
527cea3689SmrgOptions:
5327702724Smrg  -h, --help         print this help, then exit
5427702724Smrg  -t, --time-stamp   print date of last modification, then exit
5527702724Smrg  -v, --version      print version number, then exit
5627702724Smrg
5727702724SmrgReport bugs and patches to <config-patches@gnu.org>."
5827702724Smrg
5927702724Smrgversion="\
6027702724SmrgGNU config.guess ($timestamp)
6127702724Smrg
6227702724SmrgOriginally written by Per Bothner.
6395b7a5c8SmrgCopyright 1992-2021 Free Software Foundation, Inc.
6427702724Smrg
6527702724SmrgThis is free software; see the source for copying conditions.  There is NO
6627702724Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6727702724Smrg
6827702724Smrghelp="
6927702724SmrgTry \`$me --help' for more information."
7027702724Smrg
7127702724Smrg# Parse command line
7227702724Smrgwhile test $# -gt 0 ; do
7327702724Smrg  case $1 in
7427702724Smrg    --time-stamp | --time* | -t )
7527702724Smrg       echo "$timestamp" ; exit ;;
7627702724Smrg    --version | -v )
7727702724Smrg       echo "$version" ; exit ;;
7827702724Smrg    --help | --h* | -h )
7927702724Smrg       echo "$usage"; exit ;;
8027702724Smrg    -- )     # Stop option processing
8127702724Smrg       shift; break ;;
8227702724Smrg    - )	# Use stdin as input.
8327702724Smrg       break ;;
8427702724Smrg    -* )
8527702724Smrg       echo "$me: invalid option $1$help" >&2
8627702724Smrg       exit 1 ;;
8727702724Smrg    * )
8827702724Smrg       break ;;
8927702724Smrg  esac
9027702724Smrgdone
9127702724Smrg
9227702724Smrgif test $# != 0; then
9327702724Smrg  echo "$me: too many arguments$help" >&2
9427702724Smrg  exit 1
9527702724Smrgfi
9627702724Smrg
9795b7a5c8Smrg# Just in case it came from the environment.
9895b7a5c8SmrgGUESS=
9927702724Smrg
10027702724Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
10127702724Smrg# compiler to aid in system detection is discouraged as it requires
10227702724Smrg# temporary files to be created and, as you can see below, it is a
10327702724Smrg# headache to deal with in a portable fashion.
10427702724Smrg
10527702724Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10627702724Smrg# use `HOST_CC' if defined, but it is deprecated.
10727702724Smrg
10827702724Smrg# Portable tmp directory creation inspired by the Autoconf team.
10927702724Smrg
11095b7a5c8Smrgtmp=
11195b7a5c8Smrg# shellcheck disable=SC2172
11295b7a5c8Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
11395b7a5c8Smrg
11495b7a5c8Smrgset_cc_for_build() {
11595b7a5c8Smrg    # prevent multiple calls if $tmp is already set
11695b7a5c8Smrg    test "$tmp" && return 0
11795b7a5c8Smrg    : "${TMPDIR=/tmp}"
11895b7a5c8Smrg    # shellcheck disable=SC2039,SC3028
11995b7a5c8Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
12095b7a5c8Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
12195b7a5c8Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
12295b7a5c8Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
12395b7a5c8Smrg    dummy=$tmp/dummy
12495b7a5c8Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
12595b7a5c8Smrg	,,)    echo "int x;" > "$dummy.c"
12695b7a5c8Smrg	       for driver in cc gcc c89 c99 ; do
12795b7a5c8Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
12895b7a5c8Smrg		       CC_FOR_BUILD=$driver
12995b7a5c8Smrg		       break
13095b7a5c8Smrg		   fi
13195b7a5c8Smrg	       done
13295b7a5c8Smrg	       if test x"$CC_FOR_BUILD" = x ; then
13395b7a5c8Smrg		   CC_FOR_BUILD=no_compiler_found
13495b7a5c8Smrg	       fi
13595b7a5c8Smrg	       ;;
13695b7a5c8Smrg	,,*)   CC_FOR_BUILD=$CC ;;
13795b7a5c8Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13895b7a5c8Smrg    esac
13995b7a5c8Smrg}
14027702724Smrg
14127702724Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14227702724Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
14395b7a5c8Smrgif test -f /.attbin/uname ; then
14427702724Smrg	PATH=$PATH:/.attbin ; export PATH
14527702724Smrgfi
14627702724Smrg
14727702724SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14827702724SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14995b7a5c8SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15027702724SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15127702724Smrg
15295b7a5c8Smrgcase $UNAME_SYSTEM in
1537cea3689SmrgLinux|GNU|GNU/*)
15495b7a5c8Smrg	LIBC=unknown
1557cea3689Smrg
15695b7a5c8Smrg	set_cc_for_build
1577cea3689Smrg	cat <<-EOF > "$dummy.c"
1587cea3689Smrg	#include <features.h>
1597cea3689Smrg	#if defined(__UCLIBC__)
1607cea3689Smrg	LIBC=uclibc
1617cea3689Smrg	#elif defined(__dietlibc__)
1627cea3689Smrg	LIBC=dietlibc
16395b7a5c8Smrg	#elif defined(__GLIBC__)
1647cea3689Smrg	LIBC=gnu
16595b7a5c8Smrg	#else
16695b7a5c8Smrg	#include <stdarg.h>
16795b7a5c8Smrg	/* First heuristic to detect musl libc.  */
16895b7a5c8Smrg	#ifdef __DEFINED_va_list
16995b7a5c8Smrg	LIBC=musl
17095b7a5c8Smrg	#endif
1717cea3689Smrg	#endif
1727cea3689Smrg	EOF
17395b7a5c8Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
17495b7a5c8Smrg	eval "$cc_set_libc"
1757cea3689Smrg
17695b7a5c8Smrg	# Second heuristic to detect musl libc.
17795b7a5c8Smrg	if [ "$LIBC" = unknown ] &&
17895b7a5c8Smrg	   command -v ldd >/dev/null &&
17995b7a5c8Smrg	   ldd --version 2>&1 | grep -q ^musl; then
18095b7a5c8Smrg		LIBC=musl
18195b7a5c8Smrg	fi
18295b7a5c8Smrg
18395b7a5c8Smrg	# If the system lacks a compiler, then just pick glibc.
18495b7a5c8Smrg	# We could probably try harder.
18595b7a5c8Smrg	if [ "$LIBC" = unknown ]; then
18695b7a5c8Smrg		LIBC=gnu
1877cea3689Smrg	fi
1887cea3689Smrg	;;
1897cea3689Smrgesac
1907cea3689Smrg
19127702724Smrg# Note: order is significant - the case branches are not exclusive.
19227702724Smrg
19395b7a5c8Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19427702724Smrg    *:NetBSD:*:*)
19527702724Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196313a12fdSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19727702724Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19827702724Smrg	# switched to ELF, *-*-netbsd* would select the old
19927702724Smrg	# object file format.  This provides both forward
20027702724Smrg	# compatibility and a consistent mechanism for selecting the
20127702724Smrg	# object file format.
20227702724Smrg	#
20327702724Smrg	# Note: NetBSD doesn't particularly care about the vendor
20427702724Smrg	# portion of the name.  We always set it to "unknown".
2057cea3689Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
20695b7a5c8Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20795b7a5c8Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2087cea3689Smrg	    echo unknown)`
20995b7a5c8Smrg	case $UNAME_MACHINE_ARCH in
21095b7a5c8Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
21127702724Smrg	    armeb) machine=armeb-unknown ;;
21227702724Smrg	    arm*) machine=arm-unknown ;;
21327702724Smrg	    sh3el) machine=shl-unknown ;;
21427702724Smrg	    sh3eb) machine=sh-unknown ;;
215e19dfac4Smrg	    sh5el) machine=sh5le-unknown ;;
2167cea3689Smrg	    earmv*)
2177cea3689Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2187cea3689Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
21995b7a5c8Smrg		machine=${arch}${endian}-unknown
2207cea3689Smrg		;;
22195b7a5c8Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22227702724Smrg	esac
22327702724Smrg	# The Operating System including object format, if it has switched
2247cea3689Smrg	# to ELF recently (or will in the future) and ABI.
22595b7a5c8Smrg	case $UNAME_MACHINE_ARCH in
2267cea3689Smrg	    earm*)
2277cea3689Smrg		os=netbsdelf
2287cea3689Smrg		;;
22927702724Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
23095b7a5c8Smrg		set_cc_for_build
23127702724Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
23200084f2cSmrg			| grep -q __ELF__
23327702724Smrg		then
23427702724Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23527702724Smrg		    # Return netbsd for either.  FIX?
23627702724Smrg		    os=netbsd
23727702724Smrg		else
23827702724Smrg		    os=netbsdelf
23927702724Smrg		fi
24027702724Smrg		;;
24127702724Smrg	    *)
242313a12fdSmrg		os=netbsd
24327702724Smrg		;;
24427702724Smrg	esac
2457cea3689Smrg	# Determine ABI tags.
24695b7a5c8Smrg	case $UNAME_MACHINE_ARCH in
2477cea3689Smrg	    earm*)
2487cea3689Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2497cea3689Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2507cea3689Smrg		;;
2517cea3689Smrg	esac
25227702724Smrg	# The OS release
25327702724Smrg	# Debian GNU/NetBSD machines have a different userland, and
25427702724Smrg	# thus, need a distinct triplet. However, they do not need
25527702724Smrg	# kernel version information, so it can be replaced with a
25627702724Smrg	# suitable tag, in the style of linux-gnu.
25795b7a5c8Smrg	case $UNAME_VERSION in
25827702724Smrg	    Debian*)
25927702724Smrg		release='-gnu'
26027702724Smrg		;;
26127702724Smrg	    *)
2627cea3689Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
26327702724Smrg		;;
26427702724Smrg	esac
26527702724Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26627702724Smrg	# contains redundant information, the shorter form:
26727702724Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
26895b7a5c8Smrg	GUESS=$machine-${os}${release}${abi-}
26995b7a5c8Smrg	;;
270313a12fdSmrg    *:Bitrig:*:*)
271313a12fdSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
27295b7a5c8Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
27395b7a5c8Smrg	;;
27427702724Smrg    *:OpenBSD:*:*)
27527702724Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
27695b7a5c8Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
27795b7a5c8Smrg	;;
27895b7a5c8Smrg    *:SecBSD:*:*)
27995b7a5c8Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
28095b7a5c8Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
28195b7a5c8Smrg	;;
2827cea3689Smrg    *:LibertyBSD:*:*)
2837cea3689Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
28495b7a5c8Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
28595b7a5c8Smrg	;;
2867cea3689Smrg    *:MidnightBSD:*:*)
28795b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
28895b7a5c8Smrg	;;
28927702724Smrg    *:ekkoBSD:*:*)
29095b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
29195b7a5c8Smrg	;;
29227702724Smrg    *:SolidBSD:*:*)
29395b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
29495b7a5c8Smrg	;;
29595b7a5c8Smrg    *:OS108:*:*)
29695b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
29795b7a5c8Smrg	;;
29827702724Smrg    macppc:MirBSD:*:*)
29995b7a5c8Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
30095b7a5c8Smrg	;;
30127702724Smrg    *:MirBSD:*:*)
30295b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
30395b7a5c8Smrg	;;
3047cea3689Smrg    *:Sortix:*:*)
30595b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
30695b7a5c8Smrg	;;
30795b7a5c8Smrg    *:Twizzler:*:*)
30895b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
30995b7a5c8Smrg	;;
3107cea3689Smrg    *:Redox:*:*)
31195b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-redox
31295b7a5c8Smrg	;;
3137cea3689Smrg    mips:OSF1:*.*)
31495b7a5c8Smrg	GUESS=mips-dec-osf1
31595b7a5c8Smrg	;;
31627702724Smrg    alpha:OSF1:*:*)
31795b7a5c8Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
31895b7a5c8Smrg	trap '' 0
31927702724Smrg	case $UNAME_RELEASE in
32027702724Smrg	*4.0)
32127702724Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32227702724Smrg		;;
32327702724Smrg	*5.*)
324313a12fdSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
32527702724Smrg		;;
32627702724Smrg	esac
32727702724Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
32827702724Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
32927702724Smrg	# covers most systems running today.  This code pipes the CPU
33027702724Smrg	# types through head -n 1, so we only detect the type of CPU 0.
33127702724Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
33295b7a5c8Smrg	case $ALPHA_CPU_TYPE in
33327702724Smrg	    "EV4 (21064)")
3347cea3689Smrg		UNAME_MACHINE=alpha ;;
33527702724Smrg	    "EV4.5 (21064)")
3367cea3689Smrg		UNAME_MACHINE=alpha ;;
33727702724Smrg	    "LCA4 (21066/21068)")
3387cea3689Smrg		UNAME_MACHINE=alpha ;;
33927702724Smrg	    "EV5 (21164)")
3407cea3689Smrg		UNAME_MACHINE=alphaev5 ;;
34127702724Smrg	    "EV5.6 (21164A)")
3427cea3689Smrg		UNAME_MACHINE=alphaev56 ;;
34327702724Smrg	    "EV5.6 (21164PC)")
3447cea3689Smrg		UNAME_MACHINE=alphapca56 ;;
34527702724Smrg	    "EV5.7 (21164PC)")
3467cea3689Smrg		UNAME_MACHINE=alphapca57 ;;
34727702724Smrg	    "EV6 (21264)")
3487cea3689Smrg		UNAME_MACHINE=alphaev6 ;;
34927702724Smrg	    "EV6.7 (21264A)")
3507cea3689Smrg		UNAME_MACHINE=alphaev67 ;;
35127702724Smrg	    "EV6.8CB (21264C)")
3527cea3689Smrg		UNAME_MACHINE=alphaev68 ;;
35327702724Smrg	    "EV6.8AL (21264B)")
3547cea3689Smrg		UNAME_MACHINE=alphaev68 ;;
35527702724Smrg	    "EV6.8CX (21264D)")
3567cea3689Smrg		UNAME_MACHINE=alphaev68 ;;
35727702724Smrg	    "EV6.9A (21264/EV69A)")
3587cea3689Smrg		UNAME_MACHINE=alphaev69 ;;
35927702724Smrg	    "EV7 (21364)")
3607cea3689Smrg		UNAME_MACHINE=alphaev7 ;;
36127702724Smrg	    "EV7.9 (21364A)")
3627cea3689Smrg		UNAME_MACHINE=alphaev79 ;;
36327702724Smrg	esac
36427702724Smrg	# A Pn.n version is a patched version.
36527702724Smrg	# A Vn.n version is a released version.
36627702724Smrg	# A Tn.n version is a released field test version.
36727702724Smrg	# A Xn.n version is an unreleased experimental baselevel.
36827702724Smrg	# 1.2 uses "1.2" for uname -r.
36995b7a5c8Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
37095b7a5c8Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
37195b7a5c8Smrg	;;
37227702724Smrg    Amiga*:UNIX_System_V:4.0:*)
37395b7a5c8Smrg	GUESS=m68k-unknown-sysv4
37495b7a5c8Smrg	;;
37527702724Smrg    *:[Aa]miga[Oo][Ss]:*:*)
37695b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
37795b7a5c8Smrg	;;
37827702724Smrg    *:[Mm]orph[Oo][Ss]:*:*)
37995b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
38095b7a5c8Smrg	;;
38127702724Smrg    *:OS/390:*:*)
38295b7a5c8Smrg	GUESS=i370-ibm-openedition
38395b7a5c8Smrg	;;
38427702724Smrg    *:z/VM:*:*)
38595b7a5c8Smrg	GUESS=s390-ibm-zvmoe
38695b7a5c8Smrg	;;
38727702724Smrg    *:OS400:*:*)
38895b7a5c8Smrg	GUESS=powerpc-ibm-os400
38995b7a5c8Smrg	;;
39027702724Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
39195b7a5c8Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
39295b7a5c8Smrg	;;
393313a12fdSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
39495b7a5c8Smrg	GUESS=arm-unknown-riscos
39595b7a5c8Smrg	;;
39627702724Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
39795b7a5c8Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
39895b7a5c8Smrg	;;
39927702724Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40027702724Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
40195b7a5c8Smrg	case `(/bin/universe) 2>/dev/null` in
40295b7a5c8Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
40395b7a5c8Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
40495b7a5c8Smrg	esac
40595b7a5c8Smrg	;;
40627702724Smrg    NILE*:*:*:dcosx)
40795b7a5c8Smrg	GUESS=pyramid-pyramid-svr4
40895b7a5c8Smrg	;;
40927702724Smrg    DRS?6000:unix:4.0:6*)
41095b7a5c8Smrg	GUESS=sparc-icl-nx6
41195b7a5c8Smrg	;;
41227702724Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
41327702724Smrg	case `/usr/bin/uname -p` in
41495b7a5c8Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
41595b7a5c8Smrg	esac
41695b7a5c8Smrg	;;
41700084f2cSmrg    s390x:SunOS:*:*)
41895b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
41995b7a5c8Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
42095b7a5c8Smrg	;;
42127702724Smrg    sun4H:SunOS:5.*:*)
42295b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42395b7a5c8Smrg	GUESS=sparc-hal-solaris2$SUN_REL
42495b7a5c8Smrg	;;
42527702724Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
42695b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42795b7a5c8Smrg	GUESS=sparc-sun-solaris2$SUN_REL
42895b7a5c8Smrg	;;
42900084f2cSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
43095b7a5c8Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
43195b7a5c8Smrg	;;
432e19dfac4Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
43395b7a5c8Smrg	set_cc_for_build
4347cea3689Smrg	SUN_ARCH=i386
43500084f2cSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
43600084f2cSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
43700084f2cSmrg	# This test works for both compilers.
43895b7a5c8Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
43900084f2cSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4407cea3689Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
44100084f2cSmrg		grep IS_64BIT_ARCH >/dev/null
44200084f2cSmrg	    then
4437cea3689Smrg		SUN_ARCH=x86_64
44400084f2cSmrg	    fi
44500084f2cSmrg	fi
44695b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
44795b7a5c8Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
44895b7a5c8Smrg	;;
44927702724Smrg    sun4*:SunOS:6*:*)
45027702724Smrg	# According to config.sub, this is the proper way to canonicalize
45127702724Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45227702724Smrg	# it's likely to be more like Solaris than SunOS4.
45395b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
45495b7a5c8Smrg	GUESS=sparc-sun-solaris3$SUN_REL
45595b7a5c8Smrg	;;
45627702724Smrg    sun4*:SunOS:*:*)
45795b7a5c8Smrg	case `/usr/bin/arch -k` in
45827702724Smrg	    Series*|S4*)
45927702724Smrg		UNAME_RELEASE=`uname -v`
46027702724Smrg		;;
46127702724Smrg	esac
46227702724Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
46395b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
46495b7a5c8Smrg	GUESS=sparc-sun-sunos$SUN_REL
46595b7a5c8Smrg	;;
46627702724Smrg    sun3*:SunOS:*:*)
46795b7a5c8Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
46895b7a5c8Smrg	;;
46927702724Smrg    sun*:*:4.2BSD:*)
47027702724Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4717cea3689Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
47295b7a5c8Smrg	case `/bin/arch` in
47327702724Smrg	    sun3)
47495b7a5c8Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
47527702724Smrg		;;
47627702724Smrg	    sun4)
47795b7a5c8Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
47827702724Smrg		;;
47927702724Smrg	esac
48095b7a5c8Smrg	;;
48127702724Smrg    aushp:SunOS:*:*)
48295b7a5c8Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
48395b7a5c8Smrg	;;
48427702724Smrg    # The situation for MiNT is a little confusing.  The machine name
48527702724Smrg    # can be virtually everything (everything which is not
48627702724Smrg    # "atarist" or "atariste" at least should have a processor
48727702724Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48827702724Smrg    # to the lowercase version "mint" (or "freemint").  Finally
48927702724Smrg    # the system name "TOS" denotes a system which is actually not
49027702724Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
49127702724Smrg    # be no problem.
49227702724Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
49395b7a5c8Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49495b7a5c8Smrg	;;
49527702724Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
49695b7a5c8Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49795b7a5c8Smrg	;;
49827702724Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
49995b7a5c8Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
50095b7a5c8Smrg	;;
50127702724Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
50295b7a5c8Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
50395b7a5c8Smrg	;;
50427702724Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
50595b7a5c8Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
50695b7a5c8Smrg	;;
50727702724Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
50895b7a5c8Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
50995b7a5c8Smrg	;;
51027702724Smrg    m68k:machten:*:*)
51195b7a5c8Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
51295b7a5c8Smrg	;;
51327702724Smrg    powerpc:machten:*:*)
51495b7a5c8Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
51595b7a5c8Smrg	;;
51627702724Smrg    RISC*:Mach:*:*)
51795b7a5c8Smrg	GUESS=mips-dec-mach_bsd4.3
51895b7a5c8Smrg	;;
51927702724Smrg    RISC*:ULTRIX:*:*)
52095b7a5c8Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
52195b7a5c8Smrg	;;
52227702724Smrg    VAX*:ULTRIX*:*:*)
52395b7a5c8Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
52495b7a5c8Smrg	;;
52527702724Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
52695b7a5c8Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
52795b7a5c8Smrg	;;
52827702724Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
52995b7a5c8Smrg	set_cc_for_build
5307cea3689Smrg	sed 's/^	//' << EOF > "$dummy.c"
53127702724Smrg#ifdef __cplusplus
53227702724Smrg#include <stdio.h>  /* for printf() prototype */
53327702724Smrg	int main (int argc, char *argv[]) {
53427702724Smrg#else
53527702724Smrg	int main (argc, argv) int argc; char *argv[]; {
53627702724Smrg#endif
53727702724Smrg	#if defined (host_mips) && defined (MIPSEB)
53827702724Smrg	#if defined (SYSTYPE_SYSV)
5397cea3689Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54027702724Smrg	#endif
54127702724Smrg	#if defined (SYSTYPE_SVR4)
5427cea3689Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54327702724Smrg	#endif
54427702724Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5457cea3689Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54627702724Smrg	#endif
54727702724Smrg	#endif
54827702724Smrg	  exit (-1);
54927702724Smrg	}
55027702724SmrgEOF
5517cea3689Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5527cea3689Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5537cea3689Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55427702724Smrg	    { echo "$SYSTEM_NAME"; exit; }
55595b7a5c8Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
55695b7a5c8Smrg	;;
55727702724Smrg    Motorola:PowerMAX_OS:*:*)
55895b7a5c8Smrg	GUESS=powerpc-motorola-powermax
55995b7a5c8Smrg	;;
56027702724Smrg    Motorola:*:4.3:PL8-*)
56195b7a5c8Smrg	GUESS=powerpc-harris-powermax
56295b7a5c8Smrg	;;
56327702724Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
56495b7a5c8Smrg	GUESS=powerpc-harris-powermax
56595b7a5c8Smrg	;;
56627702724Smrg    Night_Hawk:Power_UNIX:*:*)
56795b7a5c8Smrg	GUESS=powerpc-harris-powerunix
56895b7a5c8Smrg	;;
56927702724Smrg    m88k:CX/UX:7*:*)
57095b7a5c8Smrg	GUESS=m88k-harris-cxux7
57195b7a5c8Smrg	;;
57227702724Smrg    m88k:*:4*:R4*)
57395b7a5c8Smrg	GUESS=m88k-motorola-sysv4
57495b7a5c8Smrg	;;
57527702724Smrg    m88k:*:3*:R3*)
57695b7a5c8Smrg	GUESS=m88k-motorola-sysv3
57795b7a5c8Smrg	;;
57827702724Smrg    AViiON:dgux:*:*)
579313a12fdSmrg	# DG/UX returns AViiON for all architectures
580313a12fdSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
58195b7a5c8Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58227702724Smrg	then
58395b7a5c8Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
58495b7a5c8Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
58527702724Smrg	    then
58695b7a5c8Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
58727702724Smrg	    else
58895b7a5c8Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58927702724Smrg	    fi
59027702724Smrg	else
59195b7a5c8Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
59227702724Smrg	fi
59395b7a5c8Smrg	;;
59427702724Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
59595b7a5c8Smrg	GUESS=m88k-dolphin-sysv3
59695b7a5c8Smrg	;;
59727702724Smrg    M88*:*:R3*:*)
59827702724Smrg	# Delta 88k system running SVR3
59995b7a5c8Smrg	GUESS=m88k-motorola-sysv3
60095b7a5c8Smrg	;;
60127702724Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
60295b7a5c8Smrg	GUESS=m88k-tektronix-sysv3
60395b7a5c8Smrg	;;
60427702724Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
60595b7a5c8Smrg	GUESS=m68k-tektronix-bsd
60695b7a5c8Smrg	;;
60727702724Smrg    *:IRIX*:*:*)
60895b7a5c8Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
60995b7a5c8Smrg	GUESS=mips-sgi-irix$IRIX_REL
61095b7a5c8Smrg	;;
61127702724Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
61295b7a5c8Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
61395b7a5c8Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61427702724Smrg    i*86:AIX:*:*)
61595b7a5c8Smrg	GUESS=i386-ibm-aix
61695b7a5c8Smrg	;;
61727702724Smrg    ia64:AIX:*:*)
61895b7a5c8Smrg	if test -x /usr/bin/oslevel ; then
61927702724Smrg		IBM_REV=`/usr/bin/oslevel`
62027702724Smrg	else
62195b7a5c8Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62227702724Smrg	fi
62395b7a5c8Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
62495b7a5c8Smrg	;;
62527702724Smrg    *:AIX:2:3)
62627702724Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
62795b7a5c8Smrg		set_cc_for_build
6287cea3689Smrg		sed 's/^		//' << EOF > "$dummy.c"
62927702724Smrg		#include <sys/systemcfg.h>
63027702724Smrg
63127702724Smrg		main()
63227702724Smrg			{
63327702724Smrg			if (!__power_pc())
63427702724Smrg				exit(1);
63527702724Smrg			puts("powerpc-ibm-aix3.2.5");
63627702724Smrg			exit(0);
63727702724Smrg			}
63827702724SmrgEOF
6397cea3689Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64027702724Smrg		then
64195b7a5c8Smrg			GUESS=$SYSTEM_NAME
64227702724Smrg		else
64395b7a5c8Smrg			GUESS=rs6000-ibm-aix3.2.5
64427702724Smrg		fi
64527702724Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
64695b7a5c8Smrg		GUESS=rs6000-ibm-aix3.2.4
64727702724Smrg	else
64895b7a5c8Smrg		GUESS=rs6000-ibm-aix3.2
64927702724Smrg	fi
65095b7a5c8Smrg	;;
651313a12fdSmrg    *:AIX:*:[4567])
65227702724Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6537cea3689Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65427702724Smrg		IBM_ARCH=rs6000
65527702724Smrg	else
65627702724Smrg		IBM_ARCH=powerpc
65727702724Smrg	fi
65895b7a5c8Smrg	if test -x /usr/bin/lslpp ; then
65995b7a5c8Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6607cea3689Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66127702724Smrg	else
66295b7a5c8Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66327702724Smrg	fi
66495b7a5c8Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
66595b7a5c8Smrg	;;
66627702724Smrg    *:AIX:*:*)
66795b7a5c8Smrg	GUESS=rs6000-ibm-aix
66895b7a5c8Smrg	;;
6697cea3689Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
67095b7a5c8Smrg	GUESS=romp-ibm-bsd4.4
67195b7a5c8Smrg	;;
67227702724Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
67395b7a5c8Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
67495b7a5c8Smrg	;;                                  # report: romp-ibm BSD 4.3
67527702724Smrg    *:BOSX:*:*)
67695b7a5c8Smrg	GUESS=rs6000-bull-bosx
67795b7a5c8Smrg	;;
67827702724Smrg    DPX/2?00:B.O.S.:*:*)
67995b7a5c8Smrg	GUESS=m68k-bull-sysv3
68095b7a5c8Smrg	;;
68127702724Smrg    9000/[34]??:4.3bsd:1.*:*)
68295b7a5c8Smrg	GUESS=m68k-hp-bsd
68395b7a5c8Smrg	;;
68427702724Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
68595b7a5c8Smrg	GUESS=m68k-hp-bsd4.4
68695b7a5c8Smrg	;;
68727702724Smrg    9000/[34678]??:HP-UX:*:*)
68895b7a5c8Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
68995b7a5c8Smrg	case $UNAME_MACHINE in
6907cea3689Smrg	    9000/31?)            HP_ARCH=m68000 ;;
6917cea3689Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
69227702724Smrg	    9000/[678][0-9][0-9])
69395b7a5c8Smrg		if test -x /usr/bin/getconf; then
69427702724Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695313a12fdSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
69695b7a5c8Smrg		    case $sc_cpu_version in
6977cea3689Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6987cea3689Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699313a12fdSmrg		      532)                      # CPU_PA_RISC2_0
70095b7a5c8Smrg			case $sc_kernel_bits in
7017cea3689Smrg			  32) HP_ARCH=hppa2.0n ;;
7027cea3689Smrg			  64) HP_ARCH=hppa2.0w ;;
7037cea3689Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704313a12fdSmrg			esac ;;
705313a12fdSmrg		    esac
70627702724Smrg		fi
70795b7a5c8Smrg		if test "$HP_ARCH" = ""; then
70895b7a5c8Smrg		    set_cc_for_build
7097cea3689Smrg		    sed 's/^		//' << EOF > "$dummy.c"
71027702724Smrg
711313a12fdSmrg		#define _HPUX_SOURCE
712313a12fdSmrg		#include <stdlib.h>
713313a12fdSmrg		#include <unistd.h>
71427702724Smrg
715313a12fdSmrg		int main ()
716313a12fdSmrg		{
717313a12fdSmrg		#if defined(_SC_KERNEL_BITS)
718313a12fdSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
719313a12fdSmrg		#endif
720313a12fdSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
72127702724Smrg
722313a12fdSmrg		    switch (cpu)
723313a12fdSmrg			{
724313a12fdSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725313a12fdSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726313a12fdSmrg			case CPU_PA_RISC2_0:
727313a12fdSmrg		#if defined(_SC_KERNEL_BITS)
728313a12fdSmrg			    switch (bits)
729313a12fdSmrg				{
730313a12fdSmrg				case 64: puts ("hppa2.0w"); break;
731313a12fdSmrg				case 32: puts ("hppa2.0n"); break;
732313a12fdSmrg				default: puts ("hppa2.0"); break;
733313a12fdSmrg				} break;
734313a12fdSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
735313a12fdSmrg			    puts ("hppa2.0"); break;
736313a12fdSmrg		#endif
737313a12fdSmrg			default: puts ("hppa1.0"); break;
738313a12fdSmrg			}
739313a12fdSmrg		    exit (0);
740313a12fdSmrg		}
74127702724SmrgEOF
7427cea3689Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
74327702724Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
74427702724Smrg		fi ;;
74527702724Smrg	esac
74695b7a5c8Smrg	if test "$HP_ARCH" = hppa2.0w
74727702724Smrg	then
74895b7a5c8Smrg	    set_cc_for_build
74927702724Smrg
75027702724Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75127702724Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75227702724Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
75327702724Smrg	    #
75427702724Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
75527702724Smrg	    # => hppa2.0w-hp-hpux11.23
75627702724Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75727702724Smrg	    # => hppa64-hp-hpux11.23
75827702724Smrg
7597cea3689Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
76000084f2cSmrg		grep -q __LP64__
76127702724Smrg	    then
7627cea3689Smrg		HP_ARCH=hppa2.0w
76327702724Smrg	    else
7647cea3689Smrg		HP_ARCH=hppa64
76527702724Smrg	    fi
76627702724Smrg	fi
76795b7a5c8Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
76895b7a5c8Smrg	;;
76927702724Smrg    ia64:HP-UX:*:*)
77095b7a5c8Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
77195b7a5c8Smrg	GUESS=ia64-hp-hpux$HPUX_REV
77295b7a5c8Smrg	;;
77327702724Smrg    3050*:HI-UX:*:*)
77495b7a5c8Smrg	set_cc_for_build
7757cea3689Smrg	sed 's/^	//' << EOF > "$dummy.c"
77627702724Smrg	#include <unistd.h>
77727702724Smrg	int
77827702724Smrg	main ()
77927702724Smrg	{
78027702724Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
78127702724Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78227702724Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78327702724Smrg	     results, however.  */
78427702724Smrg	  if (CPU_IS_PA_RISC (cpu))
78527702724Smrg	    {
78627702724Smrg	      switch (cpu)
78727702724Smrg		{
78827702724Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78927702724Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79027702724Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79127702724Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79227702724Smrg		}
79327702724Smrg	    }
79427702724Smrg	  else if (CPU_IS_HP_MC68K (cpu))
79527702724Smrg	    puts ("m68k-hitachi-hiuxwe2");
79627702724Smrg	  else puts ("unknown-hitachi-hiuxwe2");
79727702724Smrg	  exit (0);
79827702724Smrg	}
79927702724SmrgEOF
8007cea3689Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80127702724Smrg		{ echo "$SYSTEM_NAME"; exit; }
80295b7a5c8Smrg	GUESS=unknown-hitachi-hiuxwe2
80395b7a5c8Smrg	;;
8047cea3689Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
80595b7a5c8Smrg	GUESS=hppa1.1-hp-bsd
80695b7a5c8Smrg	;;
80727702724Smrg    9000/8??:4.3bsd:*:*)
80895b7a5c8Smrg	GUESS=hppa1.0-hp-bsd
80995b7a5c8Smrg	;;
81027702724Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
81195b7a5c8Smrg	GUESS=hppa1.0-hp-mpeix
81295b7a5c8Smrg	;;
8137cea3689Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
81495b7a5c8Smrg	GUESS=hppa1.1-hp-osf
81595b7a5c8Smrg	;;
81627702724Smrg    hp8??:OSF1:*:*)
81795b7a5c8Smrg	GUESS=hppa1.0-hp-osf
81895b7a5c8Smrg	;;
81927702724Smrg    i*86:OSF1:*:*)
82095b7a5c8Smrg	if test -x /usr/sbin/sysversion ; then
82195b7a5c8Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82227702724Smrg	else
82395b7a5c8Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
82427702724Smrg	fi
82595b7a5c8Smrg	;;
82627702724Smrg    parisc*:Lites*:*:*)
82795b7a5c8Smrg	GUESS=hppa1.1-hp-lites
82895b7a5c8Smrg	;;
82927702724Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
83095b7a5c8Smrg	GUESS=c1-convex-bsd
83195b7a5c8Smrg	;;
83227702724Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83327702724Smrg	if getsysinfo -f scalar_acc
83427702724Smrg	then echo c32-convex-bsd
83527702724Smrg	else echo c2-convex-bsd
83627702724Smrg	fi
837313a12fdSmrg	exit ;;
83827702724Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
83995b7a5c8Smrg	GUESS=c34-convex-bsd
84095b7a5c8Smrg	;;
84127702724Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
84295b7a5c8Smrg	GUESS=c38-convex-bsd
84395b7a5c8Smrg	;;
84427702724Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
84595b7a5c8Smrg	GUESS=c4-convex-bsd
84695b7a5c8Smrg	;;
84727702724Smrg    CRAY*Y-MP:*:*:*)
84895b7a5c8Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
84995b7a5c8Smrg	GUESS=ymp-cray-unicos$CRAY_REL
85095b7a5c8Smrg	;;
85127702724Smrg    CRAY*[A-Z]90:*:*:*)
8527cea3689Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85327702724Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85427702724Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85527702724Smrg	      -e 's/\.[^.]*$/.X/'
85627702724Smrg	exit ;;
85727702724Smrg    CRAY*TS:*:*:*)
85895b7a5c8Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
85995b7a5c8Smrg	GUESS=t90-cray-unicos$CRAY_REL
86095b7a5c8Smrg	;;
86127702724Smrg    CRAY*T3E:*:*:*)
86295b7a5c8Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86395b7a5c8Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
86495b7a5c8Smrg	;;
86527702724Smrg    CRAY*SV1:*:*:*)
86695b7a5c8Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86795b7a5c8Smrg	GUESS=sv1-cray-unicos$CRAY_REL
86895b7a5c8Smrg	;;
86927702724Smrg    *:UNICOS/mp:*:*)
87095b7a5c8Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
87195b7a5c8Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
87295b7a5c8Smrg	;;
87327702724Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8747cea3689Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8757cea3689Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8767cea3689Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
87795b7a5c8Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
87895b7a5c8Smrg	;;
87927702724Smrg    5000:UNIX_System_V:4.*:*)
8807cea3689Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8817cea3689Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
88295b7a5c8Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
88395b7a5c8Smrg	;;
88427702724Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
88595b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
88695b7a5c8Smrg	;;
88727702724Smrg    sparc*:BSD/OS:*:*)
88895b7a5c8Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
88995b7a5c8Smrg	;;
89027702724Smrg    *:BSD/OS:*:*)
89195b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
89295b7a5c8Smrg	;;
89395b7a5c8Smrg    arm:FreeBSD:*:*)
89495b7a5c8Smrg	UNAME_PROCESSOR=`uname -p`
89595b7a5c8Smrg	set_cc_for_build
89695b7a5c8Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
89795b7a5c8Smrg	    | grep -q __ARM_PCS_VFP
89895b7a5c8Smrg	then
89995b7a5c8Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90095b7a5c8Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
90195b7a5c8Smrg	else
90295b7a5c8Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90395b7a5c8Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
90495b7a5c8Smrg	fi
90595b7a5c8Smrg	;;
90627702724Smrg    *:FreeBSD:*:*)
907313a12fdSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
90895b7a5c8Smrg	case $UNAME_PROCESSOR in
909e19dfac4Smrg	    amd64)
9107cea3689Smrg		UNAME_PROCESSOR=x86_64 ;;
9117cea3689Smrg	    i386)
9127cea3689Smrg		UNAME_PROCESSOR=i586 ;;
91327702724Smrg	esac
91495b7a5c8Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
91595b7a5c8Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
91695b7a5c8Smrg	;;
91727702724Smrg    i*:CYGWIN*:*)
91895b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
91995b7a5c8Smrg	;;
920313a12fdSmrg    *:MINGW64*:*)
92195b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
92295b7a5c8Smrg	;;
923e19dfac4Smrg    *:MINGW*:*)
92495b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
92595b7a5c8Smrg	;;
9267cea3689Smrg    *:MSYS*:*)
92795b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-msys
92895b7a5c8Smrg	;;
92927702724Smrg    i*:PW*:*)
93095b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-pw32
93195b7a5c8Smrg	;;
93200084f2cSmrg    *:Interix*:*)
93395b7a5c8Smrg	case $UNAME_MACHINE in
934e19dfac4Smrg	    x86)
93595b7a5c8Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
93695b7a5c8Smrg		;;
93700084f2cSmrg	    authenticamd | genuineintel | EM64T)
93895b7a5c8Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
93995b7a5c8Smrg		;;
940e19dfac4Smrg	    IA64)
94195b7a5c8Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
94295b7a5c8Smrg		;;
943e19dfac4Smrg	esac ;;
94427702724Smrg    i*:UWIN*:*)
94595b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-uwin
94695b7a5c8Smrg	;;
94727702724Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
94895b7a5c8Smrg	GUESS=x86_64-pc-cygwin
94995b7a5c8Smrg	;;
95027702724Smrg    prep*:SunOS:5.*:*)
95195b7a5c8Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
95295b7a5c8Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
95395b7a5c8Smrg	;;
95427702724Smrg    *:GNU:*:*)
95527702724Smrg	# the GNU system
95695b7a5c8Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
95795b7a5c8Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
95895b7a5c8Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
95995b7a5c8Smrg	;;
96027702724Smrg    *:GNU/*:*:*)
96127702724Smrg	# other systems with GNU libc and userland
96295b7a5c8Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
96395b7a5c8Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
96495b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
96595b7a5c8Smrg	;;
96695b7a5c8Smrg    *:Minix:*:*)
96795b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-minix
96895b7a5c8Smrg	;;
969313a12fdSmrg    aarch64:Linux:*:*)
97095b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97195b7a5c8Smrg	;;
972313a12fdSmrg    aarch64_be:Linux:*:*)
973313a12fdSmrg	UNAME_MACHINE=aarch64_be
97495b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97595b7a5c8Smrg	;;
97600084f2cSmrg    alpha:Linux:*:*)
97795b7a5c8Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
97800084f2cSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
97900084f2cSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
98000084f2cSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
98100084f2cSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
98200084f2cSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
98300084f2cSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
98400084f2cSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
985313a12fdSmrg	esac
98600084f2cSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9877cea3689Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
98895b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
98995b7a5c8Smrg	;;
99095b7a5c8Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
99195b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99295b7a5c8Smrg	;;
99327702724Smrg    arm*:Linux:*:*)
99495b7a5c8Smrg	set_cc_for_build
995e19dfac4Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996e19dfac4Smrg	    | grep -q __ARM_EABI__
997e19dfac4Smrg	then
99895b7a5c8Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999e19dfac4Smrg	else
1000313a12fdSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001313a12fdSmrg		| grep -q __ARM_PCS_VFP
1002313a12fdSmrg	    then
100395b7a5c8Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004313a12fdSmrg	    else
100595b7a5c8Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006313a12fdSmrg	    fi
1007e19dfac4Smrg	fi
100895b7a5c8Smrg	;;
1009e19dfac4Smrg    avr32*:Linux:*:*)
101095b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
101195b7a5c8Smrg	;;
101227702724Smrg    cris:Linux:*:*)
101395b7a5c8Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101495b7a5c8Smrg	;;
101527702724Smrg    crisv32:Linux:*:*)
101695b7a5c8Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101795b7a5c8Smrg	;;
10187cea3689Smrg    e2k:Linux:*:*)
101995b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102095b7a5c8Smrg	;;
102127702724Smrg    frv:Linux:*:*)
102295b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102395b7a5c8Smrg	;;
1024313a12fdSmrg    hexagon:Linux:*:*)
102595b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102695b7a5c8Smrg	;;
102700084f2cSmrg    i*86:Linux:*:*)
102895b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
102995b7a5c8Smrg	;;
103027702724Smrg    ia64:Linux:*:*)
103195b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103295b7a5c8Smrg	;;
10337cea3689Smrg    k1om:Linux:*:*)
103495b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103595b7a5c8Smrg	;;
103695b7a5c8Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
103795b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103895b7a5c8Smrg	;;
103927702724Smrg    m32r*:Linux:*:*)
104095b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104195b7a5c8Smrg	;;
104227702724Smrg    m68*:Linux:*:*)
104395b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104495b7a5c8Smrg	;;
104500084f2cSmrg    mips:Linux:*:* | mips64:Linux:*:*)
104695b7a5c8Smrg	set_cc_for_build
104795b7a5c8Smrg	IS_GLIBC=0
104895b7a5c8Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10497cea3689Smrg	sed 's/^	//' << EOF > "$dummy.c"
105027702724Smrg	#undef CPU
105195b7a5c8Smrg	#undef mips
105295b7a5c8Smrg	#undef mipsel
105395b7a5c8Smrg	#undef mips64
105495b7a5c8Smrg	#undef mips64el
105595b7a5c8Smrg	#if ${IS_GLIBC} && defined(_ABI64)
105695b7a5c8Smrg	LIBCABI=gnuabi64
105795b7a5c8Smrg	#else
105895b7a5c8Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
105995b7a5c8Smrg	LIBCABI=gnuabin32
106095b7a5c8Smrg	#else
106195b7a5c8Smrg	LIBCABI=${LIBC}
106295b7a5c8Smrg	#endif
106395b7a5c8Smrg	#endif
106495b7a5c8Smrg
106595b7a5c8Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106695b7a5c8Smrg	CPU=mipsisa64r6
106795b7a5c8Smrg	#else
106895b7a5c8Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106995b7a5c8Smrg	CPU=mipsisa32r6
107095b7a5c8Smrg	#else
107195b7a5c8Smrg	#if defined(__mips64)
107295b7a5c8Smrg	CPU=mips64
107395b7a5c8Smrg	#else
107495b7a5c8Smrg	CPU=mips
107595b7a5c8Smrg	#endif
107695b7a5c8Smrg	#endif
107795b7a5c8Smrg	#endif
107895b7a5c8Smrg
107927702724Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
108095b7a5c8Smrg	MIPS_ENDIAN=el
108127702724Smrg	#else
108227702724Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
108395b7a5c8Smrg	MIPS_ENDIAN=
108427702724Smrg	#else
108595b7a5c8Smrg	MIPS_ENDIAN=
108627702724Smrg	#endif
108727702724Smrg	#endif
108827702724SmrgEOF
108995b7a5c8Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
109095b7a5c8Smrg	eval "$cc_set_vars"
109195b7a5c8Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
109227702724Smrg	;;
10937cea3689Smrg    mips64el:Linux:*:*)
109495b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
109595b7a5c8Smrg	;;
10967cea3689Smrg    openrisc*:Linux:*:*)
109795b7a5c8Smrg	GUESS=or1k-unknown-linux-$LIBC
109895b7a5c8Smrg	;;
10997cea3689Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
110095b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
110195b7a5c8Smrg	;;
110200084f2cSmrg    padre:Linux:*:*)
110395b7a5c8Smrg	GUESS=sparc-unknown-linux-$LIBC
110495b7a5c8Smrg	;;
110500084f2cSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
110695b7a5c8Smrg	GUESS=hppa64-unknown-linux-$LIBC
110795b7a5c8Smrg	;;
110827702724Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
110927702724Smrg	# Look for CPU level
111027702724Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
111195b7a5c8Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
111295b7a5c8Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
111395b7a5c8Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
111427702724Smrg	esac
111595b7a5c8Smrg	;;
111600084f2cSmrg    ppc64:Linux:*:*)
111795b7a5c8Smrg	GUESS=powerpc64-unknown-linux-$LIBC
111895b7a5c8Smrg	;;
111900084f2cSmrg    ppc:Linux:*:*)
112095b7a5c8Smrg	GUESS=powerpc-unknown-linux-$LIBC
112195b7a5c8Smrg	;;
11227cea3689Smrg    ppc64le:Linux:*:*)
112395b7a5c8Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
112495b7a5c8Smrg	;;
11257cea3689Smrg    ppcle:Linux:*:*)
112695b7a5c8Smrg	GUESS=powerpcle-unknown-linux-$LIBC
112795b7a5c8Smrg	;;
112895b7a5c8Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
112995b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113095b7a5c8Smrg	;;
113127702724Smrg    s390:Linux:*:* | s390x:Linux:*:*)
113295b7a5c8Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
113395b7a5c8Smrg	;;
113427702724Smrg    sh64*:Linux:*:*)
113595b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113695b7a5c8Smrg	;;
113727702724Smrg    sh*:Linux:*:*)
113895b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113995b7a5c8Smrg	;;
114027702724Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
114195b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114295b7a5c8Smrg	;;
1143313a12fdSmrg    tile*:Linux:*:*)
114495b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114595b7a5c8Smrg	;;
114627702724Smrg    vax:Linux:*:*)
114795b7a5c8Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
114895b7a5c8Smrg	;;
114927702724Smrg    x86_64:Linux:*:*)
115095b7a5c8Smrg	set_cc_for_build
115195b7a5c8Smrg	LIBCABI=$LIBC
115295b7a5c8Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
115395b7a5c8Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
115495b7a5c8Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
115595b7a5c8Smrg		grep IS_X32 >/dev/null
115695b7a5c8Smrg	    then
115795b7a5c8Smrg		LIBCABI=${LIBC}x32
115895b7a5c8Smrg	    fi
115995b7a5c8Smrg	fi
116095b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
116195b7a5c8Smrg	;;
1162e19dfac4Smrg    xtensa*:Linux:*:*)
116395b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
116495b7a5c8Smrg	;;
116527702724Smrg    i*86:DYNIX/ptx:4*:*)
116627702724Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
116727702724Smrg	# earlier versions are messed up and put the nodename in both
116827702724Smrg	# sysname and nodename.
116995b7a5c8Smrg	GUESS=i386-sequent-sysv4
117095b7a5c8Smrg	;;
117127702724Smrg    i*86:UNIX_SV:4.2MP:2.*)
1172313a12fdSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1173313a12fdSmrg	# number series starting with 2...
1174313a12fdSmrg	# I am not positive that other SVR4 systems won't match this,
117527702724Smrg	# I just have to hope.  -- rms.
1176313a12fdSmrg	# Use sysv4.2uw... so that sysv4* matches it.
117795b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
117895b7a5c8Smrg	;;
117927702724Smrg    i*86:OS/2:*:*)
118027702724Smrg	# If we were able to find `uname', then EMX Unix compatibility
118127702724Smrg	# is probably installed.
118295b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
118395b7a5c8Smrg	;;
118427702724Smrg    i*86:XTS-300:*:STOP)
118595b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-stop
118695b7a5c8Smrg	;;
118727702724Smrg    i*86:atheos:*:*)
118895b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
118995b7a5c8Smrg	;;
119027702724Smrg    i*86:syllable:*:*)
119195b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-syllable
119295b7a5c8Smrg	;;
119300084f2cSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
119495b7a5c8Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
119595b7a5c8Smrg	;;
119627702724Smrg    i*86:*DOS:*:*)
119795b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
119895b7a5c8Smrg	;;
11997cea3689Smrg    i*86:*:4.*:*)
12007cea3689Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
120127702724Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
120295b7a5c8Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
120327702724Smrg	else
120495b7a5c8Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
120527702724Smrg	fi
120695b7a5c8Smrg	;;
120727702724Smrg    i*86:*:5:[678]*)
1208313a12fdSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
120927702724Smrg	case `/bin/uname -X | grep "^Machine"` in
121027702724Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
121127702724Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
121227702724Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
121327702724Smrg	esac
121495b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
121595b7a5c8Smrg	;;
121627702724Smrg    i*86:*:3.2:*)
121727702724Smrg	if test -f /usr/options/cb.name; then
121827702724Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
121995b7a5c8Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
122027702724Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
122127702724Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
122227702724Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
122327702724Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
122427702724Smrg			&& UNAME_MACHINE=i586
122527702724Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
122627702724Smrg			&& UNAME_MACHINE=i686
122727702724Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
122827702724Smrg			&& UNAME_MACHINE=i686
122995b7a5c8Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
123027702724Smrg	else
123195b7a5c8Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
123227702724Smrg	fi
123395b7a5c8Smrg	;;
123427702724Smrg    pc:*:*:*)
123527702724Smrg	# Left here for compatibility:
1236313a12fdSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1237313a12fdSmrg	# the processor, so we play safe by assuming i586.
123800084f2cSmrg	# Note: whatever this is, it MUST be the same as what config.sub
12397cea3689Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
124000084f2cSmrg	# this is a cross-build.
124195b7a5c8Smrg	GUESS=i586-pc-msdosdjgpp
124295b7a5c8Smrg	;;
124327702724Smrg    Intel:Mach:3*:*)
124495b7a5c8Smrg	GUESS=i386-pc-mach3
124595b7a5c8Smrg	;;
124627702724Smrg    paragon:*:*:*)
124795b7a5c8Smrg	GUESS=i860-intel-osf1
124895b7a5c8Smrg	;;
124927702724Smrg    i860:*:4.*:*) # i860-SVR4
125027702724Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
125195b7a5c8Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
125227702724Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
125395b7a5c8Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
125427702724Smrg	fi
125595b7a5c8Smrg	;;
125627702724Smrg    mini*:CTIX:SYS*5:*)
125727702724Smrg	# "miniframe"
125895b7a5c8Smrg	GUESS=m68010-convergent-sysv
125995b7a5c8Smrg	;;
126027702724Smrg    mc68k:UNIX:SYSTEM5:3.51m)
126195b7a5c8Smrg	GUESS=m68k-convergent-sysv
126295b7a5c8Smrg	;;
126327702724Smrg    M680?0:D-NIX:5.3:*)
126495b7a5c8Smrg	GUESS=m68k-diab-dnix
126595b7a5c8Smrg	;;
126627702724Smrg    M68*:*:R3V[5678]*:*)
126727702724Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
126827702724Smrg    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)
126927702724Smrg	OS_REL=''
127027702724Smrg	test -r /etc/.relid \
127127702724Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
127227702724Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12737cea3689Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
127427702724Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12757cea3689Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
127627702724Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277313a12fdSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278313a12fdSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
127900084f2cSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
128000084f2cSmrg	OS_REL='.3'
128100084f2cSmrg	test -r /etc/.relid \
128200084f2cSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
128300084f2cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12847cea3689Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
128500084f2cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12867cea3689Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
128700084f2cSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12887cea3689Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
128927702724Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
129095b7a5c8Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
129195b7a5c8Smrg	;;
129227702724Smrg    mc68030:UNIX_System_V:4.*:*)
129395b7a5c8Smrg	GUESS=m68k-atari-sysv4
129495b7a5c8Smrg	;;
129527702724Smrg    TSUNAMI:LynxOS:2.*:*)
129695b7a5c8Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
129795b7a5c8Smrg	;;
129827702724Smrg    rs6000:LynxOS:2.*:*)
129995b7a5c8Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
130095b7a5c8Smrg	;;
130100084f2cSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
130295b7a5c8Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
130395b7a5c8Smrg	;;
130427702724Smrg    SM[BE]S:UNIX_SV:*:*)
130595b7a5c8Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
130695b7a5c8Smrg	;;
130727702724Smrg    RM*:ReliantUNIX-*:*:*)
130895b7a5c8Smrg	GUESS=mips-sni-sysv4
130995b7a5c8Smrg	;;
131027702724Smrg    RM*:SINIX-*:*:*)
131195b7a5c8Smrg	GUESS=mips-sni-sysv4
131295b7a5c8Smrg	;;
131327702724Smrg    *:SINIX-*:*:*)
131427702724Smrg	if uname -p 2>/dev/null >/dev/null ; then
131527702724Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
131695b7a5c8Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
131727702724Smrg	else
131895b7a5c8Smrg		GUESS=ns32k-sni-sysv
131927702724Smrg	fi
132095b7a5c8Smrg	;;
1321313a12fdSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322313a12fdSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
132395b7a5c8Smrg	GUESS=i586-unisys-sysv4
132495b7a5c8Smrg	;;
132527702724Smrg    *:UNIX_System_V:4*:FTX*)
132627702724Smrg	# From Gerald Hewes <hewes@openmarket.com>.
132727702724Smrg	# How about differentiating between stratus architectures? -djm
132895b7a5c8Smrg	GUESS=hppa1.1-stratus-sysv4
132995b7a5c8Smrg	;;
133027702724Smrg    *:*:*:FTX*)
133127702724Smrg	# From seanf@swdc.stratus.com.
133295b7a5c8Smrg	GUESS=i860-stratus-sysv4
133395b7a5c8Smrg	;;
133427702724Smrg    i*86:VOS:*:*)
133527702724Smrg	# From Paul.Green@stratus.com.
133695b7a5c8Smrg	GUESS=$UNAME_MACHINE-stratus-vos
133795b7a5c8Smrg	;;
133827702724Smrg    *:VOS:*:*)
133927702724Smrg	# From Paul.Green@stratus.com.
134095b7a5c8Smrg	GUESS=hppa1.1-stratus-vos
134195b7a5c8Smrg	;;
134227702724Smrg    mc68*:A/UX:*:*)
134395b7a5c8Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
134495b7a5c8Smrg	;;
134527702724Smrg    news*:NEWS-OS:6*:*)
134695b7a5c8Smrg	GUESS=mips-sony-newsos6
134795b7a5c8Smrg	;;
134827702724Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
134995b7a5c8Smrg	if test -d /usr/nec; then
135095b7a5c8Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
135127702724Smrg	else
135295b7a5c8Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
135327702724Smrg	fi
135495b7a5c8Smrg	;;
135527702724Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
135695b7a5c8Smrg	GUESS=powerpc-be-beos
135795b7a5c8Smrg	;;
135827702724Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
135995b7a5c8Smrg	GUESS=powerpc-apple-beos
136095b7a5c8Smrg	;;
136127702724Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
136295b7a5c8Smrg	GUESS=i586-pc-beos
136395b7a5c8Smrg	;;
136400084f2cSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
136595b7a5c8Smrg	GUESS=i586-pc-haiku
136695b7a5c8Smrg	;;
1367313a12fdSmrg    x86_64:Haiku:*:*)
136895b7a5c8Smrg	GUESS=x86_64-unknown-haiku
136995b7a5c8Smrg	;;
137027702724Smrg    SX-4:SUPER-UX:*:*)
137195b7a5c8Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
137295b7a5c8Smrg	;;
137327702724Smrg    SX-5:SUPER-UX:*:*)
137495b7a5c8Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
137595b7a5c8Smrg	;;
137627702724Smrg    SX-6:SUPER-UX:*:*)
137795b7a5c8Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
137895b7a5c8Smrg	;;
1379e19dfac4Smrg    SX-7:SUPER-UX:*:*)
138095b7a5c8Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
138195b7a5c8Smrg	;;
1382e19dfac4Smrg    SX-8:SUPER-UX:*:*)
138395b7a5c8Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
138495b7a5c8Smrg	;;
1385e19dfac4Smrg    SX-8R:SUPER-UX:*:*)
138695b7a5c8Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
138795b7a5c8Smrg	;;
13887cea3689Smrg    SX-ACE:SUPER-UX:*:*)
138995b7a5c8Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
139095b7a5c8Smrg	;;
139127702724Smrg    Power*:Rhapsody:*:*)
139295b7a5c8Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
139395b7a5c8Smrg	;;
139427702724Smrg    *:Rhapsody:*:*)
139595b7a5c8Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
139695b7a5c8Smrg	;;
139795b7a5c8Smrg    arm64:Darwin:*:*)
139895b7a5c8Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
139995b7a5c8Smrg	;;
140027702724Smrg    *:Darwin:*:*)
140195b7a5c8Smrg	UNAME_PROCESSOR=`uname -p`
140295b7a5c8Smrg	case $UNAME_PROCESSOR in
140395b7a5c8Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
140495b7a5c8Smrg	esac
140595b7a5c8Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
140695b7a5c8Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
140795b7a5c8Smrg	    # Avoid executing cc if there is no toolchain installed as
140895b7a5c8Smrg	    # cc will be a stub that puts up a graphical alert
140995b7a5c8Smrg	    # prompting the user to install developer tools.
141095b7a5c8Smrg	    CC_FOR_BUILD=no_compiler_found
141195b7a5c8Smrg	else
141295b7a5c8Smrg	    set_cc_for_build
14137cea3689Smrg	fi
141495b7a5c8Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
141595b7a5c8Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
141695b7a5c8Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
141795b7a5c8Smrg		   grep IS_64BIT_ARCH >/dev/null
141895b7a5c8Smrg	    then
141995b7a5c8Smrg		case $UNAME_PROCESSOR in
142095b7a5c8Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
142195b7a5c8Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
142295b7a5c8Smrg		esac
142395b7a5c8Smrg	    fi
142495b7a5c8Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
142595b7a5c8Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
142695b7a5c8Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
142795b7a5c8Smrg		   grep IS_PPC >/dev/null
142895b7a5c8Smrg	    then
142995b7a5c8Smrg		UNAME_PROCESSOR=powerpc
14307cea3689Smrg	    fi
14317cea3689Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
143295b7a5c8Smrg	    # uname -m returns i386 or x86_64
143395b7a5c8Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
14347cea3689Smrg	fi
143595b7a5c8Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
143695b7a5c8Smrg	;;
143727702724Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
143827702724Smrg	UNAME_PROCESSOR=`uname -p`
14397cea3689Smrg	if test "$UNAME_PROCESSOR" = x86; then
144027702724Smrg		UNAME_PROCESSOR=i386
144127702724Smrg		UNAME_MACHINE=pc
144227702724Smrg	fi
144395b7a5c8Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
144495b7a5c8Smrg	;;
144527702724Smrg    *:QNX:*:4*)
144695b7a5c8Smrg	GUESS=i386-pc-qnx
144795b7a5c8Smrg	;;
14487cea3689Smrg    NEO-*:NONSTOP_KERNEL:*:*)
144995b7a5c8Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
145095b7a5c8Smrg	;;
1451313a12fdSmrg    NSE-*:NONSTOP_KERNEL:*:*)
145295b7a5c8Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
145395b7a5c8Smrg	;;
14547cea3689Smrg    NSR-*:NONSTOP_KERNEL:*:*)
145595b7a5c8Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
145695b7a5c8Smrg	;;
14577cea3689Smrg    NSV-*:NONSTOP_KERNEL:*:*)
145895b7a5c8Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
145995b7a5c8Smrg	;;
14607cea3689Smrg    NSX-*:NONSTOP_KERNEL:*:*)
146195b7a5c8Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
146295b7a5c8Smrg	;;
146327702724Smrg    *:NonStop-UX:*:*)
146495b7a5c8Smrg	GUESS=mips-compaq-nonstopux
146595b7a5c8Smrg	;;
146627702724Smrg    BS2000:POSIX*:*:*)
146795b7a5c8Smrg	GUESS=bs2000-siemens-sysv
146895b7a5c8Smrg	;;
146927702724Smrg    DS/*:UNIX_System_V:*:*)
147095b7a5c8Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
147195b7a5c8Smrg	;;
147227702724Smrg    *:Plan9:*:*)
147327702724Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
147427702724Smrg	# is converted to i386 for consistency with other x86
147527702724Smrg	# operating systems.
147695b7a5c8Smrg	if test "${cputype-}" = 386; then
147727702724Smrg	    UNAME_MACHINE=i386
147895b7a5c8Smrg	elif test "x${cputype-}" != x; then
147995b7a5c8Smrg	    UNAME_MACHINE=$cputype
148027702724Smrg	fi
148195b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
148295b7a5c8Smrg	;;
148327702724Smrg    *:TOPS-10:*:*)
148495b7a5c8Smrg	GUESS=pdp10-unknown-tops10
148595b7a5c8Smrg	;;
148627702724Smrg    *:TENEX:*:*)
148795b7a5c8Smrg	GUESS=pdp10-unknown-tenex
148895b7a5c8Smrg	;;
148927702724Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
149095b7a5c8Smrg	GUESS=pdp10-dec-tops20
149195b7a5c8Smrg	;;
149227702724Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
149395b7a5c8Smrg	GUESS=pdp10-xkl-tops20
149495b7a5c8Smrg	;;
149527702724Smrg    *:TOPS-20:*:*)
149695b7a5c8Smrg	GUESS=pdp10-unknown-tops20
149795b7a5c8Smrg	;;
149827702724Smrg    *:ITS:*:*)
149995b7a5c8Smrg	GUESS=pdp10-unknown-its
150095b7a5c8Smrg	;;
150127702724Smrg    SEI:*:*:SEIUX)
150295b7a5c8Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
150395b7a5c8Smrg	;;
150427702724Smrg    *:DragonFly:*:*)
150595b7a5c8Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
150695b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
150795b7a5c8Smrg	;;
150827702724Smrg    *:*VMS:*:*)
1509313a12fdSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
151095b7a5c8Smrg	case $UNAME_MACHINE in
151195b7a5c8Smrg	    A*) GUESS=alpha-dec-vms ;;
151295b7a5c8Smrg	    I*) GUESS=ia64-dec-vms ;;
151395b7a5c8Smrg	    V*) GUESS=vax-dec-vms ;;
151427702724Smrg	esac ;;
151527702724Smrg    *:XENIX:*:SysV)
151695b7a5c8Smrg	GUESS=i386-pc-xenix
151795b7a5c8Smrg	;;
151827702724Smrg    i*86:skyos:*:*)
151995b7a5c8Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
152095b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
152195b7a5c8Smrg	;;
152227702724Smrg    i*86:rdos:*:*)
152395b7a5c8Smrg	GUESS=$UNAME_MACHINE-pc-rdos
152495b7a5c8Smrg	;;
152595b7a5c8Smrg    *:AROS:*:*)
152695b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-aros
152795b7a5c8Smrg	;;
1528313a12fdSmrg    x86_64:VMkernel:*:*)
152995b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-esx
153095b7a5c8Smrg	;;
15317cea3689Smrg    amd64:Isilon\ OneFS:*:*)
153295b7a5c8Smrg	GUESS=x86_64-unknown-onefs
153395b7a5c8Smrg	;;
153495b7a5c8Smrg    *:Unleashed:*:*)
153595b7a5c8Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
153695b7a5c8Smrg	;;
153727702724Smrgesac
153827702724Smrg
153995b7a5c8Smrg# Do we have a guess based on uname results?
154095b7a5c8Smrgif test "x$GUESS" != x; then
154195b7a5c8Smrg    echo "$GUESS"
154295b7a5c8Smrg    exit
154395b7a5c8Smrgfi
154495b7a5c8Smrg
154595b7a5c8Smrg# No uname command or uname output not recognized.
154695b7a5c8Smrgset_cc_for_build
154795b7a5c8Smrgcat > "$dummy.c" <<EOF
154895b7a5c8Smrg#ifdef _SEQUENT_
154995b7a5c8Smrg#include <sys/types.h>
155095b7a5c8Smrg#include <sys/utsname.h>
155195b7a5c8Smrg#endif
155295b7a5c8Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
155395b7a5c8Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
155495b7a5c8Smrg#include <signal.h>
155595b7a5c8Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
155695b7a5c8Smrg#include <sys/utsname.h>
155795b7a5c8Smrg#endif
155895b7a5c8Smrg#endif
155995b7a5c8Smrg#endif
156095b7a5c8Smrgmain ()
156195b7a5c8Smrg{
156295b7a5c8Smrg#if defined (sony)
156395b7a5c8Smrg#if defined (MIPSEB)
156495b7a5c8Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
156595b7a5c8Smrg     I don't know....  */
156695b7a5c8Smrg  printf ("mips-sony-bsd\n"); exit (0);
156795b7a5c8Smrg#else
156895b7a5c8Smrg#include <sys/param.h>
156995b7a5c8Smrg  printf ("m68k-sony-newsos%s\n",
157095b7a5c8Smrg#ifdef NEWSOS4
157195b7a5c8Smrg  "4"
157295b7a5c8Smrg#else
157395b7a5c8Smrg  ""
157495b7a5c8Smrg#endif
157595b7a5c8Smrg  ); exit (0);
157695b7a5c8Smrg#endif
157795b7a5c8Smrg#endif
157895b7a5c8Smrg
157995b7a5c8Smrg#if defined (NeXT)
158095b7a5c8Smrg#if !defined (__ARCHITECTURE__)
158195b7a5c8Smrg#define __ARCHITECTURE__ "m68k"
158295b7a5c8Smrg#endif
158395b7a5c8Smrg  int version;
158495b7a5c8Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
158595b7a5c8Smrg  if (version < 4)
158695b7a5c8Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
158795b7a5c8Smrg  else
158895b7a5c8Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
158995b7a5c8Smrg  exit (0);
159095b7a5c8Smrg#endif
159195b7a5c8Smrg
159295b7a5c8Smrg#if defined (MULTIMAX) || defined (n16)
159395b7a5c8Smrg#if defined (UMAXV)
159495b7a5c8Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
159595b7a5c8Smrg#else
159695b7a5c8Smrg#if defined (CMU)
159795b7a5c8Smrg  printf ("ns32k-encore-mach\n"); exit (0);
159895b7a5c8Smrg#else
159995b7a5c8Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
160095b7a5c8Smrg#endif
160195b7a5c8Smrg#endif
160295b7a5c8Smrg#endif
160395b7a5c8Smrg
160495b7a5c8Smrg#if defined (__386BSD__)
160595b7a5c8Smrg  printf ("i386-pc-bsd\n"); exit (0);
160695b7a5c8Smrg#endif
160795b7a5c8Smrg
160895b7a5c8Smrg#if defined (sequent)
160995b7a5c8Smrg#if defined (i386)
161095b7a5c8Smrg  printf ("i386-sequent-dynix\n"); exit (0);
161195b7a5c8Smrg#endif
161295b7a5c8Smrg#if defined (ns32000)
161395b7a5c8Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
161495b7a5c8Smrg#endif
161595b7a5c8Smrg#endif
161695b7a5c8Smrg
161795b7a5c8Smrg#if defined (_SEQUENT_)
161895b7a5c8Smrg  struct utsname un;
161995b7a5c8Smrg
162095b7a5c8Smrg  uname(&un);
162195b7a5c8Smrg  if (strncmp(un.version, "V2", 2) == 0) {
162295b7a5c8Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
162395b7a5c8Smrg  }
162495b7a5c8Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
162595b7a5c8Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
162695b7a5c8Smrg  }
162795b7a5c8Smrg  printf ("i386-sequent-ptx\n"); exit (0);
162895b7a5c8Smrg#endif
162995b7a5c8Smrg
163095b7a5c8Smrg#if defined (vax)
163195b7a5c8Smrg#if !defined (ultrix)
163295b7a5c8Smrg#include <sys/param.h>
163395b7a5c8Smrg#if defined (BSD)
163495b7a5c8Smrg#if BSD == 43
163595b7a5c8Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
163695b7a5c8Smrg#else
163795b7a5c8Smrg#if BSD == 199006
163895b7a5c8Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
163995b7a5c8Smrg#else
164095b7a5c8Smrg  printf ("vax-dec-bsd\n"); exit (0);
164195b7a5c8Smrg#endif
164295b7a5c8Smrg#endif
164395b7a5c8Smrg#else
164495b7a5c8Smrg  printf ("vax-dec-bsd\n"); exit (0);
164595b7a5c8Smrg#endif
164695b7a5c8Smrg#else
164795b7a5c8Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
164895b7a5c8Smrg  struct utsname un;
164995b7a5c8Smrg  uname (&un);
165095b7a5c8Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
165195b7a5c8Smrg#else
165295b7a5c8Smrg  printf ("vax-dec-ultrix\n"); exit (0);
165395b7a5c8Smrg#endif
165495b7a5c8Smrg#endif
165595b7a5c8Smrg#endif
165695b7a5c8Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
165795b7a5c8Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
165895b7a5c8Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
165995b7a5c8Smrg  struct utsname *un;
166095b7a5c8Smrg  uname (&un);
166195b7a5c8Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
166295b7a5c8Smrg#else
166395b7a5c8Smrg  printf ("mips-dec-ultrix\n"); exit (0);
166495b7a5c8Smrg#endif
166595b7a5c8Smrg#endif
166695b7a5c8Smrg#endif
166795b7a5c8Smrg
166895b7a5c8Smrg#if defined (alliant) && defined (i860)
166995b7a5c8Smrg  printf ("i860-alliant-bsd\n"); exit (0);
167095b7a5c8Smrg#endif
167195b7a5c8Smrg
167295b7a5c8Smrg  exit (1);
167395b7a5c8Smrg}
167495b7a5c8SmrgEOF
167595b7a5c8Smrg
167695b7a5c8Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
167795b7a5c8Smrg	{ echo "$SYSTEM_NAME"; exit; }
167895b7a5c8Smrg
167995b7a5c8Smrg# Apollos put the system type in the environment.
168095b7a5c8Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
168195b7a5c8Smrg
16827cea3689Smrgecho "$0: unable to guess system type" >&2
168327702724Smrg
168495b7a5c8Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
16857cea3689Smrg    mips:Linux | mips64:Linux)
16867cea3689Smrg	# If we got here on MIPS GNU/Linux, output extra information.
16877cea3689Smrg	cat >&2 <<EOF
168827702724Smrg
16897cea3689SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
16907cea3689Smrgthe system type. Please install a C compiler and try again.
169127702724SmrgEOF
16927cea3689Smrg	;;
16937cea3689Smrgesac
169427702724Smrg
169527702724Smrgcat >&2 <<EOF
169627702724Smrg
16977cea3689SmrgThis script (version $timestamp), has failed to recognize the
16987cea3689Smrgoperating system you are using. If your script is old, overwrite *all*
16997cea3689Smrgcopies of config.guess and config.sub with the latest versions from:
170027702724Smrg
170195b7a5c8Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
170227702724Smrgand
170395b7a5c8Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
170495b7a5c8SmrgEOF
170595b7a5c8Smrg
170695b7a5c8Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
170795b7a5c8Smrgthisyear=`date +%Y`
170895b7a5c8Smrg# shellcheck disable=SC2003
170995b7a5c8Smrgscript_age=`expr "$thisyear" - "$our_year"`
171095b7a5c8Smrgif test "$script_age" -lt 3 ; then
171195b7a5c8Smrg   cat >&2 <<EOF
171227702724Smrg
17137cea3689SmrgIf $0 has already been updated, send the following data and any
17147cea3689Smrginformation you think might be pertinent to config-patches@gnu.org to
17157cea3689Smrgprovide the necessary information to handle your system.
171627702724Smrg
171727702724Smrgconfig.guess timestamp = $timestamp
171827702724Smrg
171927702724Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
172027702724Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
172127702724Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
172227702724Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
172327702724Smrg
172427702724Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
172527702724Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
172627702724Smrg
172727702724Smrghostinfo               = `(hostinfo) 2>/dev/null`
172827702724Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
172927702724Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
173027702724Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
173127702724Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
173227702724Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
173327702724Smrg
17347cea3689SmrgUNAME_MACHINE = "$UNAME_MACHINE"
17357cea3689SmrgUNAME_RELEASE = "$UNAME_RELEASE"
17367cea3689SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
17377cea3689SmrgUNAME_VERSION = "$UNAME_VERSION"
173827702724SmrgEOF
173995b7a5c8Smrgfi
174027702724Smrg
174127702724Smrgexit 1
174227702724Smrg
174327702724Smrg# Local variables:
174495b7a5c8Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
174527702724Smrg# time-stamp-start: "timestamp='"
174627702724Smrg# time-stamp-format: "%:y-%02m-%02d"
174727702724Smrg# time-stamp-end: "'"
174827702724Smrg# End:
1749