X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=configure;h=8b80f0e0890ff54ee0f80b136af601d09bab9a0e;hp=5e7e5aa9478e8ee2c844f727dce17dfd3b3d1a64;hb=575493e78534f8fd241d663b8690a22d6885e0b1;hpb=5569e042315862bdedb341472160cd09f4a0a2f7 diff --git a/configure b/configure index 5e7e5aa9..8b80f0e0 100755 --- a/configure +++ b/configure @@ -489,33 +489,78 @@ EOF rm -rf test.db _default_backend _default_backend.cc fi -# we need to have a version >= 2.6.5 to avoid a crypto bug. We need -# 2.6.7 for permissive "From " header handling. -GMIME_MINVER=2.6.7 -GMIME3_MINVER=3.0.3 +GMIME_MINVER=3.0.3 printf "Checking for GMime development files... " -if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then - printf "Yes (3.0).\n" +if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then + printf "Yes.\n" have_gmime=1 gmime_cflags=$(pkg-config --cflags gmime-3.0) gmime_ldflags=$(pkg-config --libs gmime-3.0) - gmime_major=3 - have_gmime_session_keys=1 -elif pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then - printf "Yes (2.6).\n" - have_gmime=1 - gmime_cflags=$(pkg-config --cflags gmime-2.6) - gmime_ldflags=$(pkg-config --libs gmime-2.6) - gmime_major=2 - if pkg-config --exists "gmime-2.6 >= 2.6.21"; then - have_gmime_session_keys=1 + + 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); 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 - have_gmime_session_keys=0 + 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 - have_gmime_session_keys=0 printf "No.\n" errors=$((errors + 1)) fi @@ -788,7 +833,7 @@ EOF echo fi if [ $have_gmime -eq 0 ]; then - echo " GMime 2.6 library >= $GMIME_MINVER" + echo " GMime library >= $GMIME_MINVER" echo " (including development files such as headers)" echo " https://github.com/jstedfast/gmime/" echo @@ -810,7 +855,7 @@ case a simple command will install everything you need. For example: On Debian and similar systems: - sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev zlib1g-dev + sudo apt-get install libxapian-dev libgmime-3.0-dev libtalloc-dev zlib1g-dev Or on Fedora and similar systems: @@ -986,7 +1031,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 <