configure.ac: remove redundant AC_SUBST(PYTHON)
[platform/upstream/libevdev.git] / configure.ac
1 # Copyright © 2013 Red Hat, Inc.
2 #
3 # Permission to use, copy, modify, distribute, and sell this software and its
4 # documentation for any purpose is hereby granted without fee, provided that
5 # the above copyright notice appear in all copies and that both that copyright
6 # notice and this permission notice appear in supporting documentation, and
7 # that the name of the copyright holders not be used in advertising or
8 # publicity pertaining to distribution of the software without specific,
9 # written prior permission.  The copyright holders make no representations
10 # about the suitability of this software for any purpose.  It is provided "as
11 # is" without express or implied warranty.
12 #
13 # THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15 # EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16 # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17 # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
19 # OF THIS SOFTWARE.
20
21 AC_PREREQ([2.62])
22
23 AC_INIT([libevdev],
24         [0.4],
25         [https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev],
26         [libevdev],
27         [])
28
29 AC_CONFIG_SRCDIR([libevdev/libevdev.c])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_MACRO_DIR([m4])
32 AC_USE_SYSTEM_EXTENSIONS
33
34 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
35
36 # Before making a release, the LIBEVDEV_LT_VERSION string should be
37 # modified.
38 # The string is of the form C:R:A.
39 # - If interfaces have been changed or added, but binary compatibility has
40 #   been preserved, change to C+1:0:A+1
41 # - If binary compatibility has been broken (eg removed or changed interfaces)
42 #   change to C+1:0:0
43 # - If the interface is the same as the previous version, change to C:R+1:A
44 LIBEVDEV_LT_VERSION=1:0:0
45 AC_SUBST(LIBEVDEV_LT_VERSION)
46
47
48 AM_SILENT_RULES([yes])
49
50 # Check for programs
51 AC_PROG_CC_C99
52
53 # Initialize libtool
54 LT_PREREQ([2.2])
55 LT_INIT
56 LT_PATH_LD
57
58 with_ldflags=""
59 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
60         CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
61                                 -Wl,--as-needed \
62                                 -Wl,--gc-sections \
63                                 -Wl,-z,relro \
64                                 -Wl,-z,now])
65 fi
66 AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
67
68 PKG_PROG_PKG_CONFIG()
69 PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
70 if test "x$HAVE_CHECK" != "xyes"; then
71        AC_MSG_WARN([check not found - skipping building unit tests])
72 fi
73 AM_CONDITIONAL(BUILD_TESTS, [test "x$HAVE_CHECK" = "xyes"])
74
75 with_cflags=""
76 if test "x$GCC" = "xyes"; then
77         CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
78                                 -Wall \
79                                 -Wextra \
80                                 -Wno-unused-parameter \
81                                 -Wstrict-prototypes \
82                                 -Wmissing-prototypes \
83                                 -fvisibility=hidden \
84                                 -pipe \
85                                 -fno-strict-aliasing \
86                                 -ffunction-sections \
87                                 -fdata-sections \
88                                 -fno-strict-aliasing \
89                                 -fdiagnostics-show-option \
90                                 -fno-common])
91 fi
92 AC_SUBST([GCC_CFLAGS], $with_cflags)
93
94 AC_PATH_PROG(DOXYGEN, [doxygen])
95 if test "x$DOXYGEN" = "x"; then
96         AC_MSG_WARN([doxygen not found - required for documentation])
97         have_doxygen="no"
98 else
99         have_doxygen="yes"
100 fi
101 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
102
103 AC_MSG_CHECKING([whether to build with gcov])
104 AC_ARG_ENABLE([gcov],
105               [AS_HELP_STRING([--enable-gcov],
106                               [Whether to enable coverage testing (default:disabled)])],
107               [],
108               [enable_gcov=no],
109               )
110 AS_IF([test "x$enable_gcov" != "xno"],
111       [
112        GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
113        GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
114        enable_gcov=yes
115        ],
116 )
117
118 AM_PATH_PYTHON()
119 AS_IF([$($PYTHON -c "import argparse")], [:],
120        AC_MSG_ERROR([python argparse module is missing]))
121
122 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
123 AC_SUBST([GCOV_CFLAGS])
124 AC_SUBST([GCOV_LDFLAGS])
125 AC_MSG_RESULT([$enable_gcov])
126
127 AC_CONFIG_FILES([Makefile
128                  libevdev/Makefile
129                  doc/Makefile
130                  doc/libevdev.doxygen
131                  tools/Makefile
132                  test/Makefile
133                  libevdev.pc])
134 AC_OUTPUT
135
136 AC_MSG_RESULT([
137                Build documentation      ${have_doxygen}
138                Build unit-tests         ${HAVE_CHECK}
139                Enable profiling         ${enable_gcov}
140                ])