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_AUX_DIR([build-aux])
10 AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules
11 tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
13 AC_USE_SYSTEM_EXTENSIONS
15 AC_CONFIG_MACRO_DIR([m4])
16 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
17 AM_SILENT_RULES([yes])
18 LT_INIT([disable-static pic-only])
19 AC_PREFIX_DEFAULT([/usr])
20 AM_MAINTAINER_MODE([enable])
22 AS_IF([test "x$enable_static" = "xyes"],
23 [AC_MSG_ERROR([--enable-static is not supported by kmod])])
26 #####################################################################
27 # Program checks and configurations
28 #####################################################################
33 AC_PROG_GCC_TRADITIONAL
39 AC_PATH_PROG([XSLTPROC], [xsltproc])
42 #####################################################################
43 # Function and structure checks
44 #####################################################################
46 AC_CHECK_FUNCS_ONCE(__xstat)
47 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
48 AC_CHECK_FUNCS_ONCE([finit_module])
50 CC_CHECK_FUNC_BUILTIN([__builtin_clz])
51 CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
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 #####################################################################
74 #####################################################################
76 AC_ARG_WITH([rootlibdir],
77 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
78 [], [with_rootlibdir=$libdir])
79 AC_SUBST([rootlibdir], [$with_rootlibdir])
82 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
84 AS_IF([test "x$with_xz" != "xno"], [
85 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99])
86 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
88 AC_MSG_NOTICE([Xz support not requested])
92 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
94 AS_IF([test "x$with_zlib" != "xno"], [
95 PKG_CHECK_MODULES([zlib], [zlib])
96 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
98 AC_MSG_NOTICE([zlib support not requested])
101 AC_ARG_WITH([bashcompletiondir],
102 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
104 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
105 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
107 with_bashcompletiondir=${datadir}/bash-completion/completions
109 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
111 #####################################################################
113 #####################################################################
115 AC_ARG_ENABLE([tools],
116 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
117 [], enable_tools=yes)
118 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
120 AC_ARG_ENABLE([manpages],
121 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
122 [], enable_manpages=yes)
123 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
125 AC_ARG_ENABLE([logging],
126 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
127 [], enable_logging=yes)
128 AS_IF([test "x$enable_logging" = "xyes"], [
129 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
132 AC_ARG_ENABLE([debug],
133 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
134 [], [enable_debug=no])
135 AS_IF([test "x$enable_debug" = "xyes"], [
136 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
139 AC_ARG_ENABLE([python],
140 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
141 [], [enable_python=no])
142 AS_IF([test "x$enable_python" = "xyes"], [
143 AM_PATH_PYTHON(,,[:])
144 AC_PATH_PROG([CYTHON], [cython], [:])
146 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
148 [PKG_CHECK_MODULES([PYTHON], [python],
152 AS_IF([test "x$have_python" = xno],
153 [AC_MSG_ERROR([*** python support requested but libraries not found])])
155 AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
157 AC_ARG_ENABLE([coverage],
158 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
159 [], [enable_coverage=no])
160 AS_IF([test "x$enable_coverage" = "xyes"], [
161 AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
162 AS_IF([test "x$have_coverage" = xno],[
163 AC_MSG_ERROR([*** lcov support requested but the program was not found])
165 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
166 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
167 AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
168 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
171 CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
177 AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
179 m4_ifdef([GTK_DOC_CHECK], [
180 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
182 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
185 #####################################################################
186 # Default CFLAGS and LDFLAGS
187 #####################################################################
189 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
191 -DANOTHER_BRICK_IN_THE \
202 -Wmissing-include-dirs \
203 -Wformat-nonliteral \
204 -Wold-style-definition \
207 -Wdeclaration-after-statement \
209 -Wmissing-prototypes \
210 -Wstrict-prototypes \
212 -Wmissing-declarations \
216 -Wstrict-aliasing=3 \
219 -Wno-overlength-strings \
220 -Wno-unused-parameter \
221 -Wno-missing-field-initializers \
228 -fdiagnostics-show-option \
229 -fvisibility=hidden \
230 -ffunction-sections \
232 AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
235 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
239 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
241 #####################################################################
242 # Generate files from *.in
243 #####################################################################
245 AC_CONFIG_HEADERS(config.h)
249 libkmod/docs/Makefile
250 libkmod/docs/version.xml
254 #####################################################################
262 sysconfdir: ${sysconfdir}
264 rootlibdir: ${rootlibdir}
265 includedir: ${includedir}
267 Bash completions dir: ${with_bashcompletiondir}
270 cflags: ${with_cflags} ${CFLAGS}
271 ldflags: ${with_ldflags} ${LDFLAGS}
273 tools: ${enable_tools}
274 python bindings: ${enable_python}
275 logging: ${enable_logging}
276 compression: xz=${with_xz} zlib=${with_zlib}
277 debug: ${enable_debug}
278 coverage: ${enable_coverage}
279 doc: ${enable_gtk_doc}
280 man: ${enable_manpages}