blob: 11fda528bc7b15f6a8a963a20c06cd9a6dbe5d6b [file] [log] [blame]
Damien Millerb405d612000-06-12 23:01:02 +10001#! /bin/sh
2# Attempt to guess a canonical system name.
Damien Millerdc2da292020-05-08 13:31:53 +10003# Copyright 1992-2020 Free Software Foundation, Inc.
Damien Millerb405d612000-06-12 23:01:02 +10004
Damien Millerdc2da292020-05-08 13:31:53 +10005timestamp='2020-04-26'
Damien Millerb405d612000-06-12 23:01:02 +10006
7# This file is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by
Damien Miller23902e32016-08-02 10:48:04 +10009# the Free Software Foundation; either version 3 of the License, or
Damien Millerb405d612000-06-12 23:01:02 +100010# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
Damien Millerdc2da292020-05-08 13:31:53 +100018# along with this program; if not, see <https://www.gnu.org/licenses/>.
Damien Millerb405d612000-06-12 23:01:02 +100019#
20# As a special exception to the GNU General Public License, if you
21# distribute this file as part of a program that contains a
22# configuration script generated by Autoconf, you may include it under
Damien Miller23902e32016-08-02 10:48:04 +100023# the same distribution terms that you use for the rest of that
24# program. This Exception is an additional permission under section 7
25# of the GNU General Public License, version 3 ("GPLv3").
Damien Millerb405d612000-06-12 23:01:02 +100026#
Damien Miller23902e32016-08-02 10:48:04 +100027# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
Damien Millerb405d612000-06-12 23:01:02 +100028#
Tim Ricec5b0cb32010-03-01 15:57:42 -080029# You can get the latest version of this script from:
Damien Millerdc2da292020-05-08 13:31:53 +100030# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
Damien Miller23902e32016-08-02 10:48:04 +100031#
32# Please send patches to <config-patches@gnu.org>.
33
Damien Millerb405d612000-06-12 23:01:02 +100034
35me=`echo "$0" | sed -e 's,.*/,,'`
36
37usage="\
38Usage: $0 [OPTION]
39
Damien Miller5bf5f2c2001-05-06 10:54:15 +100040Output the configuration name of the system \`$me' is run on.
Damien Millerb405d612000-06-12 23:01:02 +100041
Damien Millerdc2da292020-05-08 13:31:53 +100042Options:
Damien Miller5bf5f2c2001-05-06 10:54:15 +100043 -h, --help print this help, then exit
44 -t, --time-stamp print date of last modification, then exit
45 -v, --version print version number, then exit
46
47Report bugs and patches to <config-patches@gnu.org>."
48
49version="\
50GNU config.guess ($timestamp)
51
52Originally written by Per Bothner.
Damien Millerdc2da292020-05-08 13:31:53 +100053Copyright 1992-2020 Free Software Foundation, Inc.
Damien Miller5bf5f2c2001-05-06 10:54:15 +100054
55This is free software; see the source for copying conditions. There is NO
56warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
Damien Millerb405d612000-06-12 23:01:02 +100057
58help="
59Try \`$me --help' for more information."
60
61# Parse command line
62while test $# -gt 0 ; do
Damien Miller5bf5f2c2001-05-06 10:54:15 +100063 case $1 in
64 --time-stamp | --time* | -t )
Tim Rice5f707582005-06-01 19:57:45 -070065 echo "$timestamp" ; exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +100066 --version | -v )
Tim Rice5f707582005-06-01 19:57:45 -070067 echo "$version" ; exit ;;
Damien Millerb405d612000-06-12 23:01:02 +100068 --help | --h* | -h )
Tim Rice5f707582005-06-01 19:57:45 -070069 echo "$usage"; exit ;;
Damien Millerb405d612000-06-12 23:01:02 +100070 -- ) # Stop option processing
71 shift; break ;;
72 - ) # Use stdin as input.
73 break ;;
74 -* )
Damien Miller5bf5f2c2001-05-06 10:54:15 +100075 echo "$me: invalid option $1$help" >&2
Damien Millerb405d612000-06-12 23:01:02 +100076 exit 1 ;;
77 * )
78 break ;;
79 esac
80done
81
82if test $# != 0; then
83 echo "$me: too many arguments$help" >&2
84 exit 1
85fi
86
Damien Millera7609f52002-07-25 14:40:22 +100087# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
88# compiler to aid in system detection is discouraged as it requires
89# temporary files to be created and, as you can see below, it is a
90# headache to deal with in a portable fashion.
Damien Miller5bf5f2c2001-05-06 10:54:15 +100091
Damien Miller5bf5f2c2001-05-06 10:54:15 +100092# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
93# use `HOST_CC' if defined, but it is deprecated.
94
Damien Miller752e4e62004-04-21 12:29:13 +100095# Portable tmp directory creation inspired by the Autoconf team.
Damien Millera7609f52002-07-25 14:40:22 +100096
Damien Millerdc2da292020-05-08 13:31:53 +100097tmp=
98# shellcheck disable=SC2172
99trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
100
101set_cc_for_build() {
102 # prevent multiple calls if $tmp is already set
103 test "$tmp" && return 0
104 : "${TMPDIR=/tmp}"
105 # shellcheck disable=SC2039
106 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
107 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
108 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
109 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
110 dummy=$tmp/dummy
111 case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
112 ,,) echo "int x;" > "$dummy.c"
113 for driver in cc gcc c89 c99 ; do
114 if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
115 CC_FOR_BUILD="$driver"
116 break
117 fi
118 done
119 if test x"$CC_FOR_BUILD" = x ; then
120 CC_FOR_BUILD=no_compiler_found
121 fi
122 ;;
123 ,,*) CC_FOR_BUILD=$CC ;;
124 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
125 esac
126}
Damien Millerb405d612000-06-12 23:01:02 +1000127
128# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
Tim Rice92c1fc42002-02-18 15:18:56 -0800129# (ghazi@noc.rutgers.edu 1994-08-24)
Damien Millerdc2da292020-05-08 13:31:53 +1000130if test -f /.attbin/uname ; then
Damien Millerb405d612000-06-12 23:01:02 +1000131 PATH=$PATH:/.attbin ; export PATH
132fi
133
134UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
135UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000136UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
Damien Millerb405d612000-06-12 23:01:02 +1000137UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
138
Damien Millerdc2da292020-05-08 13:31:53 +1000139case "$UNAME_SYSTEM" in
Damien Miller23902e32016-08-02 10:48:04 +1000140Linux|GNU|GNU/*)
141 # If the system lacks a compiler, then just pick glibc.
142 # We could probably try harder.
143 LIBC=gnu
144
Damien Millerdc2da292020-05-08 13:31:53 +1000145 set_cc_for_build
146 cat <<-EOF > "$dummy.c"
Damien Miller23902e32016-08-02 10:48:04 +1000147 #include <features.h>
148 #if defined(__UCLIBC__)
149 LIBC=uclibc
150 #elif defined(__dietlibc__)
151 LIBC=dietlibc
152 #else
153 LIBC=gnu
154 #endif
155 EOF
Damien Millerdc2da292020-05-08 13:31:53 +1000156 eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
157
158 # If ldd exists, use it to detect musl libc.
159 if command -v ldd >/dev/null && \
160 ldd --version 2>&1 | grep -q ^musl
161 then
162 LIBC=musl
163 fi
Damien Miller23902e32016-08-02 10:48:04 +1000164 ;;
165esac
166
Damien Millerb405d612000-06-12 23:01:02 +1000167# Note: order is significant - the case branches are not exclusive.
168
Damien Millerdc2da292020-05-08 13:31:53 +1000169case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
Damien Millerb405d612000-06-12 23:01:02 +1000170 *:NetBSD:*:*)
Tim Rice92c1fc42002-02-18 15:18:56 -0800171 # NetBSD (nbsd) targets should (where applicable) match one or
Damien Millerbc68f242013-04-18 11:26:25 +1000172 # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
Damien Millerb405d612000-06-12 23:01:02 +1000173 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
174 # switched to ELF, *-*-netbsd* would select the old
175 # object file format. This provides both forward
176 # compatibility and a consistent mechanism for selecting the
177 # object file format.
Tim Rice92c1fc42002-02-18 15:18:56 -0800178 #
179 # Note: NetBSD doesn't particularly care about the vendor
180 # portion of the name. We always set it to "unknown".
Damien Millera7609f52002-07-25 14:40:22 +1000181 sysctl="sysctl -n hw.machine_arch"
Damien Miller23902e32016-08-02 10:48:04 +1000182 UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
Damien Millerdc2da292020-05-08 13:31:53 +1000183 "/sbin/$sysctl" 2>/dev/null || \
184 "/usr/sbin/$sysctl" 2>/dev/null || \
Damien Miller23902e32016-08-02 10:48:04 +1000185 echo unknown)`
Damien Millerdc2da292020-05-08 13:31:53 +1000186 case "$UNAME_MACHINE_ARCH" in
Damien Millera7609f52002-07-25 14:40:22 +1000187 armeb) machine=armeb-unknown ;;
Tim Rice92c1fc42002-02-18 15:18:56 -0800188 arm*) machine=arm-unknown ;;
189 sh3el) machine=shl-unknown ;;
190 sh3eb) machine=sh-unknown ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +1000191 sh5el) machine=sh5le-unknown ;;
Damien Miller23902e32016-08-02 10:48:04 +1000192 earmv*)
Damien Millerdc2da292020-05-08 13:31:53 +1000193 arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
194 endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
195 machine="${arch}${endian}"-unknown
Damien Miller23902e32016-08-02 10:48:04 +1000196 ;;
Damien Millerdc2da292020-05-08 13:31:53 +1000197 *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
Damien Millerb405d612000-06-12 23:01:02 +1000198 esac
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000199 # The Operating System including object format, if it has switched
Damien Miller23902e32016-08-02 10:48:04 +1000200 # to ELF recently (or will in the future) and ABI.
Damien Millerdc2da292020-05-08 13:31:53 +1000201 case "$UNAME_MACHINE_ARCH" in
Damien Miller23902e32016-08-02 10:48:04 +1000202 earm*)
203 os=netbsdelf
204 ;;
Tim Rice92c1fc42002-02-18 15:18:56 -0800205 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
Damien Millerdc2da292020-05-08 13:31:53 +1000206 set_cc_for_build
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000207 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
Tim Ricec5b0cb32010-03-01 15:57:42 -0800208 | grep -q __ELF__
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000209 then
210 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
211 # Return netbsd for either. FIX?
212 os=netbsd
213 else
214 os=netbsdelf
215 fi
216 ;;
217 *)
Damien Millerbc68f242013-04-18 11:26:25 +1000218 os=netbsd
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000219 ;;
220 esac
Damien Miller23902e32016-08-02 10:48:04 +1000221 # Determine ABI tags.
Damien Millerdc2da292020-05-08 13:31:53 +1000222 case "$UNAME_MACHINE_ARCH" in
Damien Miller23902e32016-08-02 10:48:04 +1000223 earm*)
224 expr='s/^earmv[0-9]/-eabi/;s/eb$//'
Damien Millerdc2da292020-05-08 13:31:53 +1000225 abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
Damien Miller23902e32016-08-02 10:48:04 +1000226 ;;
227 esac
Damien Millerb405d612000-06-12 23:01:02 +1000228 # The OS release
Damien Miller752e4e62004-04-21 12:29:13 +1000229 # Debian GNU/NetBSD machines have a different userland, and
230 # thus, need a distinct triplet. However, they do not need
231 # kernel version information, so it can be replaced with a
232 # suitable tag, in the style of linux-gnu.
Damien Millerdc2da292020-05-08 13:31:53 +1000233 case "$UNAME_VERSION" in
Damien Miller752e4e62004-04-21 12:29:13 +1000234 Debian*)
235 release='-gnu'
236 ;;
237 *)
Damien Millerdc2da292020-05-08 13:31:53 +1000238 release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
Damien Miller752e4e62004-04-21 12:29:13 +1000239 ;;
240 esac
Damien Millerb405d612000-06-12 23:01:02 +1000241 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
242 # contains redundant information, the shorter form:
243 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
Damien Millerdc2da292020-05-08 13:31:53 +1000244 echo "$machine-${os}${release}${abi-}"
Tim Rice5f707582005-06-01 19:57:45 -0700245 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +1000246 *:Bitrig:*:*)
247 UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
Damien Millerdc2da292020-05-08 13:31:53 +1000248 echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
Damien Millerbc68f242013-04-18 11:26:25 +1000249 exit ;;
Tim Rice92c1fc42002-02-18 15:18:56 -0800250 *:OpenBSD:*:*)
Darren Tuckerc570ff72008-09-06 18:20:57 +1000251 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
Damien Millerdc2da292020-05-08 13:31:53 +1000252 echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700253 exit ;;
Damien Miller23902e32016-08-02 10:48:04 +1000254 *:LibertyBSD:*:*)
255 UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
Damien Millerdc2da292020-05-08 13:31:53 +1000256 echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
257 exit ;;
258 *:MidnightBSD:*:*)
259 echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
Damien Miller23902e32016-08-02 10:48:04 +1000260 exit ;;
Tim Rice5f707582005-06-01 19:57:45 -0700261 *:ekkoBSD:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000262 echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700263 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +1000264 *:SolidBSD:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000265 echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
266 exit ;;
267 *:OS108:*:*)
268 echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +1000269 exit ;;
Tim Rice5f707582005-06-01 19:57:45 -0700270 macppc:MirBSD:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000271 echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700272 exit ;;
273 *:MirBSD:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000274 echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700275 exit ;;
Damien Miller23902e32016-08-02 10:48:04 +1000276 *:Sortix:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000277 echo "$UNAME_MACHINE"-unknown-sortix
278 exit ;;
279 *:Twizzler:*:*)
280 echo "$UNAME_MACHINE"-unknown-twizzler
281 exit ;;
282 *:Redox:*:*)
283 echo "$UNAME_MACHINE"-unknown-redox
284 exit ;;
285 mips:OSF1:*.*)
286 echo mips-dec-osf1
Damien Miller23902e32016-08-02 10:48:04 +1000287 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000288 alpha:OSF1:*:*)
Tim Rice5f707582005-06-01 19:57:45 -0700289 case $UNAME_RELEASE in
290 *4.0)
Damien Millerb405d612000-06-12 23:01:02 +1000291 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
Tim Rice5f707582005-06-01 19:57:45 -0700292 ;;
293 *5.*)
Damien Millerbc68f242013-04-18 11:26:25 +1000294 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
Tim Rice5f707582005-06-01 19:57:45 -0700295 ;;
296 esac
Damien Miller752e4e62004-04-21 12:29:13 +1000297 # According to Compaq, /usr/sbin/psrinfo has been available on
298 # OSF/1 and Tru64 systems produced since 1995. I hope that
299 # covers most systems running today. This code pipes the CPU
300 # types through head -n 1, so we only detect the type of CPU 0.
301 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
302 case "$ALPHA_CPU_TYPE" in
303 "EV4 (21064)")
Damien Miller23902e32016-08-02 10:48:04 +1000304 UNAME_MACHINE=alpha ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000305 "EV4.5 (21064)")
Damien Miller23902e32016-08-02 10:48:04 +1000306 UNAME_MACHINE=alpha ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000307 "LCA4 (21066/21068)")
Damien Miller23902e32016-08-02 10:48:04 +1000308 UNAME_MACHINE=alpha ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000309 "EV5 (21164)")
Damien Miller23902e32016-08-02 10:48:04 +1000310 UNAME_MACHINE=alphaev5 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000311 "EV5.6 (21164A)")
Damien Miller23902e32016-08-02 10:48:04 +1000312 UNAME_MACHINE=alphaev56 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000313 "EV5.6 (21164PC)")
Damien Miller23902e32016-08-02 10:48:04 +1000314 UNAME_MACHINE=alphapca56 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000315 "EV5.7 (21164PC)")
Damien Miller23902e32016-08-02 10:48:04 +1000316 UNAME_MACHINE=alphapca57 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000317 "EV6 (21264)")
Damien Miller23902e32016-08-02 10:48:04 +1000318 UNAME_MACHINE=alphaev6 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000319 "EV6.7 (21264A)")
Damien Miller23902e32016-08-02 10:48:04 +1000320 UNAME_MACHINE=alphaev67 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000321 "EV6.8CB (21264C)")
Damien Miller23902e32016-08-02 10:48:04 +1000322 UNAME_MACHINE=alphaev68 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000323 "EV6.8AL (21264B)")
Damien Miller23902e32016-08-02 10:48:04 +1000324 UNAME_MACHINE=alphaev68 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000325 "EV6.8CX (21264D)")
Damien Miller23902e32016-08-02 10:48:04 +1000326 UNAME_MACHINE=alphaev68 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000327 "EV6.9A (21264/EV69A)")
Damien Miller23902e32016-08-02 10:48:04 +1000328 UNAME_MACHINE=alphaev69 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000329 "EV7 (21364)")
Damien Miller23902e32016-08-02 10:48:04 +1000330 UNAME_MACHINE=alphaev7 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000331 "EV7.9 (21364A)")
Damien Miller23902e32016-08-02 10:48:04 +1000332 UNAME_MACHINE=alphaev79 ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000333 esac
Tim Rice5f707582005-06-01 19:57:45 -0700334 # A Pn.n version is a patched version.
Damien Millerb405d612000-06-12 23:01:02 +1000335 # A Vn.n version is a released version.
336 # A Tn.n version is a released field test version.
337 # A Xn.n version is an unreleased experimental baselevel.
338 # 1.2 uses "1.2" for uname -r.
Damien Millerdc2da292020-05-08 13:31:53 +1000339 echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
Tim Riced069c482011-01-26 12:32:12 -0800340 # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
341 exitcode=$?
342 trap '' 0
343 exit $exitcode ;;
Damien Millerb405d612000-06-12 23:01:02 +1000344 Amiga*:UNIX_System_V:4.0:*)
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000345 echo m68k-unknown-sysv4
Tim Rice5f707582005-06-01 19:57:45 -0700346 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000347 *:[Aa]miga[Oo][Ss]:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000348 echo "$UNAME_MACHINE"-unknown-amigaos
Tim Rice5f707582005-06-01 19:57:45 -0700349 exit ;;
Tim Rice92c1fc42002-02-18 15:18:56 -0800350 *:[Mm]orph[Oo][Ss]:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000351 echo "$UNAME_MACHINE"-unknown-morphos
Tim Rice5f707582005-06-01 19:57:45 -0700352 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000353 *:OS/390:*:*)
354 echo i370-ibm-openedition
Tim Rice5f707582005-06-01 19:57:45 -0700355 exit ;;
356 *:z/VM:*:*)
357 echo s390-ibm-zvmoe
358 exit ;;
359 *:OS400:*:*)
Damien Millerbc68f242013-04-18 11:26:25 +1000360 echo powerpc-ibm-os400
Tim Rice5f707582005-06-01 19:57:45 -0700361 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000362 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000363 echo arm-acorn-riscix"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700364 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +1000365 arm*:riscos:*:*|arm*:RISCOS:*:*)
Tim Rice5f707582005-06-01 19:57:45 -0700366 echo arm-unknown-riscos
367 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000368 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
Damien Millerb405d612000-06-12 23:01:02 +1000369 echo hppa1.1-hitachi-hiuxmpp
Tim Rice5f707582005-06-01 19:57:45 -0700370 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000371 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
372 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
373 if test "`(/bin/universe) 2>/dev/null`" = att ; then
374 echo pyramid-pyramid-sysv3
375 else
376 echo pyramid-pyramid-bsd
377 fi
Tim Rice5f707582005-06-01 19:57:45 -0700378 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000379 NILE*:*:*:dcosx)
380 echo pyramid-pyramid-svr4
Tim Rice5f707582005-06-01 19:57:45 -0700381 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000382 DRS?6000:unix:4.0:6*)
383 echo sparc-icl-nx6
Tim Rice5f707582005-06-01 19:57:45 -0700384 exit ;;
385 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
Damien Millera7609f52002-07-25 14:40:22 +1000386 case `/usr/bin/uname -p` in
Tim Rice5f707582005-06-01 19:57:45 -0700387 sparc) echo sparc-icl-nx7; exit ;;
Damien Millera7609f52002-07-25 14:40:22 +1000388 esac ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800389 s390x:SunOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000390 echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
Tim Ricec5b0cb32010-03-01 15:57:42 -0800391 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000392 sun4H:SunOS:5.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000393 echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
Tim Rice5f707582005-06-01 19:57:45 -0700394 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000395 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000396 echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
Tim Rice5f707582005-06-01 19:57:45 -0700397 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800398 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000399 echo i386-pc-auroraux"$UNAME_RELEASE"
Tim Ricec5b0cb32010-03-01 15:57:42 -0800400 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +1000401 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000402 set_cc_for_build
Damien Miller23902e32016-08-02 10:48:04 +1000403 SUN_ARCH=i386
Tim Ricec5b0cb32010-03-01 15:57:42 -0800404 # If there is a compiler, see if it is configured for 64-bit objects.
405 # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
406 # This test works for both compilers.
Damien Miller23902e32016-08-02 10:48:04 +1000407 if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
Tim Ricec5b0cb32010-03-01 15:57:42 -0800408 if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
Damien Miller23902e32016-08-02 10:48:04 +1000409 (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
Tim Ricec5b0cb32010-03-01 15:57:42 -0800410 grep IS_64BIT_ARCH >/dev/null
411 then
Damien Miller23902e32016-08-02 10:48:04 +1000412 SUN_ARCH=x86_64
Tim Ricec5b0cb32010-03-01 15:57:42 -0800413 fi
414 fi
Damien Millerdc2da292020-05-08 13:31:53 +1000415 echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
Tim Rice5f707582005-06-01 19:57:45 -0700416 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000417 sun4*:SunOS:6*:*)
418 # According to config.sub, this is the proper way to canonicalize
419 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
420 # it's likely to be more like Solaris than SunOS4.
Damien Millerdc2da292020-05-08 13:31:53 +1000421 echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
Tim Rice5f707582005-06-01 19:57:45 -0700422 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000423 sun4*:SunOS:*:*)
424 case "`/usr/bin/arch -k`" in
425 Series*|S4*)
426 UNAME_RELEASE=`uname -v`
427 ;;
428 esac
429 # Japanese Language versions have a version number like `4.1.3-JL'.
Damien Millerdc2da292020-05-08 13:31:53 +1000430 echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
Tim Rice5f707582005-06-01 19:57:45 -0700431 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000432 sun3*:SunOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000433 echo m68k-sun-sunos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700434 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000435 sun*:*:4.2BSD:*)
Damien Millera7609f52002-07-25 14:40:22 +1000436 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
Damien Millerdc2da292020-05-08 13:31:53 +1000437 test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
Damien Millerb405d612000-06-12 23:01:02 +1000438 case "`/bin/arch`" in
439 sun3)
Damien Millerdc2da292020-05-08 13:31:53 +1000440 echo m68k-sun-sunos"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +1000441 ;;
442 sun4)
Damien Millerdc2da292020-05-08 13:31:53 +1000443 echo sparc-sun-sunos"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +1000444 ;;
445 esac
Tim Rice5f707582005-06-01 19:57:45 -0700446 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000447 aushp:SunOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000448 echo sparc-auspex-sunos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700449 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000450 # The situation for MiNT is a little confusing. The machine name
451 # can be virtually everything (everything which is not
452 # "atarist" or "atariste" at least should have a processor
453 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
454 # to the lowercase version "mint" (or "freemint"). Finally
455 # the system name "TOS" denotes a system which is actually not
456 # MiNT. But MiNT is downward compatible to TOS, so this should
457 # be no problem.
458 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000459 echo m68k-atari-mint"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700460 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000461 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000462 echo m68k-atari-mint"$UNAME_RELEASE"
Damien Millerbc68f242013-04-18 11:26:25 +1000463 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000464 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000465 echo m68k-atari-mint"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700466 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000467 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000468 echo m68k-milan-mint"$UNAME_RELEASE"
Damien Millerbc68f242013-04-18 11:26:25 +1000469 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000470 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000471 echo m68k-hades-mint"$UNAME_RELEASE"
Damien Millerbc68f242013-04-18 11:26:25 +1000472 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000473 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000474 echo m68k-unknown-mint"$UNAME_RELEASE"
Damien Millerbc68f242013-04-18 11:26:25 +1000475 exit ;;
Tim Rice5f707582005-06-01 19:57:45 -0700476 m68k:machten:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000477 echo m68k-apple-machten"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700478 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000479 powerpc:machten:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000480 echo powerpc-apple-machten"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700481 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000482 RISC*:Mach:*:*)
483 echo mips-dec-mach_bsd4.3
Tim Rice5f707582005-06-01 19:57:45 -0700484 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000485 RISC*:ULTRIX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000486 echo mips-dec-ultrix"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700487 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000488 VAX*:ULTRIX*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000489 echo vax-dec-ultrix"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700490 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000491 2020:CLIX:*:* | 2430:CLIX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000492 echo clipper-intergraph-clix"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700493 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000494 mips:*:*:UMIPS | mips:*:*:RISCos)
Damien Millerdc2da292020-05-08 13:31:53 +1000495 set_cc_for_build
496 sed 's/^ //' << EOF > "$dummy.c"
Damien Millerb405d612000-06-12 23:01:02 +1000497#ifdef __cplusplus
498#include <stdio.h> /* for printf() prototype */
499 int main (int argc, char *argv[]) {
500#else
501 int main (argc, argv) int argc; char *argv[]; {
502#endif
503 #if defined (host_mips) && defined (MIPSEB)
504 #if defined (SYSTYPE_SYSV)
Damien Millerdc2da292020-05-08 13:31:53 +1000505 printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
Damien Millerb405d612000-06-12 23:01:02 +1000506 #endif
507 #if defined (SYSTYPE_SVR4)
Damien Millerdc2da292020-05-08 13:31:53 +1000508 printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
Damien Millerb405d612000-06-12 23:01:02 +1000509 #endif
510 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
Damien Millerdc2da292020-05-08 13:31:53 +1000511 printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
Damien Millerb405d612000-06-12 23:01:02 +1000512 #endif
513 #endif
514 exit (-1);
515 }
516EOF
Damien Millerdc2da292020-05-08 13:31:53 +1000517 $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
518 dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
519 SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
Tim Rice5f707582005-06-01 19:57:45 -0700520 { echo "$SYSTEM_NAME"; exit; }
Damien Millerdc2da292020-05-08 13:31:53 +1000521 echo mips-mips-riscos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700522 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000523 Motorola:PowerMAX_OS:*:*)
524 echo powerpc-motorola-powermax
Tim Rice5f707582005-06-01 19:57:45 -0700525 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000526 Motorola:*:4.3:PL8-*)
527 echo powerpc-harris-powermax
Tim Rice5f707582005-06-01 19:57:45 -0700528 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000529 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
Damien Millera7609f52002-07-25 14:40:22 +1000530 echo powerpc-harris-powermax
Tim Rice5f707582005-06-01 19:57:45 -0700531 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000532 Night_Hawk:Power_UNIX:*:*)
533 echo powerpc-harris-powerunix
Tim Rice5f707582005-06-01 19:57:45 -0700534 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000535 m88k:CX/UX:7*:*)
536 echo m88k-harris-cxux7
Tim Rice5f707582005-06-01 19:57:45 -0700537 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000538 m88k:*:4*:R4*)
539 echo m88k-motorola-sysv4
Tim Rice5f707582005-06-01 19:57:45 -0700540 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000541 m88k:*:3*:R3*)
542 echo m88k-motorola-sysv3
Tim Rice5f707582005-06-01 19:57:45 -0700543 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000544 AViiON:dgux:*:*)
Damien Millerbc68f242013-04-18 11:26:25 +1000545 # DG/UX returns AViiON for all architectures
546 UNAME_PROCESSOR=`/usr/bin/uname -p`
Damien Millerdc2da292020-05-08 13:31:53 +1000547 if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
Damien Millerb405d612000-06-12 23:01:02 +1000548 then
Damien Millerdc2da292020-05-08 13:31:53 +1000549 if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
550 [ "$TARGET_BINARY_INTERFACE"x = x ]
Damien Millerb405d612000-06-12 23:01:02 +1000551 then
Damien Millerdc2da292020-05-08 13:31:53 +1000552 echo m88k-dg-dgux"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +1000553 else
Damien Millerdc2da292020-05-08 13:31:53 +1000554 echo m88k-dg-dguxbcs"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +1000555 fi
556 else
Damien Millerdc2da292020-05-08 13:31:53 +1000557 echo i586-dg-dgux"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +1000558 fi
Damien Millerbc68f242013-04-18 11:26:25 +1000559 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000560 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
561 echo m88k-dolphin-sysv3
Tim Rice5f707582005-06-01 19:57:45 -0700562 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000563 M88*:*:R3*:*)
564 # Delta 88k system running SVR3
565 echo m88k-motorola-sysv3
Tim Rice5f707582005-06-01 19:57:45 -0700566 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000567 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
568 echo m88k-tektronix-sysv3
Tim Rice5f707582005-06-01 19:57:45 -0700569 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000570 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
571 echo m68k-tektronix-bsd
Tim Rice5f707582005-06-01 19:57:45 -0700572 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000573 *:IRIX*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000574 echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
Tim Rice5f707582005-06-01 19:57:45 -0700575 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000576 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
Tim Rice5f707582005-06-01 19:57:45 -0700577 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
578 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000579 i*86:AIX:*:*)
Damien Millerb405d612000-06-12 23:01:02 +1000580 echo i386-ibm-aix
Tim Rice5f707582005-06-01 19:57:45 -0700581 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000582 ia64:AIX:*:*)
583 if [ -x /usr/bin/oslevel ] ; then
584 IBM_REV=`/usr/bin/oslevel`
585 else
Damien Millerdc2da292020-05-08 13:31:53 +1000586 IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000587 fi
Damien Millerdc2da292020-05-08 13:31:53 +1000588 echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
Tim Rice5f707582005-06-01 19:57:45 -0700589 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000590 *:AIX:2:3)
591 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
Damien Millerdc2da292020-05-08 13:31:53 +1000592 set_cc_for_build
593 sed 's/^ //' << EOF > "$dummy.c"
Damien Millerb405d612000-06-12 23:01:02 +1000594 #include <sys/systemcfg.h>
595
596 main()
597 {
598 if (!__power_pc())
599 exit(1);
600 puts("powerpc-ibm-aix3.2.5");
601 exit(0);
602 }
603EOF
Damien Millerdc2da292020-05-08 13:31:53 +1000604 if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
Tim Rice5f707582005-06-01 19:57:45 -0700605 then
606 echo "$SYSTEM_NAME"
607 else
608 echo rs6000-ibm-aix3.2.5
609 fi
Damien Millerb405d612000-06-12 23:01:02 +1000610 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
611 echo rs6000-ibm-aix3.2.4
612 else
613 echo rs6000-ibm-aix3.2
614 fi
Tim Rice5f707582005-06-01 19:57:45 -0700615 exit ;;
Tim Riced069c482011-01-26 12:32:12 -0800616 *:AIX:*:[4567])
Damien Millera7609f52002-07-25 14:40:22 +1000617 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
Damien Millerdc2da292020-05-08 13:31:53 +1000618 if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
Damien Millerb405d612000-06-12 23:01:02 +1000619 IBM_ARCH=rs6000
620 else
621 IBM_ARCH=powerpc
622 fi
Damien Miller23902e32016-08-02 10:48:04 +1000623 if [ -x /usr/bin/lslpp ] ; then
624 IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
625 awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
Damien Millerb405d612000-06-12 23:01:02 +1000626 else
Damien Millerdc2da292020-05-08 13:31:53 +1000627 IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +1000628 fi
Damien Millerdc2da292020-05-08 13:31:53 +1000629 echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
Tim Rice5f707582005-06-01 19:57:45 -0700630 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000631 *:AIX:*:*)
632 echo rs6000-ibm-aix
Tim Rice5f707582005-06-01 19:57:45 -0700633 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +1000634 ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
Damien Millerb405d612000-06-12 23:01:02 +1000635 echo romp-ibm-bsd4.4
Tim Rice5f707582005-06-01 19:57:45 -0700636 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000637 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
Damien Millerdc2da292020-05-08 13:31:53 +1000638 echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
Tim Rice5f707582005-06-01 19:57:45 -0700639 exit ;; # report: romp-ibm BSD 4.3
Damien Millerb405d612000-06-12 23:01:02 +1000640 *:BOSX:*:*)
641 echo rs6000-bull-bosx
Tim Rice5f707582005-06-01 19:57:45 -0700642 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000643 DPX/2?00:B.O.S.:*:*)
644 echo m68k-bull-sysv3
Tim Rice5f707582005-06-01 19:57:45 -0700645 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000646 9000/[34]??:4.3bsd:1.*:*)
647 echo m68k-hp-bsd
Tim Rice5f707582005-06-01 19:57:45 -0700648 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000649 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
650 echo m68k-hp-bsd4.4
Tim Rice5f707582005-06-01 19:57:45 -0700651 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000652 9000/[34678]??:HP-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000653 HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
654 case "$UNAME_MACHINE" in
655 9000/31?) HP_ARCH=m68000 ;;
656 9000/[34]??) HP_ARCH=m68k ;;
Damien Millerb405d612000-06-12 23:01:02 +1000657 9000/[678][0-9][0-9])
Tim Rice92c1fc42002-02-18 15:18:56 -0800658 if [ -x /usr/bin/getconf ]; then
659 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
Damien Millerbc68f242013-04-18 11:26:25 +1000660 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
Damien Millerdc2da292020-05-08 13:31:53 +1000661 case "$sc_cpu_version" in
Damien Miller23902e32016-08-02 10:48:04 +1000662 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
663 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
Damien Millerbc68f242013-04-18 11:26:25 +1000664 532) # CPU_PA_RISC2_0
Damien Millerdc2da292020-05-08 13:31:53 +1000665 case "$sc_kernel_bits" in
Damien Miller23902e32016-08-02 10:48:04 +1000666 32) HP_ARCH=hppa2.0n ;;
667 64) HP_ARCH=hppa2.0w ;;
668 '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
Damien Millerbc68f242013-04-18 11:26:25 +1000669 esac ;;
670 esac
Tim Rice92c1fc42002-02-18 15:18:56 -0800671 fi
Damien Millerdc2da292020-05-08 13:31:53 +1000672 if [ "$HP_ARCH" = "" ]; then
673 set_cc_for_build
674 sed 's/^ //' << EOF > "$dummy.c"
Damien Millerb405d612000-06-12 23:01:02 +1000675
Damien Millerbc68f242013-04-18 11:26:25 +1000676 #define _HPUX_SOURCE
677 #include <stdlib.h>
678 #include <unistd.h>
Damien Millerb405d612000-06-12 23:01:02 +1000679
Damien Millerbc68f242013-04-18 11:26:25 +1000680 int main ()
681 {
682 #if defined(_SC_KERNEL_BITS)
683 long bits = sysconf(_SC_KERNEL_BITS);
684 #endif
685 long cpu = sysconf (_SC_CPU_VERSION);
Damien Millerb405d612000-06-12 23:01:02 +1000686
Damien Millerbc68f242013-04-18 11:26:25 +1000687 switch (cpu)
688 {
689 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
690 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
691 case CPU_PA_RISC2_0:
692 #if defined(_SC_KERNEL_BITS)
693 switch (bits)
694 {
695 case 64: puts ("hppa2.0w"); break;
696 case 32: puts ("hppa2.0n"); break;
697 default: puts ("hppa2.0"); break;
698 } break;
699 #else /* !defined(_SC_KERNEL_BITS) */
700 puts ("hppa2.0"); break;
701 #endif
702 default: puts ("hppa1.0"); break;
703 }
704 exit (0);
705 }
Damien Millerb405d612000-06-12 23:01:02 +1000706EOF
Damien Millerdc2da292020-05-08 13:31:53 +1000707 (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
Damien Miller752e4e62004-04-21 12:29:13 +1000708 test -z "$HP_ARCH" && HP_ARCH=hppa
Tim Rice92c1fc42002-02-18 15:18:56 -0800709 fi ;;
Damien Millerb405d612000-06-12 23:01:02 +1000710 esac
Damien Millerdc2da292020-05-08 13:31:53 +1000711 if [ "$HP_ARCH" = hppa2.0w ]
Damien Miller752e4e62004-04-21 12:29:13 +1000712 then
Damien Millerdc2da292020-05-08 13:31:53 +1000713 set_cc_for_build
Tim Rice5f707582005-06-01 19:57:45 -0700714
715 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
716 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
717 # generating 64-bit code. GNU and HP use different nomenclature:
718 #
719 # $ CC_FOR_BUILD=cc ./config.guess
720 # => hppa2.0w-hp-hpux11.23
721 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
722 # => hppa64-hp-hpux11.23
723
Damien Miller23902e32016-08-02 10:48:04 +1000724 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
Tim Ricec5b0cb32010-03-01 15:57:42 -0800725 grep -q __LP64__
Damien Miller752e4e62004-04-21 12:29:13 +1000726 then
Damien Miller23902e32016-08-02 10:48:04 +1000727 HP_ARCH=hppa2.0w
Damien Miller752e4e62004-04-21 12:29:13 +1000728 else
Damien Miller23902e32016-08-02 10:48:04 +1000729 HP_ARCH=hppa64
Damien Miller752e4e62004-04-21 12:29:13 +1000730 fi
731 fi
Damien Millerdc2da292020-05-08 13:31:53 +1000732 echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
Tim Rice5f707582005-06-01 19:57:45 -0700733 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000734 ia64:HP-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000735 HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
736 echo ia64-hp-hpux"$HPUX_REV"
Tim Rice5f707582005-06-01 19:57:45 -0700737 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000738 3050*:HI-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000739 set_cc_for_build
740 sed 's/^ //' << EOF > "$dummy.c"
Damien Millerb405d612000-06-12 23:01:02 +1000741 #include <unistd.h>
742 int
743 main ()
744 {
745 long cpu = sysconf (_SC_CPU_VERSION);
746 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
747 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
748 results, however. */
749 if (CPU_IS_PA_RISC (cpu))
750 {
751 switch (cpu)
752 {
753 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
754 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
755 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
756 default: puts ("hppa-hitachi-hiuxwe2"); break;
757 }
758 }
759 else if (CPU_IS_HP_MC68K (cpu))
760 puts ("m68k-hitachi-hiuxwe2");
761 else puts ("unknown-hitachi-hiuxwe2");
762 exit (0);
763 }
764EOF
Damien Millerdc2da292020-05-08 13:31:53 +1000765 $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
Tim Rice5f707582005-06-01 19:57:45 -0700766 { echo "$SYSTEM_NAME"; exit; }
Damien Millerb405d612000-06-12 23:01:02 +1000767 echo unknown-hitachi-hiuxwe2
Tim Rice5f707582005-06-01 19:57:45 -0700768 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +1000769 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
Damien Millerb405d612000-06-12 23:01:02 +1000770 echo hppa1.1-hp-bsd
Tim Rice5f707582005-06-01 19:57:45 -0700771 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000772 9000/8??:4.3bsd:*:*)
773 echo hppa1.0-hp-bsd
Tim Rice5f707582005-06-01 19:57:45 -0700774 exit ;;
Tim Rice92c1fc42002-02-18 15:18:56 -0800775 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
Damien Millerb405d612000-06-12 23:01:02 +1000776 echo hppa1.0-hp-mpeix
Tim Rice5f707582005-06-01 19:57:45 -0700777 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +1000778 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
Damien Millerb405d612000-06-12 23:01:02 +1000779 echo hppa1.1-hp-osf
Tim Rice5f707582005-06-01 19:57:45 -0700780 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000781 hp8??:OSF1:*:*)
782 echo hppa1.0-hp-osf
Tim Rice5f707582005-06-01 19:57:45 -0700783 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000784 i*86:OSF1:*:*)
Damien Millerb405d612000-06-12 23:01:02 +1000785 if [ -x /usr/sbin/sysversion ] ; then
Damien Millerdc2da292020-05-08 13:31:53 +1000786 echo "$UNAME_MACHINE"-unknown-osf1mk
Damien Millerb405d612000-06-12 23:01:02 +1000787 else
Damien Millerdc2da292020-05-08 13:31:53 +1000788 echo "$UNAME_MACHINE"-unknown-osf1
Damien Millerb405d612000-06-12 23:01:02 +1000789 fi
Tim Rice5f707582005-06-01 19:57:45 -0700790 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000791 parisc*:Lites*:*:*)
792 echo hppa1.1-hp-lites
Tim Rice5f707582005-06-01 19:57:45 -0700793 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000794 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
795 echo c1-convex-bsd
Damien Millerbc68f242013-04-18 11:26:25 +1000796 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000797 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
798 if getsysinfo -f scalar_acc
799 then echo c32-convex-bsd
800 else echo c2-convex-bsd
801 fi
Damien Millerbc68f242013-04-18 11:26:25 +1000802 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000803 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
804 echo c34-convex-bsd
Damien Millerbc68f242013-04-18 11:26:25 +1000805 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000806 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
807 echo c38-convex-bsd
Damien Millerbc68f242013-04-18 11:26:25 +1000808 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000809 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
810 echo c4-convex-bsd
Damien Millerbc68f242013-04-18 11:26:25 +1000811 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000812 CRAY*Y-MP:*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000813 echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
Tim Rice5f707582005-06-01 19:57:45 -0700814 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000815 CRAY*[A-Z]90:*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000816 echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
Damien Millerb405d612000-06-12 23:01:02 +1000817 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
Tim Rice92c1fc42002-02-18 15:18:56 -0800818 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
819 -e 's/\.[^.]*$/.X/'
Tim Rice5f707582005-06-01 19:57:45 -0700820 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000821 CRAY*TS:*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000822 echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
Tim Rice5f707582005-06-01 19:57:45 -0700823 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000824 CRAY*T3E:*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000825 echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
Tim Rice5f707582005-06-01 19:57:45 -0700826 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000827 CRAY*SV1:*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000828 echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
Tim Rice5f707582005-06-01 19:57:45 -0700829 exit ;;
Ben Lindstroma5a26482003-03-21 01:05:37 +0000830 *:UNICOS/mp:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000831 echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
Tim Rice5f707582005-06-01 19:57:45 -0700832 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000833 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
Damien Miller23902e32016-08-02 10:48:04 +1000834 FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
835 FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
Damien Millerdc2da292020-05-08 13:31:53 +1000836 FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
Damien Millerbc68f242013-04-18 11:26:25 +1000837 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
838 exit ;;
Tim Rice5f707582005-06-01 19:57:45 -0700839 5000:UNIX_System_V:4.*:*)
Damien Miller23902e32016-08-02 10:48:04 +1000840 FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
Damien Millerdc2da292020-05-08 13:31:53 +1000841 FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
Damien Millerbc68f242013-04-18 11:26:25 +1000842 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
Tim Rice5f707582005-06-01 19:57:45 -0700843 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000844 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000845 echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700846 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000847 sparc*:BSD/OS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000848 echo sparc-unknown-bsdi"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -0700849 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000850 *:BSD/OS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000851 echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
852 exit ;;
853 arm:FreeBSD:*:*)
854 UNAME_PROCESSOR=`uname -p`
855 set_cc_for_build
856 if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
857 | grep -q __ARM_PCS_VFP
858 then
859 echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
860 else
861 echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
862 fi
Tim Rice5f707582005-06-01 19:57:45 -0700863 exit ;;
864 *:FreeBSD:*:*)
Damien Millerbc68f242013-04-18 11:26:25 +1000865 UNAME_PROCESSOR=`/usr/bin/uname -p`
Damien Millerdc2da292020-05-08 13:31:53 +1000866 case "$UNAME_PROCESSOR" in
Darren Tuckerc570ff72008-09-06 18:20:57 +1000867 amd64)
Damien Millerdc2da292020-05-08 13:31:53 +1000868 UNAME_PROCESSOR=x86_64 ;;
869 i386)
870 UNAME_PROCESSOR=i586 ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +1000871 esac
Damien Millerdc2da292020-05-08 13:31:53 +1000872 echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
Tim Rice5f707582005-06-01 19:57:45 -0700873 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000874 i*:CYGWIN*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000875 echo "$UNAME_MACHINE"-pc-cygwin
Tim Rice5f707582005-06-01 19:57:45 -0700876 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +1000877 *:MINGW64*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000878 echo "$UNAME_MACHINE"-pc-mingw64
Damien Millerbc68f242013-04-18 11:26:25 +1000879 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +1000880 *:MINGW*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000881 echo "$UNAME_MACHINE"-pc-mingw32
Tim Rice5f707582005-06-01 19:57:45 -0700882 exit ;;
Damien Miller23902e32016-08-02 10:48:04 +1000883 *:MSYS*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000884 echo "$UNAME_MACHINE"-pc-msys
Tim Rice5f707582005-06-01 19:57:45 -0700885 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000886 i*:PW*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000887 echo "$UNAME_MACHINE"-pc-pw32
Tim Rice5f707582005-06-01 19:57:45 -0700888 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800889 *:Interix*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000890 case "$UNAME_MACHINE" in
Darren Tuckerc570ff72008-09-06 18:20:57 +1000891 x86)
Damien Millerdc2da292020-05-08 13:31:53 +1000892 echo i586-pc-interix"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +1000893 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800894 authenticamd | genuineintel | EM64T)
Damien Millerdc2da292020-05-08 13:31:53 +1000895 echo x86_64-unknown-interix"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +1000896 exit ;;
897 IA64)
Damien Millerdc2da292020-05-08 13:31:53 +1000898 echo ia64-unknown-interix"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +1000899 exit ;;
900 esac ;;
Damien Millerb405d612000-06-12 23:01:02 +1000901 i*:UWIN*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000902 echo "$UNAME_MACHINE"-pc-uwin
Tim Rice5f707582005-06-01 19:57:45 -0700903 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +1000904 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000905 echo x86_64-pc-cygwin
Tim Rice5f707582005-06-01 19:57:45 -0700906 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000907 prep*:SunOS:5.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000908 echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
Tim Rice5f707582005-06-01 19:57:45 -0700909 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +1000910 *:GNU:*:*)
Tim Rice5f707582005-06-01 19:57:45 -0700911 # the GNU system
Damien Millerdc2da292020-05-08 13:31:53 +1000912 echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
Tim Rice5f707582005-06-01 19:57:45 -0700913 exit ;;
914 *:GNU/*:*:*)
915 # other systems with GNU libc and userland
Damien Millerdc2da292020-05-08 13:31:53 +1000916 echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700917 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +1000918 *:Minix:*:*)
919 echo "$UNAME_MACHINE"-unknown-minix
Tim Rice5f707582005-06-01 19:57:45 -0700920 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +1000921 aarch64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000922 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Damien Millerbc68f242013-04-18 11:26:25 +1000923 exit ;;
924 aarch64_be:Linux:*:*)
925 UNAME_MACHINE=aarch64_be
Damien Millerdc2da292020-05-08 13:31:53 +1000926 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Damien Millerbc68f242013-04-18 11:26:25 +1000927 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800928 alpha:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000929 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
Tim Ricec5b0cb32010-03-01 15:57:42 -0800930 EV5) UNAME_MACHINE=alphaev5 ;;
931 EV56) UNAME_MACHINE=alphaev56 ;;
932 PCA56) UNAME_MACHINE=alphapca56 ;;
933 PCA57) UNAME_MACHINE=alphapca56 ;;
934 EV6) UNAME_MACHINE=alphaev6 ;;
935 EV67) UNAME_MACHINE=alphaev67 ;;
936 EV68*) UNAME_MACHINE=alphaev68 ;;
Damien Millerbc68f242013-04-18 11:26:25 +1000937 esac
Tim Ricec5b0cb32010-03-01 15:57:42 -0800938 objdump --private-headers /bin/sh | grep -q ld.so.1
Damien Miller23902e32016-08-02 10:48:04 +1000939 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
Damien Millerdc2da292020-05-08 13:31:53 +1000940 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Damien Miller23902e32016-08-02 10:48:04 +1000941 exit ;;
942 arc:Linux:*:* | arceb:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000943 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Ricec5b0cb32010-03-01 15:57:42 -0800944 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000945 arm*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000946 set_cc_for_build
Darren Tuckerc570ff72008-09-06 18:20:57 +1000947 if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
948 | grep -q __ARM_EABI__
949 then
Damien Millerdc2da292020-05-08 13:31:53 +1000950 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Darren Tuckerc570ff72008-09-06 18:20:57 +1000951 else
Damien Millerbc68f242013-04-18 11:26:25 +1000952 if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
953 | grep -q __ARM_PCS_VFP
954 then
Damien Millerdc2da292020-05-08 13:31:53 +1000955 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
Damien Millerbc68f242013-04-18 11:26:25 +1000956 else
Damien Millerdc2da292020-05-08 13:31:53 +1000957 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
Damien Millerbc68f242013-04-18 11:26:25 +1000958 fi
Darren Tuckerc570ff72008-09-06 18:20:57 +1000959 fi
960 exit ;;
961 avr32*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000962 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700963 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +1000964 cris:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000965 echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700966 exit ;;
967 crisv32:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000968 echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
Damien Miller23902e32016-08-02 10:48:04 +1000969 exit ;;
970 e2k:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000971 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700972 exit ;;
973 frv:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000974 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Damien Millerbc68f242013-04-18 11:26:25 +1000975 exit ;;
976 hexagon:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000977 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700978 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800979 i*86:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000980 echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
Tim Ricec5b0cb32010-03-01 15:57:42 -0800981 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000982 ia64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000983 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Damien Miller23902e32016-08-02 10:48:04 +1000984 exit ;;
985 k1om:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000986 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700987 exit ;;
988 m32r*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000989 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700990 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +1000991 m68*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000992 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -0700993 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -0800994 mips:Linux:*:* | mips64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +1000995 set_cc_for_build
996 IS_GLIBC=0
997 test x"${LIBC}" = xgnu && IS_GLIBC=1
998 sed 's/^ //' << EOF > "$dummy.c"
Tim Rice92c1fc42002-02-18 15:18:56 -0800999 #undef CPU
Damien Millerdc2da292020-05-08 13:31:53 +10001000 #undef mips
1001 #undef mipsel
1002 #undef mips64
1003 #undef mips64el
1004 #if ${IS_GLIBC} && defined(_ABI64)
1005 LIBCABI=gnuabi64
1006 #else
1007 #if ${IS_GLIBC} && defined(_ABIN32)
1008 LIBCABI=gnuabin32
1009 #else
1010 LIBCABI=${LIBC}
1011 #endif
1012 #endif
1013
1014 #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1015 CPU=mipsisa64r6
1016 #else
1017 #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1018 CPU=mipsisa32r6
1019 #else
1020 #if defined(__mips64)
1021 CPU=mips64
1022 #else
1023 CPU=mips
1024 #endif
1025 #endif
1026 #endif
1027
Damien Millera7609f52002-07-25 14:40:22 +10001028 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
Damien Millerdc2da292020-05-08 13:31:53 +10001029 MIPS_ENDIAN=el
Tim Rice92c1fc42002-02-18 15:18:56 -08001030 #else
Damien Millera7609f52002-07-25 14:40:22 +10001031 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
Damien Millerdc2da292020-05-08 13:31:53 +10001032 MIPS_ENDIAN=
Tim Rice92c1fc42002-02-18 15:18:56 -08001033 #else
Damien Millerdc2da292020-05-08 13:31:53 +10001034 MIPS_ENDIAN=
Tim Rice92c1fc42002-02-18 15:18:56 -08001035 #endif
Damien Millera7609f52002-07-25 14:40:22 +10001036 #endif
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001037EOF
Damien Millerdc2da292020-05-08 13:31:53 +10001038 eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
1039 test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001040 ;;
Damien Millerdc2da292020-05-08 13:31:53 +10001041 mips64el:Linux:*:*)
1042 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1043 exit ;;
Damien Miller23902e32016-08-02 10:48:04 +10001044 openrisc*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001045 echo or1k-unknown-linux-"$LIBC"
Damien Miller23902e32016-08-02 10:48:04 +10001046 exit ;;
1047 or32:Linux:*:* | or1k*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001048 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Darren Tuckerc570ff72008-09-06 18:20:57 +10001049 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001050 padre:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001051 echo sparc-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001052 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001053 parisc64:Linux:*:* | hppa64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001054 echo hppa64-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001055 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001056 parisc:Linux:*:* | hppa:Linux:*:*)
1057 # Look for CPU level
1058 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
Damien Millerdc2da292020-05-08 13:31:53 +10001059 PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1060 PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1061 *) echo hppa-unknown-linux-"$LIBC" ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001062 esac
Tim Rice5f707582005-06-01 19:57:45 -07001063 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001064 ppc64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001065 echo powerpc64-unknown-linux-"$LIBC"
Tim Ricec5b0cb32010-03-01 15:57:42 -08001066 exit ;;
1067 ppc:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001068 echo powerpc-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001069 exit ;;
Darren Tuckeradfb24c2015-06-05 14:51:40 +10001070 ppc64le:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001071 echo powerpc64le-unknown-linux-"$LIBC"
Darren Tuckeradfb24c2015-06-05 14:51:40 +10001072 exit ;;
1073 ppcle:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001074 echo powerpcle-unknown-linux-"$LIBC"
1075 exit ;;
1076 riscv32:Linux:*:* | riscv64:Linux:*:*)
1077 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Darren Tuckeradfb24c2015-06-05 14:51:40 +10001078 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001079 s390:Linux:*:* | s390x:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001080 echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001081 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001082 sh64*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001083 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001084 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001085 sh*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001086 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001087 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001088 sparc:Linux:*:* | sparc64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001089 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001090 exit ;;
Tim Riced069c482011-01-26 12:32:12 -08001091 tile*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001092 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Tim Riced069c482011-01-26 12:32:12 -08001093 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +10001094 vax:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001095 echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
Darren Tuckerc570ff72008-09-06 18:20:57 +10001096 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001097 x86_64:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001098 echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
Tim Rice5f707582005-06-01 19:57:45 -07001099 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +10001100 xtensa*:Linux:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001101 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
Darren Tuckerc570ff72008-09-06 18:20:57 +10001102 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001103 i*86:DYNIX/ptx:4*:*)
Tim Rice92c1fc42002-02-18 15:18:56 -08001104 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1105 # earlier versions are messed up and put the nodename in both
1106 # sysname and nodename.
Damien Millerb405d612000-06-12 23:01:02 +10001107 echo i386-sequent-sysv4
Tim Rice5f707582005-06-01 19:57:45 -07001108 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001109 i*86:UNIX_SV:4.2MP:2.*)
Damien Millerbc68f242013-04-18 11:26:25 +10001110 # Unixware is an offshoot of SVR4, but it has its own version
1111 # number series starting with 2...
1112 # I am not positive that other SVR4 systems won't match this,
Damien Millerb405d612000-06-12 23:01:02 +10001113 # I just have to hope. -- rms.
Damien Millerbc68f242013-04-18 11:26:25 +10001114 # Use sysv4.2uw... so that sysv4* matches it.
Damien Millerdc2da292020-05-08 13:31:53 +10001115 echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
Tim Rice5f707582005-06-01 19:57:45 -07001116 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001117 i*86:OS/2:*:*)
1118 # If we were able to find `uname', then EMX Unix compatibility
1119 # is probably installed.
Damien Millerdc2da292020-05-08 13:31:53 +10001120 echo "$UNAME_MACHINE"-pc-os2-emx
Tim Rice5f707582005-06-01 19:57:45 -07001121 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001122 i*86:XTS-300:*:STOP)
Damien Millerdc2da292020-05-08 13:31:53 +10001123 echo "$UNAME_MACHINE"-unknown-stop
Tim Rice5f707582005-06-01 19:57:45 -07001124 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001125 i*86:atheos:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001126 echo "$UNAME_MACHINE"-unknown-atheos
Tim Rice5f707582005-06-01 19:57:45 -07001127 exit ;;
1128 i*86:syllable:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001129 echo "$UNAME_MACHINE"-pc-syllable
Tim Rice5f707582005-06-01 19:57:45 -07001130 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001131 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001132 echo i386-unknown-lynxos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001133 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001134 i*86:*DOS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001135 echo "$UNAME_MACHINE"-pc-msdosdjgpp
Tim Rice5f707582005-06-01 19:57:45 -07001136 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +10001137 i*86:*:4.*:*)
1138 UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
Damien Millerb405d612000-06-12 23:01:02 +10001139 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
Damien Millerdc2da292020-05-08 13:31:53 +10001140 echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
Damien Millerb405d612000-06-12 23:01:02 +10001141 else
Damien Millerdc2da292020-05-08 13:31:53 +10001142 echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
Damien Millerb405d612000-06-12 23:01:02 +10001143 fi
Tim Rice5f707582005-06-01 19:57:45 -07001144 exit ;;
Tim Rice4149ebc2005-04-23 18:17:29 -07001145 i*86:*:5:[678]*)
Damien Millerbc68f242013-04-18 11:26:25 +10001146 # UnixWare 7.x, OpenUNIX and OpenServer 6.
Tim Rice92c1fc42002-02-18 15:18:56 -08001147 case `/bin/uname -X | grep "^Machine"` in
1148 *486*) UNAME_MACHINE=i486 ;;
1149 *Pentium) UNAME_MACHINE=i586 ;;
1150 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1151 esac
Damien Millerdc2da292020-05-08 13:31:53 +10001152 echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
Tim Rice5f707582005-06-01 19:57:45 -07001153 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001154 i*86:*:3.2:*)
Damien Millerb405d612000-06-12 23:01:02 +10001155 if test -f /usr/options/cb.name; then
1156 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
Damien Millerdc2da292020-05-08 13:31:53 +10001157 echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
Damien Millerb405d612000-06-12 23:01:02 +10001158 elif /bin/uname -X 2>/dev/null >/dev/null ; then
Damien Millera7609f52002-07-25 14:40:22 +10001159 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1160 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1161 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
Damien Millerb405d612000-06-12 23:01:02 +10001162 && UNAME_MACHINE=i586
Damien Millera7609f52002-07-25 14:40:22 +10001163 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
Damien Millerb405d612000-06-12 23:01:02 +10001164 && UNAME_MACHINE=i686
Damien Millera7609f52002-07-25 14:40:22 +10001165 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
Damien Millerb405d612000-06-12 23:01:02 +10001166 && UNAME_MACHINE=i686
Damien Millerdc2da292020-05-08 13:31:53 +10001167 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
Damien Millerb405d612000-06-12 23:01:02 +10001168 else
Damien Millerdc2da292020-05-08 13:31:53 +10001169 echo "$UNAME_MACHINE"-pc-sysv32
Damien Millerb405d612000-06-12 23:01:02 +10001170 fi
Tim Rice5f707582005-06-01 19:57:45 -07001171 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001172 pc:*:*:*)
1173 # Left here for compatibility:
Damien Millerbc68f242013-04-18 11:26:25 +10001174 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1175 # the processor, so we play safe by assuming i586.
Tim Ricec5b0cb32010-03-01 15:57:42 -08001176 # Note: whatever this is, it MUST be the same as what config.sub
Damien Miller23902e32016-08-02 10:48:04 +10001177 # prints for the "djgpp" host, or else GDB configure will decide that
Tim Ricec5b0cb32010-03-01 15:57:42 -08001178 # this is a cross-build.
1179 echo i586-pc-msdosdjgpp
Damien Millerbc68f242013-04-18 11:26:25 +10001180 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001181 Intel:Mach:3*:*)
1182 echo i386-pc-mach3
Tim Rice5f707582005-06-01 19:57:45 -07001183 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001184 paragon:*:*:*)
1185 echo i860-intel-osf1
Tim Rice5f707582005-06-01 19:57:45 -07001186 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001187 i860:*:4.*:*) # i860-SVR4
1188 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
Damien Millerdc2da292020-05-08 13:31:53 +10001189 echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
Damien Millerb405d612000-06-12 23:01:02 +10001190 else # Add other i860-SVR4 vendors below as they are discovered.
Damien Millerdc2da292020-05-08 13:31:53 +10001191 echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
Damien Millerb405d612000-06-12 23:01:02 +10001192 fi
Tim Rice5f707582005-06-01 19:57:45 -07001193 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001194 mini*:CTIX:SYS*5:*)
1195 # "miniframe"
1196 echo m68010-convergent-sysv
Tim Rice5f707582005-06-01 19:57:45 -07001197 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001198 mc68k:UNIX:SYSTEM5:3.51m)
1199 echo m68k-convergent-sysv
Tim Rice5f707582005-06-01 19:57:45 -07001200 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001201 M680?0:D-NIX:5.3:*)
1202 echo m68k-diab-dnix
Tim Rice5f707582005-06-01 19:57:45 -07001203 exit ;;
1204 M68*:*:R3V[5678]*:*)
1205 test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1206 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)
Damien Millerb405d612000-06-12 23:01:02 +10001207 OS_REL=''
1208 test -r /etc/.relid \
1209 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1210 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
Damien Millerdc2da292020-05-08 13:31:53 +10001211 && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
Damien Millerb405d612000-06-12 23:01:02 +10001212 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
Damien Millerdc2da292020-05-08 13:31:53 +10001213 && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
Damien Millerb405d612000-06-12 23:01:02 +10001214 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
Damien Millerbc68f242013-04-18 11:26:25 +10001215 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1216 && { echo i486-ncr-sysv4; exit; } ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001217 NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1218 OS_REL='.3'
1219 test -r /etc/.relid \
1220 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1221 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
Damien Millerdc2da292020-05-08 13:31:53 +10001222 && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
Tim Ricec5b0cb32010-03-01 15:57:42 -08001223 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
Damien Millerdc2da292020-05-08 13:31:53 +10001224 && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
Tim Ricec5b0cb32010-03-01 15:57:42 -08001225 /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
Damien Millerdc2da292020-05-08 13:31:53 +10001226 && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001227 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001228 echo m68k-unknown-lynxos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001229 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001230 mc68030:UNIX_System_V:4.*:*)
1231 echo m68k-atari-sysv4
Tim Rice5f707582005-06-01 19:57:45 -07001232 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001233 TSUNAMI:LynxOS:2.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001234 echo sparc-unknown-lynxos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001235 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001236 rs6000:LynxOS:2.*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001237 echo rs6000-unknown-lynxos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001238 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001239 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001240 echo powerpc-unknown-lynxos"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001241 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001242 SM[BE]S:UNIX_SV:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001243 echo mips-dde-sysv"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001244 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001245 RM*:ReliantUNIX-*:*:*)
1246 echo mips-sni-sysv4
Tim Rice5f707582005-06-01 19:57:45 -07001247 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001248 RM*:SINIX-*:*:*)
1249 echo mips-sni-sysv4
Tim Rice5f707582005-06-01 19:57:45 -07001250 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001251 *:SINIX-*:*:*)
1252 if uname -p 2>/dev/null >/dev/null ; then
1253 UNAME_MACHINE=`(uname -p) 2>/dev/null`
Damien Millerdc2da292020-05-08 13:31:53 +10001254 echo "$UNAME_MACHINE"-sni-sysv4
Damien Millerb405d612000-06-12 23:01:02 +10001255 else
1256 echo ns32k-sni-sysv
1257 fi
Tim Rice5f707582005-06-01 19:57:45 -07001258 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +10001259 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1260 # says <Richard.M.Bartel@ccMail.Census.GOV>
1261 echo i586-unisys-sysv4
1262 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001263 *:UNIX_System_V:4*:FTX*)
1264 # From Gerald Hewes <hewes@openmarket.com>.
1265 # How about differentiating between stratus architectures? -djm
1266 echo hppa1.1-stratus-sysv4
Tim Rice5f707582005-06-01 19:57:45 -07001267 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001268 *:*:*:FTX*)
1269 # From seanf@swdc.stratus.com.
1270 echo i860-stratus-sysv4
Tim Rice5f707582005-06-01 19:57:45 -07001271 exit ;;
1272 i*86:VOS:*:*)
1273 # From Paul.Green@stratus.com.
Damien Millerdc2da292020-05-08 13:31:53 +10001274 echo "$UNAME_MACHINE"-stratus-vos
Tim Rice5f707582005-06-01 19:57:45 -07001275 exit ;;
Tim Rice92c1fc42002-02-18 15:18:56 -08001276 *:VOS:*:*)
1277 # From Paul.Green@stratus.com.
1278 echo hppa1.1-stratus-vos
Tim Rice5f707582005-06-01 19:57:45 -07001279 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001280 mc68*:A/UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001281 echo m68k-apple-aux"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001282 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001283 news*:NEWS-OS:6*:*)
Damien Millerb405d612000-06-12 23:01:02 +10001284 echo mips-sony-newsos6
Tim Rice5f707582005-06-01 19:57:45 -07001285 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001286 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1287 if [ -d /usr/nec ]; then
Damien Millerdc2da292020-05-08 13:31:53 +10001288 echo mips-nec-sysv"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +10001289 else
Damien Millerdc2da292020-05-08 13:31:53 +10001290 echo mips-unknown-sysv"$UNAME_RELEASE"
Damien Millerb405d612000-06-12 23:01:02 +10001291 fi
Damien Millerbc68f242013-04-18 11:26:25 +10001292 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001293 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1294 echo powerpc-be-beos
Tim Rice5f707582005-06-01 19:57:45 -07001295 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001296 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1297 echo powerpc-apple-beos
Tim Rice5f707582005-06-01 19:57:45 -07001298 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001299 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1300 echo i586-pc-beos
Tim Rice5f707582005-06-01 19:57:45 -07001301 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +10001302 BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
1303 echo i586-pc-haiku
1304 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +10001305 x86_64:Haiku:*:*)
1306 echo x86_64-unknown-haiku
1307 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001308 SX-4:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001309 echo sx4-nec-superux"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001310 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001311 SX-5:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001312 echo sx5-nec-superux"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001313 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001314 SX-6:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001315 echo sx6-nec-superux"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001316 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +10001317 SX-7:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001318 echo sx7-nec-superux"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +10001319 exit ;;
1320 SX-8:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001321 echo sx8-nec-superux"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +10001322 exit ;;
1323 SX-8R:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001324 echo sx8r-nec-superux"$UNAME_RELEASE"
Darren Tuckerc570ff72008-09-06 18:20:57 +10001325 exit ;;
Damien Miller23902e32016-08-02 10:48:04 +10001326 SX-ACE:SUPER-UX:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001327 echo sxace-nec-superux"$UNAME_RELEASE"
Damien Miller23902e32016-08-02 10:48:04 +10001328 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001329 Power*:Rhapsody:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001330 echo powerpc-apple-rhapsody"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001331 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001332 *:Rhapsody:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001333 echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001334 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001335 *:Darwin:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001336 UNAME_PROCESSOR=`uname -p`
1337 case $UNAME_PROCESSOR in
1338 unknown) UNAME_PROCESSOR=powerpc ;;
1339 esac
1340 if command -v xcode-select > /dev/null 2> /dev/null && \
1341 ! xcode-select --print-path > /dev/null 2> /dev/null ; then
1342 # Avoid executing cc if there is no toolchain installed as
1343 # cc will be a stub that puts up a graphical alert
1344 # prompting the user to install developer tools.
1345 CC_FOR_BUILD=no_compiler_found
1346 else
1347 set_cc_for_build
Damien Miller23902e32016-08-02 10:48:04 +10001348 fi
Damien Millerdc2da292020-05-08 13:31:53 +10001349 if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1350 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1351 (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1352 grep IS_64BIT_ARCH >/dev/null
1353 then
1354 case $UNAME_PROCESSOR in
1355 i386) UNAME_PROCESSOR=x86_64 ;;
1356 powerpc) UNAME_PROCESSOR=powerpc64 ;;
1357 esac
1358 fi
1359 # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1360 if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1361 (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1362 grep IS_PPC >/dev/null
1363 then
1364 UNAME_PROCESSOR=powerpc
Damien Miller23902e32016-08-02 10:48:04 +10001365 fi
1366 elif test "$UNAME_PROCESSOR" = i386 ; then
Damien Millerdc2da292020-05-08 13:31:53 +10001367 # uname -m returns i386 or x86_64
1368 UNAME_PROCESSOR=$UNAME_MACHINE
Damien Miller23902e32016-08-02 10:48:04 +10001369 fi
Damien Millerdc2da292020-05-08 13:31:53 +10001370 echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001371 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001372 *:procnto*:*:* | *:QNX:[0123456789]*:*)
Damien Millera7609f52002-07-25 14:40:22 +10001373 UNAME_PROCESSOR=`uname -p`
Damien Miller23902e32016-08-02 10:48:04 +10001374 if test "$UNAME_PROCESSOR" = x86; then
Damien Millera7609f52002-07-25 14:40:22 +10001375 UNAME_PROCESSOR=i386
Damien Millerb405d612000-06-12 23:01:02 +10001376 UNAME_MACHINE=pc
1377 fi
Damien Millerdc2da292020-05-08 13:31:53 +10001378 echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001379 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001380 *:QNX:*:4*)
1381 echo i386-pc-qnx
Tim Rice5f707582005-06-01 19:57:45 -07001382 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +10001383 NEO-*:NONSTOP_KERNEL:*:*)
1384 echo neo-tandem-nsk"$UNAME_RELEASE"
Tim Riced069c482011-01-26 12:32:12 -08001385 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +10001386 NSE-*:NONSTOP_KERNEL:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001387 echo nse-tandem-nsk"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001388 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +10001389 NSR-*:NONSTOP_KERNEL:*:*)
1390 echo nsr-tandem-nsk"$UNAME_RELEASE"
1391 exit ;;
1392 NSV-*:NONSTOP_KERNEL:*:*)
1393 echo nsv-tandem-nsk"$UNAME_RELEASE"
1394 exit ;;
1395 NSX-*:NONSTOP_KERNEL:*:*)
1396 echo nsx-tandem-nsk"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001397 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001398 *:NonStop-UX:*:*)
1399 echo mips-compaq-nonstopux
Tim Rice5f707582005-06-01 19:57:45 -07001400 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001401 BS2000:POSIX*:*:*)
1402 echo bs2000-siemens-sysv
Tim Rice5f707582005-06-01 19:57:45 -07001403 exit ;;
Damien Millerb405d612000-06-12 23:01:02 +10001404 DS/*:UNIX_System_V:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001405 echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001406 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001407 *:Plan9:*:*)
1408 # "uname -m" is not consistent, so use $cputype instead. 386
1409 # is converted to i386 for consistency with other x86
1410 # operating systems.
Damien Millerdc2da292020-05-08 13:31:53 +10001411 # shellcheck disable=SC2154
Damien Miller23902e32016-08-02 10:48:04 +10001412 if test "$cputype" = 386; then
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001413 UNAME_MACHINE=i386
1414 else
1415 UNAME_MACHINE="$cputype"
1416 fi
Damien Millerdc2da292020-05-08 13:31:53 +10001417 echo "$UNAME_MACHINE"-unknown-plan9
Tim Rice5f707582005-06-01 19:57:45 -07001418 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001419 *:TOPS-10:*:*)
1420 echo pdp10-unknown-tops10
Tim Rice5f707582005-06-01 19:57:45 -07001421 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001422 *:TENEX:*:*)
1423 echo pdp10-unknown-tenex
Tim Rice5f707582005-06-01 19:57:45 -07001424 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001425 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1426 echo pdp10-dec-tops20
Tim Rice5f707582005-06-01 19:57:45 -07001427 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001428 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1429 echo pdp10-xkl-tops20
Tim Rice5f707582005-06-01 19:57:45 -07001430 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001431 *:TOPS-20:*:*)
1432 echo pdp10-unknown-tops20
Tim Rice5f707582005-06-01 19:57:45 -07001433 exit ;;
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001434 *:ITS:*:*)
1435 echo pdp10-unknown-its
Tim Rice5f707582005-06-01 19:57:45 -07001436 exit ;;
Damien Miller752e4e62004-04-21 12:29:13 +10001437 SEI:*:*:SEIUX)
Damien Millerdc2da292020-05-08 13:31:53 +10001438 echo mips-sei-seiux"$UNAME_RELEASE"
Tim Rice5f707582005-06-01 19:57:45 -07001439 exit ;;
1440 *:DragonFly:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001441 echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
Tim Rice5f707582005-06-01 19:57:45 -07001442 exit ;;
1443 *:*VMS:*:*)
Damien Millerbc68f242013-04-18 11:26:25 +10001444 UNAME_MACHINE=`(uname -p) 2>/dev/null`
Damien Millerdc2da292020-05-08 13:31:53 +10001445 case "$UNAME_MACHINE" in
Tim Rice5f707582005-06-01 19:57:45 -07001446 A*) echo alpha-dec-vms ; exit ;;
1447 I*) echo ia64-dec-vms ; exit ;;
1448 V*) echo vax-dec-vms ; exit ;;
1449 esac ;;
1450 *:XENIX:*:SysV)
1451 echo i386-pc-xenix
1452 exit ;;
1453 i*86:skyos:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001454 echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
Tim Rice5f707582005-06-01 19:57:45 -07001455 exit ;;
Darren Tuckerc570ff72008-09-06 18:20:57 +10001456 i*86:rdos:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001457 echo "$UNAME_MACHINE"-pc-rdos
Darren Tuckerc570ff72008-09-06 18:20:57 +10001458 exit ;;
Tim Ricec5b0cb32010-03-01 15:57:42 -08001459 i*86:AROS:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001460 echo "$UNAME_MACHINE"-pc-aros
Tim Ricec5b0cb32010-03-01 15:57:42 -08001461 exit ;;
Damien Millerbc68f242013-04-18 11:26:25 +10001462 x86_64:VMkernel:*:*)
Damien Millerdc2da292020-05-08 13:31:53 +10001463 echo "$UNAME_MACHINE"-unknown-esx
Damien Millerbc68f242013-04-18 11:26:25 +10001464 exit ;;
Damien Miller23902e32016-08-02 10:48:04 +10001465 amd64:Isilon\ OneFS:*:*)
1466 echo x86_64-unknown-onefs
1467 exit ;;
Damien Millerdc2da292020-05-08 13:31:53 +10001468 *:Unleashed:*:*)
1469 echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
1470 exit ;;
1471esac
1472
1473# No uname command or uname output not recognized.
1474set_cc_for_build
1475cat > "$dummy.c" <<EOF
1476#ifdef _SEQUENT_
1477#include <sys/types.h>
1478#include <sys/utsname.h>
1479#endif
1480#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1481#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1482#include <signal.h>
1483#if defined(_SIZE_T_) || defined(SIGLOST)
1484#include <sys/utsname.h>
1485#endif
1486#endif
1487#endif
1488main ()
1489{
1490#if defined (sony)
1491#if defined (MIPSEB)
1492 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1493 I don't know.... */
1494 printf ("mips-sony-bsd\n"); exit (0);
1495#else
1496#include <sys/param.h>
1497 printf ("m68k-sony-newsos%s\n",
1498#ifdef NEWSOS4
1499 "4"
1500#else
1501 ""
1502#endif
1503 ); exit (0);
1504#endif
1505#endif
1506
1507#if defined (NeXT)
1508#if !defined (__ARCHITECTURE__)
1509#define __ARCHITECTURE__ "m68k"
1510#endif
1511 int version;
1512 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1513 if (version < 4)
1514 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1515 else
1516 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1517 exit (0);
1518#endif
1519
1520#if defined (MULTIMAX) || defined (n16)
1521#if defined (UMAXV)
1522 printf ("ns32k-encore-sysv\n"); exit (0);
1523#else
1524#if defined (CMU)
1525 printf ("ns32k-encore-mach\n"); exit (0);
1526#else
1527 printf ("ns32k-encore-bsd\n"); exit (0);
1528#endif
1529#endif
1530#endif
1531
1532#if defined (__386BSD__)
1533 printf ("i386-pc-bsd\n"); exit (0);
1534#endif
1535
1536#if defined (sequent)
1537#if defined (i386)
1538 printf ("i386-sequent-dynix\n"); exit (0);
1539#endif
1540#if defined (ns32000)
1541 printf ("ns32k-sequent-dynix\n"); exit (0);
1542#endif
1543#endif
1544
1545#if defined (_SEQUENT_)
1546 struct utsname un;
1547
1548 uname(&un);
1549 if (strncmp(un.version, "V2", 2) == 0) {
1550 printf ("i386-sequent-ptx2\n"); exit (0);
1551 }
1552 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1553 printf ("i386-sequent-ptx1\n"); exit (0);
1554 }
1555 printf ("i386-sequent-ptx\n"); exit (0);
1556#endif
1557
1558#if defined (vax)
1559#if !defined (ultrix)
1560#include <sys/param.h>
1561#if defined (BSD)
1562#if BSD == 43
1563 printf ("vax-dec-bsd4.3\n"); exit (0);
1564#else
1565#if BSD == 199006
1566 printf ("vax-dec-bsd4.3reno\n"); exit (0);
1567#else
1568 printf ("vax-dec-bsd\n"); exit (0);
1569#endif
1570#endif
1571#else
1572 printf ("vax-dec-bsd\n"); exit (0);
1573#endif
1574#else
1575#if defined(_SIZE_T_) || defined(SIGLOST)
1576 struct utsname un;
1577 uname (&un);
1578 printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1579#else
1580 printf ("vax-dec-ultrix\n"); exit (0);
1581#endif
1582#endif
1583#endif
1584#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1585#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1586#if defined(_SIZE_T_) || defined(SIGLOST)
1587 struct utsname *un;
1588 uname (&un);
1589 printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1590#else
1591 printf ("mips-dec-ultrix\n"); exit (0);
1592#endif
1593#endif
1594#endif
1595
1596#if defined (alliant) && defined (i860)
1597 printf ("i860-alliant-bsd\n"); exit (0);
1598#endif
1599
1600 exit (1);
1601}
1602EOF
1603
1604$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1605 { echo "$SYSTEM_NAME"; exit; }
1606
1607# Apollos put the system type in the environment.
1608test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1609
1610echo "$0: unable to guess system type" >&2
1611
1612case "$UNAME_MACHINE:$UNAME_SYSTEM" in
1613 mips:Linux | mips64:Linux)
1614 # If we got here on MIPS GNU/Linux, output extra information.
1615 cat >&2 <<EOF
1616
1617NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1618the system type. Please install a C compiler and try again.
1619EOF
1620 ;;
Damien Millerb405d612000-06-12 23:01:02 +10001621esac
1622
Damien Millerb405d612000-06-12 23:01:02 +10001623cat >&2 <<EOF
Damien Millerb405d612000-06-12 23:01:02 +10001624
Damien Miller23902e32016-08-02 10:48:04 +10001625This script (version $timestamp), has failed to recognize the
Damien Millerdc2da292020-05-08 13:31:53 +10001626operating system you are using. If your script is old, overwrite *all*
1627copies of config.guess and config.sub with the latest versions from:
Damien Millerb405d612000-06-12 23:01:02 +10001628
Damien Millerdc2da292020-05-08 13:31:53 +10001629 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
Tim Rice5f707582005-06-01 19:57:45 -07001630and
Damien Millerdc2da292020-05-08 13:31:53 +10001631 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1632EOF
1633
1634year=`echo $timestamp | sed 's,-.*,,'`
1635# shellcheck disable=SC2003
1636if test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
1637 cat >&2 <<EOF
Damien Millerb405d612000-06-12 23:01:02 +10001638
Damien Miller23902e32016-08-02 10:48:04 +10001639If $0 has already been updated, send the following data and any
1640information you think might be pertinent to config-patches@gnu.org to
1641provide the necessary information to handle your system.
Damien Millerb405d612000-06-12 23:01:02 +10001642
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001643config.guess timestamp = $timestamp
Damien Millerb405d612000-06-12 23:01:02 +10001644
1645uname -m = `(uname -m) 2>/dev/null || echo unknown`
1646uname -r = `(uname -r) 2>/dev/null || echo unknown`
1647uname -s = `(uname -s) 2>/dev/null || echo unknown`
1648uname -v = `(uname -v) 2>/dev/null || echo unknown`
1649
1650/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1651/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1652
1653hostinfo = `(hostinfo) 2>/dev/null`
1654/bin/universe = `(/bin/universe) 2>/dev/null`
1655/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1656/bin/arch = `(/bin/arch) 2>/dev/null`
1657/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1658/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1659
Damien Millerdc2da292020-05-08 13:31:53 +10001660UNAME_MACHINE = "$UNAME_MACHINE"
1661UNAME_RELEASE = "$UNAME_RELEASE"
1662UNAME_SYSTEM = "$UNAME_SYSTEM"
1663UNAME_VERSION = "$UNAME_VERSION"
Damien Millerb405d612000-06-12 23:01:02 +10001664EOF
Damien Millerdc2da292020-05-08 13:31:53 +10001665fi
Damien Millerb405d612000-06-12 23:01:02 +10001666
1667exit 1
1668
1669# Local variables:
Damien Millerdc2da292020-05-08 13:31:53 +10001670# eval: (add-hook 'before-save-hook 'time-stamp)
Damien Miller5bf5f2c2001-05-06 10:54:15 +10001671# time-stamp-start: "timestamp='"
Damien Millerb405d612000-06-12 23:01:02 +10001672# time-stamp-format: "%:y-%02m-%02d"
1673# time-stamp-end: "'"
1674# End: