Allow OpenLDAP to be built without LDBM.

This commit is contained in:
Kurt Zeilenga 1998-09-19 20:57:14 +00:00
parent e01f6988a3
commit b5d6d5e2a8
5 changed files with 421 additions and 217 deletions

417
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -24,10 +24,14 @@ AC_PREFIX_DEFAULT(/usr/local)
dnl General "enable" options dnl General "enable" options
CF_ARG_OPTION(debug,[ --enable-debug enable debugging (yes)],[ CF_ARG_OPTION(debug,[ --enable-debug enable debugging (yes)],[
LDAP_DEBUG=no],[LDAP_DEBUG=yes],yes)dnl LDAP_DEBUG=no],[LDAP_DEBUG=yes],yes)dnl
CF_ARG_OPTION(syslog,[ --enable-syslog enable syslog support (no)],[
LDAP_CLDAP=yes],[LDAP_CLDAP=no],no)dnl
CF_ARG_OPTION(libui,[ --enable-libui enable library user interface (yes)],[ CF_ARG_OPTION(libui,[ --enable-libui enable library user interface (yes)],[
LDAP_LIBUI=no],[LDAP_LIBUI=yes],yes)dnl LDAP_LIBUI=no],[LDAP_LIBUI=yes],yes)dnl
CF_ARG_OPTION(cache,[ --enable-cache enable caching (yes)],[ CF_ARG_OPTION(cache,[ --enable-cache enable caching (yes)],[
LDAP_CACHE=no],[LDAP_CACHE=yes],yes)dnl LDAP_CACHE=no],[LDAP_CACHE=yes],yes)dnl
CF_ARG_OPTION(dns,[ --enable-dns enable dns support (no)],[
LDAP_DNS=yes],[LDAP_DNS=no],no)dnl
CF_ARG_OPTION(referrals,[ --enable-referrals enable referrals (yes)],[ CF_ARG_OPTION(referrals,[ --enable-referrals enable referrals (yes)],[
LDAP_REFERRALS=no],[LDAP_REFERRALS=yes],yes)dnl LDAP_REFERRALS=no],[LDAP_REFERRALS=yes],yes)dnl
@ -119,12 +123,23 @@ fi
## general LDAP arguments ## general LDAP arguments
LDAP_DEFS= LDAP_DEFS=
LDAP_LIBS= LDAP_LIBS=
LDBM_DEFS=
LDBM_LIBS=
LUTIL_DEFS=
LUTIL_LIBS=
if test "$LDAP_DEBUG" = "yes" ; then if test "$LDAP_DEBUG" = "yes" ; then
LDAP_DEFS="$LDAP_DEFS -DLDAP_DEBUG" LDAP_DEFS="$LDAP_DEFS -DLDAP_DEBUG"
fi fi
if test "$LDAP_SYSLOG" = "yes" ; then
LDAP_DEFS="$LDAP_DEFS -DLDAP_SYSLOG"
fi
if test "$LDAP_DNS" = "yes" ; then
dnl AC_DEFINE(LDAP_DNS,1)
LDAP_DEFS="$LDAP_DEFS -DLDAP_DNS"
fi
if test "$LDAP_REFERRALS" = "yes" ; then if test "$LDAP_REFERRALS" = "yes" ; then
AC_DEFINE(LDAP_REFERRALS,1) dnl AC_DEFINE(LDAP_REFERRALS,1)
LDAP_DEFS="$LDAP_DEFS -DLDAP_REFERRALS" LDAP_DEFS="$LDAP_DEFS -DLDAP_REFERRALS"
fi fi
if test "$LDAP_CACHE" = "no" ; then if test "$LDAP_CACHE" = "no" ; then
@ -143,7 +158,6 @@ LDAPD_LIBS=
## slapd arguments ## slapd arguments
SLAPD_DEFS= SLAPD_DEFS=
SLAPD_LIBS= SLAPD_LIBS=
LUTIL_DEFS=
if test "$SLAPD_PHONETIC" = "yes" ; then if test "$SLAPD_PHONETIC" = "yes" ; then
AC_DEFINE(SLAPD_PHONETIC,1) AC_DEFINE(SLAPD_PHONETIC,1)
SLAPD_DEFS="$SLAPD_DEFS -DSOUNDEX" SLAPD_DEFS="$SLAPD_DEFS -DSOUNDEX"
@ -159,9 +173,11 @@ dnl AC_DEFINE(SLAPD_SHA1,1)
LUTIL_DEFS="$LUTIL_DEFS -DLDAP_SHA1" LUTIL_DEFS="$LUTIL_DEFS -DLDAP_SHA1"
fi fi
BUILD_LDBM=no
if test "$SLAPD_LDBM" = "yes" ; then if test "$SLAPD_LDBM" = "yes" ; then
dnl AC_DEFINE(SLAPD_LDBM,1) dnl AC_DEFINE(SLAPD_LDBM,1)
SLAPD_DEFS="$SLAPD_DEFS -DLDAP_LDBM" BUILD_LDBM=yes
LDBM_DEFS="$LDBM_DEFS -DLDAP_LDBM"
fi fi
if test "$SLAPD_PASSWD" = "yes" ; then if test "$SLAPD_PASSWD" = "yes" ; then
dnl AC_DEFINE(SLAPD_PASSWD,1) dnl AC_DEFINE(SLAPD_PASSWD,1)
@ -313,12 +329,13 @@ dnl AC_DEFINE(HAVE_LINUX_THREADS,1)
fi fi
fi fi
# check for strtok_r # check for strtok_r (and presumely other reentrant functions)
save_LIBS="$LIBS" save_LIBS="$LIBS"
LIBS="$save_LIBS $LTHREAD_LIBS" LIBS="$save_LIBS $LTHREAD_LIBS"
AC_CHECK_LIB(pthread,strtok_r) AC_CHECK_LIB(pthread,strtok_r)
if test $ac_cv_lib_pthread_strtok_r = no ; then if test $ac_cv_lib_pthread_strtok_r = no ; then
LIBS="$save_LIBS $LTHREAD_LIBS"
AC_CHECK_LIB(c_r,strtok_r) AC_CHECK_LIB(c_r,strtok_r)
AC_CHECK_FUNCS(strtok_r sched_yield) AC_CHECK_FUNCS(strtok_r sched_yield)
if test $ac_cv_lib_c_r_strtok_r = yes ; then if test $ac_cv_lib_c_r_strtok_r = yes ; then
@ -332,9 +349,6 @@ LIBS="$save_LIBS"
ldbm_use="none" ldbm_use="none"
LDBM_DEFS=
LDBM_LIBS=
if test "$SLAPD_LDBM" = "yes" ; then if test "$SLAPD_LDBM" = "yes" ; then
if test $ldbm_prefer = any -o $ldbm_prefer = dbbtree \ if test $ldbm_prefer = any -o $ldbm_prefer = dbbtree \
-o $ldbm_prefer = dbhash ; then -o $ldbm_prefer = dbhash ; then
@ -502,27 +516,30 @@ AC_CHECK_FUNCS( \
memcpy \ memcpy \
) )
AC_REPLACE_FUNCS(strsep strdup) AC_REPLACE_FUNCS(strdup)
dnl ---------------------------------------------------------------- dnl ----------------------------------------------------------------
# Check Configuration # Check Configuration
CF_SYS_ERRLIST CF_SYS_ERRLIST
dnl ----------------------------------------------------------------
AC_SUBST(BUILD_LDAPD) AC_SUBST(BUILD_LDAPD)
AC_SUBST(BUILD_SLAPD) AC_SUBST(BUILD_SLAPD)
AC_SUBST(SLAPD_LDBM) AC_SUBST(BUILD_LDBM)
AC_SUBST(SLAPD_PASSWD) AC_SUBST(BUILD_PASSWD)
AC_SUBST(SLAPD_SHELL) AC_SUBST(BUILD_SHELL)
AC_SUBST(BUILD_SLURPD) AC_SUBST(BUILD_SLURPD)
AC_SUBST(LDAP_DEFS) AC_SUBST(LDAP_DEFS)
AC_SUBST(LDAP_LIBS) AC_SUBST(LDAP_LIBS)
AC_SUBST(LDAPD_DEFS) AC_SUBST(LDAPD_DEFS)
AC_SUBST(LDAPD_LIBS) AC_SUBST(LDAPD_LIBS)
AC_SUBST(SLAPD_DEFS) AC_SUBST(SLAPD_DEFS)
AC_SUBST(SLAPD_LIBS) AC_SUBST(SLAPD_LIBS)
AC_SUBST(SLAPD_LDBM)
AC_SUBST(SLAPD_PASSWD)
AC_SUBST(SLAPD_SHELL)
AC_SUBST(SLURPD_DEFS) AC_SUBST(SLURPD_DEFS)
AC_SUBST(SLURPD_LIBS) AC_SUBST(SLURPD_LIBS)
AC_SUBST(LDBM_DEFS) AC_SUBST(LDBM_DEFS)
@ -532,6 +549,10 @@ AC_SUBST(LTHREAD_LIBS)
AC_SUBST(LUTIL_DEFS) AC_SUBST(LUTIL_DEFS)
AC_SUBST(LUTIL_LIBS) AC_SUBST(LUTIL_LIBS)
dnl ----------------------------------------------------------------
dnl final output
dnl
dnl AC_OUTPUT( \ dnl AC_OUTPUT( \
dnl contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \ dnl contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
dnl contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \ dnl contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \

View file

@ -79,9 +79,6 @@
/* define this to remove -lldap cache support */ /* define this to remove -lldap cache support */
#undef LDAP_NOCACHE #undef LDAP_NOCACHE
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
/* define this for phonetic support */ /* define this for phonetic support */
#undef SLAPD_PHONETIC #undef SLAPD_PHONETIC

View file

@ -1,5 +1,13 @@
/* ldbm.c - ldap dbm compatibility routines */ /* ldbm.c - ldap dbm compatibility routines */
/* Patched for Berkeley DB version 2.0; /KSp; 98/02/23
*
* - basic implementation; 1998/02/23, /KSp
* - DB_DBT_MALLOC ; 1998/03/22, /KSp
*/
#ifdef LDAP_LDBM
#include <stdio.h> #include <stdio.h>
#include "ldbm.h" #include "ldbm.h"
@ -121,10 +129,41 @@ ldbm_errno( LDBM ldbm )
* * * *
*****************************************************************/ *****************************************************************/
#ifdef LDBM_USE_DB2
/*************************************************
* *
* A malloc routine for use with DB_DBT_MALLOC *
* *
*************************************************/
#include <stdlib.h>
void *
ldbm_malloc( size_t size )
{
return( calloc( 1, size ));
}
#endif
LDBM LDBM
ldbm_open( char *name, int rw, int mode, int dbcachesize ) ldbm_open( char *name, int rw, int mode, int dbcachesize )
{ {
LDBM ret; LDBM ret = NULL;
#ifdef LDBM_USE_DB2
DB_INFO dbinfo;
memset( &dbinfo, 0, sizeof( dbinfo ));
dbinfo.db_cachesize = dbcachesize;
dbinfo.db_pagesize = DEFAULT_DB_PAGE_SIZE;
dbinfo.db_malloc = ldbm_malloc;
db_open( name, DB_TYPE, rw, mode, NULL, &dbinfo, &ret );
#else
void *info; void *info;
BTREEINFO binfo; BTREEINFO binfo;
HASHINFO hinfo; HASHINFO hinfo;
@ -140,14 +179,22 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize )
} else { } else {
info = NULL; info = NULL;
} }
ret = dbopen( name, rw, mode, DB_TYPE, info ); ret = dbopen( name, rw, mode, DB_TYPE, info );
#endif
return( ret ); return( ret );
} }
void void
ldbm_close( LDBM ldbm ) ldbm_close( LDBM ldbm )
{ {
#ifdef LDBM_USE_DB2
(*ldbm->close)( ldbm, 0 );
#else
(*ldbm->close)( ldbm ); (*ldbm->close)( ldbm );
#endif
} }
void void
@ -167,6 +214,10 @@ ldbm_datum_dup( LDBM ldbm, Datum data )
{ {
Datum dup; Datum dup;
#ifdef LDBM_USE_DB2
memset( &dup, 0, sizeof( dup ));
#endif
if ( data.dsize == 0 ) { if ( data.dsize == 0 ) {
dup.dsize = 0; dup.dsize = 0;
dup.dptr = NULL; dup.dptr = NULL;
@ -186,9 +237,18 @@ ldbm_fetch( LDBM ldbm, Datum key )
Datum data; Datum data;
int rc; int rc;
#ifdef LDBM_USE_DB2
memset( &data, 0, sizeof( data ));
data.flags = DB_DBT_MALLOC;
if ( (rc = (*ldbm->get)( ldbm, NULL, &key, &data, 0 )) != 0 ) {
if ( data.dptr ) free( data.dptr );
#else
if ( (rc = (*ldbm->get)( ldbm, &key, &data, 0 )) == 0 ) { if ( (rc = (*ldbm->get)( ldbm, &key, &data, 0 )) == 0 ) {
data = ldbm_datum_dup( ldbm, data ); data = ldbm_datum_dup( ldbm, data );
} else { } else {
#endif
data.dptr = NULL; data.dptr = NULL;
data.dsize = 0; data.dsize = 0;
} }
@ -201,7 +261,12 @@ ldbm_store( LDBM ldbm, Datum key, Datum data, int flags )
{ {
int rc; int rc;
#ifdef LDBM_USE_DB2
rc = (*ldbm->put)( ldbm, NULL, &key, &data, flags & ~LDBM_SYNC );
rc = (-1 ) * rc;
#else
rc = (*ldbm->put)( ldbm, &key, &data, flags & ~LDBM_SYNC ); rc = (*ldbm->put)( ldbm, &key, &data, flags & ~LDBM_SYNC );
#endif
if ( flags & LDBM_SYNC ) if ( flags & LDBM_SYNC )
(*ldbm->sync)( ldbm, 0 ); (*ldbm->sync)( ldbm, 0 );
return( rc ); return( rc );
@ -212,38 +277,88 @@ ldbm_delete( LDBM ldbm, Datum key )
{ {
int rc; int rc;
#ifdef LDBM_USE_DB2
rc = (*ldbm->del)( ldbm, NULL, &key, 0 );
rc = (-1 ) * rc;
#else
rc = (*ldbm->del)( ldbm, &key, 0 ); rc = (*ldbm->del)( ldbm, &key, 0 );
#endif
(*ldbm->sync)( ldbm, 0 ); (*ldbm->sync)( ldbm, 0 );
return( rc ); return( rc );
} }
Datum Datum
#ifdef LDBM_USE_DB2
ldbm_firstkey( LDBM ldbm, DBC **dbch )
#else
ldbm_firstkey( LDBM ldbm ) ldbm_firstkey( LDBM ldbm )
#endif
{ {
Datum key, data; Datum key, data;
int rc; int rc;
#ifdef LDBM_USE_DB2
DBC *dbci;
memset( &key, 0, sizeof( key ));
memset( &data, 0, sizeof( data ));
key.flags = data.flags = DB_DBT_MALLOC;
/* acquire a cursor for the DB */
if ( (*ldbm->cursor)( ldbm, NULL, &dbci )) {
return( key );
} else {
*dbch = dbci;
if ( (*dbci->c_get)( dbci, &key, &data, DB_NEXT ) == 0 ) {
if ( data.dptr ) free( data.dptr );
#else
if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_FIRST )) == 0 ) { if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_FIRST )) == 0 ) {
key = ldbm_datum_dup( ldbm, key ); key = ldbm_datum_dup( ldbm, key );
#endif
} else { } else {
key.dptr = NULL; key.dptr = NULL;
key.dsize = 0; key.dsize = 0;
} }
#ifdef LDBM_USE_DB2
}
#endif
return( key ); return( key );
} }
Datum Datum
#ifdef LDBM_USE_DB2
ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp )
#else
ldbm_nextkey( LDBM ldbm, Datum key ) ldbm_nextkey( LDBM ldbm, Datum key )
#endif
{ {
Datum data; Datum data;
int rc; int rc;
#ifdef LDBM_USE_DB2
void *oldKey = key.dptr;
memset( &data, 0, sizeof( data ));
data.flags = DB_DBT_MALLOC;
if ( (*dbcp->c_get)( dbcp, &key, &data, DB_NEXT ) == 0 ) {
if ( data.dptr ) free( data.dptr );
#else
if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_NEXT )) == 0 ) { if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_NEXT )) == 0 ) {
key = ldbm_datum_dup( ldbm, key ); key = ldbm_datum_dup( ldbm, key );
#endif
} else { } else {
key.dptr = NULL; key.dptr = NULL;
key.dsize = 0; key.dsize = 0;
} }
#ifdef LDBM_USE_DB2
if ( oldKey ) free( oldKey );
#endif
return( key ); return( key );
} }
@ -346,3 +461,4 @@ ldbm_errno( LDBM ldbm )
#endif /* ndbm */ #endif /* ndbm */
#endif /* db */ #endif /* db */
#endif /* gdbm */ #endif /* gdbm */
#endif /* ldbm */

View file

@ -30,7 +30,16 @@ OBJS2 = ../config.o ../ch_malloc.o ../backend.o ../charray.o \
../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \ ../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \
../schemaparse.o ../strdup.o ../schemaparse.o ../strdup.o
all-local: build-edb2ldif build-chlog2replog $(PROGRAMS) all-local: build-ldbm build-edb2ldif build-chlog2replog
build-ldbm: FORCE
@if [ "$(BUILD_LDBM)" = "yes" ]; then \
$(MAKE) $(MFLAGS) ldbm-tools; \
else \
echo "run configure with --with-ldbm to build LDBM tools"; \
fi
ldbm-tools: $(PROGRAMS)
XDEFS = @SLAPD_DEFS@ @LDBM_DEFS@ @LTHREAD_DEFS@ XDEFS = @SLAPD_DEFS@ @LDBM_DEFS@ @LTHREAD_DEFS@
XLIBS = @SLAPD_LIBS@ -lavl -lldbm @LDBM_LIBS@ -llthread @LTHREAD_LIBS@ -llutil @LUTIL_LIBS@ XLIBS = @SLAPD_LIBS@ -lavl -lldbm @LDBM_LIBS@ -llthread @LTHREAD_LIBS@ -llutil @LUTIL_LIBS@
@ -95,21 +104,37 @@ clean-local: FORCE
$(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) edb2-vers.c *.o a.out core $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) edb2-vers.c *.o a.out core
depend-local: FORCE depend-local: FORCE
@if [ "$(HAVE_ISODE)" = "yes" ]; then \ @DEPEND=no ; DEPEND_LDBM= ; DEPEND_ISODE= ;\
DEPENDEXTRAS="$(ISODEINCLUDEFLAG) chlog2replog.c $(EDB2LDIFSRCS)"; \ if [ "$(BUILD_LDBM)" = "yes" ]; then \
DEPEND_LDBM="$(SRCS)"; \
DEPEND=yes ; \
fi; \ fi; \
$(MKDEP) $(DEFS) $(DEFINES) $$DEPENDEXTRAS $(SRCS) if [ "$(HAVE_ISODE)" = "yes" ]; then \
DEPEND_ISODE="$(ISODEINCLUDEFLAG) chlog2replog.c $(EDB2LDIFSRCS)"; \
DEPEND=yes ; \
fi; \
if [ "$$DEPEND" = "yes" ]; then \
$(MKDEP) $(DEFS) $(DEFINES) $$DEPEND_ISODE $$DEPEND_LDBM \
else \
exit 0 ; \
fi
install-local: install-isode FORCE install-local: install-ldbm install-isode FORCE
install-ldbm: FORCE
@-$(MKDIR) -p $(sbindir) @-$(MKDIR) -p $(sbindir)
$(INSTALL) $(INSTALLFLAGS) -m 755 ldif2ldbm $(sbindir) @if [ "$(BUILD_LDBM)" = "yes" ]; then \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldif2index $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2ldbm $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldif2id2entry $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2index $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldif2id2children $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2id2entry $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldbmcat $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2id2children $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldif $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 ldbmcat $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 centipede $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 ldif $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldbmtest $(sbindir) $(INSTALL) $(INSTALLFLAGS) -m 755 centipede $(sbindir) \
$(INSTALL) $(INSTALLFLAGS) -m 755 ldbmtest $(sbindir) \
else \
exit 0; \
fi
install-isode: FORCE install-isode: FORCE
@-$(MKDIR) -p $(sbindir) @-$(MKDIR) -p $(sbindir)