127702724Smrg#! /bin/sh 227702724Smrg# Attempt to guess a canonical system name. 3ae545d91Smrg# Copyright 1992-2024 Free Software Foundation, Inc. 427702724Smrg 595b7a5c8Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale 695b7a5c8Smrg 7ae545d91Smrgtimestamp='2024-01-01' 827702724Smrg 927702724Smrg# This file is free software; you can redistribute it and/or modify it 1027702724Smrg# under the terms of the GNU General Public License as published by 11630e437aSmrg# the Free Software Foundation, either version 3 of the License, or 1227702724Smrg# (at your option) any later version. 1327702724Smrg# 1427702724Smrg# This program is distributed in the hope that it will be useful, but 1527702724Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 1627702724Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1727702724Smrg# General Public License for more details. 1827702724Smrg# 1927702724Smrg# You should have received a copy of the GNU General Public License 207cea3689Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>. 2127702724Smrg# 2227702724Smrg# As a special exception to the GNU General Public License, if you 2327702724Smrg# distribute this file as part of a program that contains a 2427702724Smrg# configuration script generated by Autoconf, you may include it under 25313a12fdSmrg# the same distribution terms that you use for the rest of that 26313a12fdSmrg# program. This Exception is an additional permission under section 7 27313a12fdSmrg# of the GNU General Public License, version 3 ("GPLv3"). 2827702724Smrg# 297cea3689Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. 3027702724Smrg# 3100084f2cSmrg# You can get the latest version of this script from: 3295b7a5c8Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess 33313a12fdSmrg# 347cea3689Smrg# Please send patches to <config-patches@gnu.org>. 35313a12fdSmrg 3627702724Smrg 3795b7a5c8Smrg# The "shellcheck disable" line above the timestamp inhibits complaints 3895b7a5c8Smrg# about features and limitations of the classic Bourne shell that were 3995b7a5c8Smrg# superseded or lifted in POSIX. However, this script identifies a wide 4095b7a5c8Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and 4195b7a5c8Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still 4295b7a5c8Smrg# have a pre-POSIX /bin/sh. 4395b7a5c8Smrg 4495b7a5c8Smrg 4527702724Smrgme=`echo "$0" | sed -e 's,.*/,,'` 4627702724Smrg 4727702724Smrgusage="\ 4827702724SmrgUsage: $0 [OPTION] 4927702724Smrg 50ae545d91SmrgOutput the configuration name of the system '$me' is run on. 5127702724Smrg 527cea3689SmrgOptions: 5327702724Smrg -h, --help print this help, then exit 5427702724Smrg -t, --time-stamp print date of last modification, then exit 5527702724Smrg -v, --version print version number, then exit 5627702724Smrg 5727702724SmrgReport bugs and patches to <config-patches@gnu.org>." 5827702724Smrg 5927702724Smrgversion="\ 6027702724SmrgGNU config.guess ($timestamp) 6127702724Smrg 6227702724SmrgOriginally written by Per Bothner. 63ae545d91SmrgCopyright 1992-2024 Free Software Foundation, Inc. 6427702724Smrg 6527702724SmrgThis is free software; see the source for copying conditions. There is NO 6627702724Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 6727702724Smrg 6827702724Smrghelp=" 69ae545d91SmrgTry '$me --help' for more information." 7027702724Smrg 7127702724Smrg# Parse command line 7227702724Smrgwhile test $# -gt 0 ; do 7327702724Smrg case $1 in 7427702724Smrg --time-stamp | --time* | -t ) 7527702724Smrg echo "$timestamp" ; exit ;; 7627702724Smrg --version | -v ) 7727702724Smrg echo "$version" ; exit ;; 7827702724Smrg --help | --h* | -h ) 7927702724Smrg echo "$usage"; exit ;; 8027702724Smrg -- ) # Stop option processing 8127702724Smrg shift; break ;; 8227702724Smrg - ) # Use stdin as input. 8327702724Smrg break ;; 8427702724Smrg -* ) 8527702724Smrg echo "$me: invalid option $1$help" >&2 8627702724Smrg exit 1 ;; 8727702724Smrg * ) 8827702724Smrg break ;; 8927702724Smrg esac 9027702724Smrgdone 9127702724Smrg 9227702724Smrgif test $# != 0; then 9327702724Smrg echo "$me: too many arguments$help" >&2 9427702724Smrg exit 1 9527702724Smrgfi 9627702724Smrg 9795b7a5c8Smrg# Just in case it came from the environment. 9895b7a5c8SmrgGUESS= 9927702724Smrg 10027702724Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a 10127702724Smrg# compiler to aid in system detection is discouraged as it requires 10227702724Smrg# temporary files to be created and, as you can see below, it is a 10327702724Smrg# headache to deal with in a portable fashion. 10427702724Smrg 105ae545d91Smrg# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still 106ae545d91Smrg# use 'HOST_CC' if defined, but it is deprecated. 10727702724Smrg 10827702724Smrg# Portable tmp directory creation inspired by the Autoconf team. 10927702724Smrg 11095b7a5c8Smrgtmp= 11195b7a5c8Smrg# shellcheck disable=SC2172 11295b7a5c8Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 11395b7a5c8Smrg 11495b7a5c8Smrgset_cc_for_build() { 11595b7a5c8Smrg # prevent multiple calls if $tmp is already set 11695b7a5c8Smrg test "$tmp" && return 0 11795b7a5c8Smrg : "${TMPDIR=/tmp}" 11895b7a5c8Smrg # shellcheck disable=SC2039,SC3028 11995b7a5c8Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || 12095b7a5c8Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || 12195b7a5c8Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || 12295b7a5c8Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } 12395b7a5c8Smrg dummy=$tmp/dummy 12495b7a5c8Smrg case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in 12595b7a5c8Smrg ,,) echo "int x;" > "$dummy.c" 12695b7a5c8Smrg for driver in cc gcc c89 c99 ; do 12795b7a5c8Smrg if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then 12895b7a5c8Smrg CC_FOR_BUILD=$driver 12995b7a5c8Smrg break 13095b7a5c8Smrg fi 13195b7a5c8Smrg done 13295b7a5c8Smrg if test x"$CC_FOR_BUILD" = x ; then 13395b7a5c8Smrg CC_FOR_BUILD=no_compiler_found 13495b7a5c8Smrg fi 13595b7a5c8Smrg ;; 13695b7a5c8Smrg ,,*) CC_FOR_BUILD=$CC ;; 13795b7a5c8Smrg ,*,*) CC_FOR_BUILD=$HOST_CC ;; 13895b7a5c8Smrg esac 13995b7a5c8Smrg} 14027702724Smrg 14127702724Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe. 14227702724Smrg# (ghazi@noc.rutgers.edu 1994-08-24) 14395b7a5c8Smrgif test -f /.attbin/uname ; then 14427702724Smrg PATH=$PATH:/.attbin ; export PATH 14527702724Smrgfi 14627702724Smrg 14727702724SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown 14827702724SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 14995b7a5c8SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 15027702724SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown 15127702724Smrg 15295b7a5c8Smrgcase $UNAME_SYSTEM in 1537cea3689SmrgLinux|GNU|GNU/*) 15495b7a5c8Smrg LIBC=unknown 1557cea3689Smrg 15695b7a5c8Smrg set_cc_for_build 1577cea3689Smrg cat <<-EOF > "$dummy.c" 158ae545d91Smrg #if defined(__ANDROID__) 159ae545d91Smrg LIBC=android 160ae545d91Smrg #else 1617cea3689Smrg #include <features.h> 1627cea3689Smrg #if defined(__UCLIBC__) 1637cea3689Smrg LIBC=uclibc 1647cea3689Smrg #elif defined(__dietlibc__) 1657cea3689Smrg LIBC=dietlibc 16695b7a5c8Smrg #elif defined(__GLIBC__) 1677cea3689Smrg LIBC=gnu 168ae545d91Smrg #elif defined(__LLVM_LIBC__) 169ae545d91Smrg LIBC=llvm 17095b7a5c8Smrg #else 17195b7a5c8Smrg #include <stdarg.h> 17295b7a5c8Smrg /* First heuristic to detect musl libc. */ 17395b7a5c8Smrg #ifdef __DEFINED_va_list 17495b7a5c8Smrg LIBC=musl 17595b7a5c8Smrg #endif 1767cea3689Smrg #endif 177ae545d91Smrg #endif 1787cea3689Smrg EOF 17995b7a5c8Smrg cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` 18095b7a5c8Smrg eval "$cc_set_libc" 1817cea3689Smrg 18295b7a5c8Smrg # Second heuristic to detect musl libc. 18395b7a5c8Smrg if [ "$LIBC" = unknown ] && 18495b7a5c8Smrg command -v ldd >/dev/null && 18595b7a5c8Smrg ldd --version 2>&1 | grep -q ^musl; then 18695b7a5c8Smrg LIBC=musl 18795b7a5c8Smrg fi 18895b7a5c8Smrg 18995b7a5c8Smrg # If the system lacks a compiler, then just pick glibc. 19095b7a5c8Smrg # We could probably try harder. 19195b7a5c8Smrg if [ "$LIBC" = unknown ]; then 19295b7a5c8Smrg LIBC=gnu 1937cea3689Smrg fi 1947cea3689Smrg ;; 1957cea3689Smrgesac 1967cea3689Smrg 19727702724Smrg# Note: order is significant - the case branches are not exclusive. 19827702724Smrg 19995b7a5c8Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in 20027702724Smrg *:NetBSD:*:*) 20127702724Smrg # NetBSD (nbsd) targets should (where applicable) match one or 202313a12fdSmrg # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, 20327702724Smrg # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently 20427702724Smrg # switched to ELF, *-*-netbsd* would select the old 20527702724Smrg # object file format. This provides both forward 20627702724Smrg # compatibility and a consistent mechanism for selecting the 20727702724Smrg # object file format. 20827702724Smrg # 20927702724Smrg # Note: NetBSD doesn't particularly care about the vendor 21027702724Smrg # portion of the name. We always set it to "unknown". 2117cea3689Smrg UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ 21295b7a5c8Smrg /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ 21395b7a5c8Smrg /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ 2147cea3689Smrg echo unknown)` 21595b7a5c8Smrg case $UNAME_MACHINE_ARCH in 21695b7a5c8Smrg aarch64eb) machine=aarch64_be-unknown ;; 21727702724Smrg armeb) machine=armeb-unknown ;; 21827702724Smrg arm*) machine=arm-unknown ;; 21927702724Smrg sh3el) machine=shl-unknown ;; 22027702724Smrg sh3eb) machine=sh-unknown ;; 221e19dfac4Smrg sh5el) machine=sh5le-unknown ;; 2227cea3689Smrg earmv*) 2237cea3689Smrg arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` 2247cea3689Smrg endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` 22595b7a5c8Smrg machine=${arch}${endian}-unknown 2267cea3689Smrg ;; 22795b7a5c8Smrg *) machine=$UNAME_MACHINE_ARCH-unknown ;; 22827702724Smrg esac 22927702724Smrg # The Operating System including object format, if it has switched 2307cea3689Smrg # to ELF recently (or will in the future) and ABI. 23195b7a5c8Smrg case $UNAME_MACHINE_ARCH in 2327cea3689Smrg earm*) 2337cea3689Smrg os=netbsdelf 2347cea3689Smrg ;; 23527702724Smrg arm*|i386|m68k|ns32k|sh3*|sparc|vax) 23695b7a5c8Smrg set_cc_for_build 23727702724Smrg if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 23800084f2cSmrg | grep -q __ELF__ 23927702724Smrg then 24027702724Smrg # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). 24127702724Smrg # Return netbsd for either. FIX? 24227702724Smrg os=netbsd 24327702724Smrg else 24427702724Smrg os=netbsdelf 24527702724Smrg fi 24627702724Smrg ;; 24727702724Smrg *) 248313a12fdSmrg os=netbsd 24927702724Smrg ;; 25027702724Smrg esac 2517cea3689Smrg # Determine ABI tags. 25295b7a5c8Smrg case $UNAME_MACHINE_ARCH in 2537cea3689Smrg earm*) 2547cea3689Smrg expr='s/^earmv[0-9]/-eabi/;s/eb$//' 2557cea3689Smrg abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` 2567cea3689Smrg ;; 2577cea3689Smrg esac 25827702724Smrg # The OS release 25927702724Smrg # Debian GNU/NetBSD machines have a different userland, and 26027702724Smrg # thus, need a distinct triplet. However, they do not need 26127702724Smrg # kernel version information, so it can be replaced with a 26227702724Smrg # suitable tag, in the style of linux-gnu. 26395b7a5c8Smrg case $UNAME_VERSION in 26427702724Smrg Debian*) 26527702724Smrg release='-gnu' 26627702724Smrg ;; 26727702724Smrg *) 2687cea3689Smrg release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` 26927702724Smrg ;; 27027702724Smrg esac 27127702724Smrg # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: 27227702724Smrg # contains redundant information, the shorter form: 27327702724Smrg # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. 27495b7a5c8Smrg GUESS=$machine-${os}${release}${abi-} 27595b7a5c8Smrg ;; 276313a12fdSmrg *:Bitrig:*:*) 277313a12fdSmrg UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` 27895b7a5c8Smrg GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE 27995b7a5c8Smrg ;; 28027702724Smrg *:OpenBSD:*:*) 28127702724Smrg UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` 28295b7a5c8Smrg GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE 28395b7a5c8Smrg ;; 28495b7a5c8Smrg *:SecBSD:*:*) 28595b7a5c8Smrg UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` 28695b7a5c8Smrg GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE 28795b7a5c8Smrg ;; 2887cea3689Smrg *:LibertyBSD:*:*) 2897cea3689Smrg UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` 29095b7a5c8Smrg GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE 29195b7a5c8Smrg ;; 2927cea3689Smrg *:MidnightBSD:*:*) 29395b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE 29495b7a5c8Smrg ;; 29527702724Smrg *:ekkoBSD:*:*) 29695b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE 29795b7a5c8Smrg ;; 29827702724Smrg *:SolidBSD:*:*) 29995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE 30095b7a5c8Smrg ;; 30195b7a5c8Smrg *:OS108:*:*) 30295b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE 30395b7a5c8Smrg ;; 30427702724Smrg macppc:MirBSD:*:*) 30595b7a5c8Smrg GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE 30695b7a5c8Smrg ;; 30727702724Smrg *:MirBSD:*:*) 30895b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE 30995b7a5c8Smrg ;; 3107cea3689Smrg *:Sortix:*:*) 31195b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-sortix 31295b7a5c8Smrg ;; 31395b7a5c8Smrg *:Twizzler:*:*) 31495b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-twizzler 31595b7a5c8Smrg ;; 3167cea3689Smrg *:Redox:*:*) 31795b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-redox 31895b7a5c8Smrg ;; 3197cea3689Smrg mips:OSF1:*.*) 32095b7a5c8Smrg GUESS=mips-dec-osf1 32195b7a5c8Smrg ;; 32227702724Smrg alpha:OSF1:*:*) 32395b7a5c8Smrg # Reset EXIT trap before exiting to avoid spurious non-zero exit code. 32495b7a5c8Smrg trap '' 0 32527702724Smrg case $UNAME_RELEASE in 32627702724Smrg *4.0) 32727702724Smrg UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` 32827702724Smrg ;; 32927702724Smrg *5.*) 330313a12fdSmrg UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` 33127702724Smrg ;; 33227702724Smrg esac 33327702724Smrg # According to Compaq, /usr/sbin/psrinfo has been available on 33427702724Smrg # OSF/1 and Tru64 systems produced since 1995. I hope that 33527702724Smrg # covers most systems running today. This code pipes the CPU 33627702724Smrg # types through head -n 1, so we only detect the type of CPU 0. 33727702724Smrg ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` 33895b7a5c8Smrg case $ALPHA_CPU_TYPE in 33927702724Smrg "EV4 (21064)") 3407cea3689Smrg UNAME_MACHINE=alpha ;; 34127702724Smrg "EV4.5 (21064)") 3427cea3689Smrg UNAME_MACHINE=alpha ;; 34327702724Smrg "LCA4 (21066/21068)") 3447cea3689Smrg UNAME_MACHINE=alpha ;; 34527702724Smrg "EV5 (21164)") 3467cea3689Smrg UNAME_MACHINE=alphaev5 ;; 34727702724Smrg "EV5.6 (21164A)") 3487cea3689Smrg UNAME_MACHINE=alphaev56 ;; 34927702724Smrg "EV5.6 (21164PC)") 3507cea3689Smrg UNAME_MACHINE=alphapca56 ;; 35127702724Smrg "EV5.7 (21164PC)") 3527cea3689Smrg UNAME_MACHINE=alphapca57 ;; 35327702724Smrg "EV6 (21264)") 3547cea3689Smrg UNAME_MACHINE=alphaev6 ;; 35527702724Smrg "EV6.7 (21264A)") 3567cea3689Smrg UNAME_MACHINE=alphaev67 ;; 35727702724Smrg "EV6.8CB (21264C)") 3587cea3689Smrg UNAME_MACHINE=alphaev68 ;; 35927702724Smrg "EV6.8AL (21264B)") 3607cea3689Smrg UNAME_MACHINE=alphaev68 ;; 36127702724Smrg "EV6.8CX (21264D)") 3627cea3689Smrg UNAME_MACHINE=alphaev68 ;; 36327702724Smrg "EV6.9A (21264/EV69A)") 3647cea3689Smrg UNAME_MACHINE=alphaev69 ;; 36527702724Smrg "EV7 (21364)") 3667cea3689Smrg UNAME_MACHINE=alphaev7 ;; 36727702724Smrg "EV7.9 (21364A)") 3687cea3689Smrg UNAME_MACHINE=alphaev79 ;; 36927702724Smrg esac 37027702724Smrg # A Pn.n version is a patched version. 37127702724Smrg # A Vn.n version is a released version. 37227702724Smrg # A Tn.n version is a released field test version. 37327702724Smrg # A Xn.n version is an unreleased experimental baselevel. 37427702724Smrg # 1.2 uses "1.2" for uname -r. 37595b7a5c8Smrg OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` 37695b7a5c8Smrg GUESS=$UNAME_MACHINE-dec-osf$OSF_REL 37795b7a5c8Smrg ;; 37827702724Smrg Amiga*:UNIX_System_V:4.0:*) 37995b7a5c8Smrg GUESS=m68k-unknown-sysv4 38095b7a5c8Smrg ;; 38127702724Smrg *:[Aa]miga[Oo][Ss]:*:*) 38295b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-amigaos 38395b7a5c8Smrg ;; 38427702724Smrg *:[Mm]orph[Oo][Ss]:*:*) 38595b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-morphos 38695b7a5c8Smrg ;; 38727702724Smrg *:OS/390:*:*) 38895b7a5c8Smrg GUESS=i370-ibm-openedition 38995b7a5c8Smrg ;; 39027702724Smrg *:z/VM:*:*) 39195b7a5c8Smrg GUESS=s390-ibm-zvmoe 39295b7a5c8Smrg ;; 39327702724Smrg *:OS400:*:*) 39495b7a5c8Smrg GUESS=powerpc-ibm-os400 39595b7a5c8Smrg ;; 39627702724Smrg arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) 39795b7a5c8Smrg GUESS=arm-acorn-riscix$UNAME_RELEASE 39895b7a5c8Smrg ;; 399313a12fdSmrg arm*:riscos:*:*|arm*:RISCOS:*:*) 40095b7a5c8Smrg GUESS=arm-unknown-riscos 40195b7a5c8Smrg ;; 40227702724Smrg SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) 40395b7a5c8Smrg GUESS=hppa1.1-hitachi-hiuxmpp 40495b7a5c8Smrg ;; 40527702724Smrg Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) 40627702724Smrg # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. 40795b7a5c8Smrg case `(/bin/universe) 2>/dev/null` in 40895b7a5c8Smrg att) GUESS=pyramid-pyramid-sysv3 ;; 40995b7a5c8Smrg *) GUESS=pyramid-pyramid-bsd ;; 41095b7a5c8Smrg esac 41195b7a5c8Smrg ;; 41227702724Smrg NILE*:*:*:dcosx) 41395b7a5c8Smrg GUESS=pyramid-pyramid-svr4 41495b7a5c8Smrg ;; 41527702724Smrg DRS?6000:unix:4.0:6*) 41695b7a5c8Smrg GUESS=sparc-icl-nx6 41795b7a5c8Smrg ;; 41827702724Smrg DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) 41927702724Smrg case `/usr/bin/uname -p` in 42095b7a5c8Smrg sparc) GUESS=sparc-icl-nx7 ;; 42195b7a5c8Smrg esac 42295b7a5c8Smrg ;; 42300084f2cSmrg s390x:SunOS:*:*) 42495b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 42595b7a5c8Smrg GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL 42695b7a5c8Smrg ;; 42727702724Smrg sun4H:SunOS:5.*:*) 42895b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 42995b7a5c8Smrg GUESS=sparc-hal-solaris2$SUN_REL 43095b7a5c8Smrg ;; 43127702724Smrg sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) 43295b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 43395b7a5c8Smrg GUESS=sparc-sun-solaris2$SUN_REL 43495b7a5c8Smrg ;; 43500084f2cSmrg i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) 43695b7a5c8Smrg GUESS=i386-pc-auroraux$UNAME_RELEASE 43795b7a5c8Smrg ;; 438e19dfac4Smrg i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) 43995b7a5c8Smrg set_cc_for_build 4407cea3689Smrg SUN_ARCH=i386 44100084f2cSmrg # If there is a compiler, see if it is configured for 64-bit objects. 44200084f2cSmrg # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. 44300084f2cSmrg # This test works for both compilers. 44495b7a5c8Smrg if test "$CC_FOR_BUILD" != no_compiler_found; then 44500084f2cSmrg if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ 446630e437aSmrg (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ 44700084f2cSmrg grep IS_64BIT_ARCH >/dev/null 44800084f2cSmrg then 4497cea3689Smrg SUN_ARCH=x86_64 45000084f2cSmrg fi 45100084f2cSmrg fi 45295b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 45395b7a5c8Smrg GUESS=$SUN_ARCH-pc-solaris2$SUN_REL 45495b7a5c8Smrg ;; 45527702724Smrg sun4*:SunOS:6*:*) 45627702724Smrg # According to config.sub, this is the proper way to canonicalize 45727702724Smrg # SunOS6. Hard to guess exactly what SunOS6 will be like, but 45827702724Smrg # it's likely to be more like Solaris than SunOS4. 45995b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 46095b7a5c8Smrg GUESS=sparc-sun-solaris3$SUN_REL 46195b7a5c8Smrg ;; 46227702724Smrg sun4*:SunOS:*:*) 46395b7a5c8Smrg case `/usr/bin/arch -k` in 46427702724Smrg Series*|S4*) 46527702724Smrg UNAME_RELEASE=`uname -v` 46627702724Smrg ;; 46727702724Smrg esac 468ae545d91Smrg # Japanese Language versions have a version number like '4.1.3-JL'. 46995b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` 47095b7a5c8Smrg GUESS=sparc-sun-sunos$SUN_REL 47195b7a5c8Smrg ;; 47227702724Smrg sun3*:SunOS:*:*) 47395b7a5c8Smrg GUESS=m68k-sun-sunos$UNAME_RELEASE 47495b7a5c8Smrg ;; 47527702724Smrg sun*:*:4.2BSD:*) 47627702724Smrg UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 4777cea3689Smrg test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 47895b7a5c8Smrg case `/bin/arch` in 47927702724Smrg sun3) 48095b7a5c8Smrg GUESS=m68k-sun-sunos$UNAME_RELEASE 48127702724Smrg ;; 48227702724Smrg sun4) 48395b7a5c8Smrg GUESS=sparc-sun-sunos$UNAME_RELEASE 48427702724Smrg ;; 48527702724Smrg esac 48695b7a5c8Smrg ;; 48727702724Smrg aushp:SunOS:*:*) 48895b7a5c8Smrg GUESS=sparc-auspex-sunos$UNAME_RELEASE 48995b7a5c8Smrg ;; 49027702724Smrg # The situation for MiNT is a little confusing. The machine name 49127702724Smrg # can be virtually everything (everything which is not 49227702724Smrg # "atarist" or "atariste" at least should have a processor 49327702724Smrg # > m68000). The system name ranges from "MiNT" over "FreeMiNT" 49427702724Smrg # to the lowercase version "mint" (or "freemint"). Finally 49527702724Smrg # the system name "TOS" denotes a system which is actually not 49627702724Smrg # MiNT. But MiNT is downward compatible to TOS, so this should 49727702724Smrg # be no problem. 49827702724Smrg atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) 49995b7a5c8Smrg GUESS=m68k-atari-mint$UNAME_RELEASE 50095b7a5c8Smrg ;; 50127702724Smrg atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) 50295b7a5c8Smrg GUESS=m68k-atari-mint$UNAME_RELEASE 50395b7a5c8Smrg ;; 50427702724Smrg *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) 50595b7a5c8Smrg GUESS=m68k-atari-mint$UNAME_RELEASE 50695b7a5c8Smrg ;; 50727702724Smrg milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) 50895b7a5c8Smrg GUESS=m68k-milan-mint$UNAME_RELEASE 50995b7a5c8Smrg ;; 51027702724Smrg hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) 51195b7a5c8Smrg GUESS=m68k-hades-mint$UNAME_RELEASE 51295b7a5c8Smrg ;; 51327702724Smrg *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) 51495b7a5c8Smrg GUESS=m68k-unknown-mint$UNAME_RELEASE 51595b7a5c8Smrg ;; 51627702724Smrg m68k:machten:*:*) 51795b7a5c8Smrg GUESS=m68k-apple-machten$UNAME_RELEASE 51895b7a5c8Smrg ;; 51927702724Smrg powerpc:machten:*:*) 52095b7a5c8Smrg GUESS=powerpc-apple-machten$UNAME_RELEASE 52195b7a5c8Smrg ;; 52227702724Smrg RISC*:Mach:*:*) 52395b7a5c8Smrg GUESS=mips-dec-mach_bsd4.3 52495b7a5c8Smrg ;; 52527702724Smrg RISC*:ULTRIX:*:*) 52695b7a5c8Smrg GUESS=mips-dec-ultrix$UNAME_RELEASE 52795b7a5c8Smrg ;; 52827702724Smrg VAX*:ULTRIX*:*:*) 52995b7a5c8Smrg GUESS=vax-dec-ultrix$UNAME_RELEASE 53095b7a5c8Smrg ;; 53127702724Smrg 2020:CLIX:*:* | 2430:CLIX:*:*) 53295b7a5c8Smrg GUESS=clipper-intergraph-clix$UNAME_RELEASE 53395b7a5c8Smrg ;; 53427702724Smrg mips:*:*:UMIPS | mips:*:*:RISCos) 53595b7a5c8Smrg set_cc_for_build 5367cea3689Smrg sed 's/^ //' << EOF > "$dummy.c" 53727702724Smrg#ifdef __cplusplus 53827702724Smrg#include <stdio.h> /* for printf() prototype */ 53927702724Smrg int main (int argc, char *argv[]) { 54027702724Smrg#else 54127702724Smrg int main (argc, argv) int argc; char *argv[]; { 54227702724Smrg#endif 54327702724Smrg #if defined (host_mips) && defined (MIPSEB) 54427702724Smrg #if defined (SYSTYPE_SYSV) 5457cea3689Smrg printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); 54627702724Smrg #endif 54727702724Smrg #if defined (SYSTYPE_SVR4) 5487cea3689Smrg printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); 54927702724Smrg #endif 55027702724Smrg #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) 5517cea3689Smrg printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); 55227702724Smrg #endif 55327702724Smrg #endif 55427702724Smrg exit (-1); 55527702724Smrg } 55627702724SmrgEOF 5577cea3689Smrg $CC_FOR_BUILD -o "$dummy" "$dummy.c" && 5587cea3689Smrg dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && 5597cea3689Smrg SYSTEM_NAME=`"$dummy" "$dummyarg"` && 56027702724Smrg { echo "$SYSTEM_NAME"; exit; } 56195b7a5c8Smrg GUESS=mips-mips-riscos$UNAME_RELEASE 56295b7a5c8Smrg ;; 56327702724Smrg Motorola:PowerMAX_OS:*:*) 56495b7a5c8Smrg GUESS=powerpc-motorola-powermax 56595b7a5c8Smrg ;; 56627702724Smrg Motorola:*:4.3:PL8-*) 56795b7a5c8Smrg GUESS=powerpc-harris-powermax 56895b7a5c8Smrg ;; 56927702724Smrg Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) 57095b7a5c8Smrg GUESS=powerpc-harris-powermax 57195b7a5c8Smrg ;; 57227702724Smrg Night_Hawk:Power_UNIX:*:*) 57395b7a5c8Smrg GUESS=powerpc-harris-powerunix 57495b7a5c8Smrg ;; 57527702724Smrg m88k:CX/UX:7*:*) 57695b7a5c8Smrg GUESS=m88k-harris-cxux7 57795b7a5c8Smrg ;; 57827702724Smrg m88k:*:4*:R4*) 57995b7a5c8Smrg GUESS=m88k-motorola-sysv4 58095b7a5c8Smrg ;; 58127702724Smrg m88k:*:3*:R3*) 58295b7a5c8Smrg GUESS=m88k-motorola-sysv3 58395b7a5c8Smrg ;; 58427702724Smrg AViiON:dgux:*:*) 585313a12fdSmrg # DG/UX returns AViiON for all architectures 586313a12fdSmrg UNAME_PROCESSOR=`/usr/bin/uname -p` 58795b7a5c8Smrg if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 58827702724Smrg then 58995b7a5c8Smrg if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ 59095b7a5c8Smrg test "$TARGET_BINARY_INTERFACE"x = x 59127702724Smrg then 59295b7a5c8Smrg GUESS=m88k-dg-dgux$UNAME_RELEASE 59327702724Smrg else 59495b7a5c8Smrg GUESS=m88k-dg-dguxbcs$UNAME_RELEASE 59527702724Smrg fi 59627702724Smrg else 59795b7a5c8Smrg GUESS=i586-dg-dgux$UNAME_RELEASE 59827702724Smrg fi 59995b7a5c8Smrg ;; 60027702724Smrg M88*:DolphinOS:*:*) # DolphinOS (SVR3) 60195b7a5c8Smrg GUESS=m88k-dolphin-sysv3 60295b7a5c8Smrg ;; 60327702724Smrg M88*:*:R3*:*) 60427702724Smrg # Delta 88k system running SVR3 60595b7a5c8Smrg GUESS=m88k-motorola-sysv3 60695b7a5c8Smrg ;; 60727702724Smrg XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) 60895b7a5c8Smrg GUESS=m88k-tektronix-sysv3 60995b7a5c8Smrg ;; 61027702724Smrg Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) 61195b7a5c8Smrg GUESS=m68k-tektronix-bsd 61295b7a5c8Smrg ;; 61327702724Smrg *:IRIX*:*:*) 61495b7a5c8Smrg IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` 61595b7a5c8Smrg GUESS=mips-sgi-irix$IRIX_REL 61695b7a5c8Smrg ;; 61727702724Smrg ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. 61895b7a5c8Smrg GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id 61995b7a5c8Smrg ;; # Note that: echo "'`uname -s`'" gives 'AIX ' 62027702724Smrg i*86:AIX:*:*) 62195b7a5c8Smrg GUESS=i386-ibm-aix 62295b7a5c8Smrg ;; 62327702724Smrg ia64:AIX:*:*) 62495b7a5c8Smrg if test -x /usr/bin/oslevel ; then 62527702724Smrg IBM_REV=`/usr/bin/oslevel` 62627702724Smrg else 62795b7a5c8Smrg IBM_REV=$UNAME_VERSION.$UNAME_RELEASE 62827702724Smrg fi 62995b7a5c8Smrg GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV 63095b7a5c8Smrg ;; 63127702724Smrg *:AIX:2:3) 63227702724Smrg if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 63395b7a5c8Smrg set_cc_for_build 6347cea3689Smrg sed 's/^ //' << EOF > "$dummy.c" 63527702724Smrg #include <sys/systemcfg.h> 63627702724Smrg 63727702724Smrg main() 63827702724Smrg { 63927702724Smrg if (!__power_pc()) 64027702724Smrg exit(1); 64127702724Smrg puts("powerpc-ibm-aix3.2.5"); 64227702724Smrg exit(0); 64327702724Smrg } 64427702724SmrgEOF 6457cea3689Smrg if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` 64627702724Smrg then 64795b7a5c8Smrg GUESS=$SYSTEM_NAME 64827702724Smrg else 64995b7a5c8Smrg GUESS=rs6000-ibm-aix3.2.5 65027702724Smrg fi 65127702724Smrg elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then 65295b7a5c8Smrg GUESS=rs6000-ibm-aix3.2.4 65327702724Smrg else 65495b7a5c8Smrg GUESS=rs6000-ibm-aix3.2 65527702724Smrg fi 65695b7a5c8Smrg ;; 657313a12fdSmrg *:AIX:*:[4567]) 65827702724Smrg IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 6597cea3689Smrg if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then 66027702724Smrg IBM_ARCH=rs6000 66127702724Smrg else 66227702724Smrg IBM_ARCH=powerpc 66327702724Smrg fi 66495b7a5c8Smrg if test -x /usr/bin/lslpp ; then 66595b7a5c8Smrg IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ 6667cea3689Smrg awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` 66727702724Smrg else 66895b7a5c8Smrg IBM_REV=$UNAME_VERSION.$UNAME_RELEASE 66927702724Smrg fi 67095b7a5c8Smrg GUESS=$IBM_ARCH-ibm-aix$IBM_REV 67195b7a5c8Smrg ;; 67227702724Smrg *:AIX:*:*) 67395b7a5c8Smrg GUESS=rs6000-ibm-aix 67495b7a5c8Smrg ;; 6757cea3689Smrg ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) 67695b7a5c8Smrg GUESS=romp-ibm-bsd4.4 67795b7a5c8Smrg ;; 67827702724Smrg ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and 67995b7a5c8Smrg GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to 68095b7a5c8Smrg ;; # report: romp-ibm BSD 4.3 68127702724Smrg *:BOSX:*:*) 68295b7a5c8Smrg GUESS=rs6000-bull-bosx 68395b7a5c8Smrg ;; 68427702724Smrg DPX/2?00:B.O.S.:*:*) 68595b7a5c8Smrg GUESS=m68k-bull-sysv3 68695b7a5c8Smrg ;; 68727702724Smrg 9000/[34]??:4.3bsd:1.*:*) 68895b7a5c8Smrg GUESS=m68k-hp-bsd 68995b7a5c8Smrg ;; 69027702724Smrg hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) 69195b7a5c8Smrg GUESS=m68k-hp-bsd4.4 69295b7a5c8Smrg ;; 69327702724Smrg 9000/[34678]??:HP-UX:*:*) 69495b7a5c8Smrg HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` 69595b7a5c8Smrg case $UNAME_MACHINE in 6967cea3689Smrg 9000/31?) HP_ARCH=m68000 ;; 6977cea3689Smrg 9000/[34]??) HP_ARCH=m68k ;; 69827702724Smrg 9000/[678][0-9][0-9]) 69995b7a5c8Smrg if test -x /usr/bin/getconf; then 70027702724Smrg sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` 701313a12fdSmrg sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` 70295b7a5c8Smrg case $sc_cpu_version in 7037cea3689Smrg 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 7047cea3689Smrg 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 705313a12fdSmrg 532) # CPU_PA_RISC2_0 70695b7a5c8Smrg case $sc_kernel_bits in 7077cea3689Smrg 32) HP_ARCH=hppa2.0n ;; 7087cea3689Smrg 64) HP_ARCH=hppa2.0w ;; 7097cea3689Smrg '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 710313a12fdSmrg esac ;; 711313a12fdSmrg esac 71227702724Smrg fi 71395b7a5c8Smrg if test "$HP_ARCH" = ""; then 71495b7a5c8Smrg set_cc_for_build 7157cea3689Smrg sed 's/^ //' << EOF > "$dummy.c" 71627702724Smrg 717313a12fdSmrg #define _HPUX_SOURCE 718313a12fdSmrg #include <stdlib.h> 719313a12fdSmrg #include <unistd.h> 72027702724Smrg 721313a12fdSmrg int main () 722313a12fdSmrg { 723313a12fdSmrg #if defined(_SC_KERNEL_BITS) 724313a12fdSmrg long bits = sysconf(_SC_KERNEL_BITS); 725313a12fdSmrg #endif 726313a12fdSmrg long cpu = sysconf (_SC_CPU_VERSION); 72727702724Smrg 728313a12fdSmrg switch (cpu) 729313a12fdSmrg { 730313a12fdSmrg case CPU_PA_RISC1_0: puts ("hppa1.0"); break; 731313a12fdSmrg case CPU_PA_RISC1_1: puts ("hppa1.1"); break; 732313a12fdSmrg case CPU_PA_RISC2_0: 733313a12fdSmrg #if defined(_SC_KERNEL_BITS) 734313a12fdSmrg switch (bits) 735313a12fdSmrg { 736313a12fdSmrg case 64: puts ("hppa2.0w"); break; 737313a12fdSmrg case 32: puts ("hppa2.0n"); break; 738313a12fdSmrg default: puts ("hppa2.0"); break; 739313a12fdSmrg } break; 740313a12fdSmrg #else /* !defined(_SC_KERNEL_BITS) */ 741313a12fdSmrg puts ("hppa2.0"); break; 742313a12fdSmrg #endif 743313a12fdSmrg default: puts ("hppa1.0"); break; 744313a12fdSmrg } 745313a12fdSmrg exit (0); 746313a12fdSmrg } 74727702724SmrgEOF 7487cea3689Smrg (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` 74927702724Smrg test -z "$HP_ARCH" && HP_ARCH=hppa 75027702724Smrg fi ;; 75127702724Smrg esac 75295b7a5c8Smrg if test "$HP_ARCH" = hppa2.0w 75327702724Smrg then 75495b7a5c8Smrg set_cc_for_build 75527702724Smrg 75627702724Smrg # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating 75727702724Smrg # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler 75827702724Smrg # generating 64-bit code. GNU and HP use different nomenclature: 75927702724Smrg # 76027702724Smrg # $ CC_FOR_BUILD=cc ./config.guess 76127702724Smrg # => hppa2.0w-hp-hpux11.23 76227702724Smrg # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess 76327702724Smrg # => hppa64-hp-hpux11.23 76427702724Smrg 7657cea3689Smrg if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | 76600084f2cSmrg grep -q __LP64__ 76727702724Smrg then 7687cea3689Smrg HP_ARCH=hppa2.0w 76927702724Smrg else 7707cea3689Smrg HP_ARCH=hppa64 77127702724Smrg fi 77227702724Smrg fi 77395b7a5c8Smrg GUESS=$HP_ARCH-hp-hpux$HPUX_REV 77495b7a5c8Smrg ;; 77527702724Smrg ia64:HP-UX:*:*) 77695b7a5c8Smrg HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` 77795b7a5c8Smrg GUESS=ia64-hp-hpux$HPUX_REV 77895b7a5c8Smrg ;; 77927702724Smrg 3050*:HI-UX:*:*) 78095b7a5c8Smrg set_cc_for_build 7817cea3689Smrg sed 's/^ //' << EOF > "$dummy.c" 78227702724Smrg #include <unistd.h> 78327702724Smrg int 78427702724Smrg main () 78527702724Smrg { 78627702724Smrg long cpu = sysconf (_SC_CPU_VERSION); 78727702724Smrg /* The order matters, because CPU_IS_HP_MC68K erroneously returns 78827702724Smrg true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct 78927702724Smrg results, however. */ 79027702724Smrg if (CPU_IS_PA_RISC (cpu)) 79127702724Smrg { 79227702724Smrg switch (cpu) 79327702724Smrg { 79427702724Smrg case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; 79527702724Smrg case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; 79627702724Smrg case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; 79727702724Smrg default: puts ("hppa-hitachi-hiuxwe2"); break; 79827702724Smrg } 79927702724Smrg } 80027702724Smrg else if (CPU_IS_HP_MC68K (cpu)) 80127702724Smrg puts ("m68k-hitachi-hiuxwe2"); 80227702724Smrg else puts ("unknown-hitachi-hiuxwe2"); 80327702724Smrg exit (0); 80427702724Smrg } 80527702724SmrgEOF 8067cea3689Smrg $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && 80727702724Smrg { echo "$SYSTEM_NAME"; exit; } 80895b7a5c8Smrg GUESS=unknown-hitachi-hiuxwe2 80995b7a5c8Smrg ;; 8107cea3689Smrg 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) 81195b7a5c8Smrg GUESS=hppa1.1-hp-bsd 81295b7a5c8Smrg ;; 81327702724Smrg 9000/8??:4.3bsd:*:*) 81495b7a5c8Smrg GUESS=hppa1.0-hp-bsd 81595b7a5c8Smrg ;; 81627702724Smrg *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) 81795b7a5c8Smrg GUESS=hppa1.0-hp-mpeix 81895b7a5c8Smrg ;; 8197cea3689Smrg hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) 82095b7a5c8Smrg GUESS=hppa1.1-hp-osf 82195b7a5c8Smrg ;; 82227702724Smrg hp8??:OSF1:*:*) 82395b7a5c8Smrg GUESS=hppa1.0-hp-osf 82495b7a5c8Smrg ;; 82527702724Smrg i*86:OSF1:*:*) 82695b7a5c8Smrg if test -x /usr/sbin/sysversion ; then 82795b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-osf1mk 82827702724Smrg else 82995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-osf1 83027702724Smrg fi 83195b7a5c8Smrg ;; 83227702724Smrg parisc*:Lites*:*:*) 83395b7a5c8Smrg GUESS=hppa1.1-hp-lites 83495b7a5c8Smrg ;; 83527702724Smrg C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) 83695b7a5c8Smrg GUESS=c1-convex-bsd 83795b7a5c8Smrg ;; 83827702724Smrg C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) 83927702724Smrg if getsysinfo -f scalar_acc 84027702724Smrg then echo c32-convex-bsd 84127702724Smrg else echo c2-convex-bsd 84227702724Smrg fi 843313a12fdSmrg exit ;; 84427702724Smrg C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) 84595b7a5c8Smrg GUESS=c34-convex-bsd 84695b7a5c8Smrg ;; 84727702724Smrg C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) 84895b7a5c8Smrg GUESS=c38-convex-bsd 84995b7a5c8Smrg ;; 85027702724Smrg C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) 85195b7a5c8Smrg GUESS=c4-convex-bsd 85295b7a5c8Smrg ;; 85327702724Smrg CRAY*Y-MP:*:*:*) 85495b7a5c8Smrg CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 85595b7a5c8Smrg GUESS=ymp-cray-unicos$CRAY_REL 85695b7a5c8Smrg ;; 85727702724Smrg CRAY*[A-Z]90:*:*:*) 8587cea3689Smrg echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ 85927702724Smrg | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ 86027702724Smrg -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ 86127702724Smrg -e 's/\.[^.]*$/.X/' 86227702724Smrg exit ;; 86327702724Smrg CRAY*TS:*:*:*) 86495b7a5c8Smrg CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 86595b7a5c8Smrg GUESS=t90-cray-unicos$CRAY_REL 86695b7a5c8Smrg ;; 86727702724Smrg CRAY*T3E:*:*:*) 86895b7a5c8Smrg CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 86995b7a5c8Smrg GUESS=alphaev5-cray-unicosmk$CRAY_REL 87095b7a5c8Smrg ;; 87127702724Smrg CRAY*SV1:*:*:*) 87295b7a5c8Smrg CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 87395b7a5c8Smrg GUESS=sv1-cray-unicos$CRAY_REL 87495b7a5c8Smrg ;; 87527702724Smrg *:UNICOS/mp:*:*) 87695b7a5c8Smrg CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` 87795b7a5c8Smrg GUESS=craynv-cray-unicosmp$CRAY_REL 87895b7a5c8Smrg ;; 87927702724Smrg F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) 8807cea3689Smrg FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` 8817cea3689Smrg FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` 8827cea3689Smrg FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` 88395b7a5c8Smrg GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} 88495b7a5c8Smrg ;; 88527702724Smrg 5000:UNIX_System_V:4.*:*) 8867cea3689Smrg FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` 8877cea3689Smrg FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` 88895b7a5c8Smrg GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} 88995b7a5c8Smrg ;; 89027702724Smrg i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 89195b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE 89295b7a5c8Smrg ;; 89327702724Smrg sparc*:BSD/OS:*:*) 89495b7a5c8Smrg GUESS=sparc-unknown-bsdi$UNAME_RELEASE 89595b7a5c8Smrg ;; 89627702724Smrg *:BSD/OS:*:*) 89795b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE 89895b7a5c8Smrg ;; 89995b7a5c8Smrg arm:FreeBSD:*:*) 90095b7a5c8Smrg UNAME_PROCESSOR=`uname -p` 90195b7a5c8Smrg set_cc_for_build 90295b7a5c8Smrg if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ 90395b7a5c8Smrg | grep -q __ARM_PCS_VFP 90495b7a5c8Smrg then 90595b7a5c8Smrg FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 90695b7a5c8Smrg GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi 90795b7a5c8Smrg else 90895b7a5c8Smrg FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 90995b7a5c8Smrg GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf 91095b7a5c8Smrg fi 91195b7a5c8Smrg ;; 91227702724Smrg *:FreeBSD:*:*) 913ae545d91Smrg UNAME_PROCESSOR=`uname -p` 91495b7a5c8Smrg case $UNAME_PROCESSOR in 915e19dfac4Smrg amd64) 9167cea3689Smrg UNAME_PROCESSOR=x86_64 ;; 9177cea3689Smrg i386) 9187cea3689Smrg UNAME_PROCESSOR=i586 ;; 91927702724Smrg esac 92095b7a5c8Smrg FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 92195b7a5c8Smrg GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL 92295b7a5c8Smrg ;; 92327702724Smrg i*:CYGWIN*:*) 92495b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-cygwin 92595b7a5c8Smrg ;; 926313a12fdSmrg *:MINGW64*:*) 92795b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-mingw64 92895b7a5c8Smrg ;; 929e19dfac4Smrg *:MINGW*:*) 93095b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-mingw32 93195b7a5c8Smrg ;; 9327cea3689Smrg *:MSYS*:*) 93395b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-msys 93495b7a5c8Smrg ;; 93527702724Smrg i*:PW*:*) 93695b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-pw32 93795b7a5c8Smrg ;; 938630e437aSmrg *:SerenityOS:*:*) 939630e437aSmrg GUESS=$UNAME_MACHINE-pc-serenity 940630e437aSmrg ;; 94100084f2cSmrg *:Interix*:*) 94295b7a5c8Smrg case $UNAME_MACHINE in 943e19dfac4Smrg x86) 94495b7a5c8Smrg GUESS=i586-pc-interix$UNAME_RELEASE 94595b7a5c8Smrg ;; 94600084f2cSmrg authenticamd | genuineintel | EM64T) 94795b7a5c8Smrg GUESS=x86_64-unknown-interix$UNAME_RELEASE 94895b7a5c8Smrg ;; 949e19dfac4Smrg IA64) 95095b7a5c8Smrg GUESS=ia64-unknown-interix$UNAME_RELEASE 95195b7a5c8Smrg ;; 952e19dfac4Smrg esac ;; 95327702724Smrg i*:UWIN*:*) 95495b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-uwin 95595b7a5c8Smrg ;; 95627702724Smrg amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) 95795b7a5c8Smrg GUESS=x86_64-pc-cygwin 95895b7a5c8Smrg ;; 95927702724Smrg prep*:SunOS:5.*:*) 96095b7a5c8Smrg SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` 96195b7a5c8Smrg GUESS=powerpcle-unknown-solaris2$SUN_REL 96295b7a5c8Smrg ;; 96327702724Smrg *:GNU:*:*) 96427702724Smrg # the GNU system 96595b7a5c8Smrg GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` 96695b7a5c8Smrg GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` 96795b7a5c8Smrg GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL 96895b7a5c8Smrg ;; 96927702724Smrg *:GNU/*:*:*) 97027702724Smrg # other systems with GNU libc and userland 97195b7a5c8Smrg GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` 97295b7a5c8Smrg GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 97395b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC 97495b7a5c8Smrg ;; 975630e437aSmrg x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) 976630e437aSmrg GUESS="$UNAME_MACHINE-pc-managarm-mlibc" 977630e437aSmrg ;; 978630e437aSmrg *:[Mm]anagarm:*:*) 979630e437aSmrg GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" 980630e437aSmrg ;; 98195b7a5c8Smrg *:Minix:*:*) 98295b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-minix 98395b7a5c8Smrg ;; 984313a12fdSmrg aarch64:Linux:*:*) 985ae545d91Smrg set_cc_for_build 986ae545d91Smrg CPU=$UNAME_MACHINE 987ae545d91Smrg LIBCABI=$LIBC 988ae545d91Smrg if test "$CC_FOR_BUILD" != no_compiler_found; then 989ae545d91Smrg ABI=64 990ae545d91Smrg sed 's/^ //' << EOF > "$dummy.c" 991ae545d91Smrg #ifdef __ARM_EABI__ 992ae545d91Smrg #ifdef __ARM_PCS_VFP 993ae545d91Smrg ABI=eabihf 994ae545d91Smrg #else 995ae545d91Smrg ABI=eabi 996ae545d91Smrg #endif 997ae545d91Smrg #endif 998ae545d91SmrgEOF 999ae545d91Smrg cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` 1000ae545d91Smrg eval "$cc_set_abi" 1001ae545d91Smrg case $ABI in 1002ae545d91Smrg eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; 1003ae545d91Smrg esac 1004ae545d91Smrg fi 1005ae545d91Smrg GUESS=$CPU-unknown-linux-$LIBCABI 100695b7a5c8Smrg ;; 1007313a12fdSmrg aarch64_be:Linux:*:*) 1008313a12fdSmrg UNAME_MACHINE=aarch64_be 100995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 101095b7a5c8Smrg ;; 101100084f2cSmrg alpha:Linux:*:*) 101295b7a5c8Smrg case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in 101300084f2cSmrg EV5) UNAME_MACHINE=alphaev5 ;; 101400084f2cSmrg EV56) UNAME_MACHINE=alphaev56 ;; 101500084f2cSmrg PCA56) UNAME_MACHINE=alphapca56 ;; 101600084f2cSmrg PCA57) UNAME_MACHINE=alphapca56 ;; 101700084f2cSmrg EV6) UNAME_MACHINE=alphaev6 ;; 101800084f2cSmrg EV67) UNAME_MACHINE=alphaev67 ;; 101900084f2cSmrg EV68*) UNAME_MACHINE=alphaev68 ;; 1020313a12fdSmrg esac 102100084f2cSmrg objdump --private-headers /bin/sh | grep -q ld.so.1 10227cea3689Smrg if test "$?" = 0 ; then LIBC=gnulibc1 ; fi 102395b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 102495b7a5c8Smrg ;; 102595b7a5c8Smrg arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) 102695b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 102795b7a5c8Smrg ;; 102827702724Smrg arm*:Linux:*:*) 102995b7a5c8Smrg set_cc_for_build 1030e19dfac4Smrg if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ 1031e19dfac4Smrg | grep -q __ARM_EABI__ 1032e19dfac4Smrg then 103395b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 1034e19dfac4Smrg else 1035313a12fdSmrg if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ 1036313a12fdSmrg | grep -q __ARM_PCS_VFP 1037313a12fdSmrg then 103895b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi 1039313a12fdSmrg else 104095b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf 1041313a12fdSmrg fi 1042e19dfac4Smrg fi 104395b7a5c8Smrg ;; 1044e19dfac4Smrg avr32*:Linux:*:*) 104595b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 104695b7a5c8Smrg ;; 104727702724Smrg cris:Linux:*:*) 104895b7a5c8Smrg GUESS=$UNAME_MACHINE-axis-linux-$LIBC 104995b7a5c8Smrg ;; 105027702724Smrg crisv32:Linux:*:*) 105195b7a5c8Smrg GUESS=$UNAME_MACHINE-axis-linux-$LIBC 105295b7a5c8Smrg ;; 10537cea3689Smrg e2k:Linux:*:*) 105495b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 105595b7a5c8Smrg ;; 105627702724Smrg frv:Linux:*:*) 105795b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 105895b7a5c8Smrg ;; 1059313a12fdSmrg hexagon:Linux:*:*) 106095b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 106195b7a5c8Smrg ;; 106200084f2cSmrg i*86:Linux:*:*) 106395b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-linux-$LIBC 106495b7a5c8Smrg ;; 106527702724Smrg ia64:Linux:*:*) 106695b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 106795b7a5c8Smrg ;; 10687cea3689Smrg k1om:Linux:*:*) 106995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 107095b7a5c8Smrg ;; 1071ae545d91Smrg kvx:Linux:*:*) 1072ae545d91Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 1073ae545d91Smrg ;; 1074ae545d91Smrg kvx:cos:*:*) 1075ae545d91Smrg GUESS=$UNAME_MACHINE-unknown-cos 1076ae545d91Smrg ;; 1077ae545d91Smrg kvx:mbr:*:*) 1078ae545d91Smrg GUESS=$UNAME_MACHINE-unknown-mbr 1079ae545d91Smrg ;; 1080630e437aSmrg loongarch32:Linux:*:* | loongarch64:Linux:*:*) 108195b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 108295b7a5c8Smrg ;; 108327702724Smrg m32r*:Linux:*:*) 108495b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 108595b7a5c8Smrg ;; 108627702724Smrg m68*:Linux:*:*) 108795b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 108895b7a5c8Smrg ;; 108900084f2cSmrg mips:Linux:*:* | mips64:Linux:*:*) 109095b7a5c8Smrg set_cc_for_build 109195b7a5c8Smrg IS_GLIBC=0 109295b7a5c8Smrg test x"${LIBC}" = xgnu && IS_GLIBC=1 10937cea3689Smrg sed 's/^ //' << EOF > "$dummy.c" 109427702724Smrg #undef CPU 109595b7a5c8Smrg #undef mips 109695b7a5c8Smrg #undef mipsel 109795b7a5c8Smrg #undef mips64 109895b7a5c8Smrg #undef mips64el 109995b7a5c8Smrg #if ${IS_GLIBC} && defined(_ABI64) 110095b7a5c8Smrg LIBCABI=gnuabi64 110195b7a5c8Smrg #else 110295b7a5c8Smrg #if ${IS_GLIBC} && defined(_ABIN32) 110395b7a5c8Smrg LIBCABI=gnuabin32 110495b7a5c8Smrg #else 110595b7a5c8Smrg LIBCABI=${LIBC} 110695b7a5c8Smrg #endif 110795b7a5c8Smrg #endif 110895b7a5c8Smrg 110995b7a5c8Smrg #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 111095b7a5c8Smrg CPU=mipsisa64r6 111195b7a5c8Smrg #else 111295b7a5c8Smrg #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 111395b7a5c8Smrg CPU=mipsisa32r6 111495b7a5c8Smrg #else 111595b7a5c8Smrg #if defined(__mips64) 111695b7a5c8Smrg CPU=mips64 111795b7a5c8Smrg #else 111895b7a5c8Smrg CPU=mips 111995b7a5c8Smrg #endif 112095b7a5c8Smrg #endif 112195b7a5c8Smrg #endif 112295b7a5c8Smrg 112327702724Smrg #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 112495b7a5c8Smrg MIPS_ENDIAN=el 112527702724Smrg #else 112627702724Smrg #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 112795b7a5c8Smrg MIPS_ENDIAN= 112827702724Smrg #else 112995b7a5c8Smrg MIPS_ENDIAN= 113027702724Smrg #endif 113127702724Smrg #endif 113227702724SmrgEOF 113395b7a5c8Smrg cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` 113495b7a5c8Smrg eval "$cc_set_vars" 113595b7a5c8Smrg test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } 113627702724Smrg ;; 11377cea3689Smrg mips64el:Linux:*:*) 113895b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 113995b7a5c8Smrg ;; 11407cea3689Smrg openrisc*:Linux:*:*) 114195b7a5c8Smrg GUESS=or1k-unknown-linux-$LIBC 114295b7a5c8Smrg ;; 11437cea3689Smrg or32:Linux:*:* | or1k*:Linux:*:*) 114495b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 114595b7a5c8Smrg ;; 114600084f2cSmrg padre:Linux:*:*) 114795b7a5c8Smrg GUESS=sparc-unknown-linux-$LIBC 114895b7a5c8Smrg ;; 114900084f2cSmrg parisc64:Linux:*:* | hppa64:Linux:*:*) 115095b7a5c8Smrg GUESS=hppa64-unknown-linux-$LIBC 115195b7a5c8Smrg ;; 115227702724Smrg parisc:Linux:*:* | hppa:Linux:*:*) 115327702724Smrg # Look for CPU level 115427702724Smrg case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 115595b7a5c8Smrg PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; 115695b7a5c8Smrg PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; 115795b7a5c8Smrg *) GUESS=hppa-unknown-linux-$LIBC ;; 115827702724Smrg esac 115995b7a5c8Smrg ;; 116000084f2cSmrg ppc64:Linux:*:*) 116195b7a5c8Smrg GUESS=powerpc64-unknown-linux-$LIBC 116295b7a5c8Smrg ;; 116300084f2cSmrg ppc:Linux:*:*) 116495b7a5c8Smrg GUESS=powerpc-unknown-linux-$LIBC 116595b7a5c8Smrg ;; 11667cea3689Smrg ppc64le:Linux:*:*) 116795b7a5c8Smrg GUESS=powerpc64le-unknown-linux-$LIBC 116895b7a5c8Smrg ;; 11697cea3689Smrg ppcle:Linux:*:*) 117095b7a5c8Smrg GUESS=powerpcle-unknown-linux-$LIBC 117195b7a5c8Smrg ;; 117295b7a5c8Smrg riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) 117395b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 117495b7a5c8Smrg ;; 117527702724Smrg s390:Linux:*:* | s390x:Linux:*:*) 117695b7a5c8Smrg GUESS=$UNAME_MACHINE-ibm-linux-$LIBC 117795b7a5c8Smrg ;; 117827702724Smrg sh64*:Linux:*:*) 117995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 118095b7a5c8Smrg ;; 118127702724Smrg sh*:Linux:*:*) 118295b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 118395b7a5c8Smrg ;; 118427702724Smrg sparc:Linux:*:* | sparc64:Linux:*:*) 118595b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 118695b7a5c8Smrg ;; 1187313a12fdSmrg tile*:Linux:*:*) 118895b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 118995b7a5c8Smrg ;; 119027702724Smrg vax:Linux:*:*) 119195b7a5c8Smrg GUESS=$UNAME_MACHINE-dec-linux-$LIBC 119295b7a5c8Smrg ;; 119327702724Smrg x86_64:Linux:*:*) 119495b7a5c8Smrg set_cc_for_build 1195630e437aSmrg CPU=$UNAME_MACHINE 119695b7a5c8Smrg LIBCABI=$LIBC 119795b7a5c8Smrg if test "$CC_FOR_BUILD" != no_compiler_found; then 1198630e437aSmrg ABI=64 1199630e437aSmrg sed 's/^ //' << EOF > "$dummy.c" 1200630e437aSmrg #ifdef __i386__ 1201630e437aSmrg ABI=x86 1202630e437aSmrg #else 1203630e437aSmrg #ifdef __ILP32__ 1204630e437aSmrg ABI=x32 1205630e437aSmrg #endif 1206630e437aSmrg #endif 1207630e437aSmrgEOF 1208630e437aSmrg cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` 1209630e437aSmrg eval "$cc_set_abi" 1210630e437aSmrg case $ABI in 1211630e437aSmrg x86) CPU=i686 ;; 1212630e437aSmrg x32) LIBCABI=${LIBC}x32 ;; 1213630e437aSmrg esac 121495b7a5c8Smrg fi 1215630e437aSmrg GUESS=$CPU-pc-linux-$LIBCABI 121695b7a5c8Smrg ;; 1217e19dfac4Smrg xtensa*:Linux:*:*) 121895b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-linux-$LIBC 121995b7a5c8Smrg ;; 122027702724Smrg i*86:DYNIX/ptx:4*:*) 122127702724Smrg # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. 122227702724Smrg # earlier versions are messed up and put the nodename in both 122327702724Smrg # sysname and nodename. 122495b7a5c8Smrg GUESS=i386-sequent-sysv4 122595b7a5c8Smrg ;; 122627702724Smrg i*86:UNIX_SV:4.2MP:2.*) 1227313a12fdSmrg # Unixware is an offshoot of SVR4, but it has its own version 1228313a12fdSmrg # number series starting with 2... 1229313a12fdSmrg # I am not positive that other SVR4 systems won't match this, 123027702724Smrg # I just have to hope. -- rms. 1231313a12fdSmrg # Use sysv4.2uw... so that sysv4* matches it. 123295b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION 123395b7a5c8Smrg ;; 123427702724Smrg i*86:OS/2:*:*) 1235ae545d91Smrg # If we were able to find 'uname', then EMX Unix compatibility 123627702724Smrg # is probably installed. 123795b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-os2-emx 123895b7a5c8Smrg ;; 123927702724Smrg i*86:XTS-300:*:STOP) 124095b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-stop 124195b7a5c8Smrg ;; 124227702724Smrg i*86:atheos:*:*) 124395b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-atheos 124495b7a5c8Smrg ;; 124527702724Smrg i*86:syllable:*:*) 124695b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-syllable 124795b7a5c8Smrg ;; 124800084f2cSmrg i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) 124995b7a5c8Smrg GUESS=i386-unknown-lynxos$UNAME_RELEASE 125095b7a5c8Smrg ;; 125127702724Smrg i*86:*DOS:*:*) 125295b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-msdosdjgpp 125395b7a5c8Smrg ;; 12547cea3689Smrg i*86:*:4.*:*) 12557cea3689Smrg UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` 125627702724Smrg if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then 125795b7a5c8Smrg GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL 125827702724Smrg else 125995b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL 126027702724Smrg fi 126195b7a5c8Smrg ;; 126227702724Smrg i*86:*:5:[678]*) 1263313a12fdSmrg # UnixWare 7.x, OpenUNIX and OpenServer 6. 126427702724Smrg case `/bin/uname -X | grep "^Machine"` in 126527702724Smrg *486*) UNAME_MACHINE=i486 ;; 126627702724Smrg *Pentium) UNAME_MACHINE=i586 ;; 126727702724Smrg *Pent*|*Celeron) UNAME_MACHINE=i686 ;; 126827702724Smrg esac 126995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 127095b7a5c8Smrg ;; 127127702724Smrg i*86:*:3.2:*) 127227702724Smrg if test -f /usr/options/cb.name; then 127327702724Smrg UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` 127495b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL 127527702724Smrg elif /bin/uname -X 2>/dev/null >/dev/null ; then 127627702724Smrg UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` 127727702724Smrg (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 127827702724Smrg (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ 127927702724Smrg && UNAME_MACHINE=i586 128027702724Smrg (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ 128127702724Smrg && UNAME_MACHINE=i686 128227702724Smrg (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ 128327702724Smrg && UNAME_MACHINE=i686 128495b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL 128527702724Smrg else 128695b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-sysv32 128727702724Smrg fi 128895b7a5c8Smrg ;; 128927702724Smrg pc:*:*:*) 129027702724Smrg # Left here for compatibility: 1291313a12fdSmrg # uname -m prints for DJGPP always 'pc', but it prints nothing about 1292313a12fdSmrg # the processor, so we play safe by assuming i586. 129300084f2cSmrg # Note: whatever this is, it MUST be the same as what config.sub 12947cea3689Smrg # prints for the "djgpp" host, or else GDB configure will decide that 129500084f2cSmrg # this is a cross-build. 129695b7a5c8Smrg GUESS=i586-pc-msdosdjgpp 129795b7a5c8Smrg ;; 129827702724Smrg Intel:Mach:3*:*) 129995b7a5c8Smrg GUESS=i386-pc-mach3 130095b7a5c8Smrg ;; 130127702724Smrg paragon:*:*:*) 130295b7a5c8Smrg GUESS=i860-intel-osf1 130395b7a5c8Smrg ;; 130427702724Smrg i860:*:4.*:*) # i860-SVR4 130527702724Smrg if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then 130695b7a5c8Smrg GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 130727702724Smrg else # Add other i860-SVR4 vendors below as they are discovered. 130895b7a5c8Smrg GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 130927702724Smrg fi 131095b7a5c8Smrg ;; 131127702724Smrg mini*:CTIX:SYS*5:*) 131227702724Smrg # "miniframe" 131395b7a5c8Smrg GUESS=m68010-convergent-sysv 131495b7a5c8Smrg ;; 131527702724Smrg mc68k:UNIX:SYSTEM5:3.51m) 131695b7a5c8Smrg GUESS=m68k-convergent-sysv 131795b7a5c8Smrg ;; 131827702724Smrg M680?0:D-NIX:5.3:*) 131995b7a5c8Smrg GUESS=m68k-diab-dnix 132095b7a5c8Smrg ;; 132127702724Smrg M68*:*:R3V[5678]*:*) 132227702724Smrg test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 132327702724Smrg 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) 132427702724Smrg OS_REL='' 132527702724Smrg test -r /etc/.relid \ 132627702724Smrg && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 132727702724Smrg /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 13287cea3689Smrg && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } 132927702724Smrg /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 13307cea3689Smrg && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 133127702724Smrg 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 1332313a12fdSmrg /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1333313a12fdSmrg && { echo i486-ncr-sysv4; exit; } ;; 133400084f2cSmrg NCR*:*:4.2:* | MPRAS*:*:4.2:*) 133500084f2cSmrg OS_REL='.3' 133600084f2cSmrg test -r /etc/.relid \ 133700084f2cSmrg && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 133800084f2cSmrg /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 13397cea3689Smrg && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } 134000084f2cSmrg /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 13417cea3689Smrg && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } 134200084f2cSmrg /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ 13437cea3689Smrg && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 134427702724Smrg m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) 134595b7a5c8Smrg GUESS=m68k-unknown-lynxos$UNAME_RELEASE 134695b7a5c8Smrg ;; 134727702724Smrg mc68030:UNIX_System_V:4.*:*) 134895b7a5c8Smrg GUESS=m68k-atari-sysv4 134995b7a5c8Smrg ;; 135027702724Smrg TSUNAMI:LynxOS:2.*:*) 135195b7a5c8Smrg GUESS=sparc-unknown-lynxos$UNAME_RELEASE 135295b7a5c8Smrg ;; 135327702724Smrg rs6000:LynxOS:2.*:*) 135495b7a5c8Smrg GUESS=rs6000-unknown-lynxos$UNAME_RELEASE 135595b7a5c8Smrg ;; 135600084f2cSmrg PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) 135795b7a5c8Smrg GUESS=powerpc-unknown-lynxos$UNAME_RELEASE 135895b7a5c8Smrg ;; 135927702724Smrg SM[BE]S:UNIX_SV:*:*) 136095b7a5c8Smrg GUESS=mips-dde-sysv$UNAME_RELEASE 136195b7a5c8Smrg ;; 136227702724Smrg RM*:ReliantUNIX-*:*:*) 136395b7a5c8Smrg GUESS=mips-sni-sysv4 136495b7a5c8Smrg ;; 136527702724Smrg RM*:SINIX-*:*:*) 136695b7a5c8Smrg GUESS=mips-sni-sysv4 136795b7a5c8Smrg ;; 136827702724Smrg *:SINIX-*:*:*) 136927702724Smrg if uname -p 2>/dev/null >/dev/null ; then 137027702724Smrg UNAME_MACHINE=`(uname -p) 2>/dev/null` 137195b7a5c8Smrg GUESS=$UNAME_MACHINE-sni-sysv4 137227702724Smrg else 137395b7a5c8Smrg GUESS=ns32k-sni-sysv 137427702724Smrg fi 137595b7a5c8Smrg ;; 1376ae545d91Smrg PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort 1377313a12fdSmrg # says <Richard.M.Bartel@ccMail.Census.GOV> 137895b7a5c8Smrg GUESS=i586-unisys-sysv4 137995b7a5c8Smrg ;; 138027702724Smrg *:UNIX_System_V:4*:FTX*) 138127702724Smrg # From Gerald Hewes <hewes@openmarket.com>. 138227702724Smrg # How about differentiating between stratus architectures? -djm 138395b7a5c8Smrg GUESS=hppa1.1-stratus-sysv4 138495b7a5c8Smrg ;; 138527702724Smrg *:*:*:FTX*) 138627702724Smrg # From seanf@swdc.stratus.com. 138795b7a5c8Smrg GUESS=i860-stratus-sysv4 138895b7a5c8Smrg ;; 138927702724Smrg i*86:VOS:*:*) 139027702724Smrg # From Paul.Green@stratus.com. 139195b7a5c8Smrg GUESS=$UNAME_MACHINE-stratus-vos 139295b7a5c8Smrg ;; 139327702724Smrg *:VOS:*:*) 139427702724Smrg # From Paul.Green@stratus.com. 139595b7a5c8Smrg GUESS=hppa1.1-stratus-vos 139695b7a5c8Smrg ;; 139727702724Smrg mc68*:A/UX:*:*) 139895b7a5c8Smrg GUESS=m68k-apple-aux$UNAME_RELEASE 139995b7a5c8Smrg ;; 140027702724Smrg news*:NEWS-OS:6*:*) 140195b7a5c8Smrg GUESS=mips-sony-newsos6 140295b7a5c8Smrg ;; 140327702724Smrg R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) 140495b7a5c8Smrg if test -d /usr/nec; then 140595b7a5c8Smrg GUESS=mips-nec-sysv$UNAME_RELEASE 140627702724Smrg else 140795b7a5c8Smrg GUESS=mips-unknown-sysv$UNAME_RELEASE 140827702724Smrg fi 140995b7a5c8Smrg ;; 141027702724Smrg BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. 141195b7a5c8Smrg GUESS=powerpc-be-beos 141295b7a5c8Smrg ;; 141327702724Smrg BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. 141495b7a5c8Smrg GUESS=powerpc-apple-beos 141595b7a5c8Smrg ;; 141627702724Smrg BePC:BeOS:*:*) # BeOS running on Intel PC compatible. 141795b7a5c8Smrg GUESS=i586-pc-beos 141895b7a5c8Smrg ;; 141900084f2cSmrg BePC:Haiku:*:*) # Haiku running on Intel PC compatible. 142095b7a5c8Smrg GUESS=i586-pc-haiku 142195b7a5c8Smrg ;; 1422630e437aSmrg ppc:Haiku:*:*) # Haiku running on Apple PowerPC 1423630e437aSmrg GUESS=powerpc-apple-haiku 1424630e437aSmrg ;; 1425630e437aSmrg *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) 1426630e437aSmrg GUESS=$UNAME_MACHINE-unknown-haiku 142795b7a5c8Smrg ;; 142827702724Smrg SX-4:SUPER-UX:*:*) 142995b7a5c8Smrg GUESS=sx4-nec-superux$UNAME_RELEASE 143095b7a5c8Smrg ;; 143127702724Smrg SX-5:SUPER-UX:*:*) 143295b7a5c8Smrg GUESS=sx5-nec-superux$UNAME_RELEASE 143395b7a5c8Smrg ;; 143427702724Smrg SX-6:SUPER-UX:*:*) 143595b7a5c8Smrg GUESS=sx6-nec-superux$UNAME_RELEASE 143695b7a5c8Smrg ;; 1437e19dfac4Smrg SX-7:SUPER-UX:*:*) 143895b7a5c8Smrg GUESS=sx7-nec-superux$UNAME_RELEASE 143995b7a5c8Smrg ;; 1440e19dfac4Smrg SX-8:SUPER-UX:*:*) 144195b7a5c8Smrg GUESS=sx8-nec-superux$UNAME_RELEASE 144295b7a5c8Smrg ;; 1443e19dfac4Smrg SX-8R:SUPER-UX:*:*) 144495b7a5c8Smrg GUESS=sx8r-nec-superux$UNAME_RELEASE 144595b7a5c8Smrg ;; 14467cea3689Smrg SX-ACE:SUPER-UX:*:*) 144795b7a5c8Smrg GUESS=sxace-nec-superux$UNAME_RELEASE 144895b7a5c8Smrg ;; 144927702724Smrg Power*:Rhapsody:*:*) 145095b7a5c8Smrg GUESS=powerpc-apple-rhapsody$UNAME_RELEASE 145195b7a5c8Smrg ;; 145227702724Smrg *:Rhapsody:*:*) 145395b7a5c8Smrg GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE 145495b7a5c8Smrg ;; 145595b7a5c8Smrg arm64:Darwin:*:*) 145695b7a5c8Smrg GUESS=aarch64-apple-darwin$UNAME_RELEASE 145795b7a5c8Smrg ;; 145827702724Smrg *:Darwin:*:*) 145995b7a5c8Smrg UNAME_PROCESSOR=`uname -p` 146095b7a5c8Smrg case $UNAME_PROCESSOR in 146195b7a5c8Smrg unknown) UNAME_PROCESSOR=powerpc ;; 146295b7a5c8Smrg esac 146395b7a5c8Smrg if command -v xcode-select > /dev/null 2> /dev/null && \ 146495b7a5c8Smrg ! xcode-select --print-path > /dev/null 2> /dev/null ; then 146595b7a5c8Smrg # Avoid executing cc if there is no toolchain installed as 146695b7a5c8Smrg # cc will be a stub that puts up a graphical alert 146795b7a5c8Smrg # prompting the user to install developer tools. 146895b7a5c8Smrg CC_FOR_BUILD=no_compiler_found 146995b7a5c8Smrg else 147095b7a5c8Smrg set_cc_for_build 14717cea3689Smrg fi 147295b7a5c8Smrg if test "$CC_FOR_BUILD" != no_compiler_found; then 147395b7a5c8Smrg if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ 147495b7a5c8Smrg (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 147595b7a5c8Smrg grep IS_64BIT_ARCH >/dev/null 147695b7a5c8Smrg then 147795b7a5c8Smrg case $UNAME_PROCESSOR in 147895b7a5c8Smrg i386) UNAME_PROCESSOR=x86_64 ;; 147995b7a5c8Smrg powerpc) UNAME_PROCESSOR=powerpc64 ;; 148095b7a5c8Smrg esac 148195b7a5c8Smrg fi 148295b7a5c8Smrg # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc 148395b7a5c8Smrg if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ 148495b7a5c8Smrg (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 148595b7a5c8Smrg grep IS_PPC >/dev/null 148695b7a5c8Smrg then 148795b7a5c8Smrg UNAME_PROCESSOR=powerpc 14887cea3689Smrg fi 14897cea3689Smrg elif test "$UNAME_PROCESSOR" = i386 ; then 149095b7a5c8Smrg # uname -m returns i386 or x86_64 149195b7a5c8Smrg UNAME_PROCESSOR=$UNAME_MACHINE 14927cea3689Smrg fi 149395b7a5c8Smrg GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE 149495b7a5c8Smrg ;; 149527702724Smrg *:procnto*:*:* | *:QNX:[0123456789]*:*) 149627702724Smrg UNAME_PROCESSOR=`uname -p` 14977cea3689Smrg if test "$UNAME_PROCESSOR" = x86; then 149827702724Smrg UNAME_PROCESSOR=i386 149927702724Smrg UNAME_MACHINE=pc 150027702724Smrg fi 150195b7a5c8Smrg GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE 150295b7a5c8Smrg ;; 150327702724Smrg *:QNX:*:4*) 150495b7a5c8Smrg GUESS=i386-pc-qnx 150595b7a5c8Smrg ;; 15067cea3689Smrg NEO-*:NONSTOP_KERNEL:*:*) 150795b7a5c8Smrg GUESS=neo-tandem-nsk$UNAME_RELEASE 150895b7a5c8Smrg ;; 1509313a12fdSmrg NSE-*:NONSTOP_KERNEL:*:*) 151095b7a5c8Smrg GUESS=nse-tandem-nsk$UNAME_RELEASE 151195b7a5c8Smrg ;; 15127cea3689Smrg NSR-*:NONSTOP_KERNEL:*:*) 151395b7a5c8Smrg GUESS=nsr-tandem-nsk$UNAME_RELEASE 151495b7a5c8Smrg ;; 15157cea3689Smrg NSV-*:NONSTOP_KERNEL:*:*) 151695b7a5c8Smrg GUESS=nsv-tandem-nsk$UNAME_RELEASE 151795b7a5c8Smrg ;; 15187cea3689Smrg NSX-*:NONSTOP_KERNEL:*:*) 151995b7a5c8Smrg GUESS=nsx-tandem-nsk$UNAME_RELEASE 152095b7a5c8Smrg ;; 152127702724Smrg *:NonStop-UX:*:*) 152295b7a5c8Smrg GUESS=mips-compaq-nonstopux 152395b7a5c8Smrg ;; 152427702724Smrg BS2000:POSIX*:*:*) 152595b7a5c8Smrg GUESS=bs2000-siemens-sysv 152695b7a5c8Smrg ;; 152727702724Smrg DS/*:UNIX_System_V:*:*) 152895b7a5c8Smrg GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE 152995b7a5c8Smrg ;; 153027702724Smrg *:Plan9:*:*) 153127702724Smrg # "uname -m" is not consistent, so use $cputype instead. 386 153227702724Smrg # is converted to i386 for consistency with other x86 153327702724Smrg # operating systems. 153495b7a5c8Smrg if test "${cputype-}" = 386; then 153527702724Smrg UNAME_MACHINE=i386 153695b7a5c8Smrg elif test "x${cputype-}" != x; then 153795b7a5c8Smrg UNAME_MACHINE=$cputype 153827702724Smrg fi 153995b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-plan9 154095b7a5c8Smrg ;; 154127702724Smrg *:TOPS-10:*:*) 154295b7a5c8Smrg GUESS=pdp10-unknown-tops10 154395b7a5c8Smrg ;; 154427702724Smrg *:TENEX:*:*) 154595b7a5c8Smrg GUESS=pdp10-unknown-tenex 154695b7a5c8Smrg ;; 154727702724Smrg KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) 154895b7a5c8Smrg GUESS=pdp10-dec-tops20 154995b7a5c8Smrg ;; 155027702724Smrg XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) 155195b7a5c8Smrg GUESS=pdp10-xkl-tops20 155295b7a5c8Smrg ;; 155327702724Smrg *:TOPS-20:*:*) 155495b7a5c8Smrg GUESS=pdp10-unknown-tops20 155595b7a5c8Smrg ;; 155627702724Smrg *:ITS:*:*) 155795b7a5c8Smrg GUESS=pdp10-unknown-its 155895b7a5c8Smrg ;; 155927702724Smrg SEI:*:*:SEIUX) 156095b7a5c8Smrg GUESS=mips-sei-seiux$UNAME_RELEASE 156195b7a5c8Smrg ;; 156227702724Smrg *:DragonFly:*:*) 156395b7a5c8Smrg DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` 156495b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL 156595b7a5c8Smrg ;; 156627702724Smrg *:*VMS:*:*) 1567313a12fdSmrg UNAME_MACHINE=`(uname -p) 2>/dev/null` 156895b7a5c8Smrg case $UNAME_MACHINE in 156995b7a5c8Smrg A*) GUESS=alpha-dec-vms ;; 157095b7a5c8Smrg I*) GUESS=ia64-dec-vms ;; 157195b7a5c8Smrg V*) GUESS=vax-dec-vms ;; 157227702724Smrg esac ;; 157327702724Smrg *:XENIX:*:SysV) 157495b7a5c8Smrg GUESS=i386-pc-xenix 157595b7a5c8Smrg ;; 157627702724Smrg i*86:skyos:*:*) 157795b7a5c8Smrg SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` 157895b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL 157995b7a5c8Smrg ;; 158027702724Smrg i*86:rdos:*:*) 158195b7a5c8Smrg GUESS=$UNAME_MACHINE-pc-rdos 158295b7a5c8Smrg ;; 1583630e437aSmrg i*86:Fiwix:*:*) 1584630e437aSmrg GUESS=$UNAME_MACHINE-pc-fiwix 1585630e437aSmrg ;; 158695b7a5c8Smrg *:AROS:*:*) 158795b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-aros 158895b7a5c8Smrg ;; 1589313a12fdSmrg x86_64:VMkernel:*:*) 159095b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-esx 159195b7a5c8Smrg ;; 15927cea3689Smrg amd64:Isilon\ OneFS:*:*) 159395b7a5c8Smrg GUESS=x86_64-unknown-onefs 159495b7a5c8Smrg ;; 159595b7a5c8Smrg *:Unleashed:*:*) 159695b7a5c8Smrg GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE 159795b7a5c8Smrg ;; 1598ae545d91Smrg *:Ironclad:*:*) 1599ae545d91Smrg GUESS=$UNAME_MACHINE-unknown-ironclad 1600ae545d91Smrg ;; 160127702724Smrgesac 160227702724Smrg 160395b7a5c8Smrg# Do we have a guess based on uname results? 160495b7a5c8Smrgif test "x$GUESS" != x; then 160595b7a5c8Smrg echo "$GUESS" 160695b7a5c8Smrg exit 160795b7a5c8Smrgfi 160895b7a5c8Smrg 160995b7a5c8Smrg# No uname command or uname output not recognized. 161095b7a5c8Smrgset_cc_for_build 161195b7a5c8Smrgcat > "$dummy.c" <<EOF 161295b7a5c8Smrg#ifdef _SEQUENT_ 161395b7a5c8Smrg#include <sys/types.h> 161495b7a5c8Smrg#include <sys/utsname.h> 161595b7a5c8Smrg#endif 161695b7a5c8Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) 161795b7a5c8Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) 161895b7a5c8Smrg#include <signal.h> 161995b7a5c8Smrg#if defined(_SIZE_T_) || defined(SIGLOST) 162095b7a5c8Smrg#include <sys/utsname.h> 162195b7a5c8Smrg#endif 162295b7a5c8Smrg#endif 162395b7a5c8Smrg#endif 162495b7a5c8Smrgmain () 162595b7a5c8Smrg{ 162695b7a5c8Smrg#if defined (sony) 162795b7a5c8Smrg#if defined (MIPSEB) 162895b7a5c8Smrg /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, 162995b7a5c8Smrg I don't know.... */ 163095b7a5c8Smrg printf ("mips-sony-bsd\n"); exit (0); 163195b7a5c8Smrg#else 163295b7a5c8Smrg#include <sys/param.h> 163395b7a5c8Smrg printf ("m68k-sony-newsos%s\n", 163495b7a5c8Smrg#ifdef NEWSOS4 163595b7a5c8Smrg "4" 163695b7a5c8Smrg#else 163795b7a5c8Smrg "" 163895b7a5c8Smrg#endif 163995b7a5c8Smrg ); exit (0); 164095b7a5c8Smrg#endif 164195b7a5c8Smrg#endif 164295b7a5c8Smrg 164395b7a5c8Smrg#if defined (NeXT) 164495b7a5c8Smrg#if !defined (__ARCHITECTURE__) 164595b7a5c8Smrg#define __ARCHITECTURE__ "m68k" 164695b7a5c8Smrg#endif 164795b7a5c8Smrg int version; 164895b7a5c8Smrg version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; 164995b7a5c8Smrg if (version < 4) 165095b7a5c8Smrg printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); 165195b7a5c8Smrg else 165295b7a5c8Smrg printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); 165395b7a5c8Smrg exit (0); 165495b7a5c8Smrg#endif 165595b7a5c8Smrg 165695b7a5c8Smrg#if defined (MULTIMAX) || defined (n16) 165795b7a5c8Smrg#if defined (UMAXV) 165895b7a5c8Smrg printf ("ns32k-encore-sysv\n"); exit (0); 165995b7a5c8Smrg#else 166095b7a5c8Smrg#if defined (CMU) 166195b7a5c8Smrg printf ("ns32k-encore-mach\n"); exit (0); 166295b7a5c8Smrg#else 166395b7a5c8Smrg printf ("ns32k-encore-bsd\n"); exit (0); 166495b7a5c8Smrg#endif 166595b7a5c8Smrg#endif 166695b7a5c8Smrg#endif 166795b7a5c8Smrg 166895b7a5c8Smrg#if defined (__386BSD__) 166995b7a5c8Smrg printf ("i386-pc-bsd\n"); exit (0); 167095b7a5c8Smrg#endif 167195b7a5c8Smrg 167295b7a5c8Smrg#if defined (sequent) 167395b7a5c8Smrg#if defined (i386) 167495b7a5c8Smrg printf ("i386-sequent-dynix\n"); exit (0); 167595b7a5c8Smrg#endif 167695b7a5c8Smrg#if defined (ns32000) 167795b7a5c8Smrg printf ("ns32k-sequent-dynix\n"); exit (0); 167895b7a5c8Smrg#endif 167995b7a5c8Smrg#endif 168095b7a5c8Smrg 168195b7a5c8Smrg#if defined (_SEQUENT_) 168295b7a5c8Smrg struct utsname un; 168395b7a5c8Smrg 168495b7a5c8Smrg uname(&un); 168595b7a5c8Smrg if (strncmp(un.version, "V2", 2) == 0) { 168695b7a5c8Smrg printf ("i386-sequent-ptx2\n"); exit (0); 168795b7a5c8Smrg } 168895b7a5c8Smrg if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ 168995b7a5c8Smrg printf ("i386-sequent-ptx1\n"); exit (0); 169095b7a5c8Smrg } 169195b7a5c8Smrg printf ("i386-sequent-ptx\n"); exit (0); 169295b7a5c8Smrg#endif 169395b7a5c8Smrg 169495b7a5c8Smrg#if defined (vax) 169595b7a5c8Smrg#if !defined (ultrix) 169695b7a5c8Smrg#include <sys/param.h> 169795b7a5c8Smrg#if defined (BSD) 169895b7a5c8Smrg#if BSD == 43 169995b7a5c8Smrg printf ("vax-dec-bsd4.3\n"); exit (0); 170095b7a5c8Smrg#else 170195b7a5c8Smrg#if BSD == 199006 170295b7a5c8Smrg printf ("vax-dec-bsd4.3reno\n"); exit (0); 170395b7a5c8Smrg#else 170495b7a5c8Smrg printf ("vax-dec-bsd\n"); exit (0); 170595b7a5c8Smrg#endif 170695b7a5c8Smrg#endif 170795b7a5c8Smrg#else 170895b7a5c8Smrg printf ("vax-dec-bsd\n"); exit (0); 170995b7a5c8Smrg#endif 171095b7a5c8Smrg#else 171195b7a5c8Smrg#if defined(_SIZE_T_) || defined(SIGLOST) 171295b7a5c8Smrg struct utsname un; 171395b7a5c8Smrg uname (&un); 171495b7a5c8Smrg printf ("vax-dec-ultrix%s\n", un.release); exit (0); 171595b7a5c8Smrg#else 171695b7a5c8Smrg printf ("vax-dec-ultrix\n"); exit (0); 171795b7a5c8Smrg#endif 171895b7a5c8Smrg#endif 171995b7a5c8Smrg#endif 172095b7a5c8Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) 172195b7a5c8Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) 172295b7a5c8Smrg#if defined(_SIZE_T_) || defined(SIGLOST) 172395b7a5c8Smrg struct utsname *un; 172495b7a5c8Smrg uname (&un); 172595b7a5c8Smrg printf ("mips-dec-ultrix%s\n", un.release); exit (0); 172695b7a5c8Smrg#else 172795b7a5c8Smrg printf ("mips-dec-ultrix\n"); exit (0); 172895b7a5c8Smrg#endif 172995b7a5c8Smrg#endif 173095b7a5c8Smrg#endif 173195b7a5c8Smrg 173295b7a5c8Smrg#if defined (alliant) && defined (i860) 173395b7a5c8Smrg printf ("i860-alliant-bsd\n"); exit (0); 173495b7a5c8Smrg#endif 173595b7a5c8Smrg 173695b7a5c8Smrg exit (1); 173795b7a5c8Smrg} 173895b7a5c8SmrgEOF 173995b7a5c8Smrg 174095b7a5c8Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && 174195b7a5c8Smrg { echo "$SYSTEM_NAME"; exit; } 174295b7a5c8Smrg 174395b7a5c8Smrg# Apollos put the system type in the environment. 174495b7a5c8Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } 174595b7a5c8Smrg 17467cea3689Smrgecho "$0: unable to guess system type" >&2 174727702724Smrg 174895b7a5c8Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in 17497cea3689Smrg mips:Linux | mips64:Linux) 17507cea3689Smrg # If we got here on MIPS GNU/Linux, output extra information. 17517cea3689Smrg cat >&2 <<EOF 175227702724Smrg 17537cea3689SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize 17547cea3689Smrgthe system type. Please install a C compiler and try again. 175527702724SmrgEOF 17567cea3689Smrg ;; 17577cea3689Smrgesac 175827702724Smrg 175927702724Smrgcat >&2 <<EOF 176027702724Smrg 17617cea3689SmrgThis script (version $timestamp), has failed to recognize the 17627cea3689Smrgoperating system you are using. If your script is old, overwrite *all* 17637cea3689Smrgcopies of config.guess and config.sub with the latest versions from: 176427702724Smrg 176595b7a5c8Smrg https://git.savannah.gnu.org/cgit/config.git/plain/config.guess 176627702724Smrgand 176795b7a5c8Smrg https://git.savannah.gnu.org/cgit/config.git/plain/config.sub 176895b7a5c8SmrgEOF 176995b7a5c8Smrg 177095b7a5c8Smrgour_year=`echo $timestamp | sed 's,-.*,,'` 177195b7a5c8Smrgthisyear=`date +%Y` 177295b7a5c8Smrg# shellcheck disable=SC2003 177395b7a5c8Smrgscript_age=`expr "$thisyear" - "$our_year"` 177495b7a5c8Smrgif test "$script_age" -lt 3 ; then 177595b7a5c8Smrg cat >&2 <<EOF 177627702724Smrg 17777cea3689SmrgIf $0 has already been updated, send the following data and any 17787cea3689Smrginformation you think might be pertinent to config-patches@gnu.org to 17797cea3689Smrgprovide the necessary information to handle your system. 178027702724Smrg 178127702724Smrgconfig.guess timestamp = $timestamp 178227702724Smrg 178327702724Smrguname -m = `(uname -m) 2>/dev/null || echo unknown` 178427702724Smrguname -r = `(uname -r) 2>/dev/null || echo unknown` 178527702724Smrguname -s = `(uname -s) 2>/dev/null || echo unknown` 178627702724Smrguname -v = `(uname -v) 2>/dev/null || echo unknown` 178727702724Smrg 178827702724Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` 178927702724Smrg/bin/uname -X = `(/bin/uname -X) 2>/dev/null` 179027702724Smrg 179127702724Smrghostinfo = `(hostinfo) 2>/dev/null` 179227702724Smrg/bin/universe = `(/bin/universe) 2>/dev/null` 179327702724Smrg/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` 179427702724Smrg/bin/arch = `(/bin/arch) 2>/dev/null` 179527702724Smrg/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` 179627702724Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` 179727702724Smrg 17987cea3689SmrgUNAME_MACHINE = "$UNAME_MACHINE" 17997cea3689SmrgUNAME_RELEASE = "$UNAME_RELEASE" 18007cea3689SmrgUNAME_SYSTEM = "$UNAME_SYSTEM" 18017cea3689SmrgUNAME_VERSION = "$UNAME_VERSION" 180227702724SmrgEOF 180395b7a5c8Smrgfi 180427702724Smrg 180527702724Smrgexit 1 180627702724Smrg 180727702724Smrg# Local variables: 180895b7a5c8Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 180927702724Smrg# time-stamp-start: "timestamp='" 181027702724Smrg# time-stamp-format: "%:y-%02m-%02d" 181127702724Smrg# time-stamp-end: "'" 181227702724Smrg# End: 1813