xref: /netbsd-src/external/bsd/file/dist/config.guess (revision ddb176824c39fb0db5ceef3e9e40dcaa273aec38)
1c20607aeSchristos#! /bin/sh
2c20607aeSchristos# Attempt to guess a canonical system name.
3c20607aeSchristos#   Copyright 1992-2021 Free Software Foundation, Inc.
4c20607aeSchristos
5c20607aeSchristos# shellcheck disable=SC2006,SC2268 # see below for rationale
6c20607aeSchristos
7c20607aeSchristostimestamp='2021-06-03'
8c20607aeSchristos
9c20607aeSchristos# This file is free software; you can redistribute it and/or modify it
10c20607aeSchristos# under the terms of the GNU General Public License as published by
11c20607aeSchristos# the Free Software Foundation; either version 3 of the License, or
12c20607aeSchristos# (at your option) any later version.
13c20607aeSchristos#
14c20607aeSchristos# This program is distributed in the hope that it will be useful, but
15c20607aeSchristos# WITHOUT ANY WARRANTY; without even the implied warranty of
16c20607aeSchristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17c20607aeSchristos# General Public License for more details.
18c20607aeSchristos#
19c20607aeSchristos# You should have received a copy of the GNU General Public License
20c20607aeSchristos# along with this program; if not, see <https://www.gnu.org/licenses/>.
21c20607aeSchristos#
22c20607aeSchristos# As a special exception to the GNU General Public License, if you
23c20607aeSchristos# distribute this file as part of a program that contains a
24c20607aeSchristos# configuration script generated by Autoconf, you may include it under
25c20607aeSchristos# the same distribution terms that you use for the rest of that
26c20607aeSchristos# program.  This Exception is an additional permission under section 7
27c20607aeSchristos# of the GNU General Public License, version 3 ("GPLv3").
28c20607aeSchristos#
29c20607aeSchristos# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30c20607aeSchristos#
31c20607aeSchristos# You can get the latest version of this script from:
32c20607aeSchristos# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33c20607aeSchristos#
34c20607aeSchristos# Please send patches to <config-patches@gnu.org>.
35c20607aeSchristos
36c20607aeSchristos
37c20607aeSchristos# The "shellcheck disable" line above the timestamp inhibits complaints
38c20607aeSchristos# about features and limitations of the classic Bourne shell that were
39c20607aeSchristos# superseded or lifted in POSIX.  However, this script identifies a wide
40c20607aeSchristos# variety of pre-POSIX systems that do not have POSIX shells at all, and
41c20607aeSchristos# even some reasonably current systems (Solaris 10 as case-in-point) still
42c20607aeSchristos# have a pre-POSIX /bin/sh.
43c20607aeSchristos
44c20607aeSchristos
45c20607aeSchristosme=`echo "$0" | sed -e 's,.*/,,'`
46c20607aeSchristos
47c20607aeSchristosusage="\
48c20607aeSchristosUsage: $0 [OPTION]
49c20607aeSchristos
50c20607aeSchristosOutput the configuration name of the system \`$me' is run on.
51c20607aeSchristos
52c20607aeSchristosOptions:
53c20607aeSchristos  -h, --help         print this help, then exit
54c20607aeSchristos  -t, --time-stamp   print date of last modification, then exit
55c20607aeSchristos  -v, --version      print version number, then exit
56c20607aeSchristos
57c20607aeSchristosReport bugs and patches to <config-patches@gnu.org>."
58c20607aeSchristos
59c20607aeSchristosversion="\
60c20607aeSchristosGNU config.guess ($timestamp)
61c20607aeSchristos
62c20607aeSchristosOriginally written by Per Bothner.
63c20607aeSchristosCopyright 1992-2021 Free Software Foundation, Inc.
64c20607aeSchristos
65c20607aeSchristosThis is free software; see the source for copying conditions.  There is NO
66c20607aeSchristoswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67c20607aeSchristos
68c20607aeSchristoshelp="
69c20607aeSchristosTry \`$me --help' for more information."
70c20607aeSchristos
71c20607aeSchristos# Parse command line
72c20607aeSchristoswhile test $# -gt 0 ; do
73c20607aeSchristos  case $1 in
74c20607aeSchristos    --time-stamp | --time* | -t )
75c20607aeSchristos       echo "$timestamp" ; exit ;;
76c20607aeSchristos    --version | -v )
77c20607aeSchristos       echo "$version" ; exit ;;
78c20607aeSchristos    --help | --h* | -h )
79c20607aeSchristos       echo "$usage"; exit ;;
80c20607aeSchristos    -- )     # Stop option processing
81c20607aeSchristos       shift; break ;;
82c20607aeSchristos    - )	# Use stdin as input.
83c20607aeSchristos       break ;;
84c20607aeSchristos    -* )
85c20607aeSchristos       echo "$me: invalid option $1$help" >&2
86c20607aeSchristos       exit 1 ;;
87c20607aeSchristos    * )
88c20607aeSchristos       break ;;
89c20607aeSchristos  esac
90c20607aeSchristosdone
91c20607aeSchristos
92c20607aeSchristosif test $# != 0; then
93c20607aeSchristos  echo "$me: too many arguments$help" >&2
94c20607aeSchristos  exit 1
95c20607aeSchristosfi
96c20607aeSchristos
97c20607aeSchristos# Just in case it came from the environment.
98c20607aeSchristosGUESS=
99c20607aeSchristos
100c20607aeSchristos# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101c20607aeSchristos# compiler to aid in system detection is discouraged as it requires
102c20607aeSchristos# temporary files to be created and, as you can see below, it is a
103c20607aeSchristos# headache to deal with in a portable fashion.
104c20607aeSchristos
105c20607aeSchristos# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106c20607aeSchristos# use `HOST_CC' if defined, but it is deprecated.
107c20607aeSchristos
108c20607aeSchristos# Portable tmp directory creation inspired by the Autoconf team.
109c20607aeSchristos
110c20607aeSchristostmp=
111c20607aeSchristos# shellcheck disable=SC2172
112c20607aeSchristostrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113c20607aeSchristos
114c20607aeSchristosset_cc_for_build() {
115c20607aeSchristos    # prevent multiple calls if $tmp is already set
116c20607aeSchristos    test "$tmp" && return 0
117c20607aeSchristos    : "${TMPDIR=/tmp}"
118c20607aeSchristos    # shellcheck disable=SC2039,SC3028
119c20607aeSchristos    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120c20607aeSchristos	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121c20607aeSchristos	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122c20607aeSchristos	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123c20607aeSchristos    dummy=$tmp/dummy
124c20607aeSchristos    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125c20607aeSchristos	,,)    echo "int x;" > "$dummy.c"
126c20607aeSchristos	       for driver in cc gcc c89 c99 ; do
127c20607aeSchristos		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128c20607aeSchristos		       CC_FOR_BUILD=$driver
129c20607aeSchristos		       break
130c20607aeSchristos		   fi
131c20607aeSchristos	       done
132c20607aeSchristos	       if test x"$CC_FOR_BUILD" = x ; then
133c20607aeSchristos		   CC_FOR_BUILD=no_compiler_found
134c20607aeSchristos	       fi
135c20607aeSchristos	       ;;
136c20607aeSchristos	,,*)   CC_FOR_BUILD=$CC ;;
137c20607aeSchristos	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138c20607aeSchristos    esac
139c20607aeSchristos}
140c20607aeSchristos
141c20607aeSchristos# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142c20607aeSchristos# (ghazi@noc.rutgers.edu 1994-08-24)
143c20607aeSchristosif test -f /.attbin/uname ; then
144c20607aeSchristos	PATH=$PATH:/.attbin ; export PATH
145c20607aeSchristosfi
146c20607aeSchristos
147c20607aeSchristosUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148c20607aeSchristosUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149c20607aeSchristosUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150c20607aeSchristosUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151c20607aeSchristos
152c20607aeSchristoscase $UNAME_SYSTEM in
153c20607aeSchristosLinux|GNU|GNU/*)
154c20607aeSchristos	LIBC=unknown
155c20607aeSchristos
156c20607aeSchristos	set_cc_for_build
157c20607aeSchristos	cat <<-EOF > "$dummy.c"
158c20607aeSchristos	#include <features.h>
159c20607aeSchristos	#if defined(__UCLIBC__)
160c20607aeSchristos	LIBC=uclibc
161c20607aeSchristos	#elif defined(__dietlibc__)
162c20607aeSchristos	LIBC=dietlibc
163c20607aeSchristos	#elif defined(__GLIBC__)
164c20607aeSchristos	LIBC=gnu
165c20607aeSchristos	#else
166c20607aeSchristos	#include <stdarg.h>
167c20607aeSchristos	/* First heuristic to detect musl libc.  */
168c20607aeSchristos	#ifdef __DEFINED_va_list
169c20607aeSchristos	LIBC=musl
170c20607aeSchristos	#endif
171c20607aeSchristos	#endif
172c20607aeSchristos	EOF
173c20607aeSchristos	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174c20607aeSchristos	eval "$cc_set_libc"
175c20607aeSchristos
176c20607aeSchristos	# Second heuristic to detect musl libc.
177c20607aeSchristos	if [ "$LIBC" = unknown ] &&
178c20607aeSchristos	   command -v ldd >/dev/null &&
179c20607aeSchristos	   ldd --version 2>&1 | grep -q ^musl; then
180c20607aeSchristos		LIBC=musl
181c20607aeSchristos	fi
182c20607aeSchristos
183c20607aeSchristos	# If the system lacks a compiler, then just pick glibc.
184c20607aeSchristos	# We could probably try harder.
185c20607aeSchristos	if [ "$LIBC" = unknown ]; then
186c20607aeSchristos		LIBC=gnu
187c20607aeSchristos	fi
188c20607aeSchristos	;;
189c20607aeSchristosesac
190c20607aeSchristos
191c20607aeSchristos# Note: order is significant - the case branches are not exclusive.
192c20607aeSchristos
193c20607aeSchristoscase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194c20607aeSchristos    *:NetBSD:*:*)
195c20607aeSchristos	# NetBSD (nbsd) targets should (where applicable) match one or
196c20607aeSchristos	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197c20607aeSchristos	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198c20607aeSchristos	# switched to ELF, *-*-netbsd* would select the old
199c20607aeSchristos	# object file format.  This provides both forward
200c20607aeSchristos	# compatibility and a consistent mechanism for selecting the
201c20607aeSchristos	# object file format.
202c20607aeSchristos	#
203c20607aeSchristos	# Note: NetBSD doesn't particularly care about the vendor
204c20607aeSchristos	# portion of the name.  We always set it to "unknown".
205c20607aeSchristos	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206c20607aeSchristos	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207c20607aeSchristos	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208c20607aeSchristos	    echo unknown)`
209c20607aeSchristos	case $UNAME_MACHINE_ARCH in
210c20607aeSchristos	    aarch64eb) machine=aarch64_be-unknown ;;
211c20607aeSchristos	    armeb) machine=armeb-unknown ;;
212c20607aeSchristos	    arm*) machine=arm-unknown ;;
213*ddb17682Schristos	    mipsn64eb) machine=mips64-unknown ;;
214*ddb17682Schristos	    mipsn64el) machine=mips64el-unknown ;;
215c20607aeSchristos	    sh3el) machine=shl-unknown ;;
216c20607aeSchristos	    sh3eb) machine=sh-unknown ;;
217c20607aeSchristos	    sh5el) machine=sh5le-unknown ;;
218c20607aeSchristos	    earm*)
219c20607aeSchristos		arch="${UNAME_MACHINE_ARCH#e}"
220c20607aeSchristos		arch="${arch%eb}"
221c20607aeSchristos		arch="${arch%hf}"
222c20607aeSchristos		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
223c20607aeSchristos		machine=${arch}${endian}-unknown
224c20607aeSchristos		;;
225c20607aeSchristos	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
226c20607aeSchristos	esac
227c20607aeSchristos	# The Operating System including object format, if it has switched
228c20607aeSchristos	# to ELF recently (or will in the future) and ABI.
229c20607aeSchristos	case $UNAME_MACHINE_ARCH in
230c20607aeSchristos	    earm*)
231c20607aeSchristos		os=netbsdelf
232c20607aeSchristos		;;
233c20607aeSchristos	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
234c20607aeSchristos		set_cc_for_build
235c20607aeSchristos		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
236c20607aeSchristos			| grep -q __ELF__
237c20607aeSchristos		then
238c20607aeSchristos		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
239c20607aeSchristos		    # Return netbsd for either.  FIX?
240c20607aeSchristos		    os=netbsd
241c20607aeSchristos		else
242c20607aeSchristos		    os=netbsdelf
243c20607aeSchristos		fi
244c20607aeSchristos		;;
245c20607aeSchristos	    *)
246c20607aeSchristos		os=netbsd
247c20607aeSchristos		;;
248c20607aeSchristos	esac
249c20607aeSchristos	# Determine ABI tags.
250c20607aeSchristos	case $UNAME_MACHINE_ARCH in
251c20607aeSchristos	    earm*)
252c20607aeSchristos		expr='s/v[0-9]//;s/earm/-eabi/;s/eb$//'
253c20607aeSchristos		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
254c20607aeSchristos		;;
255c20607aeSchristos	esac
256c20607aeSchristos	# The OS release
257c20607aeSchristos	# Debian GNU/NetBSD machines have a different userland, and
258c20607aeSchristos	# thus, need a distinct triplet. However, they do not need
259c20607aeSchristos	# kernel version information, so it can be replaced with a
260c20607aeSchristos	# suitable tag, in the style of linux-gnu.
261c20607aeSchristos	case $UNAME_VERSION in
262c20607aeSchristos	    Debian*)
263c20607aeSchristos		release='-gnu'
264c20607aeSchristos		;;
265c20607aeSchristos	    *)
266c20607aeSchristos		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
267c20607aeSchristos		;;
268c20607aeSchristos	esac
269c20607aeSchristos	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
270c20607aeSchristos	# contains redundant information, the shorter form:
271c20607aeSchristos	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
272c20607aeSchristos	GUESS=$machine-${os}${release}${abi-}
273c20607aeSchristos	;;
274c20607aeSchristos    *:Bitrig:*:*)
275c20607aeSchristos	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
276c20607aeSchristos	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
277c20607aeSchristos	;;
278c20607aeSchristos    *:OpenBSD:*:*)
279c20607aeSchristos	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
280c20607aeSchristos	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
281c20607aeSchristos	;;
282c20607aeSchristos    *:SecBSD:*:*)
283c20607aeSchristos	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
284c20607aeSchristos	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
285c20607aeSchristos	;;
286c20607aeSchristos    *:LibertyBSD:*:*)
287c20607aeSchristos	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
288c20607aeSchristos	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
289c20607aeSchristos	;;
290c20607aeSchristos    *:MidnightBSD:*:*)
291c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
292c20607aeSchristos	;;
293c20607aeSchristos    *:ekkoBSD:*:*)
294c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
295c20607aeSchristos	;;
296c20607aeSchristos    *:SolidBSD:*:*)
297c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
298c20607aeSchristos	;;
299c20607aeSchristos    *:OS108:*:*)
300c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
301c20607aeSchristos	;;
302c20607aeSchristos    macppc:MirBSD:*:*)
303c20607aeSchristos	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
304c20607aeSchristos	;;
305c20607aeSchristos    *:MirBSD:*:*)
306c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
307c20607aeSchristos	;;
308c20607aeSchristos    *:Sortix:*:*)
309c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-sortix
310c20607aeSchristos	;;
311c20607aeSchristos    *:Twizzler:*:*)
312c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-twizzler
313c20607aeSchristos	;;
314c20607aeSchristos    *:Redox:*:*)
315c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-redox
316c20607aeSchristos	;;
317c20607aeSchristos    mips:OSF1:*.*)
318c20607aeSchristos	GUESS=mips-dec-osf1
319c20607aeSchristos	;;
320c20607aeSchristos    alpha:OSF1:*:*)
321c20607aeSchristos	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
322c20607aeSchristos	trap '' 0
323c20607aeSchristos	case $UNAME_RELEASE in
324c20607aeSchristos	*4.0)
325c20607aeSchristos		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
326c20607aeSchristos		;;
327c20607aeSchristos	*5.*)
328c20607aeSchristos		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
329c20607aeSchristos		;;
330c20607aeSchristos	esac
331c20607aeSchristos	# According to Compaq, /usr/sbin/psrinfo has been available on
332c20607aeSchristos	# OSF/1 and Tru64 systems produced since 1995.  I hope that
333c20607aeSchristos	# covers most systems running today.  This code pipes the CPU
334c20607aeSchristos	# types through head -n 1, so we only detect the type of CPU 0.
335c20607aeSchristos	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
336c20607aeSchristos	case $ALPHA_CPU_TYPE in
337c20607aeSchristos	    "EV4 (21064)")
338c20607aeSchristos		UNAME_MACHINE=alpha ;;
339c20607aeSchristos	    "EV4.5 (21064)")
340c20607aeSchristos		UNAME_MACHINE=alpha ;;
341c20607aeSchristos	    "LCA4 (21066/21068)")
342c20607aeSchristos		UNAME_MACHINE=alpha ;;
343c20607aeSchristos	    "EV5 (21164)")
344c20607aeSchristos		UNAME_MACHINE=alphaev5 ;;
345c20607aeSchristos	    "EV5.6 (21164A)")
346c20607aeSchristos		UNAME_MACHINE=alphaev56 ;;
347c20607aeSchristos	    "EV5.6 (21164PC)")
348c20607aeSchristos		UNAME_MACHINE=alphapca56 ;;
349c20607aeSchristos	    "EV5.7 (21164PC)")
350c20607aeSchristos		UNAME_MACHINE=alphapca57 ;;
351c20607aeSchristos	    "EV6 (21264)")
352c20607aeSchristos		UNAME_MACHINE=alphaev6 ;;
353c20607aeSchristos	    "EV6.7 (21264A)")
354c20607aeSchristos		UNAME_MACHINE=alphaev67 ;;
355c20607aeSchristos	    "EV6.8CB (21264C)")
356c20607aeSchristos		UNAME_MACHINE=alphaev68 ;;
357c20607aeSchristos	    "EV6.8AL (21264B)")
358c20607aeSchristos		UNAME_MACHINE=alphaev68 ;;
359c20607aeSchristos	    "EV6.8CX (21264D)")
360c20607aeSchristos		UNAME_MACHINE=alphaev68 ;;
361c20607aeSchristos	    "EV6.9A (21264/EV69A)")
362c20607aeSchristos		UNAME_MACHINE=alphaev69 ;;
363c20607aeSchristos	    "EV7 (21364)")
364c20607aeSchristos		UNAME_MACHINE=alphaev7 ;;
365c20607aeSchristos	    "EV7.9 (21364A)")
366c20607aeSchristos		UNAME_MACHINE=alphaev79 ;;
367c20607aeSchristos	esac
368c20607aeSchristos	# A Pn.n version is a patched version.
369c20607aeSchristos	# A Vn.n version is a released version.
370c20607aeSchristos	# A Tn.n version is a released field test version.
371c20607aeSchristos	# A Xn.n version is an unreleased experimental baselevel.
372c20607aeSchristos	# 1.2 uses "1.2" for uname -r.
373c20607aeSchristos	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
374c20607aeSchristos	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
375c20607aeSchristos	;;
376c20607aeSchristos    Amiga*:UNIX_System_V:4.0:*)
377c20607aeSchristos	GUESS=m68k-unknown-sysv4
378c20607aeSchristos	;;
379c20607aeSchristos    *:[Aa]miga[Oo][Ss]:*:*)
380c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-amigaos
381c20607aeSchristos	;;
382c20607aeSchristos    *:[Mm]orph[Oo][Ss]:*:*)
383c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-morphos
384c20607aeSchristos	;;
385c20607aeSchristos    *:OS/390:*:*)
386c20607aeSchristos	GUESS=i370-ibm-openedition
387c20607aeSchristos	;;
388c20607aeSchristos    *:z/VM:*:*)
389c20607aeSchristos	GUESS=s390-ibm-zvmoe
390c20607aeSchristos	;;
391c20607aeSchristos    *:OS400:*:*)
392c20607aeSchristos	GUESS=powerpc-ibm-os400
393c20607aeSchristos	;;
394c20607aeSchristos    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
395c20607aeSchristos	GUESS=arm-acorn-riscix$UNAME_RELEASE
396c20607aeSchristos	;;
397c20607aeSchristos    arm*:riscos:*:*|arm*:RISCOS:*:*)
398c20607aeSchristos	GUESS=arm-unknown-riscos
399c20607aeSchristos	;;
400c20607aeSchristos    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
401c20607aeSchristos	GUESS=hppa1.1-hitachi-hiuxmpp
402c20607aeSchristos	;;
403c20607aeSchristos    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
404c20607aeSchristos	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
405c20607aeSchristos	case `(/bin/universe) 2>/dev/null` in
406c20607aeSchristos	    att) GUESS=pyramid-pyramid-sysv3 ;;
407c20607aeSchristos	    *)   GUESS=pyramid-pyramid-bsd   ;;
408c20607aeSchristos	esac
409c20607aeSchristos	;;
410c20607aeSchristos    NILE*:*:*:dcosx)
411c20607aeSchristos	GUESS=pyramid-pyramid-svr4
412c20607aeSchristos	;;
413c20607aeSchristos    DRS?6000:unix:4.0:6*)
414c20607aeSchristos	GUESS=sparc-icl-nx6
415c20607aeSchristos	;;
416c20607aeSchristos    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
417c20607aeSchristos	case `/usr/bin/uname -p` in
418c20607aeSchristos	    sparc) GUESS=sparc-icl-nx7 ;;
419c20607aeSchristos	esac
420c20607aeSchristos	;;
421c20607aeSchristos    s390x:SunOS:*:*)
422c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423c20607aeSchristos	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
424c20607aeSchristos	;;
425c20607aeSchristos    sun4H:SunOS:5.*:*)
426c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427c20607aeSchristos	GUESS=sparc-hal-solaris2$SUN_REL
428c20607aeSchristos	;;
429c20607aeSchristos    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
430c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
431c20607aeSchristos	GUESS=sparc-sun-solaris2$SUN_REL
432c20607aeSchristos	;;
433c20607aeSchristos    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
434c20607aeSchristos	GUESS=i386-pc-auroraux$UNAME_RELEASE
435c20607aeSchristos	;;
436c20607aeSchristos    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
437c20607aeSchristos	set_cc_for_build
438c20607aeSchristos	SUN_ARCH=i386
439c20607aeSchristos	# If there is a compiler, see if it is configured for 64-bit objects.
440c20607aeSchristos	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
441c20607aeSchristos	# This test works for both compilers.
442c20607aeSchristos	if test "$CC_FOR_BUILD" != no_compiler_found; then
443c20607aeSchristos	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
444c20607aeSchristos		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
445c20607aeSchristos		grep IS_64BIT_ARCH >/dev/null
446c20607aeSchristos	    then
447c20607aeSchristos		SUN_ARCH=x86_64
448c20607aeSchristos	    fi
449c20607aeSchristos	fi
450c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
451c20607aeSchristos	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
452c20607aeSchristos	;;
453c20607aeSchristos    sun4*:SunOS:6*:*)
454c20607aeSchristos	# According to config.sub, this is the proper way to canonicalize
455c20607aeSchristos	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
456c20607aeSchristos	# it's likely to be more like Solaris than SunOS4.
457c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
458c20607aeSchristos	GUESS=sparc-sun-solaris3$SUN_REL
459c20607aeSchristos	;;
460c20607aeSchristos    sun4*:SunOS:*:*)
461c20607aeSchristos	case `/usr/bin/arch -k` in
462c20607aeSchristos	    Series*|S4*)
463c20607aeSchristos		UNAME_RELEASE=`uname -v`
464c20607aeSchristos		;;
465c20607aeSchristos	esac
466c20607aeSchristos	# Japanese Language versions have a version number like `4.1.3-JL'.
467c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
468c20607aeSchristos	GUESS=sparc-sun-sunos$SUN_REL
469c20607aeSchristos	;;
470c20607aeSchristos    sun3*:SunOS:*:*)
471c20607aeSchristos	GUESS=m68k-sun-sunos$UNAME_RELEASE
472c20607aeSchristos	;;
473c20607aeSchristos    sun*:*:4.2BSD:*)
474c20607aeSchristos	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
475c20607aeSchristos	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
476c20607aeSchristos	case `/bin/arch` in
477c20607aeSchristos	    sun3)
478c20607aeSchristos		GUESS=m68k-sun-sunos$UNAME_RELEASE
479c20607aeSchristos		;;
480c20607aeSchristos	    sun4)
481c20607aeSchristos		GUESS=sparc-sun-sunos$UNAME_RELEASE
482c20607aeSchristos		;;
483c20607aeSchristos	esac
484c20607aeSchristos	;;
485c20607aeSchristos    aushp:SunOS:*:*)
486c20607aeSchristos	GUESS=sparc-auspex-sunos$UNAME_RELEASE
487c20607aeSchristos	;;
488c20607aeSchristos    # The situation for MiNT is a little confusing.  The machine name
489c20607aeSchristos    # can be virtually everything (everything which is not
490c20607aeSchristos    # "atarist" or "atariste" at least should have a processor
491c20607aeSchristos    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
492c20607aeSchristos    # to the lowercase version "mint" (or "freemint").  Finally
493c20607aeSchristos    # the system name "TOS" denotes a system which is actually not
494c20607aeSchristos    # MiNT.  But MiNT is downward compatible to TOS, so this should
495c20607aeSchristos    # be no problem.
496c20607aeSchristos    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
497c20607aeSchristos	GUESS=m68k-atari-mint$UNAME_RELEASE
498c20607aeSchristos	;;
499c20607aeSchristos    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
500c20607aeSchristos	GUESS=m68k-atari-mint$UNAME_RELEASE
501c20607aeSchristos	;;
502c20607aeSchristos    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
503c20607aeSchristos	GUESS=m68k-atari-mint$UNAME_RELEASE
504c20607aeSchristos	;;
505c20607aeSchristos    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
506c20607aeSchristos	GUESS=m68k-milan-mint$UNAME_RELEASE
507c20607aeSchristos	;;
508c20607aeSchristos    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
509c20607aeSchristos	GUESS=m68k-hades-mint$UNAME_RELEASE
510c20607aeSchristos	;;
511c20607aeSchristos    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
512c20607aeSchristos	GUESS=m68k-unknown-mint$UNAME_RELEASE
513c20607aeSchristos	;;
514c20607aeSchristos    m68k:machten:*:*)
515c20607aeSchristos	GUESS=m68k-apple-machten$UNAME_RELEASE
516c20607aeSchristos	;;
517c20607aeSchristos    powerpc:machten:*:*)
518c20607aeSchristos	GUESS=powerpc-apple-machten$UNAME_RELEASE
519c20607aeSchristos	;;
520c20607aeSchristos    RISC*:Mach:*:*)
521c20607aeSchristos	GUESS=mips-dec-mach_bsd4.3
522c20607aeSchristos	;;
523c20607aeSchristos    RISC*:ULTRIX:*:*)
524c20607aeSchristos	GUESS=mips-dec-ultrix$UNAME_RELEASE
525c20607aeSchristos	;;
526c20607aeSchristos    VAX*:ULTRIX*:*:*)
527c20607aeSchristos	GUESS=vax-dec-ultrix$UNAME_RELEASE
528c20607aeSchristos	;;
529c20607aeSchristos    2020:CLIX:*:* | 2430:CLIX:*:*)
530c20607aeSchristos	GUESS=clipper-intergraph-clix$UNAME_RELEASE
531c20607aeSchristos	;;
532c20607aeSchristos    mips:*:*:UMIPS | mips:*:*:RISCos)
533c20607aeSchristos	set_cc_for_build
534c20607aeSchristos	sed 's/^	//' << EOF > "$dummy.c"
535c20607aeSchristos#ifdef __cplusplus
536c20607aeSchristos#include <stdio.h>  /* for printf() prototype */
537c20607aeSchristos	int main (int argc, char *argv[]) {
538c20607aeSchristos#else
539c20607aeSchristos	int main (argc, argv) int argc; char *argv[]; {
540c20607aeSchristos#endif
541c20607aeSchristos	#if defined (host_mips) && defined (MIPSEB)
542c20607aeSchristos	#if defined (SYSTYPE_SYSV)
543c20607aeSchristos	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
544c20607aeSchristos	#endif
545c20607aeSchristos	#if defined (SYSTYPE_SVR4)
546c20607aeSchristos	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
547c20607aeSchristos	#endif
548c20607aeSchristos	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
549c20607aeSchristos	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
550c20607aeSchristos	#endif
551c20607aeSchristos	#endif
552c20607aeSchristos	  exit (-1);
553c20607aeSchristos	}
554c20607aeSchristosEOF
555c20607aeSchristos	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
556c20607aeSchristos	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
557c20607aeSchristos	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
558c20607aeSchristos	    { echo "$SYSTEM_NAME"; exit; }
559c20607aeSchristos	GUESS=mips-mips-riscos$UNAME_RELEASE
560c20607aeSchristos	;;
561c20607aeSchristos    Motorola:PowerMAX_OS:*:*)
562c20607aeSchristos	GUESS=powerpc-motorola-powermax
563c20607aeSchristos	;;
564c20607aeSchristos    Motorola:*:4.3:PL8-*)
565c20607aeSchristos	GUESS=powerpc-harris-powermax
566c20607aeSchristos	;;
567c20607aeSchristos    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
568c20607aeSchristos	GUESS=powerpc-harris-powermax
569c20607aeSchristos	;;
570c20607aeSchristos    Night_Hawk:Power_UNIX:*:*)
571c20607aeSchristos	GUESS=powerpc-harris-powerunix
572c20607aeSchristos	;;
573c20607aeSchristos    m88k:CX/UX:7*:*)
574c20607aeSchristos	GUESS=m88k-harris-cxux7
575c20607aeSchristos	;;
576c20607aeSchristos    m88k:*:4*:R4*)
577c20607aeSchristos	GUESS=m88k-motorola-sysv4
578c20607aeSchristos	;;
579c20607aeSchristos    m88k:*:3*:R3*)
580c20607aeSchristos	GUESS=m88k-motorola-sysv3
581c20607aeSchristos	;;
582c20607aeSchristos    AViiON:dgux:*:*)
583c20607aeSchristos	# DG/UX returns AViiON for all architectures
584c20607aeSchristos	UNAME_PROCESSOR=`/usr/bin/uname -p`
585c20607aeSchristos	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
586c20607aeSchristos	then
587c20607aeSchristos	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
588c20607aeSchristos	       test "$TARGET_BINARY_INTERFACE"x = x
589c20607aeSchristos	    then
590c20607aeSchristos		GUESS=m88k-dg-dgux$UNAME_RELEASE
591c20607aeSchristos	    else
592c20607aeSchristos		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
593c20607aeSchristos	    fi
594c20607aeSchristos	else
595c20607aeSchristos	    GUESS=i586-dg-dgux$UNAME_RELEASE
596c20607aeSchristos	fi
597c20607aeSchristos	;;
598c20607aeSchristos    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
599c20607aeSchristos	GUESS=m88k-dolphin-sysv3
600c20607aeSchristos	;;
601c20607aeSchristos    M88*:*:R3*:*)
602c20607aeSchristos	# Delta 88k system running SVR3
603c20607aeSchristos	GUESS=m88k-motorola-sysv3
604c20607aeSchristos	;;
605c20607aeSchristos    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
606c20607aeSchristos	GUESS=m88k-tektronix-sysv3
607c20607aeSchristos	;;
608c20607aeSchristos    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
609c20607aeSchristos	GUESS=m68k-tektronix-bsd
610c20607aeSchristos	;;
611c20607aeSchristos    *:IRIX*:*:*)
612c20607aeSchristos	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
613c20607aeSchristos	GUESS=mips-sgi-irix$IRIX_REL
614c20607aeSchristos	;;
615c20607aeSchristos    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
616c20607aeSchristos	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
617c20607aeSchristos	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
618c20607aeSchristos    i*86:AIX:*:*)
619c20607aeSchristos	GUESS=i386-ibm-aix
620c20607aeSchristos	;;
621c20607aeSchristos    ia64:AIX:*:*)
622c20607aeSchristos	if test -x /usr/bin/oslevel ; then
623c20607aeSchristos		IBM_REV=`/usr/bin/oslevel`
624c20607aeSchristos	else
625c20607aeSchristos		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
626c20607aeSchristos	fi
627c20607aeSchristos	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
628c20607aeSchristos	;;
629c20607aeSchristos    *:AIX:2:3)
630c20607aeSchristos	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
631c20607aeSchristos		set_cc_for_build
632c20607aeSchristos		sed 's/^		//' << EOF > "$dummy.c"
633c20607aeSchristos		#include <sys/systemcfg.h>
634c20607aeSchristos
635c20607aeSchristos		main()
636c20607aeSchristos			{
637c20607aeSchristos			if (!__power_pc())
638c20607aeSchristos				exit(1);
639c20607aeSchristos			puts("powerpc-ibm-aix3.2.5");
640c20607aeSchristos			exit(0);
641c20607aeSchristos			}
642c20607aeSchristosEOF
643c20607aeSchristos		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
644c20607aeSchristos		then
645c20607aeSchristos			GUESS=$SYSTEM_NAME
646c20607aeSchristos		else
647c20607aeSchristos			GUESS=rs6000-ibm-aix3.2.5
648c20607aeSchristos		fi
649c20607aeSchristos	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
650c20607aeSchristos		GUESS=rs6000-ibm-aix3.2.4
651c20607aeSchristos	else
652c20607aeSchristos		GUESS=rs6000-ibm-aix3.2
653c20607aeSchristos	fi
654c20607aeSchristos	;;
655c20607aeSchristos    *:AIX:*:[4567])
656c20607aeSchristos	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
657c20607aeSchristos	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
658c20607aeSchristos		IBM_ARCH=rs6000
659c20607aeSchristos	else
660c20607aeSchristos		IBM_ARCH=powerpc
661c20607aeSchristos	fi
662c20607aeSchristos	if test -x /usr/bin/lslpp ; then
663c20607aeSchristos		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
664c20607aeSchristos			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
665c20607aeSchristos	else
666c20607aeSchristos		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
667c20607aeSchristos	fi
668c20607aeSchristos	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
669c20607aeSchristos	;;
670c20607aeSchristos    *:AIX:*:*)
671c20607aeSchristos	GUESS=rs6000-ibm-aix
672c20607aeSchristos	;;
673c20607aeSchristos    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
674c20607aeSchristos	GUESS=romp-ibm-bsd4.4
675c20607aeSchristos	;;
676c20607aeSchristos    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
677c20607aeSchristos	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
678c20607aeSchristos	;;                                  # report: romp-ibm BSD 4.3
679c20607aeSchristos    *:BOSX:*:*)
680c20607aeSchristos	GUESS=rs6000-bull-bosx
681c20607aeSchristos	;;
682c20607aeSchristos    DPX/2?00:B.O.S.:*:*)
683c20607aeSchristos	GUESS=m68k-bull-sysv3
684c20607aeSchristos	;;
685c20607aeSchristos    9000/[34]??:4.3bsd:1.*:*)
686c20607aeSchristos	GUESS=m68k-hp-bsd
687c20607aeSchristos	;;
688c20607aeSchristos    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
689c20607aeSchristos	GUESS=m68k-hp-bsd4.4
690c20607aeSchristos	;;
691c20607aeSchristos    9000/[34678]??:HP-UX:*:*)
692c20607aeSchristos	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
693c20607aeSchristos	case $UNAME_MACHINE in
694c20607aeSchristos	    9000/31?)            HP_ARCH=m68000 ;;
695c20607aeSchristos	    9000/[34]??)         HP_ARCH=m68k ;;
696c20607aeSchristos	    9000/[678][0-9][0-9])
697c20607aeSchristos		if test -x /usr/bin/getconf; then
698c20607aeSchristos		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
699c20607aeSchristos		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
700c20607aeSchristos		    case $sc_cpu_version in
701c20607aeSchristos		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
702c20607aeSchristos		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
703c20607aeSchristos		      532)                      # CPU_PA_RISC2_0
704c20607aeSchristos			case $sc_kernel_bits in
705c20607aeSchristos			  32) HP_ARCH=hppa2.0n ;;
706c20607aeSchristos			  64) HP_ARCH=hppa2.0w ;;
707c20607aeSchristos			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
708c20607aeSchristos			esac ;;
709c20607aeSchristos		    esac
710c20607aeSchristos		fi
711c20607aeSchristos		if test "$HP_ARCH" = ""; then
712c20607aeSchristos		    set_cc_for_build
713c20607aeSchristos		    sed 's/^		//' << EOF > "$dummy.c"
714c20607aeSchristos
715c20607aeSchristos		#define _HPUX_SOURCE
716c20607aeSchristos		#include <stdlib.h>
717c20607aeSchristos		#include <unistd.h>
718c20607aeSchristos
719c20607aeSchristos		int main ()
720c20607aeSchristos		{
721c20607aeSchristos		#if defined(_SC_KERNEL_BITS)
722c20607aeSchristos		    long bits = sysconf(_SC_KERNEL_BITS);
723c20607aeSchristos		#endif
724c20607aeSchristos		    long cpu  = sysconf (_SC_CPU_VERSION);
725c20607aeSchristos
726c20607aeSchristos		    switch (cpu)
727c20607aeSchristos			{
728c20607aeSchristos			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
729c20607aeSchristos			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
730c20607aeSchristos			case CPU_PA_RISC2_0:
731c20607aeSchristos		#if defined(_SC_KERNEL_BITS)
732c20607aeSchristos			    switch (bits)
733c20607aeSchristos				{
734c20607aeSchristos				case 64: puts ("hppa2.0w"); break;
735c20607aeSchristos				case 32: puts ("hppa2.0n"); break;
736c20607aeSchristos				default: puts ("hppa2.0"); break;
737c20607aeSchristos				} break;
738c20607aeSchristos		#else  /* !defined(_SC_KERNEL_BITS) */
739c20607aeSchristos			    puts ("hppa2.0"); break;
740c20607aeSchristos		#endif
741c20607aeSchristos			default: puts ("hppa1.0"); break;
742c20607aeSchristos			}
743c20607aeSchristos		    exit (0);
744c20607aeSchristos		}
745c20607aeSchristosEOF
746c20607aeSchristos		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
747c20607aeSchristos		    test -z "$HP_ARCH" && HP_ARCH=hppa
748c20607aeSchristos		fi ;;
749c20607aeSchristos	esac
750c20607aeSchristos	if test "$HP_ARCH" = hppa2.0w
751c20607aeSchristos	then
752c20607aeSchristos	    set_cc_for_build
753c20607aeSchristos
754c20607aeSchristos	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
755c20607aeSchristos	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
756c20607aeSchristos	    # generating 64-bit code.  GNU and HP use different nomenclature:
757c20607aeSchristos	    #
758c20607aeSchristos	    # $ CC_FOR_BUILD=cc ./config.guess
759c20607aeSchristos	    # => hppa2.0w-hp-hpux11.23
760c20607aeSchristos	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
761c20607aeSchristos	    # => hppa64-hp-hpux11.23
762c20607aeSchristos
763c20607aeSchristos	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
764c20607aeSchristos		grep -q __LP64__
765c20607aeSchristos	    then
766c20607aeSchristos		HP_ARCH=hppa2.0w
767c20607aeSchristos	    else
768c20607aeSchristos		HP_ARCH=hppa64
769c20607aeSchristos	    fi
770c20607aeSchristos	fi
771c20607aeSchristos	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
772c20607aeSchristos	;;
773c20607aeSchristos    ia64:HP-UX:*:*)
774c20607aeSchristos	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
775c20607aeSchristos	GUESS=ia64-hp-hpux$HPUX_REV
776c20607aeSchristos	;;
777c20607aeSchristos    3050*:HI-UX:*:*)
778c20607aeSchristos	set_cc_for_build
779c20607aeSchristos	sed 's/^	//' << EOF > "$dummy.c"
780c20607aeSchristos	#include <unistd.h>
781c20607aeSchristos	int
782c20607aeSchristos	main ()
783c20607aeSchristos	{
784c20607aeSchristos	  long cpu = sysconf (_SC_CPU_VERSION);
785c20607aeSchristos	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
786c20607aeSchristos	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
787c20607aeSchristos	     results, however.  */
788c20607aeSchristos	  if (CPU_IS_PA_RISC (cpu))
789c20607aeSchristos	    {
790c20607aeSchristos	      switch (cpu)
791c20607aeSchristos		{
792c20607aeSchristos		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
793c20607aeSchristos		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
794c20607aeSchristos		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
795c20607aeSchristos		  default: puts ("hppa-hitachi-hiuxwe2"); break;
796c20607aeSchristos		}
797c20607aeSchristos	    }
798c20607aeSchristos	  else if (CPU_IS_HP_MC68K (cpu))
799c20607aeSchristos	    puts ("m68k-hitachi-hiuxwe2");
800c20607aeSchristos	  else puts ("unknown-hitachi-hiuxwe2");
801c20607aeSchristos	  exit (0);
802c20607aeSchristos	}
803c20607aeSchristosEOF
804c20607aeSchristos	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
805c20607aeSchristos		{ echo "$SYSTEM_NAME"; exit; }
806c20607aeSchristos	GUESS=unknown-hitachi-hiuxwe2
807c20607aeSchristos	;;
808c20607aeSchristos    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
809c20607aeSchristos	GUESS=hppa1.1-hp-bsd
810c20607aeSchristos	;;
811c20607aeSchristos    9000/8??:4.3bsd:*:*)
812c20607aeSchristos	GUESS=hppa1.0-hp-bsd
813c20607aeSchristos	;;
814c20607aeSchristos    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
815c20607aeSchristos	GUESS=hppa1.0-hp-mpeix
816c20607aeSchristos	;;
817c20607aeSchristos    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
818c20607aeSchristos	GUESS=hppa1.1-hp-osf
819c20607aeSchristos	;;
820c20607aeSchristos    hp8??:OSF1:*:*)
821c20607aeSchristos	GUESS=hppa1.0-hp-osf
822c20607aeSchristos	;;
823c20607aeSchristos    i*86:OSF1:*:*)
824c20607aeSchristos	if test -x /usr/sbin/sysversion ; then
825c20607aeSchristos	    GUESS=$UNAME_MACHINE-unknown-osf1mk
826c20607aeSchristos	else
827c20607aeSchristos	    GUESS=$UNAME_MACHINE-unknown-osf1
828c20607aeSchristos	fi
829c20607aeSchristos	;;
830c20607aeSchristos    parisc*:Lites*:*:*)
831c20607aeSchristos	GUESS=hppa1.1-hp-lites
832c20607aeSchristos	;;
833c20607aeSchristos    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
834c20607aeSchristos	GUESS=c1-convex-bsd
835c20607aeSchristos	;;
836c20607aeSchristos    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
837c20607aeSchristos	if getsysinfo -f scalar_acc
838c20607aeSchristos	then echo c32-convex-bsd
839c20607aeSchristos	else echo c2-convex-bsd
840c20607aeSchristos	fi
841c20607aeSchristos	exit ;;
842c20607aeSchristos    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
843c20607aeSchristos	GUESS=c34-convex-bsd
844c20607aeSchristos	;;
845c20607aeSchristos    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
846c20607aeSchristos	GUESS=c38-convex-bsd
847c20607aeSchristos	;;
848c20607aeSchristos    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
849c20607aeSchristos	GUESS=c4-convex-bsd
850c20607aeSchristos	;;
851c20607aeSchristos    CRAY*Y-MP:*:*:*)
852c20607aeSchristos	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
853c20607aeSchristos	GUESS=ymp-cray-unicos$CRAY_REL
854c20607aeSchristos	;;
855c20607aeSchristos    CRAY*[A-Z]90:*:*:*)
856c20607aeSchristos	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
857c20607aeSchristos	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
858c20607aeSchristos	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
859c20607aeSchristos	      -e 's/\.[^.]*$/.X/'
860c20607aeSchristos	exit ;;
861c20607aeSchristos    CRAY*TS:*:*:*)
862c20607aeSchristos	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863c20607aeSchristos	GUESS=t90-cray-unicos$CRAY_REL
864c20607aeSchristos	;;
865c20607aeSchristos    CRAY*T3E:*:*:*)
866c20607aeSchristos	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867c20607aeSchristos	GUESS=alphaev5-cray-unicosmk$CRAY_REL
868c20607aeSchristos	;;
869c20607aeSchristos    CRAY*SV1:*:*:*)
870c20607aeSchristos	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871c20607aeSchristos	GUESS=sv1-cray-unicos$CRAY_REL
872c20607aeSchristos	;;
873c20607aeSchristos    *:UNICOS/mp:*:*)
874c20607aeSchristos	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
875c20607aeSchristos	GUESS=craynv-cray-unicosmp$CRAY_REL
876c20607aeSchristos	;;
877c20607aeSchristos    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
878c20607aeSchristos	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
879c20607aeSchristos	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
880c20607aeSchristos	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
881c20607aeSchristos	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
882c20607aeSchristos	;;
883c20607aeSchristos    5000:UNIX_System_V:4.*:*)
884c20607aeSchristos	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
885c20607aeSchristos	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
886c20607aeSchristos	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
887c20607aeSchristos	;;
888c20607aeSchristos    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
889c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
890c20607aeSchristos	;;
891c20607aeSchristos    sparc*:BSD/OS:*:*)
892c20607aeSchristos	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
893c20607aeSchristos	;;
894c20607aeSchristos    *:BSD/OS:*:*)
895c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
896c20607aeSchristos	;;
897c20607aeSchristos    arm:FreeBSD:*:*)
898c20607aeSchristos	UNAME_PROCESSOR=`uname -p`
899c20607aeSchristos	set_cc_for_build
900c20607aeSchristos	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
901c20607aeSchristos	    | grep -q __ARM_PCS_VFP
902c20607aeSchristos	then
903c20607aeSchristos	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
904c20607aeSchristos	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
905c20607aeSchristos	else
906c20607aeSchristos	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
907c20607aeSchristos	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
908c20607aeSchristos	fi
909c20607aeSchristos	;;
910c20607aeSchristos    *:FreeBSD:*:*)
911c20607aeSchristos	UNAME_PROCESSOR=`/usr/bin/uname -p`
912c20607aeSchristos	case $UNAME_PROCESSOR in
913c20607aeSchristos	    amd64)
914c20607aeSchristos		UNAME_PROCESSOR=x86_64 ;;
915c20607aeSchristos	    i386)
916c20607aeSchristos		UNAME_PROCESSOR=i586 ;;
917c20607aeSchristos	esac
918c20607aeSchristos	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
919c20607aeSchristos	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
920c20607aeSchristos	;;
921c20607aeSchristos    i*:CYGWIN*:*)
922c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-cygwin
923c20607aeSchristos	;;
924c20607aeSchristos    *:MINGW64*:*)
925c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-mingw64
926c20607aeSchristos	;;
927c20607aeSchristos    *:MINGW*:*)
928c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-mingw32
929c20607aeSchristos	;;
930c20607aeSchristos    *:MSYS*:*)
931c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-msys
932c20607aeSchristos	;;
933c20607aeSchristos    i*:PW*:*)
934c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-pw32
935c20607aeSchristos	;;
936c20607aeSchristos    *:Interix*:*)
937c20607aeSchristos	case $UNAME_MACHINE in
938c20607aeSchristos	    x86)
939c20607aeSchristos		GUESS=i586-pc-interix$UNAME_RELEASE
940c20607aeSchristos		;;
941c20607aeSchristos	    authenticamd | genuineintel | EM64T)
942c20607aeSchristos		GUESS=x86_64-unknown-interix$UNAME_RELEASE
943c20607aeSchristos		;;
944c20607aeSchristos	    IA64)
945c20607aeSchristos		GUESS=ia64-unknown-interix$UNAME_RELEASE
946c20607aeSchristos		;;
947c20607aeSchristos	esac ;;
948c20607aeSchristos    i*:UWIN*:*)
949c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-uwin
950c20607aeSchristos	;;
951c20607aeSchristos    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
952c20607aeSchristos	GUESS=x86_64-pc-cygwin
953c20607aeSchristos	;;
954c20607aeSchristos    prep*:SunOS:5.*:*)
955c20607aeSchristos	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
956c20607aeSchristos	GUESS=powerpcle-unknown-solaris2$SUN_REL
957c20607aeSchristos	;;
958c20607aeSchristos    *:GNU:*:*)
959c20607aeSchristos	# the GNU system
960c20607aeSchristos	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
961c20607aeSchristos	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
962c20607aeSchristos	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
963c20607aeSchristos	;;
964c20607aeSchristos    *:GNU/*:*:*)
965c20607aeSchristos	# other systems with GNU libc and userland
966c20607aeSchristos	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
967c20607aeSchristos	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
968c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
969c20607aeSchristos	;;
970c20607aeSchristos    *:Minix:*:*)
971c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-minix
972c20607aeSchristos	;;
973c20607aeSchristos    aarch64:Linux:*:*)
974c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975c20607aeSchristos	;;
976c20607aeSchristos    aarch64_be:Linux:*:*)
977c20607aeSchristos	UNAME_MACHINE=aarch64_be
978c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
979c20607aeSchristos	;;
980c20607aeSchristos    alpha:Linux:*:*)
981c20607aeSchristos	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
982c20607aeSchristos	  EV5)   UNAME_MACHINE=alphaev5 ;;
983c20607aeSchristos	  EV56)  UNAME_MACHINE=alphaev56 ;;
984c20607aeSchristos	  PCA56) UNAME_MACHINE=alphapca56 ;;
985c20607aeSchristos	  PCA57) UNAME_MACHINE=alphapca56 ;;
986c20607aeSchristos	  EV6)   UNAME_MACHINE=alphaev6 ;;
987c20607aeSchristos	  EV67)  UNAME_MACHINE=alphaev67 ;;
988c20607aeSchristos	  EV68*) UNAME_MACHINE=alphaev68 ;;
989c20607aeSchristos	esac
990c20607aeSchristos	objdump --private-headers /bin/sh | grep -q ld.so.1
991c20607aeSchristos	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
992c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
993c20607aeSchristos	;;
994c20607aeSchristos    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
995c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
996c20607aeSchristos	;;
997c20607aeSchristos    arm*:Linux:*:*)
998c20607aeSchristos	set_cc_for_build
999c20607aeSchristos	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1000c20607aeSchristos	    | grep -q __ARM_EABI__
1001c20607aeSchristos	then
1002c20607aeSchristos	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1003c20607aeSchristos	else
1004c20607aeSchristos	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1005c20607aeSchristos		| grep -q __ARM_PCS_VFP
1006c20607aeSchristos	    then
1007c20607aeSchristos		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1008c20607aeSchristos	    else
1009c20607aeSchristos		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1010c20607aeSchristos	    fi
1011c20607aeSchristos	fi
1012c20607aeSchristos	;;
1013c20607aeSchristos    avr32*:Linux:*:*)
1014c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1015c20607aeSchristos	;;
1016c20607aeSchristos    cris:Linux:*:*)
1017c20607aeSchristos	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1018c20607aeSchristos	;;
1019c20607aeSchristos    crisv32:Linux:*:*)
1020c20607aeSchristos	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1021c20607aeSchristos	;;
1022c20607aeSchristos    e2k:Linux:*:*)
1023c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1024c20607aeSchristos	;;
1025c20607aeSchristos    frv:Linux:*:*)
1026c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1027c20607aeSchristos	;;
1028c20607aeSchristos    hexagon:Linux:*:*)
1029c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1030c20607aeSchristos	;;
1031c20607aeSchristos    i*86:Linux:*:*)
1032c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1033c20607aeSchristos	;;
1034c20607aeSchristos    ia64:Linux:*:*)
1035c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1036c20607aeSchristos	;;
1037c20607aeSchristos    k1om:Linux:*:*)
1038c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1039c20607aeSchristos	;;
1040c20607aeSchristos    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1041c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1042c20607aeSchristos	;;
1043c20607aeSchristos    m32r*:Linux:*:*)
1044c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1045c20607aeSchristos	;;
1046c20607aeSchristos    m68*:Linux:*:*)
1047c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1048c20607aeSchristos	;;
1049c20607aeSchristos    mips:Linux:*:* | mips64:Linux:*:*)
1050c20607aeSchristos	set_cc_for_build
1051c20607aeSchristos	IS_GLIBC=0
1052c20607aeSchristos	test x"${LIBC}" = xgnu && IS_GLIBC=1
1053c20607aeSchristos	sed 's/^	//' << EOF > "$dummy.c"
1054c20607aeSchristos	#undef CPU
1055c20607aeSchristos	#undef mips
1056c20607aeSchristos	#undef mipsel
1057c20607aeSchristos	#undef mips64
1058c20607aeSchristos	#undef mips64el
1059c20607aeSchristos	#if ${IS_GLIBC} && defined(_ABI64)
1060c20607aeSchristos	LIBCABI=gnuabi64
1061c20607aeSchristos	#else
1062c20607aeSchristos	#if ${IS_GLIBC} && defined(_ABIN32)
1063c20607aeSchristos	LIBCABI=gnuabin32
1064c20607aeSchristos	#else
1065c20607aeSchristos	LIBCABI=${LIBC}
1066c20607aeSchristos	#endif
1067c20607aeSchristos	#endif
1068c20607aeSchristos
1069c20607aeSchristos	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1070c20607aeSchristos	CPU=mipsisa64r6
1071c20607aeSchristos	#else
1072c20607aeSchristos	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1073c20607aeSchristos	CPU=mipsisa32r6
1074c20607aeSchristos	#else
1075c20607aeSchristos	#if defined(__mips64)
1076c20607aeSchristos	CPU=mips64
1077c20607aeSchristos	#else
1078c20607aeSchristos	CPU=mips
1079c20607aeSchristos	#endif
1080c20607aeSchristos	#endif
1081c20607aeSchristos	#endif
1082c20607aeSchristos
1083c20607aeSchristos	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1084c20607aeSchristos	MIPS_ENDIAN=el
1085c20607aeSchristos	#else
1086c20607aeSchristos	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1087c20607aeSchristos	MIPS_ENDIAN=
1088c20607aeSchristos	#else
1089c20607aeSchristos	MIPS_ENDIAN=
1090c20607aeSchristos	#endif
1091c20607aeSchristos	#endif
1092c20607aeSchristosEOF
1093c20607aeSchristos	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1094c20607aeSchristos	eval "$cc_set_vars"
1095c20607aeSchristos	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1096c20607aeSchristos	;;
1097c20607aeSchristos    mips64el:Linux:*:*)
1098c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1099c20607aeSchristos	;;
1100c20607aeSchristos    openrisc*:Linux:*:*)
1101c20607aeSchristos	GUESS=or1k-unknown-linux-$LIBC
1102c20607aeSchristos	;;
1103c20607aeSchristos    or32:Linux:*:* | or1k*:Linux:*:*)
1104c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1105c20607aeSchristos	;;
1106c20607aeSchristos    padre:Linux:*:*)
1107c20607aeSchristos	GUESS=sparc-unknown-linux-$LIBC
1108c20607aeSchristos	;;
1109c20607aeSchristos    parisc64:Linux:*:* | hppa64:Linux:*:*)
1110c20607aeSchristos	GUESS=hppa64-unknown-linux-$LIBC
1111c20607aeSchristos	;;
1112c20607aeSchristos    parisc:Linux:*:* | hppa:Linux:*:*)
1113c20607aeSchristos	# Look for CPU level
1114c20607aeSchristos	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1115c20607aeSchristos	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1116c20607aeSchristos	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1117c20607aeSchristos	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1118c20607aeSchristos	esac
1119c20607aeSchristos	;;
1120c20607aeSchristos    ppc64:Linux:*:*)
1121c20607aeSchristos	GUESS=powerpc64-unknown-linux-$LIBC
1122c20607aeSchristos	;;
1123c20607aeSchristos    ppc:Linux:*:*)
1124c20607aeSchristos	GUESS=powerpc-unknown-linux-$LIBC
1125c20607aeSchristos	;;
1126c20607aeSchristos    ppc64le:Linux:*:*)
1127c20607aeSchristos	GUESS=powerpc64le-unknown-linux-$LIBC
1128c20607aeSchristos	;;
1129c20607aeSchristos    ppcle:Linux:*:*)
1130c20607aeSchristos	GUESS=powerpcle-unknown-linux-$LIBC
1131c20607aeSchristos	;;
1132c20607aeSchristos    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1133c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1134c20607aeSchristos	;;
1135c20607aeSchristos    s390:Linux:*:* | s390x:Linux:*:*)
1136c20607aeSchristos	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1137c20607aeSchristos	;;
1138c20607aeSchristos    sh64*:Linux:*:*)
1139c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1140c20607aeSchristos	;;
1141c20607aeSchristos    sh*:Linux:*:*)
1142c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1143c20607aeSchristos	;;
1144c20607aeSchristos    sparc:Linux:*:* | sparc64:Linux:*:*)
1145c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1146c20607aeSchristos	;;
1147c20607aeSchristos    tile*:Linux:*:*)
1148c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1149c20607aeSchristos	;;
1150c20607aeSchristos    vax:Linux:*:*)
1151c20607aeSchristos	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1152c20607aeSchristos	;;
1153c20607aeSchristos    x86_64:Linux:*:*)
1154c20607aeSchristos	set_cc_for_build
1155c20607aeSchristos	LIBCABI=$LIBC
1156c20607aeSchristos	if test "$CC_FOR_BUILD" != no_compiler_found; then
1157c20607aeSchristos	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1158c20607aeSchristos		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1159c20607aeSchristos		grep IS_X32 >/dev/null
1160c20607aeSchristos	    then
1161c20607aeSchristos		LIBCABI=${LIBC}x32
1162c20607aeSchristos	    fi
1163c20607aeSchristos	fi
1164c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1165c20607aeSchristos	;;
1166c20607aeSchristos    xtensa*:Linux:*:*)
1167c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1168c20607aeSchristos	;;
1169c20607aeSchristos    i*86:DYNIX/ptx:4*:*)
1170c20607aeSchristos	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1171c20607aeSchristos	# earlier versions are messed up and put the nodename in both
1172c20607aeSchristos	# sysname and nodename.
1173c20607aeSchristos	GUESS=i386-sequent-sysv4
1174c20607aeSchristos	;;
1175c20607aeSchristos    i*86:UNIX_SV:4.2MP:2.*)
1176c20607aeSchristos	# Unixware is an offshoot of SVR4, but it has its own version
1177c20607aeSchristos	# number series starting with 2...
1178c20607aeSchristos	# I am not positive that other SVR4 systems won't match this,
1179c20607aeSchristos	# I just have to hope.  -- rms.
1180c20607aeSchristos	# Use sysv4.2uw... so that sysv4* matches it.
1181c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1182c20607aeSchristos	;;
1183c20607aeSchristos    i*86:OS/2:*:*)
1184c20607aeSchristos	# If we were able to find `uname', then EMX Unix compatibility
1185c20607aeSchristos	# is probably installed.
1186c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-os2-emx
1187c20607aeSchristos	;;
1188c20607aeSchristos    i*86:XTS-300:*:STOP)
1189c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-stop
1190c20607aeSchristos	;;
1191c20607aeSchristos    i*86:atheos:*:*)
1192c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-atheos
1193c20607aeSchristos	;;
1194c20607aeSchristos    i*86:syllable:*:*)
1195c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-syllable
1196c20607aeSchristos	;;
1197c20607aeSchristos    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1198c20607aeSchristos	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1199c20607aeSchristos	;;
1200c20607aeSchristos    i*86:*DOS:*:*)
1201c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1202c20607aeSchristos	;;
1203c20607aeSchristos    i*86:*:4.*:*)
1204c20607aeSchristos	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1205c20607aeSchristos	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1206c20607aeSchristos		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1207c20607aeSchristos	else
1208c20607aeSchristos		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1209c20607aeSchristos	fi
1210c20607aeSchristos	;;
1211c20607aeSchristos    i*86:*:5:[678]*)
1212c20607aeSchristos	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1213c20607aeSchristos	case `/bin/uname -X | grep "^Machine"` in
1214c20607aeSchristos	    *486*)	     UNAME_MACHINE=i486 ;;
1215c20607aeSchristos	    *Pentium)	     UNAME_MACHINE=i586 ;;
1216c20607aeSchristos	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1217c20607aeSchristos	esac
1218c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1219c20607aeSchristos	;;
1220c20607aeSchristos    i*86:*:3.2:*)
1221c20607aeSchristos	if test -f /usr/options/cb.name; then
1222c20607aeSchristos		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1223c20607aeSchristos		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1224c20607aeSchristos	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1225c20607aeSchristos		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1226c20607aeSchristos		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1227c20607aeSchristos		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1228c20607aeSchristos			&& UNAME_MACHINE=i586
1229c20607aeSchristos		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1230c20607aeSchristos			&& UNAME_MACHINE=i686
1231c20607aeSchristos		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1232c20607aeSchristos			&& UNAME_MACHINE=i686
1233c20607aeSchristos		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1234c20607aeSchristos	else
1235c20607aeSchristos		GUESS=$UNAME_MACHINE-pc-sysv32
1236c20607aeSchristos	fi
1237c20607aeSchristos	;;
1238c20607aeSchristos    pc:*:*:*)
1239c20607aeSchristos	# Left here for compatibility:
1240c20607aeSchristos	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1241c20607aeSchristos	# the processor, so we play safe by assuming i586.
1242c20607aeSchristos	# Note: whatever this is, it MUST be the same as what config.sub
1243c20607aeSchristos	# prints for the "djgpp" host, or else GDB configure will decide that
1244c20607aeSchristos	# this is a cross-build.
1245c20607aeSchristos	GUESS=i586-pc-msdosdjgpp
1246c20607aeSchristos	;;
1247c20607aeSchristos    Intel:Mach:3*:*)
1248c20607aeSchristos	GUESS=i386-pc-mach3
1249c20607aeSchristos	;;
1250c20607aeSchristos    paragon:*:*:*)
1251c20607aeSchristos	GUESS=i860-intel-osf1
1252c20607aeSchristos	;;
1253c20607aeSchristos    i860:*:4.*:*) # i860-SVR4
1254c20607aeSchristos	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1255c20607aeSchristos	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1256c20607aeSchristos	else # Add other i860-SVR4 vendors below as they are discovered.
1257c20607aeSchristos	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1258c20607aeSchristos	fi
1259c20607aeSchristos	;;
1260c20607aeSchristos    mini*:CTIX:SYS*5:*)
1261c20607aeSchristos	# "miniframe"
1262c20607aeSchristos	GUESS=m68010-convergent-sysv
1263c20607aeSchristos	;;
1264c20607aeSchristos    mc68k:UNIX:SYSTEM5:3.51m)
1265c20607aeSchristos	GUESS=m68k-convergent-sysv
1266c20607aeSchristos	;;
1267c20607aeSchristos    M680?0:D-NIX:5.3:*)
1268c20607aeSchristos	GUESS=m68k-diab-dnix
1269c20607aeSchristos	;;
1270c20607aeSchristos    M68*:*:R3V[5678]*:*)
1271c20607aeSchristos	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1272c20607aeSchristos    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)
1273c20607aeSchristos	OS_REL=''
1274c20607aeSchristos	test -r /etc/.relid \
1275c20607aeSchristos	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1276c20607aeSchristos	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1277c20607aeSchristos	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1278c20607aeSchristos	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1279c20607aeSchristos	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1280c20607aeSchristos    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1281c20607aeSchristos	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1282c20607aeSchristos	  && { echo i486-ncr-sysv4; exit; } ;;
1283c20607aeSchristos    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1284c20607aeSchristos	OS_REL='.3'
1285c20607aeSchristos	test -r /etc/.relid \
1286c20607aeSchristos	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1287c20607aeSchristos	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1288c20607aeSchristos	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1289c20607aeSchristos	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1290c20607aeSchristos	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1291c20607aeSchristos	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1292c20607aeSchristos	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1293c20607aeSchristos    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1294c20607aeSchristos	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1295c20607aeSchristos	;;
1296c20607aeSchristos    mc68030:UNIX_System_V:4.*:*)
1297c20607aeSchristos	GUESS=m68k-atari-sysv4
1298c20607aeSchristos	;;
1299c20607aeSchristos    TSUNAMI:LynxOS:2.*:*)
1300c20607aeSchristos	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1301c20607aeSchristos	;;
1302c20607aeSchristos    rs6000:LynxOS:2.*:*)
1303c20607aeSchristos	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1304c20607aeSchristos	;;
1305c20607aeSchristos    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1306c20607aeSchristos	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1307c20607aeSchristos	;;
1308c20607aeSchristos    SM[BE]S:UNIX_SV:*:*)
1309c20607aeSchristos	GUESS=mips-dde-sysv$UNAME_RELEASE
1310c20607aeSchristos	;;
1311c20607aeSchristos    RM*:ReliantUNIX-*:*:*)
1312c20607aeSchristos	GUESS=mips-sni-sysv4
1313c20607aeSchristos	;;
1314c20607aeSchristos    RM*:SINIX-*:*:*)
1315c20607aeSchristos	GUESS=mips-sni-sysv4
1316c20607aeSchristos	;;
1317c20607aeSchristos    *:SINIX-*:*:*)
1318c20607aeSchristos	if uname -p 2>/dev/null >/dev/null ; then
1319c20607aeSchristos		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1320c20607aeSchristos		GUESS=$UNAME_MACHINE-sni-sysv4
1321c20607aeSchristos	else
1322c20607aeSchristos		GUESS=ns32k-sni-sysv
1323c20607aeSchristos	fi
1324c20607aeSchristos	;;
1325c20607aeSchristos    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1326c20607aeSchristos			# says <Richard.M.Bartel@ccMail.Census.GOV>
1327c20607aeSchristos	GUESS=i586-unisys-sysv4
1328c20607aeSchristos	;;
1329c20607aeSchristos    *:UNIX_System_V:4*:FTX*)
1330c20607aeSchristos	# From Gerald Hewes <hewes@openmarket.com>.
1331c20607aeSchristos	# How about differentiating between stratus architectures? -djm
1332c20607aeSchristos	GUESS=hppa1.1-stratus-sysv4
1333c20607aeSchristos	;;
1334c20607aeSchristos    *:*:*:FTX*)
1335c20607aeSchristos	# From seanf@swdc.stratus.com.
1336c20607aeSchristos	GUESS=i860-stratus-sysv4
1337c20607aeSchristos	;;
1338c20607aeSchristos    i*86:VOS:*:*)
1339c20607aeSchristos	# From Paul.Green@stratus.com.
1340c20607aeSchristos	GUESS=$UNAME_MACHINE-stratus-vos
1341c20607aeSchristos	;;
1342c20607aeSchristos    *:VOS:*:*)
1343c20607aeSchristos	# From Paul.Green@stratus.com.
1344c20607aeSchristos	GUESS=hppa1.1-stratus-vos
1345c20607aeSchristos	;;
1346c20607aeSchristos    mc68*:A/UX:*:*)
1347c20607aeSchristos	GUESS=m68k-apple-aux$UNAME_RELEASE
1348c20607aeSchristos	;;
1349c20607aeSchristos    news*:NEWS-OS:6*:*)
1350c20607aeSchristos	GUESS=mips-sony-newsos6
1351c20607aeSchristos	;;
1352c20607aeSchristos    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1353c20607aeSchristos	if test -d /usr/nec; then
1354c20607aeSchristos		GUESS=mips-nec-sysv$UNAME_RELEASE
1355c20607aeSchristos	else
1356c20607aeSchristos		GUESS=mips-unknown-sysv$UNAME_RELEASE
1357c20607aeSchristos	fi
1358c20607aeSchristos	;;
1359c20607aeSchristos    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1360c20607aeSchristos	GUESS=powerpc-be-beos
1361c20607aeSchristos	;;
1362c20607aeSchristos    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1363c20607aeSchristos	GUESS=powerpc-apple-beos
1364c20607aeSchristos	;;
1365c20607aeSchristos    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1366c20607aeSchristos	GUESS=i586-pc-beos
1367c20607aeSchristos	;;
1368c20607aeSchristos    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1369c20607aeSchristos	GUESS=i586-pc-haiku
1370c20607aeSchristos	;;
1371c20607aeSchristos    x86_64:Haiku:*:*)
1372c20607aeSchristos	GUESS=x86_64-unknown-haiku
1373c20607aeSchristos	;;
1374c20607aeSchristos    SX-4:SUPER-UX:*:*)
1375c20607aeSchristos	GUESS=sx4-nec-superux$UNAME_RELEASE
1376c20607aeSchristos	;;
1377c20607aeSchristos    SX-5:SUPER-UX:*:*)
1378c20607aeSchristos	GUESS=sx5-nec-superux$UNAME_RELEASE
1379c20607aeSchristos	;;
1380c20607aeSchristos    SX-6:SUPER-UX:*:*)
1381c20607aeSchristos	GUESS=sx6-nec-superux$UNAME_RELEASE
1382c20607aeSchristos	;;
1383c20607aeSchristos    SX-7:SUPER-UX:*:*)
1384c20607aeSchristos	GUESS=sx7-nec-superux$UNAME_RELEASE
1385c20607aeSchristos	;;
1386c20607aeSchristos    SX-8:SUPER-UX:*:*)
1387c20607aeSchristos	GUESS=sx8-nec-superux$UNAME_RELEASE
1388c20607aeSchristos	;;
1389c20607aeSchristos    SX-8R:SUPER-UX:*:*)
1390c20607aeSchristos	GUESS=sx8r-nec-superux$UNAME_RELEASE
1391c20607aeSchristos	;;
1392c20607aeSchristos    SX-ACE:SUPER-UX:*:*)
1393c20607aeSchristos	GUESS=sxace-nec-superux$UNAME_RELEASE
1394c20607aeSchristos	;;
1395c20607aeSchristos    Power*:Rhapsody:*:*)
1396c20607aeSchristos	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1397c20607aeSchristos	;;
1398c20607aeSchristos    *:Rhapsody:*:*)
1399c20607aeSchristos	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1400c20607aeSchristos	;;
1401c20607aeSchristos    arm64:Darwin:*:*)
1402c20607aeSchristos	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1403c20607aeSchristos	;;
1404c20607aeSchristos    *:Darwin:*:*)
1405c20607aeSchristos	UNAME_PROCESSOR=`uname -p`
1406c20607aeSchristos	case $UNAME_PROCESSOR in
1407c20607aeSchristos	    unknown) UNAME_PROCESSOR=powerpc ;;
1408c20607aeSchristos	esac
1409c20607aeSchristos	if command -v xcode-select > /dev/null 2> /dev/null && \
1410c20607aeSchristos		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1411c20607aeSchristos	    # Avoid executing cc if there is no toolchain installed as
1412c20607aeSchristos	    # cc will be a stub that puts up a graphical alert
1413c20607aeSchristos	    # prompting the user to install developer tools.
1414c20607aeSchristos	    CC_FOR_BUILD=no_compiler_found
1415c20607aeSchristos	else
1416c20607aeSchristos	    set_cc_for_build
1417c20607aeSchristos	fi
1418c20607aeSchristos	if test "$CC_FOR_BUILD" != no_compiler_found; then
1419c20607aeSchristos	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1420c20607aeSchristos		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1421c20607aeSchristos		   grep IS_64BIT_ARCH >/dev/null
1422c20607aeSchristos	    then
1423c20607aeSchristos		case $UNAME_PROCESSOR in
1424c20607aeSchristos		    i386) UNAME_PROCESSOR=x86_64 ;;
1425c20607aeSchristos		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1426c20607aeSchristos		esac
1427c20607aeSchristos	    fi
1428c20607aeSchristos	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1429c20607aeSchristos	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1430c20607aeSchristos		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1431c20607aeSchristos		   grep IS_PPC >/dev/null
1432c20607aeSchristos	    then
1433c20607aeSchristos		UNAME_PROCESSOR=powerpc
1434c20607aeSchristos	    fi
1435c20607aeSchristos	elif test "$UNAME_PROCESSOR" = i386 ; then
1436c20607aeSchristos	    # uname -m returns i386 or x86_64
1437c20607aeSchristos	    UNAME_PROCESSOR=$UNAME_MACHINE
1438c20607aeSchristos	fi
1439c20607aeSchristos	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1440c20607aeSchristos	;;
1441c20607aeSchristos    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1442c20607aeSchristos	UNAME_PROCESSOR=`uname -p`
1443c20607aeSchristos	if test "$UNAME_PROCESSOR" = x86; then
1444c20607aeSchristos		UNAME_PROCESSOR=i386
1445c20607aeSchristos		UNAME_MACHINE=pc
1446c20607aeSchristos	fi
1447c20607aeSchristos	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1448c20607aeSchristos	;;
1449c20607aeSchristos    *:QNX:*:4*)
1450c20607aeSchristos	GUESS=i386-pc-qnx
1451c20607aeSchristos	;;
1452c20607aeSchristos    NEO-*:NONSTOP_KERNEL:*:*)
1453c20607aeSchristos	GUESS=neo-tandem-nsk$UNAME_RELEASE
1454c20607aeSchristos	;;
1455c20607aeSchristos    NSE-*:NONSTOP_KERNEL:*:*)
1456c20607aeSchristos	GUESS=nse-tandem-nsk$UNAME_RELEASE
1457c20607aeSchristos	;;
1458c20607aeSchristos    NSR-*:NONSTOP_KERNEL:*:*)
1459c20607aeSchristos	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1460c20607aeSchristos	;;
1461c20607aeSchristos    NSV-*:NONSTOP_KERNEL:*:*)
1462c20607aeSchristos	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1463c20607aeSchristos	;;
1464c20607aeSchristos    NSX-*:NONSTOP_KERNEL:*:*)
1465c20607aeSchristos	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1466c20607aeSchristos	;;
1467c20607aeSchristos    *:NonStop-UX:*:*)
1468c20607aeSchristos	GUESS=mips-compaq-nonstopux
1469c20607aeSchristos	;;
1470c20607aeSchristos    BS2000:POSIX*:*:*)
1471c20607aeSchristos	GUESS=bs2000-siemens-sysv
1472c20607aeSchristos	;;
1473c20607aeSchristos    DS/*:UNIX_System_V:*:*)
1474c20607aeSchristos	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1475c20607aeSchristos	;;
1476c20607aeSchristos    *:Plan9:*:*)
1477c20607aeSchristos	# "uname -m" is not consistent, so use $cputype instead. 386
1478c20607aeSchristos	# is converted to i386 for consistency with other x86
1479c20607aeSchristos	# operating systems.
1480c20607aeSchristos	if test "${cputype-}" = 386; then
1481c20607aeSchristos	    UNAME_MACHINE=i386
1482c20607aeSchristos	elif test "x${cputype-}" != x; then
1483c20607aeSchristos	    UNAME_MACHINE=$cputype
1484c20607aeSchristos	fi
1485c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-plan9
1486c20607aeSchristos	;;
1487c20607aeSchristos    *:TOPS-10:*:*)
1488c20607aeSchristos	GUESS=pdp10-unknown-tops10
1489c20607aeSchristos	;;
1490c20607aeSchristos    *:TENEX:*:*)
1491c20607aeSchristos	GUESS=pdp10-unknown-tenex
1492c20607aeSchristos	;;
1493c20607aeSchristos    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1494c20607aeSchristos	GUESS=pdp10-dec-tops20
1495c20607aeSchristos	;;
1496c20607aeSchristos    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1497c20607aeSchristos	GUESS=pdp10-xkl-tops20
1498c20607aeSchristos	;;
1499c20607aeSchristos    *:TOPS-20:*:*)
1500c20607aeSchristos	GUESS=pdp10-unknown-tops20
1501c20607aeSchristos	;;
1502c20607aeSchristos    *:ITS:*:*)
1503c20607aeSchristos	GUESS=pdp10-unknown-its
1504c20607aeSchristos	;;
1505c20607aeSchristos    SEI:*:*:SEIUX)
1506c20607aeSchristos	GUESS=mips-sei-seiux$UNAME_RELEASE
1507c20607aeSchristos	;;
1508c20607aeSchristos    *:DragonFly:*:*)
1509c20607aeSchristos	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1510c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1511c20607aeSchristos	;;
1512c20607aeSchristos    *:*VMS:*:*)
1513c20607aeSchristos	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1514c20607aeSchristos	case $UNAME_MACHINE in
1515c20607aeSchristos	    A*) GUESS=alpha-dec-vms ;;
1516c20607aeSchristos	    I*) GUESS=ia64-dec-vms ;;
1517c20607aeSchristos	    V*) GUESS=vax-dec-vms ;;
1518c20607aeSchristos	esac ;;
1519c20607aeSchristos    *:XENIX:*:SysV)
1520c20607aeSchristos	GUESS=i386-pc-xenix
1521c20607aeSchristos	;;
1522c20607aeSchristos    i*86:skyos:*:*)
1523c20607aeSchristos	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1524c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1525c20607aeSchristos	;;
1526c20607aeSchristos    i*86:rdos:*:*)
1527c20607aeSchristos	GUESS=$UNAME_MACHINE-pc-rdos
1528c20607aeSchristos	;;
1529c20607aeSchristos    *:AROS:*:*)
1530c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-aros
1531c20607aeSchristos	;;
1532c20607aeSchristos    x86_64:VMkernel:*:*)
1533c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-esx
1534c20607aeSchristos	;;
1535c20607aeSchristos    amd64:Isilon\ OneFS:*:*)
1536c20607aeSchristos	GUESS=x86_64-unknown-onefs
1537c20607aeSchristos	;;
1538c20607aeSchristos    *:Unleashed:*:*)
1539c20607aeSchristos	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1540c20607aeSchristos	;;
1541c20607aeSchristosesac
1542c20607aeSchristos
1543c20607aeSchristos# Do we have a guess based on uname results?
1544c20607aeSchristosif test "x$GUESS" != x; then
1545c20607aeSchristos    echo "$GUESS"
1546c20607aeSchristos    exit
1547c20607aeSchristosfi
1548c20607aeSchristos
1549c20607aeSchristos# No uname command or uname output not recognized.
1550c20607aeSchristosset_cc_for_build
1551c20607aeSchristoscat > "$dummy.c" <<EOF
1552c20607aeSchristos#ifdef _SEQUENT_
1553c20607aeSchristos#include <sys/types.h>
1554c20607aeSchristos#include <sys/utsname.h>
1555c20607aeSchristos#endif
1556c20607aeSchristos#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1557c20607aeSchristos#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1558c20607aeSchristos#include <signal.h>
1559c20607aeSchristos#if defined(_SIZE_T_) || defined(SIGLOST)
1560c20607aeSchristos#include <sys/utsname.h>
1561c20607aeSchristos#endif
1562c20607aeSchristos#endif
1563c20607aeSchristos#endif
1564c20607aeSchristosmain ()
1565c20607aeSchristos{
1566c20607aeSchristos#if defined (sony)
1567c20607aeSchristos#if defined (MIPSEB)
1568c20607aeSchristos  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1569c20607aeSchristos     I don't know....  */
1570c20607aeSchristos  printf ("mips-sony-bsd\n"); exit (0);
1571c20607aeSchristos#else
1572c20607aeSchristos#include <sys/param.h>
1573c20607aeSchristos  printf ("m68k-sony-newsos%s\n",
1574c20607aeSchristos#ifdef NEWSOS4
1575c20607aeSchristos  "4"
1576c20607aeSchristos#else
1577c20607aeSchristos  ""
1578c20607aeSchristos#endif
1579c20607aeSchristos  ); exit (0);
1580c20607aeSchristos#endif
1581c20607aeSchristos#endif
1582c20607aeSchristos
1583c20607aeSchristos#if defined (NeXT)
1584c20607aeSchristos#if !defined (__ARCHITECTURE__)
1585c20607aeSchristos#define __ARCHITECTURE__ "m68k"
1586c20607aeSchristos#endif
1587c20607aeSchristos  int version;
1588c20607aeSchristos  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1589c20607aeSchristos  if (version < 4)
1590c20607aeSchristos    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1591c20607aeSchristos  else
1592c20607aeSchristos    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1593c20607aeSchristos  exit (0);
1594c20607aeSchristos#endif
1595c20607aeSchristos
1596c20607aeSchristos#if defined (MULTIMAX) || defined (n16)
1597c20607aeSchristos#if defined (UMAXV)
1598c20607aeSchristos  printf ("ns32k-encore-sysv\n"); exit (0);
1599c20607aeSchristos#else
1600c20607aeSchristos#if defined (CMU)
1601c20607aeSchristos  printf ("ns32k-encore-mach\n"); exit (0);
1602c20607aeSchristos#else
1603c20607aeSchristos  printf ("ns32k-encore-bsd\n"); exit (0);
1604c20607aeSchristos#endif
1605c20607aeSchristos#endif
1606c20607aeSchristos#endif
1607c20607aeSchristos
1608c20607aeSchristos#if defined (__386BSD__)
1609c20607aeSchristos  printf ("i386-pc-bsd\n"); exit (0);
1610c20607aeSchristos#endif
1611c20607aeSchristos
1612c20607aeSchristos#if defined (sequent)
1613c20607aeSchristos#if defined (i386)
1614c20607aeSchristos  printf ("i386-sequent-dynix\n"); exit (0);
1615c20607aeSchristos#endif
1616c20607aeSchristos#if defined (ns32000)
1617c20607aeSchristos  printf ("ns32k-sequent-dynix\n"); exit (0);
1618c20607aeSchristos#endif
1619c20607aeSchristos#endif
1620c20607aeSchristos
1621c20607aeSchristos#if defined (_SEQUENT_)
1622c20607aeSchristos  struct utsname un;
1623c20607aeSchristos
1624c20607aeSchristos  uname(&un);
1625c20607aeSchristos  if (strncmp(un.version, "V2", 2) == 0) {
1626c20607aeSchristos    printf ("i386-sequent-ptx2\n"); exit (0);
1627c20607aeSchristos  }
1628c20607aeSchristos  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1629c20607aeSchristos    printf ("i386-sequent-ptx1\n"); exit (0);
1630c20607aeSchristos  }
1631c20607aeSchristos  printf ("i386-sequent-ptx\n"); exit (0);
1632c20607aeSchristos#endif
1633c20607aeSchristos
1634c20607aeSchristos#if defined (vax)
1635c20607aeSchristos#if !defined (ultrix)
1636c20607aeSchristos#include <sys/param.h>
1637c20607aeSchristos#if defined (BSD)
1638c20607aeSchristos#if BSD == 43
1639c20607aeSchristos  printf ("vax-dec-bsd4.3\n"); exit (0);
1640c20607aeSchristos#else
1641c20607aeSchristos#if BSD == 199006
1642c20607aeSchristos  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1643c20607aeSchristos#else
1644c20607aeSchristos  printf ("vax-dec-bsd\n"); exit (0);
1645c20607aeSchristos#endif
1646c20607aeSchristos#endif
1647c20607aeSchristos#else
1648c20607aeSchristos  printf ("vax-dec-bsd\n"); exit (0);
1649c20607aeSchristos#endif
1650c20607aeSchristos#else
1651c20607aeSchristos#if defined(_SIZE_T_) || defined(SIGLOST)
1652c20607aeSchristos  struct utsname un;
1653c20607aeSchristos  uname (&un);
1654c20607aeSchristos  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1655c20607aeSchristos#else
1656c20607aeSchristos  printf ("vax-dec-ultrix\n"); exit (0);
1657c20607aeSchristos#endif
1658c20607aeSchristos#endif
1659c20607aeSchristos#endif
1660c20607aeSchristos#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1661c20607aeSchristos#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1662c20607aeSchristos#if defined(_SIZE_T_) || defined(SIGLOST)
1663c20607aeSchristos  struct utsname *un;
1664c20607aeSchristos  uname (&un);
1665c20607aeSchristos  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1666c20607aeSchristos#else
1667c20607aeSchristos  printf ("mips-dec-ultrix\n"); exit (0);
1668c20607aeSchristos#endif
1669c20607aeSchristos#endif
1670c20607aeSchristos#endif
1671c20607aeSchristos
1672c20607aeSchristos#if defined (alliant) && defined (i860)
1673c20607aeSchristos  printf ("i860-alliant-bsd\n"); exit (0);
1674c20607aeSchristos#endif
1675c20607aeSchristos
1676c20607aeSchristos  exit (1);
1677c20607aeSchristos}
1678c20607aeSchristosEOF
1679c20607aeSchristos
1680c20607aeSchristos$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1681c20607aeSchristos	{ echo "$SYSTEM_NAME"; exit; }
1682c20607aeSchristos
1683c20607aeSchristos# Apollos put the system type in the environment.
1684c20607aeSchristostest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1685c20607aeSchristos
1686c20607aeSchristosecho "$0: unable to guess system type" >&2
1687c20607aeSchristos
1688c20607aeSchristoscase $UNAME_MACHINE:$UNAME_SYSTEM in
1689c20607aeSchristos    mips:Linux | mips64:Linux)
1690c20607aeSchristos	# If we got here on MIPS GNU/Linux, output extra information.
1691c20607aeSchristos	cat >&2 <<EOF
1692c20607aeSchristos
1693c20607aeSchristosNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1694c20607aeSchristosthe system type. Please install a C compiler and try again.
1695c20607aeSchristosEOF
1696c20607aeSchristos	;;
1697c20607aeSchristosesac
1698c20607aeSchristos
1699c20607aeSchristoscat >&2 <<EOF
1700c20607aeSchristos
1701c20607aeSchristosThis script (version $timestamp), has failed to recognize the
1702c20607aeSchristosoperating system you are using. If your script is old, overwrite *all*
1703c20607aeSchristoscopies of config.guess and config.sub with the latest versions from:
1704c20607aeSchristos
1705c20607aeSchristos  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1706c20607aeSchristosand
1707c20607aeSchristos  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1708c20607aeSchristosEOF
1709c20607aeSchristos
1710c20607aeSchristosour_year=`echo $timestamp | sed 's,-.*,,'`
1711c20607aeSchristosthisyear=`date +%Y`
1712c20607aeSchristos# shellcheck disable=SC2003
1713c20607aeSchristosscript_age=`expr "$thisyear" - "$our_year"`
1714c20607aeSchristosif test "$script_age" -lt 3 ; then
1715c20607aeSchristos   cat >&2 <<EOF
1716c20607aeSchristos
1717c20607aeSchristosIf $0 has already been updated, send the following data and any
1718c20607aeSchristosinformation you think might be pertinent to config-patches@gnu.org to
1719c20607aeSchristosprovide the necessary information to handle your system.
1720c20607aeSchristos
1721c20607aeSchristosconfig.guess timestamp = $timestamp
1722c20607aeSchristos
1723c20607aeSchristosuname -m = `(uname -m) 2>/dev/null || echo unknown`
1724c20607aeSchristosuname -r = `(uname -r) 2>/dev/null || echo unknown`
1725c20607aeSchristosuname -s = `(uname -s) 2>/dev/null || echo unknown`
1726c20607aeSchristosuname -v = `(uname -v) 2>/dev/null || echo unknown`
1727c20607aeSchristos
1728c20607aeSchristos/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1729c20607aeSchristos/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1730c20607aeSchristos
1731c20607aeSchristoshostinfo               = `(hostinfo) 2>/dev/null`
1732c20607aeSchristos/bin/universe          = `(/bin/universe) 2>/dev/null`
1733c20607aeSchristos/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1734c20607aeSchristos/bin/arch              = `(/bin/arch) 2>/dev/null`
1735c20607aeSchristos/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1736c20607aeSchristos/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1737c20607aeSchristos
1738c20607aeSchristosUNAME_MACHINE = "$UNAME_MACHINE"
1739c20607aeSchristosUNAME_RELEASE = "$UNAME_RELEASE"
1740c20607aeSchristosUNAME_SYSTEM  = "$UNAME_SYSTEM"
1741c20607aeSchristosUNAME_VERSION = "$UNAME_VERSION"
1742c20607aeSchristosEOF
1743c20607aeSchristosfi
1744c20607aeSchristos
1745c20607aeSchristosexit 1
1746c20607aeSchristos
1747c20607aeSchristos# Local variables:
1748c20607aeSchristos# eval: (add-hook 'before-save-hook 'time-stamp)
1749c20607aeSchristos# time-stamp-start: "timestamp='"
1750c20607aeSchristos# time-stamp-format: "%:y-%02m-%02d"
1751c20607aeSchristos# time-stamp-end: "'"
1752c20607aeSchristos# End:
1753