Hi all,
I wasn't happy with the way autocrypt was added to configure but then realized
that there is only one real problem with it. The code makes assumptions that
aren't backed by configure tests.
The autocrypt code uses sqlite3_prepare_v3(), added in version 3.20, and
without a version check, building will fail at the linker stage.
The attached patch tries to address this. At the core is the removal of the
custom --with-sqlite section and replacement with
https://www.gnu.org/software/autoconf-archive/ax_lib_sqlite3.html#ax_lib_sqlite3,
which needs to be downloaded and dumped into the m4 directory. This macro
provides the version test and --with-sqlite option. The patch for
autocrypt/Makefile.am adds the macro's SQLITE3_CFLAGS to AM_CPPFLAGS, and,
likewise, the patch for the top Makefile.am adds SQLITE3_LDFLAGS to mutt_LDADD.
I have not tested --with-sqlite=PFX.
diff -x Makefile.in -x aclocal.m4 -x configure -x doc -urN
mutt-1.14.2.orig/autocrypt/Makefile.am mutt-1.14.2/autocrypt/Makefile.am
--- mutt-1.14.2.orig/autocrypt/Makefile.am 2020-05-02 22:08:56.000000000
+0100
+++ mutt-1.14.2/autocrypt/Makefile.am 2020-06-03 10:26:00.132506085 +0100
@@ -5,7 +5,7 @@
EXTRA_DIST = README
-AM_CPPFLAGS = -I$(top_srcdir) -I../intl
+AM_CPPFLAGS = -I$(top_srcdir) -I../intl $(SQLITE3_CFLAGS)
noinst_LIBRARIES = libautocrypt.a
diff -x Makefile.in -x aclocal.m4 -x configure -x doc -urN
mutt-1.14.2.orig/configure.ac mutt-1.14.2/configure.ac
--- mutt-1.14.2.orig/configure.ac 2020-05-25 02:19:47.000000000 +0100
+++ mutt-1.14.2/configure.ac 2020-06-03 10:34:32.336332308 +0100
@@ -125,31 +125,15 @@
OPS='$(srcdir)/OPS'
-AC_ARG_WITH(sqlite3,
- AS_HELP_STRING([--with-sqlite3@<:@=PFX@:>@],
- [Enable sqlite3 support. Required by autocrypt.]),
- [],
- [with_sqlite3=no])
-if test x$with_sqlite3 != xno; then
- if test x$with_sqlite3 != xyes; then
- LDFLAGS="$LDFLAGS -L$with_sqlite3/lib"
- CPPFLAGS="$CPPFLAGS -I$with_sqlite3/include"
- fi
- saved_LIBS="$LIBS"
-
- AC_CHECK_LIB(sqlite3, sqlite3_open, [],
- AC_MSG_ERROR([Unable to find sqlite3 library]))
-
- LIBS="$saved_LIBS"
- MUTTLIBS="$MUTTLIBS -lsqlite3"
-fi
+mutt_autocrypt_sqlite_version=3.20
AC_ARG_ENABLE(autocrypt,
AS_HELP_STRING([--enable-autocrypt],[Enable autocrypt support]),
[],
[enable_autocrypt=no])
if test x$enable_autocrypt = xyes; then
- if test x$with_sqlite3 = xno; then
+ AX_LIB_SQLITE3($mutt_autocrypt_sqlite_version)
+ if test x$ac_sqlite3_version = x; then
AC_MSG_ERROR([autocrypt requires sqlite3 version
$mutt_autocrypt_sqlite_version or better])
fi
AC_DEFINE(USE_AUTOCRYPT,1,[ Define if you want support for autocrypt. ])
diff -x Makefile.in -x aclocal.m4 -x configure -x doc -urN
mutt-1.14.2.orig/Makefile.am mutt-1.14.2/Makefile.am
--- mutt-1.14.2.orig/Makefile.am 2020-05-25 02:19:47.000000000 +0100
+++ mutt-1.14.2/Makefile.am 2020-06-03 10:25:30.947515432 +0100
@@ -44,7 +44,7 @@
nodist_mutt_SOURCES = $(BUILT_SOURCES)
mutt_LDADD = $(MUTT_LIB_OBJECTS) $(LIBOBJS) \
- $(LIBIMAP) $(LIBAUTOCRYPT) \
+ $(LIBIMAP) $(LIBAUTOCRYPT) $(SQLITE3_LDFLAGS) \
$(MUTTLIBS) \
$(INTLLIBS) $(LIBICONV) $(GPGME_LIBS) $(GPG_ERROR_LIBS)