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