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 Free Software Foundation, Inc. |
5 | |
5 | |
6 | timestamp='2005-08-03' |
6 | timestamp='2006-02-23' |
7 | |
7 | |
8 | # This file is free software; you can redistribute it and/or modify it |
8 | # 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 |
9 | # under the terms of the GNU General Public License as published by |
10 | # the Free Software Foundation; either version 2 of the License, or |
10 | # the Free Software Foundation; either version 2 of the License, or |
11 | # (at your option) any later version. |
11 | # (at your option) any later version. |
… | |
… | |
104 | |
104 | |
105 | set_cc_for_build=' |
105 | set_cc_for_build=' |
106 | trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; |
106 | 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 ; |
107 | trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; |
108 | : ${TMPDIR=/tmp} ; |
108 | : ${TMPDIR=/tmp} ; |
109 | { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || |
109 | { 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) ; } || |
110 | { 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 ; } || |
111 | { 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 ; } ; |
112 | { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; |
113 | dummy=$tmp/dummy ; |
113 | dummy=$tmp/dummy ; |
114 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; |
114 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; |
… | |
… | |
204 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
204 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
205 | exit ;; |
205 | exit ;; |
206 | *:ekkoBSD:*:*) |
206 | *:ekkoBSD:*:*) |
207 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
207 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
208 | exit ;; |
208 | exit ;; |
|
|
209 | *:SolidBSD:*:*) |
|
|
210 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} |
|
|
211 | exit ;; |
209 | macppc:MirBSD:*:*) |
212 | macppc:MirBSD:*:*) |
210 | echo powerppc-unknown-mirbsd${UNAME_RELEASE} |
213 | echo powerppc-unknown-mirbsd${UNAME_RELEASE} |
211 | exit ;; |
214 | exit ;; |
212 | *:MirBSD:*:*) |
215 | *:MirBSD:*:*) |
213 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} |
216 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} |
… | |
… | |
762 | exit ;; |
765 | exit ;; |
763 | *:BSD/OS:*:*) |
766 | *:BSD/OS:*:*) |
764 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
767 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
765 | exit ;; |
768 | exit ;; |
766 | *:FreeBSD:*:*) |
769 | *:FreeBSD:*:*) |
|
|
770 | case ${UNAME_MACHINE} in |
|
|
771 | pc98) |
|
|
772 | echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
773 | *) |
767 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
774 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
775 | esac |
768 | exit ;; |
776 | exit ;; |
769 | i*:CYGWIN*:*) |
777 | i*:CYGWIN*:*) |
770 | echo ${UNAME_MACHINE}-pc-cygwin |
778 | echo ${UNAME_MACHINE}-pc-cygwin |
771 | exit ;; |
779 | exit ;; |
772 | i*:MINGW*:*) |
780 | i*:MINGW*:*) |
|
|
781 | echo ${UNAME_MACHINE}-pc-mingw32 |
|
|
782 | exit ;; |
|
|
783 | i*:MSYS_NT-*:*:*) |
773 | echo ${UNAME_MACHINE}-pc-mingw32 |
784 | echo ${UNAME_MACHINE}-pc-mingw32 |
774 | exit ;; |
785 | exit ;; |
775 | i*:windows32*:*) |
786 | i*:windows32*:*) |
776 | # uname -m includes "-pc" on this system. |
787 | # uname -m includes "-pc" on this system. |
777 | echo ${UNAME_MACHINE}-mingw32 |
788 | echo ${UNAME_MACHINE}-mingw32 |
778 | exit ;; |
789 | exit ;; |
779 | i*:PW*:*) |
790 | i*:PW*:*) |
780 | echo ${UNAME_MACHINE}-pc-pw32 |
791 | echo ${UNAME_MACHINE}-pc-pw32 |
781 | exit ;; |
792 | exit ;; |
782 | x86:Interix*:[34]*) |
793 | x86:Interix*:[345]*) |
783 | echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' |
794 | echo i586-pc-interix${UNAME_RELEASE} |
|
|
795 | exit ;; |
|
|
796 | EM64T:Interix*:[345]*) |
|
|
797 | echo x86_64-unknown-interix${UNAME_RELEASE} |
784 | exit ;; |
798 | exit ;; |
785 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
799 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
786 | echo i${UNAME_MACHINE}-pc-mks |
800 | echo i${UNAME_MACHINE}-pc-mks |
787 | exit ;; |
801 | exit ;; |
788 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) |
802 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) |
… | |
… | |
849 | #else |
863 | #else |
850 | CPU= |
864 | CPU= |
851 | #endif |
865 | #endif |
852 | #endif |
866 | #endif |
853 | EOF |
867 | EOF |
854 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
868 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
869 | /^CPU/{ |
|
|
870 | s: ::g |
|
|
871 | p |
|
|
872 | }'`" |
855 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
873 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
856 | ;; |
874 | ;; |
857 | mips64:Linux:*:*) |
875 | mips64:Linux:*:*) |
858 | eval $set_cc_for_build |
876 | eval $set_cc_for_build |
859 | sed 's/^ //' << EOF >$dummy.c |
877 | sed 's/^ //' << EOF >$dummy.c |
… | |
… | |
868 | #else |
886 | #else |
869 | CPU= |
887 | CPU= |
870 | #endif |
888 | #endif |
871 | #endif |
889 | #endif |
872 | EOF |
890 | EOF |
873 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
891 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
892 | /^CPU/{ |
|
|
893 | s: ::g |
|
|
894 | p |
|
|
895 | }'`" |
874 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
896 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
875 | ;; |
897 | ;; |
876 | or32:Linux:*:*) |
898 | or32:Linux:*:*) |
877 | echo or32-unknown-linux-gnu |
899 | echo or32-unknown-linux-gnu |
878 | exit ;; |
900 | exit ;; |
… | |
… | |
916 | sh*:Linux:*:*) |
938 | sh*:Linux:*:*) |
917 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
939 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
918 | exit ;; |
940 | exit ;; |
919 | sparc:Linux:*:* | sparc64:Linux:*:*) |
941 | sparc:Linux:*:* | sparc64:Linux:*:*) |
920 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
942 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
|
|
943 | exit ;; |
|
|
944 | vax:Linux:*:*) |
|
|
945 | echo ${UNAME_MACHINE}-dec-linux-gnu |
921 | exit ;; |
946 | exit ;; |
922 | x86_64:Linux:*:*) |
947 | x86_64:Linux:*:*) |
923 | echo x86_64-unknown-linux-gnu |
948 | echo x86_64-unknown-linux-gnu |
924 | exit ;; |
949 | exit ;; |
925 | i*86:Linux:*:*) |
950 | i*86:Linux:*:*) |
… | |
… | |
962 | # endif |
987 | # endif |
963 | # else |
988 | # else |
964 | LIBC=gnulibc1 |
989 | LIBC=gnulibc1 |
965 | # endif |
990 | # endif |
966 | #else |
991 | #else |
967 | #ifdef __INTEL_COMPILER |
992 | #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) |
968 | LIBC=gnu |
993 | LIBC=gnu |
969 | #else |
994 | #else |
970 | LIBC=gnuaout |
995 | LIBC=gnuaout |
971 | #endif |
996 | #endif |
972 | #endif |
997 | #endif |
973 | #ifdef __dietlibc__ |
998 | #ifdef __dietlibc__ |
974 | LIBC=dietlibc |
999 | LIBC=dietlibc |
975 | #endif |
1000 | #endif |
976 | EOF |
1001 | EOF |
977 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` |
1002 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
1003 | /^LIBC/{ |
|
|
1004 | s: ::g |
|
|
1005 | p |
|
|
1006 | }'`" |
978 | test x"${LIBC}" != x && { |
1007 | test x"${LIBC}" != x && { |
979 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
1008 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
980 | exit |
1009 | exit |
981 | } |
1010 | } |
982 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } |
1011 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } |
… | |
… | |
1183 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
1212 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
1184 | exit ;; |
1213 | exit ;; |
1185 | *:Darwin:*:*) |
1214 | *:Darwin:*:*) |
1186 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1215 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1187 | case $UNAME_PROCESSOR in |
1216 | case $UNAME_PROCESSOR in |
1188 | *86) UNAME_PROCESSOR=i686 ;; |
|
|
1189 | unknown) UNAME_PROCESSOR=powerpc ;; |
1217 | unknown) UNAME_PROCESSOR=powerpc ;; |
1190 | esac |
1218 | esac |
1191 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1219 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1192 | exit ;; |
1220 | exit ;; |
1193 | *:procnto*:*:* | *:QNX:[0123456789]*:*) |
1221 | *:procnto*:*:* | *:QNX:[0123456789]*:*) |
… | |
… | |
1261 | *:XENIX:*:SysV) |
1289 | *:XENIX:*:SysV) |
1262 | echo i386-pc-xenix |
1290 | echo i386-pc-xenix |
1263 | exit ;; |
1291 | exit ;; |
1264 | i*86:skyos:*:*) |
1292 | i*86:skyos:*:*) |
1265 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
1293 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
|
|
1294 | exit ;; |
|
|
1295 | i*86:rdos:*:*) |
|
|
1296 | echo ${UNAME_MACHINE}-pc-rdos |
1266 | exit ;; |
1297 | exit ;; |
1267 | esac |
1298 | esac |
1268 | |
1299 | |
1269 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
1300 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
1270 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |
1301 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |