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