[15293] | 1 | #! /bin/sh |
---|
| 2 | # |
---|
[18190] | 3 | # GMP config.sub wrapper. |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | # Copyright 2000, 2001, 2002 Free Software Foundation, Inc. |
---|
[15293] | 7 | # |
---|
[18190] | 8 | # This file is part of the GNU MP Library. |
---|
[15293] | 9 | # |
---|
[18190] | 10 | # The GNU MP Library is free software; you can redistribute it and/or modify |
---|
| 11 | # it under the terms of the GNU Lesser General Public License as published |
---|
| 12 | # by the Free Software Foundation; either version 2.1 of the License, or (at |
---|
| 13 | # your option) any later version. |
---|
[15293] | 14 | # |
---|
[18190] | 15 | # The GNU MP Library is distributed in the hope that it will be useful, but |
---|
| 16 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
| 17 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
---|
| 18 | # License for more details. |
---|
| 19 | # |
---|
| 20 | # You should have received a copy of the GNU Lesser General Public License |
---|
| 21 | # along with the GNU MP Library; see the file COPYING.LIB. If not, write to |
---|
| 22 | # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
---|
| 23 | # MA 02111-1307, USA. |
---|
[15293] | 24 | |
---|
| 25 | |
---|
[18190] | 26 | # Usage: config.sub CPU-VENDOR-OS |
---|
| 27 | # config.sub ALIAS |
---|
[15293] | 28 | # |
---|
[18190] | 29 | # Validate and canonicalize the given configuration name, with special |
---|
| 30 | # handling for GMP extra CPU names. |
---|
| 31 | # |
---|
| 32 | # When the CPU isn't special the whole name is simply passed straight |
---|
| 33 | # through to configfsf.sub. |
---|
| 34 | # |
---|
| 35 | # When the CPU is a GMP extra, configfsf.sub is run on a similar CPU that it |
---|
| 36 | # will recognise. For example "athlon-pc-freebsd3.5" is validated using |
---|
| 37 | # "i386-pc-freebsd3.5". |
---|
| 38 | # |
---|
| 39 | # Any canonicalizations made by configfsf.sub are preserved. For example |
---|
| 40 | # given "athlon-linux", configfsf.sub is called with "i386-linux" and will |
---|
| 41 | # give back "i386-pc-linux-gnu". "athlon" is then reinstated, so we print |
---|
| 42 | # "athlon-pc-linux-gnu". |
---|
[15293] | 43 | |
---|
| 44 | |
---|
[18190] | 45 | # Expect to find configfsf.sub in the same directory as this config.sub |
---|
| 46 | configfsf_sub="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`" |
---|
| 47 | if test "$configfsf_sub" = "$0"; then |
---|
| 48 | echo "Cannot derive configfsf.sub from $0" 1>&2 |
---|
| 49 | exit 1 |
---|
[15293] | 50 | fi |
---|
[18190] | 51 | if test -f "$configfsf_sub"; then |
---|
| 52 | : |
---|
| 53 | else |
---|
| 54 | echo "$configfsf_sub not found" 1>&2 |
---|
| 55 | exit 1 |
---|
| 56 | fi |
---|
[15293] | 57 | |
---|
[18190] | 58 | # Always run configfsf.sub with $SHELL, like autoconf does for config.sub |
---|
| 59 | SHELL=${CONFIG_SHELL-/bin/sh} |
---|
[15293] | 60 | |
---|
[18190] | 61 | # Identify ourselves on --version, --help, etc |
---|
| 62 | case "$1" in |
---|
| 63 | "" | -*) |
---|
| 64 | echo "(GNU MP wrapped config.sub)" 1>&2 |
---|
| 65 | $SHELL $configfsf_sub "$@" |
---|
| 66 | exit |
---|
| 67 | ;; |
---|
[15293] | 68 | esac |
---|
| 69 | |
---|
[18190] | 70 | given_full="$1" |
---|
| 71 | given_cpu=`echo "$given_full" | sed 's/-.*$//'` |
---|
| 72 | given_rest=`echo "$given_full" | sed 's/^[^-]*//'` |
---|
[15293] | 73 | |
---|
| 74 | |
---|
[18190] | 75 | # Aliases for GMP extras |
---|
| 76 | case "$given_cpu" in |
---|
| 77 | p5 | p54) given_cpu=pentium ;; |
---|
| 78 | p55) given_cpu=pentiummmx ;; |
---|
| 79 | p6) given_cpu=pentiumpro ;; |
---|
| 80 | pentiumii) given_cpu=pentium2 ;; |
---|
| 81 | pentiumiii) given_cpu=pentium3 ;; |
---|
[15293] | 82 | esac |
---|
[18190] | 83 | given_full="$given_cpu$given_rest" |
---|
[15293] | 84 | |
---|
| 85 | |
---|
[18190] | 86 | # GMP extras and what to use for the config.sub test |
---|
| 87 | case "$given_cpu" in |
---|
[22253] | 88 | pentium | pentiummmx | pentiumpro | pentium[234] | k[56] | k6[23] | athlon | viac3*) |
---|
[18190] | 89 | test_cpu=i386 ;; |
---|
| 90 | power[12] | power2sc) |
---|
| 91 | test_cpu=power ;; |
---|
| 92 | powerpc401 | powerpc403 | powerpc405 | \ |
---|
| 93 | powerpc505 | \ |
---|
| 94 | powerpc601 | powerpc602 | \ |
---|
| 95 | powerpc603 | powerpc603e | \ |
---|
| 96 | powerpc604 | powerpc604e | \ |
---|
| 97 | powerpc620 | powerpc630 | \ |
---|
| 98 | powerpc740 | powerpc7400 | powerpc7450 | powerpc750 | \ |
---|
| 99 | powerpc801 | powerpc821 | powerpc823 | powerpc860 | \ |
---|
| 100 | powerpc64) |
---|
| 101 | test_cpu=powerpc ;; |
---|
| 102 | sparcv8 | supersparc | microsparc | \ |
---|
| 103 | ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3) |
---|
| 104 | test_cpu=sparc ;; |
---|
| 105 | sh2) |
---|
| 106 | test_cpu=sh ;; |
---|
[15293] | 107 | |
---|
[18190] | 108 | *) |
---|
| 109 | # Don't need or want to change the given name, just run configfsf.sub |
---|
| 110 | $SHELL $configfsf_sub "$given_full" |
---|
| 111 | if test $? = 0; then |
---|
| 112 | exit 0 |
---|
| 113 | else |
---|
| 114 | echo "(GNU MP wrapped config.sub, testing \"$given_full\")" |
---|
| 115 | exit 1 |
---|
| 116 | fi |
---|
[15293] | 117 | esac |
---|
| 118 | |
---|
| 119 | |
---|
[18190] | 120 | test_full="$test_cpu$given_rest" |
---|
| 121 | canonical_full=`$SHELL $configfsf_sub "$test_full"` |
---|
| 122 | if test $? = 0; then |
---|
| 123 | : |
---|
| 124 | else |
---|
| 125 | echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")" |
---|
| 126 | exit 1 |
---|
[15293] | 127 | fi |
---|
| 128 | |
---|
[18190] | 129 | canonical_rest=`echo "$canonical_full" | sed 's/^[^-]*//'` |
---|
| 130 | echo "$given_cpu$canonical_rest" |
---|
| 131 | exit 0 |
---|
[15293] | 132 | |
---|
[18190] | 133 | |
---|
| 134 | |
---|
| 135 | # Local variables: |
---|
| 136 | # fill-column: 76 |
---|
| 137 | # End: |
---|