config.guess revision 291ca6f5
129459361Smrg#! /bin/sh
229459361Smrg# Attempt to guess a canonical system name.
3291ca6f5Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
429459361Smrg
5291ca6f5Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6291ca6f5Smrg
7291ca6f5Smrgtimestamp='2021-06-03'
829459361Smrg
929459361Smrg# This file is free software; you can redistribute it and/or modify it
1029459361Smrg# under the terms of the GNU General Public License as published by
11f66e55a2Smrg# the Free Software Foundation; either version 3 of the License, or
1229459361Smrg# (at your option) any later version.
1329459361Smrg#
1429459361Smrg# This program is distributed in the hope that it will be useful, but
1529459361Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1629459361Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1729459361Smrg# General Public License for more details.
1829459361Smrg#
1929459361Smrg# You should have received a copy of the GNU General Public License
2027935385Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2129459361Smrg#
2229459361Smrg# As a special exception to the GNU General Public License, if you
2329459361Smrg# distribute this file as part of a program that contains a
2429459361Smrg# configuration script generated by Autoconf, you may include it under
25f66e55a2Smrg# the same distribution terms that you use for the rest of that
26f66e55a2Smrg# program.  This Exception is an additional permission under section 7
27f66e55a2Smrg# of the GNU General Public License, version 3 ("GPLv3").
2829459361Smrg#
2927935385Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3029459361Smrg#
31c3c9b392Smrg# You can get the latest version of this script from:
32291ca6f5Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33f66e55a2Smrg#
3427935385Smrg# Please send patches to <config-patches@gnu.org>.
35f66e55a2Smrg
3629459361Smrg
37291ca6f5Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38291ca6f5Smrg# about features and limitations of the classic Bourne shell that were
39291ca6f5Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40291ca6f5Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41291ca6f5Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42291ca6f5Smrg# have a pre-POSIX /bin/sh.
43291ca6f5Smrg
44291ca6f5Smrg
4529459361Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4629459361Smrg
4729459361Smrgusage="\
4829459361SmrgUsage: $0 [OPTION]
4929459361Smrg
5029459361SmrgOutput the configuration name of the system \`$me' is run on.
5129459361Smrg
5227935385SmrgOptions:
5329459361Smrg  -h, --help         print this help, then exit
5429459361Smrg  -t, --time-stamp   print date of last modification, then exit
5529459361Smrg  -v, --version      print version number, then exit
5629459361Smrg
5729459361SmrgReport bugs and patches to <config-patches@gnu.org>."
5829459361Smrg
5929459361Smrgversion="\
6029459361SmrgGNU config.guess ($timestamp)
6129459361Smrg
6229459361SmrgOriginally written by Per Bothner.
63291ca6f5SmrgCopyright 1992-2021 Free Software Foundation, Inc.
6429459361Smrg
6529459361SmrgThis is free software; see the source for copying conditions.  There is NO
6629459361Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6729459361Smrg
6829459361Smrghelp="
6929459361SmrgTry \`$me --help' for more information."
7029459361Smrg
7129459361Smrg# Parse command line
7229459361Smrgwhile test $# -gt 0 ; do
7329459361Smrg  case $1 in
7429459361Smrg    --time-stamp | --time* | -t )
7529459361Smrg       echo "$timestamp" ; exit ;;
7629459361Smrg    --version | -v )
7729459361Smrg       echo "$version" ; exit ;;
7829459361Smrg    --help | --h* | -h )
7929459361Smrg       echo "$usage"; exit ;;
8029459361Smrg    -- )     # Stop option processing
8129459361Smrg       shift; break ;;
8229459361Smrg    - )	# Use stdin as input.
8329459361Smrg       break ;;
8429459361Smrg    -* )
8529459361Smrg       echo "$me: invalid option $1$help" >&2
8629459361Smrg       exit 1 ;;
8729459361Smrg    * )
8829459361Smrg       break ;;
8929459361Smrg  esac
9029459361Smrgdone
9129459361Smrg
9229459361Smrgif test $# != 0; then
9329459361Smrg  echo "$me: too many arguments$help" >&2
9429459361Smrg  exit 1
9529459361Smrgfi
9629459361Smrg
97291ca6f5Smrg# Just in case it came from the environment.
98291ca6f5SmrgGUESS=
9929459361Smrg
10029459361Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
10129459361Smrg# compiler to aid in system detection is discouraged as it requires
10229459361Smrg# temporary files to be created and, as you can see below, it is a
10329459361Smrg# headache to deal with in a portable fashion.
10429459361Smrg
10529459361Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10629459361Smrg# use `HOST_CC' if defined, but it is deprecated.
10729459361Smrg
10829459361Smrg# Portable tmp directory creation inspired by the Autoconf team.
10929459361Smrg
110291ca6f5Smrgtmp=
111291ca6f5Smrg# shellcheck disable=SC2172
112291ca6f5Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113291ca6f5Smrg
114291ca6f5Smrgset_cc_for_build() {
115291ca6f5Smrg    # prevent multiple calls if $tmp is already set
116291ca6f5Smrg    test "$tmp" && return 0
117291ca6f5Smrg    : "${TMPDIR=/tmp}"
118291ca6f5Smrg    # shellcheck disable=SC2039,SC3028
119291ca6f5Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120291ca6f5Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121291ca6f5Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122291ca6f5Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123291ca6f5Smrg    dummy=$tmp/dummy
124291ca6f5Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125291ca6f5Smrg	,,)    echo "int x;" > "$dummy.c"
126291ca6f5Smrg	       for driver in cc gcc c89 c99 ; do
127291ca6f5Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128291ca6f5Smrg		       CC_FOR_BUILD=$driver
129291ca6f5Smrg		       break
130291ca6f5Smrg		   fi
131291ca6f5Smrg	       done
132291ca6f5Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133291ca6f5Smrg		   CC_FOR_BUILD=no_compiler_found
134291ca6f5Smrg	       fi
135291ca6f5Smrg	       ;;
136291ca6f5Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137291ca6f5Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138291ca6f5Smrg    esac
139291ca6f5Smrg}
14029459361Smrg
14129459361Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14229459361Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143291ca6f5Smrgif test -f /.attbin/uname ; then
14429459361Smrg	PATH=$PATH:/.attbin ; export PATH
14529459361Smrgfi
14629459361Smrg
14729459361SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14829459361SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149291ca6f5SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15029459361SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15129459361Smrg
152291ca6f5Smrgcase $UNAME_SYSTEM in
15327935385SmrgLinux|GNU|GNU/*)
154291ca6f5Smrg	LIBC=unknown
15527935385Smrg
156291ca6f5Smrg	set_cc_for_build
15727935385Smrg	cat <<-EOF > "$dummy.c"
15827935385Smrg	#include <features.h>
15927935385Smrg	#if defined(__UCLIBC__)
16027935385Smrg	LIBC=uclibc
16127935385Smrg	#elif defined(__dietlibc__)
16227935385Smrg	LIBC=dietlibc
163291ca6f5Smrg	#elif defined(__GLIBC__)
16427935385Smrg	LIBC=gnu
165291ca6f5Smrg	#else
166291ca6f5Smrg	#include <stdarg.h>
167291ca6f5Smrg	/* First heuristic to detect musl libc.  */
168291ca6f5Smrg	#ifdef __DEFINED_va_list
169291ca6f5Smrg	LIBC=musl
170291ca6f5Smrg	#endif
17127935385Smrg	#endif
17227935385Smrg	EOF
173291ca6f5Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174291ca6f5Smrg	eval "$cc_set_libc"
17527935385Smrg
176291ca6f5Smrg	# Second heuristic to detect musl libc.
177291ca6f5Smrg	if [ "$LIBC" = unknown ] &&
178291ca6f5Smrg	   command -v ldd >/dev/null &&
179291ca6f5Smrg	   ldd --version 2>&1 | grep -q ^musl; then
180291ca6f5Smrg		LIBC=musl
181291ca6f5Smrg	fi
182291ca6f5Smrg
183291ca6f5Smrg	# If the system lacks a compiler, then just pick glibc.
184291ca6f5Smrg	# We could probably try harder.
185291ca6f5Smrg	if [ "$LIBC" = unknown ]; then
186291ca6f5Smrg		LIBC=gnu
18727935385Smrg	fi
18827935385Smrg	;;
18927935385Smrgesac
19027935385Smrg
19129459361Smrg# Note: order is significant - the case branches are not exclusive.
19229459361Smrg
193291ca6f5Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19429459361Smrg    *:NetBSD:*:*)
19529459361Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196f66e55a2Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19729459361Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19829459361Smrg	# switched to ELF, *-*-netbsd* would select the old
19929459361Smrg	# object file format.  This provides both forward
20029459361Smrg	# compatibility and a consistent mechanism for selecting the
20129459361Smrg	# object file format.
20229459361Smrg	#
20329459361Smrg	# Note: NetBSD doesn't particularly care about the vendor
20429459361Smrg	# portion of the name.  We always set it to "unknown".
20527935385Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206291ca6f5Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207291ca6f5Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20827935385Smrg	    echo unknown)`
209291ca6f5Smrg	case $UNAME_MACHINE_ARCH in
210291ca6f5Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
21129459361Smrg	    armeb) machine=armeb-unknown ;;
21229459361Smrg	    arm*) machine=arm-unknown ;;
21329459361Smrg	    sh3el) machine=shl-unknown ;;
21429459361Smrg	    sh3eb) machine=sh-unknown ;;
21529459361Smrg	    sh5el) machine=sh5le-unknown ;;
21627935385Smrg	    earmv*)
21727935385Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
21827935385Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219291ca6f5Smrg		machine=${arch}${endian}-unknown
22027935385Smrg		;;
221291ca6f5Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22229459361Smrg	esac
22329459361Smrg	# The Operating System including object format, if it has switched
22427935385Smrg	# to ELF recently (or will in the future) and ABI.
225291ca6f5Smrg	case $UNAME_MACHINE_ARCH in
22627935385Smrg	    earm*)
22727935385Smrg		os=netbsdelf
22827935385Smrg		;;
22929459361Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230291ca6f5Smrg		set_cc_for_build
23129459361Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232c3c9b392Smrg			| grep -q __ELF__
23329459361Smrg		then
23429459361Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23529459361Smrg		    # Return netbsd for either.  FIX?
23629459361Smrg		    os=netbsd
23729459361Smrg		else
23829459361Smrg		    os=netbsdelf
23929459361Smrg		fi
24029459361Smrg		;;
24129459361Smrg	    *)
242f66e55a2Smrg		os=netbsd
24329459361Smrg		;;
24429459361Smrg	esac
24527935385Smrg	# Determine ABI tags.
246291ca6f5Smrg	case $UNAME_MACHINE_ARCH in
24727935385Smrg	    earm*)
24827935385Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
24927935385Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
25027935385Smrg		;;
25127935385Smrg	esac
25229459361Smrg	# The OS release
25329459361Smrg	# Debian GNU/NetBSD machines have a different userland, and
25429459361Smrg	# thus, need a distinct triplet. However, they do not need
25529459361Smrg	# kernel version information, so it can be replaced with a
25629459361Smrg	# suitable tag, in the style of linux-gnu.
257291ca6f5Smrg	case $UNAME_VERSION in
25829459361Smrg	    Debian*)
25929459361Smrg		release='-gnu'
26029459361Smrg		;;
26129459361Smrg	    *)
26227935385Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
26329459361Smrg		;;
26429459361Smrg	esac
26529459361Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26629459361Smrg	# contains redundant information, the shorter form:
26729459361Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268291ca6f5Smrg	GUESS=$machine-${os}${release}${abi-}
269291ca6f5Smrg	;;
270f66e55a2Smrg    *:Bitrig:*:*)
271f66e55a2Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272291ca6f5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273291ca6f5Smrg	;;
27429459361Smrg    *:OpenBSD:*:*)
27529459361Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276291ca6f5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277291ca6f5Smrg	;;
278291ca6f5Smrg    *:SecBSD:*:*)
279291ca6f5Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280291ca6f5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281291ca6f5Smrg	;;
28227935385Smrg    *:LibertyBSD:*:*)
28327935385Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284291ca6f5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285291ca6f5Smrg	;;
28627935385Smrg    *:MidnightBSD:*:*)
287291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288291ca6f5Smrg	;;
28929459361Smrg    *:ekkoBSD:*:*)
290291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291291ca6f5Smrg	;;
29229459361Smrg    *:SolidBSD:*:*)
293291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294291ca6f5Smrg	;;
295291ca6f5Smrg    *:OS108:*:*)
296291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297291ca6f5Smrg	;;
29829459361Smrg    macppc:MirBSD:*:*)
299291ca6f5Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300291ca6f5Smrg	;;
30129459361Smrg    *:MirBSD:*:*)
302291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303291ca6f5Smrg	;;
30427935385Smrg    *:Sortix:*:*)
305291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
306291ca6f5Smrg	;;
307291ca6f5Smrg    *:Twizzler:*:*)
308291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309291ca6f5Smrg	;;
31027935385Smrg    *:Redox:*:*)
311291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-redox
312291ca6f5Smrg	;;
31327935385Smrg    mips:OSF1:*.*)
314291ca6f5Smrg	GUESS=mips-dec-osf1
315291ca6f5Smrg	;;
31629459361Smrg    alpha:OSF1:*:*)
317291ca6f5Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318291ca6f5Smrg	trap '' 0
31929459361Smrg	case $UNAME_RELEASE in
32029459361Smrg	*4.0)
32129459361Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32229459361Smrg		;;
32329459361Smrg	*5.*)
324f66e55a2Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
32529459361Smrg		;;
32629459361Smrg	esac
32729459361Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
32829459361Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
32929459361Smrg	# covers most systems running today.  This code pipes the CPU
33029459361Smrg	# types through head -n 1, so we only detect the type of CPU 0.
33129459361Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332291ca6f5Smrg	case $ALPHA_CPU_TYPE in
33329459361Smrg	    "EV4 (21064)")
33427935385Smrg		UNAME_MACHINE=alpha ;;
33529459361Smrg	    "EV4.5 (21064)")
33627935385Smrg		UNAME_MACHINE=alpha ;;
33729459361Smrg	    "LCA4 (21066/21068)")
33827935385Smrg		UNAME_MACHINE=alpha ;;
33929459361Smrg	    "EV5 (21164)")
34027935385Smrg		UNAME_MACHINE=alphaev5 ;;
34129459361Smrg	    "EV5.6 (21164A)")
34227935385Smrg		UNAME_MACHINE=alphaev56 ;;
34329459361Smrg	    "EV5.6 (21164PC)")
34427935385Smrg		UNAME_MACHINE=alphapca56 ;;
34529459361Smrg	    "EV5.7 (21164PC)")
34627935385Smrg		UNAME_MACHINE=alphapca57 ;;
34729459361Smrg	    "EV6 (21264)")
34827935385Smrg		UNAME_MACHINE=alphaev6 ;;
34929459361Smrg	    "EV6.7 (21264A)")
35027935385Smrg		UNAME_MACHINE=alphaev67 ;;
35129459361Smrg	    "EV6.8CB (21264C)")
35227935385Smrg		UNAME_MACHINE=alphaev68 ;;
35329459361Smrg	    "EV6.8AL (21264B)")
35427935385Smrg		UNAME_MACHINE=alphaev68 ;;
35529459361Smrg	    "EV6.8CX (21264D)")
35627935385Smrg		UNAME_MACHINE=alphaev68 ;;
35729459361Smrg	    "EV6.9A (21264/EV69A)")
35827935385Smrg		UNAME_MACHINE=alphaev69 ;;
35929459361Smrg	    "EV7 (21364)")
36027935385Smrg		UNAME_MACHINE=alphaev7 ;;
36129459361Smrg	    "EV7.9 (21364A)")
36227935385Smrg		UNAME_MACHINE=alphaev79 ;;
36329459361Smrg	esac
36429459361Smrg	# A Pn.n version is a patched version.
36529459361Smrg	# A Vn.n version is a released version.
36629459361Smrg	# A Tn.n version is a released field test version.
36729459361Smrg	# A Xn.n version is an unreleased experimental baselevel.
36829459361Smrg	# 1.2 uses "1.2" for uname -r.
369291ca6f5Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370291ca6f5Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371291ca6f5Smrg	;;
37229459361Smrg    Amiga*:UNIX_System_V:4.0:*)
373291ca6f5Smrg	GUESS=m68k-unknown-sysv4
374291ca6f5Smrg	;;
37529459361Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377291ca6f5Smrg	;;
37829459361Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
380291ca6f5Smrg	;;
38129459361Smrg    *:OS/390:*:*)
382291ca6f5Smrg	GUESS=i370-ibm-openedition
383291ca6f5Smrg	;;
38429459361Smrg    *:z/VM:*:*)
385291ca6f5Smrg	GUESS=s390-ibm-zvmoe
386291ca6f5Smrg	;;
38729459361Smrg    *:OS400:*:*)
388291ca6f5Smrg	GUESS=powerpc-ibm-os400
389291ca6f5Smrg	;;
39029459361Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391291ca6f5Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392291ca6f5Smrg	;;
393f66e55a2Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394291ca6f5Smrg	GUESS=arm-unknown-riscos
395291ca6f5Smrg	;;
39629459361Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397291ca6f5Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
398291ca6f5Smrg	;;
39929459361Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40029459361Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401291ca6f5Smrg	case `(/bin/universe) 2>/dev/null` in
402291ca6f5Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403291ca6f5Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404291ca6f5Smrg	esac
405291ca6f5Smrg	;;
40629459361Smrg    NILE*:*:*:dcosx)
407291ca6f5Smrg	GUESS=pyramid-pyramid-svr4
408291ca6f5Smrg	;;
40929459361Smrg    DRS?6000:unix:4.0:6*)
410291ca6f5Smrg	GUESS=sparc-icl-nx6
411291ca6f5Smrg	;;
41229459361Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
41329459361Smrg	case `/usr/bin/uname -p` in
414291ca6f5Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
415291ca6f5Smrg	esac
416291ca6f5Smrg	;;
4175715adc0Smrg    s390x:SunOS:*:*)
418291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419291ca6f5Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420291ca6f5Smrg	;;
42129459361Smrg    sun4H:SunOS:5.*:*)
422291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423291ca6f5Smrg	GUESS=sparc-hal-solaris2$SUN_REL
424291ca6f5Smrg	;;
42529459361Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427291ca6f5Smrg	GUESS=sparc-sun-solaris2$SUN_REL
428291ca6f5Smrg	;;
429c3c9b392Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430291ca6f5Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431291ca6f5Smrg	;;
4325715adc0Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433291ca6f5Smrg	set_cc_for_build
43427935385Smrg	SUN_ARCH=i386
4355715adc0Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
4365715adc0Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4375715adc0Smrg	# This test works for both compilers.
438291ca6f5Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
4395715adc0Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
44027935385Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
4415715adc0Smrg		grep IS_64BIT_ARCH >/dev/null
4425715adc0Smrg	    then
44327935385Smrg		SUN_ARCH=x86_64
4445715adc0Smrg	    fi
4455715adc0Smrg	fi
446291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447291ca6f5Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448291ca6f5Smrg	;;
44929459361Smrg    sun4*:SunOS:6*:*)
45029459361Smrg	# According to config.sub, this is the proper way to canonicalize
45129459361Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45229459361Smrg	# it's likely to be more like Solaris than SunOS4.
453291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454291ca6f5Smrg	GUESS=sparc-sun-solaris3$SUN_REL
455291ca6f5Smrg	;;
45629459361Smrg    sun4*:SunOS:*:*)
457291ca6f5Smrg	case `/usr/bin/arch -k` in
45829459361Smrg	    Series*|S4*)
45929459361Smrg		UNAME_RELEASE=`uname -v`
46029459361Smrg		;;
46129459361Smrg	esac
46229459361Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464291ca6f5Smrg	GUESS=sparc-sun-sunos$SUN_REL
465291ca6f5Smrg	;;
46629459361Smrg    sun3*:SunOS:*:*)
467291ca6f5Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468291ca6f5Smrg	;;
46929459361Smrg    sun*:*:4.2BSD:*)
47029459361Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
47127935385Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472291ca6f5Smrg	case `/bin/arch` in
47329459361Smrg	    sun3)
474291ca6f5Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
47529459361Smrg		;;
47629459361Smrg	    sun4)
477291ca6f5Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
47829459361Smrg		;;
47929459361Smrg	esac
480291ca6f5Smrg	;;
48129459361Smrg    aushp:SunOS:*:*)
482291ca6f5Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483291ca6f5Smrg	;;
48429459361Smrg    # The situation for MiNT is a little confusing.  The machine name
48529459361Smrg    # can be virtually everything (everything which is not
48629459361Smrg    # "atarist" or "atariste" at least should have a processor
48729459361Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48829459361Smrg    # to the lowercase version "mint" (or "freemint").  Finally
48929459361Smrg    # the system name "TOS" denotes a system which is actually not
49029459361Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
49129459361Smrg    # be no problem.
49229459361Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493291ca6f5Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494291ca6f5Smrg	;;
49529459361Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496291ca6f5Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497291ca6f5Smrg	;;
49829459361Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499291ca6f5Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500291ca6f5Smrg	;;
50129459361Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502291ca6f5Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503291ca6f5Smrg	;;
50429459361Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505291ca6f5Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506291ca6f5Smrg	;;
50729459361Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508291ca6f5Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509291ca6f5Smrg	;;
51029459361Smrg    m68k:machten:*:*)
511291ca6f5Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512291ca6f5Smrg	;;
51329459361Smrg    powerpc:machten:*:*)
514291ca6f5Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515291ca6f5Smrg	;;
51629459361Smrg    RISC*:Mach:*:*)
517291ca6f5Smrg	GUESS=mips-dec-mach_bsd4.3
518291ca6f5Smrg	;;
51929459361Smrg    RISC*:ULTRIX:*:*)
520291ca6f5Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521291ca6f5Smrg	;;
52229459361Smrg    VAX*:ULTRIX*:*:*)
523291ca6f5Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524291ca6f5Smrg	;;
52529459361Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526291ca6f5Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527291ca6f5Smrg	;;
52829459361Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529291ca6f5Smrg	set_cc_for_build
53027935385Smrg	sed 's/^	//' << EOF > "$dummy.c"
53129459361Smrg#ifdef __cplusplus
53229459361Smrg#include <stdio.h>  /* for printf() prototype */
53329459361Smrg	int main (int argc, char *argv[]) {
53429459361Smrg#else
53529459361Smrg	int main (argc, argv) int argc; char *argv[]; {
53629459361Smrg#endif
53729459361Smrg	#if defined (host_mips) && defined (MIPSEB)
53829459361Smrg	#if defined (SYSTYPE_SYSV)
53927935385Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54029459361Smrg	#endif
54129459361Smrg	#if defined (SYSTYPE_SVR4)
54227935385Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54329459361Smrg	#endif
54429459361Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
54527935385Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54629459361Smrg	#endif
54729459361Smrg	#endif
54829459361Smrg	  exit (-1);
54929459361Smrg	}
55029459361SmrgEOF
55127935385Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
55227935385Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
55327935385Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55429459361Smrg	    { echo "$SYSTEM_NAME"; exit; }
555291ca6f5Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556291ca6f5Smrg	;;
55729459361Smrg    Motorola:PowerMAX_OS:*:*)
558291ca6f5Smrg	GUESS=powerpc-motorola-powermax
559291ca6f5Smrg	;;
56029459361Smrg    Motorola:*:4.3:PL8-*)
561291ca6f5Smrg	GUESS=powerpc-harris-powermax
562291ca6f5Smrg	;;
56329459361Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564291ca6f5Smrg	GUESS=powerpc-harris-powermax
565291ca6f5Smrg	;;
56629459361Smrg    Night_Hawk:Power_UNIX:*:*)
567291ca6f5Smrg	GUESS=powerpc-harris-powerunix
568291ca6f5Smrg	;;
56929459361Smrg    m88k:CX/UX:7*:*)
570291ca6f5Smrg	GUESS=m88k-harris-cxux7
571291ca6f5Smrg	;;
57229459361Smrg    m88k:*:4*:R4*)
573291ca6f5Smrg	GUESS=m88k-motorola-sysv4
574291ca6f5Smrg	;;
57529459361Smrg    m88k:*:3*:R3*)
576291ca6f5Smrg	GUESS=m88k-motorola-sysv3
577291ca6f5Smrg	;;
57829459361Smrg    AViiON:dgux:*:*)
579f66e55a2Smrg	# DG/UX returns AViiON for all architectures
580f66e55a2Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581291ca6f5Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58229459361Smrg	then
583291ca6f5Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584291ca6f5Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
58529459361Smrg	    then
586291ca6f5Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
58729459361Smrg	    else
588291ca6f5Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58929459361Smrg	    fi
59029459361Smrg	else
591291ca6f5Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
59229459361Smrg	fi
593291ca6f5Smrg	;;
59429459361Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595291ca6f5Smrg	GUESS=m88k-dolphin-sysv3
596291ca6f5Smrg	;;
59729459361Smrg    M88*:*:R3*:*)
59829459361Smrg	# Delta 88k system running SVR3
599291ca6f5Smrg	GUESS=m88k-motorola-sysv3
600291ca6f5Smrg	;;
60129459361Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602291ca6f5Smrg	GUESS=m88k-tektronix-sysv3
603291ca6f5Smrg	;;
60429459361Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605291ca6f5Smrg	GUESS=m68k-tektronix-bsd
606291ca6f5Smrg	;;
60729459361Smrg    *:IRIX*:*:*)
608291ca6f5Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609291ca6f5Smrg	GUESS=mips-sgi-irix$IRIX_REL
610291ca6f5Smrg	;;
61129459361Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612291ca6f5Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613291ca6f5Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61429459361Smrg    i*86:AIX:*:*)
615291ca6f5Smrg	GUESS=i386-ibm-aix
616291ca6f5Smrg	;;
61729459361Smrg    ia64:AIX:*:*)
618291ca6f5Smrg	if test -x /usr/bin/oslevel ; then
61929459361Smrg		IBM_REV=`/usr/bin/oslevel`
62029459361Smrg	else
621291ca6f5Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62229459361Smrg	fi
623291ca6f5Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624291ca6f5Smrg	;;
62529459361Smrg    *:AIX:2:3)
62629459361Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627291ca6f5Smrg		set_cc_for_build
62827935385Smrg		sed 's/^		//' << EOF > "$dummy.c"
62929459361Smrg		#include <sys/systemcfg.h>
63029459361Smrg
63129459361Smrg		main()
63229459361Smrg			{
63329459361Smrg			if (!__power_pc())
63429459361Smrg				exit(1);
63529459361Smrg			puts("powerpc-ibm-aix3.2.5");
63629459361Smrg			exit(0);
63729459361Smrg			}
63829459361SmrgEOF
63927935385Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64029459361Smrg		then
641291ca6f5Smrg			GUESS=$SYSTEM_NAME
64229459361Smrg		else
643291ca6f5Smrg			GUESS=rs6000-ibm-aix3.2.5
64429459361Smrg		fi
64529459361Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646291ca6f5Smrg		GUESS=rs6000-ibm-aix3.2.4
64729459361Smrg	else
648291ca6f5Smrg		GUESS=rs6000-ibm-aix3.2
64929459361Smrg	fi
650291ca6f5Smrg	;;
651c3c9b392Smrg    *:AIX:*:[4567])
65229459361Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
65327935385Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65429459361Smrg		IBM_ARCH=rs6000
65529459361Smrg	else
65629459361Smrg		IBM_ARCH=powerpc
65729459361Smrg	fi
658291ca6f5Smrg	if test -x /usr/bin/lslpp ; then
659291ca6f5Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
66027935385Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66129459361Smrg	else
662291ca6f5Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66329459361Smrg	fi
664291ca6f5Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665291ca6f5Smrg	;;
66629459361Smrg    *:AIX:*:*)
667291ca6f5Smrg	GUESS=rs6000-ibm-aix
668291ca6f5Smrg	;;
66927935385Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670291ca6f5Smrg	GUESS=romp-ibm-bsd4.4
671291ca6f5Smrg	;;
67229459361Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673291ca6f5Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674291ca6f5Smrg	;;                                  # report: romp-ibm BSD 4.3
67529459361Smrg    *:BOSX:*:*)
676291ca6f5Smrg	GUESS=rs6000-bull-bosx
677291ca6f5Smrg	;;
67829459361Smrg    DPX/2?00:B.O.S.:*:*)
679291ca6f5Smrg	GUESS=m68k-bull-sysv3
680291ca6f5Smrg	;;
68129459361Smrg    9000/[34]??:4.3bsd:1.*:*)
682291ca6f5Smrg	GUESS=m68k-hp-bsd
683291ca6f5Smrg	;;
68429459361Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685291ca6f5Smrg	GUESS=m68k-hp-bsd4.4
686291ca6f5Smrg	;;
68729459361Smrg    9000/[34678]??:HP-UX:*:*)
688291ca6f5Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689291ca6f5Smrg	case $UNAME_MACHINE in
69027935385Smrg	    9000/31?)            HP_ARCH=m68000 ;;
69127935385Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
69229459361Smrg	    9000/[678][0-9][0-9])
693291ca6f5Smrg		if test -x /usr/bin/getconf; then
69429459361Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695f66e55a2Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696291ca6f5Smrg		    case $sc_cpu_version in
69727935385Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
69827935385Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699f66e55a2Smrg		      532)                      # CPU_PA_RISC2_0
700291ca6f5Smrg			case $sc_kernel_bits in
70127935385Smrg			  32) HP_ARCH=hppa2.0n ;;
70227935385Smrg			  64) HP_ARCH=hppa2.0w ;;
70327935385Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704f66e55a2Smrg			esac ;;
705f66e55a2Smrg		    esac
70629459361Smrg		fi
707291ca6f5Smrg		if test "$HP_ARCH" = ""; then
708291ca6f5Smrg		    set_cc_for_build
70927935385Smrg		    sed 's/^		//' << EOF > "$dummy.c"
71029459361Smrg
711f66e55a2Smrg		#define _HPUX_SOURCE
712f66e55a2Smrg		#include <stdlib.h>
713f66e55a2Smrg		#include <unistd.h>
71429459361Smrg
715f66e55a2Smrg		int main ()
716f66e55a2Smrg		{
717f66e55a2Smrg		#if defined(_SC_KERNEL_BITS)
718f66e55a2Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
719f66e55a2Smrg		#endif
720f66e55a2Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
72129459361Smrg
722f66e55a2Smrg		    switch (cpu)
723f66e55a2Smrg			{
724f66e55a2Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725f66e55a2Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726f66e55a2Smrg			case CPU_PA_RISC2_0:
727f66e55a2Smrg		#if defined(_SC_KERNEL_BITS)
728f66e55a2Smrg			    switch (bits)
729f66e55a2Smrg				{
730f66e55a2Smrg				case 64: puts ("hppa2.0w"); break;
731f66e55a2Smrg				case 32: puts ("hppa2.0n"); break;
732f66e55a2Smrg				default: puts ("hppa2.0"); break;
733f66e55a2Smrg				} break;
734f66e55a2Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
735f66e55a2Smrg			    puts ("hppa2.0"); break;
736f66e55a2Smrg		#endif
737f66e55a2Smrg			default: puts ("hppa1.0"); break;
738f66e55a2Smrg			}
739f66e55a2Smrg		    exit (0);
740f66e55a2Smrg		}
74129459361SmrgEOF
74227935385Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
74329459361Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
74429459361Smrg		fi ;;
74529459361Smrg	esac
746291ca6f5Smrg	if test "$HP_ARCH" = hppa2.0w
74729459361Smrg	then
748291ca6f5Smrg	    set_cc_for_build
74929459361Smrg
75029459361Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75129459361Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75229459361Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
75329459361Smrg	    #
75429459361Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
75529459361Smrg	    # => hppa2.0w-hp-hpux11.23
75629459361Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75729459361Smrg	    # => hppa64-hp-hpux11.23
75829459361Smrg
75927935385Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760c3c9b392Smrg		grep -q __LP64__
76129459361Smrg	    then
76227935385Smrg		HP_ARCH=hppa2.0w
76329459361Smrg	    else
76427935385Smrg		HP_ARCH=hppa64
76529459361Smrg	    fi
76629459361Smrg	fi
767291ca6f5Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768291ca6f5Smrg	;;
76929459361Smrg    ia64:HP-UX:*:*)
770291ca6f5Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771291ca6f5Smrg	GUESS=ia64-hp-hpux$HPUX_REV
772291ca6f5Smrg	;;
77329459361Smrg    3050*:HI-UX:*:*)
774291ca6f5Smrg	set_cc_for_build
77527935385Smrg	sed 's/^	//' << EOF > "$dummy.c"
77629459361Smrg	#include <unistd.h>
77729459361Smrg	int
77829459361Smrg	main ()
77929459361Smrg	{
78029459361Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
78129459361Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78229459361Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78329459361Smrg	     results, however.  */
78429459361Smrg	  if (CPU_IS_PA_RISC (cpu))
78529459361Smrg	    {
78629459361Smrg	      switch (cpu)
78729459361Smrg		{
78829459361Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78929459361Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79029459361Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79129459361Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79229459361Smrg		}
79329459361Smrg	    }
79429459361Smrg	  else if (CPU_IS_HP_MC68K (cpu))
79529459361Smrg	    puts ("m68k-hitachi-hiuxwe2");
79629459361Smrg	  else puts ("unknown-hitachi-hiuxwe2");
79729459361Smrg	  exit (0);
79829459361Smrg	}
79929459361SmrgEOF
80027935385Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80129459361Smrg		{ echo "$SYSTEM_NAME"; exit; }
802291ca6f5Smrg	GUESS=unknown-hitachi-hiuxwe2
803291ca6f5Smrg	;;
80427935385Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805291ca6f5Smrg	GUESS=hppa1.1-hp-bsd
806291ca6f5Smrg	;;
80729459361Smrg    9000/8??:4.3bsd:*:*)
808291ca6f5Smrg	GUESS=hppa1.0-hp-bsd
809291ca6f5Smrg	;;
81029459361Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811291ca6f5Smrg	GUESS=hppa1.0-hp-mpeix
812291ca6f5Smrg	;;
81327935385Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814291ca6f5Smrg	GUESS=hppa1.1-hp-osf
815291ca6f5Smrg	;;
81629459361Smrg    hp8??:OSF1:*:*)
817291ca6f5Smrg	GUESS=hppa1.0-hp-osf
818291ca6f5Smrg	;;
81929459361Smrg    i*86:OSF1:*:*)
820291ca6f5Smrg	if test -x /usr/sbin/sysversion ; then
821291ca6f5Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82229459361Smrg	else
823291ca6f5Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
82429459361Smrg	fi
825291ca6f5Smrg	;;
82629459361Smrg    parisc*:Lites*:*:*)
827291ca6f5Smrg	GUESS=hppa1.1-hp-lites
828291ca6f5Smrg	;;
82929459361Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830291ca6f5Smrg	GUESS=c1-convex-bsd
831291ca6f5Smrg	;;
83229459361Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83329459361Smrg	if getsysinfo -f scalar_acc
83429459361Smrg	then echo c32-convex-bsd
83529459361Smrg	else echo c2-convex-bsd
83629459361Smrg	fi
837f66e55a2Smrg	exit ;;
83829459361Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839291ca6f5Smrg	GUESS=c34-convex-bsd
840291ca6f5Smrg	;;
84129459361Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842291ca6f5Smrg	GUESS=c38-convex-bsd
843291ca6f5Smrg	;;
84429459361Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845291ca6f5Smrg	GUESS=c4-convex-bsd
846291ca6f5Smrg	;;
84729459361Smrg    CRAY*Y-MP:*:*:*)
848291ca6f5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849291ca6f5Smrg	GUESS=ymp-cray-unicos$CRAY_REL
850291ca6f5Smrg	;;
85129459361Smrg    CRAY*[A-Z]90:*:*:*)
85227935385Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85329459361Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85429459361Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85529459361Smrg	      -e 's/\.[^.]*$/.X/'
85629459361Smrg	exit ;;
85729459361Smrg    CRAY*TS:*:*:*)
858291ca6f5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859291ca6f5Smrg	GUESS=t90-cray-unicos$CRAY_REL
860291ca6f5Smrg	;;
86129459361Smrg    CRAY*T3E:*:*:*)
862291ca6f5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863291ca6f5Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864291ca6f5Smrg	;;
86529459361Smrg    CRAY*SV1:*:*:*)
866291ca6f5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867291ca6f5Smrg	GUESS=sv1-cray-unicos$CRAY_REL
868291ca6f5Smrg	;;
86929459361Smrg    *:UNICOS/mp:*:*)
870291ca6f5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871291ca6f5Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872291ca6f5Smrg	;;
87329459361Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
87427935385Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
87527935385Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
87627935385Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877291ca6f5Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878291ca6f5Smrg	;;
87929459361Smrg    5000:UNIX_System_V:4.*:*)
88027935385Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
88127935385Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882291ca6f5Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883291ca6f5Smrg	;;
88429459361Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886291ca6f5Smrg	;;
88729459361Smrg    sparc*:BSD/OS:*:*)
888291ca6f5Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889291ca6f5Smrg	;;
89029459361Smrg    *:BSD/OS:*:*)
891291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892291ca6f5Smrg	;;
893291ca6f5Smrg    arm:FreeBSD:*:*)
894291ca6f5Smrg	UNAME_PROCESSOR=`uname -p`
895291ca6f5Smrg	set_cc_for_build
896291ca6f5Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897291ca6f5Smrg	    | grep -q __ARM_PCS_VFP
898291ca6f5Smrg	then
899291ca6f5Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900291ca6f5Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901291ca6f5Smrg	else
902291ca6f5Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903291ca6f5Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904291ca6f5Smrg	fi
905291ca6f5Smrg	;;
90629459361Smrg    *:FreeBSD:*:*)
907f66e55a2Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908291ca6f5Smrg	case $UNAME_PROCESSOR in
90929459361Smrg	    amd64)
91027935385Smrg		UNAME_PROCESSOR=x86_64 ;;
91127935385Smrg	    i386)
91227935385Smrg		UNAME_PROCESSOR=i586 ;;
91329459361Smrg	esac
914291ca6f5Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915291ca6f5Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916291ca6f5Smrg	;;
91729459361Smrg    i*:CYGWIN*:*)
918291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
919291ca6f5Smrg	;;
920f66e55a2Smrg    *:MINGW64*:*)
921291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
922291ca6f5Smrg	;;
9235715adc0Smrg    *:MINGW*:*)
924291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
925291ca6f5Smrg	;;
92627935385Smrg    *:MSYS*:*)
927291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-msys
928291ca6f5Smrg	;;
92929459361Smrg    i*:PW*:*)
930291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-pw32
931291ca6f5Smrg	;;
932c3c9b392Smrg    *:Interix*:*)
933291ca6f5Smrg	case $UNAME_MACHINE in
9345715adc0Smrg	    x86)
935291ca6f5Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
936291ca6f5Smrg		;;
937c3c9b392Smrg	    authenticamd | genuineintel | EM64T)
938291ca6f5Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
939291ca6f5Smrg		;;
9405715adc0Smrg	    IA64)
941291ca6f5Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
942291ca6f5Smrg		;;
9435715adc0Smrg	esac ;;
94429459361Smrg    i*:UWIN*:*)
945291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-uwin
946291ca6f5Smrg	;;
94729459361Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948291ca6f5Smrg	GUESS=x86_64-pc-cygwin
949291ca6f5Smrg	;;
95029459361Smrg    prep*:SunOS:5.*:*)
951291ca6f5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952291ca6f5Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
953291ca6f5Smrg	;;
95429459361Smrg    *:GNU:*:*)
95529459361Smrg	# the GNU system
956291ca6f5Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957291ca6f5Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958291ca6f5Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959291ca6f5Smrg	;;
96029459361Smrg    *:GNU/*:*:*)
96129459361Smrg	# other systems with GNU libc and userland
962291ca6f5Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963291ca6f5Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965291ca6f5Smrg	;;
966291ca6f5Smrg    *:Minix:*:*)
967291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-minix
968291ca6f5Smrg	;;
969f66e55a2Smrg    aarch64:Linux:*:*)
970291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971291ca6f5Smrg	;;
972f66e55a2Smrg    aarch64_be:Linux:*:*)
973f66e55a2Smrg	UNAME_MACHINE=aarch64_be
974291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975291ca6f5Smrg	;;
976c3c9b392Smrg    alpha:Linux:*:*)
977291ca6f5Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978c3c9b392Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979c3c9b392Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980c3c9b392Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981c3c9b392Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982c3c9b392Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983c3c9b392Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984c3c9b392Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
985f66e55a2Smrg	esac
986c3c9b392Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
98727935385Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989291ca6f5Smrg	;;
990291ca6f5Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992291ca6f5Smrg	;;
99329459361Smrg    arm*:Linux:*:*)
994291ca6f5Smrg	set_cc_for_build
9955715adc0Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9965715adc0Smrg	    | grep -q __ARM_EABI__
9975715adc0Smrg	then
998291ca6f5Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9995715adc0Smrg	else
1000f66e55a2Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001f66e55a2Smrg		| grep -q __ARM_PCS_VFP
1002f66e55a2Smrg	    then
1003291ca6f5Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004f66e55a2Smrg	    else
1005291ca6f5Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006f66e55a2Smrg	    fi
10075715adc0Smrg	fi
1008291ca6f5Smrg	;;
100929459361Smrg    avr32*:Linux:*:*)
1010291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011291ca6f5Smrg	;;
101229459361Smrg    cris:Linux:*:*)
1013291ca6f5Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014291ca6f5Smrg	;;
101529459361Smrg    crisv32:Linux:*:*)
1016291ca6f5Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017291ca6f5Smrg	;;
101827935385Smrg    e2k:Linux:*:*)
1019291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020291ca6f5Smrg	;;
102129459361Smrg    frv:Linux:*:*)
1022291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023291ca6f5Smrg	;;
1024f66e55a2Smrg    hexagon:Linux:*:*)
1025291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026291ca6f5Smrg	;;
1027c3c9b392Smrg    i*86:Linux:*:*)
1028291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029291ca6f5Smrg	;;
103029459361Smrg    ia64:Linux:*:*)
1031291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032291ca6f5Smrg	;;
103327935385Smrg    k1om:Linux:*:*)
1034291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035291ca6f5Smrg	;;
1036291ca6f5Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038291ca6f5Smrg	;;
103929459361Smrg    m32r*:Linux:*:*)
1040291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041291ca6f5Smrg	;;
104229459361Smrg    m68*:Linux:*:*)
1043291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044291ca6f5Smrg	;;
1045c3c9b392Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1046291ca6f5Smrg	set_cc_for_build
1047291ca6f5Smrg	IS_GLIBC=0
1048291ca6f5Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
104927935385Smrg	sed 's/^	//' << EOF > "$dummy.c"
105029459361Smrg	#undef CPU
1051291ca6f5Smrg	#undef mips
1052291ca6f5Smrg	#undef mipsel
1053291ca6f5Smrg	#undef mips64
1054291ca6f5Smrg	#undef mips64el
1055291ca6f5Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1056291ca6f5Smrg	LIBCABI=gnuabi64
1057291ca6f5Smrg	#else
1058291ca6f5Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1059291ca6f5Smrg	LIBCABI=gnuabin32
1060291ca6f5Smrg	#else
1061291ca6f5Smrg	LIBCABI=${LIBC}
1062291ca6f5Smrg	#endif
1063291ca6f5Smrg	#endif
1064291ca6f5Smrg
1065291ca6f5Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1066291ca6f5Smrg	CPU=mipsisa64r6
1067291ca6f5Smrg	#else
1068291ca6f5Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069291ca6f5Smrg	CPU=mipsisa32r6
1070291ca6f5Smrg	#else
1071291ca6f5Smrg	#if defined(__mips64)
1072291ca6f5Smrg	CPU=mips64
1073291ca6f5Smrg	#else
1074291ca6f5Smrg	CPU=mips
1075291ca6f5Smrg	#endif
1076291ca6f5Smrg	#endif
1077291ca6f5Smrg	#endif
1078291ca6f5Smrg
107929459361Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1080291ca6f5Smrg	MIPS_ENDIAN=el
108129459361Smrg	#else
108229459361Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1083291ca6f5Smrg	MIPS_ENDIAN=
108429459361Smrg	#else
1085291ca6f5Smrg	MIPS_ENDIAN=
108629459361Smrg	#endif
108729459361Smrg	#endif
108829459361SmrgEOF
1089291ca6f5Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090291ca6f5Smrg	eval "$cc_set_vars"
1091291ca6f5Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
109229459361Smrg	;;
109327935385Smrg    mips64el:Linux:*:*)
1094291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1095291ca6f5Smrg	;;
109627935385Smrg    openrisc*:Linux:*:*)
1097291ca6f5Smrg	GUESS=or1k-unknown-linux-$LIBC
1098291ca6f5Smrg	;;
109927935385Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1100291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1101291ca6f5Smrg	;;
11025715adc0Smrg    padre:Linux:*:*)
1103291ca6f5Smrg	GUESS=sparc-unknown-linux-$LIBC
1104291ca6f5Smrg	;;
1105c3c9b392Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106291ca6f5Smrg	GUESS=hppa64-unknown-linux-$LIBC
1107291ca6f5Smrg	;;
110829459361Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
110929459361Smrg	# Look for CPU level
111029459361Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111291ca6f5Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112291ca6f5Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113291ca6f5Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
111429459361Smrg	esac
1115291ca6f5Smrg	;;
1116c3c9b392Smrg    ppc64:Linux:*:*)
1117291ca6f5Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1118291ca6f5Smrg	;;
1119c3c9b392Smrg    ppc:Linux:*:*)
1120291ca6f5Smrg	GUESS=powerpc-unknown-linux-$LIBC
1121291ca6f5Smrg	;;
112227935385Smrg    ppc64le:Linux:*:*)
1123291ca6f5Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1124291ca6f5Smrg	;;
112527935385Smrg    ppcle:Linux:*:*)
1126291ca6f5Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1127291ca6f5Smrg	;;
1128291ca6f5Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130291ca6f5Smrg	;;
113129459361Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1132291ca6f5Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133291ca6f5Smrg	;;
113429459361Smrg    sh64*:Linux:*:*)
1135291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136291ca6f5Smrg	;;
113729459361Smrg    sh*:Linux:*:*)
1138291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139291ca6f5Smrg	;;
114029459361Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1141291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142291ca6f5Smrg	;;
1143c3c9b392Smrg    tile*:Linux:*:*)
1144291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145291ca6f5Smrg	;;
114629459361Smrg    vax:Linux:*:*)
1147291ca6f5Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148291ca6f5Smrg	;;
114929459361Smrg    x86_64:Linux:*:*)
1150291ca6f5Smrg	set_cc_for_build
1151291ca6f5Smrg	LIBCABI=$LIBC
1152291ca6f5Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1153291ca6f5Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1154291ca6f5Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1155291ca6f5Smrg		grep IS_X32 >/dev/null
1156291ca6f5Smrg	    then
1157291ca6f5Smrg		LIBCABI=${LIBC}x32
1158291ca6f5Smrg	    fi
1159291ca6f5Smrg	fi
1160291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161291ca6f5Smrg	;;
11625715adc0Smrg    xtensa*:Linux:*:*)
1163291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164291ca6f5Smrg	;;
116529459361Smrg    i*86:DYNIX/ptx:4*:*)
116629459361Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
116729459361Smrg	# earlier versions are messed up and put the nodename in both
116829459361Smrg	# sysname and nodename.
1169291ca6f5Smrg	GUESS=i386-sequent-sysv4
1170291ca6f5Smrg	;;
117129459361Smrg    i*86:UNIX_SV:4.2MP:2.*)
1172f66e55a2Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1173f66e55a2Smrg	# number series starting with 2...
1174f66e55a2Smrg	# I am not positive that other SVR4 systems won't match this,
117529459361Smrg	# I just have to hope.  -- rms.
1176f66e55a2Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1177291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178291ca6f5Smrg	;;
117929459361Smrg    i*86:OS/2:*:*)
118029459361Smrg	# If we were able to find `uname', then EMX Unix compatibility
118129459361Smrg	# is probably installed.
1182291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1183291ca6f5Smrg	;;
118429459361Smrg    i*86:XTS-300:*:STOP)
1185291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1186291ca6f5Smrg	;;
118729459361Smrg    i*86:atheos:*:*)
1188291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1189291ca6f5Smrg	;;
119029459361Smrg    i*86:syllable:*:*)
1191291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1192291ca6f5Smrg	;;
1193c3c9b392Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194291ca6f5Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195291ca6f5Smrg	;;
119629459361Smrg    i*86:*DOS:*:*)
1197291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198291ca6f5Smrg	;;
119927935385Smrg    i*86:*:4.*:*)
120027935385Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
120129459361Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202291ca6f5Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
120329459361Smrg	else
1204291ca6f5Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
120529459361Smrg	fi
1206291ca6f5Smrg	;;
120729459361Smrg    i*86:*:5:[678]*)
1208f66e55a2Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
120929459361Smrg	case `/bin/uname -X | grep "^Machine"` in
121029459361Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
121129459361Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
121229459361Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
121329459361Smrg	esac
1214291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215291ca6f5Smrg	;;
121629459361Smrg    i*86:*:3.2:*)
121729459361Smrg	if test -f /usr/options/cb.name; then
121829459361Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219291ca6f5Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
122029459361Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
122129459361Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
122229459361Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
122329459361Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
122429459361Smrg			&& UNAME_MACHINE=i586
122529459361Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
122629459361Smrg			&& UNAME_MACHINE=i686
122729459361Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
122829459361Smrg			&& UNAME_MACHINE=i686
1229291ca6f5Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
123029459361Smrg	else
1231291ca6f5Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
123229459361Smrg	fi
1233291ca6f5Smrg	;;
123429459361Smrg    pc:*:*:*)
123529459361Smrg	# Left here for compatibility:
1236f66e55a2Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1237f66e55a2Smrg	# the processor, so we play safe by assuming i586.
12385715adc0Smrg	# Note: whatever this is, it MUST be the same as what config.sub
123927935385Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
12405715adc0Smrg	# this is a cross-build.
1241291ca6f5Smrg	GUESS=i586-pc-msdosdjgpp
1242291ca6f5Smrg	;;
124329459361Smrg    Intel:Mach:3*:*)
1244291ca6f5Smrg	GUESS=i386-pc-mach3
1245291ca6f5Smrg	;;
124629459361Smrg    paragon:*:*:*)
1247291ca6f5Smrg	GUESS=i860-intel-osf1
1248291ca6f5Smrg	;;
124929459361Smrg    i860:*:4.*:*) # i860-SVR4
125029459361Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251291ca6f5Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
125229459361Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1253291ca6f5Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
125429459361Smrg	fi
1255291ca6f5Smrg	;;
125629459361Smrg    mini*:CTIX:SYS*5:*)
125729459361Smrg	# "miniframe"
1258291ca6f5Smrg	GUESS=m68010-convergent-sysv
1259291ca6f5Smrg	;;
126029459361Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1261291ca6f5Smrg	GUESS=m68k-convergent-sysv
1262291ca6f5Smrg	;;
126329459361Smrg    M680?0:D-NIX:5.3:*)
1264291ca6f5Smrg	GUESS=m68k-diab-dnix
1265291ca6f5Smrg	;;
126629459361Smrg    M68*:*:R3V[5678]*:*)
126729459361Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
126829459361Smrg    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)
126929459361Smrg	OS_REL=''
127029459361Smrg	test -r /etc/.relid \
127129459361Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
127229459361Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
127327935385Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
127429459361Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
127527935385Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
127629459361Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277f66e55a2Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278f66e55a2Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
12795715adc0Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
12805715adc0Smrg	OS_REL='.3'
12815715adc0Smrg	test -r /etc/.relid \
12825715adc0Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12835715adc0Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
128427935385Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12855715adc0Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
128627935385Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
12875715adc0Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
128827935385Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
128929459361Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290291ca6f5Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291291ca6f5Smrg	;;
129229459361Smrg    mc68030:UNIX_System_V:4.*:*)
1293291ca6f5Smrg	GUESS=m68k-atari-sysv4
1294291ca6f5Smrg	;;
129529459361Smrg    TSUNAMI:LynxOS:2.*:*)
1296291ca6f5Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297291ca6f5Smrg	;;
129829459361Smrg    rs6000:LynxOS:2.*:*)
1299291ca6f5Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300291ca6f5Smrg	;;
1301c3c9b392Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302291ca6f5Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303291ca6f5Smrg	;;
130429459361Smrg    SM[BE]S:UNIX_SV:*:*)
1305291ca6f5Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1306291ca6f5Smrg	;;
130729459361Smrg    RM*:ReliantUNIX-*:*:*)
1308291ca6f5Smrg	GUESS=mips-sni-sysv4
1309291ca6f5Smrg	;;
131029459361Smrg    RM*:SINIX-*:*:*)
1311291ca6f5Smrg	GUESS=mips-sni-sysv4
1312291ca6f5Smrg	;;
131329459361Smrg    *:SINIX-*:*:*)
131429459361Smrg	if uname -p 2>/dev/null >/dev/null ; then
131529459361Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316291ca6f5Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
131729459361Smrg	else
1318291ca6f5Smrg		GUESS=ns32k-sni-sysv
131929459361Smrg	fi
1320291ca6f5Smrg	;;
1321f66e55a2Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322f66e55a2Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1323291ca6f5Smrg	GUESS=i586-unisys-sysv4
1324291ca6f5Smrg	;;
132529459361Smrg    *:UNIX_System_V:4*:FTX*)
132629459361Smrg	# From Gerald Hewes <hewes@openmarket.com>.
132729459361Smrg	# How about differentiating between stratus architectures? -djm
1328291ca6f5Smrg	GUESS=hppa1.1-stratus-sysv4
1329291ca6f5Smrg	;;
133029459361Smrg    *:*:*:FTX*)
133129459361Smrg	# From seanf@swdc.stratus.com.
1332291ca6f5Smrg	GUESS=i860-stratus-sysv4
1333291ca6f5Smrg	;;
133429459361Smrg    i*86:VOS:*:*)
133529459361Smrg	# From Paul.Green@stratus.com.
1336291ca6f5Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1337291ca6f5Smrg	;;
133829459361Smrg    *:VOS:*:*)
133929459361Smrg	# From Paul.Green@stratus.com.
1340291ca6f5Smrg	GUESS=hppa1.1-stratus-vos
1341291ca6f5Smrg	;;
134229459361Smrg    mc68*:A/UX:*:*)
1343291ca6f5Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1344291ca6f5Smrg	;;
134529459361Smrg    news*:NEWS-OS:6*:*)
1346291ca6f5Smrg	GUESS=mips-sony-newsos6
1347291ca6f5Smrg	;;
134829459361Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1349291ca6f5Smrg	if test -d /usr/nec; then
1350291ca6f5Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
135129459361Smrg	else
1352291ca6f5Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
135329459361Smrg	fi
1354291ca6f5Smrg	;;
135529459361Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1356291ca6f5Smrg	GUESS=powerpc-be-beos
1357291ca6f5Smrg	;;
135829459361Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1359291ca6f5Smrg	GUESS=powerpc-apple-beos
1360291ca6f5Smrg	;;
136129459361Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1362291ca6f5Smrg	GUESS=i586-pc-beos
1363291ca6f5Smrg	;;
13645715adc0Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1365291ca6f5Smrg	GUESS=i586-pc-haiku
1366291ca6f5Smrg	;;
1367f66e55a2Smrg    x86_64:Haiku:*:*)
1368291ca6f5Smrg	GUESS=x86_64-unknown-haiku
1369291ca6f5Smrg	;;
137029459361Smrg    SX-4:SUPER-UX:*:*)
1371291ca6f5Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1372291ca6f5Smrg	;;
137329459361Smrg    SX-5:SUPER-UX:*:*)
1374291ca6f5Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1375291ca6f5Smrg	;;
137629459361Smrg    SX-6:SUPER-UX:*:*)
1377291ca6f5Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1378291ca6f5Smrg	;;
137929459361Smrg    SX-7:SUPER-UX:*:*)
1380291ca6f5Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1381291ca6f5Smrg	;;
138229459361Smrg    SX-8:SUPER-UX:*:*)
1383291ca6f5Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1384291ca6f5Smrg	;;
13855715adc0Smrg    SX-8R:SUPER-UX:*:*)
1386291ca6f5Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1387291ca6f5Smrg	;;
138827935385Smrg    SX-ACE:SUPER-UX:*:*)
1389291ca6f5Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1390291ca6f5Smrg	;;
139129459361Smrg    Power*:Rhapsody:*:*)
1392291ca6f5Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393291ca6f5Smrg	;;
139429459361Smrg    *:Rhapsody:*:*)
1395291ca6f5Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396291ca6f5Smrg	;;
1397291ca6f5Smrg    arm64:Darwin:*:*)
1398291ca6f5Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399291ca6f5Smrg	;;
140029459361Smrg    *:Darwin:*:*)
1401291ca6f5Smrg	UNAME_PROCESSOR=`uname -p`
1402291ca6f5Smrg	case $UNAME_PROCESSOR in
1403291ca6f5Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1404291ca6f5Smrg	esac
1405291ca6f5Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1406291ca6f5Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407291ca6f5Smrg	    # Avoid executing cc if there is no toolchain installed as
1408291ca6f5Smrg	    # cc will be a stub that puts up a graphical alert
1409291ca6f5Smrg	    # prompting the user to install developer tools.
1410291ca6f5Smrg	    CC_FOR_BUILD=no_compiler_found
1411291ca6f5Smrg	else
1412291ca6f5Smrg	    set_cc_for_build
141327935385Smrg	fi
1414291ca6f5Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1415291ca6f5Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416291ca6f5Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417291ca6f5Smrg		   grep IS_64BIT_ARCH >/dev/null
1418291ca6f5Smrg	    then
1419291ca6f5Smrg		case $UNAME_PROCESSOR in
1420291ca6f5Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1421291ca6f5Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1422291ca6f5Smrg		esac
1423291ca6f5Smrg	    fi
1424291ca6f5Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425291ca6f5Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426291ca6f5Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427291ca6f5Smrg		   grep IS_PPC >/dev/null
1428291ca6f5Smrg	    then
1429291ca6f5Smrg		UNAME_PROCESSOR=powerpc
143027935385Smrg	    fi
143127935385Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1432291ca6f5Smrg	    # uname -m returns i386 or x86_64
1433291ca6f5Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
143427935385Smrg	fi
1435291ca6f5Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436291ca6f5Smrg	;;
143729459361Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
143829459361Smrg	UNAME_PROCESSOR=`uname -p`
143927935385Smrg	if test "$UNAME_PROCESSOR" = x86; then
144029459361Smrg		UNAME_PROCESSOR=i386
144129459361Smrg		UNAME_MACHINE=pc
144229459361Smrg	fi
1443291ca6f5Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444291ca6f5Smrg	;;
144529459361Smrg    *:QNX:*:4*)
1446291ca6f5Smrg	GUESS=i386-pc-qnx
1447291ca6f5Smrg	;;
144827935385Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1449291ca6f5Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1450291ca6f5Smrg	;;
1451f66e55a2Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1452291ca6f5Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1453291ca6f5Smrg	;;
145427935385Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1455291ca6f5Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456291ca6f5Smrg	;;
145727935385Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1458291ca6f5Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459291ca6f5Smrg	;;
146027935385Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1461291ca6f5Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462291ca6f5Smrg	;;
146329459361Smrg    *:NonStop-UX:*:*)
1464291ca6f5Smrg	GUESS=mips-compaq-nonstopux
1465291ca6f5Smrg	;;
146629459361Smrg    BS2000:POSIX*:*:*)
1467291ca6f5Smrg	GUESS=bs2000-siemens-sysv
1468291ca6f5Smrg	;;
146929459361Smrg    DS/*:UNIX_System_V:*:*)
1470291ca6f5Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471291ca6f5Smrg	;;
147229459361Smrg    *:Plan9:*:*)
147329459361Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
147429459361Smrg	# is converted to i386 for consistency with other x86
147529459361Smrg	# operating systems.
1476291ca6f5Smrg	if test "${cputype-}" = 386; then
147729459361Smrg	    UNAME_MACHINE=i386
1478291ca6f5Smrg	elif test "x${cputype-}" != x; then
1479291ca6f5Smrg	    UNAME_MACHINE=$cputype
148029459361Smrg	fi
1481291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1482291ca6f5Smrg	;;
148329459361Smrg    *:TOPS-10:*:*)
1484291ca6f5Smrg	GUESS=pdp10-unknown-tops10
1485291ca6f5Smrg	;;
148629459361Smrg    *:TENEX:*:*)
1487291ca6f5Smrg	GUESS=pdp10-unknown-tenex
1488291ca6f5Smrg	;;
148929459361Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490291ca6f5Smrg	GUESS=pdp10-dec-tops20
1491291ca6f5Smrg	;;
149229459361Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493291ca6f5Smrg	GUESS=pdp10-xkl-tops20
1494291ca6f5Smrg	;;
149529459361Smrg    *:TOPS-20:*:*)
1496291ca6f5Smrg	GUESS=pdp10-unknown-tops20
1497291ca6f5Smrg	;;
149829459361Smrg    *:ITS:*:*)
1499291ca6f5Smrg	GUESS=pdp10-unknown-its
1500291ca6f5Smrg	;;
150129459361Smrg    SEI:*:*:SEIUX)
1502291ca6f5Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1503291ca6f5Smrg	;;
150429459361Smrg    *:DragonFly:*:*)
1505291ca6f5Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507291ca6f5Smrg	;;
150829459361Smrg    *:*VMS:*:*)
1509f66e55a2Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510291ca6f5Smrg	case $UNAME_MACHINE in
1511291ca6f5Smrg	    A*) GUESS=alpha-dec-vms ;;
1512291ca6f5Smrg	    I*) GUESS=ia64-dec-vms ;;
1513291ca6f5Smrg	    V*) GUESS=vax-dec-vms ;;
151429459361Smrg	esac ;;
151529459361Smrg    *:XENIX:*:SysV)
1516291ca6f5Smrg	GUESS=i386-pc-xenix
1517291ca6f5Smrg	;;
151829459361Smrg    i*86:skyos:*:*)
1519291ca6f5Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521291ca6f5Smrg	;;
152229459361Smrg    i*86:rdos:*:*)
1523291ca6f5Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1524291ca6f5Smrg	;;
1525291ca6f5Smrg    *:AROS:*:*)
1526291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1527291ca6f5Smrg	;;
1528f66e55a2Smrg    x86_64:VMkernel:*:*)
1529291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1530291ca6f5Smrg	;;
153127935385Smrg    amd64:Isilon\ OneFS:*:*)
1532291ca6f5Smrg	GUESS=x86_64-unknown-onefs
1533291ca6f5Smrg	;;
1534291ca6f5Smrg    *:Unleashed:*:*)
1535291ca6f5Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1536291ca6f5Smrg	;;
153729459361Smrgesac
153829459361Smrg
1539291ca6f5Smrg# Do we have a guess based on uname results?
1540291ca6f5Smrgif test "x$GUESS" != x; then
1541291ca6f5Smrg    echo "$GUESS"
1542291ca6f5Smrg    exit
1543291ca6f5Smrgfi
1544291ca6f5Smrg
1545291ca6f5Smrg# No uname command or uname output not recognized.
1546291ca6f5Smrgset_cc_for_build
1547291ca6f5Smrgcat > "$dummy.c" <<EOF
1548291ca6f5Smrg#ifdef _SEQUENT_
1549291ca6f5Smrg#include <sys/types.h>
1550291ca6f5Smrg#include <sys/utsname.h>
1551291ca6f5Smrg#endif
1552291ca6f5Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1553291ca6f5Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1554291ca6f5Smrg#include <signal.h>
1555291ca6f5Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1556291ca6f5Smrg#include <sys/utsname.h>
1557291ca6f5Smrg#endif
1558291ca6f5Smrg#endif
1559291ca6f5Smrg#endif
1560291ca6f5Smrgmain ()
1561291ca6f5Smrg{
1562291ca6f5Smrg#if defined (sony)
1563291ca6f5Smrg#if defined (MIPSEB)
1564291ca6f5Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1565291ca6f5Smrg     I don't know....  */
1566291ca6f5Smrg  printf ("mips-sony-bsd\n"); exit (0);
1567291ca6f5Smrg#else
1568291ca6f5Smrg#include <sys/param.h>
1569291ca6f5Smrg  printf ("m68k-sony-newsos%s\n",
1570291ca6f5Smrg#ifdef NEWSOS4
1571291ca6f5Smrg  "4"
1572291ca6f5Smrg#else
1573291ca6f5Smrg  ""
1574291ca6f5Smrg#endif
1575291ca6f5Smrg  ); exit (0);
1576291ca6f5Smrg#endif
1577291ca6f5Smrg#endif
1578291ca6f5Smrg
1579291ca6f5Smrg#if defined (NeXT)
1580291ca6f5Smrg#if !defined (__ARCHITECTURE__)
1581291ca6f5Smrg#define __ARCHITECTURE__ "m68k"
1582291ca6f5Smrg#endif
1583291ca6f5Smrg  int version;
1584291ca6f5Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1585291ca6f5Smrg  if (version < 4)
1586291ca6f5Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1587291ca6f5Smrg  else
1588291ca6f5Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1589291ca6f5Smrg  exit (0);
1590291ca6f5Smrg#endif
1591291ca6f5Smrg
1592291ca6f5Smrg#if defined (MULTIMAX) || defined (n16)
1593291ca6f5Smrg#if defined (UMAXV)
1594291ca6f5Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1595291ca6f5Smrg#else
1596291ca6f5Smrg#if defined (CMU)
1597291ca6f5Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1598291ca6f5Smrg#else
1599291ca6f5Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1600291ca6f5Smrg#endif
1601291ca6f5Smrg#endif
1602291ca6f5Smrg#endif
1603291ca6f5Smrg
1604291ca6f5Smrg#if defined (__386BSD__)
1605291ca6f5Smrg  printf ("i386-pc-bsd\n"); exit (0);
1606291ca6f5Smrg#endif
1607291ca6f5Smrg
1608291ca6f5Smrg#if defined (sequent)
1609291ca6f5Smrg#if defined (i386)
1610291ca6f5Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1611291ca6f5Smrg#endif
1612291ca6f5Smrg#if defined (ns32000)
1613291ca6f5Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1614291ca6f5Smrg#endif
1615291ca6f5Smrg#endif
1616291ca6f5Smrg
1617291ca6f5Smrg#if defined (_SEQUENT_)
1618291ca6f5Smrg  struct utsname un;
1619291ca6f5Smrg
1620291ca6f5Smrg  uname(&un);
1621291ca6f5Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1622291ca6f5Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1623291ca6f5Smrg  }
1624291ca6f5Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1625291ca6f5Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1626291ca6f5Smrg  }
1627291ca6f5Smrg  printf ("i386-sequent-ptx\n"); exit (0);
1628291ca6f5Smrg#endif
1629291ca6f5Smrg
1630291ca6f5Smrg#if defined (vax)
1631291ca6f5Smrg#if !defined (ultrix)
1632291ca6f5Smrg#include <sys/param.h>
1633291ca6f5Smrg#if defined (BSD)
1634291ca6f5Smrg#if BSD == 43
1635291ca6f5Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1636291ca6f5Smrg#else
1637291ca6f5Smrg#if BSD == 199006
1638291ca6f5Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1639291ca6f5Smrg#else
1640291ca6f5Smrg  printf ("vax-dec-bsd\n"); exit (0);
1641291ca6f5Smrg#endif
1642291ca6f5Smrg#endif
1643291ca6f5Smrg#else
1644291ca6f5Smrg  printf ("vax-dec-bsd\n"); exit (0);
1645291ca6f5Smrg#endif
1646291ca6f5Smrg#else
1647291ca6f5Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1648291ca6f5Smrg  struct utsname un;
1649291ca6f5Smrg  uname (&un);
1650291ca6f5Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1651291ca6f5Smrg#else
1652291ca6f5Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1653291ca6f5Smrg#endif
1654291ca6f5Smrg#endif
1655291ca6f5Smrg#endif
1656291ca6f5Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1657291ca6f5Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1658291ca6f5Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1659291ca6f5Smrg  struct utsname *un;
1660291ca6f5Smrg  uname (&un);
1661291ca6f5Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1662291ca6f5Smrg#else
1663291ca6f5Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1664291ca6f5Smrg#endif
1665291ca6f5Smrg#endif
1666291ca6f5Smrg#endif
1667291ca6f5Smrg
1668291ca6f5Smrg#if defined (alliant) && defined (i860)
1669291ca6f5Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1670291ca6f5Smrg#endif
1671291ca6f5Smrg
1672291ca6f5Smrg  exit (1);
1673291ca6f5Smrg}
1674291ca6f5SmrgEOF
1675291ca6f5Smrg
1676291ca6f5Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1677291ca6f5Smrg	{ echo "$SYSTEM_NAME"; exit; }
1678291ca6f5Smrg
1679291ca6f5Smrg# Apollos put the system type in the environment.
1680291ca6f5Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1681291ca6f5Smrg
168227935385Smrgecho "$0: unable to guess system type" >&2
168329459361Smrg
1684291ca6f5Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
168527935385Smrg    mips:Linux | mips64:Linux)
168627935385Smrg	# If we got here on MIPS GNU/Linux, output extra information.
168727935385Smrg	cat >&2 <<EOF
168829459361Smrg
168927935385SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
169027935385Smrgthe system type. Please install a C compiler and try again.
169129459361SmrgEOF
169227935385Smrg	;;
169327935385Smrgesac
169429459361Smrg
169529459361Smrgcat >&2 <<EOF
169629459361Smrg
169727935385SmrgThis script (version $timestamp), has failed to recognize the
169827935385Smrgoperating system you are using. If your script is old, overwrite *all*
169927935385Smrgcopies of config.guess and config.sub with the latest versions from:
170029459361Smrg
1701291ca6f5Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
170229459361Smrgand
1703291ca6f5Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1704291ca6f5SmrgEOF
1705291ca6f5Smrg
1706291ca6f5Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1707291ca6f5Smrgthisyear=`date +%Y`
1708291ca6f5Smrg# shellcheck disable=SC2003
1709291ca6f5Smrgscript_age=`expr "$thisyear" - "$our_year"`
1710291ca6f5Smrgif test "$script_age" -lt 3 ; then
1711291ca6f5Smrg   cat >&2 <<EOF
171229459361Smrg
171327935385SmrgIf $0 has already been updated, send the following data and any
171427935385Smrginformation you think might be pertinent to config-patches@gnu.org to
171527935385Smrgprovide the necessary information to handle your system.
171629459361Smrg
171729459361Smrgconfig.guess timestamp = $timestamp
171829459361Smrg
171929459361Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
172029459361Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
172129459361Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
172229459361Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
172329459361Smrg
172429459361Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
172529459361Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
172629459361Smrg
172729459361Smrghostinfo               = `(hostinfo) 2>/dev/null`
172829459361Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
172929459361Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
173029459361Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
173129459361Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
173229459361Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
173329459361Smrg
173427935385SmrgUNAME_MACHINE = "$UNAME_MACHINE"
173527935385SmrgUNAME_RELEASE = "$UNAME_RELEASE"
173627935385SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
173727935385SmrgUNAME_VERSION = "$UNAME_VERSION"
173829459361SmrgEOF
1739291ca6f5Smrgfi
174029459361Smrg
174129459361Smrgexit 1
174229459361Smrg
174329459361Smrg# Local variables:
1744291ca6f5Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
174529459361Smrg# time-stamp-start: "timestamp='"
174629459361Smrg# time-stamp-format: "%:y-%02m-%02d"
174729459361Smrg# time-stamp-end: "'"
174829459361Smrg# End:
1749