1ee3138f1Smrg#! /bin/sh
2ee3138f1Smrg# Attempt to guess a canonical system name.
38d623946Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4ee3138f1Smrg
58d623946Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
68d623946Smrg
78d623946Smrgtimestamp='2021-06-03'
8ee3138f1Smrg
9ee3138f1Smrg# This file is free software; you can redistribute it and/or modify it
10ee3138f1Smrg# under the terms of the GNU General Public License as published by
11414bd68fSmrg# the Free Software Foundation; either version 3 of the License, or
12ee3138f1Smrg# (at your option) any later version.
13ee3138f1Smrg#
14ee3138f1Smrg# This program is distributed in the hope that it will be useful, but
15ee3138f1Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16ee3138f1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17ee3138f1Smrg# General Public License for more details.
18ee3138f1Smrg#
19ee3138f1Smrg# You should have received a copy of the GNU General Public License
208d623946Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21ee3138f1Smrg#
22ee3138f1Smrg# As a special exception to the GNU General Public License, if you
23ee3138f1Smrg# distribute this file as part of a program that contains a
24ee3138f1Smrg# configuration script generated by Autoconf, you may include it under
25414bd68fSmrg# the same distribution terms that you use for the rest of that
26414bd68fSmrg# program.  This Exception is an additional permission under section 7
27414bd68fSmrg# of the GNU General Public License, version 3 ("GPLv3").
28ee3138f1Smrg#
29414bd68fSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30ee3138f1Smrg#
31b425557eSmrg# You can get the latest version of this script from:
328d623946Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33414bd68fSmrg#
34414bd68fSmrg# Please send patches to <config-patches@gnu.org>.
35414bd68fSmrg
36ee3138f1Smrg
378d623946Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
388d623946Smrg# about features and limitations of the classic Bourne shell that were
398d623946Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
408d623946Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
418d623946Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
428d623946Smrg# have a pre-POSIX /bin/sh.
438d623946Smrg
448d623946Smrg
45ee3138f1Smrgme=`echo "$0" | sed -e 's,.*/,,'`
46ee3138f1Smrg
47ee3138f1Smrgusage="\
48ee3138f1SmrgUsage: $0 [OPTION]
49ee3138f1Smrg
50ee3138f1SmrgOutput the configuration name of the system \`$me' is run on.
51ee3138f1Smrg
528d623946SmrgOptions:
53ee3138f1Smrg  -h, --help         print this help, then exit
54ee3138f1Smrg  -t, --time-stamp   print date of last modification, then exit
55ee3138f1Smrg  -v, --version      print version number, then exit
56ee3138f1Smrg
57ee3138f1SmrgReport bugs and patches to <config-patches@gnu.org>."
58ee3138f1Smrg
59ee3138f1Smrgversion="\
60ee3138f1SmrgGNU config.guess ($timestamp)
61ee3138f1Smrg
62ee3138f1SmrgOriginally written by Per Bothner.
638d623946SmrgCopyright 1992-2021 Free Software Foundation, Inc.
64ee3138f1Smrg
65ee3138f1SmrgThis is free software; see the source for copying conditions.  There is NO
66ee3138f1Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67ee3138f1Smrg
68ee3138f1Smrghelp="
69ee3138f1SmrgTry \`$me --help' for more information."
70ee3138f1Smrg
71ee3138f1Smrg# Parse command line
72ee3138f1Smrgwhile test $# -gt 0 ; do
73ee3138f1Smrg  case $1 in
74ee3138f1Smrg    --time-stamp | --time* | -t )
75ee3138f1Smrg       echo "$timestamp" ; exit ;;
76ee3138f1Smrg    --version | -v )
77ee3138f1Smrg       echo "$version" ; exit ;;
78ee3138f1Smrg    --help | --h* | -h )
79ee3138f1Smrg       echo "$usage"; exit ;;
80ee3138f1Smrg    -- )     # Stop option processing
81ee3138f1Smrg       shift; break ;;
82ee3138f1Smrg    - )	# Use stdin as input.
83ee3138f1Smrg       break ;;
84ee3138f1Smrg    -* )
85ee3138f1Smrg       echo "$me: invalid option $1$help" >&2
86ee3138f1Smrg       exit 1 ;;
87ee3138f1Smrg    * )
88ee3138f1Smrg       break ;;
89ee3138f1Smrg  esac
90ee3138f1Smrgdone
91ee3138f1Smrg
92ee3138f1Smrgif test $# != 0; then
93ee3138f1Smrg  echo "$me: too many arguments$help" >&2
94ee3138f1Smrg  exit 1
95ee3138f1Smrgfi
96ee3138f1Smrg
978d623946Smrg# Just in case it came from the environment.
988d623946SmrgGUESS=
99ee3138f1Smrg
100ee3138f1Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101ee3138f1Smrg# compiler to aid in system detection is discouraged as it requires
102ee3138f1Smrg# temporary files to be created and, as you can see below, it is a
103ee3138f1Smrg# headache to deal with in a portable fashion.
104ee3138f1Smrg
105ee3138f1Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106ee3138f1Smrg# use `HOST_CC' if defined, but it is deprecated.
107ee3138f1Smrg
108ee3138f1Smrg# Portable tmp directory creation inspired by the Autoconf team.
109ee3138f1Smrg
1108d623946Smrgtmp=
1118d623946Smrg# shellcheck disable=SC2172
1128d623946Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1138d623946Smrg
1148d623946Smrgset_cc_for_build() {
1158d623946Smrg    # prevent multiple calls if $tmp is already set
1168d623946Smrg    test "$tmp" && return 0
1178d623946Smrg    : "${TMPDIR=/tmp}"
1188d623946Smrg    # shellcheck disable=SC2039,SC3028
1198d623946Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1208d623946Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1218d623946Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1228d623946Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1238d623946Smrg    dummy=$tmp/dummy
1248d623946Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1258d623946Smrg	,,)    echo "int x;" > "$dummy.c"
1268d623946Smrg	       for driver in cc gcc c89 c99 ; do
1278d623946Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1288d623946Smrg		       CC_FOR_BUILD=$driver
1298d623946Smrg		       break
1308d623946Smrg		   fi
1318d623946Smrg	       done
1328d623946Smrg	       if test x"$CC_FOR_BUILD" = x ; then
1338d623946Smrg		   CC_FOR_BUILD=no_compiler_found
1348d623946Smrg	       fi
1358d623946Smrg	       ;;
1368d623946Smrg	,,*)   CC_FOR_BUILD=$CC ;;
1378d623946Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1388d623946Smrg    esac
1398d623946Smrg}
140ee3138f1Smrg
141ee3138f1Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142ee3138f1Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
1438d623946Smrgif test -f /.attbin/uname ; then
144ee3138f1Smrg	PATH=$PATH:/.attbin ; export PATH
145ee3138f1Smrgfi
146ee3138f1Smrg
147ee3138f1SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148ee3138f1SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1498d623946SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150ee3138f1SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151ee3138f1Smrg
1528d623946Smrgcase $UNAME_SYSTEM in
153414bd68fSmrgLinux|GNU|GNU/*)
1548d623946Smrg	LIBC=unknown
155414bd68fSmrg
1568d623946Smrg	set_cc_for_build
1578d623946Smrg	cat <<-EOF > "$dummy.c"
158414bd68fSmrg	#include <features.h>
159414bd68fSmrg	#if defined(__UCLIBC__)
160414bd68fSmrg	LIBC=uclibc
161414bd68fSmrg	#elif defined(__dietlibc__)
162414bd68fSmrg	LIBC=dietlibc
1638d623946Smrg	#elif defined(__GLIBC__)
164414bd68fSmrg	LIBC=gnu
1658d623946Smrg	#else
1668d623946Smrg	#include <stdarg.h>
1678d623946Smrg	/* First heuristic to detect musl libc.  */
1688d623946Smrg	#ifdef __DEFINED_va_list
1698d623946Smrg	LIBC=musl
1708d623946Smrg	#endif
171414bd68fSmrg	#endif
172414bd68fSmrg	EOF
1738d623946Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
1748d623946Smrg	eval "$cc_set_libc"
1758d623946Smrg
1768d623946Smrg	# Second heuristic to detect musl libc.
1778d623946Smrg	if [ "$LIBC" = unknown ] &&
1788d623946Smrg	   command -v ldd >/dev/null &&
1798d623946Smrg	   ldd --version 2>&1 | grep -q ^musl; then
1808d623946Smrg		LIBC=musl
1818d623946Smrg	fi
1828d623946Smrg
1838d623946Smrg	# If the system lacks a compiler, then just pick glibc.
1848d623946Smrg	# We could probably try harder.
1858d623946Smrg	if [ "$LIBC" = unknown ]; then
1868d623946Smrg		LIBC=gnu
1878d623946Smrg	fi
188414bd68fSmrg	;;
189414bd68fSmrgesac
190414bd68fSmrg
191ee3138f1Smrg# Note: order is significant - the case branches are not exclusive.
192ee3138f1Smrg
1938d623946Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194ee3138f1Smrg    *:NetBSD:*:*)
195ee3138f1Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
1963e72ca8cSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197ee3138f1Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198ee3138f1Smrg	# switched to ELF, *-*-netbsd* would select the old
199ee3138f1Smrg	# object file format.  This provides both forward
200ee3138f1Smrg	# compatibility and a consistent mechanism for selecting the
201ee3138f1Smrg	# object file format.
202ee3138f1Smrg	#
203ee3138f1Smrg	# Note: NetBSD doesn't particularly care about the vendor
204ee3138f1Smrg	# portion of the name.  We always set it to "unknown".
2058d623946Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2068d623946Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2078d623946Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2088d623946Smrg	    echo unknown)`
2098d623946Smrg	case $UNAME_MACHINE_ARCH in
2108d623946Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
211ee3138f1Smrg	    armeb) machine=armeb-unknown ;;
212ee3138f1Smrg	    arm*) machine=arm-unknown ;;
213ee3138f1Smrg	    sh3el) machine=shl-unknown ;;
214ee3138f1Smrg	    sh3eb) machine=sh-unknown ;;
215ee3138f1Smrg	    sh5el) machine=sh5le-unknown ;;
2168d623946Smrg	    earmv*)
2178d623946Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
2188d623946Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
2198d623946Smrg		machine=${arch}${endian}-unknown
2208d623946Smrg		;;
2218d623946Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222ee3138f1Smrg	esac
223ee3138f1Smrg	# The Operating System including object format, if it has switched
2248d623946Smrg	# to ELF recently (or will in the future) and ABI.
2258d623946Smrg	case $UNAME_MACHINE_ARCH in
2268d623946Smrg	    earm*)
2278d623946Smrg		os=netbsdelf
2288d623946Smrg		;;
229ee3138f1Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2308d623946Smrg		set_cc_for_build
231ee3138f1Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232b425557eSmrg			| grep -q __ELF__
233ee3138f1Smrg		then
234ee3138f1Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235ee3138f1Smrg		    # Return netbsd for either.  FIX?
236ee3138f1Smrg		    os=netbsd
237ee3138f1Smrg		else
238ee3138f1Smrg		    os=netbsdelf
239ee3138f1Smrg		fi
240ee3138f1Smrg		;;
241ee3138f1Smrg	    *)
2423e72ca8cSmrg		os=netbsd
243ee3138f1Smrg		;;
244ee3138f1Smrg	esac
2458d623946Smrg	# Determine ABI tags.
2468d623946Smrg	case $UNAME_MACHINE_ARCH in
2478d623946Smrg	    earm*)
2488d623946Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2498d623946Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2508d623946Smrg		;;
2518d623946Smrg	esac
252ee3138f1Smrg	# The OS release
253ee3138f1Smrg	# Debian GNU/NetBSD machines have a different userland, and
254ee3138f1Smrg	# thus, need a distinct triplet. However, they do not need
255ee3138f1Smrg	# kernel version information, so it can be replaced with a
256ee3138f1Smrg	# suitable tag, in the style of linux-gnu.
2578d623946Smrg	case $UNAME_VERSION in
258ee3138f1Smrg	    Debian*)
259ee3138f1Smrg		release='-gnu'
260ee3138f1Smrg		;;
261ee3138f1Smrg	    *)
2628d623946Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263ee3138f1Smrg		;;
264ee3138f1Smrg	esac
265ee3138f1Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266ee3138f1Smrg	# contains redundant information, the shorter form:
267ee3138f1Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2688d623946Smrg	GUESS=$machine-${os}${release}${abi-}
2698d623946Smrg	;;
270414bd68fSmrg    *:Bitrig:*:*)
271414bd68fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2728d623946Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
2738d623946Smrg	;;
274ee3138f1Smrg    *:OpenBSD:*:*)
275ee3138f1Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2768d623946Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
2778d623946Smrg	;;
2788d623946Smrg    *:SecBSD:*:*)
2798d623946Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
2808d623946Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
2818d623946Smrg	;;
2828d623946Smrg    *:LibertyBSD:*:*)
2838d623946Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2848d623946Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
2858d623946Smrg	;;
2868d623946Smrg    *:MidnightBSD:*:*)
2878d623946Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
2888d623946Smrg	;;
289ee3138f1Smrg    *:ekkoBSD:*:*)
2908d623946Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
2918d623946Smrg	;;
292ee3138f1Smrg    *:SolidBSD:*:*)
2938d623946Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
2948d623946Smrg	;;
2958d623946Smrg    *:OS108:*:*)
2968d623946Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
2978d623946Smrg	;;
298ee3138f1Smrg    macppc:MirBSD:*:*)
2998d623946Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
3008d623946Smrg	;;
301ee3138f1Smrg    *:MirBSD:*:*)
3028d623946Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
3038d623946Smrg	;;
3048d623946Smrg    *:Sortix:*:*)
3058d623946Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
3068d623946Smrg	;;
3078d623946Smrg    *:Twizzler:*:*)
3088d623946Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
3098d623946Smrg	;;
3108d623946Smrg    *:Redox:*:*)
3118d623946Smrg	GUESS=$UNAME_MACHINE-unknown-redox
3128d623946Smrg	;;
3138d623946Smrg    mips:OSF1:*.*)
3148d623946Smrg	GUESS=mips-dec-osf1
3158d623946Smrg	;;
316ee3138f1Smrg    alpha:OSF1:*:*)
3178d623946Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3188d623946Smrg	trap '' 0
319ee3138f1Smrg	case $UNAME_RELEASE in
320ee3138f1Smrg	*4.0)
321ee3138f1Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322ee3138f1Smrg		;;
323ee3138f1Smrg	*5.*)
3243e72ca8cSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325ee3138f1Smrg		;;
326ee3138f1Smrg	esac
327ee3138f1Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328ee3138f1Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329ee3138f1Smrg	# covers most systems running today.  This code pipes the CPU
330ee3138f1Smrg	# types through head -n 1, so we only detect the type of CPU 0.
331ee3138f1Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3328d623946Smrg	case $ALPHA_CPU_TYPE in
333ee3138f1Smrg	    "EV4 (21064)")
3348d623946Smrg		UNAME_MACHINE=alpha ;;
335ee3138f1Smrg	    "EV4.5 (21064)")
3368d623946Smrg		UNAME_MACHINE=alpha ;;
337ee3138f1Smrg	    "LCA4 (21066/21068)")
3388d623946Smrg		UNAME_MACHINE=alpha ;;
339ee3138f1Smrg	    "EV5 (21164)")
3408d623946Smrg		UNAME_MACHINE=alphaev5 ;;
341ee3138f1Smrg	    "EV5.6 (21164A)")
3428d623946Smrg		UNAME_MACHINE=alphaev56 ;;
343ee3138f1Smrg	    "EV5.6 (21164PC)")
3448d623946Smrg		UNAME_MACHINE=alphapca56 ;;
345ee3138f1Smrg	    "EV5.7 (21164PC)")
3468d623946Smrg		UNAME_MACHINE=alphapca57 ;;
347ee3138f1Smrg	    "EV6 (21264)")
3488d623946Smrg		UNAME_MACHINE=alphaev6 ;;
349ee3138f1Smrg	    "EV6.7 (21264A)")
3508d623946Smrg		UNAME_MACHINE=alphaev67 ;;
351ee3138f1Smrg	    "EV6.8CB (21264C)")
3528d623946Smrg		UNAME_MACHINE=alphaev68 ;;
353ee3138f1Smrg	    "EV6.8AL (21264B)")
3548d623946Smrg		UNAME_MACHINE=alphaev68 ;;
355ee3138f1Smrg	    "EV6.8CX (21264D)")
3568d623946Smrg		UNAME_MACHINE=alphaev68 ;;
357ee3138f1Smrg	    "EV6.9A (21264/EV69A)")
3588d623946Smrg		UNAME_MACHINE=alphaev69 ;;
359ee3138f1Smrg	    "EV7 (21364)")
3608d623946Smrg		UNAME_MACHINE=alphaev7 ;;
361ee3138f1Smrg	    "EV7.9 (21364A)")
3628d623946Smrg		UNAME_MACHINE=alphaev79 ;;
363ee3138f1Smrg	esac
364ee3138f1Smrg	# A Pn.n version is a patched version.
365ee3138f1Smrg	# A Vn.n version is a released version.
366ee3138f1Smrg	# A Tn.n version is a released field test version.
367ee3138f1Smrg	# A Xn.n version is an unreleased experimental baselevel.
368ee3138f1Smrg	# 1.2 uses "1.2" for uname -r.
3698d623946Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
3708d623946Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
3718d623946Smrg	;;
372ee3138f1Smrg    Amiga*:UNIX_System_V:4.0:*)
3738d623946Smrg	GUESS=m68k-unknown-sysv4
3748d623946Smrg	;;
375ee3138f1Smrg    *:[Aa]miga[Oo][Ss]:*:*)
3768d623946Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
3778d623946Smrg	;;
378ee3138f1Smrg    *:[Mm]orph[Oo][Ss]:*:*)
3798d623946Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
3808d623946Smrg	;;
381ee3138f1Smrg    *:OS/390:*:*)
3828d623946Smrg	GUESS=i370-ibm-openedition
3838d623946Smrg	;;
384ee3138f1Smrg    *:z/VM:*:*)
3858d623946Smrg	GUESS=s390-ibm-zvmoe
3868d623946Smrg	;;
387ee3138f1Smrg    *:OS400:*:*)
3888d623946Smrg	GUESS=powerpc-ibm-os400
3898d623946Smrg	;;
390ee3138f1Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3918d623946Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
3928d623946Smrg	;;
393414bd68fSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3948d623946Smrg	GUESS=arm-unknown-riscos
3958d623946Smrg	;;
396ee3138f1Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3978d623946Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
3988d623946Smrg	;;
399ee3138f1Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400ee3138f1Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
4018d623946Smrg	case `(/bin/universe) 2>/dev/null` in
4028d623946Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
4038d623946Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
4048d623946Smrg	esac
4058d623946Smrg	;;
406ee3138f1Smrg    NILE*:*:*:dcosx)
4078d623946Smrg	GUESS=pyramid-pyramid-svr4
4088d623946Smrg	;;
409ee3138f1Smrg    DRS?6000:unix:4.0:6*)
4108d623946Smrg	GUESS=sparc-icl-nx6
4118d623946Smrg	;;
412ee3138f1Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413ee3138f1Smrg	case `/usr/bin/uname -p` in
4148d623946Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
4158d623946Smrg	esac
4168d623946Smrg	;;
41734977a2fSmrg    s390x:SunOS:*:*)
4188d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4198d623946Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
4208d623946Smrg	;;
421ee3138f1Smrg    sun4H:SunOS:5.*:*)
4228d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4238d623946Smrg	GUESS=sparc-hal-solaris2$SUN_REL
4248d623946Smrg	;;
425ee3138f1Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
4268d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4278d623946Smrg	GUESS=sparc-sun-solaris2$SUN_REL
4288d623946Smrg	;;
429b425557eSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
4308d623946Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
4318d623946Smrg	;;
43279a8a9c6Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4338d623946Smrg	set_cc_for_build
4348d623946Smrg	SUN_ARCH=i386
43534977a2fSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
43634977a2fSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
43734977a2fSmrg	# This test works for both compilers.
4388d623946Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
43934977a2fSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4408d623946Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
44134977a2fSmrg		grep IS_64BIT_ARCH >/dev/null
44234977a2fSmrg	    then
4438d623946Smrg		SUN_ARCH=x86_64
44434977a2fSmrg	    fi
44534977a2fSmrg	fi
4468d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4478d623946Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
4488d623946Smrg	;;
449ee3138f1Smrg    sun4*:SunOS:6*:*)
450ee3138f1Smrg	# According to config.sub, this is the proper way to canonicalize
451ee3138f1Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452ee3138f1Smrg	# it's likely to be more like Solaris than SunOS4.
4538d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
4548d623946Smrg	GUESS=sparc-sun-solaris3$SUN_REL
4558d623946Smrg	;;
456ee3138f1Smrg    sun4*:SunOS:*:*)
4578d623946Smrg	case `/usr/bin/arch -k` in
458ee3138f1Smrg	    Series*|S4*)
459ee3138f1Smrg		UNAME_RELEASE=`uname -v`
460ee3138f1Smrg		;;
461ee3138f1Smrg	esac
462ee3138f1Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4638d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
4648d623946Smrg	GUESS=sparc-sun-sunos$SUN_REL
4658d623946Smrg	;;
466ee3138f1Smrg    sun3*:SunOS:*:*)
4678d623946Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
4688d623946Smrg	;;
469ee3138f1Smrg    sun*:*:4.2BSD:*)
470ee3138f1Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4718d623946Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4728d623946Smrg	case `/bin/arch` in
473ee3138f1Smrg	    sun3)
4748d623946Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475ee3138f1Smrg		;;
476ee3138f1Smrg	    sun4)
4778d623946Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478ee3138f1Smrg		;;
479ee3138f1Smrg	esac
4808d623946Smrg	;;
481ee3138f1Smrg    aushp:SunOS:*:*)
4828d623946Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
4838d623946Smrg	;;
484ee3138f1Smrg    # The situation for MiNT is a little confusing.  The machine name
485ee3138f1Smrg    # can be virtually everything (everything which is not
486ee3138f1Smrg    # "atarist" or "atariste" at least should have a processor
487ee3138f1Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488ee3138f1Smrg    # to the lowercase version "mint" (or "freemint").  Finally
489ee3138f1Smrg    # the system name "TOS" denotes a system which is actually not
490ee3138f1Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491ee3138f1Smrg    # be no problem.
492ee3138f1Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4938d623946Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4948d623946Smrg	;;
495ee3138f1Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4968d623946Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
4978d623946Smrg	;;
498ee3138f1Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4998d623946Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
5008d623946Smrg	;;
501ee3138f1Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
5028d623946Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
5038d623946Smrg	;;
504ee3138f1Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
5058d623946Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
5068d623946Smrg	;;
507ee3138f1Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
5088d623946Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
5098d623946Smrg	;;
510ee3138f1Smrg    m68k:machten:*:*)
5118d623946Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
5128d623946Smrg	;;
513ee3138f1Smrg    powerpc:machten:*:*)
5148d623946Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
5158d623946Smrg	;;
516ee3138f1Smrg    RISC*:Mach:*:*)
5178d623946Smrg	GUESS=mips-dec-mach_bsd4.3
5188d623946Smrg	;;
519ee3138f1Smrg    RISC*:ULTRIX:*:*)
5208d623946Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
5218d623946Smrg	;;
522ee3138f1Smrg    VAX*:ULTRIX*:*:*)
5238d623946Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
5248d623946Smrg	;;
525ee3138f1Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
5268d623946Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
5278d623946Smrg	;;
528ee3138f1Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
5298d623946Smrg	set_cc_for_build
5308d623946Smrg	sed 's/^	//' << EOF > "$dummy.c"
531ee3138f1Smrg#ifdef __cplusplus
532ee3138f1Smrg#include <stdio.h>  /* for printf() prototype */
533ee3138f1Smrg	int main (int argc, char *argv[]) {
534ee3138f1Smrg#else
535ee3138f1Smrg	int main (argc, argv) int argc; char *argv[]; {
536ee3138f1Smrg#endif
537ee3138f1Smrg	#if defined (host_mips) && defined (MIPSEB)
538ee3138f1Smrg	#if defined (SYSTYPE_SYSV)
5398d623946Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540ee3138f1Smrg	#endif
541ee3138f1Smrg	#if defined (SYSTYPE_SVR4)
5428d623946Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543ee3138f1Smrg	#endif
544ee3138f1Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5458d623946Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546ee3138f1Smrg	#endif
547ee3138f1Smrg	#endif
548ee3138f1Smrg	  exit (-1);
549ee3138f1Smrg	}
550ee3138f1SmrgEOF
5518d623946Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5528d623946Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5538d623946Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554ee3138f1Smrg	    { echo "$SYSTEM_NAME"; exit; }
5558d623946Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
5568d623946Smrg	;;
557ee3138f1Smrg    Motorola:PowerMAX_OS:*:*)
5588d623946Smrg	GUESS=powerpc-motorola-powermax
5598d623946Smrg	;;
560ee3138f1Smrg    Motorola:*:4.3:PL8-*)
5618d623946Smrg	GUESS=powerpc-harris-powermax
5628d623946Smrg	;;
563ee3138f1Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5648d623946Smrg	GUESS=powerpc-harris-powermax
5658d623946Smrg	;;
566ee3138f1Smrg    Night_Hawk:Power_UNIX:*:*)
5678d623946Smrg	GUESS=powerpc-harris-powerunix
5688d623946Smrg	;;
569ee3138f1Smrg    m88k:CX/UX:7*:*)
5708d623946Smrg	GUESS=m88k-harris-cxux7
5718d623946Smrg	;;
572ee3138f1Smrg    m88k:*:4*:R4*)
5738d623946Smrg	GUESS=m88k-motorola-sysv4
5748d623946Smrg	;;
575ee3138f1Smrg    m88k:*:3*:R3*)
5768d623946Smrg	GUESS=m88k-motorola-sysv3
5778d623946Smrg	;;
578ee3138f1Smrg    AViiON:dgux:*:*)
5793e72ca8cSmrg	# DG/UX returns AViiON for all architectures
5803e72ca8cSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5818d623946Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582ee3138f1Smrg	then
5838d623946Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5848d623946Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
585ee3138f1Smrg	    then
5868d623946Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587ee3138f1Smrg	    else
5888d623946Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589ee3138f1Smrg	    fi
590ee3138f1Smrg	else
5918d623946Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592ee3138f1Smrg	fi
5938d623946Smrg	;;
594ee3138f1Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5958d623946Smrg	GUESS=m88k-dolphin-sysv3
5968d623946Smrg	;;
597ee3138f1Smrg    M88*:*:R3*:*)
598ee3138f1Smrg	# Delta 88k system running SVR3
5998d623946Smrg	GUESS=m88k-motorola-sysv3
6008d623946Smrg	;;
601ee3138f1Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
6028d623946Smrg	GUESS=m88k-tektronix-sysv3
6038d623946Smrg	;;
604ee3138f1Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
6058d623946Smrg	GUESS=m68k-tektronix-bsd
6068d623946Smrg	;;
607ee3138f1Smrg    *:IRIX*:*:*)
6088d623946Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
6098d623946Smrg	GUESS=mips-sgi-irix$IRIX_REL
6108d623946Smrg	;;
611ee3138f1Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
6128d623946Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
6138d623946Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614ee3138f1Smrg    i*86:AIX:*:*)
6158d623946Smrg	GUESS=i386-ibm-aix
6168d623946Smrg	;;
617ee3138f1Smrg    ia64:AIX:*:*)
6188d623946Smrg	if test -x /usr/bin/oslevel ; then
619ee3138f1Smrg		IBM_REV=`/usr/bin/oslevel`
620ee3138f1Smrg	else
6218d623946Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622ee3138f1Smrg	fi
6238d623946Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
6248d623946Smrg	;;
625ee3138f1Smrg    *:AIX:2:3)
626ee3138f1Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6278d623946Smrg		set_cc_for_build
6288d623946Smrg		sed 's/^		//' << EOF > "$dummy.c"
629ee3138f1Smrg		#include <sys/systemcfg.h>
630ee3138f1Smrg
631ee3138f1Smrg		main()
632ee3138f1Smrg			{
633ee3138f1Smrg			if (!__power_pc())
634ee3138f1Smrg				exit(1);
635ee3138f1Smrg			puts("powerpc-ibm-aix3.2.5");
636ee3138f1Smrg			exit(0);
637ee3138f1Smrg			}
638ee3138f1SmrgEOF
6398d623946Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640ee3138f1Smrg		then
6418d623946Smrg			GUESS=$SYSTEM_NAME
642ee3138f1Smrg		else
6438d623946Smrg			GUESS=rs6000-ibm-aix3.2.5
644ee3138f1Smrg		fi
645ee3138f1Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6468d623946Smrg		GUESS=rs6000-ibm-aix3.2.4
647ee3138f1Smrg	else
6488d623946Smrg		GUESS=rs6000-ibm-aix3.2
649ee3138f1Smrg	fi
6508d623946Smrg	;;
6513e72ca8cSmrg    *:AIX:*:[4567])
652ee3138f1Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6538d623946Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654ee3138f1Smrg		IBM_ARCH=rs6000
655ee3138f1Smrg	else
656ee3138f1Smrg		IBM_ARCH=powerpc
657ee3138f1Smrg	fi
6588d623946Smrg	if test -x /usr/bin/lslpp ; then
6598d623946Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660414bd68fSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661ee3138f1Smrg	else
6628d623946Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663ee3138f1Smrg	fi
6648d623946Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
6658d623946Smrg	;;
666ee3138f1Smrg    *:AIX:*:*)
6678d623946Smrg	GUESS=rs6000-ibm-aix
6688d623946Smrg	;;
6698d623946Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6708d623946Smrg	GUESS=romp-ibm-bsd4.4
6718d623946Smrg	;;
672ee3138f1Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6738d623946Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
6748d623946Smrg	;;                                  # report: romp-ibm BSD 4.3
675ee3138f1Smrg    *:BOSX:*:*)
6768d623946Smrg	GUESS=rs6000-bull-bosx
6778d623946Smrg	;;
678ee3138f1Smrg    DPX/2?00:B.O.S.:*:*)
6798d623946Smrg	GUESS=m68k-bull-sysv3
6808d623946Smrg	;;
681ee3138f1Smrg    9000/[34]??:4.3bsd:1.*:*)
6828d623946Smrg	GUESS=m68k-hp-bsd
6838d623946Smrg	;;
684ee3138f1Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6858d623946Smrg	GUESS=m68k-hp-bsd4.4
6868d623946Smrg	;;
687ee3138f1Smrg    9000/[34678]??:HP-UX:*:*)
6888d623946Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
6898d623946Smrg	case $UNAME_MACHINE in
6908d623946Smrg	    9000/31?)            HP_ARCH=m68000 ;;
6918d623946Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
692ee3138f1Smrg	    9000/[678][0-9][0-9])
6938d623946Smrg		if test -x /usr/bin/getconf; then
694ee3138f1Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6953e72ca8cSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6968d623946Smrg		    case $sc_cpu_version in
6978d623946Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6988d623946Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6993e72ca8cSmrg		      532)                      # CPU_PA_RISC2_0
7008d623946Smrg			case $sc_kernel_bits in
7018d623946Smrg			  32) HP_ARCH=hppa2.0n ;;
7028d623946Smrg			  64) HP_ARCH=hppa2.0w ;;
7038d623946Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7043e72ca8cSmrg			esac ;;
7053e72ca8cSmrg		    esac
706ee3138f1Smrg		fi
7078d623946Smrg		if test "$HP_ARCH" = ""; then
7088d623946Smrg		    set_cc_for_build
7098d623946Smrg		    sed 's/^		//' << EOF > "$dummy.c"
710ee3138f1Smrg
7113e72ca8cSmrg		#define _HPUX_SOURCE
7123e72ca8cSmrg		#include <stdlib.h>
7133e72ca8cSmrg		#include <unistd.h>
714ee3138f1Smrg
7153e72ca8cSmrg		int main ()
7163e72ca8cSmrg		{
7173e72ca8cSmrg		#if defined(_SC_KERNEL_BITS)
7183e72ca8cSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
7193e72ca8cSmrg		#endif
7203e72ca8cSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721ee3138f1Smrg
7223e72ca8cSmrg		    switch (cpu)
7233e72ca8cSmrg			{
7243e72ca8cSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7253e72ca8cSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7263e72ca8cSmrg			case CPU_PA_RISC2_0:
7273e72ca8cSmrg		#if defined(_SC_KERNEL_BITS)
7283e72ca8cSmrg			    switch (bits)
7293e72ca8cSmrg				{
7303e72ca8cSmrg				case 64: puts ("hppa2.0w"); break;
7313e72ca8cSmrg				case 32: puts ("hppa2.0n"); break;
7323e72ca8cSmrg				default: puts ("hppa2.0"); break;
7333e72ca8cSmrg				} break;
7343e72ca8cSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
7353e72ca8cSmrg			    puts ("hppa2.0"); break;
7363e72ca8cSmrg		#endif
7373e72ca8cSmrg			default: puts ("hppa1.0"); break;
7383e72ca8cSmrg			}
7393e72ca8cSmrg		    exit (0);
7403e72ca8cSmrg		}
741ee3138f1SmrgEOF
7428d623946Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743ee3138f1Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744ee3138f1Smrg		fi ;;
745ee3138f1Smrg	esac
7468d623946Smrg	if test "$HP_ARCH" = hppa2.0w
747ee3138f1Smrg	then
7488d623946Smrg	    set_cc_for_build
749ee3138f1Smrg
750ee3138f1Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751ee3138f1Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752ee3138f1Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753ee3138f1Smrg	    #
754ee3138f1Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
755ee3138f1Smrg	    # => hppa2.0w-hp-hpux11.23
756ee3138f1Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757ee3138f1Smrg	    # => hppa64-hp-hpux11.23
758ee3138f1Smrg
7598d623946Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760b425557eSmrg		grep -q __LP64__
761ee3138f1Smrg	    then
7628d623946Smrg		HP_ARCH=hppa2.0w
763ee3138f1Smrg	    else
7648d623946Smrg		HP_ARCH=hppa64
765ee3138f1Smrg	    fi
766ee3138f1Smrg	fi
7678d623946Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
7688d623946Smrg	;;
769ee3138f1Smrg    ia64:HP-UX:*:*)
7708d623946Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
7718d623946Smrg	GUESS=ia64-hp-hpux$HPUX_REV
7728d623946Smrg	;;
773ee3138f1Smrg    3050*:HI-UX:*:*)
7748d623946Smrg	set_cc_for_build
7758d623946Smrg	sed 's/^	//' << EOF > "$dummy.c"
776ee3138f1Smrg	#include <unistd.h>
777ee3138f1Smrg	int
778ee3138f1Smrg	main ()
779ee3138f1Smrg	{
780ee3138f1Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
781ee3138f1Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782ee3138f1Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783ee3138f1Smrg	     results, however.  */
784ee3138f1Smrg	  if (CPU_IS_PA_RISC (cpu))
785ee3138f1Smrg	    {
786ee3138f1Smrg	      switch (cpu)
787ee3138f1Smrg		{
788ee3138f1Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789ee3138f1Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790ee3138f1Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791ee3138f1Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792ee3138f1Smrg		}
793ee3138f1Smrg	    }
794ee3138f1Smrg	  else if (CPU_IS_HP_MC68K (cpu))
795ee3138f1Smrg	    puts ("m68k-hitachi-hiuxwe2");
796ee3138f1Smrg	  else puts ("unknown-hitachi-hiuxwe2");
797ee3138f1Smrg	  exit (0);
798ee3138f1Smrg	}
799ee3138f1SmrgEOF
8008d623946Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801ee3138f1Smrg		{ echo "$SYSTEM_NAME"; exit; }
8028d623946Smrg	GUESS=unknown-hitachi-hiuxwe2
8038d623946Smrg	;;
8048d623946Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
8058d623946Smrg	GUESS=hppa1.1-hp-bsd
8068d623946Smrg	;;
807ee3138f1Smrg    9000/8??:4.3bsd:*:*)
8088d623946Smrg	GUESS=hppa1.0-hp-bsd
8098d623946Smrg	;;
810ee3138f1Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
8118d623946Smrg	GUESS=hppa1.0-hp-mpeix
8128d623946Smrg	;;
8138d623946Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
8148d623946Smrg	GUESS=hppa1.1-hp-osf
8158d623946Smrg	;;
816ee3138f1Smrg    hp8??:OSF1:*:*)
8178d623946Smrg	GUESS=hppa1.0-hp-osf
8188d623946Smrg	;;
819ee3138f1Smrg    i*86:OSF1:*:*)
8208d623946Smrg	if test -x /usr/sbin/sysversion ; then
8218d623946Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822ee3138f1Smrg	else
8238d623946Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824ee3138f1Smrg	fi
8258d623946Smrg	;;
826ee3138f1Smrg    parisc*:Lites*:*:*)
8278d623946Smrg	GUESS=hppa1.1-hp-lites
8288d623946Smrg	;;
829ee3138f1Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
8308d623946Smrg	GUESS=c1-convex-bsd
8318d623946Smrg	;;
832ee3138f1Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833ee3138f1Smrg	if getsysinfo -f scalar_acc
834ee3138f1Smrg	then echo c32-convex-bsd
835ee3138f1Smrg	else echo c2-convex-bsd
836ee3138f1Smrg	fi
8373e72ca8cSmrg	exit ;;
838ee3138f1Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8398d623946Smrg	GUESS=c34-convex-bsd
8408d623946Smrg	;;
841ee3138f1Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8428d623946Smrg	GUESS=c38-convex-bsd
8438d623946Smrg	;;
844ee3138f1Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8458d623946Smrg	GUESS=c4-convex-bsd
8468d623946Smrg	;;
847ee3138f1Smrg    CRAY*Y-MP:*:*:*)
8488d623946Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8498d623946Smrg	GUESS=ymp-cray-unicos$CRAY_REL
8508d623946Smrg	;;
851ee3138f1Smrg    CRAY*[A-Z]90:*:*:*)
8528d623946Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853ee3138f1Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854ee3138f1Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855ee3138f1Smrg	      -e 's/\.[^.]*$/.X/'
856ee3138f1Smrg	exit ;;
857ee3138f1Smrg    CRAY*TS:*:*:*)
8588d623946Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8598d623946Smrg	GUESS=t90-cray-unicos$CRAY_REL
8608d623946Smrg	;;
861ee3138f1Smrg    CRAY*T3E:*:*:*)
8628d623946Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8638d623946Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
8648d623946Smrg	;;
865ee3138f1Smrg    CRAY*SV1:*:*:*)
8668d623946Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8678d623946Smrg	GUESS=sv1-cray-unicos$CRAY_REL
8688d623946Smrg	;;
869ee3138f1Smrg    *:UNICOS/mp:*:*)
8708d623946Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
8718d623946Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
8728d623946Smrg	;;
873ee3138f1Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8748d623946Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8758d623946Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8768d623946Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8778d623946Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8788d623946Smrg	;;
879ee3138f1Smrg    5000:UNIX_System_V:4.*:*)
8808d623946Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8818d623946Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8828d623946Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
8838d623946Smrg	;;
884ee3138f1Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8858d623946Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
8868d623946Smrg	;;
887ee3138f1Smrg    sparc*:BSD/OS:*:*)
8888d623946Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
8898d623946Smrg	;;
890ee3138f1Smrg    *:BSD/OS:*:*)
8918d623946Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
8928d623946Smrg	;;
8938d623946Smrg    arm:FreeBSD:*:*)
8948d623946Smrg	UNAME_PROCESSOR=`uname -p`
8958d623946Smrg	set_cc_for_build
8968d623946Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8978d623946Smrg	    | grep -q __ARM_PCS_VFP
8988d623946Smrg	then
8998d623946Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9008d623946Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9018d623946Smrg	else
9028d623946Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9038d623946Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9048d623946Smrg	fi
9058d623946Smrg	;;
906ee3138f1Smrg    *:FreeBSD:*:*)
9073e72ca8cSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
9088d623946Smrg	case $UNAME_PROCESSOR in
909ee3138f1Smrg	    amd64)
9108d623946Smrg		UNAME_PROCESSOR=x86_64 ;;
9118d623946Smrg	    i386)
9128d623946Smrg		UNAME_PROCESSOR=i586 ;;
913ee3138f1Smrg	esac
9148d623946Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9158d623946Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
9168d623946Smrg	;;
917ee3138f1Smrg    i*:CYGWIN*:*)
9188d623946Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
9198d623946Smrg	;;
920414bd68fSmrg    *:MINGW64*:*)
9218d623946Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
9228d623946Smrg	;;
923ee3138f1Smrg    *:MINGW*:*)
9248d623946Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
9258d623946Smrg	;;
926414bd68fSmrg    *:MSYS*:*)
9278d623946Smrg	GUESS=$UNAME_MACHINE-pc-msys
9288d623946Smrg	;;
929ee3138f1Smrg    i*:PW*:*)
9308d623946Smrg	GUESS=$UNAME_MACHINE-pc-pw32
9318d623946Smrg	;;
932b425557eSmrg    *:Interix*:*)
9338d623946Smrg	case $UNAME_MACHINE in
93479a8a9c6Smrg	    x86)
9358d623946Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
9368d623946Smrg		;;
937b425557eSmrg	    authenticamd | genuineintel | EM64T)
9388d623946Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
9398d623946Smrg		;;
94079a8a9c6Smrg	    IA64)
9418d623946Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
9428d623946Smrg		;;
943ee3138f1Smrg	esac ;;
944ee3138f1Smrg    i*:UWIN*:*)
9458d623946Smrg	GUESS=$UNAME_MACHINE-pc-uwin
9468d623946Smrg	;;
947ee3138f1Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9488d623946Smrg	GUESS=x86_64-pc-cygwin
9498d623946Smrg	;;
950ee3138f1Smrg    prep*:SunOS:5.*:*)
9518d623946Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
9528d623946Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
9538d623946Smrg	;;
954ee3138f1Smrg    *:GNU:*:*)
955ee3138f1Smrg	# the GNU system
9568d623946Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
9578d623946Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
9588d623946Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
9598d623946Smrg	;;
960ee3138f1Smrg    *:GNU/*:*:*)
961ee3138f1Smrg	# other systems with GNU libc and userland
9628d623946Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
9638d623946Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
9648d623946Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
9658d623946Smrg	;;
9668d623946Smrg    *:Minix:*:*)
9678d623946Smrg	GUESS=$UNAME_MACHINE-unknown-minix
9688d623946Smrg	;;
9693e72ca8cSmrg    aarch64:Linux:*:*)
9708d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9718d623946Smrg	;;
9723e72ca8cSmrg    aarch64_be:Linux:*:*)
9733e72ca8cSmrg	UNAME_MACHINE=aarch64_be
9748d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9758d623946Smrg	;;
976b425557eSmrg    alpha:Linux:*:*)
9778d623946Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978b425557eSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979b425557eSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980b425557eSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981b425557eSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982b425557eSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983b425557eSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984b425557eSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9853e72ca8cSmrg	esac
986b425557eSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9878d623946Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9888d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9898d623946Smrg	;;
9908d623946Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
9918d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9928d623946Smrg	;;
993ee3138f1Smrg    arm*:Linux:*:*)
9948d623946Smrg	set_cc_for_build
99579a8a9c6Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
99679a8a9c6Smrg	    | grep -q __ARM_EABI__
99779a8a9c6Smrg	then
9988d623946Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99979a8a9c6Smrg	else
10003e72ca8cSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10013e72ca8cSmrg		| grep -q __ARM_PCS_VFP
10023e72ca8cSmrg	    then
10038d623946Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10043e72ca8cSmrg	    else
10058d623946Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10063e72ca8cSmrg	    fi
100779a8a9c6Smrg	fi
10088d623946Smrg	;;
1009ee3138f1Smrg    avr32*:Linux:*:*)
10108d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10118d623946Smrg	;;
1012ee3138f1Smrg    cris:Linux:*:*)
10138d623946Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10148d623946Smrg	;;
1015ee3138f1Smrg    crisv32:Linux:*:*)
10168d623946Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
10178d623946Smrg	;;
10188d623946Smrg    e2k:Linux:*:*)
10198d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10208d623946Smrg	;;
1021ee3138f1Smrg    frv:Linux:*:*)
10228d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10238d623946Smrg	;;
10243e72ca8cSmrg    hexagon:Linux:*:*)
10258d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10268d623946Smrg	;;
1027b425557eSmrg    i*86:Linux:*:*)
10288d623946Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
10298d623946Smrg	;;
1030ee3138f1Smrg    ia64:Linux:*:*)
10318d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10328d623946Smrg	;;
10338d623946Smrg    k1om:Linux:*:*)
10348d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10358d623946Smrg	;;
10368d623946Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
10378d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10388d623946Smrg	;;
1039ee3138f1Smrg    m32r*:Linux:*:*)
10408d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10418d623946Smrg	;;
1042ee3138f1Smrg    m68*:Linux:*:*)
10438d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10448d623946Smrg	;;
1045b425557eSmrg    mips:Linux:*:* | mips64:Linux:*:*)
10468d623946Smrg	set_cc_for_build
10478d623946Smrg	IS_GLIBC=0
10488d623946Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
10498d623946Smrg	sed 's/^	//' << EOF > "$dummy.c"
1050ee3138f1Smrg	#undef CPU
10518d623946Smrg	#undef mips
10528d623946Smrg	#undef mipsel
10538d623946Smrg	#undef mips64
10548d623946Smrg	#undef mips64el
10558d623946Smrg	#if ${IS_GLIBC} && defined(_ABI64)
10568d623946Smrg	LIBCABI=gnuabi64
10578d623946Smrg	#else
10588d623946Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
10598d623946Smrg	LIBCABI=gnuabin32
10608d623946Smrg	#else
10618d623946Smrg	LIBCABI=${LIBC}
10628d623946Smrg	#endif
10638d623946Smrg	#endif
10648d623946Smrg
10658d623946Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10668d623946Smrg	CPU=mipsisa64r6
10678d623946Smrg	#else
10688d623946Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10698d623946Smrg	CPU=mipsisa32r6
10708d623946Smrg	#else
10718d623946Smrg	#if defined(__mips64)
10728d623946Smrg	CPU=mips64
10738d623946Smrg	#else
10748d623946Smrg	CPU=mips
10758d623946Smrg	#endif
10768d623946Smrg	#endif
10778d623946Smrg	#endif
10788d623946Smrg
1079ee3138f1Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10808d623946Smrg	MIPS_ENDIAN=el
1081ee3138f1Smrg	#else
1082ee3138f1Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10838d623946Smrg	MIPS_ENDIAN=
1084ee3138f1Smrg	#else
10858d623946Smrg	MIPS_ENDIAN=
1086ee3138f1Smrg	#endif
1087ee3138f1Smrg	#endif
1088ee3138f1SmrgEOF
10898d623946Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
10908d623946Smrg	eval "$cc_set_vars"
10918d623946Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10928d623946Smrg	;;
10938d623946Smrg    mips64el:Linux:*:*)
10948d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1095ee3138f1Smrg	;;
1096414bd68fSmrg    openrisc*:Linux:*:*)
10978d623946Smrg	GUESS=or1k-unknown-linux-$LIBC
10988d623946Smrg	;;
1099414bd68fSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
11008d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11018d623946Smrg	;;
110234977a2fSmrg    padre:Linux:*:*)
11038d623946Smrg	GUESS=sparc-unknown-linux-$LIBC
11048d623946Smrg	;;
1105b425557eSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
11068d623946Smrg	GUESS=hppa64-unknown-linux-$LIBC
11078d623946Smrg	;;
1108ee3138f1Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
1109ee3138f1Smrg	# Look for CPU level
1110ee3138f1Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
11118d623946Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
11128d623946Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
11138d623946Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1114ee3138f1Smrg	esac
11158d623946Smrg	;;
1116b425557eSmrg    ppc64:Linux:*:*)
11178d623946Smrg	GUESS=powerpc64-unknown-linux-$LIBC
11188d623946Smrg	;;
1119b425557eSmrg    ppc:Linux:*:*)
11208d623946Smrg	GUESS=powerpc-unknown-linux-$LIBC
11218d623946Smrg	;;
1122414bd68fSmrg    ppc64le:Linux:*:*)
11238d623946Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
11248d623946Smrg	;;
1125414bd68fSmrg    ppcle:Linux:*:*)
11268d623946Smrg	GUESS=powerpcle-unknown-linux-$LIBC
11278d623946Smrg	;;
11288d623946Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
11298d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11308d623946Smrg	;;
1131ee3138f1Smrg    s390:Linux:*:* | s390x:Linux:*:*)
11328d623946Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
11338d623946Smrg	;;
1134ee3138f1Smrg    sh64*:Linux:*:*)
11358d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11368d623946Smrg	;;
1137ee3138f1Smrg    sh*:Linux:*:*)
11388d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11398d623946Smrg	;;
1140ee3138f1Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
11418d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11428d623946Smrg	;;
11433e72ca8cSmrg    tile*:Linux:*:*)
11448d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11458d623946Smrg	;;
1146ee3138f1Smrg    vax:Linux:*:*)
11478d623946Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
11488d623946Smrg	;;
1149ee3138f1Smrg    x86_64:Linux:*:*)
11508d623946Smrg	set_cc_for_build
11518d623946Smrg	LIBCABI=$LIBC
11528d623946Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
11538d623946Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
11548d623946Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
11558d623946Smrg		grep IS_X32 >/dev/null
11568d623946Smrg	    then
11578d623946Smrg		LIBCABI=${LIBC}x32
11588d623946Smrg	    fi
11598d623946Smrg	fi
11608d623946Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
11618d623946Smrg	;;
116279a8a9c6Smrg    xtensa*:Linux:*:*)
11638d623946Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11648d623946Smrg	;;
1165ee3138f1Smrg    i*86:DYNIX/ptx:4*:*)
1166ee3138f1Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1167ee3138f1Smrg	# earlier versions are messed up and put the nodename in both
1168ee3138f1Smrg	# sysname and nodename.
11698d623946Smrg	GUESS=i386-sequent-sysv4
11708d623946Smrg	;;
1171ee3138f1Smrg    i*86:UNIX_SV:4.2MP:2.*)
11723e72ca8cSmrg	# Unixware is an offshoot of SVR4, but it has its own version
11733e72ca8cSmrg	# number series starting with 2...
11743e72ca8cSmrg	# I am not positive that other SVR4 systems won't match this,
1175ee3138f1Smrg	# I just have to hope.  -- rms.
11763e72ca8cSmrg	# Use sysv4.2uw... so that sysv4* matches it.
11778d623946Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
11788d623946Smrg	;;
1179ee3138f1Smrg    i*86:OS/2:*:*)
1180ee3138f1Smrg	# If we were able to find `uname', then EMX Unix compatibility
1181ee3138f1Smrg	# is probably installed.
11828d623946Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
11838d623946Smrg	;;
1184ee3138f1Smrg    i*86:XTS-300:*:STOP)
11858d623946Smrg	GUESS=$UNAME_MACHINE-unknown-stop
11868d623946Smrg	;;
1187ee3138f1Smrg    i*86:atheos:*:*)
11888d623946Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
11898d623946Smrg	;;
1190ee3138f1Smrg    i*86:syllable:*:*)
11918d623946Smrg	GUESS=$UNAME_MACHINE-pc-syllable
11928d623946Smrg	;;
1193b425557eSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
11948d623946Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
11958d623946Smrg	;;
1196ee3138f1Smrg    i*86:*DOS:*:*)
11978d623946Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
11988d623946Smrg	;;
11998d623946Smrg    i*86:*:4.*:*)
12008d623946Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1201ee3138f1Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
12028d623946Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1203ee3138f1Smrg	else
12048d623946Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1205ee3138f1Smrg	fi
12068d623946Smrg	;;
1207ee3138f1Smrg    i*86:*:5:[678]*)
12083e72ca8cSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1209ee3138f1Smrg	case `/bin/uname -X | grep "^Machine"` in
1210ee3138f1Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1211ee3138f1Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1212ee3138f1Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1213ee3138f1Smrg	esac
12148d623946Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
12158d623946Smrg	;;
1216ee3138f1Smrg    i*86:*:3.2:*)
1217ee3138f1Smrg	if test -f /usr/options/cb.name; then
1218ee3138f1Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
12198d623946Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1220ee3138f1Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1221ee3138f1Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1222ee3138f1Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1223ee3138f1Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1224ee3138f1Smrg			&& UNAME_MACHINE=i586
1225ee3138f1Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1226ee3138f1Smrg			&& UNAME_MACHINE=i686
1227ee3138f1Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1228ee3138f1Smrg			&& UNAME_MACHINE=i686
12298d623946Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1230ee3138f1Smrg	else
12318d623946Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
1232ee3138f1Smrg	fi
12338d623946Smrg	;;
1234ee3138f1Smrg    pc:*:*:*)
1235ee3138f1Smrg	# Left here for compatibility:
12363e72ca8cSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12373e72ca8cSmrg	# the processor, so we play safe by assuming i586.
123834977a2fSmrg	# Note: whatever this is, it MUST be the same as what config.sub
12398d623946Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
124034977a2fSmrg	# this is a cross-build.
12418d623946Smrg	GUESS=i586-pc-msdosdjgpp
12428d623946Smrg	;;
1243ee3138f1Smrg    Intel:Mach:3*:*)
12448d623946Smrg	GUESS=i386-pc-mach3
12458d623946Smrg	;;
1246ee3138f1Smrg    paragon:*:*:*)
12478d623946Smrg	GUESS=i860-intel-osf1
12488d623946Smrg	;;
1249ee3138f1Smrg    i860:*:4.*:*) # i860-SVR4
1250ee3138f1Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
12518d623946Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1252ee3138f1Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
12538d623946Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1254ee3138f1Smrg	fi
12558d623946Smrg	;;
1256ee3138f1Smrg    mini*:CTIX:SYS*5:*)
1257ee3138f1Smrg	# "miniframe"
12588d623946Smrg	GUESS=m68010-convergent-sysv
12598d623946Smrg	;;
1260ee3138f1Smrg    mc68k:UNIX:SYSTEM5:3.51m)
12618d623946Smrg	GUESS=m68k-convergent-sysv
12628d623946Smrg	;;
1263ee3138f1Smrg    M680?0:D-NIX:5.3:*)
12648d623946Smrg	GUESS=m68k-diab-dnix
12658d623946Smrg	;;
1266ee3138f1Smrg    M68*:*:R3V[5678]*:*)
1267ee3138f1Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1268ee3138f1Smrg    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)
1269ee3138f1Smrg	OS_REL=''
1270ee3138f1Smrg	test -r /etc/.relid \
1271ee3138f1Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1272ee3138f1Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12738d623946Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1274ee3138f1Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12758d623946Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1276ee3138f1Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12773e72ca8cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12783e72ca8cSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
127934977a2fSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
128034977a2fSmrg	OS_REL='.3'
128134977a2fSmrg	test -r /etc/.relid \
128234977a2fSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
128334977a2fSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12848d623946Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
128534977a2fSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12868d623946Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
128734977a2fSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12888d623946Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1289ee3138f1Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
12908d623946Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
12918d623946Smrg	;;
1292ee3138f1Smrg    mc68030:UNIX_System_V:4.*:*)
12938d623946Smrg	GUESS=m68k-atari-sysv4
12948d623946Smrg	;;
1295ee3138f1Smrg    TSUNAMI:LynxOS:2.*:*)
12968d623946Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
12978d623946Smrg	;;
1298ee3138f1Smrg    rs6000:LynxOS:2.*:*)
12998d623946Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
13008d623946Smrg	;;
1301b425557eSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
13028d623946Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
13038d623946Smrg	;;
1304ee3138f1Smrg    SM[BE]S:UNIX_SV:*:*)
13058d623946Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
13068d623946Smrg	;;
1307ee3138f1Smrg    RM*:ReliantUNIX-*:*:*)
13088d623946Smrg	GUESS=mips-sni-sysv4
13098d623946Smrg	;;
1310ee3138f1Smrg    RM*:SINIX-*:*:*)
13118d623946Smrg	GUESS=mips-sni-sysv4
13128d623946Smrg	;;
1313ee3138f1Smrg    *:SINIX-*:*:*)
1314ee3138f1Smrg	if uname -p 2>/dev/null >/dev/null ; then
1315ee3138f1Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
13168d623946Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
1317ee3138f1Smrg	else
13188d623946Smrg		GUESS=ns32k-sni-sysv
1319ee3138f1Smrg	fi
13208d623946Smrg	;;
13213e72ca8cSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13223e72ca8cSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
13238d623946Smrg	GUESS=i586-unisys-sysv4
13248d623946Smrg	;;
1325ee3138f1Smrg    *:UNIX_System_V:4*:FTX*)
1326ee3138f1Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1327ee3138f1Smrg	# How about differentiating between stratus architectures? -djm
13288d623946Smrg	GUESS=hppa1.1-stratus-sysv4
13298d623946Smrg	;;
1330ee3138f1Smrg    *:*:*:FTX*)
1331ee3138f1Smrg	# From seanf@swdc.stratus.com.
13328d623946Smrg	GUESS=i860-stratus-sysv4
13338d623946Smrg	;;
1334ee3138f1Smrg    i*86:VOS:*:*)
1335ee3138f1Smrg	# From Paul.Green@stratus.com.
13368d623946Smrg	GUESS=$UNAME_MACHINE-stratus-vos
13378d623946Smrg	;;
1338ee3138f1Smrg    *:VOS:*:*)
1339ee3138f1Smrg	# From Paul.Green@stratus.com.
13408d623946Smrg	GUESS=hppa1.1-stratus-vos
13418d623946Smrg	;;
1342ee3138f1Smrg    mc68*:A/UX:*:*)
13438d623946Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
13448d623946Smrg	;;
1345ee3138f1Smrg    news*:NEWS-OS:6*:*)
13468d623946Smrg	GUESS=mips-sony-newsos6
13478d623946Smrg	;;
1348ee3138f1Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13498d623946Smrg	if test -d /usr/nec; then
13508d623946Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1351ee3138f1Smrg	else
13528d623946Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1353ee3138f1Smrg	fi
13548d623946Smrg	;;
1355ee3138f1Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13568d623946Smrg	GUESS=powerpc-be-beos
13578d623946Smrg	;;
1358ee3138f1Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13598d623946Smrg	GUESS=powerpc-apple-beos
13608d623946Smrg	;;
1361ee3138f1Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13628d623946Smrg	GUESS=i586-pc-beos
13638d623946Smrg	;;
136434977a2fSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13658d623946Smrg	GUESS=i586-pc-haiku
13668d623946Smrg	;;
1367414bd68fSmrg    x86_64:Haiku:*:*)
13688d623946Smrg	GUESS=x86_64-unknown-haiku
13698d623946Smrg	;;
1370ee3138f1Smrg    SX-4:SUPER-UX:*:*)
13718d623946Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
13728d623946Smrg	;;
1373ee3138f1Smrg    SX-5:SUPER-UX:*:*)
13748d623946Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
13758d623946Smrg	;;
1376ee3138f1Smrg    SX-6:SUPER-UX:*:*)
13778d623946Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
13788d623946Smrg	;;
1379ee3138f1Smrg    SX-7:SUPER-UX:*:*)
13808d623946Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
13818d623946Smrg	;;
1382ee3138f1Smrg    SX-8:SUPER-UX:*:*)
13838d623946Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
13848d623946Smrg	;;
1385ee3138f1Smrg    SX-8R:SUPER-UX:*:*)
13868d623946Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
13878d623946Smrg	;;
13888d623946Smrg    SX-ACE:SUPER-UX:*:*)
13898d623946Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
13908d623946Smrg	;;
1391ee3138f1Smrg    Power*:Rhapsody:*:*)
13928d623946Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
13938d623946Smrg	;;
1394ee3138f1Smrg    *:Rhapsody:*:*)
13958d623946Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
13968d623946Smrg	;;
13978d623946Smrg    arm64:Darwin:*:*)
13988d623946Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
13998d623946Smrg	;;
1400ee3138f1Smrg    *:Darwin:*:*)
14018d623946Smrg	UNAME_PROCESSOR=`uname -p`
14028d623946Smrg	case $UNAME_PROCESSOR in
14038d623946Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14048d623946Smrg	esac
14058d623946Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
14068d623946Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
14078d623946Smrg	    # Avoid executing cc if there is no toolchain installed as
14088d623946Smrg	    # cc will be a stub that puts up a graphical alert
14098d623946Smrg	    # prompting the user to install developer tools.
14108d623946Smrg	    CC_FOR_BUILD=no_compiler_found
14118d623946Smrg	else
14128d623946Smrg	    set_cc_for_build
1413414bd68fSmrg	fi
14148d623946Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
14158d623946Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
14168d623946Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14178d623946Smrg		   grep IS_64BIT_ARCH >/dev/null
14188d623946Smrg	    then
14198d623946Smrg		case $UNAME_PROCESSOR in
14208d623946Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
14218d623946Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14228d623946Smrg		esac
14238d623946Smrg	    fi
14248d623946Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
14258d623946Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
14268d623946Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
14278d623946Smrg		   grep IS_PPC >/dev/null
14288d623946Smrg	    then
14298d623946Smrg		UNAME_PROCESSOR=powerpc
1430414bd68fSmrg	    fi
1431414bd68fSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
14328d623946Smrg	    # uname -m returns i386 or x86_64
14338d623946Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1434414bd68fSmrg	fi
14358d623946Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
14368d623946Smrg	;;
1437ee3138f1Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1438ee3138f1Smrg	UNAME_PROCESSOR=`uname -p`
14398d623946Smrg	if test "$UNAME_PROCESSOR" = x86; then
1440ee3138f1Smrg		UNAME_PROCESSOR=i386
1441ee3138f1Smrg		UNAME_MACHINE=pc
1442ee3138f1Smrg	fi
14438d623946Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
14448d623946Smrg	;;
1445ee3138f1Smrg    *:QNX:*:4*)
14468d623946Smrg	GUESS=i386-pc-qnx
14478d623946Smrg	;;
14488d623946Smrg    NEO-*:NONSTOP_KERNEL:*:*)
14498d623946Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
14508d623946Smrg	;;
14513e72ca8cSmrg    NSE-*:NONSTOP_KERNEL:*:*)
14528d623946Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
14538d623946Smrg	;;
14548d623946Smrg    NSR-*:NONSTOP_KERNEL:*:*)
14558d623946Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
14568d623946Smrg	;;
14578d623946Smrg    NSV-*:NONSTOP_KERNEL:*:*)
14588d623946Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
14598d623946Smrg	;;
14608d623946Smrg    NSX-*:NONSTOP_KERNEL:*:*)
14618d623946Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
14628d623946Smrg	;;
1463ee3138f1Smrg    *:NonStop-UX:*:*)
14648d623946Smrg	GUESS=mips-compaq-nonstopux
14658d623946Smrg	;;
1466ee3138f1Smrg    BS2000:POSIX*:*:*)
14678d623946Smrg	GUESS=bs2000-siemens-sysv
14688d623946Smrg	;;
1469ee3138f1Smrg    DS/*:UNIX_System_V:*:*)
14708d623946Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
14718d623946Smrg	;;
1472ee3138f1Smrg    *:Plan9:*:*)
1473ee3138f1Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1474ee3138f1Smrg	# is converted to i386 for consistency with other x86
1475ee3138f1Smrg	# operating systems.
14768d623946Smrg	if test "${cputype-}" = 386; then
1477ee3138f1Smrg	    UNAME_MACHINE=i386
14788d623946Smrg	elif test "x${cputype-}" != x; then
14798d623946Smrg	    UNAME_MACHINE=$cputype
1480ee3138f1Smrg	fi
14818d623946Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
14828d623946Smrg	;;
1483ee3138f1Smrg    *:TOPS-10:*:*)
14848d623946Smrg	GUESS=pdp10-unknown-tops10
14858d623946Smrg	;;
1486ee3138f1Smrg    *:TENEX:*:*)
14878d623946Smrg	GUESS=pdp10-unknown-tenex
14888d623946Smrg	;;
1489ee3138f1Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14908d623946Smrg	GUESS=pdp10-dec-tops20
14918d623946Smrg	;;
1492ee3138f1Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14938d623946Smrg	GUESS=pdp10-xkl-tops20
14948d623946Smrg	;;
1495ee3138f1Smrg    *:TOPS-20:*:*)
14968d623946Smrg	GUESS=pdp10-unknown-tops20
14978d623946Smrg	;;
1498ee3138f1Smrg    *:ITS:*:*)
14998d623946Smrg	GUESS=pdp10-unknown-its
15008d623946Smrg	;;
1501ee3138f1Smrg    SEI:*:*:SEIUX)
15028d623946Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
15038d623946Smrg	;;
1504ee3138f1Smrg    *:DragonFly:*:*)
15058d623946Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
15068d623946Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
15078d623946Smrg	;;
1508ee3138f1Smrg    *:*VMS:*:*)
15093e72ca8cSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
15108d623946Smrg	case $UNAME_MACHINE in
15118d623946Smrg	    A*) GUESS=alpha-dec-vms ;;
15128d623946Smrg	    I*) GUESS=ia64-dec-vms ;;
15138d623946Smrg	    V*) GUESS=vax-dec-vms ;;
1514ee3138f1Smrg	esac ;;
1515ee3138f1Smrg    *:XENIX:*:SysV)
15168d623946Smrg	GUESS=i386-pc-xenix
15178d623946Smrg	;;
1518ee3138f1Smrg    i*86:skyos:*:*)
15198d623946Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
15208d623946Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
15218d623946Smrg	;;
1522ee3138f1Smrg    i*86:rdos:*:*)
15238d623946Smrg	GUESS=$UNAME_MACHINE-pc-rdos
15248d623946Smrg	;;
15258d623946Smrg    *:AROS:*:*)
15268d623946Smrg	GUESS=$UNAME_MACHINE-unknown-aros
15278d623946Smrg	;;
15283e72ca8cSmrg    x86_64:VMkernel:*:*)
15298d623946Smrg	GUESS=$UNAME_MACHINE-unknown-esx
15308d623946Smrg	;;
15318d623946Smrg    amd64:Isilon\ OneFS:*:*)
15328d623946Smrg	GUESS=x86_64-unknown-onefs
15338d623946Smrg	;;
15348d623946Smrg    *:Unleashed:*:*)
15358d623946Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
15368d623946Smrg	;;
15378d623946Smrgesac
15388d623946Smrg
15398d623946Smrg# Do we have a guess based on uname results?
15408d623946Smrgif test "x$GUESS" != x; then
15418d623946Smrg    echo "$GUESS"
15428d623946Smrg    exit
15438d623946Smrgfi
15448d623946Smrg
15458d623946Smrg# No uname command or uname output not recognized.
15468d623946Smrgset_cc_for_build
15478d623946Smrgcat > "$dummy.c" <<EOF
15488d623946Smrg#ifdef _SEQUENT_
15498d623946Smrg#include <sys/types.h>
15508d623946Smrg#include <sys/utsname.h>
15518d623946Smrg#endif
15528d623946Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15538d623946Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15548d623946Smrg#include <signal.h>
15558d623946Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
15568d623946Smrg#include <sys/utsname.h>
15578d623946Smrg#endif
15588d623946Smrg#endif
15598d623946Smrg#endif
15608d623946Smrgmain ()
15618d623946Smrg{
15628d623946Smrg#if defined (sony)
15638d623946Smrg#if defined (MIPSEB)
15648d623946Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15658d623946Smrg     I don't know....  */
15668d623946Smrg  printf ("mips-sony-bsd\n"); exit (0);
15678d623946Smrg#else
15688d623946Smrg#include <sys/param.h>
15698d623946Smrg  printf ("m68k-sony-newsos%s\n",
15708d623946Smrg#ifdef NEWSOS4
15718d623946Smrg  "4"
15728d623946Smrg#else
15738d623946Smrg  ""
15748d623946Smrg#endif
15758d623946Smrg  ); exit (0);
15768d623946Smrg#endif
15778d623946Smrg#endif
15788d623946Smrg
15798d623946Smrg#if defined (NeXT)
15808d623946Smrg#if !defined (__ARCHITECTURE__)
15818d623946Smrg#define __ARCHITECTURE__ "m68k"
15828d623946Smrg#endif
15838d623946Smrg  int version;
15848d623946Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15858d623946Smrg  if (version < 4)
15868d623946Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15878d623946Smrg  else
15888d623946Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15898d623946Smrg  exit (0);
15908d623946Smrg#endif
15918d623946Smrg
15928d623946Smrg#if defined (MULTIMAX) || defined (n16)
15938d623946Smrg#if defined (UMAXV)
15948d623946Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
15958d623946Smrg#else
15968d623946Smrg#if defined (CMU)
15978d623946Smrg  printf ("ns32k-encore-mach\n"); exit (0);
15988d623946Smrg#else
15998d623946Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
16008d623946Smrg#endif
16018d623946Smrg#endif
16028d623946Smrg#endif
16038d623946Smrg
16048d623946Smrg#if defined (__386BSD__)
16058d623946Smrg  printf ("i386-pc-bsd\n"); exit (0);
16068d623946Smrg#endif
16078d623946Smrg
16088d623946Smrg#if defined (sequent)
16098d623946Smrg#if defined (i386)
16108d623946Smrg  printf ("i386-sequent-dynix\n"); exit (0);
16118d623946Smrg#endif
16128d623946Smrg#if defined (ns32000)
16138d623946Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16148d623946Smrg#endif
16158d623946Smrg#endif
16168d623946Smrg
16178d623946Smrg#if defined (_SEQUENT_)
16188d623946Smrg  struct utsname un;
16198d623946Smrg
16208d623946Smrg  uname(&un);
16218d623946Smrg  if (strncmp(un.version, "V2", 2) == 0) {
16228d623946Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
16238d623946Smrg  }
16248d623946Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16258d623946Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
16268d623946Smrg  }
16278d623946Smrg  printf ("i386-sequent-ptx\n"); exit (0);
16288d623946Smrg#endif
16298d623946Smrg
16308d623946Smrg#if defined (vax)
16318d623946Smrg#if !defined (ultrix)
16328d623946Smrg#include <sys/param.h>
16338d623946Smrg#if defined (BSD)
16348d623946Smrg#if BSD == 43
16358d623946Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
16368d623946Smrg#else
16378d623946Smrg#if BSD == 199006
16388d623946Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16398d623946Smrg#else
16408d623946Smrg  printf ("vax-dec-bsd\n"); exit (0);
16418d623946Smrg#endif
16428d623946Smrg#endif
16438d623946Smrg#else
16448d623946Smrg  printf ("vax-dec-bsd\n"); exit (0);
16458d623946Smrg#endif
16468d623946Smrg#else
16478d623946Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
16488d623946Smrg  struct utsname un;
16498d623946Smrg  uname (&un);
16508d623946Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16518d623946Smrg#else
16528d623946Smrg  printf ("vax-dec-ultrix\n"); exit (0);
16538d623946Smrg#endif
16548d623946Smrg#endif
16558d623946Smrg#endif
16568d623946Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16578d623946Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16588d623946Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
16598d623946Smrg  struct utsname *un;
16608d623946Smrg  uname (&un);
16618d623946Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16628d623946Smrg#else
16638d623946Smrg  printf ("mips-dec-ultrix\n"); exit (0);
16648d623946Smrg#endif
16658d623946Smrg#endif
16668d623946Smrg#endif
16678d623946Smrg
16688d623946Smrg#if defined (alliant) && defined (i860)
16698d623946Smrg  printf ("i860-alliant-bsd\n"); exit (0);
16708d623946Smrg#endif
16718d623946Smrg
16728d623946Smrg  exit (1);
16738d623946Smrg}
16748d623946SmrgEOF
16758d623946Smrg
16768d623946Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16778d623946Smrg	{ echo "$SYSTEM_NAME"; exit; }
16788d623946Smrg
16798d623946Smrg# Apollos put the system type in the environment.
16808d623946Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16818d623946Smrg
16828d623946Smrgecho "$0: unable to guess system type" >&2
16838d623946Smrg
16848d623946Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
16858d623946Smrg    mips:Linux | mips64:Linux)
16868d623946Smrg	# If we got here on MIPS GNU/Linux, output extra information.
16878d623946Smrg	cat >&2 <<EOF
16888d623946Smrg
16898d623946SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
16908d623946Smrgthe system type. Please install a C compiler and try again.
16918d623946SmrgEOF
16928d623946Smrg	;;
1693ee3138f1Smrgesac
1694ee3138f1Smrg
1695ee3138f1Smrgcat >&2 <<EOF
1696ee3138f1Smrg
16978d623946SmrgThis script (version $timestamp), has failed to recognize the
16988d623946Smrgoperating system you are using. If your script is old, overwrite *all*
16998d623946Smrgcopies of config.guess and config.sub with the latest versions from:
1700ee3138f1Smrg
17018d623946Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1702ee3138f1Smrgand
17038d623946Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17048d623946SmrgEOF
1705ee3138f1Smrg
17068d623946Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
17078d623946Smrgthisyear=`date +%Y`
17088d623946Smrg# shellcheck disable=SC2003
17098d623946Smrgscript_age=`expr "$thisyear" - "$our_year"`
17108d623946Smrgif test "$script_age" -lt 3 ; then
17118d623946Smrg   cat >&2 <<EOF
17128d623946Smrg
17138d623946SmrgIf $0 has already been updated, send the following data and any
17148d623946Smrginformation you think might be pertinent to config-patches@gnu.org to
17158d623946Smrgprovide the necessary information to handle your system.
1716ee3138f1Smrg
1717ee3138f1Smrgconfig.guess timestamp = $timestamp
1718ee3138f1Smrg
1719ee3138f1Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1720ee3138f1Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1721ee3138f1Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1722ee3138f1Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1723ee3138f1Smrg
1724ee3138f1Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1725ee3138f1Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1726ee3138f1Smrg
1727ee3138f1Smrghostinfo               = `(hostinfo) 2>/dev/null`
1728ee3138f1Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1729ee3138f1Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1730ee3138f1Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1731ee3138f1Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1732ee3138f1Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1733ee3138f1Smrg
17348d623946SmrgUNAME_MACHINE = "$UNAME_MACHINE"
17358d623946SmrgUNAME_RELEASE = "$UNAME_RELEASE"
17368d623946SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
17378d623946SmrgUNAME_VERSION = "$UNAME_VERSION"
1738ee3138f1SmrgEOF
17398d623946Smrgfi
1740ee3138f1Smrg
1741ee3138f1Smrgexit 1
1742ee3138f1Smrg
1743ee3138f1Smrg# Local variables:
17448d623946Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1745ee3138f1Smrg# time-stamp-start: "timestamp='"
1746ee3138f1Smrg# time-stamp-format: "%:y-%02m-%02d"
1747ee3138f1Smrg# time-stamp-end: "'"
1748ee3138f1Smrg# End:
1749