r25093: Use system-provided ldb library if available. Note that this only means using...
[jelmer/samba4-debian.git] / source / lib / ldb / configure.ac
1 AC_PREREQ(2.50)
2 AC_DEFUN([AC_CHECK_LIB_EXT], [
3         AC_CHECK_LIB([$1],[$3],[$4],[$5],[$7])
4         ac_cv_lib_ext_$1_$3=$ac_cv_lib_$1_$3
5 ])
6 AC_DEFUN([AC_CHECK_FUNC_EXT], [
7         AC_CHECK_FUNC([$1],[$3],[$4])
8         ac_cv_func_ext_$1=$ac_cv_func_$1
9 ])
10 AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
11 AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
12 AC_DEFUN([SMB_EXT_LIB], [echo -n ""])
13 AC_DEFUN([SMB_ENABLE], [echo -n ""])
14 AC_INIT(ldb, 0.9.1)
15 AC_CONFIG_SRCDIR([common/ldb.c])
16
17 AC_LIBREPLACE_ALL_CHECKS
18
19 if test "$ac_cv_prog_gcc" = yes; then
20    CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
21 fi
22
23 WITH_GCOV=0
24 AC_ARG_ENABLE(gcov,
25         AS_HELP_STRING([--enable-gcov],[enable GCOV code coverage tests]),
26         [ WITH_GCOV=1])
27 AC_SUBST(WITH_GCOV)
28 if test x"$with_gcov_support" = x"yes"; then
29    CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs"
30    LIBS="$LIBS -lgcov"
31 fi
32
33 AC_PATH_PROG(XSLTPROC,xsltproc)
34 AC_PATH_PROG(DOXYGEN,doxygen)
35 AC_PATH_PROG(GCOV,gcov)
36 AC_PATH_PROG(SLAPD,slapd)
37 AC_CHECK_HEADERS(stdint.h dlfcn.h)
38 AC_CONFIG_HEADER(include/config.h)
39 AC_SEARCH_LIBS(dlopen, dl, AC_DEFINE(HAVE_DLOPEN, [1], [have dlopen]))
40
41 SHLIBEXT="so" # Should be set based on OS later on
42 AC_SUBST(SHLIBEXT)
43
44 AC_DEFINE_UNQUOTED(LDB_MODULESDIR, LIBDIR "/ldb" , [Modules directory] )
45 AC_SUBST(LDB_MODULESDIR)
46
47 TESTS=""
48 EXTRA_OBJ=""
49
50 m4_include(libpopt.m4)
51 m4_include(libtalloc.m4)
52 m4_include(libtdb.m4)
53
54 m4_include(ldap.m4)
55 if test x"$with_ldap_support" = x"yes"; then
56    LIBS="$LIBS -llber -lldap"
57    CFLAGS="$CFLAGS -DHAVE_LDB_LDAP=1"
58    EXTRA_OBJ="$EXTRA_OBJ ldb_ldap/ldb_ldap.o"
59    TESTS="$TESTS test-ldap.sh"
60 fi
61
62 m4_include(sqlite3.m4)
63 if test x"$with_sqlite3_support" = x"yes"; then
64    LIBS="$LIBS -lsqlite3"
65    CFLAGS="$CFLAGS -DHAVE_LDB_SQLITE3=1"
66    EXTRA_OBJ="$EXTRA_OBJ ldb_sqlite3/ldb_sqlite3.o"
67    TESTS="$TESTS test-sqlite3.sh"
68 fi
69
70 AC_SUBST(TESTS)
71 AC_SUBST(EXTRA_OBJ)
72
73 m4_include(libldb.m4)
74 AC_OUTPUT(Makefile ldb.pc)