New Berkeley DB detection

This commit is contained in:
Kurt Zeilenga 2000-05-25 20:44:07 +00:00
parent 780d4737af
commit 8411a5319a
4 changed files with 1060 additions and 842 deletions

View File

@ -238,83 +238,75 @@ fi
]) ])
dnl dnl
dnl ==================================================================== dnl ====================================================================
dnl Check if db.h is Berkeley DB2 dnl Berkeley DB macros
dnl 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 --------------------------------------------------------------------
dnl Check if Berkeley DB2 library exists dnl Try to link
dnl Check for dbopen in standard libraries or -ldb AC_DEFUN([OL_BERKELEY_DB_TRY],
dnl [if test $ol_cv_lib_db = no ; then
dnl defines ol_cv_lib_db2 to '-ldb' or 'no' AC_CACHE_CHECK([for Berkeley DB link (]ifelse($2,,default,$2)[)],[$1],
dnl [
dnl uses: ol_DB_LIB=ifelse($2,,,$2)
dnl AC_CHECK_LIB(db,db_appexit) ol_LIBS=$LIBS
dnl LIBS="$ol_DB_LIB $LIBS"
AC_DEFUN([OL_LIB_BERKELEY_DB2],
[AC_CACHE_CHECK([for DB2 library], [ol_cv_lib_db2], AC_TRY_LINK([
[ ol_LIBS="$LIBS" #ifdef HAVE_DB_185_H
AC_CHECK_LIB(db,db_appexit,[ol_cv_lib_db2=-ldb],[ol_cv_lib_db2=no]) # 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" LIBS="$ol_LIBS"
]) ])
])dnl
dnl if test $$1 = yes ; then
dnl -------------------------------------------------------------------- ol_cv_lib_db=ifelse($2,,yes,$2)
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
fi 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 -------------------------------------------------------------------- dnl --------------------------------------------------------------------
dnl Check if Berkeley db2 supports DB_THREAD dnl Try to locate appropriate library
AC_DEFUN([OL_BERKELEY_DB2_DB_THREAD], AC_DEFUN([OL_BERKELEY_DB_LINK],
[AC_CACHE_CHECK([for DB_THREAD support], [ol_cv_berkeley_db2_db_thread], [ [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" ol_LIBS="$LIBS"
if test $ol_cv_lib_db2 != yes ; then if test $ol_cv_lib_db != yes ; then
LIBS="$ol_cv_lib_db2" LIBS="$ol_cv_lib_db"
fi fi
AC_TRY_RUN([ AC_TRY_RUN([
#ifdef HAVE_DB_185_H
choke me;
#else
#include <db.h> #include <db.h>
#endif
#ifndef NULL #ifndef NULL
#define NULL ((void *)0) #define NULL ((void *)0)
#endif #endif
@ -334,87 +326,64 @@ main()
return rc; return rc;
}], }],
[ol_cv_berkeley_db2_db_thread=yes], [ol_cv_berkeley_db_thread=yes],
[ol_cv_berkeley_db2_db_thread=no], [ol_cv_berkeley_db_thread=no],
[ol_cv_berkeley_db2_db_thread=cross]) [ol_cv_berkeley_db_thread=cross])
LIBS="$ol_LIBS" LIBS="$ol_LIBS"
if test $ol_cv_berkeley_db2_db_thread != no ; then if test $ol_cv_berkeley_db_thread != no ; then
AC_DEFINE(HAVE_BERKELEY_DB2_DB_THREAD, 1, AC_DEFINE(HAVE_BERKELEY_DB_THREAD, 1,
[define if BerkeleyDB2 has DB_THREAD support]) [define if Berkeley DB has DB_THREAD support])
fi fi
])])dnl ])])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 -------------------------------------------------------------------- dnl --------------------------------------------------------------------
dnl Check if Berkeley DB library exists dnl Find any DB
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
AC_DEFUN([OL_BERKELEY_DB], AC_DEFUN([OL_BERKELEY_DB],
[AC_REQUIRE([OL_LIB_BERKELEY_DB]) [ol_cv_berkeley_db=no
AC_REQUIRE([OL_HEADER_BERKELEY_DB]) AC_CHECK_HEADERS(db.h)
AC_CACHE_CHECK([for Berkeley DB], [ol_cv_berkeley_db], [ if test $ac_cv_header_db_h = yes; then
if test "$ol_cv_lib_db" = no -o "$ol_cv_header_db" = no ; then OL_BERKELEY_DB_LINK
ol_cv_berkeley_db=no if test "$ol_cv_lib_db" != no ; then
else
ol_cv_berkeley_db=yes ol_cv_berkeley_db=yes
OL_BERKELEY_DB_THREAD
fi 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 ==================================================================== dnl ====================================================================
dnl Check if GDBM library exists dnl Check if GDBM library exists

1574
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,7 @@ OL_ARG_WITH(ldap_module,[ --with-ldap-module module type], static,
[static dynamic]) [static dynamic])
OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend], yes)dnl OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend], yes)dnl
OL_ARG_WITH(ldbm_api,[ --with-ldbm-api use LDBM API], auto, 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, OL_ARG_WITH(ldbm_module,[ --with-ldbm-module module type], static,
[static dynamic]) [static dynamic])
OL_ARG_WITH(ldbm_type,[ --with-ldbm-type use LDBM type], auto, 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 dnl SLAPD with BDB2
if test $ol_with_ldbm_api != auto -a \ if test $ol_with_ldbm_api != auto -a \
$ol_with_ldbm_api != db2 ; then $ol_with_ldbm_api != berkeley ; then
AC_MSG_ERROR([BDB2 requires LDBM API DB2]) AC_MSG_ERROR([BDB2 requires LDBM API berkeley or auto])
fi fi
ol_with_ldbm_api=db2 ol_with_ldbm_api=db2
@ -374,8 +374,8 @@ else
if test $ol_enable_bdb2 != no ; then if test $ol_enable_bdb2 != no ; then
if test $ol_with_ldbm_api != auto -a \ if test $ol_with_ldbm_api != auto -a \
$ol_with_ldbm_api != db2 ; then $ol_with_ldbm_api != berkeley ; then
AC_MSG_WARN([BDB2 requires LDBM api db2 or auto]) AC_MSG_WARN([BDB2 requires LDBM api berkeley or auto])
ol_enable_bdb2=no ol_enable_bdb2=no
fi fi
fi fi
@ -1688,47 +1688,23 @@ if test $ol_link_threads != no ; then
fi fi
dnl ---------------------------------------------------------------- dnl ----------------------------------------------------------------
ol_link_ldbm=no 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 if test $ol_with_ldbm_api = auto \
ol_link_ldbm=db2 -o $ol_with_ldbm_api = berkeley \
ol_with_ldbm_api=db2 -o $ol_with_ldbm_api = bcompat ; then
if test $ol_with_ldbm_type = hash ; then if test $ol_with_ldbm_api = bcompat; then \
AC_DEFINE(LDBM_USE_DBHASH,1, OL_BERKELEY_COMPAT_DB
[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
else else
AC_MSG_WARN([Installed BerkeleyDB does not provide DB_THREAD support.]) OL_BERKELEY_DB
fi fi
fi
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then if test $ol_cv_berkeley_db != no ; then
OL_BERKELEY_DB AC_DEFINE(HAVE_BERKELEY_DB,1,
[define this if Berkeley DB is available])
if test $ol_cv_berkeley_db = yes ; then ol_link_ldbm=berkeley
ol_link_ldbm=db
ol_with_ldbm_api=db ol_with_ldbm_api=db
if test $ol_with_ldbm_type = hash ; then 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
fi fi
if test $ol_with_ldbm_api = manual ; then exit
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
if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
AC_MSG_WARN(Could not find LDBM with BTREE support) 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 ol_enable_ldbm=no
fi 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 ---------------------------------------------------------------- dnl ----------------------------------------------------------------
if test $ol_enable_dynamic = yes -a $enable_shared = yes ; then if test $ol_enable_dynamic = yes -a $enable_shared = yes ; then
LINK_BINS_DYNAMIC="yes" LINK_BINS_DYNAMIC="yes"

View File

@ -334,9 +334,6 @@
/* Define if you have the <db.h> header file. */ /* Define if you have the <db.h> header file. */
#undef HAVE_DB_H #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. */ /* Define if you have the <db_185.h> header file. */
#undef HAVE_DB_185_H #undef HAVE_DB_185_H
@ -724,19 +721,10 @@
/* define if you have (or want) no threads */ /* define if you have (or want) no threads */
#undef NO_THREADS #undef NO_THREADS
/* define if Berkeley DBv2 is available */ /* define if Berkeley DB has DB_THREAD support */
#undef HAVE_BERKELEY_DB2 #undef HAVE_BERKELEY_DB_THREAD
/* define this to use DBHASH w/ LDBM backend */ /* define this if Berkeley DB is available */
#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 */
#undef HAVE_BERKELEY_DB #undef HAVE_BERKELEY_DB
/* define this to use DBHASH w/ LDBM backend */ /* define this to use DBHASH w/ LDBM backend */