| @@ -1,165 +1,165 @@ | | | @@ -1,165 +1,165 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | # | | 2 | # |
3 | # GMP config.sub wrapper. | | 3 | # GMP config.sub wrapper. |
4 | | | 4 | |
5 | | | 5 | |
6 | # Copyright 2000-2003, 2006, 2009-2016 Free Software Foundation, Inc. | | 6 | # Copyright 2000-2003, 2006, 2009-2016 Free Software Foundation, Inc. |
7 | # | | 7 | # |
8 | # This file is part of the GNU MP Library. | | 8 | # This file is part of the GNU MP Library. |
9 | # | | 9 | # |
10 | # The GNU MP Library is free software; you can redistribute it and/or modify | | 10 | # The GNU MP Library is free software; you can redistribute it and/or modify |
11 | # it under the terms of either: | | 11 | # it under the terms of either: |
12 | # | | 12 | # |
13 | # * the GNU Lesser General Public License as published by the Free | | 13 | # * the GNU Lesser General Public License as published by the Free |
14 | # Software Foundation; either version 3 of the License, or (at your | | 14 | # Software Foundation; either version 3 of the License, or (at your |
15 | # option) any later version. | | 15 | # option) any later version. |
16 | # | | 16 | # |
17 | # or | | 17 | # or |
18 | # | | 18 | # |
19 | # * the GNU General Public License as published by the Free Software | | 19 | # * the GNU General Public License as published by the Free Software |
20 | # Foundation; either version 2 of the License, or (at your option) any | | 20 | # Foundation; either version 2 of the License, or (at your option) any |
21 | # later version. | | 21 | # later version. |
22 | # | | 22 | # |
23 | # or both in parallel, as here. | | 23 | # or both in parallel, as here. |
24 | # | | 24 | # |
25 | # The GNU MP Library is distributed in the hope that it will be useful, but | | 25 | # The GNU MP Library is distributed in the hope that it will be useful, but |
26 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | | 26 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
27 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | | 27 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
28 | # for more details. | | 28 | # for more details. |
29 | # | | 29 | # |
30 | # You should have received copies of the GNU General Public License and the | | 30 | # You should have received copies of the GNU General Public License and the |
31 | # GNU Lesser General Public License along with the GNU MP Library. If not, | | 31 | # GNU Lesser General Public License along with the GNU MP Library. If not, |
32 | # see https://www.gnu.org/licenses/. | | 32 | # see https://www.gnu.org/licenses/. |
33 | | | 33 | |
34 | | | 34 | |
35 | # Usage: config.sub CPU-VENDOR-OS | | 35 | # Usage: config.sub CPU-VENDOR-OS |
36 | # config.sub ALIAS | | 36 | # config.sub ALIAS |
37 | # | | 37 | # |
38 | # Validate and canonicalize the given configuration name, with special | | 38 | # Validate and canonicalize the given configuration name, with special |
39 | # handling for GMP extra CPU names. | | 39 | # handling for GMP extra CPU names. |
40 | # | | 40 | # |
41 | # When the CPU isn't special the whole name is simply passed straight | | 41 | # When the CPU isn't special the whole name is simply passed straight |
42 | # through to configfsf.sub. | | 42 | # through to configfsf.sub. |
43 | # | | 43 | # |
44 | # When the CPU is a GMP extra, configfsf.sub is run on a similar CPU that it | | 44 | # When the CPU is a GMP extra, configfsf.sub is run on a similar CPU that it |
45 | # will recognise. For example "athlon-pc-freebsd3.5" is validated using | | 45 | # will recognise. For example "athlon-pc-freebsd3.5" is validated using |
46 | # "i386-pc-freebsd3.5". | | 46 | # "i386-pc-freebsd3.5". |
47 | # | | 47 | # |
48 | # Any canonicalizations made by configfsf.sub are preserved. For example | | 48 | # Any canonicalizations made by configfsf.sub are preserved. For example |
49 | # given "athlon-linux", configfsf.sub is called with "i386-linux" and will | | 49 | # given "athlon-linux", configfsf.sub is called with "i386-linux" and will |
50 | # give back "i386-pc-linux-gnu". "athlon" is then reinstated, so we print | | 50 | # give back "i386-pc-linux-gnu". "athlon" is then reinstated, so we print |
51 | # "athlon-pc-linux-gnu". | | 51 | # "athlon-pc-linux-gnu". |
52 | | | 52 | |
53 | | | 53 | |
54 | # Expect to find configfsf.sub in the same directory as this config.sub | | 54 | # Expect to find configfsf.sub in the same directory as this config.sub |
55 | configfsf_sub="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`" | | 55 | configfsf_sub="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`" |
56 | if test "$configfsf_sub" = "$0"; then | | 56 | if test "$configfsf_sub" = "$0"; then |
57 | echo "Cannot derive configfsf.sub from $0" 1>&2 | | 57 | echo "Cannot derive configfsf.sub from $0" 1>&2 |
58 | exit 1 | | 58 | exit 1 |
59 | fi | | 59 | fi |
60 | if test -f "$configfsf_sub"; then | | 60 | if test -f "$configfsf_sub"; then |
61 | : | | 61 | : |
62 | else | | 62 | else |
63 | echo "$configfsf_sub not found" 1>&2 | | 63 | echo "$configfsf_sub not found" 1>&2 |
64 | exit 1 | | 64 | exit 1 |
65 | fi | | 65 | fi |
66 | | | 66 | |
67 | # Always run configfsf.sub with $SHELL, like autoconf does for config.sub | | 67 | # Always run configfsf.sub with $SHELL, like autoconf does for config.sub |
68 | SHELL=${CONFIG_SHELL-/bin/sh} | | 68 | SHELL=${CONFIG_SHELL-/bin/sh} |
69 | | | 69 | |
70 | # Identify ourselves on --version, --help, etc | | 70 | # Identify ourselves on --version, --help, etc |
71 | case "$1" in | | 71 | case "$1" in |
72 | "" | -*) | | 72 | "" | -*) |
73 | echo "(GNU MP wrapped config.sub)" 1>&2 | | 73 | echo "(GNU MP wrapped config.sub)" 1>&2 |
74 | $SHELL $configfsf_sub "$@" | | 74 | $SHELL $configfsf_sub "$@" |
75 | exit | | 75 | exit |
76 | ;; | | 76 | ;; |
77 | esac | | 77 | esac |
78 | | | 78 | |
79 | given_full="$1" | | 79 | given_full="$1" |
80 | given_cpu=`echo "$given_full" | sed 's/-.*$//'` | | 80 | given_cpu=`echo "$given_full" | sed 's/-.*$//'` |
81 | given_rest=`echo "$given_full" | sed 's/^[^-]*//'` | | 81 | given_rest=`echo "$given_full" | sed 's/^[^-]*//'` |
82 | | | 82 | |
83 | | | 83 | |
84 | # Aliases for GMP extras | | 84 | # Aliases for GMP extras |
85 | case "$given_cpu" in | | 85 | case "$given_cpu" in |
86 | # configfsf.sub turns p5 into i586, instead use our exact cpu type | | 86 | # configfsf.sub turns p5 into i586, instead use our exact cpu type |
87 | p5 | p54) given_cpu=pentium ;; | | 87 | p5 | p54) given_cpu=pentium ;; |
88 | p55) given_cpu=pentiummmx ;; | | 88 | p55) given_cpu=pentiummmx ;; |
89 | | | 89 | |
90 | # configfsf.sub turns p6, pentiumii and pentiumiii into i686, instead use | | 90 | # configfsf.sub turns p6, pentiumii and pentiumiii into i686, instead use |
91 | # our exact cpu types | | 91 | # our exact cpu types |
92 | p6) given_cpu=pentiumpro ;; | | 92 | p6) given_cpu=pentiumpro ;; |
93 | pentiumii) given_cpu=pentium2 ;; | | 93 | pentiumii) given_cpu=pentium2 ;; |
94 | pentiumiii) given_cpu=pentium3 ;; | | 94 | pentiumiii) given_cpu=pentium3 ;; |
95 | esac | | 95 | esac |
96 | given_full="$given_cpu$given_rest" | | 96 | given_full="$given_cpu$given_rest" |
97 | | | 97 | |
98 | | | 98 | |
99 | # GMP extras and what to use for the config.sub test | | 99 | # GMP extras and what to use for the config.sub test |
100 | case "$given_cpu" in | | 100 | case "$given_cpu" in |
101 | itanium | itanium2) | | 101 | itanium | itanium2) |
102 | test_cpu=ia64 ;; | | 102 | test_cpu=ia64 ;; |
103 | pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*) | | 103 | pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*) |
104 | test_cpu=i386 ;; | | 104 | test_cpu=i386 ;; |
105 | athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen* | nano | nehalem | westmere | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | knightslanding) | | 105 | athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen* | nano | nehalem | westmere | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | knightslanding) |
106 | test_cpu=x86_64 ;; | | 106 | test_cpu=x86_64 ;; |
107 | power[2-9] | power2sc) | | 107 | power[2-9] | power2sc) |
108 | test_cpu=power ;; | | 108 | test_cpu=power ;; |
109 | powerpc401 | powerpc403 | powerpc405 | \ | | 109 | powerpc401 | powerpc403 | powerpc405 | \ |
110 | powerpc505 | \ | | 110 | powerpc505 | \ |
111 | powerpc601 | powerpc602 | \ | | 111 | powerpc601 | powerpc602 | \ |
112 | powerpc603 | powerpc603e | \ | | 112 | powerpc603 | powerpc603e | \ |
113 | powerpc604 | powerpc604e | \ | | 113 | powerpc604 | powerpc604e | \ |
114 | powerpc620 | powerpc630 | powerpc970 | \ | | 114 | powerpc620 | powerpc630 | powerpc970 | \ |
115 | powerpc740 | powerpc7400 | powerpc7450 | powerpc750 | \ | | 115 | powerpc740 | powerpc7400 | powerpc74[4-5][0-9] | powerpc750 | \ |
116 | powerpc801 | powerpc821 | powerpc823 | powerpc860 | \ | | 116 | powerpc801 | powerpc821 | powerpc823 | powerpc860 | \ |
117 | powerpc64) | | 117 | powerpc64) |
118 | test_cpu=powerpc ;; | | 118 | test_cpu=powerpc ;; |
119 | sparcv8 | supersparc | microsparc | \ | | 119 | sparcv8 | supersparc | microsparc | \ |
120 | ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[12345]) | | 120 | ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[12345]) |
121 | test_cpu=sparc ;; | | 121 | test_cpu=sparc ;; |
122 | sh2) | | 122 | sh2) |
123 | test_cpu=sh ;; | | 123 | test_cpu=sh ;; |
124 | | | 124 | |
125 | z900 | z990 | z9 | z10 | z196) | | 125 | z900 | z990 | z9 | z10 | z196) |
126 | test_cpu=s390x;; | | 126 | test_cpu=s390x;; |
127 | z900esa | z990esa | z9esa | z10esa | z196esa) | | 127 | z900esa | z990esa | z9esa | z10esa | z196esa) |
128 | test_cpu=s390;; | | 128 | test_cpu=s390;; |
129 | | | 129 | |
130 | armsa1 | armxscale | arm9tdmi | arm9te | \ | | 130 | armsa1 | armxscale | arm9tdmi | arm9te | \ |
131 | arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \ | | 131 | arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \ |
132 | armcortex[arm][0-9] | armcortex[arm][0-9][0-9] | \ | | 132 | armcortex[arm][0-9] | armcortex[arm][0-9][0-9] | \ |
133 | arm*neon | armxgene1 | armexynosm1 | armthunderx) | | 133 | arm*neon | armxgene1 | armexynosm1 | armthunderx) |
134 | test_cpu="arm";; | | 134 | test_cpu="arm";; |
135 | | | 135 | |
136 | *) | | 136 | *) |
137 | # Don't need or want to change the given name, just run configfsf.sub | | 137 | # Don't need or want to change the given name, just run configfsf.sub |
138 | $SHELL $configfsf_sub "$given_full" | | 138 | $SHELL $configfsf_sub "$given_full" |
139 | if test $? = 0; then | | 139 | if test $? = 0; then |
140 | exit 0 | | 140 | exit 0 |
141 | else | | 141 | else |
142 | echo "(GNU MP wrapped config.sub, testing \"$given_full\")" | | 142 | echo "(GNU MP wrapped config.sub, testing \"$given_full\")" |
143 | exit 1 | | 143 | exit 1 |
144 | fi | | 144 | fi |
145 | esac | | 145 | esac |
146 | | | 146 | |
147 | | | 147 | |
148 | test_full="$test_cpu$given_rest" | | 148 | test_full="$test_cpu$given_rest" |
149 | canonical_full=`$SHELL $configfsf_sub "$test_full"` | | 149 | canonical_full=`$SHELL $configfsf_sub "$test_full"` |
150 | if test $? = 0; then | | 150 | if test $? = 0; then |
151 | : | | 151 | : |
152 | else | | 152 | else |
153 | echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")" | | 153 | echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")" |
154 | exit 1 | | 154 | exit 1 |
155 | fi | | 155 | fi |
156 | | | 156 | |
157 | canonical_rest=`echo "$canonical_full" | sed 's/^[^-]*//'` | | 157 | canonical_rest=`echo "$canonical_full" | sed 's/^[^-]*//'` |
158 | echo "$given_cpu$canonical_rest" | | 158 | echo "$given_cpu$canonical_rest" |
159 | exit 0 | | 159 | exit 0 |
160 | | | 160 | |
161 | | | 161 | |
162 | | | 162 | |
163 | # Local variables: | | 163 | # Local variables: |
164 | # fill-column: 76 | | 164 | # fill-column: 76 |
165 | # End: | | 165 | # End: |