5
|
1 #!/bin/sh |
|
2 # This script attempts to guess a canonical system name. |
583
|
3 # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. |
5
|
4 # |
|
5 # This file is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License as published by |
|
7 # the Free Software Foundation; either version 2 of the License, or |
|
8 # (at your option) any later version. |
|
9 # |
|
10 # This program is distributed in the hope that it will be useful, but |
|
11 # WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 # General Public License for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License |
|
16 # along with this program; if not, write to the Free Software |
|
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
|
18 |
|
19 # |
|
20 # This script attempts to guess a canonical system name similar to |
583
|
21 # config.sub. If it succeeds, it prints the system name on stdout, and |
|
22 # exits with 0. Otherwise, it exits with 1. |
5
|
23 # |
|
24 # The plan is that this can be called by configure scripts if you |
|
25 # don't specify an explicit system type (host/target name). |
|
26 # |
|
27 # Only a few systems have been added to this list; please add others |
|
28 # (but try to keep the structure clean). |
|
29 # |
|
30 |
|
31 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown |
|
32 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown |
|
33 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
|
34 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown |
|
35 |
583
|
36 trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 |
|
37 |
5
|
38 # Note: order is significant - the case branches are not exclusive. |
|
39 |
|
40 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in |
|
41 alpha:OSF1:1.*:*) |
89
|
42 # 1.2 uses "1.2" for uname -r. |
5
|
43 echo alpha-dec-osf${UNAME_RELEASE} |
|
44 exit 0 ;; |
583
|
45 alpha:OSF1:V1.*:* | alpha:OSF1:V[2-9].*:*) |
|
46 # 1.3 and later use "V1.3", etc. for uname -r. |
89
|
47 echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'` |
|
48 exit 0 ;; |
583
|
49 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) |
|
50 echo arm-acorn-riscix${UNAME_RELEASE} |
|
51 exit 0;; |
5
|
52 sun4*:SunOS:5.*:*) |
|
53 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
|
54 exit 0 ;; |
|
55 sun4*:SunOS:6*:*) |
|
56 # According to config.sub, this is the proper way to canonicalize |
|
57 # SunOS6. Hard to guess exactly what SunOS6 will be like, but |
|
58 # it's likely to be more like Solaris than SunOS4. |
|
59 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
|
60 exit 0 ;; |
|
61 sun4*:SunOS:*:*) |
|
62 echo sparc-sun-sunos${UNAME_RELEASE} |
|
63 exit 0 ;; |
|
64 sun3*:SunOS:*:*) |
|
65 echo m68k-sun-sunos${UNAME_RELEASE} |
|
66 exit 0 ;; |
|
67 RISC*:ULTRIX:*:*) |
|
68 echo mips-dec-ultrix${UNAME_RELEASE} |
|
69 exit 0 ;; |
|
70 VAX*:ULTRIX*:*:*) |
|
71 echo vax-dec-ultrix${UNAME_RELEASE} |
|
72 exit 0 ;; |
89
|
73 mips:*:5*:RISCos) |
|
74 echo mips-mips-riscos${UNAME_RELEASE} |
|
75 exit 0 ;; |
5
|
76 m88k:*:4*:R4*) |
|
77 echo m88k-motorola-sysv4 |
|
78 exit 0 ;; |
|
79 m88k:*:3*:R3*) |
|
80 echo m88k-motorola-sysv3 |
|
81 exit 0 ;; |
583
|
82 AViiON:dgux:*:*) |
|
83 echo m88k-dg-dgux${UNAME_RELEASE} |
|
84 exit 0 ;; |
|
85 M88*:*:R3*:*) |
|
86 # Delta 88k system running SVR3 |
|
87 echo m88k-motorola-sysv3 |
|
88 exit 0 ;; |
|
89 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) |
|
90 echo m88k-tektronix-sysv3 |
|
91 exit 0 ;; |
|
92 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) |
|
93 echo m68k-tektronix-bsd |
|
94 exit 0 ;; |
5
|
95 *:IRIX:*:*) |
|
96 echo mips-sgi-irix${UNAME_RELEASE} |
|
97 exit 0 ;; |
|
98 i[34]86:AIX:*:*) |
|
99 echo i386-ibm-aix |
|
100 exit 0 ;; |
|
101 *:AIX:2:3) |
583
|
102 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then |
|
103 echo rs6000-ibm-aix3.2.5 |
|
104 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then |
|
105 echo rs6000-ibm-aix3.2.4 |
|
106 else |
|
107 echo rs6000-ibm-aix3.2 |
|
108 fi |
5
|
109 exit 0 ;; |
|
110 *:AIX:*:*) |
|
111 echo rs6000-ibm-aix |
|
112 exit 0 ;; |
|
113 *:BOSX:*:*) |
|
114 echo rs6000-bull-bosx |
|
115 exit 0 ;; |
89
|
116 DPX/2?00:B.O.S.:*:*) |
|
117 echo m68k-bull-sysv3 |
|
118 exit 0 ;; |
|
119 9000/[34]??:4.3bsd:1.*:*) |
|
120 echo m68k-hp-bsd |
|
121 exit 0 ;; |
|
122 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) |
|
123 echo m68k-hp-bsd4.4 |
|
124 exit 0 ;; |
583
|
125 9000/[3478]??:HP-UX:*:* | 9000/8?7:HP-UX:*:* ) |
|
126 case "${UNAME_MACHINE}" in |
|
127 9000/31? ) HP_ARCH=m68000 ;; |
|
128 9000/[34]?? ) HP_ARCH=m68k ;; |
|
129 9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;; |
|
130 9000/8?? ) HP_ARCH=hppa1.0 ;; |
|
131 esac |
|
132 case ${UNAME_RELEASE} in |
|
133 *.B7.* ) HPUX_REV=7 ;; |
|
134 *.B8.* | *.08.* ) HPUX_REV=8 ;; |
|
135 *.09.* ) HPUX_REV=9 ;; |
|
136 esac |
|
137 echo ${HP_ARCH}-hp-hpux${HPUX_REV} |
5
|
138 exit 0 ;; |
583
|
139 3050*:HI-UX:*:*) |
|
140 sed 's/^ //' << EOF >dummy.c |
|
141 #include <unistd.h> |
|
142 int |
|
143 main () |
|
144 { |
|
145 long cpu = sysconf (_SC_CPU_VERSION); |
|
146 if (CPU_IS_HP_MC68K (cpu)) |
|
147 puts ("m68k-hitachi-hiuxwe2"); |
|
148 else if (CPU_IS_PA_RISC (cpu)) |
|
149 { |
|
150 switch (cpu) |
|
151 { |
|
152 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; |
|
153 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; |
|
154 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; |
|
155 default: puts ("hppa-hitachi-hiuxwe2"); break; |
|
156 } |
|
157 } |
|
158 else puts ("unknown-hitachi-hiuxwe2"); |
|
159 exit (0); |
|
160 } |
|
161 EOF |
|
162 ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 |
|
163 rm -f dummy.c dummy |
|
164 echo unknown-hitachi-hiuxwe2 |
5
|
165 exit 0 ;; |
89
|
166 9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* ) |
5
|
167 echo hppa1.1-hp-bsd |
|
168 exit 0 ;; |
|
169 9000/8??:4.3bsd:*:*) |
|
170 echo hppa1.0-hp-bsd |
|
171 exit 0 ;; |
583
|
172 C1*:ConvexOS:*:* | convex:ConvexOS:C1:*) |
5
|
173 echo c1-convex-bsd |
|
174 exit 0 ;; |
583
|
175 C2*:ConvexOS:*:* | convex:ConvexOS:C2:*) |
5
|
176 echo c2-convex-bsd |
|
177 exit 0 ;; |
|
178 CRAY*X-MP:UNICOS:*:*) |
|
179 echo xmp-cray-unicos |
|
180 exit 0 ;; |
|
181 CRAY*Y-MP:UNICOS:*:*) |
|
182 echo ymp-cray-unicos |
|
183 exit 0 ;; |
|
184 CRAY-2:UNICOS:*:*) |
|
185 echo cray2-cray-unicos |
|
186 exit 0 ;; |
89
|
187 hp3[0-9][05]:NetBSD:*:*) |
|
188 echo m68k-hp-netbsd${UNAME_RELEASE} |
|
189 exit 0 ;; |
583
|
190 i[34]86:BSD/386:*:*) |
|
191 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
|
192 exit 0 ;; |
|
193 i[34]86:FreeBSD:*:*) |
|
194 echo ${UNAME_MACHINE}-unknown-freebsd |
|
195 exit 0 ;; |
89
|
196 i[34]86:NetBSD:*:*) |
|
197 echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE} |
|
198 exit 0 ;; |
5
|
199 i[34]86:Linux:*:*) |
|
200 echo ${UNAME_MACHINE}-unknown-linux |
|
201 exit 0 ;; |
583
|
202 i[34]86:UNIX_SV:4.*:* | i[34]86:SYSTEM_V:4.*:*) |
5
|
203 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then |
|
204 echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} |
|
205 else |
|
206 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} |
|
207 fi |
|
208 exit 0 ;; |
|
209 i[34]86:*:3.2:*) |
|
210 if /bin/uname -X 2>/dev/null >/dev/null ; then |
|
211 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` |
|
212 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 |
|
213 echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL |
|
214 else |
583
|
215 echo ${UNAME_MACHINE}-unknown-sysv32 |
5
|
216 fi |
|
217 exit 0 ;; |
|
218 mini*:CTIX:SYS*5:*) |
|
219 # "miniframe" |
|
220 echo m68010-convergent-sysv |
|
221 exit 0 ;; |
89
|
222 M680[234]0:*:R3V[567]*:*) |
5
|
223 test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; |
583
|
224 3[34]??:*:4.0:* | 3[34]??,3[34]??:*:4.0:*) |
89
|
225 uname -p 2>/dev/null | grep 86 >/dev/null \ |
|
226 && echo i486-ncr-sysv4 && exit 0 ;; |
583
|
227 m680[234]0:LynxOS:2.2*:*) |
|
228 echo m68k-lynx-lynxos${UNAME_RELEASE} |
|
229 exit 0 ;; |
|
230 i[34]86:LynxOS:2.2*:*) |
|
231 echo i386-lynx-lynxos${UNAME_RELEASE} |
|
232 exit 0 ;; |
|
233 TSUNAMI:LynxOS:2.2*:*) |
|
234 echo sparc-lynx-lynxos${UNAME_RELEASE} |
|
235 exit 0 ;; |
5
|
236 esac |
|
237 |
89
|
238 #echo '(No uname command or uname output not recognized.)' 1>&2 |
5
|
239 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 |
|
240 |
|
241 cat >dummy.c <<EOF |
|
242 main() |
|
243 { |
|
244 #if defined (sony) |
|
245 #if defined (MIPSEB) |
583
|
246 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, |
|
247 I don't know.... */ |
|
248 printf ("mips-sony-bsd\n"); exit (0); |
5
|
249 #else |
|
250 printf("m68k-sony-newsos\n"); exit(0); |
|
251 #endif |
|
252 #endif |
|
253 |
583
|
254 #if defined (__arm) && defined (__acorn) && defined (__unix) |
|
255 printf("arm-acorn-riscix"); exit (0); |
|
256 #endif |
|
257 |
5
|
258 #if defined(hp300) && !defined(hpux) |
|
259 printf("m68k-hp-bsd\n"); exit(0); |
|
260 #endif |
|
261 |
89
|
262 #if defined(NeXT) |
583
|
263 #if !defined(__ARCHITECTURE__) |
|
264 #define __ARCHITECTURE__ "m68k" |
|
265 #endif |
|
266 int version; |
|
267 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; |
|
268 if (version==2) |
|
269 { |
|
270 printf("%s-next-ns2\n", __ARCHITECTURE__); |
|
271 exit(0); |
|
272 } |
|
273 else |
|
274 { |
|
275 printf("%s-next-ns3\n", __ARCHITECTURE__); |
|
276 exit(0); |
|
277 } |
89
|
278 #endif |
|
279 |
5
|
280 #if defined (MULTIMAX) || defined (n16) |
|
281 #if defined (UMAXV) |
|
282 printf("ns32k-encore-sysv\n"); exit(0); |
|
283 #else |
|
284 #if defined (CMU) |
|
285 printf("ns32k-encore-mach\n"); exit(0); |
|
286 #else |
|
287 printf("ns32k-encore-bsd\n"); exit(0); |
|
288 #endif |
|
289 #endif |
|
290 #endif |
|
291 |
|
292 #if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__)) |
|
293 printf("i386-unknown-bsd\n"); exit(0); |
|
294 #endif |
|
295 |
|
296 #if defined(sequent) |
|
297 #if defined(i386) |
|
298 printf("i386-sequent-dynix\n"); exit(0); |
|
299 #endif |
|
300 #if defined (ns32000) |
|
301 printf("ns32k-sequent-dynix\n"); exit(0); |
|
302 #endif |
|
303 #endif |
|
304 |
|
305 #if defined(_SEQUENT_) |
|
306 printf("i386-sequent-ptx\n"); exit(0); |
|
307 #endif |
|
308 |
583
|
309 #if defined(vax) |
|
310 #if !defined(ultrix) |
|
311 printf("vax-dec-bsd\n"); exit(0); |
|
312 #else |
|
313 printf("vax-dec-ultrix\n"); exit(0); |
|
314 #endif |
|
315 #endif |
|
316 |
5
|
317 exit (1); |
|
318 } |
|
319 EOF |
|
320 |
583
|
321 ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 |
5
|
322 rm -f dummy.c dummy |
|
323 |
583
|
324 # Apollos put the system type in the environment. |
|
325 |
|
326 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } |
|
327 |
89
|
328 #echo '(Unable to guess system type)' 1>&2 |
5
|
329 |
|
330 exit 1 |