3 # GMP config.sub wrapper.
6 # Copyright 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
8 # This file is part of the GNU MP Library.
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 3 of the License, or (at
13 # your option) any later version.
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.
20 # You should have received a copy of the GNU Lesser General Public License
21 # along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
24 # Usage: config.sub CPU-VENDOR-OS
27 # Validate and canonicalize the given configuration name, with special
28 # handling for GMP extra CPU names.
30 # When the CPU isn't special the whole name is simply passed straight
31 # through to configfsf.sub.
33 # When the CPU is a GMP extra, configfsf.sub is run on a similar CPU that it
34 # will recognise. For example "athlon-pc-freebsd3.5" is validated using
35 # "i386-pc-freebsd3.5".
37 # Any canonicalizations made by configfsf.sub are preserved. For example
38 # given "athlon-linux", configfsf.sub is called with "i386-linux" and will
39 # give back "i386-pc-linux-gnu". "athlon" is then reinstated, so we print
40 # "athlon-pc-linux-gnu".
43 # Expect to find configfsf.sub in the same directory as this config.sub
44 configfsf_sub
="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`"
45 if test "$configfsf_sub" = "$0"; then
46 echo "Cannot derive configfsf.sub from $0" 1>&2
49 if test -f "$configfsf_sub"; then
52 echo "$configfsf_sub not found" 1>&2
56 # Always run configfsf.sub with $SHELL, like autoconf does for config.sub
57 SHELL
=${CONFIG_SHELL-/bin/sh}
59 # Identify ourselves on --version, --help, etc
62 echo "(GNU MP wrapped config.sub)" 1>&2
63 $SHELL $configfsf_sub "$@"
69 given_cpu
=`echo "$given_full" | sed 's/-.*$//'`
70 given_rest
=`echo "$given_full" | sed 's/^[^-]*//'`
73 # Aliases for GMP extras
75 # configfsf.sub turns p5 into i586, instead use our exact cpu type
76 p5 | p54
) given_cpu
=pentium
;;
77 p55
) given_cpu
=pentiummmx
;;
79 # configfsf.sub turns p6, pentiumii and pentiumiii into i686, instead use
81 p6
) given_cpu
=pentiumpro
;;
82 pentiumii
) given_cpu
=pentium2
;;
83 pentiumiii
) given_cpu
=pentium3
;;
85 given_full
="$given_cpu$given_rest"
88 # GMP extras and what to use for the config.sub test
92 pentium | pentiummmx | pentiumpro | pentium
[234m
] | k
[56] | k6
[23] | geode | athlon | viac3
*)
94 athlon64 | atom | core2 | opteron
)
96 power
[2-9] | power2sc
)
98 powerpc401 | powerpc403 | powerpc405 | \
100 powerpc601 | powerpc602 | \
101 powerpc603 | powerpc603e | \
102 powerpc604 | powerpc604e | \
103 powerpc620 | powerpc630 | powerpc970 | \
104 powerpc740 | powerpc7400 | powerpc7450 | powerpc750 | \
105 powerpc801 | powerpc821 | powerpc823 | powerpc860 | \
108 sparcv8 | supersparc | microsparc | \
109 ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct1
)
115 # Don't need or want to change the given name, just run configfsf.sub
116 $SHELL $configfsf_sub "$given_full"
120 echo "(GNU MP wrapped config.sub, testing \"$given_full\")"
126 test_full
="$test_cpu$given_rest"
127 canonical_full
=`$SHELL $configfsf_sub "$test_full"`
131 echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")"
135 canonical_rest
=`echo "$canonical_full" | sed 's/^[^-]*//'`
136 echo "$given_cpu$canonical_rest"