Attempts to cross compile gnupg-2.2.6 on an x86_64 build machine for ARM fail because the configure script fails to find the correct versions of the following library config programs:
- gpg-error-config
- ksba-config
- libassuan-config
- libgcrypt-config
- npth-config
For gpg-error-config and libgcrypt-config, those .m4 files actually support looking in ${SYSROOT} for a cross-compile. The same bug exists for pinentry. They just look in ${SYSROOT}/bin instead of ${SYSROOT}/usr/bin where the programs actually are. For the other 3 cases, the .m4 files don´t support looking in ${SYSROOT} at all.
Since all 5 of those .m4 files are basically the same code, I was able to patch the other 3 .m4 files using gpg-error-config.m4 as a model.
The Gentoo bug report describing the problem in detail also has patches attached for all 5 files. And I was able to get a successful build with all 5 patches.