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