This supersedes my previous patch - same changelog
Martin
configure --extra-verbose --with-database=dbm
...
checking for database support
checking for ndbm.h... yes
checking for dbm_open... no
checking for dbm_open in -ldbm... no
Required DBM support cannot be provided.
--- 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
@@ -3668,7 +3674,7 @@
done ) ;;
* ) test -d "$dir" || mkdir "$dir" ;;
esac
- XE_SPACE(SUBDIR_MAKEFILES, $SUBDIR_MAKEFILES $dir/Makefile)
+ XE_SPACE(SUBDIR_MAKEFILES, $SUBDIR_MAKEFILES $dir/Makefile $dir/GNUmakefile)
XE_SPACE(internal_makefile_list, $internal_makefile_list $dir/Makefile.in)
done
AC_SUBST(INSTALL_ARCH_DEP_SUBDIR)