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 module_compressions=""
25 module_signatures="legacy"
27 #####################################################################
28 # Program checks and configurations
29 #####################################################################
35 AC_PATH_PROG([XSLTPROC], [xsltproc])
36 AC_PATH_PROG([MKOSI], [mkosi])
40 #####################################################################
41 # Function and structure checks
42 #####################################################################
44 AC_CHECK_FUNCS_ONCE(__xstat)
45 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
46 AC_CHECK_FUNCS_ONCE([finit_module])
48 CC_CHECK_FUNC_BUILTIN([__builtin_clz])
49 CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
50 CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ])
51 CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
53 # dietlibc doesn't have st.st_mtim struct member
54 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
56 # musl 1.0 and bionic 4.4 don't have strndupa
57 AC_CHECK_DECLS_ONCE([strndupa])
59 # RHEL 5 and older do not have be32toh
60 AC_CHECK_DECLS_ONCE([be32toh])
62 # Check kernel headers
63 AC_CHECK_HEADERS_ONCE([linux/module.h])
65 AC_MSG_CHECKING([whether _Static_assert() is supported])
67 [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
68 [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
69 AC_MSG_RESULT([yes])],
70 [AC_MSG_RESULT([no])])
72 AC_MSG_CHECKING([whether _Noreturn is supported])
74 [AC_LANG_SOURCE([[#include <stdlib.h>
75 _Noreturn int foo(void) { exit(0); }]])],
76 [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available])
77 AC_MSG_RESULT([yes])],
78 [AC_MSG_RESULT([no])])
81 #####################################################################
83 #####################################################################
85 AC_ARG_WITH([distconfdir], AS_HELP_STRING([--with-distconfdir=DIR], [directory to search for distribution configuration files]),
86 [], [with_distconfdir='${prefix}/lib'])
87 AC_SUBST([distconfdir], [$with_distconfdir])
89 AC_ARG_WITH([rootlibdir],
90 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
91 [], [with_rootlibdir=$libdir])
92 AC_SUBST([rootlibdir], [$with_rootlibdir])
95 AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
97 AS_IF([test "x$with_zstd" != "xno"], [
98 PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4], [LIBS="$LIBS $libzstd_LIBS"])
99 AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.])
100 module_compressions="zstd $module_compressions"
102 AC_MSG_NOTICE([Zstandard support not requested])
104 CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD])
107 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
109 AS_IF([test "x$with_xz" != "xno"], [
110 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99], [LIBS="$LIBS $liblzma_LIBS"])
111 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
112 module_compressions="xz $module_compressions"
114 AC_MSG_NOTICE([Xz support not requested])
116 CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
119 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
121 AS_IF([test "x$with_zlib" != "xno"], [
122 PKG_CHECK_MODULES([zlib], [zlib], [LIBS="$LIBS $zlib_LIBS"])
123 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
124 module_compressions="gzip $module_compressions"
126 AC_MSG_NOTICE([zlib support not requested])
128 CC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB])
130 AC_ARG_WITH([openssl],
131 AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
132 [], [with_openssl=no])
133 AS_IF([test "x$with_openssl" != "xno"], [
134 PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"])
135 AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
136 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <openssl/ssl.h>
137 int nid = NID_sm3;]])], [
138 AC_MSG_NOTICE([openssl supports sm3])
140 AC_MSG_NOTICE([openssl sm3 support not detected])
141 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3"
143 module_signatures="PKCS7 $module_signatures"
145 AC_MSG_NOTICE([openssl support not requested])
147 CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO])
149 AC_ARG_WITH([bashcompletiondir],
150 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
152 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
153 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
155 with_bashcompletiondir=${datadir}/bash-completion/completions
157 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
159 #####################################################################
161 #####################################################################
163 AC_ARG_ENABLE([experimental],
164 AS_HELP_STRING([--enable-experimental], [enable experimental tools and features. Do not enable it unless you know what you are doing. @<:@default=disabled@:>@]),
165 [], enable_experimental=no)
166 AM_CONDITIONAL([BUILD_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
167 AS_IF([test "x$enable_experimental" = "xyes"], [
168 AC_DEFINE(ENABLE_EXPERIMENTAL, [1], [Experimental features.])
170 CC_FEATURE_APPEND([with_features], [enable_experimental], [EXPERIMENTAL])
172 AC_ARG_ENABLE([tools],
173 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
174 [], enable_tools=yes)
175 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
177 AC_ARG_ENABLE([manpages],
178 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
179 [], enable_manpages=yes)
180 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
182 AC_ARG_ENABLE([test-modules],
183 AS_HELP_STRING([--disable-test-modules], [disable building test modules during make check: cached modules will be used @<:@default=enabled@:>@]),
184 [], enable_test_modules=yes)
185 AM_CONDITIONAL([BUILD_MODULES], [test "x$enable_test_modules" = "xyes"])
187 AC_ARG_ENABLE([logging],
188 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
189 [], enable_logging=yes)
190 AS_IF([test "x$enable_logging" = "xyes"], [
191 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
194 AC_ARG_ENABLE([debug],
195 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
196 [], [enable_debug=no])
197 AS_IF([test "x$enable_debug" = "xyes"], [
198 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
201 AC_ARG_ENABLE([python],
202 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
203 [], [enable_python=no])
204 AS_IF([test "x$enable_python" = "xyes"], [
205 AM_PATH_PYTHON(,,[:])
206 AC_PATH_PROG([CYTHON], [cython], [:])
208 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
210 [PKG_CHECK_MODULES([PYTHON], [python],
214 AS_IF([test "x$have_python" = xno],
215 [AC_MSG_ERROR([*** python support requested but libraries not found])])
217 AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
219 AC_ARG_ENABLE([coverage],
220 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
221 [], [enable_coverage=no])
222 AS_IF([test "x$enable_coverage" = "xyes"], [
223 AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
224 AS_IF([test "x$have_coverage" = xno],[
225 AC_MSG_ERROR([*** lcov support requested but the program was not found])
227 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
228 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
229 AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
230 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
233 CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
239 AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
241 m4_ifdef([GTK_DOC_CHECK], [
242 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
244 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
246 #####################################################################
247 # Default CFLAGS and LDFLAGS
248 #####################################################################
250 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
252 -DANOTHER_BRICK_IN_THE \
263 -Wmissing-include-dirs \
264 -Wformat-nonliteral \
265 -Wold-style-definition \
268 -Wdeclaration-after-statement \
270 -Wmissing-prototypes \
271 -Wstrict-prototypes \
273 -Wmissing-declarations \
277 -Wstrict-aliasing=3 \
280 -Wno-overlength-strings \
281 -Wno-unused-parameter \
282 -Wno-missing-field-initializers \
289 -fdiagnostics-show-option \
290 -fvisibility=hidden \
291 -ffunction-sections \
293 AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
296 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
300 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
302 AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build])
304 #####################################################################
305 # Generate files from *.in
306 #####################################################################
308 AC_SUBST([module_compressions], $module_compressions)
309 AC_SUBST([module_signatures], $module_signatures)
314 libkmod/docs/Makefile
315 libkmod/docs/version.xml
317 libkmod/python/kmod/version.py
322 #####################################################################
330 sysconfdir: ${sysconfdir}
331 distconfdir: ${distconfdir}
333 rootlibdir: ${rootlibdir}
334 includedir: ${includedir}
336 Bash completions dir: ${with_bashcompletiondir}
339 cflags: ${with_cflags} ${CFLAGS}
340 ldflags: ${with_ldflags} ${LDFLAGS}
342 experimental features: ${enable_experimental}
343 tools: ${enable_tools}
344 python bindings: ${enable_python}
345 logging: ${enable_logging}
346 compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib}
347 debug: ${enable_debug}
348 coverage: ${enable_coverage}
349 doc: ${enable_gtk_doc}
350 man: ${enable_manpages}
351 test-modules: ${enable_test_modules}
353 features: ${with_features}