From 49b89633f175b81d7415f835009b6d14f6e10933 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 19 Sep 2008 15:12:28 -0400 Subject: [PATCH] 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. --- lib/replace/Makefile.in | 13 ++++++++++--- lib/replace/build_macros.m4 | 14 ++++++++++++++ lib/replace/configure.ac | 3 +++ lib/replace/libreplace.m4 | 4 ++-- lib/replace/test/testsuite.c | 3 ++- 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 lib/replace/build_macros.m4 diff --git a/lib/replace/Makefile.in b/lib/replace/Makefile.in index c989835a8d3..c889a0e4579 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 00000000000..c036668cd14 --- /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 81997e09b7d..0361825a022 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 dc7d88e6e18..e563acfd794 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 1e8290906e1..dcb05fbbf4e 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); -- 2.11.4.GIT