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