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