Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -20,11 +20,11 @@ TCLCONFIGPATH = @TCLCONFIGPATH@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ tcllibdir = $(shell if echo "$(libdir)" | grep '^UNSPECIFIED' >/dev/null; then echo $(TCL_PACKAGE_PATH); else echo "$(libdir)"; fi) PACKAGE_INSTALL_DIR = $(tcllibdir)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -TCC_CONFIGURE_OPTS = --extra-cflags='$(CPPFLAGS) $(CFLAGS)' --with-tcl=$(TCLCONFIGPATH) --sysincludepaths='{B}/include' --libpaths='{B}/lib' @TCC_CONFIGURE_OPTS@ +TCC_CONFIGURE_OPTS = --extra-cflags='$(CPPFLAGS) $(CFLAGS) -DCONFIG_TCC_STATIC=1' --with-tcl=$(TCLCONFIGPATH) --sysincludepaths='{B}/include' --libpaths='{B}/lib' @TCC_CONFIGURE_OPTS@ INSTALL_HEADERS = tcl.h assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h wctype.h srcdir = @srcdir@ host_os = @host_os@ @SET_MAKE@ Index: build/tcc-patches/0.9.26/tcc-0.9.26-tcl.diff ================================================================== --- build/tcc-patches/0.9.26/tcc-0.9.26-tcl.diff +++ build/tcc-patches/0.9.26/tcc-0.9.26-tcl.diff @@ -1,7 +1,8 @@ ---- tcc-0.9.26.orig/configure 2013-02-15 08:24:00.000000000 -0600 -+++ tcc-0.9.26-1tcl/configure 2014-05-01 19:50:10.103740647 -0500 +diff -uNr tcc-0.9.26.orig/configure tcc-0.9.26-1tcl/configure +--- tcc-0.9.26.orig/configure 2013-02-15 09:24:00.000000000 -0500 ++++ tcc-0.9.26-1tcl/configure 2014-05-05 12:35:23.109943527 -0400 @@ -43,6 +43,7 @@ tcc_libpaths="" tcc_crtprefix="" tcc_elfinterp="" +tcc_tcl_path="" @@ -49,12 +50,28 @@ +fi + cat < +#endif #ifdef CONFIG_TCCBOOT #include "tccboot.h" +diff -uNr tcc-0.9.26.orig/tccrun.c tcc-0.9.26-1tcl/tccrun.c +--- tcc-0.9.26.orig/tccrun.c 2013-02-15 09:24:00.000000000 -0500 ++++ tcc-0.9.26-1tcl/tccrun.c 2014-05-05 13:06:41.105088994 -0400 +@@ -697,14 +697,17 @@ + + /* add the symbol you want here if no dynamic linking is done */ + static TCCSyms tcc_syms[] = { +-#if !defined(CONFIG_TCCBOOT) + #define TCCSYM(a) { #a, &a, }, ++#if !defined(CONFIG_TCCBOOT) + TCCSYM(printf) + TCCSYM(fprintf) + TCCSYM(fopen) + TCCSYM(fclose) +-#undef TCCSYM + #endif ++#ifdef USE_TCL_STUBS ++ TCCSYM(tclStubsPtr) ++#endif ++#undef TCCSYM + { NULL, NULL }, + }; + DELETED build/tcc-patches/0.9.26/tcc-0.9.26-win32useopenlibs.diff Index: build/tcc-patches/0.9.26/tcc-0.9.26-win32useopenlibs.diff ================================================================== --- build/tcc-patches/0.9.26/tcc-0.9.26-win32useopenlibs.diff +++ /dev/null @@ -1,79 +0,0 @@ -diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1win32useopenlibs/tccpe.c ---- tcc-0.9.26.orig/tccpe.c 2013-02-15 08:24:00.000000000 -0600 -+++ tcc-0.9.26-1win32useopenlibs/tccpe.c 2014-05-04 02:20:25.285150002 -0500 -@@ -38,6 +38,9 @@ - # define ADDR3264 DWORD - #endif - -+#ifdef TCC_IS_NATIVE -+#include -+#endif - #ifdef _WIN32 - void dbg_printf (const char *fmt, ...) - { -@@ -831,7 +834,27 @@ - if (dllref) { - if ( !dllref->handle ) - dllref->handle = LoadLibrary(dllref->name); -- v = (ADDR3264)GetProcAddress(dllref->handle, name); -+ if (dllref->handle) { -+ v = (ADDR3264)GetProcAddress(dllref->handle, name); -+ } -+ } -+ if (!v) { -+ HANDLE cur_proc = GetCurrentProcess(); -+ HMODULE *modules; -+ DWORD needed, i; -+ -+ needed = 0; -+ EnumProcessModules(cur_proc, NULL, 0, &needed); -+ modules = tcc_malloc(needed); -+ if (EnumProcessModules(cur_proc, modules, needed, &needed)) { -+ for (i = 0; i < needed / sizeof(HMODULE); i++) { -+ v = (ADDR3264)GetProcAddress(modules[i], name); -+ if (v) { -+ break; -+ } -+ } -+ } -+ tcc_free(modules); - } - if (!v) - tcc_error_noabort("undefined symbol '%s'", name); -@@ -1209,9 +1232,35 @@ - - const char *name = symtab_section->link->data + sym->st_name; - unsigned type = ELFW(ST_TYPE)(sym->st_info); -- int imp_sym = pe_find_import(pe->s1, sym); -+ int imp_sym; - struct import_symbol *is; - -+ imp_sym = pe_find_import(pe->s1, sym); -+ if (0 == imp_sym) { -+ HANDLE cur_proc = GetCurrentProcess(); -+ HMODULE *modules; -+ DWORD needed, i; -+ const char *symname; -+ void *addr; -+ -+ symname = pe_export_name(pe->s1, sym); -+ -+ needed = 0; -+ EnumProcessModules(cur_proc, NULL, 0, &needed); -+ modules = tcc_malloc(needed); -+ if (EnumProcessModules(cur_proc, modules, needed, &needed)) { -+ for (i = 0; i < needed / sizeof(HMODULE); i++) { -+ addr = GetProcAddress(modules[i], symname); -+ if (addr) { -+ put_elf_sym( pe->s1->dynsymtab_section, (ADDR3264) addr, sizeof(addr), ELFW(ST_INFO)(STB_GLOBAL, STT_OBJECT), 0, SHN_UNDEF, symname); -+ imp_sym = pe_find_import(pe->s1, sym); -+ break; -+ } -+ } -+ } -+ tcc_free(modules); -+ } -+ - if (0 == imp_sym) - goto not_found; -