2
2
# Attempt to guess a canonical system name.
3
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
5
5
# Free Software Foundation, Inc.
9
9
# This file is free software; you can redistribute it and/or modify it
10
10
# under the terms of the GNU General Public License as published by
139
139
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
140
140
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
142
if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
143
eval $set_cc_for_build
144
cat << EOF > $dummy.c
145
#include <features.h>
147
# ifdef __UCLIBC_CONFIG_VERSION__
148
LIBC=uclibc __UCLIBC_CONFIG_VERSION__
156
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
159
142
# Note: order is significant - the case branches are not exclusive.
161
144
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
348
334
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
350
336
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
351
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
337
eval $set_cc_for_build
339
# If there is a compiler, see if it is configured for 64-bit objects.
340
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
341
# This test works for both compilers.
342
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
343
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
344
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
345
grep IS_64BIT_ARCH >/dev/null
350
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
353
352
sun4*:SunOS:6*:*)
354
353
# According to config.sub, this is the proper way to canonicalize
823
822
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
824
823
echo i${UNAME_MACHINE}-pc-mks
826
828
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
827
829
# How do we know it's Interix rather than the generic POSIX subsystem?
828
830
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
857
859
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
858
860
| grep -q __ARM_EABI__
860
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
862
echo ${UNAME_MACHINE}-unknown-linux-gnu
862
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
864
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
865
867
avr32*:Linux:*:*)
866
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
868
echo ${UNAME_MACHINE}-unknown-linux-gnu
869
echo cris-axis-linux-${LIBC}
871
echo cris-axis-linux-gnu
871
873
crisv32:Linux:*:*)
872
echo crisv32-axis-linux-${LIBC}
874
echo crisv32-axis-linux-gnu
875
echo frv-unknown-linux-${LIBC}
877
echo frv-unknown-linux-gnu
878
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
880
echo ${UNAME_MACHINE}-unknown-linux-gnu
881
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
883
echo ${UNAME_MACHINE}-unknown-linux-gnu
884
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
886
echo ${UNAME_MACHINE}-unknown-linux-gnu
887
eval $set_cc_for_build
888
sed 's/^ //' << EOF >$dummy.c
892
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
895
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
902
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
907
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
910
eval $set_cc_for_build
911
sed 's/^ //' << EOF >$dummy.c
915
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
918
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
925
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
930
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
888
mips:Linux:*:* | mips64:Linux:*:*)
889
eval $set_cc_for_build
890
sed 's/^ //' << EOF >$dummy.c
892
#undef ${UNAME_MACHINE}
893
#undef ${UNAME_MACHINE}el
894
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
895
CPU=${UNAME_MACHINE}el
897
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
904
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
909
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
933
echo or32-unknown-linux-${LIBC}
912
echo or32-unknown-linux-gnu
936
echo powerpc-unknown-linux-${LIBC}
915
echo powerpc-unknown-linux-gnu
939
echo powerpc64-unknown-linux-${LIBC}
918
echo powerpc64-unknown-linux-gnu
942
921
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
948
927
EV67) UNAME_MACHINE=alphaev67 ;;
949
928
EV68*) UNAME_MACHINE=alphaev68 ;;
951
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
952
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
953
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
930
objdump --private-headers /bin/sh | grep -q ld.so.1
931
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
932
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
956
935
echo sparc-unknown-linux-gnu
958
937
parisc:Linux:*:* | hppa:Linux:*:*)
959
938
# Look for CPU level
960
939
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
961
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
962
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
963
*) echo hppa-unknown-linux-${LIBC} ;;
940
PA7*) echo hppa1.1-unknown-linux-gnu ;;
941
PA8*) echo hppa2.0-unknown-linux-gnu ;;
942
*) echo hppa-unknown-linux-gnu ;;
966
945
parisc64:Linux:*:* | hppa64:Linux:*:*)
967
echo hppa64-unknown-linux-${LIBC}
946
echo hppa64-unknown-linux-gnu
969
948
s390:Linux:*:* | s390x:Linux:*:*)
970
949
echo ${UNAME_MACHINE}-ibm-linux
973
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
952
echo ${UNAME_MACHINE}-unknown-linux-gnu
976
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
955
echo ${UNAME_MACHINE}-unknown-linux-gnu
978
957
sparc:Linux:*:* | sparc64:Linux:*:*)
979
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
958
echo ${UNAME_MACHINE}-unknown-linux-gnu
982
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
961
echo ${UNAME_MACHINE}-dec-linux-gnu
984
963
x86_64:Linux:*:*)
985
echo x86_64-unknown-linux-${LIBC}
964
echo x86_64-unknown-linux-gnu
987
966
xtensa*:Linux:*:*)
988
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
967
echo ${UNAME_MACHINE}-unknown-linux-gnu
991
970
# The BFD linker knows what the default object file format is, so
1001
980
case "$ld_supported_targets" in
1003
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
982
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1006
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
1009
# Either a pre-BFD a.out linker (linux-gnuoldld) or
1010
# one that does not give us useful --help.
1011
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
1014
# This should get integrated into the C code below, but now we hack
1015
if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
1016
985
# Determine whether the default compiler is a.out or elf
1017
986
eval $set_cc_for_build
1018
987
sed 's/^ //' << EOF >$dummy.c
1122
1091
# Left here for compatibility:
1123
1092
# uname -m prints for DJGPP always 'pc', but it prints nothing about
1124
# the processor, so we play safe by assuming i386.
1125
echo i386-pc-msdosdjgpp
1093
# the processor, so we play safe by assuming i586.
1094
# Note: whatever this is, it MUST be the same as what config.sub
1095
# prints for the "djgpp" host, or else GDB configury will decide that
1096
# this is a cross-build.
1097
echo i586-pc-msdosdjgpp
1127
1099
Intel:Mach:3*:*)
1128
1100
echo i386-pc-mach3
1160
1132
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1161
1133
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1162
1134
&& { echo i486-ncr-sysv4; exit; } ;;
1135
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1137
test -r /etc/.relid \
1138
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1139
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1140
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1141
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1142
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1143
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1144
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1163
1145
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1164
1146
echo m68k-unknown-lynxos${UNAME_RELEASE}