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=""
tcc_lddir=
confvars=
@@ -154,6 +155,8 @@
;;
--elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
;;
+ --with-tcl=*) tcc_tcl_path=`echo $opt | cut -d '=' -f 2-`
+ ;;
--cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
;;
--enable-gprof) gprof="yes"
@@ -278,6 +281,7 @@
--libpaths=... specify system library paths, colon separated
--crtprefix=... specify locations of crt?.o, colon separated
--elfinterp=... specify elf interpreter
+ --with-tcl=... specify path to Tcl
EOF
#echo "NOTE: The object files are build at the place where configure is launched"
exit 1
@@ -339,6 +343,25 @@
esac
fi
+print_tcl_defs() {
+ (
+ tclConfig="$1"
+ . "${tclConfig}"
+ LDFLAGS="$LDFLAGS $TCL_LIB_SPEC $TCL_LIBS"
+ CFLAGS="$CFLAGS $TCL_INCLUDE_SPEC -DHAVE_TCL_H=1"
+ set | egrep '^(CFLAGS|LDFLAGS)='
+ )
+}
+
+if [ -n "${tcc_tcl_path}" ]; then
+ for tcc_tcl_path_file in ${tcc_tcl_path}/{,lib,lib64}/tclConfig.sh; do
+ if [ -f "${tcc_tcl_path_file}" ]; then
+ eval `print_tcl_defs "${tcc_tcl_path_file}"`
+ break
+ fi
+ done
+fi
+
cat <<EOF
Binary directory $bindir
TinyCC directory $tccdir
diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1tcl/libtcc.c
--- tcc-0.9.26.orig/libtcc.c 2013-02-15 09:24:00.000000000 -0500
+++ tcc-0.9.26-1tcl/libtcc.c 2014-05-05 13:01:47.556096371 -0400
@@ -981,6 +981,11 @@
tcc_define_symbol(s, "__WCHAR_TYPE__", "int");
#endif
+ /* Tcl defines */
+#ifdef USE_TCL_STUBS
+ tcc_define_symbol(s, "USE_TCL_STUBS", "1");
+#endif
+
#ifndef TCC_TARGET_PE
/* glibc defines */
tcc_define_symbol(s, "__REDIRECT(name, proto, alias)", "name proto __asm__ (#alias)");
diff -uNr tcc-0.9.26.orig/tcc.h tcc-0.9.26-1tcl/tcc.h
--- tcc-0.9.26.orig/tcc.h 2013-02-15 09:24:00.000000000 -0500
+++ tcc-0.9.26-1tcl/tcc.h 2014-05-05 12:35:23.111943547 -0400
@@ -23,6 +23,9 @@
#define _GNU_SOURCE
#include "config.h"
+#ifdef HAVE_TCL_H
+# include <tcl.h>
+#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 },
};