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