Commit 3d1dc1b9 authored by Howard Chu's avatar Howard Chu
Browse files

Modified to use libtool's ltdl instead of gmodule. Full Makefile support

for building backends as modules.
parent 0743e963
......@@ -6,9 +6,8 @@
## Makefile Template for Server Modules
##
LIBRARY = lib$(LIBBASE).la
LIBRARY = $(LIBBASE).la
LIBSTAT = lib$(LIBBASE).a
MODULE = $(LIBBASE).so
all-common: FORCE
@if test "$(BUILD_MOD)" = "yes"; then \
......@@ -24,10 +23,7 @@ version.c: $(OBJS)
$(MKVERSION) $(LIBBASE) > $@
$(LIBRARY): version.lo
$(LTLIBLINK) -rpath $(libdir) -o $@ $(OBJS) version.lo
$(MODULE): $(LIBRARY)
ln .libs/lib$(LIBBASE).so.0.0.0 $@
$(LTLIBLINK) -module -rpath $(moduledir) -o $@ $(OBJS) version.lo
$(LIBSTAT): version.lo
$(AR) ruv $@ `echo $(OBJS) | sed s/\.lo/.o/g` version.o
......@@ -58,18 +54,24 @@ depend-common: FORCE
fi
install-common: FORCE
@if test "$(BUILD_LIB)" = "yes" ; then \
@if test "$(BUILD_MOD)" = "yes" ; then \
$(MAKE) $(MFLAGS) install-mod; \
elif test "$(BUILD_LIB)" = "yes" ; then \
$(MAKE) $(MFLAGS) install-lib; \
else \
echo "run configure with $(BUILD_OPT) to install $(LIBBASE)"; \
fi
all-local-mod:
all-mod: $(MODULE) all-local-mod FORCE
all-mod: $(LIBRARY) all-local-mod FORCE
all-local-lib:
all-lib: $(LIBSTAT) all-local-lib FORCE
install-mod: $(LIBRARY)
@-$(MKDIR) $(moduledir)
$(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(moduledir)
install-local-lib:
install-lib: install-local-lib FORCE
......
......@@ -29,6 +29,7 @@ libdir = $(TMPROOT)@libdir@
libexecdir = $(TMPROOT)@libexecdir@
localstatedir = $(TMPROOT)@localstatedir@
mandir = $(TMPROOT)@mandir@
moduledir = $(TMPROOT)@libexecdir@/$(ldap_subdir)
sbindir = $(TMPROOT)@sbindir@
sharedstatedir = $(TMPROOT)@sharedstatedir@
sysconfdir = $(TMPROOT)@sysconfdir@/$(ldap_subdir)
......@@ -126,6 +127,7 @@ SECURITY_LIBS = @SASL_LIBS@ @KRB_LIBS@ @TLS_LIBS@
MODULES_CPPFLAGS = @SLAPD_MODULES_CPPFLAGS@
MODULES_LDFLAGS = @SLAPD_MODULES_LDFLAGS@
MODULES_LIBS = @MODULES_LIBS@
PERL_CPPFLAGS = @SLAPD_PERL_CPPFLAGS@
PERL_LDFLAGS = @SLAPD_PERL_LDFLAGS@
TERMCAP_LIBS = @TERMCAP_LIBS@
......
This diff is collapsed.
......@@ -366,6 +366,7 @@ BUILD_TCL_DYNAMIC=no
SLAPD_MODULES_LDFLAGS=
SLAPD_MODULES_CPPFLAGS=
SLAPD_MODULES_LIST=
SLAPD_PERL_LDFLAGS=
SLAPD_PERL_CPPFLAGS=
......@@ -375,6 +376,7 @@ READLINE_LIBS=
SASL_LIBS=
TERMCAP_LIBS=
TLS_LIBS=
MODULES_LIBS=
dnl ----------------------------------------------------------------
dnl Checks for programs
......@@ -437,6 +439,7 @@ dnl The default CFLAGS is empty NOT whatever AC_PROG_CC sets.
dnl (for now, let autoconf sort this out)
dnl CFLAGS=${CFLAGS-""}
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
dnl AC_PROG_MAKE_SET
......@@ -514,36 +517,6 @@ if test "${ol_cv_mkdep}" = no ; then
AC_MSG_WARN([do not know how to generate dependencies])
fi
dnl
dnl Check for module support
dnl
ol_link_modules=no
if test $ol_enable_modules != no ; then
AC_PATH_PROG(GLIBCONFIG, glib-config)
if test "no$GLIBCONFIG" = "no" ; then
if test $ol_enable_modules = yes ; then
AC_MSG_ERROR([could not locate glib-config])
fi
else
SLAPD_MODULES_VERSION="`$GLIBCONFIG --version gmodule`"
SLAPD_MODULES_CPPFLAGS="`$GLIBCONFIG --cflags gmodule`"
SLAPD_MODULES_LDFLAGS="`$GLIBCONFIG --libs gmodule`"
dnl should check glib version
ol_link_modules=yes
fi
else
ol_with_bdb2_module=static
ol_with_ldap_module=static
ol_with_ldbm_module=static
ol_with_passwd_module=static
ol_with_perl_module=static
ol_with_shell_module=static
ol_with_tcl_module=static
fi
dnl ----------------------------------------------------------------
dnl Checks for header files.
OL_HEADER_STDC
......@@ -1941,9 +1914,11 @@ if test "$ol_enable_rlookups" != no ; then
AC_DEFINE(SLAPD_RLOOKUPS,1,[define to support reverse lookups])
fi
if test "$ol_link_modules" != no ; then
if test "$ol_enable_modules" != no ; then
AC_DEFINE(SLAPD_MODULES,1,[define to support modules])
BUILD_SLAPD=yes
MODULES_LIBS=-lltdl
SLAPD_MODULES_LDFLAGS="-dlopen self"
fi
if test "$ol_link_bdb2" != no ; then
......@@ -1954,6 +1929,7 @@ if test "$ol_link_bdb2" != no ; then
AC_DEFINE(SLAPD_BDB2_DYNAMIC,1,
[define to support dynamic BDB2 backend])
BUILD_BDB2_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-bdb2/back_bdb2.la"
fi
fi
......@@ -1965,6 +1941,7 @@ if test "$ol_enable_ldap" != no ; then
AC_DEFINE(SLAPD_LDAP_DYNAMIC,1,
[define to support dynamic LDAP backend])
BUILD_LDAP_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-ldap/back_ldap.la"
fi
fi
......@@ -1976,6 +1953,7 @@ if test "$ol_link_ldbm" != no ; then
AC_DEFINE(SLAPD_LDBM_DYNAMIC,1,
[define to support dynamic LDBM backend])
BUILD_LDBM_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-ldbm/back_ldbm.la"
fi
fi
......@@ -1987,6 +1965,7 @@ if test "$ol_enable_passwd" != no ; then
AC_DEFINE(SLAPD_PASSWD_DYNAMIC,1,
[define to support dynamic PASSWD backend])
BUILD_PASSWD_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-passwd/back_passwd.la"
fi
fi
......@@ -1998,6 +1977,7 @@ if test "$ol_link_perl" != no ; then
AC_DEFINE(SLAPD_PERL_DYNAMIC,1,
[define to support dynamic PERL backend])
BUILD_PERL_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-perl/back_perl.la"
fi
fi
......@@ -2009,6 +1989,7 @@ if test "$ol_enable_shell" != no ; then
AC_DEFINE(SLAPD_SHELL_DYNAMIC,1,
[define to support dynamic SHELL backend])
BUILD_SHELL_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-shell/back_shell.la"
fi
fi
......@@ -2020,6 +2001,7 @@ if test "$ol_enable_tcl" != no ; then
AC_DEFINE(SLAPD_TCL_DYNAMIC,1,
[define to support dynamic TCL backend])
BUILD_TCL_DYNAMIC=yes
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-tcl/back_tcl.la"
fi
fi
......@@ -2064,6 +2046,7 @@ AC_SUBST(LUTIL_LIBS)
AC_SUBST(SLAPD_MODULES_CPPFLAGS)
AC_SUBST(SLAPD_MODULES_LDFLAGS)
AC_SUBST(SLAPD_MODULES_LIST)
AC_SUBST(SLAPD_PERL_CPPFLAGS)
AC_SUBST(SLAPD_PERL_LDFLAGS)
......@@ -2073,6 +2056,7 @@ AC_SUBST(READLINE_LIBS)
AC_SUBST(SASL_LIBS)
AC_SUBST(TERMCAP_LIBS)
AC_SUBST(TLS_LIBS)
AC_SUBST(MODULES_LIBS)
dnl ----------------------------------------------------------------
dnl final output
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment