>>>> "sb" == SL Baur <steve(a)xemacs.org>
writes:
sb> I have recently installed glibc-2.0.108 and it saw fit to delete
sb> /usr/include/ndbm.h as part of its installation. This reveals a logic
sb> error in XEmacs.
sb> In configure, the existence of ndbm.h is tested and the symbol
sb> HAVE_NDBM_H should be defined in src/config.h. It isn't. This causes
sb> a bomb when compiling src/database.c here:
sb> #ifdef HAVE_DBM
sb> #include <ndbm.h>
sb> Lisp_Object Qdbm;
sb> #endif /* HAVE_DBM */
sb> I think the correct guard should be `HAVE_NDBM_H', though something is
sb> twisted with glibc deleting someone else's include file.
I disagree. HAVE_DBM requires ndbm.h. Here's a better fix. Needs
further testing.
1998-12-20 Martin Buchholz <martin(a)xemacs.org>
* configure.in: Redo DBM support
- die if dbm support requested, but not provided.
- properly check for libgdbm, then libc, then libdbm
- properly check for ndbm.h
--- configure.in.old
+++ configure.in
@@ -3491,39 +3491,45 @@
dnl Note that unless support for DB/(G)DBM is explicitly disabled, we always
dnl want to check for libdb/lib(g)dbm. Also note that libc will not be
dnl checked if we have the libraries.
-dnl If support for DB/(G)DBM is requested, but we neither have libdb/lib(g)dbm,
-dnl nor does libc implement it, we are a bit lost :)
AC_CHECKING(for database support)
+dnl Check for ndbm.h, required for either kind of DBM support.
+if test "$with_database_gnudbm $with_database_dbm" != "no no"; then
+ AC_CHECK_HEADER(ndbm.h, [:], [
+ test "$with_database_gnudbm" = "yes" -o \
+ "$with_database_dbm" = "yes" || \
+ XE_DIE("Required DBM support cannot be provided.")
+ with_database_gnudbm=no with_database_dbm=no])
+fi
+
+dnl Check for DBM support in libgdbm.
if test "$with_database_gnudbm" != "no"; then
- AC_CHECK_HEADERS(ndbm.h, have_ndbm_h=yes)
- if test "$have_ndbm_h" = "yes"; then
- AC_CHECK_LIB(gdbm, dbm_open, with_database_gnudbm=yes have_libgdbm=yes)
- fi
- if test "$with_database_gnudbm" != "yes"; then
- AC_CHECK_FUNC(dbm_open, with_database_gnudbm=yes)
- fi
- if test "$with_database_gnudbm" = "yes"; then
- AC_DEFINE(HAVE_DBM)
- test "$have_libgdbm" = "yes" && XE_PREPEND(-lgdbm, LIBS)
- with_database_dbm=no
- else with_database_gnudbm=no
- fi
+ AC_CHECK_LIB(gdbm, dbm_open,
+ [with_database_gnudbm=yes with_database_dbm=no libdbm=-lgdbm],
+ [if test "$with_database_gnudbm" = "yes"; then
+ XE_DIE("Required GNU DBM support cannot be provided.")
+ fi
+ with_database_gnudbm=no])
fi
+dnl Check for DBM support in libc and libdbm.
if test "$with_database_dbm" != "no"; then
- AC_CHECK_FUNC(dbm_open, with_database_dbm=yes need_libdbm=no)
- if test "$need_libdbm" != "no"; then
- AC_CHECK_LIB(dbm, dbm_open, with_database_dbm=yes need_libdbm=yes)
- fi
- if test "$with_database_dbm" = "yes"; then
- AC_DEFINE(HAVE_DBM)
- test "$need_libdbm" = "yes" && XE_PREPEND(-ldbm, LIBS)
- else with_database_dbm=no
- fi
+ AC_CHECK_FUNC(dbm_open, [with_database_dbm=yes libdbm=],
+ [AC_CHECK_LIB(dbm, dbm_open, [with_database_dbm=yes libdbm=-ldbm],
+ test "$with_database_dbm" = "yes" || \
+ XE_DIE("Required DBM support cannot be provided.")
+ with_database_dbm=no])])
+fi
+
+dnl Tell make about the DBM support we detected.
+if test -n "$libdbm"; then XE_PREPEND("$libdbm", LIBS); fi
+if test "$with_database_gnudbm" = "yes" -o \
+ "$with_database_dbm" = "yes"; then
+ AC_DEFINE(HAVE_DBM)
fi
+dnl Check for Berkeley DB.
if test "$with_database_berkdb" != "no"; then
AC_MSG_CHECKING(for Berkeley db.h)
for path in "db/db.h" "db.h"; do