From 2cdb4bb00b3e643abe24da83a006629435fb5c5e Mon Sep 17 00:00:00 2001 From: Christoph Brill Date: Mon, 14 Jul 2008 20:43:55 +0200 Subject: Build psmcomm on *BSD systems only. This is the second part of fixing the backend part of synaptics. The new build system is now able to detect whether it's running on *BSD or on Linux and will only build the backends that are available on these platforms. Also it will remove any reference from the built driver to the non-available backends. Thanks to Christian Schmitt for reporting. --- configure.ac | 21 +++++++++++++++++---- src/Makefile.am | 6 +++++- src/psmcomm.c | 4 ---- src/psmcomm.h | 4 ---- src/synaptics.c | 8 ++++++++ src/synproto.h | 8 ++++++++ 6 files changed, 38 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index ad45502..a12c64e 100644 --- a/configure.ac +++ b/configure.ac @@ -44,19 +44,32 @@ AC_PROG_CC AH_TOP([#include "xorg-server.h"]) -AC_MSG_CHECKING([if eventcomm will be built]) +AC_MSG_CHECKING([which optional backends will be build]) case "${host}" in *linux*) - AC_MSG_RESULT([yes]) + AC_MSG_RESULT([eventcomm]) BUILD_EVENTCOMM="yes" + BUILD_PSMCOMM="no" + ;; +*freebsd*) + AC_MSG_RESULT([psmcomm]) + BUILD_EVENTCOMM="no" + BUILD_PSMCOMM="yes" ;; *) - AC_MSG_RESULT([no]) + AC_MSG_RESULT([none]) BUILD_EVENTCOMM="no" + BUILD_PSMCOMM="no" ;; esac AM_CONDITIONAL([BUILD_EVENTCOMM], [test "x${BUILD_EVENTCOMM}" = "xyes"]) - +if test "x${BUILD_EVENTCOMM}" = "xyes" ; then + AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) +fi +AM_CONDITIONAL([BUILD_PSMCOMM], [test "x$BUILD_PSMCOMM}" = "xyes"]) +if test "x${BUILD_PSMCOMM}" = "xyes" ; then + AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) +fi #AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers]) # diff --git a/src/Makefile.am b/src/Makefile.am index 04be371..383bb9a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,7 +31,6 @@ @DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c @DRIVER_NAME@.h \ alpscomm.c alpscomm.h \ ps2comm.c ps2comm.h \ - psmcomm.c psmcomm.h \ synproto.h if BUILD_EVENTCOMM @@ -39,6 +38,11 @@ if BUILD_EVENTCOMM eventcomm.c eventcomm.h endif +if BUILD_PSMCOMM +@DRIVER_NAME@_drv_la_SOURCES += \ + psmcomm.c psmcomm.h +endif + bin_PROGRAMS = \ synclient \ syndaemon diff --git a/src/psmcomm.c b/src/psmcomm.c index a35f5ca..95364ab 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -34,8 +34,6 @@ * Arne Schwabe */ -#if defined(__FreeBSD) || defined(__NetBSD__) || defined(__OpenBSD) - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -181,5 +179,3 @@ struct SynapticsProtocolOperations psm_proto_operations = { PSMReadHwState, PSMAutoDevProbe }; - -#endif diff --git a/src/psmcomm.h b/src/psmcomm.h index 89ca589..d079a12 100644 --- a/src/psmcomm.h +++ b/src/psmcomm.h @@ -22,12 +22,8 @@ #ifndef _PSMCOMM_H_ #define _PSMCOMM_H_ -#if defined(__FreeBSD) || defined(__NetBSD__) || defined(__OpenBSD) - #include #include #include #endif - -#endif /* _PSMCOMM_H_ */ diff --git a/src/synaptics.c b/src/synaptics.c index 93af2c1..f08e8c3 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -177,10 +177,14 @@ SetDeviceAndProtocol(LocalDevicePtr local) str_par = xf86FindOptionValue(local->options, "Protocol"); if (str_par && !strcmp(str_par, "psaux")) { /* Already set up */ +#ifdef BUILD_EVENTCOMM } else if (str_par && !strcmp(str_par, "event")) { proto = SYN_PROTO_EVENT; +#endif /* BUILD_EVENTCOMM */ +#ifdef BUILD_PSMCOMM } else if (str_par && !strcmp(str_par, "psm")) { proto = SYN_PROTO_PSM; +#endif /* BUILD_PSMCOMM */ } else if (str_par && !strcmp(str_par, "alps")) { proto = SYN_PROTO_ALPS; } else { /* default to auto-dev */ @@ -192,12 +196,16 @@ SetDeviceAndProtocol(LocalDevicePtr local) case SYN_PROTO_PSAUX: priv->proto_ops = &psaux_proto_operations; break; +#ifdef BUILD_EVENTCOMM case SYN_PROTO_EVENT: priv->proto_ops = &event_proto_operations; break; +#endif /* BUILD_EVENTCOMM */ +#ifdef BUILD_PSMCOMM case SYN_PROTO_PSM: priv->proto_ops = &psm_proto_operations; break; +#endif /* BUILD_PSMCOMM */ case SYN_PROTO_ALPS: priv->proto_ops = &alps_proto_operations; break; diff --git a/src/synproto.h b/src/synproto.h index f78009f..d5ae8f9 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -75,8 +75,12 @@ struct CommData { enum SynapticsProtocol { SYN_PROTO_PSAUX, /* Raw psaux device */ +#ifdef BUILD_EVENTCOMM SYN_PROTO_EVENT, /* Linux kernel event interface */ +#endif /* BUILD_EVENTCOMM */ +#ifdef BUILD_PSMCOMM SYN_PROTO_PSM, /* FreeBSD psm driver */ +#endif /* BUILD_PSMCOMM */ SYN_PROTO_ALPS /* ALPS touchpad protocol */ }; @@ -95,8 +99,12 @@ struct SynapticsProtocolOperations { }; extern struct SynapticsProtocolOperations psaux_proto_operations; +#ifdef BUILD_EVENTCOMM extern struct SynapticsProtocolOperations event_proto_operations; +#endif /* BUILD_EVENTCOMM */ +#ifdef BUILD_PSMCOMM extern struct SynapticsProtocolOperations psm_proto_operations; +#endif /* BUILD_PSMCOMM */ extern struct SynapticsProtocolOperations alps_proto_operations; -- cgit v1.2.3