summaryrefslogtreecommitdiff
path: root/talloc
diff options
context:
space:
mode:
Diffstat (limited to 'talloc')
-rw-r--r--talloc/Makefile.in18
-rw-r--r--talloc/build_macros.m422
-rw-r--r--talloc/config.mk4
-rw-r--r--talloc/configure.ac2
-rw-r--r--talloc/libtalloc.m48
-rw-r--r--talloc/talloc.c12
-rw-r--r--talloc/talloc.mk6
-rw-r--r--talloc/testsuite.c10
-rw-r--r--talloc/testsuite_main.c37
9 files changed, 77 insertions, 42 deletions
diff --git a/talloc/Makefile.in b/talloc/Makefile.in
index 9b1b6320..c28693e2 100644
--- a/talloc/Makefile.in
+++ b/talloc/Makefile.in
@@ -9,7 +9,7 @@ mandir = @mandir@
VPATH = @srcdir@:@libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
-buildinstdir = @buildinstdir@
+sharedbuilddir = @sharedbuilddir@
XSLTPROC = @XSLTPROC@
INSTALLCMD = @INSTALL@
CC = @CC@
@@ -32,14 +32,14 @@ include $(tallocdir)/talloc.mk
$(TALLOC_SOLIB): $(LIBOBJ)
$(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) @SONAMEFLAG@$(TALLOC_SONAME)
-build-install:: all
- ${INSTALLCMD} -d $(buildinstdir)/lib
- ${INSTALLCMD} -m 755 libtalloc.a $(buildinstdir)/lib
- ${INSTALLCMD} -m 755 $(TALLOC_SOLIB) $(buildinstdir)/lib
- ln -sf $(TALLOC_SOLIB) $(buildinstdir)/lib/$(TALLOC_SONAME)
- ln -sf $(TALLOC_SOLIB) $(buildinstdir)/lib/libtalloc.so
- ${INSTALLCMD} -d $(buildinstdir)/include
- ${INSTALLCMD} -m 644 $(srcdir)/talloc.h $(buildinstdir)/include
+shared-build: all
+ ${INSTALLCMD} -d $(sharedbuilddir)/lib
+ ${INSTALLCMD} -m 644 libtalloc.a $(sharedbuilddir)/lib
+ ${INSTALLCMD} -m 755 $(TALLOC_SOLIB) $(sharedbuilddir)/lib
+ ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/$(TALLOC_SONAME)
+ ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/libtalloc.so
+ ${INSTALLCMD} -d $(sharedbuilddir)/include
+ ${INSTALLCMD} -m 644 $(srcdir)/talloc.h $(sharedbuilddir)/include
check: test
diff --git a/talloc/build_macros.m4 b/talloc/build_macros.m4
index bb05a582..c036668c 100644
--- a/talloc/build_macros.m4
+++ b/talloc/build_macros.m4
@@ -1,14 +1,14 @@
-AC_DEFUN(BUILD_WITH_BUILD_INST_DIR,
- [ AC_ARG_WITH([build-install-dir],
- [AC_HELP_STRING([--with-build-install-dir=DIR],
- [temporary build directory where libraries are installed [$srcdir/buildinst]])])
+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]])])
- buildinstdir="$srcdir/buildinst"
- if test x"$with_build_install_dir" != x; then
- buildinstdir=$with_build_install_dir
- CFLAGS="$CFLAGS -I$with_build_install_dir/include"
- CPPFLAGS="$CPPFLAGS -I$with_build_install_dir/include"
- LIBS="$LIBS -L$with_build_install_dir/lib"
+ 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(buildinstdir)
+ AC_SUBST(sharedbuilddir)
])
+
diff --git a/talloc/config.mk b/talloc/config.mk
index c13e1b79..5cdf3a1a 100644
--- a/talloc/config.mk
+++ b/talloc/config.mk
@@ -1,7 +1,7 @@
[LIBRARY::LIBTALLOC]
OUTPUT_TYPE = MERGED_OBJ
-CFLAGS = -Ilib/talloc
+CFLAGS = -I$(tallocsrcdir)
-LIBTALLOC_OBJ_FILES = lib/talloc/talloc.o
+LIBTALLOC_OBJ_FILES = $(tallocsrcdir)/talloc.o
MANPAGES += $(tallocdir)/talloc.3
diff --git a/talloc/configure.ac b/talloc/configure.ac
index 60314dcc..d2538f92 100644
--- a/talloc/configure.ac
+++ b/talloc/configure.ac
@@ -22,6 +22,6 @@ AC_LIBREPLACE_SHLD
AC_LIBREPLACE_SHLD_FLAGS
m4_include(build_macros.m4)
-BUILD_WITH_BUILD_INST_DIR
+BUILD_WITH_SHARED_BUILD_DIR
AC_OUTPUT(Makefile talloc.pc)
diff --git a/talloc/libtalloc.m4 b/talloc/libtalloc.m4
index d2e8eba8..e6830fbe 100644
--- a/talloc/libtalloc.m4
+++ b/talloc/libtalloc.m4
@@ -1,10 +1,10 @@
dnl find the talloc sources. This is meant to work both for
dnl talloc standalone builds, and builds of packages using talloc
tallocdir=""
-tallocpaths="$srcdir $srcdir/lib/talloc $srcdir/talloc $srcdir/../talloc"
+tallocpaths=". lib/talloc talloc ../talloc ../lib/talloc"
for d in $tallocpaths; do
- if test -f "$d/talloc.c"; then
- tallocdir="$d"
+ if test -f "$srcdir/$d/talloc.c"; then
+ tallocdir="$d"
AC_SUBST(tallocdir)
break;
fi
@@ -15,7 +15,7 @@ fi
TALLOC_OBJ="talloc.o"
AC_SUBST(TALLOC_OBJ)
-TALLOC_CFLAGS="-I$tallocdir"
+TALLOC_CFLAGS="-I$srcdir/$tallocdir"
AC_SUBST(TALLOC_CFLAGS)
TALLOC_LIBS=""
diff --git a/talloc/talloc.c b/talloc/talloc.c
index 12b85f5a..1f7e5243 100644
--- a/talloc/talloc.c
+++ b/talloc/talloc.c
@@ -82,11 +82,19 @@
#if (__GNUC__ >= 3)
/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
as its first argument */
+#ifndef likely
#define likely(x) __builtin_expect(!!(x), 1)
+#endif
+#ifndef unlikely
#define unlikely(x) __builtin_expect(!!(x), 0)
+#endif
#else
-#define likely(x) x
-#define unlikely(x) x
+#ifndef likely
+#define likely(x) (x)
+#endif
+#ifndef unlikely
+#define unlikely(x) (x)
+#endif
#endif
/* this null_context is only used if talloc_enable_leak_report() or
diff --git a/talloc/talloc.mk b/talloc/talloc.mk
index 23331b63..f183cd57 100644
--- a/talloc/talloc.mk
+++ b/talloc/talloc.mk
@@ -5,8 +5,8 @@ TALLOC_SONAME = libtalloc.$(SHLIBEXT).1
all:: libtalloc.a $(TALLOC_SOLIB) testsuite
-testsuite:: $(LIBOBJ) testsuite.o
- $(CC) $(CFLAGS) -o testsuite testsuite.o $(LIBOBJ) $(LIBS)
+testsuite:: $(LIBOBJ) testsuite.o testsuite_main.o
+ $(CC) $(CFLAGS) -o testsuite testsuite.o testsuite_main.o $(LIBOBJ) $(LIBS)
libtalloc.a: $(LIBOBJ)
ar -rv $@ $(LIBOBJ)
@@ -28,7 +28,7 @@ install:: all
doc:: talloc.3 talloc.3.html
clean::
- rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) libtalloc.a testsuite testsuite.o *.gc?? talloc.3 talloc.3.html
+ rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) libtalloc.a testsuite testsuite.o testsuite_main.o *.gc?? talloc.3 talloc.3.html
test:: testsuite
./testsuite
diff --git a/talloc/testsuite.c b/talloc/testsuite.c
index 3f06eee5..3d490ddf 100644
--- a/talloc/testsuite.c
+++ b/talloc/testsuite.c
@@ -1140,13 +1140,3 @@ bool torture_local_talloc(struct torture_context *tctx)
return ret;
}
-
-#if _SAMBA_BUILD_ < 4
-int main(void)
-{
- bool ret = torture_local_talloc(NULL);
- if (!ret)
- return -1;
- return 0;
-}
-#endif
diff --git a/talloc/testsuite_main.c b/talloc/testsuite_main.c
new file mode 100644
index 00000000..1b513332
--- /dev/null
+++ b/talloc/testsuite_main.c
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ local testing of talloc routines.
+
+ Copyright (C) Andrew Tridgell 2004
+
+ ** NOTE! The following LGPL license applies to the talloc
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+
+struct torture_context;
+bool torture_local_talloc(struct torture_context *tctx);
+
+int main(void)
+{
+ bool ret = torture_local_talloc(NULL);
+ if (!ret)
+ return -1;
+ return 0;
+}