test: automatically run the tests against valgrind for leaks
[platform/upstream/libinput.git] / configure.ac
1 AC_PREREQ([2.64])
2
3 m4_define([libinput_major_version], [0])
4 m4_define([libinput_minor_version], [1])
5 m4_define([libinput_micro_version], [0])
6 m4_define([libinput_version],
7           [libinput_major_version.libinput_minor_version.libinput_micro_version])
8
9 AC_INIT([libinput],
10         [libinput_version],
11         [https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=libinput_version],
12         [libinput],
13         [http://www.freedesktop.org/wiki/Software/libinput/])
14
15 AC_SUBST([LIBINPUT_VERSION_MAJOR], [libinput_major_version])
16 AC_SUBST([LIBINPUT_VERSION_MINOR], [libinput_minor_version])
17 AC_SUBST([LIBINPUT_VERSION_MICRO], [libinput_micro_version])
18 AC_SUBST([LIBINPUT_VERSION], [libinput_version])
19
20 AC_CONFIG_HEADERS([config.h])
21 AC_CONFIG_MACRO_DIR([m4])
22
23 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
24
25 AM_SILENT_RULES([yes])
26
27 # Check for programs
28 AC_PROG_CC_C99
29 AC_PROG_CXX # Only used by build C++ test
30
31 # Initialize libtool
32 LT_PREREQ([2.2])
33 LT_INIT
34
35 AC_CHECK_DECL(EPOLL_CLOEXEC, [],
36               [AC_MSG_ERROR("EPOLL_CLOEXEC is needed to compile libinput")],
37               [[#include <sys/epoll.h>]])
38 AC_CHECK_DECL(TFD_CLOEXEC,[],
39               [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile libinput")],
40               [[#include <sys/timerfd.h>]])
41 AC_CHECK_DECL(CLOCK_MONOTONIC,[],
42               [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile libinput")],
43               [[#include <time.h>]])
44
45 PKG_PROG_PKG_CONFIG()
46 PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0])
47 PKG_CHECK_MODULES(LIBUDEV, [libudev])
48 PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
49
50 if test "x$GCC" = "xyes"; then
51         GCC_CFLAGS="-Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
52 fi
53 AC_SUBST(GCC_CFLAGS)
54
55 AC_PATH_PROG(DOXYGEN, [doxygen])
56 if test "x$DOXYGEN" = "x"; then
57         AC_MSG_WARN([doxygen not found - required for documentation])
58         have_doxygen="no"
59 else
60         have_doxygen="yes"
61 fi
62 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
63
64 AC_ARG_ENABLE(tests,
65               AS_HELP_STRING([--enable-tests], [Build the tests (default=auto)]),
66               [build_tests="$enableval"],
67               [build_tests="auto"])
68
69 PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
70
71 if test "x$build_tests" = "xauto"; then
72         if test "x$HAVE_CHECK" = "xyes"; then
73                 build_tests="yes"
74         fi
75 fi
76 if test "x$build_tests" = "xyes"; then
77         if test "x$HAVE_CHECK" = "xno"; then
78                 AC_MSG_ERROR([Cannot build tests, check is missing])
79         fi
80
81         AC_PATH_PROG(VALGRIND, [valgrind])
82 fi
83
84 AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
85 AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
86
87 AC_CONFIG_FILES([Makefile
88                  doc/Makefile
89                  doc/libinput.doxygen
90                  src/Makefile
91                  src/libinput.pc
92                  src/libinput-version.h
93                  test/Makefile
94                  tools/Makefile])
95 AC_OUTPUT