[Libosinfo] [PATCH v3 4/5] Use GLIB_VERSION_MAX_ALLOWED

Fabiano Fidêncio fidencio at redhat.com
Mon Jan 11 13:19:54 UTC 2016


In order to avoid using a too new GLib API.
---
 configure.ac       | 14 ++++++++++++--
 osinfo/Makefile.am |  2 ++
 test/Makefile.am   |  2 ++
 tools/Makefile.am  |  5 +++++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5c38b96..403b4e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,12 +36,22 @@ m4_if(m4_version_compare([2.61a.100],
 # Use the silent-rules feature when possible.
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
-PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
-PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36])
+# Keep these two definitions in agreement.
+GLIB_MINIMUM_VERSION="2.36"
+GLIB_ENCODED_VERSION="GLIB_VERSION_2_36"
+
+PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= $GLIB_MINIMUM_VERSION])
+PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_MINIMUM_VERSION])
 PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42])
 PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0])
 PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0])
 
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_MINIMUM_VERSION])
+GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_ENCODED_VERSION"
+GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_ENCODED_VERSION"
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+
 GTK_DOC_CHECK([1.10],[--flavour no-tmpl])
 
 AC_ARG_ENABLE([tests],
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 8f5685c..e8cec0e 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -33,6 +33,7 @@ libosinfo_1_0_la_CFLAGS = \
 	$(LIBXML_CFLAGS) \
 	$(LIBXSLT_CFLAGS) \
 	$(GOBJECT_CFLAGS) \
+	$(GLIB_CFLAGS) \
 	$(GIO_CFLAGS) \
 	-DPKG_DATA_DIR='"$(pkgdatadir)"' \
 	-DSYS_CONF_DIR='"$(sysconfdir)"' \
@@ -43,6 +44,7 @@ libosinfo_1_0_la_LIBADD = \
 	$(LIBXML_LIBS) \
 	$(LIBXSLT_LIBS) \
 	$(GOBJECT_LIBS) \
+	$(GLIB_LIBS) \
 	$(GIO_LIBS)
 
 libosinfo_1_0_la_LDFLAGS = \
diff --git a/test/Makefile.am b/test/Makefile.am
index ef63154..d6504fd 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -23,6 +23,7 @@ check_PROGRAMS = \
 
 COMMON_LDADD = \
 	$(COVERAGE_LDFLAGS) \
+	$(GLIB_LIBS) \
 	$(GOBJECT_LIBS) \
 	$(SOUP_LIBS) \
 	$(CHECK_LIBS) \
@@ -30,6 +31,7 @@ COMMON_LDADD = \
 COMMON_CFLAGS = \
 	$(WARN_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
+	$(GLIB_CFLAGS) \
 	$(GOBJECT_CFLAGS) \
 	$(SOUP_CFLAGS) \
 	-I$(top_srcdir) \
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a064dce..7f7249f 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = $(GOBJECT_CFLAGS) \
 	    $(GIO_CFLAGS)     \
+	    $(GLIB_CFLAGS)    \
 	    $(LIBXML_CFLAGS)  \
 	    -DPKGDATADIR="\"$(pkgdatadir)\"" \
 	    -DLOCALEDIR="\"$(datadir)/locale\"" \
@@ -21,22 +22,26 @@ POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
 osinfo_detect_SOURCES = osinfo-detect.c
 osinfo_detect_LDADD = $(GOBJECT_LIBS)		\
 		      $(GIO_LIBS)		\
+		      $(GLIB_LIBS)		\
 		      $(LIBXML_LIBS)		\
 		      $(top_builddir)/osinfo/libosinfo-1.0.la
 
 osinfo_db_validate_SOURCES = osinfo-db-validate.c
 osinfo_db_validate_LDADD = $(GOBJECT_LIBS)	\
 		      $(GIO_LIBS)		\
+		      $(GLIB_LIBS)		\
 		      $(LIBXML_LIBS)		\
 		      $(top_builddir)/osinfo/libosinfo-1.0.la
 
 osinfo_query_SOURCES = osinfo-query.c
 osinfo_query_LDADD = $(GOBJECT_LIBS)		\
 		      $(GIO_LIBS)		\
+		      $(GLIB_LIBS)		\
 		      $(top_builddir)/osinfo/libosinfo-1.0.la
 
 osinfo_install_script_SOURCES = osinfo-install-script.c
 osinfo_install_script_LDADD = $(GOBJECT_LIBS)	\
 		      $(GIO_LIBS)		\
+		      $(GLIB_LIBS)		\
 		      $(LIBXML_LIBS)		\
 		      $(top_builddir)/osinfo/libosinfo-1.0.la
-- 
2.5.0




More information about the Libosinfo mailing list