|
Lines 1-9
Link Here
|
| 1 |
#! /bin/sh |
1 |
#! /bin/sh |
| 2 |
# Attempt to guess a canonical system name. |
2 |
# Attempt to guess a canonical system name. |
| 3 |
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
3 |
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 4 |
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
4 |
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, |
|
|
5 |
# Inc. |
| 5 |
|
6 |
|
| 6 |
timestamp='2005-08-03' |
7 |
timestamp='2006-02-27' |
| 7 |
|
8 |
|
| 8 |
# This file is free software; you can redistribute it and/or modify it |
9 |
# This file is free software; you can redistribute it and/or modify it |
| 9 |
# under the terms of the GNU General Public License as published by |
10 |
# under the terms of the GNU General Public License as published by |
|
Lines 106-112
Link Here
|
| 106 |
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; |
107 |
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; |
| 107 |
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; |
108 |
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; |
| 108 |
: ${TMPDIR=/tmp} ; |
109 |
: ${TMPDIR=/tmp} ; |
| 109 |
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || |
110 |
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || |
| 110 |
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || |
111 |
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || |
| 111 |
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || |
112 |
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || |
| 112 |
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; |
113 |
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; |
|
Lines 138-143
Link Here
|
| 138 |
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
139 |
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
| 139 |
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown |
140 |
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown |
| 140 |
|
141 |
|
|
|
142 |
if [ "${UNAME_SYSTEM}" = "Linux" ] ; then |
| 143 |
eval $set_cc_for_build |
| 144 |
cat << EOF > $dummy.c |
| 145 |
#include <features.h> |
| 146 |
#ifdef __UCLIBC__ |
| 147 |
# ifdef __UCLIBC_CONFIG_VERSION__ |
| 148 |
LIBC=uclibc __UCLIBC_CONFIG_VERSION__ |
| 149 |
# else |
| 150 |
LIBC=uclibc |
| 151 |
# endif |
| 152 |
#else |
| 153 |
LIBC=gnu |
| 154 |
#endif |
| 155 |
EOF |
| 156 |
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` |
| 157 |
fi |
| 158 |
|
| 141 |
# Note: order is significant - the case branches are not exclusive. |
159 |
# Note: order is significant - the case branches are not exclusive. |
| 142 |
|
160 |
|
| 143 |
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in |
161 |
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in |
|
Lines 206-211
Link Here
|
| 206 |
*:ekkoBSD:*:*) |
224 |
*:ekkoBSD:*:*) |
| 207 |
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
225 |
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
| 208 |
exit ;; |
226 |
exit ;; |
|
|
227 |
*:SolidBSD:*:*) |
| 228 |
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} |
| 229 |
exit ;; |
| 209 |
macppc:MirBSD:*:*) |
230 |
macppc:MirBSD:*:*) |
| 210 |
echo powerppc-unknown-mirbsd${UNAME_RELEASE} |
231 |
echo powerppc-unknown-mirbsd${UNAME_RELEASE} |
| 211 |
exit ;; |
232 |
exit ;; |
|
Lines 764-770
Link Here
|
| 764 |
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
785 |
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
| 765 |
exit ;; |
786 |
exit ;; |
| 766 |
*:FreeBSD:*:*) |
787 |
*:FreeBSD:*:*) |
| 767 |
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
788 |
case ${UNAME_MACHINE} in |
|
|
789 |
pc98) |
| 790 |
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
| 791 |
*) |
| 792 |
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
| 793 |
esac |
| 768 |
exit ;; |
794 |
exit ;; |
| 769 |
i*:CYGWIN*:*) |
795 |
i*:CYGWIN*:*) |
| 770 |
echo ${UNAME_MACHINE}-pc-cygwin |
796 |
echo ${UNAME_MACHINE}-pc-cygwin |
|
Lines 772-777
Link Here
|
| 772 |
i*:MINGW*:*) |
798 |
i*:MINGW*:*) |
| 773 |
echo ${UNAME_MACHINE}-pc-mingw32 |
799 |
echo ${UNAME_MACHINE}-pc-mingw32 |
| 774 |
exit ;; |
800 |
exit ;; |
|
|
801 |
i*:MSYS_NT-*:*:*) |
| 802 |
echo ${UNAME_MACHINE}-pc-mingw32 |
| 803 |
exit ;; |
| 775 |
i*:windows32*:*) |
804 |
i*:windows32*:*) |
| 776 |
# uname -m includes "-pc" on this system. |
805 |
# uname -m includes "-pc" on this system. |
| 777 |
echo ${UNAME_MACHINE}-mingw32 |
806 |
echo ${UNAME_MACHINE}-mingw32 |
|
Lines 779-786
Link Here
|
| 779 |
i*:PW*:*) |
808 |
i*:PW*:*) |
| 780 |
echo ${UNAME_MACHINE}-pc-pw32 |
809 |
echo ${UNAME_MACHINE}-pc-pw32 |
| 781 |
exit ;; |
810 |
exit ;; |
| 782 |
x86:Interix*:[34]*) |
811 |
x86:Interix*:[345]*) |
| 783 |
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' |
812 |
echo i586-pc-interix${UNAME_RELEASE} |
|
|
813 |
exit ;; |
| 814 |
EM64T:Interix*:[345]*) |
| 815 |
echo x86_64-unknown-interix${UNAME_RELEASE} |
| 784 |
exit ;; |
816 |
exit ;; |
| 785 |
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
817 |
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
| 786 |
echo i${UNAME_MACHINE}-pc-mks |
818 |
echo i${UNAME_MACHINE}-pc-mks |
|
Lines 815-839
Link Here
|
| 815 |
echo ${UNAME_MACHINE}-pc-minix |
847 |
echo ${UNAME_MACHINE}-pc-minix |
| 816 |
exit ;; |
848 |
exit ;; |
| 817 |
arm*:Linux:*:*) |
849 |
arm*:Linux:*:*) |
| 818 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
850 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 819 |
exit ;; |
851 |
exit ;; |
| 820 |
cris:Linux:*:*) |
852 |
cris:Linux:*:*) |
| 821 |
echo cris-axis-linux-gnu |
853 |
echo cris-axis-linux-${LIBC} |
| 822 |
exit ;; |
854 |
exit ;; |
| 823 |
crisv32:Linux:*:*) |
855 |
crisv32:Linux:*:*) |
| 824 |
echo crisv32-axis-linux-gnu |
856 |
echo crisv32-axis-linux-${LIBC} |
| 825 |
exit ;; |
857 |
exit ;; |
| 826 |
frv:Linux:*:*) |
858 |
frv:Linux:*:*) |
| 827 |
echo frv-unknown-linux-gnu |
859 |
echo frv-unknown-linux-${LIBC} |
| 828 |
exit ;; |
860 |
exit ;; |
| 829 |
ia64:Linux:*:*) |
861 |
ia64:Linux:*:*) |
| 830 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
862 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 831 |
exit ;; |
863 |
exit ;; |
| 832 |
m32r*:Linux:*:*) |
864 |
m32r*:Linux:*:*) |
| 833 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
865 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 834 |
exit ;; |
866 |
exit ;; |
| 835 |
m68*:Linux:*:*) |
867 |
m68*:Linux:*:*) |
| 836 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
868 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 837 |
exit ;; |
869 |
exit ;; |
| 838 |
mips:Linux:*:*) |
870 |
mips:Linux:*:*) |
| 839 |
eval $set_cc_for_build |
871 |
eval $set_cc_for_build |
|
Lines 851-858
Link Here
|
| 851 |
#endif |
883 |
#endif |
| 852 |
#endif |
884 |
#endif |
| 853 |
EOF |
885 |
EOF |
| 854 |
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
886 |
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
| 855 |
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
887 |
/^CPU/{ |
|
|
888 |
s: ::g |
| 889 |
p |
| 890 |
}'`" |
| 891 |
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } |
| 856 |
;; |
892 |
;; |
| 857 |
mips64:Linux:*:*) |
893 |
mips64:Linux:*:*) |
| 858 |
eval $set_cc_for_build |
894 |
eval $set_cc_for_build |
|
Lines 870-886
Link Here
|
| 870 |
#endif |
906 |
#endif |
| 871 |
#endif |
907 |
#endif |
| 872 |
EOF |
908 |
EOF |
| 873 |
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
909 |
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
| 874 |
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
910 |
/^CPU/{ |
|
|
911 |
s: ::g |
| 912 |
p |
| 913 |
}'`" |
| 914 |
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } |
| 875 |
;; |
915 |
;; |
| 876 |
or32:Linux:*:*) |
916 |
or32:Linux:*:*) |
| 877 |
echo or32-unknown-linux-gnu |
917 |
echo or32-unknown-linux-${LIBC} |
| 878 |
exit ;; |
918 |
exit ;; |
| 879 |
ppc:Linux:*:*) |
919 |
ppc:Linux:*:*) |
| 880 |
echo powerpc-unknown-linux-gnu |
920 |
echo powerpc-unknown-linux-${LIBC} |
| 881 |
exit ;; |
921 |
exit ;; |
| 882 |
ppc64:Linux:*:*) |
922 |
ppc64:Linux:*:*) |
| 883 |
echo powerpc64-unknown-linux-gnu |
923 |
echo powerpc64-unknown-linux-${LIBC} |
| 884 |
exit ;; |
924 |
exit ;; |
| 885 |
alpha:Linux:*:*) |
925 |
alpha:Linux:*:*) |
| 886 |
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in |
926 |
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in |
|
Lines 893-926
Link Here
|
| 893 |
EV68*) UNAME_MACHINE=alphaev68 ;; |
933 |
EV68*) UNAME_MACHINE=alphaev68 ;; |
| 894 |
esac |
934 |
esac |
| 895 |
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null |
935 |
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null |
| 896 |
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi |
936 |
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi |
| 897 |
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} |
937 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 898 |
exit ;; |
938 |
exit ;; |
| 899 |
parisc:Linux:*:* | hppa:Linux:*:*) |
939 |
parisc:Linux:*:* | hppa:Linux:*:*) |
| 900 |
# Look for CPU level |
940 |
# Look for CPU level |
| 901 |
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in |
941 |
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in |
| 902 |
PA7*) echo hppa1.1-unknown-linux-gnu ;; |
942 |
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; |
| 903 |
PA8*) echo hppa2.0-unknown-linux-gnu ;; |
943 |
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; |
| 904 |
*) echo hppa-unknown-linux-gnu ;; |
944 |
*) echo hppa-unknown-linux-${LIBC} ;; |
| 905 |
esac |
945 |
esac |
| 906 |
exit ;; |
946 |
exit ;; |
| 907 |
parisc64:Linux:*:* | hppa64:Linux:*:*) |
947 |
parisc64:Linux:*:* | hppa64:Linux:*:*) |
| 908 |
echo hppa64-unknown-linux-gnu |
948 |
echo hppa64-unknown-linux-${LIBC} |
| 909 |
exit ;; |
949 |
exit ;; |
| 910 |
s390:Linux:*:* | s390x:Linux:*:*) |
950 |
s390:Linux:*:* | s390x:Linux:*:*) |
| 911 |
echo ${UNAME_MACHINE}-ibm-linux |
951 |
echo ${UNAME_MACHINE}-ibm-linux |
| 912 |
exit ;; |
952 |
exit ;; |
| 913 |
sh64*:Linux:*:*) |
953 |
sh64*:Linux:*:*) |
| 914 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
954 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 915 |
exit ;; |
955 |
exit ;; |
| 916 |
sh*:Linux:*:*) |
956 |
sh*:Linux:*:*) |
| 917 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
957 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
| 918 |
exit ;; |
958 |
exit ;; |
| 919 |
sparc:Linux:*:* | sparc64:Linux:*:*) |
959 |
sparc:Linux:*:* | sparc64:Linux:*:*) |
| 920 |
echo ${UNAME_MACHINE}-unknown-linux-gnu |
960 |
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} |
|
|
961 |
exit ;; |
| 962 |
vax:Linux:*:*) |
| 963 |
echo ${UNAME_MACHINE}-dec-linux-${LIBC} |
| 921 |
exit ;; |
964 |
exit ;; |
| 922 |
x86_64:Linux:*:*) |
965 |
x86_64:Linux:*:*) |
| 923 |
echo x86_64-unknown-linux-gnu |
966 |
echo x86_64-unknown-linux-${LIBC} |
| 924 |
exit ;; |
967 |
exit ;; |
| 925 |
i*86:Linux:*:*) |
968 |
i*86:Linux:*:*) |
| 926 |
# The BFD linker knows what the default object file format is, so |
969 |
# The BFD linker knows what the default object file format is, so |
|
Lines 935-954
Link Here
|
| 935 |
p'` |
978 |
p'` |
| 936 |
case "$ld_supported_targets" in |
979 |
case "$ld_supported_targets" in |
| 937 |
elf32-i386) |
980 |
elf32-i386) |
| 938 |
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" |
981 |
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" |
| 939 |
;; |
982 |
;; |
| 940 |
a.out-i386-linux) |
983 |
a.out-i386-linux) |
| 941 |
echo "${UNAME_MACHINE}-pc-linux-gnuaout" |
984 |
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" |
| 942 |
exit ;; |
985 |
exit ;; |
| 943 |
coff-i386) |
986 |
coff-i386) |
| 944 |
echo "${UNAME_MACHINE}-pc-linux-gnucoff" |
987 |
echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff" |
| 945 |
exit ;; |
988 |
exit ;; |
| 946 |
"") |
989 |
"") |
| 947 |
# Either a pre-BFD a.out linker (linux-gnuoldld) or |
990 |
# Either a pre-BFD a.out linker (linux-gnuoldld) or |
| 948 |
# one that does not give us useful --help. |
991 |
# one that does not give us useful --help. |
| 949 |
echo "${UNAME_MACHINE}-pc-linux-gnuoldld" |
992 |
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" |
| 950 |
exit ;; |
993 |
exit ;; |
| 951 |
esac |
994 |
esac |
|
|
995 |
# This should get integrated into the C code below, but now we hack |
| 996 |
if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi |
| 952 |
# Determine whether the default compiler is a.out or elf |
997 |
# Determine whether the default compiler is a.out or elf |
| 953 |
eval $set_cc_for_build |
998 |
eval $set_cc_for_build |
| 954 |
sed 's/^ //' << EOF >$dummy.c |
999 |
sed 's/^ //' << EOF >$dummy.c |
|
Lines 964-970
Link Here
|
| 964 |
LIBC=gnulibc1 |
1009 |
LIBC=gnulibc1 |
| 965 |
# endif |
1010 |
# endif |
| 966 |
#else |
1011 |
#else |
| 967 |
#ifdef __INTEL_COMPILER |
1012 |
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) |
| 968 |
LIBC=gnu |
1013 |
LIBC=gnu |
| 969 |
#else |
1014 |
#else |
| 970 |
LIBC=gnuaout |
1015 |
LIBC=gnuaout |
|
Lines 974-980
Link Here
|
| 974 |
LIBC=dietlibc |
1019 |
LIBC=dietlibc |
| 975 |
#endif |
1020 |
#endif |
| 976 |
EOF |
1021 |
EOF |
| 977 |
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` |
1022 |
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
1023 |
/^LIBC/{ |
| 1024 |
s: ::g |
| 1025 |
p |
| 1026 |
}'`" |
| 978 |
test x"${LIBC}" != x && { |
1027 |
test x"${LIBC}" != x && { |
| 979 |
echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
1028 |
echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
| 980 |
exit |
1029 |
exit |
|
Lines 1185-1191
Link Here
|
| 1185 |
*:Darwin:*:*) |
1234 |
*:Darwin:*:*) |
| 1186 |
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1235 |
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
| 1187 |
case $UNAME_PROCESSOR in |
1236 |
case $UNAME_PROCESSOR in |
| 1188 |
*86) UNAME_PROCESSOR=i686 ;; |
|
|
| 1189 |
unknown) UNAME_PROCESSOR=powerpc ;; |
1237 |
unknown) UNAME_PROCESSOR=powerpc ;; |
| 1190 |
esac |
1238 |
esac |
| 1191 |
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1239 |
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
|
Lines 1264-1269
Link Here
|
| 1264 |
i*86:skyos:*:*) |
1312 |
i*86:skyos:*:*) |
| 1265 |
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
1313 |
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
| 1266 |
exit ;; |
1314 |
exit ;; |
|
|
1315 |
i*86:rdos:*:*) |
| 1316 |
echo ${UNAME_MACHINE}-pc-rdos |
| 1317 |
exit ;; |
| 1267 |
esac |
1318 |
esac |
| 1268 |
|
1319 |
|
| 1269 |
#echo '(No uname command or uname output not recognized.)' 1>&2 |
1320 |
#echo '(No uname command or uname output not recognized.)' 1>&2 |