From: Simo Sorce Date: Fri, 19 Sep 2008 19:12:28 +0000 (-0400) Subject: Fix standalone builds adjusting to new relative path. X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=49b89633f175b81d7415f835009b6d14f6e10933;p=metze%2Fsamba%2Fwip.git 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. --- diff --git a/lib/replace/Makefile.in b/lib/replace/Makefile.in index c989835a8d37..c889a0e45793 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 000000000000..c036668cd14e --- /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 81997e09b7d0..0361825a022d 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 dc7d88e6e183..e563acfd794c 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 1e8290906e18..dcb05fbbf4ea 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);