* 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
Unified · Split
| @@ -46,8 +46,7 @@ tcc_crtprefix="" · 45 unmodified lines | |||
| 46 | tcc_elfinterp="" | 46 | tcc_elfinterp="" |
| 47 | tcc_lddir= | 47 | tcc_lddir= |
| 48 | confvars= | 48 | confvars= |
| 49 | 49 | cpu= | |
| 50 | cpu=`uname -m` | ||
| 51 | 50 | ||
| 52 | # OS specific | 51 | # OS specific |
| 53 | targetos=`uname -s` | 52 | targetos=`uname -s` |
| @@ -166,7 +165,7 @@ for opt do · 112 unmodified lines | |||
| 166 | ;; | 165 | ;; |
| 167 | --extra-libs=*) extralibs=${opt#--extra-libs=} | 166 | --extra-libs=*) extralibs=${opt#--extra-libs=} |
| 168 | ;; | 167 | ;; |
| 169 | --cpu=*) build_cpu=`echo $opt | cut -d '=' -f 2` | 168 | --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` |
| 170 | ;; | 169 | ;; |
| 171 | --enable-gprof) gprof="yes" | 170 | --enable-gprof) gprof="yes" |
| 172 | ;; | 171 | ;; |
| @@ -195,6 +194,13 @@ for opt do · 22 unmodified lines | |||
| 195 | esac | 194 | esac |
| 196 | done | 195 | done |
| 197 | 196 | ||
| 197 | if test -z "$cpu" ; then | ||
| 198 | if test -n "$ARCH" ; then | ||
| 199 | cpu="$ARCH" | ||
| 200 | else | ||
| 201 | cpu=`uname -m` | ||
| 202 | fi | ||
| 203 | fi | ||
| 198 | classify_cpu "$cpu" | 204 | classify_cpu "$cpu" |
| 199 | 205 | ||
| 200 | # Checking for CFLAGS | 206 | # Checking for CFLAGS |
| @@ -357,24 +363,24 @@ else · 156 unmodified lines | |||
| 357 | esac | 363 | esac |
| 358 | fi | 364 | fi |
| 359 | 365 | ||
| 360 | cat <<EOF | 366 | echo "Binary directory $bindir" |
| 361 | Binary directory $bindir | 367 | echo "TinyCC directory $tccdir" |
| 362 | TinyCC directory $tccdir | 368 | echo "Library directory $libdir" |
| 363 | Library directory $libdir | 369 | echo "Include directory $includedir" |
| 364 | Include directory $includedir | 370 | echo "Manual directory $mandir" |
| 365 | Manual directory $mandir | 371 | echo "Info directory $infodir" |
| 366 | Info directory $infodir | 372 | echo "Doc directory $docdir" |
| 367 | Doc directory $docdir | 373 | echo "Target root prefix $sysroot" |
| 368 | Target root prefix $sysroot | 374 | echo "Source path $source_path" |
| 369 | Source path $source_path | 375 | echo "C compiler $cc" |
| 370 | C compiler $cc | 376 | echo "cross compilers $build_cross" |
| 371 | Build CPU $cpu | 377 | if test "$build_cross" = "no"; then |
| 372 | Target OS $targetos | 378 | echo "Target CPU $cpu" |
| 373 | Big Endian $bigendian | 379 | fi |
| 374 | gprof enabled $gprof | 380 | echo "Target OS $targetos" |
| 375 | cross compilers $build_cross | 381 | echo "Big Endian $bigendian" |
| 376 | use libgcc $use_libgcc | 382 | echo "gprof enabled $gprof" |
| 377 | EOF | 383 | echo "use libgcc $use_libgcc" |
| 378 | 384 | ||
| 379 | echo "Creating config.mak and config.h" | 385 | echo "Creating config.mak and config.h" |
| 380 | 386 | ||
| @@ -430,29 +436,21 @@ echo "#define GCC_MINOR $gcc_minor" >> $TMPH · 49 unmodified lines | |||
| 430 | 436 | ||
| 431 | if test "$cpu" = "x86" ; then | 437 | if test "$cpu" = "x86" ; then |
| 432 | echo "ARCH=i386" >> config.mak | 438 | echo "ARCH=i386" >> config.mak |
| 433 | echo "#define HOST_I386 1" >> $TMPH | ||
| 434 | elif test "$cpu" = "x86-64" ; then | 439 | elif test "$cpu" = "x86-64" ; then |
| 435 | echo "ARCH=x86-64" >> config.mak | 440 | echo "ARCH=x86-64" >> config.mak |
| 436 | echo "#define HOST_X86_64 1" >> $TMPH | ||
| 437 | elif test "$cpu" = "armv4l" ; then | 441 | elif test "$cpu" = "armv4l" ; then |
| 438 | echo "ARCH=arm" >> config.mak | 442 | echo "ARCH=arm" >> config.mak |
| 439 | echo "#define HOST_ARM 1" >> $TMPH | ||
| 440 | echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH | 443 | echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH |
| 441 | elif test "$cpu" = "aarch64" ; then | 444 | elif test "$cpu" = "aarch64" ; then |
| 442 | echo "ARCH=arm64" >> config.mak | 445 | echo "ARCH=arm64" >> config.mak |
| 443 | echo "#define HOST_ARM64 1" >> $TMPH | ||
| 444 | elif test "$cpu" = "powerpc" ; then | 446 | elif test "$cpu" = "powerpc" ; then |
| 445 | echo "ARCH=ppc" >> config.mak | 447 | echo "ARCH=ppc" >> config.mak |
| 446 | echo "#define HOST_PPC 1" >> $TMPH | ||
| 447 | elif test "$cpu" = "mips" ; then | 448 | elif test "$cpu" = "mips" ; then |
| 448 | echo "ARCH=mips" >> config.mak | 449 | echo "ARCH=mips" >> config.mak |
| 449 | echo "#define HOST_MIPS 1" >> $TMPH | ||
| 450 | elif test "$cpu" = "s390" ; then | 450 | elif test "$cpu" = "s390" ; then |
| 451 | echo "ARCH=s390" >> config.mak | 451 | echo "ARCH=s390" >> config.mak |
| 452 | echo "#define HOST_S390 1" >> $TMPH | ||
| 453 | elif test "$cpu" = "alpha" ; then | 452 | elif test "$cpu" = "alpha" ; then |
| 454 | echo "ARCH=alpha" >> config.mak | 453 | echo "ARCH=alpha" >> config.mak |
| 455 | echo "#define HOST_ALPHA 1" >> $TMPH | ||
| 456 | else | 454 | else |
| 457 | echo "Unsupported CPU" | 455 | echo "Unsupported CPU" |
| 458 | exit 1 | 456 | exit 1 |