]> granicus.if.org Git - mutt/commitdiff
Initial autoconf and makefile setup for autocrypt.
authorKevin McCarthy <kevin@8t8.us>
Thu, 4 Jul 2019 02:51:09 +0000 (19:51 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 3 Aug 2019 21:08:09 +0000 (14:08 -0700)
.gitignore
Makefile.am
autocrypt/Makefile.am [new file with mode: 0644]
autocrypt/autocrypt.c [new file with mode: 0644]
autocrypt/autocrypt.h [new file with mode: 0644]
check_sec.sh
configure.ac
main.c

index f58259917382479e62ae0c56c89290c04c4c6c22..0a0efda784695fef2cf36b0b66418957d4a0dc90 100644 (file)
@@ -1,5 +1,6 @@
 # autoconf products
 /aclocal.m4
+/autocrypt/Makefile.in
 /autom4te.cache
 /compile
 /Makefile.in
index 14bf141df2c97374629e451196e8b87a27c8da7a..0c206411e17934c1792dd409d2c3635bdfc4a461 100644 (file)
@@ -10,7 +10,12 @@ IMAP_SUBDIR = imap
 IMAP_INCLUDES = -I$(top_srcdir)/imap
 endif
 
-SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)
+if BUILD_AUTOCRYPT
+AUTOCRYPT_SUBDIR = autocrypt
+AUTOCRYPT_INCLUDES = -I$(top_srcdir)/autocrypt
+endif
+
+SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR) $(AUTOCRYPT_SUBDIR)
 
 bin_SCRIPTS = muttbug flea $(SMIMEAUX_TARGET)
 
@@ -39,16 +44,17 @@ mutt_SOURCES = \
 nodist_mutt_SOURCES = $(BUILT_SOURCES)
 
 mutt_LDADD = $(MUTT_LIB_OBJECTS) $(LIBOBJS) $(LIBIMAP) $(MUTTLIBS) \
-       $(INTLLIBS) $(LIBICONV)  $(GPGME_LIBS) $(GPG_ERROR_LIBS)
+       $(INTLLIBS) $(LIBICONV)  $(GPGME_LIBS) $(GPG_ERROR_LIBS) \
+       $(LIBAUTOCRYPT)
 
 mutt_DEPENDENCIES = $(MUTT_LIB_OBJECTS) $(LIBOBJS) $(LIBIMAPDEPS) \
-       $(INTLDEPS)
+       $(INTLDEPS) $(LIBAUTOCRYPTDEPS)
 
 DEFS=-DPKGDATADIR=\"$(pkgdatadir)\" -DSYSCONFDIR=\"$(sysconfdir)\" \
        -DBINDIR=\"$(bindir)\" -DMUTTLOCALEDIR=\"$(datadir)/locale\" \
        -DHAVE_CONFIG_H=1
 
-AM_CPPFLAGS=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(GPGME_CFLAGS) -Iintl
+AM_CPPFLAGS=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(AUTOCRYPT_INCLUDES) $(GPGME_CFLAGS) -Iintl
 
 EXTRA_mutt_SOURCES = account.c bcache.c compress.c crypt-gpgme.c crypt-mod-pgp-classic.c \
        crypt-mod-pgp-gpgme.c crypt-mod-smime-classic.c \
diff --git a/autocrypt/Makefile.am b/autocrypt/Makefile.am
new file mode 100644 (file)
index 0000000..235c43c
--- /dev/null
@@ -0,0 +1,10 @@
+## Process this file with automake to produce Makefile.in
+include $(top_srcdir)/flymake.am
+
+AUTOMAKE_OPTIONS = 1.6 foreign
+
+AM_CPPFLAGS = -I$(top_srcdir) -I../intl
+
+noinst_LIBRARIES = libautocrypt.a
+
+libautocrypt_a_SOURCES = autocrypt.c autocrypt.h
diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c
new file mode 100644 (file)
index 0000000..6aecf6f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
+ *
+ *     This program is free software; you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation; either version 2 of the License, or
+ *     (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program; if not, write to the Free Software
+ *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "mutt.h"
+#include "autocrypt.h"
+
+void mutt_autocrypt_init (void)
+{
+  dprint (1, (debugfile, "In mutt_autocrypt_init()\n"));
+}
+
+void mutt_autocrypt_cleanup (void)
+{
+  dprint (1, (debugfile, "In mutt_autocrypt_cleanup()\n"));
+}
diff --git a/autocrypt/autocrypt.h b/autocrypt/autocrypt.h
new file mode 100644 (file)
index 0000000..f866e76
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
+ *
+ *     This program is free software; you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation; either version 2 of the License, or
+ *     (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program; if not, write to the Free Software
+ *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _AUTOCRYPT_H
+#define _AUTOCRYPT_H 1
+
+void mutt_autocrypt_init (void);
+void mutt_autocrypt_cleanup (void);
+
+#endif
index c4505a3a44b46ebbc21b898acb3120353afa5f73..73ac3d54ee6355eb1f5dc4ac9a9fb8d70609d228 100755 (executable)
@@ -41,7 +41,7 @@ do_check '\<FREE[ ]?\([^&]' __FREE_CHECKED__ "You probably meant FREE(&...) here
 
 # don't do this check on others' code.
 do_check_files '\<(malloc|realloc|free|strdup)[        ]*\(' __MEM_CHECKED__ "Alert: Use of traditional memory management calls." \
-       *.c imap/*.c
+       *.c imap/*.c autocrypt/*.c
 
 rm -f $TMPFILE
 exit $RV
index a38ae6fd86fdaaa25725f6bb78c307fba7dcefc4..6752e7e1011343a0c6ad402897e78635df9fa4f1 100644 (file)
@@ -125,13 +125,52 @@ AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL", [Where to find sendmail on y
 
 OPS='$(srcdir)/OPS'
 
-AC_MSG_CHECKING([whether to build with GPGME support])
-AC_ARG_ENABLE(gpgme, AS_HELP_STRING([--enable-gpgme],[Enable GPGME support]),
-[       if test x$enableval = xyes; then
-               enable_gpgme=yes
-       fi
-])
+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
+
+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 != xyes; then
+    AC_MSG_ERROR([autocrypt requires --with-sqlite3])
+  fi
+  AC_DEFINE(USE_AUTOCRYPT,1,[ Define if you want support for autocrypt. ])
+  LIBAUTOCRYPT="-Lautocrypt -lautocrypt"
+  LIBAUTOCRYPTDEPS="\$(top_srcdir)/autocrypt/autocrypt.h autocrypt/libautocrypt.a"
+  enable_gpgme=yes
+fi
+AM_CONDITIONAL(BUILD_AUTOCRYPT, test x$enable_autocrypt = xyes)
+AC_SUBST(LIBAUTOCRYPT)
+AC_SUBST(LIBAUTOCRYPTDEPS)
+
+
+if test x"$enable_gpgme" != xyes; then
+  AC_ARG_ENABLE(gpgme, AS_HELP_STRING([--enable-gpgme],[Enable GPGME support]),
+  [       if test x$enableval = xyes; then
+            enable_gpgme=yes
+          fi
+  ])
+fi
 
+AC_MSG_CHECKING([whether to build with GPGME support])
 if test x"$enable_gpgme" = xyes; then
    AC_MSG_RESULT(yes)
    AM_PATH_GPGME(1.4.0, AC_DEFINE(CRYPT_BACKEND_GPGME, 1,
@@ -1604,6 +1643,6 @@ if test x$full_doc != xno ; then
 fi
 
 AC_CONFIG_FILES(Makefile contrib/Makefile doc/Makefile imap/Makefile
-        intl/Makefile m4/Makefile po/Makefile.in
+        intl/Makefile m4/Makefile po/Makefile.in autocrypt/Makefile
         hcachever.sh doc/instdoc.sh)
 AC_OUTPUT
diff --git a/main.c b/main.c
index 0a6de5e3540b085541e3d15bffefc6394831eb8b..7b32dbd180f88a655dc50869201b027ff59ba258 100644 (file)
--- a/main.c
+++ b/main.c
 #include "monitor.h"
 #endif
 
+#ifdef USE_AUTOCRYPT
+#include "autocrypt/autocrypt.h"
+#endif
+
 #include <string.h>
 #include <stdlib.h>
 #include <locale.h>
@@ -863,6 +867,9 @@ int main (int argc, char **argv, char **environ)
 
   /* Initialize crypto backends.  */
   crypt_init ();
+#ifdef USE_AUTOCRYPT
+  mutt_autocrypt_init ();
+#endif
 
   if (newMagic)
     mx_set_magic (newMagic);
@@ -1348,6 +1355,9 @@ cleanup_and_exit:
 #endif
 #ifdef USE_SASL
   mutt_sasl_done ();
+#endif
+#ifdef USE_AUTOCRYPT
+  mutt_autocrypt_cleanup ();
 #endif
   mutt_browser_cleanup ();
   mutt_free_opts ();