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