From: grischka Date: Thu, 14 Feb 2013 16:43:24 +0000 (+0100) Subject: configure: pass CONFIG_xxxDIR/PATH options via commandline X-Git-Tag: release_0_9_26~7 X-Git-Url: https://repo.or.cz/w/tinycc.git/commitdiff_plain/762a43877b6edc4a586b2b41f7474eee0adcdcec 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 --- diff --git a/Makefile b/Makefile index 21632fc1..1750a40c 100644 --- a/Makefile +++ b/Makefile @@ -42,13 +42,13 @@ endif endif ifeq ($(ARCH),i386) -NATIVE_DEFINES=-DTCC_TARGET_I386 +NATIVE_DEFINES+=-DTCC_TARGET_I386 else ifeq ($(ARCH),x86-64) -NATIVE_DEFINES=-DTCC_TARGET_X86_64 +NATIVE_DEFINES+=-DTCC_TARGET_X86_64 endif ifeq ($(ARCH),arm) -NATIVE_DEFINES=-DTCC_TARGET_ARM +NATIVE_DEFINES+=-DTCC_TARGET_ARM NATIVE_DEFINES+=-DWITHOUT_LIBTCC ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3)) NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT diff --git a/configure b/configure index 22fbfbe7..8e6782cc 100755 --- a/configure +++ b/configure @@ -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 <> $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 diff --git a/lib/Makefile b/lib/Makefile index e125f2c6..dfac0f84 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -3,7 +3,7 @@ # TOP = .. -include $(TOP)/config.mak +include $(TOP)/Makefile VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib ifndef TARGET @@ -91,7 +91,7 @@ $(DIR)/%.o : %.c $(DIR)/%.o : %.S $(XCC) -c $< -o $@ $(XFLAGS) $(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c - $(CC) -Os -s -o $@ $< $(XFLAGS) $(LDFLAGS) + $(CC) -o $@ $< $(XFLAGS) $(LDFLAGS) $(OBJ) $(XAR) : $(DIR)/exists $(DIR)/exists : diff --git a/lib/libtcc1.c b/lib/libtcc1.c index 946c6c89..6964cd14 100644 --- a/lib/libtcc1.c +++ b/lib/libtcc1.c @@ -609,8 +609,11 @@ unsigned long long __fixunsxfdi (long double a1) /* helper functions for stdarg.h */ -#include #include +#ifndef __TINYC__ +/* gives "incompatible types for redefinition of __va_arg" below */ +#include +#endif enum __va_arg_type { __va_gen_reg, __va_float_reg, __va_stack @@ -665,7 +668,9 @@ void *__va_arg(struct __va_list_struct *ap, return ap->overflow_arg_area - size; default: +#ifndef __TINYC__ fprintf(stderr, "unknown ABI type for __va_arg\n"); +#endif abort(); } } diff --git a/tcc.c b/tcc.c index 7c1b133a..cd306b0d 100644 --- a/tcc.c +++ b/tcc.c @@ -223,6 +223,7 @@ static void display_info(TCCState *s, int what) print_paths("crt", s->crt_paths, s->nb_crt_paths); print_paths("libraries", s->library_paths, s->nb_library_paths); print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths); + printf("elfinterp:\n %s\n", CONFIG_TCC_ELFINTERP); break; } } diff --git a/tcc.h b/tcc.h index 638540a5..1f0343e3 100644 --- a/tcc.h +++ b/tcc.h @@ -214,6 +214,8 @@ # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" # elif defined(TCC_UCLIBC) # define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0" +# elif defined(TCC_TARGET_PE) +# define CONFIG_TCC_ELFINTERP "-" # else # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" # endif