Index: kitsh/buildsrc/kitsh-0.0/Makefile.common.in ================================================================== --- kitsh/buildsrc/kitsh-0.0/Makefile.common.in +++ kitsh/buildsrc/kitsh-0.0/Makefile.common.in @@ -50,10 +50,11 @@ rm -f cvfs.tcl.h rm -f tclsh.o tclsh tclsh.exe rm -f wish.o wish wish.exe distclean: clean + rm -f kitInit-libs.h rm -f Makefile Makefile.in Makefile.common rm -f config.status config.log rm -f *~ rm -rf starpack.vfs rm -rf autom4te.cache Index: kitsh/buildsrc/kitsh-0.0/aclocal.m4 ================================================================== --- kitsh/buildsrc/kitsh-0.0/aclocal.m4 +++ kitsh/buildsrc/kitsh-0.0/aclocal.m4 @@ -158,20 +158,41 @@ DC_SETUP_TCL_PLAT_DEFS dnl We will need this for the Tcl project, which we will always have DC_CHECK_FOR_WHOLE_ARCHIVE - for proj in mk4tcl tcl tclvfs tk zlib; do - AC_MSG_CHECKING([for libraries required for ${proj}]) + echo '/* Dynamically generated. */' > kitInit-libs.h + libs_init_funcs="" + + for projdir in ../../../*/; do + proj="`basename "${projdir}"`" + + if test "${proj}" = "build"; then + continue + fi + + if test "${proj}" = "kitsh"; then + continue + fi projlibdir="../../../${proj}/inst" + + if test -d "${projlibdir}"; then + true + else + continue + fi + + AC_MSG_CHECKING([for libraries required for ${proj}]) + projlibfiles="`find "${projlibdir}" -name '*.a' 2>/dev/null | tr "\n" ' '`" projlibfilesnostub="`find "${projlibdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`" AC_MSG_RESULT([${projlibfilesnostub}]) hide_symbols="1" + initialize="1" if test "${proj}" = "tcl"; then DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfilesnostub], [ projlibfiles="${projlibfilesnostub}" ], [ @@ -179,10 +200,11 @@ projlibfiles="${projlibfiles}" ]) ]) hide_symbols="0" + initialize="0" fi if test "${proj}" = "mk4tcl"; then if test -n "${projlibfiles}"; then AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl]) @@ -189,10 +211,12 @@ kc_cv_feature_kit_includes_mk4tcl='1' DC_DO_STATIC_LINK_LIBCXX fi + + initialize="0" fi if test "${proj}" = "tk"; then if test "${projlibfilesnostub}" != ""; then DC_DO_TK @@ -214,10 +238,20 @@ ]) ]) hide_symbols="0" fi + + initialize="0" + fi + + if test "${proj}" = "thread"; then + initialize="0" + fi + + if test "${proj}" = "tclvfs"; then + initialize="0" fi if test "${hide_symbols}" = "1"; then STRIPLIBS="${STRIPLIBS} ${projlibfiles}" fi @@ -224,14 +258,36 @@ dnl Do not explicitly link to Zlib, that will happen elsewhere if test "${proj}" = "zlib"; then continue fi + + if test "${initialize}" = "1"; then + if test -n "${projlibfilesnostub}"; then + projucase="`echo ${proj} | dd conv=ucase 2>/dev/null`" + projtcase="`echo ${projucase} | cut -c 1``echo ${proj} | cut -c 2-`" + lib_init_func="${projtcase}_Init" + + echo "#define KIT_INCLUDES_${projucase}" >> kitInit-libs.h + echo "Tcl_AppInitProc ${lib_init_func};" >> kitInit-libs.h + + libs_init_funcs="${libs_init_funcs} ${lib_init_func}" + fi + fi ARCHS="${ARCHS} ${projlibfiles}" done + echo '' >> kitInit-libs.h + echo 'static void _Tclkit_GenericLib_Init(void) {' >> kitInit-libs.h + for lib_init_func in ${libs_init_funcs}; do + proj="`echo ${lib_init_func} | sed 's@_Init$$@@@' | dd conv=lcase 2>/dev/null`" + echo " Tcl_StaticPackage(0, \"${proj}\", ${lib_init_func}, NULL);" >> kitInit-libs.h + done + echo ' return;' >> kitInit-libs.h + echo '}' >> kitInit-libs.h + AC_SUBST(ARCHS) AC_SUBST(STRIPLIBS) ]) AC_DEFUN(DC_SETUP_TCL_PLAT_DEFS, [ Index: kitsh/buildsrc/kitsh-0.0/kitInit.c ================================================================== --- kitsh/buildsrc/kitsh-0.0/kitInit.c +++ kitsh/buildsrc/kitsh-0.0/kitInit.c @@ -59,13 +59,12 @@ #endif #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86 # define KIT_INCLUDES_ZLIB 1 #endif -#ifdef KIT_INCLUDES_ITCL -Tcl_AppInitProc Itcl_Init; -#endif +#include "kitInit-libs.h" + #ifdef KIT_INCLUDES_MK4TCL Tcl_AppInitProc Mk4tcl_Init; #endif Tcl_AppInitProc Vfs_Init, Rechan_Init; #ifdef KIT_INCLUDES_PWB @@ -339,13 +338,10 @@ return; } static void _Tclkit_Generic_Init(void) { -#ifdef KIT_INCLUDES_ITCL - Tcl_StaticPackage(0, "Itcl", Itcl_Init, NULL); -#endif #ifdef KIT_INCLUDES_MK4TCL Tcl_StaticPackage(0, "Mk4tcl", Mk4tcl_Init, NULL); #endif #ifdef KIT_INCLUDES_PWB Tcl_StaticPackage(0, "pwb", Pwb_Init, NULL); @@ -366,10 +362,12 @@ Tcl_StaticPackage(0, "registry", Registry_Init, NULL); #endif #ifdef KIT_INCLUDES_TK Tcl_StaticPackage(0, "Tk", Tk_Init, Tk_SafeInit); #endif + + _Tclkit_GenericLib_Init(); TclSetPreInitScript(preInitCmd); return; }