libevdev/configure.ac
Peter Hutterer 24dafff909 configure.ac: enable subdir-objects
The main thing holding us back here was our gcov hacks. We used to rebuild the
libevdev sources locally inside test/ with the gcov flags so that we could
leave the main libevdev sources untouched. This doesn't work well with
subdir-objects - we have to link to libevdev.la instead.

To enable gcov, we now have to apply the gcov flags to the main library
object. But this also means that when running, the notes files will be
somewhere within the libevdev/ directory, not the test/ directory. Working
around this in automake gets nasty quickly, so just add a script that knows
how to search for things.

No functional changes unless --enable-gcov is given at configure time - then
don't install the library.

The gcov reports are now in test/gcov-reports/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-01-09 09:40:28 +10:00

174 lines
5.3 KiB
Text

# Copyright © 2013 Red Hat, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that copyright
# notice and this permission notice appear in supporting documentation, and
# that the name of the copyright holders not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. The copyright holders make no representations
# about the suitability of this software for any purpose. It is provided "as
# is" without express or implied warranty.
#
# THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
AC_PREREQ([2.62])
AC_INIT([libevdev],
[1.5.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev],
[libevdev],
[http://freedesktop.org/wiki/Software/libevdev/])
AC_CONFIG_SRCDIR([libevdev/libevdev.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
# Before making a release, the LIBEVDEV_LT_VERSION string should be
# modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
LIBEVDEV_LT_VERSION=3:18:1
AC_SUBST(LIBEVDEV_LT_VERSION)
AM_SILENT_RULES([yes])
# Check for programs
AC_PROG_CC_C99
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT
LT_PATH_LD
with_ldflags=""
if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,--as-needed \
-Wl,--gc-sections \
-Wl,-z,relro \
-Wl,-z,now])
fi
AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
AC_CHECK_LIB([m], [round])
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
if test "x$HAVE_CHECK" = "xyes"; then
AC_PATH_PROG(VALGRIND, [valgrind])
else
AC_MSG_WARN([check not found - skipping building unit tests])
fi
AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(ENABLE_RUNTIME_TESTS, [test "x$HAVE_CHECK" = "xyes"])
AM_CONDITIONAL(ENABLE_STATIC_LINK_TEST, [test "x$enable_static" = "xyes"])
AC_ARG_ENABLE([test-run],
AS_HELP_STRING([--enable-test-run], [For internal use only]),
[run_tests="$enableval"], [run_tests="yes"])
AM_CONDITIONAL(RUN_TESTS, [test "x$run_tests" = "xyes"])
with_cflags=""
if test "x$GCC" = "xyes"; then
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-Wall \
-Wextra \
-Wno-unused-parameter \
-Wstrict-prototypes \
-Wmissing-prototypes \
-fvisibility=hidden \
-pipe \
-fno-strict-aliasing \
-ffunction-sections \
-fdata-sections \
-fno-strict-aliasing \
-fdiagnostics-show-option \
-fno-common])
fi
AC_SUBST([GCC_CFLAGS], $with_cflags)
AC_PATH_PROG(DOXYGEN, [doxygen])
if test "x$DOXYGEN" = "x"; then
AC_MSG_WARN([doxygen not found - required for documentation])
have_doxygen="no"
else
have_doxygen="yes"
fi
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
AC_MSG_CHECKING([whether to build with gcov])
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[Whether to enable coverage testing (default:disabled)])],
[],
[enable_gcov=no],
)
AS_IF([test "x$enable_gcov" != "xno"],
[
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
enable_gcov=yes
],
)
AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
AC_SUBST([GCOV_CFLAGS])
AC_SUBST([GCOV_LDFLAGS])
AC_MSG_RESULT([$enable_gcov])
AM_PATH_PYTHON([2.6])
AC_PATH_PROG(CAT, [cat])
# nm to check for leaking symbols in the static library
AC_PATH_PROG(NM, [nm])
AM_CONDITIONAL(HAVE_NM, [test "x$NM" != "x"])
if test "x$enable_static" = "xno"; then
static_symbol_leaks_test="no - static build disabled"
else
if test "x$NM" = "x"; then
AC_MSG_WARN([nm not found - skipping symbol leak test])
have_nm="no"
static_symbol_leaks_test="no - nm not found"
else
have_nm="yes"
static_symbol_leaks_test="yes"
fi
fi
AM_CONDITIONAL(ENABLE_STATIC_SYMBOL_LEAKS_TEST, [test "x$static_symbol_leaks_test" = "xyes"])
AC_CONFIG_FILES([Makefile
libevdev/Makefile
doc/Makefile
doc/libevdev.doxygen
doc/libevdev.man
tools/Makefile
test/Makefile
libevdev.pc])
AC_OUTPUT
AC_MSG_RESULT([
Prefix ${prefix}
Libdir ${libdir}
Build documentation ${have_doxygen}
Enable unit-tests ${HAVE_CHECK}
Run unit-tests ${run_tests}
Enable profiling ${enable_gcov}
Static library symbol check ${static_symbol_leaks_test}
])