[PATCH] gnome3: prefer gcr-4

Yaakov Selkowitz via Gnupg-devel <[email protected]>
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <[email protected]>
Newer distributions are now using gcr-4, while older ones will still have
gcr-3.  The APIs used by pinentry have not changed in between versions,
only the top-level header has changed.  Also, for gcr-3, only gcr-base-3
is required.

(I have attempted to sign up for a dev.gnupg.org account, but am still
awaiting verification.)

Signed-off-by: Yaakov Selkowitz <[email protected]>
---
 configure.ac             | 19 ++++++++++++++-----
 gnome3/pinentry-gnome3.c |  4 ++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index f9d090f..7dde8fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -458,15 +458,24 @@ AM_CONDITIONAL(BUILD_PINENTRY_GTK_2, test "$pinentry_gtk_2" = "yes")
 if test "$pinentry_gnome_3" != "no"; then
 	PKG_CHECK_MODULES(
 		GNOME3,
-		[gcr-3,gcr-base-3],
+		[gcr-4],
 		[
 			pinentry_gnome_3=yes
 			AC_DEFINE(GCR_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
+			AC_DEFINE(GCR_API_4, 1, [GCR API version])
 		],
-		[
-			AC_MSG_WARN([pkg-config could not find the module gcr-3,gcr-base-3])
-			pinentry_gnome_3=no
-		]
+		[PKG_CHECK_MODULES(
+			GNOME3,
+			[gcr-base-3],
+			[
+				pinentry_gnome_3=yes
+				AC_DEFINE(GCR_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
+			],
+			[
+				AC_MSG_WARN([pkg-config could not find the module gcr-4 or gcr-base-3])
+				pinentry_gnome_3=no
+			]
+		)]
 	)
 fi
 
diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c
index 8a8fbed..7f21d6f 100644
--- a/gnome3/pinentry-gnome3.c
+++ b/gnome3/pinentry-gnome3.c
@@ -23,7 +23,11 @@
 # include "config.h"
 #endif
 
+#ifdef GCR_API_4
+#include <gcr/gcr.h>
+#else
 #include <gcr/gcr-base.h>
+#endif
 
 #include <string.h>
 #include <stdlib.h>
-- 
2.44.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.