use relative paths for configure and srcdir when possible
[deliverable/binutils-gdb.git] / config.subr
1 #!/bin/sh
2 # Configuration validation subroutine script, version 1.0.
3 # Copyright (C) 1991 Free Software Foundation, Inc.
4
5 #This file is free software; you can redistribute it and/or modify
6 #it 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,
11 #but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #GNU 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 # Configuration subroutine to validate and canonicalize a configuration type.
21 # Supply the specified configuration type as an argument.
22 # If it is invalid, we print an error message on stderr and exit with code 1.
23 # Otherwise, we print the canonical config type on stdout and succeed.
24
25 # This file is supposed to be the same for all GNU packages
26 # and recognize all the CPU types, system types and aliases
27 # that are meaningful with *any* GNU software.
28 # Each package is responsible for reporting which valid configurations
29 # it does not support. The user should be able to distinguish
30 # a failure to support a valid configuration from a meaningless
31 # configuration.
32
33 # The goal of this file is to map all the various variations of a given
34 # machine specification into a single specification in the form:
35 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
36 # it is wrong to echo any other type of specification
37
38 # First pass through any local machine types.
39 case $1 in
40 *local*)
41 echo $1
42 exit 0
43 ;;
44 *)
45 ;;
46 esac
47
48 # Separate what the user gave into CPU-COMPANY and OS (if any).
49 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
50 if [ $basic_machine != $1 ]
51 then os=`echo $1 | sed 's/.*-/-/'`
52 else os=; fi
53
54 # Lets recognize common machines as not being OS so that things like
55 # config.subr decstation-3100 as legal.
56 case $os in
57 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
58 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
59 -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \
60 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -osf* | \
61 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
62 -harris)
63 os=
64 basic_machine=$1
65 ;;
66 -sco*)
67 os=-scosysv322
68 basic_machine=i386-unknown
69 ;;
70 -isc*)
71 os=-iscsysv
72 basic_machine=i386-unknown
73 ;;
74 # start-sanitize-v9
75 -32)
76 basic_machine=sparc64-hal
77 os=-hal32
78 ;;
79 -64)
80 basic_machine=sparc64-hal
81 os=-hal64
82 ;;
83 -v7)
84 basic_machine=sparc64-hal
85 os=-v7
86 ;;
87 # end-sanitize-v9
88 esac
89
90 # Decode aliases for certain CPU-COMPANY combinations.
91 case $basic_machine in
92 # Recognize the basic CPU types with without company name.
93 tahoe | i386 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
94 | tron | a29k | 580 | i960 | h8300)
95 basic_machine=$basic_machine-unknown
96 ;;
97 # Recognize the basic CPU types with with company name.
98 vax-* | tahoe-* | i386-* | i860-* | m68k-* | m68000-* | m88k-* \
99 | sparc-* | ns32k-* | alliant-* | arm-* | c[123]* \
100 | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
101 | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
102 | hppa-*)
103 ;;
104 # Recognize the various machine names and aliases which stand
105 # for a CPU type and a company and sometimes even an OS.
106 # start-sanitize-life
107 life-*) ;;
108 life)
109 basic_machine=life-philips
110 os=-none
111 ;;
112 # end-sanitize-life
113
114 # start-sanitize-v9
115 sparc64-*) ;;
116 hal-32 | hal32)
117 basic_machine=sparc64-hal
118 os=-hal32
119 ;;
120 hal-64 | hal64)
121 basic_machine=sparc64-hal
122 os=-hal64
123 ;;
124 sparc64)
125 basic_machine=sparc64-sun
126 os=-v9
127 ;;
128 sparc64-v7 | sparc64v7)
129 basic_machine=sparc64-sun
130 os=-v7
131 ;;
132 # end-sanitize-v9
133
134 vaxv)
135 basic_machine=vax-dec
136 os=-sysv
137 ;;
138 vms)
139 basic_machine=vax-dec
140 os=-vms
141 ;;
142 i386v32)
143 basic_machine=i386-unknown
144 os=-sysv32
145 ;;
146 i386-sco* | i386sco | sco)
147 basic_machine=i386-unknown
148 os=-scosysv322
149 ;;
150 i386-isc* | isc)
151 basic_machine=i386-unknown
152 os=-iscsysv
153 ;;
154 i386v4*)
155 basic_machine=i386-unknown
156 os=-sysv4
157 ;;
158 i386v)
159 basic_machine=i386-unknown
160 os=-sysv
161 ;;
162 spur)
163 basic_machine=spur-unknown
164 ;;
165 alliant)
166 basic_machine=alliant-alliant
167 ;;
168 convex-c1)
169 basic_machine=c1-convex
170 os=-sysv
171 ;;
172 convex-c2)
173 basic_machine=c2-convex
174 os=-sysv
175 ;;
176 convex-c32)
177 basic_machine=c32-convex
178 os=-sysv
179 ;;
180 convex-c34)
181 basic_machine=c34-convex
182 os=-sysv
183 ;;
184 convex-c38)
185 basic_machine=c38-convex
186 os=-sysv
187 ;;
188 m88k-omron*)
189 basic_machine=m88k-omron
190 ;;
191 merlin)
192 basic_machine=ns32k-utek
193 os=-sysv
194 ;;
195 crds | unos)
196 basic_machine=m68k-crds
197 ;;
198 encore | umax | mmax)
199 basic_machine=ns32k-encore
200 os=-sysv
201 ;;
202 genix)
203 basic_machine=ns32k-ns
204 ;;
205 iris | iris4d)
206 basic_machine=mips-sgi
207 os=-irix
208 ;;
209 news | news700 | news800 | news900)
210 basic_machine=m68k-sony
211 os=-newsos
212 ;;
213 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
214 basic_machine=m68k-att
215 ;;
216 delta | 3300 | motorola-3300 | motorola-delta \
217 | 3300-motorola | delta-motorola)
218 basic_machine=m68k-motorola
219 ;;
220 balance)
221 basic_machine=ns32k-sequent
222 os=-dynix
223 ;;
224 pc532)
225 basic_machine=ns32k-pc532
226 ;;
227 symmetry)
228 basic_machine=i386-sequent
229 os=-dynix
230 ;;
231 sun2)
232 basic_machine=m68000-sun
233 ;;
234 sun2os3)
235 basic_machine=m68000-sun
236 os=-sunos3
237 ;;
238 sun2os4)
239 basic_machine=m68000-sun
240 os=-sunos4
241 ;;
242 sun3os3)
243 basic_machine=m68k-sun
244 os=-sunos3
245 ;;
246 sun3os4)
247 basic_machine=m68k-sun
248 os=-sunos4
249 ;;
250 sun4os3)
251 basic_machine=sparc-sun
252 os=-sunos3
253 ;;
254 sun4os4)
255 basic_machine=sparc-sun
256 os=-sunos4
257 ;;
258 sun3)
259 basic_machine=m68k-sun
260 ;;
261 sun4)
262 basic_machine=sparc-sun
263 ;;
264 pbd)
265 basic_machine=sparc-unicom
266 ;;
267 sun386 | sun386i | roadrunner)
268 basic_machine=i386-sun
269 ;;
270 ps2)
271 basic_machine=i386-ibm
272 ;;
273 next)
274 basic_machine=m68k-next
275 os=-sysv
276 ;;
277 hp9k3[2-9][0-9])
278 basic_machine=m68k-hp
279 ;;
280 hp9k31[0-9] | hp9k2[0-9][0-9])
281 basic_machine=m68000-hp
282 ;;
283 hp9k8[0-9][0-9] | hp9k7[0-9][0-9] | hp8[0-9][0-9] | hp7[0-9][0-9])
284 basic_machine=hp800-hp
285 ;;
286 isi68 | isi)
287 basic_machine=m68k-isi
288 os=-sysv
289 ;;
290 apollo68)
291 basic_machine=m68k-apollo
292 os=-sysv
293 ;;
294 altos | altos3068)
295 basic_machine=m68k-altos
296 ;;
297 miniframe)
298 basic_machine=m68000-convergent
299 ;;
300 tower | tower-32)
301 basic_machine=m68k-ncr
302 ;;
303 news-3600 | risc-news)
304 basic_machine=mips-sony
305 os=-newsos
306 ;;
307 decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
308 basic_machine=mips-dec
309 ;;
310 magnum | m3230)
311 basic_machine=mips-mips
312 os=-sysv
313 ;;
314 gmicro)
315 basic_machine=tron-gmicro
316 os=-sysv
317 ;;
318 rtpc | rtpc-*)
319 basic_machine=romp-ibm
320 ;;
321 am29k)
322 basic_machine=a29k-none
323 os=-bsd
324 ;;
325 amdahl)
326 basic_machine=580-amdahl
327 os=-sysv
328 ;;
329 amigados)
330 basic_machine=m68k-cbm
331 os=-amigados
332 ;;
333 amigaunix | amix)
334 basic_machine=m68k-cbm
335 os=-sysv4
336 ;;
337 cray | ymp)
338 basic_machine=ymp-cray
339 os=-unicos
340 ;;
341 cray2)
342 basic_machine=cray2-cray
343 os=-unicos
344 ;;
345 xmp)
346 basic_machine=xmp-cray
347 os=-unicos
348 ;;
349 delta88)
350 basic_machine=m88k-motorola
351 os=-m88kbcs
352 ;;
353 dpx2)
354 basic_machine=m68k-bull
355 os=-sysv
356 ;;
357 ebmon29k)
358 basic_machine=a29k-amd
359 os=-ebmon
360 ;;
361 h8300hds)
362 basic_machine=h8300-hitachi
363 os=-hds
364 ;;
365 harris)
366 basic_machine=m88k-harris
367 os=-m88kbcs
368 ;;
369 hp300bsd)
370 basic_machine=m68k-hp
371 os=-bsd
372 ;;
373 hp300hpux)
374 basic_machine=m68k-hp
375 os=-hpux
376 ;;
377 hp9k2[0-9][0-9] | hp9k31[0-9])
378 basic_machine=m68000-hp
379 os=-hpux
380 ;;
381 hp9k3[2-9][0-9])
382 basic_machine=m68k-hp
383 os=-hpux
384 ;;
385 ncr3000)
386 basic_machine=i386-ncr
387 os=-sysv4
388 ;;
389 news1000)
390 basic_machine=m68030-sony
391 os=-newsos
392 ;;
393 nindy960)
394 basic_machine=i960-intel
395 os=-nindy
396 ;;
397 pn)
398 basic_machine=pn-gould
399 os=-sysv
400 ;;
401 np1)
402 basic_machine=np1-gould
403 os=-sysv
404 ;;
405 ultra3)
406 basic_machine=a29k-nyu
407 # Is sym1 really a different system, or is it really sysv?
408 # os=-sym1
409 ;;
410 vxworks960)
411 basic_machine=i960-wrs
412 os=-vxworks
413 ;;
414 vxworks68)
415 basic_machine=m68k-wrs
416 os=-vxworks
417 ;;
418 none)
419 basic_machine=none-none
420 os=-none
421 ;;
422
423 # Here we handle the default manufacturer of certain CPU types. It is in
424 # some cases the only manufacturer, in others, it is the most popular.
425 mips)
426 basic_machine=mips-mips
427 ;;
428 romp)
429 basic_machine=romp-ibm
430 ;;
431 rs6000)
432 basic_machine=rs6000-ibm
433 ;;
434 vax)
435 basic_machine=vax-dec
436 ;;
437 sparc)
438 basic_machine=sparc-sun
439 ;;
440 *)
441 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
442 exit 1
443 ;;
444 esac
445
446 # Decode manufacturer-specific aliases for certain operating systems.
447
448 if [ "$os" ]
449 then
450 case $os in
451 # First accept the basic system types.
452 # The portable systems comes first.
453 # Each alternative must end in a *, to match a version number.
454 -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* \
455 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
456 | -unos* | -osf* | -v88r* | -luna* | -dgux* | -solari* \
457 | -amigados* | -msdos* \
458 | -nindy* | -vxworks* | -ebmon* | -hds* | -m88kbcs*)
459 ;;
460 # start-sanitize-v9
461 -v7 | -v9 | -hal32 | -hal64) ;;
462 # end-sanitize-v9
463
464 -newsos*)
465 os=-bsd
466 ;;
467 -osfrose*)
468 os=-osf
469 ;;
470 -osf*)
471 os=-bsd
472 ;;
473 -dynix*)
474 os=-bsd
475 ;;
476 -aos*)
477 os=-bsd
478 ;;
479 -ctix* | -irix* | -uts*)
480 os=-sysv
481 ;;
482 *)
483 # Get rid of the `-' at the beginning of $os.
484 os=`echo $1 | sed 's/[^-]*-//'`
485 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
486 exit 1
487 ;;
488 esac
489 else
490
491 # Here we handle the default operating systems that come with various machines.
492 # The value should be what the vendor currently ships out the door with their
493 # machine or put another way, the most popular os provided with the machine.
494 case $basic_machine in
495 *-dec | vax-*)
496 os=-ultrix42
497 ;;
498 i386-sun)
499 os=-sunos402
500 ;;
501 m68000-sun)
502 os=-sunos3
503 # This also exists in the configure program, but was not the
504 # default.
505 # os=-sunos4
506 ;;
507 sparc-* | *-sun)
508 os=-sunos411
509 ;;
510 romp-*)
511 os=-bsd
512 ;;
513 *-ibm)
514 os=-aix
515 ;;
516 *-hp)
517 os=-hpux
518 ;;
519 *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
520 os=-sysv
521 ;;
522 *-dg)
523 os=-dgux
524 ;;
525 m88k-omron*)
526 os=-luna
527 ;;
528 *-crds)
529 os=-unos
530 ;;
531 *-ns)
532 os=-genix
533 ;;
534 i386-*)
535 os=-scosysv322
536 ;;
537 *)
538 os=-none
539 ;;
540 esac
541 fi
542
543 # Here we handle the case where we know the os, and the CPU type, but not the
544 # manufacturer. We pick the logical manufacturer.
545 vendor=unknown
546 case $basic_machine in
547 *-unknown)
548 case $os in
549 -sunos*)
550 vendor=sun
551 ;;
552 -aix*)
553 vendor=ibm
554 ;;
555 -hpux*)
556 vendor=hp
557 ;;
558 -unos*)
559 vendor=crds
560 ;;
561 -dgux*)
562 vendor=dg
563 ;;
564 -luna*)
565 vendor=omron
566 ;;
567 -genix*)
568 vendor=ns
569 ;;
570 esac
571 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
572 ;;
573 esac
574
575 echo $basic_machine$os
This page took 0.043278 seconds and 4 git commands to generate.