nice: Auto-substitute pkg-config requirements in nice.pc.in
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 30 Jun 2014 16:27:10 +0000 (17:27 +0100)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Mon, 7 Jul 2014 19:47:02 +0000 (15:47 -0400)
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
nice/nice.pc.in

index 91210a2..b915249 100644 (file)
@@ -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
index f0000fa..edc01f5 100644 (file)
@@ -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