X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=configure;h=1e7b9f7a47e1a2efc40e6dc1d8f513bb0a73a672;hp=9140026a71f0873e78be32b1c27eee699e66180f;hb=b23902a61158ecdbca2d9d96c6eaf509d6e3d205;hpb=c7bb4c77417371587aea0d62b7397d5a38fed5ed diff --git a/configure b/configure index 9140026a..1e7b9f7a 100755 --- a/configure +++ b/configure @@ -497,6 +497,68 @@ if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then have_gmime=1 gmime_cflags=$(pkg-config --cflags gmime-3.0) gmime_ldflags=$(pkg-config --libs gmime-3.0) + + printf "Checking for GMime session key extraction support... " + + cat > _check_session_keys.c < +#include + +int main () { + GError *error = NULL; + GMimeParser *parser = NULL; + GMimeMultipartEncrypted *body = NULL; + GMimeDecryptResult *decrypt_result = NULL; + GMimeObject *output = NULL; + + g_mime_init (); + parser = g_mime_parser_new (); + g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("test/corpora/crypto/basic-encrypted.eml", "r", &error)); + if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n"); + + body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); + if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n"); + + output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error); + if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n"); + + if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n"); + if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n"); + + printf ("%s\n", decrypt_result->session_key); + return 0; +} +EOF + if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then + printf 'No.\nCould not make tempdir for testing session-key support.\n' + errors=$((errors + 1)) + elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \ + && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < test/gnupg-secret-key.asc \ + && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \ + && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ] + then + printf "OK.\n" + else + cat </dev/null; then + printf 'Your current GPGME development version is: %s\n' "$(gpgme-config --version)" + else + printf 'You do not have the GPGME development libraries installed.\n' + fi + errors=$((errors + 1)) + fi + if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then + rm -rf "$TEMP_GPG" + fi else have_gmime=0 printf "No.\n" @@ -615,13 +677,14 @@ if [ -z "${EMACSETCDIR-}" ]; then EMACSETCDIR="\$(prefix)/share/emacs/site-lisp" fi -printf "Checking if emacs (>= 24) is available... " -if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 1))' > /dev/null 2>&1; then - printf "Yes.\n" - have_emacs=1 -else - printf "No (so will not byte-compile emacs code)\n" - have_emacs=0 +if [ $WITH_EMACS = "1" ]; then + printf "Checking if emacs (>= 24) is available... " + if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 1))' > /dev/null 2>&1; then + printf "Yes.\n" + else + printf "No (disabling emacs related parts of build)\n" + WITH_EMACS=0 + fi fi have_doxygen=0 @@ -969,7 +1032,7 @@ for flag in -Wmissing-declarations; do done printf "\n\t%s\n" "${WARN_CFLAGS}" -rm -f minimal minimal.c _libversion.c _libversion _libversion.sh +rm -f minimal minimal.c _libversion.c _libversion _libversion.sh _check_session_keys.c _check_session_keys # construct the Makefile.config cat > Makefile.config <