From: Werner Koch Date: Mon, 3 Dec 2018 07:41:53 +0000 (+0100) Subject: Require GPGME version 1.2.0 and drop useless HAVE macros. X-Git-Tag: 2019-10-25~461^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb025b0cfe6b99e2481556d6df157541658f4dcc;p=neomutt Require GPGME version 1.2.0 and drop useless HAVE macros. GPGME 1.2.0 was released nearly 10 years ago and thus we can really demand this version. For various reasons it would be advisable to require a decent version but that is a different thing and needs to be done in a separate patch. HAVE_GPGME_OP_EXPORT_KEYS and HAVE_GPGME_PKA_TRUST are not anymore needed because they are supported by that GPGME version. --- diff --git a/auto.def b/auto.def index ebd129bb3..3e77fefcc 100644 --- a/auto.def +++ b/auto.def @@ -154,7 +154,8 @@ if {1} { # Get the value of a macro by preprocessing a header file that defines it proc check-define-value {incfile macro} { set code "#include \"$incfile\"\n$macro" - if {[catch {exec [get-define CC] -xc - -E | tail -1 << $code} out]} { + if {[catch {exec [get-define CC] {*}[get-define CFLAGS] -xc - -E | tail -1 << $code} out]} { + user-notice $out set out "" } set out @@ -374,7 +375,24 @@ if {[get-define want-gpgme]} { gpgme.h gpgme_new gpgme]} { user-error "Unable to find GPGME" } - cc-check-functions gpgme_op_export_keys + set gpg_ver {} + foreach path [list [opt-val with-gpgme $prefix] /usr] { + set incfile [file join $path include gpgme.h] + if {![file exists $incfile]} { + continue + } + set gpg_ver [check-define-value $incfile GPGME_VERSION_NUMBER] + if {$gpg_ver eq {}} { + user-error "Unable to find GPGME version number" + } + set req_ver [format "0x%02x%02x%02x" 1 2 0] + if {$req_ver > $gpg_ver} { + user-error "Found GPGME version $gpg_ver, need $req_ver" + } + } + if {$gpg_ver eq {}} { + user-error "Unable to find GPGME" + } } define CRYPT_BACKEND_GPGME } diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index e06293e2e..081d9fa38 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -4907,7 +4907,6 @@ char *smime_gpgme_find_keys(struct Address *addrlist, bool oppenc_mode) */ struct Body *pgp_gpgme_make_key_attachment(void) { -#ifdef HAVE_GPGME_OP_EXPORT_KEYS gpgme_ctx_t context = NULL; gpgme_key_t export_keys[2]; gpgme_data_t keydata = NULL; @@ -4963,9 +4962,6 @@ bail: gpgme_release(context); return att; -#else - return NULL; -#endif } /**