clients: add simple-v4l-dmabuf client

This client opens a V4L2 device, usually exposed as /dev/videoN, and
retrieves its frames as dmabuf for later import into the compositor.

It supports both single- and multi-planar devices, and any format
exposed by the V4L2 device the Wayland compositor accepts.

This client never changes the v4l2 settings, use `v4l2-ctl -c` if you
want to change those.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>

Maniphest Tasks: T90

Differential Revision: https://phabricator.freedesktop.org/D339
diff --git a/configure.ac b/configure.ac
index 24a9de2..97cbfe5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -356,6 +356,20 @@
 fi
 AM_CONDITIONAL(BUILD_SIMPLE_DMABUF_INTEL_CLIENT, test "x$enable_simple_dmabuf_intel_client" = "xyes")
 
+AC_ARG_ENABLE(simple-dmabuf-v4l-client,
+              AS_HELP_STRING([--disable-simple-dmabuf-v4l-client],
+                             [do not build the simple dmabuf v4l client]),,
+              enable_simple_dmabuf_v4l_client="auto")
+if ! test "x$enable_simple_dmabuf_v4l_client" = "xno"; then
+  PKG_CHECK_MODULES(SIMPLE_DMABUF_V4L_CLIENT, [wayland-client libdrm],
+		    have_simple_dmabuf_v4l_client=yes, have_simple_dmabuf_v4l_client=no)
+  if test "x$have_simple_dmabuf_v4l_client" = "xno" -a "x$enable_simple_dmabuf_v4l_client" = "xyes"; then
+    AC_MSG_ERROR([V4L dmabuf client explicitly enabled, but libdrm couldn't be found])
+  fi
+  enable_simple_dmabuf_v4l_client="$have_simple_dmabuf_v4l_client"
+fi
+AM_CONDITIONAL(BUILD_SIMPLE_DMABUF_V4L_CLIENT, test "x$enable_simple_dmabuf_v4l_client" = "xyes")
+
 AC_ARG_ENABLE(clients, [  --enable-clients],, enable_clients=yes)
 AM_CONDITIONAL(BUILD_CLIENTS, test x$enable_clients = xyes)
 if test x$enable_clients = xyes; then