2013-11-10 17:55:40 +01:00
AC_PREREQ([2.64])
2015-08-26 10:43:07 +10:00
m4_define([libinput_major_version], [1])
2017-01-20 08:29:28 +10:00
m4_define([libinput_minor_version], [6])
m4_define([libinput_micro_version], [0])
2013-11-10 17:55:40 +01:00
m4_define([libinput_version],
[libinput_major_version.libinput_minor_version.libinput_micro_version])
AC_INIT([libinput],
[libinput_version],
2014-02-26 19:54:27 +01:00
[https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=libinput_version],
2013-11-10 17:55:40 +01:00
[libinput],
2014-02-26 19:54:27 +01:00
[http://www.freedesktop.org/wiki/Software/libinput/])
2013-11-10 17:55:40 +01:00
AC_SUBST([LIBINPUT_VERSION_MAJOR], [libinput_major_version])
AC_SUBST([LIBINPUT_VERSION_MINOR], [libinput_minor_version])
AC_SUBST([LIBINPUT_VERSION_MICRO], [libinput_micro_version])
AC_SUBST([LIBINPUT_VERSION], [libinput_version])
2016-04-27 11:32:02 +10:00
AC_DEFINE([LIBINPUT_VERSION_MAJOR], [libinput_major_version], "libinput major version number")
AC_DEFINE([LIBINPUT_VERSION_MINOR], [libinput_minor_version], "libinput minor version number")
AC_DEFINE([LIBINPUT_VERSION_MICRO], [libinput_micro_version], "libinput micro version number")
2013-11-10 17:55:40 +01:00
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
2014-12-05 12:52:22 +10:00
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
2013-11-10 17:55:40 +01:00
2014-05-22 08:06:25 +02:00
# Before making a release, the LIBINPUT_LT_VERSION string should be
# modified.
# The string is of the form C:R:A.
2015-03-04 09:27:37 +10:00
# a) If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0. DO NOT DO THIS! Use symbol versioning instead and
# do b) instead.
# b) If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
2017-01-20 08:29:28 +10:00
LIBINPUT_LT_VERSION=21:2:11
2014-05-22 08:06:25 +02:00
AC_SUBST(LIBINPUT_LT_VERSION)
2013-11-10 17:55:40 +01:00
AM_SILENT_RULES([yes])
2015-02-02 10:47:52 +10:00
AC_USE_SYSTEM_EXTENSIONS
2013-11-10 17:55:40 +01:00
# Check for programs
2013-12-06 14:52:38 +10:00
AC_PROG_CC_C99
2014-03-29 14:39:42 +01:00
AC_PROG_CXX # Only used by build C++ test
2014-12-18 10:49:59 -08:00
AC_PROG_GREP
2013-11-10 17:55:40 +01:00
2016-09-13 16:57:25 +10:00
# Only used for testing the hwdb
AM_PATH_PYTHON([3.0],, [:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
2013-11-10 17:55:40 +01:00
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT
2013-11-17 11:19:50 +01:00
AC_CHECK_DECL(EPOLL_CLOEXEC, [],
[AC_MSG_ERROR("EPOLL_CLOEXEC is needed to compile libinput")],
[[#include <sys/epoll.h>]])
2013-11-10 17:55:40 +01:00
AC_CHECK_DECL(TFD_CLOEXEC,[],
[AC_MSG_ERROR("TFD_CLOEXEC is needed to compile libinput")],
[[#include <sys/timerfd.h>]])
AC_CHECK_DECL(CLOCK_MONOTONIC,[],
[AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile libinput")],
[[#include <time.h>]])
2016-05-16 11:33:38 +10:00
AC_CHECK_DECL(static_assert, [],
[AC_DEFINE(static_assert(...), [/* */], [noop static_assert() replacement]),
AC_MSG_RESULT([no])],
[[#include <assert.h>]])
2013-11-10 17:55:40 +01:00
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0])
2013-12-09 16:21:06 +10:00
PKG_CHECK_MODULES(LIBUDEV, [libudev])
2017-01-16 10:23:59 +10:00
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
2015-08-05 11:28:43 +08:00
2014-07-03 09:29:22 +10:00
AC_CHECK_LIB([m], [atan2])
2014-07-03 09:30:40 +10:00
AC_CHECK_LIB([rt], [clock_gettime])
2013-11-10 17:55:40 +01:00
if test "x$GCC" = "xyes"; then
2014-06-06 09:38:35 +10:00
GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden"
GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes"
2013-11-10 17:55:40 +01:00
fi
AC_SUBST(GCC_CFLAGS)
2014-06-06 09:38:35 +10:00
AC_SUBST(GCC_CXXFLAGS)
2013-11-10 17:55:40 +01:00
2016-11-14 10:04:12 +10:00
######################
# udev configuration #
######################
2015-02-10 14:23:32 +10:00
udev_dir_default="$libdir/udev"
AC_ARG_WITH(udev-dir,
AS_HELP_STRING([--with-udev-dir=DIR],
[udev base directory [[default=$udev_dir_default]]]),
[],
[with_udev_dir="yes"])
AS_CASE($with_udev_dir,
[no|""], [AC_MSG_ERROR([You must define a udev base directory])],
[yes], [udevdir="$udev_dir_default"],
[udevdir="$with_udev_dir"])
UDEV_DIR=${udevdir}
AC_SUBST(UDEV_DIR)
2016-11-14 10:04:12 +10:00
################################
# enable/disable documentation #
################################
2014-12-18 10:49:59 -08:00
AC_ARG_ENABLE([documentation],
[AC_HELP_STRING([--enable-documentation],
[Enable building the documentation (default=auto)])],
[build_documentation="$enableval"],
[build_documentation="auto"])
if test "x$build_documentation" = "xyes" -o "x$build_documentation" = "xauto"; then
AC_PATH_PROG(DOXYGEN, doxygen)
if test "x$DOXYGEN" = "x"; then
if test "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
fi
else
AC_MSG_CHECKING([for compatible doxygen version])
doxygen_version=`$DOXYGEN --version`
AS_VERSION_COMPARE([$doxygen_version], [1.6.0],
[AC_MSG_RESULT([no])
DOXYGEN=""],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])])
if test "x$DOXYGEN" = "x" -a "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation])
fi
fi
AC_PATH_PROG(DOT, dot)
if test "x$DOT" = "x"; then
if test "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation])
fi
else
AC_MSG_CHECKING([for compatible dot version])
dot_version=`$DOT -V 2>&1|$GREP -oP '(?<=version\W)@<:@0-9.@:>@*(?=\W(.*))'`
AS_VERSION_COMPARE([$dot_version], [2.26.0],
[AC_MSG_RESULT([no])
DOT=""],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])])
if test "x$DOT" = "x" -a "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation])
fi
fi
if test "x$DOXYGEN" != "x" -a "x$DOT" != "x"; then
build_documentation="yes"
else
build_documentation="no"
fi
2014-12-18 10:49:58 -08:00
fi
2016-11-14 10:04:12 +10:00
###########################################
# enable/disable event gui debugging tool #
###########################################
2014-05-27 15:29:55 +10:00
AC_ARG_ENABLE(event-gui,
AS_HELP_STRING([--enable-event-gui], [Build the GUI event viewer (default=auto)]),
[build_eventgui="$enableval"],
[build_eventgui="auto"])
PKG_CHECK_EXISTS([cairo glib-2.0 gtk+-3.0], [HAVE_GUILIBS="yes"], [HAVE_GUILIBS="no"])
if test "x$build_eventgui" = "xauto"; then
build_eventgui="$HAVE_GUILIBS"
fi
if test "x$build_eventgui" = "xyes"; then
PKG_CHECK_MODULES(CAIRO, [cairo])
PKG_CHECK_MODULES(GTK, [glib-2.0 gtk+-3.0])
fi
2016-11-14 10:04:12 +10:00
########################
# enable/disable tests #
########################
2013-12-06 14:17:35 +10:00
AC_ARG_ENABLE(tests,
Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.
The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.
Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.
For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.
check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.
litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);
adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
"foo:bar", "trackpoint"
"foo:bar", "clickpad"
...
Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).
The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 15:02:11 +10:00
AS_HELP_STRING([--enable-tests], [Build the tests (default=auto)]),
2013-12-06 14:17:35 +10:00
[build_tests="$enableval"],
Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.
The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.
Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.
For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.
check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.
litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);
adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
"foo:bar", "trackpoint"
"foo:bar", "clickpad"
...
Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).
The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 15:02:11 +10:00
[build_tests="auto"])
2014-09-10 01:32:24 +02:00
PKG_CHECK_MODULES(CHECK, [check >= 0.9.10], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.
The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.
Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.
For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.
check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.
litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);
adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
"foo:bar", "trackpoint"
"foo:bar", "clickpad"
...
Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).
The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 15:02:11 +10:00
if test "x$build_tests" = "xauto"; then
2014-05-27 13:47:58 +10:00
build_tests="$HAVE_CHECK"
Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.
The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.
Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.
For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.
check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.
litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);
adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
"foo:bar", "trackpoint"
"foo:bar", "clickpad"
...
Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).
The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 15:02:11 +10:00
fi
2014-03-27 11:04:24 +10:00
if test "x$build_tests" = "xyes"; then
if test "x$HAVE_CHECK" = "xno"; then
AC_MSG_ERROR([Cannot build tests, check is missing])
fi
AC_PATH_PROG(VALGRIND, [valgrind])
2016-05-10 15:34:09 +10:00
AC_ARG_WITH(libunwind,
AS_HELP_STRING([--without-libunwind],[Do not use libunwind]))
AS_IF([test "x$with_libunwind" != "xno"],
[PKG_CHECK_MODULES(LIBUNWIND,
[libunwind],
[HAVE_LIBUNWIND=yes],
[HAVE_LIBUNWIND=no])],
[HAVE_LIBUNWIND=no])
AS_IF([test "x$HAVE_LIBUNWIND" = "xyes"],
[AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])],
[AS_IF([test "x$with_libunwind" = "xyes"],
[AC_MSG_ERROR([libunwind requested but not found])])])
AC_PATH_PROG(ADDR2LINE, [addr2line])
if test "x$ADDR2LINE" != "x"; then
AC_DEFINE_UNQUOTED(HAVE_ADDR2LINE, 1, [addr2line found])
AC_DEFINE_UNQUOTED(ADDR2LINE, ["$ADDR2LINE"], [Path to addr2line])
fi
Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.
The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.
Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.
For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.
check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.
litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);
adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
"foo:bar", "trackpoint"
"foo:bar", "clickpad"
...
Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).
The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 15:02:11 +10:00
fi
2013-12-06 14:17:35 +10:00
2016-11-14 09:35:56 +10:00
AC_ARG_ENABLE(test-run,
AS_HELP_STRING([--enable-test-run], [For internal use only]),
[run_tests="$enableval"],
[run_tests="yes"])
2016-11-14 10:05:41 +10:00
# Used by the udev rules so we can use callouts during testing without
# installing everything first. Default is the empty string so the installed
# rule will use udev's default path. Override is in udev/Makefile.am
AC_SUBST(UDEV_TEST_PATH, "")
AC_PATH_PROG(SED, [sed])
2016-11-14 10:04:12 +10:00
###########################
# enable/disable libwacom #
###########################
2016-11-14 09:35:56 +10:00
2015-02-19 12:56:43 +10:00
AC_ARG_ENABLE(libwacom,
AS_HELP_STRING([--enable-libwacom],
[Use libwacom for tablet identification (default=enabled)]),
[use_libwacom="$enableval"],
[use_libwacom="yes"])
if test "x$use_libwacom" = "xyes"; then
2015-03-10 12:40:14 +10:00
PKG_CHECK_MODULES(LIBWACOM, [libwacom >= 0.12], [HAVE_LIBWACOM="yes"])
2015-02-19 12:56:43 +10:00
AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom])
2016-07-18 16:06:28 +10:00
OLD_LIBS=$LIBS
OLD_CFLAGS=$CFLAGS
LIBS="$LIBS $LIBWACOM_LIBS"
CFLAGS="$CFLAGS $LIBWACOM_CFLAGS"
AC_MSG_CHECKING([if libwacom_get_paired_device is available])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libwacom/libwacom.h>]],
[[libwacom_get_paired_device(NULL)]])],
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LIBWACOM_GET_PAIRED_DEVICE, [1],
[libwacom_get_paired_device() is available])
[libwacom_have_get_paired_device=yes]],
[AC_MSG_RESULT([no])
[libwacom_have_get_paired_device=no]])
LIBS=$OLD_LIBS
CFLAGS=$OLD_CFLAGS
2015-02-19 12:56:43 +10:00
fi
2016-11-14 09:51:46 +10:00
2016-07-18 16:06:28 +10:00
AM_CONDITIONAL(HAVE_LIBWACOM_GET_PAIRED_DEVICE,
[test "x$libwacom_have_get_paired_device" == "xyes"])
2014-03-27 11:04:24 +10:00
AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
2013-12-06 14:17:35 +10:00
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
2016-11-14 09:35:56 +10:00
AM_CONDITIONAL(RUN_TESTS, [test "x$run_tests" = "xyes"])
2014-12-18 10:49:59 -08:00
AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
2016-11-14 09:51:46 +10:00
AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes])
AM_CONDITIONAL(BUILD_EVENTGUI, [test "x$build_eventgui" = "xyes"])
2013-12-06 14:17:35 +10:00
2017-01-05 15:21:24 +10:00
#######################
# enable/disable gcov #
#######################
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[Enable to enable coverage testing (default:disabled)])],
[enable_gcov="$enableval"],
[enable_gcov=no])
if test "x$enable_gcov" != "xno"; then
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
enable_gcov=yes
fi
AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
AC_SUBST([GCOV_CFLAGS])
AC_SUBST([GCOV_LDFLAGS])
2013-11-10 17:55:40 +01:00
AC_CONFIG_FILES([Makefile
2013-12-06 09:58:00 +10:00
doc/Makefile
doc/libinput.doxygen
2013-11-10 17:55:40 +01:00
src/Makefile
src/libinput.pc
2016-08-26 13:48:17 -05:00
src/libinput-uninstalled.pc
2013-12-06 14:17:35 +10:00
src/libinput-version.h
2014-01-28 11:25:40 +10:00
test/Makefile
2015-02-10 14:23:32 +10:00
tools/Makefile
2015-07-01 10:17:48 +10:00
udev/Makefile
udev/80-libinput-device-groups.rules
udev/90-libinput-model-quirks.rules])
2015-02-12 09:25:36 -05:00
AC_CONFIG_FILES([test/symbols-leak-test],
[chmod +x test/symbols-leak-test])
2013-11-10 17:55:40 +01:00
AC_OUTPUT
2014-07-03 10:52:40 +10:00
AC_MSG_RESULT([
Prefix ${prefix}
2015-02-10 14:23:32 +10:00
udev base dir ${UDEV_DIR}
2014-07-03 10:52:40 +10:00
2015-02-19 12:56:43 +10:00
libwacom enabled ${use_libwacom}
2014-12-18 10:49:59 -08:00
Build documentation ${build_documentation}
2014-07-03 10:52:40 +10:00
Build tests ${build_tests}
Tests use valgrind ${VALGRIND}
2015-05-04 09:13:22 +10:00
Tests use libunwind ${HAVE_LIBUNWIND}
2014-07-03 10:52:40 +10:00
Build GUI event tool ${build_eventgui}
2017-01-05 15:21:24 +10:00
Enable gcov profiling ${enable_gcov}
2014-07-03 10:52:40 +10:00
])