tizen 2.4 release
[framework/uifw/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         [1.2.2],
25         [https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev],
26         [libevdev],
27         [http://freedesktop.org/wiki/Software/libevdev/])
28
29 AC_CONFIG_SRCDIR([libevdev/libevdev.c])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_MACRO_DIR([m4])
32 AC_CONFIG_AUX_DIR([build-aux])
33 AC_USE_SYSTEM_EXTENSIONS
34
35 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
36
37 # Before making a release, the LIBEVDEV_LT_VERSION string should be
38 # modified.
39 # The string is of the form C:R:A.
40 # - If interfaces have been changed or added, but binary compatibility has
41 #   been preserved, change to C+1:0:A+1
42 # - If binary compatibility has been broken (eg removed or changed interfaces)
43 #   change to C+1:0:0
44 # - If the interface is the same as the previous version, change to C:R+1:A
45 LIBEVDEV_LT_VERSION=2:3:0
46 AC_SUBST(LIBEVDEV_LT_VERSION)
47
48
49 AM_SILENT_RULES([yes])
50
51 # Check for programs
52 AC_PROG_CC_C99
53
54 # Initialize libtool
55 LT_PREREQ([2.2])
56 LT_INIT
57 LT_PATH_LD
58
59 with_ldflags=""
60 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
61         CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
62                                 -Wl,--as-needed \
63                                 -Wl,--gc-sections \
64                                 -Wl,-z,relro \
65                                 -Wl,-z,now])
66 fi
67 AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
68
69 PKG_PROG_PKG_CONFIG()
70 PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
71 if test "x$HAVE_CHECK" = "xyes"; then
72         AC_PATH_PROG(VALGRIND, [valgrind])
73 else
74         AC_MSG_WARN([check not found - skipping building unit tests])
75 fi
76 AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
77 AM_CONDITIONAL(BUILD_TESTS, [test "x$HAVE_CHECK" = "xyes"])
78
79 with_cflags=""
80 if test "x$GCC" = "xyes"; then
81         CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
82                                 -Wall \
83                                 -Wextra \
84                                 -Wno-unused-parameter \
85                                 -Wstrict-prototypes \
86                                 -Wmissing-prototypes \
87                                 -fvisibility=hidden \
88                                 -pipe \
89                                 -fno-strict-aliasing \
90                                 -ffunction-sections \
91                                 -fdata-sections \
92                                 -fno-strict-aliasing \
93                                 -fdiagnostics-show-option \
94                                 -fno-common])
95 fi
96 AC_SUBST([GCC_CFLAGS], $with_cflags)
97
98 AC_PATH_PROG(DOXYGEN, [doxygen])
99 if test "x$DOXYGEN" = "x"; then
100         AC_MSG_WARN([doxygen not found - required for documentation])
101         have_doxygen="no"
102 else
103         have_doxygen="yes"
104 fi
105 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
106
107 AC_MSG_CHECKING([whether to build with gcov])
108 AC_ARG_ENABLE([gcov],
109               [AS_HELP_STRING([--enable-gcov],
110                               [Whether to enable coverage testing (default:disabled)])],
111               [],
112               [enable_gcov=no],
113               )
114 AS_IF([test "x$enable_gcov" != "xno"],
115       [
116        GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
117        GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
118        enable_gcov=yes
119        ],
120 )
121
122 AM_PATH_PYTHON([2.6])
123
124 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
125 AC_SUBST([GCOV_CFLAGS])
126 AC_SUBST([GCOV_LDFLAGS])
127 AC_MSG_RESULT([$enable_gcov])
128
129 AC_CONFIG_FILES([Makefile
130                  libevdev/Makefile
131                  doc/Makefile
132                  doc/libevdev.doxygen
133                  doc/libevdev.man
134                  tools/Makefile
135                  test/Makefile
136                  libevdev.pc])
137 AC_OUTPUT
138
139 AC_MSG_RESULT([
140                Build documentation      ${have_doxygen}
141                Build unit-tests         ${HAVE_CHECK}
142                Enable profiling         ${enable_gcov}
143                ])