3
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
4
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
8
8
# This file is free software; you can redistribute it and/or modify it
9
9
# under the terms of the GNU General Public License as published by
138
138
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
139
139
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
141
if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
142
eval $set_cc_for_build
143
cat << EOF > $dummy.c
144
#include <features.h>
146
# ifdef __UCLIBC_CONFIG_VERSION__
147
LIBC=uclibc __UCLIBC_CONFIG_VERSION__
155
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
141
158
# Note: order is significant - the case branches are not exclusive.
143
160
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
764
781
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
767
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
784
case ${UNAME_MACHINE} in
786
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
788
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
770
792
echo ${UNAME_MACHINE}-pc-cygwin
815
837
echo ${UNAME_MACHINE}-pc-minix
818
echo ${UNAME_MACHINE}-unknown-linux-gnu
840
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
821
echo cris-axis-linux-gnu
843
echo cris-axis-linux-${LIBC}
823
845
crisv32:Linux:*:*)
824
echo crisv32-axis-linux-gnu
846
echo crisv32-axis-linux-${LIBC}
827
echo frv-unknown-linux-gnu
849
echo frv-unknown-linux-${LIBC}
830
echo ${UNAME_MACHINE}-unknown-linux-gnu
852
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
833
echo ${UNAME_MACHINE}-unknown-linux-gnu
855
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
836
echo ${UNAME_MACHINE}-unknown-linux-gnu
858
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
839
861
eval $set_cc_for_build
854
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
855
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
876
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
877
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
857
879
mips64:Linux:*:*)
858
880
eval $set_cc_for_build
873
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
874
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
895
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
896
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
877
echo or32-unknown-linux-gnu
899
echo or32-unknown-linux-${LIBC}
880
echo powerpc-unknown-linux-gnu
902
echo powerpc-unknown-linux-${LIBC}
883
echo powerpc64-unknown-linux-gnu
905
echo powerpc64-unknown-linux-${LIBC}
886
908
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
893
915
EV68*) UNAME_MACHINE=alphaev68 ;;
895
917
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
896
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
897
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
918
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
919
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
899
921
parisc:Linux:*:* | hppa:Linux:*:*)
900
922
# Look for CPU level
901
923
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
902
PA7*) echo hppa1.1-unknown-linux-gnu ;;
903
PA8*) echo hppa2.0-unknown-linux-gnu ;;
904
*) echo hppa-unknown-linux-gnu ;;
924
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
925
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
926
*) echo hppa-unknown-linux-${LIBC} ;;
907
929
parisc64:Linux:*:* | hppa64:Linux:*:*)
908
echo hppa64-unknown-linux-gnu
930
echo hppa64-unknown-linux-${LIBC}
910
932
s390:Linux:*:* | s390x:Linux:*:*)
911
933
echo ${UNAME_MACHINE}-ibm-linux
914
echo ${UNAME_MACHINE}-unknown-linux-gnu
936
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
917
echo ${UNAME_MACHINE}-unknown-linux-gnu
939
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
919
941
sparc:Linux:*:* | sparc64:Linux:*:*)
920
echo ${UNAME_MACHINE}-unknown-linux-gnu
942
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
945
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
922
947
x86_64:Linux:*:*)
923
echo x86_64-unknown-linux-gnu
948
echo x86_64-unknown-linux-${LIBC}
926
951
# The BFD linker knows what the default object file format is, so
936
961
case "$ld_supported_targets" in
938
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
963
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
940
965
a.out-i386-linux)
941
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
966
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
944
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
969
echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
947
972
# Either a pre-BFD a.out linker (linux-gnuoldld) or
948
973
# one that does not give us useful --help.
949
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
974
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
977
# This should get integrated into the C code below, but now we hack
978
if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
952
979
# Determine whether the default compiler is a.out or elf
953
980
eval $set_cc_for_build
954
981
sed 's/^ //' << EOF >$dummy.c