build: allow disabling the GTK interface with --disable-gtk

For some systems, such as embedded Linux including ARM, we might want to
just compile libsysprof/sysprof-cli without the GTK user interface. This
allows for that. You can copy the capture files to your visualization
host to render the results.
This commit is contained in:
Christian Hergert
2016-04-13 21:32:01 -07:00
parent 61fed5b8f2
commit a8205c7c29
4 changed files with 46 additions and 13 deletions

View File

@ -82,20 +82,39 @@ VAPIGEN_CHECK
dnl ***********************************************************************
dnl Check for required packages
dnl ***********************************************************************
PKG_CHECK_MODULES(SYSPROF, [gio-2.0 >= 2.44
gio-unix-2.0 >= 2.44
m4_define([glib_required_version], [2.44.0])
m4_define([gtk_required_version], [3.16.0])
m4_define([systemd_required_version], [222])
PKG_CHECK_MODULES(SYSPROF, [gio-2.0 >= glib_required_version
gio-unix-2.0 >= glib_required_version
polkit-gobject-1])
PKG_CHECK_MODULES(SYSPROF_UI, [gio-2.0 >= 2.44
gtk+-3.0 >= 3.16
polkit-gobject-1])
PKG_CHECK_MODULES(SYSTEMD, [libsystemd >= 222],
PKG_CHECK_MODULES(SYSPROF_UI, [gio-2.0 >= glib_required_version
gtk+-3.0 >= gtk_required_version
polkit-gobject-1],
[have_uilibs=yes],
[have_uilibs=no])
PKG_CHECK_MODULES(SYSTEMD, [libsystemd >= systemd_required_version],
[have_systemd=yes],
[have_systemd=no])
# we require systemd for sysprofd
AM_CONDITIONAL(ENABLE_SYSPROFD, [test x$have_systemd = xyes])
# we might be building sysprof-cli without the UI
AC_ARG_ENABLE([gtk],
[AS_HELP_STRING([--enable-gtk=@<:@yes/no/auto@:>@],
[Build GTK user interface.])],
[enable_gtk=$enableval],
[enable_gtk=auto])
AS_IF([test "$enable_gtk" != no],[
AS_IF([test "$enable_gtk" = "yes" && test "$have_uilibs" = "no"],[
AC_MSG_ERROR([--enable-gtk requires gtk+-3.0 >= gtk_required_version])
])
enable_gtk=$have_uilibs
])
AM_CONDITIONAL(ENABLE_GTK, test "$enable_gtk" = "yes")
# where to place systemd units if necessary
AC_ARG_WITH([systemdsystemunitdir],
@ -196,5 +215,6 @@ echo ""
echo " Debug Directory ...................... : ${debugdir}"
echo ""
echo " Sysprofd ............................. : ${have_systemd}"
echo " Sysprof GTK Interface ............... : ${enable_gtk}"
echo " Systemd System Units ................. : ${with_systemdsystemunitdir}"
echo ""

View File

@ -116,6 +116,8 @@ libsysprof_@API_VERSION@_la_LDFLAGS = \
$(NULL)
if ENABLE_GTK
# This is our GTK library containing the widgets suitable for viewing
# and manipulating the various profiler API in libsysprof. This is
# meant to be used by IDEs and the sysprof gui.
@ -181,5 +183,7 @@ glib_resources_h = sp-resources.h
glib_resources_namespace = sp
include $(top_srcdir)/gresources.mk
endif
-include $(top_srcdir)/git.mk

View File

@ -1,3 +1,5 @@
if ENABLE_GTK
bin_PROGRAMS = sysprof
sysprof_CFLAGS = \
@ -37,4 +39,6 @@ glib_resources_h = sp-resources.h
glib_resources_namespace = sysprof
include $(top_srcdir)/gresources.mk
endif
-include $(top_srcdir)/git.mk

View File

@ -1,4 +1,5 @@
TESTS =
TEST_PROGS =
test_cflags = \
$(SYSPROF_CFLAGS) \
@ -9,11 +10,18 @@ test_libs = \
$(SYSPROF_LIBS) \
$(top_builddir)/lib/libsysprof-@API_VERSION@.la
TESTS += test-capture
test_capture_SOURCES = test-capture.c
test_capture_CFLAGS = $(test_cflags)
test_capture_LDADD = $(test_libs)
if ENABLE_GTK
test_ui_cflags = \
$(SYSPROF_UI_CFLAGS) \
-I$(top_srcdir)/lib \
-I$(top_builddir)/lib
test_ui_libs = \
$(SYSPROF_UI_LIBS) \
$(top_builddir)/lib/libsysprof-@API_VERSION@.la \
@ -21,14 +29,12 @@ test_ui_libs = \
TESTS += test-model-filter
TEST_PROGS += test-model-filter
test_model_filter_SOURCES = test-model-filter.c
test_model_filter_CFLAGS = $(test_ui_cflags)
test_model_filter_LDADD = $(test_ui_libs)
TESTS += test-capture
test_capture_SOURCES = test-capture.c
test_capture_CFLAGS = $(test_cflags)
test_capture_LDADD = $(test_libs)
endif
TEST_ENVIRONMENT = \
G_TEST_SRCDIR="$(abs_srcdir)" \
@ -38,7 +44,6 @@ TEST_ENVIRONMENT = \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
TEST_PROGS = test-model-filter
LOG_COMPILER = $(top_srcdir)/tap-test
noinst_PROGRAMS = $(TESTS)