After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636593 - pkg-config abuse
pkg-config abuse
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: shell
git master
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-12-06 13:36 UTC by Owen Taylor
Modified: 2011-02-19 17:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Owen Taylor 2010-12-06 13:36:19 UTC
One of the main points of pkg-config is that it can remove duplicated CFLAGS and LIBS. To make this work, you should group your PKG_CHECK_MODULES() by how they are *used* not by what you are checking for.

COMMON_MODULES="gtk+-3.0 >= $GTK_REQUIRED_VERSION
 glib-2.0 >= $GLIB_REQUIRED_VERSION
 gthread-2.0
 gio-2.0
 gconf-2.0
 libxml-2.0
 gsettings-desktop-schemas >= $DESKTOP_SCHEMAS_REQUIRED_VERSION"

OK, that's look promoising.

PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(GNOMECC_SHELL, $COMMON_MODULES libgnome-menu gio-unix-2.0)

So far so good.

PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0)
PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
PKG_CHECK_MODULES(GSD_DBUS, gnome-settings-daemon)
PKG_CHECK_MODULES(GIO, gio-2.0 gio-unix-2.0)
PKG_CHECK_MODULES(XML, libxml-2.0)
PKG_CHECK_MODULES(UPOWER, upower-glib >= 0.9.1)

Wait, what?

PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION)
AC_SUBST(CANBERRA_CFLAGS)
AC_SUBST(CANBERRA_LIBS)
PKG_CHECK_MODULES(PULSEAUDIO,
          libpulse >= $PA_REQUIRED_VERSION
          libpulse-mainloop-glib >= $PA_REQUIRED_VERSION)
AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS)

And now we have useless AC_SUBSTS in addition.
Comment 1 Thomas Wood 2011-02-18 11:53:23 UTC
Unnecessary AC_SUBST macros removed in commit 65057f5.
Comment 2 Thomas Wood 2011-02-19 17:04:04 UTC
pkg-config checks are now grouped by how they are used in commit e2f944a.