mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
New Berkeley DB detection
This commit is contained in:
parent
780d4737af
commit
8411a5319a
@ -238,83 +238,75 @@ fi
|
||||
])
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if db.h is Berkeley DB2
|
||||
dnl Berkeley DB macros
|
||||
dnl
|
||||
dnl defines ol_cv_header_db2 to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_HEADERS(db.h)
|
||||
dnl
|
||||
AC_DEFUN([OL_HEADER_BERKELEY_DB2],
|
||||
[AC_CHECK_HEADERS(db.h)
|
||||
if test $ac_cv_header_db_h = yes ; then
|
||||
AC_CACHE_CHECK([if db.h is DB2], [ol_cv_header_db2],[
|
||||
AC_EGREP_CPP(__db_version_2,[
|
||||
# include <db.h>
|
||||
/* this check could be improved */
|
||||
# ifdef DB_VERSION_MAJOR
|
||||
# if DB_VERSION_MAJOR == 2
|
||||
__db_version_2;
|
||||
# endif
|
||||
# endif
|
||||
], ol_cv_header_db2=yes, ol_cv_header_db2=no)])
|
||||
else
|
||||
ol_cv_header_db2=no
|
||||
fi
|
||||
])dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB2 library exists
|
||||
dnl Check for dbopen in standard libraries or -ldb
|
||||
dnl
|
||||
dnl defines ol_cv_lib_db2 to '-ldb' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_LIB(db,db_appexit)
|
||||
dnl
|
||||
AC_DEFUN([OL_LIB_BERKELEY_DB2],
|
||||
[AC_CACHE_CHECK([for DB2 library], [ol_cv_lib_db2],
|
||||
[ ol_LIBS="$LIBS"
|
||||
AC_CHECK_LIB(db,db_appexit,[ol_cv_lib_db2=-ldb],[ol_cv_lib_db2=no])
|
||||
dnl Try to link
|
||||
AC_DEFUN([OL_BERKELEY_DB_TRY],
|
||||
[if test $ol_cv_lib_db = no ; then
|
||||
AC_CACHE_CHECK([for Berkeley DB link (]ifelse($2,,default,$2)[)],[$1],
|
||||
[
|
||||
ol_DB_LIB=ifelse($2,,,$2)
|
||||
ol_LIBS=$LIBS
|
||||
LIBS="$ol_DB_LIB $LIBS"
|
||||
|
||||
AC_TRY_LINK([
|
||||
#ifdef HAVE_DB_185_H
|
||||
# include <db_185.h>
|
||||
#else
|
||||
# include <db.h>
|
||||
#endif
|
||||
|
||||
#ifndef DB_VERSION_MAJOR
|
||||
# define DB_VERSION_MAJOR 1
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
],[
|
||||
#if DB_VERSION_MAJOR > 1
|
||||
db_appexit( NULL );
|
||||
#else
|
||||
(void) dbopen( NULL, 0, 0, 0, NULL);
|
||||
#endif
|
||||
],[$1=yes],[$1=no])
|
||||
|
||||
LIBS="$ol_LIBS"
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley db2 exists
|
||||
dnl
|
||||
dnl defines ol_cv_berkeley_db2 to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_LIB_BERKELEY_DB2
|
||||
dnl OL_HEADER_BERKELEY_DB2
|
||||
dnl
|
||||
AC_DEFUN([OL_BERKELEY_DB2],
|
||||
[AC_REQUIRE([OL_LIB_BERKELEY_DB2])
|
||||
AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
|
||||
AC_CACHE_CHECK([for Berkeley DB2], [ol_cv_berkeley_db2], [
|
||||
if test "$ol_cv_lib_db2" = no -o "$ol_cv_header_db2" = no ; then
|
||||
ol_cv_berkeley_db2=no
|
||||
else
|
||||
ol_cv_berkeley_db2=yes
|
||||
|
||||
if test $$1 = yes ; then
|
||||
ol_cv_lib_db=ifelse($2,,yes,$2)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_berkeley_db2 = yes ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB2,1, [define if Berkeley DBv2 is available])
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley db2 supports DB_THREAD
|
||||
AC_DEFUN([OL_BERKELEY_DB2_DB_THREAD],
|
||||
[AC_CACHE_CHECK([for DB_THREAD support], [ol_cv_berkeley_db2_db_thread], [
|
||||
dnl Try to locate appropriate library
|
||||
AC_DEFUN([OL_BERKELEY_DB_LINK],
|
||||
[ol_cv_lib_db=no
|
||||
OL_BERKELEY_DB_TRY(ol_cv_db_none)
|
||||
OL_BERKELEY_DB_TRY(ol_cv_db_db,[-ldb])
|
||||
OL_BERKELEY_DB_TRY(ol_cv_db_db3,[-ldb3])
|
||||
OL_BERKELEY_DB_TRY(ol_cv_db_db2,[-ldb2])
|
||||
OL_BERKELEY_DB_TRY(ol_cv_db_db1,[-ldb1])
|
||||
])
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB supports DB_THREAD
|
||||
AC_DEFUN([OL_BERKELEY_DB_THREAD],
|
||||
[AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [
|
||||
ol_LIBS="$LIBS"
|
||||
if test $ol_cv_lib_db2 != yes ; then
|
||||
LIBS="$ol_cv_lib_db2"
|
||||
if test $ol_cv_lib_db != yes ; then
|
||||
LIBS="$ol_cv_lib_db"
|
||||
fi
|
||||
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_DB_185_H
|
||||
choke me;
|
||||
#else
|
||||
#include <db.h>
|
||||
#endif
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
@ -334,87 +326,64 @@ main()
|
||||
|
||||
return rc;
|
||||
}],
|
||||
[ol_cv_berkeley_db2_db_thread=yes],
|
||||
[ol_cv_berkeley_db2_db_thread=no],
|
||||
[ol_cv_berkeley_db2_db_thread=cross])
|
||||
[ol_cv_berkeley_db_thread=yes],
|
||||
[ol_cv_berkeley_db_thread=no],
|
||||
[ol_cv_berkeley_db_thread=cross])
|
||||
|
||||
LIBS="$ol_LIBS"
|
||||
|
||||
if test $ol_cv_berkeley_db2_db_thread != no ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB2_DB_THREAD, 1,
|
||||
[define if BerkeleyDB2 has DB_THREAD support])
|
||||
if test $ol_cv_berkeley_db_thread != no ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB_THREAD, 1,
|
||||
[define if Berkeley DB has DB_THREAD support])
|
||||
fi
|
||||
])])dnl
|
||||
dnl ====================================================================
|
||||
dnl Check for db.h/db_185.h is Berkeley DB
|
||||
dnl
|
||||
dnl defines ol_cv_header_db to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_HEADER_BERKELEY_DB2
|
||||
dnl AC_CHECK_HEADERS(db_185.h)
|
||||
dnl
|
||||
AC_DEFUN([OL_HEADER_BERKELEY_DB],
|
||||
[AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
|
||||
AC_CHECK_HEADERS(db_185.h)
|
||||
if test "$ol_cv_header_db2" = yes ; then
|
||||
dnl db.h is db2!
|
||||
|
||||
ol_cv_header_db=$ac_cv_header_db_185_h
|
||||
else
|
||||
ol_cv_header_db=$ac_cv_header_db_h
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB library exists
|
||||
dnl Check for dbopen in standard libraries or -ldb
|
||||
dnl
|
||||
dnl defines ol_cv_lib_db to 'yes' or '-ldb' or 'no'
|
||||
dnl 'yes' implies dbopen is in $LIBS
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_FUNC(dbopen)
|
||||
dnl AC_CHECK_LIB(db,dbopen)
|
||||
dnl
|
||||
AC_DEFUN([OL_LIB_BERKELEY_DB],
|
||||
[AC_CACHE_CHECK([for Berkeley DB library], [ol_cv_lib_db],
|
||||
[
|
||||
AC_CHECK_HEADERS(db1/db.h)
|
||||
ol_LIBS="$LIBS"
|
||||
AC_CHECK_FUNC(dbopen,[ol_cv_lib_db=yes], [
|
||||
AC_CHECK_LIB(db1,dbopen,[ol_cv_lib_db=-ldb1],[
|
||||
AC_CHECK_LIB(db,dbopen,[ol_cv_lib_db=-ldb],
|
||||
[ol_cv_lib_db=no])
|
||||
])
|
||||
])
|
||||
LIBS="$ol_LIBS"
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB exists
|
||||
dnl
|
||||
dnl defines ol_cv_berkeley_db to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_LIB_BERKELEY_DB
|
||||
dnl OL_HEADER_BERKELEY_DB
|
||||
dnl
|
||||
dnl Find any DB
|
||||
AC_DEFUN([OL_BERKELEY_DB],
|
||||
[AC_REQUIRE([OL_LIB_BERKELEY_DB])
|
||||
AC_REQUIRE([OL_HEADER_BERKELEY_DB])
|
||||
AC_CACHE_CHECK([for Berkeley DB], [ol_cv_berkeley_db], [
|
||||
if test "$ol_cv_lib_db" = no -o "$ol_cv_header_db" = no ; then
|
||||
ol_cv_berkeley_db=no
|
||||
else
|
||||
[ol_cv_berkeley_db=no
|
||||
AC_CHECK_HEADERS(db.h)
|
||||
if test $ac_cv_header_db_h = yes; then
|
||||
OL_BERKELEY_DB_LINK
|
||||
if test "$ol_cv_lib_db" != no ; then
|
||||
ol_cv_berkeley_db=yes
|
||||
OL_BERKELEY_DB_THREAD
|
||||
fi
|
||||
fi
|
||||
])
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Find old Berkeley DB 1.85/1.86
|
||||
AC_DEFUN([OL_BERKELEY_COMPAT_DB],
|
||||
[ol_cv_berkeley_db=no
|
||||
AC_CHECK_HEADERS(db_185.h db.h)
|
||||
if test $ac_cv_header_db_185_h = yes -o $ac_cv_header_db_h = yes; then
|
||||
AC_CACHE_CHECK([if Berkeley DB header compatibility], [ol_cv_header_db1],[
|
||||
AC_EGREP_CPP(__db_version_1,[
|
||||
#if HAVE_DB_185_H
|
||||
# include <db_185.h>
|
||||
#else
|
||||
# include <db.h>
|
||||
#endif
|
||||
|
||||
/* this check could be improved */
|
||||
#ifndef DB_VERSION_MAJOR
|
||||
# define DB_VERSION_MAJOR 1
|
||||
#endif
|
||||
|
||||
#if DB_VERSION_MAJOR == 1
|
||||
__db_version_1
|
||||
#endif
|
||||
], [ol_cv_header_db1=yes], [ol_cv_header_db1=no])])
|
||||
|
||||
if test ol_cv_header_db1=yes ; then
|
||||
OL_BERKELEY_DB_LINK
|
||||
if test "$ol_cv_lib_db" != no ; then
|
||||
ol_cv_berkeley_db=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_berkeley_db = yes ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB,1, [define if Berkeley DB is available])
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if GDBM library exists
|
||||
|
73
configure.in
73
configure.in
@ -157,7 +157,7 @@ OL_ARG_WITH(ldap_module,[ --with-ldap-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend], yes)dnl
|
||||
OL_ARG_WITH(ldbm_api,[ --with-ldbm-api use LDBM API], auto,
|
||||
[auto db2 db mdbm gdbm manual])
|
||||
[auto berkeley bcompat mdbm gdbm])
|
||||
OL_ARG_WITH(ldbm_module,[ --with-ldbm-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_WITH(ldbm_type,[ --with-ldbm-type use LDBM type], auto,
|
||||
@ -363,8 +363,8 @@ elif test $ol_enable_bdb2 = yes ; then
|
||||
dnl SLAPD with BDB2
|
||||
|
||||
if test $ol_with_ldbm_api != auto -a \
|
||||
$ol_with_ldbm_api != db2 ; then
|
||||
AC_MSG_ERROR([BDB2 requires LDBM API DB2])
|
||||
$ol_with_ldbm_api != berkeley ; then
|
||||
AC_MSG_ERROR([BDB2 requires LDBM API berkeley or auto])
|
||||
fi
|
||||
|
||||
ol_with_ldbm_api=db2
|
||||
@ -374,8 +374,8 @@ else
|
||||
|
||||
if test $ol_enable_bdb2 != no ; then
|
||||
if test $ol_with_ldbm_api != auto -a \
|
||||
$ol_with_ldbm_api != db2 ; then
|
||||
AC_MSG_WARN([BDB2 requires LDBM api db2 or auto])
|
||||
$ol_with_ldbm_api != berkeley ; then
|
||||
AC_MSG_WARN([BDB2 requires LDBM api berkeley or auto])
|
||||
ol_enable_bdb2=no
|
||||
fi
|
||||
fi
|
||||
@ -1688,47 +1688,23 @@ if test $ol_link_threads != no ; then
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
|
||||
ol_link_ldbm=no
|
||||
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
|
||||
OL_BERKELEY_DB2
|
||||
|
||||
if test $ol_cv_berkeley_db2 = yes ; then
|
||||
ol_link_ldbm=db2
|
||||
ol_with_ldbm_api=db2
|
||||
if test $ol_with_ldbm_api = auto \
|
||||
-o $ol_with_ldbm_api = berkeley \
|
||||
-o $ol_with_ldbm_api = bcompat ; then
|
||||
|
||||
if test $ol_with_ldbm_type = hash ; then
|
||||
AC_DEFINE(LDBM_USE_DBHASH,1,
|
||||
[define this to use DBHASH w/ LDBM backend])
|
||||
else
|
||||
AC_DEFINE(LDBM_USE_DBBTREE,1,
|
||||
[define this to use DBBTREE w/ LDBM backend])
|
||||
fi
|
||||
|
||||
OL_BERKELEY_DB2_DB_THREAD
|
||||
|
||||
dnl $ol_cv_lib_db2 should be yes or -ldb
|
||||
dnl (it could be no, but that would be an error
|
||||
if test $ol_cv_lib_db2 != yes ; then
|
||||
LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
ol_link_bdb2=no
|
||||
if test $ol_link_ldbm = db2 -a $ol_enable_bdb2 != no ; then
|
||||
if test $ol_cv_berkeley_db2_db_thread != no ; then
|
||||
ol_link_bdb2=yes
|
||||
if test $ol_with_ldbm_api = bcompat; then \
|
||||
OL_BERKELEY_COMPAT_DB
|
||||
else
|
||||
AC_MSG_WARN([Installed BerkeleyDB does not provide DB_THREAD support.])
|
||||
OL_BERKELEY_DB
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
|
||||
OL_BERKELEY_DB
|
||||
if test $ol_cv_berkeley_db != no ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB,1,
|
||||
[define this if Berkeley DB is available])
|
||||
|
||||
if test $ol_cv_berkeley_db = yes ; then
|
||||
ol_link_ldbm=db
|
||||
ol_link_ldbm=berkeley
|
||||
ol_with_ldbm_api=db
|
||||
|
||||
if test $ol_with_ldbm_type = hash ; then
|
||||
@ -1747,14 +1723,7 @@ if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ol_with_ldbm_api = manual ; then
|
||||
dnl User thinks he can manually configure LDBM api.
|
||||
ol_link_ldbm=yes
|
||||
|
||||
AC_MSG_WARN([LDBM defines and link options must be set manually])
|
||||
|
||||
AC_CHECK_HEADERS(db.h db_185.h gdbm.h ndbm.h)
|
||||
fi
|
||||
exit
|
||||
|
||||
if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
|
||||
AC_MSG_WARN(Could not find LDBM with BTREE support)
|
||||
@ -1809,6 +1778,16 @@ if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
|
||||
ol_enable_ldbm=no
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
ol_link_bdb2=no
|
||||
if test $ol_enable_bdb2 != no ; then
|
||||
if test $ol_enable_bdb2 = yes -a $ol_link_ldbm != berkeley ; then
|
||||
AC_MSG_ERROR(BDB2 requires LDBM BerkeleyDB 2)
|
||||
elif test $ol_link_ldbm = berkeley ; then
|
||||
ol_link_bdb2=$ol_link_ldbm
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
if test $ol_enable_dynamic = yes -a $enable_shared = yes ; then
|
||||
LINK_BINS_DYNAMIC="yes"
|
||||
|
@ -334,9 +334,6 @@
|
||||
/* Define if you have the <db.h> header file. */
|
||||
#undef HAVE_DB_H
|
||||
|
||||
/* Define if you have the <db1/db.h> header file. */
|
||||
#undef HAVE_DB1_DB_H
|
||||
|
||||
/* Define if you have the <db_185.h> header file. */
|
||||
#undef HAVE_DB_185_H
|
||||
|
||||
@ -724,19 +721,10 @@
|
||||
/* define if you have (or want) no threads */
|
||||
#undef NO_THREADS
|
||||
|
||||
/* define if Berkeley DBv2 is available */
|
||||
#undef HAVE_BERKELEY_DB2
|
||||
/* define if Berkeley DB has DB_THREAD support */
|
||||
#undef HAVE_BERKELEY_DB_THREAD
|
||||
|
||||
/* define this to use DBHASH w/ LDBM backend */
|
||||
#undef LDBM_USE_DBHASH
|
||||
|
||||
/* define this to use DBBTREE w/ LDBM backend */
|
||||
#undef LDBM_USE_DBBTREE
|
||||
|
||||
/* define if BerkeleyDB2 has DB_THREAD support */
|
||||
#undef HAVE_BERKELEY_DB2_DB_THREAD
|
||||
|
||||
/* define if Berkeley DB is available */
|
||||
/* define this if Berkeley DB is available */
|
||||
#undef HAVE_BERKELEY_DB
|
||||
|
||||
/* define this to use DBHASH w/ LDBM backend */
|
||||
|
Loading…
Reference in New Issue
Block a user