[PATCH input-acecad 3/7] config: simplify configuration regarding sysfs headers and library.

Gaetan Nadon memsize at videotron.ca
Mon Apr 12 14:10:59 PDT 2010


Replace deprecated AC_HEADER_CHECK with AC_CHECK_HEADERS
AC_CHECK_LIB ensures sysfs library is present and adds -lsysfs
AC_CHECK_HEADERS verifies sysfs and linux input headers are present

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 configure.ac    |   11 ++---------
 src/Makefile.am |    5 -----
 src/acecad.c    |   22 +++++++++++-----------
 src/acecad.h    |    2 +-
 4 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index fd7d1cc..4d97159 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,17 +61,10 @@ XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto $REQUIRED_MODULES)
 
 # Checks for libraries.
+AC_CHECK_LIB([sysfs], [sysfs_close_bus])
 
 # Checks for header files.
-AC_HEADER_STDC
-AC_HEADER_CHECK([linux/input.h],
-		[AC_DEFINE([LINUX_INPUT], [1], [Using the Linux input subsystem])]
-		)
-AC_CHECK_HEADER(sysfs/libsysfs.h, HAVE_LIBSYSFS=yes, HAVE_LIBSYSFS=no)
-if test x$HAVE_LIBSYSFS = xyes; then
-    AC_DEFINE(LINUX_SYSFS, 1, [Using sysfs to probe devices])
-fi
-AM_CONDITIONAL(HAVE_LIBSYSFS, test x$HAVE_LIBSYSFS = xyes)
+AC_CHECK_HEADERS([linux/input.h sysfs/libsysfs.h])
 
 DRIVER_NAME=acecad
 AC_SUBST([DRIVER_NAME])
diff --git a/src/Makefile.am b/src/Makefile.am
index 8995342..9ec2100 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,11 +29,6 @@ AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
 
 @DRIVER_NAME at _drv_la_LTLIBRARIES = @DRIVER_NAME at _drv.la
 @DRIVER_NAME at _drv_la_LDFLAGS = -module -avoid-version
-
-if HAVE_LIBSYSFS
- at DRIVER_NAME@_drv_la_LIBADD = -lsysfs
-endif
-
 @DRIVER_NAME at _drv_ladir = @inputdir@
 
 @DRIVER_NAME at _drv_la_SOURCES = @DRIVER_NAME at .c @DRIVER_NAME at .h
diff --git a/src/acecad.c b/src/acecad.c
index 2c8c78b..fb031c5 100644
--- a/src/acecad.c
+++ b/src/acecad.c
@@ -41,7 +41,7 @@
  *	Standard Headers
  ****************************************************************************/
 
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
 #include <asm/types.h>
 #include <linux/input.h>
 #ifndef EV_SYN
@@ -71,9 +71,9 @@
 #include <stdio.h>
 
 #include <errno.h>
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
 #include <fcntl.h>
-#ifdef LINUX_SYSFS
+#ifdef HAVE_SYSFS_LIBSYSFS_H
 #include <sysfs/libsysfs.h>
 #include <dlfcn.h>
 #endif
@@ -169,7 +169,7 @@ static const char *default_options[] =
 	NULL
 };
 
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
 static int
 IsUSBLine(int fd)
 {
@@ -210,7 +210,7 @@ fd_query_acecad(int fd, char *ace_name) {
 
 static char ace_name_default[7] = "acecad";
 
-#ifdef LINUX_SYSFS
+#ifdef HAVE_SYSFS_LIBSYSFS_H
 static char usb_bus_name[4] = "usb";
 static char acecad_driver_name[11] = "usb_acecad";
 #endif
@@ -227,7 +227,7 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb)
     char fname[EV_DEV_NAME_MAXLEN];
     int np;
 
-#ifdef LINUX_SYSFS
+#ifdef HAVE_SYSFS_LIBSYSFS_H
     struct sysfs_bus *usb_bus = NULL;
     struct sysfs_driver *acecad_driver = NULL;
     struct sysfs_device *candidate = NULL;
@@ -369,7 +369,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 
     s = xf86FindOptionValue(local->options, "Device");
     if (!s || (s && (xf86NameCmp(s, "auto-dev") == 0))) {
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
         priv->flags |= AUTODEV_FLAG;
         if (!AceCadAutoDevProbe(local, 0))
         {
@@ -390,7 +390,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
     }
     xf86ErrorFVerb( 6, "tty port opened successfully\n" );
 
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
     if (IsUSBLine(local->fd)) {
         priv->flags |= USB_FLAG;
 
@@ -537,7 +537,7 @@ DeviceOn (DeviceIntPtr dev)
     {
         xf86Msg(X_WARNING, "%s: cannot open input device %s: %s\n", local->name, xf86FindOptionValue(local->options, "Device"), strerror(errno));
         priv->flags &= ~AVAIL_FLAG;
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
         if ((priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4))
             local->fd = xf86OpenSerial(local->options);
         if (local->fd == -1)
@@ -854,7 +854,7 @@ ReadInput (LocalDevicePtr local)
     /*xf86Msg(X_INFO, "ACECAD Tablet Sortie Read Input\n");*/
 }
 
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
 #define set_bit(byte,nb,bit)	(bit ? byte | (1<<nb) : byte & (~(1<<nb)))
 static void
 USBReadInput (LocalDevicePtr local)
@@ -1103,7 +1103,7 @@ QueryHardware (AceCadPrivatePtr priv)
 #define OFF(x)  ((x)%BITS_PER_LONG)
 #define LONG(x) ((x)/BITS_PER_LONG)
 
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
 static Bool
 USBQueryHardware (LocalDevicePtr local)
 {
diff --git a/src/acecad.h b/src/acecad.h
index c4befb9..fc06348 100644
--- a/src/acecad.h
+++ b/src/acecad.h
@@ -108,7 +108,7 @@ static Bool QueryHardware (AceCadPrivatePtr);
 static void NewPacket (AceCadPrivatePtr priv);
 static Bool AceCadGetPacket (AceCadPrivatePtr);
 static InputInfoPtr AceCadPreInit(InputDriverPtr, IDevPtr , int);
-#ifdef LINUX_INPUT
+#ifdef HAVE_LINUX_INPUT_H
 static void USBReadInput (LocalDevicePtr);
 static Bool USBQueryHardware (LocalDevicePtr);
 static int IsUSBLine(int);
-- 
1.6.0.4



More information about the xorg-devel mailing list