summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);