4 [linux-modules@vger.kernel.org],
6 [http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
8 AC_CONFIG_SRCDIR([libkmod/libkmod.c])
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADERS(config.h)
11 AC_CONFIG_AUX_DIR([build-aux])
13 AC_USE_SYSTEM_EXTENSIONS
15 AC_PREFIX_DEFAULT([/usr])
16 AM_MAINTAINER_MODE([enable])
17 AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
18 AM_SILENT_RULES([yes])
19 LT_INIT([disable-static pic-only])
21 AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])])
22 AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])])
24 #####################################################################
25 # Program checks and configurations
26 #####################################################################
32 AC_PATH_PROG([XSLTPROC], [xsltproc])
33 AC_PATH_PROG([MKOSI], [mkosi])
37 #####################################################################
38 # Function and structure checks
39 #####################################################################
41 AC_CHECK_FUNCS_ONCE(__xstat)
42 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
43 AC_CHECK_FUNCS_ONCE([finit_module])
45 CC_CHECK_FUNC_BUILTIN([__builtin_clz])
46 CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
47 CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ])
48 CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
50 # dietlibc doesn't have st.st_mtim struct member
51 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
53 # musl 1.0 and bionic 4.4 don't have strndupa
54 AC_CHECK_DECLS_ONCE([strndupa])
56 # RHEL 5 and older do not have be32toh
57 AC_CHECK_DECLS_ONCE([be32toh])
59 # Check kernel headers
60 AC_CHECK_HEADERS_ONCE([linux/module.h])
62 AC_MSG_CHECKING([whether _Static_assert() is supported])
64 [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
65 [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
66 AC_MSG_RESULT([yes])],
67 [AC_MSG_RESULT([no])])
69 AC_MSG_CHECKING([whether _Noreturn is supported])
71 [AC_LANG_SOURCE([[#include <stdlib.h>
72 _Noreturn int foo(void) { exit(0); }]])],
73 [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available])
74 AC_MSG_RESULT([yes])],
75 [AC_MSG_RESULT([no])])
78 #####################################################################
80 #####################################################################
82 AC_ARG_WITH([rootlibdir],
83 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
84 [], [with_rootlibdir=$libdir])
85 AC_SUBST([rootlibdir], [$with_rootlibdir])
88 AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
90 AS_IF([test "x$with_zstd" != "xno"], [
91 PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4], [LIBS="$LIBS $libzstd_LIBS"])
92 AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.])
94 AC_MSG_NOTICE([Zstandard support not requested])
96 CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD])
99 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
101 AS_IF([test "x$with_xz" != "xno"], [
102 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99], [LIBS="$LIBS $liblzma_LIBS"])
103 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
105 AC_MSG_NOTICE([Xz support not requested])
107 CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
110 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
112 AS_IF([test "x$with_zlib" != "xno"], [
113 PKG_CHECK_MODULES([zlib], [zlib], [LIBS="$LIBS $zlib_LIBS"])
114 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
116 AC_MSG_NOTICE([zlib support not requested])
118 CC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB])
120 AC_ARG_WITH([openssl],
121 AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
122 [], [with_openssl=no])
123 AS_IF([test "x$with_openssl" != "xno"], [
124 PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"])
125 AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
127 AC_MSG_NOTICE([openssl support not requested])
129 CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO])
131 AC_ARG_WITH([bashcompletiondir],
132 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
134 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
135 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
137 with_bashcompletiondir=${datadir}/bash-completion/completions
139 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
141 #####################################################################
143 #####################################################################
145 AC_ARG_ENABLE([experimental],
146 AS_HELP_STRING([--enable-experimental], [enable experimental tools and features. Do not enable it unless you know what you are doing. @<:@default=disabled@:>@]),
147 [], enable_experimental=no)
148 AM_CONDITIONAL([BUILD_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
149 AS_IF([test "x$enable_experimental" = "xyes"], [
150 AC_DEFINE(ENABLE_EXPERIMENTAL, [1], [Experimental features.])
152 CC_FEATURE_APPEND([with_features], [enable_experimental], [EXPERIMENTAL])
154 AC_ARG_ENABLE([tools],
155 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
156 [], enable_tools=yes)
157 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
159 AC_ARG_ENABLE([manpages],
160 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
161 [], enable_manpages=yes)
162 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
164 AC_ARG_ENABLE([test-modules],
165 AS_HELP_STRING([--disable-test-modules], [disable building test modules during make check: cached modules will be used @<:@default=enabled@:>@]),
166 [], enable_test_modules=yes)
167 AM_CONDITIONAL([BUILD_MODULES], [test "x$enable_test_modules" = "xyes"])
169 AC_ARG_ENABLE([logging],
170 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
171 [], enable_logging=yes)
172 AS_IF([test "x$enable_logging" = "xyes"], [
173 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
176 AC_ARG_ENABLE([debug],
177 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
178 [], [enable_debug=no])
179 AS_IF([test "x$enable_debug" = "xyes"], [
180 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
183 AC_ARG_ENABLE([python],
184 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
185 [], [enable_python=no])
186 AS_IF([test "x$enable_python" = "xyes"], [
187 AM_PATH_PYTHON(,,[:])
188 AC_PATH_PROG([CYTHON], [cython], [:])
190 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
192 [PKG_CHECK_MODULES([PYTHON], [python],
196 AS_IF([test "x$have_python" = xno],
197 [AC_MSG_ERROR([*** python support requested but libraries not found])])
199 AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
201 AC_ARG_ENABLE([coverage],
202 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
203 [], [enable_coverage=no])
204 AS_IF([test "x$enable_coverage" = "xyes"], [
205 AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
206 AS_IF([test "x$have_coverage" = xno],[
207 AC_MSG_ERROR([*** lcov support requested but the program was not found])
209 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
210 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
211 AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
212 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
215 CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
221 AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
223 m4_ifdef([GTK_DOC_CHECK], [
224 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
226 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
228 #####################################################################
229 # Default CFLAGS and LDFLAGS
230 #####################################################################
232 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
234 -DANOTHER_BRICK_IN_THE \
245 -Wmissing-include-dirs \
246 -Wformat-nonliteral \
247 -Wold-style-definition \
250 -Wdeclaration-after-statement \
252 -Wmissing-prototypes \
253 -Wstrict-prototypes \
255 -Wmissing-declarations \
259 -Wstrict-aliasing=3 \
262 -Wno-overlength-strings \
263 -Wno-unused-parameter \
264 -Wno-missing-field-initializers \
271 -fdiagnostics-show-option \
272 -fvisibility=hidden \
273 -ffunction-sections \
275 AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
278 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
282 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
284 AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build])
286 #####################################################################
287 # Generate files from *.in
288 #####################################################################
293 libkmod/docs/Makefile
294 libkmod/docs/version.xml
296 libkmod/python/kmod/version.py
300 #####################################################################
308 sysconfdir: ${sysconfdir}
310 rootlibdir: ${rootlibdir}
311 includedir: ${includedir}
313 Bash completions dir: ${with_bashcompletiondir}
316 cflags: ${with_cflags} ${CFLAGS}
317 ldflags: ${with_ldflags} ${LDFLAGS}
319 experimental features: ${enable_experimental}
320 tools: ${enable_tools}
321 python bindings: ${enable_python}
322 logging: ${enable_logging}
323 compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib}
324 debug: ${enable_debug}
325 coverage: ${enable_coverage}
326 doc: ${enable_gtk_doc}
327 man: ${enable_manpages}
328 test-modules: ${enable_test_modules}
330 features: ${with_features}