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