Index: dist/configure.ac
===================================================================
--- dist.orig/configure.ac
+++ dist/configure.ac
@@ -457,12 +457,16 @@ if test "$db_cv_mingw" = "yes"; then
 	OSDIR=os_windows
 	PATH_SEPARATOR="\\\\/:"
 
-	AC_DEFINE(DB_WIN32)
+	# For some reason, autoheader chokes if this is defined without
+	# a description.
+	AC_DEFINE([DB_WIN32], [1], [Some Windows crap.])
 	AC_DEFINE(STDC_HEADERS)
 else
 	OSDIR=os
 	PATH_SEPARATOR="/"
-	AC_DEFINE(HAVE_SYSTEM_INCLUDE_FILES)
+	# For some reason, autoheader chokes if this is defined without
+	# a description.
+	AC_DEFINE([HAVE_SYSTEM_INCLUDE_FILES], [1], [More Windows crap.])
 fi
 
 # Checks for include files, structures, C types.
Index: dist/s_config
===================================================================
--- dist.orig/s_config
+++ dist/s_config
@@ -3,21 +3,15 @@
 #
 # Build the autoconfiguration files.
 
-trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 13 15
+trap 'rm -f aclocal.m4' 0 1 2 3 13 15
 
 . ./RELEASE
 
-echo "autoconf: building aclocal.m4..."
-cat aclocal/*.m4 aclocal_java/*.m4 > aclocal.m4
-
-echo "autoconf: running autoheader to build config.hin..."
-rm -f config.hin
-autoheader
-chmod 444 config.hin
-
-echo "autoconf: running autoconf to build configure"
-rm -f configure
-autoconf
+# We need to run our libtoolize to get a libtool that understands
+# -stdlib, so use autoreconf and pass autoreconf.{pre_,post_}args as the
+# arguments to this script.
+rm -f config.hin configure
+autoreconf "$@" || exit $?
 
 # Edit version information we couldn't pre-compute.
 sed -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
--- dist/aclocal/types.m4.orig	2007-04-19 00:28:20.000000000 +1000
+++ dist/aclocal/types.m4	2021-02-02 23:28:20.000000000 +1100
@@ -4,7 +4,7 @@
 #
 # Prefer ints to anything else, because read, write and others historically
 # returned an int.
-AC_DEFUN(AM_SEARCH_USIZES, [
+AC_DEFUN([AM_SEARCH_USIZES], [
 	case "$3" in
 	"$ac_cv_sizeof_unsigned_int")
 		$1="typedef unsigned int $2;";;
@@ -21,7 +21,7 @@
 			AC_MSG_ERROR([No unsigned $3-byte integral type])
 		fi;;
 	esac])
-AC_DEFUN(AM_SEARCH_SSIZES, [
+AC_DEFUN([AM_SEARCH_SSIZES], [
 	case "$3" in
 	"$ac_cv_sizeof_int")
 		$1="typedef int $2;";;
@@ -40,7 +40,7 @@
 	esac])
 
 # Check for the standard system types.
-AC_DEFUN(AM_TYPES, [
+AC_DEFUN([AM_TYPES], [
 
 # db.h includes <sys/types.h> and <stdio.h>, not the other default includes
 # autoconf usually includes.  For that reason, we specify a set of includes
--- dist/aclocal/sequence.m4.orig	2021-02-02 23:24:19.000000000 +1100
+++ dist/aclocal/sequence.m4	2021-02-02 23:29:53.000000000 +1100
@@ -1,7 +1,7 @@
 # $Id: sequence.m4,v 12.3 2005/11/24 00:49:24 bostic Exp $
 
 # Try and configure sequence support.
-AC_DEFUN(AM_SEQUENCE_CONFIGURE, [
+AC_DEFUN([AM_SEQUENCE_CONFIGURE], [
 	AC_MSG_CHECKING([for 64-bit integral type support for sequences])
 
 	db_cv_build_sequence="yes"
--- dist/aclocal/tcl.m4.orig	2005-06-29 06:45:25.000000000 +1000
+++ dist/aclocal/tcl.m4	2021-02-02 23:33:26.000000000 +1100
@@ -45,7 +45,7 @@
 # permission to use and distribute the software in accordance with the
 # terms specified in this license.
 
-AC_DEFUN(SC_PATH_TCLCONFIG, [
+AC_DEFUN([SC_PATH_TCLCONFIG], [
 	AC_CACHE_VAL(ac_cv_c_tclconfig,[
 
 	    # First check to see if --with-tclconfig was specified.
@@ -77,7 +77,7 @@
 	fi
 ])
 
-AC_DEFUN(SC_LOAD_TCLCONFIG, [
+AC_DEFUN([SC_LOAD_TCLCONFIG], [
 	AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
 
 	if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
@@ -123,7 +123,7 @@
 ])
 
 # Optional Tcl API.
-AC_DEFUN(AM_TCL_LOAD, [
+AC_DEFUN([AM_TCL_LOAD], [
 	if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then
 		AC_MSG_ERROR([Tcl requires shared libraries])
 	fi
--- dist/aclocal/sosuffix.m4.orig	2004-11-17 14:43:38.000000000 +1100
+++ dist/aclocal/sosuffix.m4	2021-02-02 23:35:31.000000000 +1100
@@ -14,7 +14,7 @@
 
 # This macro is used internally to discover the suffix for the current
 # settings of $module.  The result is stored in $_SOSUFFIX.
-AC_DEFUN(_SOSUFFIX_INTERNAL, [
+AC_DEFUN([_SOSUFFIX_INTERNAL], [
 	versuffix=""
 	release=""
 	libname=libfoo
@@ -33,7 +33,7 @@
 
 # SOSUFFIX_CONFIG will set the variable SOSUFFIX to be the
 # shared library extension used for general linking, not dlopen.
-AC_DEFUN(SOSUFFIX_CONFIG, [
+AC_DEFUN([SOSUFFIX_CONFIG], [
 	AC_MSG_CHECKING([SOSUFFIX from libtool])
 	module=no
         _SOSUFFIX_INTERNAL
@@ -45,7 +45,7 @@
 # MODSUFFIX_CONFIG will set the variable MODSUFFIX to be the
 # shared library extension used for dlopen'ed modules.
 # To discover this, we set $module, simulating libtool's -module option.
-AC_DEFUN(MODSUFFIX_CONFIG, [
+AC_DEFUN([MODSUFFIX_CONFIG], [
 	AC_MSG_CHECKING([MODSUFFIX from libtool])
 	module=yes
         _SOSUFFIX_INTERNAL
@@ -61,7 +61,7 @@
 # Robert Boehne:  Not much point in this macro any more because apparently
 # Darwin is the only OS that wants or needs the .jnilib extension.
 ##########################################################################
-AC_DEFUN(JMODSUFFIX_CONFIG, [
+AC_DEFUN([JMODSUFFIX_CONFIG], [
 	AC_MSG_CHECKING([JMODSUFFIX from libtool])
 	module=yes
         _SOSUFFIX_INTERNAL
--- dist/aclocal/rpc.m4.orig	2006-05-09 06:52:36.000000000 +1000
+++ dist/aclocal/rpc.m4	2021-02-02 23:39:07.000000000 +1100
@@ -1,7 +1,7 @@
 # $Id: rpc.m4,v 12.1 2006/05/08 20:52:36 bostic Exp $
 
 # Try and configure RPC support.
-AC_DEFUN(AM_RPC_CONFIGURE, [
+AC_DEFUN([AM_RPC_CONFIGURE], [
 	AC_DEFINE(HAVE_RPC)
 	AH_TEMPLATE(HAVE_RPC, [Define to 1 if building RPC client/server.])
 
--- dist/aclocal/programs.m4.orig	2007-04-19 00:28:19.000000000 +1000
+++ dist/aclocal/programs.m4	2021-02-02 23:40:15.000000000 +1100
@@ -1,7 +1,7 @@
 # $Id: programs.m4,v 12.3 2007/04/18 14:28:19 bostic Exp $
 
 # Check for programs used in building/installation.
-AC_DEFUN(AM_PROGRAMS_SET, [
+AC_DEFUN([AM_PROGRAMS_SET], [
 
 AC_CHECK_TOOL(CHMOD, chmod, none)
 test "$CHMOD" = "none" && AC_MSG_ERROR([No chmod utility found.])
--- dist/aclocal/options.m4.orig	2007-05-04 23:46:25.000000000 +1000
+++ dist/aclocal/options.m4	2021-02-02 23:41:22.000000000 +1100
@@ -1,7 +1,7 @@
 # $Id: options.m4,v 12.7 2007/05/04 13:46:25 bostic Exp $
 
 # Process user-specified options.
-AC_DEFUN(AM_OPTIONS_SET, [
+AC_DEFUN([AM_OPTIONS_SET], [
 
 # --enable-bigfile was the configuration option that Berkeley DB used before
 # autoconf 2.50 was released (which had --enable-largefile integrated in).
--- dist/aclocal/mutex.m4.orig	2007-05-19 01:08:50.000000000 +1000
+++ dist/aclocal/mutex.m4	2021-02-02 23:42:45.000000000 +1100
@@ -1,7 +1,7 @@
 # $Id: mutex.m4,v 12.26 2007/05/18 15:08:50 bostic Exp $
 
 # POSIX pthreads tests: inter-process safe and intra-process only.
-AC_DEFUN(AM_PTHREADS_SHARED, [
+AC_DEFUN([AM_PTHREADS_SHARED], [
 AC_TRY_RUN([
 #include <pthread.h>
 main() {
@@ -43,7 +43,7 @@
 	pthread_condattr_destroy(&condattr) ||
 	pthread_mutexattr_destroy(&mutexattr));
 ], [db_cv_mutex="$1"]))])
-AC_DEFUN(AM_PTHREADS_PRIVATE, [
+AC_DEFUN([AM_PTHREADS_PRIVATE], [
 AC_TRY_RUN([
 #include <pthread.h>
 main() {
@@ -87,7 +87,7 @@
 # There are 3 mutex groups in BDB: pthreads-style, test-and-set, or a hybrid
 # combination of the two.   We first test for the pthreads-style mutex, and
 # then for a test-and-set mutex.
-AC_DEFUN(AM_DEFINE_MUTEXES, [
+AC_DEFUN([AM_DEFINE_MUTEXES], [
 
 # Mutexes we don't test for, but want the #defines to exist for other ports.
 AH_TEMPLATE(HAVE_MUTEX_VMS, [Define to 1 to use VMS mutexes.])
--- dist/aclocal/gcc.m4.orig	2004-11-17 14:43:37.000000000 +1100
+++ dist/aclocal/gcc.m4	2021-02-02 23:44:27.000000000 +1100
@@ -1,6 +1,6 @@
 # Version 2.96 of gcc (shipped with RedHat Linux 7.[01] and Mandrake) had
 # serious problems.
-AC_DEFUN(AC_GCC_CONFIG1, [
+AC_DEFUN([AC_GCC_CONFIG1], [
 AC_CACHE_CHECK([whether we are using gcc version 2.96],
 db_cv_gcc_2_96, [
 db_cv_gcc_2_96=no
@@ -20,7 +20,7 @@
 
 # Versions of g++ up to 2.8.0 required -fhandle-exceptions, but it is
 # renamed as -fexceptions and is the default in versions 2.8.0 and after.
-AC_DEFUN(AC_GCC_CONFIG2, [
+AC_DEFUN([AC_GCC_CONFIG2], [
 AC_CACHE_CHECK([whether g++ requires -fhandle-exceptions],
 db_cv_gxx_except, [
 db_cv_gxx_except=no;
--- dist/aclocal/cxx.m4.orig	2004-11-17 14:43:37.000000000 +1100
+++ dist/aclocal/cxx.m4	2021-02-02 23:45:39.000000000 +1100
@@ -1,7 +1,7 @@
 # C++ checks to determine what style of headers to use and
 # whether to use "using" clauses.
 
-AC_DEFUN(AC_CXX_HAVE_STDHEADERS, [
+AC_DEFUN([AC_CXX_HAVE_STDHEADERS], [
 AC_SUBST(cxx_have_stdheaders)
 AC_CACHE_CHECK([whether C++ supports the ISO C++ standard includes],
 db_cv_cxx_have_stdheaders,
--- dist/aclocal_java/ac_jni_include_dirs.m4.orig	2006-08-25 00:45:36.000000000 +1000
+++ dist/aclocal_java/ac_jni_include_dirs.m4	2021-02-02 23:48:20.000000000 +1100
@@ -30,7 +30,7 @@
 dnl @author Don Anderson
 dnl @version $Id: ac_jni_include_dirs.m4,v 12.1 2006/08/24 14:45:36 bostic Exp $
 dnl
-AC_DEFUN(AC_JNI_INCLUDE_DIR,[
+AC_DEFUN([AC_JNI_INCLUDE_DIR],[
 
 JNI_INCLUDE_DIRS=""
 
@@ -97,7 +97,7 @@
 # Follows symbolic links on <path>,
 # finally setting variable _ACJNI_FOLLOWED
 # --------------------
-AC_DEFUN(_ACJNI_FOLLOW_SYMLINKS,[
+AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[
 # find the include directory relative to the javac executable
 _cur="$1"
 while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
