1e9554658Smrg#! /bin/sh
2e9554658Smrg# Attempt to guess a canonical system name.
314bc0770Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4e9554658Smrg
514bc0770Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
614bc0770Smrg
714bc0770Smrgtimestamp='2021-06-03'
8e9554658Smrg
9e9554658Smrg# This file is free software; you can redistribute it and/or modify it
10e9554658Smrg# under the terms of the GNU General Public License as published by
115dd5f640Smrg# the Free Software Foundation; either version 3 of the License, or
12e9554658Smrg# (at your option) any later version.
13e9554658Smrg#
14e9554658Smrg# This program is distributed in the hope that it will be useful, but
15e9554658Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16e9554658Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17e9554658Smrg# General Public License for more details.
18e9554658Smrg#
19e9554658Smrg# You should have received a copy of the GNU General Public License
20688b3aecSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21e9554658Smrg#
22e9554658Smrg# As a special exception to the GNU General Public License, if you
23e9554658Smrg# distribute this file as part of a program that contains a
24e9554658Smrg# configuration script generated by Autoconf, you may include it under
255dd5f640Smrg# the same distribution terms that you use for the rest of that
265dd5f640Smrg# program.  This Exception is an additional permission under section 7
275dd5f640Smrg# of the GNU General Public License, version 3 ("GPLv3").
28e9554658Smrg#
29688b3aecSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30e9554658Smrg#
318903d43aSmrg# You can get the latest version of this script from:
3214bc0770Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
335dd5f640Smrg#
34688b3aecSmrg# Please send patches to <config-patches@gnu.org>.
355dd5f640Smrg
36e9554658Smrg
3714bc0770Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
3814bc0770Smrg# about features and limitations of the classic Bourne shell that were
3914bc0770Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
4014bc0770Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
4114bc0770Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
4214bc0770Smrg# have a pre-POSIX /bin/sh.
4314bc0770Smrg
4414bc0770Smrg
45e9554658Smrgme=`echo "$0" | sed -e 's,.*/,,'`
46e9554658Smrg
47e9554658Smrgusage="\
48e9554658SmrgUsage: $0 [OPTION]
49e9554658Smrg
50e9554658SmrgOutput the configuration name of the system \`$me' is run on.
51e9554658Smrg
52688b3aecSmrgOptions:
53e9554658Smrg  -h, --help         print this help, then exit
54e9554658Smrg  -t, --time-stamp   print date of last modification, then exit
55e9554658Smrg  -v, --version      print version number, then exit
56e9554658Smrg
57e9554658SmrgReport bugs and patches to <config-patches@gnu.org>."
58e9554658Smrg
59e9554658Smrgversion="\
60e9554658SmrgGNU config.guess ($timestamp)
61e9554658Smrg
62e9554658SmrgOriginally written by Per Bothner.
6314bc0770SmrgCopyright 1992-2021 Free Software Foundation, Inc.
64e9554658Smrg
65e9554658SmrgThis is free software; see the source for copying conditions.  There is NO
66e9554658Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67e9554658Smrg
68e9554658Smrghelp="
69e9554658SmrgTry \`$me --help' for more information."
70e9554658Smrg
71e9554658Smrg# Parse command line
72e9554658Smrgwhile test $# -gt 0 ; do
73e9554658Smrg  case $1 in
74e9554658Smrg    --time-stamp | --time* | -t )
75e9554658Smrg       echo "$timestamp" ; exit ;;
76e9554658Smrg    --version | -v )
77e9554658Smrg       echo "$version" ; exit ;;
78e9554658Smrg    --help | --h* | -h )
79e9554658Smrg       echo "$usage"; exit ;;
80e9554658Smrg    -- )     # Stop option processing
81e9554658Smrg       shift; break ;;
82e9554658Smrg    - )	# Use stdin as input.
83e9554658Smrg       break ;;
84e9554658Smrg    -* )
85e9554658Smrg       echo "$me: invalid option $1$help" >&2
86e9554658Smrg       exit 1 ;;
87e9554658Smrg    * )
88e9554658Smrg       break ;;
89e9554658Smrg  esac
90e9554658Smrgdone
91e9554658Smrg
92e9554658Smrgif test $# != 0; then
93e9554658Smrg  echo "$me: too many arguments$help" >&2
94e9554658Smrg  exit 1
95e9554658Smrgfi
96e9554658Smrg
9714bc0770Smrg# Just in case it came from the environment.
9814bc0770SmrgGUESS=
99e9554658Smrg
100e9554658Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101e9554658Smrg# compiler to aid in system detection is discouraged as it requires
102e9554658Smrg# temporary files to be created and, as you can see below, it is a
103e9554658Smrg# headache to deal with in a portable fashion.
104e9554658Smrg
105e9554658Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106e9554658Smrg# use `HOST_CC' if defined, but it is deprecated.
107e9554658Smrg
108e9554658Smrg# Portable tmp directory creation inspired by the Autoconf team.
109e9554658Smrg
11014bc0770Smrgtmp=
11114bc0770Smrg# shellcheck disable=SC2172
11214bc0770Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
11314bc0770Smrg
11414bc0770Smrgset_cc_for_build() {
11514bc0770Smrg    # prevent multiple calls if $tmp is already set
11614bc0770Smrg    test "$tmp" && return 0
11714bc0770Smrg    : "${TMPDIR=/tmp}"
11814bc0770Smrg    # shellcheck disable=SC2039,SC3028
11914bc0770Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
12014bc0770Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
12114bc0770Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
12214bc0770Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
12314bc0770Smrg    dummy=$tmp/dummy
12414bc0770Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
12514bc0770Smrg	,,)    echo "int x;" > "$dummy.c"
12614bc0770Smrg	       for driver in cc gcc c89 c99 ; do
12714bc0770Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
12814bc0770Smrg		       CC_FOR_BUILD=$driver
12914bc0770Smrg		       break
13014bc0770Smrg		   fi
13114bc0770Smrg	       done
13214bc0770Smrg	       if test x"$CC_FOR_BUILD" = x ; then
13314bc0770Smrg		   CC_FOR_BUILD=no_compiler_found
13414bc0770Smrg	       fi
13514bc0770Smrg	       ;;
13614bc0770Smrg	,,*)   CC_FOR_BUILD=$CC ;;
13714bc0770Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13814bc0770Smrg    esac
13914bc0770Smrg}
140e9554658Smrg
141e9554658Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142e9554658Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
14314bc0770Smrgif test -f /.attbin/uname ; then
144e9554658Smrg	PATH=$PATH:/.attbin ; export PATH
145e9554658Smrgfi
146e9554658Smrg
147e9554658SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148e9554658SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14914bc0770SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150e9554658SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151e9554658Smrg
15214bc0770Smrgcase $UNAME_SYSTEM in
1535dd5f640SmrgLinux|GNU|GNU/*)
15414bc0770Smrg	LIBC=unknown
1555dd5f640Smrg
15614bc0770Smrg	set_cc_for_build
157688b3aecSmrg	cat <<-EOF > "$dummy.c"
1585dd5f640Smrg	#include <features.h>
1595dd5f640Smrg	#if defined(__UCLIBC__)
1605dd5f640Smrg	LIBC=uclibc
1615dd5f640Smrg	#elif defined(__dietlibc__)
1625dd5f640Smrg	LIBC=dietlibc
16314bc0770Smrg	#elif defined(__GLIBC__)
1645dd5f640Smrg	LIBC=gnu
16514bc0770Smrg	#else
16614bc0770Smrg	#include <stdarg.h>
16714bc0770Smrg	/* First heuristic to detect musl libc.  */
16814bc0770Smrg	#ifdef __DEFINED_va_list
16914bc0770Smrg	LIBC=musl
17014bc0770Smrg	#endif
1715dd5f640Smrg	#endif
1725dd5f640Smrg	EOF
17314bc0770Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
17414bc0770Smrg	eval "$cc_set_libc"
175688b3aecSmrg
17614bc0770Smrg	# Second heuristic to detect musl libc.
17714bc0770Smrg	if [ "$LIBC" = unknown ] &&
17814bc0770Smrg	   command -v ldd >/dev/null &&
17914bc0770Smrg	   ldd --version 2>&1 | grep -q ^musl; then
18014bc0770Smrg		LIBC=musl
18114bc0770Smrg	fi
18214bc0770Smrg
18314bc0770Smrg	# If the system lacks a compiler, then just pick glibc.
18414bc0770Smrg	# We could probably try harder.
18514bc0770Smrg	if [ "$LIBC" = unknown ]; then
18614bc0770Smrg		LIBC=gnu
187688b3aecSmrg	fi
1885dd5f640Smrg	;;
1895dd5f640Smrgesac
1905dd5f640Smrg
191e9554658Smrg# Note: order is significant - the case branches are not exclusive.
192e9554658Smrg
19314bc0770Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194e9554658Smrg    *:NetBSD:*:*)
195e9554658Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
1965dd5f640Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197e9554658Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198e9554658Smrg	# switched to ELF, *-*-netbsd* would select the old
199e9554658Smrg	# object file format.  This provides both forward
200e9554658Smrg	# compatibility and a consistent mechanism for selecting the
201e9554658Smrg	# object file format.
202e9554658Smrg	#
203e9554658Smrg	# Note: NetBSD doesn't particularly care about the vendor
204e9554658Smrg	# portion of the name.  We always set it to "unknown".
205688b3aecSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
20614bc0770Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20714bc0770Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208688b3aecSmrg	    echo unknown)`
20914bc0770Smrg	case $UNAME_MACHINE_ARCH in
21014bc0770Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
211e9554658Smrg	    armeb) machine=armeb-unknown ;;
212e9554658Smrg	    arm*) machine=arm-unknown ;;
213e9554658Smrg	    sh3el) machine=shl-unknown ;;
214e9554658Smrg	    sh3eb) machine=sh-unknown ;;
215c2b339b4Smrg	    sh5el) machine=sh5le-unknown ;;
216688b3aecSmrg	    earmv*)
217688b3aecSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218688b3aecSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
21914bc0770Smrg		machine=${arch}${endian}-unknown
220688b3aecSmrg		;;
22114bc0770Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222e9554658Smrg	esac
223e9554658Smrg	# The Operating System including object format, if it has switched
224688b3aecSmrg	# to ELF recently (or will in the future) and ABI.
22514bc0770Smrg	case $UNAME_MACHINE_ARCH in
226688b3aecSmrg	    earm*)
227688b3aecSmrg		os=netbsdelf
228688b3aecSmrg		;;
229e9554658Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
23014bc0770Smrg		set_cc_for_build
231e9554658Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2328903d43aSmrg			| grep -q __ELF__
233e9554658Smrg		then
234e9554658Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235e9554658Smrg		    # Return netbsd for either.  FIX?
236e9554658Smrg		    os=netbsd
237e9554658Smrg		else
238e9554658Smrg		    os=netbsdelf
239e9554658Smrg		fi
240e9554658Smrg		;;
241e9554658Smrg	    *)
2425dd5f640Smrg		os=netbsd
243e9554658Smrg		;;
244e9554658Smrg	esac
245688b3aecSmrg	# Determine ABI tags.
24614bc0770Smrg	case $UNAME_MACHINE_ARCH in
247688b3aecSmrg	    earm*)
248688b3aecSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249688b3aecSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250688b3aecSmrg		;;
251688b3aecSmrg	esac
252e9554658Smrg	# The OS release
253e9554658Smrg	# Debian GNU/NetBSD machines have a different userland, and
254e9554658Smrg	# thus, need a distinct triplet. However, they do not need
255e9554658Smrg	# kernel version information, so it can be replaced with a
256e9554658Smrg	# suitable tag, in the style of linux-gnu.
25714bc0770Smrg	case $UNAME_VERSION in
258e9554658Smrg	    Debian*)
259e9554658Smrg		release='-gnu'
260e9554658Smrg		;;
261e9554658Smrg	    *)
262688b3aecSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263e9554658Smrg		;;
264e9554658Smrg	esac
265e9554658Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266e9554658Smrg	# contains redundant information, the shorter form:
267e9554658Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
26814bc0770Smrg	GUESS=$machine-${os}${release}${abi-}
26914bc0770Smrg	;;
2705dd5f640Smrg    *:Bitrig:*:*)
2715dd5f640Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
27214bc0770Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
27314bc0770Smrg	;;
274e9554658Smrg    *:OpenBSD:*:*)
275e9554658Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
27614bc0770Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
27714bc0770Smrg	;;
27814bc0770Smrg    *:SecBSD:*:*)
27914bc0770Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
28014bc0770Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
28114bc0770Smrg	;;
282688b3aecSmrg    *:LibertyBSD:*:*)
283688b3aecSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
28414bc0770Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
28514bc0770Smrg	;;
286688b3aecSmrg    *:MidnightBSD:*:*)
28714bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
28814bc0770Smrg	;;
289e9554658Smrg    *:ekkoBSD:*:*)
29014bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
29114bc0770Smrg	;;
292e9554658Smrg    *:SolidBSD:*:*)
29314bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
29414bc0770Smrg	;;
29514bc0770Smrg    *:OS108:*:*)
29614bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
29714bc0770Smrg	;;
298e9554658Smrg    macppc:MirBSD:*:*)
29914bc0770Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
30014bc0770Smrg	;;
301e9554658Smrg    *:MirBSD:*:*)
30214bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
30314bc0770Smrg	;;
304688b3aecSmrg    *:Sortix:*:*)
30514bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
30614bc0770Smrg	;;
30714bc0770Smrg    *:Twizzler:*:*)
30814bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
30914bc0770Smrg	;;
310688b3aecSmrg    *:Redox:*:*)
31114bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-redox
31214bc0770Smrg	;;
313688b3aecSmrg    mips:OSF1:*.*)
31414bc0770Smrg	GUESS=mips-dec-osf1
31514bc0770Smrg	;;
316e9554658Smrg    alpha:OSF1:*:*)
31714bc0770Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
31814bc0770Smrg	trap '' 0
319e9554658Smrg	case $UNAME_RELEASE in
320e9554658Smrg	*4.0)
321e9554658Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322e9554658Smrg		;;
323e9554658Smrg	*5.*)
3245dd5f640Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325e9554658Smrg		;;
326e9554658Smrg	esac
327e9554658Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328e9554658Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329e9554658Smrg	# covers most systems running today.  This code pipes the CPU
330e9554658Smrg	# types through head -n 1, so we only detect the type of CPU 0.
331e9554658Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
33214bc0770Smrg	case $ALPHA_CPU_TYPE in
333e9554658Smrg	    "EV4 (21064)")
334688b3aecSmrg		UNAME_MACHINE=alpha ;;
335e9554658Smrg	    "EV4.5 (21064)")
336688b3aecSmrg		UNAME_MACHINE=alpha ;;
337e9554658Smrg	    "LCA4 (21066/21068)")
338688b3aecSmrg		UNAME_MACHINE=alpha ;;
339e9554658Smrg	    "EV5 (21164)")
340688b3aecSmrg		UNAME_MACHINE=alphaev5 ;;
341e9554658Smrg	    "EV5.6 (21164A)")
342688b3aecSmrg		UNAME_MACHINE=alphaev56 ;;
343e9554658Smrg	    "EV5.6 (21164PC)")
344688b3aecSmrg		UNAME_MACHINE=alphapca56 ;;
345e9554658Smrg	    "EV5.7 (21164PC)")
346688b3aecSmrg		UNAME_MACHINE=alphapca57 ;;
347e9554658Smrg	    "EV6 (21264)")
348688b3aecSmrg		UNAME_MACHINE=alphaev6 ;;
349e9554658Smrg	    "EV6.7 (21264A)")
350688b3aecSmrg		UNAME_MACHINE=alphaev67 ;;
351e9554658Smrg	    "EV6.8CB (21264C)")
352688b3aecSmrg		UNAME_MACHINE=alphaev68 ;;
353e9554658Smrg	    "EV6.8AL (21264B)")
354688b3aecSmrg		UNAME_MACHINE=alphaev68 ;;
355e9554658Smrg	    "EV6.8CX (21264D)")
356688b3aecSmrg		UNAME_MACHINE=alphaev68 ;;
357e9554658Smrg	    "EV6.9A (21264/EV69A)")
358688b3aecSmrg		UNAME_MACHINE=alphaev69 ;;
359e9554658Smrg	    "EV7 (21364)")
360688b3aecSmrg		UNAME_MACHINE=alphaev7 ;;
361e9554658Smrg	    "EV7.9 (21364A)")
362688b3aecSmrg		UNAME_MACHINE=alphaev79 ;;
363e9554658Smrg	esac
364e9554658Smrg	# A Pn.n version is a patched version.
365e9554658Smrg	# A Vn.n version is a released version.
366e9554658Smrg	# A Tn.n version is a released field test version.
367e9554658Smrg	# A Xn.n version is an unreleased experimental baselevel.
368e9554658Smrg	# 1.2 uses "1.2" for uname -r.
36914bc0770Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
37014bc0770Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
37114bc0770Smrg	;;
372e9554658Smrg    Amiga*:UNIX_System_V:4.0:*)
37314bc0770Smrg	GUESS=m68k-unknown-sysv4
37414bc0770Smrg	;;
375e9554658Smrg    *:[Aa]miga[Oo][Ss]:*:*)
37614bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
37714bc0770Smrg	;;
378e9554658Smrg    *:[Mm]orph[Oo][Ss]:*:*)
37914bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
38014bc0770Smrg	;;
381e9554658Smrg    *:OS/390:*:*)
38214bc0770Smrg	GUESS=i370-ibm-openedition
38314bc0770Smrg	;;
384e9554658Smrg    *:z/VM:*:*)
38514bc0770Smrg	GUESS=s390-ibm-zvmoe
38614bc0770Smrg	;;
387e9554658Smrg    *:OS400:*:*)
38814bc0770Smrg	GUESS=powerpc-ibm-os400
38914bc0770Smrg	;;
390e9554658Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
39114bc0770Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
39214bc0770Smrg	;;
3935dd5f640Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
39414bc0770Smrg	GUESS=arm-unknown-riscos
39514bc0770Smrg	;;
396e9554658Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
39714bc0770Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
39814bc0770Smrg	;;
399e9554658Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400e9554658Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
40114bc0770Smrg	case `(/bin/universe) 2>/dev/null` in
40214bc0770Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
40314bc0770Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
40414bc0770Smrg	esac
40514bc0770Smrg	;;
406e9554658Smrg    NILE*:*:*:dcosx)
40714bc0770Smrg	GUESS=pyramid-pyramid-svr4
40814bc0770Smrg	;;
409e9554658Smrg    DRS?6000:unix:4.0:6*)
41014bc0770Smrg	GUESS=sparc-icl-nx6
41114bc0770Smrg	;;
412e9554658Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413e9554658Smrg	case `/usr/bin/uname -p` in
41414bc0770Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
41514bc0770Smrg	esac
41614bc0770Smrg	;;
417c2b339b4Smrg    s390x:SunOS:*:*)
41814bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
41914bc0770Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
42014bc0770Smrg	;;
421e9554658Smrg    sun4H:SunOS:5.*:*)
42214bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42314bc0770Smrg	GUESS=sparc-hal-solaris2$SUN_REL
42414bc0770Smrg	;;
425e9554658Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
42614bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42714bc0770Smrg	GUESS=sparc-sun-solaris2$SUN_REL
42814bc0770Smrg	;;
4298903d43aSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
43014bc0770Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
43114bc0770Smrg	;;
432c2b339b4Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
43314bc0770Smrg	set_cc_for_build
434688b3aecSmrg	SUN_ARCH=i386
435c2b339b4Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436c2b339b4Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437c2b339b4Smrg	# This test works for both compilers.
43814bc0770Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439c2b339b4Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440688b3aecSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
441c2b339b4Smrg		grep IS_64BIT_ARCH >/dev/null
442c2b339b4Smrg	    then
443688b3aecSmrg		SUN_ARCH=x86_64
444c2b339b4Smrg	    fi
445c2b339b4Smrg	fi
44614bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
44714bc0770Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
44814bc0770Smrg	;;
449e9554658Smrg    sun4*:SunOS:6*:*)
450e9554658Smrg	# According to config.sub, this is the proper way to canonicalize
451e9554658Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452e9554658Smrg	# it's likely to be more like Solaris than SunOS4.
45314bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
45414bc0770Smrg	GUESS=sparc-sun-solaris3$SUN_REL
45514bc0770Smrg	;;
456e9554658Smrg    sun4*:SunOS:*:*)
45714bc0770Smrg	case `/usr/bin/arch -k` in
458e9554658Smrg	    Series*|S4*)
459e9554658Smrg		UNAME_RELEASE=`uname -v`
460e9554658Smrg		;;
461e9554658Smrg	esac
462e9554658Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
46314bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
46414bc0770Smrg	GUESS=sparc-sun-sunos$SUN_REL
46514bc0770Smrg	;;
466e9554658Smrg    sun3*:SunOS:*:*)
46714bc0770Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
46814bc0770Smrg	;;
469e9554658Smrg    sun*:*:4.2BSD:*)
470e9554658Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471688b3aecSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
47214bc0770Smrg	case `/bin/arch` in
473e9554658Smrg	    sun3)
47414bc0770Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475e9554658Smrg		;;
476e9554658Smrg	    sun4)
47714bc0770Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478e9554658Smrg		;;
479e9554658Smrg	esac
48014bc0770Smrg	;;
481e9554658Smrg    aushp:SunOS:*:*)
48214bc0770Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
48314bc0770Smrg	;;
484e9554658Smrg    # The situation for MiNT is a little confusing.  The machine name
485e9554658Smrg    # can be virtually everything (everything which is not
486e9554658Smrg    # "atarist" or "atariste" at least should have a processor
487e9554658Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488e9554658Smrg    # to the lowercase version "mint" (or "freemint").  Finally
489e9554658Smrg    # the system name "TOS" denotes a system which is actually not
490e9554658Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491e9554658Smrg    # be no problem.
492e9554658Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
49314bc0770Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49414bc0770Smrg	;;
495e9554658Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
49614bc0770Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49714bc0770Smrg	;;
498e9554658Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
49914bc0770Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
50014bc0770Smrg	;;
501e9554658Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
50214bc0770Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
50314bc0770Smrg	;;
504e9554658Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
50514bc0770Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
50614bc0770Smrg	;;
507e9554658Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
50814bc0770Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
50914bc0770Smrg	;;
510e9554658Smrg    m68k:machten:*:*)
51114bc0770Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
51214bc0770Smrg	;;
513e9554658Smrg    powerpc:machten:*:*)
51414bc0770Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
51514bc0770Smrg	;;
516e9554658Smrg    RISC*:Mach:*:*)
51714bc0770Smrg	GUESS=mips-dec-mach_bsd4.3
51814bc0770Smrg	;;
519e9554658Smrg    RISC*:ULTRIX:*:*)
52014bc0770Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
52114bc0770Smrg	;;
522e9554658Smrg    VAX*:ULTRIX*:*:*)
52314bc0770Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
52414bc0770Smrg	;;
525e9554658Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
52614bc0770Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
52714bc0770Smrg	;;
528e9554658Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
52914bc0770Smrg	set_cc_for_build
530688b3aecSmrg	sed 's/^	//' << EOF > "$dummy.c"
531e9554658Smrg#ifdef __cplusplus
532e9554658Smrg#include <stdio.h>  /* for printf() prototype */
533e9554658Smrg	int main (int argc, char *argv[]) {
534e9554658Smrg#else
535e9554658Smrg	int main (argc, argv) int argc; char *argv[]; {
536e9554658Smrg#endif
537e9554658Smrg	#if defined (host_mips) && defined (MIPSEB)
538e9554658Smrg	#if defined (SYSTYPE_SYSV)
539688b3aecSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540e9554658Smrg	#endif
541e9554658Smrg	#if defined (SYSTYPE_SVR4)
542688b3aecSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543e9554658Smrg	#endif
544e9554658Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545688b3aecSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546e9554658Smrg	#endif
547e9554658Smrg	#endif
548e9554658Smrg	  exit (-1);
549e9554658Smrg	}
550e9554658SmrgEOF
551688b3aecSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552688b3aecSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553688b3aecSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554e9554658Smrg	    { echo "$SYSTEM_NAME"; exit; }
55514bc0770Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
55614bc0770Smrg	;;
557e9554658Smrg    Motorola:PowerMAX_OS:*:*)
55814bc0770Smrg	GUESS=powerpc-motorola-powermax
55914bc0770Smrg	;;
560e9554658Smrg    Motorola:*:4.3:PL8-*)
56114bc0770Smrg	GUESS=powerpc-harris-powermax
56214bc0770Smrg	;;
563e9554658Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
56414bc0770Smrg	GUESS=powerpc-harris-powermax
56514bc0770Smrg	;;
566e9554658Smrg    Night_Hawk:Power_UNIX:*:*)
56714bc0770Smrg	GUESS=powerpc-harris-powerunix
56814bc0770Smrg	;;
569e9554658Smrg    m88k:CX/UX:7*:*)
57014bc0770Smrg	GUESS=m88k-harris-cxux7
57114bc0770Smrg	;;
572e9554658Smrg    m88k:*:4*:R4*)
57314bc0770Smrg	GUESS=m88k-motorola-sysv4
57414bc0770Smrg	;;
575e9554658Smrg    m88k:*:3*:R3*)
57614bc0770Smrg	GUESS=m88k-motorola-sysv3
57714bc0770Smrg	;;
578e9554658Smrg    AViiON:dgux:*:*)
5795dd5f640Smrg	# DG/UX returns AViiON for all architectures
5805dd5f640Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
58114bc0770Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582e9554658Smrg	then
58314bc0770Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
58414bc0770Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
585e9554658Smrg	    then
58614bc0770Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587e9554658Smrg	    else
58814bc0770Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589e9554658Smrg	    fi
590e9554658Smrg	else
59114bc0770Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592e9554658Smrg	fi
59314bc0770Smrg	;;
594e9554658Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
59514bc0770Smrg	GUESS=m88k-dolphin-sysv3
59614bc0770Smrg	;;
597e9554658Smrg    M88*:*:R3*:*)
598e9554658Smrg	# Delta 88k system running SVR3
59914bc0770Smrg	GUESS=m88k-motorola-sysv3
60014bc0770Smrg	;;
601e9554658Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
60214bc0770Smrg	GUESS=m88k-tektronix-sysv3
60314bc0770Smrg	;;
604e9554658Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
60514bc0770Smrg	GUESS=m68k-tektronix-bsd
60614bc0770Smrg	;;
607e9554658Smrg    *:IRIX*:*:*)
60814bc0770Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
60914bc0770Smrg	GUESS=mips-sgi-irix$IRIX_REL
61014bc0770Smrg	;;
611e9554658Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
61214bc0770Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
61314bc0770Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614e9554658Smrg    i*86:AIX:*:*)
61514bc0770Smrg	GUESS=i386-ibm-aix
61614bc0770Smrg	;;
617e9554658Smrg    ia64:AIX:*:*)
61814bc0770Smrg	if test -x /usr/bin/oslevel ; then
619e9554658Smrg		IBM_REV=`/usr/bin/oslevel`
620e9554658Smrg	else
62114bc0770Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622e9554658Smrg	fi
62314bc0770Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
62414bc0770Smrg	;;
625e9554658Smrg    *:AIX:2:3)
626e9554658Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
62714bc0770Smrg		set_cc_for_build
628688b3aecSmrg		sed 's/^		//' << EOF > "$dummy.c"
629e9554658Smrg		#include <sys/systemcfg.h>
630e9554658Smrg
631e9554658Smrg		main()
632e9554658Smrg			{
633e9554658Smrg			if (!__power_pc())
634e9554658Smrg				exit(1);
635e9554658Smrg			puts("powerpc-ibm-aix3.2.5");
636e9554658Smrg			exit(0);
637e9554658Smrg			}
638e9554658SmrgEOF
639688b3aecSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640e9554658Smrg		then
64114bc0770Smrg			GUESS=$SYSTEM_NAME
642e9554658Smrg		else
64314bc0770Smrg			GUESS=rs6000-ibm-aix3.2.5
644e9554658Smrg		fi
645e9554658Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
64614bc0770Smrg		GUESS=rs6000-ibm-aix3.2.4
647e9554658Smrg	else
64814bc0770Smrg		GUESS=rs6000-ibm-aix3.2
649e9554658Smrg	fi
65014bc0770Smrg	;;
6518903d43aSmrg    *:AIX:*:[4567])
652e9554658Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653688b3aecSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654e9554658Smrg		IBM_ARCH=rs6000
655e9554658Smrg	else
656e9554658Smrg		IBM_ARCH=powerpc
657e9554658Smrg	fi
65814bc0770Smrg	if test -x /usr/bin/lslpp ; then
65914bc0770Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660688b3aecSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661e9554658Smrg	else
66214bc0770Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663e9554658Smrg	fi
66414bc0770Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
66514bc0770Smrg	;;
666e9554658Smrg    *:AIX:*:*)
66714bc0770Smrg	GUESS=rs6000-ibm-aix
66814bc0770Smrg	;;
669688b3aecSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
67014bc0770Smrg	GUESS=romp-ibm-bsd4.4
67114bc0770Smrg	;;
672e9554658Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
67314bc0770Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
67414bc0770Smrg	;;                                  # report: romp-ibm BSD 4.3
675e9554658Smrg    *:BOSX:*:*)
67614bc0770Smrg	GUESS=rs6000-bull-bosx
67714bc0770Smrg	;;
678e9554658Smrg    DPX/2?00:B.O.S.:*:*)
67914bc0770Smrg	GUESS=m68k-bull-sysv3
68014bc0770Smrg	;;
681e9554658Smrg    9000/[34]??:4.3bsd:1.*:*)
68214bc0770Smrg	GUESS=m68k-hp-bsd
68314bc0770Smrg	;;
684e9554658Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
68514bc0770Smrg	GUESS=m68k-hp-bsd4.4
68614bc0770Smrg	;;
687e9554658Smrg    9000/[34678]??:HP-UX:*:*)
68814bc0770Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
68914bc0770Smrg	case $UNAME_MACHINE in
690688b3aecSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691688b3aecSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
692e9554658Smrg	    9000/[678][0-9][0-9])
69314bc0770Smrg		if test -x /usr/bin/getconf; then
694e9554658Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6955dd5f640Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
69614bc0770Smrg		    case $sc_cpu_version in
697688b3aecSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698688b3aecSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6995dd5f640Smrg		      532)                      # CPU_PA_RISC2_0
70014bc0770Smrg			case $sc_kernel_bits in
701688b3aecSmrg			  32) HP_ARCH=hppa2.0n ;;
702688b3aecSmrg			  64) HP_ARCH=hppa2.0w ;;
703688b3aecSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7045dd5f640Smrg			esac ;;
7055dd5f640Smrg		    esac
706e9554658Smrg		fi
70714bc0770Smrg		if test "$HP_ARCH" = ""; then
70814bc0770Smrg		    set_cc_for_build
709688b3aecSmrg		    sed 's/^		//' << EOF > "$dummy.c"
710e9554658Smrg
7115dd5f640Smrg		#define _HPUX_SOURCE
7125dd5f640Smrg		#include <stdlib.h>
7135dd5f640Smrg		#include <unistd.h>
714e9554658Smrg
7155dd5f640Smrg		int main ()
7165dd5f640Smrg		{
7175dd5f640Smrg		#if defined(_SC_KERNEL_BITS)
7185dd5f640Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
7195dd5f640Smrg		#endif
7205dd5f640Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721e9554658Smrg
7225dd5f640Smrg		    switch (cpu)
7235dd5f640Smrg			{
7245dd5f640Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7255dd5f640Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7265dd5f640Smrg			case CPU_PA_RISC2_0:
7275dd5f640Smrg		#if defined(_SC_KERNEL_BITS)
7285dd5f640Smrg			    switch (bits)
7295dd5f640Smrg				{
7305dd5f640Smrg				case 64: puts ("hppa2.0w"); break;
7315dd5f640Smrg				case 32: puts ("hppa2.0n"); break;
7325dd5f640Smrg				default: puts ("hppa2.0"); break;
7335dd5f640Smrg				} break;
7345dd5f640Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
7355dd5f640Smrg			    puts ("hppa2.0"); break;
7365dd5f640Smrg		#endif
7375dd5f640Smrg			default: puts ("hppa1.0"); break;
7385dd5f640Smrg			}
7395dd5f640Smrg		    exit (0);
7405dd5f640Smrg		}
741e9554658SmrgEOF
742688b3aecSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743e9554658Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744e9554658Smrg		fi ;;
745e9554658Smrg	esac
74614bc0770Smrg	if test "$HP_ARCH" = hppa2.0w
747e9554658Smrg	then
74814bc0770Smrg	    set_cc_for_build
749e9554658Smrg
750e9554658Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751e9554658Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752e9554658Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753e9554658Smrg	    #
754e9554658Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
755e9554658Smrg	    # => hppa2.0w-hp-hpux11.23
756e9554658Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757e9554658Smrg	    # => hppa64-hp-hpux11.23
758e9554658Smrg
759688b3aecSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7608903d43aSmrg		grep -q __LP64__
761e9554658Smrg	    then
762688b3aecSmrg		HP_ARCH=hppa2.0w
763e9554658Smrg	    else
764688b3aecSmrg		HP_ARCH=hppa64
765e9554658Smrg	    fi
766e9554658Smrg	fi
76714bc0770Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
76814bc0770Smrg	;;
769e9554658Smrg    ia64:HP-UX:*:*)
77014bc0770Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
77114bc0770Smrg	GUESS=ia64-hp-hpux$HPUX_REV
77214bc0770Smrg	;;
773e9554658Smrg    3050*:HI-UX:*:*)
77414bc0770Smrg	set_cc_for_build
775688b3aecSmrg	sed 's/^	//' << EOF > "$dummy.c"
776e9554658Smrg	#include <unistd.h>
777e9554658Smrg	int
778e9554658Smrg	main ()
779e9554658Smrg	{
780e9554658Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
781e9554658Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782e9554658Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783e9554658Smrg	     results, however.  */
784e9554658Smrg	  if (CPU_IS_PA_RISC (cpu))
785e9554658Smrg	    {
786e9554658Smrg	      switch (cpu)
787e9554658Smrg		{
788e9554658Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789e9554658Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790e9554658Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791e9554658Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792e9554658Smrg		}
793e9554658Smrg	    }
794e9554658Smrg	  else if (CPU_IS_HP_MC68K (cpu))
795e9554658Smrg	    puts ("m68k-hitachi-hiuxwe2");
796e9554658Smrg	  else puts ("unknown-hitachi-hiuxwe2");
797e9554658Smrg	  exit (0);
798e9554658Smrg	}
799e9554658SmrgEOF
800688b3aecSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801e9554658Smrg		{ echo "$SYSTEM_NAME"; exit; }
80214bc0770Smrg	GUESS=unknown-hitachi-hiuxwe2
80314bc0770Smrg	;;
804688b3aecSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
80514bc0770Smrg	GUESS=hppa1.1-hp-bsd
80614bc0770Smrg	;;
807e9554658Smrg    9000/8??:4.3bsd:*:*)
80814bc0770Smrg	GUESS=hppa1.0-hp-bsd
80914bc0770Smrg	;;
810e9554658Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
81114bc0770Smrg	GUESS=hppa1.0-hp-mpeix
81214bc0770Smrg	;;
813688b3aecSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
81414bc0770Smrg	GUESS=hppa1.1-hp-osf
81514bc0770Smrg	;;
816e9554658Smrg    hp8??:OSF1:*:*)
81714bc0770Smrg	GUESS=hppa1.0-hp-osf
81814bc0770Smrg	;;
819e9554658Smrg    i*86:OSF1:*:*)
82014bc0770Smrg	if test -x /usr/sbin/sysversion ; then
82114bc0770Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822e9554658Smrg	else
82314bc0770Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824e9554658Smrg	fi
82514bc0770Smrg	;;
826e9554658Smrg    parisc*:Lites*:*:*)
82714bc0770Smrg	GUESS=hppa1.1-hp-lites
82814bc0770Smrg	;;
829e9554658Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
83014bc0770Smrg	GUESS=c1-convex-bsd
83114bc0770Smrg	;;
832e9554658Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833e9554658Smrg	if getsysinfo -f scalar_acc
834e9554658Smrg	then echo c32-convex-bsd
835e9554658Smrg	else echo c2-convex-bsd
836e9554658Smrg	fi
8375dd5f640Smrg	exit ;;
838e9554658Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
83914bc0770Smrg	GUESS=c34-convex-bsd
84014bc0770Smrg	;;
841e9554658Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
84214bc0770Smrg	GUESS=c38-convex-bsd
84314bc0770Smrg	;;
844e9554658Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
84514bc0770Smrg	GUESS=c4-convex-bsd
84614bc0770Smrg	;;
847e9554658Smrg    CRAY*Y-MP:*:*:*)
84814bc0770Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
84914bc0770Smrg	GUESS=ymp-cray-unicos$CRAY_REL
85014bc0770Smrg	;;
851e9554658Smrg    CRAY*[A-Z]90:*:*:*)
852688b3aecSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853e9554658Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854e9554658Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855e9554658Smrg	      -e 's/\.[^.]*$/.X/'
856e9554658Smrg	exit ;;
857e9554658Smrg    CRAY*TS:*:*:*)
85814bc0770Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
85914bc0770Smrg	GUESS=t90-cray-unicos$CRAY_REL
86014bc0770Smrg	;;
861e9554658Smrg    CRAY*T3E:*:*:*)
86214bc0770Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86314bc0770Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
86414bc0770Smrg	;;
865e9554658Smrg    CRAY*SV1:*:*:*)
86614bc0770Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86714bc0770Smrg	GUESS=sv1-cray-unicos$CRAY_REL
86814bc0770Smrg	;;
869e9554658Smrg    *:UNICOS/mp:*:*)
87014bc0770Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
87114bc0770Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
87214bc0770Smrg	;;
873e9554658Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874688b3aecSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875688b3aecSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876688b3aecSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
87714bc0770Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
87814bc0770Smrg	;;
879e9554658Smrg    5000:UNIX_System_V:4.*:*)
880688b3aecSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881688b3aecSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
88214bc0770Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
88314bc0770Smrg	;;
884e9554658Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
88514bc0770Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
88614bc0770Smrg	;;
887e9554658Smrg    sparc*:BSD/OS:*:*)
88814bc0770Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
88914bc0770Smrg	;;
890e9554658Smrg    *:BSD/OS:*:*)
89114bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
89214bc0770Smrg	;;
89314bc0770Smrg    arm:FreeBSD:*:*)
89414bc0770Smrg	UNAME_PROCESSOR=`uname -p`
89514bc0770Smrg	set_cc_for_build
89614bc0770Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
89714bc0770Smrg	    | grep -q __ARM_PCS_VFP
89814bc0770Smrg	then
89914bc0770Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90014bc0770Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
90114bc0770Smrg	else
90214bc0770Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90314bc0770Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
90414bc0770Smrg	fi
90514bc0770Smrg	;;
906e9554658Smrg    *:FreeBSD:*:*)
9075dd5f640Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
90814bc0770Smrg	case $UNAME_PROCESSOR in
909e9554658Smrg	    amd64)
910688b3aecSmrg		UNAME_PROCESSOR=x86_64 ;;
911688b3aecSmrg	    i386)
912688b3aecSmrg		UNAME_PROCESSOR=i586 ;;
913e9554658Smrg	esac
91414bc0770Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
91514bc0770Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
91614bc0770Smrg	;;
917e9554658Smrg    i*:CYGWIN*:*)
91814bc0770Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
91914bc0770Smrg	;;
9205dd5f640Smrg    *:MINGW64*:*)
92114bc0770Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
92214bc0770Smrg	;;
923c2b339b4Smrg    *:MINGW*:*)
92414bc0770Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
92514bc0770Smrg	;;
926688b3aecSmrg    *:MSYS*:*)
92714bc0770Smrg	GUESS=$UNAME_MACHINE-pc-msys
92814bc0770Smrg	;;
929e9554658Smrg    i*:PW*:*)
93014bc0770Smrg	GUESS=$UNAME_MACHINE-pc-pw32
93114bc0770Smrg	;;
9328903d43aSmrg    *:Interix*:*)
93314bc0770Smrg	case $UNAME_MACHINE in
934c2b339b4Smrg	    x86)
93514bc0770Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
93614bc0770Smrg		;;
9378903d43aSmrg	    authenticamd | genuineintel | EM64T)
93814bc0770Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
93914bc0770Smrg		;;
940c2b339b4Smrg	    IA64)
94114bc0770Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
94214bc0770Smrg		;;
943c2b339b4Smrg	esac ;;
944e9554658Smrg    i*:UWIN*:*)
94514bc0770Smrg	GUESS=$UNAME_MACHINE-pc-uwin
94614bc0770Smrg	;;
947e9554658Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
94814bc0770Smrg	GUESS=x86_64-pc-cygwin
94914bc0770Smrg	;;
950e9554658Smrg    prep*:SunOS:5.*:*)
95114bc0770Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
95214bc0770Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
95314bc0770Smrg	;;
954e9554658Smrg    *:GNU:*:*)
955e9554658Smrg	# the GNU system
95614bc0770Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
95714bc0770Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
95814bc0770Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
95914bc0770Smrg	;;
960e9554658Smrg    *:GNU/*:*:*)
961e9554658Smrg	# other systems with GNU libc and userland
96214bc0770Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
96314bc0770Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
96414bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
96514bc0770Smrg	;;
96614bc0770Smrg    *:Minix:*:*)
96714bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-minix
96814bc0770Smrg	;;
9695dd5f640Smrg    aarch64:Linux:*:*)
97014bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97114bc0770Smrg	;;
9725dd5f640Smrg    aarch64_be:Linux:*:*)
9735dd5f640Smrg	UNAME_MACHINE=aarch64_be
97414bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
97514bc0770Smrg	;;
9768903d43aSmrg    alpha:Linux:*:*)
97714bc0770Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
9788903d43aSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9798903d43aSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9808903d43aSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9818903d43aSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9828903d43aSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9838903d43aSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9848903d43aSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9855dd5f640Smrg	esac
9868903d43aSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
987688b3aecSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
98814bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
98914bc0770Smrg	;;
99014bc0770Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
99114bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99214bc0770Smrg	;;
993e9554658Smrg    arm*:Linux:*:*)
99414bc0770Smrg	set_cc_for_build
995c2b339b4Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996c2b339b4Smrg	    | grep -q __ARM_EABI__
997c2b339b4Smrg	then
99814bc0770Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999c2b339b4Smrg	else
10005dd5f640Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10015dd5f640Smrg		| grep -q __ARM_PCS_VFP
10025dd5f640Smrg	    then
100314bc0770Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10045dd5f640Smrg	    else
100514bc0770Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10065dd5f640Smrg	    fi
1007c2b339b4Smrg	fi
100814bc0770Smrg	;;
1009e9554658Smrg    avr32*:Linux:*:*)
101014bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
101114bc0770Smrg	;;
1012e9554658Smrg    cris:Linux:*:*)
101314bc0770Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101414bc0770Smrg	;;
1015e9554658Smrg    crisv32:Linux:*:*)
101614bc0770Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
101714bc0770Smrg	;;
1018688b3aecSmrg    e2k:Linux:*:*)
101914bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102014bc0770Smrg	;;
1021e9554658Smrg    frv:Linux:*:*)
102214bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102314bc0770Smrg	;;
10245dd5f640Smrg    hexagon:Linux:*:*)
102514bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102614bc0770Smrg	;;
10278903d43aSmrg    i*86:Linux:*:*)
102814bc0770Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
102914bc0770Smrg	;;
1030e9554658Smrg    ia64:Linux:*:*)
103114bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103214bc0770Smrg	;;
1033688b3aecSmrg    k1om:Linux:*:*)
103414bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103514bc0770Smrg	;;
103614bc0770Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
103714bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103814bc0770Smrg	;;
1039e9554658Smrg    m32r*:Linux:*:*)
104014bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104114bc0770Smrg	;;
1042e9554658Smrg    m68*:Linux:*:*)
104314bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104414bc0770Smrg	;;
10458903d43aSmrg    mips:Linux:*:* | mips64:Linux:*:*)
104614bc0770Smrg	set_cc_for_build
104714bc0770Smrg	IS_GLIBC=0
104814bc0770Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049688b3aecSmrg	sed 's/^	//' << EOF > "$dummy.c"
1050e9554658Smrg	#undef CPU
105114bc0770Smrg	#undef mips
105214bc0770Smrg	#undef mipsel
105314bc0770Smrg	#undef mips64
105414bc0770Smrg	#undef mips64el
105514bc0770Smrg	#if ${IS_GLIBC} && defined(_ABI64)
105614bc0770Smrg	LIBCABI=gnuabi64
105714bc0770Smrg	#else
105814bc0770Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
105914bc0770Smrg	LIBCABI=gnuabin32
106014bc0770Smrg	#else
106114bc0770Smrg	LIBCABI=${LIBC}
106214bc0770Smrg	#endif
106314bc0770Smrg	#endif
106414bc0770Smrg
106514bc0770Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106614bc0770Smrg	CPU=mipsisa64r6
106714bc0770Smrg	#else
106814bc0770Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
106914bc0770Smrg	CPU=mipsisa32r6
107014bc0770Smrg	#else
107114bc0770Smrg	#if defined(__mips64)
107214bc0770Smrg	CPU=mips64
107314bc0770Smrg	#else
107414bc0770Smrg	CPU=mips
107514bc0770Smrg	#endif
107614bc0770Smrg	#endif
107714bc0770Smrg	#endif
107814bc0770Smrg
1079e9554658Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
108014bc0770Smrg	MIPS_ENDIAN=el
1081e9554658Smrg	#else
1082e9554658Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
108314bc0770Smrg	MIPS_ENDIAN=
1084e9554658Smrg	#else
108514bc0770Smrg	MIPS_ENDIAN=
1086e9554658Smrg	#endif
1087e9554658Smrg	#endif
1088e9554658SmrgEOF
108914bc0770Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
109014bc0770Smrg	eval "$cc_set_vars"
109114bc0770Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092e9554658Smrg	;;
1093688b3aecSmrg    mips64el:Linux:*:*)
109414bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
109514bc0770Smrg	;;
1096688b3aecSmrg    openrisc*:Linux:*:*)
109714bc0770Smrg	GUESS=or1k-unknown-linux-$LIBC
109814bc0770Smrg	;;
1099688b3aecSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
110014bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
110114bc0770Smrg	;;
1102c2b339b4Smrg    padre:Linux:*:*)
110314bc0770Smrg	GUESS=sparc-unknown-linux-$LIBC
110414bc0770Smrg	;;
11058903d43aSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
110614bc0770Smrg	GUESS=hppa64-unknown-linux-$LIBC
110714bc0770Smrg	;;
1108e9554658Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
1109e9554658Smrg	# Look for CPU level
1110e9554658Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
111114bc0770Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
111214bc0770Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
111314bc0770Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1114e9554658Smrg	esac
111514bc0770Smrg	;;
11168903d43aSmrg    ppc64:Linux:*:*)
111714bc0770Smrg	GUESS=powerpc64-unknown-linux-$LIBC
111814bc0770Smrg	;;
11198903d43aSmrg    ppc:Linux:*:*)
112014bc0770Smrg	GUESS=powerpc-unknown-linux-$LIBC
112114bc0770Smrg	;;
11225dd5f640Smrg    ppc64le:Linux:*:*)
112314bc0770Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
112414bc0770Smrg	;;
11255dd5f640Smrg    ppcle:Linux:*:*)
112614bc0770Smrg	GUESS=powerpcle-unknown-linux-$LIBC
112714bc0770Smrg	;;
112814bc0770Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
112914bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113014bc0770Smrg	;;
1131e9554658Smrg    s390:Linux:*:* | s390x:Linux:*:*)
113214bc0770Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
113314bc0770Smrg	;;
1134e9554658Smrg    sh64*:Linux:*:*)
113514bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113614bc0770Smrg	;;
1137e9554658Smrg    sh*:Linux:*:*)
113814bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113914bc0770Smrg	;;
1140e9554658Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
114114bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114214bc0770Smrg	;;
11438903d43aSmrg    tile*:Linux:*:*)
114414bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114514bc0770Smrg	;;
1146e9554658Smrg    vax:Linux:*:*)
114714bc0770Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
114814bc0770Smrg	;;
1149e9554658Smrg    x86_64:Linux:*:*)
115014bc0770Smrg	set_cc_for_build
115114bc0770Smrg	LIBCABI=$LIBC
115214bc0770Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
115314bc0770Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
115414bc0770Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
115514bc0770Smrg		grep IS_X32 >/dev/null
115614bc0770Smrg	    then
115714bc0770Smrg		LIBCABI=${LIBC}x32
115814bc0770Smrg	    fi
115914bc0770Smrg	fi
116014bc0770Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
116114bc0770Smrg	;;
1162c2b339b4Smrg    xtensa*:Linux:*:*)
116314bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
116414bc0770Smrg	;;
1165e9554658Smrg    i*86:DYNIX/ptx:4*:*)
1166e9554658Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1167e9554658Smrg	# earlier versions are messed up and put the nodename in both
1168e9554658Smrg	# sysname and nodename.
116914bc0770Smrg	GUESS=i386-sequent-sysv4
117014bc0770Smrg	;;
1171e9554658Smrg    i*86:UNIX_SV:4.2MP:2.*)
11725dd5f640Smrg	# Unixware is an offshoot of SVR4, but it has its own version
11735dd5f640Smrg	# number series starting with 2...
11745dd5f640Smrg	# I am not positive that other SVR4 systems won't match this,
1175e9554658Smrg	# I just have to hope.  -- rms.
11765dd5f640Smrg	# Use sysv4.2uw... so that sysv4* matches it.
117714bc0770Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
117814bc0770Smrg	;;
1179e9554658Smrg    i*86:OS/2:*:*)
1180e9554658Smrg	# If we were able to find `uname', then EMX Unix compatibility
1181e9554658Smrg	# is probably installed.
118214bc0770Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
118314bc0770Smrg	;;
1184e9554658Smrg    i*86:XTS-300:*:STOP)
118514bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-stop
118614bc0770Smrg	;;
1187e9554658Smrg    i*86:atheos:*:*)
118814bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
118914bc0770Smrg	;;
1190e9554658Smrg    i*86:syllable:*:*)
119114bc0770Smrg	GUESS=$UNAME_MACHINE-pc-syllable
119214bc0770Smrg	;;
11938903d43aSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
119414bc0770Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
119514bc0770Smrg	;;
1196e9554658Smrg    i*86:*DOS:*:*)
119714bc0770Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
119814bc0770Smrg	;;
1199688b3aecSmrg    i*86:*:4.*:*)
1200688b3aecSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1201e9554658Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
120214bc0770Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1203e9554658Smrg	else
120414bc0770Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1205e9554658Smrg	fi
120614bc0770Smrg	;;
1207e9554658Smrg    i*86:*:5:[678]*)
12085dd5f640Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1209e9554658Smrg	case `/bin/uname -X | grep "^Machine"` in
1210e9554658Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1211e9554658Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1212e9554658Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1213e9554658Smrg	esac
121414bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
121514bc0770Smrg	;;
1216e9554658Smrg    i*86:*:3.2:*)
1217e9554658Smrg	if test -f /usr/options/cb.name; then
1218e9554658Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
121914bc0770Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1220e9554658Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1221e9554658Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1222e9554658Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1223e9554658Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1224e9554658Smrg			&& UNAME_MACHINE=i586
1225e9554658Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1226e9554658Smrg			&& UNAME_MACHINE=i686
1227e9554658Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1228e9554658Smrg			&& UNAME_MACHINE=i686
122914bc0770Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1230e9554658Smrg	else
123114bc0770Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
1232e9554658Smrg	fi
123314bc0770Smrg	;;
1234e9554658Smrg    pc:*:*:*)
1235e9554658Smrg	# Left here for compatibility:
12365dd5f640Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12375dd5f640Smrg	# the processor, so we play safe by assuming i586.
1238c2b339b4Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1239688b3aecSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1240c2b339b4Smrg	# this is a cross-build.
124114bc0770Smrg	GUESS=i586-pc-msdosdjgpp
124214bc0770Smrg	;;
1243e9554658Smrg    Intel:Mach:3*:*)
124414bc0770Smrg	GUESS=i386-pc-mach3
124514bc0770Smrg	;;
1246e9554658Smrg    paragon:*:*:*)
124714bc0770Smrg	GUESS=i860-intel-osf1
124814bc0770Smrg	;;
1249e9554658Smrg    i860:*:4.*:*) # i860-SVR4
1250e9554658Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
125114bc0770Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1252e9554658Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
125314bc0770Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1254e9554658Smrg	fi
125514bc0770Smrg	;;
1256e9554658Smrg    mini*:CTIX:SYS*5:*)
1257e9554658Smrg	# "miniframe"
125814bc0770Smrg	GUESS=m68010-convergent-sysv
125914bc0770Smrg	;;
1260e9554658Smrg    mc68k:UNIX:SYSTEM5:3.51m)
126114bc0770Smrg	GUESS=m68k-convergent-sysv
126214bc0770Smrg	;;
1263e9554658Smrg    M680?0:D-NIX:5.3:*)
126414bc0770Smrg	GUESS=m68k-diab-dnix
126514bc0770Smrg	;;
1266e9554658Smrg    M68*:*:R3V[5678]*:*)
1267e9554658Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1268e9554658Smrg    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)
1269e9554658Smrg	OS_REL=''
1270e9554658Smrg	test -r /etc/.relid \
1271e9554658Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1272e9554658Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273688b3aecSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1274e9554658Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275688b3aecSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1276e9554658Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12775dd5f640Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12785dd5f640Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1279c2b339b4Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280c2b339b4Smrg	OS_REL='.3'
1281c2b339b4Smrg	test -r /etc/.relid \
1282c2b339b4Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283c2b339b4Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284688b3aecSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285c2b339b4Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286688b3aecSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287c2b339b4Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288688b3aecSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1289e9554658Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
129014bc0770Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
129114bc0770Smrg	;;
1292e9554658Smrg    mc68030:UNIX_System_V:4.*:*)
129314bc0770Smrg	GUESS=m68k-atari-sysv4
129414bc0770Smrg	;;
1295e9554658Smrg    TSUNAMI:LynxOS:2.*:*)
129614bc0770Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
129714bc0770Smrg	;;
1298e9554658Smrg    rs6000:LynxOS:2.*:*)
129914bc0770Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
130014bc0770Smrg	;;
13018903d43aSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
130214bc0770Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
130314bc0770Smrg	;;
1304e9554658Smrg    SM[BE]S:UNIX_SV:*:*)
130514bc0770Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
130614bc0770Smrg	;;
1307e9554658Smrg    RM*:ReliantUNIX-*:*:*)
130814bc0770Smrg	GUESS=mips-sni-sysv4
130914bc0770Smrg	;;
1310e9554658Smrg    RM*:SINIX-*:*:*)
131114bc0770Smrg	GUESS=mips-sni-sysv4
131214bc0770Smrg	;;
1313e9554658Smrg    *:SINIX-*:*:*)
1314e9554658Smrg	if uname -p 2>/dev/null >/dev/null ; then
1315e9554658Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
131614bc0770Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
1317e9554658Smrg	else
131814bc0770Smrg		GUESS=ns32k-sni-sysv
1319e9554658Smrg	fi
132014bc0770Smrg	;;
13215dd5f640Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13225dd5f640Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
132314bc0770Smrg	GUESS=i586-unisys-sysv4
132414bc0770Smrg	;;
1325e9554658Smrg    *:UNIX_System_V:4*:FTX*)
1326e9554658Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1327e9554658Smrg	# How about differentiating between stratus architectures? -djm
132814bc0770Smrg	GUESS=hppa1.1-stratus-sysv4
132914bc0770Smrg	;;
1330e9554658Smrg    *:*:*:FTX*)
1331e9554658Smrg	# From seanf@swdc.stratus.com.
133214bc0770Smrg	GUESS=i860-stratus-sysv4
133314bc0770Smrg	;;
1334e9554658Smrg    i*86:VOS:*:*)
1335e9554658Smrg	# From Paul.Green@stratus.com.
133614bc0770Smrg	GUESS=$UNAME_MACHINE-stratus-vos
133714bc0770Smrg	;;
1338e9554658Smrg    *:VOS:*:*)
1339e9554658Smrg	# From Paul.Green@stratus.com.
134014bc0770Smrg	GUESS=hppa1.1-stratus-vos
134114bc0770Smrg	;;
1342e9554658Smrg    mc68*:A/UX:*:*)
134314bc0770Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
134414bc0770Smrg	;;
1345e9554658Smrg    news*:NEWS-OS:6*:*)
134614bc0770Smrg	GUESS=mips-sony-newsos6
134714bc0770Smrg	;;
1348e9554658Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
134914bc0770Smrg	if test -d /usr/nec; then
135014bc0770Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1351e9554658Smrg	else
135214bc0770Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1353e9554658Smrg	fi
135414bc0770Smrg	;;
1355e9554658Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
135614bc0770Smrg	GUESS=powerpc-be-beos
135714bc0770Smrg	;;
1358e9554658Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
135914bc0770Smrg	GUESS=powerpc-apple-beos
136014bc0770Smrg	;;
1361e9554658Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
136214bc0770Smrg	GUESS=i586-pc-beos
136314bc0770Smrg	;;
1364c2b339b4Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
136514bc0770Smrg	GUESS=i586-pc-haiku
136614bc0770Smrg	;;
13675dd5f640Smrg    x86_64:Haiku:*:*)
136814bc0770Smrg	GUESS=x86_64-unknown-haiku
136914bc0770Smrg	;;
1370e9554658Smrg    SX-4:SUPER-UX:*:*)
137114bc0770Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
137214bc0770Smrg	;;
1373e9554658Smrg    SX-5:SUPER-UX:*:*)
137414bc0770Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
137514bc0770Smrg	;;
1376e9554658Smrg    SX-6:SUPER-UX:*:*)
137714bc0770Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
137814bc0770Smrg	;;
1379c2b339b4Smrg    SX-7:SUPER-UX:*:*)
138014bc0770Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
138114bc0770Smrg	;;
1382c2b339b4Smrg    SX-8:SUPER-UX:*:*)
138314bc0770Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
138414bc0770Smrg	;;
1385c2b339b4Smrg    SX-8R:SUPER-UX:*:*)
138614bc0770Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
138714bc0770Smrg	;;
1388688b3aecSmrg    SX-ACE:SUPER-UX:*:*)
138914bc0770Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
139014bc0770Smrg	;;
1391e9554658Smrg    Power*:Rhapsody:*:*)
139214bc0770Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
139314bc0770Smrg	;;
1394e9554658Smrg    *:Rhapsody:*:*)
139514bc0770Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
139614bc0770Smrg	;;
139714bc0770Smrg    arm64:Darwin:*:*)
139814bc0770Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
139914bc0770Smrg	;;
1400e9554658Smrg    *:Darwin:*:*)
140114bc0770Smrg	UNAME_PROCESSOR=`uname -p`
140214bc0770Smrg	case $UNAME_PROCESSOR in
140314bc0770Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
140414bc0770Smrg	esac
140514bc0770Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
140614bc0770Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
140714bc0770Smrg	    # Avoid executing cc if there is no toolchain installed as
140814bc0770Smrg	    # cc will be a stub that puts up a graphical alert
140914bc0770Smrg	    # prompting the user to install developer tools.
141014bc0770Smrg	    CC_FOR_BUILD=no_compiler_found
141114bc0770Smrg	else
141214bc0770Smrg	    set_cc_for_build
14135dd5f640Smrg	fi
141414bc0770Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
141514bc0770Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
141614bc0770Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
141714bc0770Smrg		   grep IS_64BIT_ARCH >/dev/null
141814bc0770Smrg	    then
141914bc0770Smrg		case $UNAME_PROCESSOR in
142014bc0770Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
142114bc0770Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
142214bc0770Smrg		esac
142314bc0770Smrg	    fi
142414bc0770Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
142514bc0770Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
142614bc0770Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
142714bc0770Smrg		   grep IS_PPC >/dev/null
142814bc0770Smrg	    then
142914bc0770Smrg		UNAME_PROCESSOR=powerpc
14305dd5f640Smrg	    fi
1431688b3aecSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
143214bc0770Smrg	    # uname -m returns i386 or x86_64
143314bc0770Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
14345dd5f640Smrg	fi
143514bc0770Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
143614bc0770Smrg	;;
1437e9554658Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1438e9554658Smrg	UNAME_PROCESSOR=`uname -p`
1439688b3aecSmrg	if test "$UNAME_PROCESSOR" = x86; then
1440e9554658Smrg		UNAME_PROCESSOR=i386
1441e9554658Smrg		UNAME_MACHINE=pc
1442e9554658Smrg	fi
144314bc0770Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
144414bc0770Smrg	;;
1445e9554658Smrg    *:QNX:*:4*)
144614bc0770Smrg	GUESS=i386-pc-qnx
144714bc0770Smrg	;;
1448688b3aecSmrg    NEO-*:NONSTOP_KERNEL:*:*)
144914bc0770Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
145014bc0770Smrg	;;
14515dd5f640Smrg    NSE-*:NONSTOP_KERNEL:*:*)
145214bc0770Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
145314bc0770Smrg	;;
1454688b3aecSmrg    NSR-*:NONSTOP_KERNEL:*:*)
145514bc0770Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
145614bc0770Smrg	;;
1457688b3aecSmrg    NSV-*:NONSTOP_KERNEL:*:*)
145814bc0770Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
145914bc0770Smrg	;;
1460688b3aecSmrg    NSX-*:NONSTOP_KERNEL:*:*)
146114bc0770Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
146214bc0770Smrg	;;
1463e9554658Smrg    *:NonStop-UX:*:*)
146414bc0770Smrg	GUESS=mips-compaq-nonstopux
146514bc0770Smrg	;;
1466e9554658Smrg    BS2000:POSIX*:*:*)
146714bc0770Smrg	GUESS=bs2000-siemens-sysv
146814bc0770Smrg	;;
1469e9554658Smrg    DS/*:UNIX_System_V:*:*)
147014bc0770Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
147114bc0770Smrg	;;
1472e9554658Smrg    *:Plan9:*:*)
1473e9554658Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1474e9554658Smrg	# is converted to i386 for consistency with other x86
1475e9554658Smrg	# operating systems.
147614bc0770Smrg	if test "${cputype-}" = 386; then
1477e9554658Smrg	    UNAME_MACHINE=i386
147814bc0770Smrg	elif test "x${cputype-}" != x; then
147914bc0770Smrg	    UNAME_MACHINE=$cputype
1480e9554658Smrg	fi
148114bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
148214bc0770Smrg	;;
1483e9554658Smrg    *:TOPS-10:*:*)
148414bc0770Smrg	GUESS=pdp10-unknown-tops10
148514bc0770Smrg	;;
1486e9554658Smrg    *:TENEX:*:*)
148714bc0770Smrg	GUESS=pdp10-unknown-tenex
148814bc0770Smrg	;;
1489e9554658Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
149014bc0770Smrg	GUESS=pdp10-dec-tops20
149114bc0770Smrg	;;
1492e9554658Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
149314bc0770Smrg	GUESS=pdp10-xkl-tops20
149414bc0770Smrg	;;
1495e9554658Smrg    *:TOPS-20:*:*)
149614bc0770Smrg	GUESS=pdp10-unknown-tops20
149714bc0770Smrg	;;
1498e9554658Smrg    *:ITS:*:*)
149914bc0770Smrg	GUESS=pdp10-unknown-its
150014bc0770Smrg	;;
1501e9554658Smrg    SEI:*:*:SEIUX)
150214bc0770Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
150314bc0770Smrg	;;
1504e9554658Smrg    *:DragonFly:*:*)
150514bc0770Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
150614bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
150714bc0770Smrg	;;
1508e9554658Smrg    *:*VMS:*:*)
15095dd5f640Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
151014bc0770Smrg	case $UNAME_MACHINE in
151114bc0770Smrg	    A*) GUESS=alpha-dec-vms ;;
151214bc0770Smrg	    I*) GUESS=ia64-dec-vms ;;
151314bc0770Smrg	    V*) GUESS=vax-dec-vms ;;
1514e9554658Smrg	esac ;;
1515e9554658Smrg    *:XENIX:*:SysV)
151614bc0770Smrg	GUESS=i386-pc-xenix
151714bc0770Smrg	;;
1518e9554658Smrg    i*86:skyos:*:*)
151914bc0770Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
152014bc0770Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
152114bc0770Smrg	;;
1522e9554658Smrg    i*86:rdos:*:*)
152314bc0770Smrg	GUESS=$UNAME_MACHINE-pc-rdos
152414bc0770Smrg	;;
152514bc0770Smrg    *:AROS:*:*)
152614bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-aros
152714bc0770Smrg	;;
15285dd5f640Smrg    x86_64:VMkernel:*:*)
152914bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-esx
153014bc0770Smrg	;;
1531688b3aecSmrg    amd64:Isilon\ OneFS:*:*)
153214bc0770Smrg	GUESS=x86_64-unknown-onefs
153314bc0770Smrg	;;
153414bc0770Smrg    *:Unleashed:*:*)
153514bc0770Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
153614bc0770Smrg	;;
1537e9554658Smrgesac
1538e9554658Smrg
153914bc0770Smrg# Do we have a guess based on uname results?
154014bc0770Smrgif test "x$GUESS" != x; then
154114bc0770Smrg    echo "$GUESS"
154214bc0770Smrg    exit
154314bc0770Smrgfi
154414bc0770Smrg
154514bc0770Smrg# No uname command or uname output not recognized.
154614bc0770Smrgset_cc_for_build
154714bc0770Smrgcat > "$dummy.c" <<EOF
154814bc0770Smrg#ifdef _SEQUENT_
154914bc0770Smrg#include <sys/types.h>
155014bc0770Smrg#include <sys/utsname.h>
155114bc0770Smrg#endif
155214bc0770Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
155314bc0770Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
155414bc0770Smrg#include <signal.h>
155514bc0770Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
155614bc0770Smrg#include <sys/utsname.h>
155714bc0770Smrg#endif
155814bc0770Smrg#endif
155914bc0770Smrg#endif
156014bc0770Smrgmain ()
156114bc0770Smrg{
156214bc0770Smrg#if defined (sony)
156314bc0770Smrg#if defined (MIPSEB)
156414bc0770Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
156514bc0770Smrg     I don't know....  */
156614bc0770Smrg  printf ("mips-sony-bsd\n"); exit (0);
156714bc0770Smrg#else
156814bc0770Smrg#include <sys/param.h>
156914bc0770Smrg  printf ("m68k-sony-newsos%s\n",
157014bc0770Smrg#ifdef NEWSOS4
157114bc0770Smrg  "4"
157214bc0770Smrg#else
157314bc0770Smrg  ""
157414bc0770Smrg#endif
157514bc0770Smrg  ); exit (0);
157614bc0770Smrg#endif
157714bc0770Smrg#endif
157814bc0770Smrg
157914bc0770Smrg#if defined (NeXT)
158014bc0770Smrg#if !defined (__ARCHITECTURE__)
158114bc0770Smrg#define __ARCHITECTURE__ "m68k"
158214bc0770Smrg#endif
158314bc0770Smrg  int version;
158414bc0770Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
158514bc0770Smrg  if (version < 4)
158614bc0770Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
158714bc0770Smrg  else
158814bc0770Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
158914bc0770Smrg  exit (0);
159014bc0770Smrg#endif
159114bc0770Smrg
159214bc0770Smrg#if defined (MULTIMAX) || defined (n16)
159314bc0770Smrg#if defined (UMAXV)
159414bc0770Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
159514bc0770Smrg#else
159614bc0770Smrg#if defined (CMU)
159714bc0770Smrg  printf ("ns32k-encore-mach\n"); exit (0);
159814bc0770Smrg#else
159914bc0770Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
160014bc0770Smrg#endif
160114bc0770Smrg#endif
160214bc0770Smrg#endif
160314bc0770Smrg
160414bc0770Smrg#if defined (__386BSD__)
160514bc0770Smrg  printf ("i386-pc-bsd\n"); exit (0);
160614bc0770Smrg#endif
160714bc0770Smrg
160814bc0770Smrg#if defined (sequent)
160914bc0770Smrg#if defined (i386)
161014bc0770Smrg  printf ("i386-sequent-dynix\n"); exit (0);
161114bc0770Smrg#endif
161214bc0770Smrg#if defined (ns32000)
161314bc0770Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
161414bc0770Smrg#endif
161514bc0770Smrg#endif
161614bc0770Smrg
161714bc0770Smrg#if defined (_SEQUENT_)
161814bc0770Smrg  struct utsname un;
161914bc0770Smrg
162014bc0770Smrg  uname(&un);
162114bc0770Smrg  if (strncmp(un.version, "V2", 2) == 0) {
162214bc0770Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
162314bc0770Smrg  }
162414bc0770Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
162514bc0770Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
162614bc0770Smrg  }
162714bc0770Smrg  printf ("i386-sequent-ptx\n"); exit (0);
162814bc0770Smrg#endif
162914bc0770Smrg
163014bc0770Smrg#if defined (vax)
163114bc0770Smrg#if !defined (ultrix)
163214bc0770Smrg#include <sys/param.h>
163314bc0770Smrg#if defined (BSD)
163414bc0770Smrg#if BSD == 43
163514bc0770Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
163614bc0770Smrg#else
163714bc0770Smrg#if BSD == 199006
163814bc0770Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
163914bc0770Smrg#else
164014bc0770Smrg  printf ("vax-dec-bsd\n"); exit (0);
164114bc0770Smrg#endif
164214bc0770Smrg#endif
164314bc0770Smrg#else
164414bc0770Smrg  printf ("vax-dec-bsd\n"); exit (0);
164514bc0770Smrg#endif
164614bc0770Smrg#else
164714bc0770Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
164814bc0770Smrg  struct utsname un;
164914bc0770Smrg  uname (&un);
165014bc0770Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
165114bc0770Smrg#else
165214bc0770Smrg  printf ("vax-dec-ultrix\n"); exit (0);
165314bc0770Smrg#endif
165414bc0770Smrg#endif
165514bc0770Smrg#endif
165614bc0770Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
165714bc0770Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
165814bc0770Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
165914bc0770Smrg  struct utsname *un;
166014bc0770Smrg  uname (&un);
166114bc0770Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
166214bc0770Smrg#else
166314bc0770Smrg  printf ("mips-dec-ultrix\n"); exit (0);
166414bc0770Smrg#endif
166514bc0770Smrg#endif
166614bc0770Smrg#endif
166714bc0770Smrg
166814bc0770Smrg#if defined (alliant) && defined (i860)
166914bc0770Smrg  printf ("i860-alliant-bsd\n"); exit (0);
167014bc0770Smrg#endif
167114bc0770Smrg
167214bc0770Smrg  exit (1);
167314bc0770Smrg}
167414bc0770SmrgEOF
167514bc0770Smrg
167614bc0770Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
167714bc0770Smrg	{ echo "$SYSTEM_NAME"; exit; }
167814bc0770Smrg
167914bc0770Smrg# Apollos put the system type in the environment.
168014bc0770Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
168114bc0770Smrg
1682688b3aecSmrgecho "$0: unable to guess system type" >&2
1683e9554658Smrg
168414bc0770Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685688b3aecSmrg    mips:Linux | mips64:Linux)
1686688b3aecSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1687688b3aecSmrg	cat >&2 <<EOF
1688e9554658Smrg
1689688b3aecSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690688b3aecSmrgthe system type. Please install a C compiler and try again.
1691e9554658SmrgEOF
1692688b3aecSmrg	;;
1693688b3aecSmrgesac
1694e9554658Smrg
1695e9554658Smrgcat >&2 <<EOF
1696e9554658Smrg
1697688b3aecSmrgThis script (version $timestamp), has failed to recognize the
1698688b3aecSmrgoperating system you are using. If your script is old, overwrite *all*
1699688b3aecSmrgcopies of config.guess and config.sub with the latest versions from:
1700e9554658Smrg
170114bc0770Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1702e9554658Smrgand
170314bc0770Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
170414bc0770SmrgEOF
170514bc0770Smrg
170614bc0770Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
170714bc0770Smrgthisyear=`date +%Y`
170814bc0770Smrg# shellcheck disable=SC2003
170914bc0770Smrgscript_age=`expr "$thisyear" - "$our_year"`
171014bc0770Smrgif test "$script_age" -lt 3 ; then
171114bc0770Smrg   cat >&2 <<EOF
1712e9554658Smrg
1713688b3aecSmrgIf $0 has already been updated, send the following data and any
1714688b3aecSmrginformation you think might be pertinent to config-patches@gnu.org to
1715688b3aecSmrgprovide the necessary information to handle your system.
1716e9554658Smrg
1717e9554658Smrgconfig.guess timestamp = $timestamp
1718e9554658Smrg
1719e9554658Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1720e9554658Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1721e9554658Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1722e9554658Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1723e9554658Smrg
1724e9554658Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1725e9554658Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1726e9554658Smrg
1727e9554658Smrghostinfo               = `(hostinfo) 2>/dev/null`
1728e9554658Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1729e9554658Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1730e9554658Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1731e9554658Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1732e9554658Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1733e9554658Smrg
1734688b3aecSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735688b3aecSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736688b3aecSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737688b3aecSmrgUNAME_VERSION = "$UNAME_VERSION"
1738e9554658SmrgEOF
173914bc0770Smrgfi
1740e9554658Smrg
1741e9554658Smrgexit 1
1742e9554658Smrg
1743e9554658Smrg# Local variables:
174414bc0770Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
1745e9554658Smrg# time-stamp-start: "timestamp='"
1746e9554658Smrg# time-stamp-format: "%:y-%02m-%02d"
1747e9554658Smrg# time-stamp-end: "'"
1748e9554658Smrg# End:
1749