summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-03-21 13:18:10 +1100
committerAmitay Isaacs <amitay@gmail.com>2012-03-30 12:33:27 +1100
commit89415a1f00eb3cbdb17133037bb6bf8e64fea136 (patch)
tree532a3aa77d9e8269191cc6653350d1f03445f9d8
parent25d01ece0767cd646d734c4de7e9822fb396ed0c (diff)
downloadsamba-89415a1f00eb3cbdb17133037bb6bf8e64fea136.tar.gz
samba-89415a1f00eb3cbdb17133037bb6bf8e64fea136.tar.xz
samba-89415a1f00eb3cbdb17133037bb6bf8e64fea136.zip
build: Use system talloc library if available
Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 94f1e02406c353c3a0235685acdd107ee5a7f285)
-rwxr-xr-xctdb/Makefile.in12
-rw-r--r--ctdb/lib/talloc/libtalloc.m463
2 files changed, 52 insertions, 23 deletions
diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in
index db721ed7825..7def4397494 100755
--- a/ctdb/Makefile.in
+++ b/ctdb/Makefile.in
@@ -29,6 +29,10 @@ POPT_LIBS = @POPT_LIBS@
POPT_CFLAGS = @POPT_CFLAGS@
POPT_OBJ = @POPT_OBJ@
+TALLOC_LIBS = @TALLOC_LIBS@
+TALLOC_CFLAGS = @TALLOC_CFLAGS@
+TALLOC_OBJ = @TALLOC_OBJ@
+
SOCKET_WRAPPER_OBJ = @SOCKET_WRAPPER_OBJS@
PMDA_LIBS = -lpcp -lpcp_pmda
@@ -36,7 +40,7 @@ PMDA_INSTALL = @CTDB_PMDA_INSTALL@
PMDA_DEST_DIR = /var/lib/pcp/pmdas
CFLAGS=@CPPFLAGS@ -g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
- -I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
+ $(TALLOC_CFLAGS) -I@tdbdir@/include -I@libreplacedir@ \
-DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
-DLOGDIR=\"$(logdir)\" \
-DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 @CFLAGS@ -Wno-format-zero-length $(POPT_CFLAGS) \
@@ -46,7 +50,7 @@ LDSHFLAGS=-fPIC -shared
#LDSHFLAGS=-fPIC -shared -Wl,-Bsymbolic -Wl,-z,relo -Wl,-Bsymbolic-funtions -Wl,--as-needed -Wl,-z,defs
SHLD=${CC} ${CFLAGS} ${LDSHFLAGS} -o $@
-LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
+LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) $(TALLOC_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o lib/util/util.o \
lib/util/util_time.o lib/util/util_file.o lib/util/fault.o lib/util/substitute.o \
@@ -64,7 +68,7 @@ CTDB_LIB_OBJ = libctdb/ctdb.o libctdb/io_elem.o libctdb/local_tdb.o \
CTDB_TCP_OBJ = tcp/tcp_connect.o tcp/tcp_io.o tcp/tcp_init.o
CTDB_CLIENT_OBJ = client/ctdb_client.o \
- $(CTDB_COMMON_OBJ) $(POPT_OBJ) $(UTIL_OBJ) @TALLOC_OBJ@ @TDB_OBJ@ \
+ $(CTDB_COMMON_OBJ) $(POPT_OBJ) $(UTIL_OBJ) $(TALLOC_OBJ) @TDB_OBJ@ \
@LIBREPLACEOBJ@ $(EXTRA_OBJ) @TEVENT_OBJ@ $(SOCKET_WRAPPER_OBJ)
CTDB_SERVER_OBJ = server/ctdbd.o server/ctdb_daemon.o server/ctdb_lockwait.o \
@@ -245,7 +249,7 @@ CTDBD_TEST_C = $(CTDB_SERVER_MOST_OBJ:.o=.c) tests/src/ctdbd_test.c
CTDB_TEST_C = $(CTDB_CLIENT_OBJ:.o=.c) tools/ctdb.c tools/ctdb_vacuum.c tests/src/ctdb_test.c
-CTDB_TEST_OBJ = @TALLOC_OBJ@ @TDB_OBJ@ \
+CTDB_TEST_OBJ = $(TALLOC_OBJ) @TDB_OBJ@ \
@CTDB_SYSTEM_OBJ@ @LIBREPLACEOBJ@ $(EXTRA_OBJ) @TEVENT_OBJ@ $(SOCKET_WRAPPER_OBJ)
tests/src/ctdb_takeover_tests.o: tests/src/ctdb_takeover_tests.c $(CTDBD_TEST_C)
diff --git a/ctdb/lib/talloc/libtalloc.m4 b/ctdb/lib/talloc/libtalloc.m4
index 4b22c8e41a9..65227d89f6b 100644
--- a/ctdb/lib/talloc/libtalloc.m4
+++ b/ctdb/lib/talloc/libtalloc.m4
@@ -1,25 +1,50 @@
-dnl find the talloc sources. This is meant to work both for
-dnl talloc standalone builds, and builds of packages using talloc
-tallocdir=""
-tallocpaths=". lib/talloc talloc ../talloc ../lib/talloc"
-for d in $tallocpaths; do
- if test -f "$srcdir/$d/talloc.c"; then
- tallocdir="$d"
- AC_SUBST(tallocdir)
- break;
- fi
-done
-if test x"$tallocdir" = "x"; then
- AC_MSG_ERROR([cannot find talloc source in $tallocpaths])
-fi
-TALLOC_OBJ="talloc.o"
-AC_SUBST(TALLOC_OBJ)
+dnl Check to see if we should use the included talloc
-TALLOC_CFLAGS="-I$srcdir/$tallocdir"
-AC_SUBST(TALLOC_CFLAGS)
+INCLUDED_TALLOC=auto
+AC_ARG_WITH(included-talloc,
+ [AC_HELP_STRING([--with-included-talloc], [use bundled talloc library, not from system])],
+ [ INCLUDED_TALLOC=$withval ])
-TALLOC_LIBS=""
AC_SUBST(TALLOC_LIBS)
+AC_SUBST(TALLOC_CFLAGS)
+
+if test x"$INCLUDED_TALLOC" != x"yes" ; then
+ AC_CHECK_HEADERS(talloc.h)
+ AC_CHECK_LIB(talloc, talloc_init, [ TALLOC_LIBS="-ltalloc" ])
+ if test x"$ac_cv_header_talloc_h" = x"no" -o x"$ac_cv_lib_talloc_talloc_init" = x"no" ; then
+ INCLUDED_TALLOC=yes
+ TALLOC_CFLAGS=""
+ else
+ INCLUDED_TALLOC=no
+ fi
+fi
+
+AC_MSG_CHECKING(whether to use included talloc)
+AC_MSG_RESULT($INCLUDED_TALLOC)
+if test x"$INCLUDED_TALLOC" != x"no" ; then
+ dnl find the talloc sources. This is meant to work both for
+ dnl talloc standalone builds, and builds of packages using talloc
+ tallocdir=""
+ tallocpaths=". lib/talloc talloc ../talloc ../lib/talloc"
+ for d in $tallocpaths; do
+ if test -f "$srcdir/$d/talloc.c"; then
+ tallocdir="$d"
+ AC_SUBST(tallocdir)
+ break
+ fi
+ done
+ if test x"$tallocdir" = "x"; then
+ AC_MSG_ERROR([cannot find talloc source in $tallocpaths])
+ fi
+ TALLOC_OBJ="talloc.o"
+ AC_SUBST(TALLOC_OBJ)
+
+ TALLOC_CFLAGS="-I$srcdir/$tallocdir"
+ AC_SUBST(TALLOC_CFLAGS)
+
+ TALLOC_LIBS=""
+ AC_SUBST(TALLOC_LIBS)
+fi
AC_CHECK_SIZEOF(size_t,cross)
AC_CHECK_SIZEOF(void *,cross)