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