From c05e8a98283929fd7cd97889a96756b57ee79839 Mon Sep 17 00:00:00 2001 From: rbuj Date: Thu, 16 Apr 2020 11:32:25 +0200 Subject: build: Use dbus-glib only when required --- configure.ac | 12 +++++++----- cpufreq/src/Makefile.am | 16 +++++++++++----- mateweather/Makefile.am | 4 +--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 2cd90943..a8c9df61 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,6 @@ LIBPANEL4_REQUIRED=1.17.0 LIBGTOP_REQUIRED=2.12.0 LIBNOTIFY_REQUIRED=0.7.0 UPOWER_REQUIRED=0.9.4 -DBUS_REQUIRED=1.10.0 DBUS_GLIB_REQUIRED=0.74 LIBXML_REQUIRED=2.5.0 POLKIT_REQUIRED=0.97 @@ -109,9 +108,9 @@ PKG_CHECK_MODULES(CPUFREQ_SELECTOR, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $G AC_SUBST(CPUFREQ_SELECTOR_CFLAGS) AC_SUBST(CPUFREQ_SELECTOR_LIBS) -dnl -- check for dbus (required for cpufreq-selector) -PKG_CHECK_MODULES(DBUS, dbus-1 >= $DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_DBUS=yes, HAVE_DBUS=no) - +dnl -- check for dbus-glib (optional) ----------------------------------------- +PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_DBUS=yes, HAVE_DBUS=no) +AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes") AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) @@ -123,7 +122,10 @@ AC_ARG_ENABLE([polkit], enable_polkit=$enableval, enable_polkit=auto) if test "x$enable_polkit" != "xno"; then - PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) + if test "x$enable_polkit" = "xyes" -a "x$HAVE_DBUS" = "xno"; then + AC_MSG_ERROR([PolicyKit support explicitly requested but dbus-glib-1 not found]) + fi + PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno"; then AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found]) fi diff --git a/cpufreq/src/Makefile.am b/cpufreq/src/Makefile.am index b9a3781c..bfa6fd48 100644 --- a/cpufreq/src/Makefile.am +++ b/cpufreq/src/Makefile.am @@ -6,9 +6,12 @@ SUBDIRS = $(selector_SUBDIR) AM_CPPFLAGS = \ -DCPUFREQ_MENU_UI_DIR=\""$(datadir)/mate/ui"\" \ - $(MATE_APPLETS4_CFLAGS) \ - $(MATEDESKTOP_CFLAGS) \ - $(DBUS_CFLAGS) + $(MATE_APPLETS4_CFLAGS) \ + $(MATEDESKTOP_CFLAGS) + +if HAVE_DBUS +AM_CPPFLAGS += $(DBUS_CFLAGS) +endif libexec_PROGRAMS = mate-cpufreq-applet @@ -35,7 +38,10 @@ mate_cpufreq_applet_CFLAGS = \ mate_cpufreq_applet_LDADD = \ $(MATE_APPLETS4_LIBS) \ $(MATEDESKTOP_LIBS) \ - $(LIBCPUFREQ_LIBS) \ - $(DBUS_LIBS) + $(LIBCPUFREQ_LIBS) + +if HAVE_DBUS +mate_cpufreq_applet_LDADD += $(DBUS_LIBS) +endif -include $(top_srcdir)/git.mk diff --git a/mateweather/Makefile.am b/mateweather/Makefile.am index ea6a723d..467f6d8c 100644 --- a/mateweather/Makefile.am +++ b/mateweather/Makefile.am @@ -10,7 +10,6 @@ AM_CPPFLAGS = \ $(MATEDESKTOP_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ $(LIBMATEWEATHER_CFLAGS) \ - $(DBUS_CFLAGS) \ ${WARN_CFLAGS} libexec_PROGRAMS = mateweather-applet @@ -28,8 +27,7 @@ mateweather_applet_LDADD = \ $(MATE_APPLETS4_LIBS) \ $(MATEDESKTOP_LIBS) \ $(MATE_LIBS2_LIBS) \ - $(LIBMATEWEATHER_LIBS) \ - $(DBUS_LIBS) + $(LIBMATEWEATHER_LIBS) uidir = $(datadir)/mate/ui ui_DATA = mateweather-applet-menu.xml -- cgit v1.2.1