]> git.ipfire.org Git - thirdparty/kmod.git/blob - configure.ac
shared: avoid checking for __STDC_VERSION__
[thirdparty/kmod.git] / configure.ac
1 AC_PREREQ(2.64)
2 AC_INIT([kmod],
3 [19],
4 [linux-modules@vger.kernel.org],
5 [kmod],
6 [http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
7
8 AC_CONFIG_SRCDIR([libkmod/libkmod.c])
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADERS(config.h)
11 AC_CONFIG_AUX_DIR([build-aux])
12
13 AC_USE_SYSTEM_EXTENSIONS
14 AC_SYS_LARGEFILE
15 AC_PREFIX_DEFAULT([/usr])
16 AM_MAINTAINER_MODE([enable])
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])
20
21 AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by systemd])])
22 AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by systemd])])
23
24 #####################################################################
25 # Program checks and configurations
26 #####################################################################
27
28 AC_PROG_SED
29 AC_PROG_MKDIR_P
30 AC_PROG_LN_S
31 PKG_PROG_PKG_CONFIG
32 AC_PATH_PROG([XSLTPROC], [xsltproc])
33
34 AC_PROG_CC_C99
35
36 #####################################################################
37 # Function and structure checks
38 #####################################################################
39
40 AC_CHECK_FUNCS_ONCE(__xstat)
41 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
42 AC_CHECK_FUNCS_ONCE([finit_module])
43
44 CC_CHECK_FUNC_BUILTIN([__builtin_clz])
45 CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p])
46 CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ])
47 CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
48
49 # dietlibc doesn't have st.st_mtim struct member
50 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
51
52 # musl 1.0 and bionic 4.4 don't have strndupa
53 AC_CHECK_DECLS_ONCE([strndupa])
54
55 # RHEL 5 and older do not have be32toh
56 AC_CHECK_DECLS_ONCE([be32toh])
57
58 # Check kernel headers
59 AC_CHECK_HEADERS_ONCE([linux/module.h])
60
61 AC_MSG_CHECKING([whether _Static_assert() is supported])
62 AC_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])])
67
68 AC_MSG_CHECKING([whether _Noreturn is supported])
69 AC_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
76 #####################################################################
77 # --with-
78 #####################################################################
79
80 AC_ARG_WITH([rootlibdir],
81 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
82 [], [with_rootlibdir=$libdir])
83 AC_SUBST([rootlibdir], [$with_rootlibdir])
84
85 AC_ARG_WITH([xz],
86 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
87 [], [with_xz=no])
88 AS_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
95 AC_ARG_WITH([zlib],
96 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
97 [], [with_zlib=no])
98 AS_IF([test "x$with_zlib" != "xno"], [
99 PKG_CHECK_MODULES([zlib], [zlib])
100 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
101 ], [
102 AC_MSG_NOTICE([zlib support not requested])
103 ])
104
105 AC_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 ])])
113 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
114
115 #####################################################################
116 # --enable-
117 #####################################################################
118
119 AC_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)
122 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
123
124 AC_ARG_ENABLE([manpages],
125 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
126 [], enable_manpages=yes)
127 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
128
129 AC_ARG_ENABLE([logging],
130 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
131 [], enable_logging=yes)
132 AS_IF([test "x$enable_logging" = "xyes"], [
133 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
134 ])
135
136 AC_ARG_ENABLE([debug],
137 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
138 [], [enable_debug=no])
139 AS_IF([test "x$enable_debug" = "xyes"], [
140 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
141 ])
142
143 AC_ARG_ENABLE([python],
144 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
145 [], [enable_python=no])
146 AS_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 ])
159 AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
160
161 AC_ARG_ENABLE([coverage],
162 AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
163 [], [enable_coverage=no])
164 AS_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 ])
181 AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
182
183 m4_ifdef([GTK_DOC_CHECK], [
184 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
185 ], [
186 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
187
188
189 #####################################################################
190 # Default CFLAGS and LDFLAGS
191 #####################################################################
192
193 CC_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 \
220 -Wstrict-aliasing=3 \
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])
236 AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
237
238
239 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
240 -Wl,--as-needed \
241 -Wl,--no-undefined \
242 -Wl,--gc-sections])
243 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
244
245 #####################################################################
246 # Generate files from *.in
247 #####################################################################
248
249 AC_CONFIG_FILES([
250 Makefile
251 man/Makefile
252 libkmod/docs/Makefile
253 libkmod/docs/version.xml
254 ])
255
256
257 #####################################################################
258
259 AC_OUTPUT
260 AC_MSG_RESULT([
261 $PACKAGE $VERSION
262 =======
263
264 prefix: ${prefix}
265 sysconfdir: ${sysconfdir}
266 libdir: ${libdir}
267 rootlibdir: ${rootlibdir}
268 includedir: ${includedir}
269 bindir: ${bindir}
270 Bash completions dir: ${with_bashcompletiondir}
271
272 compiler: ${CC}
273 cflags: ${with_cflags} ${CFLAGS}
274 ldflags: ${with_ldflags} ${LDFLAGS}
275
276 tools: ${enable_tools}
277 python bindings: ${enable_python}
278 logging: ${enable_logging}
279 compression: xz=${with_xz} zlib=${with_zlib}
280 debug: ${enable_debug}
281 coverage: ${enable_coverage}
282 doc: ${enable_gtk_doc}
283 man: ${enable_manpages}
284 ])