For further simplifying virt-p2v's GTK API usage, require the GLIB2 and
GTK3 versions that RHEL7 provides.
The MIN_REQUIRED=<version> macros elicit warnings if we use an API that
was already deprecated in said version of the given library.
The MAX_ALLOWED=<version> macros make sure we don't unwittingly use an API
that was introduced after our required minimum version.
(GDK is a layer below GTK, so using the GDK_VERSION_* macros ensures both
GDK and GTK API compatibility.)
Suggested-by: Richard W.M. Jones <rjones(a)redhat.com>
Suggested-by: Daniel P. Berrangé <berrange(a)redhat.com>
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
Makefile.am | 4 ++++
docs/p2v-building.pod | 6 +++++-
m4/p2v-libraries.m4 | 5 +++--
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index eaa98270fd9a..02ff1bb2eebd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -120,28 +120,32 @@ virt_p2v_SOURCES = \
utils.c
generated_sources = \
config.c \
kernel-config.c \
p2v-config.h
nodist_virt_p2v_SOURCES = \
$(generated_sources) \
about-authors.c
virt_p2v_CPPFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DGTK_DISABLE_DEPRECATED \
+ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 \
+ -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56 \
+ -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_22 \
+ -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_22 \
-I$(srcdir)/libguestfs \
-I$(srcdir)/miniexpect \
-I$(srcdir)/gnulib/lib -Ignulib/lib
virt_p2v_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(PCRE2_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(GTK3_CFLAGS) \
$(DBUS_CFLAGS)
virt_p2v_LDADD = \
$(PCRE2_LIBS) \
diff --git a/docs/p2v-building.pod b/docs/p2v-building.pod
index e1ba4de12504..a0c16f1202a9 100644
--- a/docs/p2v-building.pod
+++ b/docs/p2v-building.pod
@@ -69,29 +69,33 @@ I<Required>.
I<Required>.
=item xz
I<Required>.
=item nbdkit
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 3
+=item Glib E<ge> 2.56
+
+I<Required>.
+
+=item Gtk E<ge> 3.22
I<Required>.
=item D-Bus
Optional.
If the D-Bus low level C API is available, virt-p2v can send a D-Bus
message to logind to inhibit power saving (sleep, suspend, etc) during
P2V conversions.
If this API is not available at build time, then very long conversions
might be interrupted if the physical machine goes to sleep.
diff --git a/m4/p2v-libraries.m4 b/m4/p2v-libraries.m4
index a00b301056d2..b8cea3603423 100644
--- a/m4/p2v-libraries.m4
+++ b/m4/p2v-libraries.m4
@@ -21,25 +21,26 @@ AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host
architecture.])
dnl Headers.
AC_CHECK_HEADERS([\
linux/rtc.h])
dnl Which header file defines major, minor, makedev.
AC_HEADER_MAJOR
dnl Check for PCRE2 (required)
PKG_CHECK_MODULES([PCRE2], [libpcre2-8])
dnl libxml2 (required)
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
-dnl Check for Gtk 3 library, used by virt-p2v (required).
-PKG_CHECK_MODULES([GTK3], [gtk+-3.0])
+dnl Check for the Glib 2 and Gtk 3 libraries, used by virt-p2v (required).
+PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.56])
+PKG_CHECK_MODULES([GTK3], [gtk+-3.0 >= 3.22])
dnl D-Bus is an optional dependency of virt-p2v.
PKG_CHECK_MODULES([DBUS], [dbus-1], [
AC_SUBST([DBUS_CFLAGS])
AC_SUBST([DBUS_LIBS])
AC_DEFINE([HAVE_DBUS],[1],[D-Bus found at compile time.])
],[
AC_MSG_WARN([D-Bus not found, virt-p2v will not be able to inhibit power saving
during P2V conversions])
])