xref: /freebsd/contrib/dialog/config.guess (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
14c8945a0SNathan Whitehorn#! /bin/sh
24c8945a0SNathan Whitehorn# Attempt to guess a canonical system name.
3*a96ef450SBaptiste Daroussin#   Copyright 1992-2020 Free Software Foundation, Inc.
44c8945a0SNathan Whitehorn
5*a96ef450SBaptiste Daroussintimestamp='2020-08-17'
64c8945a0SNathan Whitehorn
74c8945a0SNathan Whitehorn# This file is free software; you can redistribute it and/or modify it
84c8945a0SNathan Whitehorn# under the terms of the GNU General Public License as published by
9febdb468SDevin Teske# the Free Software Foundation; either version 3 of the License, or
104c8945a0SNathan Whitehorn# (at your option) any later version.
114c8945a0SNathan Whitehorn#
124c8945a0SNathan Whitehorn# This program is distributed in the hope that it will be useful, but
134c8945a0SNathan Whitehorn# WITHOUT ANY WARRANTY; without even the implied warranty of
144c8945a0SNathan Whitehorn# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
154c8945a0SNathan Whitehorn# General Public License for more details.
164c8945a0SNathan Whitehorn#
174c8945a0SNathan Whitehorn# You should have received a copy of the GNU General Public License
18f4f33ea0SBaptiste Daroussin# along with this program; if not, see <https://www.gnu.org/licenses/>.
194c8945a0SNathan Whitehorn#
204c8945a0SNathan Whitehorn# As a special exception to the GNU General Public License, if you
214c8945a0SNathan Whitehorn# distribute this file as part of a program that contains a
224c8945a0SNathan Whitehorn# configuration script generated by Autoconf, you may include it under
23febdb468SDevin Teske# the same distribution terms that you use for the rest of that
24febdb468SDevin Teske# program.  This Exception is an additional permission under section 7
25febdb468SDevin Teske# of the GNU General Public License, version 3 ("GPLv3").
264c8945a0SNathan Whitehorn#
27f4f33ea0SBaptiste Daroussin# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
284c8945a0SNathan Whitehorn#
294c8945a0SNathan Whitehorn# You can get the latest version of this script from:
30f4f33ea0SBaptiste Daroussin# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
31febdb468SDevin Teske#
32f4f33ea0SBaptiste Daroussin# Please send patches to <config-patches@gnu.org>.
33febdb468SDevin Teske
344c8945a0SNathan Whitehorn
354c8945a0SNathan Whitehornme=`echo "$0" | sed -e 's,.*/,,'`
364c8945a0SNathan Whitehorn
374c8945a0SNathan Whitehornusage="\
384c8945a0SNathan WhitehornUsage: $0 [OPTION]
394c8945a0SNathan Whitehorn
404c8945a0SNathan WhitehornOutput the configuration name of the system \`$me' is run on.
414c8945a0SNathan Whitehorn
42f4f33ea0SBaptiste DaroussinOptions:
434c8945a0SNathan Whitehorn  -h, --help         print this help, then exit
444c8945a0SNathan Whitehorn  -t, --time-stamp   print date of last modification, then exit
454c8945a0SNathan Whitehorn  -v, --version      print version number, then exit
464c8945a0SNathan Whitehorn
474c8945a0SNathan WhitehornReport bugs and patches to <config-patches@gnu.org>."
484c8945a0SNathan Whitehorn
494c8945a0SNathan Whitehornversion="\
504c8945a0SNathan WhitehornGNU config.guess ($timestamp)
514c8945a0SNathan Whitehorn
524c8945a0SNathan WhitehornOriginally written by Per Bothner.
53*a96ef450SBaptiste DaroussinCopyright 1992-2020 Free Software Foundation, Inc.
544c8945a0SNathan Whitehorn
554c8945a0SNathan WhitehornThis is free software; see the source for copying conditions.  There is NO
564c8945a0SNathan Whitehornwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
574c8945a0SNathan Whitehorn
584c8945a0SNathan Whitehornhelp="
594c8945a0SNathan WhitehornTry \`$me --help' for more information."
604c8945a0SNathan Whitehorn
614c8945a0SNathan Whitehorn# Parse command line
624c8945a0SNathan Whitehornwhile test $# -gt 0 ; do
634c8945a0SNathan Whitehorn  case $1 in
644c8945a0SNathan Whitehorn    --time-stamp | --time* | -t )
654c8945a0SNathan Whitehorn       echo "$timestamp" ; exit ;;
664c8945a0SNathan Whitehorn    --version | -v )
674c8945a0SNathan Whitehorn       echo "$version" ; exit ;;
684c8945a0SNathan Whitehorn    --help | --h* | -h )
694c8945a0SNathan Whitehorn       echo "$usage"; exit ;;
704c8945a0SNathan Whitehorn    -- )     # Stop option processing
714c8945a0SNathan Whitehorn       shift; break ;;
724c8945a0SNathan Whitehorn    - )	# Use stdin as input.
734c8945a0SNathan Whitehorn       break ;;
744c8945a0SNathan Whitehorn    -* )
754c8945a0SNathan Whitehorn       echo "$me: invalid option $1$help" >&2
764c8945a0SNathan Whitehorn       exit 1 ;;
774c8945a0SNathan Whitehorn    * )
784c8945a0SNathan Whitehorn       break ;;
794c8945a0SNathan Whitehorn  esac
804c8945a0SNathan Whitehorndone
814c8945a0SNathan Whitehorn
824c8945a0SNathan Whitehornif test $# != 0; then
834c8945a0SNathan Whitehorn  echo "$me: too many arguments$help" >&2
844c8945a0SNathan Whitehorn  exit 1
854c8945a0SNathan Whitehornfi
864c8945a0SNathan Whitehorn
874c8945a0SNathan Whitehorn# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
884c8945a0SNathan Whitehorn# compiler to aid in system detection is discouraged as it requires
894c8945a0SNathan Whitehorn# temporary files to be created and, as you can see below, it is a
904c8945a0SNathan Whitehorn# headache to deal with in a portable fashion.
914c8945a0SNathan Whitehorn
924c8945a0SNathan Whitehorn# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
934c8945a0SNathan Whitehorn# use `HOST_CC' if defined, but it is deprecated.
944c8945a0SNathan Whitehorn
954c8945a0SNathan Whitehorn# Portable tmp directory creation inspired by the Autoconf team.
964c8945a0SNathan Whitehorn
97*a96ef450SBaptiste Daroussintmp=
98*a96ef450SBaptiste Daroussin# shellcheck disable=SC2172
99*a96ef450SBaptiste Daroussintrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
100*a96ef450SBaptiste Daroussin
101*a96ef450SBaptiste Daroussinset_cc_for_build() {
102*a96ef450SBaptiste Daroussin    # prevent multiple calls if $tmp is already set
103*a96ef450SBaptiste Daroussin    test "$tmp" && return 0
104*a96ef450SBaptiste Daroussin    : "${TMPDIR=/tmp}"
105*a96ef450SBaptiste Daroussin    # shellcheck disable=SC2039
1064c8945a0SNathan Whitehorn    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
107*a96ef450SBaptiste Daroussin	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
108*a96ef450SBaptiste Daroussin	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
109*a96ef450SBaptiste Daroussin	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
110*a96ef450SBaptiste Daroussin    dummy=$tmp/dummy
111f4f33ea0SBaptiste Daroussin    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
112*a96ef450SBaptiste Daroussin	,,)    echo "int x;" > "$dummy.c"
113*a96ef450SBaptiste Daroussin	       for driver in cc gcc c89 c99 ; do
114*a96ef450SBaptiste Daroussin		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
115*a96ef450SBaptiste Daroussin		       CC_FOR_BUILD="$driver"
116*a96ef450SBaptiste Daroussin		       break
117*a96ef450SBaptiste Daroussin		   fi
118*a96ef450SBaptiste Daroussin	       done
1194c8945a0SNathan Whitehorn	       if test x"$CC_FOR_BUILD" = x ; then
120*a96ef450SBaptiste Daroussin		   CC_FOR_BUILD=no_compiler_found
1214c8945a0SNathan Whitehorn	       fi
1224c8945a0SNathan Whitehorn	       ;;
1234c8945a0SNathan Whitehorn	,,*)   CC_FOR_BUILD=$CC ;;
1244c8945a0SNathan Whitehorn	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
125*a96ef450SBaptiste Daroussin    esac
126*a96ef450SBaptiste Daroussin}
1274c8945a0SNathan Whitehorn
1284c8945a0SNathan Whitehorn# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1294c8945a0SNathan Whitehorn# (ghazi@noc.rutgers.edu 1994-08-24)
130*a96ef450SBaptiste Daroussinif test -f /.attbin/uname ; then
1314c8945a0SNathan Whitehorn	PATH=$PATH:/.attbin ; export PATH
1324c8945a0SNathan Whitehornfi
1334c8945a0SNathan Whitehorn
1344c8945a0SNathan WhitehornUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1354c8945a0SNathan WhitehornUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1364c8945a0SNathan WhitehornUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1374c8945a0SNathan WhitehornUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1384c8945a0SNathan Whitehorn
139f4f33ea0SBaptiste Daroussincase "$UNAME_SYSTEM" in
140febdb468SDevin TeskeLinux|GNU|GNU/*)
141febdb468SDevin Teske	# If the system lacks a compiler, then just pick glibc.
142febdb468SDevin Teske	# We could probably try harder.
143febdb468SDevin Teske	LIBC=gnu
144febdb468SDevin Teske
145*a96ef450SBaptiste Daroussin	set_cc_for_build
146f4f33ea0SBaptiste Daroussin	cat <<-EOF > "$dummy.c"
147febdb468SDevin Teske	#include <features.h>
148febdb468SDevin Teske	#if defined(__UCLIBC__)
149febdb468SDevin Teske	LIBC=uclibc
150febdb468SDevin Teske	#elif defined(__dietlibc__)
151febdb468SDevin Teske	LIBC=dietlibc
152febdb468SDevin Teske	#else
153febdb468SDevin Teske	LIBC=gnu
154febdb468SDevin Teske	#endif
155febdb468SDevin Teske	EOF
156f4f33ea0SBaptiste Daroussin	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
157f4f33ea0SBaptiste Daroussin
158f4f33ea0SBaptiste Daroussin	# If ldd exists, use it to detect musl libc.
159f4f33ea0SBaptiste Daroussin	if command -v ldd >/dev/null && \
160f4f33ea0SBaptiste Daroussin		ldd --version 2>&1 | grep -q ^musl
161f4f33ea0SBaptiste Daroussin	then
162f4f33ea0SBaptiste Daroussin	    LIBC=musl
163f4f33ea0SBaptiste Daroussin	fi
164febdb468SDevin Teske	;;
165febdb468SDevin Teskeesac
166febdb468SDevin Teske
1674c8945a0SNathan Whitehorn# Note: order is significant - the case branches are not exclusive.
1684c8945a0SNathan Whitehorn
169f4f33ea0SBaptiste Daroussincase "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
1704c8945a0SNathan Whitehorn    *:NetBSD:*:*)
1714c8945a0SNathan Whitehorn	# NetBSD (nbsd) targets should (where applicable) match one or
1722a3e3873SBaptiste Daroussin	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1734c8945a0SNathan Whitehorn	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1744c8945a0SNathan Whitehorn	# switched to ELF, *-*-netbsd* would select the old
1754c8945a0SNathan Whitehorn	# object file format.  This provides both forward
1764c8945a0SNathan Whitehorn	# compatibility and a consistent mechanism for selecting the
1774c8945a0SNathan Whitehorn	# object file format.
1784c8945a0SNathan Whitehorn	#
1794c8945a0SNathan Whitehorn	# Note: NetBSD doesn't particularly care about the vendor
1804c8945a0SNathan Whitehorn	# portion of the name.  We always set it to "unknown".
1814c8945a0SNathan Whitehorn	sysctl="sysctl -n hw.machine_arch"
182f4f33ea0SBaptiste Daroussin	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
183f4f33ea0SBaptiste Daroussin	    "/sbin/$sysctl" 2>/dev/null || \
184f4f33ea0SBaptiste Daroussin	    "/usr/sbin/$sysctl" 2>/dev/null || \
185f4f33ea0SBaptiste Daroussin	    echo unknown)`
186f4f33ea0SBaptiste Daroussin	case "$UNAME_MACHINE_ARCH" in
1874c8945a0SNathan Whitehorn	    armeb) machine=armeb-unknown ;;
1884c8945a0SNathan Whitehorn	    arm*) machine=arm-unknown ;;
1894c8945a0SNathan Whitehorn	    sh3el) machine=shl-unknown ;;
1904c8945a0SNathan Whitehorn	    sh3eb) machine=sh-unknown ;;
1914c8945a0SNathan Whitehorn	    sh5el) machine=sh5le-unknown ;;
192f4f33ea0SBaptiste Daroussin	    earmv*)
193f4f33ea0SBaptiste Daroussin		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
194f4f33ea0SBaptiste Daroussin		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
195f4f33ea0SBaptiste Daroussin		machine="${arch}${endian}"-unknown
196f4f33ea0SBaptiste Daroussin		;;
197f4f33ea0SBaptiste Daroussin	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
1984c8945a0SNathan Whitehorn	esac
1994c8945a0SNathan Whitehorn	# The Operating System including object format, if it has switched
200f4f33ea0SBaptiste Daroussin	# to ELF recently (or will in the future) and ABI.
201f4f33ea0SBaptiste Daroussin	case "$UNAME_MACHINE_ARCH" in
202f4f33ea0SBaptiste Daroussin	    earm*)
203f4f33ea0SBaptiste Daroussin		os=netbsdelf
204f4f33ea0SBaptiste Daroussin		;;
2054c8945a0SNathan Whitehorn	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
206*a96ef450SBaptiste Daroussin		set_cc_for_build
2074c8945a0SNathan Whitehorn		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2084c8945a0SNathan Whitehorn			| grep -q __ELF__
2094c8945a0SNathan Whitehorn		then
2104c8945a0SNathan Whitehorn		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2114c8945a0SNathan Whitehorn		    # Return netbsd for either.  FIX?
2124c8945a0SNathan Whitehorn		    os=netbsd
2134c8945a0SNathan Whitehorn		else
2144c8945a0SNathan Whitehorn		    os=netbsdelf
2154c8945a0SNathan Whitehorn		fi
2164c8945a0SNathan Whitehorn		;;
2174c8945a0SNathan Whitehorn	    *)
2184c8945a0SNathan Whitehorn		os=netbsd
2194c8945a0SNathan Whitehorn		;;
2204c8945a0SNathan Whitehorn	esac
221f4f33ea0SBaptiste Daroussin	# Determine ABI tags.
222f4f33ea0SBaptiste Daroussin	case "$UNAME_MACHINE_ARCH" in
223f4f33ea0SBaptiste Daroussin	    earm*)
224f4f33ea0SBaptiste Daroussin		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
225f4f33ea0SBaptiste Daroussin		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
226f4f33ea0SBaptiste Daroussin		;;
227f4f33ea0SBaptiste Daroussin	esac
2284c8945a0SNathan Whitehorn	# The OS release
2294c8945a0SNathan Whitehorn	# Debian GNU/NetBSD machines have a different userland, and
2304c8945a0SNathan Whitehorn	# thus, need a distinct triplet. However, they do not need
2314c8945a0SNathan Whitehorn	# kernel version information, so it can be replaced with a
2324c8945a0SNathan Whitehorn	# suitable tag, in the style of linux-gnu.
233f4f33ea0SBaptiste Daroussin	case "$UNAME_VERSION" in
2344c8945a0SNathan Whitehorn	    Debian*)
2354c8945a0SNathan Whitehorn		release='-gnu'
2364c8945a0SNathan Whitehorn		;;
2374c8945a0SNathan Whitehorn	    *)
238f4f33ea0SBaptiste Daroussin		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2394c8945a0SNathan Whitehorn		;;
2404c8945a0SNathan Whitehorn	esac
2414c8945a0SNathan Whitehorn	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2424c8945a0SNathan Whitehorn	# contains redundant information, the shorter form:
2434c8945a0SNathan Whitehorn	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
244f4f33ea0SBaptiste Daroussin	echo "$machine-${os}${release}${abi-}"
2454c8945a0SNathan Whitehorn	exit ;;
2462a3e3873SBaptiste Daroussin    *:Bitrig:*:*)
2472a3e3873SBaptiste Daroussin	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
248f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
2492a3e3873SBaptiste Daroussin	exit ;;
2504c8945a0SNathan Whitehorn    *:OpenBSD:*:*)
2514c8945a0SNathan Whitehorn	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
252f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
253f4f33ea0SBaptiste Daroussin	exit ;;
254f4f33ea0SBaptiste Daroussin    *:LibertyBSD:*:*)
255f4f33ea0SBaptiste Daroussin	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
256f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
257f4f33ea0SBaptiste Daroussin	exit ;;
258f4f33ea0SBaptiste Daroussin    *:MidnightBSD:*:*)
259f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
2604c8945a0SNathan Whitehorn	exit ;;
2614c8945a0SNathan Whitehorn    *:ekkoBSD:*:*)
262f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
2634c8945a0SNathan Whitehorn	exit ;;
2644c8945a0SNathan Whitehorn    *:SolidBSD:*:*)
265f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
2664c8945a0SNathan Whitehorn	exit ;;
267*a96ef450SBaptiste Daroussin    *:OS108:*:*)
268*a96ef450SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
269*a96ef450SBaptiste Daroussin	exit ;;
2704c8945a0SNathan Whitehorn    macppc:MirBSD:*:*)
271f4f33ea0SBaptiste Daroussin	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
2724c8945a0SNathan Whitehorn	exit ;;
2734c8945a0SNathan Whitehorn    *:MirBSD:*:*)
274f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
275f4f33ea0SBaptiste Daroussin	exit ;;
276f4f33ea0SBaptiste Daroussin    *:Sortix:*:*)
277f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-sortix
278f4f33ea0SBaptiste Daroussin	exit ;;
279*a96ef450SBaptiste Daroussin    *:Twizzler:*:*)
280*a96ef450SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-twizzler
281*a96ef450SBaptiste Daroussin	exit ;;
282f4f33ea0SBaptiste Daroussin    *:Redox:*:*)
283f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-redox
284f4f33ea0SBaptiste Daroussin	exit ;;
285f4f33ea0SBaptiste Daroussin    mips:OSF1:*.*)
286f4f33ea0SBaptiste Daroussin	echo mips-dec-osf1
2874c8945a0SNathan Whitehorn	exit ;;
2884c8945a0SNathan Whitehorn    alpha:OSF1:*:*)
2894c8945a0SNathan Whitehorn	case $UNAME_RELEASE in
2904c8945a0SNathan Whitehorn	*4.0)
2914c8945a0SNathan Whitehorn		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2924c8945a0SNathan Whitehorn		;;
2934c8945a0SNathan Whitehorn	*5.*)
2944c8945a0SNathan Whitehorn		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2954c8945a0SNathan Whitehorn		;;
2964c8945a0SNathan Whitehorn	esac
2974c8945a0SNathan Whitehorn	# According to Compaq, /usr/sbin/psrinfo has been available on
2984c8945a0SNathan Whitehorn	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2994c8945a0SNathan Whitehorn	# covers most systems running today.  This code pipes the CPU
3004c8945a0SNathan Whitehorn	# types through head -n 1, so we only detect the type of CPU 0.
3014c8945a0SNathan Whitehorn	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3024c8945a0SNathan Whitehorn	case "$ALPHA_CPU_TYPE" in
3034c8945a0SNathan Whitehorn	    "EV4 (21064)")
304f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alpha ;;
3054c8945a0SNathan Whitehorn	    "EV4.5 (21064)")
306f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alpha ;;
3074c8945a0SNathan Whitehorn	    "LCA4 (21066/21068)")
308f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alpha ;;
3094c8945a0SNathan Whitehorn	    "EV5 (21164)")
310f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev5 ;;
3114c8945a0SNathan Whitehorn	    "EV5.6 (21164A)")
312f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev56 ;;
3134c8945a0SNathan Whitehorn	    "EV5.6 (21164PC)")
314f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphapca56 ;;
3154c8945a0SNathan Whitehorn	    "EV5.7 (21164PC)")
316f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphapca57 ;;
3174c8945a0SNathan Whitehorn	    "EV6 (21264)")
318f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev6 ;;
3194c8945a0SNathan Whitehorn	    "EV6.7 (21264A)")
320f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev67 ;;
3214c8945a0SNathan Whitehorn	    "EV6.8CB (21264C)")
322f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev68 ;;
3234c8945a0SNathan Whitehorn	    "EV6.8AL (21264B)")
324f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev68 ;;
3254c8945a0SNathan Whitehorn	    "EV6.8CX (21264D)")
326f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev68 ;;
3274c8945a0SNathan Whitehorn	    "EV6.9A (21264/EV69A)")
328f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev69 ;;
3294c8945a0SNathan Whitehorn	    "EV7 (21364)")
330f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev7 ;;
3314c8945a0SNathan Whitehorn	    "EV7.9 (21364A)")
332f4f33ea0SBaptiste Daroussin		UNAME_MACHINE=alphaev79 ;;
3334c8945a0SNathan Whitehorn	esac
3344c8945a0SNathan Whitehorn	# A Pn.n version is a patched version.
3354c8945a0SNathan Whitehorn	# A Vn.n version is a released version.
3364c8945a0SNathan Whitehorn	# A Tn.n version is a released field test version.
3374c8945a0SNathan Whitehorn	# A Xn.n version is an unreleased experimental baselevel.
3384c8945a0SNathan Whitehorn	# 1.2 uses "1.2" for uname -r.
339f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
340682c9e0fSNathan Whitehorn	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
341682c9e0fSNathan Whitehorn	exitcode=$?
342682c9e0fSNathan Whitehorn	trap '' 0
343682c9e0fSNathan Whitehorn	exit $exitcode ;;
3444c8945a0SNathan Whitehorn    Amiga*:UNIX_System_V:4.0:*)
3454c8945a0SNathan Whitehorn	echo m68k-unknown-sysv4
3464c8945a0SNathan Whitehorn	exit ;;
3474c8945a0SNathan Whitehorn    *:[Aa]miga[Oo][Ss]:*:*)
348f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-amigaos
3494c8945a0SNathan Whitehorn	exit ;;
3504c8945a0SNathan Whitehorn    *:[Mm]orph[Oo][Ss]:*:*)
351f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-morphos
3524c8945a0SNathan Whitehorn	exit ;;
3534c8945a0SNathan Whitehorn    *:OS/390:*:*)
3544c8945a0SNathan Whitehorn	echo i370-ibm-openedition
3554c8945a0SNathan Whitehorn	exit ;;
3564c8945a0SNathan Whitehorn    *:z/VM:*:*)
3574c8945a0SNathan Whitehorn	echo s390-ibm-zvmoe
3584c8945a0SNathan Whitehorn	exit ;;
3594c8945a0SNathan Whitehorn    *:OS400:*:*)
3604c8945a0SNathan Whitehorn	echo powerpc-ibm-os400
3614c8945a0SNathan Whitehorn	exit ;;
3624c8945a0SNathan Whitehorn    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
363f4f33ea0SBaptiste Daroussin	echo arm-acorn-riscix"$UNAME_RELEASE"
3644c8945a0SNathan Whitehorn	exit ;;
3652a3e3873SBaptiste Daroussin    arm*:riscos:*:*|arm*:RISCOS:*:*)
3664c8945a0SNathan Whitehorn	echo arm-unknown-riscos
3674c8945a0SNathan Whitehorn	exit ;;
3684c8945a0SNathan Whitehorn    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3694c8945a0SNathan Whitehorn	echo hppa1.1-hitachi-hiuxmpp
3704c8945a0SNathan Whitehorn	exit ;;
3714c8945a0SNathan Whitehorn    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3724c8945a0SNathan Whitehorn	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3734c8945a0SNathan Whitehorn	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3744c8945a0SNathan Whitehorn		echo pyramid-pyramid-sysv3
3754c8945a0SNathan Whitehorn	else
3764c8945a0SNathan Whitehorn		echo pyramid-pyramid-bsd
3774c8945a0SNathan Whitehorn	fi
3784c8945a0SNathan Whitehorn	exit ;;
3794c8945a0SNathan Whitehorn    NILE*:*:*:dcosx)
3804c8945a0SNathan Whitehorn	echo pyramid-pyramid-svr4
3814c8945a0SNathan Whitehorn	exit ;;
3824c8945a0SNathan Whitehorn    DRS?6000:unix:4.0:6*)
3834c8945a0SNathan Whitehorn	echo sparc-icl-nx6
3844c8945a0SNathan Whitehorn	exit ;;
3854c8945a0SNathan Whitehorn    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3864c8945a0SNathan Whitehorn	case `/usr/bin/uname -p` in
3874c8945a0SNathan Whitehorn	    sparc) echo sparc-icl-nx7; exit ;;
3884c8945a0SNathan Whitehorn	esac ;;
3894c8945a0SNathan Whitehorn    s390x:SunOS:*:*)
390f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
3914c8945a0SNathan Whitehorn	exit ;;
3924c8945a0SNathan Whitehorn    sun4H:SunOS:5.*:*)
393f4f33ea0SBaptiste Daroussin	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
3944c8945a0SNathan Whitehorn	exit ;;
3954c8945a0SNathan Whitehorn    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
396f4f33ea0SBaptiste Daroussin	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
3974c8945a0SNathan Whitehorn	exit ;;
3984c8945a0SNathan Whitehorn    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
399f4f33ea0SBaptiste Daroussin	echo i386-pc-auroraux"$UNAME_RELEASE"
4004c8945a0SNathan Whitehorn	exit ;;
4014c8945a0SNathan Whitehorn    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
402*a96ef450SBaptiste Daroussin	set_cc_for_build
403f4f33ea0SBaptiste Daroussin	SUN_ARCH=i386
4044c8945a0SNathan Whitehorn	# If there is a compiler, see if it is configured for 64-bit objects.
4054c8945a0SNathan Whitehorn	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4064c8945a0SNathan Whitehorn	# This test works for both compilers.
407*a96ef450SBaptiste Daroussin	if test "$CC_FOR_BUILD" != no_compiler_found; then
4084c8945a0SNathan Whitehorn	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
409f4f33ea0SBaptiste Daroussin		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
4104c8945a0SNathan Whitehorn		grep IS_64BIT_ARCH >/dev/null
4114c8945a0SNathan Whitehorn	    then
412f4f33ea0SBaptiste Daroussin		SUN_ARCH=x86_64
4134c8945a0SNathan Whitehorn	    fi
4144c8945a0SNathan Whitehorn	fi
415f4f33ea0SBaptiste Daroussin	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4164c8945a0SNathan Whitehorn	exit ;;
4174c8945a0SNathan Whitehorn    sun4*:SunOS:6*:*)
4184c8945a0SNathan Whitehorn	# According to config.sub, this is the proper way to canonicalize
4194c8945a0SNathan Whitehorn	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4204c8945a0SNathan Whitehorn	# it's likely to be more like Solaris than SunOS4.
421f4f33ea0SBaptiste Daroussin	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4224c8945a0SNathan Whitehorn	exit ;;
4234c8945a0SNathan Whitehorn    sun4*:SunOS:*:*)
4244c8945a0SNathan Whitehorn	case "`/usr/bin/arch -k`" in
4254c8945a0SNathan Whitehorn	    Series*|S4*)
4264c8945a0SNathan Whitehorn		UNAME_RELEASE=`uname -v`
4274c8945a0SNathan Whitehorn		;;
4284c8945a0SNathan Whitehorn	esac
4294c8945a0SNathan Whitehorn	# Japanese Language versions have a version number like `4.1.3-JL'.
430f4f33ea0SBaptiste Daroussin	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
4314c8945a0SNathan Whitehorn	exit ;;
4324c8945a0SNathan Whitehorn    sun3*:SunOS:*:*)
433f4f33ea0SBaptiste Daroussin	echo m68k-sun-sunos"$UNAME_RELEASE"
4344c8945a0SNathan Whitehorn	exit ;;
4354c8945a0SNathan Whitehorn    sun*:*:4.2BSD:*)
4364c8945a0SNathan Whitehorn	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
437f4f33ea0SBaptiste Daroussin	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4384c8945a0SNathan Whitehorn	case "`/bin/arch`" in
4394c8945a0SNathan Whitehorn	    sun3)
440f4f33ea0SBaptiste Daroussin		echo m68k-sun-sunos"$UNAME_RELEASE"
4414c8945a0SNathan Whitehorn		;;
4424c8945a0SNathan Whitehorn	    sun4)
443f4f33ea0SBaptiste Daroussin		echo sparc-sun-sunos"$UNAME_RELEASE"
4444c8945a0SNathan Whitehorn		;;
4454c8945a0SNathan Whitehorn	esac
4464c8945a0SNathan Whitehorn	exit ;;
4474c8945a0SNathan Whitehorn    aushp:SunOS:*:*)
448f4f33ea0SBaptiste Daroussin	echo sparc-auspex-sunos"$UNAME_RELEASE"
4494c8945a0SNathan Whitehorn	exit ;;
4504c8945a0SNathan Whitehorn    # The situation for MiNT is a little confusing.  The machine name
4514c8945a0SNathan Whitehorn    # can be virtually everything (everything which is not
4524c8945a0SNathan Whitehorn    # "atarist" or "atariste" at least should have a processor
4534c8945a0SNathan Whitehorn    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4544c8945a0SNathan Whitehorn    # to the lowercase version "mint" (or "freemint").  Finally
4554c8945a0SNathan Whitehorn    # the system name "TOS" denotes a system which is actually not
4564c8945a0SNathan Whitehorn    # MiNT.  But MiNT is downward compatible to TOS, so this should
4574c8945a0SNathan Whitehorn    # be no problem.
4584c8945a0SNathan Whitehorn    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
459f4f33ea0SBaptiste Daroussin	echo m68k-atari-mint"$UNAME_RELEASE"
4604c8945a0SNathan Whitehorn	exit ;;
4614c8945a0SNathan Whitehorn    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
462f4f33ea0SBaptiste Daroussin	echo m68k-atari-mint"$UNAME_RELEASE"
4634c8945a0SNathan Whitehorn	exit ;;
4644c8945a0SNathan Whitehorn    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
465f4f33ea0SBaptiste Daroussin	echo m68k-atari-mint"$UNAME_RELEASE"
4664c8945a0SNathan Whitehorn	exit ;;
4674c8945a0SNathan Whitehorn    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
468f4f33ea0SBaptiste Daroussin	echo m68k-milan-mint"$UNAME_RELEASE"
4694c8945a0SNathan Whitehorn	exit ;;
4704c8945a0SNathan Whitehorn    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
471f4f33ea0SBaptiste Daroussin	echo m68k-hades-mint"$UNAME_RELEASE"
4724c8945a0SNathan Whitehorn	exit ;;
4734c8945a0SNathan Whitehorn    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
474f4f33ea0SBaptiste Daroussin	echo m68k-unknown-mint"$UNAME_RELEASE"
4754c8945a0SNathan Whitehorn	exit ;;
4764c8945a0SNathan Whitehorn    m68k:machten:*:*)
477f4f33ea0SBaptiste Daroussin	echo m68k-apple-machten"$UNAME_RELEASE"
4784c8945a0SNathan Whitehorn	exit ;;
4794c8945a0SNathan Whitehorn    powerpc:machten:*:*)
480f4f33ea0SBaptiste Daroussin	echo powerpc-apple-machten"$UNAME_RELEASE"
4814c8945a0SNathan Whitehorn	exit ;;
4824c8945a0SNathan Whitehorn    RISC*:Mach:*:*)
4834c8945a0SNathan Whitehorn	echo mips-dec-mach_bsd4.3
4844c8945a0SNathan Whitehorn	exit ;;
4854c8945a0SNathan Whitehorn    RISC*:ULTRIX:*:*)
486f4f33ea0SBaptiste Daroussin	echo mips-dec-ultrix"$UNAME_RELEASE"
4874c8945a0SNathan Whitehorn	exit ;;
4884c8945a0SNathan Whitehorn    VAX*:ULTRIX*:*:*)
489f4f33ea0SBaptiste Daroussin	echo vax-dec-ultrix"$UNAME_RELEASE"
4904c8945a0SNathan Whitehorn	exit ;;
4914c8945a0SNathan Whitehorn    2020:CLIX:*:* | 2430:CLIX:*:*)
492f4f33ea0SBaptiste Daroussin	echo clipper-intergraph-clix"$UNAME_RELEASE"
4934c8945a0SNathan Whitehorn	exit ;;
4944c8945a0SNathan Whitehorn    mips:*:*:UMIPS | mips:*:*:RISCos)
495*a96ef450SBaptiste Daroussin	set_cc_for_build
496f4f33ea0SBaptiste Daroussin	sed 's/^	//' << EOF > "$dummy.c"
4974c8945a0SNathan Whitehorn#ifdef __cplusplus
4984c8945a0SNathan Whitehorn#include <stdio.h>  /* for printf() prototype */
4994c8945a0SNathan Whitehorn	int main (int argc, char *argv[]) {
5004c8945a0SNathan Whitehorn#else
5014c8945a0SNathan Whitehorn	int main (argc, argv) int argc; char *argv[]; {
5024c8945a0SNathan Whitehorn#endif
5034c8945a0SNathan Whitehorn	#if defined (host_mips) && defined (MIPSEB)
5044c8945a0SNathan Whitehorn	#if defined (SYSTYPE_SYSV)
505f4f33ea0SBaptiste Daroussin	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5064c8945a0SNathan Whitehorn	#endif
5074c8945a0SNathan Whitehorn	#if defined (SYSTYPE_SVR4)
508f4f33ea0SBaptiste Daroussin	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5094c8945a0SNathan Whitehorn	#endif
5104c8945a0SNathan Whitehorn	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
511f4f33ea0SBaptiste Daroussin	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5124c8945a0SNathan Whitehorn	#endif
5134c8945a0SNathan Whitehorn	#endif
5144c8945a0SNathan Whitehorn	  exit (-1);
5154c8945a0SNathan Whitehorn	}
5164c8945a0SNathan WhitehornEOF
517f4f33ea0SBaptiste Daroussin	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
518f4f33ea0SBaptiste Daroussin	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
519f4f33ea0SBaptiste Daroussin	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5204c8945a0SNathan Whitehorn	    { echo "$SYSTEM_NAME"; exit; }
521f4f33ea0SBaptiste Daroussin	echo mips-mips-riscos"$UNAME_RELEASE"
5224c8945a0SNathan Whitehorn	exit ;;
5234c8945a0SNathan Whitehorn    Motorola:PowerMAX_OS:*:*)
5244c8945a0SNathan Whitehorn	echo powerpc-motorola-powermax
5254c8945a0SNathan Whitehorn	exit ;;
5264c8945a0SNathan Whitehorn    Motorola:*:4.3:PL8-*)
5274c8945a0SNathan Whitehorn	echo powerpc-harris-powermax
5284c8945a0SNathan Whitehorn	exit ;;
5294c8945a0SNathan Whitehorn    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5304c8945a0SNathan Whitehorn	echo powerpc-harris-powermax
5314c8945a0SNathan Whitehorn	exit ;;
5324c8945a0SNathan Whitehorn    Night_Hawk:Power_UNIX:*:*)
5334c8945a0SNathan Whitehorn	echo powerpc-harris-powerunix
5344c8945a0SNathan Whitehorn	exit ;;
5354c8945a0SNathan Whitehorn    m88k:CX/UX:7*:*)
5364c8945a0SNathan Whitehorn	echo m88k-harris-cxux7
5374c8945a0SNathan Whitehorn	exit ;;
5384c8945a0SNathan Whitehorn    m88k:*:4*:R4*)
5394c8945a0SNathan Whitehorn	echo m88k-motorola-sysv4
5404c8945a0SNathan Whitehorn	exit ;;
5414c8945a0SNathan Whitehorn    m88k:*:3*:R3*)
5424c8945a0SNathan Whitehorn	echo m88k-motorola-sysv3
5434c8945a0SNathan Whitehorn	exit ;;
5444c8945a0SNathan Whitehorn    AViiON:dgux:*:*)
5454c8945a0SNathan Whitehorn	# DG/UX returns AViiON for all architectures
5464c8945a0SNathan Whitehorn	UNAME_PROCESSOR=`/usr/bin/uname -p`
547*a96ef450SBaptiste Daroussin	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5484c8945a0SNathan Whitehorn	then
549*a96ef450SBaptiste Daroussin	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
550*a96ef450SBaptiste Daroussin	       test "$TARGET_BINARY_INTERFACE"x = x
5514c8945a0SNathan Whitehorn	    then
552f4f33ea0SBaptiste Daroussin		echo m88k-dg-dgux"$UNAME_RELEASE"
5534c8945a0SNathan Whitehorn	    else
554f4f33ea0SBaptiste Daroussin		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
5554c8945a0SNathan Whitehorn	    fi
5564c8945a0SNathan Whitehorn	else
557f4f33ea0SBaptiste Daroussin	    echo i586-dg-dgux"$UNAME_RELEASE"
5584c8945a0SNathan Whitehorn	fi
5594c8945a0SNathan Whitehorn	exit ;;
5604c8945a0SNathan Whitehorn    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5614c8945a0SNathan Whitehorn	echo m88k-dolphin-sysv3
5624c8945a0SNathan Whitehorn	exit ;;
5634c8945a0SNathan Whitehorn    M88*:*:R3*:*)
5644c8945a0SNathan Whitehorn	# Delta 88k system running SVR3
5654c8945a0SNathan Whitehorn	echo m88k-motorola-sysv3
5664c8945a0SNathan Whitehorn	exit ;;
5674c8945a0SNathan Whitehorn    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5684c8945a0SNathan Whitehorn	echo m88k-tektronix-sysv3
5694c8945a0SNathan Whitehorn	exit ;;
5704c8945a0SNathan Whitehorn    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5714c8945a0SNathan Whitehorn	echo m68k-tektronix-bsd
5724c8945a0SNathan Whitehorn	exit ;;
5734c8945a0SNathan Whitehorn    *:IRIX*:*:*)
574f4f33ea0SBaptiste Daroussin	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
5754c8945a0SNathan Whitehorn	exit ;;
5764c8945a0SNathan Whitehorn    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5774c8945a0SNathan Whitehorn	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5784c8945a0SNathan Whitehorn	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5794c8945a0SNathan Whitehorn    i*86:AIX:*:*)
5804c8945a0SNathan Whitehorn	echo i386-ibm-aix
5814c8945a0SNathan Whitehorn	exit ;;
5824c8945a0SNathan Whitehorn    ia64:AIX:*:*)
583*a96ef450SBaptiste Daroussin	if test -x /usr/bin/oslevel ; then
5844c8945a0SNathan Whitehorn		IBM_REV=`/usr/bin/oslevel`
5854c8945a0SNathan Whitehorn	else
586f4f33ea0SBaptiste Daroussin		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
5874c8945a0SNathan Whitehorn	fi
588f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
5894c8945a0SNathan Whitehorn	exit ;;
5904c8945a0SNathan Whitehorn    *:AIX:2:3)
5914c8945a0SNathan Whitehorn	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
592*a96ef450SBaptiste Daroussin		set_cc_for_build
593f4f33ea0SBaptiste Daroussin		sed 's/^		//' << EOF > "$dummy.c"
5944c8945a0SNathan Whitehorn		#include <sys/systemcfg.h>
5954c8945a0SNathan Whitehorn
5964c8945a0SNathan Whitehorn		main()
5974c8945a0SNathan Whitehorn			{
5984c8945a0SNathan Whitehorn			if (!__power_pc())
5994c8945a0SNathan Whitehorn				exit(1);
6004c8945a0SNathan Whitehorn			puts("powerpc-ibm-aix3.2.5");
6014c8945a0SNathan Whitehorn			exit(0);
6024c8945a0SNathan Whitehorn			}
6034c8945a0SNathan WhitehornEOF
604f4f33ea0SBaptiste Daroussin		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6054c8945a0SNathan Whitehorn		then
6064c8945a0SNathan Whitehorn			echo "$SYSTEM_NAME"
6074c8945a0SNathan Whitehorn		else
6084c8945a0SNathan Whitehorn			echo rs6000-ibm-aix3.2.5
6094c8945a0SNathan Whitehorn		fi
6104c8945a0SNathan Whitehorn	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6114c8945a0SNathan Whitehorn		echo rs6000-ibm-aix3.2.4
6124c8945a0SNathan Whitehorn	else
6134c8945a0SNathan Whitehorn		echo rs6000-ibm-aix3.2
6144c8945a0SNathan Whitehorn	fi
6154c8945a0SNathan Whitehorn	exit ;;
6167a1c0d96SNathan Whitehorn    *:AIX:*:[4567])
6174c8945a0SNathan Whitehorn	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
618f4f33ea0SBaptiste Daroussin	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6194c8945a0SNathan Whitehorn		IBM_ARCH=rs6000
6204c8945a0SNathan Whitehorn	else
6214c8945a0SNathan Whitehorn		IBM_ARCH=powerpc
6224c8945a0SNathan Whitehorn	fi
623*a96ef450SBaptiste Daroussin	if test -x /usr/bin/lslpp ; then
624f4f33ea0SBaptiste Daroussin		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
625f4f33ea0SBaptiste Daroussin			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6264c8945a0SNathan Whitehorn	else
627f4f33ea0SBaptiste Daroussin		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
6284c8945a0SNathan Whitehorn	fi
629f4f33ea0SBaptiste Daroussin	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
6304c8945a0SNathan Whitehorn	exit ;;
6314c8945a0SNathan Whitehorn    *:AIX:*:*)
6324c8945a0SNathan Whitehorn	echo rs6000-ibm-aix
6334c8945a0SNathan Whitehorn	exit ;;
634f4f33ea0SBaptiste Daroussin    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6354c8945a0SNathan Whitehorn	echo romp-ibm-bsd4.4
6364c8945a0SNathan Whitehorn	exit ;;
6374c8945a0SNathan Whitehorn    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
638f4f33ea0SBaptiste Daroussin	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
6394c8945a0SNathan Whitehorn	exit ;;                             # report: romp-ibm BSD 4.3
6404c8945a0SNathan Whitehorn    *:BOSX:*:*)
6414c8945a0SNathan Whitehorn	echo rs6000-bull-bosx
6424c8945a0SNathan Whitehorn	exit ;;
6434c8945a0SNathan Whitehorn    DPX/2?00:B.O.S.:*:*)
6444c8945a0SNathan Whitehorn	echo m68k-bull-sysv3
6454c8945a0SNathan Whitehorn	exit ;;
6464c8945a0SNathan Whitehorn    9000/[34]??:4.3bsd:1.*:*)
6474c8945a0SNathan Whitehorn	echo m68k-hp-bsd
6484c8945a0SNathan Whitehorn	exit ;;
6494c8945a0SNathan Whitehorn    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6504c8945a0SNathan Whitehorn	echo m68k-hp-bsd4.4
6514c8945a0SNathan Whitehorn	exit ;;
6524c8945a0SNathan Whitehorn    9000/[34678]??:HP-UX:*:*)
653f4f33ea0SBaptiste Daroussin	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
654f4f33ea0SBaptiste Daroussin	case "$UNAME_MACHINE" in
6554c8945a0SNathan Whitehorn	    9000/31?)            HP_ARCH=m68000 ;;
6564c8945a0SNathan Whitehorn	    9000/[34]??)         HP_ARCH=m68k ;;
6574c8945a0SNathan Whitehorn	    9000/[678][0-9][0-9])
658*a96ef450SBaptiste Daroussin		if test -x /usr/bin/getconf; then
6594c8945a0SNathan Whitehorn		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6604c8945a0SNathan Whitehorn		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
661f4f33ea0SBaptiste Daroussin		    case "$sc_cpu_version" in
662f4f33ea0SBaptiste Daroussin		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
663f4f33ea0SBaptiste Daroussin		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6644c8945a0SNathan Whitehorn		      532)                      # CPU_PA_RISC2_0
665f4f33ea0SBaptiste Daroussin			case "$sc_kernel_bits" in
666f4f33ea0SBaptiste Daroussin			  32) HP_ARCH=hppa2.0n ;;
667f4f33ea0SBaptiste Daroussin			  64) HP_ARCH=hppa2.0w ;;
668f4f33ea0SBaptiste Daroussin			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
6694c8945a0SNathan Whitehorn			esac ;;
6704c8945a0SNathan Whitehorn		    esac
6714c8945a0SNathan Whitehorn		fi
672*a96ef450SBaptiste Daroussin		if test "$HP_ARCH" = ""; then
673*a96ef450SBaptiste Daroussin		    set_cc_for_build
674f4f33ea0SBaptiste Daroussin		    sed 's/^		//' << EOF > "$dummy.c"
6754c8945a0SNathan Whitehorn
6764c8945a0SNathan Whitehorn		#define _HPUX_SOURCE
6774c8945a0SNathan Whitehorn		#include <stdlib.h>
6784c8945a0SNathan Whitehorn		#include <unistd.h>
6794c8945a0SNathan Whitehorn
6804c8945a0SNathan Whitehorn		int main ()
6814c8945a0SNathan Whitehorn		{
6824c8945a0SNathan Whitehorn		#if defined(_SC_KERNEL_BITS)
6834c8945a0SNathan Whitehorn		    long bits = sysconf(_SC_KERNEL_BITS);
6844c8945a0SNathan Whitehorn		#endif
6854c8945a0SNathan Whitehorn		    long cpu  = sysconf (_SC_CPU_VERSION);
6864c8945a0SNathan Whitehorn
6874c8945a0SNathan Whitehorn		    switch (cpu)
6884c8945a0SNathan Whitehorn			{
6894c8945a0SNathan Whitehorn			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6904c8945a0SNathan Whitehorn			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6914c8945a0SNathan Whitehorn			case CPU_PA_RISC2_0:
6924c8945a0SNathan Whitehorn		#if defined(_SC_KERNEL_BITS)
6934c8945a0SNathan Whitehorn			    switch (bits)
6944c8945a0SNathan Whitehorn				{
6954c8945a0SNathan Whitehorn				case 64: puts ("hppa2.0w"); break;
6964c8945a0SNathan Whitehorn				case 32: puts ("hppa2.0n"); break;
6974c8945a0SNathan Whitehorn				default: puts ("hppa2.0"); break;
6984c8945a0SNathan Whitehorn				} break;
6994c8945a0SNathan Whitehorn		#else  /* !defined(_SC_KERNEL_BITS) */
7004c8945a0SNathan Whitehorn			    puts ("hppa2.0"); break;
7014c8945a0SNathan Whitehorn		#endif
7024c8945a0SNathan Whitehorn			default: puts ("hppa1.0"); break;
7034c8945a0SNathan Whitehorn			}
7044c8945a0SNathan Whitehorn		    exit (0);
7054c8945a0SNathan Whitehorn		}
7064c8945a0SNathan WhitehornEOF
707f4f33ea0SBaptiste Daroussin		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7084c8945a0SNathan Whitehorn		    test -z "$HP_ARCH" && HP_ARCH=hppa
7094c8945a0SNathan Whitehorn		fi ;;
7104c8945a0SNathan Whitehorn	esac
711*a96ef450SBaptiste Daroussin	if test "$HP_ARCH" = hppa2.0w
7124c8945a0SNathan Whitehorn	then
713*a96ef450SBaptiste Daroussin	    set_cc_for_build
7144c8945a0SNathan Whitehorn
7154c8945a0SNathan Whitehorn	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7164c8945a0SNathan Whitehorn	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7174c8945a0SNathan Whitehorn	    # generating 64-bit code.  GNU and HP use different nomenclature:
7184c8945a0SNathan Whitehorn	    #
7194c8945a0SNathan Whitehorn	    # $ CC_FOR_BUILD=cc ./config.guess
7204c8945a0SNathan Whitehorn	    # => hppa2.0w-hp-hpux11.23
7214c8945a0SNathan Whitehorn	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7224c8945a0SNathan Whitehorn	    # => hppa64-hp-hpux11.23
7234c8945a0SNathan Whitehorn
724f4f33ea0SBaptiste Daroussin	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7254c8945a0SNathan Whitehorn		grep -q __LP64__
7264c8945a0SNathan Whitehorn	    then
727f4f33ea0SBaptiste Daroussin		HP_ARCH=hppa2.0w
7284c8945a0SNathan Whitehorn	    else
729f4f33ea0SBaptiste Daroussin		HP_ARCH=hppa64
7304c8945a0SNathan Whitehorn	    fi
7314c8945a0SNathan Whitehorn	fi
732f4f33ea0SBaptiste Daroussin	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
7334c8945a0SNathan Whitehorn	exit ;;
7344c8945a0SNathan Whitehorn    ia64:HP-UX:*:*)
735f4f33ea0SBaptiste Daroussin	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
736f4f33ea0SBaptiste Daroussin	echo ia64-hp-hpux"$HPUX_REV"
7374c8945a0SNathan Whitehorn	exit ;;
7384c8945a0SNathan Whitehorn    3050*:HI-UX:*:*)
739*a96ef450SBaptiste Daroussin	set_cc_for_build
740f4f33ea0SBaptiste Daroussin	sed 's/^	//' << EOF > "$dummy.c"
7414c8945a0SNathan Whitehorn	#include <unistd.h>
7424c8945a0SNathan Whitehorn	int
7434c8945a0SNathan Whitehorn	main ()
7444c8945a0SNathan Whitehorn	{
7454c8945a0SNathan Whitehorn	  long cpu = sysconf (_SC_CPU_VERSION);
7464c8945a0SNathan Whitehorn	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7474c8945a0SNathan Whitehorn	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7484c8945a0SNathan Whitehorn	     results, however.  */
7494c8945a0SNathan Whitehorn	  if (CPU_IS_PA_RISC (cpu))
7504c8945a0SNathan Whitehorn	    {
7514c8945a0SNathan Whitehorn	      switch (cpu)
7524c8945a0SNathan Whitehorn		{
7534c8945a0SNathan Whitehorn		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7544c8945a0SNathan Whitehorn		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7554c8945a0SNathan Whitehorn		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7564c8945a0SNathan Whitehorn		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7574c8945a0SNathan Whitehorn		}
7584c8945a0SNathan Whitehorn	    }
7594c8945a0SNathan Whitehorn	  else if (CPU_IS_HP_MC68K (cpu))
7604c8945a0SNathan Whitehorn	    puts ("m68k-hitachi-hiuxwe2");
7614c8945a0SNathan Whitehorn	  else puts ("unknown-hitachi-hiuxwe2");
7624c8945a0SNathan Whitehorn	  exit (0);
7634c8945a0SNathan Whitehorn	}
7644c8945a0SNathan WhitehornEOF
765f4f33ea0SBaptiste Daroussin	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
7664c8945a0SNathan Whitehorn		{ echo "$SYSTEM_NAME"; exit; }
7674c8945a0SNathan Whitehorn	echo unknown-hitachi-hiuxwe2
7684c8945a0SNathan Whitehorn	exit ;;
7694c8945a0SNathan Whitehorn    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
7704c8945a0SNathan Whitehorn	echo hppa1.1-hp-bsd
7714c8945a0SNathan Whitehorn	exit ;;
7724c8945a0SNathan Whitehorn    9000/8??:4.3bsd:*:*)
7734c8945a0SNathan Whitehorn	echo hppa1.0-hp-bsd
7744c8945a0SNathan Whitehorn	exit ;;
7754c8945a0SNathan Whitehorn    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7764c8945a0SNathan Whitehorn	echo hppa1.0-hp-mpeix
7774c8945a0SNathan Whitehorn	exit ;;
7784c8945a0SNathan Whitehorn    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
7794c8945a0SNathan Whitehorn	echo hppa1.1-hp-osf
7804c8945a0SNathan Whitehorn	exit ;;
7814c8945a0SNathan Whitehorn    hp8??:OSF1:*:*)
7824c8945a0SNathan Whitehorn	echo hppa1.0-hp-osf
7834c8945a0SNathan Whitehorn	exit ;;
7844c8945a0SNathan Whitehorn    i*86:OSF1:*:*)
785*a96ef450SBaptiste Daroussin	if test -x /usr/sbin/sysversion ; then
786f4f33ea0SBaptiste Daroussin	    echo "$UNAME_MACHINE"-unknown-osf1mk
7874c8945a0SNathan Whitehorn	else
788f4f33ea0SBaptiste Daroussin	    echo "$UNAME_MACHINE"-unknown-osf1
7894c8945a0SNathan Whitehorn	fi
7904c8945a0SNathan Whitehorn	exit ;;
7914c8945a0SNathan Whitehorn    parisc*:Lites*:*:*)
7924c8945a0SNathan Whitehorn	echo hppa1.1-hp-lites
7934c8945a0SNathan Whitehorn	exit ;;
7944c8945a0SNathan Whitehorn    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7954c8945a0SNathan Whitehorn	echo c1-convex-bsd
7964c8945a0SNathan Whitehorn	exit ;;
7974c8945a0SNathan Whitehorn    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7984c8945a0SNathan Whitehorn	if getsysinfo -f scalar_acc
7994c8945a0SNathan Whitehorn	then echo c32-convex-bsd
8004c8945a0SNathan Whitehorn	else echo c2-convex-bsd
8014c8945a0SNathan Whitehorn	fi
8024c8945a0SNathan Whitehorn	exit ;;
8034c8945a0SNathan Whitehorn    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8044c8945a0SNathan Whitehorn	echo c34-convex-bsd
8054c8945a0SNathan Whitehorn	exit ;;
8064c8945a0SNathan Whitehorn    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8074c8945a0SNathan Whitehorn	echo c38-convex-bsd
8084c8945a0SNathan Whitehorn	exit ;;
8094c8945a0SNathan Whitehorn    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8104c8945a0SNathan Whitehorn	echo c4-convex-bsd
8114c8945a0SNathan Whitehorn	exit ;;
8124c8945a0SNathan Whitehorn    CRAY*Y-MP:*:*:*)
813f4f33ea0SBaptiste Daroussin	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8144c8945a0SNathan Whitehorn	exit ;;
8154c8945a0SNathan Whitehorn    CRAY*[A-Z]90:*:*:*)
816f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8174c8945a0SNathan Whitehorn	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8184c8945a0SNathan Whitehorn	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8194c8945a0SNathan Whitehorn	      -e 's/\.[^.]*$/.X/'
8204c8945a0SNathan Whitehorn	exit ;;
8214c8945a0SNathan Whitehorn    CRAY*TS:*:*:*)
822f4f33ea0SBaptiste Daroussin	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8234c8945a0SNathan Whitehorn	exit ;;
8244c8945a0SNathan Whitehorn    CRAY*T3E:*:*:*)
825f4f33ea0SBaptiste Daroussin	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8264c8945a0SNathan Whitehorn	exit ;;
8274c8945a0SNathan Whitehorn    CRAY*SV1:*:*:*)
828f4f33ea0SBaptiste Daroussin	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8294c8945a0SNathan Whitehorn	exit ;;
8304c8945a0SNathan Whitehorn    *:UNICOS/mp:*:*)
831f4f33ea0SBaptiste Daroussin	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8324c8945a0SNathan Whitehorn	exit ;;
8334c8945a0SNathan Whitehorn    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
834f4f33ea0SBaptiste Daroussin	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
835f4f33ea0SBaptiste Daroussin	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
836f4f33ea0SBaptiste Daroussin	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8374c8945a0SNathan Whitehorn	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8384c8945a0SNathan Whitehorn	exit ;;
8394c8945a0SNathan Whitehorn    5000:UNIX_System_V:4.*:*)
840f4f33ea0SBaptiste Daroussin	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
841f4f33ea0SBaptiste Daroussin	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8424c8945a0SNathan Whitehorn	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8434c8945a0SNathan Whitehorn	exit ;;
8444c8945a0SNathan Whitehorn    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
845f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
8464c8945a0SNathan Whitehorn	exit ;;
8474c8945a0SNathan Whitehorn    sparc*:BSD/OS:*:*)
848f4f33ea0SBaptiste Daroussin	echo sparc-unknown-bsdi"$UNAME_RELEASE"
8494c8945a0SNathan Whitehorn	exit ;;
8504c8945a0SNathan Whitehorn    *:BSD/OS:*:*)
851f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
8524c8945a0SNathan Whitehorn	exit ;;
853*a96ef450SBaptiste Daroussin    arm:FreeBSD:*:*)
854*a96ef450SBaptiste Daroussin	UNAME_PROCESSOR=`uname -p`
855*a96ef450SBaptiste Daroussin	set_cc_for_build
856*a96ef450SBaptiste Daroussin	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
857*a96ef450SBaptiste Daroussin	    | grep -q __ARM_PCS_VFP
858*a96ef450SBaptiste Daroussin	then
859*a96ef450SBaptiste Daroussin	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
860*a96ef450SBaptiste Daroussin	else
861*a96ef450SBaptiste Daroussin	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
862*a96ef450SBaptiste Daroussin	fi
863*a96ef450SBaptiste Daroussin	exit ;;
8644c8945a0SNathan Whitehorn    *:FreeBSD:*:*)
8652a3e3873SBaptiste Daroussin	UNAME_PROCESSOR=`/usr/bin/uname -p`
866f4f33ea0SBaptiste Daroussin	case "$UNAME_PROCESSOR" in
8674c8945a0SNathan Whitehorn	    amd64)
868f4f33ea0SBaptiste Daroussin		UNAME_PROCESSOR=x86_64 ;;
869f4f33ea0SBaptiste Daroussin	    i386)
870f4f33ea0SBaptiste Daroussin		UNAME_PROCESSOR=i586 ;;
8714c8945a0SNathan Whitehorn	esac
872f4f33ea0SBaptiste Daroussin	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
8734c8945a0SNathan Whitehorn	exit ;;
8744c8945a0SNathan Whitehorn    i*:CYGWIN*:*)
875f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-cygwin
8764c8945a0SNathan Whitehorn	exit ;;
8772a3e3873SBaptiste Daroussin    *:MINGW64*:*)
878f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-mingw64
8792a3e3873SBaptiste Daroussin	exit ;;
8804c8945a0SNathan Whitehorn    *:MINGW*:*)
881f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-mingw32
8824c8945a0SNathan Whitehorn	exit ;;
883f4f33ea0SBaptiste Daroussin    *:MSYS*:*)
884f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-msys
8854c8945a0SNathan Whitehorn	exit ;;
8864c8945a0SNathan Whitehorn    i*:PW*:*)
887f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-pw32
8884c8945a0SNathan Whitehorn	exit ;;
8894c8945a0SNathan Whitehorn    *:Interix*:*)
890f4f33ea0SBaptiste Daroussin	case "$UNAME_MACHINE" in
8914c8945a0SNathan Whitehorn	    x86)
892f4f33ea0SBaptiste Daroussin		echo i586-pc-interix"$UNAME_RELEASE"
8934c8945a0SNathan Whitehorn		exit ;;
8944c8945a0SNathan Whitehorn	    authenticamd | genuineintel | EM64T)
895f4f33ea0SBaptiste Daroussin		echo x86_64-unknown-interix"$UNAME_RELEASE"
8964c8945a0SNathan Whitehorn		exit ;;
8974c8945a0SNathan Whitehorn	    IA64)
898f4f33ea0SBaptiste Daroussin		echo ia64-unknown-interix"$UNAME_RELEASE"
8994c8945a0SNathan Whitehorn		exit ;;
9004c8945a0SNathan Whitehorn	esac ;;
9014c8945a0SNathan Whitehorn    i*:UWIN*:*)
902f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-uwin
9034c8945a0SNathan Whitehorn	exit ;;
9044c8945a0SNathan Whitehorn    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
905*a96ef450SBaptiste Daroussin	echo x86_64-pc-cygwin
9064c8945a0SNathan Whitehorn	exit ;;
9074c8945a0SNathan Whitehorn    prep*:SunOS:5.*:*)
908f4f33ea0SBaptiste Daroussin	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
9094c8945a0SNathan Whitehorn	exit ;;
9104c8945a0SNathan Whitehorn    *:GNU:*:*)
9114c8945a0SNathan Whitehorn	# the GNU system
912f4f33ea0SBaptiste Daroussin	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
9134c8945a0SNathan Whitehorn	exit ;;
9144c8945a0SNathan Whitehorn    *:GNU/*:*:*)
9154c8945a0SNathan Whitehorn	# other systems with GNU libc and userland
916f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
9174c8945a0SNathan Whitehorn	exit ;;
918*a96ef450SBaptiste Daroussin    *:Minix:*:*)
919*a96ef450SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-minix
9204c8945a0SNathan Whitehorn	exit ;;
9212a3e3873SBaptiste Daroussin    aarch64:Linux:*:*)
922f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9232a3e3873SBaptiste Daroussin	exit ;;
9242a3e3873SBaptiste Daroussin    aarch64_be:Linux:*:*)
9252a3e3873SBaptiste Daroussin	UNAME_MACHINE=aarch64_be
926f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9272a3e3873SBaptiste Daroussin	exit ;;
9284c8945a0SNathan Whitehorn    alpha:Linux:*:*)
929*a96ef450SBaptiste Daroussin	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
9304c8945a0SNathan Whitehorn	  EV5)   UNAME_MACHINE=alphaev5 ;;
9314c8945a0SNathan Whitehorn	  EV56)  UNAME_MACHINE=alphaev56 ;;
9324c8945a0SNathan Whitehorn	  PCA56) UNAME_MACHINE=alphapca56 ;;
9334c8945a0SNathan Whitehorn	  PCA57) UNAME_MACHINE=alphapca56 ;;
9344c8945a0SNathan Whitehorn	  EV6)   UNAME_MACHINE=alphaev6 ;;
9354c8945a0SNathan Whitehorn	  EV67)  UNAME_MACHINE=alphaev67 ;;
9364c8945a0SNathan Whitehorn	  EV68*) UNAME_MACHINE=alphaev68 ;;
9374c8945a0SNathan Whitehorn	esac
9384c8945a0SNathan Whitehorn	objdump --private-headers /bin/sh | grep -q ld.so.1
939f4f33ea0SBaptiste Daroussin	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
940f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
941febdb468SDevin Teske	exit ;;
942febdb468SDevin Teske    arc:Linux:*:* | arceb:Linux:*:*)
943f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9444c8945a0SNathan Whitehorn	exit ;;
9454c8945a0SNathan Whitehorn    arm*:Linux:*:*)
946*a96ef450SBaptiste Daroussin	set_cc_for_build
9472a3e3873SBaptiste Daroussin	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9482a3e3873SBaptiste Daroussin	    | grep -q __ARM_EABI__
9494c8945a0SNathan Whitehorn	then
950f4f33ea0SBaptiste Daroussin	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9514c8945a0SNathan Whitehorn	else
9522a3e3873SBaptiste Daroussin	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
9532a3e3873SBaptiste Daroussin		| grep -q __ARM_PCS_VFP
9542a3e3873SBaptiste Daroussin	    then
955f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
9562a3e3873SBaptiste Daroussin	    else
957f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
9582a3e3873SBaptiste Daroussin	    fi
9594c8945a0SNathan Whitehorn	fi
9604c8945a0SNathan Whitehorn	exit ;;
9614c8945a0SNathan Whitehorn    avr32*:Linux:*:*)
962f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9634c8945a0SNathan Whitehorn	exit ;;
9644c8945a0SNathan Whitehorn    cris:Linux:*:*)
965f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
9664c8945a0SNathan Whitehorn	exit ;;
9674c8945a0SNathan Whitehorn    crisv32:Linux:*:*)
968f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
969f4f33ea0SBaptiste Daroussin	exit ;;
970f4f33ea0SBaptiste Daroussin    e2k:Linux:*:*)
971f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9724c8945a0SNathan Whitehorn	exit ;;
9734c8945a0SNathan Whitehorn    frv:Linux:*:*)
974f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9752a3e3873SBaptiste Daroussin	exit ;;
9762a3e3873SBaptiste Daroussin    hexagon:Linux:*:*)
977f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9784c8945a0SNathan Whitehorn	exit ;;
9794c8945a0SNathan Whitehorn    i*86:Linux:*:*)
980f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
9814c8945a0SNathan Whitehorn	exit ;;
9824c8945a0SNathan Whitehorn    ia64:Linux:*:*)
983f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
984f4f33ea0SBaptiste Daroussin	exit ;;
985f4f33ea0SBaptiste Daroussin    k1om:Linux:*:*)
986f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9874c8945a0SNathan Whitehorn	exit ;;
9884c8945a0SNathan Whitehorn    m32r*:Linux:*:*)
989f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9904c8945a0SNathan Whitehorn	exit ;;
9914c8945a0SNathan Whitehorn    m68*:Linux:*:*)
992f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9934c8945a0SNathan Whitehorn	exit ;;
9944c8945a0SNathan Whitehorn    mips:Linux:*:* | mips64:Linux:*:*)
995*a96ef450SBaptiste Daroussin	set_cc_for_build
996*a96ef450SBaptiste Daroussin	IS_GLIBC=0
997*a96ef450SBaptiste Daroussin	test x"${LIBC}" = xgnu && IS_GLIBC=1
998f4f33ea0SBaptiste Daroussin	sed 's/^	//' << EOF > "$dummy.c"
9994c8945a0SNathan Whitehorn	#undef CPU
1000*a96ef450SBaptiste Daroussin	#undef mips
1001*a96ef450SBaptiste Daroussin	#undef mipsel
1002*a96ef450SBaptiste Daroussin	#undef mips64
1003*a96ef450SBaptiste Daroussin	#undef mips64el
1004*a96ef450SBaptiste Daroussin	#if ${IS_GLIBC} && defined(_ABI64)
1005*a96ef450SBaptiste Daroussin	LIBCABI=gnuabi64
1006*a96ef450SBaptiste Daroussin	#else
1007*a96ef450SBaptiste Daroussin	#if ${IS_GLIBC} && defined(_ABIN32)
1008*a96ef450SBaptiste Daroussin	LIBCABI=gnuabin32
1009*a96ef450SBaptiste Daroussin	#else
1010*a96ef450SBaptiste Daroussin	LIBCABI=${LIBC}
1011*a96ef450SBaptiste Daroussin	#endif
1012*a96ef450SBaptiste Daroussin	#endif
1013*a96ef450SBaptiste Daroussin
1014*a96ef450SBaptiste Daroussin	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1015*a96ef450SBaptiste Daroussin	CPU=mipsisa64r6
1016*a96ef450SBaptiste Daroussin	#else
1017*a96ef450SBaptiste Daroussin	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1018*a96ef450SBaptiste Daroussin	CPU=mipsisa32r6
1019*a96ef450SBaptiste Daroussin	#else
1020*a96ef450SBaptiste Daroussin	#if defined(__mips64)
1021*a96ef450SBaptiste Daroussin	CPU=mips64
1022*a96ef450SBaptiste Daroussin	#else
1023*a96ef450SBaptiste Daroussin	CPU=mips
1024*a96ef450SBaptiste Daroussin	#endif
1025*a96ef450SBaptiste Daroussin	#endif
1026*a96ef450SBaptiste Daroussin	#endif
1027*a96ef450SBaptiste Daroussin
10284c8945a0SNathan Whitehorn	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1029*a96ef450SBaptiste Daroussin	MIPS_ENDIAN=el
10304c8945a0SNathan Whitehorn	#else
10314c8945a0SNathan Whitehorn	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1032*a96ef450SBaptiste Daroussin	MIPS_ENDIAN=
10334c8945a0SNathan Whitehorn	#else
1034*a96ef450SBaptiste Daroussin	MIPS_ENDIAN=
10354c8945a0SNathan Whitehorn	#endif
10364c8945a0SNathan Whitehorn	#endif
10374c8945a0SNathan WhitehornEOF
1038*a96ef450SBaptiste Daroussin	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
1039*a96ef450SBaptiste Daroussin	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10404c8945a0SNathan Whitehorn	;;
1041f4f33ea0SBaptiste Daroussin    mips64el:Linux:*:*)
1042f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1043febdb468SDevin Teske	exit ;;
1044f4f33ea0SBaptiste Daroussin    openrisc*:Linux:*:*)
1045f4f33ea0SBaptiste Daroussin	echo or1k-unknown-linux-"$LIBC"
1046f4f33ea0SBaptiste Daroussin	exit ;;
1047f4f33ea0SBaptiste Daroussin    or32:Linux:*:* | or1k*:Linux:*:*)
1048f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10494c8945a0SNathan Whitehorn	exit ;;
10504c8945a0SNathan Whitehorn    padre:Linux:*:*)
1051f4f33ea0SBaptiste Daroussin	echo sparc-unknown-linux-"$LIBC"
10524c8945a0SNathan Whitehorn	exit ;;
10534c8945a0SNathan Whitehorn    parisc64:Linux:*:* | hppa64:Linux:*:*)
1054f4f33ea0SBaptiste Daroussin	echo hppa64-unknown-linux-"$LIBC"
10554c8945a0SNathan Whitehorn	exit ;;
10564c8945a0SNathan Whitehorn    parisc:Linux:*:* | hppa:Linux:*:*)
10574c8945a0SNathan Whitehorn	# Look for CPU level
10584c8945a0SNathan Whitehorn	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1059f4f33ea0SBaptiste Daroussin	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1060f4f33ea0SBaptiste Daroussin	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1061f4f33ea0SBaptiste Daroussin	  *)    echo hppa-unknown-linux-"$LIBC" ;;
10624c8945a0SNathan Whitehorn	esac
10634c8945a0SNathan Whitehorn	exit ;;
10644c8945a0SNathan Whitehorn    ppc64:Linux:*:*)
1065f4f33ea0SBaptiste Daroussin	echo powerpc64-unknown-linux-"$LIBC"
10664c8945a0SNathan Whitehorn	exit ;;
10674c8945a0SNathan Whitehorn    ppc:Linux:*:*)
1068f4f33ea0SBaptiste Daroussin	echo powerpc-unknown-linux-"$LIBC"
1069febdb468SDevin Teske	exit ;;
1070febdb468SDevin Teske    ppc64le:Linux:*:*)
1071f4f33ea0SBaptiste Daroussin	echo powerpc64le-unknown-linux-"$LIBC"
1072febdb468SDevin Teske	exit ;;
1073febdb468SDevin Teske    ppcle:Linux:*:*)
1074f4f33ea0SBaptiste Daroussin	echo powerpcle-unknown-linux-"$LIBC"
1075f4f33ea0SBaptiste Daroussin	exit ;;
1076f4f33ea0SBaptiste Daroussin    riscv32:Linux:*:* | riscv64:Linux:*:*)
1077f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10784c8945a0SNathan Whitehorn	exit ;;
10794c8945a0SNathan Whitehorn    s390:Linux:*:* | s390x:Linux:*:*)
1080f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
10814c8945a0SNathan Whitehorn	exit ;;
10824c8945a0SNathan Whitehorn    sh64*:Linux:*:*)
1083f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10844c8945a0SNathan Whitehorn	exit ;;
10854c8945a0SNathan Whitehorn    sh*:Linux:*:*)
1086f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10874c8945a0SNathan Whitehorn	exit ;;
10884c8945a0SNathan Whitehorn    sparc:Linux:*:* | sparc64:Linux:*:*)
1089f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10904c8945a0SNathan Whitehorn	exit ;;
10917a1c0d96SNathan Whitehorn    tile*:Linux:*:*)
1092f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10937a1c0d96SNathan Whitehorn	exit ;;
10944c8945a0SNathan Whitehorn    vax:Linux:*:*)
1095f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
10964c8945a0SNathan Whitehorn	exit ;;
10974c8945a0SNathan Whitehorn    x86_64:Linux:*:*)
1098*a96ef450SBaptiste Daroussin	set_cc_for_build
1099*a96ef450SBaptiste Daroussin	LIBCABI=$LIBC
1100*a96ef450SBaptiste Daroussin	if test "$CC_FOR_BUILD" != no_compiler_found; then
1101*a96ef450SBaptiste Daroussin	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1102*a96ef450SBaptiste Daroussin		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1103*a96ef450SBaptiste Daroussin		grep IS_X32 >/dev/null
1104*a96ef450SBaptiste Daroussin	    then
1105*a96ef450SBaptiste Daroussin		LIBCABI="$LIBC"x32
1106*a96ef450SBaptiste Daroussin	    fi
1107*a96ef450SBaptiste Daroussin	fi
1108*a96ef450SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
11094c8945a0SNathan Whitehorn	exit ;;
11104c8945a0SNathan Whitehorn    xtensa*:Linux:*:*)
1111f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
11124c8945a0SNathan Whitehorn	exit ;;
11134c8945a0SNathan Whitehorn    i*86:DYNIX/ptx:4*:*)
11144c8945a0SNathan Whitehorn	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11154c8945a0SNathan Whitehorn	# earlier versions are messed up and put the nodename in both
11164c8945a0SNathan Whitehorn	# sysname and nodename.
11174c8945a0SNathan Whitehorn	echo i386-sequent-sysv4
11184c8945a0SNathan Whitehorn	exit ;;
11194c8945a0SNathan Whitehorn    i*86:UNIX_SV:4.2MP:2.*)
11204c8945a0SNathan Whitehorn	# Unixware is an offshoot of SVR4, but it has its own version
11214c8945a0SNathan Whitehorn	# number series starting with 2...
11224c8945a0SNathan Whitehorn	# I am not positive that other SVR4 systems won't match this,
11234c8945a0SNathan Whitehorn	# I just have to hope.  -- rms.
11244c8945a0SNathan Whitehorn	# Use sysv4.2uw... so that sysv4* matches it.
1125f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
11264c8945a0SNathan Whitehorn	exit ;;
11274c8945a0SNathan Whitehorn    i*86:OS/2:*:*)
11284c8945a0SNathan Whitehorn	# If we were able to find `uname', then EMX Unix compatibility
11294c8945a0SNathan Whitehorn	# is probably installed.
1130f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-os2-emx
11314c8945a0SNathan Whitehorn	exit ;;
11324c8945a0SNathan Whitehorn    i*86:XTS-300:*:STOP)
1133f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-stop
11344c8945a0SNathan Whitehorn	exit ;;
11354c8945a0SNathan Whitehorn    i*86:atheos:*:*)
1136f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-atheos
11374c8945a0SNathan Whitehorn	exit ;;
11384c8945a0SNathan Whitehorn    i*86:syllable:*:*)
1139f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-syllable
11404c8945a0SNathan Whitehorn	exit ;;
11414c8945a0SNathan Whitehorn    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1142f4f33ea0SBaptiste Daroussin	echo i386-unknown-lynxos"$UNAME_RELEASE"
11434c8945a0SNathan Whitehorn	exit ;;
11444c8945a0SNathan Whitehorn    i*86:*DOS:*:*)
1145f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-msdosdjgpp
11464c8945a0SNathan Whitehorn	exit ;;
1147f4f33ea0SBaptiste Daroussin    i*86:*:4.*:*)
1148f4f33ea0SBaptiste Daroussin	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
11494c8945a0SNathan Whitehorn	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1150f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
11514c8945a0SNathan Whitehorn	else
1152f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
11534c8945a0SNathan Whitehorn	fi
11544c8945a0SNathan Whitehorn	exit ;;
11554c8945a0SNathan Whitehorn    i*86:*:5:[678]*)
11564c8945a0SNathan Whitehorn	# UnixWare 7.x, OpenUNIX and OpenServer 6.
11574c8945a0SNathan Whitehorn	case `/bin/uname -X | grep "^Machine"` in
11584c8945a0SNathan Whitehorn	    *486*)	     UNAME_MACHINE=i486 ;;
11594c8945a0SNathan Whitehorn	    *Pentium)	     UNAME_MACHINE=i586 ;;
11604c8945a0SNathan Whitehorn	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
11614c8945a0SNathan Whitehorn	esac
1162*a96ef450SBaptiste Daroussin	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
11634c8945a0SNathan Whitehorn	exit ;;
11644c8945a0SNathan Whitehorn    i*86:*:3.2:*)
11654c8945a0SNathan Whitehorn	if test -f /usr/options/cb.name; then
11664c8945a0SNathan Whitehorn		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1167f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
11684c8945a0SNathan Whitehorn	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11694c8945a0SNathan Whitehorn		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11704c8945a0SNathan Whitehorn		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11714c8945a0SNathan Whitehorn		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11724c8945a0SNathan Whitehorn			&& UNAME_MACHINE=i586
11734c8945a0SNathan Whitehorn		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11744c8945a0SNathan Whitehorn			&& UNAME_MACHINE=i686
11754c8945a0SNathan Whitehorn		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11764c8945a0SNathan Whitehorn			&& UNAME_MACHINE=i686
1177f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
11784c8945a0SNathan Whitehorn	else
1179f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-pc-sysv32
11804c8945a0SNathan Whitehorn	fi
11814c8945a0SNathan Whitehorn	exit ;;
11824c8945a0SNathan Whitehorn    pc:*:*:*)
11834c8945a0SNathan Whitehorn	# Left here for compatibility:
11844c8945a0SNathan Whitehorn	# uname -m prints for DJGPP always 'pc', but it prints nothing about
11854c8945a0SNathan Whitehorn	# the processor, so we play safe by assuming i586.
11864c8945a0SNathan Whitehorn	# Note: whatever this is, it MUST be the same as what config.sub
1187f4f33ea0SBaptiste Daroussin	# prints for the "djgpp" host, or else GDB configure will decide that
11884c8945a0SNathan Whitehorn	# this is a cross-build.
11894c8945a0SNathan Whitehorn	echo i586-pc-msdosdjgpp
11904c8945a0SNathan Whitehorn	exit ;;
11914c8945a0SNathan Whitehorn    Intel:Mach:3*:*)
11924c8945a0SNathan Whitehorn	echo i386-pc-mach3
11934c8945a0SNathan Whitehorn	exit ;;
11944c8945a0SNathan Whitehorn    paragon:*:*:*)
11954c8945a0SNathan Whitehorn	echo i860-intel-osf1
11964c8945a0SNathan Whitehorn	exit ;;
11974c8945a0SNathan Whitehorn    i860:*:4.*:*) # i860-SVR4
11984c8945a0SNathan Whitehorn	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1199f4f33ea0SBaptiste Daroussin	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
12004c8945a0SNathan Whitehorn	else # Add other i860-SVR4 vendors below as they are discovered.
1201f4f33ea0SBaptiste Daroussin	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
12024c8945a0SNathan Whitehorn	fi
12034c8945a0SNathan Whitehorn	exit ;;
12044c8945a0SNathan Whitehorn    mini*:CTIX:SYS*5:*)
12054c8945a0SNathan Whitehorn	# "miniframe"
12064c8945a0SNathan Whitehorn	echo m68010-convergent-sysv
12074c8945a0SNathan Whitehorn	exit ;;
12084c8945a0SNathan Whitehorn    mc68k:UNIX:SYSTEM5:3.51m)
12094c8945a0SNathan Whitehorn	echo m68k-convergent-sysv
12104c8945a0SNathan Whitehorn	exit ;;
12114c8945a0SNathan Whitehorn    M680?0:D-NIX:5.3:*)
12124c8945a0SNathan Whitehorn	echo m68k-diab-dnix
12134c8945a0SNathan Whitehorn	exit ;;
12144c8945a0SNathan Whitehorn    M68*:*:R3V[5678]*:*)
12154c8945a0SNathan Whitehorn	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12164c8945a0SNathan Whitehorn    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)
12174c8945a0SNathan Whitehorn	OS_REL=''
12184c8945a0SNathan Whitehorn	test -r /etc/.relid \
12194c8945a0SNathan Whitehorn	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12204c8945a0SNathan Whitehorn	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1221f4f33ea0SBaptiste Daroussin	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12224c8945a0SNathan Whitehorn	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1223f4f33ea0SBaptiste Daroussin	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12244c8945a0SNathan Whitehorn    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12254c8945a0SNathan Whitehorn	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12264c8945a0SNathan Whitehorn	  && { echo i486-ncr-sysv4; exit; } ;;
12274c8945a0SNathan Whitehorn    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
12284c8945a0SNathan Whitehorn	OS_REL='.3'
12294c8945a0SNathan Whitehorn	test -r /etc/.relid \
12304c8945a0SNathan Whitehorn	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12314c8945a0SNathan Whitehorn	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1232f4f33ea0SBaptiste Daroussin	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12334c8945a0SNathan Whitehorn	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1234f4f33ea0SBaptiste Daroussin	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
12354c8945a0SNathan Whitehorn	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1236f4f33ea0SBaptiste Daroussin	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12374c8945a0SNathan Whitehorn    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1238f4f33ea0SBaptiste Daroussin	echo m68k-unknown-lynxos"$UNAME_RELEASE"
12394c8945a0SNathan Whitehorn	exit ;;
12404c8945a0SNathan Whitehorn    mc68030:UNIX_System_V:4.*:*)
12414c8945a0SNathan Whitehorn	echo m68k-atari-sysv4
12424c8945a0SNathan Whitehorn	exit ;;
12434c8945a0SNathan Whitehorn    TSUNAMI:LynxOS:2.*:*)
1244f4f33ea0SBaptiste Daroussin	echo sparc-unknown-lynxos"$UNAME_RELEASE"
12454c8945a0SNathan Whitehorn	exit ;;
12464c8945a0SNathan Whitehorn    rs6000:LynxOS:2.*:*)
1247f4f33ea0SBaptiste Daroussin	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
12484c8945a0SNathan Whitehorn	exit ;;
12494c8945a0SNathan Whitehorn    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1250f4f33ea0SBaptiste Daroussin	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
12514c8945a0SNathan Whitehorn	exit ;;
12524c8945a0SNathan Whitehorn    SM[BE]S:UNIX_SV:*:*)
1253f4f33ea0SBaptiste Daroussin	echo mips-dde-sysv"$UNAME_RELEASE"
12544c8945a0SNathan Whitehorn	exit ;;
12554c8945a0SNathan Whitehorn    RM*:ReliantUNIX-*:*:*)
12564c8945a0SNathan Whitehorn	echo mips-sni-sysv4
12574c8945a0SNathan Whitehorn	exit ;;
12584c8945a0SNathan Whitehorn    RM*:SINIX-*:*:*)
12594c8945a0SNathan Whitehorn	echo mips-sni-sysv4
12604c8945a0SNathan Whitehorn	exit ;;
12614c8945a0SNathan Whitehorn    *:SINIX-*:*:*)
12624c8945a0SNathan Whitehorn	if uname -p 2>/dev/null >/dev/null ; then
12634c8945a0SNathan Whitehorn		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1264f4f33ea0SBaptiste Daroussin		echo "$UNAME_MACHINE"-sni-sysv4
12654c8945a0SNathan Whitehorn	else
12664c8945a0SNathan Whitehorn		echo ns32k-sni-sysv
12674c8945a0SNathan Whitehorn	fi
12684c8945a0SNathan Whitehorn	exit ;;
12694c8945a0SNathan Whitehorn    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
12704c8945a0SNathan Whitehorn			# says <Richard.M.Bartel@ccMail.Census.GOV>
12714c8945a0SNathan Whitehorn	echo i586-unisys-sysv4
12724c8945a0SNathan Whitehorn	exit ;;
12734c8945a0SNathan Whitehorn    *:UNIX_System_V:4*:FTX*)
12744c8945a0SNathan Whitehorn	# From Gerald Hewes <hewes@openmarket.com>.
12754c8945a0SNathan Whitehorn	# How about differentiating between stratus architectures? -djm
12764c8945a0SNathan Whitehorn	echo hppa1.1-stratus-sysv4
12774c8945a0SNathan Whitehorn	exit ;;
12784c8945a0SNathan Whitehorn    *:*:*:FTX*)
12794c8945a0SNathan Whitehorn	# From seanf@swdc.stratus.com.
12804c8945a0SNathan Whitehorn	echo i860-stratus-sysv4
12814c8945a0SNathan Whitehorn	exit ;;
12824c8945a0SNathan Whitehorn    i*86:VOS:*:*)
12834c8945a0SNathan Whitehorn	# From Paul.Green@stratus.com.
1284f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-stratus-vos
12854c8945a0SNathan Whitehorn	exit ;;
12864c8945a0SNathan Whitehorn    *:VOS:*:*)
12874c8945a0SNathan Whitehorn	# From Paul.Green@stratus.com.
12884c8945a0SNathan Whitehorn	echo hppa1.1-stratus-vos
12894c8945a0SNathan Whitehorn	exit ;;
12904c8945a0SNathan Whitehorn    mc68*:A/UX:*:*)
1291f4f33ea0SBaptiste Daroussin	echo m68k-apple-aux"$UNAME_RELEASE"
12924c8945a0SNathan Whitehorn	exit ;;
12934c8945a0SNathan Whitehorn    news*:NEWS-OS:6*:*)
12944c8945a0SNathan Whitehorn	echo mips-sony-newsos6
12954c8945a0SNathan Whitehorn	exit ;;
12964c8945a0SNathan Whitehorn    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1297*a96ef450SBaptiste Daroussin	if test -d /usr/nec; then
1298f4f33ea0SBaptiste Daroussin		echo mips-nec-sysv"$UNAME_RELEASE"
12994c8945a0SNathan Whitehorn	else
1300f4f33ea0SBaptiste Daroussin		echo mips-unknown-sysv"$UNAME_RELEASE"
13014c8945a0SNathan Whitehorn	fi
13024c8945a0SNathan Whitehorn	exit ;;
13034c8945a0SNathan Whitehorn    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13044c8945a0SNathan Whitehorn	echo powerpc-be-beos
13054c8945a0SNathan Whitehorn	exit ;;
13064c8945a0SNathan Whitehorn    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13074c8945a0SNathan Whitehorn	echo powerpc-apple-beos
13084c8945a0SNathan Whitehorn	exit ;;
13094c8945a0SNathan Whitehorn    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13104c8945a0SNathan Whitehorn	echo i586-pc-beos
13114c8945a0SNathan Whitehorn	exit ;;
13124c8945a0SNathan Whitehorn    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
13134c8945a0SNathan Whitehorn	echo i586-pc-haiku
13144c8945a0SNathan Whitehorn	exit ;;
13152a3e3873SBaptiste Daroussin    x86_64:Haiku:*:*)
13162a3e3873SBaptiste Daroussin	echo x86_64-unknown-haiku
13172a3e3873SBaptiste Daroussin	exit ;;
13184c8945a0SNathan Whitehorn    SX-4:SUPER-UX:*:*)
1319f4f33ea0SBaptiste Daroussin	echo sx4-nec-superux"$UNAME_RELEASE"
13204c8945a0SNathan Whitehorn	exit ;;
13214c8945a0SNathan Whitehorn    SX-5:SUPER-UX:*:*)
1322f4f33ea0SBaptiste Daroussin	echo sx5-nec-superux"$UNAME_RELEASE"
13234c8945a0SNathan Whitehorn	exit ;;
13244c8945a0SNathan Whitehorn    SX-6:SUPER-UX:*:*)
1325f4f33ea0SBaptiste Daroussin	echo sx6-nec-superux"$UNAME_RELEASE"
13264c8945a0SNathan Whitehorn	exit ;;
13274c8945a0SNathan Whitehorn    SX-7:SUPER-UX:*:*)
1328f4f33ea0SBaptiste Daroussin	echo sx7-nec-superux"$UNAME_RELEASE"
13294c8945a0SNathan Whitehorn	exit ;;
13304c8945a0SNathan Whitehorn    SX-8:SUPER-UX:*:*)
1331f4f33ea0SBaptiste Daroussin	echo sx8-nec-superux"$UNAME_RELEASE"
13324c8945a0SNathan Whitehorn	exit ;;
13334c8945a0SNathan Whitehorn    SX-8R:SUPER-UX:*:*)
1334f4f33ea0SBaptiste Daroussin	echo sx8r-nec-superux"$UNAME_RELEASE"
1335f4f33ea0SBaptiste Daroussin	exit ;;
1336f4f33ea0SBaptiste Daroussin    SX-ACE:SUPER-UX:*:*)
1337f4f33ea0SBaptiste Daroussin	echo sxace-nec-superux"$UNAME_RELEASE"
13384c8945a0SNathan Whitehorn	exit ;;
13394c8945a0SNathan Whitehorn    Power*:Rhapsody:*:*)
1340f4f33ea0SBaptiste Daroussin	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
13414c8945a0SNathan Whitehorn	exit ;;
13424c8945a0SNathan Whitehorn    *:Rhapsody:*:*)
1343f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
13444c8945a0SNathan Whitehorn	exit ;;
1345*a96ef450SBaptiste Daroussin    arm64:Darwin:*:*)
1346*a96ef450SBaptiste Daroussin	echo aarch64-apple-darwin"$UNAME_RELEASE"
1347*a96ef450SBaptiste Daroussin	exit ;;
13484c8945a0SNathan Whitehorn    *:Darwin:*:*)
1349*a96ef450SBaptiste Daroussin	UNAME_PROCESSOR=`uname -p`
1350*a96ef450SBaptiste Daroussin	case $UNAME_PROCESSOR in
1351*a96ef450SBaptiste Daroussin	    unknown) UNAME_PROCESSOR=powerpc ;;
1352*a96ef450SBaptiste Daroussin	esac
1353*a96ef450SBaptiste Daroussin	if command -v xcode-select > /dev/null 2> /dev/null && \
1354*a96ef450SBaptiste Daroussin		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1355*a96ef450SBaptiste Daroussin	    # Avoid executing cc if there is no toolchain installed as
1356*a96ef450SBaptiste Daroussin	    # cc will be a stub that puts up a graphical alert
1357*a96ef450SBaptiste Daroussin	    # prompting the user to install developer tools.
1358*a96ef450SBaptiste Daroussin	    CC_FOR_BUILD=no_compiler_found
1359*a96ef450SBaptiste Daroussin	else
1360*a96ef450SBaptiste Daroussin	    set_cc_for_build
1361febdb468SDevin Teske	fi
1362*a96ef450SBaptiste Daroussin	if test "$CC_FOR_BUILD" != no_compiler_found; then
13634c8945a0SNathan Whitehorn	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1364f4f33ea0SBaptiste Daroussin		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
13654c8945a0SNathan Whitehorn		   grep IS_64BIT_ARCH >/dev/null
13664c8945a0SNathan Whitehorn	    then
1367febdb468SDevin Teske		case $UNAME_PROCESSOR in
1368febdb468SDevin Teske		    i386) UNAME_PROCESSOR=x86_64 ;;
1369febdb468SDevin Teske		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
13704c8945a0SNathan Whitehorn		esac
1371febdb468SDevin Teske	    fi
1372f4f33ea0SBaptiste Daroussin	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1373f4f33ea0SBaptiste Daroussin	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1374f4f33ea0SBaptiste Daroussin		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1375f4f33ea0SBaptiste Daroussin		   grep IS_PPC >/dev/null
1376f4f33ea0SBaptiste Daroussin	    then
1377f4f33ea0SBaptiste Daroussin		UNAME_PROCESSOR=powerpc
1378febdb468SDevin Teske	    fi
1379f4f33ea0SBaptiste Daroussin	elif test "$UNAME_PROCESSOR" = i386 ; then
1380*a96ef450SBaptiste Daroussin	    # uname -m returns i386 or x86_64
1381*a96ef450SBaptiste Daroussin	    UNAME_PROCESSOR=$UNAME_MACHINE
1382f4f33ea0SBaptiste Daroussin	fi
1383f4f33ea0SBaptiste Daroussin	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
13844c8945a0SNathan Whitehorn	exit ;;
13854c8945a0SNathan Whitehorn    *:procnto*:*:* | *:QNX:[0123456789]*:*)
13864c8945a0SNathan Whitehorn	UNAME_PROCESSOR=`uname -p`
1387f4f33ea0SBaptiste Daroussin	if test "$UNAME_PROCESSOR" = x86; then
13884c8945a0SNathan Whitehorn		UNAME_PROCESSOR=i386
13894c8945a0SNathan Whitehorn		UNAME_MACHINE=pc
13904c8945a0SNathan Whitehorn	fi
1391f4f33ea0SBaptiste Daroussin	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
13924c8945a0SNathan Whitehorn	exit ;;
13934c8945a0SNathan Whitehorn    *:QNX:*:4*)
13944c8945a0SNathan Whitehorn	echo i386-pc-qnx
13954c8945a0SNathan Whitehorn	exit ;;
1396f4f33ea0SBaptiste Daroussin    NEO-*:NONSTOP_KERNEL:*:*)
1397f4f33ea0SBaptiste Daroussin	echo neo-tandem-nsk"$UNAME_RELEASE"
13987a1c0d96SNathan Whitehorn	exit ;;
13992a3e3873SBaptiste Daroussin    NSE-*:NONSTOP_KERNEL:*:*)
1400f4f33ea0SBaptiste Daroussin	echo nse-tandem-nsk"$UNAME_RELEASE"
14014c8945a0SNathan Whitehorn	exit ;;
1402f4f33ea0SBaptiste Daroussin    NSR-*:NONSTOP_KERNEL:*:*)
1403f4f33ea0SBaptiste Daroussin	echo nsr-tandem-nsk"$UNAME_RELEASE"
1404f4f33ea0SBaptiste Daroussin	exit ;;
1405f4f33ea0SBaptiste Daroussin    NSV-*:NONSTOP_KERNEL:*:*)
1406f4f33ea0SBaptiste Daroussin	echo nsv-tandem-nsk"$UNAME_RELEASE"
1407f4f33ea0SBaptiste Daroussin	exit ;;
1408f4f33ea0SBaptiste Daroussin    NSX-*:NONSTOP_KERNEL:*:*)
1409f4f33ea0SBaptiste Daroussin	echo nsx-tandem-nsk"$UNAME_RELEASE"
14104c8945a0SNathan Whitehorn	exit ;;
14114c8945a0SNathan Whitehorn    *:NonStop-UX:*:*)
14124c8945a0SNathan Whitehorn	echo mips-compaq-nonstopux
14134c8945a0SNathan Whitehorn	exit ;;
14144c8945a0SNathan Whitehorn    BS2000:POSIX*:*:*)
14154c8945a0SNathan Whitehorn	echo bs2000-siemens-sysv
14164c8945a0SNathan Whitehorn	exit ;;
14174c8945a0SNathan Whitehorn    DS/*:UNIX_System_V:*:*)
1418f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
14194c8945a0SNathan Whitehorn	exit ;;
14204c8945a0SNathan Whitehorn    *:Plan9:*:*)
14214c8945a0SNathan Whitehorn	# "uname -m" is not consistent, so use $cputype instead. 386
14224c8945a0SNathan Whitehorn	# is converted to i386 for consistency with other x86
14234c8945a0SNathan Whitehorn	# operating systems.
1424*a96ef450SBaptiste Daroussin	# shellcheck disable=SC2154
1425f4f33ea0SBaptiste Daroussin	if test "$cputype" = 386; then
14264c8945a0SNathan Whitehorn	    UNAME_MACHINE=i386
14274c8945a0SNathan Whitehorn	else
14284c8945a0SNathan Whitehorn	    UNAME_MACHINE="$cputype"
14294c8945a0SNathan Whitehorn	fi
1430f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-plan9
14314c8945a0SNathan Whitehorn	exit ;;
14324c8945a0SNathan Whitehorn    *:TOPS-10:*:*)
14334c8945a0SNathan Whitehorn	echo pdp10-unknown-tops10
14344c8945a0SNathan Whitehorn	exit ;;
14354c8945a0SNathan Whitehorn    *:TENEX:*:*)
14364c8945a0SNathan Whitehorn	echo pdp10-unknown-tenex
14374c8945a0SNathan Whitehorn	exit ;;
14384c8945a0SNathan Whitehorn    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14394c8945a0SNathan Whitehorn	echo pdp10-dec-tops20
14404c8945a0SNathan Whitehorn	exit ;;
14414c8945a0SNathan Whitehorn    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14424c8945a0SNathan Whitehorn	echo pdp10-xkl-tops20
14434c8945a0SNathan Whitehorn	exit ;;
14444c8945a0SNathan Whitehorn    *:TOPS-20:*:*)
14454c8945a0SNathan Whitehorn	echo pdp10-unknown-tops20
14464c8945a0SNathan Whitehorn	exit ;;
14474c8945a0SNathan Whitehorn    *:ITS:*:*)
14484c8945a0SNathan Whitehorn	echo pdp10-unknown-its
14494c8945a0SNathan Whitehorn	exit ;;
14504c8945a0SNathan Whitehorn    SEI:*:*:SEIUX)
1451f4f33ea0SBaptiste Daroussin	echo mips-sei-seiux"$UNAME_RELEASE"
14524c8945a0SNathan Whitehorn	exit ;;
14534c8945a0SNathan Whitehorn    *:DragonFly:*:*)
1454f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
14554c8945a0SNathan Whitehorn	exit ;;
14564c8945a0SNathan Whitehorn    *:*VMS:*:*)
14574c8945a0SNathan Whitehorn	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1458f4f33ea0SBaptiste Daroussin	case "$UNAME_MACHINE" in
14594c8945a0SNathan Whitehorn	    A*) echo alpha-dec-vms ; exit ;;
14604c8945a0SNathan Whitehorn	    I*) echo ia64-dec-vms ; exit ;;
14614c8945a0SNathan Whitehorn	    V*) echo vax-dec-vms ; exit ;;
14624c8945a0SNathan Whitehorn	esac ;;
14634c8945a0SNathan Whitehorn    *:XENIX:*:SysV)
14644c8945a0SNathan Whitehorn	echo i386-pc-xenix
14654c8945a0SNathan Whitehorn	exit ;;
14664c8945a0SNathan Whitehorn    i*86:skyos:*:*)
1467f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
14684c8945a0SNathan Whitehorn	exit ;;
14694c8945a0SNathan Whitehorn    i*86:rdos:*:*)
1470f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-rdos
14714c8945a0SNathan Whitehorn	exit ;;
14724c8945a0SNathan Whitehorn    i*86:AROS:*:*)
1473f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-pc-aros
14744c8945a0SNathan Whitehorn	exit ;;
14752a3e3873SBaptiste Daroussin    x86_64:VMkernel:*:*)
1476f4f33ea0SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-esx
1477f4f33ea0SBaptiste Daroussin	exit ;;
1478f4f33ea0SBaptiste Daroussin    amd64:Isilon\ OneFS:*:*)
1479f4f33ea0SBaptiste Daroussin	echo x86_64-unknown-onefs
14802a3e3873SBaptiste Daroussin	exit ;;
1481*a96ef450SBaptiste Daroussin    *:Unleashed:*:*)
1482*a96ef450SBaptiste Daroussin	echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
1483*a96ef450SBaptiste Daroussin	exit ;;
14844c8945a0SNathan Whitehornesac
14854c8945a0SNathan Whitehorn
1486*a96ef450SBaptiste Daroussin# No uname command or uname output not recognized.
1487*a96ef450SBaptiste Daroussinset_cc_for_build
1488*a96ef450SBaptiste Daroussincat > "$dummy.c" <<EOF
1489*a96ef450SBaptiste Daroussin#ifdef _SEQUENT_
1490*a96ef450SBaptiste Daroussin#include <sys/types.h>
1491*a96ef450SBaptiste Daroussin#include <sys/utsname.h>
1492*a96ef450SBaptiste Daroussin#endif
1493*a96ef450SBaptiste Daroussin#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1494*a96ef450SBaptiste Daroussin#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1495*a96ef450SBaptiste Daroussin#include <signal.h>
1496*a96ef450SBaptiste Daroussin#if defined(_SIZE_T_) || defined(SIGLOST)
1497*a96ef450SBaptiste Daroussin#include <sys/utsname.h>
1498*a96ef450SBaptiste Daroussin#endif
1499*a96ef450SBaptiste Daroussin#endif
1500*a96ef450SBaptiste Daroussin#endif
1501*a96ef450SBaptiste Daroussinmain ()
1502*a96ef450SBaptiste Daroussin{
1503*a96ef450SBaptiste Daroussin#if defined (sony)
1504*a96ef450SBaptiste Daroussin#if defined (MIPSEB)
1505*a96ef450SBaptiste Daroussin  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1506*a96ef450SBaptiste Daroussin     I don't know....  */
1507*a96ef450SBaptiste Daroussin  printf ("mips-sony-bsd\n"); exit (0);
1508*a96ef450SBaptiste Daroussin#else
1509*a96ef450SBaptiste Daroussin#include <sys/param.h>
1510*a96ef450SBaptiste Daroussin  printf ("m68k-sony-newsos%s\n",
1511*a96ef450SBaptiste Daroussin#ifdef NEWSOS4
1512*a96ef450SBaptiste Daroussin  "4"
1513*a96ef450SBaptiste Daroussin#else
1514*a96ef450SBaptiste Daroussin  ""
1515*a96ef450SBaptiste Daroussin#endif
1516*a96ef450SBaptiste Daroussin  ); exit (0);
1517*a96ef450SBaptiste Daroussin#endif
1518*a96ef450SBaptiste Daroussin#endif
1519*a96ef450SBaptiste Daroussin
1520*a96ef450SBaptiste Daroussin#if defined (NeXT)
1521*a96ef450SBaptiste Daroussin#if !defined (__ARCHITECTURE__)
1522*a96ef450SBaptiste Daroussin#define __ARCHITECTURE__ "m68k"
1523*a96ef450SBaptiste Daroussin#endif
1524*a96ef450SBaptiste Daroussin  int version;
1525*a96ef450SBaptiste Daroussin  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1526*a96ef450SBaptiste Daroussin  if (version < 4)
1527*a96ef450SBaptiste Daroussin    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1528*a96ef450SBaptiste Daroussin  else
1529*a96ef450SBaptiste Daroussin    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1530*a96ef450SBaptiste Daroussin  exit (0);
1531*a96ef450SBaptiste Daroussin#endif
1532*a96ef450SBaptiste Daroussin
1533*a96ef450SBaptiste Daroussin#if defined (MULTIMAX) || defined (n16)
1534*a96ef450SBaptiste Daroussin#if defined (UMAXV)
1535*a96ef450SBaptiste Daroussin  printf ("ns32k-encore-sysv\n"); exit (0);
1536*a96ef450SBaptiste Daroussin#else
1537*a96ef450SBaptiste Daroussin#if defined (CMU)
1538*a96ef450SBaptiste Daroussin  printf ("ns32k-encore-mach\n"); exit (0);
1539*a96ef450SBaptiste Daroussin#else
1540*a96ef450SBaptiste Daroussin  printf ("ns32k-encore-bsd\n"); exit (0);
1541*a96ef450SBaptiste Daroussin#endif
1542*a96ef450SBaptiste Daroussin#endif
1543*a96ef450SBaptiste Daroussin#endif
1544*a96ef450SBaptiste Daroussin
1545*a96ef450SBaptiste Daroussin#if defined (__386BSD__)
1546*a96ef450SBaptiste Daroussin  printf ("i386-pc-bsd\n"); exit (0);
1547*a96ef450SBaptiste Daroussin#endif
1548*a96ef450SBaptiste Daroussin
1549*a96ef450SBaptiste Daroussin#if defined (sequent)
1550*a96ef450SBaptiste Daroussin#if defined (i386)
1551*a96ef450SBaptiste Daroussin  printf ("i386-sequent-dynix\n"); exit (0);
1552*a96ef450SBaptiste Daroussin#endif
1553*a96ef450SBaptiste Daroussin#if defined (ns32000)
1554*a96ef450SBaptiste Daroussin  printf ("ns32k-sequent-dynix\n"); exit (0);
1555*a96ef450SBaptiste Daroussin#endif
1556*a96ef450SBaptiste Daroussin#endif
1557*a96ef450SBaptiste Daroussin
1558*a96ef450SBaptiste Daroussin#if defined (_SEQUENT_)
1559*a96ef450SBaptiste Daroussin  struct utsname un;
1560*a96ef450SBaptiste Daroussin
1561*a96ef450SBaptiste Daroussin  uname(&un);
1562*a96ef450SBaptiste Daroussin  if (strncmp(un.version, "V2", 2) == 0) {
1563*a96ef450SBaptiste Daroussin    printf ("i386-sequent-ptx2\n"); exit (0);
1564*a96ef450SBaptiste Daroussin  }
1565*a96ef450SBaptiste Daroussin  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1566*a96ef450SBaptiste Daroussin    printf ("i386-sequent-ptx1\n"); exit (0);
1567*a96ef450SBaptiste Daroussin  }
1568*a96ef450SBaptiste Daroussin  printf ("i386-sequent-ptx\n"); exit (0);
1569*a96ef450SBaptiste Daroussin#endif
1570*a96ef450SBaptiste Daroussin
1571*a96ef450SBaptiste Daroussin#if defined (vax)
1572*a96ef450SBaptiste Daroussin#if !defined (ultrix)
1573*a96ef450SBaptiste Daroussin#include <sys/param.h>
1574*a96ef450SBaptiste Daroussin#if defined (BSD)
1575*a96ef450SBaptiste Daroussin#if BSD == 43
1576*a96ef450SBaptiste Daroussin  printf ("vax-dec-bsd4.3\n"); exit (0);
1577*a96ef450SBaptiste Daroussin#else
1578*a96ef450SBaptiste Daroussin#if BSD == 199006
1579*a96ef450SBaptiste Daroussin  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1580*a96ef450SBaptiste Daroussin#else
1581*a96ef450SBaptiste Daroussin  printf ("vax-dec-bsd\n"); exit (0);
1582*a96ef450SBaptiste Daroussin#endif
1583*a96ef450SBaptiste Daroussin#endif
1584*a96ef450SBaptiste Daroussin#else
1585*a96ef450SBaptiste Daroussin  printf ("vax-dec-bsd\n"); exit (0);
1586*a96ef450SBaptiste Daroussin#endif
1587*a96ef450SBaptiste Daroussin#else
1588*a96ef450SBaptiste Daroussin#if defined(_SIZE_T_) || defined(SIGLOST)
1589*a96ef450SBaptiste Daroussin  struct utsname un;
1590*a96ef450SBaptiste Daroussin  uname (&un);
1591*a96ef450SBaptiste Daroussin  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1592*a96ef450SBaptiste Daroussin#else
1593*a96ef450SBaptiste Daroussin  printf ("vax-dec-ultrix\n"); exit (0);
1594*a96ef450SBaptiste Daroussin#endif
1595*a96ef450SBaptiste Daroussin#endif
1596*a96ef450SBaptiste Daroussin#endif
1597*a96ef450SBaptiste Daroussin#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1598*a96ef450SBaptiste Daroussin#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1599*a96ef450SBaptiste Daroussin#if defined(_SIZE_T_) || defined(SIGLOST)
1600*a96ef450SBaptiste Daroussin  struct utsname *un;
1601*a96ef450SBaptiste Daroussin  uname (&un);
1602*a96ef450SBaptiste Daroussin  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1603*a96ef450SBaptiste Daroussin#else
1604*a96ef450SBaptiste Daroussin  printf ("mips-dec-ultrix\n"); exit (0);
1605*a96ef450SBaptiste Daroussin#endif
1606*a96ef450SBaptiste Daroussin#endif
1607*a96ef450SBaptiste Daroussin#endif
1608*a96ef450SBaptiste Daroussin
1609*a96ef450SBaptiste Daroussin#if defined (alliant) && defined (i860)
1610*a96ef450SBaptiste Daroussin  printf ("i860-alliant-bsd\n"); exit (0);
1611*a96ef450SBaptiste Daroussin#endif
1612*a96ef450SBaptiste Daroussin
1613*a96ef450SBaptiste Daroussin  exit (1);
1614*a96ef450SBaptiste Daroussin}
1615*a96ef450SBaptiste DaroussinEOF
1616*a96ef450SBaptiste Daroussin
1617*a96ef450SBaptiste Daroussin$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1618*a96ef450SBaptiste Daroussin	{ echo "$SYSTEM_NAME"; exit; }
1619*a96ef450SBaptiste Daroussin
1620*a96ef450SBaptiste Daroussin# Apollos put the system type in the environment.
1621*a96ef450SBaptiste Daroussintest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1622*a96ef450SBaptiste Daroussin
1623f4f33ea0SBaptiste Daroussinecho "$0: unable to guess system type" >&2
16244c8945a0SNathan Whitehorn
1625f4f33ea0SBaptiste Daroussincase "$UNAME_MACHINE:$UNAME_SYSTEM" in
1626f4f33ea0SBaptiste Daroussin    mips:Linux | mips64:Linux)
1627f4f33ea0SBaptiste Daroussin	# If we got here on MIPS GNU/Linux, output extra information.
1628f4f33ea0SBaptiste Daroussin	cat >&2 <<EOF
16294c8945a0SNathan Whitehorn
1630f4f33ea0SBaptiste DaroussinNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1631f4f33ea0SBaptiste Daroussinthe system type. Please install a C compiler and try again.
16324c8945a0SNathan WhitehornEOF
1633f4f33ea0SBaptiste Daroussin	;;
16344c8945a0SNathan Whitehornesac
16354c8945a0SNathan Whitehorn
16364c8945a0SNathan Whitehorncat >&2 <<EOF
16374c8945a0SNathan Whitehorn
1638f4f33ea0SBaptiste DaroussinThis script (version $timestamp), has failed to recognize the
1639f4f33ea0SBaptiste Daroussinoperating system you are using. If your script is old, overwrite *all*
1640f4f33ea0SBaptiste Daroussincopies of config.guess and config.sub with the latest versions from:
16414c8945a0SNathan Whitehorn
1642f4f33ea0SBaptiste Daroussin  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
16434c8945a0SNathan Whitehornand
1644f4f33ea0SBaptiste Daroussin  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1645*a96ef450SBaptiste DaroussinEOF
1646*a96ef450SBaptiste Daroussin
1647*a96ef450SBaptiste Daroussinyear=`echo $timestamp | sed 's,-.*,,'`
1648*a96ef450SBaptiste Daroussin# shellcheck disable=SC2003
1649*a96ef450SBaptiste Daroussinif test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
1650*a96ef450SBaptiste Daroussin   cat >&2 <<EOF
16514c8945a0SNathan Whitehorn
1652f4f33ea0SBaptiste DaroussinIf $0 has already been updated, send the following data and any
1653f4f33ea0SBaptiste Daroussininformation you think might be pertinent to config-patches@gnu.org to
1654f4f33ea0SBaptiste Daroussinprovide the necessary information to handle your system.
16554c8945a0SNathan Whitehorn
16564c8945a0SNathan Whitehornconfig.guess timestamp = $timestamp
16574c8945a0SNathan Whitehorn
16584c8945a0SNathan Whitehornuname -m = `(uname -m) 2>/dev/null || echo unknown`
16594c8945a0SNathan Whitehornuname -r = `(uname -r) 2>/dev/null || echo unknown`
16604c8945a0SNathan Whitehornuname -s = `(uname -s) 2>/dev/null || echo unknown`
16614c8945a0SNathan Whitehornuname -v = `(uname -v) 2>/dev/null || echo unknown`
16624c8945a0SNathan Whitehorn
16634c8945a0SNathan Whitehorn/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
16644c8945a0SNathan Whitehorn/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
16654c8945a0SNathan Whitehorn
16664c8945a0SNathan Whitehornhostinfo               = `(hostinfo) 2>/dev/null`
16674c8945a0SNathan Whitehorn/bin/universe          = `(/bin/universe) 2>/dev/null`
16684c8945a0SNathan Whitehorn/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
16694c8945a0SNathan Whitehorn/bin/arch              = `(/bin/arch) 2>/dev/null`
16704c8945a0SNathan Whitehorn/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
16714c8945a0SNathan Whitehorn/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
16724c8945a0SNathan Whitehorn
1673f4f33ea0SBaptiste DaroussinUNAME_MACHINE = "$UNAME_MACHINE"
1674f4f33ea0SBaptiste DaroussinUNAME_RELEASE = "$UNAME_RELEASE"
1675f4f33ea0SBaptiste DaroussinUNAME_SYSTEM  = "$UNAME_SYSTEM"
1676f4f33ea0SBaptiste DaroussinUNAME_VERSION = "$UNAME_VERSION"
16774c8945a0SNathan WhitehornEOF
1678*a96ef450SBaptiste Daroussinfi
16794c8945a0SNathan Whitehorn
16804c8945a0SNathan Whitehornexit 1
16814c8945a0SNathan Whitehorn
16824c8945a0SNathan Whitehorn# Local variables:
1683f4f33ea0SBaptiste Daroussin# eval: (add-hook 'before-save-hook 'time-stamp)
16844c8945a0SNathan Whitehorn# time-stamp-start: "timestamp='"
16854c8945a0SNathan Whitehorn# time-stamp-format: "%:y-%02m-%02d"
16864c8945a0SNathan Whitehorn# time-stamp-end: "'"
16874c8945a0SNathan Whitehorn# End:
1688