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
42endif42endif
43 43
44ifeq ($(ARCH),i386)44ifeq ($(ARCH),i386)
45NATIVE_DEFINES=-DTCC_TARGET_I38645NATIVE_DEFINES+=-DTCC_TARGET_I386
46else ifeq ($(ARCH),x86-64)46else ifeq ($(ARCH),x86-64)
47NATIVE_DEFINES=-DTCC_TARGET_X86_6447NATIVE_DEFINES+=-DTCC_TARGET_X86_64
48endif48endif
49 49
50ifeq ($(ARCH),arm)50ifeq ($(ARCH),arm)
51NATIVE_DEFINES=-DTCC_TARGET_ARM51NATIVE_DEFINES+=-DTCC_TARGET_ARM
52NATIVE_DEFINES+=-DWITHOUT_LIBTCC52NATIVE_DEFINES+=-DWITHOUT_LIBTCC
53ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3))53ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3))
54NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT54NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
configure+16−32
@@ -304,15 +304,6 @@ if test -z "$cross_prefix" ; then · 303 unmodified lines
304 tcc_lddir="lib64"304 tcc_lddir="lib64"
305 fi305 fi
306 306
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#
316# multiarch_triplet=${libc_dir#*/}307# multiarch_triplet=${libc_dir#*/}
317# multiarch_triplet=${multiarch_triplet%/}308# multiarch_triplet=${multiarch_triplet%/}
318# tcc_lddir="${libc_dir%%/*}"309# tcc_lddir="${libc_dir%%/*}"
@@ -321,8 +312,8 @@ if test -z "$cross_prefix" ; then · 2 unmodified lines
321# fi312# fi
322 313
323# gr: maybe for after the release:314# gr: maybe for after the release:
324# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"315# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
325# #echo "elfinterp $tcc_elfinterp"316 # echo "elfinterp $tcc_elfinterp"
326 317
327 fi318 fi
328 fi319 fi
@@ -333,18 +324,6 @@ else · 4 unmodified lines
333 esac324 esac
334fi325fi
335 326
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
348cat <<EOF327cat <<EOF
349Binary directory $bindir328Binary directory $bindir
350TinyCC directory $tccdir329TinyCC directory $tccdir
@@ -389,24 +368,29 @@ LIBSUF=$LIBSUF · 38 unmodified lines
389EXESUF=$EXESUF368EXESUF=$EXESUF
390EOF369EOF
391 370
392print_def() {371print_inc() {
393 if test -n "$2"; then372 if test -n "$2"; then
394 echo "#ifndef $1" >> $TMPH373 echo "#ifndef $1" >> $TMPH
395 echo "# define $1 \"$2\"" >> $TMPH374 echo "# define $1 \"$2\"" >> $TMPH
396 echo "#endif" >> $TMPH375 echo "#endif" >> $TMPH
397 fi376 fi
398}377}
378print_mak() {
379 if test -n "$2"; then
380 echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak
381 fi
382}
399 383
400echo "/* Automatically generated by configure - do not modify */" > $TMPH384echo "/* Automatically generated by configure - do not modify */" > $TMPH
401 385
402print_def CONFIG_SYSROOT "$sysroot"386print_inc CONFIG_SYSROOT "$sysroot"
403print_def CONFIG_TCCDIR "$tccdir"387print_inc CONFIG_TCCDIR "$tccdir"
404print_def CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"388print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
405print_def CONFIG_TCC_LIBPATHS "$tcc_libpaths"389print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
406print_def CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"390print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
407print_def CONFIG_TCC_ELFINTERP "$tcc_elfinterp"391print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
408print_def CONFIG_MULTIARCHDIR "$multiarch_triplet"392print_mak CONFIG_LDDIR "$tcc_lddir"
409print_def CONFIG_LDDIR "$tcc_lddir"393print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet"
410 394
411echo "#define GCC_MAJOR $gcc_major" >> $TMPH395echo "#define GCC_MAJOR $gcc_major" >> $TMPH
412echo "#define GCC_MINOR $gcc_minor" >> $TMPH396echo "#define GCC_MINOR $gcc_minor" >> $TMPH
lib/Makefile+2−2
@@ -3,7 +3,7 @@ · 2 unmodified lines
3#3#
4 4
5TOP = ..5TOP = ..
6include $(TOP)/config.mak6include $(TOP)/Makefile
7VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib7VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib
8 8
9ifndef TARGET9ifndef TARGET
@@ -91,7 +91,7 @@ $(DIR)/%.o : %.c · 81 unmodified lines
91$(DIR)/%.o : %.S91$(DIR)/%.o : %.S
92 $(XCC) -c $< -o $@ $(XFLAGS)92 $(XCC) -c $< -o $@ $(XFLAGS)
93$(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c93$(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c
94 $(CC) -Os -s -o $@ $< $(XFLAGS) $(LDFLAGS)94 $(CC) -o $@ $< $(XFLAGS) $(LDFLAGS)
95 95
96$(OBJ) $(XAR) : $(DIR)/exists96$(OBJ) $(XAR) : $(DIR)/exists
97$(DIR)/exists :97$(DIR)/exists :
lib/libtcc1.c+6−1
@@ -609,8 +609,11 @@ unsigned long long __fixunsxfdi (long double a1) · 608 unmodified lines
609 609
610/* helper functions for stdarg.h */610/* helper functions for stdarg.h */
611 611
612#include <stdio.h>
613#include <stdlib.h>612#include <stdlib.h>
613#ifndef __TINYC__
614/* gives "incompatible types for redefinition of __va_arg" below */
615#include <stdio.h>
616#endif
614 617
615enum __va_arg_type {618enum __va_arg_type {
616 __va_gen_reg, __va_float_reg, __va_stack619 __va_gen_reg, __va_float_reg, __va_stack
@@ -665,7 +668,9 @@ void *__va_arg(struct __va_list_struct *ap, · 48 unmodified lines
665 return ap->overflow_arg_area - size;668 return ap->overflow_arg_area - size;
666 669
667 default:670 default:
671#ifndef __TINYC__
668 fprintf(stderr, "unknown ABI type for __va_arg\n");672 fprintf(stderr, "unknown ABI type for __va_arg\n");
673#endif
669 abort();674 abort();
670 }675 }
671}676}
tcc.c+1−0
@@ -223,6 +223,7 @@ static void display_info(TCCState *s, int what) · 222 unmodified lines
223 print_paths("crt", s->crt_paths, s->nb_crt_paths);223 print_paths("crt", s->crt_paths, s->nb_crt_paths);
224 print_paths("libraries", s->library_paths, s->nb_library_paths);224 print_paths("libraries", s->library_paths, s->nb_library_paths);
225 print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths);225 print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths);
226 printf("elfinterp:\n %s\n", CONFIG_TCC_ELFINTERP);
226 break;227 break;
227 }228 }
228}229}
tcc.h+2−0
@@ -214,6 +214,8 @@ · 213 unmodified lines
214# define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2"214# define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2"
215# elif defined(TCC_UCLIBC)215# elif defined(TCC_UCLIBC)
216# define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0"216# define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0"
217# elif defined(TCC_TARGET_PE)
218# define CONFIG_TCC_ELFINTERP "-"
217# else219# else
218# define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2"220# define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2"
219# endif221# 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