From f1dd7d6076645b066df216ebd8d37acbaaa20096 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 10 Nov 2022 12:10:52 +0000 Subject: [PATCH] build: Accept gpgme >= 1.8.0 as equivalent to gpgme-pthread Before 1.8.0 (2016), gpgme used to have two different thread-safe builds, one for use with POSIX-style pthread and one for use with GNU Portable Threads (libpth), plus a non-thread-safe version. Since 1.8.0, this complexity has gone away and there is only libgpgme, which is thread-safe. In practice this meant that on modern distros since 2016, we would always fail to detect gpgme via pkg-config and fall back to calling gpgme-config. Library-specific -config scripts are generally considered problematic for multiarch, multilib and cross-compiling, and the gpgme-config script recently disappeared from GPGME's Debian packaging (see https://bugs.debian.org/1022348 and https://bugs.debian.org/1023601), so it's better if we can prefer to use pkg-config. If gpgme >= 1.8.0 is not found, fall back to gpgme-pthread >= 1.1.8, either discovered via pkg-config or via gpgme-config. Signed-off-by: Simon McVittie (cherry picked from commit 9b87e4c0d4557f7ece3fedad699954a10663e41d) (cherry picked from commit c8f3f0dc1a72d03d01117814f6fc40063e1490c6) --- Makefile.am | 4 ++-- configure.ac | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3e8a93c1b..3500e2177 100644 --- a/Makefile.am +++ b/Makefile.am @@ -84,8 +84,8 @@ dist_triggers_SCRIPTS = \ $(NULL) # This canonicalizes the PKG_CHECK_MODULES or AM_PATH_GPGME results -INTERNAL_GPGME_CFLAGS = $(DEP_GPGME_CFLAGS) $(GPGME_PTHREAD_CFLAGS) -INTERNAL_GPGME_LIBS = $(DEP_GPGME_LIBS) $(GPGME_PTHREAD_LIBS) +INTERNAL_GPGME_CFLAGS = $(DEP_GPGME_CFLAGS) $(DEP_GPGME_PTHREAD_CFLAGS) $(GPGME_PTHREAD_CFLAGS) +INTERNAL_GPGME_LIBS = $(DEP_GPGME_LIBS) $(DEP_GPGME_PTHREAD_LIBS) $(GPGME_PTHREAD_LIBS) lib_LTLIBRARIES = noinst_LTLIBRARIES += libglnx.la diff --git a/configure.ac b/configure.ac index 84247986c..7ad47fa08 100644 --- a/configure.ac +++ b/configure.ac @@ -260,10 +260,16 @@ AC_CHECK_FUNCS(archive_read_support_filter_all) LIBS=$save_LIBS LIBGPGME_DEPENDENCY="1.1.8" -PKG_CHECK_MODULES(DEP_GPGME, gpgme-pthread >= $LIBGPGME_DEPENDENCY, have_gpgme=yes, [ - m4_ifdef([AM_PATH_GPGME_PTHREAD], [ - AM_PATH_GPGME_PTHREAD($LIBGPGME_DEPENDENCY, have_gpgme=yes, have_gpgme=no) - ],[ have_gpgme=no ]) +PKG_CHECK_MODULES([DEP_GPGME], [gpgme >= 1.8.0], [have_gpgme=yes], [ + PKG_CHECK_MODULES([DEP_GPGME_PTHREAD], [gpgme-pthread >= $LIBGPGME_DEPENDENCY], [ + have_gpgme=yes + ], [ + m4_ifdef([AM_PATH_GPGME_PTHREAD], [ + AM_PATH_GPGME_PTHREAD([$LIBGPGME_DEPENDENCY], [have_gpgme=yes], [have_gpgme=no]) + ], [ + have_gpgme=no + ]) + ]) ]) AS_IF([ test x$have_gpgme = xno ], [ AC_MSG_ERROR([Need GPGME_PTHREAD version $LIBGPGME_DEPENDENCY or later])