diff -Nurd beecrypt-4.2.1.orig/Makefile.am beecrypt-4.2.1/Makefile.am
--- beecrypt-4.2.1.orig/Makefile.am	2009-07-08 14:56:18.000000000 -0400
+++ beecrypt-4.2.1/Makefile.am	2023-06-06 11:09:16.000000000 -0400
@@ -33,6 +33,7 @@
 LIBBEECRYPT_LT_AGE = 0
 LIBBEECRYPT_LT_REVISION = 0
 
+ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = gnu check-news no-dependencies
 
 SUBDIRS = . include $(MAYBE_SUB) tests docs gas masm
diff -Nurd beecrypt-4.2.1.orig/acinclude.m4 beecrypt-4.2.1/acinclude.m4
--- beecrypt-4.2.1.orig/acinclude.m4	2009-07-04 06:04:08.000000000 -0400
+++ beecrypt-4.2.1/acinclude.m4	2023-06-06 11:09:22.000000000 -0400
@@ -320,6 +320,9 @@
             #if HAVE_FCNTL_H
             # include <fcntl.h>
             #endif
+            #if HAVE_TIME_H
+            # include <time.h>
+            #endif
             #if HAVE_STRING_H
             # include <string.h>
             #endif
@@ -338,7 +341,7 @@
               int i, rc, fd = open("conftest.aio", O_RDONLY);
 
               if (fd < 0)
-                exit(1);
+                return 1;
 
               memset(&a, 0, sizeof(struct aiocb));
 
@@ -355,7 +358,7 @@
               if (aio_read(&a) < 0)
               {
                 perror("aio_read");
-                exit(1);
+                return 1;
               }
               if (aio_suspend(&a_list, 1, &a_timeout) < 0)
               {
@@ -368,25 +371,25 @@
                   if (aio_suspend(&a_list, 1, &a_timeout) < 0)
                   {
                     perror("aio_suspend");
-                    exit(1);
+                    return 1;
                   }
                 }
                 else
                 {
                   perror("aio_suspend");
-                  exit(1);
+                  return 1;
                 }
                 #else
-                exit(1);
+                return 1;
                 #endif
               }
               if (aio_error(&a) < 0)
-                exit(1);
+                return 1;
 
               if (aio_return(&a) < 0)
-                exit(1);
+                return 1;
 
-              exit(0);
+              return 0;
           ]])],[bc_cv_working_aio=yes],[bc_cv_working_aio=no],[
             case $target_os in
               linux* | solaris*)
@@ -1610,7 +1613,7 @@
   AH_TEMPLATE([ENABLE_THREAD_LOCAL_STORAGE],[Define to 1 if you want to enable thread-local-storage support])
   if test "$ac_enable_threads" = yes; then
     AC_MSG_CHECKING([if your compiler supports thread-local-storage])
-    AC_COMPILE_IFELSE([__thread int a = 0;],[
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[__thread int a = 0;]])],[
       AC_DEFINE([ENABLE_THREAD_LOCAL_STORAGE],1)
       AC_MSG_RESULT([yes])
       ],[
diff -Nurd beecrypt-4.2.1.orig/blockmode.c beecrypt-4.2.1/blockmode.c
--- beecrypt-4.2.1.orig/blockmode.c	2009-06-17 07:05:53.000000000 -0400
+++ beecrypt-4.2.1/blockmode.c	2023-06-06 11:09:27.000000000 -0400
@@ -29,6 +29,7 @@
 # include "config.h"
 #endif
 
+#include "beecrypt/endianness.h"
 #include "beecrypt/blockmode.h"
 
 int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks)
diff -Nurd beecrypt-4.2.1.orig/configure.ac beecrypt-4.2.1/configure.ac
--- beecrypt-4.2.1.orig/configure.ac	2009-07-12 03:18:46.000000000 -0400
+++ beecrypt-4.2.1/configure.ac	2023-06-06 11:09:16.000000000 -0400
@@ -4,6 +4,7 @@
 AC_CANONICAL_TARGET
 AC_CONFIG_SRCDIR(include/beecrypt/beecrypt.h)
 AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIRS([m4])
 AM_INIT_AUTOMAKE
 
 # Checks for AWK - used by expert mode
diff -Nurd beecrypt-4.2.1.orig/include/beecrypt/c++/beeyond/BeeCertificate.h beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeCertificate.h
--- beecrypt-4.2.1.orig/include/beecrypt/c++/beeyond/BeeCertificate.h	2009-06-17 07:05:54.000000000 -0400
+++ beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeCertificate.h	2023-06-06 11:09:16.000000000 -0400
@@ -147,13 +147,13 @@
 			mutable bytearray* enc;
 
 			BeeCertificate();
-			BeeCertificate(InputStream& in) throw (IOException);
 
 			void encodeTBS(DataOutputStream& out) const throw (IOException);
 
 			bytearray* encodeTBS() const throw (CertificateEncodingException);
 
 		public:
+			BeeCertificate(InputStream& in) throw (IOException);
 			BeeCertificate(const BeeCertificate&) throw (CloneNotSupportedException);
 			virtual ~BeeCertificate();
 
diff -Nurd beecrypt-4.2.1.orig/include/beecrypt/c++/security/Security.h beecrypt-4.2.1/include/beecrypt/c++/security/Security.h
--- beecrypt-4.2.1.orig/include/beecrypt/c++/security/Security.h	2009-06-17 07:05:55.000000000 -0400
+++ beecrypt-4.2.1/include/beecrypt/c++/security/Security.h	2023-06-06 11:09:16.000000000 -0400
@@ -61,7 +61,6 @@
 			friend class SecureRandom;
 			friend class Signature;
 
-		private:
 			struct spi
 			{
 				Object* cspi;
@@ -76,6 +75,7 @@
 			static spi* getSpi(const String& algo, const String& type, const Provider&) throw (NoSuchAlgorithmException);
 			static spi* getFirstSpi(const String& type);
 
+		private:
 			static const String& getKeyStoreDefault();
 
 			static bool _init;
diff -Nurd beecrypt-4.2.1.orig/include/beecrypt/c++/util/AbstractSet.h beecrypt-4.2.1/include/beecrypt/c++/util/AbstractSet.h
--- beecrypt-4.2.1.orig/include/beecrypt/c++/util/AbstractSet.h	2009-06-17 07:05:55.000000000 -0400
+++ beecrypt-4.2.1/include/beecrypt/c++/util/AbstractSet.h	2023-06-06 11:09:16.000000000 -0400
@@ -56,7 +56,7 @@
 					if (c->size() != size())
 						return false;
 
-					return containsAll(*c);
+					return this->containsAll(*c);
 				}
 				return false;
 			}
