1481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAC_PREREQ(2.64)
2cb48c9b2e611251c68bd0b8f349312330310f644Lucas De MarchiAC_INIT([kmod],
3ef4257b59c4307b8c627d89f3c7f1feedb32582fLucas De Marchi	[24],
4e17cc3afccc46bf89a3a6f2568f9d630fd91e366Lucas De Marchi	[linux-modules@vger.kernel.org],
5cb48c9b2e611251c68bd0b8f349312330310f644Lucas De Marchi	[kmod],
6bb05bc8ac139449c3fda63e16ba8e3f45d5f290eLucas De Marchi	[http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
7586fc304d85b2a31ae764377b4ddfb64cc9f221cLucas De Marchi
8586fc304d85b2a31ae764377b4ddfb64cc9f221cLucas De MarchiAC_CONFIG_SRCDIR([libkmod/libkmod.c])
9481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAC_CONFIG_MACRO_DIR([m4])
10481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAC_CONFIG_HEADERS(config.h)
11ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_CONFIG_AUX_DIR([build-aux])
12481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De Marchi
13ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_USE_SYSTEM_EXTENSIONS
14ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_SYS_LARGEFILE
15ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_PREFIX_DEFAULT([/usr])
16f5cc26c77d2f332a9b40f51f0ec72e95711edf1eAnders OlofssonAM_MAINTAINER_MODE([enable])
17481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
18481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAM_SILENT_RULES([yes])
19481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiLT_INIT([disable-static pic-only])
20da6c0d2f52390fe7ed6c40f6aa9799edfeb19dcbLucas De MarchiDOLT
21ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi
22fae77516b405e8e685afd08acff71209a90609f7Lucas De MarchiAS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])])
23fae77516b405e8e685afd08acff71209a90609f7Lucas De MarchiAS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])])
24b7016153ec87dba2b0f0d182cc8f1e3b12f4dfafLucas De Marchi
253ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
263ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# Program checks and configurations
273ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
283ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
299faa7b376c1e1a48d8763829bab0ac4f0b924b01Kay SieversAC_PROG_SED
309faa7b376c1e1a48d8763829bab0ac4f0b924b01Kay SieversAC_PROG_MKDIR_P
31481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAC_PROG_LN_S
327b3a74fc67993e6fb85918ec8c2f71c90903a4d4Jan EngelhardtPKG_PROG_PKG_CONFIG
33bccb4b2545a409a909d2ad1bc19a73300ae07c49Lucas De MarchiAC_PATH_PROG([XSLTPROC], [xsltproc])
343d8226edfea12b951f6e257b087ec7453135ed10Gustavo Sverzut Barbieri
35481ad14550087c77c9df6d117c7a975a38a4ad33Lucas De MarchiAC_PROG_CC_C99
363ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
373ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
383ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# Function and structure checks
393ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
403ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
41d005aeb7529ab690c7b7119f0ef545e2c07a1ceaLucas De MarchiAC_CHECK_FUNCS_ONCE(__xstat)
4241a51c2af915bc99851446cf604fac99eca1848fCristian RodríguezAC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
4355112d19f7067dff89b1481d5bd8cc49139c4ecbLucas De MarchiAC_CHECK_FUNCS_ONCE([finit_module])
44d005aeb7529ab690c7b7119f0ef545e2c07a1ceaLucas De Marchi
45e6307200af74d1556466522216e8ae77b7c8b843Lucas De MarchiCC_CHECK_FUNC_BUILTIN([__builtin_clz])
46e6307200af74d1556466522216e8ae77b7c8b843Lucas De MarchiCC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
47aac5f4514f71d04ac3dcb8b923209781895d7ff2Lucas De MarchiCC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ])
48aac5f4514f71d04ac3dcb8b923209781895d7ff2Lucas De MarchiCC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
49e6307200af74d1556466522216e8ae77b7c8b843Lucas De Marchi
503ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# dietlibc doesn't have st.st_mtim struct member
513ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiAC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
523ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
5304c0956e207e3b27a700494f8dc77f902cd53731Lucas De Marchi# musl 1.0 and bionic 4.4 don't have strndupa
5404c0956e207e3b27a700494f8dc77f902cd53731Lucas De MarchiAC_CHECK_DECLS_ONCE([strndupa])
5504c0956e207e3b27a700494f8dc77f902cd53731Lucas De Marchi
569b34db1ae63427269f918b2868b4cfcb50e6259bRandy MacLeod# RHEL 5 and older do not have be32toh
579b34db1ae63427269f918b2868b4cfcb50e6259bRandy MacLeodAC_CHECK_DECLS_ONCE([be32toh])
589b34db1ae63427269f918b2868b4cfcb50e6259bRandy MacLeod
59144d1826f1a0fcd6cc59c4535f0a8145163c640cKees Cook# Check kernel headers
60144d1826f1a0fcd6cc59c4535f0a8145163c640cKees CookAC_CHECK_HEADERS_ONCE([linux/module.h])
61144d1826f1a0fcd6cc59c4535f0a8145163c640cKees Cook
62dc8ed09f8f21d17ef9481001683d7edfdb308983Thomas PetazzoniAC_MSG_CHECKING([whether _Static_assert() is supported])
63dc8ed09f8f21d17ef9481001683d7edfdb308983Thomas PetazzoniAC_COMPILE_IFELSE(
64dc8ed09f8f21d17ef9481001683d7edfdb308983Thomas Petazzoni	[AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
65dc8ed09f8f21d17ef9481001683d7edfdb308983Thomas Petazzoni        [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
66dc8ed09f8f21d17ef9481001683d7edfdb308983Thomas Petazzoni	 AC_MSG_RESULT([yes])],
67dc8ed09f8f21d17ef9481001683d7edfdb308983Thomas Petazzoni	[AC_MSG_RESULT([no])])
683ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
6916a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De MarchiAC_MSG_CHECKING([whether _Noreturn is supported])
7016a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De MarchiAC_COMPILE_IFELSE(
7116a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De Marchi	[AC_LANG_SOURCE([[_Noreturn int foo(void) { exit(0); }]])],
7216a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De Marchi        [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available])
7316a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De Marchi	 AC_MSG_RESULT([yes])],
7416a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De Marchi	[AC_MSG_RESULT([no])])
7516a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De Marchi
7616a62c7ab3846a1996624cccc0e16dd4adb5deb0Lucas De Marchi
773ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
783ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# --with-
793ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
803ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
81e79bf83b0648a44585dc5960f7022a9a8f4ab40cKay SieversAC_ARG_WITH([rootlibdir],
82e79bf83b0648a44585dc5960f7022a9a8f4ab40cKay Sievers        AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
83e79bf83b0648a44585dc5960f7022a9a8f4ab40cKay Sievers        [], [with_rootlibdir=$libdir])
84e79bf83b0648a44585dc5960f7022a9a8f4ab40cKay SieversAC_SUBST([rootlibdir], [$with_rootlibdir])
85e79bf83b0648a44585dc5960f7022a9a8f4ab40cKay Sievers
86b182f8fb5e5765dd5c935aa7b3775e382662b318Jan EngelhardtAC_ARG_WITH([xz],
87b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt	AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
88b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt	[], [with_xz=no])
89b182f8fb5e5765dd5c935aa7b3775e382662b318Jan EngelhardtAS_IF([test "x$with_xz" != "xno"], [
90b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt	PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99])
91b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt	AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
92b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt], [
93b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt	AC_MSG_NOTICE([Xz support not requested])
94b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt])
954671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De MarchiCC_FEATURE_APPEND([with_features], [with_xz], [XZ])
96b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt
975a51a357a8fad00582631592969f6d410228b8a7Jan EngelhardtAC_ARG_WITH([zlib],
985a51a357a8fad00582631592969f6d410228b8a7Jan Engelhardt	AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
995a51a357a8fad00582631592969f6d410228b8a7Jan Engelhardt	[], [with_zlib=no])
1005a51a357a8fad00582631592969f6d410228b8a7Jan EngelhardtAS_IF([test "x$with_zlib" != "xno"], [
1017b3a74fc67993e6fb85918ec8c2f71c90903a4d4Jan Engelhardt	PKG_CHECK_MODULES([zlib], [zlib])
1027b3a74fc67993e6fb85918ec8c2f71c90903a4d4Jan Engelhardt	AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
103cfb908bf660871f9475b485806e004ddcc5ced18Lucas De Marchi], [
104cfb908bf660871f9475b485806e004ddcc5ced18Lucas De Marchi	AC_MSG_NOTICE([zlib support not requested])
105cfb908bf660871f9475b485806e004ddcc5ced18Lucas De Marchi])
1064671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De MarchiCC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB])
1073d8226edfea12b951f6e257b087ec7453135ed10Gustavo Sverzut Barbieri
10880cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De MarchiAC_ARG_WITH([bashcompletiondir],
10980cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
11080cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	[],
11180cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	[AS_IF([$($PKG_CONFIG --exists bash-completion)], [
11280cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi		with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
11380cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	] , [
11480cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi		with_bashcompletiondir=${datadir}/bash-completion/completions
11580cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	])])
11680cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De MarchiAC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
1173ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
1183ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
1193ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# --enable-
1203ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
1213ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
122013e855043149ec998085bd94896379e08578acdLucas De MarchiAC_ARG_ENABLE([experimental],
123013e855043149ec998085bd94896379e08578acdLucas De Marchi        AS_HELP_STRING([--enable-experimental], [enable experimental tools and features. Do not enable it unless you know what you are doing. @<:@default=disabled@:>@]),
124013e855043149ec998085bd94896379e08578acdLucas De Marchi        [], enable_experimental=no)
125013e855043149ec998085bd94896379e08578acdLucas De MarchiAM_CONDITIONAL([BUILD_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
126013e855043149ec998085bd94896379e08578acdLucas De MarchiAS_IF([test "x$enable_experimental" = "xyes"], [
127013e855043149ec998085bd94896379e08578acdLucas De Marchi	AC_DEFINE(ENABLE_EXPERIMENTAL, [1], [Experimental features.])
128013e855043149ec998085bd94896379e08578acdLucas De Marchi])
1294671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De MarchiCC_FEATURE_APPEND([with_features], [enable_experimental], [EXPERIMENTAL])
130013e855043149ec998085bd94896379e08578acdLucas De Marchi
1313ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiAC_ARG_ENABLE([tools],
1323ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi        AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
1333ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi	[], enable_tools=yes)
1343ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiAM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
1353ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
1368631552d3d48092932c6fb93baa6e38fb3ca951aColin WaltersAC_ARG_ENABLE([manpages],
1378631552d3d48092932c6fb93baa6e38fb3ca951aColin Walters        AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
1388631552d3d48092932c6fb93baa6e38fb3ca951aColin Walters	[], enable_manpages=yes)
1398631552d3d48092932c6fb93baa6e38fb3ca951aColin WaltersAM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
1408631552d3d48092932c6fb93baa6e38fb3ca951aColin Walters
14123603f1f837caeff45c6960722c2cad690db801dLucas De MarchiAC_ARG_ENABLE([test-modules],
14223603f1f837caeff45c6960722c2cad690db801dLucas De Marchi        AS_HELP_STRING([--disable-test-modules], [disable building test modules during make check: cached modules will be used @<:@default=enabled@:>@]),
14323603f1f837caeff45c6960722c2cad690db801dLucas De Marchi	[], enable_test_modules=yes)
14423603f1f837caeff45c6960722c2cad690db801dLucas De MarchiAM_CONDITIONAL([BUILD_MODULES], [test "x$enable_test_modules" = "xyes"])
14523603f1f837caeff45c6960722c2cad690db801dLucas De Marchi
1463ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiAC_ARG_ENABLE([logging],
1473ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi	AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
1483ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi	[], enable_logging=yes)
1493ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiAS_IF([test "x$enable_logging" = "xyes"], [
1503ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi	AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
1513ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi])
1523ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
153ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_ARG_ENABLE([debug],
154ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
155ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	[], [enable_debug=no])
156ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAS_IF([test "x$enable_debug" = "xyes"], [
157ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
158ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi])
159ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi
1603a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De MarchiAC_ARG_ENABLE([python],
1613a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
1623a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	[], [enable_python=no])
1633a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De MarchiAS_IF([test "x$enable_python" = "xyes"], [
1643a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	AM_PATH_PYTHON(,,[:])
1653a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	AC_PATH_PROG([CYTHON], [cython], [:])
1663a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi
1673a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
1683a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi			  [have_python=yes],
1693a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi			  [PKG_CHECK_MODULES([PYTHON], [python],
1703a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi					     [have_python=yes],
1713a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi					     [have_python=no])])
1723a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi
1733a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	AS_IF([test "x$have_python" = xno],
1743a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	      [AC_MSG_ERROR([*** python support requested but libraries not found])])
1753a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi])
1763a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De MarchiAM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
1773a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi
178e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De MarchiAC_ARG_ENABLE([coverage],
179e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi	AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
180e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi	[], [enable_coverage=no])
181e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De MarchiAS_IF([test "x$enable_coverage" = "xyes"], [
182e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi	AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
183e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi	AS_IF([test "x$have_coverage" = xno],[
184e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi		AC_MSG_ERROR([*** lcov support requested but the program was not found])
185e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi	], [
186e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi		lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
187e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi		lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
188e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi		AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
189e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi			AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
190e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi		], [
191e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi			have_coverage=yes
192e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi                        CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
193e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi                        -fprofile-arcs \
194e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi                        -ftest-coverage])
195e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi		])
196e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi        ])
197e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi])
198e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De MarchiAM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
199e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi
2003ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchim4_ifdef([GTK_DOC_CHECK], [
2013ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiGTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
2023ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi], [
2033ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De MarchiAM_CONDITIONAL([ENABLE_GTK_DOC], false)])
2043ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
2053ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
2063ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
2073ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# Default CFLAGS and LDFLAGS
2083ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
2096068aaaea8e7cdc6039e6fd7a1aeab9db9d0225bLucas De Marchi
210e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De MarchiCC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
211e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -pipe \
212e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -DANOTHER_BRICK_IN_THE \
213e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wall \
214e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -W \
215e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wextra \
216e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wno-inline \
217e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wvla \
218e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wundef \
219e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wformat=2 \
220e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wlogical-op \
221e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wsign-compare \
222e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wformat-security \
223e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wmissing-include-dirs \
224e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wformat-nonliteral \
225e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wold-style-definition \
226e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wpointer-arith \
227e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Winit-self \
228e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wdeclaration-after-statement \
229e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wfloat-equal \
230e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wmissing-prototypes \
231e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wstrict-prototypes \
232e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wredundant-decls \
233e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wmissing-declarations \
234e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wmissing-noreturn \
235e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wshadow \
236e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wendif-labels \
237db62153ea0beedbc6941e1d438c0b6e7189e78d9Lucas De Marchi		       -Wstrict-aliasing=3 \
238e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wwrite-strings \
239e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wno-long-long \
240e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wno-overlength-strings \
241e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wno-unused-parameter \
242e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wno-missing-field-initializers \
243e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wno-unused-result \
244e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wnested-externs \
245e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wchar-subscripts \
246e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wtype-limits \
247e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wuninitialized \
248e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -fno-common \
249e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -fdiagnostics-show-option \
250e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -fvisibility=hidden \
251e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -ffunction-sections \
252e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -fdata-sections])
25327bcc9111b63e94d091c3fa47e81fe52b806cd3eLucas De MarchiAC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
254e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi
255c677bf2c7d4c6b4390dcc5739aec55aecb0cd62eLucas De Marchi
256e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De MarchiCC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
257e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wl,--as-needed \
258a5f799af9819876c5d1dc9d77dc3ee9f12171b65Lucas De Marchi		       -Wl,--no-undefined \
259e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi		       -Wl,--gc-sections])
26084aaaedfa6295ebe1f24b114b35ab0f53c138bbdLucas De MarchiAC_SUBST([OUR_LDFLAGS], $with_ldflags)
2613ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
2624671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De MarchiAC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build])
2634671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De Marchi
2643ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
2653ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi# Generate files from *.in
2663ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
2673ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
268ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_CONFIG_FILES([
269ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	Makefile
270904b57d022b0187bc5c6eeeacf2d5bf566ca8881Lucas De Marchi	man/Makefile
271646b83b841a4591d00223cda14ce1530ec4dbd39Lucas De Marchi	libkmod/docs/Makefile
272646b83b841a4591d00223cda14ce1530ec4dbd39Lucas De Marchi	libkmod/docs/version.xml
273ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi])
274ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi
2753ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi
2763ef7208ecfa2fb3edc0d3f6344811e686907c94cLucas De Marchi#####################################################################
277646b83b841a4591d00223cda14ce1530ec4dbd39Lucas De Marchi
278ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_OUTPUT
279ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De MarchiAC_MSG_RESULT([
280ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	$PACKAGE $VERSION
28180cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	=======
282ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi
283ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	prefix:			${prefix}
284ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	sysconfdir:		${sysconfdir}
285ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	libdir:			${libdir}
286e79bf83b0648a44585dc5960f7022a9a8f4ab40cKay Sievers	rootlibdir:		${rootlibdir}
287ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	includedir:		${includedir}
2887c41c2dd8c1357d10cdee912c43614fa47c8d4ecLucas De Marchi	bindir:			${bindir}
28980cf2c8f05813b04a5479746ce3ddaef00ea240dLucas De Marchi	Bash completions dir:   ${with_bashcompletiondir}
290ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi
291ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	compiler:		${CC}
292e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi	cflags:			${with_cflags} ${CFLAGS}
293e48f37657dc03aee9aace60bf14ef9af489bf47cLucas De Marchi	ldflags:		${with_ldflags} ${LDFLAGS}
294ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi
295013e855043149ec998085bd94896379e08578acdLucas De Marchi	experimental features:  ${enable_experimental}
2967c41c2dd8c1357d10cdee912c43614fa47c8d4ecLucas De Marchi	tools:			${enable_tools}
2973a33a7a566c221e13c426c0d2f3519ebe8f70a34Lucas De Marchi	python bindings:	${enable_python}
298ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	logging:		${enable_logging}
299b182f8fb5e5765dd5c935aa7b3775e382662b318Jan Engelhardt	compression:		xz=${with_xz}  zlib=${with_zlib}
300ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi	debug:			${enable_debug}
301e9b0d1b40e645fd583f090601f4ae2a7926888a1Lucas De Marchi	coverage:		${enable_coverage}
302646b83b841a4591d00223cda14ce1530ec4dbd39Lucas De Marchi	doc:			${enable_gtk_doc}
303382de85c94ce6b057acc6e3513e314f34fef966bLucas De Marchi	man:			${enable_manpages}
30423603f1f837caeff45c6960722c2cad690db801dLucas De Marchi	test-modules:           ${enable_test_modules}
3054671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De Marchi
3064671e03e1d3f2c23e0a9bfee5b5493bc3c71a305Lucas De Marchi	features:               ${with_features}
307ecd40ee4992009e8b49f2f8088dd9ab896802ecLucas De Marchi])
308