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