Make build CPU detection a tad more flexible

This commit is contained in:
Thomas Preud'homme 2014-04-12 16:20:12 +08:00
parent 6e56bb387d
commit 0e3d2e0bea

109
configure vendored
View File

@ -71,46 +71,52 @@ if test -z "$source_path" -o "$source_path" = "." ; then
source_path_used="no" source_path_used="no"
fi fi
case "$cpu" in classify_cpu ()
i386|i486|i586|i686|i86pc|BePC|i686-AT386) {
cpu="x86" cpu="$1"
;;
x86_64|amd64) case "$cpu" in
cpu="x86-64" x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
;; cpu="x86"
arm*) ;;
case "$cpu" in x86_64|amd64)
arm|armv4l) cpu="x86-64"
cpuver=4 ;;
;; arm*)
armv5tel|armv5tejl) case "$cpu" in
cpuver=5 arm|armv4l)
;; cpuver=4
armv6j|armv6l) ;;
cpuver=6 armv5tel|armv5tejl)
;; cpuver=5
armv7a|armv7l) ;;
cpuver=7 armv6j|armv6l)
;; cpuver=6
esac ;;
cpu="armv4l" armv7a|armv7l)
;; cpuver=7
alpha) ;;
cpu="alpha" esac
;; cpu="armv4l"
"Power Macintosh"|ppc|ppc64) ;;
cpu="powerpc" alpha)
;; cpu="alpha"
mips) ;;
cpu="mips" "Power Macintosh"|ppc|ppc64)
;; cpu="powerpc"
s390) ;;
cpu="s390" mips)
;; cpu="mips"
*) ;;
cpu="unknown" s390)
;; cpu="s390"
esac ;;
*)
echo "Unsupported CPU: $cpu"
exit 1
;;
esac
}
for opt do for opt do
eval opt=\"$opt\" eval opt=\"$opt\"
@ -141,14 +147,6 @@ for opt do
;; ;;
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
;; ;;
--cc=*) cc=`echo $opt | cut -d '=' -f 2`
;;
--extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
;;
--extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
;;
--extra-libs=*) extralibs=${opt#--extra-libs=}
;;
--sysincludepaths=*) tcc_sysincludepaths=`echo $opt | cut -d '=' -f 2` --sysincludepaths=*) tcc_sysincludepaths=`echo $opt | cut -d '=' -f 2`
;; ;;
--libpaths=*) tcc_libpaths=`echo $opt | cut -d '=' -f 2` --libpaths=*) tcc_libpaths=`echo $opt | cut -d '=' -f 2`
@ -157,7 +155,15 @@ for opt do
;; ;;
--elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2` --elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
;; ;;
--cpu=*) cpu=`echo $opt | cut -d '=' -f 2` --cc=*) cc=`echo $opt | cut -d '=' -f 2`
;;
--extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
;;
--extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
;;
--extra-libs=*) extralibs=${opt#--extra-libs=}
;;
--cpu=*) build_cpu=`echo $opt | cut -d '=' -f 2`
;; ;;
--enable-gprof) gprof="yes" --enable-gprof) gprof="yes"
;; ;;
@ -186,6 +192,8 @@ for opt do
esac esac
done done
classify_cpu "$cpu"
# Checking for CFLAGS # Checking for CFLAGS
if test -z "$CFLAGS"; then if test -z "$CFLAGS"; then
CFLAGS="-Wall -g -O2" CFLAGS="-Wall -g -O2"
@ -271,6 +279,7 @@ Advanced options (experts only):
--cc=CC use C compiler CC [$cc] --cc=CC use C compiler CC [$cc]
--extra-cflags= specify compiler flags [$CFLAGS] --extra-cflags= specify compiler flags [$CFLAGS]
--extra-ldflags= specify linker options [] --extra-ldflags= specify linker options []
--cpu=CPU CPU [$cpu]
--strip-binaries strip symbol tables from resulting binaries --strip-binaries strip symbol tables from resulting binaries
--disable-static make libtcc.so instead of libtcc.a --disable-static make libtcc.so instead of libtcc.a
--disable-rpath disable use of -rpath with the above --disable-rpath disable use of -rpath with the above
@ -356,8 +365,8 @@ Doc directory $docdir
Target root prefix $sysroot Target root prefix $sysroot
Source path $source_path Source path $source_path
C compiler $cc C compiler $cc
Build CPU $cpu
Target OS $targetos Target OS $targetos
CPU $cpu
Big Endian $bigendian Big Endian $bigendian
gprof enabled $gprof gprof enabled $gprof
cross compilers $build_cross cross compilers $build_cross