From 149c2a9cc98b07a2ca4fd5d66fd580ffa79eb403 Mon Sep 17 00:00:00 2001 From: seyko Date: Wed, 4 Mar 2015 10:03:40 +0300 Subject: [PATCH] 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 --- configure | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/configure b/configure index c75d460..318b788 100755 --- a/configure +++ b/configure @@ -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 <> $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