xref: /freebsd/contrib/tcpdump/config.guess (revision 0a7e5f1f02aad2ff5fff1c60f44c6975fd07e1d9)
14edb46e9SPaul Traina#! /bin/sh
24edb46e9SPaul Traina# Attempt to guess a canonical system name.
3*0a7e5f1fSJoseph Mingrone#   Copyright 1992-2024 Free Software Foundation, Inc.
4685295f4SBill Fenner
5ee67461eSJoseph Mingrone# shellcheck disable=SC2006,SC2268 # see below for rationale
6ee67461eSJoseph Mingrone
7*0a7e5f1fSJoseph Mingronetimestamp='2024-01-01'
8685295f4SBill Fenner
94edb46e9SPaul Traina# This file is free software; you can redistribute it and/or modify it
104edb46e9SPaul Traina# under the terms of the GNU General Public License as published by
11ee67461eSJoseph Mingrone# the Free Software Foundation, either version 3 of the License, or
124edb46e9SPaul Traina# (at your option) any later version.
134edb46e9SPaul Traina#
144edb46e9SPaul Traina# This program is distributed in the hope that it will be useful, but
154edb46e9SPaul Traina# WITHOUT ANY WARRANTY; without even the implied warranty of
164edb46e9SPaul Traina# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
174edb46e9SPaul Traina# General Public License for more details.
184edb46e9SPaul Traina#
194edb46e9SPaul Traina# You should have received a copy of the GNU General Public License
2039e421e8SCy Schubert# along with this program; if not, see <https://www.gnu.org/licenses/>.
214edb46e9SPaul Traina#
224edb46e9SPaul Traina# As a special exception to the GNU General Public License, if you
234edb46e9SPaul Traina# distribute this file as part of a program that contains a
244edb46e9SPaul Traina# configuration script generated by Autoconf, you may include it under
258bdc5a62SPatrick Kelsey# the same distribution terms that you use for the rest of that
268bdc5a62SPatrick Kelsey# program.  This Exception is an additional permission under section 7
278bdc5a62SPatrick Kelsey# of the GNU General Public License, version 3 ("GPLv3").
284edb46e9SPaul Traina#
298bdc5a62SPatrick Kelsey# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
304edb46e9SPaul Traina#
3127df3f5dSRui Paulo# You can get the latest version of this script from:
32ee67461eSJoseph Mingrone# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
338bdc5a62SPatrick Kelsey#
348bdc5a62SPatrick Kelsey# Please send patches to <config-patches@gnu.org>.
358bdc5a62SPatrick Kelsey
364edb46e9SPaul Traina
37ee67461eSJoseph Mingrone# The "shellcheck disable" line above the timestamp inhibits complaints
38ee67461eSJoseph Mingrone# about features and limitations of the classic Bourne shell that were
39ee67461eSJoseph Mingrone# superseded or lifted in POSIX.  However, this script identifies a wide
40ee67461eSJoseph Mingrone# variety of pre-POSIX systems that do not have POSIX shells at all, and
41ee67461eSJoseph Mingrone# even some reasonably current systems (Solaris 10 as case-in-point) still
42ee67461eSJoseph Mingrone# have a pre-POSIX /bin/sh.
43ee67461eSJoseph Mingrone
44ee67461eSJoseph Mingrone
45685295f4SBill Fennerme=`echo "$0" | sed -e 's,.*/,,'`
46685295f4SBill Fenner
47685295f4SBill Fennerusage="\
48685295f4SBill FennerUsage: $0 [OPTION]
49685295f4SBill Fenner
50*0a7e5f1fSJoseph MingroneOutput the configuration name of the system '$me' is run on.
51685295f4SBill Fenner
5239e421e8SCy SchubertOptions:
53685295f4SBill Fenner  -h, --help         print this help, then exit
54685295f4SBill Fenner  -t, --time-stamp   print date of last modification, then exit
55685295f4SBill Fenner  -v, --version      print version number, then exit
56685295f4SBill Fenner
57685295f4SBill FennerReport bugs and patches to <config-patches@gnu.org>."
58685295f4SBill Fenner
59685295f4SBill Fennerversion="\
60685295f4SBill FennerGNU config.guess ($timestamp)
61685295f4SBill Fenner
62685295f4SBill FennerOriginally written by Per Bothner.
63*0a7e5f1fSJoseph MingroneCopyright 1992-2024 Free Software Foundation, Inc.
64685295f4SBill Fenner
65685295f4SBill FennerThis is free software; see the source for copying conditions.  There is NO
66685295f4SBill Fennerwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67685295f4SBill Fenner
68685295f4SBill Fennerhelp="
69*0a7e5f1fSJoseph MingroneTry '$me --help' for more information."
70685295f4SBill Fenner
71685295f4SBill Fenner# Parse command line
72685295f4SBill Fennerwhile test $# -gt 0 ; do
73685295f4SBill Fenner  case $1 in
74685295f4SBill Fenner    --time-stamp | --time* | -t )
7527df3f5dSRui Paulo       echo "$timestamp" ; exit ;;
76685295f4SBill Fenner    --version | -v )
7727df3f5dSRui Paulo       echo "$version" ; exit ;;
78685295f4SBill Fenner    --help | --h* | -h )
7927df3f5dSRui Paulo       echo "$usage"; exit ;;
80685295f4SBill Fenner    -- )     # Stop option processing
81685295f4SBill Fenner       shift; break ;;
82685295f4SBill Fenner    - )	# Use stdin as input.
83685295f4SBill Fenner       break ;;
84685295f4SBill Fenner    -* )
85685295f4SBill Fenner       echo "$me: invalid option $1$help" >&2
86685295f4SBill Fenner       exit 1 ;;
87685295f4SBill Fenner    * )
88685295f4SBill Fenner       break ;;
89685295f4SBill Fenner  esac
90685295f4SBill Fennerdone
91685295f4SBill Fenner
92685295f4SBill Fennerif test $# != 0; then
93685295f4SBill Fenner  echo "$me: too many arguments$help" >&2
94685295f4SBill Fenner  exit 1
95685295f4SBill Fennerfi
96685295f4SBill Fenner
97ee67461eSJoseph Mingrone# Just in case it came from the environment.
98ee67461eSJoseph MingroneGUESS=
99685295f4SBill Fenner
1005b0fe478SBruce M Simpson# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1015b0fe478SBruce M Simpson# compiler to aid in system detection is discouraged as it requires
1025b0fe478SBruce M Simpson# temporary files to be created and, as you can see below, it is a
1035b0fe478SBruce M Simpson# headache to deal with in a portable fashion.
104685295f4SBill Fenner
105*0a7e5f1fSJoseph Mingrone# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
106*0a7e5f1fSJoseph Mingrone# use 'HOST_CC' if defined, but it is deprecated.
107685295f4SBill Fenner
1085b0fe478SBruce M Simpson# Portable tmp directory creation inspired by the Autoconf team.
1095b0fe478SBruce M Simpson
110ee67461eSJoseph Mingronetmp=
111ee67461eSJoseph Mingrone# shellcheck disable=SC2172
112ee67461eSJoseph Mingronetrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113ee67461eSJoseph Mingrone
114ee67461eSJoseph Mingroneset_cc_for_build() {
115ee67461eSJoseph Mingrone    # prevent multiple calls if $tmp is already set
116ee67461eSJoseph Mingrone    test "$tmp" && return 0
117ee67461eSJoseph Mingrone    : "${TMPDIR=/tmp}"
118ee67461eSJoseph Mingrone    # shellcheck disable=SC2039,SC3028
11927df3f5dSRui Paulo    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120ee67461eSJoseph Mingrone	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121ee67461eSJoseph Mingrone	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122ee67461eSJoseph Mingrone	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123ee67461eSJoseph Mingrone    dummy=$tmp/dummy
12439e421e8SCy Schubert    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125ee67461eSJoseph Mingrone	,,)    echo "int x;" > "$dummy.c"
126ee67461eSJoseph Mingrone	       for driver in cc gcc c89 c99 ; do
127ee67461eSJoseph Mingrone		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128ee67461eSJoseph Mingrone		       CC_FOR_BUILD=$driver
129ee67461eSJoseph Mingrone		       break
130ee67461eSJoseph Mingrone		   fi
131ee67461eSJoseph Mingrone	       done
132685295f4SBill Fenner	       if test x"$CC_FOR_BUILD" = x ; then
133ee67461eSJoseph Mingrone		   CC_FOR_BUILD=no_compiler_found
134685295f4SBill Fenner	       fi
135685295f4SBill Fenner	       ;;
136685295f4SBill Fenner	,,*)   CC_FOR_BUILD=$CC ;;
137685295f4SBill Fenner	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138ee67461eSJoseph Mingrone    esac
139ee67461eSJoseph Mingrone}
140685295f4SBill Fenner
1414edb46e9SPaul Traina# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1425b0fe478SBruce M Simpson# (ghazi@noc.rutgers.edu 1994-08-24)
143ee67461eSJoseph Mingroneif test -f /.attbin/uname ; then
1444edb46e9SPaul Traina	PATH=$PATH:/.attbin ; export PATH
1454edb46e9SPaul Trainafi
1464edb46e9SPaul Traina
1474edb46e9SPaul TrainaUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1484edb46e9SPaul TrainaUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1494edb46e9SPaul TrainaUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1504edb46e9SPaul TrainaUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1514edb46e9SPaul Traina
152ee67461eSJoseph Mingronecase $UNAME_SYSTEM in
1538bdc5a62SPatrick KelseyLinux|GNU|GNU/*)
154ee67461eSJoseph Mingrone	LIBC=unknown
1558bdc5a62SPatrick Kelsey
156ee67461eSJoseph Mingrone	set_cc_for_build
15739e421e8SCy Schubert	cat <<-EOF > "$dummy.c"
158*0a7e5f1fSJoseph Mingrone	#if defined(__ANDROID__)
159*0a7e5f1fSJoseph Mingrone	LIBC=android
160*0a7e5f1fSJoseph Mingrone	#else
1618bdc5a62SPatrick Kelsey	#include <features.h>
1628bdc5a62SPatrick Kelsey	#if defined(__UCLIBC__)
1638bdc5a62SPatrick Kelsey	LIBC=uclibc
1648bdc5a62SPatrick Kelsey	#elif defined(__dietlibc__)
1658bdc5a62SPatrick Kelsey	LIBC=dietlibc
166ee67461eSJoseph Mingrone	#elif defined(__GLIBC__)
1678bdc5a62SPatrick Kelsey	LIBC=gnu
168*0a7e5f1fSJoseph Mingrone	#elif defined(__LLVM_LIBC__)
169*0a7e5f1fSJoseph Mingrone	LIBC=llvm
170ee67461eSJoseph Mingrone	#else
171ee67461eSJoseph Mingrone	#include <stdarg.h>
172ee67461eSJoseph Mingrone	/* First heuristic to detect musl libc.  */
173ee67461eSJoseph Mingrone	#ifdef __DEFINED_va_list
174ee67461eSJoseph Mingrone	LIBC=musl
175ee67461eSJoseph Mingrone	#endif
1768bdc5a62SPatrick Kelsey	#endif
177*0a7e5f1fSJoseph Mingrone	#endif
1788bdc5a62SPatrick Kelsey	EOF
179ee67461eSJoseph Mingrone	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
180ee67461eSJoseph Mingrone	eval "$cc_set_libc"
18139e421e8SCy Schubert
182ee67461eSJoseph Mingrone	# Second heuristic to detect musl libc.
183ee67461eSJoseph Mingrone	if [ "$LIBC" = unknown ] &&
184ee67461eSJoseph Mingrone	   command -v ldd >/dev/null &&
185ee67461eSJoseph Mingrone	   ldd --version 2>&1 | grep -q ^musl; then
18639e421e8SCy Schubert		LIBC=musl
18739e421e8SCy Schubert	fi
188ee67461eSJoseph Mingrone
189ee67461eSJoseph Mingrone	# If the system lacks a compiler, then just pick glibc.
190ee67461eSJoseph Mingrone	# We could probably try harder.
191ee67461eSJoseph Mingrone	if [ "$LIBC" = unknown ]; then
192ee67461eSJoseph Mingrone		LIBC=gnu
193ee67461eSJoseph Mingrone	fi
1948bdc5a62SPatrick Kelsey	;;
1958bdc5a62SPatrick Kelseyesac
1968bdc5a62SPatrick Kelsey
1974edb46e9SPaul Traina# Note: order is significant - the case branches are not exclusive.
1984edb46e9SPaul Traina
199ee67461eSJoseph Mingronecase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
200685295f4SBill Fenner    *:NetBSD:*:*)
2015b0fe478SBruce M Simpson	# NetBSD (nbsd) targets should (where applicable) match one or
2023c602fabSXin LI	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
203685295f4SBill Fenner	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
204685295f4SBill Fenner	# switched to ELF, *-*-netbsd* would select the old
205685295f4SBill Fenner	# object file format.  This provides both forward
206685295f4SBill Fenner	# compatibility and a consistent mechanism for selecting the
207685295f4SBill Fenner	# object file format.
2085b0fe478SBruce M Simpson	#
2095b0fe478SBruce M Simpson	# Note: NetBSD doesn't particularly care about the vendor
2105b0fe478SBruce M Simpson	# portion of the name.  We always set it to "unknown".
2118bdc5a62SPatrick Kelsey	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
212ee67461eSJoseph Mingrone	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
213ee67461eSJoseph Mingrone	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2148bdc5a62SPatrick Kelsey	    echo unknown)`
215ee67461eSJoseph Mingrone	case $UNAME_MACHINE_ARCH in
216ee67461eSJoseph Mingrone	    aarch64eb) machine=aarch64_be-unknown ;;
2175b0fe478SBruce M Simpson	    armeb) machine=armeb-unknown ;;
2185b0fe478SBruce M Simpson	    arm*) machine=arm-unknown ;;
2195b0fe478SBruce M Simpson	    sh3el) machine=shl-unknown ;;
2205b0fe478SBruce M Simpson	    sh3eb) machine=sh-unknown ;;
22127df3f5dSRui Paulo	    sh5el) machine=sh5le-unknown ;;
2228bdc5a62SPatrick Kelsey	    earmv*)
22339e421e8SCy Schubert		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
22439e421e8SCy Schubert		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
225ee67461eSJoseph Mingrone		machine=${arch}${endian}-unknown
2268bdc5a62SPatrick Kelsey		;;
227ee67461eSJoseph Mingrone	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
228685295f4SBill Fenner	esac
229685295f4SBill Fenner	# The Operating System including object format, if it has switched
23039e421e8SCy Schubert	# to ELF recently (or will in the future) and ABI.
231ee67461eSJoseph Mingrone	case $UNAME_MACHINE_ARCH in
23239e421e8SCy Schubert	    earm*)
23339e421e8SCy Schubert		os=netbsdelf
23439e421e8SCy Schubert		;;
23539e421e8SCy Schubert	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
236ee67461eSJoseph Mingrone		set_cc_for_build
237685295f4SBill Fenner		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
23827df3f5dSRui Paulo			| grep -q __ELF__
239685295f4SBill Fenner		then
240685295f4SBill Fenner		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
241685295f4SBill Fenner		    # Return netbsd for either.  FIX?
242685295f4SBill Fenner		    os=netbsd
243685295f4SBill Fenner		else
244685295f4SBill Fenner		    os=netbsdelf
245685295f4SBill Fenner		fi
246685295f4SBill Fenner		;;
247685295f4SBill Fenner	    *)
248685295f4SBill Fenner		os=netbsd
249685295f4SBill Fenner		;;
250685295f4SBill Fenner	esac
2518bdc5a62SPatrick Kelsey	# Determine ABI tags.
252ee67461eSJoseph Mingrone	case $UNAME_MACHINE_ARCH in
2538bdc5a62SPatrick Kelsey	    earm*)
2548bdc5a62SPatrick Kelsey		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
25539e421e8SCy Schubert		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2568bdc5a62SPatrick Kelsey		;;
2578bdc5a62SPatrick Kelsey	esac
258685295f4SBill Fenner	# The OS release
2595b0fe478SBruce M Simpson	# Debian GNU/NetBSD machines have a different userland, and
2605b0fe478SBruce M Simpson	# thus, need a distinct triplet. However, they do not need
2615b0fe478SBruce M Simpson	# kernel version information, so it can be replaced with a
2625b0fe478SBruce M Simpson	# suitable tag, in the style of linux-gnu.
263ee67461eSJoseph Mingrone	case $UNAME_VERSION in
2645b0fe478SBruce M Simpson	    Debian*)
2655b0fe478SBruce M Simpson		release='-gnu'
2665b0fe478SBruce M Simpson		;;
2675b0fe478SBruce M Simpson	    *)
26839e421e8SCy Schubert		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2695b0fe478SBruce M Simpson		;;
2705b0fe478SBruce M Simpson	esac
271685295f4SBill Fenner	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
272685295f4SBill Fenner	# contains redundant information, the shorter form:
273685295f4SBill Fenner	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
274ee67461eSJoseph Mingrone	GUESS=$machine-${os}${release}${abi-}
275ee67461eSJoseph Mingrone	;;
2768bdc5a62SPatrick Kelsey    *:Bitrig:*:*)
2778bdc5a62SPatrick Kelsey	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
278ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
279ee67461eSJoseph Mingrone	;;
2805b0fe478SBruce M Simpson    *:OpenBSD:*:*)
28127df3f5dSRui Paulo	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
282ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
283ee67461eSJoseph Mingrone	;;
284ee67461eSJoseph Mingrone    *:SecBSD:*:*)
285ee67461eSJoseph Mingrone	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
286ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
287ee67461eSJoseph Mingrone	;;
28839e421e8SCy Schubert    *:LibertyBSD:*:*)
28939e421e8SCy Schubert	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
290ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
291ee67461eSJoseph Mingrone	;;
29239e421e8SCy Schubert    *:MidnightBSD:*:*)
293ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
294ee67461eSJoseph Mingrone	;;
29527df3f5dSRui Paulo    *:ekkoBSD:*:*)
296ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
297ee67461eSJoseph Mingrone	;;
29827df3f5dSRui Paulo    *:SolidBSD:*:*)
299ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
300ee67461eSJoseph Mingrone	;;
301ee67461eSJoseph Mingrone    *:OS108:*:*)
302ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
303ee67461eSJoseph Mingrone	;;
30427df3f5dSRui Paulo    macppc:MirBSD:*:*)
305ee67461eSJoseph Mingrone	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
306ee67461eSJoseph Mingrone	;;
30727df3f5dSRui Paulo    *:MirBSD:*:*)
308ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
309ee67461eSJoseph Mingrone	;;
31039e421e8SCy Schubert    *:Sortix:*:*)
311ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-sortix
312ee67461eSJoseph Mingrone	;;
313ee67461eSJoseph Mingrone    *:Twizzler:*:*)
314ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-twizzler
315ee67461eSJoseph Mingrone	;;
31639e421e8SCy Schubert    *:Redox:*:*)
317ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-redox
318ee67461eSJoseph Mingrone	;;
31939e421e8SCy Schubert    mips:OSF1:*.*)
320ee67461eSJoseph Mingrone	GUESS=mips-dec-osf1
321ee67461eSJoseph Mingrone	;;
3224edb46e9SPaul Traina    alpha:OSF1:*:*)
323ee67461eSJoseph Mingrone	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
324ee67461eSJoseph Mingrone	trap '' 0
32527df3f5dSRui Paulo	case $UNAME_RELEASE in
32627df3f5dSRui Paulo	*4.0)
327685295f4SBill Fenner		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32827df3f5dSRui Paulo		;;
32927df3f5dSRui Paulo	*5.*)
33027df3f5dSRui Paulo		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
33127df3f5dSRui Paulo		;;
33227df3f5dSRui Paulo	esac
3335b0fe478SBruce M Simpson	# According to Compaq, /usr/sbin/psrinfo has been available on
3345b0fe478SBruce M Simpson	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3355b0fe478SBruce M Simpson	# covers most systems running today.  This code pipes the CPU
3365b0fe478SBruce M Simpson	# types through head -n 1, so we only detect the type of CPU 0.
3375b0fe478SBruce M Simpson	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
338ee67461eSJoseph Mingrone	case $ALPHA_CPU_TYPE in
3395b0fe478SBruce M Simpson	    "EV4 (21064)")
34039e421e8SCy Schubert		UNAME_MACHINE=alpha ;;
3415b0fe478SBruce M Simpson	    "EV4.5 (21064)")
34239e421e8SCy Schubert		UNAME_MACHINE=alpha ;;
3435b0fe478SBruce M Simpson	    "LCA4 (21066/21068)")
34439e421e8SCy Schubert		UNAME_MACHINE=alpha ;;
3455b0fe478SBruce M Simpson	    "EV5 (21164)")
34639e421e8SCy Schubert		UNAME_MACHINE=alphaev5 ;;
3475b0fe478SBruce M Simpson	    "EV5.6 (21164A)")
34839e421e8SCy Schubert		UNAME_MACHINE=alphaev56 ;;
3495b0fe478SBruce M Simpson	    "EV5.6 (21164PC)")
35039e421e8SCy Schubert		UNAME_MACHINE=alphapca56 ;;
3515b0fe478SBruce M Simpson	    "EV5.7 (21164PC)")
35239e421e8SCy Schubert		UNAME_MACHINE=alphapca57 ;;
3535b0fe478SBruce M Simpson	    "EV6 (21264)")
35439e421e8SCy Schubert		UNAME_MACHINE=alphaev6 ;;
3555b0fe478SBruce M Simpson	    "EV6.7 (21264A)")
35639e421e8SCy Schubert		UNAME_MACHINE=alphaev67 ;;
3575b0fe478SBruce M Simpson	    "EV6.8CB (21264C)")
35839e421e8SCy Schubert		UNAME_MACHINE=alphaev68 ;;
3595b0fe478SBruce M Simpson	    "EV6.8AL (21264B)")
36039e421e8SCy Schubert		UNAME_MACHINE=alphaev68 ;;
3615b0fe478SBruce M Simpson	    "EV6.8CX (21264D)")
36239e421e8SCy Schubert		UNAME_MACHINE=alphaev68 ;;
3635b0fe478SBruce M Simpson	    "EV6.9A (21264/EV69A)")
36439e421e8SCy Schubert		UNAME_MACHINE=alphaev69 ;;
3655b0fe478SBruce M Simpson	    "EV7 (21364)")
36639e421e8SCy Schubert		UNAME_MACHINE=alphaev7 ;;
3675b0fe478SBruce M Simpson	    "EV7.9 (21364A)")
36839e421e8SCy Schubert		UNAME_MACHINE=alphaev79 ;;
3695b0fe478SBruce M Simpson	esac
37027df3f5dSRui Paulo	# A Pn.n version is a patched version.
3714edb46e9SPaul Traina	# A Vn.n version is a released version.
3724edb46e9SPaul Traina	# A Tn.n version is a released field test version.
3734edb46e9SPaul Traina	# A Xn.n version is an unreleased experimental baselevel.
3744edb46e9SPaul Traina	# 1.2 uses "1.2" for uname -r.
375ee67461eSJoseph Mingrone	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
376ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
377ee67461eSJoseph Mingrone	;;
3784edb46e9SPaul Traina    Amiga*:UNIX_System_V:4.0:*)
379ee67461eSJoseph Mingrone	GUESS=m68k-unknown-sysv4
380ee67461eSJoseph Mingrone	;;
381685295f4SBill Fenner    *:[Aa]miga[Oo][Ss]:*:*)
382ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-amigaos
383ee67461eSJoseph Mingrone	;;
3845b0fe478SBruce M Simpson    *:[Mm]orph[Oo][Ss]:*:*)
385ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-morphos
386ee67461eSJoseph Mingrone	;;
387685295f4SBill Fenner    *:OS/390:*:*)
388ee67461eSJoseph Mingrone	GUESS=i370-ibm-openedition
389ee67461eSJoseph Mingrone	;;
39027df3f5dSRui Paulo    *:z/VM:*:*)
391ee67461eSJoseph Mingrone	GUESS=s390-ibm-zvmoe
392ee67461eSJoseph Mingrone	;;
3935b0fe478SBruce M Simpson    *:OS400:*:*)
394ee67461eSJoseph Mingrone	GUESS=powerpc-ibm-os400
395ee67461eSJoseph Mingrone	;;
3964edb46e9SPaul Traina    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
397ee67461eSJoseph Mingrone	GUESS=arm-acorn-riscix$UNAME_RELEASE
398ee67461eSJoseph Mingrone	;;
3998bdc5a62SPatrick Kelsey    arm*:riscos:*:*|arm*:RISCOS:*:*)
400ee67461eSJoseph Mingrone	GUESS=arm-unknown-riscos
401ee67461eSJoseph Mingrone	;;
402a90e161bSBill Fenner    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
403ee67461eSJoseph Mingrone	GUESS=hppa1.1-hitachi-hiuxmpp
404ee67461eSJoseph Mingrone	;;
405685295f4SBill Fenner    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4064de76e31SBill Fenner	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
407ee67461eSJoseph Mingrone	case `(/bin/universe) 2>/dev/null` in
408ee67461eSJoseph Mingrone	    att) GUESS=pyramid-pyramid-sysv3 ;;
409ee67461eSJoseph Mingrone	    *)   GUESS=pyramid-pyramid-bsd   ;;
410ee67461eSJoseph Mingrone	esac
411ee67461eSJoseph Mingrone	;;
412685295f4SBill Fenner    NILE*:*:*:dcosx)
413ee67461eSJoseph Mingrone	GUESS=pyramid-pyramid-svr4
414ee67461eSJoseph Mingrone	;;
4155b0fe478SBruce M Simpson    DRS?6000:unix:4.0:6*)
416ee67461eSJoseph Mingrone	GUESS=sparc-icl-nx6
417ee67461eSJoseph Mingrone	;;
41827df3f5dSRui Paulo    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4195b0fe478SBruce M Simpson	case `/usr/bin/uname -p` in
420ee67461eSJoseph Mingrone	    sparc) GUESS=sparc-icl-nx7 ;;
421ee67461eSJoseph Mingrone	esac
422ee67461eSJoseph Mingrone	;;
42327df3f5dSRui Paulo    s390x:SunOS:*:*)
424ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
425ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
426ee67461eSJoseph Mingrone	;;
427685295f4SBill Fenner    sun4H:SunOS:5.*:*)
428ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
429ee67461eSJoseph Mingrone	GUESS=sparc-hal-solaris2$SUN_REL
430ee67461eSJoseph Mingrone	;;
4314de76e31SBill Fenner    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
432ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
433ee67461eSJoseph Mingrone	GUESS=sparc-sun-solaris2$SUN_REL
434ee67461eSJoseph Mingrone	;;
43527df3f5dSRui Paulo    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
436ee67461eSJoseph Mingrone	GUESS=i386-pc-auroraux$UNAME_RELEASE
437ee67461eSJoseph Mingrone	;;
43827df3f5dSRui Paulo    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
439ee67461eSJoseph Mingrone	set_cc_for_build
44039e421e8SCy Schubert	SUN_ARCH=i386
44127df3f5dSRui Paulo	# If there is a compiler, see if it is configured for 64-bit objects.
44227df3f5dSRui Paulo	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
44327df3f5dSRui Paulo	# This test works for both compilers.
444ee67461eSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
44527df3f5dSRui Paulo	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
446ee67461eSJoseph Mingrone		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
44727df3f5dSRui Paulo		grep IS_64BIT_ARCH >/dev/null
44827df3f5dSRui Paulo	    then
44939e421e8SCy Schubert		SUN_ARCH=x86_64
45027df3f5dSRui Paulo	    fi
45127df3f5dSRui Paulo	fi
452ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
453ee67461eSJoseph Mingrone	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
454ee67461eSJoseph Mingrone	;;
4554edb46e9SPaul Traina    sun4*:SunOS:6*:*)
4564edb46e9SPaul Traina	# According to config.sub, this is the proper way to canonicalize
4574edb46e9SPaul Traina	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4584edb46e9SPaul Traina	# it's likely to be more like Solaris than SunOS4.
459ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
460ee67461eSJoseph Mingrone	GUESS=sparc-sun-solaris3$SUN_REL
461ee67461eSJoseph Mingrone	;;
4624edb46e9SPaul Traina    sun4*:SunOS:*:*)
463ee67461eSJoseph Mingrone	case `/usr/bin/arch -k` in
4644edb46e9SPaul Traina	    Series*|S4*)
4654edb46e9SPaul Traina		UNAME_RELEASE=`uname -v`
4664edb46e9SPaul Traina		;;
4674edb46e9SPaul Traina	esac
468*0a7e5f1fSJoseph Mingrone	# Japanese Language versions have a version number like '4.1.3-JL'.
469ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
470ee67461eSJoseph Mingrone	GUESS=sparc-sun-sunos$SUN_REL
471ee67461eSJoseph Mingrone	;;
4724edb46e9SPaul Traina    sun3*:SunOS:*:*)
473ee67461eSJoseph Mingrone	GUESS=m68k-sun-sunos$UNAME_RELEASE
474ee67461eSJoseph Mingrone	;;
475685295f4SBill Fenner    sun*:*:4.2BSD:*)
4765b0fe478SBruce M Simpson	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
47739e421e8SCy Schubert	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
478ee67461eSJoseph Mingrone	case `/bin/arch` in
479685295f4SBill Fenner	    sun3)
480ee67461eSJoseph Mingrone		GUESS=m68k-sun-sunos$UNAME_RELEASE
481685295f4SBill Fenner		;;
482685295f4SBill Fenner	    sun4)
483ee67461eSJoseph Mingrone		GUESS=sparc-sun-sunos$UNAME_RELEASE
484685295f4SBill Fenner		;;
485685295f4SBill Fenner	esac
486ee67461eSJoseph Mingrone	;;
4874de76e31SBill Fenner    aushp:SunOS:*:*)
488ee67461eSJoseph Mingrone	GUESS=sparc-auspex-sunos$UNAME_RELEASE
489ee67461eSJoseph Mingrone	;;
490685295f4SBill Fenner    # The situation for MiNT is a little confusing.  The machine name
491685295f4SBill Fenner    # can be virtually everything (everything which is not
492685295f4SBill Fenner    # "atarist" or "atariste" at least should have a processor
493685295f4SBill Fenner    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
494685295f4SBill Fenner    # to the lowercase version "mint" (or "freemint").  Finally
495685295f4SBill Fenner    # the system name "TOS" denotes a system which is actually not
496685295f4SBill Fenner    # MiNT.  But MiNT is downward compatible to TOS, so this should
497685295f4SBill Fenner    # be no problem.
498685295f4SBill Fenner    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
499ee67461eSJoseph Mingrone	GUESS=m68k-atari-mint$UNAME_RELEASE
500ee67461eSJoseph Mingrone	;;
501685295f4SBill Fenner    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
502ee67461eSJoseph Mingrone	GUESS=m68k-atari-mint$UNAME_RELEASE
503ee67461eSJoseph Mingrone	;;
504685295f4SBill Fenner    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
505ee67461eSJoseph Mingrone	GUESS=m68k-atari-mint$UNAME_RELEASE
506ee67461eSJoseph Mingrone	;;
507685295f4SBill Fenner    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
508ee67461eSJoseph Mingrone	GUESS=m68k-milan-mint$UNAME_RELEASE
509ee67461eSJoseph Mingrone	;;
510685295f4SBill Fenner    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
511ee67461eSJoseph Mingrone	GUESS=m68k-hades-mint$UNAME_RELEASE
512ee67461eSJoseph Mingrone	;;
513685295f4SBill Fenner    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
514ee67461eSJoseph Mingrone	GUESS=m68k-unknown-mint$UNAME_RELEASE
515ee67461eSJoseph Mingrone	;;
51627df3f5dSRui Paulo    m68k:machten:*:*)
517ee67461eSJoseph Mingrone	GUESS=m68k-apple-machten$UNAME_RELEASE
518ee67461eSJoseph Mingrone	;;
5194de76e31SBill Fenner    powerpc:machten:*:*)
520ee67461eSJoseph Mingrone	GUESS=powerpc-apple-machten$UNAME_RELEASE
521ee67461eSJoseph Mingrone	;;
5224de76e31SBill Fenner    RISC*:Mach:*:*)
523ee67461eSJoseph Mingrone	GUESS=mips-dec-mach_bsd4.3
524ee67461eSJoseph Mingrone	;;
5254edb46e9SPaul Traina    RISC*:ULTRIX:*:*)
526ee67461eSJoseph Mingrone	GUESS=mips-dec-ultrix$UNAME_RELEASE
527ee67461eSJoseph Mingrone	;;
5284edb46e9SPaul Traina    VAX*:ULTRIX*:*:*)
529ee67461eSJoseph Mingrone	GUESS=vax-dec-ultrix$UNAME_RELEASE
530ee67461eSJoseph Mingrone	;;
531685295f4SBill Fenner    2020:CLIX:*:* | 2430:CLIX:*:*)
532ee67461eSJoseph Mingrone	GUESS=clipper-intergraph-clix$UNAME_RELEASE
533ee67461eSJoseph Mingrone	;;
5344de76e31SBill Fenner    mips:*:*:UMIPS | mips:*:*:RISCos)
535ee67461eSJoseph Mingrone	set_cc_for_build
53639e421e8SCy Schubert	sed 's/^	//' << EOF > "$dummy.c"
537685295f4SBill Fenner#ifdef __cplusplus
538685295f4SBill Fenner#include <stdio.h>  /* for printf() prototype */
539685295f4SBill Fenner	int main (int argc, char *argv[]) {
540685295f4SBill Fenner#else
541685295f4SBill Fenner	int main (argc, argv) int argc; char *argv[]; {
542685295f4SBill Fenner#endif
5434de76e31SBill Fenner	#if defined (host_mips) && defined (MIPSEB)
5444de76e31SBill Fenner	#if defined (SYSTYPE_SYSV)
54539e421e8SCy Schubert	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5464de76e31SBill Fenner	#endif
5474de76e31SBill Fenner	#if defined (SYSTYPE_SVR4)
54839e421e8SCy Schubert	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5494de76e31SBill Fenner	#endif
5504de76e31SBill Fenner	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
55139e421e8SCy Schubert	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5524de76e31SBill Fenner	#endif
5534de76e31SBill Fenner	#endif
5544de76e31SBill Fenner	  exit (-1);
5554de76e31SBill Fenner	}
5564de76e31SBill FennerEOF
55739e421e8SCy Schubert	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
55839e421e8SCy Schubert	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
55939e421e8SCy Schubert	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
56027df3f5dSRui Paulo	    { echo "$SYSTEM_NAME"; exit; }
561ee67461eSJoseph Mingrone	GUESS=mips-mips-riscos$UNAME_RELEASE
562ee67461eSJoseph Mingrone	;;
563a90e161bSBill Fenner    Motorola:PowerMAX_OS:*:*)
564ee67461eSJoseph Mingrone	GUESS=powerpc-motorola-powermax
565ee67461eSJoseph Mingrone	;;
5665b0fe478SBruce M Simpson    Motorola:*:4.3:PL8-*)
567ee67461eSJoseph Mingrone	GUESS=powerpc-harris-powermax
568ee67461eSJoseph Mingrone	;;
5695b0fe478SBruce M Simpson    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
570ee67461eSJoseph Mingrone	GUESS=powerpc-harris-powermax
571ee67461eSJoseph Mingrone	;;
5724edb46e9SPaul Traina    Night_Hawk:Power_UNIX:*:*)
573ee67461eSJoseph Mingrone	GUESS=powerpc-harris-powerunix
574ee67461eSJoseph Mingrone	;;
5754edb46e9SPaul Traina    m88k:CX/UX:7*:*)
576ee67461eSJoseph Mingrone	GUESS=m88k-harris-cxux7
577ee67461eSJoseph Mingrone	;;
5784edb46e9SPaul Traina    m88k:*:4*:R4*)
579ee67461eSJoseph Mingrone	GUESS=m88k-motorola-sysv4
580ee67461eSJoseph Mingrone	;;
5814edb46e9SPaul Traina    m88k:*:3*:R3*)
582ee67461eSJoseph Mingrone	GUESS=m88k-motorola-sysv3
583ee67461eSJoseph Mingrone	;;
5844edb46e9SPaul Traina    AViiON:dgux:*:*)
5854edb46e9SPaul Traina	# DG/UX returns AViiON for all architectures
5864edb46e9SPaul Traina	UNAME_PROCESSOR=`/usr/bin/uname -p`
587ee67461eSJoseph Mingrone	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
588685295f4SBill Fenner	then
589ee67461eSJoseph Mingrone	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
590ee67461eSJoseph Mingrone	       test "$TARGET_BINARY_INTERFACE"x = x
591685295f4SBill Fenner	    then
592ee67461eSJoseph Mingrone		GUESS=m88k-dg-dgux$UNAME_RELEASE
5934edb46e9SPaul Traina	    else
594ee67461eSJoseph Mingrone		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5954edb46e9SPaul Traina	    fi
596685295f4SBill Fenner	else
597ee67461eSJoseph Mingrone	    GUESS=i586-dg-dgux$UNAME_RELEASE
5984edb46e9SPaul Traina	fi
599ee67461eSJoseph Mingrone	;;
6004edb46e9SPaul Traina    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
601ee67461eSJoseph Mingrone	GUESS=m88k-dolphin-sysv3
602ee67461eSJoseph Mingrone	;;
6034edb46e9SPaul Traina    M88*:*:R3*:*)
6044edb46e9SPaul Traina	# Delta 88k system running SVR3
605ee67461eSJoseph Mingrone	GUESS=m88k-motorola-sysv3
606ee67461eSJoseph Mingrone	;;
6074edb46e9SPaul Traina    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
608ee67461eSJoseph Mingrone	GUESS=m88k-tektronix-sysv3
609ee67461eSJoseph Mingrone	;;
6104edb46e9SPaul Traina    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
611ee67461eSJoseph Mingrone	GUESS=m68k-tektronix-bsd
612ee67461eSJoseph Mingrone	;;
6134edb46e9SPaul Traina    *:IRIX*:*:*)
614ee67461eSJoseph Mingrone	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
615ee67461eSJoseph Mingrone	GUESS=mips-sgi-irix$IRIX_REL
616ee67461eSJoseph Mingrone	;;
6174edb46e9SPaul Traina    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
618ee67461eSJoseph Mingrone	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
619ee67461eSJoseph Mingrone	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
620a90e161bSBill Fenner    i*86:AIX:*:*)
621ee67461eSJoseph Mingrone	GUESS=i386-ibm-aix
622ee67461eSJoseph Mingrone	;;
623a90e161bSBill Fenner    ia64:AIX:*:*)
624ee67461eSJoseph Mingrone	if test -x /usr/bin/oslevel ; then
625a90e161bSBill Fenner		IBM_REV=`/usr/bin/oslevel`
626a90e161bSBill Fenner	else
627ee67461eSJoseph Mingrone		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
628a90e161bSBill Fenner	fi
629ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
630ee67461eSJoseph Mingrone	;;
6314edb46e9SPaul Traina    *:AIX:2:3)
6324edb46e9SPaul Traina	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
633ee67461eSJoseph Mingrone		set_cc_for_build
63439e421e8SCy Schubert		sed 's/^		//' << EOF > "$dummy.c"
6354edb46e9SPaul Traina		#include <sys/systemcfg.h>
6364edb46e9SPaul Traina
6374edb46e9SPaul Traina		main()
6384edb46e9SPaul Traina			{
6394edb46e9SPaul Traina			if (!__power_pc())
6404edb46e9SPaul Traina				exit(1);
6414edb46e9SPaul Traina			puts("powerpc-ibm-aix3.2.5");
6424edb46e9SPaul Traina			exit(0);
6434edb46e9SPaul Traina			}
6444edb46e9SPaul TrainaEOF
64539e421e8SCy Schubert		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64627df3f5dSRui Paulo		then
647ee67461eSJoseph Mingrone			GUESS=$SYSTEM_NAME
64827df3f5dSRui Paulo		else
649ee67461eSJoseph Mingrone			GUESS=rs6000-ibm-aix3.2.5
65027df3f5dSRui Paulo		fi
6514edb46e9SPaul Traina	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
652ee67461eSJoseph Mingrone		GUESS=rs6000-ibm-aix3.2.4
6534edb46e9SPaul Traina	else
654ee67461eSJoseph Mingrone		GUESS=rs6000-ibm-aix3.2
6554edb46e9SPaul Traina	fi
656ee67461eSJoseph Mingrone	;;
6573c602fabSXin LI    *:AIX:*:[4567])
6585b0fe478SBruce M Simpson	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
65939e421e8SCy Schubert	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6604edb46e9SPaul Traina		IBM_ARCH=rs6000
6614edb46e9SPaul Traina	else
6624edb46e9SPaul Traina		IBM_ARCH=powerpc
6634edb46e9SPaul Traina	fi
664ee67461eSJoseph Mingrone	if test -x /usr/bin/lslpp ; then
665ee67461eSJoseph Mingrone		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6668bdc5a62SPatrick Kelsey			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6674edb46e9SPaul Traina	else
668ee67461eSJoseph Mingrone		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6694edb46e9SPaul Traina	fi
670ee67461eSJoseph Mingrone	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
671ee67461eSJoseph Mingrone	;;
6724edb46e9SPaul Traina    *:AIX:*:*)
673ee67461eSJoseph Mingrone	GUESS=rs6000-ibm-aix
674ee67461eSJoseph Mingrone	;;
67539e421e8SCy Schubert    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
676ee67461eSJoseph Mingrone	GUESS=romp-ibm-bsd4.4
677ee67461eSJoseph Mingrone	;;
678685295f4SBill Fenner    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
679ee67461eSJoseph Mingrone	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
680ee67461eSJoseph Mingrone	;;                                  # report: romp-ibm BSD 4.3
6814edb46e9SPaul Traina    *:BOSX:*:*)
682ee67461eSJoseph Mingrone	GUESS=rs6000-bull-bosx
683ee67461eSJoseph Mingrone	;;
6844edb46e9SPaul Traina    DPX/2?00:B.O.S.:*:*)
685ee67461eSJoseph Mingrone	GUESS=m68k-bull-sysv3
686ee67461eSJoseph Mingrone	;;
6874edb46e9SPaul Traina    9000/[34]??:4.3bsd:1.*:*)
688ee67461eSJoseph Mingrone	GUESS=m68k-hp-bsd
689ee67461eSJoseph Mingrone	;;
6904edb46e9SPaul Traina    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
691ee67461eSJoseph Mingrone	GUESS=m68k-hp-bsd4.4
692ee67461eSJoseph Mingrone	;;
693685295f4SBill Fenner    9000/[34678]??:HP-UX:*:*)
69439e421e8SCy Schubert	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
695ee67461eSJoseph Mingrone	case $UNAME_MACHINE in
6964edb46e9SPaul Traina	    9000/31?)            HP_ARCH=m68000 ;;
6974edb46e9SPaul Traina	    9000/[34]??)         HP_ARCH=m68k ;;
698685295f4SBill Fenner	    9000/[678][0-9][0-9])
699ee67461eSJoseph Mingrone		if test -x /usr/bin/getconf; then
700685295f4SBill Fenner		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
701685295f4SBill Fenner		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
702ee67461eSJoseph Mingrone		    case $sc_cpu_version in
70339e421e8SCy Schubert		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
70439e421e8SCy Schubert		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
705685295f4SBill Fenner		      532)                      # CPU_PA_RISC2_0
706ee67461eSJoseph Mingrone			case $sc_kernel_bits in
70739e421e8SCy Schubert			  32) HP_ARCH=hppa2.0n ;;
70839e421e8SCy Schubert			  64) HP_ARCH=hppa2.0w ;;
70939e421e8SCy Schubert			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
710685295f4SBill Fenner			esac ;;
7114edb46e9SPaul Traina		    esac
7125b0fe478SBruce M Simpson		fi
713ee67461eSJoseph Mingrone		if test "$HP_ARCH" = ""; then
714ee67461eSJoseph Mingrone		    set_cc_for_build
71539e421e8SCy Schubert		    sed 's/^		//' << EOF > "$dummy.c"
716685295f4SBill Fenner
717685295f4SBill Fenner		#define _HPUX_SOURCE
718685295f4SBill Fenner		#include <stdlib.h>
719685295f4SBill Fenner		#include <unistd.h>
720685295f4SBill Fenner
721685295f4SBill Fenner		int main ()
722685295f4SBill Fenner		{
723685295f4SBill Fenner		#if defined(_SC_KERNEL_BITS)
724685295f4SBill Fenner		    long bits = sysconf(_SC_KERNEL_BITS);
725685295f4SBill Fenner		#endif
726685295f4SBill Fenner		    long cpu  = sysconf (_SC_CPU_VERSION);
727685295f4SBill Fenner
728685295f4SBill Fenner		    switch (cpu)
729685295f4SBill Fenner			{
730685295f4SBill Fenner			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
731685295f4SBill Fenner			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
732685295f4SBill Fenner			case CPU_PA_RISC2_0:
733685295f4SBill Fenner		#if defined(_SC_KERNEL_BITS)
734685295f4SBill Fenner			    switch (bits)
735685295f4SBill Fenner				{
736685295f4SBill Fenner				case 64: puts ("hppa2.0w"); break;
737685295f4SBill Fenner				case 32: puts ("hppa2.0n"); break;
738685295f4SBill Fenner				default: puts ("hppa2.0"); break;
739685295f4SBill Fenner				} break;
740685295f4SBill Fenner		#else  /* !defined(_SC_KERNEL_BITS) */
741685295f4SBill Fenner			    puts ("hppa2.0"); break;
742685295f4SBill Fenner		#endif
743685295f4SBill Fenner			default: puts ("hppa1.0"); break;
744685295f4SBill Fenner			}
745685295f4SBill Fenner		    exit (0);
746685295f4SBill Fenner		}
747685295f4SBill FennerEOF
74839e421e8SCy Schubert		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7495b0fe478SBruce M Simpson		    test -z "$HP_ARCH" && HP_ARCH=hppa
750685295f4SBill Fenner		fi ;;
751685295f4SBill Fenner	esac
752ee67461eSJoseph Mingrone	if test "$HP_ARCH" = hppa2.0w
7535b0fe478SBruce M Simpson	then
754ee67461eSJoseph Mingrone	    set_cc_for_build
75527df3f5dSRui Paulo
75627df3f5dSRui Paulo	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75727df3f5dSRui Paulo	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75827df3f5dSRui Paulo	    # generating 64-bit code.  GNU and HP use different nomenclature:
75927df3f5dSRui Paulo	    #
76027df3f5dSRui Paulo	    # $ CC_FOR_BUILD=cc ./config.guess
76127df3f5dSRui Paulo	    # => hppa2.0w-hp-hpux11.23
76227df3f5dSRui Paulo	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
76327df3f5dSRui Paulo	    # => hppa64-hp-hpux11.23
76427df3f5dSRui Paulo
76539e421e8SCy Schubert	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
76627df3f5dSRui Paulo		grep -q __LP64__
7675b0fe478SBruce M Simpson	    then
76839e421e8SCy Schubert		HP_ARCH=hppa2.0w
7695b0fe478SBruce M Simpson	    else
77039e421e8SCy Schubert		HP_ARCH=hppa64
7715b0fe478SBruce M Simpson	    fi
7725b0fe478SBruce M Simpson	fi
773ee67461eSJoseph Mingrone	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
774ee67461eSJoseph Mingrone	;;
775a90e161bSBill Fenner    ia64:HP-UX:*:*)
77639e421e8SCy Schubert	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
777ee67461eSJoseph Mingrone	GUESS=ia64-hp-hpux$HPUX_REV
778ee67461eSJoseph Mingrone	;;
7794edb46e9SPaul Traina    3050*:HI-UX:*:*)
780ee67461eSJoseph Mingrone	set_cc_for_build
78139e421e8SCy Schubert	sed 's/^	//' << EOF > "$dummy.c"
7824edb46e9SPaul Traina	#include <unistd.h>
7834edb46e9SPaul Traina	int
7844edb46e9SPaul Traina	main ()
7854edb46e9SPaul Traina	{
7864edb46e9SPaul Traina	  long cpu = sysconf (_SC_CPU_VERSION);
7874edb46e9SPaul Traina	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7884edb46e9SPaul Traina	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7894edb46e9SPaul Traina	     results, however.  */
7904edb46e9SPaul Traina	  if (CPU_IS_PA_RISC (cpu))
7914edb46e9SPaul Traina	    {
7924edb46e9SPaul Traina	      switch (cpu)
7934edb46e9SPaul Traina		{
7944edb46e9SPaul Traina		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7954edb46e9SPaul Traina		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7964edb46e9SPaul Traina		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7974edb46e9SPaul Traina		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7984edb46e9SPaul Traina		}
7994edb46e9SPaul Traina	    }
8004edb46e9SPaul Traina	  else if (CPU_IS_HP_MC68K (cpu))
8014edb46e9SPaul Traina	    puts ("m68k-hitachi-hiuxwe2");
8024edb46e9SPaul Traina	  else puts ("unknown-hitachi-hiuxwe2");
8034edb46e9SPaul Traina	  exit (0);
8044edb46e9SPaul Traina	}
8054edb46e9SPaul TrainaEOF
80639e421e8SCy Schubert	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80727df3f5dSRui Paulo		{ echo "$SYSTEM_NAME"; exit; }
808ee67461eSJoseph Mingrone	GUESS=unknown-hitachi-hiuxwe2
809ee67461eSJoseph Mingrone	;;
8104edb46e9SPaul Traina    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
811ee67461eSJoseph Mingrone	GUESS=hppa1.1-hp-bsd
812ee67461eSJoseph Mingrone	;;
8134edb46e9SPaul Traina    9000/8??:4.3bsd:*:*)
814ee67461eSJoseph Mingrone	GUESS=hppa1.0-hp-bsd
815ee67461eSJoseph Mingrone	;;
8165b0fe478SBruce M Simpson    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
817ee67461eSJoseph Mingrone	GUESS=hppa1.0-hp-mpeix
818ee67461eSJoseph Mingrone	;;
8194edb46e9SPaul Traina    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
820ee67461eSJoseph Mingrone	GUESS=hppa1.1-hp-osf
821ee67461eSJoseph Mingrone	;;
8224edb46e9SPaul Traina    hp8??:OSF1:*:*)
823ee67461eSJoseph Mingrone	GUESS=hppa1.0-hp-osf
824ee67461eSJoseph Mingrone	;;
825a90e161bSBill Fenner    i*86:OSF1:*:*)
826ee67461eSJoseph Mingrone	if test -x /usr/sbin/sysversion ; then
827ee67461eSJoseph Mingrone	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8284de76e31SBill Fenner	else
829ee67461eSJoseph Mingrone	    GUESS=$UNAME_MACHINE-unknown-osf1
8304de76e31SBill Fenner	fi
831ee67461eSJoseph Mingrone	;;
8324edb46e9SPaul Traina    parisc*:Lites*:*:*)
833ee67461eSJoseph Mingrone	GUESS=hppa1.1-hp-lites
834ee67461eSJoseph Mingrone	;;
8354edb46e9SPaul Traina    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
836ee67461eSJoseph Mingrone	GUESS=c1-convex-bsd
837ee67461eSJoseph Mingrone	;;
8384edb46e9SPaul Traina    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8394edb46e9SPaul Traina	if getsysinfo -f scalar_acc
8404edb46e9SPaul Traina	then echo c32-convex-bsd
8414edb46e9SPaul Traina	else echo c2-convex-bsd
8424edb46e9SPaul Traina	fi
84327df3f5dSRui Paulo	exit ;;
8444edb46e9SPaul Traina    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
845ee67461eSJoseph Mingrone	GUESS=c34-convex-bsd
846ee67461eSJoseph Mingrone	;;
8474edb46e9SPaul Traina    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
848ee67461eSJoseph Mingrone	GUESS=c38-convex-bsd
849ee67461eSJoseph Mingrone	;;
8504edb46e9SPaul Traina    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
851ee67461eSJoseph Mingrone	GUESS=c4-convex-bsd
852ee67461eSJoseph Mingrone	;;
8534edb46e9SPaul Traina    CRAY*Y-MP:*:*:*)
854ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
855ee67461eSJoseph Mingrone	GUESS=ymp-cray-unicos$CRAY_REL
856ee67461eSJoseph Mingrone	;;
8574de76e31SBill Fenner    CRAY*[A-Z]90:*:*:*)
85839e421e8SCy Schubert	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8594de76e31SBill Fenner	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8605b0fe478SBruce M Simpson	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8615b0fe478SBruce M Simpson	      -e 's/\.[^.]*$/.X/'
86227df3f5dSRui Paulo	exit ;;
8634de76e31SBill Fenner    CRAY*TS:*:*:*)
864ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
865ee67461eSJoseph Mingrone	GUESS=t90-cray-unicos$CRAY_REL
866ee67461eSJoseph Mingrone	;;
867685295f4SBill Fenner    CRAY*T3E:*:*:*)
868ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
869ee67461eSJoseph Mingrone	GUESS=alphaev5-cray-unicosmk$CRAY_REL
870ee67461eSJoseph Mingrone	;;
871685295f4SBill Fenner    CRAY*SV1:*:*:*)
872ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
873ee67461eSJoseph Mingrone	GUESS=sv1-cray-unicos$CRAY_REL
874ee67461eSJoseph Mingrone	;;
8755b0fe478SBruce M Simpson    *:UNICOS/mp:*:*)
876ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
877ee67461eSJoseph Mingrone	GUESS=craynv-cray-unicosmp$CRAY_REL
878ee67461eSJoseph Mingrone	;;
879a90e161bSBill Fenner    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
88039e421e8SCy Schubert	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
88139e421e8SCy Schubert	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
88239e421e8SCy Schubert	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
883ee67461eSJoseph Mingrone	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
884ee67461eSJoseph Mingrone	;;
8855b0fe478SBruce M Simpson    5000:UNIX_System_V:4.*:*)
88639e421e8SCy Schubert	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
88739e421e8SCy Schubert	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
888ee67461eSJoseph Mingrone	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
889ee67461eSJoseph Mingrone	;;
890a90e161bSBill Fenner    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
891ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
892ee67461eSJoseph Mingrone	;;
893685295f4SBill Fenner    sparc*:BSD/OS:*:*)
894ee67461eSJoseph Mingrone	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
895ee67461eSJoseph Mingrone	;;
896685295f4SBill Fenner    *:BSD/OS:*:*)
897ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
898ee67461eSJoseph Mingrone	;;
899ee67461eSJoseph Mingrone    arm:FreeBSD:*:*)
900ee67461eSJoseph Mingrone	UNAME_PROCESSOR=`uname -p`
901ee67461eSJoseph Mingrone	set_cc_for_build
902ee67461eSJoseph Mingrone	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
903ee67461eSJoseph Mingrone	    | grep -q __ARM_PCS_VFP
904ee67461eSJoseph Mingrone	then
905ee67461eSJoseph Mingrone	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
906ee67461eSJoseph Mingrone	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
907ee67461eSJoseph Mingrone	else
908ee67461eSJoseph Mingrone	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
909ee67461eSJoseph Mingrone	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
910ee67461eSJoseph Mingrone	fi
911ee67461eSJoseph Mingrone	;;
9124edb46e9SPaul Traina    *:FreeBSD:*:*)
913*0a7e5f1fSJoseph Mingrone	UNAME_PROCESSOR=`uname -p`
914ee67461eSJoseph Mingrone	case $UNAME_PROCESSOR in
91527df3f5dSRui Paulo	    amd64)
91639e421e8SCy Schubert		UNAME_PROCESSOR=x86_64 ;;
91739e421e8SCy Schubert	    i386)
91839e421e8SCy Schubert		UNAME_PROCESSOR=i586 ;;
91927df3f5dSRui Paulo	esac
920ee67461eSJoseph Mingrone	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
921ee67461eSJoseph Mingrone	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
922ee67461eSJoseph Mingrone	;;
9234edb46e9SPaul Traina    i*:CYGWIN*:*)
924ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-cygwin
925ee67461eSJoseph Mingrone	;;
9268bdc5a62SPatrick Kelsey    *:MINGW64*:*)
927ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-mingw64
928ee67461eSJoseph Mingrone	;;
92927df3f5dSRui Paulo    *:MINGW*:*)
930ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-mingw32
931ee67461eSJoseph Mingrone	;;
9328bdc5a62SPatrick Kelsey    *:MSYS*:*)
933ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-msys
934ee67461eSJoseph Mingrone	;;
935685295f4SBill Fenner    i*:PW*:*)
936ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-pw32
937ee67461eSJoseph Mingrone	;;
938ee67461eSJoseph Mingrone    *:SerenityOS:*:*)
939ee67461eSJoseph Mingrone        GUESS=$UNAME_MACHINE-pc-serenity
940ee67461eSJoseph Mingrone        ;;
94127df3f5dSRui Paulo    *:Interix*:*)
942ee67461eSJoseph Mingrone	case $UNAME_MACHINE in
94327df3f5dSRui Paulo	    x86)
944ee67461eSJoseph Mingrone		GUESS=i586-pc-interix$UNAME_RELEASE
945ee67461eSJoseph Mingrone		;;
94627df3f5dSRui Paulo	    authenticamd | genuineintel | EM64T)
947ee67461eSJoseph Mingrone		GUESS=x86_64-unknown-interix$UNAME_RELEASE
948ee67461eSJoseph Mingrone		;;
94927df3f5dSRui Paulo	    IA64)
950ee67461eSJoseph Mingrone		GUESS=ia64-unknown-interix$UNAME_RELEASE
951ee67461eSJoseph Mingrone		;;
95227df3f5dSRui Paulo	esac ;;
953685295f4SBill Fenner    i*:UWIN*:*)
954ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-uwin
955ee67461eSJoseph Mingrone	;;
95627df3f5dSRui Paulo    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
957ee67461eSJoseph Mingrone	GUESS=x86_64-pc-cygwin
958ee67461eSJoseph Mingrone	;;
9594edb46e9SPaul Traina    prep*:SunOS:5.*:*)
960ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
961ee67461eSJoseph Mingrone	GUESS=powerpcle-unknown-solaris2$SUN_REL
962ee67461eSJoseph Mingrone	;;
9634edb46e9SPaul Traina    *:GNU:*:*)
9645b0fe478SBruce M Simpson	# the GNU system
965ee67461eSJoseph Mingrone	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
966ee67461eSJoseph Mingrone	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
967ee67461eSJoseph Mingrone	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
968ee67461eSJoseph Mingrone	;;
9695b0fe478SBruce M Simpson    *:GNU/*:*:*)
9705b0fe478SBruce M Simpson	# other systems with GNU libc and userland
971ee67461eSJoseph Mingrone	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
972ee67461eSJoseph Mingrone	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
973ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
974ee67461eSJoseph Mingrone	;;
975ee67461eSJoseph Mingrone    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
976ee67461eSJoseph Mingrone	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
977ee67461eSJoseph Mingrone	;;
978ee67461eSJoseph Mingrone    *:[Mm]anagarm:*:*)
979ee67461eSJoseph Mingrone	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
980ee67461eSJoseph Mingrone	;;
98139e421e8SCy Schubert    *:Minix:*:*)
982ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-minix
983ee67461eSJoseph Mingrone	;;
9843c602fabSXin LI    aarch64:Linux:*:*)
985*0a7e5f1fSJoseph Mingrone	set_cc_for_build
986*0a7e5f1fSJoseph Mingrone	CPU=$UNAME_MACHINE
987*0a7e5f1fSJoseph Mingrone	LIBCABI=$LIBC
988*0a7e5f1fSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
989*0a7e5f1fSJoseph Mingrone	    ABI=64
990*0a7e5f1fSJoseph Mingrone	    sed 's/^	    //' << EOF > "$dummy.c"
991*0a7e5f1fSJoseph Mingrone	    #ifdef __ARM_EABI__
992*0a7e5f1fSJoseph Mingrone	    #ifdef __ARM_PCS_VFP
993*0a7e5f1fSJoseph Mingrone	    ABI=eabihf
994*0a7e5f1fSJoseph Mingrone	    #else
995*0a7e5f1fSJoseph Mingrone	    ABI=eabi
996*0a7e5f1fSJoseph Mingrone	    #endif
997*0a7e5f1fSJoseph Mingrone	    #endif
998*0a7e5f1fSJoseph MingroneEOF
999*0a7e5f1fSJoseph Mingrone	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1000*0a7e5f1fSJoseph Mingrone	    eval "$cc_set_abi"
1001*0a7e5f1fSJoseph Mingrone	    case $ABI in
1002*0a7e5f1fSJoseph Mingrone		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
1003*0a7e5f1fSJoseph Mingrone	    esac
1004*0a7e5f1fSJoseph Mingrone	fi
1005*0a7e5f1fSJoseph Mingrone	GUESS=$CPU-unknown-linux-$LIBCABI
1006ee67461eSJoseph Mingrone	;;
10073c602fabSXin LI    aarch64_be:Linux:*:*)
10083c602fabSXin LI	UNAME_MACHINE=aarch64_be
1009ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1010ee67461eSJoseph Mingrone	;;
1011a90e161bSBill Fenner    alpha:Linux:*:*)
1012ee67461eSJoseph Mingrone	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
10135b0fe478SBruce M Simpson	  EV5)   UNAME_MACHINE=alphaev5 ;;
10145b0fe478SBruce M Simpson	  EV56)  UNAME_MACHINE=alphaev56 ;;
10155b0fe478SBruce M Simpson	  PCA56) UNAME_MACHINE=alphapca56 ;;
10165b0fe478SBruce M Simpson	  PCA57) UNAME_MACHINE=alphapca56 ;;
10175b0fe478SBruce M Simpson	  EV6)   UNAME_MACHINE=alphaev6 ;;
10185b0fe478SBruce M Simpson	  EV67)  UNAME_MACHINE=alphaev67 ;;
10195b0fe478SBruce M Simpson	  EV68*) UNAME_MACHINE=alphaev68 ;;
1020685295f4SBill Fenner	esac
102127df3f5dSRui Paulo	objdump --private-headers /bin/sh | grep -q ld.so.1
102239e421e8SCy Schubert	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
1023ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1024ee67461eSJoseph Mingrone	;;
1025ee67461eSJoseph Mingrone    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1026ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1027ee67461eSJoseph Mingrone	;;
102827df3f5dSRui Paulo    arm*:Linux:*:*)
1029ee67461eSJoseph Mingrone	set_cc_for_build
103027df3f5dSRui Paulo	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
103127df3f5dSRui Paulo	    | grep -q __ARM_EABI__
103227df3f5dSRui Paulo	then
1033ee67461eSJoseph Mingrone	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103427df3f5dSRui Paulo	else
10353c602fabSXin LI	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10363c602fabSXin LI		| grep -q __ARM_PCS_VFP
10373c602fabSXin LI	    then
1038ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10393c602fabSXin LI	    else
1040ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10413c602fabSXin LI	    fi
104227df3f5dSRui Paulo	fi
1043ee67461eSJoseph Mingrone	;;
104427df3f5dSRui Paulo    avr32*:Linux:*:*)
1045ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1046ee67461eSJoseph Mingrone	;;
104727df3f5dSRui Paulo    cris:Linux:*:*)
1048ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1049ee67461eSJoseph Mingrone	;;
105027df3f5dSRui Paulo    crisv32:Linux:*:*)
1051ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1052ee67461eSJoseph Mingrone	;;
105339e421e8SCy Schubert    e2k:Linux:*:*)
1054ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1055ee67461eSJoseph Mingrone	;;
105627df3f5dSRui Paulo    frv:Linux:*:*)
1057ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1058ee67461eSJoseph Mingrone	;;
10593c602fabSXin LI    hexagon:Linux:*:*)
1060ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1061ee67461eSJoseph Mingrone	;;
106227df3f5dSRui Paulo    i*86:Linux:*:*)
1063ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1064ee67461eSJoseph Mingrone	;;
106527df3f5dSRui Paulo    ia64:Linux:*:*)
1066ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1067ee67461eSJoseph Mingrone	;;
106839e421e8SCy Schubert    k1om:Linux:*:*)
1069ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1070ee67461eSJoseph Mingrone	;;
1071*0a7e5f1fSJoseph Mingrone    kvx:Linux:*:*)
1072*0a7e5f1fSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1073*0a7e5f1fSJoseph Mingrone	;;
1074*0a7e5f1fSJoseph Mingrone    kvx:cos:*:*)
1075*0a7e5f1fSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-cos
1076*0a7e5f1fSJoseph Mingrone	;;
1077*0a7e5f1fSJoseph Mingrone    kvx:mbr:*:*)
1078*0a7e5f1fSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-mbr
1079*0a7e5f1fSJoseph Mingrone	;;
1080ee67461eSJoseph Mingrone    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1081ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1082ee67461eSJoseph Mingrone	;;
108327df3f5dSRui Paulo    m32r*:Linux:*:*)
1084ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1085ee67461eSJoseph Mingrone	;;
108627df3f5dSRui Paulo    m68*:Linux:*:*)
1087ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1088ee67461eSJoseph Mingrone	;;
108927df3f5dSRui Paulo    mips:Linux:*:* | mips64:Linux:*:*)
1090ee67461eSJoseph Mingrone	set_cc_for_build
1091ee67461eSJoseph Mingrone	IS_GLIBC=0
1092ee67461eSJoseph Mingrone	test x"${LIBC}" = xgnu && IS_GLIBC=1
109339e421e8SCy Schubert	sed 's/^	//' << EOF > "$dummy.c"
109427df3f5dSRui Paulo	#undef CPU
1095ee67461eSJoseph Mingrone	#undef mips
1096ee67461eSJoseph Mingrone	#undef mipsel
1097ee67461eSJoseph Mingrone	#undef mips64
1098ee67461eSJoseph Mingrone	#undef mips64el
1099ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && defined(_ABI64)
1100ee67461eSJoseph Mingrone	LIBCABI=gnuabi64
1101ee67461eSJoseph Mingrone	#else
1102ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && defined(_ABIN32)
1103ee67461eSJoseph Mingrone	LIBCABI=gnuabin32
1104ee67461eSJoseph Mingrone	#else
1105ee67461eSJoseph Mingrone	LIBCABI=${LIBC}
1106ee67461eSJoseph Mingrone	#endif
1107ee67461eSJoseph Mingrone	#endif
1108ee67461eSJoseph Mingrone
1109ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1110ee67461eSJoseph Mingrone	CPU=mipsisa64r6
1111ee67461eSJoseph Mingrone	#else
1112ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1113ee67461eSJoseph Mingrone	CPU=mipsisa32r6
1114ee67461eSJoseph Mingrone	#else
1115ee67461eSJoseph Mingrone	#if defined(__mips64)
1116ee67461eSJoseph Mingrone	CPU=mips64
1117ee67461eSJoseph Mingrone	#else
1118ee67461eSJoseph Mingrone	CPU=mips
1119ee67461eSJoseph Mingrone	#endif
1120ee67461eSJoseph Mingrone	#endif
1121ee67461eSJoseph Mingrone	#endif
1122ee67461eSJoseph Mingrone
112327df3f5dSRui Paulo	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1124ee67461eSJoseph Mingrone	MIPS_ENDIAN=el
112527df3f5dSRui Paulo	#else
112627df3f5dSRui Paulo	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1127ee67461eSJoseph Mingrone	MIPS_ENDIAN=
112827df3f5dSRui Paulo	#else
1129ee67461eSJoseph Mingrone	MIPS_ENDIAN=
113027df3f5dSRui Paulo	#endif
113127df3f5dSRui Paulo	#endif
113227df3f5dSRui PauloEOF
1133ee67461eSJoseph Mingrone	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1134ee67461eSJoseph Mingrone	eval "$cc_set_vars"
1135ee67461eSJoseph Mingrone	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
113627df3f5dSRui Paulo	;;
113739e421e8SCy Schubert    mips64el:Linux:*:*)
1138ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139ee67461eSJoseph Mingrone	;;
11408bdc5a62SPatrick Kelsey    openrisc*:Linux:*:*)
1141ee67461eSJoseph Mingrone	GUESS=or1k-unknown-linux-$LIBC
1142ee67461eSJoseph Mingrone	;;
11438bdc5a62SPatrick Kelsey    or32:Linux:*:* | or1k*:Linux:*:*)
1144ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145ee67461eSJoseph Mingrone	;;
114627df3f5dSRui Paulo    padre:Linux:*:*)
1147ee67461eSJoseph Mingrone	GUESS=sparc-unknown-linux-$LIBC
1148ee67461eSJoseph Mingrone	;;
114927df3f5dSRui Paulo    parisc64:Linux:*:* | hppa64:Linux:*:*)
1150ee67461eSJoseph Mingrone	GUESS=hppa64-unknown-linux-$LIBC
1151ee67461eSJoseph Mingrone	;;
1152a90e161bSBill Fenner    parisc:Linux:*:* | hppa:Linux:*:*)
1153685295f4SBill Fenner	# Look for CPU level
1154685295f4SBill Fenner	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1155ee67461eSJoseph Mingrone	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1156ee67461eSJoseph Mingrone	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1157ee67461eSJoseph Mingrone	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1158a90e161bSBill Fenner	esac
1159ee67461eSJoseph Mingrone	;;
116027df3f5dSRui Paulo    ppc64:Linux:*:*)
1161ee67461eSJoseph Mingrone	GUESS=powerpc64-unknown-linux-$LIBC
1162ee67461eSJoseph Mingrone	;;
116327df3f5dSRui Paulo    ppc:Linux:*:*)
1164ee67461eSJoseph Mingrone	GUESS=powerpc-unknown-linux-$LIBC
1165ee67461eSJoseph Mingrone	;;
11668bdc5a62SPatrick Kelsey    ppc64le:Linux:*:*)
1167ee67461eSJoseph Mingrone	GUESS=powerpc64le-unknown-linux-$LIBC
1168ee67461eSJoseph Mingrone	;;
11698bdc5a62SPatrick Kelsey    ppcle:Linux:*:*)
1170ee67461eSJoseph Mingrone	GUESS=powerpcle-unknown-linux-$LIBC
1171ee67461eSJoseph Mingrone	;;
1172ee67461eSJoseph Mingrone    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1173ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1174ee67461eSJoseph Mingrone	;;
1175a90e161bSBill Fenner    s390:Linux:*:* | s390x:Linux:*:*)
1176ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1177ee67461eSJoseph Mingrone	;;
11785b0fe478SBruce M Simpson    sh64*:Linux:*:*)
1179ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1180ee67461eSJoseph Mingrone	;;
1181a90e161bSBill Fenner    sh*:Linux:*:*)
1182ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1183ee67461eSJoseph Mingrone	;;
1184a90e161bSBill Fenner    sparc:Linux:*:* | sparc64:Linux:*:*)
1185ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1186ee67461eSJoseph Mingrone	;;
11873c602fabSXin LI    tile*:Linux:*:*)
1188ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1189ee67461eSJoseph Mingrone	;;
119027df3f5dSRui Paulo    vax:Linux:*:*)
1191ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1192ee67461eSJoseph Mingrone	;;
1193a90e161bSBill Fenner    x86_64:Linux:*:*)
1194ee67461eSJoseph Mingrone	set_cc_for_build
1195ee67461eSJoseph Mingrone	CPU=$UNAME_MACHINE
1196ee67461eSJoseph Mingrone	LIBCABI=$LIBC
1197ee67461eSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
1198ee67461eSJoseph Mingrone	    ABI=64
1199ee67461eSJoseph Mingrone	    sed 's/^	    //' << EOF > "$dummy.c"
1200ee67461eSJoseph Mingrone	    #ifdef __i386__
1201ee67461eSJoseph Mingrone	    ABI=x86
1202ee67461eSJoseph Mingrone	    #else
1203ee67461eSJoseph Mingrone	    #ifdef __ILP32__
1204ee67461eSJoseph Mingrone	    ABI=x32
1205ee67461eSJoseph Mingrone	    #endif
1206ee67461eSJoseph Mingrone	    #endif
1207ee67461eSJoseph MingroneEOF
1208ee67461eSJoseph Mingrone	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1209ee67461eSJoseph Mingrone	    eval "$cc_set_abi"
1210ee67461eSJoseph Mingrone	    case $ABI in
1211ee67461eSJoseph Mingrone		x86) CPU=i686 ;;
1212ee67461eSJoseph Mingrone		x32) LIBCABI=${LIBC}x32 ;;
1213ee67461eSJoseph Mingrone	    esac
1214ee67461eSJoseph Mingrone	fi
1215ee67461eSJoseph Mingrone	GUESS=$CPU-pc-linux-$LIBCABI
1216ee67461eSJoseph Mingrone	;;
121727df3f5dSRui Paulo    xtensa*:Linux:*:*)
1218ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1219ee67461eSJoseph Mingrone	;;
1220a90e161bSBill Fenner    i*86:DYNIX/ptx:4*:*)
12215b0fe478SBruce M Simpson	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
12225b0fe478SBruce M Simpson	# earlier versions are messed up and put the nodename in both
12235b0fe478SBruce M Simpson	# sysname and nodename.
1224ee67461eSJoseph Mingrone	GUESS=i386-sequent-sysv4
1225ee67461eSJoseph Mingrone	;;
1226a90e161bSBill Fenner    i*86:UNIX_SV:4.2MP:2.*)
1227685295f4SBill Fenner	# Unixware is an offshoot of SVR4, but it has its own version
1228685295f4SBill Fenner	# number series starting with 2...
1229685295f4SBill Fenner	# I am not positive that other SVR4 systems won't match this,
1230685295f4SBill Fenner	# I just have to hope.  -- rms.
1231685295f4SBill Fenner	# Use sysv4.2uw... so that sysv4* matches it.
1232ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1233ee67461eSJoseph Mingrone	;;
12345b0fe478SBruce M Simpson    i*86:OS/2:*:*)
1235*0a7e5f1fSJoseph Mingrone	# If we were able to find 'uname', then EMX Unix compatibility
12365b0fe478SBruce M Simpson	# is probably installed.
1237ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-os2-emx
1238ee67461eSJoseph Mingrone	;;
12395b0fe478SBruce M Simpson    i*86:XTS-300:*:STOP)
1240ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-stop
1241ee67461eSJoseph Mingrone	;;
12425b0fe478SBruce M Simpson    i*86:atheos:*:*)
1243ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-atheos
1244ee67461eSJoseph Mingrone	;;
124527df3f5dSRui Paulo    i*86:syllable:*:*)
1246ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-syllable
1247ee67461eSJoseph Mingrone	;;
124827df3f5dSRui Paulo    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1249ee67461eSJoseph Mingrone	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1250ee67461eSJoseph Mingrone	;;
12515b0fe478SBruce M Simpson    i*86:*DOS:*:*)
1252ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1253ee67461eSJoseph Mingrone	;;
125439e421e8SCy Schubert    i*86:*:4.*:*)
125539e421e8SCy Schubert	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12564edb46e9SPaul Traina	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1257ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1258685295f4SBill Fenner	else
1259ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1260685295f4SBill Fenner	fi
1261ee67461eSJoseph Mingrone	;;
126227df3f5dSRui Paulo    i*86:*:5:[678]*)
126327df3f5dSRui Paulo	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12645b0fe478SBruce M Simpson	case `/bin/uname -X | grep "^Machine"` in
12655b0fe478SBruce M Simpson	    *486*)	     UNAME_MACHINE=i486 ;;
12665b0fe478SBruce M Simpson	    *Pentium)	     UNAME_MACHINE=i586 ;;
12675b0fe478SBruce M Simpson	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12685b0fe478SBruce M Simpson	esac
1269ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1270ee67461eSJoseph Mingrone	;;
1271a90e161bSBill Fenner    i*86:*:3.2:*)
12724edb46e9SPaul Traina	if test -f /usr/options/cb.name; then
12734edb46e9SPaul Traina		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1274ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12754edb46e9SPaul Traina	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12765b0fe478SBruce M Simpson		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12775b0fe478SBruce M Simpson		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12785b0fe478SBruce M Simpson		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12794edb46e9SPaul Traina			&& UNAME_MACHINE=i586
12805b0fe478SBruce M Simpson		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1281685295f4SBill Fenner			&& UNAME_MACHINE=i686
12825b0fe478SBruce M Simpson		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1283685295f4SBill Fenner			&& UNAME_MACHINE=i686
1284ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12854edb46e9SPaul Traina	else
1286ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-sysv32
12874edb46e9SPaul Traina	fi
1288ee67461eSJoseph Mingrone	;;
1289685295f4SBill Fenner    pc:*:*:*)
1290685295f4SBill Fenner	# Left here for compatibility:
1291685295f4SBill Fenner	# uname -m prints for DJGPP always 'pc', but it prints nothing about
129227df3f5dSRui Paulo	# the processor, so we play safe by assuming i586.
129327df3f5dSRui Paulo	# Note: whatever this is, it MUST be the same as what config.sub
129439e421e8SCy Schubert	# prints for the "djgpp" host, or else GDB configure will decide that
129527df3f5dSRui Paulo	# this is a cross-build.
1296ee67461eSJoseph Mingrone	GUESS=i586-pc-msdosdjgpp
1297ee67461eSJoseph Mingrone	;;
12984edb46e9SPaul Traina    Intel:Mach:3*:*)
1299ee67461eSJoseph Mingrone	GUESS=i386-pc-mach3
1300ee67461eSJoseph Mingrone	;;
13014edb46e9SPaul Traina    paragon:*:*:*)
1302ee67461eSJoseph Mingrone	GUESS=i860-intel-osf1
1303ee67461eSJoseph Mingrone	;;
13044edb46e9SPaul Traina    i860:*:4.*:*) # i860-SVR4
13054edb46e9SPaul Traina	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1306ee67461eSJoseph Mingrone	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
13074edb46e9SPaul Traina	else # Add other i860-SVR4 vendors below as they are discovered.
1308ee67461eSJoseph Mingrone	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
13094edb46e9SPaul Traina	fi
1310ee67461eSJoseph Mingrone	;;
13114edb46e9SPaul Traina    mini*:CTIX:SYS*5:*)
13124edb46e9SPaul Traina	# "miniframe"
1313ee67461eSJoseph Mingrone	GUESS=m68010-convergent-sysv
1314ee67461eSJoseph Mingrone	;;
13155b0fe478SBruce M Simpson    mc68k:UNIX:SYSTEM5:3.51m)
1316ee67461eSJoseph Mingrone	GUESS=m68k-convergent-sysv
1317ee67461eSJoseph Mingrone	;;
13185b0fe478SBruce M Simpson    M680?0:D-NIX:5.3:*)
1319ee67461eSJoseph Mingrone	GUESS=m68k-diab-dnix
1320ee67461eSJoseph Mingrone	;;
132127df3f5dSRui Paulo    M68*:*:R3V[5678]*:*)
132227df3f5dSRui Paulo	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
132327df3f5dSRui Paulo    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)
13244de76e31SBill Fenner	OS_REL=''
13254de76e31SBill Fenner	test -r /etc/.relid \
13264de76e31SBill Fenner	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
13274de76e31SBill Fenner	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
132839e421e8SCy Schubert	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
13294de76e31SBill Fenner	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
133039e421e8SCy Schubert	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13314edb46e9SPaul Traina    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
13324de76e31SBill Fenner	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
133327df3f5dSRui Paulo	  && { echo i486-ncr-sysv4; exit; } ;;
133427df3f5dSRui Paulo    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
133527df3f5dSRui Paulo	OS_REL='.3'
133627df3f5dSRui Paulo	test -r /etc/.relid \
133727df3f5dSRui Paulo	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
133827df3f5dSRui Paulo	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
133939e421e8SCy Schubert	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
134027df3f5dSRui Paulo	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
134139e421e8SCy Schubert	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
134227df3f5dSRui Paulo	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
134339e421e8SCy Schubert	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1344a90e161bSBill Fenner    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1345ee67461eSJoseph Mingrone	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1346ee67461eSJoseph Mingrone	;;
13474edb46e9SPaul Traina    mc68030:UNIX_System_V:4.*:*)
1348ee67461eSJoseph Mingrone	GUESS=m68k-atari-sysv4
1349ee67461eSJoseph Mingrone	;;
13504de76e31SBill Fenner    TSUNAMI:LynxOS:2.*:*)
1351ee67461eSJoseph Mingrone	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1352ee67461eSJoseph Mingrone	;;
1353a90e161bSBill Fenner    rs6000:LynxOS:2.*:*)
1354ee67461eSJoseph Mingrone	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1355ee67461eSJoseph Mingrone	;;
135627df3f5dSRui Paulo    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1357ee67461eSJoseph Mingrone	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1358ee67461eSJoseph Mingrone	;;
13594de76e31SBill Fenner    SM[BE]S:UNIX_SV:*:*)
1360ee67461eSJoseph Mingrone	GUESS=mips-dde-sysv$UNAME_RELEASE
1361ee67461eSJoseph Mingrone	;;
1362685295f4SBill Fenner    RM*:ReliantUNIX-*:*:*)
1363ee67461eSJoseph Mingrone	GUESS=mips-sni-sysv4
1364ee67461eSJoseph Mingrone	;;
13654edb46e9SPaul Traina    RM*:SINIX-*:*:*)
1366ee67461eSJoseph Mingrone	GUESS=mips-sni-sysv4
1367ee67461eSJoseph Mingrone	;;
13684edb46e9SPaul Traina    *:SINIX-*:*:*)
13694edb46e9SPaul Traina	if uname -p 2>/dev/null >/dev/null ; then
13704edb46e9SPaul Traina		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1371ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-sni-sysv4
13724edb46e9SPaul Traina	else
1373ee67461eSJoseph Mingrone		GUESS=ns32k-sni-sysv
13744edb46e9SPaul Traina	fi
1375ee67461eSJoseph Mingrone	;;
1376*0a7e5f1fSJoseph Mingrone    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
1377685295f4SBill Fenner			# says <Richard.M.Bartel@ccMail.Census.GOV>
1378ee67461eSJoseph Mingrone	GUESS=i586-unisys-sysv4
1379ee67461eSJoseph Mingrone	;;
13804de76e31SBill Fenner    *:UNIX_System_V:4*:FTX*)
13814de76e31SBill Fenner	# From Gerald Hewes <hewes@openmarket.com>.
13824de76e31SBill Fenner	# How about differentiating between stratus architectures? -djm
1383ee67461eSJoseph Mingrone	GUESS=hppa1.1-stratus-sysv4
1384ee67461eSJoseph Mingrone	;;
13854de76e31SBill Fenner    *:*:*:FTX*)
13864de76e31SBill Fenner	# From seanf@swdc.stratus.com.
1387ee67461eSJoseph Mingrone	GUESS=i860-stratus-sysv4
1388ee67461eSJoseph Mingrone	;;
138927df3f5dSRui Paulo    i*86:VOS:*:*)
139027df3f5dSRui Paulo	# From Paul.Green@stratus.com.
1391ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-stratus-vos
1392ee67461eSJoseph Mingrone	;;
13935b0fe478SBruce M Simpson    *:VOS:*:*)
13945b0fe478SBruce M Simpson	# From Paul.Green@stratus.com.
1395ee67461eSJoseph Mingrone	GUESS=hppa1.1-stratus-vos
1396ee67461eSJoseph Mingrone	;;
13974edb46e9SPaul Traina    mc68*:A/UX:*:*)
1398ee67461eSJoseph Mingrone	GUESS=m68k-apple-aux$UNAME_RELEASE
1399ee67461eSJoseph Mingrone	;;
1400685295f4SBill Fenner    news*:NEWS-OS:6*:*)
1401ee67461eSJoseph Mingrone	GUESS=mips-sony-newsos6
1402ee67461eSJoseph Mingrone	;;
1403685295f4SBill Fenner    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1404ee67461eSJoseph Mingrone	if test -d /usr/nec; then
1405ee67461eSJoseph Mingrone		GUESS=mips-nec-sysv$UNAME_RELEASE
14064edb46e9SPaul Traina	else
1407ee67461eSJoseph Mingrone		GUESS=mips-unknown-sysv$UNAME_RELEASE
14084edb46e9SPaul Traina	fi
1409ee67461eSJoseph Mingrone	;;
1410685295f4SBill Fenner    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1411ee67461eSJoseph Mingrone	GUESS=powerpc-be-beos
1412ee67461eSJoseph Mingrone	;;
1413685295f4SBill Fenner    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1414ee67461eSJoseph Mingrone	GUESS=powerpc-apple-beos
1415ee67461eSJoseph Mingrone	;;
1416685295f4SBill Fenner    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1417ee67461eSJoseph Mingrone	GUESS=i586-pc-beos
1418ee67461eSJoseph Mingrone	;;
141927df3f5dSRui Paulo    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1420ee67461eSJoseph Mingrone	GUESS=i586-pc-haiku
1421ee67461eSJoseph Mingrone	;;
1422ee67461eSJoseph Mingrone    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1423ee67461eSJoseph Mingrone	GUESS=powerpc-apple-haiku
1424ee67461eSJoseph Mingrone	;;
1425ee67461eSJoseph Mingrone    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1426ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-haiku
1427ee67461eSJoseph Mingrone	;;
1428685295f4SBill Fenner    SX-4:SUPER-UX:*:*)
1429ee67461eSJoseph Mingrone	GUESS=sx4-nec-superux$UNAME_RELEASE
1430ee67461eSJoseph Mingrone	;;
1431685295f4SBill Fenner    SX-5:SUPER-UX:*:*)
1432ee67461eSJoseph Mingrone	GUESS=sx5-nec-superux$UNAME_RELEASE
1433ee67461eSJoseph Mingrone	;;
14345b0fe478SBruce M Simpson    SX-6:SUPER-UX:*:*)
1435ee67461eSJoseph Mingrone	GUESS=sx6-nec-superux$UNAME_RELEASE
1436ee67461eSJoseph Mingrone	;;
143727df3f5dSRui Paulo    SX-7:SUPER-UX:*:*)
1438ee67461eSJoseph Mingrone	GUESS=sx7-nec-superux$UNAME_RELEASE
1439ee67461eSJoseph Mingrone	;;
144027df3f5dSRui Paulo    SX-8:SUPER-UX:*:*)
1441ee67461eSJoseph Mingrone	GUESS=sx8-nec-superux$UNAME_RELEASE
1442ee67461eSJoseph Mingrone	;;
144327df3f5dSRui Paulo    SX-8R:SUPER-UX:*:*)
1444ee67461eSJoseph Mingrone	GUESS=sx8r-nec-superux$UNAME_RELEASE
1445ee67461eSJoseph Mingrone	;;
144639e421e8SCy Schubert    SX-ACE:SUPER-UX:*:*)
1447ee67461eSJoseph Mingrone	GUESS=sxace-nec-superux$UNAME_RELEASE
1448ee67461eSJoseph Mingrone	;;
1449685295f4SBill Fenner    Power*:Rhapsody:*:*)
1450ee67461eSJoseph Mingrone	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1451ee67461eSJoseph Mingrone	;;
1452685295f4SBill Fenner    *:Rhapsody:*:*)
1453ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1454ee67461eSJoseph Mingrone	;;
1455ee67461eSJoseph Mingrone    arm64:Darwin:*:*)
1456ee67461eSJoseph Mingrone	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1457ee67461eSJoseph Mingrone	;;
1458685295f4SBill Fenner    *:Darwin:*:*)
1459ee67461eSJoseph Mingrone	UNAME_PROCESSOR=`uname -p`
1460ee67461eSJoseph Mingrone	case $UNAME_PROCESSOR in
1461ee67461eSJoseph Mingrone	    unknown) UNAME_PROCESSOR=powerpc ;;
1462ee67461eSJoseph Mingrone	esac
1463ee67461eSJoseph Mingrone	if command -v xcode-select > /dev/null 2> /dev/null && \
1464ee67461eSJoseph Mingrone		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1465ee67461eSJoseph Mingrone	    # Avoid executing cc if there is no toolchain installed as
1466ee67461eSJoseph Mingrone	    # cc will be a stub that puts up a graphical alert
1467ee67461eSJoseph Mingrone	    # prompting the user to install developer tools.
1468ee67461eSJoseph Mingrone	    CC_FOR_BUILD=no_compiler_found
1469ee67461eSJoseph Mingrone	else
1470ee67461eSJoseph Mingrone	    set_cc_for_build
14718bdc5a62SPatrick Kelsey	fi
1472ee67461eSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
147327df3f5dSRui Paulo	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
147439e421e8SCy Schubert		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
147527df3f5dSRui Paulo		   grep IS_64BIT_ARCH >/dev/null
147627df3f5dSRui Paulo	    then
14778bdc5a62SPatrick Kelsey		case $UNAME_PROCESSOR in
14788bdc5a62SPatrick Kelsey		    i386) UNAME_PROCESSOR=x86_64 ;;
14798bdc5a62SPatrick Kelsey		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14805b0fe478SBruce M Simpson		esac
14818bdc5a62SPatrick Kelsey	    fi
148239e421e8SCy Schubert	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
148339e421e8SCy Schubert	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
148439e421e8SCy Schubert		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
148539e421e8SCy Schubert		   grep IS_PPC >/dev/null
148639e421e8SCy Schubert	    then
148739e421e8SCy Schubert		UNAME_PROCESSOR=powerpc
148839e421e8SCy Schubert	    fi
14898bdc5a62SPatrick Kelsey	elif test "$UNAME_PROCESSOR" = i386 ; then
1490ee67461eSJoseph Mingrone	    # uname -m returns i386 or x86_64
1491ee67461eSJoseph Mingrone	    UNAME_PROCESSOR=$UNAME_MACHINE
14928bdc5a62SPatrick Kelsey	fi
1493ee67461eSJoseph Mingrone	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1494ee67461eSJoseph Mingrone	;;
1495685295f4SBill Fenner    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14965b0fe478SBruce M Simpson	UNAME_PROCESSOR=`uname -p`
149739e421e8SCy Schubert	if test "$UNAME_PROCESSOR" = x86; then
14985b0fe478SBruce M Simpson		UNAME_PROCESSOR=i386
1499685295f4SBill Fenner		UNAME_MACHINE=pc
1500685295f4SBill Fenner	fi
1501ee67461eSJoseph Mingrone	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1502ee67461eSJoseph Mingrone	;;
1503685295f4SBill Fenner    *:QNX:*:4*)
1504ee67461eSJoseph Mingrone	GUESS=i386-pc-qnx
1505ee67461eSJoseph Mingrone	;;
150639e421e8SCy Schubert    NEO-*:NONSTOP_KERNEL:*:*)
1507ee67461eSJoseph Mingrone	GUESS=neo-tandem-nsk$UNAME_RELEASE
1508ee67461eSJoseph Mingrone	;;
15098bdc5a62SPatrick Kelsey    NSE-*:NONSTOP_KERNEL:*:*)
1510ee67461eSJoseph Mingrone	GUESS=nse-tandem-nsk$UNAME_RELEASE
1511ee67461eSJoseph Mingrone	;;
151239e421e8SCy Schubert    NSR-*:NONSTOP_KERNEL:*:*)
1513ee67461eSJoseph Mingrone	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1514ee67461eSJoseph Mingrone	;;
151539e421e8SCy Schubert    NSV-*:NONSTOP_KERNEL:*:*)
1516ee67461eSJoseph Mingrone	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1517ee67461eSJoseph Mingrone	;;
151839e421e8SCy Schubert    NSX-*:NONSTOP_KERNEL:*:*)
1519ee67461eSJoseph Mingrone	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1520ee67461eSJoseph Mingrone	;;
1521685295f4SBill Fenner    *:NonStop-UX:*:*)
1522ee67461eSJoseph Mingrone	GUESS=mips-compaq-nonstopux
1523ee67461eSJoseph Mingrone	;;
1524685295f4SBill Fenner    BS2000:POSIX*:*:*)
1525ee67461eSJoseph Mingrone	GUESS=bs2000-siemens-sysv
1526ee67461eSJoseph Mingrone	;;
1527685295f4SBill Fenner    DS/*:UNIX_System_V:*:*)
1528ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1529ee67461eSJoseph Mingrone	;;
1530685295f4SBill Fenner    *:Plan9:*:*)
1531685295f4SBill Fenner	# "uname -m" is not consistent, so use $cputype instead. 386
1532685295f4SBill Fenner	# is converted to i386 for consistency with other x86
1533685295f4SBill Fenner	# operating systems.
1534ee67461eSJoseph Mingrone	if test "${cputype-}" = 386; then
1535685295f4SBill Fenner	    UNAME_MACHINE=i386
1536ee67461eSJoseph Mingrone	elif test "x${cputype-}" != x; then
1537ee67461eSJoseph Mingrone	    UNAME_MACHINE=$cputype
1538685295f4SBill Fenner	fi
1539ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-plan9
1540ee67461eSJoseph Mingrone	;;
1541a90e161bSBill Fenner    *:TOPS-10:*:*)
1542ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-tops10
1543ee67461eSJoseph Mingrone	;;
1544a90e161bSBill Fenner    *:TENEX:*:*)
1545ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-tenex
1546ee67461eSJoseph Mingrone	;;
1547a90e161bSBill Fenner    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1548ee67461eSJoseph Mingrone	GUESS=pdp10-dec-tops20
1549ee67461eSJoseph Mingrone	;;
1550a90e161bSBill Fenner    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1551ee67461eSJoseph Mingrone	GUESS=pdp10-xkl-tops20
1552ee67461eSJoseph Mingrone	;;
1553a90e161bSBill Fenner    *:TOPS-20:*:*)
1554ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-tops20
1555ee67461eSJoseph Mingrone	;;
1556a90e161bSBill Fenner    *:ITS:*:*)
1557ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-its
1558ee67461eSJoseph Mingrone	;;
15595b0fe478SBruce M Simpson    SEI:*:*:SEIUX)
1560ee67461eSJoseph Mingrone	GUESS=mips-sei-seiux$UNAME_RELEASE
1561ee67461eSJoseph Mingrone	;;
156227df3f5dSRui Paulo    *:DragonFly:*:*)
1563ee67461eSJoseph Mingrone	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1564ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1565ee67461eSJoseph Mingrone	;;
156627df3f5dSRui Paulo    *:*VMS:*:*)
156727df3f5dSRui Paulo	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1568ee67461eSJoseph Mingrone	case $UNAME_MACHINE in
1569ee67461eSJoseph Mingrone	    A*) GUESS=alpha-dec-vms ;;
1570ee67461eSJoseph Mingrone	    I*) GUESS=ia64-dec-vms ;;
1571ee67461eSJoseph Mingrone	    V*) GUESS=vax-dec-vms ;;
157227df3f5dSRui Paulo	esac ;;
157327df3f5dSRui Paulo    *:XENIX:*:SysV)
1574ee67461eSJoseph Mingrone	GUESS=i386-pc-xenix
1575ee67461eSJoseph Mingrone	;;
157627df3f5dSRui Paulo    i*86:skyos:*:*)
1577ee67461eSJoseph Mingrone	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1578ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1579ee67461eSJoseph Mingrone	;;
158027df3f5dSRui Paulo    i*86:rdos:*:*)
1581ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-rdos
1582ee67461eSJoseph Mingrone	;;
1583ee67461eSJoseph Mingrone    i*86:Fiwix:*:*)
1584ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-fiwix
1585ee67461eSJoseph Mingrone	;;
1586ee67461eSJoseph Mingrone    *:AROS:*:*)
1587ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-aros
1588ee67461eSJoseph Mingrone	;;
15893c602fabSXin LI    x86_64:VMkernel:*:*)
1590ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-esx
1591ee67461eSJoseph Mingrone	;;
159239e421e8SCy Schubert    amd64:Isilon\ OneFS:*:*)
1593ee67461eSJoseph Mingrone	GUESS=x86_64-unknown-onefs
1594ee67461eSJoseph Mingrone	;;
1595ee67461eSJoseph Mingrone    *:Unleashed:*:*)
1596ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1597ee67461eSJoseph Mingrone	;;
1598*0a7e5f1fSJoseph Mingrone    *:Ironclad:*:*)
1599*0a7e5f1fSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-ironclad
1600*0a7e5f1fSJoseph Mingrone	;;
16014edb46e9SPaul Trainaesac
16024edb46e9SPaul Traina
1603ee67461eSJoseph Mingrone# Do we have a guess based on uname results?
1604ee67461eSJoseph Mingroneif test "x$GUESS" != x; then
1605ee67461eSJoseph Mingrone    echo "$GUESS"
1606ee67461eSJoseph Mingrone    exit
1607ee67461eSJoseph Mingronefi
1608ee67461eSJoseph Mingrone
1609ee67461eSJoseph Mingrone# No uname command or uname output not recognized.
1610ee67461eSJoseph Mingroneset_cc_for_build
1611ee67461eSJoseph Mingronecat > "$dummy.c" <<EOF
1612ee67461eSJoseph Mingrone#ifdef _SEQUENT_
1613ee67461eSJoseph Mingrone#include <sys/types.h>
1614ee67461eSJoseph Mingrone#include <sys/utsname.h>
1615ee67461eSJoseph Mingrone#endif
1616ee67461eSJoseph Mingrone#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1617ee67461eSJoseph Mingrone#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1618ee67461eSJoseph Mingrone#include <signal.h>
1619ee67461eSJoseph Mingrone#if defined(_SIZE_T_) || defined(SIGLOST)
1620ee67461eSJoseph Mingrone#include <sys/utsname.h>
1621ee67461eSJoseph Mingrone#endif
1622ee67461eSJoseph Mingrone#endif
1623ee67461eSJoseph Mingrone#endif
1624ee67461eSJoseph Mingronemain ()
1625ee67461eSJoseph Mingrone{
1626ee67461eSJoseph Mingrone#if defined (sony)
1627ee67461eSJoseph Mingrone#if defined (MIPSEB)
1628ee67461eSJoseph Mingrone  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1629ee67461eSJoseph Mingrone     I don't know....  */
1630ee67461eSJoseph Mingrone  printf ("mips-sony-bsd\n"); exit (0);
1631ee67461eSJoseph Mingrone#else
1632ee67461eSJoseph Mingrone#include <sys/param.h>
1633ee67461eSJoseph Mingrone  printf ("m68k-sony-newsos%s\n",
1634ee67461eSJoseph Mingrone#ifdef NEWSOS4
1635ee67461eSJoseph Mingrone  "4"
1636ee67461eSJoseph Mingrone#else
1637ee67461eSJoseph Mingrone  ""
1638ee67461eSJoseph Mingrone#endif
1639ee67461eSJoseph Mingrone  ); exit (0);
1640ee67461eSJoseph Mingrone#endif
1641ee67461eSJoseph Mingrone#endif
1642ee67461eSJoseph Mingrone
1643ee67461eSJoseph Mingrone#if defined (NeXT)
1644ee67461eSJoseph Mingrone#if !defined (__ARCHITECTURE__)
1645ee67461eSJoseph Mingrone#define __ARCHITECTURE__ "m68k"
1646ee67461eSJoseph Mingrone#endif
1647ee67461eSJoseph Mingrone  int version;
1648ee67461eSJoseph Mingrone  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1649ee67461eSJoseph Mingrone  if (version < 4)
1650ee67461eSJoseph Mingrone    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1651ee67461eSJoseph Mingrone  else
1652ee67461eSJoseph Mingrone    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1653ee67461eSJoseph Mingrone  exit (0);
1654ee67461eSJoseph Mingrone#endif
1655ee67461eSJoseph Mingrone
1656ee67461eSJoseph Mingrone#if defined (MULTIMAX) || defined (n16)
1657ee67461eSJoseph Mingrone#if defined (UMAXV)
1658ee67461eSJoseph Mingrone  printf ("ns32k-encore-sysv\n"); exit (0);
1659ee67461eSJoseph Mingrone#else
1660ee67461eSJoseph Mingrone#if defined (CMU)
1661ee67461eSJoseph Mingrone  printf ("ns32k-encore-mach\n"); exit (0);
1662ee67461eSJoseph Mingrone#else
1663ee67461eSJoseph Mingrone  printf ("ns32k-encore-bsd\n"); exit (0);
1664ee67461eSJoseph Mingrone#endif
1665ee67461eSJoseph Mingrone#endif
1666ee67461eSJoseph Mingrone#endif
1667ee67461eSJoseph Mingrone
1668ee67461eSJoseph Mingrone#if defined (__386BSD__)
1669ee67461eSJoseph Mingrone  printf ("i386-pc-bsd\n"); exit (0);
1670ee67461eSJoseph Mingrone#endif
1671ee67461eSJoseph Mingrone
1672ee67461eSJoseph Mingrone#if defined (sequent)
1673ee67461eSJoseph Mingrone#if defined (i386)
1674ee67461eSJoseph Mingrone  printf ("i386-sequent-dynix\n"); exit (0);
1675ee67461eSJoseph Mingrone#endif
1676ee67461eSJoseph Mingrone#if defined (ns32000)
1677ee67461eSJoseph Mingrone  printf ("ns32k-sequent-dynix\n"); exit (0);
1678ee67461eSJoseph Mingrone#endif
1679ee67461eSJoseph Mingrone#endif
1680ee67461eSJoseph Mingrone
1681ee67461eSJoseph Mingrone#if defined (_SEQUENT_)
1682ee67461eSJoseph Mingrone  struct utsname un;
1683ee67461eSJoseph Mingrone
1684ee67461eSJoseph Mingrone  uname(&un);
1685ee67461eSJoseph Mingrone  if (strncmp(un.version, "V2", 2) == 0) {
1686ee67461eSJoseph Mingrone    printf ("i386-sequent-ptx2\n"); exit (0);
1687ee67461eSJoseph Mingrone  }
1688ee67461eSJoseph Mingrone  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1689ee67461eSJoseph Mingrone    printf ("i386-sequent-ptx1\n"); exit (0);
1690ee67461eSJoseph Mingrone  }
1691ee67461eSJoseph Mingrone  printf ("i386-sequent-ptx\n"); exit (0);
1692ee67461eSJoseph Mingrone#endif
1693ee67461eSJoseph Mingrone
1694ee67461eSJoseph Mingrone#if defined (vax)
1695ee67461eSJoseph Mingrone#if !defined (ultrix)
1696ee67461eSJoseph Mingrone#include <sys/param.h>
1697ee67461eSJoseph Mingrone#if defined (BSD)
1698ee67461eSJoseph Mingrone#if BSD == 43
1699ee67461eSJoseph Mingrone  printf ("vax-dec-bsd4.3\n"); exit (0);
1700ee67461eSJoseph Mingrone#else
1701ee67461eSJoseph Mingrone#if BSD == 199006
1702ee67461eSJoseph Mingrone  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1703ee67461eSJoseph Mingrone#else
1704ee67461eSJoseph Mingrone  printf ("vax-dec-bsd\n"); exit (0);
1705ee67461eSJoseph Mingrone#endif
1706ee67461eSJoseph Mingrone#endif
1707ee67461eSJoseph Mingrone#else
1708ee67461eSJoseph Mingrone  printf ("vax-dec-bsd\n"); exit (0);
1709ee67461eSJoseph Mingrone#endif
1710ee67461eSJoseph Mingrone#else
1711ee67461eSJoseph Mingrone#if defined(_SIZE_T_) || defined(SIGLOST)
1712ee67461eSJoseph Mingrone  struct utsname un;
1713ee67461eSJoseph Mingrone  uname (&un);
1714ee67461eSJoseph Mingrone  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1715ee67461eSJoseph Mingrone#else
1716ee67461eSJoseph Mingrone  printf ("vax-dec-ultrix\n"); exit (0);
1717ee67461eSJoseph Mingrone#endif
1718ee67461eSJoseph Mingrone#endif
1719ee67461eSJoseph Mingrone#endif
1720ee67461eSJoseph Mingrone#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1721ee67461eSJoseph Mingrone#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1722ee67461eSJoseph Mingrone#if defined(_SIZE_T_) || defined(SIGLOST)
1723ee67461eSJoseph Mingrone  struct utsname *un;
1724ee67461eSJoseph Mingrone  uname (&un);
1725ee67461eSJoseph Mingrone  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1726ee67461eSJoseph Mingrone#else
1727ee67461eSJoseph Mingrone  printf ("mips-dec-ultrix\n"); exit (0);
1728ee67461eSJoseph Mingrone#endif
1729ee67461eSJoseph Mingrone#endif
1730ee67461eSJoseph Mingrone#endif
1731ee67461eSJoseph Mingrone
1732ee67461eSJoseph Mingrone#if defined (alliant) && defined (i860)
1733ee67461eSJoseph Mingrone  printf ("i860-alliant-bsd\n"); exit (0);
1734ee67461eSJoseph Mingrone#endif
1735ee67461eSJoseph Mingrone
1736ee67461eSJoseph Mingrone  exit (1);
1737ee67461eSJoseph Mingrone}
1738ee67461eSJoseph MingroneEOF
1739ee67461eSJoseph Mingrone
1740ee67461eSJoseph Mingrone$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1741ee67461eSJoseph Mingrone	{ echo "$SYSTEM_NAME"; exit; }
1742ee67461eSJoseph Mingrone
1743ee67461eSJoseph Mingrone# Apollos put the system type in the environment.
1744ee67461eSJoseph Mingronetest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1745ee67461eSJoseph Mingrone
174639e421e8SCy Schubertecho "$0: unable to guess system type" >&2
174739e421e8SCy Schubert
1748ee67461eSJoseph Mingronecase $UNAME_MACHINE:$UNAME_SYSTEM in
174939e421e8SCy Schubert    mips:Linux | mips64:Linux)
175039e421e8SCy Schubert	# If we got here on MIPS GNU/Linux, output extra information.
1751685295f4SBill Fenner	cat >&2 <<EOF
1752685295f4SBill Fenner
175339e421e8SCy SchubertNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
175439e421e8SCy Schubertthe system type. Please install a C compiler and try again.
175539e421e8SCy SchubertEOF
175639e421e8SCy Schubert	;;
175739e421e8SCy Schubertesac
1758685295f4SBill Fenner
175939e421e8SCy Schubertcat >&2 <<EOF
176039e421e8SCy Schubert
176139e421e8SCy SchubertThis script (version $timestamp), has failed to recognize the
176239e421e8SCy Schubertoperating system you are using. If your script is old, overwrite *all*
176339e421e8SCy Schubertcopies of config.guess and config.sub with the latest versions from:
176439e421e8SCy Schubert
1765ee67461eSJoseph Mingrone  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
176627df3f5dSRui Pauloand
1767ee67461eSJoseph Mingrone  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1768ee67461eSJoseph MingroneEOF
1769ee67461eSJoseph Mingrone
1770ee67461eSJoseph Mingroneour_year=`echo $timestamp | sed 's,-.*,,'`
1771ee67461eSJoseph Mingronethisyear=`date +%Y`
1772ee67461eSJoseph Mingrone# shellcheck disable=SC2003
1773ee67461eSJoseph Mingronescript_age=`expr "$thisyear" - "$our_year"`
1774ee67461eSJoseph Mingroneif test "$script_age" -lt 3 ; then
1775ee67461eSJoseph Mingrone   cat >&2 <<EOF
1776685295f4SBill Fenner
177739e421e8SCy SchubertIf $0 has already been updated, send the following data and any
177839e421e8SCy Schubertinformation you think might be pertinent to config-patches@gnu.org to
177939e421e8SCy Schubertprovide the necessary information to handle your system.
1780685295f4SBill Fenner
1781a90e161bSBill Fennerconfig.guess timestamp = $timestamp
1782685295f4SBill Fenner
1783685295f4SBill Fenneruname -m = `(uname -m) 2>/dev/null || echo unknown`
1784685295f4SBill Fenneruname -r = `(uname -r) 2>/dev/null || echo unknown`
1785685295f4SBill Fenneruname -s = `(uname -s) 2>/dev/null || echo unknown`
1786685295f4SBill Fenneruname -v = `(uname -v) 2>/dev/null || echo unknown`
1787685295f4SBill Fenner
1788685295f4SBill Fenner/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1789685295f4SBill Fenner/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1790685295f4SBill Fenner
1791685295f4SBill Fennerhostinfo               = `(hostinfo) 2>/dev/null`
1792685295f4SBill Fenner/bin/universe          = `(/bin/universe) 2>/dev/null`
1793685295f4SBill Fenner/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1794685295f4SBill Fenner/bin/arch              = `(/bin/arch) 2>/dev/null`
1795685295f4SBill Fenner/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1796685295f4SBill Fenner/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1797685295f4SBill Fenner
179839e421e8SCy SchubertUNAME_MACHINE = "$UNAME_MACHINE"
179939e421e8SCy SchubertUNAME_RELEASE = "$UNAME_RELEASE"
180039e421e8SCy SchubertUNAME_SYSTEM  = "$UNAME_SYSTEM"
180139e421e8SCy SchubertUNAME_VERSION = "$UNAME_VERSION"
1802685295f4SBill FennerEOF
1803ee67461eSJoseph Mingronefi
18044edb46e9SPaul Traina
18054edb46e9SPaul Trainaexit 1
1806685295f4SBill Fenner
1807685295f4SBill Fenner# Local variables:
180839e421e8SCy Schubert# eval: (add-hook 'before-save-hook 'time-stamp)
1809685295f4SBill Fenner# time-stamp-start: "timestamp='"
1810685295f4SBill Fenner# time-stamp-format: "%:y-%02m-%02d"
1811685295f4SBill Fenner# time-stamp-end: "'"
1812685295f4SBill Fenner# End:
1813