| 1 |
# Autoconf macros for xdvik. |
| 2 |
# Copyright (C) 2014 Paul Vojta <[email protected]> |
| 3 |
# |
| 4 |
# This file is free software; the copyright holder |
| 5 |
# gives unlimited permission to copy and/or distribute it, |
| 6 |
# with or without modifications, as long as this notice is preserved. |
| 7 |
|
| 8 |
# XDVI_XINPUT_2_1 |
| 9 |
# --------------- |
| 10 |
# Check for whether XInput version 2.1 is supported in the X libraries. |
| 11 |
|
| 12 |
dnl ### Check for XInput 2.1 functionality. |
| 13 |
AC_DEFUN([XDVI_XINPUT_2_1], [dnl |
| 14 |
AC_ARG_ENABLE([xi2-scrolling], |
| 15 |
AS_HELP_STRING([--enable-xi2-scrolling], |
| 16 |
[Use XInput 2.1 'smooth scrolling' if available (default: disabled |
| 17 |
for native TL build)])) |
| 18 |
AS_CASE([$enable_xi2_scrolling], |
| 19 |
[yes | no], [:], |
| 20 |
[AS_IF([test "x$enable_native_texlive_build" = xyes], |
| 21 |
[enable_xi2_scrolling=no], |
| 22 |
[enable_xi2_scrolling=yes])]) |
| 23 |
if test "x$enable_xi2_scrolling" = xyes; then |
| 24 |
AC_CACHE_CHECK([for XInput version 2.1 or higher], |
| 25 |
[xdvi_cv_xinput_2_1], [dnl |
| 26 |
xdvi_xi2_save_LIBS=$LIBS |
| 27 |
xdvi_xi2_save_CFLAGS=$CFLAGS |
| 28 |
xdvi_xi2_save_CPPFLAGS=$CPPFLAGS |
| 29 |
xdvi_xi2_save_LDFLAGS=$LDFLAGS |
| 30 |
LIBS="$X_PRE_LIBS -lXi $X_EXTRA_LIBS $LIBS" |
| 31 |
CFLAGS="$X_CFLAGS $CFLAGS" |
| 32 |
CPPFLAGS="$X_CFLAGS $CPPFLAGS" |
| 33 |
LDFLAGS="$X_LIBS $LDFLAGS" |
| 34 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/XInput2.h>]], |
| 35 |
[[Display *DISP; int ndevices; |
| 36 |
XIDeviceInfo *info = XIQueryDevice(DISP, XIAllDevices, &ndevices); |
| 37 |
#if (XI_2_Major < 2 || (XI_2_Major == 2 && XI_2_Minor < 1)) |
| 38 |
choke me "XInput version is < 2.1" |
| 39 |
#endif]])], |
| 40 |
[xdvi_cv_xinput_2_1=yes], |
| 41 |
[xdvi_cv_xinput_2_1=no]) |
| 42 |
LIBS=$xdvi_xi2_save_LIBS |
| 43 |
CFLAGS=$xdvi_xi2_save_CFLAGS |
| 44 |
CPPFLAGS=$xdvi_xi2_save_CPPFLAGS |
| 45 |
LDFLAGS=$xdvi_xi2_save_LDFLAGS]) |
| 46 |
if test "x$xdvi_cv_xinput_2_1" = xyes; then |
| 47 |
AC_DEFINE([HAVE_XI21], 1, |
| 48 |
[Define if your system has XInput version 2.1 or higher.]) |
| 49 |
X_PRE_LIBS="$X_PRE_LIBS -lXi" |
| 50 |
fi |
| 51 |
fi]) |