[Spice-commits] m4/common.m4 m4/spice-deps.m4

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 2 13:54:52 UTC 2020


 m4/common.m4     |    6 ++++++
 m4/spice-deps.m4 |   31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

New commits:
commit 19ea60416c301e0b4b69ea038618452f0845d173
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Nov 26 21:07:03 2019 +0000

    m4: Make easier to integrate in other projects
    
    Add a common.m4 file to be included directly in other project.
    This include will include all needed checks to use spice-common.
    Just include directly this file in your configure.ac.
    This will define SPICE_COMMON_CFLAGS and SPICE_COMMON_DIR (for
    linking .la files) which are needed to use spice-common.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Kevin Pouget <kpouget at redhat.com>

diff --git a/m4/common.m4 b/m4/common.m4
new file mode 100644
index 0000000..5e6c6bb
--- /dev/null
+++ b/m4/common.m4
@@ -0,0 +1,6 @@
+dnl This file should be included by spice-common user from
+dnl configure.ac to have all required checks in order to use spice-common
+m4_define(spice_common_dir,m4_bpatsubst(__file__,[/m4/common\.m4],[]))dnl
+dnl Automatically include m4 files in m4 directory
+AC_CONFIG_MACRO_DIRS(spice_common_dir[/m4])dnl
+SPICE_COMMON(spice_common_dir)
diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 53255e1..9e1b8fd 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -346,3 +346,34 @@ AC_DEFUN([SPICE_CHECK_INSTRUMENTATION], [
     AM_CONDITIONAL([ENABLE_RECORDER],[test "$enable_instrumentation" = "recorder"])
     AM_CONDITIONAL([ENABLE_AGENT_INTERFACE],[test "$enable_instrumentation" = "agent"])
 ])
+
+# SPICE_COMMON
+# -----------------
+# Define variables in order to use spice-common
+# SPICE_COMMON_DIR        directory for output libraries
+# SPICE_COMMON_CFLAGS     CFLAGS to add to use the library
+#
+# SPICE_PROTOCOL_MIN_VER  input (m4) and output (autoconf) SPICE protocol version
+# SPICE_PROTOCOL_CFLAGS   CFLAGS for SPICE protocol, already automatically included
+#------------------
+AC_DEFUN([SPICE_COMMON], [dnl
+dnl These add some flags and checks to component using spice-common
+dnl The flags are necessary in order to make included header working
+    AC_REQUIRE([SPICE_CHECK_CELT051])dnl
+    AC_REQUIRE([SPICE_EXTRA_CHECKS])dnl
+    AC_REQUIRE([SPICE_CHECK_INSTRUMENTATION])dnl
+dnl Get the required spice protocol version
+    m4_define([SPICE_PROTOCOL_MIN_VER],m4_ifdef([SPICE_PROTOCOL_MIN_VER],SPICE_PROTOCOL_MIN_VER,[0.12.12]))dnl
+    m4_define([SPICE_PROTOCOL_MIN_VER],m4_if(m4_version_compare(SPICE_PROTOCOL_MIN_VER,[0.12.12]),[1],SPICE_PROTOCOL_MIN_VER,[0.12.12]))dnl
+    [SPICE_PROTOCOL_MIN_VER]=SPICE_PROTOCOL_MIN_VER
+    m4_undefine([SPICE_PROTOCOL_MIN_VER])dnl
+    PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= $SPICE_PROTOCOL_MIN_VER])
+    AC_SUBST([SPICE_PROTOCOL_MIN_VER])dnl
+dnl Configuration variables
+    AC_CONFIG_SUBDIRS([$1])dnl
+    SPICE_COMMON_CFLAGS='-I${top_srcdir}/$1 -I${top_builddir}/$1 -DG_LOG_DOMAIN=\"Spice\" $(SPICE_PROTOCOL_CFLAGS)'
+    AC_SUBST([SPICE_COMMON_CFLAGS])dnl
+
+    SPICE_COMMON_DIR='${top_builddir}/$1'
+    AC_SUBST([SPICE_COMMON_DIR])dnl
+])


More information about the Spice-commits mailing list