Add shared-build target to tdb.
authorSimo Sorce <idra@samba.org>
Fri, 19 Sep 2008 19:15:46 +0000 (15:15 -0400)
committerSimo Sorce <idra@samba.org>
Fri, 19 Sep 2008 22:07:53 +0000 (18:07 -0400)
Useful to build multiple standalone libraries that depend on each other
without having to install them to the final install dir during the build.

lib/tdb/Makefile.in
lib/tdb/build_macros.m4 [new file with mode: 0644]
lib/tdb/configure.ac
lib/tdb/include/tdb.h

index 090bb6e2dcfefe8e0fd5d7821f64d62e783fcbcd..9915d88264b9a486a3da092fe10b896330874655 100644 (file)
@@ -12,6 +12,8 @@ libdir = @libdir@
 VPATH = @srcdir@:@libreplacedir@
 srcdir = @srcdir@
 builddir = @builddir@
+sharedbuilddir = @sharedbuilddir@
+INSTALLCMD = @INSTALL@
 CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude 
 CFLAGS = $(CPPFLAGS) @CFLAGS@
 LDFLAGS = @LDFLAGS@
@@ -43,6 +45,15 @@ install:: all
 $(TDB_SOLIB): $(TDB_OBJ)
        $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(TDB_SONAME)
 
+shared-build: all
+       ${INSTALLCMD} -d $(sharedbuilddir)/lib
+       ${INSTALLCMD} -m 644 libtdb.a $(sharedbuilddir)/lib
+       ${INSTALLCMD} -m 755 $(TDB_SOLIB) $(sharedbuilddir)/lib
+       ln -sf $(TDB_SOLIB) $(sharedbuilddir)/lib/$(TDB_SONAME)
+       ln -sf $(TDB_SOLIB) $(sharedbuilddir)/lib/libtdb.so
+       ${INSTALLCMD} -d $(sharedbuilddir)/include
+       ${INSTALLCMD} -m 644 $(srcdir)/include/tdb.h $(sharedbuilddir)/include
+
 check: test
 
 test:: $(PYTHON_CHECK_TARGET)
diff --git a/lib/tdb/build_macros.m4 b/lib/tdb/build_macros.m4
new file mode 100644 (file)
index 0000000..c036668
--- /dev/null
@@ -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)
+  ])
+
index eaf70d30b4470f757a5366e4de7fcb63264f13dd..4bf2e98e8f1d1257294aa65abba406d43a6ff48a 100644 (file)
@@ -27,4 +27,8 @@ if test -z "$PYTHON_CONFIG"; then
        PYTHON_INSTALL_TARGET=""
        PYTHON_CHECK_TARGET=""
 fi
+
+m4_include(build_macros.m4)
+BUILD_WITH_SHARED_BUILD_DIR
+
 AC_OUTPUT(Makefile tdb.pc)
index 0008085de540b525bb02fc1ff178d06bc898a02d..c41c9941f0691074b59ec73e36f4ff003a9e9ef9 100644 (file)
@@ -30,6 +30,7 @@
 extern "C" {
 #endif
 
+#include "signal.h"
 
 /* flags to tdb_store() */
 #define TDB_REPLACE 1          /* Unused */