]> git.ipfire.org Git - thirdparty/kmod.git/blob - configure.ac
kmod 17
[thirdparty/kmod.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT([kmod],
3 [17],
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 # Check kernel headers
54 AC_CHECK_HEADERS_ONCE([linux/module.h])
55
56 AC_MSG_CHECKING([whether _Static_assert() is supported])
57 AC_COMPILE_IFELSE(
58 [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
59 [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
60 AC_MSG_RESULT([yes])],
61 [AC_MSG_RESULT([no])])
62
63 #####################################################################
64 # --with-
65 #####################################################################
66
67 AC_ARG_WITH([rootlibdir],
68 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
69 [], [with_rootlibdir=$libdir])
70 AC_SUBST([rootlibdir], [$with_rootlibdir])
71
72 AC_ARG_WITH([xz],
73 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
74 [], [with_xz=no])
75 AS_IF([test "x$with_xz" != "xno"], [
76 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99])
77 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
78 ], [
79 AC_MSG_NOTICE([Xz support not requested])
80 ])
81
82 AC_ARG_WITH([zlib],
83 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
84 [], [with_zlib=no])
85 AS_IF([test "x$with_zlib" != "xno"], [
86 PKG_CHECK_MODULES([zlib], [zlib])
87 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
88 ], [
89 AC_MSG_NOTICE([zlib support not requested])
90 ])
91
92 AC_ARG_WITH([bashcompletiondir],
93 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
94 [],
95 [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
96 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
97 ] , [
98 with_bashcompletiondir=${datadir}/bash-completion/completions
99 ])])
100 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
101
102 #####################################################################
103 # --enable-
104 #####################################################################
105
106 AC_ARG_ENABLE([tools],
107 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
108 [], enable_tools=yes)
109 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
110
111 AC_ARG_ENABLE([manpages],
112 AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
113 [], enable_manpages=yes)
114 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
115
116 AC_ARG_ENABLE([logging],
117 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
118 [], enable_logging=yes)
119 AS_IF([test "x$enable_logging" = "xyes"], [
120 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
121 ])
122
123 AC_ARG_ENABLE([debug],
124 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
125 [], [enable_debug=no])
126 AS_IF([test "x$enable_debug" = "xyes"], [
127 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
128 ])
129
130 AC_ARG_ENABLE([python],
131 AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
132 [], [enable_python=no])
133 AS_IF([test "x$enable_python" = "xyes"], [
134 AM_PATH_PYTHON(,,[:])
135 AC_PATH_PROG([CYTHON], [cython], [:])
136
137 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
138 [have_python=yes],
139 [PKG_CHECK_MODULES([PYTHON], [python],
140 [have_python=yes],
141 [have_python=no])])
142
143 AS_IF([test "x$have_python" = xno],
144 [AC_MSG_ERROR([*** python support requested but libraries not found])])
145 ])
146 AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
147
148 m4_ifdef([GTK_DOC_CHECK], [
149 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
150 ], [
151 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
152
153
154 #####################################################################
155 # Default CFLAGS and LDFLAGS
156 #####################################################################
157
158 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
159 -pipe \
160 -DANOTHER_BRICK_IN_THE \
161 -Wall \
162 -W \
163 -Wextra \
164 -Wno-inline \
165 -Wvla \
166 -Wundef \
167 -Wformat=2 \
168 -Wlogical-op \
169 -Wsign-compare \
170 -Wformat-security \
171 -Wmissing-include-dirs \
172 -Wformat-nonliteral \
173 -Wold-style-definition \
174 -Wpointer-arith \
175 -Winit-self \
176 -Wdeclaration-after-statement \
177 -Wfloat-equal \
178 -Wmissing-prototypes \
179 -Wstrict-prototypes \
180 -Wredundant-decls \
181 -Wmissing-declarations \
182 -Wmissing-noreturn \
183 -Wshadow \
184 -Wendif-labels \
185 -Wstrict-aliasing=3 \
186 -Wwrite-strings \
187 -Wno-long-long \
188 -Wno-overlength-strings \
189 -Wno-unused-parameter \
190 -Wno-missing-field-initializers \
191 -Wno-unused-result \
192 -Wnested-externs \
193 -Wchar-subscripts \
194 -Wtype-limits \
195 -Wuninitialized \
196 -fno-common \
197 -fdiagnostics-show-option \
198 -fdiagnostics-color=auto \
199 -fvisibility=hidden \
200 -ffunction-sections \
201 -fdata-sections])
202 AC_SUBST([WARNINGFLAGS], $with_cflags)
203
204
205 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
206 -Wl,--as-needed \
207 -Wl,--gc-sections])
208 AC_SUBST([GCLDFLAGS], $with_ldflags)
209
210 #####################################################################
211 # Generate files from *.in
212 #####################################################################
213
214 AC_CONFIG_HEADERS(config.h)
215 AC_CONFIG_FILES([
216 Makefile
217 man/Makefile
218 libkmod/docs/Makefile
219 libkmod/docs/version.xml
220 ])
221
222
223 #####################################################################
224
225 AC_OUTPUT
226 AC_MSG_RESULT([
227 $PACKAGE $VERSION
228 =======
229
230 prefix: ${prefix}
231 sysconfdir: ${sysconfdir}
232 libdir: ${libdir}
233 rootlibdir: ${rootlibdir}
234 includedir: ${includedir}
235 bindir: ${bindir}
236 Bash completions dir: ${with_bashcompletiondir}
237
238 compiler: ${CC}
239 cflags: ${with_cflags} ${CFLAGS}
240 ldflags: ${with_ldflags} ${LDFLAGS}
241
242 tools: ${enable_tools}
243 python bindings: ${enable_python}
244 logging: ${enable_logging}
245 compression: xz=${with_xz} zlib=${with_zlib}
246 debug: ${enable_debug}
247 doc: ${enable_gtk_doc}
248 man: ${enable_manpages}
249 ])