From 7a4206aa525a328d99df778f62fa1a5c25416606 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 4 Sep 2006 12:49:17 +0000 Subject: r18036: Add missing file (This used to be commit 9ad8075d702d67fc82974e1ef2cfbcaefb2028f5) --- source4/lib/ldb/configure.ac | 79 ++++++++++++++++++++++++++++++++++++++++++++ source4/lib/ldb/configure.in | 79 -------------------------------------------- source4/lib/ldb/replace.m4 | 60 +++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 79 deletions(-) create mode 100644 source4/lib/ldb/configure.ac delete mode 100644 source4/lib/ldb/configure.in create mode 100644 source4/lib/ldb/replace.m4 diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac new file mode 100644 index 0000000000..5ef3d1cc96 --- /dev/null +++ b/source4/lib/ldb/configure.ac @@ -0,0 +1,79 @@ +AC_PREREQ(2.50) +AC_DEFUN([AC_CHECK_LIB_EXT], [ + AC_CHECK_LIB([$1],[$3],[$4],[$5],[$7]) + ac_cv_lib_ext_$1_$3=$ac_cv_lib_$1_$3 +]) +AC_DEFUN([AC_CHECK_FUNC_EXT], [ + AC_CHECK_FUNC([$1],[$3],[$4]) + ac_cv_func_ext_$1=$ac_cv_func_$1 +]) +AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""]) +AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) +AC_DEFUN([SMB_EXT_LIB], [echo -n ""]) +AC_DEFUN([SMB_ENABLE], [echo -n ""]) +AC_INIT(include/ldb.h) +AC_CONFIG_SRCDIR([common/ldb.c]) +AC_PROG_CC + +if test "$ac_cv_prog_gcc" = yes; then + CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" +fi + +WITH_GCOV=0 +AC_ARG_ENABLE(gcov, + AS_HELP_STRING([--enable-gcov],[enable GCOV code coverage tests]), + [ WITH_GCOV=1]) +AC_SUBST(WITH_GCOV) +if test x"$with_gcov_support" = x"yes"; then + CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs" + LIBS="$LIBS -lgcov" +fi + +AC_SYS_LARGEFILE +AC_FUNC_MMAP +AC_PATH_PROG(XSLTPROC,xsltproc) +AC_PATH_PROG(DOXYGEN,doxygen) +AC_PATH_PROG(GCOV,gcov) +AC_PATH_PROG(SLAPD,slapd) +AC_CHECK_HEADERS(stdint.h dlfcn.h) +AC_CONFIG_HEADER(include/config.h) +AC_SEARCH_LIBS(dlopen, dl, AC_DEFINE(HAVE_DLOPEN, [1], [have dlopen])) + +SHLIBEXT="so" # Should be set based on OS later on +AC_SUBST(SHLIBEXT) + +AC_DEFINE_UNQUOTED(MODULESDIR, LIBDIR "/ldb" , [Modules directory] ) +AC_SUBST(MODULESDIR) + +TESTS="" +EXTRA_OBJ="" + +sinclude(popt.m4) +sinclude(replace/config.m4) + +sinclude(ldap.m4) +if test x"$with_ldap_support" = x"yes"; then + LIBS="$LIBS -llber -lldap" + CFLAGS="$CFLAGS -DHAVE_LDAP=1" + EXTRA_OBJ="$EXTRA_OBJ ldb_ldap/ldb_ldap.o" + TESTS="$TESTS test-ldap.sh" +fi + +sinclude(sqlite3.m4) +if test x"$with_sqlite3_support" = x"yes"; then + LIBS="$LIBS -lsqlite3" + CFLAGS="$CFLAGS -DHAVE_SQLITE3=1" + EXTRA_OBJ="$EXTRA_OBJ ldb_sqlite3/ldb_sqlite3.o" + TESTS="$TESTS test-sqlite3.sh" +fi + +AC_SUBST(TESTS) +AC_SUBST(EXTRA_OBJ) + +sinclude(replace.m4) +SMB_REPLACE_FUNCS(strtoll) + +sinclude(config.m4) +sinclude(../talloc/config.m4) +sinclude(../tdb/config.m4) +AC_OUTPUT(Makefile ldb.pc) diff --git a/source4/lib/ldb/configure.in b/source4/lib/ldb/configure.in deleted file mode 100644 index 5ef3d1cc96..0000000000 --- a/source4/lib/ldb/configure.in +++ /dev/null @@ -1,79 +0,0 @@ -AC_PREREQ(2.50) -AC_DEFUN([AC_CHECK_LIB_EXT], [ - AC_CHECK_LIB([$1],[$3],[$4],[$5],[$7]) - ac_cv_lib_ext_$1_$3=$ac_cv_lib_$1_$3 -]) -AC_DEFUN([AC_CHECK_FUNC_EXT], [ - AC_CHECK_FUNC([$1],[$3],[$4]) - ac_cv_func_ext_$1=$ac_cv_func_$1 -]) -AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""]) -AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) -AC_DEFUN([SMB_EXT_LIB], [echo -n ""]) -AC_DEFUN([SMB_ENABLE], [echo -n ""]) -AC_INIT(include/ldb.h) -AC_CONFIG_SRCDIR([common/ldb.c]) -AC_PROG_CC - -if test "$ac_cv_prog_gcc" = yes; then - CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" -fi - -WITH_GCOV=0 -AC_ARG_ENABLE(gcov, - AS_HELP_STRING([--enable-gcov],[enable GCOV code coverage tests]), - [ WITH_GCOV=1]) -AC_SUBST(WITH_GCOV) -if test x"$with_gcov_support" = x"yes"; then - CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs" - LIBS="$LIBS -lgcov" -fi - -AC_SYS_LARGEFILE -AC_FUNC_MMAP -AC_PATH_PROG(XSLTPROC,xsltproc) -AC_PATH_PROG(DOXYGEN,doxygen) -AC_PATH_PROG(GCOV,gcov) -AC_PATH_PROG(SLAPD,slapd) -AC_CHECK_HEADERS(stdint.h dlfcn.h) -AC_CONFIG_HEADER(include/config.h) -AC_SEARCH_LIBS(dlopen, dl, AC_DEFINE(HAVE_DLOPEN, [1], [have dlopen])) - -SHLIBEXT="so" # Should be set based on OS later on -AC_SUBST(SHLIBEXT) - -AC_DEFINE_UNQUOTED(MODULESDIR, LIBDIR "/ldb" , [Modules directory] ) -AC_SUBST(MODULESDIR) - -TESTS="" -EXTRA_OBJ="" - -sinclude(popt.m4) -sinclude(replace/config.m4) - -sinclude(ldap.m4) -if test x"$with_ldap_support" = x"yes"; then - LIBS="$LIBS -llber -lldap" - CFLAGS="$CFLAGS -DHAVE_LDAP=1" - EXTRA_OBJ="$EXTRA_OBJ ldb_ldap/ldb_ldap.o" - TESTS="$TESTS test-ldap.sh" -fi - -sinclude(sqlite3.m4) -if test x"$with_sqlite3_support" = x"yes"; then - LIBS="$LIBS -lsqlite3" - CFLAGS="$CFLAGS -DHAVE_SQLITE3=1" - EXTRA_OBJ="$EXTRA_OBJ ldb_sqlite3/ldb_sqlite3.o" - TESTS="$TESTS test-sqlite3.sh" -fi - -AC_SUBST(TESTS) -AC_SUBST(EXTRA_OBJ) - -sinclude(replace.m4) -SMB_REPLACE_FUNCS(strtoll) - -sinclude(config.m4) -sinclude(../talloc/config.m4) -sinclude(../tdb/config.m4) -AC_OUTPUT(Makefile ldb.pc) diff --git a/source4/lib/ldb/replace.m4 b/source4/lib/ldb/replace.m4 new file mode 100644 index 0000000000..e06cb7e85a --- /dev/null +++ b/source4/lib/ldb/replace.m4 @@ -0,0 +1,60 @@ +dnl Try to find a replacement library +dnl Will define HAVE_REPLACE_H if replace.h can be found +AC_DEFUN([SMB_LIBREPLACE], [ +AC_ARG_WITH(libreplace, +[ --with-libreplace Specify location to libreplace], +[ + # Check whether libreplace can actually be found in this location + if ! test -f "$withval/replace.h" + then + AC_MSG_ERROR([Unable to find replace.h in $withval]) + fi + replacedir=$withval +], +[ + # Check if we can find libreplace in a common location + for dir in . replace ../replace + do + AC_MSG_CHECKING([for libreplace in $dir]) + if test -f "$dir/replace.h" + then + replacedir="$dir" + AC_MSG_RESULT(yes) + break + fi + AC_MSG_RESULT(no) + done +]) + +AC_SUBST(REPLACE_LIB) +AC_SUBST(REPLACE_DIR) + +if test "$replacedir" != "" +then + REPLACE_DIR="$replacedir" + REPLACE_LIB="$replacedir/libreplace.a" + CFLAGS="$CFLAGS -I$replacedir" + AC_DEFINE(HAVE_REPLACE_H, 1, + [Whether replace.h is present and should be used]) +fi +]) + +dnl Try to find the specified functions in the system, or +dnl in Samba's replacement library. In the future, this may also +dnl try to find these functions in libroken or GNUlib if libreplace can't be +dnl found. +AC_DEFUN(SMB_REPLACE_FUNCS, [ + AC_REQUIRE([SMB_LIBREPLACE])dnl + + if test -z "$replacedir" || test -f "$replacedir/libreplace.a" + then + LIBS="$LIBS $REPLACE_LIB" + for f in $1 + do + AC_CHECK_FUNC($f, [], [ + AC_MSG_ERROR([Unable to find $f in the system. Consider + specifying the path to the replacement library]) + ]) + done + fi +]) -- cgit