--- m4/bdb.m4.orig	2022-09-21 18:58:52.000000000 -0700
+++ m4/bdb.m4	2022-09-21 21:55:57.000000000 -0700
@@ -128,11 +128,14 @@
 	do
 	    bdbdir=""
 	    AC_MSG_CHECKING([for Berkeley DB files in $d])
-	    for version in "" 6.0 5.3 5.1 5.0 4.9 4.8 4.7
+	    for version in "" 6.2 6.0 5.3 5.1 5.0 4.9 4.8 4.7
 	    do
 	        if test $platform_win32 = yes
 		then
 		    sversion=`echo $version | sed -e 's,\.,,g'`
+		elif test $platform_carbon = yes
+		then
+		    sversion=`echo $version | sed -e 's,\.,,g'`
 		else
 		    sversion=`echo $version | sed -e 's,\..*,,g'`
 		fi
@@ -149,6 +152,12 @@
         	        db_lib="-ldb$sversion"
 		        db_libfile="$d/$bdb_loclibdir/libdb$sversion$bdb_libext"
         	        try_headers="db.h db$version/db.h db$sversion/db.h"
+		    elif test $platform_carbon = yes
+		    then
+		        db_libfilename="libdb-$version$bdb_libext"
+        	        db_lib="-ldb-$version"
+		        db_libfile="$d/$bdb_loclibdir/libdb-$version$bdb_libext"
+        	        try_headers="db.h db$version/db.h db$sversion/db.h"
 		    else
 		        db_libfilename="libdb-$version$bdb_libext"
         	        db_lib="-ldb-$version"
@@ -159,7 +168,7 @@
 
 		for db_hdr in $try_headers
 		do
-		    #echo "Checking for files $d/$bdb_locincludedir/$db_hdr and $db_libfile"
+		    echo "Checking for files $d/$bdb_locincludedir/$db_hdr and $db_libfile"
 		    if test -f $d/$bdb_locincludedir/$db_hdr -a -f $db_libfile
 		    then
   	                save_CFLAGS="$CFLAGS"
@@ -236,6 +245,9 @@
         if test "x$platform_win32" = xyes
 	then
 	    bdbsql_loclibdir=bin
+        elif test "x$platform_carbon" = xyes
+	then
+	    bdbsql_loclibdir=$bdb_loclibdir
 	else
 	    bdbsql_loclibdir=lib
 	fi
@@ -246,10 +258,13 @@
     if test "x$BDB_DIR" != x
     then
         AC_MSG_CHECKING([for Berkeley DB SQL files along with found BDB installation])
-	#echo "Checking $BDB_DIR/$bdb_locincludedir/dbsql.h and $BDB_DIR/$bdb_locincludedir/libdb/dbsql.h"
-	if test -f $BDB_DIR/$bdb_locincludedir/dbsql.h -o -f $BDB_DIR/$bdb_locincludedir/libdb/dbsql.h
+	echo "Checking $BDB_DIR/include/db$sversion/dbsql.h, $BDB_DIR/include/dbsql.h and $BDB_DIR/include/libdb/dbsql.h"
+	if test -f $BDB_DIR/include/db$sversion/dbsql.h -o $BDB_DIR/include/dbsql.h -o -f $BDB_DIR/include/libdb/dbsql.h
 	then
-	    if test -f $BDB_DIR/$bdb_locincludedir/libdb/dbsql.h
+	    if test -f $BDB_DIR/include/db$sversion/dbsql.h
+	    then
+	        BDBSQL_CFLAGS="$BDB_CFLAGS/db$sversion"
+	    elif test -f $BDB_DIR/include/libdb/dbsql.h
 	    then
 	        BDBSQL_CFLAGS="$BDB_CFLAGS/libdb"
 	    else
