[PATCH:xf86-input-keyboard 21/21] Add some NetBSD feature detection code.
Thomas Klausner
wiz at NetBSD.org
Sat Jul 27 00:45:20 PDT 2013
On Fri, Jul 26, 2013 at 06:40:08PM -0700, Alan Coopersmith wrote:
> On 07/26/13 02:24 PM, Thomas Klausner wrote:
> >+case $host_os in
> >+ netbsd*)
> >+ case $host in
> >+ *i386*|*x86_64*)
> >+ OS_FLAGS="$OS_FLAGS -DPCVT_SUPPORT"
> >+ ;;
> >+ *powerpc-*|*sparc-*|*sparc64-*|*vax-*)
> >+ OS_FLAGS="$OS_FLAGS -DDEFAULT_TO_WSKBD"
> >+ ;;
> >+ esac
> >+ case "$(uname -m 2>&1)" in
> >+ cats)
> >+ OS_FLAGS="$OS_FLAGS -DPCVT_SUPPORT"
> >+ ;;
> >+ evbarm|sgimips|shark)
> >+ OS_FLAGS="$OS_FLAGS -DDEFAULT_TO_WSKBD"
> >+ ;;
> >+ esac
> >+ OS_FLAGS="$OS_FLAGS -DWSCONS_SUPPORT"
> >+esac
> >+AC_SUBST([OS_FLAGS])
> >+
>
> Is there no way to do that in the same manner for all platforms?
> It's confusing to set the same flags via the autoconf $host for
> some hardware and via uname checks for other hardware.
I understand. I tried to match the NetBSD Makefiles for xsrc, which
set these variables manually per platform or architecture, choosing
what's easier. There are multiple ports to powerpc platforms, for
example, or mips and arm. Only some of the latter support PCVT or
WSKBD.
If I only used the architecture check, I'd have to maintain a list of
powerpc platforms here, which I'd like to avoid.
> At the very least it would be nice to have the two inner sets of case
> statements use the same levels of indentation as each other.
Oops. Updated patch attached.
Thanks,
Thomas
-------------- next part --------------
>From c62f6dff6a6096ac782b66053577d8d119b215ae Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Fri, 26 Jul 2013 23:18:02 +0200
Subject: [PATCH:xf86-input-keyboard 21/21] Add some NetBSD feature detection
code.
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
configure.ac | 23 +++++++++++++++++++++++
src/Makefile.am | 2 +-
src/kbd.c | 8 ++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index c699f6e..892d5c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,29 @@ case $host_os in
porting it.])
;;
esac
+case $host_os in
+ netbsd*)
+ case $host in
+ *i386*|*x86_64*)
+ OS_FLAGS="$OS_FLAGS -DPCVT_SUPPORT"
+ ;;
+ *powerpc-*|*sparc-*|*sparc64-*|*vax-*)
+ OS_FLAGS="$OS_FLAGS -DDEFAULT_TO_WSKBD"
+ ;;
+ esac
+ case "$(uname -m 2>&1)" in
+ cats)
+ OS_FLAGS="$OS_FLAGS -DPCVT_SUPPORT"
+ ;;
+ evbarm|sgimips|shark)
+ OS_FLAGS="$OS_FLAGS -DDEFAULT_TO_WSKBD"
+ ;;
+ esac
+ OS_FLAGS="$OS_FLAGS -DWSCONS_SUPPORT"
+ ;;
+esac
+AC_SUBST([OS_FLAGS])
+
AM_CONDITIONAL(LINUX, [test "x$IS_LINUX" = xyes])
AM_CONDITIONAL(BSD, [test "x$IS_BSD" = xyes])
AM_CONDITIONAL(SOLARIS, [test "x$IS_SOLARIS" = xyes])
diff --git a/src/Makefile.am b/src/Makefile.am
index d5d3ef4..8612c87 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,7 +18,7 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
+AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS) $(OS_FLAGS)
kbd_drv_la_LTLIBRARIES = kbd_drv.la
kbd_drv_la_LDFLAGS = -avoid-version -module
diff --git a/src/kbd.c b/src/kbd.c
index 9a013b7..189adca 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -85,7 +85,15 @@ _X_EXPORT InputDriverRec KEYBOARD = {
};
static const char *kbdDefaults[] = {
+#ifdef __NetBSD__
+#ifdef DEFAULT_TO_WSKBD
+ "Protocol", "wskbd",
+#else
+ "Protocol", "standard",
+#endif
+#else /* NetBSD */
"Protocol", "standard",
+#endif /* NetBSD */
"XkbRules", "base",
"XkbModel", "pc105",
"XkbLayout", "us",
--
1.8.3.3
More information about the xorg-devel
mailing list