a cpu option of the configure script as a method to specify a target cpu

* don't setup a cpu before scanning for --cpu=
    * --cpu= option sets a 'cpu' variable, not a 'build_cpu', 'build_cpu' was not used anywhere.
    * if cpu="" and ARCH != "" then cpu=$ARCH else cpu=`uname -m`
    * replace "Build CPU" with "Target CPU" in the output of the configure script.
      output this value only when not builing a cross compilers.
    * remove a HOST_I386, ... defines from a config.h file.
      thise defines are not used anywhere and cpu is now used to define a target cpu
This commit is contained in:
seyko 2015-03-04 10:03:40 +03:00
parent d972472c53
commit 149c2a9cc9

56
configure vendored
View file

@ -46,8 +46,7 @@ tcc_crtprefix=""
tcc_elfinterp="" tcc_elfinterp=""
tcc_lddir= tcc_lddir=
confvars= confvars=
cpu=
cpu=`uname -m`
# OS specific # OS specific
targetos=`uname -s` targetos=`uname -s`
@ -166,7 +165,7 @@ for opt do
;; ;;
--extra-libs=*) extralibs=${opt#--extra-libs=} --extra-libs=*) extralibs=${opt#--extra-libs=}
;; ;;
--cpu=*) build_cpu=`echo $opt | cut -d '=' -f 2` --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
;; ;;
--enable-gprof) gprof="yes" --enable-gprof) gprof="yes"
;; ;;
@ -195,6 +194,13 @@ for opt do
esac esac
done done
if test -z "$cpu" ; then
if test -n "$ARCH" ; then
cpu="$ARCH"
else
cpu=`uname -m`
fi
fi
classify_cpu "$cpu" classify_cpu "$cpu"
# Checking for CFLAGS # Checking for CFLAGS
@ -357,24 +363,24 @@ else
esac esac
fi fi
cat <<EOF echo "Binary directory $bindir"
Binary directory $bindir echo "TinyCC directory $tccdir"
TinyCC directory $tccdir echo "Library directory $libdir"
Library directory $libdir echo "Include directory $includedir"
Include directory $includedir echo "Manual directory $mandir"
Manual directory $mandir echo "Info directory $infodir"
Info directory $infodir echo "Doc directory $docdir"
Doc directory $docdir echo "Target root prefix $sysroot"
Target root prefix $sysroot echo "Source path $source_path"
Source path $source_path echo "C compiler $cc"
C compiler $cc echo "cross compilers $build_cross"
Build CPU $cpu if test "$build_cross" = "no"; then
Target OS $targetos echo "Target CPU $cpu"
Big Endian $bigendian fi
gprof enabled $gprof echo "Target OS $targetos"
cross compilers $build_cross echo "Big Endian $bigendian"
use libgcc $use_libgcc echo "gprof enabled $gprof"
EOF echo "use libgcc $use_libgcc"
echo "Creating config.mak and config.h" echo "Creating config.mak and config.h"
@ -430,29 +436,21 @@ echo "#define GCC_MINOR $gcc_minor" >> $TMPH
if test "$cpu" = "x86" ; then if test "$cpu" = "x86" ; then
echo "ARCH=i386" >> config.mak echo "ARCH=i386" >> config.mak
echo "#define HOST_I386 1" >> $TMPH
elif test "$cpu" = "x86-64" ; then elif test "$cpu" = "x86-64" ; then
echo "ARCH=x86-64" >> config.mak echo "ARCH=x86-64" >> config.mak
echo "#define HOST_X86_64 1" >> $TMPH
elif test "$cpu" = "armv4l" ; then elif test "$cpu" = "armv4l" ; then
echo "ARCH=arm" >> config.mak echo "ARCH=arm" >> config.mak
echo "#define HOST_ARM 1" >> $TMPH
echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH
elif test "$cpu" = "aarch64" ; then elif test "$cpu" = "aarch64" ; then
echo "ARCH=arm64" >> config.mak echo "ARCH=arm64" >> config.mak
echo "#define HOST_ARM64 1" >> $TMPH
elif test "$cpu" = "powerpc" ; then elif test "$cpu" = "powerpc" ; then
echo "ARCH=ppc" >> config.mak echo "ARCH=ppc" >> config.mak
echo "#define HOST_PPC 1" >> $TMPH
elif test "$cpu" = "mips" ; then elif test "$cpu" = "mips" ; then
echo "ARCH=mips" >> config.mak echo "ARCH=mips" >> config.mak
echo "#define HOST_MIPS 1" >> $TMPH
elif test "$cpu" = "s390" ; then elif test "$cpu" = "s390" ; then
echo "ARCH=s390" >> config.mak echo "ARCH=s390" >> config.mak
echo "#define HOST_S390 1" >> $TMPH
elif test "$cpu" = "alpha" ; then elif test "$cpu" = "alpha" ; then
echo "ARCH=alpha" >> config.mak echo "ARCH=alpha" >> config.mak
echo "#define HOST_ALPHA 1" >> $TMPH
else else
echo "Unsupported CPU" echo "Unsupported CPU"
exit 1 exit 1