config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] * config.sub: Simplify OS checking


From: John Ericson
Subject: [PATCH] * config.sub: Simplify OS checking
Date: Sat, 19 May 2018 22:15:49 -0400

The removed case did a variety of things. Here's each and what I did:

 - Prevent manufacture from being treated as OS:

   Made that a special case just for two component patterns.

 - Defaulted, removed, or elaborated trailing version numbers:

   Moved down below to the main OS checking

 - Substituted some "-pc" in the `basic_machine` with sed:

   Removed as this isn't really necessary. If the user passed `unknown`
   or no vender, this will already be filled in. If they passed
   something more specific, it's customary to respect that.

 - Substituted "-sequent" in the `basic_machine` for "ipx":

   Removed. "unknown" will be defaulted to "sequent" per existing code
   below.

 - Forced `basic_machine` based on `os`, just for "mint" and "clix":

   I just got rid of this forcing, as it can hide the user's errors from
   the user and is unlike how other OSes are treated. I added fallbacks
   for clix (MiNT already had them) such that at least the following
   stil work:

       $ ./config.sub clipper-clix
       clipper-intergraph-clix

       $ ./config.sub m68k-mint
       m68k-atari-mint

       $ ./config.sub mint
       m68k-atari-mint

   "clix" (as opposed to "nonsense-clix", i.e. with at least one "-"
   before) never worked, so I didn't add a short-hand to make it work
   like "mint".
---
 ChangeLog                 |   4 +
 config.sub                | 211 ++++++++++++++++++++--------------------------
 testsuite/config-sub.data |   2 +
 3 files changed, 99 insertions(+), 118 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 88bab97..a08c477 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-05-19  John Ericson  <address@hidden>
+
+       * config.sub: Simplify OS checking
+
 2018-05-19  Ben Elliston  <address@hidden>
 
        * testsuite/config-sub.data: Sort.
diff --git a/config.sub b/config.sub
index f38250f..98c44ef 100755
--- a/config.sub
+++ b/config.sub
@@ -149,8 +149,35 @@ case $1 in
                esac
                ;;
        *-*)
-               basic_machine=$field1
-               os=$field2
+               # Second component is usually, but not always the OS
+               case $field2 in
+                       # Prevent following clause from handling this valid os
+                       sun*os*)
+                               basic_machine=$field1
+                               os=$field2
+                               ;;
+                       # Manufacturers
+                       dec* | mips* | sequent* | encore* | pc532* | sgi* | 
sony* \
+                       | att* | 7300* | 3300* | delta* | motorola* | sun[234]* 
\
+                       | unicom* | ibm* | next | hp | isi* | apollo | altos* \
+                       | convergent* | ncr* | news | 32* | 3600* | 3100* | 
hitachi* \
+                       | c[123]* | convex* | sun | crds | omron* | dg | ultra 
| tti* \
+                       | harris | dolphin | highlevel | gould | cbm | ns | 
masscomp \
+                       | apple | axis | knuth | cray | microblaze* \
+                       | sim | cisco | oki | wec | wrs | winbond)
+                               basic_machine=$field1-$field2
+                               os=
+                               ;;
+                       # Machine models
+                       bluegene*)
+                               basic_machine=$field1-ibm
+                               os=cnk
+                               ;;
+                       *)
+                               basic_machine=$field1
+                               os=$field2
+                               ;;
+               esac
                ;;
        *)
                # Convert single-component short-hands not valid as part of
@@ -540,110 +567,6 @@ case $1 in
                ;;
 esac
 
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-       sun*os*)
-               # Prevent following clause from handling this invalid input.
-               ;;
-       dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* | \
-       att* | 7300* | 3300* | delta* | motorola* | sun[234]* | \
-       unicom* | ibm* | next | hp | isi* | apollo | altos* | \
-       convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* |\
-       c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* | \
-       harris | dolphin | highlevel | gould | cbm | ns | masscomp | \
-       apple | axis | knuth | cray | microblaze*)
-               os=
-               basic_machine=$1
-               ;;
-       bluegene*)
-               os=cnk
-               ;;
-       sim | cisco | oki | wec | winbond)
-               os=
-               basic_machine=$1
-               ;;
-       scout)
-               ;;
-       wrs)
-               os=vxworks
-               basic_machine=$1
-               ;;
-       chorusos*)
-               os=chorusos
-               basic_machine=$1
-               ;;
-       chorusrdb)
-               os=chorusrdb
-               basic_machine=$1
-               ;;
-       hiux*)
-               os=hiuxwe2
-               ;;
-       sco6)
-               os=sco5v6
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       sco5)
-               os=sco3.2v5
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       sco4)
-               os=sco3.2v4
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       sco3.2v[4-9]*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       sco5v6*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       sco*)
-               os=sco3.2v2
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       udk*)
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       isc)
-               os=isc2.2
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       clix*)
-               basic_machine=clipper-intergraph
-               ;;
-       isc*)
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-               ;;
-       lynx*178)
-               os=lynxos178
-               ;;
-       lynx*5)
-               os=lynxos5
-               ;;
-       lynx*)
-               os=lynxos
-               ;;
-       ptx*)
-               basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
-               ;;
-       psos*)
-               os=psos
-               ;;
-       mint | mint[0-9]*)
-               basic_machine=m68k-atari
-               os=mint
-               ;;
-esac
-
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
        # Recognize the basic CPU types without company name.
@@ -893,7 +816,7 @@ case $basic_machine in
                basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=linux
                ;;
-       bluegene*)
+       bluegene* )
                basic_machine=powerpc-ibm
                os=cnk
                ;;
@@ -1393,26 +1316,57 @@ case $os in
        es1800*)
                os=ose
                ;;
+       # Some version numbers need modification
+       chorusos*)
+               os=chorusos
+               ;;
+       isc)
+               os=isc2.2
+               ;;
+       sco6)
+               os=sco5v6
+               ;;
+       sco5)
+               os=sco3.2v5
+               ;;
+       sco4)
+               os=sco3.2v4
+               ;;
+       sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               ;;
+       sco3.2v[4-9]* | sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               ;;
+       scout)
+               # Don't match below
+               ;;
+       sco*)
+               os=sco3.2v2
+               ;;
+       psos*)
+               os=psos
+               ;;
        # Now accept the basic system types.
        # The portable systems comes first.
        # Each alternative MUST end in a * to match a version number.
        # sysv* is not here because it comes later, after sysvr4.
        gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
-            | *vms* | sco* | esix* | isc* | aix* | cnk* | sunos | sunos[34]*\
+            | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
             | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
             | sym* | kopensolaris* | plan9* \
             | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
             | aos* | aros* | cloudabi* | sortix* \
             | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
             | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \
-            | hiux* | knetbsd* | mirbsd* | netbsd* \
+            | knetbsd* | mirbsd* | netbsd* \
             | bitrig* | openbsd* | solidbsd* | libertybsd* \
             | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
             | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
             | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
             | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
-            | chorusos* | chorusrdb* | cegcc* | glidix* \
-            | cygwin* | msys* | pe* | psos* | moss* | proelf* | rtems* \
+            | chorusrdb* | cegcc* | glidix* \
+            | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
             | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
             | linux-newlib* | linux-musl* | linux-uclibc* \
             | uxpv* | beos* | mpeix* | udk* | moxiebox* \
@@ -1436,6 +1390,9 @@ case $os in
                        ;;
                esac
                ;;
+       hiux*)
+               os=hiuxwe2
+               ;;
        nto-qnx*)
                ;;
        nto*)
@@ -1445,20 +1402,23 @@ case $os in
            | windows* | osx | abug | netware* | os9* \
            | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
                ;;
-       mac*)
-               os=`echo "$os" | sed -e 's|mac|macos|'`
-               ;;
        linux-dietlibc)
                os=linux-dietlibc
                ;;
        linux*)
                os=`echo $os | sed -e 's|linux|linux-gnu|'`
                ;;
-       sunos5*)
-               os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
+       lynx*178)
+               os=lynxos178
                ;;
-       sunos6*)
-               os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
+       lynx*5)
+               os=lynxos5
+               ;;
+       lynx*)
+               os=lynxos
+               ;;
+       mac*)
+               os=`echo "$os" | sed -e 's|mac|macos|'`
                ;;
        opened*)
                os=openedition
@@ -1466,6 +1426,12 @@ case $os in
        os400*)
                os=os400
                ;;
+       sunos5*)
+               os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
+               ;;
+       sunos6*)
+               os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
+               ;;
        wince*)
                os=wince
                ;;
@@ -1599,6 +1565,9 @@ case $basic_machine in
        c8051-*)
                os=elf
                ;;
+       clipper-intergraph)
+               os=clix
+               ;;
        hexagon-*)
                os=elf
                ;;
@@ -1744,6 +1713,9 @@ case $basic_machine in
        *-atari*)
                os=mint
                ;;
+       *-wrs)
+               os=vxworks
+               ;;
        *)
                os=none
                ;;
@@ -1789,6 +1761,9 @@ case $basic_machine in
                        genix*)
                                vendor=ns
                                ;;
+                       clix*)
+                               vendor=intergraph
+                               ;;
                        mvs* | opened*)
                                vendor=ibm
                                ;;
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index 49473f6..d51b44e 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -124,6 +124,7 @@ c8051                                               
c8051-unknown-elf
 c8051-elf                                      c8051-unknown-elf
 cegcc                                          arm-unknown-cegcc
 clipper                                                clipper-unknown-none
+clipper-clix                                   clipper-intergraph-clix
 cr16-elf                                       cr16-unknown-elf
 cr16-random-elf                                        cr16-unknown-elf
 cris-linux                                     cris-axis-linux-gnu
@@ -318,6 +319,7 @@ mipsr5900                                   
mipsr5900-unknown-elf
 mips-sde-elf                                   mips-sde-elf
 mipstx39el                                     mipstx39el-unknown-elf
 mipstx39                                       mipstx39-unknown-elf
+m68k-mint                                      m68k-atari-mint
 mmix-elf                                       mmix-knuth-elf
 mmix                                           mmix-knuth-mmixware
 mn10200                                                mn10200-unknown-none
-- 
2.16.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]