beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / configgmp.sub
blobf248e7170437202d297af4281e8dd3badb5a3587
1 #! /bin/sh
3 # GMP config.sub wrapper.
6 # Copyright 2000-2003, 2006, 2009-2015 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 either:
13 # * the GNU Lesser General Public License as published by the Free
14 # Software Foundation; either version 3 of the License, or (at your
15 # option) any later version.
17 # or
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
21 # later version.
23 # or both in parallel, as here.
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
27 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 # for more details.
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,
32 # see https://www.gnu.org/licenses/.
35 # Usage: config.sub CPU-VENDOR-OS
36 # config.sub ALIAS
38 # Validate and canonicalize the given configuration name, with special
39 # handling for GMP extra CPU names.
41 # When the CPU isn't special the whole name is simply passed straight
42 # through to configfsf.sub.
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
46 # "i386-pc-freebsd3.5".
48 # Any canonicalizations made by configfsf.sub are preserved. For example
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
51 # "athlon-pc-linux-gnu".
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/'`"
56 if test "$configfsf_sub" = "$0"; then
57 echo "Cannot derive configfsf.sub from $0" 1>&2
58 exit 1
60 if test -f "$configfsf_sub"; then
62 else
63 echo "$configfsf_sub not found" 1>&2
64 exit 1
67 # Always run configfsf.sub with $SHELL, like autoconf does for config.sub
68 SHELL=${CONFIG_SHELL-/bin/sh}
70 # Identify ourselves on --version, --help, etc
71 case "$1" in
72 "" | -*)
73 echo "(GNU MP wrapped config.sub)" 1>&2
74 $SHELL $configfsf_sub "$@"
75 exit
77 esac
79 given_full="$1"
80 given_cpu=`echo "$given_full" | sed 's/-.*$//'`
81 given_rest=`echo "$given_full" | sed 's/^[^-]*//'`
84 # Aliases for GMP extras
85 case "$given_cpu" in
86 # configfsf.sub turns p5 into i586, instead use our exact cpu type
87 p5 | p54) given_cpu=pentium ;;
88 p55) given_cpu=pentiummmx ;;
90 # configfsf.sub turns p6, pentiumii and pentiumiii into i686, instead use
91 # our exact cpu types
92 p6) given_cpu=pentiumpro ;;
93 pentiumii) given_cpu=pentium2 ;;
94 pentiumiii) given_cpu=pentium3 ;;
95 esac
96 given_full="$given_cpu$given_rest"
99 # GMP extras and what to use for the config.sub test
100 case "$given_cpu" in
101 itanium | itanium2)
102 test_cpu=ia64 ;;
103 pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
104 test_cpu=i386 ;;
105 athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | nano | nehalem* | westmere* | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | cabylake* | knightslanding)
106 test_cpu=x86_64 ;;
107 power[2-9] | power2sc)
108 test_cpu=power ;;
109 powerpc401 | powerpc403 | powerpc405 | \
110 powerpc505 | \
111 powerpc601 | powerpc602 | \
112 powerpc603 | powerpc603e | \
113 powerpc604 | powerpc604e | \
114 powerpc620 | powerpc630 | powerpc970 | \
115 powerpc740 | powerpc7400 | powerpc7450 | powerpc750 | \
116 powerpc801 | powerpc821 | powerpc823 | powerpc860 | \
117 powerpc64)
118 test_cpu=powerpc ;;
119 sparcv8 | supersparc | microsparc | \
120 ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[12345])
121 test_cpu=sparc ;;
122 sh2)
123 test_cpu=sh ;;
125 z900 | z990 | z9 | z10 | z196)
126 test_cpu=s390x;;
127 z900esa | z990esa | z9esa | z10esa | z196esa)
128 test_cpu=s390;;
130 armsa1 | armxscale | arm9tdmi | arm9te | \
131 arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \
132 armcortexa5 | armcortexa7 | armcortexa8 | armcortexa9 | armcortexa15 | \
133 armcortexr4 | armcortexr5 | armcortexm3 | arm*neon)
134 test_cpu="arm";;
137 # Don't need or want to change the given name, just run configfsf.sub
138 $SHELL $configfsf_sub "$given_full"
139 if test $? = 0; then
140 exit 0
141 else
142 echo "(GNU MP wrapped config.sub, testing \"$given_full\")"
143 exit 1
145 esac
148 test_full="$test_cpu$given_rest"
149 canonical_full=`$SHELL $configfsf_sub "$test_full"`
150 if test $? = 0; then
152 else
153 echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")"
154 exit 1
157 canonical_rest=`echo "$canonical_full" | sed 's/^[^-]*//'`
158 echo "$given_cpu$canonical_rest"
159 exit 0
163 # Local variables:
164 # fill-column: 76
165 # End: