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