Overlay build environment

This commit is contained in:
Howard Chu 2003-12-06 10:59:27 +00:00
parent 723bc044e0
commit 64e337eacf
7 changed files with 1226 additions and 921 deletions

1919
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -242,6 +242,15 @@ OL_ARG_ENABLE(tcl,[ --enable-tcl enable tcl backend], no)dnl
OL_ARG_WITH(tcl_module,[ --with-tcl-module module type static|dynamic], static,
[static dynamic])
dnl ----------------------------------------------------------------
dnl SLAPD Overlay Options
AC_ARG_WITH(xxslapoverlays,[
SLAPD Overlay Options:])
OL_ARG_WITH(dyngroup,[ --with-dyngroup Dynamic Group overlay no|yes|mod], no,
[no yes mod])
OL_ARG_WITH(proxycache,[ --with-proxycache Proxy Cache overlay no|yes|mod], no,
[no yes mod])
dnl ----------------------------------------------------------------
dnl SLURPD OPTIONS
AC_ARG_WITH(xxslurpdoptions,[
@ -368,6 +377,12 @@ if test $ol_enable_slapd = no ; then
if test $ol_enable_rewrite = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-rewrite argument])
fi
if test $ol_with_dyngroup != no ; then
AC_MSG_WARN([slapd disabled, ignoring --with-dyngroup argument])
fi
if test $ol_with_proxycache != no ; then
AC_MSG_WARN([slapd disabled, ignoring --with-proxycache argument])
fi
# force settings to no
ol_enable_slapi=no
@ -413,6 +428,9 @@ if test $ol_enable_slapd = no ; then
ol_enable_rewrite=no
ol_with_dyngroup=no
ol_with_proxycache=no
elif test $ol_enable_ldbm = no ; then
dnl SLAPD without LDBM
@ -574,6 +592,11 @@ BUILD_SHELL_DYNAMIC=static
BUILD_TCL_DYNAMIC=static
BUILD_SQL_DYNAMIC=static
BUILD_DYNGROUP=no
BUILD_PROXYCACHE=no
SLAPD_DYNAMIC_OVERLAYS=
SLAPD_MODULES_LDFLAGS=
SLAPD_MODULES_CPPFLAGS=
@ -802,6 +825,14 @@ else
ol_with_shell_module=static
ol_with_tcl_module=static
ol_with_sql_module=static
if test $ol_with_dyngroup = mod ; then
AC_MSG_WARN([building static dyngroup overlay])
ol_with_dyngroup = yes
fi
if test $ol_with_proxycache = mod ; then
AC_MSG_WARN([building static proxycache overlay])
ol_with_proxycache = yes
fi
fi
dnl ----------------------------------------------------------------
@ -2596,6 +2627,9 @@ if test "$ol_link_modules" != no ; then
SLAPD_MODULES_LDFLAGS="-dlopen self"
fi
AC_DEFINE(SLAPD_MOD_STATIC,1,[statically linked module])
AC_DEFINE(SLAPD_MOD_DYNAMIC,2,[dynamically linked module])
if test "$ol_enable_bdb" != no ; then
AC_DEFINE(SLAPD_BDB,1,[define to support BDB backend])
BUILD_SLAPD=yes
@ -2805,6 +2839,28 @@ if test "$ol_link_sql" != no ; then
fi
fi
if test "$ol_with_dyngroup" != no ; then
BUILD_DYNGROUP=$ol_with_dyngroup
if test "$ol_with_dyngroup" = mod ; then
MFLAG=SLAPD_MOD_DYNAMIC
SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS dyngroup.la"
else
MFLAG=SLAPD_MOD_STATIC
fi
AC_DEFINE_UNQUOTED(SLAPD_OVER_DYNGROUP,$MFLAG,[define for Dynamic Group overlay])
fi
if test "$ol_with_proxycache" != no ; then
BUILD_PROXYCACHE=$ol_with_proxycache
if test "$ol_with_proxycache" = mod ; then
MFLAG=SLAPD_MOD_DYNAMIC
SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS pcache.la"
else
MFLAG=SLAPD_MOD_STATIC
fi
AC_DEFINE_UNQUOTED(SLAPD_OVER_PROXYCACHE,$MFLAG,[define for Proxy Cache overlay])
fi
if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
$BUILD_SLAPD = yes ; then
BUILD_SLURPD=yes
@ -2876,6 +2932,8 @@ AC_SUBST(BUILD_SLAPD)
AC_SUBST(BUILD_SHELL_DYNAMIC)
AC_SUBST(BUILD_SQL_DYNAMIC)
AC_SUBST(BUILD_TCL_DYNAMIC)
AC_SUBST(BUILD_DYNGROUP)
AC_SUBST(BUILD_PROXYCACHE)
AC_SUBST(BUILD_SLURPD)
AC_SUBST(LDAP_LIBS)
@ -2893,6 +2951,7 @@ AC_SUBST(SLAPD_MODULES_LDFLAGS)
AC_SUBST(SLAPD_NO_STATIC)
AC_SUBST(SLAPD_STATIC_BACKENDS)
AC_SUBST(SLAPD_DYNAMIC_BACKENDS)
AC_SUBST(SLAPD_DYNAMIC_OVERLAYS)
AC_SUBST(PERL_CPPFLAGS)
AC_SUBST(SLAPD_PERL_LDFLAGS)
@ -2959,6 +3018,7 @@ servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:
servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/mod.mk \
servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk \
servers/slapd/overlays/Makefile:build/top.mk:servers/slapd/overlays/Makefile.in:build/lib.mk:build/lib-shared.mk \
servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \

View File

@ -956,6 +956,12 @@
/* define to support modules */
#undef SLAPD_MODULES
/* statically linked module */
#undef SLAPD_MOD_STATIC
/* dynamically linked module */
#undef SLAPD_MOD_DYNAMIC
/* define to support BDB backend */
#undef SLAPD_BDB
@ -1034,6 +1040,12 @@
/* define to support dynamic SQL backend */
#undef SLAPD_SQL_DYNAMIC
/* define for Dynamic Group overlay */
#undef SLAPD_OVER_DYNGROUP
/* define for Proxy Cache overlay */
#undef SLAPD_OVER_PROXYCACHE
/* define to enable rewriting in back-ldap and back-meta */
#undef ENABLE_REWRITE

View File

@ -0,0 +1,45 @@
# Makefile.in for overlays
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 2003 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
SRCS = overlays.c dyngroup.c pcache.c
OBJS = overlays.lo dyngroup.lo pcache.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
MOD_DEFS = -DSLAPD_IMPORT
shared_LDAP_LIBS = $(LDAP_LIBLDAP_R_LA) $(LDAP_LIBLBER_LA)
NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
UNIX_LINK_LIBS = $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBRARY = ../liboverlays.a
PROGRAMS = @SLAPD_DYNAMIC_OVERLAYS@
XINCPATH = -I.. -I$(srcdir)/..
XDEFS = $(MODULES_CPPFLAGS)
dyngroup.la : dyngroup.lo $(@PLAT@_LINK_LIBS)
$(LTLINK_MOD) -module -o $@ dyngroup.lo version.lo $(LINK_LIBS)
pcache.la : pcache.lo $(@PLAT@_LINK_LIBS)
$(LTLINK_MOD) -module -o $@ pcache.lo version.lo $(LINK_LIBS)
install-local: $(PROGRAMS)
@-$(MKDIR) $(DESTDIR)$(moduledir)
@for i in $? ; do \
$(LTINSTALL) $(INSTALLFLAGS) -m 755 $$i $(DESTDIR)$(moduledir);\
done

View File

@ -3,6 +3,7 @@
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2003 The OpenLDAP Foundation.
* Copyright 2003 by Howard Chu.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -13,27 +14,6 @@
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* This is an altered version */
/*
* Copyright 2003, Howard Chu, All rights reserved. <hyc@symas.com>
*
* Permission is granted to anyone to use this software for any purpose
* on any computer system, and to alter it and redistribute it, subject
* to the following restrictions:
*
* 1. The author is not responsible for the consequences of use of this
* software, no matter how awful, even if they arise from flaws in it.
*
* 2. The origin of this software must not be misrepresented, either by
* explicit claim or by omission. Since few users ever read sources,
* credits should appear in the documentation.
*
* 3. Altered versions must be plainly marked as such, and must not be
* misrepresented as being the original software. Since few users
* ever read sources, credits should appear in the documentation.
*
* 4. This notice may not be removed or altered.
*/
/* ACKNOWLEDGEMENTS:
* This work was initially developed by Howard Chu for inclusion in
* OpenLDAP Software.
@ -41,6 +21,8 @@
#include "portable.h"
#ifdef SLAPD_OVER_DYNGROUP
#include <stdio.h>
#include <ac/string.h>
@ -161,7 +143,7 @@ static slap_overinst dyngroup;
* initialized and registered by some other function inside slapd.
*/
int init_module(int argc, char *argv[]) {
int dyngroup_init() {
dyngroup.on_bi.bi_type = "dyngroup";
dyngroup.on_bi.bi_db_config = dyngroup_config;
dyngroup.on_bi.bi_db_close = dyngroup_close;
@ -169,3 +151,11 @@ int init_module(int argc, char *argv[]) {
return overlay_register( &dyngroup );
}
#if SLAPD_OVER_DYNGROUP == SLAPD_MOD_DYNAMIC
int init_module(int argc, char *argv[]) {
return dyngroup_init();
}
#endif
#endif /* defined(SLAPD_OVER_DYNGROUP) */

View File

@ -0,0 +1,64 @@
/* overlays.c - Static overlay framework */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2003 The OpenLDAP Foundation.
* Copyright 2003 by Howard Chu.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in the file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* ACKNOWLEDGEMENTS:
* This work was initially developed by Howard Chu for inclusion in
* OpenLDAP Software.
*/
#include "portable.h"
#include "slap.h"
#if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
extern int dyngroup_init();
#endif
#if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
extern int pcache_init();
#endif
static struct {
char *name;
int (*func)();
} funcs[] = {
#if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
{ "Dynamic Group", dyngroup_init },
#endif
#if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
{ "Proxy Cache", pcache_init },
#endif
{ NULL, NULL }
};
int overlay_init() {
int i, rc = 0;
for ( i=0; funcs[i].name; i++ ) {
rc = funcs[i].func();
if ( rc ) {
#ifdef NEW_LOGGING
LDAP_LOG( BACKEND, ERR,
"%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
#endif
break;
}
}
return rc;
}

View File

@ -23,6 +23,8 @@
#include "portable.h"
#ifdef SLAPD_OVER_PROXYCACHE
#include <stdio.h>
#include <ac/string.h>
@ -757,6 +759,7 @@ static void cache_replacement(query_manager* qm, struct berval *result)
"Cache replacement invoked without "
"any query in LRU list\n", 0, 0, 0 );
#endif
return;
}
temp_id = bottom->template_id;
@ -1993,7 +1996,7 @@ compare_sets(struct attr_set* set, int i, int j)
static slap_overinst proxy_cache;
int init_module()
int pcache_init()
{
LDAPAttributeType *at;
int code;
@ -2027,3 +2030,11 @@ int init_module()
return overlay_register( &proxy_cache );
}
#if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_DYNAMIC
int init_module(int argc, char *argv[]) {
return pcache_init();
}
#endif
#endif /* defined(SLAPD_OVER_PROXYCACHE) */