|
Packit |
5c3484 |
#! /bin/sh
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# GMP config.sub wrapper.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Copyright 2000-2003, 2006, 2009-2016 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
5c3484 |
# it under the terms of either:
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# * the GNU Lesser General Public License as published by the Free
|
|
Packit |
5c3484 |
# Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
5c3484 |
# option) any later version.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# or
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# * the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
# Foundation; either version 2 of the License, or (at your option) any
|
|
Packit |
5c3484 |
# later version.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# or both in parallel, as here.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
5c3484 |
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
5c3484 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit |
5c3484 |
# for more details.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# You should have received copies of the GNU General Public License and the
|
|
Packit |
5c3484 |
# GNU Lesser General Public License along with the GNU MP Library. If not,
|
|
Packit |
5c3484 |
# see https://www.gnu.org/licenses/.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Usage: config.sub CPU-VENDOR-OS
|
|
Packit |
5c3484 |
# config.sub ALIAS
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# Validate and canonicalize the given configuration name, with special
|
|
Packit |
5c3484 |
# handling for GMP extra CPU names.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# When the CPU isn't special the whole name is simply passed straight
|
|
Packit |
5c3484 |
# through to configfsf.sub.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# When the CPU is a GMP extra, configfsf.sub is run on a similar CPU that it
|
|
Packit |
5c3484 |
# will recognise. For example "athlon-pc-freebsd3.5" is validated using
|
|
Packit |
5c3484 |
# "i386-pc-freebsd3.5".
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# Any canonicalizations made by configfsf.sub are preserved. For example
|
|
Packit |
5c3484 |
# given "athlon-linux", configfsf.sub is called with "i386-linux" and will
|
|
Packit |
5c3484 |
# give back "i386-pc-linux-gnu". "athlon" is then reinstated, so we print
|
|
Packit |
5c3484 |
# "athlon-pc-linux-gnu".
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Expect to find configfsf.sub in the same directory as this config.sub
|
|
Packit |
5c3484 |
configfsf_sub="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`"
|
|
Packit |
5c3484 |
if test "$configfsf_sub" = "$0"; then
|
|
Packit |
5c3484 |
echo "Cannot derive configfsf.sub from $0" 1>&2
|
|
Packit |
5c3484 |
exit 1
|
|
Packit |
5c3484 |
fi
|
|
Packit |
5c3484 |
if test -f "$configfsf_sub"; then
|
|
Packit |
5c3484 |
:
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
echo "$configfsf_sub not found" 1>&2
|
|
Packit |
5c3484 |
exit 1
|
|
Packit |
5c3484 |
fi
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Always run configfsf.sub with $SHELL, like autoconf does for config.sub
|
|
Packit |
5c3484 |
SHELL=${CONFIG_SHELL-/bin/sh}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Identify ourselves on --version, --help, etc
|
|
Packit |
5c3484 |
case "$1" in
|
|
Packit |
5c3484 |
"" | -*)
|
|
Packit |
5c3484 |
echo "(GNU MP wrapped config.sub)" 1>&2
|
|
Packit |
5c3484 |
$SHELL $configfsf_sub "$@"
|
|
Packit |
5c3484 |
exit
|
|
Packit |
5c3484 |
;;
|
|
Packit |
5c3484 |
esac
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
given_full="$1"
|
|
Packit |
5c3484 |
given_cpu=`echo "$given_full" | sed 's/-.*$//'`
|
|
Packit |
5c3484 |
given_rest=`echo "$given_full" | sed 's/^[^-]*//'`
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Aliases for GMP extras
|
|
Packit |
5c3484 |
case "$given_cpu" in
|
|
Packit |
5c3484 |
# configfsf.sub turns p5 into i586, instead use our exact cpu type
|
|
Packit |
5c3484 |
p5 | p54) given_cpu=pentium ;;
|
|
Packit |
5c3484 |
p55) given_cpu=pentiummmx ;;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# configfsf.sub turns p6, pentiumii and pentiumiii into i686, instead use
|
|
Packit |
5c3484 |
# our exact cpu types
|
|
Packit |
5c3484 |
p6) given_cpu=pentiumpro ;;
|
|
Packit |
5c3484 |
pentiumii) given_cpu=pentium2 ;;
|
|
Packit |
5c3484 |
pentiumiii) given_cpu=pentium3 ;;
|
|
Packit |
5c3484 |
esac
|
|
Packit |
5c3484 |
given_full="$given_cpu$given_rest"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# GMP extras and what to use for the config.sub test
|
|
Packit |
5c3484 |
case "$given_cpu" in
|
|
Packit |
5c3484 |
itanium | itanium2)
|
|
Packit |
5c3484 |
test_cpu=ia64 ;;
|
|
Packit |
5c3484 |
pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
|
|
Packit |
5c3484 |
test_cpu=i386 ;;
|
|
Packit |
5c3484 |
athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | nano | nehalem* | westmere* | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | knightslanding)
|
|
Packit |
5c3484 |
test_cpu=x86_64 ;;
|
|
Packit |
5c3484 |
power[2-9] | power2sc)
|
|
Packit |
5c3484 |
test_cpu=power ;;
|
|
Packit |
5c3484 |
powerpc401 | powerpc403 | powerpc405 | \
|
|
Packit |
5c3484 |
powerpc505 | \
|
|
Packit |
5c3484 |
powerpc601 | powerpc602 | \
|
|
Packit |
5c3484 |
powerpc603 | powerpc603e | \
|
|
Packit |
5c3484 |
powerpc604 | powerpc604e | \
|
|
Packit |
5c3484 |
powerpc620 | powerpc630 | powerpc970 | \
|
|
Packit |
5c3484 |
powerpc740 | powerpc7400 | powerpc7450 | powerpc750 | \
|
|
Packit |
5c3484 |
powerpc801 | powerpc821 | powerpc823 | powerpc860 | \
|
|
Packit |
5c3484 |
powerpc64)
|
|
Packit |
5c3484 |
test_cpu=powerpc ;;
|
|
Packit |
5c3484 |
sparcv8 | supersparc | microsparc | \
|
|
Packit |
5c3484 |
ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[12345])
|
|
Packit |
5c3484 |
test_cpu=sparc ;;
|
|
Packit |
5c3484 |
sh2)
|
|
Packit |
5c3484 |
test_cpu=sh ;;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
z900 | z990 | z9 | z10 | z196)
|
|
Packit |
5c3484 |
test_cpu=s390x;;
|
|
Packit |
5c3484 |
z900esa | z990esa | z9esa | z10esa | z196esa)
|
|
Packit |
5c3484 |
test_cpu=s390;;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
armsa1 | armxscale | arm9tdmi | arm9te | \
|
|
Packit |
5c3484 |
arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \
|
|
Packit |
5c3484 |
armcortexa5 | armcortexa7 | armcortexa8 | armcortexa9 | armcortexa15 | \
|
|
Packit |
5c3484 |
armcortexr4 | armcortexr5 | armcortexm3 | arm*neon | xgene1 | exynosm1 | thunderx)
|
|
Packit |
5c3484 |
test_cpu="arm";;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
*)
|
|
Packit |
5c3484 |
# Don't need or want to change the given name, just run configfsf.sub
|
|
Packit |
5c3484 |
$SHELL $configfsf_sub "$given_full"
|
|
Packit |
5c3484 |
if test $? = 0; then
|
|
Packit |
5c3484 |
exit 0
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
echo "(GNU MP wrapped config.sub, testing \"$given_full\")"
|
|
Packit |
5c3484 |
exit 1
|
|
Packit |
5c3484 |
fi
|
|
Packit |
5c3484 |
esac
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
test_full="$test_cpu$given_rest"
|
|
Packit |
5c3484 |
canonical_full=`$SHELL $configfsf_sub "$test_full"`
|
|
Packit |
5c3484 |
if test $? = 0; then
|
|
Packit |
5c3484 |
:
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")"
|
|
Packit |
5c3484 |
exit 1
|
|
Packit |
5c3484 |
fi
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
canonical_rest=`echo "$canonical_full" | sed 's/^[^-]*//'`
|
|
Packit |
5c3484 |
echo "$given_cpu$canonical_rest"
|
|
Packit |
5c3484 |
exit 0
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Local variables:
|
|
Packit |
5c3484 |
# fill-column: 76
|
|
Packit |
5c3484 |
# End:
|