[PATCH] build: disabling the mtdev library support

mchalain [marc.chalain@gmail.com] marc.chalain at gmail.com
Tue Jun 25 08:28:11 PDT 2013


From: mchalain <marc.chalain at gmail.com>

This patch creates the --enable-mtdev configure's option with
"auto" as default value.
If mtdv library is not available the mtdev functions are replaced
by empty macros.
To simplify the Makefile.am evdev source files are placed inside
a static library. The other reason of this modification is to
see the link between evdev code and mtdev library from the Makefile
---
 configure.ac    |   20 +++++++++++++++-----
 src/Makefile.am |   27 ++++++++++++++-------------
 src/evdev.c     |   11 ++++++++---
 3 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index b625221..4bfce58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,7 +132,7 @@ AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
 AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes -a x$enable_egl = xyes)
 if test x$enable_drm_compositor = xyes -a x$enable_egl = xyes; then
   AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
-  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev >= 1.1.0])
+  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
 fi
 
 
@@ -161,7 +161,7 @@ AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test "x$enable_rpi_compositor" = "xyes")
 have_bcm_host="no"
 if test "x$enable_rpi_compositor" = "xyes"; then
   AC_DEFINE([BUILD_RPI_COMPOSITOR], [1], [Build the compositor for Raspberry Pi])
-  PKG_CHECK_MODULES(RPI_COMPOSITOR, [libudev >= 136 mtdev >= 1.1.0])
+  PKG_CHECK_MODULES(RPI_COMPOSITOR, [libudev >= 136])
   PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
                     [have_bcm_host="yes"
                      AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM headers])],
@@ -176,7 +176,7 @@ AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
                [test x$enable_fbdev_compositor = xyes])
 AS_IF([test x$enable_fbdev_compositor = xyes], [
   AC_DEFINE([BUILD_FBDEV_COMPOSITOR], [1], [Build the fbdev compositor])
-  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
+  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 ])
 ])
 
 AC_ARG_ENABLE([rdp-compositor], [  --enable-rdp-compositor],,
@@ -203,6 +203,16 @@ PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], [have_webp=no])
 AS_IF([test "x$have_webp" = "xyes"],
       [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
 
+AC_ARG_ENABLE(mtdev,
+              AS_HELP_STRING([--disable-mtdev],
+                             [do not support multitouch library libmtdev]),,
+	      enable_mtdev=auto)
+if test "x$enable_mtdev" != "xno"; then
+	PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0], [have_mtdev=yes], [have_mtdev=no])
+	AS_IF([test "x$have_mtdev" = "xyes"],
+		  [AC_DEFINE([HAVE_MTDEV], [1], [Have Multitouch device support])])
+fi
+
 AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
 if test x$have_jpeglib = xyes; then
   JPEG_LIBS="-ljpeg"
@@ -259,8 +269,8 @@ AS_IF([test "x$enable_resize_optimization" = "xyes"],
       [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
 
 AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
-AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
-if test x$enable_weston_launch == xyes; then
+AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes)
+if test x$enable_weston_launch = xyes; then
   PKG_CHECK_MODULES(WESTON_LAUNCH, [libdrm])
   PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login],
 		    [have_systemd_login=yes], [have_systemd_login=no])
diff --git a/src/Makefile.am b/src/Makefile.am
index d06e773..b16bc80 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,6 +100,7 @@ module_LTLIBRARIES =				\
 	$(tablet_shell)				\
 	$(cms_static)				\
 	$(cms_colord)				\
+	$(libevdev)					\
 	$(x11_backend)				\
 	$(drm_backend)				\
 	$(wayland_backend)			\
@@ -129,11 +130,20 @@ x11_backend_la_CFLAGS =				\
 x11_backend_la_SOURCES = compositor-x11.c
 endif
 
+libevdev = libevdev.la
+libevdev_la_LIBADD = $(MTDEV_LIBS)
+evdev_la_CFLAGS =			\
+	$(MTDEV_CFLAGS)
+libevdev_la_SOURCES =			\
+	evdev.c					\
+	evdev.h					\
+	evdev-touchpad.c
+	
 if ENABLE_DRM_COMPOSITOR
 drm_backend = drm-backend.la
 drm_backend_la_LDFLAGS = -module -avoid-version
 drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS) \
-	../shared/libshared.la -lrt
+	./libevdev.la ../shared/libshared.la -lrt
 drm_backend_la_CFLAGS =				\
 	$(COMPOSITOR_CFLAGS)			\
 	$(DRM_COMPOSITOR_CFLAGS)		\
@@ -143,9 +153,6 @@ drm_backend_la_SOURCES =			\
 	tty.c					\
 	udev-seat.c				\
 	udev-seat.h				\
-	evdev.c					\
-	evdev.h					\
-	evdev-touchpad.c			\
 	launcher-util.c				\
 	launcher-util.h				\
 	libbacklight.c				\
@@ -172,7 +179,7 @@ rpi_backend_la_LDFLAGS = -module -avoid-version
 rpi_backend_la_LIBADD = $(COMPOSITOR_LIBS)	\
 	$(RPI_COMPOSITOR_LIBS)			\
 	$(RPI_BCM_HOST_LIBS)			\
-	../shared/libshared.la
+	./libevdev.la ../shared/libshared.la
 rpi_backend_la_CFLAGS =				\
 	$(GCC_CFLAGS)				\
 	$(COMPOSITOR_CFLAGS)			\
@@ -183,10 +190,7 @@ rpi_backend_la_SOURCES =			\
 	rpi-renderer.c				\
 	rpi-renderer.h				\
 	rpi-bcm-stubs.h 			\
-	tty.c					\
-	evdev.c					\
-	evdev.h					\
-	evdev-touchpad.c
+	tty.c
 endif
 
 if ENABLE_HEADLESS_COMPOSITOR
@@ -206,7 +210,7 @@ fbdev_backend_la_LDFLAGS = -module -avoid-version
 fbdev_backend_la_LIBADD = \
 	$(COMPOSITOR_LIBS) \
 	$(FBDEV_COMPOSITOR_LIBS) \
-	../shared/libshared.la
+	./libevdev.la ../shared/libshared.la
 fbdev_backend_la_CFLAGS = \
 	$(COMPOSITOR_CFLAGS) \
 	$(FBDEV_COMPOSITOR_CFLAGS) \
@@ -217,9 +221,6 @@ fbdev_backend_la_SOURCES = \
 	tty.c \
 	udev-seat.c \
 	udev-seat.h \
-	evdev.c \
-	evdev.h \
-	evdev-touchpad.c \
 	launcher-util.c
 endif
 
diff --git a/src/evdev.c b/src/evdev.c
index 122a2d9..59af038 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -27,7 +27,15 @@
 #include <linux/input.h>
 #include <unistd.h>
 #include <fcntl.h>
+#ifdef HAVE_MTDEV
 #include <mtdev.h>
+#else
+struct mtdev
+{ int none;};
+#define mtdev_close_delete(...) do{}while(0)
+#define mtdev_get(...) 0
+#define mtdev_new_open(...) NULL
+#endif
 
 #include "compositor.h"
 #include "evdev.h"
@@ -565,11 +573,8 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
 	if (device->dispatch == NULL)
 		goto err1;
 
-
 	if (device->is_mt) {
 		device->mtdev = mtdev_new_open(device->fd);
-		if (!device->mtdev)
-			weston_log("mtdev failed to open for %s\n", path);
 	}
 
 	device->source = wl_event_loop_add_fd(ec->input_loop, device->fd,
-- 
1.7.9.5



More information about the wayland-devel mailing list