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