config.guess revision 0c674dbd
1b042e37fSmrg#! /bin/sh
2b042e37fSmrg# Attempt to guess a canonical system name.
30c674dbdSmrg#   Copyright 1992-2023 Free Software Foundation, Inc.
4b042e37fSmrg
58d0bc965Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
68d0bc965Smrg
70c674dbdSmrgtimestamp='2023-01-01'
8b042e37fSmrg
9b042e37fSmrg# This file is free software; you can redistribute it and/or modify it
10b042e37fSmrg# under the terms of the GNU General Public License as published by
110c674dbdSmrg# the Free Software Foundation, either version 3 of the License, or
12b042e37fSmrg# (at your option) any later version.
13b042e37fSmrg#
14b042e37fSmrg# This program is distributed in the hope that it will be useful, but
15b042e37fSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16b042e37fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17b042e37fSmrg# General Public License for more details.
18b042e37fSmrg#
19b042e37fSmrg# You should have received a copy of the GNU General Public License
203169be4bSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21b042e37fSmrg#
22b042e37fSmrg# As a special exception to the GNU General Public License, if you
23b042e37fSmrg# distribute this file as part of a program that contains a
24b042e37fSmrg# configuration script generated by Autoconf, you may include it under
258bd17e5fSmrg# the same distribution terms that you use for the rest of that
268bd17e5fSmrg# program.  This Exception is an additional permission under section 7
278bd17e5fSmrg# of the GNU General Public License, version 3 ("GPLv3").
28b042e37fSmrg#
293169be4bSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30b042e37fSmrg#
31706b6b52Smrg# You can get the latest version of this script from:
328d0bc965Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
338bd17e5fSmrg#
343169be4bSmrg# Please send patches to <config-patches@gnu.org>.
358bd17e5fSmrg
36b042e37fSmrg
378d0bc965Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
388d0bc965Smrg# about features and limitations of the classic Bourne shell that were
398d0bc965Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
408d0bc965Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
418d0bc965Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
428d0bc965Smrg# have a pre-POSIX /bin/sh.
438d0bc965Smrg
448d0bc965Smrg
45b042e37fSmrgme=`echo "$0" | sed -e 's,.*/,,'`
46b042e37fSmrg
47b042e37fSmrgusage="\
48b042e37fSmrgUsage: $0 [OPTION]
49b042e37fSmrg
50b042e37fSmrgOutput the configuration name of the system \`$me' is run on.
51b042e37fSmrg
523169be4bSmrgOptions:
53b042e37fSmrg  -h, --help         print this help, then exit
54b042e37fSmrg  -t, --time-stamp   print date of last modification, then exit
55b042e37fSmrg  -v, --version      print version number, then exit
56b042e37fSmrg
57b042e37fSmrgReport bugs and patches to <config-patches@gnu.org>."
58b042e37fSmrg
59b042e37fSmrgversion="\
60b042e37fSmrgGNU config.guess ($timestamp)
61b042e37fSmrg
62b042e37fSmrgOriginally written by Per Bothner.
630c674dbdSmrgCopyright 1992-2023 Free Software Foundation, Inc.
64b042e37fSmrg
65b042e37fSmrgThis is free software; see the source for copying conditions.  There is NO
66b042e37fSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67b042e37fSmrg
68b042e37fSmrghelp="
69b042e37fSmrgTry \`$me --help' for more information."
70b042e37fSmrg
71b042e37fSmrg# Parse command line
72b042e37fSmrgwhile test $# -gt 0 ; do
73b042e37fSmrg  case $1 in
74b042e37fSmrg    --time-stamp | --time* | -t )
758c4a8e55Smrg       echo "$timestamp" ; exit ;;
76b042e37fSmrg    --version | -v )
778c4a8e55Smrg       echo "$version" ; exit ;;
78b042e37fSmrg    --help | --h* | -h )
798c4a8e55Smrg       echo "$usage"; exit ;;
80b042e37fSmrg    -- )     # Stop option processing
81b042e37fSmrg       shift; break ;;
82b042e37fSmrg    - )	# Use stdin as input.
83b042e37fSmrg       break ;;
84b042e37fSmrg    -* )
85b042e37fSmrg       echo "$me: invalid option $1$help" >&2
86b042e37fSmrg       exit 1 ;;
87b042e37fSmrg    * )
88b042e37fSmrg       break ;;
89b042e37fSmrg  esac
90b042e37fSmrgdone
91b042e37fSmrg
92b042e37fSmrgif test $# != 0; then
93b042e37fSmrg  echo "$me: too many arguments$help" >&2
94b042e37fSmrg  exit 1
95b042e37fSmrgfi
96b042e37fSmrg
978d0bc965Smrg# Just in case it came from the environment.
988d0bc965SmrgGUESS=
99b042e37fSmrg
100b042e37fSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101b042e37fSmrg# compiler to aid in system detection is discouraged as it requires
102b042e37fSmrg# temporary files to be created and, as you can see below, it is a
103b042e37fSmrg# headache to deal with in a portable fashion.
104b042e37fSmrg
105b042e37fSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106b042e37fSmrg# use `HOST_CC' if defined, but it is deprecated.
107b042e37fSmrg
108b042e37fSmrg# Portable tmp directory creation inspired by the Autoconf team.
109b042e37fSmrg
1108d0bc965Smrgtmp=
1118d0bc965Smrg# shellcheck disable=SC2172
1128d0bc965Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1138d0bc965Smrg
1148d0bc965Smrgset_cc_for_build() {
1158d0bc965Smrg    # prevent multiple calls if $tmp is already set
1168d0bc965Smrg    test "$tmp" && return 0
1178d0bc965Smrg    : "${TMPDIR=/tmp}"
1188d0bc965Smrg    # shellcheck disable=SC2039,SC3028
1198d0bc965Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1208d0bc965Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1218d0bc965Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1228d0bc965Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1238d0bc965Smrg    dummy=$tmp/dummy
1248d0bc965Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1258d0bc965Smrg	,,)    echo "int x;" > "$dummy.c"
1268d0bc965Smrg	       for driver in cc gcc c89 c99 ; do
1278d0bc965Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1288d0bc965Smrg		       CC_FOR_BUILD=$driver
1298d0bc965Smrg		       break
1308d0bc965Smrg		   fi
1318d0bc965Smrg	       done
1328d0bc965Smrg	       if test x"$CC_FOR_BUILD" = x ; then
1338d0bc965Smrg		   CC_FOR_BUILD=no_compiler_found
1348d0bc965Smrg	       fi
1358d0bc965Smrg	       ;;
1368d0bc965Smrg	,,*)   CC_FOR_BUILD=$CC ;;
1378d0bc965Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1388d0bc965Smrg    esac
1398d0bc965Smrg}
140b042e37fSmrg
141b042e37fSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142b042e37fSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
1438d0bc965Smrgif test -f /.attbin/uname ; then
144b042e37fSmrg	PATH=$PATH:/.attbin ; export PATH
145b042e37fSmrgfi
146b042e37fSmrg
147b042e37fSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148b042e37fSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1498d0bc965SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150b042e37fSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151b042e37fSmrg
1528d0bc965Smrgcase $UNAME_SYSTEM in
153fc98c8e2SmrgLinux|GNU|GNU/*)
1548d0bc965Smrg	LIBC=unknown
155fc98c8e2Smrg
1568d0bc965Smrg	set_cc_for_build
1573169be4bSmrg	cat <<-EOF > "$dummy.c"
158fc98c8e2Smrg	#include <features.h>
159fc98c8e2Smrg	#if defined(__UCLIBC__)
160fc98c8e2Smrg	LIBC=uclibc
161fc98c8e2Smrg	#elif defined(__dietlibc__)
162fc98c8e2Smrg	LIBC=dietlibc
1638d0bc965Smrg	#elif defined(__GLIBC__)
164fc98c8e2Smrg	LIBC=gnu
1658d0bc965Smrg	#else
1668d0bc965Smrg	#include <stdarg.h>
1678d0bc965Smrg	/* First heuristic to detect musl libc.  */
1688d0bc965Smrg	#ifdef __DEFINED_va_list
1698d0bc965Smrg	LIBC=musl
1708d0bc965Smrg	#endif
171fc98c8e2Smrg	#endif
172fc98c8e2Smrg	EOF
1738d0bc965Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
1748d0bc965Smrg	eval "$cc_set_libc"
1753169be4bSmrg
1768d0bc965Smrg	# Second heuristic to detect musl libc.
1778d0bc965Smrg	if [ "$LIBC" = unknown ] &&
1788d0bc965Smrg	   command -v ldd >/dev/null &&
1798d0bc965Smrg	   ldd --version 2>&1 | grep -q ^musl; then
1808d0bc965Smrg		LIBC=musl
1818d0bc965Smrg	fi
1828d0bc965Smrg
1838d0bc965Smrg	# If the system lacks a compiler, then just pick glibc.
1848d0bc965Smrg	# We could probably try harder.
1858d0bc965Smrg	if [ "$LIBC" = unknown ]; then
1868d0bc965Smrg		LIBC=gnu
1873169be4bSmrg	fi
188fc98c8e2Smrg	;;
189fc98c8e2Smrgesac
190fc98c8e2Smrg
191b042e37fSmrg# Note: order is significant - the case branches are not exclusive.
192b042e37fSmrg
1938d0bc965Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194b042e37fSmrg    *:NetBSD:*:*)
195b042e37fSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
1960597fb56Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197b042e37fSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198b042e37fSmrg	# switched to ELF, *-*-netbsd* would select the old
199b042e37fSmrg	# object file format.  This provides both forward
200b042e37fSmrg	# compatibility and a consistent mechanism for selecting the
201b042e37fSmrg	# object file format.
202b042e37fSmrg	#
203b042e37fSmrg	# Note: NetBSD doesn't particularly care about the vendor
204b042e37fSmrg	# portion of the name.  We always set it to "unknown".
2053169be4bSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2068d0bc965Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2078d0bc965Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2083169be4bSmrg	    echo unknown)`
2098d0bc965Smrg	case $UNAME_MACHINE_ARCH in
2108d0bc965Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
211b042e37fSmrg	    armeb) machine=armeb-unknown ;;
212b042e37fSmrg	    arm*) machine=arm-unknown ;;
213b042e37fSmrg	    sh3el) machine=shl-unknown ;;
214b042e37fSmrg	    sh3eb) machine=sh-unknown ;;
215706b6b52Smrg	    sh5el) machine=sh5le-unknown ;;
2163169be4bSmrg	    earmv*)
2173169be4bSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2183169be4bSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
2198d0bc965Smrg		machine=${arch}${endian}-unknown
2203169be4bSmrg		;;
2218d0bc965Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222b042e37fSmrg	esac
223b042e37fSmrg	# The Operating System including object format, if it has switched
2243169be4bSmrg	# to ELF recently (or will in the future) and ABI.
2258d0bc965Smrg	case $UNAME_MACHINE_ARCH in
2263169be4bSmrg	    earm*)
2273169be4bSmrg		os=netbsdelf
2283169be4bSmrg		;;
229b042e37fSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2308d0bc965Smrg		set_cc_for_build
231b042e37fSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232706b6b52Smrg			| grep -q __ELF__
233b042e37fSmrg		then
234b042e37fSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235b042e37fSmrg		    # Return netbsd for either.  FIX?
236b042e37fSmrg		    os=netbsd
237b042e37fSmrg		else
238b042e37fSmrg		    os=netbsdelf
239b042e37fSmrg		fi
240b042e37fSmrg		;;
241b042e37fSmrg	    *)
2420597fb56Smrg		os=netbsd
243b042e37fSmrg		;;
244b042e37fSmrg	esac
2453169be4bSmrg	# Determine ABI tags.
2468d0bc965Smrg	case $UNAME_MACHINE_ARCH in
2473169be4bSmrg	    earm*)
2483169be4bSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2493169be4bSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2503169be4bSmrg		;;
2513169be4bSmrg	esac
252b042e37fSmrg	# The OS release
253b042e37fSmrg	# Debian GNU/NetBSD machines have a different userland, and
254b042e37fSmrg	# thus, need a distinct triplet. However, they do not need
255b042e37fSmrg	# kernel version information, so it can be replaced with a
256b042e37fSmrg	# suitable tag, in the style of linux-gnu.
2578d0bc965Smrg	case $UNAME_VERSION in
258b042e37fSmrg	    Debian*)
259b042e37fSmrg		release='-gnu'
260b042e37fSmrg		;;
261b042e37fSmrg	    *)
2623169be4bSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263b042e37fSmrg		;;
264b042e37fSmrg	esac
265b042e37fSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266b042e37fSmrg	# contains redundant information, the shorter form:
267b042e37fSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2688d0bc965Smrg	GUESS=$machine-${os}${release}${abi-}
2698d0bc965Smrg	;;
2708bd17e5fSmrg    *:Bitrig:*:*)
2718bd17e5fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2728d0bc965Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
2738d0bc965Smrg	;;
274b042e37fSmrg    *:OpenBSD:*:*)
2758c4a8e55Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2768d0bc965Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
2778d0bc965Smrg	;;
2788d0bc965Smrg    *:SecBSD:*:*)
2798d0bc965Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
2808d0bc965Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
2818d0bc965Smrg	;;
2823169be4bSmrg    *:LibertyBSD:*:*)
2833169be4bSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2848d0bc965Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
2858d0bc965Smrg	;;
2863169be4bSmrg    *:MidnightBSD:*:*)
2878d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
2888d0bc965Smrg	;;
2898c4a8e55Smrg    *:ekkoBSD:*:*)
2908d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
2918d0bc965Smrg	;;
2928c4a8e55Smrg    *:SolidBSD:*:*)
2938d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
2948d0bc965Smrg	;;
2958d0bc965Smrg    *:OS108:*:*)
2968d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
2978d0bc965Smrg	;;
2988c4a8e55Smrg    macppc:MirBSD:*:*)
2998d0bc965Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
3008d0bc965Smrg	;;
3018c4a8e55Smrg    *:MirBSD:*:*)
3028d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
3038d0bc965Smrg	;;
3043169be4bSmrg    *:Sortix:*:*)
3058d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
3068d0bc965Smrg	;;
3078d0bc965Smrg    *:Twizzler:*:*)
3088d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
3098d0bc965Smrg	;;
3103169be4bSmrg    *:Redox:*:*)
3118d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-redox
3128d0bc965Smrg	;;
3133169be4bSmrg    mips:OSF1:*.*)
3148d0bc965Smrg	GUESS=mips-dec-osf1
3158d0bc965Smrg	;;
316b042e37fSmrg    alpha:OSF1:*:*)
3178d0bc965Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3188d0bc965Smrg	trap '' 0
3198c4a8e55Smrg	case $UNAME_RELEASE in
3208c4a8e55Smrg	*4.0)
321b042e37fSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3228c4a8e55Smrg		;;
3238c4a8e55Smrg	*5.*)
3240597fb56Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3258c4a8e55Smrg		;;
3268c4a8e55Smrg	esac
327b042e37fSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328b042e37fSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329b042e37fSmrg	# covers most systems running today.  This code pipes the CPU
330b042e37fSmrg	# types through head -n 1, so we only detect the type of CPU 0.
331b042e37fSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3328d0bc965Smrg	case $ALPHA_CPU_TYPE in
333b042e37fSmrg	    "EV4 (21064)")
3343169be4bSmrg		UNAME_MACHINE=alpha ;;
335b042e37fSmrg	    "EV4.5 (21064)")
3363169be4bSmrg		UNAME_MACHINE=alpha ;;
337b042e37fSmrg	    "LCA4 (21066/21068)")
3383169be4bSmrg		UNAME_MACHINE=alpha ;;
339b042e37fSmrg	    "EV5 (21164)")
3403169be4bSmrg		UNAME_MACHINE=alphaev5 ;;
341b042e37fSmrg	    "EV5.6 (21164A)")
3423169be4bSmrg		UNAME_MACHINE=alphaev56 ;;
343b042e37fSmrg	    "EV5.6 (21164PC)")
3443169be4bSmrg		UNAME_MACHINE=alphapca56 ;;
345b042e37fSmrg	    "EV5.7 (21164PC)")
3463169be4bSmrg		UNAME_MACHINE=alphapca57 ;;
347b042e37fSmrg	    "EV6 (21264)")
3483169be4bSmrg		UNAME_MACHINE=alphaev6 ;;
349b042e37fSmrg	    "EV6.7 (21264A)")
3503169be4bSmrg		UNAME_MACHINE=alphaev67 ;;
351b042e37fSmrg	    "EV6.8CB (21264C)")
3523169be4bSmrg		UNAME_MACHINE=alphaev68 ;;
353b042e37fSmrg	    "EV6.8AL (21264B)")
3543169be4bSmrg		UNAME_MACHINE=alphaev68 ;;
355b042e37fSmrg	    "EV6.8CX (21264D)")
3563169be4bSmrg		UNAME_MACHINE=alphaev68 ;;
357b042e37fSmrg	    "EV6.9A (21264/EV69A)")
3583169be4bSmrg		UNAME_MACHINE=alphaev69 ;;
359b042e37fSmrg	    "EV7 (21364)")
3603169be4bSmrg		UNAME_MACHINE=alphaev7 ;;
361b042e37fSmrg	    "EV7.9 (21364A)")
3623169be4bSmrg		UNAME_MACHINE=alphaev79 ;;
363b042e37fSmrg	esac
3648c4a8e55Smrg	# A Pn.n version is a patched version.
365b042e37fSmrg	# A Vn.n version is a released version.
366b042e37fSmrg	# A Tn.n version is a released field test version.
367b042e37fSmrg	# A Xn.n version is an unreleased experimental baselevel.
368b042e37fSmrg	# 1.2 uses "1.2" for uname -r.
3698d0bc965Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
3708d0bc965Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
3718d0bc965Smrg	;;
372b042e37fSmrg    Amiga*:UNIX_System_V:4.0:*)
3738d0bc965Smrg	GUESS=m68k-unknown-sysv4
3748d0bc965Smrg	;;
375b042e37fSmrg    *:[Aa]miga[Oo][Ss]:*:*)
3768d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
3778d0bc965Smrg	;;
378b042e37fSmrg    *:[Mm]orph[Oo][Ss]:*:*)
3798d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
3808d0bc965Smrg	;;
381b042e37fSmrg    *:OS/390:*:*)
3828d0bc965Smrg	GUESS=i370-ibm-openedition
3838d0bc965Smrg	;;
3848c4a8e55Smrg    *:z/VM:*:*)
3858d0bc965Smrg	GUESS=s390-ibm-zvmoe
3868d0bc965Smrg	;;
3878c4a8e55Smrg    *:OS400:*:*)
3888d0bc965Smrg	GUESS=powerpc-ibm-os400
3898d0bc965Smrg	;;
390b042e37fSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3918d0bc965Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
3928d0bc965Smrg	;;
3938bd17e5fSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3948d0bc965Smrg	GUESS=arm-unknown-riscos
3958d0bc965Smrg	;;
396b042e37fSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3978d0bc965Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
3988d0bc965Smrg	;;
399b042e37fSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400b042e37fSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
4018d0bc965Smrg	case `(/bin/universe) 2>/dev/null` in
4028d0bc965Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
4038d0bc965Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
4048d0bc965Smrg	esac
4058d0bc965Smrg	;;
406b042e37fSmrg    NILE*:*:*:dcosx)
4078d0bc965Smrg	GUESS=pyramid-pyramid-svr4
4088d0bc965Smrg	;;
409b042e37fSmrg    DRS?6000:unix:4.0:6*)
4108d0bc965Smrg	GUESS=sparc-icl-nx6
4118d0bc965Smrg	;;
4128c4a8e55Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413b042e37fSmrg	case `/usr/bin/uname -p` in
4148d0bc965Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
4158d0bc965Smrg	esac
4168d0bc965Smrg	;;
417706b6b52Smrg    s390x:SunOS:*:*)
4188d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4198d0bc965Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
4208d0bc965Smrg	;;
421b042e37fSmrg    sun4H:SunOS:5.*:*)
4228d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4238d0bc965Smrg	GUESS=sparc-hal-solaris2$SUN_REL
4248d0bc965Smrg	;;
425b042e37fSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
4268d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4278d0bc965Smrg	GUESS=sparc-sun-solaris2$SUN_REL
4288d0bc965Smrg	;;
429706b6b52Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
4308d0bc965Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
4318d0bc965Smrg	;;
432706b6b52Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4338d0bc965Smrg	set_cc_for_build
4343169be4bSmrg	SUN_ARCH=i386
435706b6b52Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436706b6b52Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437706b6b52Smrg	# This test works for both compilers.
4388d0bc965Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439706b6b52Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4400c674dbdSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441706b6b52Smrg		grep IS_64BIT_ARCH >/dev/null
442706b6b52Smrg	    then
4433169be4bSmrg		SUN_ARCH=x86_64
444706b6b52Smrg	    fi
445706b6b52Smrg	fi
4468d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4478d0bc965Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
4488d0bc965Smrg	;;
449b042e37fSmrg    sun4*:SunOS:6*:*)
450b042e37fSmrg	# According to config.sub, this is the proper way to canonicalize
451b042e37fSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452b042e37fSmrg	# it's likely to be more like Solaris than SunOS4.
4538d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4548d0bc965Smrg	GUESS=sparc-sun-solaris3$SUN_REL
4558d0bc965Smrg	;;
456b042e37fSmrg    sun4*:SunOS:*:*)
4578d0bc965Smrg	case `/usr/bin/arch -k` in
458b042e37fSmrg	    Series*|S4*)
459b042e37fSmrg		UNAME_RELEASE=`uname -v`
460b042e37fSmrg		;;
461b042e37fSmrg	esac
462b042e37fSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4638d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
4648d0bc965Smrg	GUESS=sparc-sun-sunos$SUN_REL
4658d0bc965Smrg	;;
466b042e37fSmrg    sun3*:SunOS:*:*)
4678d0bc965Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
4688d0bc965Smrg	;;
469b042e37fSmrg    sun*:*:4.2BSD:*)
470b042e37fSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4713169be4bSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4728d0bc965Smrg	case `/bin/arch` in
473b042e37fSmrg	    sun3)
4748d0bc965Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475b042e37fSmrg		;;
476b042e37fSmrg	    sun4)
4778d0bc965Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478b042e37fSmrg		;;
479b042e37fSmrg	esac
4808d0bc965Smrg	;;
481b042e37fSmrg    aushp:SunOS:*:*)
4828d0bc965Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
4838d0bc965Smrg	;;
484b042e37fSmrg    # The situation for MiNT is a little confusing.  The machine name
485b042e37fSmrg    # can be virtually everything (everything which is not
486b042e37fSmrg    # "atarist" or "atariste" at least should have a processor
487b042e37fSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488b042e37fSmrg    # to the lowercase version "mint" (or "freemint").  Finally
489b042e37fSmrg    # the system name "TOS" denotes a system which is actually not
490b042e37fSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491b042e37fSmrg    # be no problem.
492b042e37fSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4938d0bc965Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4948d0bc965Smrg	;;
495b042e37fSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4968d0bc965Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4978d0bc965Smrg	;;
498b042e37fSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4998d0bc965Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
5008d0bc965Smrg	;;
501b042e37fSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
5028d0bc965Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
5038d0bc965Smrg	;;
504b042e37fSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
5058d0bc965Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
5068d0bc965Smrg	;;
507b042e37fSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
5088d0bc965Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
5098d0bc965Smrg	;;
5108c4a8e55Smrg    m68k:machten:*:*)
5118d0bc965Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
5128d0bc965Smrg	;;
513b042e37fSmrg    powerpc:machten:*:*)
5148d0bc965Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
5158d0bc965Smrg	;;
516b042e37fSmrg    RISC*:Mach:*:*)
5178d0bc965Smrg	GUESS=mips-dec-mach_bsd4.3
5188d0bc965Smrg	;;
519b042e37fSmrg    RISC*:ULTRIX:*:*)
5208d0bc965Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
5218d0bc965Smrg	;;
522b042e37fSmrg    VAX*:ULTRIX*:*:*)
5238d0bc965Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
5248d0bc965Smrg	;;
525b042e37fSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
5268d0bc965Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
5278d0bc965Smrg	;;
528b042e37fSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
5298d0bc965Smrg	set_cc_for_build
5303169be4bSmrg	sed 's/^	//' << EOF > "$dummy.c"
531b042e37fSmrg#ifdef __cplusplus
532b042e37fSmrg#include <stdio.h>  /* for printf() prototype */
533b042e37fSmrg	int main (int argc, char *argv[]) {
534b042e37fSmrg#else
535b042e37fSmrg	int main (argc, argv) int argc; char *argv[]; {
536b042e37fSmrg#endif
537b042e37fSmrg	#if defined (host_mips) && defined (MIPSEB)
538b042e37fSmrg	#if defined (SYSTYPE_SYSV)
5393169be4bSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540b042e37fSmrg	#endif
541b042e37fSmrg	#if defined (SYSTYPE_SVR4)
5423169be4bSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543b042e37fSmrg	#endif
544b042e37fSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5453169be4bSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546b042e37fSmrg	#endif
547b042e37fSmrg	#endif
548b042e37fSmrg	  exit (-1);
549b042e37fSmrg	}
550b042e37fSmrgEOF
5513169be4bSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5523169be4bSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5533169be4bSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5548c4a8e55Smrg	    { echo "$SYSTEM_NAME"; exit; }
5558d0bc965Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
5568d0bc965Smrg	;;
557b042e37fSmrg    Motorola:PowerMAX_OS:*:*)
5588d0bc965Smrg	GUESS=powerpc-motorola-powermax
5598d0bc965Smrg	;;
560b042e37fSmrg    Motorola:*:4.3:PL8-*)
5618d0bc965Smrg	GUESS=powerpc-harris-powermax
5628d0bc965Smrg	;;
563b042e37fSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5648d0bc965Smrg	GUESS=powerpc-harris-powermax
5658d0bc965Smrg	;;
566b042e37fSmrg    Night_Hawk:Power_UNIX:*:*)
5678d0bc965Smrg	GUESS=powerpc-harris-powerunix
5688d0bc965Smrg	;;
569b042e37fSmrg    m88k:CX/UX:7*:*)
5708d0bc965Smrg	GUESS=m88k-harris-cxux7
5718d0bc965Smrg	;;
572b042e37fSmrg    m88k:*:4*:R4*)
5738d0bc965Smrg	GUESS=m88k-motorola-sysv4
5748d0bc965Smrg	;;
575b042e37fSmrg    m88k:*:3*:R3*)
5768d0bc965Smrg	GUESS=m88k-motorola-sysv3
5778d0bc965Smrg	;;
578b042e37fSmrg    AViiON:dgux:*:*)
5790597fb56Smrg	# DG/UX returns AViiON for all architectures
5800597fb56Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5818d0bc965Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582b042e37fSmrg	then
5838d0bc965Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5848d0bc965Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
585b042e37fSmrg	    then
5868d0bc965Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587b042e37fSmrg	    else
5888d0bc965Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589b042e37fSmrg	    fi
590b042e37fSmrg	else
5918d0bc965Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592b042e37fSmrg	fi
5938d0bc965Smrg	;;
594b042e37fSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5958d0bc965Smrg	GUESS=m88k-dolphin-sysv3
5968d0bc965Smrg	;;
597b042e37fSmrg    M88*:*:R3*:*)
598b042e37fSmrg	# Delta 88k system running SVR3
5998d0bc965Smrg	GUESS=m88k-motorola-sysv3
6008d0bc965Smrg	;;
601b042e37fSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
6028d0bc965Smrg	GUESS=m88k-tektronix-sysv3
6038d0bc965Smrg	;;
604b042e37fSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
6058d0bc965Smrg	GUESS=m68k-tektronix-bsd
6068d0bc965Smrg	;;
607b042e37fSmrg    *:IRIX*:*:*)
6088d0bc965Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
6098d0bc965Smrg	GUESS=mips-sgi-irix$IRIX_REL
6108d0bc965Smrg	;;
611b042e37fSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
6128d0bc965Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
6138d0bc965Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614b042e37fSmrg    i*86:AIX:*:*)
6158d0bc965Smrg	GUESS=i386-ibm-aix
6168d0bc965Smrg	;;
617b042e37fSmrg    ia64:AIX:*:*)
6188d0bc965Smrg	if test -x /usr/bin/oslevel ; then
619b042e37fSmrg		IBM_REV=`/usr/bin/oslevel`
620b042e37fSmrg	else
6218d0bc965Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622b042e37fSmrg	fi
6238d0bc965Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
6248d0bc965Smrg	;;
625b042e37fSmrg    *:AIX:2:3)
626b042e37fSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6278d0bc965Smrg		set_cc_for_build
6283169be4bSmrg		sed 's/^		//' << EOF > "$dummy.c"
629b042e37fSmrg		#include <sys/systemcfg.h>
630b042e37fSmrg
631b042e37fSmrg		main()
632b042e37fSmrg			{
633b042e37fSmrg			if (!__power_pc())
634b042e37fSmrg				exit(1);
635b042e37fSmrg			puts("powerpc-ibm-aix3.2.5");
636b042e37fSmrg			exit(0);
637b042e37fSmrg			}
638b042e37fSmrgEOF
6393169be4bSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6408c4a8e55Smrg		then
6418d0bc965Smrg			GUESS=$SYSTEM_NAME
6428c4a8e55Smrg		else
6438d0bc965Smrg			GUESS=rs6000-ibm-aix3.2.5
6448c4a8e55Smrg		fi
645b042e37fSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6468d0bc965Smrg		GUESS=rs6000-ibm-aix3.2.4
647b042e37fSmrg	else
6488d0bc965Smrg		GUESS=rs6000-ibm-aix3.2
649b042e37fSmrg	fi
6508d0bc965Smrg	;;
651706b6b52Smrg    *:AIX:*:[4567])
652b042e37fSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6533169be4bSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654b042e37fSmrg		IBM_ARCH=rs6000
655b042e37fSmrg	else
656b042e37fSmrg		IBM_ARCH=powerpc
657b042e37fSmrg	fi
6588d0bc965Smrg	if test -x /usr/bin/lslpp ; then
6598d0bc965Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6603169be4bSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661b042e37fSmrg	else
6628d0bc965Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663b042e37fSmrg	fi
6648d0bc965Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
6658d0bc965Smrg	;;
666b042e37fSmrg    *:AIX:*:*)
6678d0bc965Smrg	GUESS=rs6000-ibm-aix
6688d0bc965Smrg	;;
6693169be4bSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6708d0bc965Smrg	GUESS=romp-ibm-bsd4.4
6718d0bc965Smrg	;;
672b042e37fSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6738d0bc965Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
6748d0bc965Smrg	;;                                  # report: romp-ibm BSD 4.3
675b042e37fSmrg    *:BOSX:*:*)
6768d0bc965Smrg	GUESS=rs6000-bull-bosx
6778d0bc965Smrg	;;
678b042e37fSmrg    DPX/2?00:B.O.S.:*:*)
6798d0bc965Smrg	GUESS=m68k-bull-sysv3
6808d0bc965Smrg	;;
681b042e37fSmrg    9000/[34]??:4.3bsd:1.*:*)
6828d0bc965Smrg	GUESS=m68k-hp-bsd
6838d0bc965Smrg	;;
684b042e37fSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6858d0bc965Smrg	GUESS=m68k-hp-bsd4.4
6868d0bc965Smrg	;;
687b042e37fSmrg    9000/[34678]??:HP-UX:*:*)
6888d0bc965Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
6898d0bc965Smrg	case $UNAME_MACHINE in
6903169be4bSmrg	    9000/31?)            HP_ARCH=m68000 ;;
6913169be4bSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
692b042e37fSmrg	    9000/[678][0-9][0-9])
6938d0bc965Smrg		if test -x /usr/bin/getconf; then
694b042e37fSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6950597fb56Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6968d0bc965Smrg		    case $sc_cpu_version in
6973169be4bSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6983169be4bSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6990597fb56Smrg		      532)                      # CPU_PA_RISC2_0
7008d0bc965Smrg			case $sc_kernel_bits in
7013169be4bSmrg			  32) HP_ARCH=hppa2.0n ;;
7023169be4bSmrg			  64) HP_ARCH=hppa2.0w ;;
7033169be4bSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7040597fb56Smrg			esac ;;
7050597fb56Smrg		    esac
706b042e37fSmrg		fi
7078d0bc965Smrg		if test "$HP_ARCH" = ""; then
7088d0bc965Smrg		    set_cc_for_build
7093169be4bSmrg		    sed 's/^		//' << EOF > "$dummy.c"
710b042e37fSmrg
7110597fb56Smrg		#define _HPUX_SOURCE
7120597fb56Smrg		#include <stdlib.h>
7130597fb56Smrg		#include <unistd.h>
714b042e37fSmrg
7150597fb56Smrg		int main ()
7160597fb56Smrg		{
7170597fb56Smrg		#if defined(_SC_KERNEL_BITS)
7180597fb56Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
7190597fb56Smrg		#endif
7200597fb56Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721b042e37fSmrg
7220597fb56Smrg		    switch (cpu)
7230597fb56Smrg			{
7240597fb56Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7250597fb56Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7260597fb56Smrg			case CPU_PA_RISC2_0:
7270597fb56Smrg		#if defined(_SC_KERNEL_BITS)
7280597fb56Smrg			    switch (bits)
7290597fb56Smrg				{
7300597fb56Smrg				case 64: puts ("hppa2.0w"); break;
7310597fb56Smrg				case 32: puts ("hppa2.0n"); break;
7320597fb56Smrg				default: puts ("hppa2.0"); break;
7330597fb56Smrg				} break;
7340597fb56Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
7350597fb56Smrg			    puts ("hppa2.0"); break;
7360597fb56Smrg		#endif
7370597fb56Smrg			default: puts ("hppa1.0"); break;
7380597fb56Smrg			}
7390597fb56Smrg		    exit (0);
7400597fb56Smrg		}
741b042e37fSmrgEOF
7423169be4bSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743b042e37fSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744b042e37fSmrg		fi ;;
745b042e37fSmrg	esac
7468d0bc965Smrg	if test "$HP_ARCH" = hppa2.0w
747b042e37fSmrg	then
7488d0bc965Smrg	    set_cc_for_build
7498c4a8e55Smrg
7508c4a8e55Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7518c4a8e55Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7528c4a8e55Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7538c4a8e55Smrg	    #
7548c4a8e55Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
7558c4a8e55Smrg	    # => hppa2.0w-hp-hpux11.23
7568c4a8e55Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7578c4a8e55Smrg	    # => hppa64-hp-hpux11.23
7588c4a8e55Smrg
7593169be4bSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760706b6b52Smrg		grep -q __LP64__
761b042e37fSmrg	    then
7623169be4bSmrg		HP_ARCH=hppa2.0w
763b042e37fSmrg	    else
7643169be4bSmrg		HP_ARCH=hppa64
765b042e37fSmrg	    fi
766b042e37fSmrg	fi
7678d0bc965Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
7688d0bc965Smrg	;;
769b042e37fSmrg    ia64:HP-UX:*:*)
7708d0bc965Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
7718d0bc965Smrg	GUESS=ia64-hp-hpux$HPUX_REV
7728d0bc965Smrg	;;
773b042e37fSmrg    3050*:HI-UX:*:*)
7748d0bc965Smrg	set_cc_for_build
7753169be4bSmrg	sed 's/^	//' << EOF > "$dummy.c"
776b042e37fSmrg	#include <unistd.h>
777b042e37fSmrg	int
778b042e37fSmrg	main ()
779b042e37fSmrg	{
780b042e37fSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
781b042e37fSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782b042e37fSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783b042e37fSmrg	     results, however.  */
784b042e37fSmrg	  if (CPU_IS_PA_RISC (cpu))
785b042e37fSmrg	    {
786b042e37fSmrg	      switch (cpu)
787b042e37fSmrg		{
788b042e37fSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789b042e37fSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790b042e37fSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791b042e37fSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792b042e37fSmrg		}
793b042e37fSmrg	    }
794b042e37fSmrg	  else if (CPU_IS_HP_MC68K (cpu))
795b042e37fSmrg	    puts ("m68k-hitachi-hiuxwe2");
796b042e37fSmrg	  else puts ("unknown-hitachi-hiuxwe2");
797b042e37fSmrg	  exit (0);
798b042e37fSmrg	}
799b042e37fSmrgEOF
8003169be4bSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8018c4a8e55Smrg		{ echo "$SYSTEM_NAME"; exit; }
8028d0bc965Smrg	GUESS=unknown-hitachi-hiuxwe2
8038d0bc965Smrg	;;
8043169be4bSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
8058d0bc965Smrg	GUESS=hppa1.1-hp-bsd
8068d0bc965Smrg	;;
807b042e37fSmrg    9000/8??:4.3bsd:*:*)
8088d0bc965Smrg	GUESS=hppa1.0-hp-bsd
8098d0bc965Smrg	;;
810b042e37fSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
8118d0bc965Smrg	GUESS=hppa1.0-hp-mpeix
8128d0bc965Smrg	;;
8133169be4bSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
8148d0bc965Smrg	GUESS=hppa1.1-hp-osf
8158d0bc965Smrg	;;
816b042e37fSmrg    hp8??:OSF1:*:*)
8178d0bc965Smrg	GUESS=hppa1.0-hp-osf
8188d0bc965Smrg	;;
819b042e37fSmrg    i*86:OSF1:*:*)
8208d0bc965Smrg	if test -x /usr/sbin/sysversion ; then
8218d0bc965Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822b042e37fSmrg	else
8238d0bc965Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824b042e37fSmrg	fi
8258d0bc965Smrg	;;
826b042e37fSmrg    parisc*:Lites*:*:*)
8278d0bc965Smrg	GUESS=hppa1.1-hp-lites
8288d0bc965Smrg	;;
829b042e37fSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
8308d0bc965Smrg	GUESS=c1-convex-bsd
8318d0bc965Smrg	;;
832b042e37fSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833b042e37fSmrg	if getsysinfo -f scalar_acc
834b042e37fSmrg	then echo c32-convex-bsd
835b042e37fSmrg	else echo c2-convex-bsd
836b042e37fSmrg	fi
8370597fb56Smrg	exit ;;
838b042e37fSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8398d0bc965Smrg	GUESS=c34-convex-bsd
8408d0bc965Smrg	;;
841b042e37fSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8428d0bc965Smrg	GUESS=c38-convex-bsd
8438d0bc965Smrg	;;
844b042e37fSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8458d0bc965Smrg	GUESS=c4-convex-bsd
8468d0bc965Smrg	;;
847b042e37fSmrg    CRAY*Y-MP:*:*:*)
8488d0bc965Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8498d0bc965Smrg	GUESS=ymp-cray-unicos$CRAY_REL
8508d0bc965Smrg	;;
851b042e37fSmrg    CRAY*[A-Z]90:*:*:*)
8523169be4bSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853b042e37fSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854b042e37fSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855b042e37fSmrg	      -e 's/\.[^.]*$/.X/'
8568c4a8e55Smrg	exit ;;
857b042e37fSmrg    CRAY*TS:*:*:*)
8588d0bc965Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8598d0bc965Smrg	GUESS=t90-cray-unicos$CRAY_REL
8608d0bc965Smrg	;;
861b042e37fSmrg    CRAY*T3E:*:*:*)
8628d0bc965Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8638d0bc965Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
8648d0bc965Smrg	;;
865b042e37fSmrg    CRAY*SV1:*:*:*)
8668d0bc965Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8678d0bc965Smrg	GUESS=sv1-cray-unicos$CRAY_REL
8688d0bc965Smrg	;;
869b042e37fSmrg    *:UNICOS/mp:*:*)
8708d0bc965Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8718d0bc965Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
8728d0bc965Smrg	;;
873b042e37fSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8743169be4bSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8753169be4bSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8763169be4bSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8778d0bc965Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8788d0bc965Smrg	;;
8798c4a8e55Smrg    5000:UNIX_System_V:4.*:*)
8803169be4bSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8813169be4bSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8828d0bc965Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8838d0bc965Smrg	;;
884b042e37fSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8858d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
8868d0bc965Smrg	;;
887b042e37fSmrg    sparc*:BSD/OS:*:*)
8888d0bc965Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
8898d0bc965Smrg	;;
890b042e37fSmrg    *:BSD/OS:*:*)
8918d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
8928d0bc965Smrg	;;
8938d0bc965Smrg    arm:FreeBSD:*:*)
8948d0bc965Smrg	UNAME_PROCESSOR=`uname -p`
8958d0bc965Smrg	set_cc_for_build
8968d0bc965Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8978d0bc965Smrg	    | grep -q __ARM_PCS_VFP
8988d0bc965Smrg	then
8998d0bc965Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9008d0bc965Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9018d0bc965Smrg	else
9028d0bc965Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9038d0bc965Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9048d0bc965Smrg	fi
9058d0bc965Smrg	;;
9068c4a8e55Smrg    *:FreeBSD:*:*)
9070597fb56Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
9088d0bc965Smrg	case $UNAME_PROCESSOR in
9098c4a8e55Smrg	    amd64)
9103169be4bSmrg		UNAME_PROCESSOR=x86_64 ;;
9113169be4bSmrg	    i386)
9123169be4bSmrg		UNAME_PROCESSOR=i586 ;;
9138c4a8e55Smrg	esac
9148d0bc965Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9158d0bc965Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
9168d0bc965Smrg	;;
917b042e37fSmrg    i*:CYGWIN*:*)
9188d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
9198d0bc965Smrg	;;
9208bd17e5fSmrg    *:MINGW64*:*)
9218d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
9228d0bc965Smrg	;;
923706b6b52Smrg    *:MINGW*:*)
9248d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
9258d0bc965Smrg	;;
9263169be4bSmrg    *:MSYS*:*)
9278d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-msys
9288d0bc965Smrg	;;
929b042e37fSmrg    i*:PW*:*)
9308d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-pw32
9318d0bc965Smrg	;;
9320c674dbdSmrg    *:SerenityOS:*:*)
9330c674dbdSmrg        GUESS=$UNAME_MACHINE-pc-serenity
9340c674dbdSmrg        ;;
935706b6b52Smrg    *:Interix*:*)
9368d0bc965Smrg	case $UNAME_MACHINE in
937706b6b52Smrg	    x86)
9388d0bc965Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
9398d0bc965Smrg		;;
940706b6b52Smrg	    authenticamd | genuineintel | EM64T)
9418d0bc965Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
9428d0bc965Smrg		;;
943706b6b52Smrg	    IA64)
9448d0bc965Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
9458d0bc965Smrg		;;
946706b6b52Smrg	esac ;;
947b042e37fSmrg    i*:UWIN*:*)
9488d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-uwin
9498d0bc965Smrg	;;
9508c4a8e55Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9518d0bc965Smrg	GUESS=x86_64-pc-cygwin
9528d0bc965Smrg	;;
953b042e37fSmrg    prep*:SunOS:5.*:*)
9548d0bc965Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
9558d0bc965Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
9568d0bc965Smrg	;;
957b042e37fSmrg    *:GNU:*:*)
9588c4a8e55Smrg	# the GNU system
9598d0bc965Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
9608d0bc965Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
9618d0bc965Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
9628d0bc965Smrg	;;
9638c4a8e55Smrg    *:GNU/*:*:*)
9648c4a8e55Smrg	# other systems with GNU libc and userland
9658d0bc965Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
9668d0bc965Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9678d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
9688d0bc965Smrg	;;
9690c674dbdSmrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
9700c674dbdSmrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
9710c674dbdSmrg	;;
9720c674dbdSmrg    *:[Mm]anagarm:*:*)
9730c674dbdSmrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
9740c674dbdSmrg	;;
9758d0bc965Smrg    *:Minix:*:*)
9768d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-minix
9778d0bc965Smrg	;;
9788bd17e5fSmrg    aarch64:Linux:*:*)
9798d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9808d0bc965Smrg	;;
9818bd17e5fSmrg    aarch64_be:Linux:*:*)
9828bd17e5fSmrg	UNAME_MACHINE=aarch64_be
9838d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9848d0bc965Smrg	;;
985706b6b52Smrg    alpha:Linux:*:*)
9868d0bc965Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
987706b6b52Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
988706b6b52Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
989706b6b52Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
990706b6b52Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
991706b6b52Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
992706b6b52Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
993706b6b52Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9940597fb56Smrg	esac
995706b6b52Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9963169be4bSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9978d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9988d0bc965Smrg	;;
9998d0bc965Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
10008d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10018d0bc965Smrg	;;
1002b042e37fSmrg    arm*:Linux:*:*)
10038d0bc965Smrg	set_cc_for_build
1004706b6b52Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1005706b6b52Smrg	    | grep -q __ARM_EABI__
1006706b6b52Smrg	then
10078d0bc965Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1008706b6b52Smrg	else
10090597fb56Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10100597fb56Smrg		| grep -q __ARM_PCS_VFP
10110597fb56Smrg	    then
10128d0bc965Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10130597fb56Smrg	    else
10148d0bc965Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10150597fb56Smrg	    fi
1016706b6b52Smrg	fi
10178d0bc965Smrg	;;
10188c4a8e55Smrg    avr32*:Linux:*:*)
10198d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10208d0bc965Smrg	;;
1021b042e37fSmrg    cris:Linux:*:*)
10228d0bc965Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10238d0bc965Smrg	;;
10248c4a8e55Smrg    crisv32:Linux:*:*)
10258d0bc965Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10268d0bc965Smrg	;;
10273169be4bSmrg    e2k:Linux:*:*)
10288d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10298d0bc965Smrg	;;
10308c4a8e55Smrg    frv:Linux:*:*)
10318d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10328d0bc965Smrg	;;
10330597fb56Smrg    hexagon:Linux:*:*)
10348d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10358d0bc965Smrg	;;
1036706b6b52Smrg    i*86:Linux:*:*)
10378d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
10388d0bc965Smrg	;;
1039b042e37fSmrg    ia64:Linux:*:*)
10408d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10418d0bc965Smrg	;;
10423169be4bSmrg    k1om:Linux:*:*)
10438d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10448d0bc965Smrg	;;
10450c674dbdSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
10468d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10478d0bc965Smrg	;;
10488c4a8e55Smrg    m32r*:Linux:*:*)
10498d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10508d0bc965Smrg	;;
1051b042e37fSmrg    m68*:Linux:*:*)
10528d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10538d0bc965Smrg	;;
1054706b6b52Smrg    mips:Linux:*:* | mips64:Linux:*:*)
10558d0bc965Smrg	set_cc_for_build
10568d0bc965Smrg	IS_GLIBC=0
10578d0bc965Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10583169be4bSmrg	sed 's/^	//' << EOF > "$dummy.c"
1059b042e37fSmrg	#undef CPU
10608d0bc965Smrg	#undef mips
10618d0bc965Smrg	#undef mipsel
10628d0bc965Smrg	#undef mips64
10638d0bc965Smrg	#undef mips64el
10648d0bc965Smrg	#if ${IS_GLIBC} && defined(_ABI64)
10658d0bc965Smrg	LIBCABI=gnuabi64
10668d0bc965Smrg	#else
10678d0bc965Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
10688d0bc965Smrg	LIBCABI=gnuabin32
10698d0bc965Smrg	#else
10708d0bc965Smrg	LIBCABI=${LIBC}
10718d0bc965Smrg	#endif
10728d0bc965Smrg	#endif
10738d0bc965Smrg
10748d0bc965Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10758d0bc965Smrg	CPU=mipsisa64r6
10768d0bc965Smrg	#else
10778d0bc965Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10788d0bc965Smrg	CPU=mipsisa32r6
10798d0bc965Smrg	#else
10808d0bc965Smrg	#if defined(__mips64)
10818d0bc965Smrg	CPU=mips64
10828d0bc965Smrg	#else
10838d0bc965Smrg	CPU=mips
10848d0bc965Smrg	#endif
10858d0bc965Smrg	#endif
10868d0bc965Smrg	#endif
10878d0bc965Smrg
1088b042e37fSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10898d0bc965Smrg	MIPS_ENDIAN=el
1090b042e37fSmrg	#else
1091b042e37fSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10928d0bc965Smrg	MIPS_ENDIAN=
1093b042e37fSmrg	#else
10948d0bc965Smrg	MIPS_ENDIAN=
1095b042e37fSmrg	#endif
1096b042e37fSmrg	#endif
1097b042e37fSmrgEOF
10988d0bc965Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
10998d0bc965Smrg	eval "$cc_set_vars"
11008d0bc965Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1101b042e37fSmrg	;;
11023169be4bSmrg    mips64el:Linux:*:*)
11038d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11048d0bc965Smrg	;;
11053169be4bSmrg    openrisc*:Linux:*:*)
11068d0bc965Smrg	GUESS=or1k-unknown-linux-$LIBC
11078d0bc965Smrg	;;
11083169be4bSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
11098d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11108d0bc965Smrg	;;
1111706b6b52Smrg    padre:Linux:*:*)
11128d0bc965Smrg	GUESS=sparc-unknown-linux-$LIBC
11138d0bc965Smrg	;;
1114706b6b52Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
11158d0bc965Smrg	GUESS=hppa64-unknown-linux-$LIBC
11168d0bc965Smrg	;;
1117b042e37fSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
1118b042e37fSmrg	# Look for CPU level
1119b042e37fSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
11208d0bc965Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
11218d0bc965Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
11228d0bc965Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1123b042e37fSmrg	esac
11248d0bc965Smrg	;;
1125706b6b52Smrg    ppc64:Linux:*:*)
11268d0bc965Smrg	GUESS=powerpc64-unknown-linux-$LIBC
11278d0bc965Smrg	;;
1128706b6b52Smrg    ppc:Linux:*:*)
11298d0bc965Smrg	GUESS=powerpc-unknown-linux-$LIBC
11308d0bc965Smrg	;;
1131fc98c8e2Smrg    ppc64le:Linux:*:*)
11328d0bc965Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
11338d0bc965Smrg	;;
1134fc98c8e2Smrg    ppcle:Linux:*:*)
11358d0bc965Smrg	GUESS=powerpcle-unknown-linux-$LIBC
11368d0bc965Smrg	;;
11378d0bc965Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
11388d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11398d0bc965Smrg	;;
1140b042e37fSmrg    s390:Linux:*:* | s390x:Linux:*:*)
11418d0bc965Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
11428d0bc965Smrg	;;
1143b042e37fSmrg    sh64*:Linux:*:*)
11448d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11458d0bc965Smrg	;;
1146b042e37fSmrg    sh*:Linux:*:*)
11478d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11488d0bc965Smrg	;;
1149b042e37fSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
11508d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11518d0bc965Smrg	;;
1152706b6b52Smrg    tile*:Linux:*:*)
11538d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11548d0bc965Smrg	;;
11558c4a8e55Smrg    vax:Linux:*:*)
11568d0bc965Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
11578d0bc965Smrg	;;
1158b042e37fSmrg    x86_64:Linux:*:*)
11598d0bc965Smrg	set_cc_for_build
11600c674dbdSmrg	CPU=$UNAME_MACHINE
11618d0bc965Smrg	LIBCABI=$LIBC
11628d0bc965Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11630c674dbdSmrg	    ABI=64
11640c674dbdSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
11650c674dbdSmrg	    #ifdef __i386__
11660c674dbdSmrg	    ABI=x86
11670c674dbdSmrg	    #else
11680c674dbdSmrg	    #ifdef __ILP32__
11690c674dbdSmrg	    ABI=x32
11700c674dbdSmrg	    #endif
11710c674dbdSmrg	    #endif
11720c674dbdSmrgEOF
11730c674dbdSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
11740c674dbdSmrg	    eval "$cc_set_abi"
11750c674dbdSmrg	    case $ABI in
11760c674dbdSmrg		x86) CPU=i686 ;;
11770c674dbdSmrg		x32) LIBCABI=${LIBC}x32 ;;
11780c674dbdSmrg	    esac
11798d0bc965Smrg	fi
11800c674dbdSmrg	GUESS=$CPU-pc-linux-$LIBCABI
11818d0bc965Smrg	;;
1182706b6b52Smrg    xtensa*:Linux:*:*)
11838d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11848d0bc965Smrg	;;
1185b042e37fSmrg    i*86:DYNIX/ptx:4*:*)
1186b042e37fSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1187b042e37fSmrg	# earlier versions are messed up and put the nodename in both
1188b042e37fSmrg	# sysname and nodename.
11898d0bc965Smrg	GUESS=i386-sequent-sysv4
11908d0bc965Smrg	;;
1191b042e37fSmrg    i*86:UNIX_SV:4.2MP:2.*)
11920597fb56Smrg	# Unixware is an offshoot of SVR4, but it has its own version
11930597fb56Smrg	# number series starting with 2...
11940597fb56Smrg	# I am not positive that other SVR4 systems won't match this,
1195b042e37fSmrg	# I just have to hope.  -- rms.
11960597fb56Smrg	# Use sysv4.2uw... so that sysv4* matches it.
11978d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
11988d0bc965Smrg	;;
1199b042e37fSmrg    i*86:OS/2:*:*)
1200b042e37fSmrg	# If we were able to find `uname', then EMX Unix compatibility
1201b042e37fSmrg	# is probably installed.
12028d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
12038d0bc965Smrg	;;
1204b042e37fSmrg    i*86:XTS-300:*:STOP)
12058d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-stop
12068d0bc965Smrg	;;
1207b042e37fSmrg    i*86:atheos:*:*)
12088d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
12098d0bc965Smrg	;;
12108c4a8e55Smrg    i*86:syllable:*:*)
12118d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-syllable
12128d0bc965Smrg	;;
1213706b6b52Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
12148d0bc965Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
12158d0bc965Smrg	;;
1216b042e37fSmrg    i*86:*DOS:*:*)
12178d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
12188d0bc965Smrg	;;
12193169be4bSmrg    i*86:*:4.*:*)
12203169be4bSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1221b042e37fSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
12228d0bc965Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1223b042e37fSmrg	else
12248d0bc965Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1225b042e37fSmrg	fi
12268d0bc965Smrg	;;
12278c4a8e55Smrg    i*86:*:5:[678]*)
12280597fb56Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1229b042e37fSmrg	case `/bin/uname -X | grep "^Machine"` in
1230b042e37fSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1231b042e37fSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1232b042e37fSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1233b042e37fSmrg	esac
12348d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
12358d0bc965Smrg	;;
1236b042e37fSmrg    i*86:*:3.2:*)
1237b042e37fSmrg	if test -f /usr/options/cb.name; then
1238b042e37fSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
12398d0bc965Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1240b042e37fSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1241b042e37fSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1242b042e37fSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1243b042e37fSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1244b042e37fSmrg			&& UNAME_MACHINE=i586
1245b042e37fSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1246b042e37fSmrg			&& UNAME_MACHINE=i686
1247b042e37fSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1248b042e37fSmrg			&& UNAME_MACHINE=i686
12498d0bc965Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1250b042e37fSmrg	else
12518d0bc965Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
1252b042e37fSmrg	fi
12538d0bc965Smrg	;;
1254b042e37fSmrg    pc:*:*:*)
1255b042e37fSmrg	# Left here for compatibility:
12560597fb56Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12570597fb56Smrg	# the processor, so we play safe by assuming i586.
1258706b6b52Smrg	# Note: whatever this is, it MUST be the same as what config.sub
12593169be4bSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1260706b6b52Smrg	# this is a cross-build.
12618d0bc965Smrg	GUESS=i586-pc-msdosdjgpp
12628d0bc965Smrg	;;
1263b042e37fSmrg    Intel:Mach:3*:*)
12648d0bc965Smrg	GUESS=i386-pc-mach3
12658d0bc965Smrg	;;
1266b042e37fSmrg    paragon:*:*:*)
12678d0bc965Smrg	GUESS=i860-intel-osf1
12688d0bc965Smrg	;;
1269b042e37fSmrg    i860:*:4.*:*) # i860-SVR4
1270b042e37fSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
12718d0bc965Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1272b042e37fSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
12738d0bc965Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1274b042e37fSmrg	fi
12758d0bc965Smrg	;;
1276b042e37fSmrg    mini*:CTIX:SYS*5:*)
1277b042e37fSmrg	# "miniframe"
12788d0bc965Smrg	GUESS=m68010-convergent-sysv
12798d0bc965Smrg	;;
1280b042e37fSmrg    mc68k:UNIX:SYSTEM5:3.51m)
12818d0bc965Smrg	GUESS=m68k-convergent-sysv
12828d0bc965Smrg	;;
1283b042e37fSmrg    M680?0:D-NIX:5.3:*)
12848d0bc965Smrg	GUESS=m68k-diab-dnix
12858d0bc965Smrg	;;
12868c4a8e55Smrg    M68*:*:R3V[5678]*:*)
12878c4a8e55Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12888c4a8e55Smrg    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)
1289b042e37fSmrg	OS_REL=''
1290b042e37fSmrg	test -r /etc/.relid \
1291b042e37fSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1292b042e37fSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12933169be4bSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1294b042e37fSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12953169be4bSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1296b042e37fSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12970597fb56Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12980597fb56Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1299706b6b52Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1300706b6b52Smrg	OS_REL='.3'
1301706b6b52Smrg	test -r /etc/.relid \
1302706b6b52Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1303706b6b52Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
13043169be4bSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1305706b6b52Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
13063169be4bSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1307706b6b52Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
13083169be4bSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1309b042e37fSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
13108d0bc965Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
13118d0bc965Smrg	;;
1312b042e37fSmrg    mc68030:UNIX_System_V:4.*:*)
13138d0bc965Smrg	GUESS=m68k-atari-sysv4
13148d0bc965Smrg	;;
1315b042e37fSmrg    TSUNAMI:LynxOS:2.*:*)
13168d0bc965Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
13178d0bc965Smrg	;;
1318b042e37fSmrg    rs6000:LynxOS:2.*:*)
13198d0bc965Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
13208d0bc965Smrg	;;
1321706b6b52Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
13228d0bc965Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
13238d0bc965Smrg	;;
1324b042e37fSmrg    SM[BE]S:UNIX_SV:*:*)
13258d0bc965Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
13268d0bc965Smrg	;;
1327b042e37fSmrg    RM*:ReliantUNIX-*:*:*)
13288d0bc965Smrg	GUESS=mips-sni-sysv4
13298d0bc965Smrg	;;
1330b042e37fSmrg    RM*:SINIX-*:*:*)
13318d0bc965Smrg	GUESS=mips-sni-sysv4
13328d0bc965Smrg	;;
1333b042e37fSmrg    *:SINIX-*:*:*)
1334b042e37fSmrg	if uname -p 2>/dev/null >/dev/null ; then
1335b042e37fSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
13368d0bc965Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
1337b042e37fSmrg	else
13388d0bc965Smrg		GUESS=ns32k-sni-sysv
1339b042e37fSmrg	fi
13408d0bc965Smrg	;;
13410597fb56Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13420597fb56Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
13438d0bc965Smrg	GUESS=i586-unisys-sysv4
13448d0bc965Smrg	;;
1345b042e37fSmrg    *:UNIX_System_V:4*:FTX*)
1346b042e37fSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1347b042e37fSmrg	# How about differentiating between stratus architectures? -djm
13488d0bc965Smrg	GUESS=hppa1.1-stratus-sysv4
13498d0bc965Smrg	;;
1350b042e37fSmrg    *:*:*:FTX*)
1351b042e37fSmrg	# From seanf@swdc.stratus.com.
13528d0bc965Smrg	GUESS=i860-stratus-sysv4
13538d0bc965Smrg	;;
13548c4a8e55Smrg    i*86:VOS:*:*)
13558c4a8e55Smrg	# From Paul.Green@stratus.com.
13568d0bc965Smrg	GUESS=$UNAME_MACHINE-stratus-vos
13578d0bc965Smrg	;;
1358b042e37fSmrg    *:VOS:*:*)
1359b042e37fSmrg	# From Paul.Green@stratus.com.
13608d0bc965Smrg	GUESS=hppa1.1-stratus-vos
13618d0bc965Smrg	;;
1362b042e37fSmrg    mc68*:A/UX:*:*)
13638d0bc965Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
13648d0bc965Smrg	;;
1365b042e37fSmrg    news*:NEWS-OS:6*:*)
13668d0bc965Smrg	GUESS=mips-sony-newsos6
13678d0bc965Smrg	;;
1368b042e37fSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13698d0bc965Smrg	if test -d /usr/nec; then
13708d0bc965Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1371b042e37fSmrg	else
13728d0bc965Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1373b042e37fSmrg	fi
13748d0bc965Smrg	;;
1375b042e37fSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13768d0bc965Smrg	GUESS=powerpc-be-beos
13778d0bc965Smrg	;;
1378b042e37fSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13798d0bc965Smrg	GUESS=powerpc-apple-beos
13808d0bc965Smrg	;;
1381b042e37fSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13828d0bc965Smrg	GUESS=i586-pc-beos
13838d0bc965Smrg	;;
1384706b6b52Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13858d0bc965Smrg	GUESS=i586-pc-haiku
13868d0bc965Smrg	;;
13870c674dbdSmrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
13880c674dbdSmrg	GUESS=powerpc-apple-haiku
13890c674dbdSmrg	;;
13900c674dbdSmrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
13910c674dbdSmrg	GUESS=$UNAME_MACHINE-unknown-haiku
13928d0bc965Smrg	;;
1393b042e37fSmrg    SX-4:SUPER-UX:*:*)
13948d0bc965Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
13958d0bc965Smrg	;;
1396b042e37fSmrg    SX-5:SUPER-UX:*:*)
13978d0bc965Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
13988d0bc965Smrg	;;
1399b042e37fSmrg    SX-6:SUPER-UX:*:*)
14008d0bc965Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
14018d0bc965Smrg	;;
1402706b6b52Smrg    SX-7:SUPER-UX:*:*)
14038d0bc965Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
14048d0bc965Smrg	;;
1405706b6b52Smrg    SX-8:SUPER-UX:*:*)
14068d0bc965Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
14078d0bc965Smrg	;;
1408706b6b52Smrg    SX-8R:SUPER-UX:*:*)
14098d0bc965Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
14108d0bc965Smrg	;;
14113169be4bSmrg    SX-ACE:SUPER-UX:*:*)
14128d0bc965Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
14138d0bc965Smrg	;;
1414b042e37fSmrg    Power*:Rhapsody:*:*)
14158d0bc965Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
14168d0bc965Smrg	;;
1417b042e37fSmrg    *:Rhapsody:*:*)
14188d0bc965Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
14198d0bc965Smrg	;;
14208d0bc965Smrg    arm64:Darwin:*:*)
14218d0bc965Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
14228d0bc965Smrg	;;
1423b042e37fSmrg    *:Darwin:*:*)
14248d0bc965Smrg	UNAME_PROCESSOR=`uname -p`
14258d0bc965Smrg	case $UNAME_PROCESSOR in
14268d0bc965Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14278d0bc965Smrg	esac
14288d0bc965Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
14298d0bc965Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
14308d0bc965Smrg	    # Avoid executing cc if there is no toolchain installed as
14318d0bc965Smrg	    # cc will be a stub that puts up a graphical alert
14328d0bc965Smrg	    # prompting the user to install developer tools.
14338d0bc965Smrg	    CC_FOR_BUILD=no_compiler_found
14348d0bc965Smrg	else
14358d0bc965Smrg	    set_cc_for_build
1436fc98c8e2Smrg	fi
14378d0bc965Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14388d0bc965Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
14398d0bc965Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14408d0bc965Smrg		   grep IS_64BIT_ARCH >/dev/null
14418d0bc965Smrg	    then
14428d0bc965Smrg		case $UNAME_PROCESSOR in
14438d0bc965Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14448d0bc965Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14458d0bc965Smrg		esac
14468d0bc965Smrg	    fi
14478d0bc965Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
14488d0bc965Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
14498d0bc965Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14508d0bc965Smrg		   grep IS_PPC >/dev/null
14518d0bc965Smrg	    then
14528d0bc965Smrg		UNAME_PROCESSOR=powerpc
1453fc98c8e2Smrg	    fi
14543169be4bSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
14558d0bc965Smrg	    # uname -m returns i386 or x86_64
14568d0bc965Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1457fc98c8e2Smrg	fi
14588d0bc965Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
14598d0bc965Smrg	;;
1460b042e37fSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1461b042e37fSmrg	UNAME_PROCESSOR=`uname -p`
14623169be4bSmrg	if test "$UNAME_PROCESSOR" = x86; then
1463b042e37fSmrg		UNAME_PROCESSOR=i386
1464b042e37fSmrg		UNAME_MACHINE=pc
1465b042e37fSmrg	fi
14668d0bc965Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
14678d0bc965Smrg	;;
1468b042e37fSmrg    *:QNX:*:4*)
14698d0bc965Smrg	GUESS=i386-pc-qnx
14708d0bc965Smrg	;;
14713169be4bSmrg    NEO-*:NONSTOP_KERNEL:*:*)
14728d0bc965Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
14738d0bc965Smrg	;;
14748bd17e5fSmrg    NSE-*:NONSTOP_KERNEL:*:*)
14758d0bc965Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
14768d0bc965Smrg	;;
14773169be4bSmrg    NSR-*:NONSTOP_KERNEL:*:*)
14788d0bc965Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
14798d0bc965Smrg	;;
14803169be4bSmrg    NSV-*:NONSTOP_KERNEL:*:*)
14818d0bc965Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
14828d0bc965Smrg	;;
14833169be4bSmrg    NSX-*:NONSTOP_KERNEL:*:*)
14848d0bc965Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
14858d0bc965Smrg	;;
1486b042e37fSmrg    *:NonStop-UX:*:*)
14878d0bc965Smrg	GUESS=mips-compaq-nonstopux
14888d0bc965Smrg	;;
1489b042e37fSmrg    BS2000:POSIX*:*:*)
14908d0bc965Smrg	GUESS=bs2000-siemens-sysv
14918d0bc965Smrg	;;
1492b042e37fSmrg    DS/*:UNIX_System_V:*:*)
14938d0bc965Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
14948d0bc965Smrg	;;
1495b042e37fSmrg    *:Plan9:*:*)
1496b042e37fSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1497b042e37fSmrg	# is converted to i386 for consistency with other x86
1498b042e37fSmrg	# operating systems.
14998d0bc965Smrg	if test "${cputype-}" = 386; then
1500b042e37fSmrg	    UNAME_MACHINE=i386
15018d0bc965Smrg	elif test "x${cputype-}" != x; then
15028d0bc965Smrg	    UNAME_MACHINE=$cputype
1503b042e37fSmrg	fi
15048d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
15058d0bc965Smrg	;;
1506b042e37fSmrg    *:TOPS-10:*:*)
15078d0bc965Smrg	GUESS=pdp10-unknown-tops10
15088d0bc965Smrg	;;
1509b042e37fSmrg    *:TENEX:*:*)
15108d0bc965Smrg	GUESS=pdp10-unknown-tenex
15118d0bc965Smrg	;;
1512b042e37fSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
15138d0bc965Smrg	GUESS=pdp10-dec-tops20
15148d0bc965Smrg	;;
1515b042e37fSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
15168d0bc965Smrg	GUESS=pdp10-xkl-tops20
15178d0bc965Smrg	;;
1518b042e37fSmrg    *:TOPS-20:*:*)
15198d0bc965Smrg	GUESS=pdp10-unknown-tops20
15208d0bc965Smrg	;;
1521b042e37fSmrg    *:ITS:*:*)
15228d0bc965Smrg	GUESS=pdp10-unknown-its
15238d0bc965Smrg	;;
1524b042e37fSmrg    SEI:*:*:SEIUX)
15258d0bc965Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
15268d0bc965Smrg	;;
15278c4a8e55Smrg    *:DragonFly:*:*)
15288d0bc965Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
15298d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
15308d0bc965Smrg	;;
15318c4a8e55Smrg    *:*VMS:*:*)
15320597fb56Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
15338d0bc965Smrg	case $UNAME_MACHINE in
15348d0bc965Smrg	    A*) GUESS=alpha-dec-vms ;;
15358d0bc965Smrg	    I*) GUESS=ia64-dec-vms ;;
15368d0bc965Smrg	    V*) GUESS=vax-dec-vms ;;
15378c4a8e55Smrg	esac ;;
15388c4a8e55Smrg    *:XENIX:*:SysV)
15398d0bc965Smrg	GUESS=i386-pc-xenix
15408d0bc965Smrg	;;
15418c4a8e55Smrg    i*86:skyos:*:*)
15428d0bc965Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
15438d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
15448d0bc965Smrg	;;
15458c4a8e55Smrg    i*86:rdos:*:*)
15468d0bc965Smrg	GUESS=$UNAME_MACHINE-pc-rdos
15478d0bc965Smrg	;;
15480c674dbdSmrg    i*86:Fiwix:*:*)
15490c674dbdSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
15500c674dbdSmrg	;;
15518d0bc965Smrg    *:AROS:*:*)
15528d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-aros
15538d0bc965Smrg	;;
15548bd17e5fSmrg    x86_64:VMkernel:*:*)
15558d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-esx
15568d0bc965Smrg	;;
15573169be4bSmrg    amd64:Isilon\ OneFS:*:*)
15588d0bc965Smrg	GUESS=x86_64-unknown-onefs
15598d0bc965Smrg	;;
15608d0bc965Smrg    *:Unleashed:*:*)
15618d0bc965Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
15628d0bc965Smrg	;;
1563b042e37fSmrgesac
1564b042e37fSmrg
15658d0bc965Smrg# Do we have a guess based on uname results?
15668d0bc965Smrgif test "x$GUESS" != x; then
15678d0bc965Smrg    echo "$GUESS"
15688d0bc965Smrg    exit
15698d0bc965Smrgfi
15708d0bc965Smrg
15718d0bc965Smrg# No uname command or uname output not recognized.
15728d0bc965Smrgset_cc_for_build
15738d0bc965Smrgcat > "$dummy.c" <<EOF
15748d0bc965Smrg#ifdef _SEQUENT_
15758d0bc965Smrg#include <sys/types.h>
15768d0bc965Smrg#include <sys/utsname.h>
15778d0bc965Smrg#endif
15788d0bc965Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15798d0bc965Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15808d0bc965Smrg#include <signal.h>
15818d0bc965Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
15828d0bc965Smrg#include <sys/utsname.h>
15838d0bc965Smrg#endif
15848d0bc965Smrg#endif
15858d0bc965Smrg#endif
15868d0bc965Smrgmain ()
15878d0bc965Smrg{
15888d0bc965Smrg#if defined (sony)
15898d0bc965Smrg#if defined (MIPSEB)
15908d0bc965Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15918d0bc965Smrg     I don't know....  */
15928d0bc965Smrg  printf ("mips-sony-bsd\n"); exit (0);
15938d0bc965Smrg#else
15948d0bc965Smrg#include <sys/param.h>
15958d0bc965Smrg  printf ("m68k-sony-newsos%s\n",
15968d0bc965Smrg#ifdef NEWSOS4
15978d0bc965Smrg  "4"
15988d0bc965Smrg#else
15998d0bc965Smrg  ""
16008d0bc965Smrg#endif
16018d0bc965Smrg  ); exit (0);
16028d0bc965Smrg#endif
16038d0bc965Smrg#endif
16048d0bc965Smrg
16058d0bc965Smrg#if defined (NeXT)
16068d0bc965Smrg#if !defined (__ARCHITECTURE__)
16078d0bc965Smrg#define __ARCHITECTURE__ "m68k"
16088d0bc965Smrg#endif
16098d0bc965Smrg  int version;
16108d0bc965Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
16118d0bc965Smrg  if (version < 4)
16128d0bc965Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
16138d0bc965Smrg  else
16148d0bc965Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
16158d0bc965Smrg  exit (0);
16168d0bc965Smrg#endif
16178d0bc965Smrg
16188d0bc965Smrg#if defined (MULTIMAX) || defined (n16)
16198d0bc965Smrg#if defined (UMAXV)
16208d0bc965Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
16218d0bc965Smrg#else
16228d0bc965Smrg#if defined (CMU)
16238d0bc965Smrg  printf ("ns32k-encore-mach\n"); exit (0);
16248d0bc965Smrg#else
16258d0bc965Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
16268d0bc965Smrg#endif
16278d0bc965Smrg#endif
16288d0bc965Smrg#endif
16298d0bc965Smrg
16308d0bc965Smrg#if defined (__386BSD__)
16318d0bc965Smrg  printf ("i386-pc-bsd\n"); exit (0);
16328d0bc965Smrg#endif
16338d0bc965Smrg
16348d0bc965Smrg#if defined (sequent)
16358d0bc965Smrg#if defined (i386)
16368d0bc965Smrg  printf ("i386-sequent-dynix\n"); exit (0);
16378d0bc965Smrg#endif
16388d0bc965Smrg#if defined (ns32000)
16398d0bc965Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16408d0bc965Smrg#endif
16418d0bc965Smrg#endif
16428d0bc965Smrg
16438d0bc965Smrg#if defined (_SEQUENT_)
16448d0bc965Smrg  struct utsname un;
16458d0bc965Smrg
16468d0bc965Smrg  uname(&un);
16478d0bc965Smrg  if (strncmp(un.version, "V2", 2) == 0) {
16488d0bc965Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
16498d0bc965Smrg  }
16508d0bc965Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16518d0bc965Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
16528d0bc965Smrg  }
16538d0bc965Smrg  printf ("i386-sequent-ptx\n"); exit (0);
16548d0bc965Smrg#endif
16558d0bc965Smrg
16568d0bc965Smrg#if defined (vax)
16578d0bc965Smrg#if !defined (ultrix)
16588d0bc965Smrg#include <sys/param.h>
16598d0bc965Smrg#if defined (BSD)
16608d0bc965Smrg#if BSD == 43
16618d0bc965Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
16628d0bc965Smrg#else
16638d0bc965Smrg#if BSD == 199006
16648d0bc965Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16658d0bc965Smrg#else
16668d0bc965Smrg  printf ("vax-dec-bsd\n"); exit (0);
16678d0bc965Smrg#endif
16688d0bc965Smrg#endif
16698d0bc965Smrg#else
16708d0bc965Smrg  printf ("vax-dec-bsd\n"); exit (0);
16718d0bc965Smrg#endif
16728d0bc965Smrg#else
16738d0bc965Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
16748d0bc965Smrg  struct utsname un;
16758d0bc965Smrg  uname (&un);
16768d0bc965Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16778d0bc965Smrg#else
16788d0bc965Smrg  printf ("vax-dec-ultrix\n"); exit (0);
16798d0bc965Smrg#endif
16808d0bc965Smrg#endif
16818d0bc965Smrg#endif
16828d0bc965Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16838d0bc965Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16848d0bc965Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
16858d0bc965Smrg  struct utsname *un;
16868d0bc965Smrg  uname (&un);
16878d0bc965Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16888d0bc965Smrg#else
16898d0bc965Smrg  printf ("mips-dec-ultrix\n"); exit (0);
16908d0bc965Smrg#endif
16918d0bc965Smrg#endif
16928d0bc965Smrg#endif
16938d0bc965Smrg
16948d0bc965Smrg#if defined (alliant) && defined (i860)
16958d0bc965Smrg  printf ("i860-alliant-bsd\n"); exit (0);
16968d0bc965Smrg#endif
16978d0bc965Smrg
16988d0bc965Smrg  exit (1);
16998d0bc965Smrg}
17008d0bc965SmrgEOF
17018d0bc965Smrg
17028d0bc965Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
17038d0bc965Smrg	{ echo "$SYSTEM_NAME"; exit; }
17048d0bc965Smrg
17058d0bc965Smrg# Apollos put the system type in the environment.
17068d0bc965Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
17078d0bc965Smrg
17083169be4bSmrgecho "$0: unable to guess system type" >&2
1709b242714cSmrg
17108d0bc965Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
17113169be4bSmrg    mips:Linux | mips64:Linux)
17123169be4bSmrg	# If we got here on MIPS GNU/Linux, output extra information.
17133169be4bSmrg	cat >&2 <<EOF
1714b242714cSmrg
17153169be4bSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
17163169be4bSmrgthe system type. Please install a C compiler and try again.
1717b242714cSmrgEOF
17183169be4bSmrg	;;
17193169be4bSmrgesac
1720b242714cSmrg
1721b042e37fSmrgcat >&2 <<EOF
1722b042e37fSmrg
17233169be4bSmrgThis script (version $timestamp), has failed to recognize the
17243169be4bSmrgoperating system you are using. If your script is old, overwrite *all*
17253169be4bSmrgcopies of config.guess and config.sub with the latest versions from:
1726b042e37fSmrg
17278d0bc965Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17288c4a8e55Smrgand
17298d0bc965Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17308d0bc965SmrgEOF
17318d0bc965Smrg
17328d0bc965Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
17338d0bc965Smrgthisyear=`date +%Y`
17348d0bc965Smrg# shellcheck disable=SC2003
17358d0bc965Smrgscript_age=`expr "$thisyear" - "$our_year"`
17368d0bc965Smrgif test "$script_age" -lt 3 ; then
17378d0bc965Smrg   cat >&2 <<EOF
1738b042e37fSmrg
17393169be4bSmrgIf $0 has already been updated, send the following data and any
17403169be4bSmrginformation you think might be pertinent to config-patches@gnu.org to
17413169be4bSmrgprovide the necessary information to handle your system.
1742b042e37fSmrg
1743b042e37fSmrgconfig.guess timestamp = $timestamp
1744b042e37fSmrg
1745b042e37fSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1746b042e37fSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1747b042e37fSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1748b042e37fSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1749b042e37fSmrg
1750b042e37fSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1751b042e37fSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1752b042e37fSmrg
1753b042e37fSmrghostinfo               = `(hostinfo) 2>/dev/null`
1754b042e37fSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1755b042e37fSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1756b042e37fSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1757b042e37fSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1758b042e37fSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1759b042e37fSmrg
17603169be4bSmrgUNAME_MACHINE = "$UNAME_MACHINE"
17613169be4bSmrgUNAME_RELEASE = "$UNAME_RELEASE"
17623169be4bSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
17633169be4bSmrgUNAME_VERSION = "$UNAME_VERSION"
1764b042e37fSmrgEOF
17658d0bc965Smrgfi
1766b042e37fSmrg
1767b042e37fSmrgexit 1
1768b042e37fSmrg
1769b042e37fSmrg# Local variables:
17708d0bc965Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1771b042e37fSmrg# time-stamp-start: "timestamp='"
1772b042e37fSmrg# time-stamp-format: "%:y-%02m-%02d"
1773b042e37fSmrg# time-stamp-end: "'"
1774b042e37fSmrg# End:
1775