Fossil SCM

Enhance the private (i.e. fake) Tcl stubs mechanism support and make it optional at compile-time.

mistachkin 2013-09-16 05:54 UTC tcl-stubs
Commit a76a134bfd4e2951add6a0f9db71b00fc14fe76f
--- Makefile.in
+++ Makefile.in
@@ -42,10 +42,11 @@
4242
TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
4343
INSTALLDIR = $(DESTDIR)@prefix@/bin
4444
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
4545
FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
4646
FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
47
+FOSSIL_ENABLE_TCL_FAKE_STUBS = @FOSSIL_ENABLE_TCL_FAKE_STUBS@
4748
4849
include $(SRCDIR)/main.mk
4950
5051
distclean: clean
5152
rm -f autoconfig.h config.log Makefile
5253
--- Makefile.in
+++ Makefile.in
@@ -42,10 +42,11 @@
42 TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
43 INSTALLDIR = $(DESTDIR)@prefix@/bin
44 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
45 FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
46 FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
 
47
48 include $(SRCDIR)/main.mk
49
50 distclean: clean
51 rm -f autoconfig.h config.log Makefile
52
--- Makefile.in
+++ Makefile.in
@@ -42,10 +42,11 @@
42 TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
43 INSTALLDIR = $(DESTDIR)@prefix@/bin
44 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
45 FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
46 FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
47 FOSSIL_ENABLE_TCL_FAKE_STUBS = @FOSSIL_ENABLE_TCL_FAKE_STUBS@
48
49 include $(SRCDIR)/main.mk
50
51 distclean: clean
52 rm -f autoconfig.h config.log Makefile
53
+24 -13
--- auto.def
+++ auto.def
@@ -2,19 +2,20 @@
22
33
use cc cc-lib
44
55
options {
66
with-openssl:path|auto|none
7
- => {Look for openssl in the given path, or auto or none}
8
- with-zlib:path => {Look for zlib in the given path}
9
- with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
10
- with-tcl-stubs=0 => {Enable Tcl integration via stubs mechanism}
11
- internal-sqlite=1 => {Don't use the internal sqlite, use the system one}
12
- static=0 => {Link a static executable}
13
- lineedit=1 => {Disable line editing}
14
- fossil-debug=0 => {Build with fossil debugging enabled}
15
- json=0 => {Build with fossil JSON API enabled}
7
+ => {Look for openssl in the given path, or auto or none}
8
+ with-zlib:path => {Look for zlib in the given path}
9
+ with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
10
+ with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
11
+ with-tcl-fake-stubs=0 => {Enable Tcl integration via private stubs mechanism}
12
+ internal-sqlite=1 => {Don't use the internal SQLite, use the system one}
13
+ static=0 => {Link a static executable}
14
+ lineedit=1 => {Disable line editing}
15
+ fossil-debug=0 => {Build with fossil debugging enabled}
16
+ json=0 => {Build with fossil JSON API enabled}
1617
}
1718
1819
# sqlite wants these types if possible
1920
cc-with {-includes {stdint.h inttypes.h}} {
2021
cc-check-types uint32_t uint16_t int16_t uint8_t
@@ -114,28 +115,38 @@
114115
}
115116
if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
116117
user-error "Cannot find Tcl $msg"
117118
}
118119
set tclstubs [opt-bool with-tcl-stubs]
120
+ set tclfakestubs [opt-bool with-tcl-fake-stubs]
119121
if {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
120122
set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
121123
define FOSSIL_ENABLE_TCL_STUBS
122124
define USE_TCL_STUBS
125
+ } elseif {$tclfakestubs} {
126
+ define FOSSIL_ENABLE_TCL_FAKE_STUBS
127
+ define USE_TCL_STUBS
123128
} else {
124129
set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
125130
}
126131
set cflags $tclconfig(TCL_INCLUDE_SPEC)
127
- if {!$tclstubs} {
132
+ if {!$tclfakestubs} {
128133
cc-with [list -cflags $cflags -libs $libs] {
129
- if {![cc-check-functions Tcl_CreateInterp]} {
130
- user-error "Cannot find a usable Tcl library $msg"
134
+ if {$tclstubs} {
135
+ if {![cc-check-functions Tcl_InitStubs]} {
136
+ user-error "Cannot find a usable Tcl stubs library $msg"
137
+ }
138
+ } else {
139
+ if {![cc-check-functions Tcl_CreateInterp]} {
140
+ user-error "Cannot find a usable Tcl library $msg"
141
+ }
131142
}
132143
}
133144
}
134145
set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
135146
msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
136
- if {!$tclstubs} {
147
+ if {!$tclfakestubs} {
137148
define-append LIBS $libs
138149
}
139150
define-append EXTRA_CFLAGS $cflags
140151
define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
141152
define FOSSIL_ENABLE_TCL
142153
--- auto.def
+++ auto.def
@@ -2,19 +2,20 @@
2
3 use cc cc-lib
4
5 options {
6 with-openssl:path|auto|none
7 => {Look for openssl in the given path, or auto or none}
8 with-zlib:path => {Look for zlib in the given path}
9 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
10 with-tcl-stubs=0 => {Enable Tcl integration via stubs mechanism}
11 internal-sqlite=1 => {Don't use the internal sqlite, use the system one}
12 static=0 => {Link a static executable}
13 lineedit=1 => {Disable line editing}
14 fossil-debug=0 => {Build with fossil debugging enabled}
15 json=0 => {Build with fossil JSON API enabled}
 
16 }
17
18 # sqlite wants these types if possible
19 cc-with {-includes {stdint.h inttypes.h}} {
20 cc-check-types uint32_t uint16_t int16_t uint8_t
@@ -114,28 +115,38 @@
114 }
115 if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
116 user-error "Cannot find Tcl $msg"
117 }
118 set tclstubs [opt-bool with-tcl-stubs]
 
119 if {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
120 set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
121 define FOSSIL_ENABLE_TCL_STUBS
122 define USE_TCL_STUBS
 
 
 
123 } else {
124 set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
125 }
126 set cflags $tclconfig(TCL_INCLUDE_SPEC)
127 if {!$tclstubs} {
128 cc-with [list -cflags $cflags -libs $libs] {
129 if {![cc-check-functions Tcl_CreateInterp]} {
130 user-error "Cannot find a usable Tcl library $msg"
 
 
 
 
 
 
131 }
132 }
133 }
134 set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
135 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
136 if {!$tclstubs} {
137 define-append LIBS $libs
138 }
139 define-append EXTRA_CFLAGS $cflags
140 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
141 define FOSSIL_ENABLE_TCL
142
--- auto.def
+++ auto.def
@@ -2,19 +2,20 @@
2
3 use cc cc-lib
4
5 options {
6 with-openssl:path|auto|none
7 => {Look for openssl in the given path, or auto or none}
8 with-zlib:path => {Look for zlib in the given path}
9 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
10 with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
11 with-tcl-fake-stubs=0 => {Enable Tcl integration via private stubs mechanism}
12 internal-sqlite=1 => {Don't use the internal SQLite, use the system one}
13 static=0 => {Link a static executable}
14 lineedit=1 => {Disable line editing}
15 fossil-debug=0 => {Build with fossil debugging enabled}
16 json=0 => {Build with fossil JSON API enabled}
17 }
18
19 # sqlite wants these types if possible
20 cc-with {-includes {stdint.h inttypes.h}} {
21 cc-check-types uint32_t uint16_t int16_t uint8_t
@@ -114,28 +115,38 @@
115 }
116 if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
117 user-error "Cannot find Tcl $msg"
118 }
119 set tclstubs [opt-bool with-tcl-stubs]
120 set tclfakestubs [opt-bool with-tcl-fake-stubs]
121 if {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
122 set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
123 define FOSSIL_ENABLE_TCL_STUBS
124 define USE_TCL_STUBS
125 } elseif {$tclfakestubs} {
126 define FOSSIL_ENABLE_TCL_FAKE_STUBS
127 define USE_TCL_STUBS
128 } else {
129 set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
130 }
131 set cflags $tclconfig(TCL_INCLUDE_SPEC)
132 if {!$tclfakestubs} {
133 cc-with [list -cflags $cflags -libs $libs] {
134 if {$tclstubs} {
135 if {![cc-check-functions Tcl_InitStubs]} {
136 user-error "Cannot find a usable Tcl stubs library $msg"
137 }
138 } else {
139 if {![cc-check-functions Tcl_CreateInterp]} {
140 user-error "Cannot find a usable Tcl library $msg"
141 }
142 }
143 }
144 }
145 set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
146 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
147 if {!$tclfakestubs} {
148 define-append LIBS $libs
149 }
150 define-append EXTRA_CFLAGS $cflags
151 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
152 define FOSSIL_ENABLE_TCL
153
+1
--- src/main.c
+++ src/main.c
@@ -99,10 +99,11 @@
9999
int argc; /* Number of original (expanded) arguments. */
100100
char **argv; /* Full copy of the original (expanded) arguments. */
101101
void *library; /* The Tcl library module handle. */
102102
void *xFindExecutable; /* See tcl_FindExecutableProc in th_tcl.c. */
103103
void *xCreateInterp; /* See tcl_CreateInterpProc in th_tcl.c. */
104
+ void *xDeleteInterp; /* See tcl_DeleteInterpProc in th_tcl.c. */
104105
Tcl_Interp *interp; /* The on-demand created Tcl interpreter. */
105106
char *setup; /* The optional Tcl setup script. */
106107
void *xPreEval; /* Optional, called before Tcl_Eval*(). */
107108
void *pPreContext; /* Optional, provided to xPreEval(). */
108109
void *xPostEval; /* Optional, called after Tcl_Eval*(). */
109110
--- src/main.c
+++ src/main.c
@@ -99,10 +99,11 @@
99 int argc; /* Number of original (expanded) arguments. */
100 char **argv; /* Full copy of the original (expanded) arguments. */
101 void *library; /* The Tcl library module handle. */
102 void *xFindExecutable; /* See tcl_FindExecutableProc in th_tcl.c. */
103 void *xCreateInterp; /* See tcl_CreateInterpProc in th_tcl.c. */
 
104 Tcl_Interp *interp; /* The on-demand created Tcl interpreter. */
105 char *setup; /* The optional Tcl setup script. */
106 void *xPreEval; /* Optional, called before Tcl_Eval*(). */
107 void *pPreContext; /* Optional, provided to xPreEval(). */
108 void *xPostEval; /* Optional, called after Tcl_Eval*(). */
109
--- src/main.c
+++ src/main.c
@@ -99,10 +99,11 @@
99 int argc; /* Number of original (expanded) arguments. */
100 char **argv; /* Full copy of the original (expanded) arguments. */
101 void *library; /* The Tcl library module handle. */
102 void *xFindExecutable; /* See tcl_FindExecutableProc in th_tcl.c. */
103 void *xCreateInterp; /* See tcl_CreateInterpProc in th_tcl.c. */
104 void *xDeleteInterp; /* See tcl_DeleteInterpProc in th_tcl.c. */
105 Tcl_Interp *interp; /* The on-demand created Tcl interpreter. */
106 char *setup; /* The optional Tcl setup script. */
107 void *xPreEval; /* Optional, called before Tcl_Eval*(). */
108 void *pPreContext; /* Optional, provided to xPreEval(). */
109 void *xPostEval; /* Optional, called after Tcl_Eval*(). */
110
+13 -1
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -394,10 +394,14 @@
394394
# FOSSIL_ENABLE_TCL = 1
395395
396396
#### Load Tcl using the stubs mechanism
397397
#
398398
# FOSSIL_ENABLE_TCL_STUBS = 1
399
+
400
+#### Load Tcl using the "fake" stubs mechanism
401
+#
402
+# FOSSIL_ENABLE_TCL_FAKE_STUBS = 1
399403
400404
#### Use the Tcl source directory instead of the install directory?
401405
# This is useful when Tcl has been compiled statically with MinGW.
402406
#
403407
FOSSIL_TCL_SOURCE = 1
@@ -449,11 +453,15 @@
449453
TCLINCDIR = $(TCLDIR)/include
450454
TCLLIBDIR = $(TCLDIR)/lib
451455
452456
#### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
453457
#
454
-ifndef FOSSIL_ENABLE_TCL_STUBS
458
+ifdef FOSSIL_ENABLE_TCL_STUBS
459
+ifndef FOSSIL_ENABLE_TCL_FAKE_STUBS
460
+LIBTCL = -ltclstub86
461
+endif
462
+else
455463
LIBTCL = -ltcl86
456464
endif
457465
458466
#### C Compile and options for use in building executables that
459467
# will run on the target platform. This is usually the same
@@ -510,10 +518,14 @@
510518
RCC += -DFOSSIL_ENABLE_TCL=1
511519
# Either statically linked or via stubs
512520
ifdef FOSSIL_ENABLE_TCL_STUBS
513521
TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
514522
RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
523
+ifdef FOSSIL_ENABLE_TCL_FAKE_STUBS
524
+TCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
525
+RCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
526
+endif
515527
else
516528
TCC += -DSTATIC_BUILD
517529
RCC += -DSTATIC_BUILD
518530
endif
519531
endif
520532
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -394,10 +394,14 @@
394 # FOSSIL_ENABLE_TCL = 1
395
396 #### Load Tcl using the stubs mechanism
397 #
398 # FOSSIL_ENABLE_TCL_STUBS = 1
 
 
 
 
399
400 #### Use the Tcl source directory instead of the install directory?
401 # This is useful when Tcl has been compiled statically with MinGW.
402 #
403 FOSSIL_TCL_SOURCE = 1
@@ -449,11 +453,15 @@
449 TCLINCDIR = $(TCLDIR)/include
450 TCLLIBDIR = $(TCLDIR)/lib
451
452 #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
453 #
454 ifndef FOSSIL_ENABLE_TCL_STUBS
 
 
 
 
455 LIBTCL = -ltcl86
456 endif
457
458 #### C Compile and options for use in building executables that
459 # will run on the target platform. This is usually the same
@@ -510,10 +518,14 @@
510 RCC += -DFOSSIL_ENABLE_TCL=1
511 # Either statically linked or via stubs
512 ifdef FOSSIL_ENABLE_TCL_STUBS
513 TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
514 RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
 
 
 
 
515 else
516 TCC += -DSTATIC_BUILD
517 RCC += -DSTATIC_BUILD
518 endif
519 endif
520
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -394,10 +394,14 @@
394 # FOSSIL_ENABLE_TCL = 1
395
396 #### Load Tcl using the stubs mechanism
397 #
398 # FOSSIL_ENABLE_TCL_STUBS = 1
399
400 #### Load Tcl using the "fake" stubs mechanism
401 #
402 # FOSSIL_ENABLE_TCL_FAKE_STUBS = 1
403
404 #### Use the Tcl source directory instead of the install directory?
405 # This is useful when Tcl has been compiled statically with MinGW.
406 #
407 FOSSIL_TCL_SOURCE = 1
@@ -449,11 +453,15 @@
453 TCLINCDIR = $(TCLDIR)/include
454 TCLLIBDIR = $(TCLDIR)/lib
455
456 #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
457 #
458 ifdef FOSSIL_ENABLE_TCL_STUBS
459 ifndef FOSSIL_ENABLE_TCL_FAKE_STUBS
460 LIBTCL = -ltclstub86
461 endif
462 else
463 LIBTCL = -ltcl86
464 endif
465
466 #### C Compile and options for use in building executables that
467 # will run on the target platform. This is usually the same
@@ -510,10 +518,14 @@
518 RCC += -DFOSSIL_ENABLE_TCL=1
519 # Either statically linked or via stubs
520 ifdef FOSSIL_ENABLE_TCL_STUBS
521 TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
522 RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
523 ifdef FOSSIL_ENABLE_TCL_FAKE_STUBS
524 TCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
525 RCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
526 endif
527 else
528 TCC += -DSTATIC_BUILD
529 RCC += -DSTATIC_BUILD
530 endif
531 endif
532
+101 -31
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -119,29 +119,27 @@
119119
# define TCL_FINDEXECUTABLE_NAME "_Tcl_FindExecutable"
120120
# endif
121121
# ifndef TCL_CREATEINTERP_NAME
122122
# define TCL_CREATEINTERP_NAME "_Tcl_CreateInterp"
123123
# endif
124
-#define tclStubsPtr staticTclStubsPtr
125
-static const TclStubs *tclStubsPtr = NULL;
126
-typedef struct {
127
- char *notused1;
128
- Tcl_FreeProc *notused2;
129
- int notused3;
130
- const struct TclStubs *stubTable;
131
-} Interp;
124
+# ifndef TCL_DELETEINTERP_NAME
125
+# define TCL_DELETEINTERP_NAME "_Tcl_DeleteInterp"
126
+# endif
132127
#endif /* defined(USE_TCL_STUBS) */
133128
134129
/*
135130
** The function types for Tcl_FindExecutable and Tcl_CreateInterp are needed
136131
** when the Tcl library is being loaded dynamically by a stubs-enabled
137132
** application (i.e. the inverse of using a stubs-enabled package). These are
138133
** the only Tcl API functions that MUST be called prior to being able to call
139
-** Tcl_InitStubs (i.e. because it requires a Tcl interpreter).
134
+** Tcl_InitStubs (i.e. because it requires a Tcl interpreter). For complete
135
+** cleanup if the Tcl stubs initialization fails somehow, the Tcl_DeleteInterp
136
+** function type is also required.
140137
*/
141138
typedef void (tcl_FindExecutableProc) (const char * argv0);
142139
typedef Tcl_Interp *(tcl_CreateInterpProc) (void);
140
+typedef void (tcl_DeleteInterpProc) (Tcl_Interp *interp);
143141
144142
/*
145143
** The function types for the "hook" functions to be called before and after a
146144
** TH1 command makes a call to evaluate a Tcl script. If the "pre" function
147145
** returns anything but TH_OK, then evaluation of the Tcl script is skipped and
@@ -157,10 +155,65 @@
157155
const char **argv, /* Array of arguments for the TH1 command. */
158156
int *argl, /* Array of lengths for the TH1 command arguments. */
159157
int rc /* Recommended notification return value. */
160158
);
161159
160
+/*
161
+** Are we using our own private implementation of the Tcl stubs mechanism? If
162
+** this is enabled, it prevents the user from having to link against the Tcl
163
+** stubs library for the target platform, which may not be readily available.
164
+ */
165
+#if defined(FOSSIL_ENABLE_TCL_FAKE_STUBS)
166
+/*
167
+** HACK: Using some preprocessor magic and a private static variable, redirect
168
+** the Tcl API calls [found within this file] to the function pointers
169
+** that will be contained in our private Tcl stubs table. This takes
170
+** advantage of the fact that the Tcl headers always define the Tcl API
171
+** functions in terms of the "tclStubsPtr" variable.
172
+ */
173
+#define tclStubsPtr privateTclStubsPtr
174
+static const TclStubs *tclStubsPtr = NULL;
175
+
176
+/*
177
+** Create a Tcl interpreter structure that mirrors just enough fields to get
178
+** it up and running successfully with our private implementation of the Tcl
179
+** stubs mechanism.
180
+ */
181
+struct PrivateTclInterp {
182
+ char *result;
183
+ Tcl_FreeProc *freeProc;
184
+ int errorLine;
185
+ const struct TclStubs *stubTable;
186
+};
187
+
188
+/*
189
+** Fossil can now be compiled without linking to the actual Tcl stubs library.
190
+** In that case, this function will be used to perform those steps that would
191
+** normally be performed within the Tcl stubs library.
192
+ */
193
+static int initTclStubs(
194
+ Th_Interp *interp,
195
+ Tcl_Interp *tclInterp
196
+){
197
+ tclStubsPtr = ((struct PrivateTclInterp *)tclInterp)->stubTable;
198
+ if( !tclStubsPtr || (tclStubsPtr->magic!=TCL_STUB_MAGIC) ){
199
+ Th_ErrorMessage(interp,
200
+ "could not initialize Tcl stubs: incompatible mechanism",
201
+ (const char *)"", 0);
202
+ return TH_ERROR;
203
+ }
204
+ /* NOTE: At this point, the Tcl API functions should be available. */
205
+ if( Tcl_PkgRequireEx(tclInterp, "Tcl", "8.4", 0, (void *)&tclStubsPtr)==0 ){
206
+ Th_ErrorMessage(interp,
207
+ "could not create Tcl interpreter: incompatible version",
208
+ (const char *)"", 0);
209
+ return TH_ERROR;
210
+ }
211
+ return TH_OK;
212
+}
213
+#endif
214
+
162215
/*
163216
** Creates and initializes a Tcl interpreter for use with the specified TH1
164217
** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
165218
** by the caller. This must be declared here because quite a few functions in
166219
** this file need to use it before it can be defined.
@@ -197,10 +250,11 @@
197250
int argc; /* Number of original arguments. */
198251
char **argv; /* Full copy of the original arguments. */
199252
void *library; /* The Tcl library module handle. */
200253
tcl_FindExecutableProc *xFindExecutable; /* Tcl_FindExecutable() pointer. */
201254
tcl_CreateInterpProc *xCreateInterp; /* Tcl_CreateInterp() pointer. */
255
+ tcl_DeleteInterpProc *xDeleteInterp; /* Tcl_DeleteInterp() pointer. */
202256
Tcl_Interp *interp; /* The on-demand created Tcl interpreter. */
203257
char *setup; /* The optional Tcl setup script. */
204258
tcl_NotifyProc *xPreEval; /* Optional, called before Tcl_Eval*(). */
205259
void *pPreContext; /* Optional, provided to xPreEval(). */
206260
tcl_NotifyProc *xPostEval; /* Optional, called after Tcl_Eval*(). */
@@ -534,11 +588,12 @@
534588
*/
535589
static int loadTcl(
536590
Th_Interp *interp,
537591
void **pLibrary,
538592
tcl_FindExecutableProc **pxFindExecutable,
539
- tcl_CreateInterpProc **pxCreateInterp
593
+ tcl_CreateInterpProc **pxCreateInterp,
594
+ tcl_DeleteInterpProc **pxDeleteInterp
540595
){
541596
#if defined(USE_TCL_STUBS)
542597
char fileName[] = TCL_LIBRARY_NAME;
543598
#endif
544599
if( !pLibrary || !pxFindExecutable || !pxCreateInterp ){
@@ -550,10 +605,11 @@
550605
do {
551606
void *library = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL);
552607
if( library ){
553608
tcl_FindExecutableProc *xFindExecutable;
554609
tcl_CreateInterpProc *xCreateInterp;
610
+ tcl_DeleteInterpProc *xDeleteInterp;
555611
const char *procName = TCL_FINDEXECUTABLE_NAME;
556612
xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName + 1);
557613
if( !xFindExecutable ){
558614
xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName);
559615
}
@@ -571,14 +627,26 @@
571627
if( !xCreateInterp ){
572628
Th_ErrorMessage(interp,
573629
"could not locate Tcl_CreateInterp", (const char *)"", 0);
574630
dlclose(library);
575631
return TH_ERROR;
632
+ }
633
+ procName = TCL_DELETEINTERP_NAME;
634
+ xDeleteInterp = (tcl_DeleteInterpProc *)dlsym(library, procName + 1);
635
+ if( !xDeleteInterp ){
636
+ xDeleteInterp = (tcl_DeleteInterpProc *)dlsym(library, procName);
637
+ }
638
+ if( !xDeleteInterp ){
639
+ Th_ErrorMessage(interp,
640
+ "could not locate Tcl_DeleteInterp", (const char *)"", 0);
641
+ dlclose(library);
642
+ return TH_ERROR;
576643
}
577644
*pLibrary = library;
578645
*pxFindExecutable = xFindExecutable;
579646
*pxCreateInterp = xCreateInterp;
647
+ *pxDeleteInterp = xDeleteInterp;
580648
return TH_OK;
581649
}
582650
} while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */
583651
Th_ErrorMessage(interp,
584652
"could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"",
@@ -671,43 +739,45 @@
671739
}
672740
if ( tclContext->interp ){
673741
return TH_OK;
674742
}
675743
if( loadTcl(interp, &tclContext->library, &tclContext->xFindExecutable,
676
- &tclContext->xCreateInterp)!=TH_OK ){
744
+ &tclContext->xCreateInterp, &tclContext->xDeleteInterp)!=TH_OK ){
677745
return TH_ERROR;
678746
}
679747
argc = tclContext->argc;
680748
argv = tclContext->argv;
681749
if( argc>0 && argv ){
682750
argv0 = argv[0];
683751
}
684752
tclContext->xFindExecutable(argv0);
685753
tclInterp = tclContext->xCreateInterp();
686
-
687
-#if defined(USE_TCL_STUBS)
688
- if( tclInterp ){
689
- tclStubsPtr = ((Interp *) tclInterp)->stubTable;
690
- if (!tclStubsPtr || (tclStubsPtr->magic != TCL_STUB_MAGIC)) {
691
- Th_ErrorMessage(interp,
692
- "could not create Tcl interpreter: "
693
- "incompatible stubs mechanism", (const char *)"", 0);
694
- return TH_ERROR;
695
- }
696
- if( Tcl_PkgRequireEx(tclInterp, "Tcl", "8.4", 0, (void *)&tclStubsPtr)==0 ){
697
- Th_ErrorMessage(interp,
698
- "could not create Tcl interpreter: "
699
- "incompatible version", (const char *)"", 0);
700
- return TH_ERROR;
701
- }
702
- }
703
-#endif
704
- if( !tclInterp ||
705
- Tcl_InterpDeleted(tclInterp) ){
754
+ if( !tclInterp ){
706755
Th_ErrorMessage(interp,
707756
"could not create Tcl interpreter", (const char *)"", 0);
708757
return TH_ERROR;
758
+ }
759
+#if defined(USE_TCL_STUBS)
760
+#if defined(FOSSIL_ENABLE_TCL_FAKE_STUBS)
761
+ if( initTclStubs(interp, tclInterp)!=TH_OK ){
762
+ tclContext->xDeleteInterp(tclInterp);
763
+ return TH_ERROR;
764
+ }
765
+#else
766
+ if( !Tcl_InitStubs(tclInterp, "8.4", 0) ){
767
+ Th_ErrorMessage(interp,
768
+ "could not initialize Tcl stubs", (const char *)"", 0);
769
+ tclContext->xDeleteInterp(tclInterp);
770
+ return TH_ERROR;
771
+ }
772
+#endif /* defined(FOSSIL_ENABLE_TCL_FAKE_STUBS) */
773
+#endif /* defined(USE_TCL_STUBS) */
774
+ if( Tcl_InterpDeleted(tclInterp) ){
775
+ Th_ErrorMessage(interp,
776
+ "Tcl interpreter appears to be deleted", (const char *)"", 0);
777
+ tclContext->xDeleteInterp(tclInterp); /* TODO: Redundant? */
778
+ return TH_ERROR;
709779
}
710780
tclContext->interp = tclInterp;
711781
if( Tcl_Init(tclInterp)!=TCL_OK ){
712782
Th_ErrorMessage(interp,
713783
"Tcl initialization error:", Tcl_GetStringResult(tclInterp), -1);
714784
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -119,29 +119,27 @@
119 # define TCL_FINDEXECUTABLE_NAME "_Tcl_FindExecutable"
120 # endif
121 # ifndef TCL_CREATEINTERP_NAME
122 # define TCL_CREATEINTERP_NAME "_Tcl_CreateInterp"
123 # endif
124 #define tclStubsPtr staticTclStubsPtr
125 static const TclStubs *tclStubsPtr = NULL;
126 typedef struct {
127 char *notused1;
128 Tcl_FreeProc *notused2;
129 int notused3;
130 const struct TclStubs *stubTable;
131 } Interp;
132 #endif /* defined(USE_TCL_STUBS) */
133
134 /*
135 ** The function types for Tcl_FindExecutable and Tcl_CreateInterp are needed
136 ** when the Tcl library is being loaded dynamically by a stubs-enabled
137 ** application (i.e. the inverse of using a stubs-enabled package). These are
138 ** the only Tcl API functions that MUST be called prior to being able to call
139 ** Tcl_InitStubs (i.e. because it requires a Tcl interpreter).
 
 
140 */
141 typedef void (tcl_FindExecutableProc) (const char * argv0);
142 typedef Tcl_Interp *(tcl_CreateInterpProc) (void);
 
143
144 /*
145 ** The function types for the "hook" functions to be called before and after a
146 ** TH1 command makes a call to evaluate a Tcl script. If the "pre" function
147 ** returns anything but TH_OK, then evaluation of the Tcl script is skipped and
@@ -157,10 +155,65 @@
157 const char **argv, /* Array of arguments for the TH1 command. */
158 int *argl, /* Array of lengths for the TH1 command arguments. */
159 int rc /* Recommended notification return value. */
160 );
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162 /*
163 ** Creates and initializes a Tcl interpreter for use with the specified TH1
164 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
165 ** by the caller. This must be declared here because quite a few functions in
166 ** this file need to use it before it can be defined.
@@ -197,10 +250,11 @@
197 int argc; /* Number of original arguments. */
198 char **argv; /* Full copy of the original arguments. */
199 void *library; /* The Tcl library module handle. */
200 tcl_FindExecutableProc *xFindExecutable; /* Tcl_FindExecutable() pointer. */
201 tcl_CreateInterpProc *xCreateInterp; /* Tcl_CreateInterp() pointer. */
 
202 Tcl_Interp *interp; /* The on-demand created Tcl interpreter. */
203 char *setup; /* The optional Tcl setup script. */
204 tcl_NotifyProc *xPreEval; /* Optional, called before Tcl_Eval*(). */
205 void *pPreContext; /* Optional, provided to xPreEval(). */
206 tcl_NotifyProc *xPostEval; /* Optional, called after Tcl_Eval*(). */
@@ -534,11 +588,12 @@
534 */
535 static int loadTcl(
536 Th_Interp *interp,
537 void **pLibrary,
538 tcl_FindExecutableProc **pxFindExecutable,
539 tcl_CreateInterpProc **pxCreateInterp
 
540 ){
541 #if defined(USE_TCL_STUBS)
542 char fileName[] = TCL_LIBRARY_NAME;
543 #endif
544 if( !pLibrary || !pxFindExecutable || !pxCreateInterp ){
@@ -550,10 +605,11 @@
550 do {
551 void *library = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL);
552 if( library ){
553 tcl_FindExecutableProc *xFindExecutable;
554 tcl_CreateInterpProc *xCreateInterp;
 
555 const char *procName = TCL_FINDEXECUTABLE_NAME;
556 xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName + 1);
557 if( !xFindExecutable ){
558 xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName);
559 }
@@ -571,14 +627,26 @@
571 if( !xCreateInterp ){
572 Th_ErrorMessage(interp,
573 "could not locate Tcl_CreateInterp", (const char *)"", 0);
574 dlclose(library);
575 return TH_ERROR;
 
 
 
 
 
 
 
 
 
 
 
576 }
577 *pLibrary = library;
578 *pxFindExecutable = xFindExecutable;
579 *pxCreateInterp = xCreateInterp;
 
580 return TH_OK;
581 }
582 } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */
583 Th_ErrorMessage(interp,
584 "could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"",
@@ -671,43 +739,45 @@
671 }
672 if ( tclContext->interp ){
673 return TH_OK;
674 }
675 if( loadTcl(interp, &tclContext->library, &tclContext->xFindExecutable,
676 &tclContext->xCreateInterp)!=TH_OK ){
677 return TH_ERROR;
678 }
679 argc = tclContext->argc;
680 argv = tclContext->argv;
681 if( argc>0 && argv ){
682 argv0 = argv[0];
683 }
684 tclContext->xFindExecutable(argv0);
685 tclInterp = tclContext->xCreateInterp();
686
687 #if defined(USE_TCL_STUBS)
688 if( tclInterp ){
689 tclStubsPtr = ((Interp *) tclInterp)->stubTable;
690 if (!tclStubsPtr || (tclStubsPtr->magic != TCL_STUB_MAGIC)) {
691 Th_ErrorMessage(interp,
692 "could not create Tcl interpreter: "
693 "incompatible stubs mechanism", (const char *)"", 0);
694 return TH_ERROR;
695 }
696 if( Tcl_PkgRequireEx(tclInterp, "Tcl", "8.4", 0, (void *)&tclStubsPtr)==0 ){
697 Th_ErrorMessage(interp,
698 "could not create Tcl interpreter: "
699 "incompatible version", (const char *)"", 0);
700 return TH_ERROR;
701 }
702 }
703 #endif
704 if( !tclInterp ||
705 Tcl_InterpDeleted(tclInterp) ){
706 Th_ErrorMessage(interp,
707 "could not create Tcl interpreter", (const char *)"", 0);
708 return TH_ERROR;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709 }
710 tclContext->interp = tclInterp;
711 if( Tcl_Init(tclInterp)!=TCL_OK ){
712 Th_ErrorMessage(interp,
713 "Tcl initialization error:", Tcl_GetStringResult(tclInterp), -1);
714
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -119,29 +119,27 @@
119 # define TCL_FINDEXECUTABLE_NAME "_Tcl_FindExecutable"
120 # endif
121 # ifndef TCL_CREATEINTERP_NAME
122 # define TCL_CREATEINTERP_NAME "_Tcl_CreateInterp"
123 # endif
124 # ifndef TCL_DELETEINTERP_NAME
125 # define TCL_DELETEINTERP_NAME "_Tcl_DeleteInterp"
126 # endif
 
 
 
 
 
127 #endif /* defined(USE_TCL_STUBS) */
128
129 /*
130 ** The function types for Tcl_FindExecutable and Tcl_CreateInterp are needed
131 ** when the Tcl library is being loaded dynamically by a stubs-enabled
132 ** application (i.e. the inverse of using a stubs-enabled package). These are
133 ** the only Tcl API functions that MUST be called prior to being able to call
134 ** Tcl_InitStubs (i.e. because it requires a Tcl interpreter). For complete
135 ** cleanup if the Tcl stubs initialization fails somehow, the Tcl_DeleteInterp
136 ** function type is also required.
137 */
138 typedef void (tcl_FindExecutableProc) (const char * argv0);
139 typedef Tcl_Interp *(tcl_CreateInterpProc) (void);
140 typedef void (tcl_DeleteInterpProc) (Tcl_Interp *interp);
141
142 /*
143 ** The function types for the "hook" functions to be called before and after a
144 ** TH1 command makes a call to evaluate a Tcl script. If the "pre" function
145 ** returns anything but TH_OK, then evaluation of the Tcl script is skipped and
@@ -157,10 +155,65 @@
155 const char **argv, /* Array of arguments for the TH1 command. */
156 int *argl, /* Array of lengths for the TH1 command arguments. */
157 int rc /* Recommended notification return value. */
158 );
159
160 /*
161 ** Are we using our own private implementation of the Tcl stubs mechanism? If
162 ** this is enabled, it prevents the user from having to link against the Tcl
163 ** stubs library for the target platform, which may not be readily available.
164 */
165 #if defined(FOSSIL_ENABLE_TCL_FAKE_STUBS)
166 /*
167 ** HACK: Using some preprocessor magic and a private static variable, redirect
168 ** the Tcl API calls [found within this file] to the function pointers
169 ** that will be contained in our private Tcl stubs table. This takes
170 ** advantage of the fact that the Tcl headers always define the Tcl API
171 ** functions in terms of the "tclStubsPtr" variable.
172 */
173 #define tclStubsPtr privateTclStubsPtr
174 static const TclStubs *tclStubsPtr = NULL;
175
176 /*
177 ** Create a Tcl interpreter structure that mirrors just enough fields to get
178 ** it up and running successfully with our private implementation of the Tcl
179 ** stubs mechanism.
180 */
181 struct PrivateTclInterp {
182 char *result;
183 Tcl_FreeProc *freeProc;
184 int errorLine;
185 const struct TclStubs *stubTable;
186 };
187
188 /*
189 ** Fossil can now be compiled without linking to the actual Tcl stubs library.
190 ** In that case, this function will be used to perform those steps that would
191 ** normally be performed within the Tcl stubs library.
192 */
193 static int initTclStubs(
194 Th_Interp *interp,
195 Tcl_Interp *tclInterp
196 ){
197 tclStubsPtr = ((struct PrivateTclInterp *)tclInterp)->stubTable;
198 if( !tclStubsPtr || (tclStubsPtr->magic!=TCL_STUB_MAGIC) ){
199 Th_ErrorMessage(interp,
200 "could not initialize Tcl stubs: incompatible mechanism",
201 (const char *)"", 0);
202 return TH_ERROR;
203 }
204 /* NOTE: At this point, the Tcl API functions should be available. */
205 if( Tcl_PkgRequireEx(tclInterp, "Tcl", "8.4", 0, (void *)&tclStubsPtr)==0 ){
206 Th_ErrorMessage(interp,
207 "could not create Tcl interpreter: incompatible version",
208 (const char *)"", 0);
209 return TH_ERROR;
210 }
211 return TH_OK;
212 }
213 #endif
214
215 /*
216 ** Creates and initializes a Tcl interpreter for use with the specified TH1
217 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
218 ** by the caller. This must be declared here because quite a few functions in
219 ** this file need to use it before it can be defined.
@@ -197,10 +250,11 @@
250 int argc; /* Number of original arguments. */
251 char **argv; /* Full copy of the original arguments. */
252 void *library; /* The Tcl library module handle. */
253 tcl_FindExecutableProc *xFindExecutable; /* Tcl_FindExecutable() pointer. */
254 tcl_CreateInterpProc *xCreateInterp; /* Tcl_CreateInterp() pointer. */
255 tcl_DeleteInterpProc *xDeleteInterp; /* Tcl_DeleteInterp() pointer. */
256 Tcl_Interp *interp; /* The on-demand created Tcl interpreter. */
257 char *setup; /* The optional Tcl setup script. */
258 tcl_NotifyProc *xPreEval; /* Optional, called before Tcl_Eval*(). */
259 void *pPreContext; /* Optional, provided to xPreEval(). */
260 tcl_NotifyProc *xPostEval; /* Optional, called after Tcl_Eval*(). */
@@ -534,11 +588,12 @@
588 */
589 static int loadTcl(
590 Th_Interp *interp,
591 void **pLibrary,
592 tcl_FindExecutableProc **pxFindExecutable,
593 tcl_CreateInterpProc **pxCreateInterp,
594 tcl_DeleteInterpProc **pxDeleteInterp
595 ){
596 #if defined(USE_TCL_STUBS)
597 char fileName[] = TCL_LIBRARY_NAME;
598 #endif
599 if( !pLibrary || !pxFindExecutable || !pxCreateInterp ){
@@ -550,10 +605,11 @@
605 do {
606 void *library = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL);
607 if( library ){
608 tcl_FindExecutableProc *xFindExecutable;
609 tcl_CreateInterpProc *xCreateInterp;
610 tcl_DeleteInterpProc *xDeleteInterp;
611 const char *procName = TCL_FINDEXECUTABLE_NAME;
612 xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName + 1);
613 if( !xFindExecutable ){
614 xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName);
615 }
@@ -571,14 +627,26 @@
627 if( !xCreateInterp ){
628 Th_ErrorMessage(interp,
629 "could not locate Tcl_CreateInterp", (const char *)"", 0);
630 dlclose(library);
631 return TH_ERROR;
632 }
633 procName = TCL_DELETEINTERP_NAME;
634 xDeleteInterp = (tcl_DeleteInterpProc *)dlsym(library, procName + 1);
635 if( !xDeleteInterp ){
636 xDeleteInterp = (tcl_DeleteInterpProc *)dlsym(library, procName);
637 }
638 if( !xDeleteInterp ){
639 Th_ErrorMessage(interp,
640 "could not locate Tcl_DeleteInterp", (const char *)"", 0);
641 dlclose(library);
642 return TH_ERROR;
643 }
644 *pLibrary = library;
645 *pxFindExecutable = xFindExecutable;
646 *pxCreateInterp = xCreateInterp;
647 *pxDeleteInterp = xDeleteInterp;
648 return TH_OK;
649 }
650 } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */
651 Th_ErrorMessage(interp,
652 "could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"",
@@ -671,43 +739,45 @@
739 }
740 if ( tclContext->interp ){
741 return TH_OK;
742 }
743 if( loadTcl(interp, &tclContext->library, &tclContext->xFindExecutable,
744 &tclContext->xCreateInterp, &tclContext->xDeleteInterp)!=TH_OK ){
745 return TH_ERROR;
746 }
747 argc = tclContext->argc;
748 argv = tclContext->argv;
749 if( argc>0 && argv ){
750 argv0 = argv[0];
751 }
752 tclContext->xFindExecutable(argv0);
753 tclInterp = tclContext->xCreateInterp();
754 if( !tclInterp ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755 Th_ErrorMessage(interp,
756 "could not create Tcl interpreter", (const char *)"", 0);
757 return TH_ERROR;
758 }
759 #if defined(USE_TCL_STUBS)
760 #if defined(FOSSIL_ENABLE_TCL_FAKE_STUBS)
761 if( initTclStubs(interp, tclInterp)!=TH_OK ){
762 tclContext->xDeleteInterp(tclInterp);
763 return TH_ERROR;
764 }
765 #else
766 if( !Tcl_InitStubs(tclInterp, "8.4", 0) ){
767 Th_ErrorMessage(interp,
768 "could not initialize Tcl stubs", (const char *)"", 0);
769 tclContext->xDeleteInterp(tclInterp);
770 return TH_ERROR;
771 }
772 #endif /* defined(FOSSIL_ENABLE_TCL_FAKE_STUBS) */
773 #endif /* defined(USE_TCL_STUBS) */
774 if( Tcl_InterpDeleted(tclInterp) ){
775 Th_ErrorMessage(interp,
776 "Tcl interpreter appears to be deleted", (const char *)"", 0);
777 tclContext->xDeleteInterp(tclInterp); /* TODO: Redundant? */
778 return TH_ERROR;
779 }
780 tclContext->interp = tclInterp;
781 if( Tcl_Init(tclInterp)!=TCL_OK ){
782 Th_ErrorMessage(interp,
783 "Tcl initialization error:", Tcl_GetStringResult(tclInterp), -1);
784
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -55,10 +55,14 @@
5555
# FOSSIL_ENABLE_TCL = 1
5656
5757
#### Load Tcl using the stubs mechanism
5858
#
5959
# FOSSIL_ENABLE_TCL_STUBS = 1
60
+
61
+#### Load Tcl using the "fake" stubs mechanism
62
+#
63
+# FOSSIL_ENABLE_TCL_FAKE_STUBS = 1
6064
6165
#### Use the Tcl source directory instead of the install directory?
6266
# This is useful when Tcl has been compiled statically with MinGW.
6367
#
6468
FOSSIL_TCL_SOURCE = 1
@@ -110,11 +114,15 @@
110114
TCLINCDIR = $(TCLDIR)/include
111115
TCLLIBDIR = $(TCLDIR)/lib
112116
113117
#### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
114118
#
115
-ifndef FOSSIL_ENABLE_TCL_STUBS
119
+ifdef FOSSIL_ENABLE_TCL_STUBS
120
+ifndef FOSSIL_ENABLE_TCL_FAKE_STUBS
121
+LIBTCL = -ltclstub86
122
+endif
123
+else
116124
LIBTCL = -ltcl86
117125
endif
118126
119127
#### C Compile and options for use in building executables that
120128
# will run on the target platform. This is usually the same
@@ -171,10 +179,14 @@
171179
RCC += -DFOSSIL_ENABLE_TCL=1
172180
# Either statically linked or via stubs
173181
ifdef FOSSIL_ENABLE_TCL_STUBS
174182
TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
175183
RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
184
+ifdef FOSSIL_ENABLE_TCL_FAKE_STUBS
185
+TCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
186
+RCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
187
+endif
176188
else
177189
TCC += -DSTATIC_BUILD
178190
RCC += -DSTATIC_BUILD
179191
endif
180192
endif
181193
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -55,10 +55,14 @@
55 # FOSSIL_ENABLE_TCL = 1
56
57 #### Load Tcl using the stubs mechanism
58 #
59 # FOSSIL_ENABLE_TCL_STUBS = 1
 
 
 
 
60
61 #### Use the Tcl source directory instead of the install directory?
62 # This is useful when Tcl has been compiled statically with MinGW.
63 #
64 FOSSIL_TCL_SOURCE = 1
@@ -110,11 +114,15 @@
110 TCLINCDIR = $(TCLDIR)/include
111 TCLLIBDIR = $(TCLDIR)/lib
112
113 #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
114 #
115 ifndef FOSSIL_ENABLE_TCL_STUBS
 
 
 
 
116 LIBTCL = -ltcl86
117 endif
118
119 #### C Compile and options for use in building executables that
120 # will run on the target platform. This is usually the same
@@ -171,10 +179,14 @@
171 RCC += -DFOSSIL_ENABLE_TCL=1
172 # Either statically linked or via stubs
173 ifdef FOSSIL_ENABLE_TCL_STUBS
174 TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
175 RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
 
 
 
 
176 else
177 TCC += -DSTATIC_BUILD
178 RCC += -DSTATIC_BUILD
179 endif
180 endif
181
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -55,10 +55,14 @@
55 # FOSSIL_ENABLE_TCL = 1
56
57 #### Load Tcl using the stubs mechanism
58 #
59 # FOSSIL_ENABLE_TCL_STUBS = 1
60
61 #### Load Tcl using the "fake" stubs mechanism
62 #
63 # FOSSIL_ENABLE_TCL_FAKE_STUBS = 1
64
65 #### Use the Tcl source directory instead of the install directory?
66 # This is useful when Tcl has been compiled statically with MinGW.
67 #
68 FOSSIL_TCL_SOURCE = 1
@@ -110,11 +114,15 @@
114 TCLINCDIR = $(TCLDIR)/include
115 TCLLIBDIR = $(TCLDIR)/lib
116
117 #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
118 #
119 ifdef FOSSIL_ENABLE_TCL_STUBS
120 ifndef FOSSIL_ENABLE_TCL_FAKE_STUBS
121 LIBTCL = -ltclstub86
122 endif
123 else
124 LIBTCL = -ltcl86
125 endif
126
127 #### C Compile and options for use in building executables that
128 # will run on the target platform. This is usually the same
@@ -171,10 +179,14 @@
179 RCC += -DFOSSIL_ENABLE_TCL=1
180 # Either statically linked or via stubs
181 ifdef FOSSIL_ENABLE_TCL_STUBS
182 TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
183 RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
184 ifdef FOSSIL_ENABLE_TCL_FAKE_STUBS
185 TCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
186 RCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
187 endif
188 else
189 TCC += -DSTATIC_BUILD
190 RCC += -DSTATIC_BUILD
191 endif
192 endif
193
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -55,10 +55,14 @@
5555
FOSSIL_ENABLE_TCL = 1
5656
5757
#### Load Tcl using the stubs mechanism
5858
#
5959
FOSSIL_ENABLE_TCL_STUBS = 1
60
+
61
+#### Load Tcl using the "fake" stubs mechanism
62
+#
63
+FOSSIL_ENABLE_TCL_FAKE_STUBS = 1
6064
6165
#### Use the Tcl source directory instead of the install directory?
6266
# This is useful when Tcl has been compiled statically with MinGW.
6367
#
6468
FOSSIL_TCL_SOURCE = 1
@@ -110,11 +114,15 @@
110114
TCLINCDIR = $(TCLDIR)/include
111115
TCLLIBDIR = $(TCLDIR)/lib
112116
113117
#### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
114118
#
115
-ifndef FOSSIL_ENABLE_TCL_STUBS
119
+ifdef FOSSIL_ENABLE_TCL_STUBS
120
+ifndef FOSSIL_ENABLE_TCL_FAKE_STUBS
121
+LIBTCL = -ltclstub86
122
+endif
123
+else
116124
LIBTCL = -ltcl86
117125
endif
118126
119127
#### C Compile and options for use in building executables that
120128
# will run on the target platform. This is usually the same
@@ -171,10 +179,14 @@
171179
RCC += -DFOSSIL_ENABLE_TCL=1
172180
# Either statically linked or via stubs
173181
ifdef FOSSIL_ENABLE_TCL_STUBS
174182
TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
175183
RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
184
+ifdef FOSSIL_ENABLE_TCL_FAKE_STUBS
185
+TCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
186
+RCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
187
+endif
176188
else
177189
TCC += -DSTATIC_BUILD
178190
RCC += -DSTATIC_BUILD
179191
endif
180192
endif
181193
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -55,10 +55,14 @@
55 FOSSIL_ENABLE_TCL = 1
56
57 #### Load Tcl using the stubs mechanism
58 #
59 FOSSIL_ENABLE_TCL_STUBS = 1
 
 
 
 
60
61 #### Use the Tcl source directory instead of the install directory?
62 # This is useful when Tcl has been compiled statically with MinGW.
63 #
64 FOSSIL_TCL_SOURCE = 1
@@ -110,11 +114,15 @@
110 TCLINCDIR = $(TCLDIR)/include
111 TCLLIBDIR = $(TCLDIR)/lib
112
113 #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
114 #
115 ifndef FOSSIL_ENABLE_TCL_STUBS
 
 
 
 
116 LIBTCL = -ltcl86
117 endif
118
119 #### C Compile and options for use in building executables that
120 # will run on the target platform. This is usually the same
@@ -171,10 +179,14 @@
171 RCC += -DFOSSIL_ENABLE_TCL=1
172 # Either statically linked or via stubs
173 ifdef FOSSIL_ENABLE_TCL_STUBS
174 TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
175 RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
 
 
 
 
176 else
177 TCC += -DSTATIC_BUILD
178 RCC += -DSTATIC_BUILD
179 endif
180 endif
181
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -55,10 +55,14 @@
55 FOSSIL_ENABLE_TCL = 1
56
57 #### Load Tcl using the stubs mechanism
58 #
59 FOSSIL_ENABLE_TCL_STUBS = 1
60
61 #### Load Tcl using the "fake" stubs mechanism
62 #
63 FOSSIL_ENABLE_TCL_FAKE_STUBS = 1
64
65 #### Use the Tcl source directory instead of the install directory?
66 # This is useful when Tcl has been compiled statically with MinGW.
67 #
68 FOSSIL_TCL_SOURCE = 1
@@ -110,11 +114,15 @@
114 TCLINCDIR = $(TCLDIR)/include
115 TCLLIBDIR = $(TCLDIR)/lib
116
117 #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
118 #
119 ifdef FOSSIL_ENABLE_TCL_STUBS
120 ifndef FOSSIL_ENABLE_TCL_FAKE_STUBS
121 LIBTCL = -ltclstub86
122 endif
123 else
124 LIBTCL = -ltcl86
125 endif
126
127 #### C Compile and options for use in building executables that
128 # will run on the target platform. This is usually the same
@@ -171,10 +179,14 @@
179 RCC += -DFOSSIL_ENABLE_TCL=1
180 # Either statically linked or via stubs
181 ifdef FOSSIL_ENABLE_TCL_STUBS
182 TCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
183 RCC += -DFOSSIL_ENABLE_TCL_STUBS=1 -DUSE_TCL_STUBS
184 ifdef FOSSIL_ENABLE_TCL_FAKE_STUBS
185 TCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
186 RCC += -DFOSSIL_ENABLE_TCL_FAKE_STUBS=1
187 endif
188 else
189 TCC += -DSTATIC_BUILD
190 RCC += -DSTATIC_BUILD
191 endif
192 endif
193

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button