[gjs] build: Switch to using AX_PKG_CHECK_MODULES



commit f0bbf8fbb58f32ec3003e354d79fef441a1478fe
Author: Philip Chimento <philip endlessm com>
Date:   Tue Oct 4 19:48:04 2016 -0700

    build: Switch to using AX_PKG_CHECK_MODULES
    
    This macro can automatically collect Requires and Requires.private for
    pkg-config files. Now that we only have one pkg-config file, it's simple
    to switch to it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772386

 Makefile.am   |    5 +++--
 configure.ac  |   16 +++++++++-------
 gjs-1.0.pc.in |    4 ++--
 3 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6da3e00..d5dc6d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -220,9 +220,10 @@ bin_PROGRAMS += gjs-console
 
 gjs_console_CPPFLAGS =                 \
        $(AM_CPPFLAGS)          \
-       $(GOBJECT_CFLAGS)
+       $(GJS_CONSOLE_CFLAGS)   \
+       $(NULL)
 gjs_console_LDADD =            \
-       $(GOBJECT_LIBS)         \
+       $(GJS_CONSOLE_LIBS)     \
        libgjs.la
 gjs_console_LDFLAGS = -rdynamic
 gjs_console_SOURCES = gjs/console.cpp
diff --git a/configure.ac b/configure.ac
index ada7687..be70e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,30 +53,32 @@ m4_define(glib_required_version, 2.50.0)
 
 GOBJECT_INTROSPECTION_REQUIRE([1.41.4])
 
-common_packages="gmodule-2.0 gthread-2.0 gio-2.0 >= glib_required_version mozjs-24"
+GOBJECT_REQUIREMENT="gobject-2.0 >= glib_required_version"
+common_packages="gthread-2.0 gio-2.0 >= glib_required_version mozjs-24"
 gjs_packages="gobject-introspection-1.0 libffi $common_packages"
 gjs_cairo_packages="cairo cairo-gobject $common_packages"
-gjs_gdbus_packages="gobject-2.0 >= glib_required_version gio-2.0"
+gjs_gdbus_packages="$GOBJECT_REQUIREMENT gio-2.0"
 gjs_gtk_packages="gtk+-3.0 >= 3.20"
 # gjs-tests links against everything
 gjstests_packages="gio-unix-2.0 $gjs_packages"
 
-PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= glib_required_version])
-PKG_CHECK_MODULES([GJS], [$gjs_packages])
+AX_PKG_CHECK_MODULES([GJS], [$GOBJECT_REQUIREMENT], [$gjs_packages])
+dnl These don't need to be put in the .pc file so use regular PKG_CHECK_MODULES
 PKG_CHECK_MODULES([GJS_GDBUS], [$gjs_gdbus_packages])
+PKG_CHECK_MODULES([GJS_CONSOLE], [$GOBJECT_REQUIREMENT])
 PKG_CHECK_MODULES([GJSTESTS], [$gjstests_packages])
 
 # Optional cairo dep (enabled by default)
 AC_ARG_WITH(cairo,
   [AS_HELP_STRING([--without-cairo], [Don't build cairo module])])
 AS_IF([test "x$with_cairo" != "xno"],
-  [PKG_CHECK_MODULES([GJS_CAIRO], [$gjs_cairo_packages],
+  [AX_PKG_CHECK_MODULES([GJS_CAIRO], [], [$gjs_cairo_packages],
     [have_cairo=yes], [have_cairo=no])],
   [have_cairo=no])
 AM_CONDITIONAL(ENABLE_CAIRO, test x$have_cairo = xyes)
 AS_IF([test x$have_cairo = xyes], [
   AC_DEFINE([ENABLE_CAIRO],[1],[Define if you want to build with cairo support])
-  PKG_CHECK_MODULES([GJS_CAIRO_XLIB], [cairo-xlib], [],
+  AX_PKG_CHECK_MODULES([GJS_CAIRO_XLIB], [], [cairo-xlib], [],
     [AC_MSG_WARN([Cairo-xlib support not found])])
 ], [AS_IF([test "x$with_cairo" = "xyes"],
   [AC_MSG_ERROR([Cairo requested but not found])])])
@@ -85,7 +87,7 @@ AS_IF([test x$have_cairo = xyes], [
 AC_ARG_WITH(gtk,
   [AS_HELP_STRING([--without-gtk], [Don't build GTK-related code])])
 AS_IF([test "x$with_gtk" != "xno"],
-  [PKG_CHECK_MODULES([GJS_GTK], [$gjs_gtk_packages],
+  [AX_PKG_CHECK_MODULES([GJS_GTK], [], [$gjs_gtk_packages],
     [have_gtk=yes], [have_gtk=no])],
   [have_gtk=no])
 AM_CONDITIONAL(ENABLE_GTK, test x$have_gtk = xyes)
diff --git a/gjs-1.0.pc.in b/gjs-1.0.pc.in
index 8a5d47b..1c52230 100644
--- a/gjs-1.0.pc.in
+++ b/gjs-1.0.pc.in
@@ -9,8 +9,8 @@ datadir=@datadir@
 gjs_console=${bindir}/gjs-console
 
 Cflags: -I${includedir}/gjs-1.0
-Requires: gobject-2.0
-Requires.private: gobject-introspection-1.0 mozjs-24
+Requires: @AX_PACKAGE_REQUIRES@
+Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@
 Libs: -L${libdir} -lgjs
 
 Name: gjs-1.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]