4
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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
107
107
set_cc_for_build='
108
108
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
109
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
109
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
110
110
: ${TMPDIR=/tmp} ;
111
111
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
112
112
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
140
140
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
141
141
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
143
case "${UNAME_SYSTEM}" in
145
eval $set_cc_for_build
146
cat <<-EOF > $dummy.c
147
#include <features.h>
149
# ifdef __UCLIBC_CONFIG_VERSION__
150
LIBC=uclibc __UCLIBC_CONFIG_VERSION__
162
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
166
143
# Note: order is significant - the case branches are not exclusive.
168
145
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
875
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
852
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
878
855
# other systems with GNU libc and userland
879
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
856
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
882
859
echo ${UNAME_MACHINE}-pc-minix
892
869
EV68*) UNAME_MACHINE=alphaev68 ;;
894
871
objdump --private-headers /bin/sh | grep -q ld.so.1
895
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
896
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
872
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
873
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
899
876
eval $set_cc_for_build
900
877
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
901
878
| grep -q __ARM_EABI__
903
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
880
echo ${UNAME_MACHINE}-unknown-linux-gnu
905
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
882
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
908
885
avr32*:Linux:*:*)
909
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
886
echo ${UNAME_MACHINE}-unknown-linux-gnu
912
echo cris-axis-linux-${LIBC}
889
echo cris-axis-linux-gnu
914
891
crisv32:Linux:*:*)
915
echo crisv32-axis-linux-${LIBC}
892
echo crisv32-axis-linux-gnu
918
echo frv-unknown-linux-${LIBC}
895
echo frv-unknown-linux-gnu
921
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
899
eval $set_cc_for_build
900
sed 's/^ //' << EOF >$dummy.c
905
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
906
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
924
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
909
echo ${UNAME_MACHINE}-unknown-linux-gnu
927
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
912
echo ${UNAME_MACHINE}-unknown-linux-gnu
930
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
915
echo ${UNAME_MACHINE}-unknown-linux-gnu
932
917
mips:Linux:*:* | mips64:Linux:*:*)
933
918
eval $set_cc_for_build
948
933
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
949
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
934
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
952
echo or32-unknown-linux-${LIBC}
937
echo or32-unknown-linux-gnu
955
echo sparc-unknown-linux-${LIBC}
940
echo sparc-unknown-linux-gnu
957
942
parisc64:Linux:*:* | hppa64:Linux:*:*)
958
echo hppa64-unknown-linux-${LIBC}
943
echo hppa64-unknown-linux-gnu
960
945
parisc:Linux:*:* | hppa:Linux:*:*)
961
946
# Look for CPU level
962
947
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
963
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
964
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
965
*) echo hppa-unknown-linux-${LIBC} ;;
948
PA7*) echo hppa1.1-unknown-linux-gnu ;;
949
PA8*) echo hppa2.0-unknown-linux-gnu ;;
950
*) echo hppa-unknown-linux-gnu ;;
969
echo powerpc64-unknown-linux-${LIBC}
954
echo powerpc64-unknown-linux-gnu
972
echo powerpc-unknown-linux-${LIBC}
957
echo powerpc-unknown-linux-gnu
974
959
s390:Linux:*:* | s390x:Linux:*:*)
975
960
echo ${UNAME_MACHINE}-ibm-linux
978
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
963
echo ${UNAME_MACHINE}-unknown-linux-gnu
981
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
966
echo ${UNAME_MACHINE}-unknown-linux-gnu
983
968
sparc:Linux:*:* | sparc64:Linux:*:*)
984
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
969
echo ${UNAME_MACHINE}-unknown-linux-gnu
987
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
972
echo ${UNAME_MACHINE}-dec-linux-gnu
989
974
x86_64:Linux:*:*)
990
echo x86_64-unknown-linux-${LIBC}
975
echo x86_64-unknown-linux-gnu
992
977
xtensa*:Linux:*:*)
993
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
978
echo ${UNAME_MACHINE}-unknown-linux-gnu
995
980
i*86:DYNIX/ptx:4*:*)
996
981
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.