1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

build: Use system talloc library if available

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 94f1e02406c353c3a0235685acdd107ee5a7f285)
This commit is contained in:
Amitay Isaacs 2012-03-21 13:18:10 +11:00
parent 25d01ece07
commit 89415a1f00
2 changed files with 52 additions and 23 deletions

View File

@ -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)

View File

@ -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"
INCLUDED_TALLOC=auto
AC_ARG_WITH(included-talloc,
[AC_HELP_STRING([--with-included-talloc], [use bundled talloc library, not from system])],
[ INCLUDED_TALLOC=$withval ])
AC_SUBST(TALLOC_LIBS)
AC_SUBST(TALLOC_CFLAGS)
TALLOC_LIBS=""
AC_SUBST(TALLOC_LIBS)
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)