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