configure.ac 6.57 KB
Newer Older
1 2 3
AC_PREREQ([2.64])

m4_define([libinput_major_version], [0])
Peter Hutterer's avatar
Peter Hutterer committed
4
m4_define([libinput_minor_version], [13])
Jonas Ådahl's avatar
Jonas Ådahl committed
5
m4_define([libinput_micro_version], [0])
6 7 8 9 10
m4_define([libinput_version],
          [libinput_major_version.libinput_minor_version.libinput_micro_version])

AC_INIT([libinput],
        [libinput_version],
Jonas Ådahl's avatar
Jonas Ådahl committed
11
        [https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=libinput_version],
12
        [libinput],
Jonas Ådahl's avatar
Jonas Ådahl committed
13
        [http://www.freedesktop.org/wiki/Software/libinput/])
14 15 16 17 18 19 20 21 22

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])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

23
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
24

25 26 27
# Before making a release, the LIBINPUT_LT_VERSION string should be
# modified.
# The string is of the form C:R:A.
Peter Hutterer's avatar
Peter Hutterer committed
28 29 30 31 32 33
# 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
Peter Hutterer's avatar
Peter Hutterer committed
34
LIBINPUT_LT_VERSION=10:1:0
35 36
AC_SUBST(LIBINPUT_LT_VERSION)

37
AM_SILENT_RULES([yes])
38
AC_USE_SYSTEM_EXTENSIONS
39 40

# Check for programs
Peter Hutterer's avatar
Peter Hutterer committed
41
AC_PROG_CC_C99
42
AC_PROG_CXX # Only used by build C++ test
43
AC_PROG_GREP
44 45 46 47 48

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT

49 50 51
AC_CHECK_DECL(EPOLL_CLOEXEC, [],
	      [AC_MSG_ERROR("EPOLL_CLOEXEC is needed to compile libinput")],
	      [[#include <sys/epoll.h>]])
52 53 54 55 56 57 58 59 60
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>]])

PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0])
61
PKG_CHECK_MODULES(LIBUDEV, [libudev])
Peter Hutterer's avatar
Peter Hutterer committed
62
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
63
AC_CHECK_LIB([m], [atan2])
Peter Hutterer's avatar
Peter Hutterer committed
64
AC_CHECK_LIB([rt], [clock_gettime])
65 66

if test "x$GCC" = "xyes"; then
67 68
	GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden"
	GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes"
69 70
fi
AC_SUBST(GCC_CFLAGS)
71
AC_SUBST(GCC_CXXFLAGS)
72

73 74 75 76 77 78 79 80 81 82 83 84 85
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)

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
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
134 135
fi

136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
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
AM_CONDITIONAL(BUILD_EVENTGUI, [test "x$build_eventgui" = "xyes"])

151
AC_ARG_ENABLE(tests,
Peter Hutterer's avatar
Peter Hutterer committed
152
	      AS_HELP_STRING([--enable-tests], [Build the tests (default=auto)]),
153
	      [build_tests="$enableval"],
Peter Hutterer's avatar
Peter Hutterer committed
154 155
	      [build_tests="auto"])

156
PKG_CHECK_MODULES(CHECK, [check >= 0.9.10], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
Peter Hutterer's avatar
Peter Hutterer committed
157 158

if test "x$build_tests" = "xauto"; then
159
	build_tests="$HAVE_CHECK"
Peter Hutterer's avatar
Peter Hutterer committed
160
fi
161 162 163 164 165 166
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])
Peter Hutterer's avatar
Peter Hutterer committed
167
fi
168

169
AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
170
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
171
AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
172

173
AC_CONFIG_FILES([Makefile
174 175
		 doc/Makefile
		 doc/libinput.doxygen
176 177
		 src/Makefile
		 src/libinput.pc
178
		 src/libinput-version.h
179
		 test/Makefile
180 181
		 tools/Makefile
		 udev/Makefile])
182 183
AC_CONFIG_FILES([test/symbols-leak-test],
		[chmod +x test/symbols-leak-test])
184
AC_OUTPUT
185 186 187

AC_MSG_RESULT([
	Prefix			${prefix}
188
	udev base dir		${UDEV_DIR}
189

190
	Build documentation	${build_documentation}
191 192 193 194
	Build tests		${build_tests}
	Tests use valgrind	${VALGRIND}
	Build GUI event tool	${build_eventgui}
	])