From: Howard Chu Date: Sat, 7 Aug 1999 07:58:11 +0000 (+0000) Subject: Modified to use libtool's ltdl instead of gmodule X-Git-Tag: TWEB_OL_BASE~261 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0743e963cac4aca63ea40e837fb3e7f59cbec04d;p=openldap Modified to use libtool's ltdl instead of gmodule --- diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in index 70025e4477..0d04863b8c 100644 --- a/servers/slapd/Makefile.in +++ b/servers/slapd/Makefile.in @@ -24,15 +24,17 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \ LDAP_INCDIR= ../../include LDAP_LIBDIR= ../../libraries +SLAP_DIR= +SLAPD_MODULES=@SLAPD_MODULES_LIST@ XDEFS = $(MODULES_CPPFLAGS) -XLDFLAGS = $(MODULES_LDFLAGS) +XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES) # $(LTHREAD_LIBS) must be last XLIBS = libbackends.a -lavl -lldbm -lldif -lldap_r -llber -llutil XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \ $(PERL_LDFLAGS) $(SECURITY_LIBS) \ $(LDIF_LIBS) $(LUTIL_LIBS) -XXXLIBS = $(LTHREAD_LIBS) +XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS) BUILD_OPT = "--enable-slapd" BUILD_SRV = @BUILD_SLAPD@ @@ -117,6 +119,15 @@ install-slapd: FORCE @-$(MKDIR) $(libexecdir) @-$(MKDIR) $(localstatedir) $(LTINSTALL) $(INSTALLFLAGS) -m 755 slapd $(libexecdir) + @if [ ! -z "$(SLAPD_MODULES)" ]; then \ + for i in back-* shell-backends tools; do \ + if [ -d $$i ]; then \ + echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \ + ( cd $$i; $(MAKE) $(MFLAGS) install ); \ + fi; \ + done; \ + fi + CFFILES=slapd.conf slapd.at.conf slapd.oc.conf diff --git a/servers/slapd/config.c b/servers/slapd/config.c index ff114775f0..47b081a286 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -661,7 +661,7 @@ read_config( char *fname ) fname, lineno, 0 ); exit( EXIT_FAILURE ); } - if (!load_module(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) { + if (load_module(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) { Debug( LDAP_DEBUG_ANY, "%s: line %d: failed to load or initialize module %s\n", fname, lineno, cargv[1]); diff --git a/servers/slapd/module.c b/servers/slapd/module.c index b99d718e40..5b945e5b81 100644 --- a/servers/slapd/module.c +++ b/servers/slapd/module.c @@ -4,33 +4,32 @@ #ifdef SLAPD_MODULES -#include -#include +#include int load_module(const char* file_name, int argc, char *argv[]) { - GModule* module = NULL; + lt_dlhandle* module = NULL; void (*initialize) LDAP_P((int argc, char *argv[])); - if (!g_module_supported()) { - Debug(LDAP_DEBUG_ANY, "loadable modules not supported on this platform\n", 0, 0, 0); - return FALSE; + if (lt_dlinit()) { + Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", lt_dlerror(), 0, 0); + return -1; } - if ((module = g_module_open(file_name, G_MODULE_BIND_LAZY)) == NULL) { - Debug(LDAP_DEBUG_ANY, "failed to load module %s: %s\n", file_name, g_module_error(), 0); - return FALSE; + if ((module = lt_dlopen(file_name)) == NULL) { + Debug(LDAP_DEBUG_ANY, "lt_dlopen failed: (%s) %s\n", file_name, lt_dlerror(), 0); + return -1; } Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0); - if (g_module_symbol(module, "init_module", (gpointer *) &initialize)) { + if ((initialize = lt_dlsym(module, "init_module"))) { initialize(argc, argv); } else { Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n", file_name, 0, 0); - return FALSE; + return -1; } - return TRUE; + return 0; } #endif /* SLAPD_MODULES */ diff --git a/servers/slapd/tools/Makefile.in b/servers/slapd/tools/Makefile.in index 1e0a9db4a2..062d2a9bbf 100644 --- a/servers/slapd/tools/Makefile.in +++ b/servers/slapd/tools/Makefile.in @@ -19,14 +19,16 @@ BUILD_BDB2 = @BUILD_BDB2@ LDAP_INCDIR= ../../../include LDAP_LIBDIR= ../../../libraries +SLAP_DIR=../ +SLAPD_MODULES = @SLAPD_MODULES_LIST@ XDEFS = $(MODULES_CPPFLAGS) -XLDFLAGS = $(MODULES_LDFLAGS) +XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES) XLIBS = -lavl -lldif -lldbm -lldap_r -llber -llutil XXLIBS = $(LDAPD_LIBS) $(SLAPD_LIBS) \ $(PERL_LDFLAGS) $(LDBM_LIBS) $(SECURITY_LIBS) \ $(LDIF_LIBS) $(LUTIL_LIBS) -XXXLIBS = $(LTHREAD_LIBS) +XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS) PROGRAMS=ldif2index ldif2ldbm ldbmcat ldif2id2entry ldif2id2children \ centipede ldbmtest ldif