[mutter/wip/wayland: 12/20] configure: Adds --enable-wayland config option



commit 40c7083adb23aa91b4321e0ebbb3e5645a6d3423
Author: Robert Bragg <robert linux intel com>
Date:   Thu Jan 5 12:19:58 2012 +0000

    configure: Adds --enable-wayland config option
    
    This adds a --enable-wayland configure option to enable building mutter
    as a hybrid X and Wayland compositor. By default the option is disabled.
    If enabled then HAVE_WAYLAND is defined for C code and as an automake
    conditional.
    
    This copies the xserver.xml wayland protocol into a protocol/ directory
    since wayland support will depend on this protocol for communicating
    with an xwayland X server. Copying the spec like this is consistent with
    Weston so we don't need a configure option to locate an external spec.

 Makefile.am     |    2 +-
 configure.ac    |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 src/Makefile.am |    9 +++++++++
 3 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 56c7c88..979ba25 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 
-SUBDIRS=src po doc
+SUBDIRS=src protocol po doc
 
 EXTRA_DIST = HACKING MAINTAINERS rationales.txt
 
diff --git a/configure.ac b/configure.ac
index dbb3aca..0cfe8de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,6 +113,21 @@ AC_ARG_ENABLE(shape,
                  [disable mutter's use of the shaped window extension]),,
   enable_shape=auto)
 
+AC_ARG_ENABLE(wayland,
+  AC_HELP_STRING([--enable-wayland],
+                 [Enable support for running as a hybrid X and Wayland compositor]),,
+  enable_wayland=no)
+
+## Wayland support requires the xserver.xml protocol extension found in the weston
+## repository but since there aren't currently established conventions for
+## installing and discovering these we simply require a location to be given
+## explicitly...
+AC_ARG_WITH([wayland-protocols],
+            [AS_HELP_STRING([--with-wayland-protocols], [Location for wayland extension protocol specs])],
+            [
+            ],
+            [])
+
 AM_GLIB_GNU_GETTEXT
 
 ## here we get the flags we'll actually use
@@ -199,6 +214,34 @@ if test x$have_xcursor = xyes; then
   AC_DEFINE(HAVE_XCURSOR, , [Building with Xcursor support])
 fi
 
+have_wayland=no
+if test x$enable_wayland = "xyes"; then
+  WAYLAND_VERSION=0.1
+  AC_MSG_CHECKING([Wayland >= $WAYLAND_VERSION])
+  if ! $PKG_CONFIG --atleast-version $WAYLAND_VERSION wayland-server; then
+    AC_MSG_ERROR([wayland support enabled but no suitable wayland-server package found])
+  fi
+  AC_MSG_RESULT(yes)
+
+  CLUTTER_WAYLAND_VERSION=1.9.3
+  AC_MSG_CHECKING([Clutter Wayland Compositor >= $CLUTTER_WAYLAND_VERSION])
+  if ! $PKG_CONFIG --atleast-version $CLUTTER_WAYLAND_VERSION clutter-wayland-compositor-1.0; then
+    AC_MSG_ERROR([wayland support enabled but no suitable clutter-wayland-compositor package found])
+  fi
+  AC_MSG_RESULT(yes)
+
+  AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
+  AS_IF([test "x$WAYLAND_SCANNER" = "xno"],
+        AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension 
protocols]))
+  AC_SUBST([WAYLAND_SCANNER])
+
+  MUTTER_PC_MODULES="$MUTTER_PC_MODULES wayland-server clutter-wayland-compositor-1.0"
+  AC_DEFINE(HAVE_WAYLAND, , [Building with Wayland support])
+  have_wayland=yes
+fi
+
+AM_CONDITIONAL(HAVE_WAYLAND, test x$have_wayland = "xyes")
+
 PKG_CHECK_MODULES(MUTTER, $MUTTER_PC_MODULES)
 
 PKG_CHECK_EXISTS([xi >= 1.6.99.1],
@@ -444,6 +487,7 @@ src/libmutter.pc
 src/mutter-plugins.pc
 src/tools/Makefile
 src/compositor/plugins/Makefile
+protocol/Makefile
 po/Makefile.in
 ])
 
@@ -465,6 +509,8 @@ mutter-$VERSION
        source code location:     ${srcdir}
        compiler:                 ${CC}
 
+       Wayland:                  ${have_wayland}
+
        Startup notification:     ${have_startup_notification}
        libcanberra:              ${have_libcanberra}
        Introspection:            ${found_introspection}
diff --git a/src/Makefile.am b/src/Makefile.am
index e2cec91..7a11926 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -342,3 +342,12 @@ mutter-enum-types.c: stamp-mutter-enum-types.h mutter-enum-types.c.in
          $(libmutterinclude_base_headers) ) >> xgen-tetc && \
        cp xgen-tetc mutter-enum-types.c && \
        rm -f xgen-tetc
+
+if HAVE_WAYLAND
+wayland/%-protocol.c : $(top_builddir)/protocol/%.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+wayland/%-server-protocol.h : $(top_builddir)/protocol/%.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@
+wayland/%-client-protocol.h : $(top_builddir)/protocol/%.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+endif


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