Subject: 30.0.50; Support webkit2gtk-4.1

From: Ulrich Müller <[email-masked]>
Date: Thu, 09 Feb 2023 12:52:56 +0100

Gentoo is transitioning from webkit2gtk-4.0 to 4.1,
see downstream bug at <https://bugs.gentoo.org/893668>.

Would it be possible to support webkit2gtk-4.1? IIUC there should be
no API differences, so updating configure should be enough.

The patch below adds a configure option --with-webkit2gtk=VALUE that
allows to select version 4.0 or 4.1.

I have tested this with the tip of the master branch (as of today),
and it seems to build and work just fine with webkit2gtk-4.1.

>From c3f765e7f987f4c29aaf9df80e304ee24b69427d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <[email-masked]>
Date: Thu, 9 Feb 2023 10:58:48 +0100
Subject: [PATCH] Support webkit2gtk version 4.1

* configure.ac: Add --with-webkit2gtk=VALUE configuration option,
where VALUE can be 4.0 (default) or 4.1.
---
 configure.ac | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index fc17dbd8318..ac0ed8d5d11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -521,6 +521,18 @@ otherwise for the first of 'inotify', 'kqueue' or 'gfile' that is usable.])
 OPTION_DEFAULT_OFF([xwidgets],
   [enable use of xwidgets in Emacs buffers (requires gtk3 or macOS Cocoa)])
 
+AC_ARG_WITH([webkit2gtk],[AS_HELP_STRING([--with-webkit2gtk=VALUE],
+  [version of webkit2gtk to use (VALUE one of: 4.0, 4.1; default 4.0)])],
+  [ case "${withval}" in
+      4.0|4.1) val=$withval ;;
+      *) AC_MSG_ERROR(['--with-webkit2gtk=$withval is invalid;
+this option's value should be '4.0' or '4.1'.])
+      ;;
+    esac
+    with_webkit2gtk=$val
+  ],
+  [with_webkit2gtk=4.0])
+
 OPTION_DEFAULT_OFF([be-app],
   [enable use of Haiku's Application Kit as a window system])
 
@@ -3583,7 +3595,7 @@ XWIDGETS_OBJ=
 if test "$with_xwidgets" != "no"; then
   if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
     WEBKIT_REQUIRED=2.12
-    WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
+    WEBKIT_MODULES="webkit2gtk-$with_webkit2gtk >= $WEBKIT_REQUIRED"
     EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
     HAVE_XWIDGETS=$HAVE_WEBKIT
     XWIDGETS_OBJ="xwidget.o"
-- 
2.39.1