[sysprof] build: be a bit more flexible with configuration options



commit 5d25b8a2428c47cd256cca414ddf9ccd07433684
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 14 00:59:28 2016 -0700

    build: be a bit more flexible with configuration options
    
    It would be nice if we can be a bit more flexible with where the
    sysprof-cli tool can run. Lets try to break out the system checks a
    bit more.

 configure.ac      |   81 ++++++++++++++++++++++++++++++++++++++---------------
 lib/Makefile.am   |   25 ++++++++++------
 src/Makefile.am   |    8 ++++-
 tests/Makefile.am |   14 ++++++--
 tools/Makefile.am |    6 ++--
 5 files changed, 92 insertions(+), 42 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 99f57d8..27bdadd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,20 +87,29 @@ 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 >= 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])
+PKG_CHECK_MODULES(GIO,
+                  [gio-2.0 >= glib_required_version
+                   gio-unix-2.0 >= glib_required_version])
+PKG_CHECK_MODULES(GTK,
+                  [gtk+-3.0 >= gtk_required_version],
+                  [have_gtk=yes],
+                  [have_gtk=no])
+PKG_CHECK_MODULES(POLKIT,
+                  [polkit-gobject-1],
+                  [have_polkit=yes],
+                  [have_polkit=no])
+PKG_CHECK_MODULES(SYSTEMD,
+                  [libsystemd >= systemd_required_version],
+                  [have_systemd=yes],
+                  [have_systemd=no])
+
+enable_sysprofd=no
+AS_IF([test "$have_polkit" = "yes" && test "$have_systemd" = "yes"],[
+       enable_sysprofd=yes
+])
 
 # we require systemd for sysprofd
-AM_CONDITIONAL(ENABLE_SYSPROFD, [test x$have_systemd = xyes])
+AM_CONDITIONAL(ENABLE_SYSPROFD, [test "$enable_sysprofd" = "yes"])
 
 # we might be building sysprof-cli without the UI
 AC_ARG_ENABLE([gtk],
@@ -108,11 +117,13 @@ AC_ARG_ENABLE([gtk],
                               [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])
+AS_IF([test "$enable_gtk" = auto],[
+       AS_IF([test "$have_gtk" = "yes" && test "$have_polkit" = "yes"],[enable_gtk=yes],[enable_gtk=no])
+])
+AS_IF([test "$enable_gtk" = "yes"],[
+       AS_IF([test "$have_gtk" = "yes" && test "$have_polkit" = "yes"],[],[
+               AC_MSG_ERROR([--enable-gtk requires gtk+-3.0 >= gtk_required_version and polkit-gobject-1])
        ])
-       enable_gtk=$have_uilibs
 ])
 AM_CONDITIONAL(ENABLE_GTK, test "$enable_gtk" = "yes")
 
@@ -209,13 +220,37 @@ echo " ${PACKAGE} - ${VERSION}"
 echo ""
 echo " Options"
 echo ""
-echo "  Prefix ............................... : ${prefix}"
-echo "  Libdir ............................... : ${libdir}"
-echo "  Libexecdir ........................... : ${libexecdir}"
+echo "  Prefix ....................................... : ${prefix}"
+echo "  Libdir ....................................... : ${libdir}"
+echo "  Libexecdir ................................... : ${libexecdir}"
+echo ""
+echo "  Debug Symbols Directory ...................... : ${debugdir}"
+echo ""
+echo "    The sysprof interface will look in this"
+echo "    directory to load symbols for libraries that"
+echo "    have symbols stripped."
+echo ""
+echo "  sysprof-cli .................................. : yes"
+echo ""
+echo "    The sysprof-cli command line tool can be used"
+echo "    to profile systems where there is no access"
+echo "    to GTK. It also has less overhead than the"
+echo "    full GTK interface."
+echo ""
+echo "  sysprof GTK Interface  ....................... : ${enable_gtk}"
+echo ""
+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 ""
+echo "    The sysprofd system daemon provides support"
+echo "    for accessing hardware performance counters"
+echo "    as a normal user."
 echo ""
-echo "  Debug Directory ...................... : ${debugdir}"
+echo "  Systemd System Units ......................... : ${with_systemdsystemunitdir}"
 echo ""
-echo "  Sysprofd ............................. : ${have_systemd}"
-echo "  Sysprof GTK Interface  ............... : ${enable_gtk}"
-echo "  Systemd System Units ................. : ${with_systemdsystemunitdir}"
+echo "    sysprofd uses systemd to manage the service"
+echo "    and sd-bus for D-Bus communication."
 echo ""
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 313aee9..02956bc 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -24,12 +24,12 @@ libutil_la_SOURCES = \
        $(NULL)
 libutil_la_CFLAGS = \
        -I$(srcdir)/util \
-       $(SYSPROF_CFLAGS) \
+       $(GIO_CFLAGS) \
        $(WARN_CFLAGS) \
        $(NULL)
 libutil_la_CXXFLAGS = \
        -I$(srcdir)/util \
-       $(SYSPROF_CFLAGS) \
+       $(GIO_CFLAGS) \
        $(WARN_CXXFLAGS) \
        $(NULL)
 
@@ -94,20 +94,21 @@ libsysprof_ API_VERSION@_la_SOURCES = \
 
 libsysprof_ API_VERSION@_la_CFLAGS = \
        -I$(srcdir)/util \
-       $(SYSPROF_CFLAGS) \
+       $(GIO_CFLAGS) \
        $(WARN_CFLAGS) \
        $(NULL)
-if ENABLE_SYSPROFD
-libsysprof_ API_VERSION@_la_CFLAGS += \
-       -DENABLE_SYSPROFD
-endif
 
 libsysprof_ API_VERSION@_la_LIBADD = \
        libutil.la \
        -lstdc++ \
-       $(SYSPROF_LIBS) \
+       $(GIO_LIBS) \
        $(NULL)
 
+if ENABLE_SYSPROFD
+libsysprof_ API_VERSION@_la_LIBADD += $(POLKIT_LIBS)
+libsysprof_ API_VERSION@_la_CFLAGS += $(POLKIT_CFLAGS) -DENABLE_SYSPROFD
+endif
+
 libsysprof_ API_VERSION@_la_LDFLAGS = \
        -avoid-version \
        -no-undefined \
@@ -156,14 +157,18 @@ libsysprof_ui_ API_VERSION@_la_SOURCES = \
 
 libsysprof_ui_ API_VERSION@_la_CFLAGS = \
        -I$(srcdir)/util \
-       $(SYSPROF_UI_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GTK_CFLAGS) \
+       $(POLKIT_CFLAGS) \
        $(WARN_CFLAGS) \
        $(NULL)
 
 libsysprof_ui_ API_VERSION@_la_LIBADD = \
        libutil.la \
        libsysprof- API_VERSION@.la \
-       $(SYSPROF_UI_LIBS) \
+       $(GIO_LIBS) \
+       $(GTK_LIBS) \
+       $(POLKIT_LIBS) \
        $(NULL)
 
 libsysprof_ui_ API_VERSION@_la_LDFLAGS = \
diff --git a/src/Makefile.am b/src/Makefile.am
index 5af40c2..8cf8148 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,9 @@ if ENABLE_GTK
 bin_PROGRAMS = sysprof
 
 sysprof_CFLAGS = \
-       $(SYSPROF_UI_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GTK_CFLAGS) \
+       $(POLKIT_CFLAGS) \
        -I$(top_srcdir)/lib \
        -I$(top_builddir)/lib
 
@@ -23,7 +25,9 @@ nodist_sysprof_SOURCES = \
        sp-resources.h
 
 sysprof_LDADD = \
-       $(SYSPROF_UI_LIBS) \
+       $(GIO_LIBS) \
+       $(GTK_LIBS) \
+       $(POLKIT_LIBS) \
        $(top_builddir)/lib/libsysprof- API_VERSION@.la \
        $(top_builddir)/lib/libsysprof-ui- API_VERSION@.la \
        $(NULL)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0f121f7..f3825d3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,12 +2,14 @@ TESTS =
 TEST_PROGS =
 
 test_cflags = \
-       $(SYSPROF_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(POLKIT_CFLAGS) \
        -I$(top_srcdir)/lib \
        -I$(top_builddir)/lib
 
 test_libs = \
-       $(SYSPROF_LIBS) \
+       $(GIO_LIBS) \
+       $(POLKIT_LIBS) \
        $(top_builddir)/lib/libsysprof- API_VERSION@.la
 
 TESTS += test-capture
@@ -19,11 +21,15 @@ test_capture_LDADD = $(test_libs)
 if ENABLE_GTK
 
 test_ui_cflags = \
-       $(SYSPROF_UI_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GTK_CFLAGS) \
+       $(POLKIT_CFLAGS) \
        -I$(top_srcdir)/lib \
        -I$(top_builddir)/lib
 test_ui_libs = \
-       $(SYSPROF_UI_LIBS) \
+       $(GIO_LIBS) \
+       $(GTK_LIBS) \
+       $(POLKIT_LIBS) \
        $(top_builddir)/lib/libsysprof- API_VERSION@.la \
        $(top_builddir)/lib/libsysprof-ui- API_VERSION@.la
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0b1522a..5ad169b 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -2,18 +2,18 @@ bin_PROGRAMS = sysprof-cli
 noinst_PROGRAMS = sysprof-dump
 
 AM_CPPFLAGS = \
-       $(SYSPROF_CFLAGS) \
+       $(GIO_CFLAGS) \
        -I$(top_srcdir)/lib \
        -I$(top_builddir)/lib
 
 sysprof_cli_SOURCES = sysprof-cli.c
 sysprof_cli_LDADD = \
-       $(SYSPROF_LIBS) \
+       $(GIO_LIBS) \
        $(top_builddir)/lib/libsysprof- API_VERSION@.la
 
 sysprof_dump_SOURCES = sysprof-dump.c
 sysprof_dump_LDADD = \
-       $(SYSPROF_LIBS) \
+       $(GIO_LIBS) \
        $(top_builddir)/lib/libsysprof- API_VERSION@.la
 
 -include $(top_srcdir)/git.mk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]