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

build: Use system tdb library if available

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

(This used to be ctdb commit 10ab88a5c822ac403a70a9cd1a6c81020eb91d08)
This commit is contained in:
Amitay Isaacs 2012-03-21 14:45:56 +11:00
parent 13124e356e
commit 634bbc5469
2 changed files with 58 additions and 29 deletions

View File

@ -37,6 +37,10 @@ TEVENT_LIBS = @TEVENT_LIBS@
TEVENT_CFLAGS = @TEVENT_CFLAGS@
TEVENT_OBJ = @TEVENT_OBJ@
TDB_LIBS = @TDB_LIBS@
TDB_CFLAGS = @TDB_CFLAGS@
TDB_OBJ = @TDB_OBJ@
SOCKET_WRAPPER_OBJ = @SOCKET_WRAPPER_OBJS@
PMDA_LIBS = -lpcp -lpcp_pmda
@ -44,7 +48,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) \
$(TALLOC_CFLAGS) $(TEVENT_CFLAGS) -I@tdbdir@/include -I@libreplacedir@ \
$(TALLOC_CFLAGS) $(TEVENT_CFLAGS) $(TDB_CFLAGS) -I@libreplacedir@ \
-DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
-DLOGDIR=\"$(logdir)\" \
-DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 @CFLAGS@ -Wno-format-zero-length $(POPT_CFLAGS) \
@ -54,7 +58,8 @@ 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) $(TALLOC_LIBS) $(TEVENT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) $(TALLOC_LIBS) $(TEVENT_LIBS) $(TDB_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 \
@ -72,7 +77,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 \
@ -158,9 +163,9 @@ bin/ctdb: $(CTDB_CLIENT_OBJ) tools/ctdb.o tools/ctdb_vacuum.o libctdb/libctdb.a
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ tools/ctdb.o tools/ctdb_vacuum.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS) libctdb/libctdb.a
bin/ltdbtool: tools/ltdbtool.o @TDB_OBJ@
bin/ltdbtool: tools/ltdbtool.o $(TDB_OBJ)
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ $+
@$(CC) $(CFLAGS) -o $@ $+ $(TDB_LIBS)
bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o $(POPT_OBJ)
@echo Linking $@
@ -206,11 +211,11 @@ tests/bin/ctdb_fetch_one: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch_one.o
tests/bin/ctdb_fetch_lock_once: libctdb/libctdb.a tests/src/ctdb_fetch_lock_once.o
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_lock_once.o @TDB_OBJ@ @POPT_OBJ@ libctdb/libctdb.a $(LIB_FLAGS)
@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_lock_once.o $(TDB_OBJ) @POPT_OBJ@ libctdb/libctdb.a $(LIB_FLAGS)
tests/bin/ctdb_fetch_readonly_once: libctdb/libctdb.a tests/src/ctdb_fetch_readonly_once.o
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_readonly_once.o @TDB_OBJ@ @POPT_OBJ@ libctdb/libctdb.a $(LIB_FLAGS)
@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_readonly_once.o $(TDB_OBJ) @POPT_OBJ@ libctdb/libctdb.a $(LIB_FLAGS)
tests/bin/ctdb_fetch_readonly_loop: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch_readonly_loop.o
@echo Linking $@
@ -253,7 +258,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,28 +1,52 @@
dnl find the tdb sources. This is meant to work both for
dnl tdb standalone builds, and builds of packages using tdb
tdbdir=""
tdbpaths=". lib/tdb tdb ../tdb ../lib/tdb"
for d in $tdbpaths; do
if test -f "$srcdir/$d/common/tdb.c"; then
tdbdir="$d"
AC_SUBST(tdbdir)
break;
fi
done
if test x"$tdbdir" = "x"; then
AC_MSG_ERROR([cannot find tdb source in $tdbpaths])
fi
TDB_OBJ="common/tdb.o common/dump.o common/transaction.o common/error.o common/traverse.o"
TDB_OBJ="$TDB_OBJ common/freelist.o common/freelistcheck.o common/io.o common/lock.o common/open.o common/check.o common/hash.o"
AC_SUBST(TDB_OBJ)
AC_SUBST(LIBREPLACEOBJ)
dnl Check to see if we should use the included tdb
INCLUDED_TDB=auto
AC_ARG_WITH(included-tdb,
[AC_HELP_STRING([--with-included-tdb], [use bundled tdb library, not from system])],
[ INCLUDED_TDB=$withval ])
TDB_LIBS=""
AC_SUBST(TDB_LIBS)
TDB_CFLAGS="-I$tdbdir/include"
AC_SUBST(TDB_CFLAGS)
if test x"$INCLUDED_TDB" != x"yes" ; then
AC_CHECK_HEADERS(tdb.h)
AC_CHECK_LIB(tdb, tdb_transaction_write_lock_mark, [ TDB_LIBS="-ltdb" ])
if test x"$ac_cv_header_tdb_h" = x"no" -o x"$ac_cv_lib_tdb_tdb_transaction_write_lock_mark" = x"no" ; then
INCLUDED_TDB=yes
TDB_CFLAGS=""
else
INCLUDED_TDB=no
fi
fi
AC_MSG_CHECKING(whether to use included tdb)
AC_MSG_RESULT($INCLUDED_TDB)
if test x"$INCLUDED_TDB" != x"no" ; then
dnl find the tdb sources. This is meant to work both for
dnl tdb standalone builds, and builds of packages using tdb
tdbdir=""
tdbpaths=". lib/tdb tdb ../tdb ../lib/tdb"
for d in $tdbpaths; do
if test -f "$srcdir/$d/common/tdb.c"; then
tdbdir="$d"
AC_SUBST(tdbdir)
break;
fi
done
if test x"$tdbdir" = "x"; then
AC_MSG_ERROR([cannot find tdb source in $tdbpaths])
fi
TDB_OBJ="common/tdb.o common/dump.o common/transaction.o common/error.o common/traverse.o"
TDB_OBJ="$TDB_OBJ common/freelist.o common/freelistcheck.o common/io.o common/lock.o common/open.o common/check.o common/hash.o"
AC_SUBST(TDB_OBJ)
TDB_LIBS=""
AC_SUBST(TDB_LIBS)
TDB_CFLAGS="-I$tdbdir/include"
AC_SUBST(TDB_CFLAGS)
fi
AC_CHECK_FUNCS(mmap pread pwrite getpagesize utime)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h)