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-07-02' |
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 |
10 | # the Free Software Foundation; either version 2 of the License, or |
11 | # the Free Software Foundation; either version 2 of the License, or |
11 | # (at your option) any later version. |
12 | # (at your option) any later version. |
… | |
… | |
104 | |
105 | |
105 | set_cc_for_build=' |
106 | set_cc_for_build=' |
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 ; } ; |
113 | dummy=$tmp/dummy ; |
114 | dummy=$tmp/dummy ; |
114 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; |
115 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; |
… | |
… | |
204 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
205 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
205 | exit ;; |
206 | exit ;; |
206 | *:ekkoBSD:*:*) |
207 | *:ekkoBSD:*:*) |
207 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
208 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
208 | exit ;; |
209 | exit ;; |
|
|
210 | *:SolidBSD:*:*) |
|
|
211 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} |
|
|
212 | exit ;; |
209 | macppc:MirBSD:*:*) |
213 | macppc:MirBSD:*:*) |
210 | echo powerppc-unknown-mirbsd${UNAME_RELEASE} |
214 | echo powerpc-unknown-mirbsd${UNAME_RELEASE} |
211 | exit ;; |
215 | exit ;; |
212 | *:MirBSD:*:*) |
216 | *:MirBSD:*:*) |
213 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} |
217 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} |
214 | exit ;; |
218 | exit ;; |
215 | alpha:OSF1:*:*) |
219 | alpha:OSF1:*:*) |
… | |
… | |
762 | exit ;; |
766 | exit ;; |
763 | *:BSD/OS:*:*) |
767 | *:BSD/OS:*:*) |
764 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
768 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
765 | exit ;; |
769 | exit ;; |
766 | *:FreeBSD:*:*) |
770 | *:FreeBSD:*:*) |
|
|
771 | case ${UNAME_MACHINE} in |
|
|
772 | pc98) |
|
|
773 | echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
774 | amd64) |
|
|
775 | echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
776 | *) |
767 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
777 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
778 | esac |
768 | exit ;; |
779 | exit ;; |
769 | i*:CYGWIN*:*) |
780 | i*:CYGWIN*:*) |
770 | echo ${UNAME_MACHINE}-pc-cygwin |
781 | echo ${UNAME_MACHINE}-pc-cygwin |
771 | exit ;; |
782 | exit ;; |
772 | i*:MINGW*:*) |
783 | i*:MINGW*:*) |
… | |
… | |
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*:[3456]*) |
783 | echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' |
794 | echo i586-pc-interix${UNAME_RELEASE} |
|
|
795 | exit ;; |
|
|
796 | EM64T:Interix*:[3456]*) |
|
|
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*:*) |
… | |
… | |
813 | exit ;; |
827 | exit ;; |
814 | i*86:Minix:*:*) |
828 | i*86:Minix:*:*) |
815 | echo ${UNAME_MACHINE}-pc-minix |
829 | echo ${UNAME_MACHINE}-pc-minix |
816 | exit ;; |
830 | exit ;; |
817 | arm*:Linux:*:*) |
831 | arm*:Linux:*:*) |
|
|
832 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
|
|
833 | exit ;; |
|
|
834 | avr32*:Linux:*:*) |
818 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
835 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
819 | exit ;; |
836 | exit ;; |
820 | cris:Linux:*:*) |
837 | cris:Linux:*:*) |
821 | echo cris-axis-linux-gnu |
838 | echo cris-axis-linux-gnu |
822 | exit ;; |
839 | exit ;; |
… | |
… | |
849 | #else |
866 | #else |
850 | CPU= |
867 | CPU= |
851 | #endif |
868 | #endif |
852 | #endif |
869 | #endif |
853 | EOF |
870 | EOF |
854 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
871 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
872 | /^CPU/{ |
|
|
873 | s: ::g |
|
|
874 | p |
|
|
875 | }'`" |
855 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
876 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
856 | ;; |
877 | ;; |
857 | mips64:Linux:*:*) |
878 | mips64:Linux:*:*) |
858 | eval $set_cc_for_build |
879 | eval $set_cc_for_build |
859 | sed 's/^ //' << EOF >$dummy.c |
880 | sed 's/^ //' << EOF >$dummy.c |
… | |
… | |
868 | #else |
889 | #else |
869 | CPU= |
890 | CPU= |
870 | #endif |
891 | #endif |
871 | #endif |
892 | #endif |
872 | EOF |
893 | EOF |
873 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
894 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
895 | /^CPU/{ |
|
|
896 | s: ::g |
|
|
897 | p |
|
|
898 | }'`" |
874 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
899 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
875 | ;; |
900 | ;; |
876 | or32:Linux:*:*) |
901 | or32:Linux:*:*) |
877 | echo or32-unknown-linux-gnu |
902 | echo or32-unknown-linux-gnu |
878 | exit ;; |
903 | exit ;; |
… | |
… | |
916 | sh*:Linux:*:*) |
941 | sh*:Linux:*:*) |
917 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
942 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
918 | exit ;; |
943 | exit ;; |
919 | sparc:Linux:*:* | sparc64:Linux:*:*) |
944 | sparc:Linux:*:* | sparc64:Linux:*:*) |
920 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
945 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
|
|
946 | exit ;; |
|
|
947 | vax:Linux:*:*) |
|
|
948 | echo ${UNAME_MACHINE}-dec-linux-gnu |
921 | exit ;; |
949 | exit ;; |
922 | x86_64:Linux:*:*) |
950 | x86_64:Linux:*:*) |
923 | echo x86_64-unknown-linux-gnu |
951 | echo x86_64-unknown-linux-gnu |
924 | exit ;; |
952 | exit ;; |
925 | i*86:Linux:*:*) |
953 | i*86:Linux:*:*) |
… | |
… | |
962 | # endif |
990 | # endif |
963 | # else |
991 | # else |
964 | LIBC=gnulibc1 |
992 | LIBC=gnulibc1 |
965 | # endif |
993 | # endif |
966 | #else |
994 | #else |
967 | #ifdef __INTEL_COMPILER |
995 | #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
968 | LIBC=gnu |
996 | LIBC=gnu |
969 | #else |
997 | #else |
970 | LIBC=gnuaout |
998 | LIBC=gnuaout |
971 | #endif |
999 | #endif |
972 | #endif |
1000 | #endif |
973 | #ifdef __dietlibc__ |
1001 | #ifdef __dietlibc__ |
974 | LIBC=dietlibc |
1002 | LIBC=dietlibc |
975 | #endif |
1003 | #endif |
976 | EOF |
1004 | EOF |
977 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` |
1005 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
1006 | /^LIBC/{ |
|
|
1007 | s: ::g |
|
|
1008 | p |
|
|
1009 | }'`" |
978 | test x"${LIBC}" != x && { |
1010 | test x"${LIBC}" != x && { |
979 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
1011 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
980 | exit |
1012 | exit |
981 | } |
1013 | } |
982 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } |
1014 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } |
… | |
… | |
1183 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
1215 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
1184 | exit ;; |
1216 | exit ;; |
1185 | *:Darwin:*:*) |
1217 | *:Darwin:*:*) |
1186 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1218 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1187 | case $UNAME_PROCESSOR in |
1219 | case $UNAME_PROCESSOR in |
1188 | *86) UNAME_PROCESSOR=i686 ;; |
|
|
1189 | unknown) UNAME_PROCESSOR=powerpc ;; |
1220 | unknown) UNAME_PROCESSOR=powerpc ;; |
1190 | esac |
1221 | esac |
1191 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1222 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1192 | exit ;; |
1223 | exit ;; |
1193 | *:procnto*:*:* | *:QNX:[0123456789]*:*) |
1224 | *:procnto*:*:* | *:QNX:[0123456789]*:*) |
… | |
… | |
1261 | *:XENIX:*:SysV) |
1292 | *:XENIX:*:SysV) |
1262 | echo i386-pc-xenix |
1293 | echo i386-pc-xenix |
1263 | exit ;; |
1294 | exit ;; |
1264 | i*86:skyos:*:*) |
1295 | i*86:skyos:*:*) |
1265 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
1296 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
|
|
1297 | exit ;; |
|
|
1298 | i*86:rdos:*:*) |
|
|
1299 | echo ${UNAME_MACHINE}-pc-rdos |
1266 | exit ;; |
1300 | exit ;; |
1267 | esac |
1301 | esac |
1268 | |
1302 | |
1269 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
1303 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
1270 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |
1304 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |