2
2
# Attempt to guess a canonical system name.
3
3
# Copyright 1992-2015 Free Software Foundation, Inc.
7
7
# This file is free software; you can redistribute it and/or modify it
8
8
# under the terms of the GNU General Public License as published by
168
168
# Note: NetBSD doesn't particularly care about the vendor
169
169
# portion of the name. We always set it to "unknown".
170
170
sysctl="sysctl -n hw.machine_arch"
171
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
172
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
171
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
172
/sbin/$sysctl 2>/dev/null || \
173
/usr/sbin/$sysctl 2>/dev/null || \
173
175
case "${UNAME_MACHINE_ARCH}" in
174
176
armeb) machine=armeb-unknown ;;
175
177
arm*) machine=arm-unknown ;;
176
178
sh3el) machine=shl-unknown ;;
177
179
sh3eb) machine=sh-unknown ;;
178
180
sh5el) machine=sh5le-unknown ;;
182
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
183
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
184
machine=${arch}${endian}-unknown
179
186
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
181
188
# The Operating System including object format, if it has switched
182
189
# to ELF recently, or will in the future.
183
190
case "${UNAME_MACHINE_ARCH}" in
184
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
191
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
185
192
eval $set_cc_for_build
186
193
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
187
194
| grep -q __ELF__
207
# Determine ABI tags.
208
case "${UNAME_MACHINE_ARCH}" in
210
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
211
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
201
215
# Debian GNU/NetBSD machines have a different userland, and
202
216
# thus, need a distinct triplet. However, they do not need
210
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
224
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
213
227
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
214
228
# contains redundant information, the shorter form:
215
229
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
216
echo "${machine}-${os}${release}"
230
echo "${machine}-${os}${release}${abi}"
219
233
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`