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