test for the ndbm database really being a .db one

and use it when moving/removing database files


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10684 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-09-13 00:34:07 +00:00
parent 9e099ffcb5
commit 49123a12f3

View File

@@ -10,6 +10,7 @@ if test "$withval" = no; then
fi fi
]) ])
have_ndbm=no
db_type=unknown db_type=unknown
if test "$berkeley_db"; then if test "$berkeley_db"; then
@@ -76,6 +77,7 @@ dnl test for ndbm compatability
LIB_NDBM="" LIB_NDBM=""
fi fi
AC_DEFINE(HAVE_DB_NDBM, 1, [define if you have ndbm compat in db]) AC_DEFINE(HAVE_DB_NDBM, 1, [define if you have ndbm compat in db])
AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
else else
$as_unset ac_cv_func_dbm_firstkey $as_unset ac_cv_func_dbm_firstkey
$as_unset ac_cv_funclib_dbm_firstkey $as_unset ac_cv_funclib_dbm_firstkey
@@ -109,6 +111,7 @@ if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
LIB_NDBM="" LIB_NDBM=""
fi fi
AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
have_ndbm=yes
if test "$db_type" = "unknown"; then if test "$db_type" = "unknown"; then
db_type=ndbm db_type=ndbm
DBLIB="$LIB_NDBM" DBLIB="$LIB_NDBM"
@@ -135,6 +138,7 @@ if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
LIB_NDBM="" LIB_NDBM=""
fi fi
AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
have_ndbm=yes
if test "$db_type" = "unknown"; then if test "$db_type" = "unknown"; then
db_type=ndbm db_type=ndbm
DBLIB="$LIB_NDBM" DBLIB="$LIB_NDBM"
@@ -143,6 +147,37 @@ if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
fi fi
fi # unknown fi # unknown
if test "$have_ndbm" = "yes"; then
AC_MSG_CHECKING([if ndbm is implemented with db])
AC_TRY_RUN([
#include <unistd.h>
#include <fcntl.h>
#if defined(HAVE_GDBM_NDBM_H)
#include <gdbm/ndbm.h>
#elif defined(HAVE_NDBM_H)
#include <ndbm.h>
#elif defined(HAVE_DBM_H)
#include <dbm.h>
#endif
int main()
{
DBM *d;
d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
if (d == NULL)
return 1;
dbm_close(d);
return 0;
}],[
if test -f conftest.db; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
else
AC_MSG_RESULT([no])
fi],[AC_MSG_RESULT([no])])
fi
AC_SUBST(DBLIB)dnl AC_SUBST(DBLIB)dnl
AC_SUBST(LIB_NDBM)dnl AC_SUBST(LIB_NDBM)dnl
]) ])