From: Pietro Cerutti Date: Mon, 24 Apr 2017 15:57:15 +0000 (+0100) Subject: Fix and simplify handling of GPGME in configure.ac (#545) X-Git-Tag: neomutt-20170428~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57b2a57df6770dfa2aa12160be64d7f53453a078;p=neomutt Fix and simplify handling of GPGME in configure.ac (#545) * Fix When GPGME is not installed, the m4 macro AM_PATH_GPGME is not defined, which causes autoconf to fail. The fix adds an `ifdef` around the block to skip expanding the macro, if it's not defined. * Enhancement The enhancement is to assume that we have at leat GPGME 1.2.0 (released in 2009). This allows us to simplify the configure.ac code block by avoiding checks for functionalities we know to be there. Fixes #542 --- diff --git a/configure.ac b/configure.ac index 74399bfe2..865ad11ec 100644 --- a/configure.ac +++ b/configure.ac @@ -250,21 +250,16 @@ dnl == Declare all the checks and code for options / features below this line == dnl --enable-gpgme AS_IF([test x$use_gpgme = "xyes"], [ - AM_PATH_GPGME(1.0.0, AC_DEFINE(CRYPT_BACKEND_GPGME, 1, - [Defined, if GPGME support is enabled]), - [gpgme_found=no]) - AS_IF([test x$gpgme_found = "xno"], [ - AC_MSG_ERROR([*** GPGME not found ***]) - ], [ - AM_PATH_GPGME(1.1.1, AC_DEFINE(HAVE_GPGME_PKA_TRUST, 1, - [Define if GPGME supports PKA])) - dnl AC_CHECK_FUNCS([gpgme_op_export_keys]) - saved_LIBS="$LIBS" - LIBS="$LIBS $GPGME_LIBS" - AC_CHECK_FUNCS([gpgme_op_export_keys]) - LIBS="$saved_LIBS" - MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt_gpgme.o crypt_mod_pgp_gpgme.o crypt_mod_smime_gpgme.o" - ]) + ifdef([AM_PATH_GPGME], [ + AM_PATH_GPGME(1.2.0, [ + AC_DEFINE(CRYPT_BACKEND_GPGME, 1, [GPGME support]) + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt_gpgme.o \ + crypt_mod_pgp_gpgme.o crypt_mod_smime_gpgme.o" + ], [gpgme_found=no]) + ], [gpgme_found=no]) +]) +AS_IF([test x$use_gpgme = xyes && test x$gpgme_found = xno], [ + AC_MSG_ERROR([GPGME not found]) ]) dnl --enable-pgp diff --git a/crypt_gpgme.c b/crypt_gpgme.c index 2d0cee129..c0bd8379b 100644 --- a/crypt_gpgme.c +++ b/crypt_gpgme.c @@ -1214,8 +1214,6 @@ static int show_sig_summary(unsigned long sum, gpgme_ctx_t ctx, gpgme_key_t key, state_puts("\n", s); } -#ifdef HAVE_GPGME_PKA_TRUST - if (option(OPTCRYPTUSEPKA)) { if (sig->pka_trust == 1 && sig->pka_address) @@ -1234,8 +1232,6 @@ static int show_sig_summary(unsigned long sum, gpgme_ctx_t ctx, gpgme_key_t key, } } -#endif - return severe; } @@ -4471,7 +4467,6 @@ char *smime_gpgme_findkeys(ADDRESS *adrlist, int oppenc_mode) return find_keys(adrlist, APPLICATION_SMIME, oppenc_mode); } -#ifdef HAVE_GPGME_OP_EXPORT_KEYS BODY *pgp_gpgme_make_key_attachment(char *tempf) { crypt_key_t *key = NULL; @@ -4531,7 +4526,6 @@ bail: return att; } -#endif /* * Implementation of `init'. diff --git a/crypt_mod_pgp_gpgme.c b/crypt_mod_pgp_gpgme.c index 732349c76..aace2e303 100644 --- a/crypt_mod_pgp_gpgme.c +++ b/crypt_mod_pgp_gpgme.c @@ -89,12 +89,10 @@ static BODY *crypt_mod_pgp_encrypt_message(BODY *a, char *keylist, int sign) return pgp_gpgme_encrypt_message(a, keylist, sign); } -#ifdef HAVE_GPGME_OP_EXPORT_KEYS static BODY *crypt_mod_pgp_make_key_attachment(char *tempf) { return pgp_gpgme_make_key_attachment(tempf); } -#endif static void crypt_mod_pgp_set_sender(const char *sender) { @@ -112,11 +110,7 @@ struct crypt_module_specs crypt_mod_pgp_gpgme = { /* PGP specific. */ crypt_mod_pgp_encrypt_message, -#ifdef HAVE_GPGME_OP_EXPORT_KEYS crypt_mod_pgp_make_key_attachment, -#else - NULL, -#endif crypt_mod_pgp_check_traditional, NULL, /* pgp_traditional_encryptsign */ NULL, /* pgp_invoke_getkeys */ crypt_mod_pgp_invoke_import, NULL, /* pgp_extract_keys_from_attachment_list */