]> git.ipfire.org Git - thirdparty/kmod.git/blame - configure.ac
build: cache modules from playground
[thirdparty/kmod.git] / configure.ac
CommitLineData
481ad145 1AC_PREREQ(2.64)
cb48c9b2 2AC_INIT([kmod],
d9c71758 3 [20],
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
8AC_CONFIG_SRCDIR([libkmod/libkmod.c])
481ad145
LDM
9AC_CONFIG_MACRO_DIR([m4])
10AC_CONFIG_HEADERS(config.h)
ecd40ee4 11AC_CONFIG_AUX_DIR([build-aux])
481ad145 12
ecd40ee4
LDM
13AC_USE_SYSTEM_EXTENSIONS
14AC_SYS_LARGEFILE
ecd40ee4 15AC_PREFIX_DEFAULT([/usr])
f5cc26c7 16AM_MAINTAINER_MODE([enable])
481ad145
LDM
17AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
18AM_SILENT_RULES([yes])
19LT_INIT([disable-static pic-only])
da6c0d2f 20DOLT
ecd40ee4 21
fae77516
LDM
22AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])])
23AS_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
29AC_PROG_SED
30AC_PROG_MKDIR_P
481ad145 31AC_PROG_LN_S
7b3a74fc 32PKG_PROG_PKG_CONFIG
bccb4b25 33AC_PATH_PROG([XSLTPROC], [xsltproc])
3d8226ed 34
481ad145 35AC_PROG_CC_C99
3ef7208e
LDM
36
37#####################################################################
38# Function and structure checks
39#####################################################################
40
d005aeb7 41AC_CHECK_FUNCS_ONCE(__xstat)
41a51c2a 42AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
55112d19 43AC_CHECK_FUNCS_ONCE([finit_module])
d005aeb7 44
e6307200
LDM
45CC_CHECK_FUNC_BUILTIN([__builtin_clz])
46CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
aac5f451
LDM
47CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ])
48CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
e6307200 49
3ef7208e
LDM
50# dietlibc doesn't have st.st_mtim struct member
51AC_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
54AC_CHECK_DECLS_ONCE([strndupa])
55
9b34db1a
RM
56# RHEL 5 and older do not have be32toh
57AC_CHECK_DECLS_ONCE([be32toh])
58
144d1826
KC
59# Check kernel headers
60AC_CHECK_HEADERS_ONCE([linux/module.h])
61
dc8ed09f
TP
62AC_MSG_CHECKING([whether _Static_assert() is supported])
63AC_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
69AC_MSG_CHECKING([whether _Noreturn is supported])
70AC_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
81AC_ARG_WITH([rootlibdir],
82 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
83 [], [with_rootlibdir=$libdir])
84AC_SUBST([rootlibdir], [$with_rootlibdir])
85
b182f8fb
JE
86AC_ARG_WITH([xz],
87 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
88 [], [with_xz=no])
89AS_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])
95
5a51a357
JE
96AC_ARG_WITH([zlib],
97 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
98 [], [with_zlib=no])
99AS_IF([test "x$with_zlib" != "xno"], [
7b3a74fc
JE
100 PKG_CHECK_MODULES([zlib], [zlib])
101 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
cfb908bf
LDM
102], [
103 AC_MSG_NOTICE([zlib support not requested])
cfb908bf 104])
3d8226ed 105
80cf2c8f
LDM
106AC_ARG_WITH([bashcompletiondir],
107 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
108 [],
109 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
110 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
111 ] , [
112 with_bashcompletiondir=${datadir}/bash-completion/completions
113 ])])
114AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
3ef7208e
LDM
115
116#####################################################################
117# --enable-
118#####################################################################
119
120AC_ARG_ENABLE([tools],
121 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
122 [], enable_tools=yes)
123AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
124
8631552d
CW
125AC_ARG_ENABLE([manpages],
126 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
127 [], enable_manpages=yes)
128AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
129
23603f1f
LDM
130AC_ARG_ENABLE([test-modules],
131 AS_HELP_STRING([--disable-test-modules], [disable building test modules during make check: cached modules will be used @<:@default=enabled@:>@]),
132 [], enable_test_modules=yes)
133AM_CONDITIONAL([BUILD_MODULES], [test "x$enable_test_modules" = "xyes"])
134
3ef7208e
LDM
135AC_ARG_ENABLE([logging],
136 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
137 [], enable_logging=yes)
138AS_IF([test "x$enable_logging" = "xyes"], [
139 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
140])
141
ecd40ee4
LDM
142AC_ARG_ENABLE([debug],
143 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
144 [], [enable_debug=no])
145AS_IF([test "x$enable_debug" = "xyes"], [
146 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
147])
148
3a33a7a5
LDM
149AC_ARG_ENABLE([python],
150 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
151 [], [enable_python=no])
152AS_IF([test "x$enable_python" = "xyes"], [
153 AM_PATH_PYTHON(,,[:])
154 AC_PATH_PROG([CYTHON], [cython], [:])
155
156 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
157 [have_python=yes],
158 [PKG_CHECK_MODULES([PYTHON], [python],
159 [have_python=yes],
160 [have_python=no])])
161
162 AS_IF([test "x$have_python" = xno],
163 [AC_MSG_ERROR([*** python support requested but libraries not found])])
164])
165AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
166
e9b0d1b4
LDM
167AC_ARG_ENABLE([coverage],
168 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
169 [], [enable_coverage=no])
170AS_IF([test "x$enable_coverage" = "xyes"], [
171 AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
172 AS_IF([test "x$have_coverage" = xno],[
173 AC_MSG_ERROR([*** lcov support requested but the program was not found])
174 ], [
175 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
176 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
177 AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
178 AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
179 ], [
180 have_coverage=yes
181 CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
182 -fprofile-arcs \
183 -ftest-coverage])
184 ])
185 ])
186])
187AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
188
3ef7208e
LDM
189m4_ifdef([GTK_DOC_CHECK], [
190GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
191], [
192AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
193
194
195#####################################################################
196# Default CFLAGS and LDFLAGS
197#####################################################################
6068aaae 198
e48f3765
LDM
199CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
200 -pipe \
201 -DANOTHER_BRICK_IN_THE \
202 -Wall \
203 -W \
204 -Wextra \
205 -Wno-inline \
206 -Wvla \
207 -Wundef \
208 -Wformat=2 \
209 -Wlogical-op \
210 -Wsign-compare \
211 -Wformat-security \
212 -Wmissing-include-dirs \
213 -Wformat-nonliteral \
214 -Wold-style-definition \
215 -Wpointer-arith \
216 -Winit-self \
217 -Wdeclaration-after-statement \
218 -Wfloat-equal \
219 -Wmissing-prototypes \
220 -Wstrict-prototypes \
221 -Wredundant-decls \
222 -Wmissing-declarations \
223 -Wmissing-noreturn \
224 -Wshadow \
225 -Wendif-labels \
db62153e 226 -Wstrict-aliasing=3 \
e48f3765
LDM
227 -Wwrite-strings \
228 -Wno-long-long \
229 -Wno-overlength-strings \
230 -Wno-unused-parameter \
231 -Wno-missing-field-initializers \
232 -Wno-unused-result \
233 -Wnested-externs \
234 -Wchar-subscripts \
235 -Wtype-limits \
236 -Wuninitialized \
237 -fno-common \
238 -fdiagnostics-show-option \
239 -fvisibility=hidden \
240 -ffunction-sections \
241 -fdata-sections])
27bcc911 242AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
e48f3765 243
c677bf2c 244
e48f3765
LDM
245CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
246 -Wl,--as-needed \
a5f799af 247 -Wl,--no-undefined \
e48f3765 248 -Wl,--gc-sections])
84aaaedf 249AC_SUBST([OUR_LDFLAGS], $with_ldflags)
3ef7208e
LDM
250
251#####################################################################
252# Generate files from *.in
253#####################################################################
254
ecd40ee4
LDM
255AC_CONFIG_FILES([
256 Makefile
904b57d0 257 man/Makefile
646b83b8
LDM
258 libkmod/docs/Makefile
259 libkmod/docs/version.xml
ecd40ee4
LDM
260])
261
3ef7208e
LDM
262
263#####################################################################
646b83b8 264
ecd40ee4
LDM
265AC_OUTPUT
266AC_MSG_RESULT([
267 $PACKAGE $VERSION
80cf2c8f 268 =======
ecd40ee4
LDM
269
270 prefix: ${prefix}
271 sysconfdir: ${sysconfdir}
272 libdir: ${libdir}
e79bf83b 273 rootlibdir: ${rootlibdir}
ecd40ee4 274 includedir: ${includedir}
7c41c2dd 275 bindir: ${bindir}
80cf2c8f 276 Bash completions dir: ${with_bashcompletiondir}
ecd40ee4
LDM
277
278 compiler: ${CC}
e48f3765
LDM
279 cflags: ${with_cflags} ${CFLAGS}
280 ldflags: ${with_ldflags} ${LDFLAGS}
ecd40ee4 281
7c41c2dd 282 tools: ${enable_tools}
3a33a7a5 283 python bindings: ${enable_python}
ecd40ee4 284 logging: ${enable_logging}
b182f8fb 285 compression: xz=${with_xz} zlib=${with_zlib}
ecd40ee4 286 debug: ${enable_debug}
e9b0d1b4 287 coverage: ${enable_coverage}
646b83b8 288 doc: ${enable_gtk_doc}
382de85c 289 man: ${enable_manpages}
23603f1f 290 test-modules: ${enable_test_modules}
ecd40ee4 291])