$NetBSD: patch-configure,v 1.6 2021/11/01 14:17:32 ryoon Exp $

* Select GnuPG binary
* Don't let CDPATH affect the build
* Ignore errors for gpgme tests, can be affected by running gpg-agent

--- configure.orig	2021-10-20 14:25:35.000000000 +0000
+++ configure
@@ -499,7 +499,7 @@ EOF
 	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 < "$srcdir"/test/gnupg-secret-key.asc \
+	   && GNUPGHOME=${TEMP_GPG} @GPGME_GPG@ --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
 	   && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
 	   && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
     then
@@ -591,7 +591,6 @@ is later than 3.2.7, which should have f
 Please follow up on https://github.com/jstedfast/gmime/pull/90 with
 more details.
 EOF
-		errors=$((errors + 1))
 	    fi
 	fi
     else
@@ -650,7 +649,7 @@ EOF
 	printf 'No.\nCould not make tempdir for testing signature verification when decrypting with session keys.\n'
 	errors=$((errors + 1))
     elif ${CC} ${CFLAGS} ${gmime_cflags} _verify_sig_with_session_key.c ${gmime_ldflags} -o _verify_sig_with_session_key \
-	    && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
+	    && GNUPGHOME=${TEMP_GPG} @GPGME_GPG@ --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
 	    && rm -f ${TEMP_GPG}/private-keys-v1.d/*.key
     then
 	if GNUPGHOME=${TEMP_GPG} ./_verify_sig_with_session_key; then
@@ -1576,7 +1575,7 @@ EOF
     if [ $WITH_PYTHON_DOCS = "1" ]; then
 	echo "tags.add('WITH_PYTHON')"
     fi
-    printf "rsti_dir = '%s'\n" "$(cd emacs && pwd -P)"
+    printf "rsti_dir = '%s'\n" "$(unset CDPATH && cd emacs && pwd -P)"
 } > sphinx.config
 
 # Finally, after everything configured, inform the user how to continue.
