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.13.1], 11 [https://gitlab.freedesktop.org/libevdev/libevdev/issues/], 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_MSG_WARN([check not found - skipping building unit tests]) 64fi 65AM_CONDITIONAL(ENABLE_RUNTIME_TESTS, [test "x$HAVE_CHECK" = "xyes"]) 66AM_CONDITIONAL(ENABLE_STATIC_LINK_TEST, [test "x$enable_static" = "xyes"]) 67 68with_cflags="" 69if test "x$GCC" = "xyes"; then 70 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ 71 -Wall \ 72 -Wextra \ 73 -Wno-unused-parameter \ 74 -Wstrict-prototypes \ 75 -Wmissing-prototypes \ 76 -fvisibility=hidden \ 77 -pipe \ 78 -fno-strict-aliasing \ 79 -ffunction-sections \ 80 -fdata-sections \ 81 -fno-strict-aliasing \ 82 -fdiagnostics-show-option \ 83 -fno-common]) 84fi 85AC_SUBST([GCC_CFLAGS], $with_cflags) 86 87AC_PATH_PROG(DOXYGEN, [doxygen]) 88if test "x$DOXYGEN" = "x"; then 89 AC_MSG_WARN([doxygen not found - required for documentation]) 90 have_doxygen="no" 91else 92 have_doxygen="yes" 93fi 94AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"]) 95 96AC_MSG_CHECKING([whether to build with gcov]) 97AC_ARG_ENABLE([gcov], 98 [AS_HELP_STRING([--enable-gcov], 99 [Whether to enable coverage testing (default:disabled)])], 100 [], 101 [enable_gcov=no], 102 ) 103AS_IF([test "x$enable_gcov" != "xno"], 104 [ 105 GCOV_CFLAGS="-fprofile-arcs -ftest-coverage" 106 GCOV_LDFLAGS="-lgcov" 107 enable_gcov=yes 108 ], 109) 110AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"]) 111AC_SUBST([GCOV_CFLAGS]) 112AC_SUBST([GCOV_LDFLAGS]) 113AC_MSG_RESULT([$enable_gcov]) 114 115AC_MSG_CHECKING([whether to build with coverity support]) 116AC_ARG_ENABLE([coverity], 117 [AS_HELP_STRING([--enable-coverity], 118 [Whether to build with coverity support (default: disabled)])], 119 [], 120 [enable_coverity=no], 121 ) 122AS_IF([test "x$enable_coverity" != "xno"], 123 [ 124 AC_DEFINE([_Float128], [__uint128_t], [Override for coverity]) 125 AC_DEFINE([_Float32], [int], [Override for coverity]) 126 AC_DEFINE([_Float32x], [int], [Override for coverity]) 127 AC_DEFINE([_Float64], [long], [Override for coverity]) 128 AC_DEFINE([_Float64x], [long], [Override for coverity]) 129 enable_coverity=yes 130 ], 131) 132AC_MSG_RESULT([$enable_coverity]) 133 134 135AM_PATH_PYTHON([2.6]) 136 137# nm to check for leaking symbols in the static library 138AC_PATH_PROG(NM, [nm]) 139AM_CONDITIONAL(HAVE_NM, [test "x$NM" != "x"]) 140if test "x$enable_static" = "xno"; then 141 static_symbol_leaks_test="no - static build disabled" 142else 143 if test "x$NM" = "x"; then 144 AC_MSG_WARN([nm not found - skipping symbol leak test]) 145 have_nm="no" 146 static_symbol_leaks_test="no - nm not found" 147 else 148 have_nm="yes" 149 static_symbol_leaks_test="yes" 150 fi 151fi 152 153AM_CONDITIONAL(ENABLE_STATIC_SYMBOL_LEAKS_TEST, [test "x$static_symbol_leaks_test" = "xyes"]) 154 155AC_CONFIG_FILES([Makefile 156 libevdev/Makefile 157 doc/Makefile 158 doc/libevdev.doxygen 159 doc/libevdev.man 160 tools/Makefile 161 test/Makefile 162 libevdev.pc]) 163AC_OUTPUT 164 165AC_MSG_RESULT([ 166 Prefix ${prefix} 167 Libdir ${libdir} 168 169 Build documentation ${have_doxygen} 170 Enable unit-tests ${HAVE_CHECK} 171 Enable profiling ${enable_gcov} 172 Enable coverity support ${enable_coverity} 173 Static library symbol check ${static_symbol_leaks_test} 174 ]) 175