diff options
author | Thomas Preud'homme <robotux@celest.fr> | 2015-12-26 18:15:30 +0800 |
---|---|---|
committer | Thomas Preud'homme <robotux@celest.fr> | 2015-12-26 18:15:30 +0800 |
commit | 9b58ceece89525bc832012f7b877de5615b12829 (patch) | |
tree | 9c085e51cc8754463d27fac5d516fe9d7533c3c6 /configure | |
parent | 2946895a376add9d940bdbe4391e97cb846d26d1 (diff) |
Imported Upstream version 0.9.27~git20151225.f15c0a9
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 135 |
1 files changed, 95 insertions, 40 deletions
@@ -46,13 +46,18 @@ tcc_crtprefix="" tcc_elfinterp="" tcc_lddir= confvars= +cpu= -cpu=`uname -m` +host_os=`uname` +case $host_os in + MINGW32*) host_os=Windows; ;; + *) ;; +esac # OS specific -targetos=`uname -s` +targetos=`uname` case $targetos in - MINGW32*) mingw32=yes;; + MINGW32*) mingw32=yes; host_os=Windows; ;; DragonFly) noldl=yes;; OpenBSD) noldl=yes;; FreeBSD) noldl=yes;; @@ -99,6 +104,9 @@ classify_cpu () esac cpu="armv4l" ;; + aarch64) + cpu="aarch64" + ;; alpha) cpu="alpha" ;; @@ -163,13 +171,17 @@ 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" ;; - --enable-mingw32) mingw32="yes" ; cross_prefix="i686-pc-mingw32-" ; cpu=x86 + --enable-mingw32) mingw32="yes" ; cross_prefix="i686-pc-mingw32-" ; cpu=x86; targetos=Windows; ;; - --enable-cygwin) mingw32="yes" ; cygwin="yes" ; cross_prefix="mingw32-" ; cpu=x86 + --enable-cygwin) mingw32="yes" ; cygwin="yes" ; cross_prefix="mingw32-" ; cpu=x86; targetos=Windows; + ;; + --enable-tcc32-mingw) mingw32="yes" ; cross_prefix="i386-win-" ; cpu=x86; cc=tcc; targetos=Windows; + ;; + --enable-tcc64-mingw) mingw32="yes" ; cross_prefix="x86_64-win-" ; cpu=x86_64; cc=tcc; targetos=Windows; ;; --enable-cross) build_cross="yes" ;; @@ -192,11 +204,18 @@ 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 if test -z "$CFLAGS"; then - CFLAGS="-Wall -g -O2" + CFLAGS="-Wall -g -O0" fi if test "$mingw32" = "yes" ; then @@ -228,15 +247,25 @@ else if test x"$execprefix" = x""; then execprefix="${prefix}" fi + if test x"$tccdir" = x""; then + tccdir="tcc" + fi if test x"$libdir" = x""; then - libdir="${execprefix}/lib" + libdir="${execprefix}/lib" + if test -n "${tccdir}"; then + tccdir="${libdir}/${tccdir}" + else + tccdir="${libdir}" + fi + if test "$cpu" = "x86-64"; then + libdir="${execprefix}/lib64" + fi + else + tccdir="${libdir}/${tccdir}" fi if test x"$bindir" = x""; then bindir="${execprefix}/bin" fi - if test x"$tccdir" = x""; then - tccdir="tcc" - fi if test x"$docdir" = x""; then docdir="${sharedir}/doc/${tccdir}" fi @@ -246,7 +275,6 @@ else if test x"$infodir" = x""; then infodir="${sharedir}/info" fi - tccdir="${libdir}/${tccdir}" fi # mingw32 if test x"$includedir" = x""; then @@ -284,6 +312,8 @@ Advanced options (experts only): --disable-static make libtcc.so instead of libtcc.a --disable-rpath disable use of -rpath with the above --with-libgcc use libgcc_s.so.1 instead of libtcc1.a in dynamic link + --enable-tcc64-mingw build windows version on linux with x86_64-win-tcc + --enable-tcc32-mingw build windows version on linux with i386-win-tcc --enable-mingw32 build windows version on linux with mingw32 --enable-cygwin build windows version on windows with cygwin --enable-cross build cross compilers @@ -298,8 +328,10 @@ EOF exit 1 fi +if test "$cc" != "tcc"; then + ar="${cross_prefix}${ar}" +fi cc="${cross_prefix}${cc}" -ar="${cross_prefix}${ar}" strip="${cross_prefix}${strip}" CONFTEST=./conftest$EXESUF @@ -316,7 +348,7 @@ if test -z "$cross_prefix" ; then if test -f "/usr/lib/$triplet/crti.o" ; then tcc_lddir="lib" multiarch_triplet="$triplet" - elif test -f "/usr/lib64/crti.o" ; then + elif test "$cpu" != "x86" -a -f "/usr/lib64/crti.o" ; then tcc_lddir="lib64" fi @@ -354,24 +386,43 @@ 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 +# a final configuration tuning +W_OPTIONS="declaration-after-statement" +for i in $W_OPTIONS; do + O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)" + if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -W$i"; fi +done +W_OPTIONS="deprecated-declarations strict-aliasing pointer-sign sign-compare unused-result uninitialized" +for i in $W_OPTIONS; do + O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)" + if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -Wno-$i"; fi +done +F_OPTIONS="strict-aliasing" +for i in $F_OPTIONS; do + O_PRESENT="$($cc -v --help 2>&1 | grep -- -f$i)" + if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -fno-$i"; fi +done +if test -z "$tcc_lddir" -a "$cpu" = "x86-64"; then tcc_lddir="lib64"; fi + +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 "Host OS $host_os" +echo "Target OS $targetos" +echo "Big Endian $bigendian" +echo "gprof enabled $gprof" +echo "use libgcc $use_libgcc" echo "Creating config.mak and config.h" @@ -396,7 +447,14 @@ CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS LIBSUF=$LIBSUF EXESUF=$EXESUF +HOST_OS=$host_os +EOF +if test "$mingw32" = "yes" -a "$host_os" != "Windows" ; then +cat >>config.mak <<EOF +XCC=$cc +XAR=$ar EOF +fi print_inc() { if test -n "$2"; then @@ -415,11 +473,13 @@ echo "/* Automatically generated by configure - do not modify */" > $TMPH print_inc CONFIG_SYSROOT "$sysroot" print_inc CONFIG_TCCDIR "$tccdir" +if test "$build_cross" = "no"; then +print_inc CONFIG_LDDIR "$tcc_lddir" +fi print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths" print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp" -print_mak CONFIG_LDDIR "$tcc_lddir" print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet" echo "#define GCC_MAJOR $gcc_major" >> $TMPH @@ -427,26 +487,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 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 |