summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-09-19 15:12:28 -0400
committerSimo Sorce <idra@samba.org>2008-09-19 18:06:46 -0400
commit49b89633f175b81d7415f835009b6d14f6e10933 (patch)
treeb2bb5d683c41eee56ce770a53784148564445ca6 /lib/replace
parent258cec7756952f552ca2c4213a6724af546a3eab (diff)
downloadsamba-49b89633f175b81d7415f835009b6d14f6e10933.tar.gz
samba-49b89633f175b81d7415f835009b6d14f6e10933.tar.bz2
samba-49b89633f175b81d7415f835009b6d14f6e10933.zip
Fix standalone builds adjusting to new relative path.
Add shared-build target to libreplace. Useful to build multiple standalone libraries that depend on each other without having to install them to the final install dir during the build.
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/Makefile.in13
-rw-r--r--lib/replace/build_macros.m414
-rw-r--r--lib/replace/configure.ac3
-rw-r--r--lib/replace/libreplace.m44
-rw-r--r--lib/replace/test/testsuite.c3
5 files changed, 31 insertions, 6 deletions
diff --git a/lib/replace/Makefile.in b/lib/replace/Makefile.in
index c989835a8d..c889a0e457 100644
--- a/lib/replace/Makefile.in
+++ b/lib/replace/Makefile.in
@@ -9,7 +9,8 @@ libdir = @libdir@
VPATH = @libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
-INSTALL = @INSTALL@
+sharedbuilddir = @sharedbuilddir@
+INSTALLCMD = @INSTALL@
LIBS = @LIBS@
.PHONY: test all showflags install installcheck clean distclean realdistclean
@@ -29,8 +30,14 @@ showflags:
@echo ' LIBS = $(LIBS)'
install: all
- mkdir -p $(libdir)
- $(INSTALL) libreplace.a $(libdir)
+ ${INSTALLCMD} -d $(libdir)
+ ${INSTALLCMD} -m 644 libreplace.a $(libdir)
+
+shared-build: all
+ ${INSTALLCMD} -d $(sharedbuilddir)/include
+ ${INSTALLCMD} -m 644 replace.h $(sharedbuilddir)/include
+ ${INSTALLCMD} -d $(sharedbuilddir)/lib
+ ${INSTALLCMD} -m 644 libreplace.a $(sharedbuilddir)/lib
libreplace.a: $(OBJS)
ar -rcsv $@ $(OBJS)
diff --git a/lib/replace/build_macros.m4 b/lib/replace/build_macros.m4
new file mode 100644
index 0000000000..c036668cd1
--- /dev/null
+++ b/lib/replace/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/lib/replace/configure.ac b/lib/replace/configure.ac
index 81997e09b7..0361825a02 100644
--- a/lib/replace/configure.ac
+++ b/lib/replace/configure.ac
@@ -22,6 +22,9 @@ if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wno-format-y2k"
fi
+m4_include(build_macros.m4)
+BUILD_WITH_SHARED_BUILD_DIR
+
LIBS="${LIBREPLACE_NETWORK_LIBS}"
AC_SUBST(LIBS)
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index dc7d88e6e1..e563acfd79 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -5,7 +5,7 @@ echo "LIBREPLACE_LOCATION_CHECKS: START"
dnl find the libreplace sources. This is meant to work both for
dnl libreplace standalone builds, and builds of packages using libreplace
libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace"
+libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
for d in $libreplacepaths; do
if test -f "$d/replace.c"; then
libreplacedir="$d"
@@ -34,7 +34,7 @@ echo "LIBREPLACE_BROKEN_CHECKS: START"
dnl find the libreplace sources. This is meant to work both for
dnl libreplace standalone builds, and builds of packages using libreplace
libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace"
+libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
for d in $libreplacepaths; do
if test -f "$d/replace.c"; then
libreplacedir="$d"
diff --git a/lib/replace/test/testsuite.c b/lib/replace/test/testsuite.c
index 1e8290906e..dcb05fbbf4 100644
--- a/lib/replace/test/testsuite.c
+++ b/lib/replace/test/testsuite.c
@@ -1069,7 +1069,8 @@ bool torture_local_replace(struct torture_context *ctx)
return ret;
}
-#if _SAMBA_BUILD_<4
+#if _SAMBA_BUILD_>3
+#else
int main(void)
{
bool ret = torture_local_replace(NULL);