ctdb-build: Remove duplicate replace library
[Samba.git] / ctdb / lib / talloc / libtalloc.m4
blob65227d89f6bb9b8968c7aa559a2bda109d939c62
1 dnl Check to see if we should use the included talloc
3 INCLUDED_TALLOC=auto
4 AC_ARG_WITH(included-talloc,
5     [AC_HELP_STRING([--with-included-talloc], [use bundled talloc library, not from system])],
6     [ INCLUDED_TALLOC=$withval ])
8 AC_SUBST(TALLOC_LIBS)
9 AC_SUBST(TALLOC_CFLAGS)
11 if test x"$INCLUDED_TALLOC" != x"yes" ; then
12     AC_CHECK_HEADERS(talloc.h)
13     AC_CHECK_LIB(talloc, talloc_init, [ TALLOC_LIBS="-ltalloc" ])
14     if test x"$ac_cv_header_talloc_h" = x"no" -o x"$ac_cv_lib_talloc_talloc_init" = x"no" ; then
15         INCLUDED_TALLOC=yes
16         TALLOC_CFLAGS=""
17     else
18         INCLUDED_TALLOC=no
19     fi
22 AC_MSG_CHECKING(whether to use included talloc)
23 AC_MSG_RESULT($INCLUDED_TALLOC)
24 if test x"$INCLUDED_TALLOC" != x"no" ; then
25     dnl find the talloc sources. This is meant to work both for 
26     dnl talloc standalone builds, and builds of packages using talloc
27     tallocdir=""
28     tallocpaths=". lib/talloc talloc ../talloc ../lib/talloc"
29     for d in $tallocpaths; do
30         if test -f "$srcdir/$d/talloc.c"; then
31                 tallocdir="$d"
32                 AC_SUBST(tallocdir)
33                 break
34         fi
35     done
36     if test x"$tallocdir" = "x"; then
37         AC_MSG_ERROR([cannot find talloc source in $tallocpaths])
38     fi
39     TALLOC_OBJ="talloc.o"
40     AC_SUBST(TALLOC_OBJ)
42     TALLOC_CFLAGS="-I$srcdir/$tallocdir"
43     AC_SUBST(TALLOC_CFLAGS)
45     TALLOC_LIBS=""
46     AC_SUBST(TALLOC_LIBS)
49 AC_CHECK_SIZEOF(size_t,cross)
50 AC_CHECK_SIZEOF(void *,cross)
52 if test $ac_cv_sizeof_size_t -lt $ac_cv_sizeof_void_p; then
53         AC_WARN([size_t cannot represent the amount of used memory of a process])
54         AC_WARN([please report this to <samba-technical@samba.org>])
55         AC_WARN([sizeof(size_t) = $ac_cv_sizeof_size_t])
56         AC_WARN([sizeof(void *) = $ac_cv_sizeof_void_p])
57         AC_ERROR([sizeof(size_t) < sizeof(void *)])
60 if test x"$VERSIONSCRIPT" != "x"; then
61     EXPORTSFILE=talloc.exports
62     AC_SUBST(EXPORTSFILE)