Add libevdev_disable_property
[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 # change meson version too
24 AC_INIT([libevdev],
25         [1.9.901],
26         [https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev],
27         [libevdev],
28         [http://freedesktop.org/wiki/Software/libevdev/])
29
30 AC_CONFIG_SRCDIR([libevdev/libevdev.c])
31 AC_CONFIG_HEADERS([config.h])
32 AC_CONFIG_MACRO_DIR([m4])
33 AC_CONFIG_AUX_DIR([build-aux])
34 AC_USE_SYSTEM_EXTENSIONS
35
36 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
37
38 # DO NOT MODIFY THIS
39 # Use symbol versioning instead.
40 LIBEVDEV_LT_VERSION=5:0:3
41 AC_SUBST(LIBEVDEV_LT_VERSION)
42
43
44 AM_SILENT_RULES([yes])
45
46 # Check for programs
47 AC_PROG_CC_C99
48
49 # Initialize libtool
50 LT_PREREQ([2.2])
51 LT_INIT
52 LT_PATH_LD
53
54 with_ldflags=""
55 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
56         CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
57                                 -Wl,--as-needed \
58                                 -Wl,--gc-sections \
59                                 -Wl,-z,relro \
60                                 -Wl,-z,now])
61 fi
62 AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
63
64 case "${host_os}" in
65     freebsd*)
66 AC_SUBST([OS], [freebsd])
67         ;;
68     *)
69 AC_SUBST([OS], [linux])
70         ;;
71 esac
72
73 AC_CHECK_LIB([m], [round])
74
75 PKG_PROG_PKG_CONFIG()
76 PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
77 if test "x$HAVE_CHECK" = "xyes"; then
78         AC_PATH_PROG(VALGRIND, [valgrind])
79 else
80         AC_MSG_WARN([check not found - skipping building unit tests])
81 fi
82 AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
83 AM_CONDITIONAL(ENABLE_RUNTIME_TESTS, [test "x$HAVE_CHECK" = "xyes"])
84 AM_CONDITIONAL(ENABLE_STATIC_LINK_TEST, [test "x$enable_static" = "xyes"])
85
86 with_cflags=""
87 if test "x$GCC" = "xyes"; then
88         CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
89                                 -Wall \
90                                 -Wextra \
91                                 -Wno-unused-parameter \
92                                 -Wstrict-prototypes \
93                                 -Wmissing-prototypes \
94                                 -fvisibility=hidden \
95                                 -pipe \
96                                 -fno-strict-aliasing \
97                                 -ffunction-sections \
98                                 -fdata-sections \
99                                 -fno-strict-aliasing \
100                                 -fdiagnostics-show-option \
101                                 -fno-common])
102 fi
103 AC_SUBST([GCC_CFLAGS], $with_cflags)
104
105 AC_PATH_PROG(DOXYGEN, [doxygen])
106 if test "x$DOXYGEN" = "x"; then
107         AC_MSG_WARN([doxygen not found - required for documentation])
108         have_doxygen="no"
109 else
110         have_doxygen="yes"
111 fi
112 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
113
114 AC_MSG_CHECKING([whether to build with gcov])
115 AC_ARG_ENABLE([gcov],
116               [AS_HELP_STRING([--enable-gcov],
117                               [Whether to enable coverage testing (default:disabled)])],
118               [],
119               [enable_gcov=no],
120               )
121 AS_IF([test "x$enable_gcov" != "xno"],
122       [
123        GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
124        GCOV_LDFLAGS="-lgcov"
125        enable_gcov=yes
126        ],
127 )
128 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
129 AC_SUBST([GCOV_CFLAGS])
130 AC_SUBST([GCOV_LDFLAGS])
131 AC_MSG_RESULT([$enable_gcov])
132
133 AC_MSG_CHECKING([whether to build with coverity support])
134 AC_ARG_ENABLE([coverity],
135               [AS_HELP_STRING([--enable-coverity],
136                               [Whether to build with coverity support (default: disabled)])],
137               [],
138               [enable_coverity=no],
139               )
140 AS_IF([test "x$enable_coverity" != "xno"],
141       [
142        AC_DEFINE([_Float128], [__uint128_t], [Override for coverity])
143        AC_DEFINE([_Float32], [int], [Override for coverity])
144        AC_DEFINE([_Float32x], [int], [Override for coverity])
145        AC_DEFINE([_Float64], [long], [Override for coverity])
146        AC_DEFINE([_Float64x], [long], [Override for coverity])
147        enable_coverity=yes
148        ],
149 )
150 AC_MSG_RESULT([$enable_coverity])
151
152
153 AM_PATH_PYTHON([2.6])
154
155 # nm to check for leaking symbols in the static library
156 AC_PATH_PROG(NM, [nm])
157 AM_CONDITIONAL(HAVE_NM, [test "x$NM" != "x"])
158 if test "x$enable_static" = "xno"; then
159         static_symbol_leaks_test="no - static build disabled"
160 else
161         if test "x$NM" = "x"; then
162                 AC_MSG_WARN([nm not found - skipping symbol leak test])
163                 have_nm="no"
164                 static_symbol_leaks_test="no - nm not found"
165         else
166                 have_nm="yes"
167                 static_symbol_leaks_test="yes"
168         fi
169 fi
170
171 AM_CONDITIONAL(ENABLE_STATIC_SYMBOL_LEAKS_TEST, [test "x$static_symbol_leaks_test" = "xyes"])
172
173 AC_CONFIG_FILES([Makefile
174                  libevdev/Makefile
175                  doc/Makefile
176                  doc/libevdev.doxygen
177                  doc/libevdev.man
178                  tools/Makefile
179                  test/Makefile
180                  libevdev.pc])
181 AC_OUTPUT
182
183 AC_MSG_RESULT([
184                Prefix                           ${prefix}
185                Libdir                           ${libdir}
186
187                Build documentation              ${have_doxygen}
188                Enable unit-tests                ${HAVE_CHECK}
189                Enable profiling                 ${enable_gcov}
190                Enable coverity support          ${enable_coverity}
191                Static library symbol check      ${static_symbol_leaks_test}
192                ])