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]),[
14 if test "$enable_berkeley_db" != no; then
23 dnl db_create is used by db3 and db4
25 AC_FIND_FUNC_NO_LIBS(db_create, db4 db3 db, [
29 #elif defined(HAVE_DB3_DB_H)
36 if test "$ac_cv_func_db_create" = "yes"; then
38 if test "$ac_cv_funclib_db_create" != "yes"; then
39 DBLIB="$ac_cv_funclib_db_create"
43 AC_DEFINE(HAVE_DB3, 1, [define if you have a berkeley db3/4 library])
46 dnl dbopen is used by db1/db2
48 AC_FIND_FUNC_NO_LIBS(dbopen, db2 db, [
50 #if defined(HAVE_DB2_DB_H)
52 #elif defined(HAVE_DB_185_H)
54 #elif defined(HAVE_DB_H)
59 ],[NULL, 0, 0, 0, NULL])
61 if test "$ac_cv_func_dbopen" = "yes"; then
63 if test "$ac_cv_funclib_dbopen" != "yes"; then
64 DBLIB="$ac_cv_funclib_dbopen"
68 AC_DEFINE(HAVE_DB1, 1, [define if you have a berkeley db1/2 library])
72 dnl test for ndbm compatability
74 if test "$ac_cv_func_dbm_firstkey" != yes; then
75 AC_FIND_FUNC_NO_LIBS2(dbm_firstkey, $ac_cv_funclib_dbopen $ac_cv_funclib_db_create, [
77 #define DB_DBM_HSEARCH 1
82 if test "$ac_cv_func_dbm_firstkey" = "yes"; then
83 if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
84 LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
88 AC_DEFINE(HAVE_DB_NDBM, 1, [define if you have ndbm compat in db])
89 AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
91 $as_unset ac_cv_func_dbm_firstkey
92 $as_unset ac_cv_funclib_dbm_firstkey
98 if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
105 AC_FIND_FUNC_NO_LIBS(dbm_firstkey, ndbm, [
107 #if defined(HAVE_NDBM_H)
109 #elif defined(HAVE_DBM_H)
115 if test "$ac_cv_func_dbm_firstkey" = "yes"; then
116 if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
117 LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
121 AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
123 if test "$db_type" = "unknown"; then
129 $as_unset ac_cv_func_dbm_firstkey
130 $as_unset ac_cv_funclib_dbm_firstkey
136 AC_FIND_FUNC_NO_LIBS(dbm_firstkey, gdbm, [
138 #include <gdbm/ndbm.h>
142 if test "$ac_cv_func_dbm_firstkey" = "yes"; then
143 if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
144 LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
148 AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
150 if test "$db_type" = "unknown"; then
159 if test "$have_ndbm" = "yes"; then
160 AC_MSG_CHECKING([if ndbm is implemented with db])
161 AC_RUN_IFELSE([AC_LANG_SOURCE([[
164 #if defined(HAVE_GDBM_NDBM_H)
165 #include <gdbm/ndbm.h>
166 #elif defined(HAVE_NDBM_H)
168 #elif defined(HAVE_DBM_H)
175 d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
181 if test -f conftest.db; then
183 AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
186 fi],[AC_MSG_RESULT([no])])
189 AM_CONDITIONAL(HAVE_DB1, test "$db_type" = db1)dnl
190 AM_CONDITIONAL(HAVE_DB3, test "$db_type" = db3)dnl
191 AM_CONDITIONAL(HAVE_NDBM, test "$db_type" = ndbm)dnl
193 ## it's probably not correct to include LDFLAGS here, but we might
194 ## need it, for now just add any possible -L
196 for i in $LDFLAGS; do
203 AC_SUBST(LIB_NDBM)dnl