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
836
822
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
837
823
echo i${UNAME_MACHINE}-pc-mks
839
828
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
840
829
# How do we know it's Interix rather than the generic POSIX subsystem?
841
830
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
870
859
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
871
860
| grep -q __ARM_EABI__
873
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
862
echo ${UNAME_MACHINE}-unknown-linux-gnu
875
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
864
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
878
867
avr32*:Linux:*:*)
879
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
868
echo ${UNAME_MACHINE}-unknown-linux-gnu
882
echo cris-axis-linux-${LIBC}
871
echo cris-axis-linux-gnu
884
873
crisv32:Linux:*:*)
885
echo crisv32-axis-linux-${LIBC}
874
echo crisv32-axis-linux-gnu
888
echo frv-unknown-linux-${LIBC}
877
echo frv-unknown-linux-gnu
891
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
880
echo ${UNAME_MACHINE}-unknown-linux-gnu
894
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
883
echo ${UNAME_MACHINE}-unknown-linux-gnu
897
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
886
echo ${UNAME_MACHINE}-unknown-linux-gnu
900
eval $set_cc_for_build
901
sed 's/^ //' << EOF >$dummy.c
905
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
908
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
915
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
920
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
923
eval $set_cc_for_build
924
sed 's/^ //' << EOF >$dummy.c
928
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
931
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
938
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
943
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; }
946
echo or32-unknown-linux-${LIBC}
912
echo or32-unknown-linux-gnu
949
echo powerpc-unknown-linux-${LIBC}
915
echo powerpc-unknown-linux-gnu
952
echo powerpc64-unknown-linux-${LIBC}
918
echo powerpc64-unknown-linux-gnu
955
921
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
961
927
EV67) UNAME_MACHINE=alphaev67 ;;
962
928
EV68*) UNAME_MACHINE=alphaev68 ;;
964
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
965
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
966
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}
969
935
echo sparc-unknown-linux-gnu
971
937
parisc:Linux:*:* | hppa:Linux:*:*)
972
938
# Look for CPU level
973
939
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
974
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
975
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
976
*) 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 ;;
979
945
parisc64:Linux:*:* | hppa64:Linux:*:*)
980
echo hppa64-unknown-linux-${LIBC}
946
echo hppa64-unknown-linux-gnu
982
948
s390:Linux:*:* | s390x:Linux:*:*)
983
949
echo ${UNAME_MACHINE}-ibm-linux
986
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
952
echo ${UNAME_MACHINE}-unknown-linux-gnu
989
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
955
echo ${UNAME_MACHINE}-unknown-linux-gnu
991
957
sparc:Linux:*:* | sparc64:Linux:*:*)
992
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
958
echo ${UNAME_MACHINE}-unknown-linux-gnu
995
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
961
echo ${UNAME_MACHINE}-dec-linux-gnu
997
963
x86_64:Linux:*:*)
998
echo x86_64-unknown-linux-${LIBC}
964
echo x86_64-unknown-linux-gnu
1000
966
xtensa*:Linux:*:*)
1001
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
967
echo ${UNAME_MACHINE}-unknown-linux-gnu
1004
970
# The BFD linker knows what the default object file format is, so
1014
980
case "$ld_supported_targets" in
1016
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
982
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1019
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
1022
# Either a pre-BFD a.out linker (linux-gnuoldld) or
1023
# one that does not give us useful --help.
1024
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
1027
# This should get integrated into the C code below, but now we hack
1028
if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
1029
985
# Determine whether the default compiler is a.out or elf
1030
986
eval $set_cc_for_build
1031
987
sed 's/^ //' << EOF >$dummy.c
1135
1091
# Left here for compatibility:
1136
1092
# uname -m prints for DJGPP always 'pc', but it prints nothing about
1137
# the processor, so we play safe by assuming i386.
1138
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
1140
1099
Intel:Mach:3*:*)
1141
1100
echo i386-pc-mach3