1#!/bin/sh 2# Configuration validation subroutine script, version 1.0. 3# Copyright (C) 1991, 1992 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 38if [ x$1 = x ] 39then 40 echo Configuration name missing. 1>&2 41 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 42 echo "or $0 ALIAS" 1>&2 43 echo where ALIAS is a recognized configuration type. 1>&2 44 exit 1 45fi 46 47# First pass through any local machine types. 48case $1 in 49 *local*) 50 echo $1 51 exit 0 52 ;; 53 *) 54 ;; 55esac 56 57# Separate what the user gave into CPU-COMPANY and OS (if any). 58basic_machine=`echo $1 | sed 's/-[^-][^-]*$//'` 59if [ $basic_machine != $1 ] 60then os=`echo $1 | sed 's/.*-/-/'` 61else os=; fi 62 63# Lets recognize common machines as not being OS so that things like 64# config.subr decstation-3100 as legal. 65case $os in 66 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ 67 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ 68 -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \ 69 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -osf* | \ 70 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 71 -harris | -sim) 72 os= 73 basic_machine=$1 74 ;; 75 -scout) 76 ;; 77 -sco*) 78 os=-scosysv322 79 basic_machine=i386-unknown 80 ;; 81 -OSE68k | -ose68k | -OSE | -ose | -es1800) 82 os=-ose 83 basic_machine=m68k-ericsson 84 ;; 85 -OSE68000 | -ose68000) 86 os=-ose 87 basic_machine=m68000-ericsson 88 ;; 89 -isc*) 90 os=-iscsysv 91 basic_machine=i386-unknown 92 ;; 93esac 94 95# Decode aliases for certain CPU-COMPANY combinations. 96case $basic_machine in 97 # Recognize the basic CPU types with without company name. 98 tahoe | i386 | i486 | i860 | m68k | m680[01234]0 | m683?2 \ 99 | m88k | ns32k | arm | pyramid \ 100 | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 | we32k\ 101 | v70 | we32k | z8k) 102 basic_machine=$basic_machine-unknown 103 ;; 104 # Recognize the basic CPU types with with company name. 105 vax-* | tahoe-* | i386-* | i486-* | i860-* | m68k-* \ 106 | m680[01234]0-* | m683?2-* | m88k-* \ 107 | sparc-* | ns32k-* | alliant-* | arm-* | c[123]* \ 108 | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ 109 | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ 110 | hppa1.0-* | hppa1.1-* | we32k-* | z8k-*) 111 ;; 112 # Recognize the various machine names and aliases which stand 113 # for a CPU type and a company and sometimes even an OS. 114 115 116 vaxv) 117 basic_machine=vax-dec 118 os=-sysv 119 ;; 120 vms) 121 basic_machine=vax-dec 122 os=-vms 123 ;; 124 i386mach) 125 basic_machine=i386-mach 126 os=-mach 127 ;; 128 i386v32) 129 basic_machine=i386-unknown 130 os=-sysv32 131 ;; 132 i386-sco* | i386sco | sco) 133 basic_machine=i386-unknown 134 os=-scosysv322 135 ;; 136 go32 | i386-go32) 137 basic_machine=i386-unknown 138 os=-go32 139 ;; 140 i386-isc* | isc) 141 basic_machine=i386-unknown 142 os=-iscsysv 143 ;; 144 i386-linux* | linux) 145 basic_machine=i386-unknown 146 os=-linux 147 ;; 148 i386v4*) 149 basic_machine=i386-unknown 150 os=-sysv4 151 ;; 152 i486v4*) 153 basic_machine=i486-unknown 154 os=-sysv4 155 ;; 156 i386v) 157 basic_machine=i386-unknown 158 os=-sysv 159 ;; 160 i486v) 161 basic_machine=i486-unknown 162 os=-sysv 163 ;; 164 386bsd) 165 basic_machine=i386-unknown 166 os=-bsd 167 ;; 168 spur) 169 basic_machine=spur-unknown 170 ;; 171 alliant) 172 basic_machine=alliant-alliant 173 ;; 174 convex-c1) 175 basic_machine=c1-convex 176 os=-sysv 177 ;; 178 convex-c2) 179 basic_machine=c2-convex 180 os=-sysv 181 ;; 182 convex-c32) 183 basic_machine=c32-convex 184 os=-sysv 185 ;; 186 convex-c34) 187 basic_machine=c34-convex 188 os=-sysv 189 ;; 190 convex-c38) 191 basic_machine=c38-convex 192 os=-sysv 193 ;; 194 m88k-omron*) 195 basic_machine=m88k-omron 196 ;; 197 merlin) 198 basic_machine=ns32k-utek 199 os=-sysv 200 ;; 201 crds | unos) 202 basic_machine=m68k-crds 203 ;; 204 encore | umax | mmax) 205 basic_machine=ns32k-encore 206 os=-sysv 207 ;; 208 genix) 209 basic_machine=ns32k-ns 210 ;; 211 iris | iris3 | iris4d) 212 basic_machine=mips-sgi 213 os=-irix3 214 ;; 215 iris4) 216 basic_machine=mips-sgi 217 os=-irix4 218 ;; 219 news | news700 | news800 | news900) 220 basic_machine=m68k-sony 221 os=-newsos 222 ;; 223 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 224 basic_machine=m68k-att 225 ;; 226 3b* | we32k* ) 227 basic_machine=we32k-att 228 os=-sysv 229 ;; 230 delta | 3300 | motorola-3300 | motorola-delta \ 231 | 3300-motorola | delta-motorola) 232 basic_machine=m68k-motorola 233 ;; 234 balance) 235 basic_machine=ns32k-sequent 236 os=-dynix 237 ;; 238 pc532) 239 basic_machine=ns32k-pc532 240 ;; 241 symmetry) 242 basic_machine=i386-sequent 243 os=-dynix 244 ;; 245 sun2) 246 basic_machine=m68000-sun 247 ;; 248 sun2os3) 249 basic_machine=m68000-sun 250 os=-sunos3 251 ;; 252 sun2os4) 253 basic_machine=m68000-sun 254 os=-sunos4 255 ;; 256 sun3os3) 257 basic_machine=m68k-sun 258 os=-sunos3 259 ;; 260 sun3os4) 261 basic_machine=m68k-sun 262 os=-sunos4 263 ;; 264 sun4os3) 265 basic_machine=sparc-sun 266 os=-sunos3 267 ;; 268 sun4os4) 269 basic_machine=sparc-sun 270 os=-sunos4 271 ;; 272 sun4sol2) 273 basic_machine=sparc-sun 274 os=-solaris2 275 ;; 276 z8ksim) 277 basic_machine=z8k-unknown 278 os=-sim 279 ;; 280 sun3) 281 basic_machine=m68k-sun 282 ;; 283 sun4) 284 basic_machine=sparc-sun 285 ;; 286 msdos) 287 basic_machine=i386-unknown 288 os=-msdos 289 ;; 290 pbd) 291 basic_machine=sparc-unicom 292 ;; 293 sun386 | sun386i | roadrunner) 294 basic_machine=i386-sun 295 ;; 296 ps2) 297 basic_machine=i386-ibm 298 ;; 299 next) 300 basic_machine=m68k-next 301 os=-bsd 302 ;; 303 hp9k3[2-9][0-9]) 304 basic_machine=m68k-hp 305 ;; 306 hp9k31[0-9] | hp9k2[0-9][0-9]) 307 basic_machine=m68000-hp 308 ;; 309 hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) 310 basic_machine=hppa1.1-hp 311 ;; 312 hp9k8[0-9][0-9] | hp8[0-9][0-9]) 313 basic_machine=hppa1.0-hp 314 ;; 315 isi68 | isi) 316 basic_machine=m68k-isi 317 os=-sysv 318 ;; 319 apollo68) 320 basic_machine=m68k-apollo 321 os=-sysv 322 ;; 323 apollo68bsd) 324 basic_machine=m68k-apollo 325 os=-bsd 326 ;; 327 altos | altos3068) 328 basic_machine=m68k-altos 329 ;; 330 miniframe) 331 basic_machine=m68000-convergent 332 ;; 333 tower | tower-32) 334 basic_machine=m68k-ncr 335 ;; 336 news-3600 | risc-news) 337 basic_machine=mips-sony 338 os=-newsos 339 ;; 340 st2000) 341 basic_machine=m68k-tandem 342 ;; 343 decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn) 344 basic_machine=mips-dec 345 ;; 346 magnum | m3230) 347 basic_machine=mips-mips 348 os=-sysv 349 ;; 350 gmicro) 351 basic_machine=tron-gmicro 352 os=-sysv 353 ;; 354 rtpc | rtpc-*) 355 basic_machine=romp-ibm 356 ;; 357 am29k) 358 basic_machine=a29k-none 359 os=-bsd 360 ;; 361 amdahl) 362 basic_machine=580-amdahl 363 os=-sysv 364 ;; 365 amigados) 366 basic_machine=m68k-cbm 367 os=-amigados 368 ;; 369 amigaunix | amix) 370 basic_machine=m68k-cbm 371 os=-sysv4 372 ;; 373 stratus) 374 basic_machine=i860-stratus 375 os=-sysv4 376 ;; 377 cray | ymp) 378 basic_machine=ymp-cray 379 os=-unicos 380 ;; 381 cray2) 382 basic_machine=cray2-cray 383 os=-unicos 384 ;; 385 xmp) 386 basic_machine=xmp-cray 387 os=-unicos 388 ;; 389 delta88) 390 basic_machine=m88k-motorola 391 os=-m88kbcs 392 ;; 393 dpx2) 394 basic_machine=m68k-bull 395 os=-sysv 396 ;; 397 ebmon29k) 398 basic_machine=a29k-amd 399 os=-ebmon 400 ;; 401 402 h8300hms) 403 basic_machine=h8300-hitachi 404 os=-hms 405 ;; 406 udi29k) 407 basic_machine=a29k-amd 408 os=-udi 409 ;; 410 a29khif) 411 basic_machine=a29k-amd 412 os=-udi 413 ;; 414 sa29200) 415 basic_machine=a29k-amd 416 os=-udi 417 ;; 418 h8300xray) 419 basic_machine=h8300-hitachi 420 os=-xray 421 ;; 422 harris) 423 basic_machine=m88k-harris 424 os=-m88kbcs 425 ;; 426 luna68k) 427 basic_machine=m68k-omron 428 os=-bsd 429 ;; 430 hp300bsd) 431 basic_machine=m68k-hp 432 os=-bsd 433 ;; 434 hp300hpux) 435 basic_machine=m68k-hp 436 os=-hpux 437 ;; 438 hp9k2[0-9][0-9] | hp9k31[0-9]) 439 basic_machine=m68000-hp 440 os=-hpux 441 ;; 442 hp9k3[2-9][0-9]) 443 basic_machine=m68k-hp 444 os=-hpux 445 ;; 446 hppabsd) 447 basic_machine=hppa-hp 448 os=-bsd 449 ;; 450 hppahpux) 451 basic_machine=hppa-hp 452 os=-hpux 453 ;; 454 ncr3000) 455 basic_machine=i486-ncr 456 os=-sysv4 457 ;; 458 necv70) 459 basic_machine=v70-nec 460 os=-sysv 461 ;; 462 news1000) 463 basic_machine=m68030-sony 464 os=-newsos 465 ;; 466 nindy960) 467 basic_machine=i960-intel 468 os=-nindy 469 ;; 470 pn) 471 basic_machine=pn-gould 472 os=-sysv 473 ;; 474 np1) 475 basic_machine=np1-gould 476 os=-sysv 477 ;; 478 ultra3) 479 basic_machine=a29k-nyu 480 os=-sym1 481 ;; 482 vxworks960) 483 basic_machine=i960-wrs 484 os=-vxworks 485 ;; 486 vxworks68) 487 basic_machine=m68k-wrs 488 os=-vxworks 489 ;; 490 es1800 | OSE68k | ose68k) 491 basic_machine=m68k-ericsson 492 os=-ose 493 ;; 494 OSE68000 | ose68000) 495 basic_machine=m68000-ericsson 496 os=-ose 497 ;; 498 os68k) 499 basic_machine=m68k-none 500 os=-os68k 501 ;; 502 sparclite) 503 basic_machine=sparclite-fujitsu 504 os=-none 505 ;; 506 sparclite-wrs) 507 basic_machine=sparclite-wrs 508 os=-vxworks 509 ;; 510 sparcfrw) 511 basic_machine=sparcfrw-sun 512 os=-sunos4 513 ;; 514 sparcfrwcompat) 515 basic_machine=sparcfrwcompat-sun 516 os=-sunos4 517 ;; 518 sparclitefrw) 519 basic_machine=sparclitefrw-fujitsu 520 os=-none 521 ;; 522 sparclitefrwcompat) 523 basic_machine=sparclitefrwcompat-fujitsu 524 os=-none 525 ;; 526 adobe68k) 527 basic_machine=m68010-adobe 528 os=-scout 529 ;; 530 531 none) 532 basic_machine=none-none 533 os=-none 534 ;; 535 536# Here we handle the default manufacturer of certain CPU types. It is in 537# some cases the only manufacturer, in others, it is the most popular. 538 mips) 539 basic_machine=mips-mips 540 ;; 541 romp) 542 basic_machine=romp-ibm 543 ;; 544 rs6000) 545 basic_machine=rs6000-ibm 546 ;; 547 vax) 548 basic_machine=vax-dec 549 ;; 550 sparc) 551 basic_machine=sparc-sun 552 ;; 553 fx2800) 554 basic_machine=i860-alliant 555 ;; 556 *) 557 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 558 exit 1 559 ;; 560esac 561 562# Decode manufacturer-specific aliases for certain operating systems. 563 564if [ "$os" ] 565then 566case $os in 567 # First accept the basic system types. 568 # The portable systems comes first. 569 # Each alternative must end in a *, to match a version number. 570 -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* \ 571 | -aout | -coff | -elf \ 572 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \ 573 | -unos* | -osf* | -v88r* | -luna* | -dgux* | -solaris* | -sym* \ 574 | -newsos | -amigados* | -msdos* | -none* | -os68k* | -irix* \ 575 | -nindy* | -vxworks* | -ebmon* | -udi | -hms* | -xray \ 576 | -m88kbcs* | -go32 | -linux* | -sim | -es1800*) 577 ;; 578 579# Note that readline checks for newsos 580# -newsos*) 581# os=-bsd 582# ;; 583 -osfrose*) 584 os=-osf 585 ;; 586 -osf*) 587 os=-bsd 588 ;; 589 -dynix*) 590 os=-bsd 591 ;; 592 -aos*) 593 os=-bsd 594 ;; 595 -386bsd) 596 os=-bsd 597 ;; 598 -ctix* | -uts*) 599 os=-sysv 600 ;; 601 -svr4) 602 os=-sysv4 603 ;; 604 -svr3) 605 os=-sysv3 606 ;; 607 -ose*) 608 os=-ose 609 ;; 610 -es1800*) 611 os=-ose 612 ;; 613 *) 614 # Get rid of the `-' at the beginning of $os. 615 os=`echo $1 | sed 's/[^-]*-//'` 616 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 617 exit 1 618 ;; 619esac 620else 621 622# Here we handle the default operating systems that come with various machines. 623# The value should be what the vendor currently ships out the door with their 624# machine or put another way, the most popular os provided with the machine. 625case $basic_machine in 626 *-dec | vax-*) 627 os=-ultrix42 628 ;; 629 i386-sun) 630 os=-sunos402 631 ;; 632 m68000-sun) 633 os=-sunos3 634 # This also exists in the configure program, but was not the 635 # default. 636 # os=-sunos4 637 ;; 638 sparc-* | *-sun) 639 os=-sunos411 640 ;; 641 romp-*) 642 os=-bsd 643 ;; 644 *-ibm) 645 os=-aix 646 ;; 647 *-hp) 648 os=-hpux 649 ;; 650 *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 651 os=-sysv 652 ;; 653 *-dg) 654 os=-dgux 655 ;; 656 m88k-omron*) 657 os=-luna 658 ;; 659 *-crds) 660 os=-unos 661 ;; 662 *-ns) 663 os=-genix 664 ;; 665 i386-*) 666 os=-scosysv322 667 ;; 668 *) 669 os=-none 670 ;; 671esac 672fi 673 674# Here we handle the case where we know the os, and the CPU type, but not the 675# manufacturer. We pick the logical manufacturer. 676vendor=unknown 677case $basic_machine in 678 *-unknown) 679 case $os in 680 -sunos*) 681 vendor=sun 682 ;; 683 -aix*) 684 vendor=ibm 685 ;; 686 -hpux*) 687 vendor=hp 688 ;; 689 -unos*) 690 vendor=crds 691 ;; 692 -dgux*) 693 vendor=dg 694 ;; 695 -luna*) 696 vendor=omron 697 ;; 698 -genix*) 699 vendor=ns 700 ;; 701 -vxworks*) 702 vendor=wrs 703 ;; 704 esac 705 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` 706 ;; 707esac 708 709echo $basic_machine$os 710