From: Kevin McCarthy Date: Thu, 4 Jul 2019 02:51:09 +0000 (-0700) Subject: Initial autoconf and makefile setup for autocrypt. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fe2980d3b1a429bf14e8d6286ac4f06d0c666e7;p=mutt Initial autoconf and makefile setup for autocrypt. --- diff --git a/.gitignore b/.gitignore index f5825991..0a0efda7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # autoconf products /aclocal.m4 +/autocrypt/Makefile.in /autom4te.cache /compile /Makefile.in diff --git a/Makefile.am b/Makefile.am index 14bf141d..0c206411 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 00000000..235c43c2 --- /dev/null +++ b/autocrypt/Makefile.am @@ -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 index 00000000..6aecf6fe --- /dev/null +++ b/autocrypt/autocrypt.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2019 Kevin J. McCarthy + * + * 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 index 00000000..f866e76b --- /dev/null +++ b/autocrypt/autocrypt.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 Kevin J. McCarthy + * + * 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 diff --git a/check_sec.sh b/check_sec.sh index c4505a3a..73ac3d54 100755 --- a/check_sec.sh +++ b/check_sec.sh @@ -41,7 +41,7 @@ do_check '\@], + [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 0a6de5e3..7b32dbd1 100644 --- a/main.c +++ b/main.c @@ -51,6 +51,10 @@ #include "monitor.h" #endif +#ifdef USE_AUTOCRYPT +#include "autocrypt/autocrypt.h" +#endif + #include #include #include @@ -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 ();