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='2007-03-06' |
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" ; |
… | |
… | |
158 | case "${UNAME_MACHINE_ARCH}" in |
159 | case "${UNAME_MACHINE_ARCH}" in |
159 | armeb) machine=armeb-unknown ;; |
160 | armeb) machine=armeb-unknown ;; |
160 | arm*) machine=arm-unknown ;; |
161 | arm*) machine=arm-unknown ;; |
161 | sh3el) machine=shl-unknown ;; |
162 | sh3el) machine=shl-unknown ;; |
162 | sh3eb) machine=sh-unknown ;; |
163 | sh3eb) machine=sh-unknown ;; |
|
|
164 | sh5el) machine=sh5le-unknown ;; |
163 | *) machine=${UNAME_MACHINE_ARCH}-unknown ;; |
165 | *) machine=${UNAME_MACHINE_ARCH}-unknown ;; |
164 | esac |
166 | esac |
165 | # The Operating System including object format, if it has switched |
167 | # The Operating System including object format, if it has switched |
166 | # to ELF recently, or will in the future. |
168 | # to ELF recently, or will in the future. |
167 | case "${UNAME_MACHINE_ARCH}" in |
169 | case "${UNAME_MACHINE_ARCH}" in |
… | |
… | |
204 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
206 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
205 | exit ;; |
207 | exit ;; |
206 | *:ekkoBSD:*:*) |
208 | *:ekkoBSD:*:*) |
207 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
209 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} |
208 | exit ;; |
210 | exit ;; |
|
|
211 | *:SolidBSD:*:*) |
|
|
212 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} |
|
|
213 | exit ;; |
209 | macppc:MirBSD:*:*) |
214 | macppc:MirBSD:*:*) |
210 | echo powerppc-unknown-mirbsd${UNAME_RELEASE} |
215 | echo powerpc-unknown-mirbsd${UNAME_RELEASE} |
211 | exit ;; |
216 | exit ;; |
212 | *:MirBSD:*:*) |
217 | *:MirBSD:*:*) |
213 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} |
218 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} |
214 | exit ;; |
219 | exit ;; |
215 | alpha:OSF1:*:*) |
220 | alpha:OSF1:*:*) |
… | |
… | |
762 | exit ;; |
767 | exit ;; |
763 | *:BSD/OS:*:*) |
768 | *:BSD/OS:*:*) |
764 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
769 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
765 | exit ;; |
770 | exit ;; |
766 | *:FreeBSD:*:*) |
771 | *:FreeBSD:*:*) |
|
|
772 | case ${UNAME_MACHINE} in |
|
|
773 | pc98) |
|
|
774 | echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
775 | amd64) |
|
|
776 | echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
777 | *) |
767 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
778 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
|
|
779 | esac |
768 | exit ;; |
780 | exit ;; |
769 | i*:CYGWIN*:*) |
781 | i*:CYGWIN*:*) |
770 | echo ${UNAME_MACHINE}-pc-cygwin |
782 | echo ${UNAME_MACHINE}-pc-cygwin |
771 | exit ;; |
783 | exit ;; |
772 | i*:MINGW*:*) |
784 | *:MINGW*:*) |
773 | echo ${UNAME_MACHINE}-pc-mingw32 |
785 | echo ${UNAME_MACHINE}-pc-mingw32 |
774 | exit ;; |
786 | exit ;; |
775 | i*:windows32*:*) |
787 | i*:windows32*:*) |
776 | # uname -m includes "-pc" on this system. |
788 | # uname -m includes "-pc" on this system. |
777 | echo ${UNAME_MACHINE}-mingw32 |
789 | echo ${UNAME_MACHINE}-mingw32 |
778 | exit ;; |
790 | exit ;; |
779 | i*:PW*:*) |
791 | i*:PW*:*) |
780 | echo ${UNAME_MACHINE}-pc-pw32 |
792 | echo ${UNAME_MACHINE}-pc-pw32 |
781 | exit ;; |
793 | exit ;; |
782 | x86:Interix*:[34]*) |
794 | *:Interix*:[3456]*) |
|
|
795 | case ${UNAME_MACHINE} in |
|
|
796 | x86) |
783 | echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' |
797 | echo i586-pc-interix${UNAME_RELEASE} |
784 | exit ;; |
798 | exit ;; |
|
|
799 | EM64T | authenticamd) |
|
|
800 | echo x86_64-unknown-interix${UNAME_RELEASE} |
|
|
801 | exit ;; |
|
|
802 | esac ;; |
785 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
803 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
786 | echo i${UNAME_MACHINE}-pc-mks |
804 | echo i${UNAME_MACHINE}-pc-mks |
787 | exit ;; |
805 | exit ;; |
788 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) |
806 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) |
789 | # How do we know it's Interix rather than the generic POSIX subsystem? |
807 | # How do we know it's Interix rather than the generic POSIX subsystem? |
… | |
… | |
813 | exit ;; |
831 | exit ;; |
814 | i*86:Minix:*:*) |
832 | i*86:Minix:*:*) |
815 | echo ${UNAME_MACHINE}-pc-minix |
833 | echo ${UNAME_MACHINE}-pc-minix |
816 | exit ;; |
834 | exit ;; |
817 | arm*:Linux:*:*) |
835 | arm*:Linux:*:*) |
|
|
836 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
|
|
837 | exit ;; |
|
|
838 | avr32*:Linux:*:*) |
818 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
839 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
819 | exit ;; |
840 | exit ;; |
820 | cris:Linux:*:*) |
841 | cris:Linux:*:*) |
821 | echo cris-axis-linux-gnu |
842 | echo cris-axis-linux-gnu |
822 | exit ;; |
843 | exit ;; |
… | |
… | |
849 | #else |
870 | #else |
850 | CPU= |
871 | CPU= |
851 | #endif |
872 | #endif |
852 | #endif |
873 | #endif |
853 | EOF |
874 | EOF |
854 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
875 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
876 | /^CPU/{ |
|
|
877 | s: ::g |
|
|
878 | p |
|
|
879 | }'`" |
855 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
880 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
856 | ;; |
881 | ;; |
857 | mips64:Linux:*:*) |
882 | mips64:Linux:*:*) |
858 | eval $set_cc_for_build |
883 | eval $set_cc_for_build |
859 | sed 's/^ //' << EOF >$dummy.c |
884 | sed 's/^ //' << EOF >$dummy.c |
… | |
… | |
868 | #else |
893 | #else |
869 | CPU= |
894 | CPU= |
870 | #endif |
895 | #endif |
871 | #endif |
896 | #endif |
872 | EOF |
897 | EOF |
873 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` |
898 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
899 | /^CPU/{ |
|
|
900 | s: ::g |
|
|
901 | p |
|
|
902 | }'`" |
874 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
903 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
875 | ;; |
904 | ;; |
876 | or32:Linux:*:*) |
905 | or32:Linux:*:*) |
877 | echo or32-unknown-linux-gnu |
906 | echo or32-unknown-linux-gnu |
878 | exit ;; |
907 | exit ;; |
… | |
… | |
917 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
946 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
918 | exit ;; |
947 | exit ;; |
919 | sparc:Linux:*:* | sparc64:Linux:*:*) |
948 | sparc:Linux:*:* | sparc64:Linux:*:*) |
920 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
949 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
921 | exit ;; |
950 | exit ;; |
|
|
951 | vax:Linux:*:*) |
|
|
952 | echo ${UNAME_MACHINE}-dec-linux-gnu |
|
|
953 | exit ;; |
922 | x86_64:Linux:*:*) |
954 | x86_64:Linux:*:*) |
923 | echo x86_64-unknown-linux-gnu |
955 | echo x86_64-unknown-linux-gnu |
|
|
956 | exit ;; |
|
|
957 | xtensa:Linux:*:*) |
|
|
958 | echo xtensa-unknown-linux-gnu |
924 | exit ;; |
959 | exit ;; |
925 | i*86:Linux:*:*) |
960 | i*86:Linux:*:*) |
926 | # The BFD linker knows what the default object file format is, so |
961 | # The BFD linker knows what the default object file format is, so |
927 | # first see if it will tell us. cd to the root directory to prevent |
962 | # first see if it will tell us. cd to the root directory to prevent |
928 | # problems with other programs or directories called `ld' in the path. |
963 | # problems with other programs or directories called `ld' in the path. |
… | |
… | |
962 | # endif |
997 | # endif |
963 | # else |
998 | # else |
964 | LIBC=gnulibc1 |
999 | LIBC=gnulibc1 |
965 | # endif |
1000 | # endif |
966 | #else |
1001 | #else |
967 | #ifdef __INTEL_COMPILER |
1002 | #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
968 | LIBC=gnu |
1003 | LIBC=gnu |
969 | #else |
1004 | #else |
970 | LIBC=gnuaout |
1005 | LIBC=gnuaout |
971 | #endif |
1006 | #endif |
972 | #endif |
1007 | #endif |
973 | #ifdef __dietlibc__ |
1008 | #ifdef __dietlibc__ |
974 | LIBC=dietlibc |
1009 | LIBC=dietlibc |
975 | #endif |
1010 | #endif |
976 | EOF |
1011 | EOF |
977 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` |
1012 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
|
|
1013 | /^LIBC/{ |
|
|
1014 | s: ::g |
|
|
1015 | p |
|
|
1016 | }'`" |
978 | test x"${LIBC}" != x && { |
1017 | test x"${LIBC}" != x && { |
979 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
1018 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" |
980 | exit |
1019 | exit |
981 | } |
1020 | } |
982 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } |
1021 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } |
… | |
… | |
1174 | echo sx5-nec-superux${UNAME_RELEASE} |
1213 | echo sx5-nec-superux${UNAME_RELEASE} |
1175 | exit ;; |
1214 | exit ;; |
1176 | SX-6:SUPER-UX:*:*) |
1215 | SX-6:SUPER-UX:*:*) |
1177 | echo sx6-nec-superux${UNAME_RELEASE} |
1216 | echo sx6-nec-superux${UNAME_RELEASE} |
1178 | exit ;; |
1217 | exit ;; |
|
|
1218 | SX-7:SUPER-UX:*:*) |
|
|
1219 | echo sx7-nec-superux${UNAME_RELEASE} |
|
|
1220 | exit ;; |
|
|
1221 | SX-8:SUPER-UX:*:*) |
|
|
1222 | echo sx8-nec-superux${UNAME_RELEASE} |
|
|
1223 | exit ;; |
|
|
1224 | SX-8R:SUPER-UX:*:*) |
|
|
1225 | echo sx8r-nec-superux${UNAME_RELEASE} |
|
|
1226 | exit ;; |
1179 | Power*:Rhapsody:*:*) |
1227 | Power*:Rhapsody:*:*) |
1180 | echo powerpc-apple-rhapsody${UNAME_RELEASE} |
1228 | echo powerpc-apple-rhapsody${UNAME_RELEASE} |
1181 | exit ;; |
1229 | exit ;; |
1182 | *:Rhapsody:*:*) |
1230 | *:Rhapsody:*:*) |
1183 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
1231 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} |
1184 | exit ;; |
1232 | exit ;; |
1185 | *:Darwin:*:*) |
1233 | *:Darwin:*:*) |
1186 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1234 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1187 | case $UNAME_PROCESSOR in |
1235 | case $UNAME_PROCESSOR in |
1188 | *86) UNAME_PROCESSOR=i686 ;; |
|
|
1189 | unknown) UNAME_PROCESSOR=powerpc ;; |
1236 | unknown) UNAME_PROCESSOR=powerpc ;; |
1190 | esac |
1237 | esac |
1191 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1238 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1192 | exit ;; |
1239 | exit ;; |
1193 | *:procnto*:*:* | *:QNX:[0123456789]*:*) |
1240 | *:procnto*:*:* | *:QNX:[0123456789]*:*) |
… | |
… | |
1261 | *:XENIX:*:SysV) |
1308 | *:XENIX:*:SysV) |
1262 | echo i386-pc-xenix |
1309 | echo i386-pc-xenix |
1263 | exit ;; |
1310 | exit ;; |
1264 | i*86:skyos:*:*) |
1311 | i*86:skyos:*:*) |
1265 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
1312 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' |
|
|
1313 | exit ;; |
|
|
1314 | i*86:rdos:*:*) |
|
|
1315 | echo ${UNAME_MACHINE}-pc-rdos |
1266 | exit ;; |
1316 | exit ;; |
1267 | esac |
1317 | esac |
1268 | |
1318 | |
1269 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
1319 | #echo '(No uname command or uname output not recognized.)' 1>&2 |
1270 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |
1320 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |