xref: /trunk/main/config.guess (revision 09be380f1ebba053dbf269468ff884f5d26ce1e4)
1cdf0e10cSrcweir#! /bin/sh
2cdf0e10cSrcweir# Attempt to guess a canonical system name.
31adde547Smseidel#   Copyright 1992-2021 Free Software Foundation, Inc.
4cdf0e10cSrcweir
5*09be380fSmseidel# shellcheck disable=SC2006,SC2268 # see below for rationale
6*09be380fSmseidel
7*09be380fSmseideltimestamp='2021-11-30'
8cdf0e10cSrcweir
9cdf0e10cSrcweir# This file is free software; you can redistribute it and/or modify it
10cdf0e10cSrcweir# under the terms of the GNU General Public License as published by
11ee1eb700SMatthias Seidel# the Free Software Foundation; either version 3 of the License, or
12cdf0e10cSrcweir# (at your option) any later version.
13cdf0e10cSrcweir#
14cdf0e10cSrcweir# This program is distributed in the hope that it will be useful, but
15cdf0e10cSrcweir# WITHOUT ANY WARRANTY; without even the implied warranty of
16cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17cdf0e10cSrcweir# General Public License for more details.
18cdf0e10cSrcweir#
19cdf0e10cSrcweir# You should have received a copy of the GNU General Public License
20ee1eb700SMatthias Seidel# along with this program; if not, see <https://www.gnu.org/licenses/>.
21cdf0e10cSrcweir#
22cdf0e10cSrcweir# As a special exception to the GNU General Public License, if you
23cdf0e10cSrcweir# distribute this file as part of a program that contains a
24cdf0e10cSrcweir# configuration script generated by Autoconf, you may include it under
25ee1eb700SMatthias Seidel# the same distribution terms that you use for the rest of that
26ee1eb700SMatthias Seidel# program.  This Exception is an additional permission under section 7
27ee1eb700SMatthias Seidel# of the GNU General Public License, version 3 ("GPLv3").
28cdf0e10cSrcweir#
29ee1eb700SMatthias Seidel# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30cdf0e10cSrcweir#
31187b4248SPedro Giffuni# You can get the latest version of this script from:
321adde547Smseidel# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33ee1eb700SMatthias Seidel#
34ee1eb700SMatthias Seidel# Please send patches to <config-patches@gnu.org>.
35ee1eb700SMatthias Seidel
36cdf0e10cSrcweir
37*09be380fSmseidel# The "shellcheck disable" line above the timestamp inhibits complaints
38*09be380fSmseidel# about features and limitations of the classic Bourne shell that were
39*09be380fSmseidel# superseded or lifted in POSIX.  However, this script identifies a wide
40*09be380fSmseidel# variety of pre-POSIX systems that do not have POSIX shells at all, and
41*09be380fSmseidel# even some reasonably current systems (Solaris 10 as case-in-point) still
42*09be380fSmseidel# have a pre-POSIX /bin/sh.
43*09be380fSmseidel
44*09be380fSmseidel
45*09be380fSmseidelme=`echo "$0" | sed -e 's,.*/,,'`
46cdf0e10cSrcweir
47cdf0e10cSrcweirusage="\
48cdf0e10cSrcweirUsage: $0 [OPTION]
49cdf0e10cSrcweir
50cdf0e10cSrcweirOutput the configuration name of the system \`$me' is run on.
51cdf0e10cSrcweir
52ee1eb700SMatthias SeidelOptions:
53cdf0e10cSrcweir  -h, --help         print this help, then exit
54cdf0e10cSrcweir  -t, --time-stamp   print date of last modification, then exit
55cdf0e10cSrcweir  -v, --version      print version number, then exit
56cdf0e10cSrcweir
57cdf0e10cSrcweirReport bugs and patches to <config-patches@gnu.org>."
58cdf0e10cSrcweir
59cdf0e10cSrcweirversion="\
60cdf0e10cSrcweirGNU config.guess ($timestamp)
61cdf0e10cSrcweir
62cdf0e10cSrcweirOriginally written by Per Bothner.
631adde547SmseidelCopyright 1992-2021 Free Software Foundation, Inc.
64cdf0e10cSrcweir
65cdf0e10cSrcweirThis is free software; see the source for copying conditions.  There is NO
66cdf0e10cSrcweirwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67cdf0e10cSrcweir
68cdf0e10cSrcweirhelp="
69cdf0e10cSrcweirTry \`$me --help' for more information."
70cdf0e10cSrcweir
71cdf0e10cSrcweir# Parse command line
72cdf0e10cSrcweirwhile test $# -gt 0 ; do
73cdf0e10cSrcweir  case $1 in
74cdf0e10cSrcweir    --time-stamp | --time* | -t )
75187b4248SPedro Giffuni       echo "$timestamp" ; exit ;;
76cdf0e10cSrcweir    --version | -v )
77187b4248SPedro Giffuni       echo "$version" ; exit ;;
78cdf0e10cSrcweir    --help | --h* | -h )
79187b4248SPedro Giffuni       echo "$usage"; exit ;;
80cdf0e10cSrcweir    -- )     # Stop option processing
81cdf0e10cSrcweir       shift; break ;;
82cdf0e10cSrcweir    - ) # Use stdin as input.
83cdf0e10cSrcweir       break ;;
84cdf0e10cSrcweir    -* )
85cdf0e10cSrcweir       echo "$me: invalid option $1$help" >&2
86cdf0e10cSrcweir       exit 1 ;;
87cdf0e10cSrcweir    * )
88cdf0e10cSrcweir       break ;;
89cdf0e10cSrcweir  esac
90cdf0e10cSrcweirdone
91cdf0e10cSrcweir
92cdf0e10cSrcweirif test $# != 0; then
93cdf0e10cSrcweir  echo "$me: too many arguments$help" >&2
94cdf0e10cSrcweir  exit 1
95cdf0e10cSrcweirfi
96cdf0e10cSrcweir
97*09be380fSmseidel# Just in case it came from the environment.
98*09be380fSmseidelGUESS=
99*09be380fSmseidel
100cdf0e10cSrcweir# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101cdf0e10cSrcweir# compiler to aid in system detection is discouraged as it requires
102cdf0e10cSrcweir# temporary files to be created and, as you can see below, it is a
103cdf0e10cSrcweir# headache to deal with in a portable fashion.
104cdf0e10cSrcweir
105cdf0e10cSrcweir# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106cdf0e10cSrcweir# use `HOST_CC' if defined, but it is deprecated.
107cdf0e10cSrcweir
108cdf0e10cSrcweir# Portable tmp directory creation inspired by the Autoconf team.
109cdf0e10cSrcweir
1101aeda8abSMatthias Seideltmp=
1111aeda8abSMatthias Seidel# shellcheck disable=SC2172
1123ace3152SMatthias Seideltrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1131aeda8abSMatthias Seidel
1141aeda8abSMatthias Seidelset_cc_for_build() {
115859e76afSmseidel    # prevent multiple calls if $tmp is already set
116859e76afSmseidel    test "$tmp" && return 0
1171aeda8abSMatthias Seidel    : "${TMPDIR=/tmp}"
118*09be380fSmseidel    # shellcheck disable=SC2039,SC3028
119*09be380fSmseidel    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1201aeda8abSMatthias Seidel    { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1211aeda8abSMatthias Seidel    { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1221aeda8abSMatthias Seidel    { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1231aeda8abSMatthias Seidel    dummy=$tmp/dummy
1241aeda8abSMatthias Seidel    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1251aeda8abSMatthias Seidel    ,,)    echo "int x;" > "$dummy.c"
1261aeda8abSMatthias Seidel           for driver in cc gcc c89 c99 ; do
1271aeda8abSMatthias Seidel           if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128*09be380fSmseidel               CC_FOR_BUILD=$driver
1291aeda8abSMatthias Seidel               break
1301aeda8abSMatthias Seidel           fi
1311aeda8abSMatthias Seidel           done
132cdf0e10cSrcweir           if test x"$CC_FOR_BUILD" = x ; then
1331aeda8abSMatthias Seidel           CC_FOR_BUILD=no_compiler_found
134cdf0e10cSrcweir           fi
135cdf0e10cSrcweir           ;;
136cdf0e10cSrcweir    ,,*)   CC_FOR_BUILD=$CC ;;
137cdf0e10cSrcweir    ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1381aeda8abSMatthias Seidel    esac
1391aeda8abSMatthias Seidel}
140cdf0e10cSrcweir
141cdf0e10cSrcweir# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142cdf0e10cSrcweir# (ghazi@noc.rutgers.edu 1994-08-24)
1431aeda8abSMatthias Seidelif test -f /.attbin/uname ; then
144cdf0e10cSrcweir    PATH=$PATH:/.attbin ; export PATH
145cdf0e10cSrcweirfi
146cdf0e10cSrcweir
147*09be380fSmseidelUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148*09be380fSmseidelUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149*09be380fSmseidelUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150*09be380fSmseidelUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151cdf0e10cSrcweir
152*09be380fSmseidelcase $UNAME_SYSTEM in
153ee1eb700SMatthias SeidelLinux|GNU|GNU/*)
1541adde547Smseidel    LIBC=unknown
155ee1eb700SMatthias Seidel
1561aeda8abSMatthias Seidel    set_cc_for_build
1571a5d95c5SMatthias Seidel    cat <<-EOF > "$dummy.c"
158ee1eb700SMatthias Seidel    #include <features.h>
159ee1eb700SMatthias Seidel    #if defined(__UCLIBC__)
160ee1eb700SMatthias Seidel    LIBC=uclibc
161ee1eb700SMatthias Seidel    #elif defined(__dietlibc__)
162ee1eb700SMatthias Seidel    LIBC=dietlibc
1631adde547Smseidel    #elif defined(__GLIBC__)
1641adde547Smseidel    LIBC=gnu
165ee1eb700SMatthias Seidel    #else
1665bf8527aSmseidel    #include <stdarg.h>
1671adde547Smseidel    /* First heuristic to detect musl libc.  */
1685bf8527aSmseidel    #ifdef __DEFINED_va_list
1695bf8527aSmseidel    LIBC=musl
170ee1eb700SMatthias Seidel    #endif
1715bf8527aSmseidel    #endif
172ee1eb700SMatthias Seidel    EOF
173*09be380fSmseidel    cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174*09be380fSmseidel    eval "$cc_set_libc"
1751adde547Smseidel
1761adde547Smseidel    # Second heuristic to detect musl libc.
1771adde547Smseidel    if [ "$LIBC" = unknown ] &&
1781adde547Smseidel       command -v ldd >/dev/null &&
1791adde547Smseidel       ldd --version 2>&1 | grep -q ^musl; then
1801adde547Smseidel        LIBC=musl
1811adde547Smseidel    fi
1821adde547Smseidel
1831adde547Smseidel    # If the system lacks a compiler, then just pick glibc.
1841adde547Smseidel    # We could probably try harder.
1851adde547Smseidel    if [ "$LIBC" = unknown ]; then
1861adde547Smseidel        LIBC=gnu
1871adde547Smseidel    fi
188ee1eb700SMatthias Seidel    ;;
189ee1eb700SMatthias Seidelesac
190ee1eb700SMatthias Seidel
191cdf0e10cSrcweir# Note: order is significant - the case branches are not exclusive.
192cdf0e10cSrcweir
193*09be380fSmseidelcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194cdf0e10cSrcweir    *:NetBSD:*:*)
195cdf0e10cSrcweir    # NetBSD (nbsd) targets should (where applicable) match one or
196ee1eb700SMatthias Seidel    # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197cdf0e10cSrcweir    # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198cdf0e10cSrcweir    # switched to ELF, *-*-netbsd* would select the old
199cdf0e10cSrcweir    # object file format.  This provides both forward
200cdf0e10cSrcweir    # compatibility and a consistent mechanism for selecting the
201cdf0e10cSrcweir    # object file format.
202cdf0e10cSrcweir    #
203cdf0e10cSrcweir    # Note: NetBSD doesn't particularly care about the vendor
204cdf0e10cSrcweir    # portion of the name.  We always set it to "unknown".
205*09be380fSmseidel    UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
2061adde547Smseidel        /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2071adde547Smseidel        /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208*09be380fSmseidel        echo unknown)`
209*09be380fSmseidel    case $UNAME_MACHINE_ARCH in
2105bf8527aSmseidel        aarch64eb) machine=aarch64_be-unknown ;;
211cdf0e10cSrcweir        armeb) machine=armeb-unknown ;;
212cdf0e10cSrcweir        arm*) machine=arm-unknown ;;
213cdf0e10cSrcweir        sh3el) machine=shl-unknown ;;
214cdf0e10cSrcweir        sh3eb) machine=sh-unknown ;;
215187b4248SPedro Giffuni        sh5el) machine=sh5le-unknown ;;
216ee1eb700SMatthias Seidel        earmv*)
217*09be380fSmseidel        arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218*09be380fSmseidel        endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219*09be380fSmseidel        machine=${arch}${endian}-unknown
220ee1eb700SMatthias Seidel        ;;
221*09be380fSmseidel        *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222cdf0e10cSrcweir    esac
223cdf0e10cSrcweir    # The Operating System including object format, if it has switched
224ee1eb700SMatthias Seidel    # to ELF recently (or will in the future) and ABI.
225*09be380fSmseidel    case $UNAME_MACHINE_ARCH in
226ee1eb700SMatthias Seidel        earm*)
227ee1eb700SMatthias Seidel        os=netbsdelf
228ee1eb700SMatthias Seidel        ;;
229cdf0e10cSrcweir        arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2301aeda8abSMatthias Seidel        set_cc_for_build
231cdf0e10cSrcweir        if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232187b4248SPedro Giffuni            | grep -q __ELF__
233cdf0e10cSrcweir        then
234cdf0e10cSrcweir            # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235cdf0e10cSrcweir            # Return netbsd for either.  FIX?
236cdf0e10cSrcweir            os=netbsd
237cdf0e10cSrcweir        else
238cdf0e10cSrcweir            os=netbsdelf
239cdf0e10cSrcweir        fi
240cdf0e10cSrcweir        ;;
241cdf0e10cSrcweir        *)
242cdf0e10cSrcweir        os=netbsd
243cdf0e10cSrcweir        ;;
244cdf0e10cSrcweir    esac
245ee1eb700SMatthias Seidel    # Determine ABI tags.
246*09be380fSmseidel    case $UNAME_MACHINE_ARCH in
247ee1eb700SMatthias Seidel        earm*)
248ee1eb700SMatthias Seidel        expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249*09be380fSmseidel        abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250ee1eb700SMatthias Seidel        ;;
251ee1eb700SMatthias Seidel    esac
252cdf0e10cSrcweir    # The OS release
253cdf0e10cSrcweir    # Debian GNU/NetBSD machines have a different userland, and
254cdf0e10cSrcweir    # thus, need a distinct triplet. However, they do not need
255cdf0e10cSrcweir    # kernel version information, so it can be replaced with a
256cdf0e10cSrcweir    # suitable tag, in the style of linux-gnu.
257*09be380fSmseidel    case $UNAME_VERSION in
258cdf0e10cSrcweir        Debian*)
259cdf0e10cSrcweir        release='-gnu'
260cdf0e10cSrcweir        ;;
261cdf0e10cSrcweir        *)
262*09be380fSmseidel        release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263cdf0e10cSrcweir        ;;
264cdf0e10cSrcweir    esac
265cdf0e10cSrcweir    # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266cdf0e10cSrcweir    # contains redundant information, the shorter form:
267cdf0e10cSrcweir    # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268*09be380fSmseidel    GUESS=$machine-${os}${release}${abi-}
269*09be380fSmseidel    ;;
270ee1eb700SMatthias Seidel    *:Bitrig:*:*)
271*09be380fSmseidel    UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272*09be380fSmseidel    GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273*09be380fSmseidel    ;;
274cdf0e10cSrcweir    *:OpenBSD:*:*)
275*09be380fSmseidel    UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276*09be380fSmseidel    GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277*09be380fSmseidel    ;;
278*09be380fSmseidel    *:SecBSD:*:*)
279*09be380fSmseidel    UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280*09be380fSmseidel    GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281*09be380fSmseidel    ;;
282ee1eb700SMatthias Seidel    *:LibertyBSD:*:*)
283*09be380fSmseidel    UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284*09be380fSmseidel    GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285*09be380fSmseidel    ;;
286ee1eb700SMatthias Seidel    *:MidnightBSD:*:*)
287*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288*09be380fSmseidel    ;;
289187b4248SPedro Giffuni    *:ekkoBSD:*:*)
290*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291*09be380fSmseidel    ;;
292187b4248SPedro Giffuni    *:SolidBSD:*:*)
293*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294*09be380fSmseidel    ;;
295859e76afSmseidel    *:OS108:*:*)
296*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297*09be380fSmseidel    ;;
298187b4248SPedro Giffuni    macppc:MirBSD:*:*)
299*09be380fSmseidel    GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300*09be380fSmseidel    ;;
301187b4248SPedro Giffuni    *:MirBSD:*:*)
302*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303*09be380fSmseidel    ;;
304ee1eb700SMatthias Seidel    *:Sortix:*:*)
305*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-sortix
306*09be380fSmseidel    ;;
307859e76afSmseidel    *:Twizzler:*:*)
308*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-twizzler
309*09be380fSmseidel    ;;
310ee1eb700SMatthias Seidel    *:Redox:*:*)
311*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-redox
312*09be380fSmseidel    ;;
31386278b1cSMatthias Seidel    mips:OSF1:*.*)
314*09be380fSmseidel    GUESS=mips-dec-osf1
315*09be380fSmseidel    ;;
316cdf0e10cSrcweir    alpha:OSF1:*:*)
317*09be380fSmseidel    # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318*09be380fSmseidel    trap '' 0
319187b4248SPedro Giffuni    case $UNAME_RELEASE in
320187b4248SPedro Giffuni    *4.0)
321*09be380fSmseidel        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322187b4248SPedro Giffuni        ;;
323187b4248SPedro Giffuni    *5.*)
324*09be380fSmseidel        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325187b4248SPedro Giffuni        ;;
326187b4248SPedro Giffuni    esac
327cdf0e10cSrcweir    # According to Compaq, /usr/sbin/psrinfo has been available on
328cdf0e10cSrcweir    # OSF/1 and Tru64 systems produced since 1995.  I hope that
329cdf0e10cSrcweir    # covers most systems running today.  This code pipes the CPU
330cdf0e10cSrcweir    # types through head -n 1, so we only detect the type of CPU 0.
331*09be380fSmseidel    ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332*09be380fSmseidel    case $ALPHA_CPU_TYPE in
333cdf0e10cSrcweir        "EV4 (21064)")
334ee1eb700SMatthias Seidel        UNAME_MACHINE=alpha ;;
335cdf0e10cSrcweir        "EV4.5 (21064)")
336ee1eb700SMatthias Seidel        UNAME_MACHINE=alpha ;;
337cdf0e10cSrcweir        "LCA4 (21066/21068)")
338ee1eb700SMatthias Seidel        UNAME_MACHINE=alpha ;;
339cdf0e10cSrcweir        "EV5 (21164)")
340ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev5 ;;
341cdf0e10cSrcweir        "EV5.6 (21164A)")
342ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev56 ;;
343cdf0e10cSrcweir        "EV5.6 (21164PC)")
344ee1eb700SMatthias Seidel        UNAME_MACHINE=alphapca56 ;;
345cdf0e10cSrcweir        "EV5.7 (21164PC)")
346ee1eb700SMatthias Seidel        UNAME_MACHINE=alphapca57 ;;
347cdf0e10cSrcweir        "EV6 (21264)")
348ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev6 ;;
349cdf0e10cSrcweir        "EV6.7 (21264A)")
350ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev67 ;;
351cdf0e10cSrcweir        "EV6.8CB (21264C)")
352ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev68 ;;
353cdf0e10cSrcweir        "EV6.8AL (21264B)")
354ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev68 ;;
355cdf0e10cSrcweir        "EV6.8CX (21264D)")
356ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev68 ;;
357cdf0e10cSrcweir        "EV6.9A (21264/EV69A)")
358ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev69 ;;
359cdf0e10cSrcweir        "EV7 (21364)")
360ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev7 ;;
361cdf0e10cSrcweir        "EV7.9 (21364A)")
362ee1eb700SMatthias Seidel        UNAME_MACHINE=alphaev79 ;;
363cdf0e10cSrcweir    esac
364187b4248SPedro Giffuni    # A Pn.n version is a patched version.
365cdf0e10cSrcweir    # A Vn.n version is a released version.
366cdf0e10cSrcweir    # A Tn.n version is a released field test version.
367cdf0e10cSrcweir    # A Xn.n version is an unreleased experimental baselevel.
368cdf0e10cSrcweir    # 1.2 uses "1.2" for uname -r.
369*09be380fSmseidel    OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370*09be380fSmseidel    GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371*09be380fSmseidel    ;;
372cdf0e10cSrcweir    Amiga*:UNIX_System_V:4.0:*)
373*09be380fSmseidel    GUESS=m68k-unknown-sysv4
374*09be380fSmseidel    ;;
375cdf0e10cSrcweir    *:[Aa]miga[Oo][Ss]:*:*)
376*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-amigaos
377*09be380fSmseidel    ;;
378cdf0e10cSrcweir    *:[Mm]orph[Oo][Ss]:*:*)
379*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-morphos
380*09be380fSmseidel    ;;
381cdf0e10cSrcweir    *:OS/390:*:*)
382*09be380fSmseidel    GUESS=i370-ibm-openedition
383*09be380fSmseidel    ;;
384187b4248SPedro Giffuni    *:z/VM:*:*)
385*09be380fSmseidel    GUESS=s390-ibm-zvmoe
386*09be380fSmseidel    ;;
387187b4248SPedro Giffuni    *:OS400:*:*)
388*09be380fSmseidel    GUESS=powerpc-ibm-os400
389*09be380fSmseidel    ;;
390cdf0e10cSrcweir    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391*09be380fSmseidel    GUESS=arm-acorn-riscix$UNAME_RELEASE
392*09be380fSmseidel    ;;
393ee1eb700SMatthias Seidel    arm*:riscos:*:*|arm*:RISCOS:*:*)
394*09be380fSmseidel    GUESS=arm-unknown-riscos
395*09be380fSmseidel    ;;
396cdf0e10cSrcweir    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397*09be380fSmseidel    GUESS=hppa1.1-hitachi-hiuxmpp
398*09be380fSmseidel    ;;
399cdf0e10cSrcweir    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400cdf0e10cSrcweir    # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401*09be380fSmseidel    case `(/bin/universe) 2>/dev/null` in
402*09be380fSmseidel        att) GUESS=pyramid-pyramid-sysv3 ;;
403*09be380fSmseidel        *)   GUESS=pyramid-pyramid-bsd   ;;
404*09be380fSmseidel    esac
405*09be380fSmseidel    ;;
406cdf0e10cSrcweir    NILE*:*:*:dcosx)
407*09be380fSmseidel    GUESS=pyramid-pyramid-svr4
408*09be380fSmseidel    ;;
409cdf0e10cSrcweir    DRS?6000:unix:4.0:6*)
410*09be380fSmseidel    GUESS=sparc-icl-nx6
411*09be380fSmseidel    ;;
412187b4248SPedro Giffuni    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413*09be380fSmseidel    case `/usr/bin/uname -p` in
414*09be380fSmseidel        sparc) GUESS=sparc-icl-nx7 ;;
415*09be380fSmseidel    esac
416*09be380fSmseidel    ;;
417187b4248SPedro Giffuni    s390x:SunOS:*:*)
418*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419*09be380fSmseidel    GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420*09be380fSmseidel    ;;
421cdf0e10cSrcweir    sun4H:SunOS:5.*:*)
422*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423*09be380fSmseidel    GUESS=sparc-hal-solaris2$SUN_REL
424*09be380fSmseidel    ;;
425cdf0e10cSrcweir    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427*09be380fSmseidel    GUESS=sparc-sun-solaris2$SUN_REL
428*09be380fSmseidel    ;;
429187b4248SPedro Giffuni    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430*09be380fSmseidel    GUESS=i386-pc-auroraux$UNAME_RELEASE
431*09be380fSmseidel    ;;
432187b4248SPedro Giffuni    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4333ace3152SMatthias Seidel    set_cc_for_build
4343ace3152SMatthias Seidel    SUN_ARCH=i386
4353ace3152SMatthias Seidel    # If there is a compiler, see if it is configured for 64-bit objects.
4363ace3152SMatthias Seidel    # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4373ace3152SMatthias Seidel    # This test works for both compilers.
4385bf8527aSmseidel    if test "$CC_FOR_BUILD" != no_compiler_found; then
4393ace3152SMatthias Seidel        if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440*09be380fSmseidel        (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
4413ace3152SMatthias Seidel        grep IS_64BIT_ARCH >/dev/null
4423ace3152SMatthias Seidel        then
4433ace3152SMatthias Seidel        SUN_ARCH=x86_64
4443ace3152SMatthias Seidel        fi
4453ace3152SMatthias Seidel    fi
446*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447*09be380fSmseidel    GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448*09be380fSmseidel    ;;
449cdf0e10cSrcweir    sun4*:SunOS:6*:*)
450cdf0e10cSrcweir    # According to config.sub, this is the proper way to canonicalize
451cdf0e10cSrcweir    # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452cdf0e10cSrcweir    # it's likely to be more like Solaris than SunOS4.
453*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454*09be380fSmseidel    GUESS=sparc-sun-solaris3$SUN_REL
455*09be380fSmseidel    ;;
456cdf0e10cSrcweir    sun4*:SunOS:*:*)
457*09be380fSmseidel    case `/usr/bin/arch -k` in
458cdf0e10cSrcweir        Series*|S4*)
459*09be380fSmseidel        UNAME_RELEASE=`uname -v`
460cdf0e10cSrcweir        ;;
461cdf0e10cSrcweir    esac
462cdf0e10cSrcweir    # Japanese Language versions have a version number like `4.1.3-JL'.
463*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464*09be380fSmseidel    GUESS=sparc-sun-sunos$SUN_REL
465*09be380fSmseidel    ;;
466cdf0e10cSrcweir    sun3*:SunOS:*:*)
467*09be380fSmseidel    GUESS=m68k-sun-sunos$UNAME_RELEASE
468*09be380fSmseidel    ;;
469cdf0e10cSrcweir    sun*:*:4.2BSD:*)
470*09be380fSmseidel    UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4711a5d95c5SMatthias Seidel    test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472*09be380fSmseidel    case `/bin/arch` in
473cdf0e10cSrcweir        sun3)
474*09be380fSmseidel        GUESS=m68k-sun-sunos$UNAME_RELEASE
475cdf0e10cSrcweir        ;;
476cdf0e10cSrcweir        sun4)
477*09be380fSmseidel        GUESS=sparc-sun-sunos$UNAME_RELEASE
478cdf0e10cSrcweir        ;;
479cdf0e10cSrcweir    esac
480*09be380fSmseidel    ;;
481cdf0e10cSrcweir    aushp:SunOS:*:*)
482*09be380fSmseidel    GUESS=sparc-auspex-sunos$UNAME_RELEASE
483*09be380fSmseidel    ;;
484cdf0e10cSrcweir    # The situation for MiNT is a little confusing.  The machine name
485cdf0e10cSrcweir    # can be virtually everything (everything which is not
486cdf0e10cSrcweir    # "atarist" or "atariste" at least should have a processor
487cdf0e10cSrcweir    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488cdf0e10cSrcweir    # to the lowercase version "mint" (or "freemint").  Finally
489cdf0e10cSrcweir    # the system name "TOS" denotes a system which is actually not
490cdf0e10cSrcweir    # MiNT.  But MiNT is downward compatible to TOS, so this should
491cdf0e10cSrcweir    # be no problem.
492cdf0e10cSrcweir    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493*09be380fSmseidel    GUESS=m68k-atari-mint$UNAME_RELEASE
494*09be380fSmseidel    ;;
495cdf0e10cSrcweir    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496*09be380fSmseidel    GUESS=m68k-atari-mint$UNAME_RELEASE
497*09be380fSmseidel    ;;
498cdf0e10cSrcweir    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499*09be380fSmseidel    GUESS=m68k-atari-mint$UNAME_RELEASE
500*09be380fSmseidel    ;;
501cdf0e10cSrcweir    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502*09be380fSmseidel    GUESS=m68k-milan-mint$UNAME_RELEASE
503*09be380fSmseidel    ;;
504cdf0e10cSrcweir    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505*09be380fSmseidel    GUESS=m68k-hades-mint$UNAME_RELEASE
506*09be380fSmseidel    ;;
507cdf0e10cSrcweir    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508*09be380fSmseidel    GUESS=m68k-unknown-mint$UNAME_RELEASE
509*09be380fSmseidel    ;;
510187b4248SPedro Giffuni    m68k:machten:*:*)
511*09be380fSmseidel    GUESS=m68k-apple-machten$UNAME_RELEASE
512*09be380fSmseidel    ;;
513cdf0e10cSrcweir    powerpc:machten:*:*)
514*09be380fSmseidel    GUESS=powerpc-apple-machten$UNAME_RELEASE
515*09be380fSmseidel    ;;
516cdf0e10cSrcweir    RISC*:Mach:*:*)
517*09be380fSmseidel    GUESS=mips-dec-mach_bsd4.3
518*09be380fSmseidel    ;;
519cdf0e10cSrcweir    RISC*:ULTRIX:*:*)
520*09be380fSmseidel    GUESS=mips-dec-ultrix$UNAME_RELEASE
521*09be380fSmseidel    ;;
522cdf0e10cSrcweir    VAX*:ULTRIX*:*:*)
523*09be380fSmseidel    GUESS=vax-dec-ultrix$UNAME_RELEASE
524*09be380fSmseidel    ;;
525cdf0e10cSrcweir    2020:CLIX:*:* | 2430:CLIX:*:*)
526*09be380fSmseidel    GUESS=clipper-intergraph-clix$UNAME_RELEASE
527*09be380fSmseidel    ;;
528cdf0e10cSrcweir    mips:*:*:UMIPS | mips:*:*:RISCos)
5291aeda8abSMatthias Seidel    set_cc_for_build
5301a5d95c5SMatthias Seidel    sed 's/^    //' << EOF > "$dummy.c"
531cdf0e10cSrcweir#ifdef __cplusplus
532cdf0e10cSrcweir#include <stdio.h>  /* for printf() prototype */
533cdf0e10cSrcweir    int main (int argc, char *argv[]) {
534cdf0e10cSrcweir#else
535cdf0e10cSrcweir    int main (argc, argv) int argc; char *argv[]; {
536cdf0e10cSrcweir#endif
537cdf0e10cSrcweir    #if defined (host_mips) && defined (MIPSEB)
538cdf0e10cSrcweir    #if defined (SYSTYPE_SYSV)
539ee1eb700SMatthias Seidel      printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540cdf0e10cSrcweir    #endif
541cdf0e10cSrcweir    #if defined (SYSTYPE_SVR4)
542ee1eb700SMatthias Seidel      printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543cdf0e10cSrcweir    #endif
544cdf0e10cSrcweir    #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545ee1eb700SMatthias Seidel      printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546cdf0e10cSrcweir    #endif
547cdf0e10cSrcweir    #endif
548cdf0e10cSrcweir      exit (-1);
549cdf0e10cSrcweir    }
550cdf0e10cSrcweirEOF
5511a5d95c5SMatthias Seidel    $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552*09be380fSmseidel      dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553*09be380fSmseidel      SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554187b4248SPedro Giffuni        { echo "$SYSTEM_NAME"; exit; }
555*09be380fSmseidel    GUESS=mips-mips-riscos$UNAME_RELEASE
556*09be380fSmseidel    ;;
557cdf0e10cSrcweir    Motorola:PowerMAX_OS:*:*)
558*09be380fSmseidel    GUESS=powerpc-motorola-powermax
559*09be380fSmseidel    ;;
560cdf0e10cSrcweir    Motorola:*:4.3:PL8-*)
561*09be380fSmseidel    GUESS=powerpc-harris-powermax
562*09be380fSmseidel    ;;
563cdf0e10cSrcweir    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564*09be380fSmseidel    GUESS=powerpc-harris-powermax
565*09be380fSmseidel    ;;
566cdf0e10cSrcweir    Night_Hawk:Power_UNIX:*:*)
567*09be380fSmseidel    GUESS=powerpc-harris-powerunix
568*09be380fSmseidel    ;;
569cdf0e10cSrcweir    m88k:CX/UX:7*:*)
570*09be380fSmseidel    GUESS=m88k-harris-cxux7
571*09be380fSmseidel    ;;
572cdf0e10cSrcweir    m88k:*:4*:R4*)
573*09be380fSmseidel    GUESS=m88k-motorola-sysv4
574*09be380fSmseidel    ;;
575cdf0e10cSrcweir    m88k:*:3*:R3*)
576*09be380fSmseidel    GUESS=m88k-motorola-sysv3
577*09be380fSmseidel    ;;
578cdf0e10cSrcweir    AViiON:dgux:*:*)
579cdf0e10cSrcweir    # DG/UX returns AViiON for all architectures
580*09be380fSmseidel    UNAME_PROCESSOR=`/usr/bin/uname -p`
5815bf8527aSmseidel    if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582cdf0e10cSrcweir    then
5835bf8527aSmseidel        if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
5845bf8527aSmseidel           test "$TARGET_BINARY_INTERFACE"x = x
585cdf0e10cSrcweir        then
586*09be380fSmseidel        GUESS=m88k-dg-dgux$UNAME_RELEASE
587cdf0e10cSrcweir        else
588*09be380fSmseidel        GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589cdf0e10cSrcweir        fi
590cdf0e10cSrcweir    else
591*09be380fSmseidel        GUESS=i586-dg-dgux$UNAME_RELEASE
592cdf0e10cSrcweir    fi
593*09be380fSmseidel    ;;
594cdf0e10cSrcweir    M88*:DolphinOS:*:*) # DolphinOS (SVR3)
595*09be380fSmseidel    GUESS=m88k-dolphin-sysv3
596*09be380fSmseidel    ;;
597cdf0e10cSrcweir    M88*:*:R3*:*)
598cdf0e10cSrcweir    # Delta 88k system running SVR3
599*09be380fSmseidel    GUESS=m88k-motorola-sysv3
600*09be380fSmseidel    ;;
601cdf0e10cSrcweir    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602*09be380fSmseidel    GUESS=m88k-tektronix-sysv3
603*09be380fSmseidel    ;;
604cdf0e10cSrcweir    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605*09be380fSmseidel    GUESS=m68k-tektronix-bsd
606*09be380fSmseidel    ;;
607cdf0e10cSrcweir    *:IRIX*:*:*)
608*09be380fSmseidel    IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609*09be380fSmseidel    GUESS=mips-sgi-irix$IRIX_REL
610*09be380fSmseidel    ;;
611cdf0e10cSrcweir    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612*09be380fSmseidel    GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613*09be380fSmseidel    ;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614cdf0e10cSrcweir    i*86:AIX:*:*)
615*09be380fSmseidel    GUESS=i386-ibm-aix
616*09be380fSmseidel    ;;
617cdf0e10cSrcweir    ia64:AIX:*:*)
6185bf8527aSmseidel    if test -x /usr/bin/oslevel ; then
619*09be380fSmseidel        IBM_REV=`/usr/bin/oslevel`
620cdf0e10cSrcweir    else
621*09be380fSmseidel        IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622cdf0e10cSrcweir    fi
623*09be380fSmseidel    GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624*09be380fSmseidel    ;;
625cdf0e10cSrcweir    *:AIX:2:3)
626cdf0e10cSrcweir    if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
6271aeda8abSMatthias Seidel        set_cc_for_build
6281a5d95c5SMatthias Seidel        sed 's/^        //' << EOF > "$dummy.c"
629cdf0e10cSrcweir        #include <sys/systemcfg.h>
630cdf0e10cSrcweir
631cdf0e10cSrcweir        main()
632cdf0e10cSrcweir            {
633cdf0e10cSrcweir            if (!__power_pc())
634cdf0e10cSrcweir                exit(1);
635cdf0e10cSrcweir            puts("powerpc-ibm-aix3.2.5");
636cdf0e10cSrcweir            exit(0);
637cdf0e10cSrcweir            }
638cdf0e10cSrcweirEOF
639*09be380fSmseidel        if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640187b4248SPedro Giffuni        then
641*09be380fSmseidel            GUESS=$SYSTEM_NAME
642187b4248SPedro Giffuni        else
643*09be380fSmseidel            GUESS=rs6000-ibm-aix3.2.5
644187b4248SPedro Giffuni        fi
645cdf0e10cSrcweir    elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646*09be380fSmseidel        GUESS=rs6000-ibm-aix3.2.4
647cdf0e10cSrcweir    else
648*09be380fSmseidel        GUESS=rs6000-ibm-aix3.2
649cdf0e10cSrcweir    fi
650*09be380fSmseidel    ;;
651ee1eb700SMatthias Seidel    *:AIX:*:[4567])
652*09be380fSmseidel    IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6531a5d95c5SMatthias Seidel    if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654cdf0e10cSrcweir        IBM_ARCH=rs6000
655cdf0e10cSrcweir    else
656cdf0e10cSrcweir        IBM_ARCH=powerpc
657cdf0e10cSrcweir    fi
6585bf8527aSmseidel    if test -x /usr/bin/lslpp ; then
659*09be380fSmseidel        IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660*09be380fSmseidel               awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661cdf0e10cSrcweir    else
662*09be380fSmseidel        IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663cdf0e10cSrcweir    fi
664*09be380fSmseidel    GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665*09be380fSmseidel    ;;
666cdf0e10cSrcweir    *:AIX:*:*)
667*09be380fSmseidel    GUESS=rs6000-ibm-aix
668*09be380fSmseidel    ;;
669ee1eb700SMatthias Seidel    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670*09be380fSmseidel    GUESS=romp-ibm-bsd4.4
671*09be380fSmseidel    ;;
672cdf0e10cSrcweir    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673*09be380fSmseidel    GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674*09be380fSmseidel    ;;                                  # report: romp-ibm BSD 4.3
675cdf0e10cSrcweir    *:BOSX:*:*)
676*09be380fSmseidel    GUESS=rs6000-bull-bosx
677*09be380fSmseidel    ;;
678cdf0e10cSrcweir    DPX/2?00:B.O.S.:*:*)
679*09be380fSmseidel    GUESS=m68k-bull-sysv3
680*09be380fSmseidel    ;;
681cdf0e10cSrcweir    9000/[34]??:4.3bsd:1.*:*)
682*09be380fSmseidel    GUESS=m68k-hp-bsd
683*09be380fSmseidel    ;;
684cdf0e10cSrcweir    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685*09be380fSmseidel    GUESS=m68k-hp-bsd4.4
686*09be380fSmseidel    ;;
687cdf0e10cSrcweir    9000/[34678]??:HP-UX:*:*)
688*09be380fSmseidel    HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689*09be380fSmseidel    case $UNAME_MACHINE in
690cdf0e10cSrcweir        9000/31?)            HP_ARCH=m68000 ;;
691cdf0e10cSrcweir        9000/[34]??)         HP_ARCH=m68k ;;
692cdf0e10cSrcweir        9000/[678][0-9][0-9])
6935bf8527aSmseidel        if test -x /usr/bin/getconf; then
694*09be380fSmseidel            sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695*09be380fSmseidel            sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696*09be380fSmseidel            case $sc_cpu_version in
697ee1eb700SMatthias Seidel              523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698ee1eb700SMatthias Seidel              528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699cdf0e10cSrcweir              532)                      # CPU_PA_RISC2_0
700*09be380fSmseidel            case $sc_kernel_bits in
701ee1eb700SMatthias Seidel              32) HP_ARCH=hppa2.0n ;;
702ee1eb700SMatthias Seidel              64) HP_ARCH=hppa2.0w ;;
703ee1eb700SMatthias Seidel              '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704cdf0e10cSrcweir            esac ;;
705cdf0e10cSrcweir            esac
706cdf0e10cSrcweir        fi
7075bf8527aSmseidel        if test "$HP_ARCH" = ""; then
7081aeda8abSMatthias Seidel            set_cc_for_build
7091a5d95c5SMatthias Seidel            sed 's/^        //' << EOF > "$dummy.c"
710cdf0e10cSrcweir
711cdf0e10cSrcweir        #define _HPUX_SOURCE
712cdf0e10cSrcweir        #include <stdlib.h>
713cdf0e10cSrcweir        #include <unistd.h>
714cdf0e10cSrcweir
715cdf0e10cSrcweir        int main ()
716cdf0e10cSrcweir        {
717cdf0e10cSrcweir        #if defined(_SC_KERNEL_BITS)
718cdf0e10cSrcweir            long bits = sysconf(_SC_KERNEL_BITS);
719cdf0e10cSrcweir        #endif
720cdf0e10cSrcweir            long cpu  = sysconf (_SC_CPU_VERSION);
721cdf0e10cSrcweir
722cdf0e10cSrcweir            switch (cpu)
723cdf0e10cSrcweir            {
724cdf0e10cSrcweir            case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725cdf0e10cSrcweir            case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726cdf0e10cSrcweir            case CPU_PA_RISC2_0:
727cdf0e10cSrcweir        #if defined(_SC_KERNEL_BITS)
728cdf0e10cSrcweir                switch (bits)
729cdf0e10cSrcweir                {
730cdf0e10cSrcweir                case 64: puts ("hppa2.0w"); break;
731cdf0e10cSrcweir                case 32: puts ("hppa2.0n"); break;
732cdf0e10cSrcweir                default: puts ("hppa2.0"); break;
733cdf0e10cSrcweir                } break;
734cdf0e10cSrcweir        #else  /* !defined(_SC_KERNEL_BITS) */
735cdf0e10cSrcweir                puts ("hppa2.0"); break;
736cdf0e10cSrcweir        #endif
737cdf0e10cSrcweir            default: puts ("hppa1.0"); break;
738cdf0e10cSrcweir            }
739cdf0e10cSrcweir            exit (0);
740cdf0e10cSrcweir        }
741cdf0e10cSrcweirEOF
742*09be380fSmseidel            (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743cdf0e10cSrcweir            test -z "$HP_ARCH" && HP_ARCH=hppa
744cdf0e10cSrcweir        fi ;;
745cdf0e10cSrcweir    esac
7465bf8527aSmseidel    if test "$HP_ARCH" = hppa2.0w
747cdf0e10cSrcweir    then
7481aeda8abSMatthias Seidel        set_cc_for_build
749187b4248SPedro Giffuni
750187b4248SPedro Giffuni        # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751187b4248SPedro Giffuni        # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752187b4248SPedro Giffuni        # generating 64-bit code.  GNU and HP use different nomenclature:
753187b4248SPedro Giffuni        #
754187b4248SPedro Giffuni        # $ CC_FOR_BUILD=cc ./config.guess
755187b4248SPedro Giffuni        # => hppa2.0w-hp-hpux11.23
756187b4248SPedro Giffuni        # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757187b4248SPedro Giffuni        # => hppa64-hp-hpux11.23
758187b4248SPedro Giffuni
759ee1eb700SMatthias Seidel        if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760187b4248SPedro Giffuni        grep -q __LP64__
761cdf0e10cSrcweir        then
762ee1eb700SMatthias Seidel        HP_ARCH=hppa2.0w
763cdf0e10cSrcweir        else
764ee1eb700SMatthias Seidel        HP_ARCH=hppa64
765cdf0e10cSrcweir        fi
766cdf0e10cSrcweir    fi
767*09be380fSmseidel    GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768*09be380fSmseidel    ;;
769cdf0e10cSrcweir    ia64:HP-UX:*:*)
770*09be380fSmseidel    HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771*09be380fSmseidel    GUESS=ia64-hp-hpux$HPUX_REV
772*09be380fSmseidel    ;;
773cdf0e10cSrcweir    3050*:HI-UX:*:*)
7741aeda8abSMatthias Seidel    set_cc_for_build
7751a5d95c5SMatthias Seidel    sed 's/^    //' << EOF > "$dummy.c"
776cdf0e10cSrcweir    #include <unistd.h>
777cdf0e10cSrcweir    int
778cdf0e10cSrcweir    main ()
779cdf0e10cSrcweir    {
780cdf0e10cSrcweir      long cpu = sysconf (_SC_CPU_VERSION);
781cdf0e10cSrcweir      /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782cdf0e10cSrcweir         true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783cdf0e10cSrcweir         results, however.  */
784cdf0e10cSrcweir      if (CPU_IS_PA_RISC (cpu))
785cdf0e10cSrcweir        {
786cdf0e10cSrcweir          switch (cpu)
787cdf0e10cSrcweir        {
788cdf0e10cSrcweir          case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789cdf0e10cSrcweir          case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790cdf0e10cSrcweir          case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791cdf0e10cSrcweir          default: puts ("hppa-hitachi-hiuxwe2"); break;
792cdf0e10cSrcweir        }
793cdf0e10cSrcweir        }
794cdf0e10cSrcweir      else if (CPU_IS_HP_MC68K (cpu))
795cdf0e10cSrcweir        puts ("m68k-hitachi-hiuxwe2");
796cdf0e10cSrcweir      else puts ("unknown-hitachi-hiuxwe2");
797cdf0e10cSrcweir      exit (0);
798cdf0e10cSrcweir    }
799cdf0e10cSrcweirEOF
800*09be380fSmseidel    $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801187b4248SPedro Giffuni        { echo "$SYSTEM_NAME"; exit; }
802*09be380fSmseidel    GUESS=unknown-hitachi-hiuxwe2
803*09be380fSmseidel    ;;
804cdf0e10cSrcweir    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805*09be380fSmseidel    GUESS=hppa1.1-hp-bsd
806*09be380fSmseidel    ;;
807cdf0e10cSrcweir    9000/8??:4.3bsd:*:*)
808*09be380fSmseidel    GUESS=hppa1.0-hp-bsd
809*09be380fSmseidel    ;;
810cdf0e10cSrcweir    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811*09be380fSmseidel    GUESS=hppa1.0-hp-mpeix
812*09be380fSmseidel    ;;
813cdf0e10cSrcweir    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814*09be380fSmseidel    GUESS=hppa1.1-hp-osf
815*09be380fSmseidel    ;;
816cdf0e10cSrcweir    hp8??:OSF1:*:*)
817*09be380fSmseidel    GUESS=hppa1.0-hp-osf
818*09be380fSmseidel    ;;
819cdf0e10cSrcweir    i*86:OSF1:*:*)
8205bf8527aSmseidel    if test -x /usr/sbin/sysversion ; then
821*09be380fSmseidel        GUESS=$UNAME_MACHINE-unknown-osf1mk
822cdf0e10cSrcweir    else
823*09be380fSmseidel        GUESS=$UNAME_MACHINE-unknown-osf1
824cdf0e10cSrcweir    fi
825*09be380fSmseidel    ;;
826cdf0e10cSrcweir    parisc*:Lites*:*:*)
827*09be380fSmseidel    GUESS=hppa1.1-hp-lites
828*09be380fSmseidel    ;;
829cdf0e10cSrcweir    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830*09be380fSmseidel    GUESS=c1-convex-bsd
831*09be380fSmseidel    ;;
832cdf0e10cSrcweir    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833cdf0e10cSrcweir    if getsysinfo -f scalar_acc
834cdf0e10cSrcweir    then echo c32-convex-bsd
835cdf0e10cSrcweir    else echo c2-convex-bsd
836cdf0e10cSrcweir    fi
837187b4248SPedro Giffuni    exit ;;
838cdf0e10cSrcweir    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839*09be380fSmseidel    GUESS=c34-convex-bsd
840*09be380fSmseidel    ;;
841cdf0e10cSrcweir    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842*09be380fSmseidel    GUESS=c38-convex-bsd
843*09be380fSmseidel    ;;
844cdf0e10cSrcweir    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845*09be380fSmseidel    GUESS=c4-convex-bsd
846*09be380fSmseidel    ;;
847cdf0e10cSrcweir    CRAY*Y-MP:*:*:*)
848*09be380fSmseidel    CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849*09be380fSmseidel    GUESS=ymp-cray-unicos$CRAY_REL
850*09be380fSmseidel    ;;
851cdf0e10cSrcweir    CRAY*[A-Z]90:*:*:*)
8521a5d95c5SMatthias Seidel    echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853cdf0e10cSrcweir    | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854cdf0e10cSrcweir          -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855cdf0e10cSrcweir          -e 's/\.[^.]*$/.X/'
856187b4248SPedro Giffuni    exit ;;
857cdf0e10cSrcweir    CRAY*TS:*:*:*)
858*09be380fSmseidel    CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859*09be380fSmseidel    GUESS=t90-cray-unicos$CRAY_REL
860*09be380fSmseidel    ;;
861cdf0e10cSrcweir    CRAY*T3E:*:*:*)
862*09be380fSmseidel    CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863*09be380fSmseidel    GUESS=alphaev5-cray-unicosmk$CRAY_REL
864*09be380fSmseidel    ;;
865cdf0e10cSrcweir    CRAY*SV1:*:*:*)
866*09be380fSmseidel    CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867*09be380fSmseidel    GUESS=sv1-cray-unicos$CRAY_REL
868*09be380fSmseidel    ;;
869cdf0e10cSrcweir    *:UNICOS/mp:*:*)
870*09be380fSmseidel    CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871*09be380fSmseidel    GUESS=craynv-cray-unicosmp$CRAY_REL
872*09be380fSmseidel    ;;
873cdf0e10cSrcweir    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874*09be380fSmseidel    FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875*09be380fSmseidel    FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876*09be380fSmseidel    FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877*09be380fSmseidel    GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878*09be380fSmseidel    ;;
879187b4248SPedro Giffuni    5000:UNIX_System_V:4.*:*)
880*09be380fSmseidel    FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881*09be380fSmseidel    FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882*09be380fSmseidel    GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883*09be380fSmseidel    ;;
884cdf0e10cSrcweir    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886*09be380fSmseidel    ;;
887cdf0e10cSrcweir    sparc*:BSD/OS:*:*)
888*09be380fSmseidel    GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889*09be380fSmseidel    ;;
890cdf0e10cSrcweir    *:BSD/OS:*:*)
891*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892*09be380fSmseidel    ;;
8931aeda8abSMatthias Seidel    arm:FreeBSD:*:*)
894*09be380fSmseidel    UNAME_PROCESSOR=`uname -p`
8951aeda8abSMatthias Seidel    set_cc_for_build
8961aeda8abSMatthias Seidel    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8971aeda8abSMatthias Seidel        | grep -q __ARM_PCS_VFP
8981aeda8abSMatthias Seidel    then
899*09be380fSmseidel        FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900*09be380fSmseidel        GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
9011aeda8abSMatthias Seidel    else
902*09be380fSmseidel        FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903*09be380fSmseidel        GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
9041aeda8abSMatthias Seidel    fi
905*09be380fSmseidel    ;;
906187b4248SPedro Giffuni    *:FreeBSD:*:*)
907*09be380fSmseidel    UNAME_PROCESSOR=`/usr/bin/uname -p`
908*09be380fSmseidel    case $UNAME_PROCESSOR in
909187b4248SPedro Giffuni        amd64)
910ee1eb700SMatthias Seidel        UNAME_PROCESSOR=x86_64 ;;
911ee1eb700SMatthias Seidel        i386)
912ee1eb700SMatthias Seidel        UNAME_PROCESSOR=i586 ;;
913187b4248SPedro Giffuni    esac
914*09be380fSmseidel    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915*09be380fSmseidel    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916*09be380fSmseidel    ;;
917cdf0e10cSrcweir    i*:CYGWIN*:*)
918*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-cygwin
919*09be380fSmseidel    ;;
920ee1eb700SMatthias Seidel    *:MINGW64*:*)
921*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-mingw64
922*09be380fSmseidel    ;;
923187b4248SPedro Giffuni    *:MINGW*:*)
924*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-mingw32
925*09be380fSmseidel    ;;
926ee1eb700SMatthias Seidel    *:MSYS*:*)
927*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-msys
928*09be380fSmseidel    ;;
929cdf0e10cSrcweir    i*:PW*:*)
930*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-pw32
931*09be380fSmseidel    ;;
932187b4248SPedro Giffuni    *:Interix*:*)
933*09be380fSmseidel    case $UNAME_MACHINE in
934187b4248SPedro Giffuni        x86)
935*09be380fSmseidel        GUESS=i586-pc-interix$UNAME_RELEASE
936*09be380fSmseidel        ;;
937187b4248SPedro Giffuni        authenticamd | genuineintel | EM64T)
938*09be380fSmseidel        GUESS=x86_64-unknown-interix$UNAME_RELEASE
939*09be380fSmseidel        ;;
940187b4248SPedro Giffuni        IA64)
941*09be380fSmseidel        GUESS=ia64-unknown-interix$UNAME_RELEASE
942*09be380fSmseidel        ;;
943187b4248SPedro Giffuni    esac ;;
944cdf0e10cSrcweir    i*:UWIN*:*)
945*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-uwin
946*09be380fSmseidel    ;;
947187b4248SPedro Giffuni    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948*09be380fSmseidel    GUESS=x86_64-pc-cygwin
949*09be380fSmseidel    ;;
950cdf0e10cSrcweir    prep*:SunOS:5.*:*)
951*09be380fSmseidel    SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952*09be380fSmseidel    GUESS=powerpcle-unknown-solaris2$SUN_REL
953*09be380fSmseidel    ;;
954cdf0e10cSrcweir    *:GNU:*:*)
955187b4248SPedro Giffuni    # the GNU system
956*09be380fSmseidel    GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957*09be380fSmseidel    GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958*09be380fSmseidel    GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959*09be380fSmseidel    ;;
960187b4248SPedro Giffuni    *:GNU/*:*:*)
961187b4248SPedro Giffuni    # other systems with GNU libc and userland
962*09be380fSmseidel    GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963*09be380fSmseidel    GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965*09be380fSmseidel    ;;
9661aeda8abSMatthias Seidel    *:Minix:*:*)
967*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-minix
968*09be380fSmseidel    ;;
969ee1eb700SMatthias Seidel    aarch64:Linux:*:*)
970*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971*09be380fSmseidel    ;;
972ee1eb700SMatthias Seidel    aarch64_be:Linux:*:*)
973ee1eb700SMatthias Seidel    UNAME_MACHINE=aarch64_be
974*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975*09be380fSmseidel    ;;
976cdf0e10cSrcweir    alpha:Linux:*:*)
977*09be380fSmseidel    case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978cdf0e10cSrcweir      EV5)   UNAME_MACHINE=alphaev5 ;;
979cdf0e10cSrcweir      EV56)  UNAME_MACHINE=alphaev56 ;;
980cdf0e10cSrcweir      PCA56) UNAME_MACHINE=alphapca56 ;;
981cdf0e10cSrcweir      PCA57) UNAME_MACHINE=alphapca56 ;;
982cdf0e10cSrcweir      EV6)   UNAME_MACHINE=alphaev6 ;;
983cdf0e10cSrcweir      EV67)  UNAME_MACHINE=alphaev67 ;;
984cdf0e10cSrcweir      EV68*) UNAME_MACHINE=alphaev68 ;;
985cdf0e10cSrcweir    esac
986187b4248SPedro Giffuni    objdump --private-headers /bin/sh | grep -q ld.so.1
987ee1eb700SMatthias Seidel    if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989*09be380fSmseidel    ;;
990*09be380fSmseidel    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992*09be380fSmseidel    ;;
993187b4248SPedro Giffuni    arm*:Linux:*:*)
9941aeda8abSMatthias Seidel    set_cc_for_build
995187b4248SPedro Giffuni    if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996187b4248SPedro Giffuni        | grep -q __ARM_EABI__
997187b4248SPedro Giffuni    then
998*09be380fSmseidel        GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999187b4248SPedro Giffuni    else
1000ee1eb700SMatthias Seidel        if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001ee1eb700SMatthias Seidel        | grep -q __ARM_PCS_VFP
1002ee1eb700SMatthias Seidel        then
1003*09be380fSmseidel        GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004ee1eb700SMatthias Seidel        else
1005*09be380fSmseidel        GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006ee1eb700SMatthias Seidel        fi
1007187b4248SPedro Giffuni    fi
1008*09be380fSmseidel    ;;
1009187b4248SPedro Giffuni    avr32*:Linux:*:*)
1010*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011*09be380fSmseidel    ;;
1012187b4248SPedro Giffuni    cris:Linux:*:*)
1013*09be380fSmseidel    GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014*09be380fSmseidel    ;;
1015187b4248SPedro Giffuni    crisv32:Linux:*:*)
1016*09be380fSmseidel    GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017*09be380fSmseidel    ;;
1018ee1eb700SMatthias Seidel    e2k:Linux:*:*)
1019*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020*09be380fSmseidel    ;;
1021187b4248SPedro Giffuni    frv:Linux:*:*)
1022*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023*09be380fSmseidel    ;;
1024ee1eb700SMatthias Seidel    hexagon:Linux:*:*)
1025*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026*09be380fSmseidel    ;;
1027187b4248SPedro Giffuni    i*86:Linux:*:*)
1028*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029*09be380fSmseidel    ;;
1030187b4248SPedro Giffuni    ia64:Linux:*:*)
1031*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032*09be380fSmseidel    ;;
1033ee1eb700SMatthias Seidel    k1om:Linux:*:*)
1034*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035*09be380fSmseidel    ;;
10361adde547Smseidel    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038*09be380fSmseidel    ;;
1039187b4248SPedro Giffuni    m32r*:Linux:*:*)
1040*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041*09be380fSmseidel    ;;
1042187b4248SPedro Giffuni    m68*:Linux:*:*)
1043*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044*09be380fSmseidel    ;;
1045187b4248SPedro Giffuni    mips:Linux:*:* | mips64:Linux:*:*)
10461aeda8abSMatthias Seidel    set_cc_for_build
10473ace3152SMatthias Seidel    IS_GLIBC=0
10483ace3152SMatthias Seidel    test x"${LIBC}" = xgnu && IS_GLIBC=1
10491a5d95c5SMatthias Seidel    sed 's/^    //' << EOF > "$dummy.c"
1050187b4248SPedro Giffuni    #undef CPU
10513ace3152SMatthias Seidel    #undef mips
10523ace3152SMatthias Seidel    #undef mipsel
10533ace3152SMatthias Seidel    #undef mips64
10543ace3152SMatthias Seidel    #undef mips64el
10553ace3152SMatthias Seidel    #if ${IS_GLIBC} && defined(_ABI64)
10563ace3152SMatthias Seidel    LIBCABI=gnuabi64
10573ace3152SMatthias Seidel    #else
10583ace3152SMatthias Seidel    #if ${IS_GLIBC} && defined(_ABIN32)
10593ace3152SMatthias Seidel    LIBCABI=gnuabin32
10603ace3152SMatthias Seidel    #else
10613ace3152SMatthias Seidel    LIBCABI=${LIBC}
10623ace3152SMatthias Seidel    #endif
10633ace3152SMatthias Seidel    #endif
10643ace3152SMatthias Seidel
10653ace3152SMatthias Seidel    #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10663ace3152SMatthias Seidel    CPU=mipsisa64r6
10673ace3152SMatthias Seidel    #else
10683ace3152SMatthias Seidel    #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10693ace3152SMatthias Seidel    CPU=mipsisa32r6
10703ace3152SMatthias Seidel    #else
10713ace3152SMatthias Seidel    #if defined(__mips64)
10723ace3152SMatthias Seidel    CPU=mips64
10733ace3152SMatthias Seidel    #else
10743ace3152SMatthias Seidel    CPU=mips
10753ace3152SMatthias Seidel    #endif
10763ace3152SMatthias Seidel    #endif
10773ace3152SMatthias Seidel    #endif
10783ace3152SMatthias Seidel
1079187b4248SPedro Giffuni    #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10803ace3152SMatthias Seidel    MIPS_ENDIAN=el
1081187b4248SPedro Giffuni    #else
1082187b4248SPedro Giffuni    #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10833ace3152SMatthias Seidel    MIPS_ENDIAN=
1084187b4248SPedro Giffuni    #else
10853ace3152SMatthias Seidel    MIPS_ENDIAN=
1086187b4248SPedro Giffuni    #endif
1087187b4248SPedro Giffuni    #endif
1088187b4248SPedro GiffuniEOF
1089*09be380fSmseidel    cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090*09be380fSmseidel    eval "$cc_set_vars"
10913ace3152SMatthias Seidel    test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092187b4248SPedro Giffuni    ;;
1093ee1eb700SMatthias Seidel    mips64el:Linux:*:*)
1094*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1095*09be380fSmseidel    ;;
1096ee1eb700SMatthias Seidel    openrisc*:Linux:*:*)
1097*09be380fSmseidel    GUESS=or1k-unknown-linux-$LIBC
1098*09be380fSmseidel    ;;
1099ee1eb700SMatthias Seidel    or32:Linux:*:* | or1k*:Linux:*:*)
1100*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1101*09be380fSmseidel    ;;
1102187b4248SPedro Giffuni    padre:Linux:*:*)
1103*09be380fSmseidel    GUESS=sparc-unknown-linux-$LIBC
1104*09be380fSmseidel    ;;
1105187b4248SPedro Giffuni    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106*09be380fSmseidel    GUESS=hppa64-unknown-linux-$LIBC
1107*09be380fSmseidel    ;;
1108cdf0e10cSrcweir    parisc:Linux:*:* | hppa:Linux:*:*)
1109cdf0e10cSrcweir    # Look for CPU level
1110*09be380fSmseidel    case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111*09be380fSmseidel      PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112*09be380fSmseidel      PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113*09be380fSmseidel      *)    GUESS=hppa-unknown-linux-$LIBC ;;
1114cdf0e10cSrcweir    esac
1115*09be380fSmseidel    ;;
1116187b4248SPedro Giffuni    ppc64:Linux:*:*)
1117*09be380fSmseidel    GUESS=powerpc64-unknown-linux-$LIBC
1118*09be380fSmseidel    ;;
1119187b4248SPedro Giffuni    ppc:Linux:*:*)
1120*09be380fSmseidel    GUESS=powerpc-unknown-linux-$LIBC
1121*09be380fSmseidel    ;;
1122ee1eb700SMatthias Seidel    ppc64le:Linux:*:*)
1123*09be380fSmseidel    GUESS=powerpc64le-unknown-linux-$LIBC
1124*09be380fSmseidel    ;;
1125ee1eb700SMatthias Seidel    ppcle:Linux:*:*)
1126*09be380fSmseidel    GUESS=powerpcle-unknown-linux-$LIBC
1127*09be380fSmseidel    ;;
11281adde547Smseidel    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130*09be380fSmseidel    ;;
1131cdf0e10cSrcweir    s390:Linux:*:* | s390x:Linux:*:*)
1132*09be380fSmseidel    GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133*09be380fSmseidel    ;;
1134cdf0e10cSrcweir    sh64*:Linux:*:*)
1135*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136*09be380fSmseidel    ;;
1137cdf0e10cSrcweir    sh*:Linux:*:*)
1138*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139*09be380fSmseidel    ;;
1140cdf0e10cSrcweir    sparc:Linux:*:* | sparc64:Linux:*:*)
1141*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142*09be380fSmseidel    ;;
1143ee1eb700SMatthias Seidel    tile*:Linux:*:*)
1144*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145*09be380fSmseidel    ;;
1146187b4248SPedro Giffuni    vax:Linux:*:*)
1147*09be380fSmseidel    GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148*09be380fSmseidel    ;;
1149cdf0e10cSrcweir    x86_64:Linux:*:*)
11505bf8527aSmseidel    set_cc_for_build
11515bf8527aSmseidel    LIBCABI=$LIBC
11525bf8527aSmseidel    if test "$CC_FOR_BUILD" != no_compiler_found; then
11535bf8527aSmseidel        if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
11545bf8527aSmseidel        (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
11555bf8527aSmseidel        grep IS_X32 >/dev/null
11565bf8527aSmseidel        then
1157*09be380fSmseidel        LIBCABI=${LIBC}x32
11585bf8527aSmseidel        fi
11595bf8527aSmseidel    fi
1160*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161*09be380fSmseidel    ;;
1162187b4248SPedro Giffuni    xtensa*:Linux:*:*)
1163*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164*09be380fSmseidel    ;;
1165cdf0e10cSrcweir    i*86:DYNIX/ptx:4*:*)
1166cdf0e10cSrcweir    # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1167cdf0e10cSrcweir    # earlier versions are messed up and put the nodename in both
1168cdf0e10cSrcweir    # sysname and nodename.
1169*09be380fSmseidel    GUESS=i386-sequent-sysv4
1170*09be380fSmseidel    ;;
1171cdf0e10cSrcweir    i*86:UNIX_SV:4.2MP:2.*)
1172cdf0e10cSrcweir    # Unixware is an offshoot of SVR4, but it has its own version
1173cdf0e10cSrcweir    # number series starting with 2...
1174cdf0e10cSrcweir    # I am not positive that other SVR4 systems won't match this,
1175cdf0e10cSrcweir    # I just have to hope.  -- rms.
1176cdf0e10cSrcweir    # Use sysv4.2uw... so that sysv4* matches it.
1177*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178*09be380fSmseidel    ;;
1179cdf0e10cSrcweir    i*86:OS/2:*:*)
1180cdf0e10cSrcweir    # If we were able to find `uname', then EMX Unix compatibility
1181cdf0e10cSrcweir    # is probably installed.
1182*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-os2-emx
1183*09be380fSmseidel    ;;
1184cdf0e10cSrcweir    i*86:XTS-300:*:STOP)
1185*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-stop
1186*09be380fSmseidel    ;;
1187cdf0e10cSrcweir    i*86:atheos:*:*)
1188*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-atheos
1189*09be380fSmseidel    ;;
1190187b4248SPedro Giffuni    i*86:syllable:*:*)
1191*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-syllable
1192*09be380fSmseidel    ;;
1193187b4248SPedro Giffuni    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194*09be380fSmseidel    GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195*09be380fSmseidel    ;;
1196cdf0e10cSrcweir    i*86:*DOS:*:*)
1197*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198*09be380fSmseidel    ;;
1199ee1eb700SMatthias Seidel    i*86:*:4.*:*)
1200*09be380fSmseidel    UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1201cdf0e10cSrcweir    if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202*09be380fSmseidel        GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1203cdf0e10cSrcweir    else
1204*09be380fSmseidel        GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1205cdf0e10cSrcweir    fi
1206*09be380fSmseidel    ;;
1207187b4248SPedro Giffuni    i*86:*:5:[678]*)
1208187b4248SPedro Giffuni    # UnixWare 7.x, OpenUNIX and OpenServer 6.
1209*09be380fSmseidel    case `/bin/uname -X | grep "^Machine"` in
1210cdf0e10cSrcweir        *486*)       UNAME_MACHINE=i486 ;;
1211cdf0e10cSrcweir        *Pentium)        UNAME_MACHINE=i586 ;;
1212cdf0e10cSrcweir        *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1213cdf0e10cSrcweir    esac
1214*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215*09be380fSmseidel    ;;
1216cdf0e10cSrcweir    i*86:*:3.2:*)
1217cdf0e10cSrcweir    if test -f /usr/options/cb.name; then
1218*09be380fSmseidel        UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219*09be380fSmseidel        GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1220cdf0e10cSrcweir    elif /bin/uname -X 2>/dev/null >/dev/null ; then
1221*09be380fSmseidel        UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1222cdf0e10cSrcweir        (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1223cdf0e10cSrcweir        (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1224cdf0e10cSrcweir            && UNAME_MACHINE=i586
1225cdf0e10cSrcweir        (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1226cdf0e10cSrcweir            && UNAME_MACHINE=i686
1227cdf0e10cSrcweir        (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1228cdf0e10cSrcweir            && UNAME_MACHINE=i686
1229*09be380fSmseidel        GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1230cdf0e10cSrcweir    else
1231*09be380fSmseidel        GUESS=$UNAME_MACHINE-pc-sysv32
1232cdf0e10cSrcweir    fi
1233*09be380fSmseidel    ;;
1234cdf0e10cSrcweir    pc:*:*:*)
1235cdf0e10cSrcweir    # Left here for compatibility:
1236cdf0e10cSrcweir    # uname -m prints for DJGPP always 'pc', but it prints nothing about
1237187b4248SPedro Giffuni    # the processor, so we play safe by assuming i586.
1238187b4248SPedro Giffuni    # Note: whatever this is, it MUST be the same as what config.sub
1239ee1eb700SMatthias Seidel    # prints for the "djgpp" host, or else GDB configure will decide that
1240187b4248SPedro Giffuni    # this is a cross-build.
1241*09be380fSmseidel    GUESS=i586-pc-msdosdjgpp
1242*09be380fSmseidel    ;;
1243cdf0e10cSrcweir    Intel:Mach:3*:*)
1244*09be380fSmseidel    GUESS=i386-pc-mach3
1245*09be380fSmseidel    ;;
1246cdf0e10cSrcweir    paragon:*:*:*)
1247*09be380fSmseidel    GUESS=i860-intel-osf1
1248*09be380fSmseidel    ;;
1249cdf0e10cSrcweir    i860:*:4.*:*) # i860-SVR4
1250cdf0e10cSrcweir    if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251*09be380fSmseidel      GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1252cdf0e10cSrcweir    else # Add other i860-SVR4 vendors below as they are discovered.
1253*09be380fSmseidel      GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1254cdf0e10cSrcweir    fi
1255*09be380fSmseidel    ;;
1256cdf0e10cSrcweir    mini*:CTIX:SYS*5:*)
1257cdf0e10cSrcweir    # "miniframe"
1258*09be380fSmseidel    GUESS=m68010-convergent-sysv
1259*09be380fSmseidel    ;;
1260cdf0e10cSrcweir    mc68k:UNIX:SYSTEM5:3.51m)
1261*09be380fSmseidel    GUESS=m68k-convergent-sysv
1262*09be380fSmseidel    ;;
1263cdf0e10cSrcweir    M680?0:D-NIX:5.3:*)
1264*09be380fSmseidel    GUESS=m68k-diab-dnix
1265*09be380fSmseidel    ;;
1266187b4248SPedro Giffuni    M68*:*:R3V[5678]*:*)
1267187b4248SPedro Giffuni    test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1268187b4248SPedro Giffuni    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)
1269cdf0e10cSrcweir    OS_REL=''
1270cdf0e10cSrcweir    test -r /etc/.relid \
1271*09be380fSmseidel    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1272cdf0e10cSrcweir    /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12731a5d95c5SMatthias Seidel      && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1274cdf0e10cSrcweir    /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12751a5d95c5SMatthias Seidel      && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1276cdf0e10cSrcweir    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277cdf0e10cSrcweir    /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278187b4248SPedro Giffuni      && { echo i486-ncr-sysv4; exit; } ;;
1279187b4248SPedro Giffuni    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280187b4248SPedro Giffuni    OS_REL='.3'
1281187b4248SPedro Giffuni    test -r /etc/.relid \
1282*09be380fSmseidel        && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283187b4248SPedro Giffuni    /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12841a5d95c5SMatthias Seidel        && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285187b4248SPedro Giffuni    /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12861a5d95c5SMatthias Seidel        && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287187b4248SPedro Giffuni    /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12881a5d95c5SMatthias Seidel        && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1289cdf0e10cSrcweir    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290*09be380fSmseidel    GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291*09be380fSmseidel    ;;
1292cdf0e10cSrcweir    mc68030:UNIX_System_V:4.*:*)
1293*09be380fSmseidel    GUESS=m68k-atari-sysv4
1294*09be380fSmseidel    ;;
1295cdf0e10cSrcweir    TSUNAMI:LynxOS:2.*:*)
1296*09be380fSmseidel    GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297*09be380fSmseidel    ;;
1298cdf0e10cSrcweir    rs6000:LynxOS:2.*:*)
1299*09be380fSmseidel    GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300*09be380fSmseidel    ;;
1301187b4248SPedro Giffuni    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302*09be380fSmseidel    GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303*09be380fSmseidel    ;;
1304cdf0e10cSrcweir    SM[BE]S:UNIX_SV:*:*)
1305*09be380fSmseidel    GUESS=mips-dde-sysv$UNAME_RELEASE
1306*09be380fSmseidel    ;;
1307cdf0e10cSrcweir    RM*:ReliantUNIX-*:*:*)
1308*09be380fSmseidel    GUESS=mips-sni-sysv4
1309*09be380fSmseidel    ;;
1310cdf0e10cSrcweir    RM*:SINIX-*:*:*)
1311*09be380fSmseidel    GUESS=mips-sni-sysv4
1312*09be380fSmseidel    ;;
1313cdf0e10cSrcweir    *:SINIX-*:*:*)
1314cdf0e10cSrcweir    if uname -p 2>/dev/null >/dev/null ; then
1315*09be380fSmseidel        UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316*09be380fSmseidel        GUESS=$UNAME_MACHINE-sni-sysv4
1317cdf0e10cSrcweir    else
1318*09be380fSmseidel        GUESS=ns32k-sni-sysv
1319cdf0e10cSrcweir    fi
1320*09be380fSmseidel    ;;
1321cdf0e10cSrcweir    PENTIUM:*:4.0*:*)   # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322cdf0e10cSrcweir            # says <Richard.M.Bartel@ccMail.Census.GOV>
1323*09be380fSmseidel    GUESS=i586-unisys-sysv4
1324*09be380fSmseidel    ;;
1325cdf0e10cSrcweir    *:UNIX_System_V:4*:FTX*)
1326cdf0e10cSrcweir    # From Gerald Hewes <hewes@openmarket.com>.
1327cdf0e10cSrcweir    # How about differentiating between stratus architectures? -djm
1328*09be380fSmseidel    GUESS=hppa1.1-stratus-sysv4
1329*09be380fSmseidel    ;;
1330cdf0e10cSrcweir    *:*:*:FTX*)
1331cdf0e10cSrcweir    # From seanf@swdc.stratus.com.
1332*09be380fSmseidel    GUESS=i860-stratus-sysv4
1333*09be380fSmseidel    ;;
1334187b4248SPedro Giffuni    i*86:VOS:*:*)
1335187b4248SPedro Giffuni    # From Paul.Green@stratus.com.
1336*09be380fSmseidel    GUESS=$UNAME_MACHINE-stratus-vos
1337*09be380fSmseidel    ;;
1338cdf0e10cSrcweir    *:VOS:*:*)
1339cdf0e10cSrcweir    # From Paul.Green@stratus.com.
1340*09be380fSmseidel    GUESS=hppa1.1-stratus-vos
1341*09be380fSmseidel    ;;
1342cdf0e10cSrcweir    mc68*:A/UX:*:*)
1343*09be380fSmseidel    GUESS=m68k-apple-aux$UNAME_RELEASE
1344*09be380fSmseidel    ;;
1345cdf0e10cSrcweir    news*:NEWS-OS:6*:*)
1346*09be380fSmseidel    GUESS=mips-sony-newsos6
1347*09be380fSmseidel    ;;
1348cdf0e10cSrcweir    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
13495bf8527aSmseidel    if test -d /usr/nec; then
1350*09be380fSmseidel        GUESS=mips-nec-sysv$UNAME_RELEASE
1351cdf0e10cSrcweir    else
1352*09be380fSmseidel        GUESS=mips-unknown-sysv$UNAME_RELEASE
1353cdf0e10cSrcweir    fi
1354*09be380fSmseidel    ;;
1355cdf0e10cSrcweir    BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1356*09be380fSmseidel    GUESS=powerpc-be-beos
1357*09be380fSmseidel    ;;
1358cdf0e10cSrcweir    BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1359*09be380fSmseidel    GUESS=powerpc-apple-beos
1360*09be380fSmseidel    ;;
1361cdf0e10cSrcweir    BePC:BeOS:*:*)  # BeOS running on Intel PC compatible.
1362*09be380fSmseidel    GUESS=i586-pc-beos
1363*09be380fSmseidel    ;;
1364187b4248SPedro Giffuni    BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
1365*09be380fSmseidel    GUESS=i586-pc-haiku
1366*09be380fSmseidel    ;;
1367ee1eb700SMatthias Seidel    x86_64:Haiku:*:*)
1368*09be380fSmseidel    GUESS=x86_64-unknown-haiku
1369*09be380fSmseidel    ;;
1370cdf0e10cSrcweir    SX-4:SUPER-UX:*:*)
1371*09be380fSmseidel    GUESS=sx4-nec-superux$UNAME_RELEASE
1372*09be380fSmseidel    ;;
1373cdf0e10cSrcweir    SX-5:SUPER-UX:*:*)
1374*09be380fSmseidel    GUESS=sx5-nec-superux$UNAME_RELEASE
1375*09be380fSmseidel    ;;
1376cdf0e10cSrcweir    SX-6:SUPER-UX:*:*)
1377*09be380fSmseidel    GUESS=sx6-nec-superux$UNAME_RELEASE
1378*09be380fSmseidel    ;;
1379187b4248SPedro Giffuni    SX-7:SUPER-UX:*:*)
1380*09be380fSmseidel    GUESS=sx7-nec-superux$UNAME_RELEASE
1381*09be380fSmseidel    ;;
1382187b4248SPedro Giffuni    SX-8:SUPER-UX:*:*)
1383*09be380fSmseidel    GUESS=sx8-nec-superux$UNAME_RELEASE
1384*09be380fSmseidel    ;;
1385187b4248SPedro Giffuni    SX-8R:SUPER-UX:*:*)
1386*09be380fSmseidel    GUESS=sx8r-nec-superux$UNAME_RELEASE
1387*09be380fSmseidel    ;;
1388ee1eb700SMatthias Seidel    SX-ACE:SUPER-UX:*:*)
1389*09be380fSmseidel    GUESS=sxace-nec-superux$UNAME_RELEASE
1390*09be380fSmseidel    ;;
1391cdf0e10cSrcweir    Power*:Rhapsody:*:*)
1392*09be380fSmseidel    GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393*09be380fSmseidel    ;;
1394cdf0e10cSrcweir    *:Rhapsody:*:*)
1395*09be380fSmseidel    GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396*09be380fSmseidel    ;;
13975bf8527aSmseidel    arm64:Darwin:*:*)
1398*09be380fSmseidel    GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399*09be380fSmseidel    ;;
1400cdf0e10cSrcweir    *:Darwin:*:*)
1401*09be380fSmseidel    UNAME_PROCESSOR=`uname -p`
1402859e76afSmseidel    case $UNAME_PROCESSOR in
1403859e76afSmseidel        unknown) UNAME_PROCESSOR=powerpc ;;
1404859e76afSmseidel    esac
1405859e76afSmseidel    if command -v xcode-select > /dev/null 2> /dev/null && \
1406859e76afSmseidel        ! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407859e76afSmseidel        # Avoid executing cc if there is no toolchain installed as
1408859e76afSmseidel        # cc will be a stub that puts up a graphical alert
1409859e76afSmseidel        # prompting the user to install developer tools.
1410859e76afSmseidel        CC_FOR_BUILD=no_compiler_found
1411859e76afSmseidel    else
14121aeda8abSMatthias Seidel        set_cc_for_build
1413ee1eb700SMatthias Seidel    fi
14145bf8527aSmseidel    if test "$CC_FOR_BUILD" != no_compiler_found; then
1415187b4248SPedro Giffuni        if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416ee1eb700SMatthias Seidel           (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417187b4248SPedro Giffuni           grep IS_64BIT_ARCH >/dev/null
1418187b4248SPedro Giffuni        then
1419ee1eb700SMatthias Seidel        case $UNAME_PROCESSOR in
1420ee1eb700SMatthias Seidel            i386) UNAME_PROCESSOR=x86_64 ;;
1421ee1eb700SMatthias Seidel            powerpc) UNAME_PROCESSOR=powerpc64 ;;
1422cdf0e10cSrcweir        esac
1423ee1eb700SMatthias Seidel        fi
1424ee1eb700SMatthias Seidel        # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425ee1eb700SMatthias Seidel        if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426ee1eb700SMatthias Seidel           (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427ee1eb700SMatthias Seidel           grep IS_PPC >/dev/null
1428ee1eb700SMatthias Seidel        then
1429ee1eb700SMatthias Seidel        UNAME_PROCESSOR=powerpc
1430ee1eb700SMatthias Seidel        fi
1431ee1eb700SMatthias Seidel    elif test "$UNAME_PROCESSOR" = i386 ; then
1432859e76afSmseidel        # uname -m returns i386 or x86_64
1433859e76afSmseidel        UNAME_PROCESSOR=$UNAME_MACHINE
1434ee1eb700SMatthias Seidel    fi
1435*09be380fSmseidel    GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436*09be380fSmseidel    ;;
1437cdf0e10cSrcweir    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1438*09be380fSmseidel    UNAME_PROCESSOR=`uname -p`
1439ee1eb700SMatthias Seidel    if test "$UNAME_PROCESSOR" = x86; then
1440cdf0e10cSrcweir        UNAME_PROCESSOR=i386
1441cdf0e10cSrcweir        UNAME_MACHINE=pc
1442cdf0e10cSrcweir    fi
1443*09be380fSmseidel    GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444*09be380fSmseidel    ;;
1445cdf0e10cSrcweir    *:QNX:*:4*)
1446*09be380fSmseidel    GUESS=i386-pc-qnx
1447*09be380fSmseidel    ;;
1448ee1eb700SMatthias Seidel    NEO-*:NONSTOP_KERNEL:*:*)
1449*09be380fSmseidel    GUESS=neo-tandem-nsk$UNAME_RELEASE
1450*09be380fSmseidel    ;;
1451ee1eb700SMatthias Seidel    NSE-*:NONSTOP_KERNEL:*:*)
1452*09be380fSmseidel    GUESS=nse-tandem-nsk$UNAME_RELEASE
1453*09be380fSmseidel    ;;
1454ee1eb700SMatthias Seidel    NSR-*:NONSTOP_KERNEL:*:*)
1455*09be380fSmseidel    GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456*09be380fSmseidel    ;;
14571a5d95c5SMatthias Seidel    NSV-*:NONSTOP_KERNEL:*:*)
1458*09be380fSmseidel    GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459*09be380fSmseidel    ;;
1460ee1eb700SMatthias Seidel    NSX-*:NONSTOP_KERNEL:*:*)
1461*09be380fSmseidel    GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462*09be380fSmseidel    ;;
1463cdf0e10cSrcweir    *:NonStop-UX:*:*)
1464*09be380fSmseidel    GUESS=mips-compaq-nonstopux
1465*09be380fSmseidel    ;;
1466cdf0e10cSrcweir    BS2000:POSIX*:*:*)
1467*09be380fSmseidel    GUESS=bs2000-siemens-sysv
1468*09be380fSmseidel    ;;
1469cdf0e10cSrcweir    DS/*:UNIX_System_V:*:*)
1470*09be380fSmseidel    GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471*09be380fSmseidel    ;;
1472cdf0e10cSrcweir    *:Plan9:*:*)
1473cdf0e10cSrcweir    # "uname -m" is not consistent, so use $cputype instead. 386
1474cdf0e10cSrcweir    # is converted to i386 for consistency with other x86
1475cdf0e10cSrcweir    # operating systems.
1476*09be380fSmseidel    if test "${cputype-}" = 386; then
1477cdf0e10cSrcweir        UNAME_MACHINE=i386
1478*09be380fSmseidel    elif test "x${cputype-}" != x; then
1479*09be380fSmseidel        UNAME_MACHINE=$cputype
1480cdf0e10cSrcweir    fi
1481*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-plan9
1482*09be380fSmseidel    ;;
1483cdf0e10cSrcweir    *:TOPS-10:*:*)
1484*09be380fSmseidel    GUESS=pdp10-unknown-tops10
1485*09be380fSmseidel    ;;
1486cdf0e10cSrcweir    *:TENEX:*:*)
1487*09be380fSmseidel    GUESS=pdp10-unknown-tenex
1488*09be380fSmseidel    ;;
1489cdf0e10cSrcweir    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490*09be380fSmseidel    GUESS=pdp10-dec-tops20
1491*09be380fSmseidel    ;;
1492cdf0e10cSrcweir    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493*09be380fSmseidel    GUESS=pdp10-xkl-tops20
1494*09be380fSmseidel    ;;
1495cdf0e10cSrcweir    *:TOPS-20:*:*)
1496*09be380fSmseidel    GUESS=pdp10-unknown-tops20
1497*09be380fSmseidel    ;;
1498cdf0e10cSrcweir    *:ITS:*:*)
1499*09be380fSmseidel    GUESS=pdp10-unknown-its
1500*09be380fSmseidel    ;;
1501cdf0e10cSrcweir    SEI:*:*:SEIUX)
1502*09be380fSmseidel    GUESS=mips-sei-seiux$UNAME_RELEASE
1503*09be380fSmseidel    ;;
1504187b4248SPedro Giffuni    *:DragonFly:*:*)
1505*09be380fSmseidel    DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507*09be380fSmseidel    ;;
1508187b4248SPedro Giffuni    *:*VMS:*:*)
1509*09be380fSmseidel    UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510*09be380fSmseidel    case $UNAME_MACHINE in
1511*09be380fSmseidel        A*) GUESS=alpha-dec-vms ;;
1512*09be380fSmseidel        I*) GUESS=ia64-dec-vms ;;
1513*09be380fSmseidel        V*) GUESS=vax-dec-vms ;;
1514187b4248SPedro Giffuni    esac ;;
1515187b4248SPedro Giffuni    *:XENIX:*:SysV)
1516*09be380fSmseidel    GUESS=i386-pc-xenix
1517*09be380fSmseidel    ;;
1518187b4248SPedro Giffuni    i*86:skyos:*:*)
1519*09be380fSmseidel    SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521*09be380fSmseidel    ;;
1522187b4248SPedro Giffuni    i*86:rdos:*:*)
1523*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-rdos
1524*09be380fSmseidel    ;;
1525*09be380fSmseidel    i*86:Fiwix:*:*)
1526*09be380fSmseidel    GUESS=$UNAME_MACHINE-pc-fiwix
1527*09be380fSmseidel    ;;
15281adde547Smseidel    *:AROS:*:*)
1529*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-aros
1530*09be380fSmseidel    ;;
1531ee1eb700SMatthias Seidel    x86_64:VMkernel:*:*)
1532*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-esx
1533*09be380fSmseidel    ;;
1534ee1eb700SMatthias Seidel    amd64:Isilon\ OneFS:*:*)
1535*09be380fSmseidel    GUESS=x86_64-unknown-onefs
1536*09be380fSmseidel    ;;
15373ace3152SMatthias Seidel    *:Unleashed:*:*)
1538*09be380fSmseidel    GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1539*09be380fSmseidel    ;;
1540cdf0e10cSrcweiresac
1541cdf0e10cSrcweir
1542*09be380fSmseidel# Do we have a guess based on uname results?
1543*09be380fSmseidelif test "x$GUESS" != x; then
1544*09be380fSmseidel    echo "$GUESS"
1545*09be380fSmseidel    exit
1546*09be380fSmseidelfi
1547*09be380fSmseidel
15483ace3152SMatthias Seidel# No uname command or uname output not recognized.
15493ace3152SMatthias Seidelset_cc_for_build
15503ace3152SMatthias Seidelcat > "$dummy.c" <<EOF
15513ace3152SMatthias Seidel#ifdef _SEQUENT_
15523ace3152SMatthias Seidel#include <sys/types.h>
15533ace3152SMatthias Seidel#include <sys/utsname.h>
15543ace3152SMatthias Seidel#endif
15553ace3152SMatthias Seidel#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15563ace3152SMatthias Seidel#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15573ace3152SMatthias Seidel#include <signal.h>
15583ace3152SMatthias Seidel#if defined(_SIZE_T_) || defined(SIGLOST)
15593ace3152SMatthias Seidel#include <sys/utsname.h>
15603ace3152SMatthias Seidel#endif
15613ace3152SMatthias Seidel#endif
15623ace3152SMatthias Seidel#endif
15633ace3152SMatthias Seidelmain ()
15643ace3152SMatthias Seidel{
15653ace3152SMatthias Seidel#if defined (sony)
15663ace3152SMatthias Seidel#if defined (MIPSEB)
15673ace3152SMatthias Seidel  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15683ace3152SMatthias Seidel     I don't know....  */
15693ace3152SMatthias Seidel  printf ("mips-sony-bsd\n"); exit (0);
15703ace3152SMatthias Seidel#else
15713ace3152SMatthias Seidel#include <sys/param.h>
15723ace3152SMatthias Seidel  printf ("m68k-sony-newsos%s\n",
15733ace3152SMatthias Seidel#ifdef NEWSOS4
15743ace3152SMatthias Seidel  "4"
15753ace3152SMatthias Seidel#else
15763ace3152SMatthias Seidel  ""
15773ace3152SMatthias Seidel#endif
15783ace3152SMatthias Seidel  ); exit (0);
15793ace3152SMatthias Seidel#endif
15803ace3152SMatthias Seidel#endif
15813ace3152SMatthias Seidel
15823ace3152SMatthias Seidel#if defined (NeXT)
15833ace3152SMatthias Seidel#if !defined (__ARCHITECTURE__)
15843ace3152SMatthias Seidel#define __ARCHITECTURE__ "m68k"
15853ace3152SMatthias Seidel#endif
15863ace3152SMatthias Seidel  int version;
1587*09be380fSmseidel  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15883ace3152SMatthias Seidel  if (version < 4)
15893ace3152SMatthias Seidel    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15903ace3152SMatthias Seidel  else
15913ace3152SMatthias Seidel    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15923ace3152SMatthias Seidel  exit (0);
15933ace3152SMatthias Seidel#endif
15943ace3152SMatthias Seidel
15953ace3152SMatthias Seidel#if defined (MULTIMAX) || defined (n16)
15963ace3152SMatthias Seidel#if defined (UMAXV)
15973ace3152SMatthias Seidel  printf ("ns32k-encore-sysv\n"); exit (0);
15983ace3152SMatthias Seidel#else
15993ace3152SMatthias Seidel#if defined (CMU)
16003ace3152SMatthias Seidel  printf ("ns32k-encore-mach\n"); exit (0);
16013ace3152SMatthias Seidel#else
16023ace3152SMatthias Seidel  printf ("ns32k-encore-bsd\n"); exit (0);
16033ace3152SMatthias Seidel#endif
16043ace3152SMatthias Seidel#endif
16053ace3152SMatthias Seidel#endif
16063ace3152SMatthias Seidel
16073ace3152SMatthias Seidel#if defined (__386BSD__)
16083ace3152SMatthias Seidel  printf ("i386-pc-bsd\n"); exit (0);
16093ace3152SMatthias Seidel#endif
16103ace3152SMatthias Seidel
16113ace3152SMatthias Seidel#if defined (sequent)
16123ace3152SMatthias Seidel#if defined (i386)
16133ace3152SMatthias Seidel  printf ("i386-sequent-dynix\n"); exit (0);
16143ace3152SMatthias Seidel#endif
16153ace3152SMatthias Seidel#if defined (ns32000)
16163ace3152SMatthias Seidel  printf ("ns32k-sequent-dynix\n"); exit (0);
16173ace3152SMatthias Seidel#endif
16183ace3152SMatthias Seidel#endif
16193ace3152SMatthias Seidel
16203ace3152SMatthias Seidel#if defined (_SEQUENT_)
16213ace3152SMatthias Seidel  struct utsname un;
16223ace3152SMatthias Seidel
16233ace3152SMatthias Seidel  uname(&un);
16243ace3152SMatthias Seidel  if (strncmp(un.version, "V2", 2) == 0) {
16253ace3152SMatthias Seidel    printf ("i386-sequent-ptx2\n"); exit (0);
16263ace3152SMatthias Seidel  }
16273ace3152SMatthias Seidel  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
16283ace3152SMatthias Seidel    printf ("i386-sequent-ptx1\n"); exit (0);
16293ace3152SMatthias Seidel  }
16303ace3152SMatthias Seidel  printf ("i386-sequent-ptx\n"); exit (0);
16313ace3152SMatthias Seidel#endif
16323ace3152SMatthias Seidel
16333ace3152SMatthias Seidel#if defined (vax)
16343ace3152SMatthias Seidel#if !defined (ultrix)
16353ace3152SMatthias Seidel#include <sys/param.h>
16363ace3152SMatthias Seidel#if defined (BSD)
16373ace3152SMatthias Seidel#if BSD == 43
16383ace3152SMatthias Seidel  printf ("vax-dec-bsd4.3\n"); exit (0);
16393ace3152SMatthias Seidel#else
16403ace3152SMatthias Seidel#if BSD == 199006
16413ace3152SMatthias Seidel  printf ("vax-dec-bsd4.3reno\n"); exit (0);
16423ace3152SMatthias Seidel#else
16433ace3152SMatthias Seidel  printf ("vax-dec-bsd\n"); exit (0);
16443ace3152SMatthias Seidel#endif
16453ace3152SMatthias Seidel#endif
16463ace3152SMatthias Seidel#else
16473ace3152SMatthias Seidel  printf ("vax-dec-bsd\n"); exit (0);
16483ace3152SMatthias Seidel#endif
16493ace3152SMatthias Seidel#else
16503ace3152SMatthias Seidel#if defined(_SIZE_T_) || defined(SIGLOST)
16513ace3152SMatthias Seidel  struct utsname un;
16523ace3152SMatthias Seidel  uname (&un);
16533ace3152SMatthias Seidel  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
16543ace3152SMatthias Seidel#else
16553ace3152SMatthias Seidel  printf ("vax-dec-ultrix\n"); exit (0);
16563ace3152SMatthias Seidel#endif
16573ace3152SMatthias Seidel#endif
16583ace3152SMatthias Seidel#endif
16593ace3152SMatthias Seidel#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
16603ace3152SMatthias Seidel#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
16613ace3152SMatthias Seidel#if defined(_SIZE_T_) || defined(SIGLOST)
16623ace3152SMatthias Seidel  struct utsname *un;
16633ace3152SMatthias Seidel  uname (&un);
16643ace3152SMatthias Seidel  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16653ace3152SMatthias Seidel#else
16663ace3152SMatthias Seidel  printf ("mips-dec-ultrix\n"); exit (0);
16673ace3152SMatthias Seidel#endif
16683ace3152SMatthias Seidel#endif
16693ace3152SMatthias Seidel#endif
16703ace3152SMatthias Seidel
16713ace3152SMatthias Seidel#if defined (alliant) && defined (i860)
16723ace3152SMatthias Seidel  printf ("i860-alliant-bsd\n"); exit (0);
16733ace3152SMatthias Seidel#endif
16743ace3152SMatthias Seidel
16753ace3152SMatthias Seidel  exit (1);
16763ace3152SMatthias Seidel}
16773ace3152SMatthias SeidelEOF
16783ace3152SMatthias Seidel
1679*09be380fSmseidel$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16803ace3152SMatthias Seidel    { echo "$SYSTEM_NAME"; exit; }
16813ace3152SMatthias Seidel
16823ace3152SMatthias Seidel# Apollos put the system type in the environment.
16833ace3152SMatthias Seideltest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16843ace3152SMatthias Seidel
1685ee1eb700SMatthias Seidelecho "$0: unable to guess system type" >&2
1686cdf0e10cSrcweir
1687*09be380fSmseidelcase $UNAME_MACHINE:$UNAME_SYSTEM in
1688ee1eb700SMatthias Seidel    mips:Linux | mips64:Linux)
1689ee1eb700SMatthias Seidel    # If we got here on MIPS GNU/Linux, output extra information.
1690ee1eb700SMatthias Seidel    cat >&2 <<EOF
1691cdf0e10cSrcweir
1692ee1eb700SMatthias SeidelNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1693ee1eb700SMatthias Seidelthe system type. Please install a C compiler and try again.
1694cdf0e10cSrcweirEOF
1695ee1eb700SMatthias Seidel    ;;
1696cdf0e10cSrcweiresac
1697cdf0e10cSrcweir
1698cdf0e10cSrcweircat >&2 <<EOF
1699cdf0e10cSrcweir
1700ee1eb700SMatthias SeidelThis script (version $timestamp), has failed to recognize the
1701ee1eb700SMatthias Seideloperating system you are using. If your script is old, overwrite *all*
1702ee1eb700SMatthias Seidelcopies of config.guess and config.sub with the latest versions from:
1703cdf0e10cSrcweir
17041adde547Smseidel  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1705187b4248SPedro Giffuniand
17061adde547Smseidel  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
17075bf8527aSmseidelEOF
17085bf8527aSmseidel
1709*09be380fSmseidelour_year=`echo $timestamp | sed 's,-.*,,'`
1710*09be380fSmseidelthisyear=`date +%Y`
17115bf8527aSmseidel# shellcheck disable=SC2003
1712*09be380fSmseidelscript_age=`expr "$thisyear" - "$our_year"`
1713*09be380fSmseidelif test "$script_age" -lt 3 ; then
17145bf8527aSmseidel   cat >&2 <<EOF
1715cdf0e10cSrcweir
1716ee1eb700SMatthias SeidelIf $0 has already been updated, send the following data and any
1717ee1eb700SMatthias Seidelinformation you think might be pertinent to config-patches@gnu.org to
1718ee1eb700SMatthias Seidelprovide the necessary information to handle your system.
1719cdf0e10cSrcweir
1720cdf0e10cSrcweirconfig.guess timestamp = $timestamp
1721cdf0e10cSrcweir
1722*09be380fSmseideluname -m = `(uname -m) 2>/dev/null || echo unknown`
1723*09be380fSmseideluname -r = `(uname -r) 2>/dev/null || echo unknown`
1724*09be380fSmseideluname -s = `(uname -s) 2>/dev/null || echo unknown`
1725*09be380fSmseideluname -v = `(uname -v) 2>/dev/null || echo unknown`
1726cdf0e10cSrcweir
1727*09be380fSmseidel/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1728*09be380fSmseidel/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1729cdf0e10cSrcweir
1730*09be380fSmseidelhostinfo               = `(hostinfo) 2>/dev/null`
1731*09be380fSmseidel/bin/universe          = `(/bin/universe) 2>/dev/null`
1732*09be380fSmseidel/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1733*09be380fSmseidel/bin/arch              = `(/bin/arch) 2>/dev/null`
1734*09be380fSmseidel/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1735*09be380fSmseidel/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1736cdf0e10cSrcweir
17371a5d95c5SMatthias SeidelUNAME_MACHINE = "$UNAME_MACHINE"
17381a5d95c5SMatthias SeidelUNAME_RELEASE = "$UNAME_RELEASE"
17391a5d95c5SMatthias SeidelUNAME_SYSTEM  = "$UNAME_SYSTEM"
17401a5d95c5SMatthias SeidelUNAME_VERSION = "$UNAME_VERSION"
1741cdf0e10cSrcweirEOF
17425bf8527aSmseidelfi
1743cdf0e10cSrcweir
1744cdf0e10cSrcweirexit 1
1745cdf0e10cSrcweir
1746cdf0e10cSrcweir# Local variables:
17471a5d95c5SMatthias Seidel# eval: (add-hook 'before-save-hook 'time-stamp)
1748cdf0e10cSrcweir# time-stamp-start: "timestamp='"
1749cdf0e10cSrcweir# time-stamp-format: "%:y-%02m-%02d"
1750cdf0e10cSrcweir# time-stamp-end: "'"
1751cdf0e10cSrcweir# End:
1752