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