History

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

grischka committed 13 years ago

Commit 762a4381 parent 99b801d6 files · +30 −38Browse files

Unified · Split

6 files
  1. Makefile +3 −3
  2. configure +16 −32
  3. lib/Makefile +2 −2
  4. lib/libtcc1.c +6 −1
  5. tcc.c +1 −0
  6. tcc.h +2 −0
Makefile+3−3
@@ -42,13 +42,13 @@ endif · 41 unmodified lines
4242 endif
4343
4444 ifeq ($(ARCH),i386)
45−NATIVE_DEFINES=-DTCC_TARGET_I386
45+NATIVE_DEFINES+=-DTCC_TARGET_I386
4646 else ifeq ($(ARCH),x86-64)
47−NATIVE_DEFINES=-DTCC_TARGET_X86_64
47+NATIVE_DEFINES+=-DTCC_TARGET_X86_64
4848 endif
4949
5050 ifeq ($(ARCH),arm)
51−NATIVE_DEFINES=-DTCC_TARGET_ARM
51+NATIVE_DEFINES+=-DTCC_TARGET_ARM
5252 NATIVE_DEFINES+=-DWITHOUT_LIBTCC
5353 ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3))
5454 NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
configure+16−32
@@ -304,15 +304,6 @@ if test -z "$cross_prefix" ; then · 303 unmodified lines
304304 tcc_lddir="lib64"
305305 fi
306306
307−# gr: FIXME
308−# ldd $CONFTEST gives (ubuntu 8)
309−# linux-gate.so.1 => (0xb7fc3000)
310−# libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e37000)
311−# /lib/ld-linux.so.2 (0xb7fa9000)
312−# result is crap:
313−# CONFIG_LDDIR="lib/tls/i686/cmov"
314−# CONFIG_MUADIR="tls/i686/cmov"
315−#
316307 # multiarch_triplet=${libc_dir#*/}
317308 # multiarch_triplet=${multiarch_triplet%/}
318309 # tcc_lddir="${libc_dir%%/*}"
@@ -321,8 +312,8 @@ if test -z "$cross_prefix" ; then · 2 unmodified lines
321312 # fi
322313
323314 # gr: maybe for after the release:
324−# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
325−# #echo "elfinterp $tcc_elfinterp"
315+# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
316+ # echo "elfinterp $tcc_elfinterp"
326317
327318 fi
328319 fi
@@ -333,18 +324,6 @@ else · 4 unmodified lines
333324 esac
334325 fi
335326
336−# gr: maybe for after the release:
337−# run compiler to see if it supports FLAG, if yes add to CFLAGS
338−#cc_option() {
339−# if $cc $CFLAGS $1 -S -o /dev/null -xc conftest.c >/dev/null 2>&1; then
340−# CFLAGS="$CFLAGS $1"; else if test -n "$2"; then
341−# CFLAGS="$CFLAGS $2"; fi; fi
342−#}
343−#cc_option -fno-strict-aliasing
344−#cc_option -Wno-pointer-sign
345−#cc_option -Wno-sign-compare
346−#cc_option -Wno-unused-result -D_FORTIFY_SOURCE=0
347−
348327 cat <<EOF
349328 Binary directory $bindir
350329 TinyCC directory $tccdir
@@ -389,24 +368,29 @@ LIBSUF=$LIBSUF · 38 unmodified lines
389368 EXESUF=$EXESUF
390369 EOF
391370
392−print_def() {
371+print_inc() {
393372 if test -n "$2"; then
394373 echo "#ifndef $1" >> $TMPH
395374 echo "# define $1 \"$2\"" >> $TMPH
396375 echo "#endif" >> $TMPH
397376 fi
398377 }
378+print_mak() {
379+ if test -n "$2"; then
380+ echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak
381+ fi
382+}
399383
400384 echo "/* Automatically generated by configure - do not modify */" > $TMPH
401385
402−print_def CONFIG_SYSROOT "$sysroot"
403−print_def CONFIG_TCCDIR "$tccdir"
404−print_def CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
405−print_def CONFIG_TCC_LIBPATHS "$tcc_libpaths"
406−print_def CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
407−print_def CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
408−print_def CONFIG_MULTIARCHDIR "$multiarch_triplet"
409−print_def CONFIG_LDDIR "$tcc_lddir"
386+print_inc CONFIG_SYSROOT "$sysroot"
387+print_inc CONFIG_TCCDIR "$tccdir"
388+print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
389+print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
390+print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
391+print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
392+print_mak CONFIG_LDDIR "$tcc_lddir"
393+print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet"
410394
411395 echo "#define GCC_MAJOR $gcc_major" >> $TMPH
412396 echo "#define GCC_MINOR $gcc_minor" >> $TMPH
lib/Makefile+2−2
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 #
44
55 TOP = ..
6−include $(TOP)/config.mak
6+include $(TOP)/Makefile
77 VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib
88
99 ifndef TARGET
@@ -91,7 +91,7 @@ $(DIR)/%.o : %.c · 81 unmodified lines
9191 $(DIR)/%.o : %.S
9292 $(XCC) -c $< -o $@ $(XFLAGS)
9393 $(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c
94− $(CC) -Os -s -o $@ $< $(XFLAGS) $(LDFLAGS)
94+ $(CC) -o $@ $< $(XFLAGS) $(LDFLAGS)
9595
9696 $(OBJ) $(XAR) : $(DIR)/exists
9797 $(DIR)/exists :
lib/libtcc1.c+6−1
@@ -609,8 +609,11 @@ unsigned long long __fixunsxfdi (long double a1) · 608 unmodified lines
609609
610610 /* helper functions for stdarg.h */
611611
612−#include <stdio.h>
613612 #include <stdlib.h>
613+#ifndef __TINYC__
614+/* gives "incompatible types for redefinition of __va_arg" below */
615+#include <stdio.h>
616+#endif
614617
615618 enum __va_arg_type {
616619 __va_gen_reg, __va_float_reg, __va_stack
@@ -665,7 +668,9 @@ void *__va_arg(struct __va_list_struct *ap, · 48 unmodified lines
665668 return ap->overflow_arg_area - size;
666669
667670 default:
671+#ifndef __TINYC__
668672 fprintf(stderr, "unknown ABI type for __va_arg\n");
673+#endif
669674 abort();
670675 }
671676 }
tcc.c+1−0
@@ -223,6 +223,7 @@ static void display_info(TCCState *s, int what) · 222 unmodified lines
223223 print_paths("crt", s->crt_paths, s->nb_crt_paths);
224224 print_paths("libraries", s->library_paths, s->nb_library_paths);
225225 print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths);
226+ printf("elfinterp:\n %s\n", CONFIG_TCC_ELFINTERP);
226227 break;
227228 }
228229 }
tcc.h+2−0
@@ -214,6 +214,8 @@ · 213 unmodified lines
214214 # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2"
215215 # elif defined(TCC_UCLIBC)
216216 # define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0"
217+# elif defined(TCC_TARGET_PE)
218+# define CONFIG_TCC_ELFINTERP "-"
217219 # else
218220 # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2"
219221 # endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t