3 dnl tests for various db libraries
6 AC_ARG_ENABLE(berkeley-db,
7 AS_HELP_STRING([--disable-berkeley-db],
8 [if you don't want berkeley db]),[
11 AC_ARG_ENABLE(ndbm-db,
12 AS_HELP_STRING([--disable-ndbm-db],
13 [if you don't want ndbm db]),[
19 if test "$enable_berkeley_db" != no; then
28 dnl db_create is used by db3 and db4
30 AC_FIND_FUNC_NO_LIBS(db_create, db4 db3 db, [
34 #elif defined(HAVE_DB3_DB_H)
41 if test "$ac_cv_func_db_create" = "yes"; then
43 if test "$ac_cv_funclib_db_create" != "yes"; then
44 DBLIB="$ac_cv_funclib_db_create"
48 AC_DEFINE(HAVE_DB3, 1, [define if you have a berkeley db3/4 library])
51 dnl dbopen is used by db1/db2
53 AC_FIND_FUNC_NO_LIBS(dbopen, db2 db, [
55 #if defined(HAVE_DB2_DB_H)
57 #elif defined(HAVE_DB_185_H)
59 #elif defined(HAVE_DB_H)
64 ],[NULL, 0, 0, 0, NULL])
66 if test "$ac_cv_func_dbopen" = "yes"; then
68 if test "$ac_cv_funclib_dbopen" != "yes"; then
69 DBLIB="$ac_cv_funclib_dbopen"
73 AC_DEFINE(HAVE_DB1, 1, [define if you have a berkeley db1/2 library])
77 dnl test for ndbm compatability
79 if test "$ac_cv_func_dbm_firstkey" != yes; then
80 AC_FIND_FUNC_NO_LIBS2(dbm_firstkey, $ac_cv_funclib_dbopen $ac_cv_funclib_db_create, [
82 #define DB_DBM_HSEARCH 1
87 if test "$ac_cv_func_dbm_firstkey" = "yes"; then
88 if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
89 LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
93 AC_DEFINE(HAVE_DB_NDBM, 1, [define if you have ndbm compat in db])
94 AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
96 $as_unset ac_cv_func_dbm_firstkey
97 $as_unset ac_cv_funclib_dbm_firstkey
103 if test "$enable_ndbm_db" != "no"; then
105 if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
112 AC_FIND_FUNC_NO_LIBS(dbm_firstkey, ndbm, [
114 #if defined(HAVE_NDBM_H)
116 #elif defined(HAVE_DBM_H)
122 if test "$ac_cv_func_dbm_firstkey" = "yes"; then
123 if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
124 LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
128 AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
130 if test "$db_type" = "unknown"; then
136 $as_unset ac_cv_func_dbm_firstkey
137 $as_unset ac_cv_funclib_dbm_firstkey
143 AC_FIND_FUNC_NO_LIBS(dbm_firstkey, gdbm, [
145 #include <gdbm/ndbm.h>
149 if test "$ac_cv_func_dbm_firstkey" = "yes"; then
150 if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
151 LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
155 AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
157 if test "$db_type" = "unknown"; then
166 if test "$have_ndbm" = "yes"; then
167 AC_MSG_CHECKING([if ndbm is implemented with db])
168 AC_RUN_IFELSE([AC_LANG_SOURCE([[
171 #if defined(HAVE_GDBM_NDBM_H)
172 #include <gdbm/ndbm.h>
173 #elif defined(HAVE_NDBM_H)
175 #elif defined(HAVE_DBM_H)
178 int main(int argc, char **argv)
182 d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
188 if test -f conftest.db; then
190 AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
193 fi],[AC_MSG_RESULT([no])],[AC_MSG_RESULT([no-cross])])
196 AM_CONDITIONAL(HAVE_DB1, test "$db_type" = db1)dnl
197 AM_CONDITIONAL(HAVE_DB3, test "$db_type" = db3)dnl
198 AM_CONDITIONAL(HAVE_NDBM, test "$db_type" = ndbm)dnl
200 ## it's probably not correct to include LDFLAGS here, but we might
201 ## need it, for now just add any possible -L
203 for i in $LDFLAGS; do
210 AC_SUBST(LIB_NDBM)dnl