summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hlusiak <saschahlusiak@arcor.de>2007-12-05 18:00:12 +0100
committerSascha Hlusiak <saschahlusiak@arcor.de>2007-12-05 18:00:12 +0100
commit37aae4731320d4e1301f17a065bc5f1d5a3d1596 (patch)
tree88f466598137d9c41ef025895dd25abf6ec57e57
parentf581e2b0daf6c79c74728ab2e21a0836ff252a65 (diff)
configure.ac: Checking for available kernel backends instead of OS
The configure script now checks for availability of several backends like Linux's joystick, Linux's evdev, BSD's usbhid. This way several backends can be compiled in and used with the same binary module. Backend selection code still missing!
-rw-r--r--configure.ac55
-rw-r--r--src/Makefile.am9
-rw-r--r--src/evdev_jstk.c30
3 files changed, 73 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index a4fd447..6b1b489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,24 +44,6 @@ AC_PROG_CC
AH_TOP([#include "xorg-server.h"])
-case $host_os in
- linux*)
- IS_LINUX="yes"
- ;;
-
- freebsd* | kfreebsd-gnu* | netbsd* | openbsd*)
- IS_BSD="yes"
- ;;
-
- *)
- AC_MSG_ERROR([Your operating system is not supported by the joystick
- driver. Contact xorg@lists.freedesktop.org if you are
- interested in porting it.])
- ;;
-esac
-AM_CONDITIONAL(LINUX, [test "x$IS_LINUX" = xyes])
-AM_CONDITIONAL(BSD, [test "x$IS_BSD" = xyes])
-
AC_ARG_WITH(xorg-module-dir,
AC_HELP_STRING([--with-xorg-module-dir=DIR],
[Default xorg module directory
@@ -78,7 +60,7 @@ if test "x$DEBUGGING" = xyes; then
else
AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi
-AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
+AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
inputdir=${moduledir}/input
AC_SUBST(inputdir)
@@ -99,9 +81,44 @@ AC_SUBST([CFLAGS])
# Checks for libraries.
# Checks for header files.
+linux_backend=yes
+AC_CHECK_HEADERS([linux/joystick.h],, [linux_backend=no])
+AM_CONDITIONAL(LINUX_BACKEND, [test "x$linux_backend" = xyes])
+if test "x$linux_backend" = xyes; then
+ AC_DEFINE(LINUX_BACKEND, 1, [Compile Linux joystick backend])
+fi
+
+bsd_backend=yes
+AC_CHECK_HEADERS([usbhid.h dev/usb/usb.h dev/usb/usbhid.h],, [bsd_backend=no])
+AC_CHECK_LIB([usbhid],[hid_get_item],, [bsd_backend=no])
+AM_CONDITIONAL(BSD_BACKEND, [test "x$bsd_backend" = xyes])
+if test "x$bsd_backend" = xyes; then
+ AC_DEFINE(BSD_BACKEND, 1, [Compile BSD usbhid backend])
+fi
+
+evdev_backend=yes
+AC_CHECK_HEADERS([linux/input.h],, [evdev_backend=no])
+AM_CONDITIONAL(EVDEV_BACKEND, [test "x$evdev_backend" = xyes])
+if test "x$evdev_backend" = xyes; then
+ AC_DEFINE(EVDEV_BACKEND, 1, [Compile Linux evdev backend])
+fi
+
AC_HEADER_STDC
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
AC_OUTPUT([Makefile src/Makefile man/Makefile])
+
+echo
+echo Building linux joystick backend: $linux_backend
+echo Building evdev backend: $evdev_backend
+echo Building BSD backend: $bsd_backend
+
+if test "x$linux_backend" != "xyes" -a \
+ "x$bsd_backend" != "xyes" -a \
+ "x$evdev_backend" != "xyes"; then
+ AC_MSG_ERROR([No backends were found. Your operating is not supported by the
+ joystick driver. Contact xorg@lists.freedesktop.org if you are
+ interested in porting it.])
+fi
diff --git a/src/Makefile.am b/src/Makefile.am
index d9fc76a..fd417b4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,14 +36,19 @@
BSD_SRCS = bsd_jstk.c
LINUX_SRCS = linux_jstk.c
+EVDEV_SRCS = evdev_jstk.c
-if BSD
+if BSD_BACKEND
@DRIVER_NAME@_drv_la_SOURCES += $(BSD_SRCS)
@DRIVER_NAME@_drv_la_LDFLAGS += -lusbhid
endif
-if LINUX
+if LINUX_BACKEND
@DRIVER_NAME@_drv_la_SOURCES += $(LINUX_SRCS)
endif
+if EVDEV_BACKEND
+@DRIVER_NAME@_drv_la_SOURCES += $(EVDEV_SRCS)
+endif
+
EXTRA_DIST = $(BSD_SRCS) $(LINUX_SRCS)
diff --git a/src/evdev_jstk.c b/src/evdev_jstk.c
new file mode 100644
index 0000000..67e8c5d
--- /dev/null
+++ b/src/evdev_jstk.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2007 by Sascha Hlusiak. <saschahlusiak@freedesktop.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Sascha Hlusiak not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Sascha Hlusiak makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * SASCHA HLUSIAK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL SASCHA HLUSIAK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/**
+ * This provides the backend for Linux evdev devices.
+ * Devices are usually /dev/input/event?
+ **/
+
+/* NOTE: IMPLEMENTATION NEEDED */
+