]>
Commit | Line | Data |
---|---|---|
481ad145 | 1 | AC_PREREQ(2.64) |
cb48c9b2 | 2 | AC_INIT([kmod], |
aff617ea | 3 | [31], |
e17cc3af | 4 | [linux-modules@vger.kernel.org], |
cb48c9b2 | 5 | [kmod], |
bb05bc8a | 6 | [http://git.kernel.org/?p=utils/kernel/kmod/kmod.git]) |
586fc304 LDM |
7 | |
8 | AC_CONFIG_SRCDIR([libkmod/libkmod.c]) | |
481ad145 LDM |
9 | AC_CONFIG_MACRO_DIR([m4]) |
10 | AC_CONFIG_HEADERS(config.h) | |
ecd40ee4 | 11 | AC_CONFIG_AUX_DIR([build-aux]) |
481ad145 | 12 | |
ecd40ee4 LDM |
13 | AC_USE_SYSTEM_EXTENSIONS |
14 | AC_SYS_LARGEFILE | |
ecd40ee4 | 15 | AC_PREFIX_DEFAULT([/usr]) |
f5cc26c7 | 16 | AM_MAINTAINER_MODE([enable]) |
481ad145 LDM |
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]) | |
ecd40ee4 | 20 | |
fae77516 LDM |
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])]) | |
b7016153 | 23 | |
ecef7c13 MS |
24 | module_compressions="" |
25 | module_signatures="legacy" | |
26 | ||
3ef7208e LDM |
27 | ##################################################################### |
28 | # Program checks and configurations | |
29 | ##################################################################### | |
30 | ||
9faa7b37 KS |
31 | AC_PROG_SED |
32 | AC_PROG_MKDIR_P | |
481ad145 | 33 | AC_PROG_LN_S |
7b3a74fc | 34 | PKG_PROG_PKG_CONFIG |
bccb4b25 | 35 | AC_PATH_PROG([XSLTPROC], [xsltproc]) |
8d9c7e37 | 36 | AC_PATH_PROG([MKOSI], [mkosi]) |
3d8226ed | 37 | |
481ad145 | 38 | AC_PROG_CC_C99 |
3ef7208e LDM |
39 | |
40 | ##################################################################### | |
41 | # Function and structure checks | |
42 | ##################################################################### | |
43 | ||
d005aeb7 | 44 | AC_CHECK_FUNCS_ONCE(__xstat) |
41a51c2a | 45 | AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv]) |
55112d19 | 46 | AC_CHECK_FUNCS_ONCE([finit_module]) |
d005aeb7 | 47 | |
e6307200 LDM |
48 | CC_CHECK_FUNC_BUILTIN([__builtin_clz]) |
49 | CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p]) | |
aac5f451 LDM |
50 | CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ]) |
51 | CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ]) | |
e6307200 | 52 | |
3ef7208e LDM |
53 | # dietlibc doesn't have st.st_mtim struct member |
54 | AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>]) | |
55 | ||
04c0956e LDM |
56 | # musl 1.0 and bionic 4.4 don't have strndupa |
57 | AC_CHECK_DECLS_ONCE([strndupa]) | |
58 | ||
9b34db1a RM |
59 | # RHEL 5 and older do not have be32toh |
60 | AC_CHECK_DECLS_ONCE([be32toh]) | |
61 | ||
144d1826 KC |
62 | # Check kernel headers |
63 | AC_CHECK_HEADERS_ONCE([linux/module.h]) | |
64 | ||
dc8ed09f TP |
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])]) | |
3ef7208e | 71 | |
16a62c7a LDM |
72 | AC_MSG_CHECKING([whether _Noreturn is supported]) |
73 | AC_COMPILE_IFELSE( | |
035e6667 FW |
74 | [AC_LANG_SOURCE([[#include <stdlib.h> |
75 | _Noreturn int foo(void) { exit(0); }]])], | |
16a62c7a LDM |
76 | [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available]) |
77 | AC_MSG_RESULT([yes])], | |
78 | [AC_MSG_RESULT([no])]) | |
79 | ||
80 | ||
3ef7208e LDM |
81 | ##################################################################### |
82 | # --with- | |
83 | ##################################################################### | |
84 | ||
8463809f MS |
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 | ||
e79bf83b KS |
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 | ||
3821e197 TM |
94 | AC_ARG_WITH([zstd], |
95 | AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]), | |
96 | [], [with_zstd=no]) | |
97 | AS_IF([test "x$with_zstd" != "xno"], [ | |
3d1bd339 | 98 | PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4], [LIBS="$LIBS $libzstd_LIBS"]) |
3821e197 | 99 | AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.]) |
ecef7c13 | 100 | module_compressions="zstd $module_compressions" |
3821e197 TM |
101 | ], [ |
102 | AC_MSG_NOTICE([Zstandard support not requested]) | |
103 | ]) | |
104 | CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD]) | |
105 | ||
b182f8fb JE |
106 | AC_ARG_WITH([xz], |
107 | AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]), | |
108 | [], [with_xz=no]) | |
109 | AS_IF([test "x$with_xz" != "xno"], [ | |
3d1bd339 | 110 | PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99], [LIBS="$LIBS $liblzma_LIBS"]) |
b182f8fb | 111 | AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.]) |
ecef7c13 | 112 | module_compressions="xz $module_compressions" |
b182f8fb JE |
113 | ], [ |
114 | AC_MSG_NOTICE([Xz support not requested]) | |
115 | ]) | |
4671e03e | 116 | CC_FEATURE_APPEND([with_features], [with_xz], [XZ]) |
b182f8fb | 117 | |
5a51a357 JE |
118 | AC_ARG_WITH([zlib], |
119 | AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]), | |
120 | [], [with_zlib=no]) | |
121 | AS_IF([test "x$with_zlib" != "xno"], [ | |
3d1bd339 | 122 | PKG_CHECK_MODULES([zlib], [zlib], [LIBS="$LIBS $zlib_LIBS"]) |
7b3a74fc | 123 | AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.]) |
ecef7c13 | 124 | module_compressions="gzip $module_compressions" |
cfb908bf LDM |
125 | ], [ |
126 | AC_MSG_NOTICE([zlib support not requested]) | |
cfb908bf | 127 | ]) |
4671e03e | 128 | CC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB]) |
3d8226ed | 129 | |
391b4714 YK |
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"], [ | |
3d1bd339 | 134 | PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"]) |
391b4714 | 135 | AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.]) |
ecef7c13 | 136 | module_signatures="PKCS7 $module_signatures" |
391b4714 YK |
137 | ], [ |
138 | AC_MSG_NOTICE([openssl support not requested]) | |
139 | ]) | |
8e266b9e | 140 | CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO]) |
391b4714 | 141 | |
80cf2c8f LDM |
142 | AC_ARG_WITH([bashcompletiondir], |
143 | AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), | |
144 | [], | |
145 | [AS_IF([$($PKG_CONFIG --exists bash-completion)], [ | |
146 | with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion) | |
147 | ] , [ | |
148 | with_bashcompletiondir=${datadir}/bash-completion/completions | |
149 | ])]) | |
150 | AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) | |
3ef7208e LDM |
151 | |
152 | ##################################################################### | |
153 | # --enable- | |
154 | ##################################################################### | |
155 | ||
013e8550 LDM |
156 | AC_ARG_ENABLE([experimental], |
157 | AS_HELP_STRING([--enable-experimental], [enable experimental tools and features. Do not enable it unless you know what you are doing. @<:@default=disabled@:>@]), | |
158 | [], enable_experimental=no) | |
159 | AM_CONDITIONAL([BUILD_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) | |
160 | AS_IF([test "x$enable_experimental" = "xyes"], [ | |
161 | AC_DEFINE(ENABLE_EXPERIMENTAL, [1], [Experimental features.]) | |
162 | ]) | |
4671e03e | 163 | CC_FEATURE_APPEND([with_features], [enable_experimental], [EXPERIMENTAL]) |
013e8550 | 164 | |
3ef7208e LDM |
165 | AC_ARG_ENABLE([tools], |
166 | AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]), | |
167 | [], enable_tools=yes) | |
168 | AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"]) | |
169 | ||
8631552d CW |
170 | AC_ARG_ENABLE([manpages], |
171 | AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]), | |
172 | [], enable_manpages=yes) | |
173 | AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"]) | |
174 | ||
23603f1f LDM |
175 | AC_ARG_ENABLE([test-modules], |
176 | AS_HELP_STRING([--disable-test-modules], [disable building test modules during make check: cached modules will be used @<:@default=enabled@:>@]), | |
177 | [], enable_test_modules=yes) | |
178 | AM_CONDITIONAL([BUILD_MODULES], [test "x$enable_test_modules" = "xyes"]) | |
179 | ||
3ef7208e LDM |
180 | AC_ARG_ENABLE([logging], |
181 | AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), | |
182 | [], enable_logging=yes) | |
183 | AS_IF([test "x$enable_logging" = "xyes"], [ | |
184 | AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) | |
185 | ]) | |
186 | ||
ecd40ee4 LDM |
187 | AC_ARG_ENABLE([debug], |
188 | AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), | |
189 | [], [enable_debug=no]) | |
190 | AS_IF([test "x$enable_debug" = "xyes"], [ | |
191 | AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) | |
192 | ]) | |
193 | ||
3a33a7a5 LDM |
194 | AC_ARG_ENABLE([python], |
195 | AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]), | |
196 | [], [enable_python=no]) | |
197 | AS_IF([test "x$enable_python" = "xyes"], [ | |
198 | AM_PATH_PYTHON(,,[:]) | |
199 | AC_PATH_PROG([CYTHON], [cython], [:]) | |
200 | ||
201 | PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}], | |
202 | [have_python=yes], | |
203 | [PKG_CHECK_MODULES([PYTHON], [python], | |
204 | [have_python=yes], | |
205 | [have_python=no])]) | |
206 | ||
207 | AS_IF([test "x$have_python" = xno], | |
208 | [AC_MSG_ERROR([*** python support requested but libraries not found])]) | |
209 | ]) | |
210 | AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"]) | |
211 | ||
e9b0d1b4 LDM |
212 | AC_ARG_ENABLE([coverage], |
213 | AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]), | |
214 | [], [enable_coverage=no]) | |
215 | AS_IF([test "x$enable_coverage" = "xyes"], [ | |
216 | AC_CHECK_PROG(have_coverage, [lcov], [yes], [no]) | |
217 | AS_IF([test "x$have_coverage" = xno],[ | |
218 | AC_MSG_ERROR([*** lcov support requested but the program was not found]) | |
219 | ], [ | |
220 | lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`" | |
221 | lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`" | |
222 | AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [ | |
223 | AC_MSG_ERROR([*** lcov version is too old. 1.10 required]) | |
224 | ], [ | |
225 | have_coverage=yes | |
226 | CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\ | |
227 | -fprofile-arcs \ | |
228 | -ftest-coverage]) | |
229 | ]) | |
230 | ]) | |
231 | ]) | |
232 | AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"]) | |
233 | ||
3ef7208e LDM |
234 | m4_ifdef([GTK_DOC_CHECK], [ |
235 | GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat]) | |
236 | ], [ | |
237 | AM_CONDITIONAL([ENABLE_GTK_DOC], false)]) | |
238 | ||
3ef7208e LDM |
239 | ##################################################################### |
240 | # Default CFLAGS and LDFLAGS | |
241 | ##################################################################### | |
6068aaae | 242 | |
e48f3765 LDM |
243 | CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\ |
244 | -pipe \ | |
245 | -DANOTHER_BRICK_IN_THE \ | |
246 | -Wall \ | |
247 | -W \ | |
248 | -Wextra \ | |
249 | -Wno-inline \ | |
250 | -Wvla \ | |
251 | -Wundef \ | |
252 | -Wformat=2 \ | |
253 | -Wlogical-op \ | |
254 | -Wsign-compare \ | |
255 | -Wformat-security \ | |
256 | -Wmissing-include-dirs \ | |
257 | -Wformat-nonliteral \ | |
258 | -Wold-style-definition \ | |
259 | -Wpointer-arith \ | |
260 | -Winit-self \ | |
261 | -Wdeclaration-after-statement \ | |
262 | -Wfloat-equal \ | |
263 | -Wmissing-prototypes \ | |
264 | -Wstrict-prototypes \ | |
265 | -Wredundant-decls \ | |
266 | -Wmissing-declarations \ | |
267 | -Wmissing-noreturn \ | |
268 | -Wshadow \ | |
269 | -Wendif-labels \ | |
db62153e | 270 | -Wstrict-aliasing=3 \ |
e48f3765 LDM |
271 | -Wwrite-strings \ |
272 | -Wno-long-long \ | |
273 | -Wno-overlength-strings \ | |
274 | -Wno-unused-parameter \ | |
275 | -Wno-missing-field-initializers \ | |
276 | -Wno-unused-result \ | |
277 | -Wnested-externs \ | |
278 | -Wchar-subscripts \ | |
279 | -Wtype-limits \ | |
280 | -Wuninitialized \ | |
281 | -fno-common \ | |
282 | -fdiagnostics-show-option \ | |
283 | -fvisibility=hidden \ | |
284 | -ffunction-sections \ | |
285 | -fdata-sections]) | |
27bcc911 | 286 | AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags") |
e48f3765 | 287 | |
c677bf2c | 288 | |
e48f3765 LDM |
289 | CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \ |
290 | -Wl,--as-needed \ | |
a5f799af | 291 | -Wl,--no-undefined \ |
e48f3765 | 292 | -Wl,--gc-sections]) |
84aaaedf | 293 | AC_SUBST([OUR_LDFLAGS], $with_ldflags) |
3ef7208e | 294 | |
4671e03e LDM |
295 | AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build]) |
296 | ||
3ef7208e LDM |
297 | ##################################################################### |
298 | # Generate files from *.in | |
299 | ##################################################################### | |
300 | ||
ecef7c13 MS |
301 | AC_SUBST([module_compressions], $module_compressions) |
302 | AC_SUBST([module_signatures], $module_signatures) | |
303 | ||
ecd40ee4 LDM |
304 | AC_CONFIG_FILES([ |
305 | Makefile | |
904b57d0 | 306 | man/Makefile |
646b83b8 LDM |
307 | libkmod/docs/Makefile |
308 | libkmod/docs/version.xml | |
e4c1a5b2 EV |
309 | libkmod/libkmod.pc |
310 | libkmod/python/kmod/version.py | |
ecef7c13 | 311 | tools/kmod.pc |
ecd40ee4 LDM |
312 | ]) |
313 | ||
3ef7208e LDM |
314 | |
315 | ##################################################################### | |
646b83b8 | 316 | |
ecd40ee4 LDM |
317 | AC_OUTPUT |
318 | AC_MSG_RESULT([ | |
319 | $PACKAGE $VERSION | |
80cf2c8f | 320 | ======= |
ecd40ee4 LDM |
321 | |
322 | prefix: ${prefix} | |
323 | sysconfdir: ${sysconfdir} | |
8463809f | 324 | distconfdir: ${distconfdir} |
ecd40ee4 | 325 | libdir: ${libdir} |
e79bf83b | 326 | rootlibdir: ${rootlibdir} |
ecd40ee4 | 327 | includedir: ${includedir} |
7c41c2dd | 328 | bindir: ${bindir} |
80cf2c8f | 329 | Bash completions dir: ${with_bashcompletiondir} |
ecd40ee4 LDM |
330 | |
331 | compiler: ${CC} | |
e48f3765 LDM |
332 | cflags: ${with_cflags} ${CFLAGS} |
333 | ldflags: ${with_ldflags} ${LDFLAGS} | |
ecd40ee4 | 334 | |
013e8550 | 335 | experimental features: ${enable_experimental} |
7c41c2dd | 336 | tools: ${enable_tools} |
3a33a7a5 | 337 | python bindings: ${enable_python} |
ecd40ee4 | 338 | logging: ${enable_logging} |
3821e197 | 339 | compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib} |
ecd40ee4 | 340 | debug: ${enable_debug} |
e9b0d1b4 | 341 | coverage: ${enable_coverage} |
646b83b8 | 342 | doc: ${enable_gtk_doc} |
382de85c | 343 | man: ${enable_manpages} |
23603f1f | 344 | test-modules: ${enable_test_modules} |
4671e03e LDM |
345 | |
346 | features: ${with_features} | |
ecd40ee4 | 347 | ]) |