1e07dc26bSmrg#! /bin/sh
2e07dc26bSmrg# Attempt to guess a canonical system name.
3636c353eSmrg#   Copyright 1992-2023 Free Software Foundation, Inc.
4e07dc26bSmrg
5636c353eSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6636c353eSmrg
7636c353eSmrgtimestamp='2023-01-01'
8e07dc26bSmrg
9e07dc26bSmrg# This file is free software; you can redistribute it and/or modify it
10e07dc26bSmrg# under the terms of the GNU General Public License as published by
11636c353eSmrg# the Free Software Foundation, either version 3 of the License, or
12e07dc26bSmrg# (at your option) any later version.
13e07dc26bSmrg#
14e07dc26bSmrg# This program is distributed in the hope that it will be useful, but
15e07dc26bSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16e07dc26bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17e07dc26bSmrg# General Public License for more details.
18e07dc26bSmrg#
19e07dc26bSmrg# You should have received a copy of the GNU General Public License
20636c353eSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21e07dc26bSmrg#
22e07dc26bSmrg# As a special exception to the GNU General Public License, if you
23e07dc26bSmrg# distribute this file as part of a program that contains a
24e07dc26bSmrg# configuration script generated by Autoconf, you may include it under
25e07dc26bSmrg# the same distribution terms that you use for the rest of that
26e07dc26bSmrg# program.  This Exception is an additional permission under section 7
27e07dc26bSmrg# of the GNU General Public License, version 3 ("GPLv3").
28e07dc26bSmrg#
29e07dc26bSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30e07dc26bSmrg#
31e07dc26bSmrg# You can get the latest version of this script from:
32636c353eSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33e07dc26bSmrg#
34e07dc26bSmrg# Please send patches to <config-patches@gnu.org>.
35e07dc26bSmrg
36e07dc26bSmrg
37636c353eSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
38636c353eSmrg# about features and limitations of the classic Bourne shell that were
39636c353eSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
40636c353eSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41636c353eSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42636c353eSmrg# have a pre-POSIX /bin/sh.
43636c353eSmrg
44636c353eSmrg
45e07dc26bSmrgme=`echo "$0" | sed -e 's,.*/,,'`
46e07dc26bSmrg
47e07dc26bSmrgusage="\
48e07dc26bSmrgUsage: $0 [OPTION]
49e07dc26bSmrg
50e07dc26bSmrgOutput the configuration name of the system \`$me' is run on.
51e07dc26bSmrg
52636c353eSmrgOptions:
53e07dc26bSmrg  -h, --help         print this help, then exit
54e07dc26bSmrg  -t, --time-stamp   print date of last modification, then exit
55e07dc26bSmrg  -v, --version      print version number, then exit
56e07dc26bSmrg
57e07dc26bSmrgReport bugs and patches to <config-patches@gnu.org>."
58e07dc26bSmrg
59e07dc26bSmrgversion="\
60e07dc26bSmrgGNU config.guess ($timestamp)
61e07dc26bSmrg
62e07dc26bSmrgOriginally written by Per Bothner.
63636c353eSmrgCopyright 1992-2023 Free Software Foundation, Inc.
64e07dc26bSmrg
65e07dc26bSmrgThis is free software; see the source for copying conditions.  There is NO
66e07dc26bSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67e07dc26bSmrg
68e07dc26bSmrghelp="
69e07dc26bSmrgTry \`$me --help' for more information."
70e07dc26bSmrg
71e07dc26bSmrg# Parse command line
72e07dc26bSmrgwhile test $# -gt 0 ; do
73e07dc26bSmrg  case $1 in
74e07dc26bSmrg    --time-stamp | --time* | -t )
75e07dc26bSmrg       echo "$timestamp" ; exit ;;
76e07dc26bSmrg    --version | -v )
77e07dc26bSmrg       echo "$version" ; exit ;;
78e07dc26bSmrg    --help | --h* | -h )
79e07dc26bSmrg       echo "$usage"; exit ;;
80e07dc26bSmrg    -- )     # Stop option processing
81e07dc26bSmrg       shift; break ;;
82e07dc26bSmrg    - )	# Use stdin as input.
83e07dc26bSmrg       break ;;
84e07dc26bSmrg    -* )
85e07dc26bSmrg       echo "$me: invalid option $1$help" >&2
86e07dc26bSmrg       exit 1 ;;
87e07dc26bSmrg    * )
88e07dc26bSmrg       break ;;
89e07dc26bSmrg  esac
90e07dc26bSmrgdone
91e07dc26bSmrg
92e07dc26bSmrgif test $# != 0; then
93e07dc26bSmrg  echo "$me: too many arguments$help" >&2
94e07dc26bSmrg  exit 1
95e07dc26bSmrgfi
96e07dc26bSmrg
97636c353eSmrg# Just in case it came from the environment.
98636c353eSmrgGUESS=
99e07dc26bSmrg
100e07dc26bSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101e07dc26bSmrg# compiler to aid in system detection is discouraged as it requires
102e07dc26bSmrg# temporary files to be created and, as you can see below, it is a
103e07dc26bSmrg# headache to deal with in a portable fashion.
104e07dc26bSmrg
105e07dc26bSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106e07dc26bSmrg# use `HOST_CC' if defined, but it is deprecated.
107e07dc26bSmrg
108e07dc26bSmrg# Portable tmp directory creation inspired by the Autoconf team.
109e07dc26bSmrg
110636c353eSmrgtmp=
111636c353eSmrg# shellcheck disable=SC2172
112636c353eSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113636c353eSmrg
114636c353eSmrgset_cc_for_build() {
115636c353eSmrg    # prevent multiple calls if $tmp is already set
116636c353eSmrg    test "$tmp" && return 0
117636c353eSmrg    : "${TMPDIR=/tmp}"
118636c353eSmrg    # shellcheck disable=SC2039,SC3028
119636c353eSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120636c353eSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121636c353eSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122636c353eSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123636c353eSmrg    dummy=$tmp/dummy
124636c353eSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125636c353eSmrg	,,)    echo "int x;" > "$dummy.c"
126636c353eSmrg	       for driver in cc gcc c89 c99 ; do
127636c353eSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128636c353eSmrg		       CC_FOR_BUILD=$driver
129636c353eSmrg		       break
130636c353eSmrg		   fi
131636c353eSmrg	       done
132636c353eSmrg	       if test x"$CC_FOR_BUILD" = x ; then
133636c353eSmrg		   CC_FOR_BUILD=no_compiler_found
134636c353eSmrg	       fi
135636c353eSmrg	       ;;
136636c353eSmrg	,,*)   CC_FOR_BUILD=$CC ;;
137636c353eSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138636c353eSmrg    esac
139636c353eSmrg}
140e07dc26bSmrg
141e07dc26bSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142e07dc26bSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
143636c353eSmrgif test -f /.attbin/uname ; then
144e07dc26bSmrg	PATH=$PATH:/.attbin ; export PATH
145e07dc26bSmrgfi
146e07dc26bSmrg
147e07dc26bSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148e07dc26bSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149636c353eSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150e07dc26bSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151e07dc26bSmrg
152636c353eSmrgcase $UNAME_SYSTEM in
153e07dc26bSmrgLinux|GNU|GNU/*)
154636c353eSmrg	LIBC=unknown
155e07dc26bSmrg
156636c353eSmrg	set_cc_for_build
157636c353eSmrg	cat <<-EOF > "$dummy.c"
158e07dc26bSmrg	#include <features.h>
159e07dc26bSmrg	#if defined(__UCLIBC__)
160e07dc26bSmrg	LIBC=uclibc
161e07dc26bSmrg	#elif defined(__dietlibc__)
162e07dc26bSmrg	LIBC=dietlibc
163636c353eSmrg	#elif defined(__GLIBC__)
164e07dc26bSmrg	LIBC=gnu
165636c353eSmrg	#else
166636c353eSmrg	#include <stdarg.h>
167636c353eSmrg	/* First heuristic to detect musl libc.  */
168636c353eSmrg	#ifdef __DEFINED_va_list
169636c353eSmrg	LIBC=musl
170636c353eSmrg	#endif
171e07dc26bSmrg	#endif
172e07dc26bSmrg	EOF
173636c353eSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174636c353eSmrg	eval "$cc_set_libc"
175636c353eSmrg
176636c353eSmrg	# Second heuristic to detect musl libc.
177636c353eSmrg	if [ "$LIBC" = unknown ] &&
178636c353eSmrg	   command -v ldd >/dev/null &&
179636c353eSmrg	   ldd --version 2>&1 | grep -q ^musl; then
180636c353eSmrg		LIBC=musl
181636c353eSmrg	fi
182636c353eSmrg
183636c353eSmrg	# If the system lacks a compiler, then just pick glibc.
184636c353eSmrg	# We could probably try harder.
185636c353eSmrg	if [ "$LIBC" = unknown ]; then
186636c353eSmrg		LIBC=gnu
187636c353eSmrg	fi
188e07dc26bSmrg	;;
189e07dc26bSmrgesac
190e07dc26bSmrg
191e07dc26bSmrg# Note: order is significant - the case branches are not exclusive.
192e07dc26bSmrg
193636c353eSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194e07dc26bSmrg    *:NetBSD:*:*)
195e07dc26bSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
196e07dc26bSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197e07dc26bSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198e07dc26bSmrg	# switched to ELF, *-*-netbsd* would select the old
199e07dc26bSmrg	# object file format.  This provides both forward
200e07dc26bSmrg	# compatibility and a consistent mechanism for selecting the
201e07dc26bSmrg	# object file format.
202e07dc26bSmrg	#
203e07dc26bSmrg	# Note: NetBSD doesn't particularly care about the vendor
204e07dc26bSmrg	# portion of the name.  We always set it to "unknown".
205e07dc26bSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206636c353eSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207636c353eSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208e07dc26bSmrg	    echo unknown)`
209636c353eSmrg	case $UNAME_MACHINE_ARCH in
210636c353eSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
211e07dc26bSmrg	    armeb) machine=armeb-unknown ;;
212e07dc26bSmrg	    arm*) machine=arm-unknown ;;
213e07dc26bSmrg	    sh3el) machine=shl-unknown ;;
214e07dc26bSmrg	    sh3eb) machine=sh-unknown ;;
215e07dc26bSmrg	    sh5el) machine=sh5le-unknown ;;
216e07dc26bSmrg	    earmv*)
217636c353eSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218636c353eSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219e07dc26bSmrg		machine=${arch}${endian}-unknown
220e07dc26bSmrg		;;
221636c353eSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222e07dc26bSmrg	esac
223e07dc26bSmrg	# The Operating System including object format, if it has switched
224e07dc26bSmrg	# to ELF recently (or will in the future) and ABI.
225636c353eSmrg	case $UNAME_MACHINE_ARCH in
226e07dc26bSmrg	    earm*)
227e07dc26bSmrg		os=netbsdelf
228e07dc26bSmrg		;;
229e07dc26bSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230636c353eSmrg		set_cc_for_build
231e07dc26bSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232e07dc26bSmrg			| grep -q __ELF__
233e07dc26bSmrg		then
234e07dc26bSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235e07dc26bSmrg		    # Return netbsd for either.  FIX?
236e07dc26bSmrg		    os=netbsd
237e07dc26bSmrg		else
238e07dc26bSmrg		    os=netbsdelf
239e07dc26bSmrg		fi
240e07dc26bSmrg		;;
241e07dc26bSmrg	    *)
242e07dc26bSmrg		os=netbsd
243e07dc26bSmrg		;;
244e07dc26bSmrg	esac
245e07dc26bSmrg	# Determine ABI tags.
246636c353eSmrg	case $UNAME_MACHINE_ARCH in
247e07dc26bSmrg	    earm*)
248e07dc26bSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249636c353eSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250e07dc26bSmrg		;;
251e07dc26bSmrg	esac
252e07dc26bSmrg	# The OS release
253e07dc26bSmrg	# Debian GNU/NetBSD machines have a different userland, and
254e07dc26bSmrg	# thus, need a distinct triplet. However, they do not need
255e07dc26bSmrg	# kernel version information, so it can be replaced with a
256e07dc26bSmrg	# suitable tag, in the style of linux-gnu.
257636c353eSmrg	case $UNAME_VERSION in
258e07dc26bSmrg	    Debian*)
259e07dc26bSmrg		release='-gnu'
260e07dc26bSmrg		;;
261e07dc26bSmrg	    *)
262636c353eSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263e07dc26bSmrg		;;
264e07dc26bSmrg	esac
265e07dc26bSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266e07dc26bSmrg	# contains redundant information, the shorter form:
267e07dc26bSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268636c353eSmrg	GUESS=$machine-${os}${release}${abi-}
269636c353eSmrg	;;
270e07dc26bSmrg    *:Bitrig:*:*)
271e07dc26bSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272636c353eSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273636c353eSmrg	;;
274e07dc26bSmrg    *:OpenBSD:*:*)
275e07dc26bSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276636c353eSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277636c353eSmrg	;;
278636c353eSmrg    *:SecBSD:*:*)
279636c353eSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280636c353eSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281636c353eSmrg	;;
282e07dc26bSmrg    *:LibertyBSD:*:*)
283e07dc26bSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284636c353eSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285636c353eSmrg	;;
286636c353eSmrg    *:MidnightBSD:*:*)
287636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288636c353eSmrg	;;
289e07dc26bSmrg    *:ekkoBSD:*:*)
290636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291636c353eSmrg	;;
292e07dc26bSmrg    *:SolidBSD:*:*)
293636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294636c353eSmrg	;;
295636c353eSmrg    *:OS108:*:*)
296636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297636c353eSmrg	;;
298e07dc26bSmrg    macppc:MirBSD:*:*)
299636c353eSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300636c353eSmrg	;;
301e07dc26bSmrg    *:MirBSD:*:*)
302636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303636c353eSmrg	;;
304e07dc26bSmrg    *:Sortix:*:*)
305636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
306636c353eSmrg	;;
307636c353eSmrg    *:Twizzler:*:*)
308636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309636c353eSmrg	;;
310636c353eSmrg    *:Redox:*:*)
311636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-redox
312636c353eSmrg	;;
313636c353eSmrg    mips:OSF1:*.*)
314636c353eSmrg	GUESS=mips-dec-osf1
315636c353eSmrg	;;
316e07dc26bSmrg    alpha:OSF1:*:*)
317636c353eSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318636c353eSmrg	trap '' 0
319e07dc26bSmrg	case $UNAME_RELEASE in
320e07dc26bSmrg	*4.0)
321e07dc26bSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322e07dc26bSmrg		;;
323e07dc26bSmrg	*5.*)
324e07dc26bSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325e07dc26bSmrg		;;
326e07dc26bSmrg	esac
327e07dc26bSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328e07dc26bSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329e07dc26bSmrg	# covers most systems running today.  This code pipes the CPU
330e07dc26bSmrg	# types through head -n 1, so we only detect the type of CPU 0.
331e07dc26bSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332636c353eSmrg	case $ALPHA_CPU_TYPE in
333e07dc26bSmrg	    "EV4 (21064)")
334e07dc26bSmrg		UNAME_MACHINE=alpha ;;
335e07dc26bSmrg	    "EV4.5 (21064)")
336e07dc26bSmrg		UNAME_MACHINE=alpha ;;
337e07dc26bSmrg	    "LCA4 (21066/21068)")
338e07dc26bSmrg		UNAME_MACHINE=alpha ;;
339e07dc26bSmrg	    "EV5 (21164)")
340e07dc26bSmrg		UNAME_MACHINE=alphaev5 ;;
341e07dc26bSmrg	    "EV5.6 (21164A)")
342e07dc26bSmrg		UNAME_MACHINE=alphaev56 ;;
343e07dc26bSmrg	    "EV5.6 (21164PC)")
344e07dc26bSmrg		UNAME_MACHINE=alphapca56 ;;
345e07dc26bSmrg	    "EV5.7 (21164PC)")
346e07dc26bSmrg		UNAME_MACHINE=alphapca57 ;;
347e07dc26bSmrg	    "EV6 (21264)")
348e07dc26bSmrg		UNAME_MACHINE=alphaev6 ;;
349e07dc26bSmrg	    "EV6.7 (21264A)")
350e07dc26bSmrg		UNAME_MACHINE=alphaev67 ;;
351e07dc26bSmrg	    "EV6.8CB (21264C)")
352e07dc26bSmrg		UNAME_MACHINE=alphaev68 ;;
353e07dc26bSmrg	    "EV6.8AL (21264B)")
354e07dc26bSmrg		UNAME_MACHINE=alphaev68 ;;
355e07dc26bSmrg	    "EV6.8CX (21264D)")
356e07dc26bSmrg		UNAME_MACHINE=alphaev68 ;;
357e07dc26bSmrg	    "EV6.9A (21264/EV69A)")
358e07dc26bSmrg		UNAME_MACHINE=alphaev69 ;;
359e07dc26bSmrg	    "EV7 (21364)")
360e07dc26bSmrg		UNAME_MACHINE=alphaev7 ;;
361e07dc26bSmrg	    "EV7.9 (21364A)")
362e07dc26bSmrg		UNAME_MACHINE=alphaev79 ;;
363e07dc26bSmrg	esac
364e07dc26bSmrg	# A Pn.n version is a patched version.
365e07dc26bSmrg	# A Vn.n version is a released version.
366e07dc26bSmrg	# A Tn.n version is a released field test version.
367e07dc26bSmrg	# A Xn.n version is an unreleased experimental baselevel.
368e07dc26bSmrg	# 1.2 uses "1.2" for uname -r.
369636c353eSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370636c353eSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371636c353eSmrg	;;
372e07dc26bSmrg    Amiga*:UNIX_System_V:4.0:*)
373636c353eSmrg	GUESS=m68k-unknown-sysv4
374636c353eSmrg	;;
375e07dc26bSmrg    *:[Aa]miga[Oo][Ss]:*:*)
376636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377636c353eSmrg	;;
378e07dc26bSmrg    *:[Mm]orph[Oo][Ss]:*:*)
379636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
380636c353eSmrg	;;
381e07dc26bSmrg    *:OS/390:*:*)
382636c353eSmrg	GUESS=i370-ibm-openedition
383636c353eSmrg	;;
384e07dc26bSmrg    *:z/VM:*:*)
385636c353eSmrg	GUESS=s390-ibm-zvmoe
386636c353eSmrg	;;
387e07dc26bSmrg    *:OS400:*:*)
388636c353eSmrg	GUESS=powerpc-ibm-os400
389636c353eSmrg	;;
390e07dc26bSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391636c353eSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392636c353eSmrg	;;
393e07dc26bSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394636c353eSmrg	GUESS=arm-unknown-riscos
395636c353eSmrg	;;
396e07dc26bSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397636c353eSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
398636c353eSmrg	;;
399e07dc26bSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400e07dc26bSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401636c353eSmrg	case `(/bin/universe) 2>/dev/null` in
402636c353eSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403636c353eSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404636c353eSmrg	esac
405636c353eSmrg	;;
406e07dc26bSmrg    NILE*:*:*:dcosx)
407636c353eSmrg	GUESS=pyramid-pyramid-svr4
408636c353eSmrg	;;
409e07dc26bSmrg    DRS?6000:unix:4.0:6*)
410636c353eSmrg	GUESS=sparc-icl-nx6
411636c353eSmrg	;;
412e07dc26bSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413e07dc26bSmrg	case `/usr/bin/uname -p` in
414636c353eSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
415636c353eSmrg	esac
416636c353eSmrg	;;
417e07dc26bSmrg    s390x:SunOS:*:*)
418636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419636c353eSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420636c353eSmrg	;;
421e07dc26bSmrg    sun4H:SunOS:5.*:*)
422636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423636c353eSmrg	GUESS=sparc-hal-solaris2$SUN_REL
424636c353eSmrg	;;
425e07dc26bSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427636c353eSmrg	GUESS=sparc-sun-solaris2$SUN_REL
428636c353eSmrg	;;
429e07dc26bSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430636c353eSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431636c353eSmrg	;;
432e07dc26bSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433636c353eSmrg	set_cc_for_build
434e07dc26bSmrg	SUN_ARCH=i386
435e07dc26bSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
436e07dc26bSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437e07dc26bSmrg	# This test works for both compilers.
438636c353eSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439e07dc26bSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440636c353eSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441e07dc26bSmrg		grep IS_64BIT_ARCH >/dev/null
442e07dc26bSmrg	    then
443e07dc26bSmrg		SUN_ARCH=x86_64
444e07dc26bSmrg	    fi
445e07dc26bSmrg	fi
446636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447636c353eSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448636c353eSmrg	;;
449e07dc26bSmrg    sun4*:SunOS:6*:*)
450e07dc26bSmrg	# According to config.sub, this is the proper way to canonicalize
451e07dc26bSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452e07dc26bSmrg	# it's likely to be more like Solaris than SunOS4.
453636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454636c353eSmrg	GUESS=sparc-sun-solaris3$SUN_REL
455636c353eSmrg	;;
456e07dc26bSmrg    sun4*:SunOS:*:*)
457636c353eSmrg	case `/usr/bin/arch -k` in
458e07dc26bSmrg	    Series*|S4*)
459e07dc26bSmrg		UNAME_RELEASE=`uname -v`
460e07dc26bSmrg		;;
461e07dc26bSmrg	esac
462e07dc26bSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464636c353eSmrg	GUESS=sparc-sun-sunos$SUN_REL
465636c353eSmrg	;;
466e07dc26bSmrg    sun3*:SunOS:*:*)
467636c353eSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468636c353eSmrg	;;
469e07dc26bSmrg    sun*:*:4.2BSD:*)
470e07dc26bSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471636c353eSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472636c353eSmrg	case `/bin/arch` in
473e07dc26bSmrg	    sun3)
474636c353eSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475e07dc26bSmrg		;;
476e07dc26bSmrg	    sun4)
477636c353eSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478e07dc26bSmrg		;;
479e07dc26bSmrg	esac
480636c353eSmrg	;;
481e07dc26bSmrg    aushp:SunOS:*:*)
482636c353eSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483636c353eSmrg	;;
484e07dc26bSmrg    # The situation for MiNT is a little confusing.  The machine name
485e07dc26bSmrg    # can be virtually everything (everything which is not
486e07dc26bSmrg    # "atarist" or "atariste" at least should have a processor
487e07dc26bSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488e07dc26bSmrg    # to the lowercase version "mint" (or "freemint").  Finally
489e07dc26bSmrg    # the system name "TOS" denotes a system which is actually not
490e07dc26bSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491e07dc26bSmrg    # be no problem.
492e07dc26bSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493636c353eSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494636c353eSmrg	;;
495e07dc26bSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496636c353eSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497636c353eSmrg	;;
498e07dc26bSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499636c353eSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500636c353eSmrg	;;
501e07dc26bSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502636c353eSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503636c353eSmrg	;;
504e07dc26bSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505636c353eSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506636c353eSmrg	;;
507e07dc26bSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508636c353eSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509636c353eSmrg	;;
510e07dc26bSmrg    m68k:machten:*:*)
511636c353eSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512636c353eSmrg	;;
513e07dc26bSmrg    powerpc:machten:*:*)
514636c353eSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515636c353eSmrg	;;
516e07dc26bSmrg    RISC*:Mach:*:*)
517636c353eSmrg	GUESS=mips-dec-mach_bsd4.3
518636c353eSmrg	;;
519e07dc26bSmrg    RISC*:ULTRIX:*:*)
520636c353eSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521636c353eSmrg	;;
522e07dc26bSmrg    VAX*:ULTRIX*:*:*)
523636c353eSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524636c353eSmrg	;;
525e07dc26bSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526636c353eSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527636c353eSmrg	;;
528e07dc26bSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529636c353eSmrg	set_cc_for_build
530636c353eSmrg	sed 's/^	//' << EOF > "$dummy.c"
531e07dc26bSmrg#ifdef __cplusplus
532e07dc26bSmrg#include <stdio.h>  /* for printf() prototype */
533e07dc26bSmrg	int main (int argc, char *argv[]) {
534e07dc26bSmrg#else
535e07dc26bSmrg	int main (argc, argv) int argc; char *argv[]; {
536e07dc26bSmrg#endif
537e07dc26bSmrg	#if defined (host_mips) && defined (MIPSEB)
538e07dc26bSmrg	#if defined (SYSTYPE_SYSV)
539636c353eSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540e07dc26bSmrg	#endif
541e07dc26bSmrg	#if defined (SYSTYPE_SVR4)
542636c353eSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543e07dc26bSmrg	#endif
544e07dc26bSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545636c353eSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546e07dc26bSmrg	#endif
547e07dc26bSmrg	#endif
548e07dc26bSmrg	  exit (-1);
549e07dc26bSmrg	}
550e07dc26bSmrgEOF
551636c353eSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552636c353eSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553636c353eSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554e07dc26bSmrg	    { echo "$SYSTEM_NAME"; exit; }
555636c353eSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556636c353eSmrg	;;
557e07dc26bSmrg    Motorola:PowerMAX_OS:*:*)
558636c353eSmrg	GUESS=powerpc-motorola-powermax
559636c353eSmrg	;;
560e07dc26bSmrg    Motorola:*:4.3:PL8-*)
561636c353eSmrg	GUESS=powerpc-harris-powermax
562636c353eSmrg	;;
563e07dc26bSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564636c353eSmrg	GUESS=powerpc-harris-powermax
565636c353eSmrg	;;
566e07dc26bSmrg    Night_Hawk:Power_UNIX:*:*)
567636c353eSmrg	GUESS=powerpc-harris-powerunix
568636c353eSmrg	;;
569e07dc26bSmrg    m88k:CX/UX:7*:*)
570636c353eSmrg	GUESS=m88k-harris-cxux7
571636c353eSmrg	;;
572e07dc26bSmrg    m88k:*:4*:R4*)
573636c353eSmrg	GUESS=m88k-motorola-sysv4
574636c353eSmrg	;;
575e07dc26bSmrg    m88k:*:3*:R3*)
576636c353eSmrg	GUESS=m88k-motorola-sysv3
577636c353eSmrg	;;
578e07dc26bSmrg    AViiON:dgux:*:*)
579e07dc26bSmrg	# DG/UX returns AViiON for all architectures
580e07dc26bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581636c353eSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582e07dc26bSmrg	then
583636c353eSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584636c353eSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
585e07dc26bSmrg	    then
586636c353eSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587e07dc26bSmrg	    else
588636c353eSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589e07dc26bSmrg	    fi
590e07dc26bSmrg	else
591636c353eSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592e07dc26bSmrg	fi
593636c353eSmrg	;;
594e07dc26bSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595636c353eSmrg	GUESS=m88k-dolphin-sysv3
596636c353eSmrg	;;
597e07dc26bSmrg    M88*:*:R3*:*)
598e07dc26bSmrg	# Delta 88k system running SVR3
599636c353eSmrg	GUESS=m88k-motorola-sysv3
600636c353eSmrg	;;
601e07dc26bSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602636c353eSmrg	GUESS=m88k-tektronix-sysv3
603636c353eSmrg	;;
604e07dc26bSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605636c353eSmrg	GUESS=m68k-tektronix-bsd
606636c353eSmrg	;;
607e07dc26bSmrg    *:IRIX*:*:*)
608636c353eSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609636c353eSmrg	GUESS=mips-sgi-irix$IRIX_REL
610636c353eSmrg	;;
611e07dc26bSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612636c353eSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613636c353eSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614e07dc26bSmrg    i*86:AIX:*:*)
615636c353eSmrg	GUESS=i386-ibm-aix
616636c353eSmrg	;;
617e07dc26bSmrg    ia64:AIX:*:*)
618636c353eSmrg	if test -x /usr/bin/oslevel ; then
619e07dc26bSmrg		IBM_REV=`/usr/bin/oslevel`
620e07dc26bSmrg	else
621636c353eSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622e07dc26bSmrg	fi
623636c353eSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624636c353eSmrg	;;
625e07dc26bSmrg    *:AIX:2:3)
626e07dc26bSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627636c353eSmrg		set_cc_for_build
628636c353eSmrg		sed 's/^		//' << EOF > "$dummy.c"
629e07dc26bSmrg		#include <sys/systemcfg.h>
630e07dc26bSmrg
631e07dc26bSmrg		main()
632e07dc26bSmrg			{
633e07dc26bSmrg			if (!__power_pc())
634e07dc26bSmrg				exit(1);
635e07dc26bSmrg			puts("powerpc-ibm-aix3.2.5");
636e07dc26bSmrg			exit(0);
637e07dc26bSmrg			}
638e07dc26bSmrgEOF
639636c353eSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640e07dc26bSmrg		then
641636c353eSmrg			GUESS=$SYSTEM_NAME
642e07dc26bSmrg		else
643636c353eSmrg			GUESS=rs6000-ibm-aix3.2.5
644e07dc26bSmrg		fi
645e07dc26bSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646636c353eSmrg		GUESS=rs6000-ibm-aix3.2.4
647e07dc26bSmrg	else
648636c353eSmrg		GUESS=rs6000-ibm-aix3.2
649e07dc26bSmrg	fi
650636c353eSmrg	;;
651e07dc26bSmrg    *:AIX:*:[4567])
652e07dc26bSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653636c353eSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654e07dc26bSmrg		IBM_ARCH=rs6000
655e07dc26bSmrg	else
656e07dc26bSmrg		IBM_ARCH=powerpc
657e07dc26bSmrg	fi
658636c353eSmrg	if test -x /usr/bin/lslpp ; then
659636c353eSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660e07dc26bSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661e07dc26bSmrg	else
662636c353eSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663e07dc26bSmrg	fi
664636c353eSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665636c353eSmrg	;;
666e07dc26bSmrg    *:AIX:*:*)
667636c353eSmrg	GUESS=rs6000-ibm-aix
668636c353eSmrg	;;
669636c353eSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670636c353eSmrg	GUESS=romp-ibm-bsd4.4
671636c353eSmrg	;;
672e07dc26bSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673636c353eSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674636c353eSmrg	;;                                  # report: romp-ibm BSD 4.3
675e07dc26bSmrg    *:BOSX:*:*)
676636c353eSmrg	GUESS=rs6000-bull-bosx
677636c353eSmrg	;;
678e07dc26bSmrg    DPX/2?00:B.O.S.:*:*)
679636c353eSmrg	GUESS=m68k-bull-sysv3
680636c353eSmrg	;;
681e07dc26bSmrg    9000/[34]??:4.3bsd:1.*:*)
682636c353eSmrg	GUESS=m68k-hp-bsd
683636c353eSmrg	;;
684e07dc26bSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685636c353eSmrg	GUESS=m68k-hp-bsd4.4
686636c353eSmrg	;;
687e07dc26bSmrg    9000/[34678]??:HP-UX:*:*)
688636c353eSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689636c353eSmrg	case $UNAME_MACHINE in
690636c353eSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691636c353eSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
692e07dc26bSmrg	    9000/[678][0-9][0-9])
693636c353eSmrg		if test -x /usr/bin/getconf; then
694e07dc26bSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695e07dc26bSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696636c353eSmrg		    case $sc_cpu_version in
697e07dc26bSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698e07dc26bSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699e07dc26bSmrg		      532)                      # CPU_PA_RISC2_0
700636c353eSmrg			case $sc_kernel_bits in
701e07dc26bSmrg			  32) HP_ARCH=hppa2.0n ;;
702e07dc26bSmrg			  64) HP_ARCH=hppa2.0w ;;
703e07dc26bSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704e07dc26bSmrg			esac ;;
705e07dc26bSmrg		    esac
706e07dc26bSmrg		fi
707636c353eSmrg		if test "$HP_ARCH" = ""; then
708636c353eSmrg		    set_cc_for_build
709636c353eSmrg		    sed 's/^		//' << EOF > "$dummy.c"
710e07dc26bSmrg
711e07dc26bSmrg		#define _HPUX_SOURCE
712e07dc26bSmrg		#include <stdlib.h>
713e07dc26bSmrg		#include <unistd.h>
714e07dc26bSmrg
715e07dc26bSmrg		int main ()
716e07dc26bSmrg		{
717e07dc26bSmrg		#if defined(_SC_KERNEL_BITS)
718e07dc26bSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
719e07dc26bSmrg		#endif
720e07dc26bSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721e07dc26bSmrg
722e07dc26bSmrg		    switch (cpu)
723e07dc26bSmrg			{
724e07dc26bSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725e07dc26bSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726e07dc26bSmrg			case CPU_PA_RISC2_0:
727e07dc26bSmrg		#if defined(_SC_KERNEL_BITS)
728e07dc26bSmrg			    switch (bits)
729e07dc26bSmrg				{
730e07dc26bSmrg				case 64: puts ("hppa2.0w"); break;
731e07dc26bSmrg				case 32: puts ("hppa2.0n"); break;
732e07dc26bSmrg				default: puts ("hppa2.0"); break;
733e07dc26bSmrg				} break;
734e07dc26bSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
735e07dc26bSmrg			    puts ("hppa2.0"); break;
736e07dc26bSmrg		#endif
737e07dc26bSmrg			default: puts ("hppa1.0"); break;
738e07dc26bSmrg			}
739e07dc26bSmrg		    exit (0);
740e07dc26bSmrg		}
741e07dc26bSmrgEOF
742636c353eSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743e07dc26bSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744e07dc26bSmrg		fi ;;
745e07dc26bSmrg	esac
746636c353eSmrg	if test "$HP_ARCH" = hppa2.0w
747e07dc26bSmrg	then
748636c353eSmrg	    set_cc_for_build
749e07dc26bSmrg
750e07dc26bSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751e07dc26bSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752e07dc26bSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753e07dc26bSmrg	    #
754e07dc26bSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
755e07dc26bSmrg	    # => hppa2.0w-hp-hpux11.23
756e07dc26bSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757e07dc26bSmrg	    # => hppa64-hp-hpux11.23
758e07dc26bSmrg
759e07dc26bSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760e07dc26bSmrg		grep -q __LP64__
761e07dc26bSmrg	    then
762e07dc26bSmrg		HP_ARCH=hppa2.0w
763e07dc26bSmrg	    else
764e07dc26bSmrg		HP_ARCH=hppa64
765e07dc26bSmrg	    fi
766e07dc26bSmrg	fi
767636c353eSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768636c353eSmrg	;;
769e07dc26bSmrg    ia64:HP-UX:*:*)
770636c353eSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771636c353eSmrg	GUESS=ia64-hp-hpux$HPUX_REV
772636c353eSmrg	;;
773e07dc26bSmrg    3050*:HI-UX:*:*)
774636c353eSmrg	set_cc_for_build
775636c353eSmrg	sed 's/^	//' << EOF > "$dummy.c"
776e07dc26bSmrg	#include <unistd.h>
777e07dc26bSmrg	int
778e07dc26bSmrg	main ()
779e07dc26bSmrg	{
780e07dc26bSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
781e07dc26bSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782e07dc26bSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783e07dc26bSmrg	     results, however.  */
784e07dc26bSmrg	  if (CPU_IS_PA_RISC (cpu))
785e07dc26bSmrg	    {
786e07dc26bSmrg	      switch (cpu)
787e07dc26bSmrg		{
788e07dc26bSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789e07dc26bSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790e07dc26bSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791e07dc26bSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792e07dc26bSmrg		}
793e07dc26bSmrg	    }
794e07dc26bSmrg	  else if (CPU_IS_HP_MC68K (cpu))
795e07dc26bSmrg	    puts ("m68k-hitachi-hiuxwe2");
796e07dc26bSmrg	  else puts ("unknown-hitachi-hiuxwe2");
797e07dc26bSmrg	  exit (0);
798e07dc26bSmrg	}
799e07dc26bSmrgEOF
800636c353eSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801e07dc26bSmrg		{ echo "$SYSTEM_NAME"; exit; }
802636c353eSmrg	GUESS=unknown-hitachi-hiuxwe2
803636c353eSmrg	;;
804636c353eSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805636c353eSmrg	GUESS=hppa1.1-hp-bsd
806636c353eSmrg	;;
807e07dc26bSmrg    9000/8??:4.3bsd:*:*)
808636c353eSmrg	GUESS=hppa1.0-hp-bsd
809636c353eSmrg	;;
810e07dc26bSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811636c353eSmrg	GUESS=hppa1.0-hp-mpeix
812636c353eSmrg	;;
813636c353eSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814636c353eSmrg	GUESS=hppa1.1-hp-osf
815636c353eSmrg	;;
816e07dc26bSmrg    hp8??:OSF1:*:*)
817636c353eSmrg	GUESS=hppa1.0-hp-osf
818636c353eSmrg	;;
819e07dc26bSmrg    i*86:OSF1:*:*)
820636c353eSmrg	if test -x /usr/sbin/sysversion ; then
821636c353eSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822e07dc26bSmrg	else
823636c353eSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824e07dc26bSmrg	fi
825636c353eSmrg	;;
826e07dc26bSmrg    parisc*:Lites*:*:*)
827636c353eSmrg	GUESS=hppa1.1-hp-lites
828636c353eSmrg	;;
829e07dc26bSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830636c353eSmrg	GUESS=c1-convex-bsd
831636c353eSmrg	;;
832e07dc26bSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833e07dc26bSmrg	if getsysinfo -f scalar_acc
834e07dc26bSmrg	then echo c32-convex-bsd
835e07dc26bSmrg	else echo c2-convex-bsd
836e07dc26bSmrg	fi
837e07dc26bSmrg	exit ;;
838e07dc26bSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839636c353eSmrg	GUESS=c34-convex-bsd
840636c353eSmrg	;;
841e07dc26bSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842636c353eSmrg	GUESS=c38-convex-bsd
843636c353eSmrg	;;
844e07dc26bSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845636c353eSmrg	GUESS=c4-convex-bsd
846636c353eSmrg	;;
847e07dc26bSmrg    CRAY*Y-MP:*:*:*)
848636c353eSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849636c353eSmrg	GUESS=ymp-cray-unicos$CRAY_REL
850636c353eSmrg	;;
851e07dc26bSmrg    CRAY*[A-Z]90:*:*:*)
852636c353eSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853e07dc26bSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854e07dc26bSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855e07dc26bSmrg	      -e 's/\.[^.]*$/.X/'
856e07dc26bSmrg	exit ;;
857e07dc26bSmrg    CRAY*TS:*:*:*)
858636c353eSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859636c353eSmrg	GUESS=t90-cray-unicos$CRAY_REL
860636c353eSmrg	;;
861e07dc26bSmrg    CRAY*T3E:*:*:*)
862636c353eSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863636c353eSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864636c353eSmrg	;;
865e07dc26bSmrg    CRAY*SV1:*:*:*)
866636c353eSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867636c353eSmrg	GUESS=sv1-cray-unicos$CRAY_REL
868636c353eSmrg	;;
869e07dc26bSmrg    *:UNICOS/mp:*:*)
870636c353eSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871636c353eSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872636c353eSmrg	;;
873e07dc26bSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874e07dc26bSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875e07dc26bSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876636c353eSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877636c353eSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878636c353eSmrg	;;
879e07dc26bSmrg    5000:UNIX_System_V:4.*:*)
880e07dc26bSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881636c353eSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882636c353eSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883636c353eSmrg	;;
884e07dc26bSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885636c353eSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886636c353eSmrg	;;
887e07dc26bSmrg    sparc*:BSD/OS:*:*)
888636c353eSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889636c353eSmrg	;;
890e07dc26bSmrg    *:BSD/OS:*:*)
891636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892636c353eSmrg	;;
893636c353eSmrg    arm:FreeBSD:*:*)
894636c353eSmrg	UNAME_PROCESSOR=`uname -p`
895636c353eSmrg	set_cc_for_build
896636c353eSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897636c353eSmrg	    | grep -q __ARM_PCS_VFP
898636c353eSmrg	then
899636c353eSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900636c353eSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901636c353eSmrg	else
902636c353eSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903636c353eSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904636c353eSmrg	fi
905636c353eSmrg	;;
906e07dc26bSmrg    *:FreeBSD:*:*)
907e07dc26bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908636c353eSmrg	case $UNAME_PROCESSOR in
909e07dc26bSmrg	    amd64)
910636c353eSmrg		UNAME_PROCESSOR=x86_64 ;;
911636c353eSmrg	    i386)
912636c353eSmrg		UNAME_PROCESSOR=i586 ;;
913e07dc26bSmrg	esac
914636c353eSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915636c353eSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916636c353eSmrg	;;
917e07dc26bSmrg    i*:CYGWIN*:*)
918636c353eSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
919636c353eSmrg	;;
920e07dc26bSmrg    *:MINGW64*:*)
921636c353eSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
922636c353eSmrg	;;
923e07dc26bSmrg    *:MINGW*:*)
924636c353eSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
925636c353eSmrg	;;
926e07dc26bSmrg    *:MSYS*:*)
927636c353eSmrg	GUESS=$UNAME_MACHINE-pc-msys
928636c353eSmrg	;;
929e07dc26bSmrg    i*:PW*:*)
930636c353eSmrg	GUESS=$UNAME_MACHINE-pc-pw32
931636c353eSmrg	;;
932636c353eSmrg    *:SerenityOS:*:*)
933636c353eSmrg        GUESS=$UNAME_MACHINE-pc-serenity
934636c353eSmrg        ;;
935e07dc26bSmrg    *:Interix*:*)
936636c353eSmrg	case $UNAME_MACHINE in
937e07dc26bSmrg	    x86)
938636c353eSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
939636c353eSmrg		;;
940e07dc26bSmrg	    authenticamd | genuineintel | EM64T)
941636c353eSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
942636c353eSmrg		;;
943e07dc26bSmrg	    IA64)
944636c353eSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
945636c353eSmrg		;;
946e07dc26bSmrg	esac ;;
947e07dc26bSmrg    i*:UWIN*:*)
948636c353eSmrg	GUESS=$UNAME_MACHINE-pc-uwin
949636c353eSmrg	;;
950e07dc26bSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
951636c353eSmrg	GUESS=x86_64-pc-cygwin
952636c353eSmrg	;;
953e07dc26bSmrg    prep*:SunOS:5.*:*)
954636c353eSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
955636c353eSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
956636c353eSmrg	;;
957e07dc26bSmrg    *:GNU:*:*)
958e07dc26bSmrg	# the GNU system
959636c353eSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
960636c353eSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
961636c353eSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
962636c353eSmrg	;;
963e07dc26bSmrg    *:GNU/*:*:*)
964e07dc26bSmrg	# other systems with GNU libc and userland
965636c353eSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
966636c353eSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
967636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
968636c353eSmrg	;;
969636c353eSmrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
970636c353eSmrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
971636c353eSmrg	;;
972636c353eSmrg    *:[Mm]anagarm:*:*)
973636c353eSmrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
974636c353eSmrg	;;
975636c353eSmrg    *:Minix:*:*)
976636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-minix
977636c353eSmrg	;;
978636c353eSmrg    aarch64:Linux:*:*)
979636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
980636c353eSmrg	;;
981e07dc26bSmrg    aarch64_be:Linux:*:*)
982e07dc26bSmrg	UNAME_MACHINE=aarch64_be
983636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
984636c353eSmrg	;;
985e07dc26bSmrg    alpha:Linux:*:*)
986636c353eSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
987e07dc26bSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
988e07dc26bSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
989e07dc26bSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
990e07dc26bSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
991e07dc26bSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
992e07dc26bSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
993e07dc26bSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
994e07dc26bSmrg	esac
995e07dc26bSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
996e07dc26bSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
997636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
998636c353eSmrg	;;
999636c353eSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1000636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1001636c353eSmrg	;;
1002e07dc26bSmrg    arm*:Linux:*:*)
1003636c353eSmrg	set_cc_for_build
1004e07dc26bSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1005e07dc26bSmrg	    | grep -q __ARM_EABI__
1006e07dc26bSmrg	then
1007636c353eSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1008e07dc26bSmrg	else
1009e07dc26bSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1010e07dc26bSmrg		| grep -q __ARM_PCS_VFP
1011e07dc26bSmrg	    then
1012636c353eSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1013e07dc26bSmrg	    else
1014636c353eSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1015e07dc26bSmrg	    fi
1016e07dc26bSmrg	fi
1017636c353eSmrg	;;
1018e07dc26bSmrg    avr32*:Linux:*:*)
1019636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020636c353eSmrg	;;
1021e07dc26bSmrg    cris:Linux:*:*)
1022636c353eSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1023636c353eSmrg	;;
1024e07dc26bSmrg    crisv32:Linux:*:*)
1025636c353eSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1026636c353eSmrg	;;
1027e07dc26bSmrg    e2k:Linux:*:*)
1028636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1029636c353eSmrg	;;
1030e07dc26bSmrg    frv:Linux:*:*)
1031636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032636c353eSmrg	;;
1033e07dc26bSmrg    hexagon:Linux:*:*)
1034636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035636c353eSmrg	;;
1036e07dc26bSmrg    i*86:Linux:*:*)
1037636c353eSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1038636c353eSmrg	;;
1039e07dc26bSmrg    ia64:Linux:*:*)
1040636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041636c353eSmrg	;;
1042e07dc26bSmrg    k1om:Linux:*:*)
1043636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044636c353eSmrg	;;
1045636c353eSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1046636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1047636c353eSmrg	;;
1048e07dc26bSmrg    m32r*:Linux:*:*)
1049636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1050636c353eSmrg	;;
1051e07dc26bSmrg    m68*:Linux:*:*)
1052636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1053636c353eSmrg	;;
1054e07dc26bSmrg    mips:Linux:*:* | mips64:Linux:*:*)
1055636c353eSmrg	set_cc_for_build
1056636c353eSmrg	IS_GLIBC=0
1057636c353eSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1058636c353eSmrg	sed 's/^	//' << EOF > "$dummy.c"
1059e07dc26bSmrg	#undef CPU
1060636c353eSmrg	#undef mips
1061636c353eSmrg	#undef mipsel
1062636c353eSmrg	#undef mips64
1063636c353eSmrg	#undef mips64el
1064636c353eSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1065636c353eSmrg	LIBCABI=gnuabi64
1066636c353eSmrg	#else
1067636c353eSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1068636c353eSmrg	LIBCABI=gnuabin32
1069636c353eSmrg	#else
1070636c353eSmrg	LIBCABI=${LIBC}
1071636c353eSmrg	#endif
1072636c353eSmrg	#endif
1073636c353eSmrg
1074636c353eSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1075636c353eSmrg	CPU=mipsisa64r6
1076636c353eSmrg	#else
1077636c353eSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1078636c353eSmrg	CPU=mipsisa32r6
1079636c353eSmrg	#else
1080636c353eSmrg	#if defined(__mips64)
1081636c353eSmrg	CPU=mips64
1082636c353eSmrg	#else
1083636c353eSmrg	CPU=mips
1084636c353eSmrg	#endif
1085636c353eSmrg	#endif
1086636c353eSmrg	#endif
1087636c353eSmrg
1088e07dc26bSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1089636c353eSmrg	MIPS_ENDIAN=el
1090e07dc26bSmrg	#else
1091e07dc26bSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1092636c353eSmrg	MIPS_ENDIAN=
1093e07dc26bSmrg	#else
1094636c353eSmrg	MIPS_ENDIAN=
1095e07dc26bSmrg	#endif
1096e07dc26bSmrg	#endif
1097e07dc26bSmrgEOF
1098636c353eSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1099636c353eSmrg	eval "$cc_set_vars"
1100636c353eSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1101e07dc26bSmrg	;;
1102e07dc26bSmrg    mips64el:Linux:*:*)
1103636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1104636c353eSmrg	;;
1105e07dc26bSmrg    openrisc*:Linux:*:*)
1106636c353eSmrg	GUESS=or1k-unknown-linux-$LIBC
1107636c353eSmrg	;;
1108e07dc26bSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1109636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1110636c353eSmrg	;;
1111e07dc26bSmrg    padre:Linux:*:*)
1112636c353eSmrg	GUESS=sparc-unknown-linux-$LIBC
1113636c353eSmrg	;;
1114e07dc26bSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1115636c353eSmrg	GUESS=hppa64-unknown-linux-$LIBC
1116636c353eSmrg	;;
1117e07dc26bSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
1118e07dc26bSmrg	# Look for CPU level
1119e07dc26bSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1120636c353eSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1121636c353eSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1122636c353eSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1123e07dc26bSmrg	esac
1124636c353eSmrg	;;
1125e07dc26bSmrg    ppc64:Linux:*:*)
1126636c353eSmrg	GUESS=powerpc64-unknown-linux-$LIBC
1127636c353eSmrg	;;
1128e07dc26bSmrg    ppc:Linux:*:*)
1129636c353eSmrg	GUESS=powerpc-unknown-linux-$LIBC
1130636c353eSmrg	;;
1131e07dc26bSmrg    ppc64le:Linux:*:*)
1132636c353eSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
1133636c353eSmrg	;;
1134e07dc26bSmrg    ppcle:Linux:*:*)
1135636c353eSmrg	GUESS=powerpcle-unknown-linux-$LIBC
1136636c353eSmrg	;;
1137636c353eSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1138636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139636c353eSmrg	;;
1140e07dc26bSmrg    s390:Linux:*:* | s390x:Linux:*:*)
1141636c353eSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1142636c353eSmrg	;;
1143e07dc26bSmrg    sh64*:Linux:*:*)
1144636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145636c353eSmrg	;;
1146e07dc26bSmrg    sh*:Linux:*:*)
1147636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1148636c353eSmrg	;;
1149e07dc26bSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1150636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1151636c353eSmrg	;;
1152e07dc26bSmrg    tile*:Linux:*:*)
1153636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1154636c353eSmrg	;;
1155e07dc26bSmrg    vax:Linux:*:*)
1156636c353eSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1157636c353eSmrg	;;
1158e07dc26bSmrg    x86_64:Linux:*:*)
1159636c353eSmrg	set_cc_for_build
1160636c353eSmrg	CPU=$UNAME_MACHINE
1161636c353eSmrg	LIBCABI=$LIBC
1162636c353eSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1163636c353eSmrg	    ABI=64
1164636c353eSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
1165636c353eSmrg	    #ifdef __i386__
1166636c353eSmrg	    ABI=x86
1167636c353eSmrg	    #else
1168636c353eSmrg	    #ifdef __ILP32__
1169636c353eSmrg	    ABI=x32
1170636c353eSmrg	    #endif
1171636c353eSmrg	    #endif
1172636c353eSmrgEOF
1173636c353eSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1174636c353eSmrg	    eval "$cc_set_abi"
1175636c353eSmrg	    case $ABI in
1176636c353eSmrg		x86) CPU=i686 ;;
1177636c353eSmrg		x32) LIBCABI=${LIBC}x32 ;;
1178636c353eSmrg	    esac
1179636c353eSmrg	fi
1180636c353eSmrg	GUESS=$CPU-pc-linux-$LIBCABI
1181636c353eSmrg	;;
1182e07dc26bSmrg    xtensa*:Linux:*:*)
1183636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1184636c353eSmrg	;;
1185e07dc26bSmrg    i*86:DYNIX/ptx:4*:*)
1186e07dc26bSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1187e07dc26bSmrg	# earlier versions are messed up and put the nodename in both
1188e07dc26bSmrg	# sysname and nodename.
1189636c353eSmrg	GUESS=i386-sequent-sysv4
1190636c353eSmrg	;;
1191e07dc26bSmrg    i*86:UNIX_SV:4.2MP:2.*)
1192e07dc26bSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1193e07dc26bSmrg	# number series starting with 2...
1194e07dc26bSmrg	# I am not positive that other SVR4 systems won't match this,
1195e07dc26bSmrg	# I just have to hope.  -- rms.
1196e07dc26bSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1197636c353eSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1198636c353eSmrg	;;
1199e07dc26bSmrg    i*86:OS/2:*:*)
1200e07dc26bSmrg	# If we were able to find `uname', then EMX Unix compatibility
1201e07dc26bSmrg	# is probably installed.
1202636c353eSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1203636c353eSmrg	;;
1204e07dc26bSmrg    i*86:XTS-300:*:STOP)
1205636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-stop
1206636c353eSmrg	;;
1207e07dc26bSmrg    i*86:atheos:*:*)
1208636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
1209636c353eSmrg	;;
1210e07dc26bSmrg    i*86:syllable:*:*)
1211636c353eSmrg	GUESS=$UNAME_MACHINE-pc-syllable
1212636c353eSmrg	;;
1213e07dc26bSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1214636c353eSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1215636c353eSmrg	;;
1216e07dc26bSmrg    i*86:*DOS:*:*)
1217636c353eSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1218636c353eSmrg	;;
1219636c353eSmrg    i*86:*:4.*:*)
1220636c353eSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1221e07dc26bSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1222636c353eSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1223e07dc26bSmrg	else
1224636c353eSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1225e07dc26bSmrg	fi
1226636c353eSmrg	;;
1227e07dc26bSmrg    i*86:*:5:[678]*)
1228e07dc26bSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1229e07dc26bSmrg	case `/bin/uname -X | grep "^Machine"` in
1230e07dc26bSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1231e07dc26bSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1232e07dc26bSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1233e07dc26bSmrg	esac
1234636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1235636c353eSmrg	;;
1236e07dc26bSmrg    i*86:*:3.2:*)
1237e07dc26bSmrg	if test -f /usr/options/cb.name; then
1238e07dc26bSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1239636c353eSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1240e07dc26bSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1241e07dc26bSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1242e07dc26bSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1243e07dc26bSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1244e07dc26bSmrg			&& UNAME_MACHINE=i586
1245e07dc26bSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1246e07dc26bSmrg			&& UNAME_MACHINE=i686
1247e07dc26bSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1248e07dc26bSmrg			&& UNAME_MACHINE=i686
1249636c353eSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1250e07dc26bSmrg	else
1251636c353eSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
1252e07dc26bSmrg	fi
1253636c353eSmrg	;;
1254e07dc26bSmrg    pc:*:*:*)
1255e07dc26bSmrg	# Left here for compatibility:
1256e07dc26bSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1257e07dc26bSmrg	# the processor, so we play safe by assuming i586.
1258e07dc26bSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1259e07dc26bSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1260e07dc26bSmrg	# this is a cross-build.
1261636c353eSmrg	GUESS=i586-pc-msdosdjgpp
1262636c353eSmrg	;;
1263e07dc26bSmrg    Intel:Mach:3*:*)
1264636c353eSmrg	GUESS=i386-pc-mach3
1265636c353eSmrg	;;
1266e07dc26bSmrg    paragon:*:*:*)
1267636c353eSmrg	GUESS=i860-intel-osf1
1268636c353eSmrg	;;
1269e07dc26bSmrg    i860:*:4.*:*) # i860-SVR4
1270e07dc26bSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1271636c353eSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1272e07dc26bSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1273636c353eSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1274e07dc26bSmrg	fi
1275636c353eSmrg	;;
1276e07dc26bSmrg    mini*:CTIX:SYS*5:*)
1277e07dc26bSmrg	# "miniframe"
1278636c353eSmrg	GUESS=m68010-convergent-sysv
1279636c353eSmrg	;;
1280e07dc26bSmrg    mc68k:UNIX:SYSTEM5:3.51m)
1281636c353eSmrg	GUESS=m68k-convergent-sysv
1282636c353eSmrg	;;
1283e07dc26bSmrg    M680?0:D-NIX:5.3:*)
1284636c353eSmrg	GUESS=m68k-diab-dnix
1285636c353eSmrg	;;
1286e07dc26bSmrg    M68*:*:R3V[5678]*:*)
1287e07dc26bSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1288e07dc26bSmrg    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)
1289e07dc26bSmrg	OS_REL=''
1290e07dc26bSmrg	test -r /etc/.relid \
1291e07dc26bSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1292e07dc26bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1293636c353eSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1294e07dc26bSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1295636c353eSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1296e07dc26bSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1297e07dc26bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1298e07dc26bSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1299e07dc26bSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1300e07dc26bSmrg	OS_REL='.3'
1301e07dc26bSmrg	test -r /etc/.relid \
1302e07dc26bSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1303e07dc26bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1304636c353eSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1305e07dc26bSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1306636c353eSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1307e07dc26bSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1308636c353eSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1309e07dc26bSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1310636c353eSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1311636c353eSmrg	;;
1312e07dc26bSmrg    mc68030:UNIX_System_V:4.*:*)
1313636c353eSmrg	GUESS=m68k-atari-sysv4
1314636c353eSmrg	;;
1315e07dc26bSmrg    TSUNAMI:LynxOS:2.*:*)
1316636c353eSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1317636c353eSmrg	;;
1318e07dc26bSmrg    rs6000:LynxOS:2.*:*)
1319636c353eSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1320636c353eSmrg	;;
1321e07dc26bSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1322636c353eSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1323636c353eSmrg	;;
1324e07dc26bSmrg    SM[BE]S:UNIX_SV:*:*)
1325636c353eSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1326636c353eSmrg	;;
1327e07dc26bSmrg    RM*:ReliantUNIX-*:*:*)
1328636c353eSmrg	GUESS=mips-sni-sysv4
1329636c353eSmrg	;;
1330e07dc26bSmrg    RM*:SINIX-*:*:*)
1331636c353eSmrg	GUESS=mips-sni-sysv4
1332636c353eSmrg	;;
1333e07dc26bSmrg    *:SINIX-*:*:*)
1334e07dc26bSmrg	if uname -p 2>/dev/null >/dev/null ; then
1335e07dc26bSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1336636c353eSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
1337e07dc26bSmrg	else
1338636c353eSmrg		GUESS=ns32k-sni-sysv
1339e07dc26bSmrg	fi
1340636c353eSmrg	;;
1341e07dc26bSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1342e07dc26bSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1343636c353eSmrg	GUESS=i586-unisys-sysv4
1344636c353eSmrg	;;
1345e07dc26bSmrg    *:UNIX_System_V:4*:FTX*)
1346e07dc26bSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1347e07dc26bSmrg	# How about differentiating between stratus architectures? -djm
1348636c353eSmrg	GUESS=hppa1.1-stratus-sysv4
1349636c353eSmrg	;;
1350e07dc26bSmrg    *:*:*:FTX*)
1351e07dc26bSmrg	# From seanf@swdc.stratus.com.
1352636c353eSmrg	GUESS=i860-stratus-sysv4
1353636c353eSmrg	;;
1354e07dc26bSmrg    i*86:VOS:*:*)
1355e07dc26bSmrg	# From Paul.Green@stratus.com.
1356636c353eSmrg	GUESS=$UNAME_MACHINE-stratus-vos
1357636c353eSmrg	;;
1358e07dc26bSmrg    *:VOS:*:*)
1359e07dc26bSmrg	# From Paul.Green@stratus.com.
1360636c353eSmrg	GUESS=hppa1.1-stratus-vos
1361636c353eSmrg	;;
1362e07dc26bSmrg    mc68*:A/UX:*:*)
1363636c353eSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1364636c353eSmrg	;;
1365e07dc26bSmrg    news*:NEWS-OS:6*:*)
1366636c353eSmrg	GUESS=mips-sony-newsos6
1367636c353eSmrg	;;
1368e07dc26bSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1369636c353eSmrg	if test -d /usr/nec; then
1370636c353eSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1371e07dc26bSmrg	else
1372636c353eSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1373e07dc26bSmrg	fi
1374636c353eSmrg	;;
1375e07dc26bSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1376636c353eSmrg	GUESS=powerpc-be-beos
1377636c353eSmrg	;;
1378e07dc26bSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1379636c353eSmrg	GUESS=powerpc-apple-beos
1380636c353eSmrg	;;
1381e07dc26bSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1382636c353eSmrg	GUESS=i586-pc-beos
1383636c353eSmrg	;;
1384e07dc26bSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1385636c353eSmrg	GUESS=i586-pc-haiku
1386636c353eSmrg	;;
1387636c353eSmrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1388636c353eSmrg	GUESS=powerpc-apple-haiku
1389636c353eSmrg	;;
1390636c353eSmrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1391636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-haiku
1392636c353eSmrg	;;
1393e07dc26bSmrg    SX-4:SUPER-UX:*:*)
1394636c353eSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1395636c353eSmrg	;;
1396e07dc26bSmrg    SX-5:SUPER-UX:*:*)
1397636c353eSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1398636c353eSmrg	;;
1399e07dc26bSmrg    SX-6:SUPER-UX:*:*)
1400636c353eSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1401636c353eSmrg	;;
1402e07dc26bSmrg    SX-7:SUPER-UX:*:*)
1403636c353eSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1404636c353eSmrg	;;
1405e07dc26bSmrg    SX-8:SUPER-UX:*:*)
1406636c353eSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1407636c353eSmrg	;;
1408e07dc26bSmrg    SX-8R:SUPER-UX:*:*)
1409636c353eSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1410636c353eSmrg	;;
1411e07dc26bSmrg    SX-ACE:SUPER-UX:*:*)
1412636c353eSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1413636c353eSmrg	;;
1414e07dc26bSmrg    Power*:Rhapsody:*:*)
1415636c353eSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1416636c353eSmrg	;;
1417e07dc26bSmrg    *:Rhapsody:*:*)
1418636c353eSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1419636c353eSmrg	;;
1420636c353eSmrg    arm64:Darwin:*:*)
1421636c353eSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1422636c353eSmrg	;;
1423e07dc26bSmrg    *:Darwin:*:*)
1424636c353eSmrg	UNAME_PROCESSOR=`uname -p`
1425636c353eSmrg	case $UNAME_PROCESSOR in
1426636c353eSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1427636c353eSmrg	esac
1428636c353eSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1429636c353eSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1430636c353eSmrg	    # Avoid executing cc if there is no toolchain installed as
1431636c353eSmrg	    # cc will be a stub that puts up a graphical alert
1432636c353eSmrg	    # prompting the user to install developer tools.
1433636c353eSmrg	    CC_FOR_BUILD=no_compiler_found
1434636c353eSmrg	else
1435636c353eSmrg	    set_cc_for_build
1436e07dc26bSmrg	fi
1437636c353eSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1438636c353eSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1439636c353eSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1440636c353eSmrg		   grep IS_64BIT_ARCH >/dev/null
1441636c353eSmrg	    then
1442636c353eSmrg		case $UNAME_PROCESSOR in
1443636c353eSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1444636c353eSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1445636c353eSmrg		esac
1446636c353eSmrg	    fi
1447636c353eSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1448636c353eSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1449636c353eSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1450636c353eSmrg		   grep IS_PPC >/dev/null
1451636c353eSmrg	    then
1452636c353eSmrg		UNAME_PROCESSOR=powerpc
1453e07dc26bSmrg	    fi
1454e07dc26bSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1455636c353eSmrg	    # uname -m returns i386 or x86_64
1456636c353eSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1457e07dc26bSmrg	fi
1458636c353eSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1459636c353eSmrg	;;
1460e07dc26bSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1461e07dc26bSmrg	UNAME_PROCESSOR=`uname -p`
1462e07dc26bSmrg	if test "$UNAME_PROCESSOR" = x86; then
1463e07dc26bSmrg		UNAME_PROCESSOR=i386
1464e07dc26bSmrg		UNAME_MACHINE=pc
1465e07dc26bSmrg	fi
1466636c353eSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1467636c353eSmrg	;;
1468e07dc26bSmrg    *:QNX:*:4*)
1469636c353eSmrg	GUESS=i386-pc-qnx
1470636c353eSmrg	;;
1471636c353eSmrg    NEO-*:NONSTOP_KERNEL:*:*)
1472636c353eSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1473636c353eSmrg	;;
1474e07dc26bSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1475636c353eSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1476636c353eSmrg	;;
1477636c353eSmrg    NSR-*:NONSTOP_KERNEL:*:*)
1478636c353eSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1479636c353eSmrg	;;
1480636c353eSmrg    NSV-*:NONSTOP_KERNEL:*:*)
1481636c353eSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1482636c353eSmrg	;;
1483636c353eSmrg    NSX-*:NONSTOP_KERNEL:*:*)
1484636c353eSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1485636c353eSmrg	;;
1486e07dc26bSmrg    *:NonStop-UX:*:*)
1487636c353eSmrg	GUESS=mips-compaq-nonstopux
1488636c353eSmrg	;;
1489e07dc26bSmrg    BS2000:POSIX*:*:*)
1490636c353eSmrg	GUESS=bs2000-siemens-sysv
1491636c353eSmrg	;;
1492e07dc26bSmrg    DS/*:UNIX_System_V:*:*)
1493636c353eSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1494636c353eSmrg	;;
1495e07dc26bSmrg    *:Plan9:*:*)
1496e07dc26bSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1497e07dc26bSmrg	# is converted to i386 for consistency with other x86
1498e07dc26bSmrg	# operating systems.
1499636c353eSmrg	if test "${cputype-}" = 386; then
1500e07dc26bSmrg	    UNAME_MACHINE=i386
1501636c353eSmrg	elif test "x${cputype-}" != x; then
1502636c353eSmrg	    UNAME_MACHINE=$cputype
1503e07dc26bSmrg	fi
1504636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
1505636c353eSmrg	;;
1506e07dc26bSmrg    *:TOPS-10:*:*)
1507636c353eSmrg	GUESS=pdp10-unknown-tops10
1508636c353eSmrg	;;
1509e07dc26bSmrg    *:TENEX:*:*)
1510636c353eSmrg	GUESS=pdp10-unknown-tenex
1511636c353eSmrg	;;
1512e07dc26bSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1513636c353eSmrg	GUESS=pdp10-dec-tops20
1514636c353eSmrg	;;
1515e07dc26bSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1516636c353eSmrg	GUESS=pdp10-xkl-tops20
1517636c353eSmrg	;;
1518e07dc26bSmrg    *:TOPS-20:*:*)
1519636c353eSmrg	GUESS=pdp10-unknown-tops20
1520636c353eSmrg	;;
1521e07dc26bSmrg    *:ITS:*:*)
1522636c353eSmrg	GUESS=pdp10-unknown-its
1523636c353eSmrg	;;
1524e07dc26bSmrg    SEI:*:*:SEIUX)
1525636c353eSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1526636c353eSmrg	;;
1527e07dc26bSmrg    *:DragonFly:*:*)
1528636c353eSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1529636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1530636c353eSmrg	;;
1531e07dc26bSmrg    *:*VMS:*:*)
1532e07dc26bSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1533636c353eSmrg	case $UNAME_MACHINE in
1534636c353eSmrg	    A*) GUESS=alpha-dec-vms ;;
1535636c353eSmrg	    I*) GUESS=ia64-dec-vms ;;
1536636c353eSmrg	    V*) GUESS=vax-dec-vms ;;
1537e07dc26bSmrg	esac ;;
1538e07dc26bSmrg    *:XENIX:*:SysV)
1539636c353eSmrg	GUESS=i386-pc-xenix
1540636c353eSmrg	;;
1541e07dc26bSmrg    i*86:skyos:*:*)
1542636c353eSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1543636c353eSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1544636c353eSmrg	;;
1545e07dc26bSmrg    i*86:rdos:*:*)
1546636c353eSmrg	GUESS=$UNAME_MACHINE-pc-rdos
1547636c353eSmrg	;;
1548636c353eSmrg    i*86:Fiwix:*:*)
1549636c353eSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
1550636c353eSmrg	;;
1551636c353eSmrg    *:AROS:*:*)
1552636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-aros
1553636c353eSmrg	;;
1554e07dc26bSmrg    x86_64:VMkernel:*:*)
1555636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-esx
1556636c353eSmrg	;;
1557e07dc26bSmrg    amd64:Isilon\ OneFS:*:*)
1558636c353eSmrg	GUESS=x86_64-unknown-onefs
1559636c353eSmrg	;;
1560636c353eSmrg    *:Unleashed:*:*)
1561636c353eSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1562636c353eSmrg	;;
1563636c353eSmrgesac
1564636c353eSmrg
1565636c353eSmrg# Do we have a guess based on uname results?
1566636c353eSmrgif test "x$GUESS" != x; then
1567636c353eSmrg    echo "$GUESS"
1568636c353eSmrg    exit
1569636c353eSmrgfi
1570636c353eSmrg
1571636c353eSmrg# No uname command or uname output not recognized.
1572636c353eSmrgset_cc_for_build
1573636c353eSmrgcat > "$dummy.c" <<EOF
1574636c353eSmrg#ifdef _SEQUENT_
1575636c353eSmrg#include <sys/types.h>
1576636c353eSmrg#include <sys/utsname.h>
1577636c353eSmrg#endif
1578636c353eSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1579636c353eSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1580636c353eSmrg#include <signal.h>
1581636c353eSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1582636c353eSmrg#include <sys/utsname.h>
1583636c353eSmrg#endif
1584636c353eSmrg#endif
1585636c353eSmrg#endif
1586636c353eSmrgmain ()
1587636c353eSmrg{
1588636c353eSmrg#if defined (sony)
1589636c353eSmrg#if defined (MIPSEB)
1590636c353eSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1591636c353eSmrg     I don't know....  */
1592636c353eSmrg  printf ("mips-sony-bsd\n"); exit (0);
1593636c353eSmrg#else
1594636c353eSmrg#include <sys/param.h>
1595636c353eSmrg  printf ("m68k-sony-newsos%s\n",
1596636c353eSmrg#ifdef NEWSOS4
1597636c353eSmrg  "4"
1598636c353eSmrg#else
1599636c353eSmrg  ""
1600636c353eSmrg#endif
1601636c353eSmrg  ); exit (0);
1602636c353eSmrg#endif
1603636c353eSmrg#endif
1604636c353eSmrg
1605636c353eSmrg#if defined (NeXT)
1606636c353eSmrg#if !defined (__ARCHITECTURE__)
1607636c353eSmrg#define __ARCHITECTURE__ "m68k"
1608636c353eSmrg#endif
1609636c353eSmrg  int version;
1610636c353eSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1611636c353eSmrg  if (version < 4)
1612636c353eSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1613636c353eSmrg  else
1614636c353eSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1615636c353eSmrg  exit (0);
1616636c353eSmrg#endif
1617636c353eSmrg
1618636c353eSmrg#if defined (MULTIMAX) || defined (n16)
1619636c353eSmrg#if defined (UMAXV)
1620636c353eSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
1621636c353eSmrg#else
1622636c353eSmrg#if defined (CMU)
1623636c353eSmrg  printf ("ns32k-encore-mach\n"); exit (0);
1624636c353eSmrg#else
1625636c353eSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
1626636c353eSmrg#endif
1627636c353eSmrg#endif
1628636c353eSmrg#endif
1629636c353eSmrg
1630636c353eSmrg#if defined (__386BSD__)
1631636c353eSmrg  printf ("i386-pc-bsd\n"); exit (0);
1632636c353eSmrg#endif
1633636c353eSmrg
1634636c353eSmrg#if defined (sequent)
1635636c353eSmrg#if defined (i386)
1636636c353eSmrg  printf ("i386-sequent-dynix\n"); exit (0);
1637636c353eSmrg#endif
1638636c353eSmrg#if defined (ns32000)
1639636c353eSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1640636c353eSmrg#endif
1641636c353eSmrg#endif
1642636c353eSmrg
1643636c353eSmrg#if defined (_SEQUENT_)
1644636c353eSmrg  struct utsname un;
1645636c353eSmrg
1646636c353eSmrg  uname(&un);
1647636c353eSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1648636c353eSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1649636c353eSmrg  }
1650636c353eSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1651636c353eSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1652636c353eSmrg  }
1653636c353eSmrg  printf ("i386-sequent-ptx\n"); exit (0);
1654636c353eSmrg#endif
1655636c353eSmrg
1656636c353eSmrg#if defined (vax)
1657636c353eSmrg#if !defined (ultrix)
1658636c353eSmrg#include <sys/param.h>
1659636c353eSmrg#if defined (BSD)
1660636c353eSmrg#if BSD == 43
1661636c353eSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1662636c353eSmrg#else
1663636c353eSmrg#if BSD == 199006
1664636c353eSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1665636c353eSmrg#else
1666636c353eSmrg  printf ("vax-dec-bsd\n"); exit (0);
1667636c353eSmrg#endif
1668636c353eSmrg#endif
1669636c353eSmrg#else
1670636c353eSmrg  printf ("vax-dec-bsd\n"); exit (0);
1671636c353eSmrg#endif
1672636c353eSmrg#else
1673636c353eSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1674636c353eSmrg  struct utsname un;
1675636c353eSmrg  uname (&un);
1676636c353eSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1677636c353eSmrg#else
1678636c353eSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1679636c353eSmrg#endif
1680636c353eSmrg#endif
1681636c353eSmrg#endif
1682636c353eSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1683636c353eSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1684636c353eSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1685636c353eSmrg  struct utsname *un;
1686636c353eSmrg  uname (&un);
1687636c353eSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1688636c353eSmrg#else
1689636c353eSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1690636c353eSmrg#endif
1691636c353eSmrg#endif
1692636c353eSmrg#endif
1693636c353eSmrg
1694636c353eSmrg#if defined (alliant) && defined (i860)
1695636c353eSmrg  printf ("i860-alliant-bsd\n"); exit (0);
1696636c353eSmrg#endif
1697636c353eSmrg
1698636c353eSmrg  exit (1);
1699636c353eSmrg}
1700636c353eSmrgEOF
1701636c353eSmrg
1702636c353eSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1703636c353eSmrg	{ echo "$SYSTEM_NAME"; exit; }
1704636c353eSmrg
1705636c353eSmrg# Apollos put the system type in the environment.
1706636c353eSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1707636c353eSmrg
1708636c353eSmrgecho "$0: unable to guess system type" >&2
1709636c353eSmrg
1710636c353eSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1711636c353eSmrg    mips:Linux | mips64:Linux)
1712636c353eSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1713636c353eSmrg	cat >&2 <<EOF
1714636c353eSmrg
1715636c353eSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1716636c353eSmrgthe system type. Please install a C compiler and try again.
1717636c353eSmrgEOF
1718636c353eSmrg	;;
1719e07dc26bSmrgesac
1720e07dc26bSmrg
1721e07dc26bSmrgcat >&2 <<EOF
1722e07dc26bSmrg
1723e07dc26bSmrgThis script (version $timestamp), has failed to recognize the
1724636c353eSmrgoperating system you are using. If your script is old, overwrite *all*
1725636c353eSmrgcopies of config.guess and config.sub with the latest versions from:
1726e07dc26bSmrg
1727636c353eSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1728e07dc26bSmrgand
1729636c353eSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1730636c353eSmrgEOF
1731636c353eSmrg
1732636c353eSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
1733636c353eSmrgthisyear=`date +%Y`
1734636c353eSmrg# shellcheck disable=SC2003
1735636c353eSmrgscript_age=`expr "$thisyear" - "$our_year"`
1736636c353eSmrgif test "$script_age" -lt 3 ; then
1737636c353eSmrg   cat >&2 <<EOF
1738e07dc26bSmrg
1739e07dc26bSmrgIf $0 has already been updated, send the following data and any
1740e07dc26bSmrginformation you think might be pertinent to config-patches@gnu.org to
1741e07dc26bSmrgprovide the necessary information to handle your system.
1742e07dc26bSmrg
1743e07dc26bSmrgconfig.guess timestamp = $timestamp
1744e07dc26bSmrg
1745e07dc26bSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1746e07dc26bSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1747e07dc26bSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1748e07dc26bSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1749e07dc26bSmrg
1750e07dc26bSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1751e07dc26bSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1752e07dc26bSmrg
1753e07dc26bSmrghostinfo               = `(hostinfo) 2>/dev/null`
1754e07dc26bSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1755e07dc26bSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1756e07dc26bSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1757e07dc26bSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1758e07dc26bSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1759e07dc26bSmrg
1760636c353eSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1761636c353eSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1762636c353eSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1763636c353eSmrgUNAME_VERSION = "$UNAME_VERSION"
1764e07dc26bSmrgEOF
1765636c353eSmrgfi
1766e07dc26bSmrg
1767e07dc26bSmrgexit 1
1768e07dc26bSmrg
1769e07dc26bSmrg# Local variables:
1770636c353eSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
1771e07dc26bSmrg# time-stamp-start: "timestamp='"
1772e07dc26bSmrg# time-stamp-format: "%:y-%02m-%02d"
1773e07dc26bSmrg# time-stamp-end: "'"
1774e07dc26bSmrg# End:
1775