summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/ldb/Makefile.in42
-rwxr-xr-xsource4/lib/ldb/autogen.sh9
-rw-r--r--source4/lib/ldb/build_macros.m414
-rw-r--r--source4/lib/ldb/configure.ac4
-rw-r--r--source4/lib/ldb/external/libevents.m49
-rw-r--r--source4/lib/ldb/external/libtalloc.m49
-rw-r--r--source4/lib/ldb/external/libtdb.m49
-rw-r--r--source4/lib/ldb/ldb.mk29
8 files changed, 78 insertions, 47 deletions
diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in
index ecb6b6516b..8d95dae7ea 100644
--- a/source4/lib/ldb/Makefile.in
+++ b/source4/lib/ldb/Makefile.in
@@ -11,9 +11,11 @@ includedir = @includedir@
libdir = @libdir@
bindir = @bindir@
mandir = @mandir@
-VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@:@eventsdir@
+VPATH = @srcdir@:@libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
+sharedbuilddir = @sharedbuilddir@
+INSTALLCMD = @INSTALL@
SLAPD = @SLAPD@
SWIG = swig
EXTRA_OBJ=@EXTRA_OBJ@
@@ -21,9 +23,7 @@ TESTS=test-tdb.sh @TESTS@
PACKAGE_VERSION = @PACKAGE_VERSION@
PYTHON = @PYTHON@
PYTHON_CONFIG = @PYTHON_CONFIG@
-tdbdir = @tdbdir@
ldbdir = $(srcdir)
-tallocdir = @tallocdir@
TALLOC_LIBS = @TALLOC_LIBS@
TALLOC_CFLAGS = @TALLOC_CFLAGS@
@@ -33,6 +33,7 @@ TDB_LIBS = @TDB_LIBS@
TDB_CFLAGS = @TDB_CFLAGS@
TDB_OBJ = @TDB_OBJ@
+EVENTS_LIBS = @EVENTS_LIBS@
EVENTS_CFLAGS = @EVENTS_CFLAGS@
EVENTS_OBJ = @EVENTS_OBJ@
@@ -65,7 +66,7 @@ OBJS = $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(EVENTS_OBJ) $(TA
headers = $(srcdir)/include/ldb.h $(srcdir)/include/ldb_errors.h $(srcdir)/include/ldb_handlers.h
-BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest bin/oLschema2ldif
+BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest
EXAMPLES = examples/ldbreader examples/ldifreader
@@ -81,24 +82,37 @@ nssdir:
@mkdir -p $(NSSDIR)
SONAME = libldb.$(SHLIBEXT).0
-SOLIB = lib/libldb.$(SHLIBEXT).$(PACKAGE_VERSION)
+SOLIB = libldb.$(SHLIBEXT).$(PACKAGE_VERSION)
+LIBSOLIB = lib/$(SOLIB)
STATICLIB = lib/libldb.a
-lib/$(SONAME): $(SOLIB)
+lib/$(SONAME): $(LIBSOLIB)
ln -fs libldb.$(SHLIBEXT).$(PACKAGE_VERSION) $@
-lib/libldb.$(SHLIBEXT): $(SOLIB)
+lib/libldb.$(SHLIBEXT): $(LIBSOLIB)
ln -fs libldb.$(SHLIBEXT).$(PACKAGE_VERSION) $@
-lib/libnss_ldb.$(SHLIBEXT).2: $(NSS_OBJ) $(SOLIB)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(NSS_OBJ) $(LDFLAGS) $(SOLIB) @SONAMEFLAG@libnss_ldb.$(SHLIBEXT).2
+lib/libnss_ldb.$(SHLIBEXT).2: $(NSS_OBJ) $(LIBSOLIB)
+ $(SHLD) $(SHLD_FLAGS) -o $@ $(NSS_OBJ) $(LDFLAGS) $(LIBSOLIB) @SONAMEFLAG@libnss_ldb.$(SHLIBEXT).2
-$(SOLIB): $(OBJS)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) $(TALLOC_LIBS) $(TDB_LIBS) $(LIBDL) $(LDAP_LIBS) @SONAMEFLAG@$(SONAME)
+$(LIBSOLIB): $(OBJS)
+ $(SHLD) $(SHLD_FLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) $(TALLOC_LIBS) $(TDB_LIBS) $(EVENTS_LIBS) $(LIBDL) $(LDAP_LIBS) @SONAMEFLAG@$(SONAME)
+ ln -sf libldb.$(SHLIBEXT).$(PACKAGE_VERSION) lib/libldb.$(SHLIBEXT)
-all: showflags dirs $(OBJS) $(STATICLIB) $(SOLIB) $(BINS) $(EXAMPLES) manpages \
+all: showflags dirs $(OBJS) $(STATICLIB) $(LIBSOLIB) $(BINS) $(EXAMPLES) manpages \
@PYTHON_BUILD_TARGET@
+shared-build: all
+ ${INSTALLCMD} -d $(sharedbuilddir)/lib
+ ${INSTALLCMD} -m 644 $(STATICLIB) $(sharedbuilddir)/lib
+ ${INSTALLCMD} -m 755 $(LIBSOLIB) $(sharedbuilddir)/lib
+ ln -sf $(SOLIB) $(sharedbuilddir)/lib/$(SONAME)
+ ln -sf $(SOLIB) $(sharedbuilddir)/lib/libldb.so
+ ${INSTALLCMD} -d $(sharedbuilddir)/include
+ ${INSTALLCMD} -m 644 $(srcdir)/include/ldb.h $(sharedbuilddir)/include
+ ${INSTALLCMD} -m 644 $(srcdir)/include/ldb_errors.h $(sharedbuilddir)/include
+ ${INSTALLCMD} -m 644 $(srcdir)/include/ldb_handlers.h $(sharedbuilddir)/include
+
dirs:
@mkdir -p $(DIRS)
@@ -110,7 +124,7 @@ doxygen::
clean::
rm -f *.o */*.o *.gcov */*.gc?? tdbtest.ldb*
- rm -f $(BINS) $(TDB_OBJ) $(TALLOC_OBJ) $(STATICLIB) $(NSS_LIB) $(SOLIB)
+ rm -f $(BINS) $(TDB_OBJ) $(TALLOC_OBJ) $(STATICLIB) $(NSS_LIB) $(LIBSOLIB)
rm -f $(POPT_OBJ)
rm -f man/*.1 man/*.3 man/*.html
rm -f $(EXAMPLES)
@@ -149,7 +163,7 @@ installheaders:: installdirs
cp $(headers) $(DESTDIR)$(includedir)
installlibs:: installdirs
- cp $(STATICLIB) $(SOLIB) $(DESTDIR)$(libdir)
+ cp $(STATICLIB) $(LIBSOLIB) $(DESTDIR)$(libdir)
cp ldb.pc $(DESTDIR)$(libdir)/pkgconfig
installbin:: installdirs
diff --git a/source4/lib/ldb/autogen.sh b/source4/lib/ldb/autogen.sh
index b81e5b094e..52fc8b63e2 100755
--- a/source4/lib/ldb/autogen.sh
+++ b/source4/lib/ldb/autogen.sh
@@ -3,14 +3,7 @@
rm -rf autom4te.cache
rm -f configure config.h.in
-IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace"
-IPATHS="$IPATHS -I lib/events -I events -I ../events"
-IPATHS="$IPATHS -I lib/talloc -I talloc -I ../talloc"
-IPATHS="$IPATHS -I lib/tdb -I tdb -I ../tdb"
-IPATHS="$IPATHS -I lib/popt -I popt -I ../popt"
-
-# Always keep this listed last, so the built-in versions of tdb and talloc
-# get used if available.
+IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace -I ../../../lib/replace"
IPATHS="$IPATHS -I ./external"
autoheader $IPATHS || exit 1
diff --git a/source4/lib/ldb/build_macros.m4 b/source4/lib/ldb/build_macros.m4
new file mode 100644
index 0000000000..c036668cd1
--- /dev/null
+++ b/source4/lib/ldb/build_macros.m4
@@ -0,0 +1,14 @@
+AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
+ [ AC_ARG_WITH([shared-build-dir],
+ [AC_HELP_STRING([--with-shared-build-dir=DIR],
+ [temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
+
+ sharedbuilddir="$srcdir/sharedbuild"
+ if test x"$with_shared_build_dir" != x; then
+ sharedbuilddir=$with_shared_build_dir
+ CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
+ LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
+ fi
+ AC_SUBST(sharedbuilddir)
+ ])
+
diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac
index 4a703e8139..095caa5e92 100644
--- a/source4/lib/ldb/configure.ac
+++ b/source4/lib/ldb/configure.ac
@@ -43,6 +43,10 @@ AC_SUBST(LDB_MODULESDIR)
TESTS=""
EXTRA_OBJ=""
+m4_include(build_macros.m4)
+BUILD_WITH_SHARED_BUILD_DIR
+
+m4_include(pkg.m4)
m4_include(libpopt.m4)
m4_include(libtalloc.m4)
m4_include(libtdb.m4)
diff --git a/source4/lib/ldb/external/libevents.m4 b/source4/lib/ldb/external/libevents.m4
index f0f80e9d8e..4fd2e71ec2 100644
--- a/source4/lib/ldb/external/libevents.m4
+++ b/source4/lib/ldb/external/libevents.m4
@@ -1,4 +1,7 @@
-m4_include(pkg.m4)
-EVENTS_OBJ=""
AC_SUBST(EVENTS_OBJ)
-PKG_CHECK_MODULES(EVENTS, events)
+AC_SUBST(EVENTS_CFLAGS)
+AC_SUBST(EVENTS_LIBS)
+
+AC_CHECK_HEADER(events.h,
+ [AC_CHECK_LIB(events, event_context_init, [EVENTS_LIBS="-levents"]) ],
+ [PKG_CHECK_MODULES(EVENTS, events)])
diff --git a/source4/lib/ldb/external/libtalloc.m4 b/source4/lib/ldb/external/libtalloc.m4
index d08bd42065..a4c5b8a9d9 100644
--- a/source4/lib/ldb/external/libtalloc.m4
+++ b/source4/lib/ldb/external/libtalloc.m4
@@ -1,4 +1,7 @@
-m4_include(pkg.m4)
-TALLOC_OBJ=""
AC_SUBST(TALLOC_OBJ)
-PKG_CHECK_MODULES(TALLOC, talloc)
+AC_SUBST(TALLOC_CFLAGS)
+AC_SUBST(TALLOC_LIBS)
+
+AC_CHECK_HEADER(talloc.h,
+ [AC_CHECK_LIB(talloc, talloc_init, [TALLOC_LIBS="-ltalloc"]) ],
+ [PKG_CHECK_MODULES(TALLOC, talloc)])
diff --git a/source4/lib/ldb/external/libtdb.m4 b/source4/lib/ldb/external/libtdb.m4
index 4c1f4b530e..8c2cab702f 100644
--- a/source4/lib/ldb/external/libtdb.m4
+++ b/source4/lib/ldb/external/libtdb.m4
@@ -1,4 +1,7 @@
-m4_include(pkg.m4)
-TDB_OBJ=""
AC_SUBST(TDB_OBJ)
-PKG_CHECK_MODULES(TDB, tdb >= 1.1.0)
+AC_SUBST(TDB_CFLAGS)
+AC_SUBST(TDB_LIBS)
+
+AC_CHECK_HEADER(tdb.h,
+ [AC_CHECK_LIB(tdb, tdb_open, [TDB_LIBS="-ltdb"]) ],
+ [PKG_CHECK_MODULES(TDB, tdb >= 1.1.0)])
diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk
index df11e9d2ab..a7b1cb0c69 100644
--- a/source4/lib/ldb/ldb.mk
+++ b/source4/lib/ldb/ldb.mk
@@ -1,7 +1,7 @@
-LDB_LIB = $(STATICLIB)
+LDB_LIB = -Llib -lldb
-LIB_FLAGS=$(LDFLAGS) -Llib $(LDB_LIB) $(LIBS) $(POPT_LIBS) $(TALLOC_LIBS) \
- $(TDB_LIBS) $(LDAP_LIBS) $(LIBDL)
+LIB_FLAGS=$(LDFLAGS) $(LIBS) $(LDB_LIB) $(POPT_LIBS) $(TALLOC_LIBS) \
+ $(TDB_LIBS) $(EVENTS_LIBS) $(LDAP_LIBS) $(LIBDL)
LDB_TDB_DIR=ldb_tdb
LDB_TDB_OBJ=$(LDB_TDB_DIR)/ldb_tdb.o \
@@ -34,34 +34,31 @@ lib/libldb.a: $(OBJS)
sample.$(SHLIBEXT): tests/sample_module.o
$(MDLD) $(MDLD_FLAGS) -o $@ tests/sample_module.o
-bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS)
+bin/ldbadd: tools/ldbadd.o tools/cmdline.o
$(CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/ldbsearch: tools/ldbsearch.o tools/cmdline.o $(LIBS)
+bin/ldbsearch: tools/ldbsearch.o tools/cmdline.o
$(CC) -o bin/ldbsearch tools/ldbsearch.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/ldbdel: tools/ldbdel.o tools/cmdline.o $(LIBS)
+bin/ldbdel: tools/ldbdel.o tools/cmdline.o
$(CC) -o bin/ldbdel tools/ldbdel.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/ldbmodify: tools/ldbmodify.o tools/cmdline.o $(LIBS)
+bin/ldbmodify: tools/ldbmodify.o tools/cmdline.o
$(CC) -o bin/ldbmodify tools/ldbmodify.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/ldbedit: tools/ldbedit.o tools/cmdline.o $(LIBS)
+bin/ldbedit: tools/ldbedit.o tools/cmdline.o
$(CC) -o bin/ldbedit tools/ldbedit.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/ldbrename: tools/ldbrename.o tools/cmdline.o $(LIBS)
+bin/ldbrename: tools/ldbrename.o tools/cmdline.o
$(CC) -o bin/ldbrename tools/ldbrename.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/ldbtest: tools/ldbtest.o tools/cmdline.o $(LIBS)
+bin/ldbtest: tools/ldbtest.o tools/cmdline.o
$(CC) -o bin/ldbtest tools/ldbtest.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-bin/oLschema2ldif: tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIBS)
- $(CC) -o bin/oLschema2ldif tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIB_FLAGS)
-
-examples/ldbreader: examples/ldbreader.o $(LIBS)
+examples/ldbreader: examples/ldbreader.o
$(CC) -o examples/ldbreader examples/ldbreader.o $(LIB_FLAGS)
-examples/ldifreader: examples/ldifreader.o $(LIBS)
+examples/ldifreader: examples/ldifreader.o
$(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
# Python bindings
@@ -70,7 +67,7 @@ build-python:: _ldb.$(SHLIBEXT)
ldb_wrap.o: $(ldbdir)/ldb_wrap.c
$(CC) $(PICFLAG) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
-_ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o
+_ldb.$(SHLIBEXT): ldb_wrap.o
$(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags`
install-python:: build-python