From 46fd481b5a1cb7746e9d5c5d16695a6fb7f1de76 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 30 Jun 2014 17:27:10 +0100 Subject: [PATCH] nice: Auto-substitute pkg-config requirements in nice.pc.in The requirements in the pkg-config file were outdated and incomplete. It makes a lot more sense to automatically substitute them in from the checks in configure.ac. --- configure.ac | 29 ++++++++++++++++++++++------- nice/nice.pc.in | 9 ++++----- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 91210a2..b915249 100644 --- a/configure.ac +++ b/configure.ac @@ -181,12 +181,15 @@ AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""]) AC_CHECK_FUNCS([poll]) AC_SUBST(LIBRT) -PKG_CHECK_MODULES(GLIB, [dnl - glib-2.0 >= $GLIB_REQ dnl - gobject-2.0 >= $GLIB_REQ dnl - gthread-2.0 >= $GLIB_REQ dnl - gio-2.0 >= $GLIB_REQ dnl - ]) +# Dependencies +NICE_PACKAGES_PUBLIC="glib-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ" +NICE_PACKAGES_PRIVATE="gthread-2.0" +NICE_PACKAGES="$NICE_PACKAGES_PUBLIC $NICE_PACKAGES_PRIVATE" +AC_SUBST([NICE_PACKAGES_PUBLIC]) +AC_SUBST([NICE_PACKAGES_PRIVATE]) +AC_SUBST([NICE_PACKAGES]) + +PKG_CHECK_MODULES(GLIB, [$NICE_PACKAGES]) AC_ARG_WITH(gstreamer, AS_HELP_STRING([--with-gstreamer],[build GStreamer plugin]), @@ -255,9 +258,13 @@ AC_ARG_ENABLE([gupnp], esac], WANT_GUPNP=test) +GUPNP_PACKAGES_PUBLIC="" +GUPNP_PACKAGES_PRIVATE="gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" +GUPNP_PACKAGES="$GUPNP_PACKAGES_PUBLIC $GUPNP_PACKAGES_PRIVATE" + HAVE_GUPNP=no if test "x$WANT_GUPNP" != "xno"; then - PKG_CHECK_MODULES(GUPNP, gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED, + PKG_CHECK_MODULES(GUPNP, [$GUPNP_PACKAGES], [ HAVE_GUPNP=yes ], [ HAVE_GUPNP=no ]) fi @@ -267,8 +274,16 @@ fi if test "x$HAVE_GUPNP" = "xyes"; then AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library]) +else + GUPNP_PACKAGES_PUBLIC="" + GUPNP_PACKAGES_PRIVATE="" + GUPNP_PACKAGES="" fi +AC_SUBST([GUPNP_PACKAGES_PUBLIC]) +AC_SUBST([GUPNP_PACKAGES_PRIVATE]) +AC_SUBST([GUPNP_PACKAGES]) + AC_SUBST(HAVE_GUPNP) dnl Test coverage diff --git a/nice/nice.pc.in b/nice/nice.pc.in index f0000fa..edc01f5 100644 --- a/nice/nice.pc.in +++ b/nice/nice.pc.in @@ -5,9 +5,8 @@ includedir=@includedir@ Name: libnice Description: ICE library -Requires: glib-2.0 >= 2.10.0 Version: @VERSION@ -Libs: -L${libdir} -lnice @GLIB_LIBS@ -Libs.private: @GUPNP_LIBS@ -Cflags: @GLIB_CFLAGS@ -I${includedir} -I${includedir}/nice - +Requires: @NICE_PACKAGES_PUBLIC@ @GUPNP_PACKAGES_PUBLIC@ +Requires.private: @NICE_PACKAGES_PRIVATE@ @GUPNP_PACKAGES_PRIVATE@ +Libs: -L${libdir} -lnice +Cflags: -I${includedir}/nice -- 2.7.4