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