From 009038a79545f5ee8135b7dac852895b73ce0134 Mon Sep 17 00:00:00 2001 From: Juan Gomez Date: Tue, 30 Mar 1999 04:25:52 +0000 Subject: [PATCH] MDBM detection feature. --- build/openldap.m4 | 45 +++++++++++++++++++++++++++++++++++++++++++ configure.in | 16 +++++++++++++++ include/portable.h.in | 3 +++ 3 files changed, 64 insertions(+) diff --git a/build/openldap.m4 b/build/openldap.m4 index f5a14dfcf1..16e2647c00 100644 --- a/build/openldap.m4 +++ b/build/openldap.m4 @@ -337,6 +337,51 @@ AC_DEFUN([OL_GDBM], ])dnl dnl dnl ==================================================================== +dnl Check if MDBM library exists +dnl Check for mdbm_open in standard libraries or -lmdbm +dnl +dnl defines ol_cv_lib_mdbm to 'yes' or '-lmdbm' or 'no' +dnl 'yes' implies mdbm_open is in $LIBS +dnl +dnl uses: +dnl AC_CHECK_FUNC(mdbm_set_chain) +dnl AC_CHECK_LIB(mdbm,mdbm_set_chain) +dnl +AC_DEFUN([OL_LIB_MDBM], +[AC_CACHE_CHECK(for MDBM library, [ol_cv_lib_mdbm], +[ ol_LIBS="$LIBS" + AC_CHECK_FUNC(mdbm_set_chain,[ol_cv_lib_mdbm=yes], [ + AC_CHECK_LIB(mdbm,mdbm_set_chain,[ol_cv_lib_mdbm=-lmdbm],[ol_cv_lib_mdbm=no]) + ]) + LIBS="$ol_LIBS" +]) +])dnl +dnl +dnl -------------------------------------------------------------------- +dnl Check if MDBM exists +dnl +dnl defines ol_cv_mdbm to 'yes' or 'no' +dnl +dnl uses: +dnl OL_LIB_MDBM +dnl AC_CHECK_HEADERS(mdbm.h) +dnl +AC_DEFUN([OL_MDBM], +[AC_REQUIRE([OL_LIB_MDBM]) + AC_CHECK_HEADERS(mdbm.h) + AC_CACHE_CHECK(for db, [ol_cv_mdbm], [ + if test $ol_cv_lib_mdbm = no -o $ac_cv_header_mdbm_h = no ; then + ol_cv_mdbm=no + else + ol_cv_mdbm=yes + fi +]) + if test $ol_cv_mdbm = yes ; then + AC_DEFINE(HAVE_MDBM,1, [define if MDBM is available]) + fi +])dnl +dnl +dnl ==================================================================== dnl Check if NDBM library exists dnl Check for dbm_open in standard libraries or -lndbm or -ldbm dnl diff --git a/configure.in b/configure.in index 61dc27746e..3b2b2e7f08 100644 --- a/configure.in +++ b/configure.in @@ -220,6 +220,10 @@ else $ol_with_ldbm_type = btree ; then AC_MSG_ERROR([GDBM only supports LDBM type hash]) fi + if test $ol_with_ldbm_api = mdbm -a \ + $ol_with_ldbm_type = btree ; then + AC_MSG_ERROR([MDBM only supports LDBM type hash]) + fi if test $ol_with_ldbm_api = ndbm -a \ $ol_with_ldbm_type = btree ; then AC_MSG_ERROR([NDBM only supports LDBM type hash]) @@ -1397,6 +1401,18 @@ if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then ol_with_ldbm_api=none fi +if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then + OL_MDBM + + if test $ol_cv_mdbm = yes ; then + ol_link_ldbm=mdbm + ol_with_ldbm_api=mdbm + if test $ol_cv_lib_mdbm != yes ; then + LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_mdbm" + fi + fi +fi + if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then OL_GDBM diff --git a/include/portable.h.in b/include/portable.h.in index 8ea0c646e1..3ac216399c 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -636,6 +636,9 @@ /* define if GNU DBM is available */ #undef HAVE_GDBM +/* define if MDBM is available */ +#undef HAVE_MDBM + /* define if NDBM is available */ #undef HAVE_NDBM -- 2.39.5