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])
36 #####################################################################
37 # Function and structure checks
38 #####################################################################
40 AC_CHECK_FUNCS_ONCE(__xstat)
41 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
42 AC_CHECK_FUNCS_ONCE([finit_module])
44 CC_CHECK_FUNC_BUILTIN([__builtin_clz])
45 CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
46 CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ])
47 CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
49 # dietlibc doesn't have st.st_mtim struct member
50 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
52 # musl 1.0 and bionic 4.4 don't have strndupa
53 AC_CHECK_DECLS_ONCE([strndupa])
55 # RHEL 5 and older do not have be32toh
56 AC_CHECK_DECLS_ONCE([be32toh])
58 # Check kernel headers
59 AC_CHECK_HEADERS_ONCE([linux/module.h])
61 AC_MSG_CHECKING([whether _Static_assert() is supported])
63 [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
64 [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
65 AC_MSG_RESULT([yes])],
66 [AC_MSG_RESULT([no])])
68 AC_MSG_CHECKING([whether _Noreturn is supported])
70 [AC_LANG_SOURCE([[_Noreturn int foo(void) { exit(0); }]])],
71 [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available])
72 AC_MSG_RESULT([yes])],
73 [AC_MSG_RESULT([no])])
76 #####################################################################
78 #####################################################################
80 AC_ARG_WITH([rootlibdir],
81 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
82 [], [with_rootlibdir=$libdir])
83 AC_SUBST([rootlibdir], [$with_rootlibdir])
86 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
88 AS_IF([test "x$with_xz" != "xno"], [
89 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99])
90 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
92 AC_MSG_NOTICE([Xz support not requested])
96 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
98 AS_IF([test "x$with_zlib" != "xno"], [
99 PKG_CHECK_MODULES([zlib], [zlib])
100 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
102 AC_MSG_NOTICE([zlib support not requested])
105 AC_ARG_WITH([bashcompletiondir],
106 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
108 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
109 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
111 with_bashcompletiondir=${datadir}/bash-completion/completions
113 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
115 #####################################################################
117 #####################################################################
119 AC_ARG_ENABLE([tools],
120 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
121 [], enable_tools=yes)
122 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
124 AC_ARG_ENABLE([manpages],
125 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
126 [], enable_manpages=yes)
127 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
129 AC_ARG_ENABLE([logging],
130 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
131 [], enable_logging=yes)
132 AS_IF([test "x$enable_logging" = "xyes"], [
133 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
136 AC_ARG_ENABLE([debug],
137 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
138 [], [enable_debug=no])
139 AS_IF([test "x$enable_debug" = "xyes"], [
140 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
143 AC_ARG_ENABLE([python],
144 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
145 [], [enable_python=no])
146 AS_IF([test "x$enable_python" = "xyes"], [
147 AM_PATH_PYTHON(,,[:])
148 AC_PATH_PROG([CYTHON], [cython], [:])
150 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
152 [PKG_CHECK_MODULES([PYTHON], [python],
156 AS_IF([test "x$have_python" = xno],
157 [AC_MSG_ERROR([*** python support requested but libraries not found])])
159 AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
161 AC_ARG_ENABLE([coverage],
162 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
163 [], [enable_coverage=no])
164 AS_IF([test "x$enable_coverage" = "xyes"], [
165 AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
166 AS_IF([test "x$have_coverage" = xno],[
167 AC_MSG_ERROR([*** lcov support requested but the program was not found])
169 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
170 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
171 AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
172 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
175 CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
181 AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
183 m4_ifdef([GTK_DOC_CHECK], [
184 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
186 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
189 #####################################################################
190 # Default CFLAGS and LDFLAGS
191 #####################################################################
193 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
195 -DANOTHER_BRICK_IN_THE \
206 -Wmissing-include-dirs \
207 -Wformat-nonliteral \
208 -Wold-style-definition \
211 -Wdeclaration-after-statement \
213 -Wmissing-prototypes \
214 -Wstrict-prototypes \
216 -Wmissing-declarations \
220 -Wstrict-aliasing=3 \
223 -Wno-overlength-strings \
224 -Wno-unused-parameter \
225 -Wno-missing-field-initializers \
232 -fdiagnostics-show-option \
233 -fvisibility=hidden \
234 -ffunction-sections \
236 AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
239 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
243 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
245 #####################################################################
246 # Generate files from *.in
247 #####################################################################
252 libkmod/docs/Makefile
253 libkmod/docs/version.xml
257 #####################################################################
265 sysconfdir: ${sysconfdir}
267 rootlibdir: ${rootlibdir}
268 includedir: ${includedir}
270 Bash completions dir: ${with_bashcompletiondir}
273 cflags: ${with_cflags} ${CFLAGS}
274 ldflags: ${with_ldflags} ${LDFLAGS}
276 tools: ${enable_tools}
277 python bindings: ${enable_python}
278 logging: ${enable_logging}
279 compression: xz=${with_xz} zlib=${with_zlib}
280 debug: ${enable_debug}
281 coverage: ${enable_coverage}
282 doc: ${enable_gtk_doc}
283 man: ${enable_manpages}