]> granicus.if.org Git - neomutt/commitdiff
Fix and simplify handling of GPGME in configure.ac (#545)
authorPietro Cerutti <gahr@gahr.ch>
Mon, 24 Apr 2017 15:57:15 +0000 (16:57 +0100)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2017 15:57:15 +0000 (16:57 +0100)
* 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

configure.ac
crypt_gpgme.c
crypt_mod_pgp_gpgme.c

index 74399bfe2fbe189e23e453bf7cac9b04b7ffad09..865ad11ecf8e24cc171154ae2dda8904809d7c2f 100644 (file)
@@ -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
index 2d0cee129a36cc9927d279367ccdb8955599026a..c0bd8379bd50651fd3a9517928f477f320260ea0 100644 (file)
@@ -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'.
index 732349c76943629ec4b26be66eed334469b49559..aace2e303d65c672f569687ef2a59bf3e8e9e41a 100644 (file)
@@ -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  */