configure.ac: AC_INIT: add bug report url
[platform/upstream/libevdev.git] / configure.ac
1 AC_PREREQ([2.62])
2
3 AC_INIT([libevdev],
4         [0.4],
5         [https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev],
6         [libevdev],
7         [])
8
9 AC_CONFIG_SRCDIR([libevdev/libevdev.c])
10 AC_CONFIG_HEADERS([config.h])
11 AC_CONFIG_MACRO_DIR([m4])
12 AC_USE_SYSTEM_EXTENSIONS
13
14 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
15
16 # Before making a release, the LIBEVDEV_LT_VERSION string should be
17 # modified.
18 # The string is of the form C:R:A.
19 # - If interfaces have been changed or added, but binary compatibility has
20 #   been preserved, change to C+1:0:A+1
21 # - If binary compatibility has been broken (eg removed or changed interfaces)
22 #   change to C+1:0:0
23 # - If the interface is the same as the previous version, change to C:R+1:A
24 LIBEVDEV_LT_VERSION=1:0:0
25 AC_SUBST(LIBEVDEV_LT_VERSION)
26
27
28 AM_SILENT_RULES([yes])
29
30 # Check for programs
31 AC_PROG_CC
32
33 # Initialize libtool
34 LT_PREREQ([2.2])
35 LT_INIT
36 LT_PATH_LD
37
38 with_ldflags=""
39 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
40         CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
41                                 -Wl,--as-needed \
42                                 -Wl,--gc-sections \
43                                 -Wl,-z,relro \
44                                 -Wl,-z,now])
45 fi
46 AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
47
48 PKG_PROG_PKG_CONFIG()
49 PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
50 if test "x$HAVE_CHECK" != "xyes"; then
51        AC_MSG_WARN([check not found - skipping building unit tests])
52 fi
53 AM_CONDITIONAL(BUILD_TESTS, [test "x$HAVE_CHECK" = "xyes"])
54
55 with_cflags=""
56 if test "x$GCC" = "xyes"; then
57         CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
58                                 -Wall \
59                                 -Wextra \
60                                 -Wno-unused-parameter \
61                                 -Wstrict-prototypes \
62                                 -Wmissing-prototypes \
63                                 -fvisibility=hidden \
64                                 -pipe \
65                                 -fno-strict-aliasing \
66                                 -ffunction-sections \
67                                 -fdata-sections \
68                                 -fno-strict-aliasing \
69                                 -fdiagnostics-show-option \
70                                 -fno-common])
71 fi
72 AC_SUBST([GCC_CFLAGS], $with_cflags)
73
74 AC_PATH_PROG(DOXYGEN, [doxygen])
75 if test "x$DOXYGEN" = "x"; then
76         AC_MSG_WARN([doxygen not found - required for documentation])
77         have_doxygen="no"
78 else
79         have_doxygen="yes"
80 fi
81 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
82
83 AC_MSG_CHECKING([whether to build with gcov])
84 AC_ARG_ENABLE([gcov],
85               [AS_HELP_STRING([--enable-gcov],
86                               [Whether to enable coverage testing (default:disabled)])],
87               [],
88               [enable_gcov=no],
89               )
90 AS_IF([test "x$enable_gcov" != "xno"],
91       [
92        GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
93        GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
94        enable_gcov=yes
95        ],
96 )
97
98 AM_PATH_PYTHON()
99 AC_SUBST(PYTHON)
100 AS_IF([$($PYTHON -c "import argparse")], [:],
101        AC_MSG_ERROR([python argparse module is missing]))
102
103 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
104 AC_SUBST([GCOV_CFLAGS])
105 AC_SUBST([GCOV_LDFLAGS])
106 AC_MSG_RESULT([$enable_gcov])
107
108 AC_CONFIG_FILES([Makefile
109                  libevdev/Makefile
110                  doc/Makefile
111                  doc/libevdev.doxygen
112                  tools/Makefile
113                  test/Makefile
114                  libevdev.pc])
115 AC_OUTPUT
116
117 AC_MSG_RESULT([
118                Build documentation      ${have_doxygen}
119                Build unit-tests         ${HAVE_CHECK}
120                Enable profiling         ${enable_gcov}
121                ])