From xemacs-m  Thu Apr 24 07:26:15 1997
Received: from alk.physik.uni-erlangen.de (root@theorie3.physik.uni-erlangen.de [131.188.166.210])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id HAA25002
	for <xemacs-beta@xemacs.org>; Thu, 24 Apr 1997 07:26:14 -0500 (CDT)
Received: from cognac.physik.uni-erlangen.de (aoppelt@cognac.physik.uni-erlangen.de [131.188.166.201])
          by alk.physik.uni-erlangen.de (8.8.5/8.8.4) with ESMTP
	  id OAA24749 for <xemacs-beta@xemacs.org>; Thu, 24 Apr 1997 14:26:16 +0200
Received: (from aoppelt@localhost)
	by cognac.physik.uni-erlangen.de (8.8.5/8.8.5) id OAA23949;
	Thu, 24 Apr 1997 14:26:15 +0200
To: xemacs-beta@xemacs.org
Subject: Re: <db/db.h> vs <db.h> Linux question
References: <199704241005.DAA08834@bittersweet.inetarena.com> <ubk9lsk58g.fsf@cognac.physik.uni-erlangen.de>
From: Achim Oppelt <aoppelt@theorie3.physik.uni-erlangen.de>
Date: 24 Apr 1997 14:26:14 +0200
In-Reply-To: Achim Oppelt's message of 24 Apr 1997 13:52:31 +0200
Message-ID: <ubiv1ck3o9.fsf@cognac.physik.uni-erlangen.de>
Lines: 127
X-Mailer: Gnus v5.4.46/XEmacs 20.2(beta2)

Ok, I seem to have successfully patched configure.in, src/config.h and
src/database.c to check for db/db.h. I have only tried this on a Debian
system. You might want to check if it breaks anything on non-Debian
systems. 

You need autoconf 1.11 to regenerate configure, Debian comes with autoconf
2 :-(. Anyway, the patch includes the necessary changes to configure as
well.

Wow, this is my first XEmacs patch :-)

Achim

--- xemacs-20.2-b2/src/database.c.orig	Thu Apr 24 13:53:47 1997
+++ xemacs-20.2-b2/src/database.c	Thu Apr 24 13:53:53 1997
@@ -29,7 +29,11 @@
 #ifdef HAVE_DATABASE
 #include <database.h>         /* Our include file     */
 #ifdef HAVE_BERKELEY_DB
+#ifdef HAVE_DB_DB_H
+#include <db/db.h>
+#else
 #include <db.h>                       /* Berkeley db access   */
+#endif
 #endif
 #ifdef HAVE_DBM
 #include <ndbm.h>
--- xemacs-20.2-b2/src/config.h.in.orig	Thu Apr 24 14:08:36 1997
+++ xemacs-20.2-b2/src/config.h.in	Thu Apr 24 14:09:42 1997
@@ -266,6 +266,9 @@
 /* Do you have the BerkDB libraries and want XEmacs to use them? */
 #undef HAVE_BERKELEY_DB
 
+/* Do we have db/db.h or db.h */
+#undef HAVE_DB_DB_H
+
 /* Do you have the -lgdbm library? (separated from HAVE_GNU_DBM stuff
    because FreeBSD has the DBM routines in libc) */
 #undef HAVE_LIBGDBM
--- xemacs-20.2-b2/configure.in.orig	Thu Apr 24 13:49:13 1997
+++ xemacs-20.2-b2/configure.in	Thu Apr 24 13:50:55 1997
@@ -3014,6 +3014,8 @@
       AC_FUNC_CHECK(dbopen, with_database_berkdb=yes, with_database_berkdb=no)
     fi
   fi
+  AC_HEADER_CHECK(db/db.h, have_db_db_h=yes, have_db_db_h=no)
+  IF_YES_AC_DEFINE(have_db_db_h, HAVE_DB_DB_H)
 fi
 IF_YES_AC_DEFINE(with_database_berkdb, HAVE_BERKELEY_DB)
 
--- xemacs-20.2-b2/configure.orig	Thu Apr 24 14:22:55 1997
+++ xemacs-20.2-b2/configure	Thu Apr 24 14:04:44 1997
@@ -6183,6 +6183,37 @@
 
     fi
   fi
+  test -n "$silent" || echo "checking for db/db.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+#include <db/db.h>
+EOF
+ac_err=`eval "(exec $ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test "${extra_verbose}" = "yes"  && test -n "$ac_err"; then
+  echo "$ac_err"
+fi
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  have_db_db_h=yes
+
+else
+  rm -rf conftest*
+  have_db_db_h=no
+fi
+rm -f conftest*
+
+  test "${have_db_db_h}" = yes && 
+{
+test -n "$verbose" && \
+echo "	defining HAVE_DB_DB_H"
+echo "#define" HAVE_DB_DB_H "1" >> confdefs.h
+DEFS="$DEFS -DHAVE_DB_DB_H=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_DB_DB_H\${ac_dB}HAVE_DB_DB_H\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE_DB_DB_H\${ac_uB}HAVE_DB_DB_H\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE_DB_DB_H\${ac_eB}HAVE_DB_DB_H\${ac_eC}1\${ac_eD}
+"
+}
+
 fi
 test "${with_database_berkdb}" = yes && 
 {
@@ -7276,15 +7307,15 @@
 # This directory was configured as follows,
 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 #
-# $0 $quoted_arguments
+# $0 $configure_args
 
 ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]"
 for ac_option
 do
   case "\$ac_option" in
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo running \${CONFIG_SHELL-/bin/sh} $0 $quoted_arguments --no-create
-    exec \${CONFIG_SHELL-/bin/sh} $0 $quoted_arguments --no-create ;;
+    echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create
+    exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
     echo "config.status generated by autoconf version 1.11"
     exit 0 ;;
--- xemacs-20.2-b2/ChangeLog.orig	Thu Apr 24 13:58:27 1997
+++ xemacs-20.2-b2/ChangeLog	Thu Apr 24 14:16:25 1997
@@ -1,3 +1,9 @@
+Thu Apr 24 13:56:53 1997  Achim Oppelt  <aoppelt@theorie3.physik.uni-erlangen.de>
+
+	* configure.in, src/config.h and src/database.c: Check for
+	Berkeley db include file in db/db.h. Necessary on Debian Linux
+	systems.
+
 Wed Apr 23 10:33:58 1997  Steven L Baur  <steve@altair.xemacs.org>
 
 	* XEmacs 20.2-b2 is released.


-- 
Achim Oppelt, Schwedenstr. 25, D-91080 Spardorf, Germany
aoppelt@theorie3.physik.uni-erlangen.de
Tel: +49 9131 85-8816	Tel (private): +49 9131 503693	Fax: +49 9131 503690

