From ef1786df1cd86e79da2f97e3ce50068bee7928da Mon Sep 17 00:00:00 2001 From: Bill Gribble Date: Thu, 8 Nov 2001 18:15:30 +0000 Subject: [PATCH] More makefile changes to get modules loading right. Hacked the crashes away by commenting out calls to lt_dlclose ... will figure out what's going on later. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5801 57a11ea4-9604-0410-9ed3-97b8803252fd --- po/ChangeLog | 12 +++++++++ src/app-file/Makefile.am | 2 -- src/app-file/test/Makefile.am | 6 ++--- src/backend/file/test/Makefile.am | 3 +-- src/backend/postgres/test/test-db.c | 1 + src/gnc-module/Makefile.am | 2 +- src/gnc-module/gnc-module.c | 27 ++++++++++++++----- src/gnc-module/test/Makefile.am | 5 ++-- src/gnome-utils/Makefile.am | 1 + src/gnome-utils/test/Makefile.am | 15 +++++++++-- src/gnome-utils/test/test-link-module.c | 14 ++++++++-- src/gnome-utils/test/test-load-module | 11 ++++++++ src/gnome/Makefile.am | 1 + src/network-utils/test/Makefile.am | 9 +++---- src/network-utils/test/test-load-module | 11 ++++++++ src/register/Makefile.am | 2 +- src/register/ledger-core/Makefile.am | 1 + src/report/locale-specific/us/Makefile.am | 2 +- .../locale-specific/us/test/Makefile.am | 8 +++--- src/report/stylesheets/test/Makefile.am | 4 +-- 20 files changed, 102 insertions(+), 35 deletions(-) create mode 100755 src/gnome-utils/test/test-load-module create mode 100755 src/network-utils/test/test-load-module diff --git a/po/ChangeLog b/po/ChangeLog index bacdeef39a..aa3328d2b7 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,15 @@ +2001-11-08 gettextize + + * Makefile.in.in: Upgrade to gettext-0.10.40. + +2001-11-08 gettextize + + * Makefile.in.in: Upgrade to gettext-0.10.40. + +2001-11-08 gettextize + + * Makefile.in.in: Upgrade to gettext-0.10.40. + 2001-11-07 gettextize * Makefile.in.in: Upgrade to gettext-0.10.40. diff --git a/src/app-file/Makefile.am b/src/app-file/Makefile.am index 4031cfc2b4..dd797e9cb7 100644 --- a/src/app-file/Makefile.am +++ b/src/app-file/Makefile.am @@ -29,8 +29,6 @@ libgncmod_app_file_la_LDFLAGS = -module libgncmod_app_file_la_LIBADD = \ ../gnc-module/libgncmodule.la \ ../engine/libgncmod-engine.la \ - ../app-utils/libgncmod-app-utils.la \ - ../calculation/libgncmod-calculation.la \ ../gnome-utils/libgncmod-gnome-utils.la \ ./gnome/libgnc-app-file-gnome.la \ ${GUILE_LIBS} \ diff --git a/src/app-file/test/Makefile.am b/src/app-file/test/Makefile.am index c5b0f58d87..86916f4715 100644 --- a/src/app-file/test/Makefile.am +++ b/src/app-file/test/Makefile.am @@ -1,9 +1,9 @@ TESTS=test-link test-load-module TESTS_ENVIRONMENT=\ -GNC_MODULE_PATH=${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine \ -GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine \ -LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine:${top_srcdir}/src/app-file/gnome +GNC_MODULE_PATH=${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine:${top_srcdir}/src/calculation \ +GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine:${top_srcdir}/src/calculation:${top_srcdir}/lib:${top_srcdir}/src/gnome:${top_srcdir}/src/scm \ +LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine:${top_srcdir}/src/app-file/gnome:${top_srcdir}/src/calculation:${top_srcdir}/src/gnome noinst_PROGRAMS=test-link diff --git a/src/backend/file/test/Makefile.am b/src/backend/file/test/Makefile.am index 0a83c3ee1a..50440ec4da 100644 --- a/src/backend/file/test/Makefile.am +++ b/src/backend/file/test/Makefile.am @@ -49,8 +49,7 @@ LDADD = ${top_srcdir}/src/test-core/libgncmod-test.la \ ${top_srcdir}/src/engine/libgw-kvp.la \ ${top_srcdir}/src/engine/test-core/libgncmod-test-engine.la \ ../libgncmod-backend-file.la \ - ./libgnc-test-file-stuff.la \ - -lltdl + ./libgnc-test-file-stuff.la AM_CFLAGS = \ -I${top_srcdir}/src/gnc-module \ diff --git a/src/backend/postgres/test/test-db.c b/src/backend/postgres/test/test-db.c index 9dc809ff48..ffeb096965 100644 --- a/src/backend/postgres/test/test-db.c +++ b/src/backend/postgres/test/test-db.c @@ -407,6 +407,7 @@ test_updates (GNCSession *session, const char *db_name, const char *mode, gnc_session_destroy (session_2); g_free (filename); + return TRUE; } static gboolean diff --git a/src/gnc-module/Makefile.am b/src/gnc-module/Makefile.am index 5b4f258d60..a913077d84 100644 --- a/src/gnc-module/Makefile.am +++ b/src/gnc-module/Makefile.am @@ -11,7 +11,7 @@ libgncmodule_la_LIBADD = \ ${G_WRAP_LINK_ARGS} \ ${GLIB_LIBS} \ ${GUILE_LIBS} \ - -lltdl + -lltdl libgw_gnc_module_la_SOURCES = gw-gnc-module.c libgw_gnc_module_la_DEPENDENCIES = libgncmodule.la diff --git a/src/gnc-module/gnc-module.c b/src/gnc-module/gnc-module.c index 86428fbb7c..211d990ec7 100644 --- a/src/gnc-module/gnc-module.c +++ b/src/gnc-module/gnc-module.c @@ -243,6 +243,7 @@ gnc_module_get_info(const char * fullpath) { lt_dlhandle handle; + //printf("(init) dlopening %s\n", fullpath); handle = lt_dlopen(fullpath); if(handle) { @@ -252,7 +253,8 @@ gnc_module_get_info(const char * fullpath) * types are */ if (!modsysver) { - lt_dlclose(handle); + //printf("(init) closing %s\n", fullpath); + //lt_dlclose(handle); return NULL; } @@ -278,13 +280,14 @@ gnc_module_get_info(const char * fullpath) info->module_interface = *(int *)interface; info->module_age = *(int *)age; info->module_revision = *(int *)revision; - lt_dlclose(handle); + //printf("(init) closing %s\n", fullpath); + //lt_dlclose(handle); return info; } else { g_warning ("module '%s' does not match module signature\n", fullpath); - lt_dlclose(handle); + //lt_dlclose(handle); return NULL; } } @@ -293,7 +296,7 @@ gnc_module_get_info(const char * fullpath) /* unsupported module system interface version */ /* printf("\n** WARNING ** : module '%s' requires newer module system\n", fullpath); */ - lt_dlclose(handle); + //lt_dlclose(handle); return NULL; } } @@ -421,6 +424,9 @@ gnc_module_load(char * module_name, gint interface) /* module already loaded ... call the init thunk */ if(info->init_func) { + printf("calling init func for '%s' .. refcount = %d\n", + module_name, info->load_count); + if(info->init_func(info->load_count)) { info->load_count++; @@ -442,6 +448,9 @@ gnc_module_load(char * module_name, gint interface) GNCModuleInfo * modinfo = gnc_module_locate(module_name, interface); lt_dlhandle handle = NULL; + //if(modinfo) + //printf("(load) dlopening %s\n", modinfo->module_filepath); + if(modinfo && ((handle = lt_dlopen(modinfo->module_filepath)) != NULL)) { lt_ptr initfunc = lt_dlsym(handle, "gnc_module_init"); @@ -458,6 +467,9 @@ gnc_module_load(char * module_name, gint interface) /* now call its init function. this should load any dependent * modules, too. If it doesn't return TRUE unload the module. */ + printf("calling init func for '%s' .. refcount = 0\n", + module_name); + if(!info->init_func(0)) { /* init failed. unload the module. */ @@ -465,7 +477,7 @@ gnc_module_load(char * module_name, gint interface) g_hash_table_remove(loaded_modules, info); g_free(info->filename); g_free(info); - lt_dlclose(handle); + //lt_dlclose(handle); return NULL; } @@ -475,7 +487,7 @@ gnc_module_load(char * module_name, gint interface) { g_warning ("Module %s (%s) is not a gnc-module.\n", module_name, modinfo->module_filepath); - lt_dlclose(handle); + //lt_dlclose(handle); } return info; } @@ -522,7 +534,8 @@ gnc_module_unload(GNCModule module) if(info->load_count == 0) { /* now close the module and free the struct */ - lt_dlclose(info->handle); + //printf("(unload) closing %s\n", info->filename); + //lt_dlclose(info->handle); g_hash_table_remove(loaded_modules, module); g_free(info); } diff --git a/src/gnc-module/test/Makefile.am b/src/gnc-module/test/Makefile.am index 52b3a720f6..4f7e597e67 100644 --- a/src/gnc-module/test/Makefile.am +++ b/src/gnc-module/test/Makefile.am @@ -19,10 +19,9 @@ TESTS = \ test-scm-init TESTS_ENVIRONMENT = \ - GNC_MODULE_PATH=${PWD}/mod-foo:${PWD}/mod-bar:${PWD}/mod-baz:${PWD}/misc-mods:${top_srcdir}/src/import-export/qif-import \ + GNC_MODULE_PATH=mod-foo:mod-bar:mod-baz:misc-mods \ GUILE_LOAD_PATH=..:${G_WRAP_MODULE_DIR} \ - LTDL_LIBRARY_PATH=../ \ - LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/app-file:mod-foo:mod-foo/.libs:mod-bar:mod-bar/.libs:mod-baz:mod-baz/.libs:..:../.libs + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:mod-foo:mod-bar:mod-baz:misc-mods:..: noinst_PROGRAMS = \ test-load-c \ diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am index c4db93a118..b2eacfac28 100644 --- a/src/gnome-utils/Makefile.am +++ b/src/gnome-utils/Makefile.am @@ -78,6 +78,7 @@ libgncmod_gnome_utils_la_LIBADD = \ ${GNOME_LIBDIR} \ ${GNOME_PRINT_LIBS} \ ${GTKHTML_LIBS} \ + ${GDK_PIXBUF_LIBS} \ ${GLADE_LIBS} \ ${GUILE_LIBS} \ ${GUPPI_LIBS} \ diff --git a/src/gnome-utils/test/Makefile.am b/src/gnome-utils/test/Makefile.am index 94011464af..dc868a6b8c 100644 --- a/src/gnome-utils/test/Makefile.am +++ b/src/gnome-utils/test/Makefile.am @@ -1,11 +1,22 @@ TESTS = \ - test-link-module + test-link-module test-load-module + +TESTS_ENVIRONMENT=\ +GNC_MODULE_PATH=${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/gnome-utils:${top_srcdir}/src/network-utils:${top_srcdir}/src/engine:${top_srcdir}/src/calculation:${top_srcdir}/src/tax/us:${top_srcdir}/src/report/locale-specific/us \ +GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/gnome-utils:${top_srcdir}/src/network-utils:${top_srcdir}/src/engine:${top_srcdir}/src/calculation:${top_srcdir}/lib:${top_srcdir}/src/gnome:${top_srcdir}/src/scm:${top_srcdir}/src/report/report-system:${top_srcdir}/src/tax/us:${G_WRAP_MODULE_DIR}:${top_srcdir}/src/report/locale-specific/us \ +LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/gnome-utils:${top_srcdir}/src/network-utils:${top_srcdir}/src/engine:${top_srcdir}/src/app-file/gnome:${top_srcdir}/src/calculation:${top_srcdir}/src/gnome:${top_srcdir}/src/report/report-system:${top_srcdir}/src/report/locale-specific/us:${top_srcdir}/src/tax/us noinst_PROGRAMS = \ test-link-module +INCLUDES=-I../../gnc-module ${GLIB_CFLAGS} ${GUILE_CFLAGS} + test_link_module_SOURCES=test-link-module.c -test_link_module_LDADD=../libgncmod-gnome-utils.la +test_link_module_LDADD= \ +../../gnc-module/libgncmodule.la +testit: + libtool --mode execute gdb test-link-module + diff --git a/src/gnome-utils/test/test-link-module.c b/src/gnome-utils/test/test-link-module.c index c0d815b3d5..4b7b86a82b 100644 --- a/src/gnome-utils/test/test-link-module.c +++ b/src/gnome-utils/test/test-link-module.c @@ -1,6 +1,16 @@ #include +#include +#include -int -main(int argc, char ** argv) { +void +guile_main(int argc, char ** argv) { + gnc_module_system_init(); +/* gnc_module_load("gnucash/gnome-utils", 0); */ exit(0); } +int +main(int argc, char ** argv) { + gh_enter(argc, argv, guile_main); + return 0; + +} diff --git a/src/gnome-utils/test/test-load-module b/src/gnome-utils/test/test-load-module new file mode 100755 index 0000000000..b3ea474f47 --- /dev/null +++ b/src/gnome-utils/test/test-load-module @@ -0,0 +1,11 @@ +#! /bin/sh +exec guile -s $0 +!# + +(use-modules (gnucash gnc-module)) +(gnc:module-system-init) + +(display " testing gnome-utils module load ... ") +(gnc:module-load "gnucash/gnome-utils" 0) + +(display " ok\n") diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am index 777da0fcf4..2f822113ba 100644 --- a/src/gnome/Makefile.am +++ b/src/gnome/Makefile.am @@ -10,6 +10,7 @@ libgw_gnc_la_LIBADD = ${G_WRAP_LINK_ARGS} ${GLIB_LIBS} libgw_gnc_la_LDFLAGS = -module libgncgnome_la_LDFLAGS = -module +libgncgnome_la_LIBADD = ${GNOMEUI_LIBS} ${GLIB_LIBS} ${GUILE_LIBS} libgncgnome_la_SOURCES = \ argv-list-converters.c \ diff --git a/src/network-utils/test/Makefile.am b/src/network-utils/test/Makefile.am index 4f3c785a9b..2e59bdaa8c 100644 --- a/src/network-utils/test/Makefile.am +++ b/src/network-utils/test/Makefile.am @@ -1,12 +1,11 @@ TESTS = \ - test-link-module -# test-load-module + test-link-module \ + test-load-module TESTS_ENVIRONMENT= \ - GNC_MODULE_PATH=../../gnc-module:.. \ + GNC_MODULE_PATH=.. \ GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:..:../../gnc-module:${top_srcdir}/lib \ - LTDL_LIBRARY_PATH=.. \ - LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/network-utils noinst_PROGRAMS = \ diff --git a/src/network-utils/test/test-load-module b/src/network-utils/test/test-load-module new file mode 100755 index 0000000000..c28da1c9a4 --- /dev/null +++ b/src/network-utils/test/test-load-module @@ -0,0 +1,11 @@ +#! /bin/sh +exec guile -s $0 +!# + +(use-modules (gnucash gnc-module)) +(gnc:module-system-init) + +(display " testing network-utils module load ... ") +(gnc:module-load "gnucash/network-utils" 0) + +(display " ok\n") diff --git a/src/register/Makefile.am b/src/register/Makefile.am index a1de4da451..de7a97dbc2 100644 --- a/src/register/Makefile.am +++ b/src/register/Makefile.am @@ -1 +1 @@ -SUBDIRS=ledger-core register-core register-gnome +SUBDIRS=register-core register-gnome ledger-core diff --git a/src/register/ledger-core/Makefile.am b/src/register/ledger-core/Makefile.am index 9c684a04d2..58fe628ed4 100644 --- a/src/register/ledger-core/Makefile.am +++ b/src/register/ledger-core/Makefile.am @@ -24,6 +24,7 @@ noinst_HEADERS = \ libgncmod_ledger_core_la_LDFLAGS = -module libgncmod_ledger_core_la_LIBADD = \ + ${top_srcdir}/src/register/register-core/libgncmod-register-core.la \ ${top_srcdir}/src/gnome/libgncgnome.la AM_CFLAGS = \ diff --git a/src/report/locale-specific/us/Makefile.am b/src/report/locale-specific/us/Makefile.am index 9eedc51b50..6cf7e7d726 100644 --- a/src/report/locale-specific/us/Makefile.am +++ b/src/report/locale-specific/us/Makefile.am @@ -9,7 +9,7 @@ libgncmod_locale_reports_us_la_LDFLAGS = -module libgncmod_locale_reports_us_la_LIBADD = \ ${top_srcdir}/src/gnc-module/libgncmodule.la \ ${GUILE_LIBS} \ - ${GLIB_LIBS} + ${GLIB_LIBS} AM_CFLAGS = -I${top_srcdir}/src/gnc-module ${GUILE_INCS} ${GLIB_CFLAGS} diff --git a/src/report/locale-specific/us/test/Makefile.am b/src/report/locale-specific/us/test/Makefile.am index 5473060754..1d2a489061 100644 --- a/src/report/locale-specific/us/test/Makefile.am +++ b/src/report/locale-specific/us/test/Makefile.am @@ -1,9 +1,9 @@ -TESTS= test-load-module test-link-module +TESTS=test-load-module test-link-module TESTS_ENVIRONMENT= \ - GNC_MODULE_PATH=${top_srcdir}/src/engine:${top_srcdir}/src/report/report-system:${top_srcdir}/src/app-utils:${top_srcdir}/src/app-file:${top_srcdir}/src/calculation:${top_srcdir}/src/tax/us:${top_srcdir}/src/report/locale-specific/us \ - GUILE_LOAD_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/scm:${top_srcdir}/src/app-file:${top_srcdir}/src/gnome:${top_srcdir}/src/report/report-system:${top_srcdir}/src/tax/us:${G_WRAP_MODULE_DIR}:${top_srcdir}/src/report/locale-specific/us:${top_srcdir}/lib \ - LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/engine:${top_srcdir}/src/app-utils:${top_srcdir}/src/calculation:${top_srcdir}/src/app-file:${top_srcdir}/src/app-file/gnome:${top_srcdir}/src/gnome:${top_srcdir}/src/report/report-system:${top_srcdir}/src/tax/us:${top_srcdir}/src/scm:.. +GNC_MODULE_PATH=${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/gnome-utils:{top_srcdir}/src/network-utils:${top_srcdir}/src/engine:${top_srcdir}/src/calculation:${top_srcdir}/src/tax/us:${top_srcdir}/src/report/report-system:${top_srcdir}/src/report/locale-specific/us \ +GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/gnome-utils:{top_srcdir}/src/network-utils:${top_srcdir}/src/engine:${top_srcdir}/src/calculation:${top_srcdir}/lib:${top_srcdir}/src/gnome:${top_srcdir}/src/scm:${top_srcdir}/src/report/report-system:${top_srcdir}/src/tax/us:${G_WRAP_MODULE_DIR}:${top_srcdir}/src/report/locale-specific/us \ +LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/app-file:${top_srcdir}/src/app-utils:${top_srcdir}/src/gnome-utils:{top_srcdir}/src/network-utils:${top_srcdir}/src/engine:${top_srcdir}/src/app-file/gnome:${top_srcdir}/src/calculation:${top_srcdir}/src/gnome:${top_srcdir}/src/report/report-system:${top_srcdir}/src/report/locale-specific/us:${top_srcdir}/src/tax/us EXTRA_DIST = test-load-module diff --git a/src/report/stylesheets/test/Makefile.am b/src/report/stylesheets/test/Makefile.am index a3f2064b3f..2b1e0a0f46 100644 --- a/src/report/stylesheets/test/Makefile.am +++ b/src/report/stylesheets/test/Makefile.am @@ -2,7 +2,7 @@ TESTS=test-load-module TESTS_ENVIRONMENT= \ GNC_MODULE_PATH=${top_srcdir}/src/engine:${top_srcdir}/src/report/report-system:${top_srcdir}/src/app-utils:${top_srcdir}/src/calculation:.. \ - GUILE_LOAD_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/lib:..:${G_WRAP_MODULE_DIR}:${top_srcdir}/src/guile:${top_srcdir}/src/scm \ - LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/engine:${top_srcdir}/src/app-utils:${top_srcdir}/src/calculation:${top_srcdir}/src/guile + GUILE_LOAD_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/lib:..:${G_WRAP_MODULE_DIR}:${top_srcdir}/src/guile:${top_srcdir}/src/scm:${top_srcdir}/src/gnome \ + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${top_srcdir}/src/gnc-module:${top_srcdir}/src/engine:${top_srcdir}/src/app-utils:${top_srcdir}/src/calculation:${top_srcdir}/src/guile:${top_srcdir}/src/gnome EXTRA_DIST = test-load-module