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