[PATCH 7/9] [kdrive] Add option to compile out input drivers

Mikhail Gusarov dottedmag at dottedmag.net
Sat Jan 2 06:32:57 PST 2010


Add --without-kdrive-{kbd,mouse,evdev} configure options disabling
Linux keyboard driver, Linux mouse drivers (ps2, bus,ms),
and Linux evdev driver.

Build all drivers by default as before.

Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 configure.ac                |   17 +++++++++++++++++
 hw/kdrive/ephyr/ephyrinit.c |    9 +++++++--
 hw/kdrive/linux/Makefile.am |   31 +++++++++++++++++--------------
 hw/kdrive/linux/linux.c     |   24 +++++++++++++++++++++++-
 hw/kdrive/src/kdrive.h      |   14 --------------
 include/kdrive-config.h.in  |    9 +++++++++
 6 files changed, 73 insertions(+), 31 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7e2c6a5..ee9fa7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -640,6 +640,10 @@ AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive se
 AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
 AC_ARG_ENABLE(xfake,          AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
 AC_ARG_ENABLE(xfbdev,         AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
+dnl kdrive options
+AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: enabled)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=yes])
+AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: enabled)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=yes])
+AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: enabled)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=yes])
 
 
 dnl chown/chmod to be setuid root as part of build
@@ -2023,6 +2027,19 @@ if test "$KDRIVE" = yes; then
         fi
     fi
 
+    AM_CONDITIONAL(KDRIVE_KBD, test x$KDRIVE_KBD = xyes)
+    if test x$KDRIVE_KBD = xyes; then
+       AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
+    fi
+    AM_CONDITIONAL(KDRIVE_EVDEV, test x$KDRIVE_EVDEV = xyes)
+    if test x$KDRIVE_EVDEV = xyes; then
+       AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
+    fi
+    AM_CONDITIONAL(KDRIVE_MOUSE, test x$KDRIVE_MOUSE = xyes)
+    if test x$KDRIVE_MOUSE = xyes; then
+       AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
+    fi
+
     XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xfont xau xdmcp"
     if test "x$XV" = xyes; then
         XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 2f4e632..c7bfb5b 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -40,6 +40,11 @@ extern Bool noGlxVisualInit;
 #endif
 extern Bool   ephyrNoXV;
 
+#ifdef KDRIVE_EVDEV
+extern KdPointerDriver	LinuxEvdevMouseDriver;
+extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
+#endif
+
 void processScreenArg (char *screen_size, char *parent_id) ;
 
 void
@@ -62,11 +67,11 @@ InitInput (int argc, char **argv)
   KdPointerInfo *pi;
 
   KdAddKeyboardDriver(&EphyrKeyboardDriver);
-#ifdef linux
+#ifdef KDRIVE_EVDEV
   KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
 #endif
   KdAddPointerDriver(&EphyrMouseDriver);
-#ifdef linux
+#ifdef KDRIVE_EVDEV
   KdAddPointerDriver(&LinuxEvdevMouseDriver);
 #endif
 
diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am
index 13df142..2f89b8f 100644
--- a/hw/kdrive/linux/Makefile.am
+++ b/hw/kdrive/linux/Makefile.am
@@ -6,19 +6,22 @@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H
 
 noinst_LTLIBRARIES = liblinux.la
 
-if TSLIB
-TSLIB_C = tslib.c
+liblinux_la_SOURCES =
+
+liblinux_la_SOURCES += linux.c klinux.h
+
+if KDRIVE_KBD
+liblinux_la_SOURCES += keyboard.c
+endif
+
+if KDRIVE_EVDEV
+liblinux_la_SOURCES += evdev.c
 endif
 
-KDRIVE_HW_SOURCES =	\
-	evdev.c		\
-	keyboard.c	\
-	linux.c
-
-liblinux_la_SOURCES = 	\
-	bus.c		\
-	mouse.c		\
-	ms.c		\
-	ps2.c		\
-	$(KDRIVE_HW_SOURCES) \
-	$(TSLIB_C)
+if KDRIVE_MOUSE
+liblinux_la_SOURCES += mouse.c bus.c ms.c ps2.c
+endif
+
+if TSLIB
+liblinux_la_SOURCES += tslib.c
+endif
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index e56ffb4..9863c14 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -33,6 +33,22 @@
 #include <X11/keysym.h>
 #include <linux/apm_bios.h>
 
+#ifdef KDRIVE_MOUSE
+extern KdPointerDriver	LinuxMouseDriver;
+extern KdPointerDriver	Ps2MouseDriver;
+extern KdPointerDriver	MsMouseDriver;
+#endif
+#ifdef TSLIB
+extern KdPointerDriver	TsDriver;
+#endif
+#ifdef KDRIVE_EVDEV
+extern KdPointerDriver	LinuxEvdevMouseDriver;
+extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
+#endif
+#ifdef KDRIVE_KBD
+extern KdKeyboardDriver	LinuxKeyboardDriver;
+#endif
+
 static int  vtno;
 int  LinuxConsoleFd;
 int  LinuxApmFd = -1;
@@ -345,15 +361,21 @@ LinuxFini (void)
 void
 KdOsAddInputDrivers (void)
 {
+#ifdef KDRIVE_MOUSE
     KdAddPointerDriver(&LinuxMouseDriver);
     KdAddPointerDriver(&MsMouseDriver);
     KdAddPointerDriver(&Ps2MouseDriver);
+#endif
 #ifdef TSLIB
     KdAddPointerDriver(&TsDriver);
 #endif
+#ifdef KDRIVE_EVDEV
     KdAddPointerDriver(&LinuxEvdevMouseDriver);
-    KdAddKeyboardDriver(&LinuxKeyboardDriver);
     KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
+#endif
+#ifdef KDRIVE_KBD
+    KdAddKeyboardDriver(&LinuxKeyboardDriver);
+#endif
 }
 
 static void
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 9f8465f..252616a 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -584,20 +584,6 @@ KdRingBell (KdKeyboardInfo      *ki,
             int                 pitch,
             int                 duration);
 
-extern KdPointerDriver	LinuxMouseDriver;
-extern KdPointerDriver	LinuxEvdevMouseDriver;
-extern KdPointerDriver	Ps2MouseDriver;
-extern KdPointerDriver	BusMouseDriver;
-extern KdPointerDriver	MsMouseDriver;
-extern KdPointerDriver	TsDriver;
-extern KdKeyboardDriver	LinuxKeyboardDriver;
-extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
-extern KdOsFuncs	LinuxFuncs;
-
-extern KdPointerDriver	VxWorksMouseDriver;
-extern KdKeyboardDriver	VxWorksKeyboardDriver;
-extern KdOsFuncs	VxWorksFuncs;
-
 /* kmap.c */
 
 #define KD_MAPPED_MODE_REGISTERS    0
diff --git a/include/kdrive-config.h.in b/include/kdrive-config.h.in
index 14efb56..0e54aa1 100644
--- a/include/kdrive-config.h.in
+++ b/include/kdrive-config.h.in
@@ -19,6 +19,15 @@
 /* Support tslib touchscreen abstraction library */
 #undef TSLIB
 
+/* Support KDrive kbd driver */
+#undef KDRIVE_KBD
+
+/* Support KDrive mouse driver */
+#undef KDRIVE_MOUSE
+
+/* Support KDrive evdev driver */
+#undef KDRIVE_EVDEV
+
 /* Verbose debugging output hilarity */
 #undef DEBUG
 
-- 
1.6.3.3



More information about the xorg-devel mailing list