[sysprof] build: allow using a host-installed sysprofd
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] build: allow using a host-installed sysprofd
- Date: Thu, 15 Sep 2016 21:24:15 +0000 (UTC)
commit c5ba20caeb3a9b46ac7018f50bcef4ca465b5b59
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 15 13:45:02 2016 -0700
build: allow using a host-installed sysprofd
In case we are building in a flatpak, we might want to rely on a system
installed sysprofd. This means we might want to pretend we have sysprofd
support (to be found on the system), but not actually build sysprofd.
configure.ac | 21 +++++++++++----------
lib/Makefile.am | 4 ++--
lib/sp-perf-counter.c | 12 ++++++------
3 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cb96c7a..f0d4104 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,22 +133,23 @@ PKG_CHECK_MODULES(SYSTEMD,
# sysprofd requires libsystemd and polkit, and is required to run
# the ui without root permissions
-AC_ARG_ENABLE([sysprofd],
- [AS_HELP_STRING([--enable-sysprofd=@<:@yes/no/auto@:>@],
+AC_ARG_WITH([sysprofd],
+ [AS_HELP_STRING([--with-sysprofd=@<:@host/bundled/no/auto@:>@],
[Build Sysprof D-Bus daemon.])],
- [enable_sysprofd=$enableval],
- [enable_sysprofd=auto])
-AS_IF([test "$enable_sysprofd" = "auto"],[
+ [with_sysprofd=$withval],
+ [with_sysprofd=auto])
+AS_IF([test "$with_sysprofd" = "auto"],[
AS_IF([test "$have_polkit" = "yes" && test "$have_systemd" = "yes"],
- [enable_sysprofd=yes],
- [enable_sysprofd=no])
+ [with_sysprofd=bundled],
+ [with_sysprofd=no])
])
-AS_IF([test "$enable_sysprofd" = "yes"],[
+AS_IF([test "$with_sysprofd" = "bundled"],[
AS_IF([test "$have_systemd" = "yes" && test "$have_polkit" = "yes"],[],[
AC_MSG_ERROR([--enable-sysprofd requires libsystemd >= systemd_required_version and
polkit-gobject-1])
])
])
-AM_CONDITIONAL(ENABLE_SYSPROFD, [test "$enable_sysprofd" = "yes"])
+AM_CONDITIONAL(ENABLE_SYSPROFD, [test "$with_sysprofd" = "bundled"])
+AM_CONDITIONAL(ENABLE_POLKIT, [test "$with_sysprofd" = "host" || test "$with_sysprofd" = "bundled"])
# we might be building sysprof-cli without the UI
AC_ARG_ENABLE([gtk],
@@ -282,7 +283,7 @@ echo " The GTK interface can explore sysprof capture"
echo " files. If you want the user interface, ensure"
echo " this is yes."
echo ""
-echo " sysprofd ..................................... : ${enable_sysprofd}"
+echo " sysprofd ..................................... : ${with_sysprofd}"
echo ""
echo " The sysprofd system daemon provides support"
echo " for accessing hardware performance counters"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2b9d473..710d4f3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -107,9 +107,9 @@ libsysprof_@API_VERSION@_la_LIBADD = \
$(GIO_LIBS) \
$(NULL)
-if ENABLE_SYSPROFD
+if ENABLE_POLKIT
libsysprof_@API_VERSION@_la_LIBADD += $(POLKIT_LIBS)
-libsysprof_@API_VERSION@_la_CFLAGS += $(POLKIT_CFLAGS) -DENABLE_SYSPROFD
+libsysprof_@API_VERSION@_la_CFLAGS += $(POLKIT_CFLAGS) -DENABLE_POLKIT
endif
libsysprof_@API_VERSION@_la_LDFLAGS = \
diff --git a/lib/sp-perf-counter.c b/lib/sp-perf-counter.c
index d41bc9e..df8626d 100644
--- a/lib/sp-perf-counter.c
+++ b/lib/sp-perf-counter.c
@@ -49,7 +49,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#ifdef ENABLE_SYSPROFD
+#ifdef ENABLE_POLKIT
# include <polkit/polkit.h>
#endif
@@ -124,7 +124,7 @@ G_DEFINE_BOXED_TYPE (SpPerfCounter,
(GBoxedCopyFunc)sp_perf_counter_ref,
(GBoxedFreeFunc)sp_perf_counter_unref)
-#ifdef ENABLE_SYSPROFD
+#ifdef ENABLE_POLKIT
static GDBusConnection *shared_conn;
#endif
@@ -420,7 +420,7 @@ sp_perf_counter_take_fd (SpPerfCounter *self,
sp_perf_counter_add_info (self, fd, -1);
}
-#ifdef ENABLE_SYSPROFD
+#ifdef ENABLE_POLKIT
static GDBusProxy *
get_proxy (void)
{
@@ -641,7 +641,7 @@ sp_perf_counter_authorize_async (GCancellable *cancellable,
task = g_task_new (NULL, cancellable, callback, user_data);
-#ifdef ENABLE_SYSPROFD
+#ifdef ENABLE_POLKIT
g_bus_get (G_BUS_TYPE_SYSTEM,
cancellable,
sp_perf_counter_get_bus_cb,
@@ -671,7 +671,7 @@ sp_perf_counter_open (SpPerfCounter *self,
gint group_fd,
gulong flags)
{
-#ifdef ENABLE_SYSPROFD
+#ifdef ENABLE_POLKIT
g_autoptr(GError) error = NULL;
g_autoptr(GDBusProxy) proxy = NULL;
g_autoptr(GUnixFDList) fdlist = NULL;
@@ -694,7 +694,7 @@ sp_perf_counter_open (SpPerfCounter *self,
return ret;
}
-#ifdef ENABLE_SYSPROFD
+#ifdef ENABLE_POLKIT
params = g_variant_new_parsed (
"("
"["
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]