]> git.ipfire.org Git - thirdparty/kmod.git/blob - configure.ac
kmod 19
[thirdparty/kmod.git] / configure.ac
1 AC_PREREQ(2.60)
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_AUX_DIR([build-aux])
10 AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules
11 tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
12 AC_PROG_CC_STDC
13 AC_USE_SYSTEM_EXTENSIONS
14 AC_SYS_LARGEFILE
15 AC_CONFIG_MACRO_DIR([m4])
16 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
17 AM_SILENT_RULES([yes])
18 LT_INIT([disable-static pic-only])
19 AC_PREFIX_DEFAULT([/usr])
20 AM_MAINTAINER_MODE([enable])
21
22 AS_IF([test "x$enable_static" = "xyes"],
23 [AC_MSG_ERROR([--enable-static is not supported by kmod])])
24
25
26 #####################################################################
27 # Program checks and configurations
28 #####################################################################
29
30 AC_PROG_CC
31 AC_PROG_CC_C99
32 AM_PROG_CC_C_O
33 AC_PROG_GCC_TRADITIONAL
34 AC_C_BIGENDIAN
35
36 AC_PROG_SED
37 AC_PROG_MKDIR_P
38 PKG_PROG_PKG_CONFIG
39 AC_PATH_PROG([XSLTPROC], [xsltproc])
40
41
42 #####################################################################
43 # Function and structure checks
44 #####################################################################
45
46 AC_CHECK_FUNCS_ONCE(__xstat)
47 AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
48 AC_CHECK_FUNCS_ONCE([finit_module])
49
50 # dietlibc doesn't have st.st_mtim struct member
51 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
52
53 # musl 1.0 and bionic 4.4 don't have strndupa
54 AC_CHECK_DECLS_ONCE([strndupa])
55
56 # RHEL 5 and older do not have be32toh
57 AC_CHECK_DECLS_ONCE([be32toh])
58
59 # Check kernel headers
60 AC_CHECK_HEADERS_ONCE([linux/module.h])
61
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])])
68
69 #####################################################################
70 # --with-
71 #####################################################################
72
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
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
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"], [
92 PKG_CHECK_MODULES([zlib], [zlib])
93 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
94 ], [
95 AC_MSG_NOTICE([zlib support not requested])
96 ])
97
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])
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
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
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
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
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
154 m4_ifdef([GTK_DOC_CHECK], [
155 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
156 ], [
157 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
158
159
160 #####################################################################
161 # Default CFLAGS and LDFLAGS
162 #####################################################################
163
164 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
165 -pipe \
166 -DANOTHER_BRICK_IN_THE \
167 -Wall \
168 -W \
169 -Wextra \
170 -Wno-inline \
171 -Wvla \
172 -Wundef \
173 -Wformat=2 \
174 -Wlogical-op \
175 -Wsign-compare \
176 -Wformat-security \
177 -Wmissing-include-dirs \
178 -Wformat-nonliteral \
179 -Wold-style-definition \
180 -Wpointer-arith \
181 -Winit-self \
182 -Wdeclaration-after-statement \
183 -Wfloat-equal \
184 -Wmissing-prototypes \
185 -Wstrict-prototypes \
186 -Wredundant-decls \
187 -Wmissing-declarations \
188 -Wmissing-noreturn \
189 -Wshadow \
190 -Wendif-labels \
191 -Wstrict-aliasing=3 \
192 -Wwrite-strings \
193 -Wno-long-long \
194 -Wno-overlength-strings \
195 -Wno-unused-parameter \
196 -Wno-missing-field-initializers \
197 -Wno-unused-result \
198 -Wnested-externs \
199 -Wchar-subscripts \
200 -Wtype-limits \
201 -Wuninitialized \
202 -fno-common \
203 -fdiagnostics-show-option \
204 -fdiagnostics-color=auto \
205 -fvisibility=hidden \
206 -ffunction-sections \
207 -fdata-sections])
208 AC_SUBST([WARNINGFLAGS], $with_cflags)
209
210
211 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
212 -Wl,--as-needed \
213 -Wl,--gc-sections])
214 AC_SUBST([GCLDFLAGS], $with_ldflags)
215
216 #####################################################################
217 # Generate files from *.in
218 #####################################################################
219
220 AC_CONFIG_HEADERS(config.h)
221 AC_CONFIG_FILES([
222 Makefile
223 man/Makefile
224 libkmod/docs/Makefile
225 libkmod/docs/version.xml
226 ])
227
228
229 #####################################################################
230
231 AC_OUTPUT
232 AC_MSG_RESULT([
233 $PACKAGE $VERSION
234 =======
235
236 prefix: ${prefix}
237 sysconfdir: ${sysconfdir}
238 libdir: ${libdir}
239 rootlibdir: ${rootlibdir}
240 includedir: ${includedir}
241 bindir: ${bindir}
242 Bash completions dir: ${with_bashcompletiondir}
243
244 compiler: ${CC}
245 cflags: ${with_cflags} ${CFLAGS}
246 ldflags: ${with_ldflags} ${LDFLAGS}
247
248 tools: ${enable_tools}
249 python bindings: ${enable_python}
250 logging: ${enable_logging}
251 compression: xz=${with_xz} zlib=${with_zlib}
252 debug: ${enable_debug}
253 doc: ${enable_gtk_doc}
254 man: ${enable_manpages}
255 ])