]> git.ipfire.org Git - thirdparty/kmod.git/blob - configure.ac
Drop python bindings
[thirdparty/kmod.git] / configure.ac
1 AC_PREREQ(2.64)
2 AC_INIT([kmod],
3 [31],
4 [linux-modules@vger.kernel.org],
5 [kmod],
6 [http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
7
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])
12
13 AC_USE_SYSTEM_EXTENSIONS
14 AC_SYS_LARGEFILE
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])
20
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])])
23
24 module_compressions=""
25 module_signatures="legacy"
26
27 #####################################################################
28 # Program checks and configurations
29 #####################################################################
30
31 AC_PROG_SED
32 AC_PROG_MKDIR_P
33 AC_PROG_LN_S
34 PKG_PROG_PKG_CONFIG
35 AC_PATH_PROG([XSLTPROC], [xsltproc])
36 AC_PATH_PROG([MKOSI], [mkosi])
37
38 AC_PROG_CC_C99
39
40 #####################################################################
41 # Function and structure checks
42 #####################################################################
43
44 AC_CHECK_FUNCS_ONCE(__xstat)
45 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
46 AC_CHECK_FUNCS_ONCE([finit_module])
47
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], [ ], [ ])
52
53 # dietlibc doesn't have st.st_mtim struct member
54 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
55
56 # musl 1.0 and bionic 4.4 don't have strndupa
57 AC_CHECK_DECLS_ONCE([strndupa])
58
59 # RHEL 5 and older do not have be32toh
60 AC_CHECK_DECLS_ONCE([be32toh])
61
62 # Check kernel headers
63 AC_CHECK_HEADERS_ONCE([linux/module.h])
64
65 AC_MSG_CHECKING([whether _Static_assert() is supported])
66 AC_COMPILE_IFELSE(
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])])
71
72 AC_MSG_CHECKING([whether _Noreturn is supported])
73 AC_COMPILE_IFELSE(
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])])
79
80
81 #####################################################################
82 # --with-
83 #####################################################################
84
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])
88
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])
93
94 # Ideally this would be $prefix/lib/modules but default to /lib/modules for compatibility with earlier versions
95 AC_ARG_WITH([module_directory],
96 AS_HELP_STRING([--with-module-directory=DIR], [directory in which to look for kernel modules - typically '/lib/modules' or '${prefix}/lib/modules']),
97 [], [with_module_directory=/lib/modules])
98 AC_SUBST([module_directory], [$with_module_directory])
99
100 # Check all directory arguments for consistency.
101 for ac_var in distconfdir rootlibdir module_directory
102 do
103 eval ac_val=\$$ac_var
104 # Remove trailing slashes.
105 case $ac_val in
106 */ )
107 ac_val=`expr "X$ac_val" : 'X\(.*@<:@^/@:>@\)' \| "X$ac_val" : 'X\(.*\)'`
108 eval $ac_var=\$ac_val;;
109 esac
110 # Be sure to have absolute directory names.
111 case $ac_val in
112 @<:@\\/$@:>@* | ?:@<:@\\/@:>@* ) continue;;
113 esac
114 as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
115 done
116
117 AC_ARG_WITH([zstd],
118 AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
119 [], [with_zstd=no])
120 AS_IF([test "x$with_zstd" != "xno"], [
121 PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4], [LIBS="$LIBS $libzstd_LIBS"])
122 AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.])
123 module_compressions="zstd $module_compressions"
124 ], [
125 AC_MSG_NOTICE([Zstandard support not requested])
126 ])
127 CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD])
128
129 AC_ARG_WITH([xz],
130 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
131 [], [with_xz=no])
132 AS_IF([test "x$with_xz" != "xno"], [
133 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99], [LIBS="$LIBS $liblzma_LIBS"])
134 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
135 module_compressions="xz $module_compressions"
136 ], [
137 AC_MSG_NOTICE([Xz support not requested])
138 ])
139 CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
140
141 AC_ARG_WITH([zlib],
142 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
143 [], [with_zlib=no])
144 AS_IF([test "x$with_zlib" != "xno"], [
145 PKG_CHECK_MODULES([zlib], [zlib], [LIBS="$LIBS $zlib_LIBS"])
146 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
147 module_compressions="gzip $module_compressions"
148 ], [
149 AC_MSG_NOTICE([zlib support not requested])
150 ])
151 CC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB])
152
153 AC_ARG_WITH([openssl],
154 AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
155 [], [with_openssl=no])
156 AS_IF([test "x$with_openssl" != "xno"], [
157 PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"])
158 AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
159 module_signatures="PKCS7 $module_signatures"
160 ], [
161 AC_MSG_NOTICE([openssl support not requested])
162 ])
163 CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO])
164
165 AC_ARG_WITH([bashcompletiondir],
166 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
167 [],
168 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
169 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
170 ] , [
171 with_bashcompletiondir=${datadir}/bash-completion/completions
172 ])])
173 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
174
175 #####################################################################
176 # --enable-
177 #####################################################################
178
179 AC_ARG_ENABLE([experimental],
180 AS_HELP_STRING([--enable-experimental], [enable experimental tools and features. Do not enable it unless you know what you are doing. @<:@default=disabled@:>@]),
181 [], enable_experimental=no)
182 AM_CONDITIONAL([BUILD_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
183 AS_IF([test "x$enable_experimental" = "xyes"], [
184 AC_DEFINE(ENABLE_EXPERIMENTAL, [1], [Experimental features.])
185 ])
186 CC_FEATURE_APPEND([with_features], [enable_experimental], [EXPERIMENTAL])
187
188 AC_ARG_ENABLE([tools],
189 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
190 [], enable_tools=yes)
191 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
192
193 AC_ARG_ENABLE([manpages],
194 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
195 [], enable_manpages=yes)
196 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
197
198 AC_ARG_ENABLE([test-modules],
199 AS_HELP_STRING([--disable-test-modules], [disable building test modules during make check: cached modules will be used @<:@default=enabled@:>@]),
200 [], enable_test_modules=yes)
201 AM_CONDITIONAL([BUILD_MODULES], [test "x$enable_test_modules" = "xyes"])
202
203 AC_ARG_ENABLE([logging],
204 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
205 [], enable_logging=yes)
206 AS_IF([test "x$enable_logging" = "xyes"], [
207 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
208 ])
209
210 AC_ARG_ENABLE([debug],
211 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
212 [], [enable_debug=no])
213 AS_IF([test "x$enable_debug" = "xyes"], [
214 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
215 ])
216
217 AC_ARG_ENABLE([coverage],
218 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
219 [], [enable_coverage=no])
220 AS_IF([test "x$enable_coverage" = "xyes"], [
221 AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
222 AS_IF([test "x$have_coverage" = xno],[
223 AC_MSG_ERROR([*** lcov support requested but the program was not found])
224 ], [
225 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
226 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
227 AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
228 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
229 ], [
230 have_coverage=yes
231 CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
232 -fprofile-arcs \
233 -ftest-coverage])
234 ])
235 ])
236 ])
237 AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
238
239 m4_ifdef([GTK_DOC_CHECK], [
240 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
241 ], [
242 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
243
244 #####################################################################
245 # Default CFLAGS and LDFLAGS
246 #####################################################################
247
248 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
249 -pipe \
250 -DANOTHER_BRICK_IN_THE \
251 -Wall \
252 -W \
253 -Wextra \
254 -Wno-inline \
255 -Wvla \
256 -Wundef \
257 -Wformat=2 \
258 -Wlogical-op \
259 -Wsign-compare \
260 -Wformat-security \
261 -Wmissing-include-dirs \
262 -Wformat-nonliteral \
263 -Wold-style-definition \
264 -Wpointer-arith \
265 -Winit-self \
266 -Wdeclaration-after-statement \
267 -Wfloat-equal \
268 -Wmissing-prototypes \
269 -Wstrict-prototypes \
270 -Wredundant-decls \
271 -Wmissing-declarations \
272 -Wmissing-noreturn \
273 -Wshadow \
274 -Wendif-labels \
275 -Wstrict-aliasing=3 \
276 -Wwrite-strings \
277 -Wno-long-long \
278 -Wno-overlength-strings \
279 -Wno-unused-parameter \
280 -Wno-missing-field-initializers \
281 -Wno-unused-result \
282 -Wnested-externs \
283 -Wchar-subscripts \
284 -Wtype-limits \
285 -Wuninitialized \
286 -fno-common \
287 -fdiagnostics-show-option \
288 -fvisibility=hidden \
289 -ffunction-sections \
290 -fdata-sections])
291 AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
292
293
294 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
295 -Wl,--as-needed \
296 -Wl,--no-undefined \
297 -Wl,--gc-sections])
298 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
299
300 AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build])
301
302 #####################################################################
303 # Generate files from *.in
304 #####################################################################
305
306 AC_SUBST([module_compressions], $module_compressions)
307 AC_SUBST([module_signatures], $module_signatures)
308
309 AC_CONFIG_FILES([
310 Makefile
311 man/Makefile
312 libkmod/docs/Makefile
313 libkmod/docs/version.xml
314 libkmod/libkmod.pc
315 tools/kmod.pc
316 ])
317
318
319 #####################################################################
320
321 AC_OUTPUT
322 AC_MSG_RESULT([
323 $PACKAGE $VERSION
324 =======
325
326 module_directory: ${module_directory}
327 prefix: ${prefix}
328 sysconfdir: ${sysconfdir}
329 distconfdir: ${distconfdir}
330 libdir: ${libdir}
331 rootlibdir: ${rootlibdir}
332 includedir: ${includedir}
333 bindir: ${bindir}
334 Bash completions dir: ${with_bashcompletiondir}
335
336 compiler: ${CC}
337 cflags: ${with_cflags} ${CFLAGS}
338 ldflags: ${with_ldflags} ${LDFLAGS}
339
340 experimental features: ${enable_experimental}
341 tools: ${enable_tools}
342 logging: ${enable_logging}
343 compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib}
344 debug: ${enable_debug}
345 coverage: ${enable_coverage}
346 doc: ${enable_gtk_doc}
347 man: ${enable_manpages}
348 test-modules: ${enable_test_modules}
349
350 features: ${with_features}
351 ])