[Libguestfs] [p2v PATCH 3/7] require GTK3

Laszlo Ersek
2022-09-26T08:18:08Z

Virt-p2v now requires PCRE2, so we can no longer compile virt-p2v on
RHEL<=6.  This means we can now also require GTK3.  In this patch, remove
the ./configure knob for GTK version selection, remove the auto-detection,
open-code the dependency, and update the build docs.

Note that the autoconf module name is changed from GTK to GTK3 as well
(for prior art, see commit fb42310a8d0c, "miniexpect: Import miniexpect
1.1 and upgrade to PCRE2", 2022-07-25); this results in ./configure taking
GTK3_CFLAGS and GTK3_LIBS.

Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 Makefile.am           |  6 ++--
 dependencies.m4       | 10 +++---
 docs/p2v-building.pod | 11 +------
 m4/p2v-libraries.m4   | 32 ++------------------
 4 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d659ce65c06d..126ee726278a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -141,13 +141,13 @@ virt_p2v_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(PCRE2_CFLAGS) \
 	$(LIBXML2_CFLAGS) \
-	$(GTK_CFLAGS) \
+	$(GTK3_CFLAGS) \
 	$(DBUS_CFLAGS)

 virt_p2v_LDADD = \
 	$(PCRE2_LIBS) \
 	$(LIBXML2_LIBS) \
-	$(GTK_LIBS) \
+	$(GTK3_LIBS) \
 	$(DBUS_LIBS) \
 	gnulib/lib/libgnu.la \
 	-lm
@@ -169,7 +169,7 @@ dependencies_files = \

 $(dependencies_files): dependencies.m4 config.status
 	define=`echo $@ | $(SED)
's/dependencies.//;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`;
\
-	m4 -D$$define=1 -DGTK_VERSION=$(GTK_VERSION) $< > $@-t
+	m4 -D$$define=1 $< > $@-t
 	mv $@-t $@

 # Support files needed by the virt-p2v-make-* scripts.
diff --git a/dependencies.m4 b/dependencies.m4
index 7bbeb37d5412..b6d7db37287b 100644
--- a/dependencies.m4
+++ b/dependencies.m4
@@ -24,7 +24,7 @@ ifelse(REDHAT,1,
   dnl Used by the virt-p2v binary.
   pcre2
   libxml2
-  gtk`'GTK_VERSION
+  gtk3
   dbus-libs

   dnl Run as external programs by the p2v binary.
@@ -68,7 +68,7 @@ ifelse(REDHAT,1,
 ifelse(DEBIAN,1,
   libpcre2-8-0
   libxml2
-
ifelse(GTK_VERSION,2,libgtk`'GTK_VERSION`'.0-0,libgtk-`'GTK_VERSION`'-0)
+  libgtk-3-0
   libdbus-1-3
   openssh-client
   nbdkit
@@ -88,7 +88,7 @@ ifelse(DEBIAN,1,
 ifelse(ARCHLINUX,1,
   pcre2
   libxml2
-  gtk`'GTK_VERSION
+  gtk3
   dbus
   openssh
   nbdkit
@@ -110,7 +110,7 @@ ifelse(ARCHLINUX,1,
 ifelse(SUSE,1,
   pcre2
   libxml2
-  gtk`'GTK_VERSION
+  gtk3
   libdbus-1-3
   nbdkit-server
   nbdkit-file-plugin
@@ -135,7 +135,7 @@ ifelse(OPENMANDRIVA,1,
   dnl Used by the virt-p2v binary.
   pcre2
   libxml2
-  gtk`'GTK_VERSION
+  gtk3
   dbus-libs

   dnl Run as external programs by the p2v binary.
diff --git a/docs/p2v-building.pod b/docs/p2v-building.pod
index cb418049fd51..e1ba4de12504 100644
--- a/docs/p2v-building.pod
+++ b/docs/p2v-building.pod
@@ -80,14 +80,10 @@ Optional.
 L<virt-p2v(1)> requires nbdkit, but it only needs to be present on the
 virt-p2v ISO, it does not need to be installed at compile time.

-=item Gtk E<ge> 2.24, or 3
+=item Gtk 3

 I<Required>.

-Either Gtk 2 or Gtk 3 can be used.  If you want to select a specific
-version of Gtk, use S<C<./configure --with-gtk=2>> or
-S<C<./configure --with-gtk=3>>.
-
 =item D-Bus

 Optional.
@@ -201,11 +197,6 @@ by users.
 For custom and/or local builds, this can be set to C<local> to
 indicate this is I<not> a distro build.

-=item B<--with-gtk=3>
-
-This option forces virt-p2v to be built against Gtk 3, which is
-currently the most widely tested configuration.
-
 =back

 =head1 USING CLANG (LLVM) INSTEAD OF GCC
diff --git a/m4/p2v-libraries.m4 b/m4/p2v-libraries.m4
index 8604baaf8d83..a00b301056d2 100644
--- a/m4/p2v-libraries.m4
+++ b/m4/p2v-libraries.m4
@@ -32,36 +32,8 @@ PKG_CHECK_MODULES([PCRE2], [libpcre2-8])
 dnl libxml2 (required)
 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])

-dnl Check for Gtk 2 or 3 library, used by virt-p2v.
-AC_MSG_CHECKING([for --with-gtk option])
-AC_ARG_WITH([gtk],
-    [AS_HELP_STRING([--with-gtk=2|3|check|no],
-        [prefer Gtk version 2 or 3. @<:@default=check@:>@])],
-    [with_gtk="$withval"
-     AC_MSG_RESULT([$withval])],
-    [with_gtk="check"
-     AC_MSG_RESULT([not set, will check for installed Gtk])]
-)
-
-if test "x$with_gtk" = "x3"; then
-    PKG_CHECK_MODULES([GTK], [gtk+-3.0], [
-        GTK_VERSION=3
-    ])
-elif test "x$with_gtk" = "x2"; then
-    PKG_CHECK_MODULES([GTK], [gtk+-2.0], [
-        GTK_VERSION=2
-    ], [])
-elif test "x$with_gtk" = "xcheck"; then
-    PKG_CHECK_MODULES([GTK], [gtk+-3.0], [
-        GTK_VERSION=3
-    ], [
-        PKG_CHECK_MODULES([GTK], [gtk+-2.0], [
-            GTK_VERSION=2
-        ])
-    ])
-fi
-
-AC_SUBST([GTK_VERSION])
+dnl Check for Gtk 3 library, used by virt-p2v (required).
+PKG_CHECK_MODULES([GTK3], [gtk+-3.0])

 dnl D-Bus is an optional dependency of virt-p2v.
 PKG_CHECK_MODULES([DBUS], [dbus-1], [