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