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.
This commit is contained in:
Robert Bragg 2012-01-05 12:19:58 +00:00 committed by Jasper St. Pierre
parent 531be6c413
commit 6585a5760b
4 changed files with 74 additions and 1 deletions

View File

@ -1,5 +1,5 @@
SUBDIRS=src po doc
SUBDIRS=src protocol po doc
EXTRA_DIST = HACKING MAINTAINERS rationales.txt

View File

@ -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}

18
protocol/xserver.xml Normal file
View File

@ -0,0 +1,18 @@
<protocol name="xserver">
<interface name="xserver" version="1">
<request name="set_window_id">
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="id" type="uint"/>
</request>
<event name="client">
<arg name="fd" type="fd"/>
</event>
<event name="listen_socket">
<arg name="fd" type="fd"/>
</event>
</interface>
</protocol>

View File

@ -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