Index: generic/tclBasic.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
retrieving revision 1.270
diff -u -r1.270 tclBasic.c
--- generic/tclBasic.c	25 Sep 2007 20:27:17 -0000	1.270
+++ generic/tclBasic.c	24 Oct 2007 16:14:38 -0000
@@ -776,11 +776,6 @@
 
     Tcl_PkgProvideEx(interp, "Tcl", TCL_PATCH_LEVEL, (ClientData) &tclStubs);
 
-#ifdef Tcl_InitStubs
-#undef Tcl_InitStubs
-#endif
-    Tcl_InitStubs(interp, TCL_VERSION, 1);
-
     if (TclTommath_Init(interp) != TCL_OK) {
 	Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp)));
     }
Index: generic/tclDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDecls.h,v
retrieving revision 1.128
diff -u -r1.128 tclDecls.h
--- generic/tclDecls.h	23 Feb 2007 23:02:53 -0000	1.128
+++ generic/tclDecls.h	24 Oct 2007 16:14:40 -0000
@@ -4078,6 +4078,8 @@
     void (*tcl_AppendPrintfToObj) (Tcl_Obj * objPtr, CONST char * format, ...); /* 579 */
 } TclStubs;
 
+#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -4086,6 +4088,8 @@
 }
 #endif
 
+#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
+
 #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
 
 /*
Index: generic/tclIntDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIntDecls.h,v
retrieving revision 1.105
diff -u -r1.105 tclIntDecls.h
--- generic/tclIntDecls.h	6 Sep 2007 18:13:20 -0000	1.105
+++ generic/tclIntDecls.h	24 Oct 2007 16:14:41 -0000
@@ -1316,6 +1316,8 @@
     void (*tclBackgroundException) (Tcl_Interp * interp, int code); /* 236 */
 } TclIntStubs;
 
+#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -1324,6 +1326,8 @@
 }
 #endif
 
+#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
+
 #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
 
 /*
Index: generic/tclIntPlatDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIntPlatDecls.h,v
retrieving revision 1.30
diff -u -r1.30 tclIntPlatDecls.h
--- generic/tclIntPlatDecls.h	15 Nov 2006 14:58:27 -0000	1.30
+++ generic/tclIntPlatDecls.h	24 Oct 2007 16:14:41 -0000
@@ -351,6 +351,8 @@
 #endif /* MAC_OSX_TCL */
 } TclIntPlatStubs;
 
+#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -359,6 +361,8 @@
 }
 #endif
 
+#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
+
 #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
 
 /*
Index: generic/tclPlatDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPlatDecls.h,v
retrieving revision 1.25
diff -u -r1.25 tclPlatDecls.h
--- generic/tclPlatDecls.h	15 Nov 2006 14:58:27 -0000	1.25
+++ generic/tclPlatDecls.h	24 Oct 2007 16:14:41 -0000
@@ -94,6 +94,8 @@
 #endif /* MAC_OSX_TCL */
 } TclPlatStubs;
 
+#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -102,6 +104,8 @@
 }
 #endif
 
+#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
+
 #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
 
 /*
Index: generic/tclTomMathDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTomMathDecls.h,v
retrieving revision 1.2
diff -u -r1.2 tclTomMathDecls.h
--- generic/tclTomMathDecls.h	15 Nov 2006 14:58:27 -0000	1.2
+++ generic/tclTomMathDecls.h	24 Oct 2007 16:14:42 -0000
@@ -520,6 +520,8 @@
     int (*tclBN_s_mp_sub) (mp_int* a, mp_int* b, mp_int* c); /* 60 */
 } TclTomMathStubs;
 
+#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -528,6 +530,8 @@
 }
 #endif
 
+#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
+
 #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
 
 /*
Index: tools/genStubs.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/tools/genStubs.tcl,v
retrieving revision 1.20
diff -u -r1.20 genStubs.tcl
--- tools/genStubs.tcl	23 Feb 2007 23:02:54 -0000	1.20
+++ tools/genStubs.tcl	24 Oct 2007 16:14:43 -0000
@@ -803,6 +803,7 @@
 proc genStubs::emitHeader {name} {
     variable outDir
     variable hooks
+    variable libraryName
 
     set capName [string toupper [string index $name 0]]
     append capName [string range $name 1 end]
@@ -826,9 +827,12 @@
 
     append text "} ${capName}Stubs;\n"
 
+    set upName [string toupper $libraryName]
+    append text "\n#if defined(USE_${upName}_STUBS) && !defined(USE_${upName}_STUB_PROCS)\n"
     append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
     append text "extern ${capName}Stubs *${name}StubsPtr;\n"
     append text "#ifdef __cplusplus\n}\n#endif\n"
+    append text "\n#endif /* defined(USE_${upName}_STUBS) && !defined(USE_${upName}_STUB_PROCS) */\n"
 
     emitMacros $name text
 
Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.223
diff -u -r1.223 Makefile.in
--- unix/Makefile.in	18 Oct 2007 17:52:18 -0000	1.223
+++ unix/Makefile.in	24 Oct 2007 16:14:43 -0000
@@ -291,7 +291,7 @@
 	tclResolve.o tclResult.o tclScan.o tclStringObj.o \
 	tclStrToD.o tclThread.o \
 	tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \
-	tclStubLib.o tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o \
+	tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o \
 	tclTomMathInterface.o
 
 TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \
@@ -408,7 +408,6 @@
 	$(GENERIC_DIR)/tclResult.c \
 	$(GENERIC_DIR)/tclScan.c \
 	$(GENERIC_DIR)/tclStubInit.c \
-	$(GENERIC_DIR)/tclStubLib.c \
 	$(GENERIC_DIR)/tclStringObj.c \
 	$(GENERIC_DIR)/tclStrToD.c \
 	$(GENERIC_DIR)/tclTest.c \
