Modified to use libtool's ltdl instead of gmodule

This commit is contained in:
Howard Chu 1999-08-07 07:58:11 +00:00
parent 00ac49a1fd
commit 0743e963ca
4 changed files with 29 additions and 17 deletions

View file

@ -24,15 +24,17 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
LDAP_INCDIR= ../../include LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries LDAP_LIBDIR= ../../libraries
SLAP_DIR=
SLAPD_MODULES=@SLAPD_MODULES_LIST@
XDEFS = $(MODULES_CPPFLAGS) XDEFS = $(MODULES_CPPFLAGS)
XLDFLAGS = $(MODULES_LDFLAGS) XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES)
# $(LTHREAD_LIBS) must be last # $(LTHREAD_LIBS) must be last
XLIBS = libbackends.a -lavl -lldbm -lldif -lldap_r -llber -llutil XLIBS = libbackends.a -lavl -lldbm -lldif -lldap_r -llber -llutil
XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \ XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \
$(PERL_LDFLAGS) $(SECURITY_LIBS) \ $(PERL_LDFLAGS) $(SECURITY_LIBS) \
$(LDIF_LIBS) $(LUTIL_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS) XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS)
BUILD_OPT = "--enable-slapd" BUILD_OPT = "--enable-slapd"
BUILD_SRV = @BUILD_SLAPD@ BUILD_SRV = @BUILD_SLAPD@
@ -117,6 +119,15 @@ install-slapd: FORCE
@-$(MKDIR) $(libexecdir) @-$(MKDIR) $(libexecdir)
@-$(MKDIR) $(localstatedir) @-$(MKDIR) $(localstatedir)
$(LTINSTALL) $(INSTALLFLAGS) -m 755 slapd $(libexecdir) $(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 CFFILES=slapd.conf slapd.at.conf slapd.oc.conf

View file

@ -661,7 +661,7 @@ read_config( char *fname )
fname, lineno, 0 ); fname, lineno, 0 );
exit( EXIT_FAILURE ); 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, Debug( LDAP_DEBUG_ANY,
"%s: line %d: failed to load or initialize module %s\n", "%s: line %d: failed to load or initialize module %s\n",
fname, lineno, cargv[1]); fname, lineno, cargv[1]);

View file

@ -4,33 +4,32 @@
#ifdef SLAPD_MODULES #ifdef SLAPD_MODULES
#include <glib.h> #include <ltdl.h>
#include <gmodule.h>
int load_module(const char* file_name, int argc, char *argv[]) { 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[])); void (*initialize) LDAP_P((int argc, char *argv[]));
if (!g_module_supported()) { if (lt_dlinit()) {
Debug(LDAP_DEBUG_ANY, "loadable modules not supported on this platform\n", 0, 0, 0); Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", lt_dlerror(), 0, 0);
return FALSE; return -1;
} }
if ((module = g_module_open(file_name, G_MODULE_BIND_LAZY)) == NULL) { if ((module = lt_dlopen(file_name)) == NULL) {
Debug(LDAP_DEBUG_ANY, "failed to load module %s: %s\n", file_name, g_module_error(), 0); Debug(LDAP_DEBUG_ANY, "lt_dlopen failed: (%s) %s\n", file_name, lt_dlerror(), 0);
return FALSE; return -1;
} }
Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0); 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); initialize(argc, argv);
} else { } else {
Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n", file_name, 0, 0); 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 */ #endif /* SLAPD_MODULES */

View file

@ -19,14 +19,16 @@ BUILD_BDB2 = @BUILD_BDB2@
LDAP_INCDIR= ../../../include LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries LDAP_LIBDIR= ../../../libraries
SLAP_DIR=../
SLAPD_MODULES = @SLAPD_MODULES_LIST@
XDEFS = $(MODULES_CPPFLAGS) XDEFS = $(MODULES_CPPFLAGS)
XLDFLAGS = $(MODULES_LDFLAGS) XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES)
XLIBS = -lavl -lldif -lldbm -lldap_r -llber -llutil XLIBS = -lavl -lldif -lldbm -lldap_r -llber -llutil
XXLIBS = $(LDAPD_LIBS) $(SLAPD_LIBS) \ XXLIBS = $(LDAPD_LIBS) $(SLAPD_LIBS) \
$(PERL_LDFLAGS) $(LDBM_LIBS) $(SECURITY_LIBS) \ $(PERL_LDFLAGS) $(LDBM_LIBS) $(SECURITY_LIBS) \
$(LDIF_LIBS) $(LUTIL_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS) XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS)
PROGRAMS=ldif2index ldif2ldbm ldbmcat ldif2id2entry ldif2id2children \ PROGRAMS=ldif2index ldif2ldbm ldbmcat ldif2id2entry ldif2id2children \
centipede ldbmtest ldif centipede ldbmtest ldif