195b296d0Smrg#! /bin/sh
295b296d0Smrg# Attempt to guess a canonical system name.
3d87a3195Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
495b296d0Smrg
5d87a3195Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6d87a3195Smrg
7d87a3195Smrgtimestamp='2021-06-03'
895b296d0Smrg
995b296d0Smrg# This file is free software; you can redistribute it and/or modify it
1095b296d0Smrg# under the terms of the GNU General Public License as published by
11eca46af7Smrg# the Free Software Foundation; either version 3 of the License, or
1295b296d0Smrg# (at your option) any later version.
1395b296d0Smrg#
1495b296d0Smrg# This program is distributed in the hope that it will be useful, but
1595b296d0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1695b296d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1795b296d0Smrg# General Public License for more details.
1895b296d0Smrg#
1995b296d0Smrg# You should have received a copy of the GNU General Public License
20d87a3195Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2195b296d0Smrg#
2295b296d0Smrg# As a special exception to the GNU General Public License, if you
2395b296d0Smrg# distribute this file as part of a program that contains a
2495b296d0Smrg# configuration script generated by Autoconf, you may include it under
25eca46af7Smrg# the same distribution terms that you use for the rest of that
26eca46af7Smrg# program.  This Exception is an additional permission under section 7
27eca46af7Smrg# of the GNU General Public License, version 3 ("GPLv3").
2895b296d0Smrg#
2989b0dc75Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3095b296d0Smrg#
3114330f12Smrg# You can get the latest version of this script from:
32d87a3195Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33eca46af7Smrg#
3489b0dc75Smrg# Please send patches to <config-patches@gnu.org>.
35eca46af7Smrg
3695b296d0Smrg
37d87a3195Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38d87a3195Smrg# about features and limitations of the classic Bourne shell that were
39d87a3195Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40d87a3195Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41d87a3195Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42d87a3195Smrg# have a pre-POSIX /bin/sh.
43d87a3195Smrg
44d87a3195Smrg
4595b296d0Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4695b296d0Smrg
4795b296d0Smrgusage="\
4895b296d0SmrgUsage: $0 [OPTION]
4995b296d0Smrg
5095b296d0SmrgOutput the configuration name of the system \`$me' is run on.
5195b296d0Smrg
52d87a3195SmrgOptions:
5395b296d0Smrg  -h, --help         print this help, then exit
5495b296d0Smrg  -t, --time-stamp   print date of last modification, then exit
5595b296d0Smrg  -v, --version      print version number, then exit
5695b296d0Smrg
5795b296d0SmrgReport bugs and patches to <config-patches@gnu.org>."
5895b296d0Smrg
5995b296d0Smrgversion="\
6095b296d0SmrgGNU config.guess ($timestamp)
6195b296d0Smrg
6295b296d0SmrgOriginally written by Per Bothner.
63d87a3195SmrgCopyright 1992-2021 Free Software Foundation, Inc.
6495b296d0Smrg
6595b296d0SmrgThis is free software; see the source for copying conditions.  There is NO
6695b296d0Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6795b296d0Smrg
6895b296d0Smrghelp="
6995b296d0SmrgTry \`$me --help' for more information."
7095b296d0Smrg
7195b296d0Smrg# Parse command line
7295b296d0Smrgwhile test $# -gt 0 ; do
7395b296d0Smrg  case $1 in
7495b296d0Smrg    --time-stamp | --time* | -t )
7595b296d0Smrg       echo "$timestamp" ; exit ;;
7695b296d0Smrg    --version | -v )
7795b296d0Smrg       echo "$version" ; exit ;;
7895b296d0Smrg    --help | --h* | -h )
7995b296d0Smrg       echo "$usage"; exit ;;
8095b296d0Smrg    -- )     # Stop option processing
8195b296d0Smrg       shift; break ;;
8295b296d0Smrg    - )	# Use stdin as input.
8395b296d0Smrg       break ;;
8495b296d0Smrg    -* )
8595b296d0Smrg       echo "$me: invalid option $1$help" >&2
8695b296d0Smrg       exit 1 ;;
8795b296d0Smrg    * )
8895b296d0Smrg       break ;;
8995b296d0Smrg  esac
9095b296d0Smrgdone
9195b296d0Smrg
9295b296d0Smrgif test $# != 0; then
9395b296d0Smrg  echo "$me: too many arguments$help" >&2
9495b296d0Smrg  exit 1
9595b296d0Smrgfi
9695b296d0Smrg
97d87a3195Smrg# Just in case it came from the environment.
98d87a3195SmrgGUESS=
9995b296d0Smrg
10095b296d0Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
10195b296d0Smrg# compiler to aid in system detection is discouraged as it requires
10295b296d0Smrg# temporary files to be created and, as you can see below, it is a
10395b296d0Smrg# headache to deal with in a portable fashion.
10495b296d0Smrg
10595b296d0Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10695b296d0Smrg# use `HOST_CC' if defined, but it is deprecated.
10795b296d0Smrg
10895b296d0Smrg# Portable tmp directory creation inspired by the Autoconf team.
10995b296d0Smrg
110d87a3195Smrgtmp=
111d87a3195Smrg# shellcheck disable=SC2172
112d87a3195Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113d87a3195Smrg
114d87a3195Smrgset_cc_for_build() {
115d87a3195Smrg    # prevent multiple calls if $tmp is already set
116d87a3195Smrg    test "$tmp" && return 0
117d87a3195Smrg    : "${TMPDIR=/tmp}"
118d87a3195Smrg    # shellcheck disable=SC2039,SC3028
119d87a3195Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120d87a3195Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121d87a3195Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122d87a3195Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123d87a3195Smrg    dummy=$tmp/dummy
124d87a3195Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125d87a3195Smrg	,,)    echo "int x;" > "$dummy.c"
126d87a3195Smrg	       for driver in cc gcc c89 c99 ; do
127d87a3195Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128d87a3195Smrg		       CC_FOR_BUILD=$driver
129d87a3195Smrg		       break
130d87a3195Smrg		   fi
131d87a3195Smrg	       done
132d87a3195Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133d87a3195Smrg		   CC_FOR_BUILD=no_compiler_found
134d87a3195Smrg	       fi
135d87a3195Smrg	       ;;
136d87a3195Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137d87a3195Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138d87a3195Smrg    esac
139d87a3195Smrg}
14095b296d0Smrg
14195b296d0Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14295b296d0Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143d87a3195Smrgif test -f /.attbin/uname ; then
14495b296d0Smrg	PATH=$PATH:/.attbin ; export PATH
14595b296d0Smrgfi
14695b296d0Smrg
14795b296d0SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14895b296d0SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149d87a3195SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15095b296d0SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15195b296d0Smrg
152d87a3195Smrgcase $UNAME_SYSTEM in
153eca46af7SmrgLinux|GNU|GNU/*)
154d87a3195Smrg	LIBC=unknown
155eca46af7Smrg
156d87a3195Smrg	set_cc_for_build
157d87a3195Smrg	cat <<-EOF > "$dummy.c"
158eca46af7Smrg	#include <features.h>
159eca46af7Smrg	#if defined(__UCLIBC__)
160eca46af7Smrg	LIBC=uclibc
161eca46af7Smrg	#elif defined(__dietlibc__)
162eca46af7Smrg	LIBC=dietlibc
163d87a3195Smrg	#elif defined(__GLIBC__)
164eca46af7Smrg	LIBC=gnu
165d87a3195Smrg	#else
166d87a3195Smrg	#include <stdarg.h>
167d87a3195Smrg	/* First heuristic to detect musl libc.  */
168d87a3195Smrg	#ifdef __DEFINED_va_list
169d87a3195Smrg	LIBC=musl
170d87a3195Smrg	#endif
171eca46af7Smrg	#endif
172eca46af7Smrg	EOF
173d87a3195Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174d87a3195Smrg	eval "$cc_set_libc"
175d87a3195Smrg
176d87a3195Smrg	# Second heuristic to detect musl libc.
177d87a3195Smrg	if [ "$LIBC" = unknown ] &&
178d87a3195Smrg	   command -v ldd >/dev/null &&
179d87a3195Smrg	   ldd --version 2>&1 | grep -q ^musl; then
180d87a3195Smrg		LIBC=musl
181d87a3195Smrg	fi
182d87a3195Smrg
183d87a3195Smrg	# If the system lacks a compiler, then just pick glibc.
184d87a3195Smrg	# We could probably try harder.
185d87a3195Smrg	if [ "$LIBC" = unknown ]; then
186d87a3195Smrg		LIBC=gnu
187d87a3195Smrg	fi
188eca46af7Smrg	;;
189eca46af7Smrgesac
190eca46af7Smrg
19195b296d0Smrg# Note: order is significant - the case branches are not exclusive.
19295b296d0Smrg
193d87a3195Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19495b296d0Smrg    *:NetBSD:*:*)
19595b296d0Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196eca46af7Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19795b296d0Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19895b296d0Smrg	# switched to ELF, *-*-netbsd* would select the old
19995b296d0Smrg	# object file format.  This provides both forward
20095b296d0Smrg	# compatibility and a consistent mechanism for selecting the
20195b296d0Smrg	# object file format.
20295b296d0Smrg	#
20395b296d0Smrg	# Note: NetBSD doesn't particularly care about the vendor
20495b296d0Smrg	# portion of the name.  We always set it to "unknown".
20589b0dc75Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206d87a3195Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207d87a3195Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20889b0dc75Smrg	    echo unknown)`
209d87a3195Smrg	case $UNAME_MACHINE_ARCH in
210d87a3195Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
21195b296d0Smrg	    armeb) machine=armeb-unknown ;;
21295b296d0Smrg	    arm*) machine=arm-unknown ;;
21395b296d0Smrg	    sh3el) machine=shl-unknown ;;
21495b296d0Smrg	    sh3eb) machine=sh-unknown ;;
215ff89ac2bSmrg	    sh5el) machine=sh5le-unknown ;;
21689b0dc75Smrg	    earmv*)
217d87a3195Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218d87a3195Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
21989b0dc75Smrg		machine=${arch}${endian}-unknown
22089b0dc75Smrg		;;
221d87a3195Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22295b296d0Smrg	esac
22395b296d0Smrg	# The Operating System including object format, if it has switched
224d87a3195Smrg	# to ELF recently (or will in the future) and ABI.
225d87a3195Smrg	case $UNAME_MACHINE_ARCH in
226d87a3195Smrg	    earm*)
227d87a3195Smrg		os=netbsdelf
228d87a3195Smrg		;;
229d87a3195Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230d87a3195Smrg		set_cc_for_build
23195b296d0Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
23214330f12Smrg			| grep -q __ELF__
23395b296d0Smrg		then
23495b296d0Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23595b296d0Smrg		    # Return netbsd for either.  FIX?
23695b296d0Smrg		    os=netbsd
23795b296d0Smrg		else
23895b296d0Smrg		    os=netbsdelf
23995b296d0Smrg		fi
24095b296d0Smrg		;;
24195b296d0Smrg	    *)
242eca46af7Smrg		os=netbsd
24395b296d0Smrg		;;
24495b296d0Smrg	esac
24589b0dc75Smrg	# Determine ABI tags.
246d87a3195Smrg	case $UNAME_MACHINE_ARCH in
24789b0dc75Smrg	    earm*)
24889b0dc75Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249d87a3195Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
25089b0dc75Smrg		;;
25189b0dc75Smrg	esac
25295b296d0Smrg	# The OS release
25395b296d0Smrg	# Debian GNU/NetBSD machines have a different userland, and
25495b296d0Smrg	# thus, need a distinct triplet. However, they do not need
25595b296d0Smrg	# kernel version information, so it can be replaced with a
25695b296d0Smrg	# suitable tag, in the style of linux-gnu.
257d87a3195Smrg	case $UNAME_VERSION in
25895b296d0Smrg	    Debian*)
25995b296d0Smrg		release='-gnu'
26095b296d0Smrg		;;
26195b296d0Smrg	    *)
262d87a3195Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
26395b296d0Smrg		;;
26495b296d0Smrg	esac
26595b296d0Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26695b296d0Smrg	# contains redundant information, the shorter form:
26795b296d0Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268d87a3195Smrg	GUESS=$machine-${os}${release}${abi-}
269d87a3195Smrg	;;
270eca46af7Smrg    *:Bitrig:*:*)
271eca46af7Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272d87a3195Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273d87a3195Smrg	;;
27495b296d0Smrg    *:OpenBSD:*:*)
27595b296d0Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276d87a3195Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277d87a3195Smrg	;;
278d87a3195Smrg    *:SecBSD:*:*)
279d87a3195Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280d87a3195Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281d87a3195Smrg	;;
28289b0dc75Smrg    *:LibertyBSD:*:*)
28389b0dc75Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284d87a3195Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285d87a3195Smrg	;;
286d87a3195Smrg    *:MidnightBSD:*:*)
287d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288d87a3195Smrg	;;
28995b296d0Smrg    *:ekkoBSD:*:*)
290d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291d87a3195Smrg	;;
29295b296d0Smrg    *:SolidBSD:*:*)
293d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294d87a3195Smrg	;;
295d87a3195Smrg    *:OS108:*:*)
296d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297d87a3195Smrg	;;
29895b296d0Smrg    macppc:MirBSD:*:*)
299d87a3195Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300d87a3195Smrg	;;
30195b296d0Smrg    *:MirBSD:*:*)
302d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303d87a3195Smrg	;;
30489b0dc75Smrg    *:Sortix:*:*)
305d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
306d87a3195Smrg	;;
307d87a3195Smrg    *:Twizzler:*:*)
308d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309d87a3195Smrg	;;
310d87a3195Smrg    *:Redox:*:*)
311d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-redox
312d87a3195Smrg	;;
313d87a3195Smrg    mips:OSF1:*.*)
314d87a3195Smrg	GUESS=mips-dec-osf1
315d87a3195Smrg	;;
31695b296d0Smrg    alpha:OSF1:*:*)
317d87a3195Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318d87a3195Smrg	trap '' 0
31995b296d0Smrg	case $UNAME_RELEASE in
32095b296d0Smrg	*4.0)
32195b296d0Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32295b296d0Smrg		;;
32395b296d0Smrg	*5.*)
324eca46af7Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
32595b296d0Smrg		;;
32695b296d0Smrg	esac
32795b296d0Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
32895b296d0Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
32995b296d0Smrg	# covers most systems running today.  This code pipes the CPU
33095b296d0Smrg	# types through head -n 1, so we only detect the type of CPU 0.
33195b296d0Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332d87a3195Smrg	case $ALPHA_CPU_TYPE in
33395b296d0Smrg	    "EV4 (21064)")
33489b0dc75Smrg		UNAME_MACHINE=alpha ;;
33595b296d0Smrg	    "EV4.5 (21064)")
33689b0dc75Smrg		UNAME_MACHINE=alpha ;;
33795b296d0Smrg	    "LCA4 (21066/21068)")
33889b0dc75Smrg		UNAME_MACHINE=alpha ;;
33995b296d0Smrg	    "EV5 (21164)")
34089b0dc75Smrg		UNAME_MACHINE=alphaev5 ;;
34195b296d0Smrg	    "EV5.6 (21164A)")
34289b0dc75Smrg		UNAME_MACHINE=alphaev56 ;;
34395b296d0Smrg	    "EV5.6 (21164PC)")
34489b0dc75Smrg		UNAME_MACHINE=alphapca56 ;;
34595b296d0Smrg	    "EV5.7 (21164PC)")
34689b0dc75Smrg		UNAME_MACHINE=alphapca57 ;;
34795b296d0Smrg	    "EV6 (21264)")
34889b0dc75Smrg		UNAME_MACHINE=alphaev6 ;;
34995b296d0Smrg	    "EV6.7 (21264A)")
35089b0dc75Smrg		UNAME_MACHINE=alphaev67 ;;
35195b296d0Smrg	    "EV6.8CB (21264C)")
35289b0dc75Smrg		UNAME_MACHINE=alphaev68 ;;
35395b296d0Smrg	    "EV6.8AL (21264B)")
35489b0dc75Smrg		UNAME_MACHINE=alphaev68 ;;
35595b296d0Smrg	    "EV6.8CX (21264D)")
35689b0dc75Smrg		UNAME_MACHINE=alphaev68 ;;
35795b296d0Smrg	    "EV6.9A (21264/EV69A)")
35889b0dc75Smrg		UNAME_MACHINE=alphaev69 ;;
35995b296d0Smrg	    "EV7 (21364)")
36089b0dc75Smrg		UNAME_MACHINE=alphaev7 ;;
36195b296d0Smrg	    "EV7.9 (21364A)")
36289b0dc75Smrg		UNAME_MACHINE=alphaev79 ;;
36395b296d0Smrg	esac
36495b296d0Smrg	# A Pn.n version is a patched version.
36595b296d0Smrg	# A Vn.n version is a released version.
36695b296d0Smrg	# A Tn.n version is a released field test version.
36795b296d0Smrg	# A Xn.n version is an unreleased experimental baselevel.
36895b296d0Smrg	# 1.2 uses "1.2" for uname -r.
369d87a3195Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370d87a3195Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371d87a3195Smrg	;;
37295b296d0Smrg    Amiga*:UNIX_System_V:4.0:*)
373d87a3195Smrg	GUESS=m68k-unknown-sysv4
374d87a3195Smrg	;;
37595b296d0Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377d87a3195Smrg	;;
37895b296d0Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
380d87a3195Smrg	;;
38195b296d0Smrg    *:OS/390:*:*)
382d87a3195Smrg	GUESS=i370-ibm-openedition
383d87a3195Smrg	;;
38495b296d0Smrg    *:z/VM:*:*)
385d87a3195Smrg	GUESS=s390-ibm-zvmoe
386d87a3195Smrg	;;
38795b296d0Smrg    *:OS400:*:*)
388d87a3195Smrg	GUESS=powerpc-ibm-os400
389d87a3195Smrg	;;
39095b296d0Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391d87a3195Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392d87a3195Smrg	;;
393eca46af7Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394d87a3195Smrg	GUESS=arm-unknown-riscos
395d87a3195Smrg	;;
39695b296d0Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397d87a3195Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
398d87a3195Smrg	;;
39995b296d0Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40095b296d0Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401d87a3195Smrg	case `(/bin/universe) 2>/dev/null` in
402d87a3195Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403d87a3195Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404d87a3195Smrg	esac
405d87a3195Smrg	;;
40695b296d0Smrg    NILE*:*:*:dcosx)
407d87a3195Smrg	GUESS=pyramid-pyramid-svr4
408d87a3195Smrg	;;
40995b296d0Smrg    DRS?6000:unix:4.0:6*)
410d87a3195Smrg	GUESS=sparc-icl-nx6
411d87a3195Smrg	;;
41295b296d0Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
41395b296d0Smrg	case `/usr/bin/uname -p` in
414d87a3195Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
415d87a3195Smrg	esac
416d87a3195Smrg	;;
41714330f12Smrg    s390x:SunOS:*:*)
418d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419d87a3195Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420d87a3195Smrg	;;
42195b296d0Smrg    sun4H:SunOS:5.*:*)
422d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423d87a3195Smrg	GUESS=sparc-hal-solaris2$SUN_REL
424d87a3195Smrg	;;
42595b296d0Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427d87a3195Smrg	GUESS=sparc-sun-solaris2$SUN_REL
428d87a3195Smrg	;;
42914330f12Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430d87a3195Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431d87a3195Smrg	;;
432ff89ac2bSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433d87a3195Smrg	set_cc_for_build
43489b0dc75Smrg	SUN_ARCH=i386
43514330f12Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
43614330f12Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
43714330f12Smrg	# This test works for both compilers.
438d87a3195Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
43914330f12Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
44089b0dc75Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
44114330f12Smrg		grep IS_64BIT_ARCH >/dev/null
44214330f12Smrg	    then
44389b0dc75Smrg		SUN_ARCH=x86_64
44414330f12Smrg	    fi
44514330f12Smrg	fi
446d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447d87a3195Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448d87a3195Smrg	;;
44995b296d0Smrg    sun4*:SunOS:6*:*)
45095b296d0Smrg	# According to config.sub, this is the proper way to canonicalize
45195b296d0Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45295b296d0Smrg	# it's likely to be more like Solaris than SunOS4.
453d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454d87a3195Smrg	GUESS=sparc-sun-solaris3$SUN_REL
455d87a3195Smrg	;;
45695b296d0Smrg    sun4*:SunOS:*:*)
457d87a3195Smrg	case `/usr/bin/arch -k` in
45895b296d0Smrg	    Series*|S4*)
45995b296d0Smrg		UNAME_RELEASE=`uname -v`
46095b296d0Smrg		;;
46195b296d0Smrg	esac
46295b296d0Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464d87a3195Smrg	GUESS=sparc-sun-sunos$SUN_REL
465d87a3195Smrg	;;
46695b296d0Smrg    sun3*:SunOS:*:*)
467d87a3195Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468d87a3195Smrg	;;
46995b296d0Smrg    sun*:*:4.2BSD:*)
47095b296d0Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471d87a3195Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472d87a3195Smrg	case `/bin/arch` in
47395b296d0Smrg	    sun3)
474d87a3195Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
47595b296d0Smrg		;;
47695b296d0Smrg	    sun4)
477d87a3195Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
47895b296d0Smrg		;;
47995b296d0Smrg	esac
480d87a3195Smrg	;;
48195b296d0Smrg    aushp:SunOS:*:*)
482d87a3195Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483d87a3195Smrg	;;
48495b296d0Smrg    # The situation for MiNT is a little confusing.  The machine name
48595b296d0Smrg    # can be virtually everything (everything which is not
48695b296d0Smrg    # "atarist" or "atariste" at least should have a processor
48795b296d0Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48895b296d0Smrg    # to the lowercase version "mint" (or "freemint").  Finally
48995b296d0Smrg    # the system name "TOS" denotes a system which is actually not
49095b296d0Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
49195b296d0Smrg    # be no problem.
49295b296d0Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493d87a3195Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494d87a3195Smrg	;;
49595b296d0Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496d87a3195Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497d87a3195Smrg	;;
49895b296d0Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499d87a3195Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500d87a3195Smrg	;;
50195b296d0Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502d87a3195Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503d87a3195Smrg	;;
50495b296d0Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505d87a3195Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506d87a3195Smrg	;;
50795b296d0Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508d87a3195Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509d87a3195Smrg	;;
51095b296d0Smrg    m68k:machten:*:*)
511d87a3195Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512d87a3195Smrg	;;
51395b296d0Smrg    powerpc:machten:*:*)
514d87a3195Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515d87a3195Smrg	;;
51695b296d0Smrg    RISC*:Mach:*:*)
517d87a3195Smrg	GUESS=mips-dec-mach_bsd4.3
518d87a3195Smrg	;;
51995b296d0Smrg    RISC*:ULTRIX:*:*)
520d87a3195Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521d87a3195Smrg	;;
52295b296d0Smrg    VAX*:ULTRIX*:*:*)
523d87a3195Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524d87a3195Smrg	;;
52595b296d0Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526d87a3195Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527d87a3195Smrg	;;
52895b296d0Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529d87a3195Smrg	set_cc_for_build
530d87a3195Smrg	sed 's/^	//' << EOF > "$dummy.c"
53195b296d0Smrg#ifdef __cplusplus
53295b296d0Smrg#include <stdio.h>  /* for printf() prototype */
53395b296d0Smrg	int main (int argc, char *argv[]) {
53495b296d0Smrg#else
53595b296d0Smrg	int main (argc, argv) int argc; char *argv[]; {
53695b296d0Smrg#endif
53795b296d0Smrg	#if defined (host_mips) && defined (MIPSEB)
53895b296d0Smrg	#if defined (SYSTYPE_SYSV)
539d87a3195Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54095b296d0Smrg	#endif
54195b296d0Smrg	#if defined (SYSTYPE_SVR4)
542d87a3195Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54395b296d0Smrg	#endif
54495b296d0Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545d87a3195Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54695b296d0Smrg	#endif
54795b296d0Smrg	#endif
54895b296d0Smrg	  exit (-1);
54995b296d0Smrg	}
55095b296d0SmrgEOF
551d87a3195Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552d87a3195Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553d87a3195Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55495b296d0Smrg	    { echo "$SYSTEM_NAME"; exit; }
555d87a3195Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556d87a3195Smrg	;;
55795b296d0Smrg    Motorola:PowerMAX_OS:*:*)
558d87a3195Smrg	GUESS=powerpc-motorola-powermax
559d87a3195Smrg	;;
56095b296d0Smrg    Motorola:*:4.3:PL8-*)
561d87a3195Smrg	GUESS=powerpc-harris-powermax
562d87a3195Smrg	;;
56395b296d0Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564d87a3195Smrg	GUESS=powerpc-harris-powermax
565d87a3195Smrg	;;
56695b296d0Smrg    Night_Hawk:Power_UNIX:*:*)
567d87a3195Smrg	GUESS=powerpc-harris-powerunix
568d87a3195Smrg	;;
56995b296d0Smrg    m88k:CX/UX:7*:*)
570d87a3195Smrg	GUESS=m88k-harris-cxux7
571d87a3195Smrg	;;
57295b296d0Smrg    m88k:*:4*:R4*)
573d87a3195Smrg	GUESS=m88k-motorola-sysv4
574d87a3195Smrg	;;
57595b296d0Smrg    m88k:*:3*:R3*)
576d87a3195Smrg	GUESS=m88k-motorola-sysv3
577d87a3195Smrg	;;
57895b296d0Smrg    AViiON:dgux:*:*)
579eca46af7Smrg	# DG/UX returns AViiON for all architectures
580eca46af7Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581d87a3195Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58295b296d0Smrg	then
583d87a3195Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584d87a3195Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
58595b296d0Smrg	    then
586d87a3195Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
58795b296d0Smrg	    else
588d87a3195Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58995b296d0Smrg	    fi
59095b296d0Smrg	else
591d87a3195Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
59295b296d0Smrg	fi
593d87a3195Smrg	;;
59495b296d0Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595d87a3195Smrg	GUESS=m88k-dolphin-sysv3
596d87a3195Smrg	;;
59795b296d0Smrg    M88*:*:R3*:*)
59895b296d0Smrg	# Delta 88k system running SVR3
599d87a3195Smrg	GUESS=m88k-motorola-sysv3
600d87a3195Smrg	;;
60195b296d0Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602d87a3195Smrg	GUESS=m88k-tektronix-sysv3
603d87a3195Smrg	;;
60495b296d0Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605d87a3195Smrg	GUESS=m68k-tektronix-bsd
606d87a3195Smrg	;;
60795b296d0Smrg    *:IRIX*:*:*)
608d87a3195Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609d87a3195Smrg	GUESS=mips-sgi-irix$IRIX_REL
610d87a3195Smrg	;;
61195b296d0Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612d87a3195Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613d87a3195Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61495b296d0Smrg    i*86:AIX:*:*)
615d87a3195Smrg	GUESS=i386-ibm-aix
616d87a3195Smrg	;;
61795b296d0Smrg    ia64:AIX:*:*)
618d87a3195Smrg	if test -x /usr/bin/oslevel ; then
61995b296d0Smrg		IBM_REV=`/usr/bin/oslevel`
62095b296d0Smrg	else
621d87a3195Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62295b296d0Smrg	fi
623d87a3195Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624d87a3195Smrg	;;
62595b296d0Smrg    *:AIX:2:3)
62695b296d0Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627d87a3195Smrg		set_cc_for_build
628d87a3195Smrg		sed 's/^		//' << EOF > "$dummy.c"
62995b296d0Smrg		#include <sys/systemcfg.h>
63095b296d0Smrg
63195b296d0Smrg		main()
63295b296d0Smrg			{
63395b296d0Smrg			if (!__power_pc())
63495b296d0Smrg				exit(1);
63595b296d0Smrg			puts("powerpc-ibm-aix3.2.5");
63695b296d0Smrg			exit(0);
63795b296d0Smrg			}
63895b296d0SmrgEOF
639d87a3195Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64095b296d0Smrg		then
641d87a3195Smrg			GUESS=$SYSTEM_NAME
64295b296d0Smrg		else
643d87a3195Smrg			GUESS=rs6000-ibm-aix3.2.5
64495b296d0Smrg		fi
64595b296d0Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646d87a3195Smrg		GUESS=rs6000-ibm-aix3.2.4
64795b296d0Smrg	else
648d87a3195Smrg		GUESS=rs6000-ibm-aix3.2
64995b296d0Smrg	fi
650d87a3195Smrg	;;
65114330f12Smrg    *:AIX:*:[4567])
65295b296d0Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653d87a3195Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65495b296d0Smrg		IBM_ARCH=rs6000
65595b296d0Smrg	else
65695b296d0Smrg		IBM_ARCH=powerpc
65795b296d0Smrg	fi
658d87a3195Smrg	if test -x /usr/bin/lslpp ; then
659d87a3195Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
66089b0dc75Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66195b296d0Smrg	else
662d87a3195Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66395b296d0Smrg	fi
664d87a3195Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665d87a3195Smrg	;;
66695b296d0Smrg    *:AIX:*:*)
667d87a3195Smrg	GUESS=rs6000-ibm-aix
668d87a3195Smrg	;;
669d87a3195Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670d87a3195Smrg	GUESS=romp-ibm-bsd4.4
671d87a3195Smrg	;;
67295b296d0Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673d87a3195Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674d87a3195Smrg	;;                                  # report: romp-ibm BSD 4.3
67595b296d0Smrg    *:BOSX:*:*)
676d87a3195Smrg	GUESS=rs6000-bull-bosx
677d87a3195Smrg	;;
67895b296d0Smrg    DPX/2?00:B.O.S.:*:*)
679d87a3195Smrg	GUESS=m68k-bull-sysv3
680d87a3195Smrg	;;
68195b296d0Smrg    9000/[34]??:4.3bsd:1.*:*)
682d87a3195Smrg	GUESS=m68k-hp-bsd
683d87a3195Smrg	;;
68495b296d0Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685d87a3195Smrg	GUESS=m68k-hp-bsd4.4
686d87a3195Smrg	;;
68795b296d0Smrg    9000/[34678]??:HP-UX:*:*)
688d87a3195Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689d87a3195Smrg	case $UNAME_MACHINE in
690d87a3195Smrg	    9000/31?)            HP_ARCH=m68000 ;;
691d87a3195Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
69295b296d0Smrg	    9000/[678][0-9][0-9])
693d87a3195Smrg		if test -x /usr/bin/getconf; then
69495b296d0Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695eca46af7Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696d87a3195Smrg		    case $sc_cpu_version in
69789b0dc75Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
69889b0dc75Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699eca46af7Smrg		      532)                      # CPU_PA_RISC2_0
700d87a3195Smrg			case $sc_kernel_bits in
70189b0dc75Smrg			  32) HP_ARCH=hppa2.0n ;;
70289b0dc75Smrg			  64) HP_ARCH=hppa2.0w ;;
70389b0dc75Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704eca46af7Smrg			esac ;;
705eca46af7Smrg		    esac
70695b296d0Smrg		fi
707d87a3195Smrg		if test "$HP_ARCH" = ""; then
708d87a3195Smrg		    set_cc_for_build
709d87a3195Smrg		    sed 's/^		//' << EOF > "$dummy.c"
71095b296d0Smrg
711eca46af7Smrg		#define _HPUX_SOURCE
712eca46af7Smrg		#include <stdlib.h>
713eca46af7Smrg		#include <unistd.h>
71495b296d0Smrg
715eca46af7Smrg		int main ()
716eca46af7Smrg		{
717eca46af7Smrg		#if defined(_SC_KERNEL_BITS)
718eca46af7Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
719eca46af7Smrg		#endif
720eca46af7Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
72195b296d0Smrg
722eca46af7Smrg		    switch (cpu)
723eca46af7Smrg			{
724eca46af7Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725eca46af7Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726eca46af7Smrg			case CPU_PA_RISC2_0:
727eca46af7Smrg		#if defined(_SC_KERNEL_BITS)
728eca46af7Smrg			    switch (bits)
729eca46af7Smrg				{
730eca46af7Smrg				case 64: puts ("hppa2.0w"); break;
731eca46af7Smrg				case 32: puts ("hppa2.0n"); break;
732eca46af7Smrg				default: puts ("hppa2.0"); break;
733eca46af7Smrg				} break;
734eca46af7Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
735eca46af7Smrg			    puts ("hppa2.0"); break;
736eca46af7Smrg		#endif
737eca46af7Smrg			default: puts ("hppa1.0"); break;
738eca46af7Smrg			}
739eca46af7Smrg		    exit (0);
740eca46af7Smrg		}
74195b296d0SmrgEOF
742d87a3195Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
74395b296d0Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
74495b296d0Smrg		fi ;;
74595b296d0Smrg	esac
746d87a3195Smrg	if test "$HP_ARCH" = hppa2.0w
74795b296d0Smrg	then
748d87a3195Smrg	    set_cc_for_build
74995b296d0Smrg
75095b296d0Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75195b296d0Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75295b296d0Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
75395b296d0Smrg	    #
75495b296d0Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
75595b296d0Smrg	    # => hppa2.0w-hp-hpux11.23
75695b296d0Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75795b296d0Smrg	    # => hppa64-hp-hpux11.23
75895b296d0Smrg
75989b0dc75Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
76014330f12Smrg		grep -q __LP64__
76195b296d0Smrg	    then
76289b0dc75Smrg		HP_ARCH=hppa2.0w
76395b296d0Smrg	    else
76489b0dc75Smrg		HP_ARCH=hppa64
76595b296d0Smrg	    fi
76695b296d0Smrg	fi
767d87a3195Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768d87a3195Smrg	;;
76995b296d0Smrg    ia64:HP-UX:*:*)
770d87a3195Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771d87a3195Smrg	GUESS=ia64-hp-hpux$HPUX_REV
772d87a3195Smrg	;;
77395b296d0Smrg    3050*:HI-UX:*:*)
774d87a3195Smrg	set_cc_for_build
775d87a3195Smrg	sed 's/^	//' << EOF > "$dummy.c"
77695b296d0Smrg	#include <unistd.h>
77795b296d0Smrg	int
77895b296d0Smrg	main ()
77995b296d0Smrg	{
78095b296d0Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
78195b296d0Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78295b296d0Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78395b296d0Smrg	     results, however.  */
78495b296d0Smrg	  if (CPU_IS_PA_RISC (cpu))
78595b296d0Smrg	    {
78695b296d0Smrg	      switch (cpu)
78795b296d0Smrg		{
78895b296d0Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78995b296d0Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79095b296d0Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79195b296d0Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79295b296d0Smrg		}
79395b296d0Smrg	    }
79495b296d0Smrg	  else if (CPU_IS_HP_MC68K (cpu))
79595b296d0Smrg	    puts ("m68k-hitachi-hiuxwe2");
79695b296d0Smrg	  else puts ("unknown-hitachi-hiuxwe2");
79795b296d0Smrg	  exit (0);
79895b296d0Smrg	}
79995b296d0SmrgEOF
800d87a3195Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80195b296d0Smrg		{ echo "$SYSTEM_NAME"; exit; }
802d87a3195Smrg	GUESS=unknown-hitachi-hiuxwe2
803d87a3195Smrg	;;
804d87a3195Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805d87a3195Smrg	GUESS=hppa1.1-hp-bsd
806d87a3195Smrg	;;
80795b296d0Smrg    9000/8??:4.3bsd:*:*)
808d87a3195Smrg	GUESS=hppa1.0-hp-bsd
809d87a3195Smrg	;;
81095b296d0Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811d87a3195Smrg	GUESS=hppa1.0-hp-mpeix
812d87a3195Smrg	;;
813d87a3195Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814d87a3195Smrg	GUESS=hppa1.1-hp-osf
815d87a3195Smrg	;;
81695b296d0Smrg    hp8??:OSF1:*:*)
817d87a3195Smrg	GUESS=hppa1.0-hp-osf
818d87a3195Smrg	;;
81995b296d0Smrg    i*86:OSF1:*:*)
820d87a3195Smrg	if test -x /usr/sbin/sysversion ; then
821d87a3195Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82295b296d0Smrg	else
823d87a3195Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
82495b296d0Smrg	fi
825d87a3195Smrg	;;
82695b296d0Smrg    parisc*:Lites*:*:*)
827d87a3195Smrg	GUESS=hppa1.1-hp-lites
828d87a3195Smrg	;;
82995b296d0Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830d87a3195Smrg	GUESS=c1-convex-bsd
831d87a3195Smrg	;;
83295b296d0Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83395b296d0Smrg	if getsysinfo -f scalar_acc
83495b296d0Smrg	then echo c32-convex-bsd
83595b296d0Smrg	else echo c2-convex-bsd
83695b296d0Smrg	fi
837eca46af7Smrg	exit ;;
83895b296d0Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839d87a3195Smrg	GUESS=c34-convex-bsd
840d87a3195Smrg	;;
84195b296d0Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842d87a3195Smrg	GUESS=c38-convex-bsd
843d87a3195Smrg	;;
84495b296d0Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845d87a3195Smrg	GUESS=c4-convex-bsd
846d87a3195Smrg	;;
84795b296d0Smrg    CRAY*Y-MP:*:*:*)
848d87a3195Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849d87a3195Smrg	GUESS=ymp-cray-unicos$CRAY_REL
850d87a3195Smrg	;;
85195b296d0Smrg    CRAY*[A-Z]90:*:*:*)
852d87a3195Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85395b296d0Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85495b296d0Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85595b296d0Smrg	      -e 's/\.[^.]*$/.X/'
85695b296d0Smrg	exit ;;
85795b296d0Smrg    CRAY*TS:*:*:*)
858d87a3195Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859d87a3195Smrg	GUESS=t90-cray-unicos$CRAY_REL
860d87a3195Smrg	;;
86195b296d0Smrg    CRAY*T3E:*:*:*)
862d87a3195Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863d87a3195Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864d87a3195Smrg	;;
86595b296d0Smrg    CRAY*SV1:*:*:*)
866d87a3195Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867d87a3195Smrg	GUESS=sv1-cray-unicos$CRAY_REL
868d87a3195Smrg	;;
86995b296d0Smrg    *:UNICOS/mp:*:*)
870d87a3195Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871d87a3195Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872d87a3195Smrg	;;
87395b296d0Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
87489b0dc75Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
87589b0dc75Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876d87a3195Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877d87a3195Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878d87a3195Smrg	;;
87995b296d0Smrg    5000:UNIX_System_V:4.*:*)
88089b0dc75Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881d87a3195Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882d87a3195Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883d87a3195Smrg	;;
88495b296d0Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886d87a3195Smrg	;;
88795b296d0Smrg    sparc*:BSD/OS:*:*)
888d87a3195Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889d87a3195Smrg	;;
89095b296d0Smrg    *:BSD/OS:*:*)
891d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892d87a3195Smrg	;;
893d87a3195Smrg    arm:FreeBSD:*:*)
894d87a3195Smrg	UNAME_PROCESSOR=`uname -p`
895d87a3195Smrg	set_cc_for_build
896d87a3195Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897d87a3195Smrg	    | grep -q __ARM_PCS_VFP
898d87a3195Smrg	then
899d87a3195Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900d87a3195Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901d87a3195Smrg	else
902d87a3195Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903d87a3195Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904d87a3195Smrg	fi
905d87a3195Smrg	;;
90695b296d0Smrg    *:FreeBSD:*:*)
907eca46af7Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908d87a3195Smrg	case $UNAME_PROCESSOR in
90995b296d0Smrg	    amd64)
910d87a3195Smrg		UNAME_PROCESSOR=x86_64 ;;
911d87a3195Smrg	    i386)
912d87a3195Smrg		UNAME_PROCESSOR=i586 ;;
91395b296d0Smrg	esac
914d87a3195Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915d87a3195Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916d87a3195Smrg	;;
91795b296d0Smrg    i*:CYGWIN*:*)
918d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
919d87a3195Smrg	;;
920eca46af7Smrg    *:MINGW64*:*)
921d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
922d87a3195Smrg	;;
923ff89ac2bSmrg    *:MINGW*:*)
924d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
925d87a3195Smrg	;;
926eca46af7Smrg    *:MSYS*:*)
927d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-msys
928d87a3195Smrg	;;
92995b296d0Smrg    i*:PW*:*)
930d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-pw32
931d87a3195Smrg	;;
93214330f12Smrg    *:Interix*:*)
933d87a3195Smrg	case $UNAME_MACHINE in
934ff89ac2bSmrg	    x86)
935d87a3195Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
936d87a3195Smrg		;;
93714330f12Smrg	    authenticamd | genuineintel | EM64T)
938d87a3195Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
939d87a3195Smrg		;;
940ff89ac2bSmrg	    IA64)
941d87a3195Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
942d87a3195Smrg		;;
943ff89ac2bSmrg	esac ;;
94495b296d0Smrg    i*:UWIN*:*)
945d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-uwin
946d87a3195Smrg	;;
94795b296d0Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948d87a3195Smrg	GUESS=x86_64-pc-cygwin
949d87a3195Smrg	;;
95095b296d0Smrg    prep*:SunOS:5.*:*)
951d87a3195Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952d87a3195Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
953d87a3195Smrg	;;
95495b296d0Smrg    *:GNU:*:*)
95595b296d0Smrg	# the GNU system
956d87a3195Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957d87a3195Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958d87a3195Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959d87a3195Smrg	;;
96095b296d0Smrg    *:GNU/*:*:*)
96195b296d0Smrg	# other systems with GNU libc and userland
962d87a3195Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963d87a3195Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965d87a3195Smrg	;;
966d87a3195Smrg    *:Minix:*:*)
967d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-minix
968d87a3195Smrg	;;
969eca46af7Smrg    aarch64:Linux:*:*)
970d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971d87a3195Smrg	;;
972eca46af7Smrg    aarch64_be:Linux:*:*)
973eca46af7Smrg	UNAME_MACHINE=aarch64_be
974d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975d87a3195Smrg	;;
97614330f12Smrg    alpha:Linux:*:*)
977d87a3195Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
97814330f12Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
97914330f12Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
98014330f12Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
98114330f12Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
98214330f12Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
98314330f12Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
98414330f12Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
985eca46af7Smrg	esac
98614330f12Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
98789b0dc75Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989d87a3195Smrg	;;
990d87a3195Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992d87a3195Smrg	;;
99395b296d0Smrg    arm*:Linux:*:*)
994d87a3195Smrg	set_cc_for_build
995ff89ac2bSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996ff89ac2bSmrg	    | grep -q __ARM_EABI__
997ff89ac2bSmrg	then
998d87a3195Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999ff89ac2bSmrg	else
1000eca46af7Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001eca46af7Smrg		| grep -q __ARM_PCS_VFP
1002eca46af7Smrg	    then
1003d87a3195Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004eca46af7Smrg	    else
1005d87a3195Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006eca46af7Smrg	    fi
1007ff89ac2bSmrg	fi
1008d87a3195Smrg	;;
100995b296d0Smrg    avr32*:Linux:*:*)
1010d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011d87a3195Smrg	;;
101295b296d0Smrg    cris:Linux:*:*)
1013d87a3195Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014d87a3195Smrg	;;
101595b296d0Smrg    crisv32:Linux:*:*)
1016d87a3195Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017d87a3195Smrg	;;
101889b0dc75Smrg    e2k:Linux:*:*)
1019d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020d87a3195Smrg	;;
102195b296d0Smrg    frv:Linux:*:*)
1022d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023d87a3195Smrg	;;
1024eca46af7Smrg    hexagon:Linux:*:*)
1025d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026d87a3195Smrg	;;
102714330f12Smrg    i*86:Linux:*:*)
1028d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029d87a3195Smrg	;;
103095b296d0Smrg    ia64:Linux:*:*)
1031d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032d87a3195Smrg	;;
103389b0dc75Smrg    k1om:Linux:*:*)
1034d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035d87a3195Smrg	;;
1036d87a3195Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038d87a3195Smrg	;;
103995b296d0Smrg    m32r*:Linux:*:*)
1040d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041d87a3195Smrg	;;
104295b296d0Smrg    m68*:Linux:*:*)
1043d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044d87a3195Smrg	;;
104514330f12Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1046d87a3195Smrg	set_cc_for_build
1047d87a3195Smrg	IS_GLIBC=0
1048d87a3195Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049d87a3195Smrg	sed 's/^	//' << EOF > "$dummy.c"
105095b296d0Smrg	#undef CPU
1051d87a3195Smrg	#undef mips
1052d87a3195Smrg	#undef mipsel
1053d87a3195Smrg	#undef mips64
1054d87a3195Smrg	#undef mips64el
1055d87a3195Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1056d87a3195Smrg	LIBCABI=gnuabi64
1057d87a3195Smrg	#else
1058d87a3195Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1059d87a3195Smrg	LIBCABI=gnuabin32
1060d87a3195Smrg	#else
1061d87a3195Smrg	LIBCABI=${LIBC}
1062d87a3195Smrg	#endif
1063d87a3195Smrg	#endif
1064d87a3195Smrg
1065d87a3195Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1066d87a3195Smrg	CPU=mipsisa64r6
1067d87a3195Smrg	#else
1068d87a3195Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069d87a3195Smrg	CPU=mipsisa32r6
1070d87a3195Smrg	#else
1071d87a3195Smrg	#if defined(__mips64)
1072d87a3195Smrg	CPU=mips64
1073d87a3195Smrg	#else
1074d87a3195Smrg	CPU=mips
1075d87a3195Smrg	#endif
1076d87a3195Smrg	#endif
1077d87a3195Smrg	#endif
1078d87a3195Smrg
107995b296d0Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1080d87a3195Smrg	MIPS_ENDIAN=el
108195b296d0Smrg	#else
108295b296d0Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1083d87a3195Smrg	MIPS_ENDIAN=
108495b296d0Smrg	#else
1085d87a3195Smrg	MIPS_ENDIAN=
108695b296d0Smrg	#endif
108795b296d0Smrg	#endif
108895b296d0SmrgEOF
1089d87a3195Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090d87a3195Smrg	eval "$cc_set_vars"
1091d87a3195Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092d87a3195Smrg	;;
1093d87a3195Smrg    mips64el:Linux:*:*)
1094d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
109595b296d0Smrg	;;
1096eca46af7Smrg    openrisc*:Linux:*:*)
1097d87a3195Smrg	GUESS=or1k-unknown-linux-$LIBC
1098d87a3195Smrg	;;
1099eca46af7Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1100d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1101d87a3195Smrg	;;
110214330f12Smrg    padre:Linux:*:*)
1103d87a3195Smrg	GUESS=sparc-unknown-linux-$LIBC
1104d87a3195Smrg	;;
110514330f12Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106d87a3195Smrg	GUESS=hppa64-unknown-linux-$LIBC
1107d87a3195Smrg	;;
110895b296d0Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
110995b296d0Smrg	# Look for CPU level
111095b296d0Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111d87a3195Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112d87a3195Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113d87a3195Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
111495b296d0Smrg	esac
1115d87a3195Smrg	;;
111614330f12Smrg    ppc64:Linux:*:*)
1117d87a3195Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1118d87a3195Smrg	;;
111914330f12Smrg    ppc:Linux:*:*)
1120d87a3195Smrg	GUESS=powerpc-unknown-linux-$LIBC
1121d87a3195Smrg	;;
1122eca46af7Smrg    ppc64le:Linux:*:*)
1123d87a3195Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1124d87a3195Smrg	;;
1125eca46af7Smrg    ppcle:Linux:*:*)
1126d87a3195Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1127d87a3195Smrg	;;
1128d87a3195Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130d87a3195Smrg	;;
113195b296d0Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1132d87a3195Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133d87a3195Smrg	;;
113495b296d0Smrg    sh64*:Linux:*:*)
1135d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136d87a3195Smrg	;;
113795b296d0Smrg    sh*:Linux:*:*)
1138d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139d87a3195Smrg	;;
114095b296d0Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1141d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142d87a3195Smrg	;;
114314330f12Smrg    tile*:Linux:*:*)
1144d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145d87a3195Smrg	;;
114695b296d0Smrg    vax:Linux:*:*)
1147d87a3195Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148d87a3195Smrg	;;
114995b296d0Smrg    x86_64:Linux:*:*)
1150d87a3195Smrg	set_cc_for_build
1151d87a3195Smrg	LIBCABI=$LIBC
1152d87a3195Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1153eca46af7Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1154d87a3195Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1155eca46af7Smrg		grep IS_X32 >/dev/null
1156eca46af7Smrg	    then
1157d87a3195Smrg		LIBCABI=${LIBC}x32
1158eca46af7Smrg	    fi
1159eca46af7Smrg	fi
1160d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161d87a3195Smrg	;;
1162ff89ac2bSmrg    xtensa*:Linux:*:*)
1163d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164d87a3195Smrg	;;
116595b296d0Smrg    i*86:DYNIX/ptx:4*:*)
116695b296d0Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
116795b296d0Smrg	# earlier versions are messed up and put the nodename in both
116895b296d0Smrg	# sysname and nodename.
1169d87a3195Smrg	GUESS=i386-sequent-sysv4
1170d87a3195Smrg	;;
117195b296d0Smrg    i*86:UNIX_SV:4.2MP:2.*)
1172eca46af7Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1173eca46af7Smrg	# number series starting with 2...
1174eca46af7Smrg	# I am not positive that other SVR4 systems won't match this,
117595b296d0Smrg	# I just have to hope.  -- rms.
1176eca46af7Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1177d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178d87a3195Smrg	;;
117995b296d0Smrg    i*86:OS/2:*:*)
118095b296d0Smrg	# If we were able to find `uname', then EMX Unix compatibility
118195b296d0Smrg	# is probably installed.
1182d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1183d87a3195Smrg	;;
118495b296d0Smrg    i*86:XTS-300:*:STOP)
1185d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1186d87a3195Smrg	;;
118795b296d0Smrg    i*86:atheos:*:*)
1188d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1189d87a3195Smrg	;;
119095b296d0Smrg    i*86:syllable:*:*)
1191d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1192d87a3195Smrg	;;
119314330f12Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194d87a3195Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195d87a3195Smrg	;;
119695b296d0Smrg    i*86:*DOS:*:*)
1197d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198d87a3195Smrg	;;
1199d87a3195Smrg    i*86:*:4.*:*)
1200d87a3195Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
120195b296d0Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202d87a3195Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
120395b296d0Smrg	else
1204d87a3195Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
120595b296d0Smrg	fi
1206d87a3195Smrg	;;
120795b296d0Smrg    i*86:*:5:[678]*)
1208eca46af7Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
120995b296d0Smrg	case `/bin/uname -X | grep "^Machine"` in
121095b296d0Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
121195b296d0Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
121295b296d0Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
121395b296d0Smrg	esac
1214d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215d87a3195Smrg	;;
121695b296d0Smrg    i*86:*:3.2:*)
121795b296d0Smrg	if test -f /usr/options/cb.name; then
121895b296d0Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219d87a3195Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
122095b296d0Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
122195b296d0Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
122295b296d0Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
122395b296d0Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
122495b296d0Smrg			&& UNAME_MACHINE=i586
122595b296d0Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
122695b296d0Smrg			&& UNAME_MACHINE=i686
122795b296d0Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
122895b296d0Smrg			&& UNAME_MACHINE=i686
1229d87a3195Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
123095b296d0Smrg	else
1231d87a3195Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
123295b296d0Smrg	fi
1233d87a3195Smrg	;;
123495b296d0Smrg    pc:*:*:*)
123595b296d0Smrg	# Left here for compatibility:
1236eca46af7Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1237eca46af7Smrg	# the processor, so we play safe by assuming i586.
123814330f12Smrg	# Note: whatever this is, it MUST be the same as what config.sub
123989b0dc75Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
124014330f12Smrg	# this is a cross-build.
1241d87a3195Smrg	GUESS=i586-pc-msdosdjgpp
1242d87a3195Smrg	;;
124395b296d0Smrg    Intel:Mach:3*:*)
1244d87a3195Smrg	GUESS=i386-pc-mach3
1245d87a3195Smrg	;;
124695b296d0Smrg    paragon:*:*:*)
1247d87a3195Smrg	GUESS=i860-intel-osf1
1248d87a3195Smrg	;;
124995b296d0Smrg    i860:*:4.*:*) # i860-SVR4
125095b296d0Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251d87a3195Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
125295b296d0Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1253d87a3195Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
125495b296d0Smrg	fi
1255d87a3195Smrg	;;
125695b296d0Smrg    mini*:CTIX:SYS*5:*)
125795b296d0Smrg	# "miniframe"
1258d87a3195Smrg	GUESS=m68010-convergent-sysv
1259d87a3195Smrg	;;
126095b296d0Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1261d87a3195Smrg	GUESS=m68k-convergent-sysv
1262d87a3195Smrg	;;
126395b296d0Smrg    M680?0:D-NIX:5.3:*)
1264d87a3195Smrg	GUESS=m68k-diab-dnix
1265d87a3195Smrg	;;
126695b296d0Smrg    M68*:*:R3V[5678]*:*)
126795b296d0Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
126895b296d0Smrg    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)
126995b296d0Smrg	OS_REL=''
127095b296d0Smrg	test -r /etc/.relid \
127195b296d0Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
127295b296d0Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273d87a3195Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
127495b296d0Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275d87a3195Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
127695b296d0Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277eca46af7Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278eca46af7Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
127914330f12Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
128014330f12Smrg	OS_REL='.3'
128114330f12Smrg	test -r /etc/.relid \
128214330f12Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
128314330f12Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284d87a3195Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
128514330f12Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286d87a3195Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
128714330f12Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288d87a3195Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
128995b296d0Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290d87a3195Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291d87a3195Smrg	;;
129295b296d0Smrg    mc68030:UNIX_System_V:4.*:*)
1293d87a3195Smrg	GUESS=m68k-atari-sysv4
1294d87a3195Smrg	;;
129595b296d0Smrg    TSUNAMI:LynxOS:2.*:*)
1296d87a3195Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297d87a3195Smrg	;;
129895b296d0Smrg    rs6000:LynxOS:2.*:*)
1299d87a3195Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300d87a3195Smrg	;;
130114330f12Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302d87a3195Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303d87a3195Smrg	;;
130495b296d0Smrg    SM[BE]S:UNIX_SV:*:*)
1305d87a3195Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1306d87a3195Smrg	;;
130795b296d0Smrg    RM*:ReliantUNIX-*:*:*)
1308d87a3195Smrg	GUESS=mips-sni-sysv4
1309d87a3195Smrg	;;
131095b296d0Smrg    RM*:SINIX-*:*:*)
1311d87a3195Smrg	GUESS=mips-sni-sysv4
1312d87a3195Smrg	;;
131395b296d0Smrg    *:SINIX-*:*:*)
131495b296d0Smrg	if uname -p 2>/dev/null >/dev/null ; then
131595b296d0Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316d87a3195Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
131795b296d0Smrg	else
1318d87a3195Smrg		GUESS=ns32k-sni-sysv
131995b296d0Smrg	fi
1320d87a3195Smrg	;;
1321eca46af7Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322eca46af7Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1323d87a3195Smrg	GUESS=i586-unisys-sysv4
1324d87a3195Smrg	;;
132595b296d0Smrg    *:UNIX_System_V:4*:FTX*)
132695b296d0Smrg	# From Gerald Hewes <hewes@openmarket.com>.
132795b296d0Smrg	# How about differentiating between stratus architectures? -djm
1328d87a3195Smrg	GUESS=hppa1.1-stratus-sysv4
1329d87a3195Smrg	;;
133095b296d0Smrg    *:*:*:FTX*)
133195b296d0Smrg	# From seanf@swdc.stratus.com.
1332d87a3195Smrg	GUESS=i860-stratus-sysv4
1333d87a3195Smrg	;;
133495b296d0Smrg    i*86:VOS:*:*)
133595b296d0Smrg	# From Paul.Green@stratus.com.
1336d87a3195Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1337d87a3195Smrg	;;
133895b296d0Smrg    *:VOS:*:*)
133995b296d0Smrg	# From Paul.Green@stratus.com.
1340d87a3195Smrg	GUESS=hppa1.1-stratus-vos
1341d87a3195Smrg	;;
134295b296d0Smrg    mc68*:A/UX:*:*)
1343d87a3195Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1344d87a3195Smrg	;;
134595b296d0Smrg    news*:NEWS-OS:6*:*)
1346d87a3195Smrg	GUESS=mips-sony-newsos6
1347d87a3195Smrg	;;
134895b296d0Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1349d87a3195Smrg	if test -d /usr/nec; then
1350d87a3195Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
135195b296d0Smrg	else
1352d87a3195Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
135395b296d0Smrg	fi
1354d87a3195Smrg	;;
135595b296d0Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1356d87a3195Smrg	GUESS=powerpc-be-beos
1357d87a3195Smrg	;;
135895b296d0Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1359d87a3195Smrg	GUESS=powerpc-apple-beos
1360d87a3195Smrg	;;
136195b296d0Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1362d87a3195Smrg	GUESS=i586-pc-beos
1363d87a3195Smrg	;;
136414330f12Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1365d87a3195Smrg	GUESS=i586-pc-haiku
1366d87a3195Smrg	;;
1367eca46af7Smrg    x86_64:Haiku:*:*)
1368d87a3195Smrg	GUESS=x86_64-unknown-haiku
1369d87a3195Smrg	;;
137095b296d0Smrg    SX-4:SUPER-UX:*:*)
1371d87a3195Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1372d87a3195Smrg	;;
137395b296d0Smrg    SX-5:SUPER-UX:*:*)
1374d87a3195Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1375d87a3195Smrg	;;
137695b296d0Smrg    SX-6:SUPER-UX:*:*)
1377d87a3195Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1378d87a3195Smrg	;;
1379ff89ac2bSmrg    SX-7:SUPER-UX:*:*)
1380d87a3195Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1381d87a3195Smrg	;;
1382ff89ac2bSmrg    SX-8:SUPER-UX:*:*)
1383d87a3195Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1384d87a3195Smrg	;;
1385ff89ac2bSmrg    SX-8R:SUPER-UX:*:*)
1386d87a3195Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1387d87a3195Smrg	;;
138889b0dc75Smrg    SX-ACE:SUPER-UX:*:*)
1389d87a3195Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1390d87a3195Smrg	;;
139195b296d0Smrg    Power*:Rhapsody:*:*)
1392d87a3195Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393d87a3195Smrg	;;
139495b296d0Smrg    *:Rhapsody:*:*)
1395d87a3195Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396d87a3195Smrg	;;
1397d87a3195Smrg    arm64:Darwin:*:*)
1398d87a3195Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399d87a3195Smrg	;;
140095b296d0Smrg    *:Darwin:*:*)
1401d87a3195Smrg	UNAME_PROCESSOR=`uname -p`
1402d87a3195Smrg	case $UNAME_PROCESSOR in
1403d87a3195Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1404d87a3195Smrg	esac
1405d87a3195Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1406d87a3195Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407d87a3195Smrg	    # Avoid executing cc if there is no toolchain installed as
1408d87a3195Smrg	    # cc will be a stub that puts up a graphical alert
1409d87a3195Smrg	    # prompting the user to install developer tools.
1410d87a3195Smrg	    CC_FOR_BUILD=no_compiler_found
1411d87a3195Smrg	else
1412d87a3195Smrg	    set_cc_for_build
1413eca46af7Smrg	fi
1414d87a3195Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1415d87a3195Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416d87a3195Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417d87a3195Smrg		   grep IS_64BIT_ARCH >/dev/null
1418d87a3195Smrg	    then
1419d87a3195Smrg		case $UNAME_PROCESSOR in
1420d87a3195Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1421d87a3195Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1422d87a3195Smrg		esac
1423d87a3195Smrg	    fi
1424d87a3195Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425d87a3195Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426d87a3195Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427d87a3195Smrg		   grep IS_PPC >/dev/null
1428d87a3195Smrg	    then
1429d87a3195Smrg		UNAME_PROCESSOR=powerpc
1430eca46af7Smrg	    fi
1431eca46af7Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1432d87a3195Smrg	    # uname -m returns i386 or x86_64
1433d87a3195Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1434eca46af7Smrg	fi
1435d87a3195Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436d87a3195Smrg	;;
143795b296d0Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
143895b296d0Smrg	UNAME_PROCESSOR=`uname -p`
143989b0dc75Smrg	if test "$UNAME_PROCESSOR" = x86; then
144095b296d0Smrg		UNAME_PROCESSOR=i386
144195b296d0Smrg		UNAME_MACHINE=pc
144295b296d0Smrg	fi
1443d87a3195Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444d87a3195Smrg	;;
144595b296d0Smrg    *:QNX:*:4*)
1446d87a3195Smrg	GUESS=i386-pc-qnx
1447d87a3195Smrg	;;
1448d87a3195Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1449d87a3195Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1450d87a3195Smrg	;;
1451eca46af7Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1452d87a3195Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1453d87a3195Smrg	;;
1454d87a3195Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1455d87a3195Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456d87a3195Smrg	;;
1457d87a3195Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1458d87a3195Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459d87a3195Smrg	;;
1460d87a3195Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1461d87a3195Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462d87a3195Smrg	;;
146395b296d0Smrg    *:NonStop-UX:*:*)
1464d87a3195Smrg	GUESS=mips-compaq-nonstopux
1465d87a3195Smrg	;;
146695b296d0Smrg    BS2000:POSIX*:*:*)
1467d87a3195Smrg	GUESS=bs2000-siemens-sysv
1468d87a3195Smrg	;;
146995b296d0Smrg    DS/*:UNIX_System_V:*:*)
1470d87a3195Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471d87a3195Smrg	;;
147295b296d0Smrg    *:Plan9:*:*)
147395b296d0Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
147495b296d0Smrg	# is converted to i386 for consistency with other x86
147595b296d0Smrg	# operating systems.
1476d87a3195Smrg	if test "${cputype-}" = 386; then
147795b296d0Smrg	    UNAME_MACHINE=i386
1478d87a3195Smrg	elif test "x${cputype-}" != x; then
1479d87a3195Smrg	    UNAME_MACHINE=$cputype
148095b296d0Smrg	fi
1481d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1482d87a3195Smrg	;;
148395b296d0Smrg    *:TOPS-10:*:*)
1484d87a3195Smrg	GUESS=pdp10-unknown-tops10
1485d87a3195Smrg	;;
148695b296d0Smrg    *:TENEX:*:*)
1487d87a3195Smrg	GUESS=pdp10-unknown-tenex
1488d87a3195Smrg	;;
148995b296d0Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490d87a3195Smrg	GUESS=pdp10-dec-tops20
1491d87a3195Smrg	;;
149295b296d0Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493d87a3195Smrg	GUESS=pdp10-xkl-tops20
1494d87a3195Smrg	;;
149595b296d0Smrg    *:TOPS-20:*:*)
1496d87a3195Smrg	GUESS=pdp10-unknown-tops20
1497d87a3195Smrg	;;
149895b296d0Smrg    *:ITS:*:*)
1499d87a3195Smrg	GUESS=pdp10-unknown-its
1500d87a3195Smrg	;;
150195b296d0Smrg    SEI:*:*:SEIUX)
1502d87a3195Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1503d87a3195Smrg	;;
150495b296d0Smrg    *:DragonFly:*:*)
1505d87a3195Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507d87a3195Smrg	;;
150895b296d0Smrg    *:*VMS:*:*)
1509eca46af7Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510d87a3195Smrg	case $UNAME_MACHINE in
1511d87a3195Smrg	    A*) GUESS=alpha-dec-vms ;;
1512d87a3195Smrg	    I*) GUESS=ia64-dec-vms ;;
1513d87a3195Smrg	    V*) GUESS=vax-dec-vms ;;
151495b296d0Smrg	esac ;;
151595b296d0Smrg    *:XENIX:*:SysV)
1516d87a3195Smrg	GUESS=i386-pc-xenix
1517d87a3195Smrg	;;
151895b296d0Smrg    i*86:skyos:*:*)
1519d87a3195Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521d87a3195Smrg	;;
152295b296d0Smrg    i*86:rdos:*:*)
1523d87a3195Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1524d87a3195Smrg	;;
1525d87a3195Smrg    *:AROS:*:*)
1526d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1527d87a3195Smrg	;;
1528eca46af7Smrg    x86_64:VMkernel:*:*)
1529d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1530d87a3195Smrg	;;
153189b0dc75Smrg    amd64:Isilon\ OneFS:*:*)
1532d87a3195Smrg	GUESS=x86_64-unknown-onefs
1533d87a3195Smrg	;;
1534d87a3195Smrg    *:Unleashed:*:*)
1535d87a3195Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1536d87a3195Smrg	;;
1537d87a3195Smrgesac
1538d87a3195Smrg
1539d87a3195Smrg# Do we have a guess based on uname results?
1540d87a3195Smrgif test "x$GUESS" != x; then
1541d87a3195Smrg    echo "$GUESS"
1542d87a3195Smrg    exit
1543d87a3195Smrgfi
1544d87a3195Smrg
1545d87a3195Smrg# No uname command or uname output not recognized.
1546d87a3195Smrgset_cc_for_build
1547d87a3195Smrgcat > "$dummy.c" <<EOF
1548d87a3195Smrg#ifdef _SEQUENT_
1549d87a3195Smrg#include <sys/types.h>
1550d87a3195Smrg#include <sys/utsname.h>
1551d87a3195Smrg#endif
1552d87a3195Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1553d87a3195Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1554d87a3195Smrg#include <signal.h>
1555d87a3195Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1556d87a3195Smrg#include <sys/utsname.h>
1557d87a3195Smrg#endif
1558d87a3195Smrg#endif
1559d87a3195Smrg#endif
1560d87a3195Smrgmain ()
1561d87a3195Smrg{
1562d87a3195Smrg#if defined (sony)
1563d87a3195Smrg#if defined (MIPSEB)
1564d87a3195Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1565d87a3195Smrg     I don't know....  */
1566d87a3195Smrg  printf ("mips-sony-bsd\n"); exit (0);
1567d87a3195Smrg#else
1568d87a3195Smrg#include <sys/param.h>
1569d87a3195Smrg  printf ("m68k-sony-newsos%s\n",
1570d87a3195Smrg#ifdef NEWSOS4
1571d87a3195Smrg  "4"
1572d87a3195Smrg#else
1573d87a3195Smrg  ""
1574d87a3195Smrg#endif
1575d87a3195Smrg  ); exit (0);
1576d87a3195Smrg#endif
1577d87a3195Smrg#endif
1578d87a3195Smrg
1579d87a3195Smrg#if defined (NeXT)
1580d87a3195Smrg#if !defined (__ARCHITECTURE__)
1581d87a3195Smrg#define __ARCHITECTURE__ "m68k"
1582d87a3195Smrg#endif
1583d87a3195Smrg  int version;
1584d87a3195Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1585d87a3195Smrg  if (version < 4)
1586d87a3195Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1587d87a3195Smrg  else
1588d87a3195Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1589d87a3195Smrg  exit (0);
1590d87a3195Smrg#endif
1591d87a3195Smrg
1592d87a3195Smrg#if defined (MULTIMAX) || defined (n16)
1593d87a3195Smrg#if defined (UMAXV)
1594d87a3195Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1595d87a3195Smrg#else
1596d87a3195Smrg#if defined (CMU)
1597d87a3195Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1598d87a3195Smrg#else
1599d87a3195Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1600d87a3195Smrg#endif
1601d87a3195Smrg#endif
1602d87a3195Smrg#endif
1603d87a3195Smrg
1604d87a3195Smrg#if defined (__386BSD__)
1605d87a3195Smrg  printf ("i386-pc-bsd\n"); exit (0);
1606d87a3195Smrg#endif
1607d87a3195Smrg
1608d87a3195Smrg#if defined (sequent)
1609d87a3195Smrg#if defined (i386)
1610d87a3195Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1611d87a3195Smrg#endif
1612d87a3195Smrg#if defined (ns32000)
1613d87a3195Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1614d87a3195Smrg#endif
1615d87a3195Smrg#endif
1616d87a3195Smrg
1617d87a3195Smrg#if defined (_SEQUENT_)
1618d87a3195Smrg  struct utsname un;
1619d87a3195Smrg
1620d87a3195Smrg  uname(&un);
1621d87a3195Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1622d87a3195Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1623d87a3195Smrg  }
1624d87a3195Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1625d87a3195Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1626d87a3195Smrg  }
1627d87a3195Smrg  printf ("i386-sequent-ptx\n"); exit (0);
1628d87a3195Smrg#endif
1629d87a3195Smrg
1630d87a3195Smrg#if defined (vax)
1631d87a3195Smrg#if !defined (ultrix)
1632d87a3195Smrg#include <sys/param.h>
1633d87a3195Smrg#if defined (BSD)
1634d87a3195Smrg#if BSD == 43
1635d87a3195Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1636d87a3195Smrg#else
1637d87a3195Smrg#if BSD == 199006
1638d87a3195Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1639d87a3195Smrg#else
1640d87a3195Smrg  printf ("vax-dec-bsd\n"); exit (0);
1641d87a3195Smrg#endif
1642d87a3195Smrg#endif
1643d87a3195Smrg#else
1644d87a3195Smrg  printf ("vax-dec-bsd\n"); exit (0);
1645d87a3195Smrg#endif
1646d87a3195Smrg#else
1647d87a3195Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1648d87a3195Smrg  struct utsname un;
1649d87a3195Smrg  uname (&un);
1650d87a3195Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1651d87a3195Smrg#else
1652d87a3195Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1653d87a3195Smrg#endif
1654d87a3195Smrg#endif
1655d87a3195Smrg#endif
1656d87a3195Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1657d87a3195Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1658d87a3195Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1659d87a3195Smrg  struct utsname *un;
1660d87a3195Smrg  uname (&un);
1661d87a3195Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1662d87a3195Smrg#else
1663d87a3195Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1664d87a3195Smrg#endif
1665d87a3195Smrg#endif
1666d87a3195Smrg#endif
1667d87a3195Smrg
1668d87a3195Smrg#if defined (alliant) && defined (i860)
1669d87a3195Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1670d87a3195Smrg#endif
1671d87a3195Smrg
1672d87a3195Smrg  exit (1);
1673d87a3195Smrg}
1674d87a3195SmrgEOF
1675d87a3195Smrg
1676d87a3195Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1677d87a3195Smrg	{ echo "$SYSTEM_NAME"; exit; }
1678d87a3195Smrg
1679d87a3195Smrg# Apollos put the system type in the environment.
1680d87a3195Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1681d87a3195Smrg
1682d87a3195Smrgecho "$0: unable to guess system type" >&2
1683d87a3195Smrg
1684d87a3195Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685d87a3195Smrg    mips:Linux | mips64:Linux)
1686d87a3195Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1687d87a3195Smrg	cat >&2 <<EOF
1688d87a3195Smrg
1689d87a3195SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690d87a3195Smrgthe system type. Please install a C compiler and try again.
1691d87a3195SmrgEOF
1692d87a3195Smrg	;;
1693eca46af7Smrgesac
169495b296d0Smrg
169595b296d0Smrgcat >&2 <<EOF
169695b296d0Smrg
1697d87a3195SmrgThis script (version $timestamp), has failed to recognize the
1698d87a3195Smrgoperating system you are using. If your script is old, overwrite *all*
1699d87a3195Smrgcopies of config.guess and config.sub with the latest versions from:
170095b296d0Smrg
1701d87a3195Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
170295b296d0Smrgand
1703d87a3195Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1704d87a3195SmrgEOF
170595b296d0Smrg
1706d87a3195Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1707d87a3195Smrgthisyear=`date +%Y`
1708d87a3195Smrg# shellcheck disable=SC2003
1709d87a3195Smrgscript_age=`expr "$thisyear" - "$our_year"`
1710d87a3195Smrgif test "$script_age" -lt 3 ; then
1711d87a3195Smrg   cat >&2 <<EOF
1712d87a3195Smrg
1713d87a3195SmrgIf $0 has already been updated, send the following data and any
1714d87a3195Smrginformation you think might be pertinent to config-patches@gnu.org to
1715d87a3195Smrgprovide the necessary information to handle your system.
171695b296d0Smrg
171795b296d0Smrgconfig.guess timestamp = $timestamp
171895b296d0Smrg
171995b296d0Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
172095b296d0Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
172195b296d0Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
172295b296d0Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
172395b296d0Smrg
172495b296d0Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
172595b296d0Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
172695b296d0Smrg
172795b296d0Smrghostinfo               = `(hostinfo) 2>/dev/null`
172895b296d0Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
172995b296d0Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
173095b296d0Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
173195b296d0Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
173295b296d0Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
173395b296d0Smrg
1734d87a3195SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735d87a3195SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736d87a3195SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737d87a3195SmrgUNAME_VERSION = "$UNAME_VERSION"
173895b296d0SmrgEOF
1739d87a3195Smrgfi
174095b296d0Smrg
174195b296d0Smrgexit 1
174295b296d0Smrg
174395b296d0Smrg# Local variables:
1744d87a3195Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
174595b296d0Smrg# time-stamp-start: "timestamp='"
174695b296d0Smrg# time-stamp-format: "%:y-%02m-%02d"
174795b296d0Smrg# time-stamp-end: "'"
174895b296d0Smrg# End:
1749