configure: pass CONFIG_xxxDIR/PATH options via commandline

- except for CONFIG_SYSROOT and CONFIG_TCCDIR

Strictly neccessary it is only for CONFIG_MULTIARCHDIR
because otherwise if it's in config.h it is impossible to
leave it undefined.

But it is also nicer not to use these definitions for
cross-compilers.

- Also:
lib/Makefile : include ../Makefile for CFLAGS
lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
This commit is contained in:
grischka
2013-02-14 17:43:24 +01:00
parent 99b801dafc
commit 762a43877b
6 changed files with 30 additions and 38 deletions

48
configure vendored
View File

@ -304,15 +304,6 @@ if test -z "$cross_prefix" ; then
tcc_lddir="lib64"
fi
# gr: FIXME
# ldd $CONFTEST gives (ubuntu 8)
# linux-gate.so.1 => (0xb7fc3000)
# libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e37000)
# /lib/ld-linux.so.2 (0xb7fa9000)
# result is crap:
# CONFIG_LDDIR="lib/tls/i686/cmov"
# CONFIG_MUADIR="tls/i686/cmov"
#
# multiarch_triplet=${libc_dir#*/}
# multiarch_triplet=${multiarch_triplet%/}
# tcc_lddir="${libc_dir%%/*}"
@ -321,8 +312,8 @@ if test -z "$cross_prefix" ; then
# fi
# gr: maybe for after the release:
# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
# #echo "elfinterp $tcc_elfinterp"
# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
# echo "elfinterp $tcc_elfinterp"
fi
fi
@ -333,18 +324,6 @@ else
esac
fi
# gr: maybe for after the release:
# run compiler to see if it supports FLAG, if yes add to CFLAGS
#cc_option() {
# if $cc $CFLAGS $1 -S -o /dev/null -xc conftest.c >/dev/null 2>&1; then
# CFLAGS="$CFLAGS $1"; else if test -n "$2"; then
# CFLAGS="$CFLAGS $2"; fi; fi
#}
#cc_option -fno-strict-aliasing
#cc_option -Wno-pointer-sign
#cc_option -Wno-sign-compare
#cc_option -Wno-unused-result -D_FORTIFY_SOURCE=0
cat <<EOF
Binary directory $bindir
TinyCC directory $tccdir
@ -389,24 +368,29 @@ LIBSUF=$LIBSUF
EXESUF=$EXESUF
EOF
print_def() {
print_inc() {
if test -n "$2"; then
echo "#ifndef $1" >> $TMPH
echo "# define $1 \"$2\"" >> $TMPH
echo "#endif" >> $TMPH
fi
}
print_mak() {
if test -n "$2"; then
echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak
fi
}
echo "/* Automatically generated by configure - do not modify */" > $TMPH
print_def CONFIG_SYSROOT "$sysroot"
print_def CONFIG_TCCDIR "$tccdir"
print_def CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
print_def CONFIG_TCC_LIBPATHS "$tcc_libpaths"
print_def CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
print_def CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
print_def CONFIG_MULTIARCHDIR "$multiarch_triplet"
print_def CONFIG_LDDIR "$tcc_lddir"
print_inc CONFIG_SYSROOT "$sysroot"
print_inc CONFIG_TCCDIR "$tccdir"
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
echo "#define GCC_MINOR $gcc_minor" >> $TMPH