Commit 1977fb6c authored by Colin Walters's avatar Colin Walters Committed by Pavel Šimerda

build: clean up GLib-related pkg-config usage (bgo #687218)

We had separate checks for glib-2.0, gobject-2.0, gmodule-2.0, and
gio-unix-2.0.  It doesn't make sense to link a binary against all 4
because gio-unix-2.0 depends on glib-2.0 and gobject-2.0.  Doing this
actually breaks things in unusual circumstances.

Generally, few bits of NM actually just use glib, and not gio.  We
might as well coalesce those requirements together, even if it means
in some cases we "overlink".  Additionally, I chose for now to fold
gmodule-2.0 in as well, even though many fewer programs need it.  The
cost of overlinking is quite small.

The benefit of this is less repeated junk in Makefile.am, as well as
more centralized control over GLib.  A followup patch will allow us to
set -DGLIB_VERSION_MIN_REQUIRED in just one place, rather than having
to replicate it 4 times.

The NM configure is still suboptimal - for example, libpolkit-1
depends on gio-2.0, so really we should determine the compiler flags
all in one pass.  But it doesn't matter too much for now.
parent 59f2cd0f
......@@ -226,22 +226,14 @@ AC_SUBST(DBUS_LIBS)
# getting warnings. (GLIB_VERSION_2_26 is the oldest defined version.)
DBUS_CFLAGS="$DBUS_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26"
PKG_CHECK_MODULES(GLIB, gthread-2.0 glib-2.0 >= 2.22 gobject-2.0)
PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.22 gmodule-2.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
PKG_CHECK_MODULES(GMODULE, gmodule-2.0)
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= 147)
AC_SUBST(GUDEV_CFLAGS)
AC_SUBST(GUDEV_LIBS)
PKG_CHECK_MODULES(GIO, gio-unix-2.0)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
GOBJECT_INTROSPECTION_CHECK([0.9.6])
# Qt4
......
......@@ -65,11 +65,11 @@ monitor_nm_running_dbus_glib_LDADD = \
monitor_nm_running_GDBus_SOURCES = monitor-nm-running-GDBus.c
monitor_nm_running_GDBus_LDADD = \
$(GIO_LIBS)
$(GLIB_LIBS)
monitor_nm_state_GDBus_SOURCES = monitor-nm-state-GDBus.c
monitor_nm_state_GDBus_LDADD = \
$(GIO_LIBS)
$(GLIB_LIBS)
EXTRA_DIST = \
add-connection-dbus-glib.c \
......
......@@ -45,7 +45,7 @@ libdeprecated_HEADERS = libnm_glib.h
lib_LTLIBRARIES = libnm-glib.la libnm-glib-vpn.la
libnm_glib_la_CFLAGS = \
$(GIO_CFLAGS) \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
$(GUDEV_CFLAGS)
......@@ -139,7 +139,7 @@ nm_glib_marshal_sources = $(libnm_glib_la_SOURCES)
libnm_glib_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(builddir)/libdeprecated-nm-glib.la \
$(GIO_LIBS) \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
$(GUDEV_LIBS)
......@@ -151,8 +151,8 @@ libnm_glib_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \
noinst_PROGRAMS = libnm-glib-test
libnm_glib_test_SOURCES = libnm-glib-test.c
libnm_glib_test_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS)
libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS)
libnm_glib_test_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS)
libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS)
libnm_glib_vpn_la_SOURCES = \
......@@ -162,8 +162,8 @@ libnm_glib_vpn_la_SOURCES = \
nm-vpn-enum-types.c
GLIB_GENERATED += nm-vpn-enum-types.h nm-vpn-enum-types.c
nm_vpn_enum_types_sources = $(libnmvpn_HEADERS)
libnm_glib_vpn_la_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS)
libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS)
libnm_glib_vpn_la_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS)
libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS)
libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib-vpn.ver \
-version-info "2:0:1"
......@@ -174,7 +174,7 @@ BUILT_SOURCES += $(GLIB_GENERATED)
#####################################################
libnm_glib_test_la_CFLAGS = \
$(GIO_CFLAGS) \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
$(GUDEV_CFLAGS) \
-DLIBNM_GLIB_TEST
......@@ -185,7 +185,7 @@ libnm_glib_test_la_SOURCES = \
libnm_glib_test_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(GIO_LIBS) \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
$(GUDEV_LIBS)
......
......@@ -289,10 +289,8 @@ BUILT_SOURCES = \
NetworkManager_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
$(GIO_CFLAGS) \
$(GUDEV_CFLAGS) \
$(LIBNL_CFLAGS) \
$(GMODULE_CFLAGS) \
$(POLKIT_CFLAGS) \
$(SYSTEMD_CFLAGS) \
-DBINDIR=\"$(bindir)\" \
......@@ -331,7 +329,6 @@ NetworkManager_LDADD = \
$(GLIB_LIBS) \
$(GUDEV_LIBS) \
$(LIBNL_LIBS) \
$(GMODULE_LIBS) \
$(POLKIT_LIBS) \
$(SYSTEMD_LIBS) \
$(LIBM) \
......
......@@ -66,7 +66,6 @@ libnm_generated_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GUDEV_CFLAGS) \
$(LIBNL_CFLAGS) \
$(GMODULE_CFLAGS) \
$(POLKIT_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(IWMX_SDK_CFLAGS)
......
......@@ -53,7 +53,6 @@ libsettings_la_SOURCES = \
libsettings_la_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(POLKIT_CFLAGS) \
-DBINDIR=\"$(bindir)\" \
-DSBINDIR=\"$(sbindir)\" \
......@@ -71,7 +70,6 @@ libsettings_la_LIBADD = \
$(builddir)/plugins/keyfile/libnm-settings-plugin-keyfile.la \
$(DBUS_LIBS) \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(POLKIT_LIBS)
libsettings_la_LDFLAGS = -rdynamic
......
......@@ -25,15 +25,12 @@ libnm_settings_plugin_example_la_SOURCES = \
libnm_settings_plugin_example_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS) \
-DSYSCONFDIR=\"$(sysconfdir)\"
libnm_settings_plugin_example_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(GIO_LIBS)
$(GLIB_LIBS)
libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version
......@@ -54,7 +54,6 @@ libnm_settings_plugin_ifcfg_rh_la_SOURCES = \
libnm_settings_plugin_ifcfg_rh_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS) \
-DSYSCONFDIR=\"$(sysconfdir)\"
......@@ -63,9 +62,7 @@ libnm_settings_plugin_ifcfg_rh_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm-glib.la \
libifcfg-rh-io.la \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(GIO_LIBS)
$(GLIB_LIBS)
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = nm-ifcfg-rh.conf
......
......@@ -7,7 +7,6 @@ libnm_settings_plugin_ifcfg_suse_la_SOURCES = \
libnm_settings_plugin_ifcfg_suse_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS) \
-I${top_srcdir}/src/settings \
-I$(top_srcdir)/include \
......@@ -19,7 +18,5 @@ libnm_settings_plugin_ifcfg_suse_la_LDFLAGS = -module -avoid-version
libnm_settings_plugin_ifcfg_suse_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm-glib.la \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(GIO_LIBS)
$(GLIB_LIBS)
......@@ -18,7 +18,6 @@ libnm_settings_plugin_ifnet_la_SOURCES = \
libnm_settings_plugin_ifnet_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS) \
$(GUDEV_CFLAGS) \
-DSYSCONFDIR=\"$(sysconfdir)\"
......@@ -30,9 +29,7 @@ libnm_settings_plugin_ifnet_la_LIBADD = \
$(top_builddir)/libnm-glib/libnm-glib.la \
lib-ifnet-io.la\
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(GUDEV_LIBS) \
$(GIO_LIBS)
$(GUDEV_LIBS)
lib_ifnet_io_la_SOURCES = \
net_parser.c\
......@@ -53,5 +50,4 @@ lib_ifnet_io_la_CPPFLAGS = \
lib_ifnet_io_la_LIBADD = \
$(top_builddir)/src/wifi/libwifi-utils.la \
$(top_builddir)/libnm-util/libnm-util.la \
$(GLIB_LIBS)\
$(GIO_LIBS)
$(GLIB_LIBS)
......@@ -22,8 +22,7 @@ libifupdown_io_la_CPPFLAGS = \
libifupdown_io_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(GLIB_LIBS) \
$(GMODULE_LIBS)
$(GLIB_LIBS)
pkglib_LTLIBRARIES = libnm-settings-plugin-ifupdown.la
......@@ -35,7 +34,6 @@ libnm_settings_plugin_ifupdown_la_SOURCES = \
libnm_settings_plugin_ifupdown_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS) \
$(GUDEV_CFLAGS) \
-DSYSCONFDIR=\"$(sysconfdir)\"
......@@ -46,6 +44,5 @@ libnm_settings_plugin_ifupdown_la_LIBADD = \
$(top_builddir)/src/logging/libnm-logging.la \
libifupdown-io.la \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(GUDEV_LIBS)
......@@ -40,7 +40,6 @@ libnm_settings_plugin_keyfile_la_SOURCES = \
libnm_settings_plugin_keyfile_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS) \
-DSYSCONFDIR=\"$(sysconfdir)\"
......@@ -48,9 +47,7 @@ libnm_settings_plugin_keyfile_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
libkeyfile-io.la \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(DBUS_LIBS) \
$(GIO_LIBS)
$(DBUS_LIBS)
libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment