build: Install bash completion data
[platform/upstream/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 AC_ARG_WITH([bashcompletiondir],
86         AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
87         [],
88         [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
89                 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
90         ] , [
91                 with_bashcompletiondir=${datadir}/bash-completion/completions
92         ])])
93 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
94
95 #####################################################################
96 # --enable-
97 #####################################################################
98
99 AC_ARG_ENABLE([tools],
100         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
101         [], enable_tools=yes)
102 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
103
104 AC_ARG_ENABLE([manpages],
105         AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
106         [], enable_manpages=yes)
107 AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
108 AC_PATH_PROG([XSLTPROC], [xsltproc], [no])
109 AS_IF([test "x$XSLTPROC" = "xno" && test "x$enable_manpages" = "xyes"], [
110         AC_MSG_ERROR([xsltproc command not found, try ./configure --disable-manpages])
111 ])
112
113 AC_ARG_ENABLE([logging],
114         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
115         [], enable_logging=yes)
116 AS_IF([test "x$enable_logging" = "xyes"], [
117         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
118 ])
119
120 AC_ARG_ENABLE([debug],
121         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
122         [], [enable_debug=no])
123 AS_IF([test "x$enable_debug" = "xyes"], [
124         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
125 ])
126
127 m4_ifdef([GTK_DOC_CHECK], [
128 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
129 ], [
130 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
131
132
133 #####################################################################
134 # Default CFLAGS and LDFLAGS
135 #####################################################################
136
137 CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
138                        -pipe \
139                        -DANOTHER_BRICK_IN_THE \
140                        -Wall \
141                        -W \
142                        -Wextra \
143                        -Wno-inline \
144                        -Wvla \
145                        -Wundef \
146                        -Wformat=2 \
147                        -Wlogical-op \
148                        -Wsign-compare \
149                        -Wformat-security \
150                        -Wmissing-include-dirs \
151                        -Wformat-nonliteral \
152                        -Wold-style-definition \
153                        -Wpointer-arith \
154                        -Winit-self \
155                        -Wdeclaration-after-statement \
156                        -Wfloat-equal \
157                        -Wmissing-prototypes \
158                        -Wstrict-prototypes \
159                        -Wredundant-decls \
160                        -Wmissing-declarations \
161                        -Wmissing-noreturn \
162                        -Wshadow \
163                        -Wendif-labels \
164                        -Wstrict-aliasing=2 \
165                        -Wwrite-strings \
166                        -Wno-long-long \
167                        -Wno-overlength-strings \
168                        -Wno-unused-parameter \
169                        -Wno-missing-field-initializers \
170                        -Wno-unused-result \
171                        -Wnested-externs \
172                        -Wchar-subscripts \
173                        -Wtype-limits \
174                        -Wuninitialized \
175                        -fno-common \
176                        -fdiagnostics-show-option \
177                        -fvisibility=hidden \
178                        -ffunction-sections \
179                        -fdata-sections])
180 AC_SUBST([WARNINGFLAGS], $with_cflags)
181
182
183 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
184                        -Wl,--as-needed \
185                        -Wl,--gc-sections])
186 AC_SUBST([GCLDFLAGS], $with_ldflags)
187
188 #####################################################################
189 # Generate files from *.in
190 #####################################################################
191
192 AC_CONFIG_HEADERS(config.h)
193 AC_CONFIG_FILES([
194         Makefile
195         man/Makefile
196         libkmod/docs/Makefile
197         libkmod/docs/version.xml
198 ])
199
200
201 #####################################################################
202
203 AC_OUTPUT
204 AC_MSG_RESULT([
205         $PACKAGE $VERSION
206         =======
207
208         prefix:                 ${prefix}
209         sysconfdir:             ${sysconfdir}
210         libdir:                 ${libdir}
211         rootlibdir:             ${rootlibdir}
212         includedir:             ${includedir}
213         bindir:                 ${bindir}
214         Bash completions dir:   ${with_bashcompletiondir}
215
216         compiler:               ${CC}
217         cflags:                 ${with_cflags} ${CFLAGS}
218         ldflags:                ${with_ldflags} ${LDFLAGS}
219
220         tools:                  ${enable_tools}
221         logging:                ${enable_logging}
222         compression:            xz=${with_xz}  zlib=${with_zlib}
223         debug:                  ${enable_debug}
224         doc:                    ${enable_gtk_doc}
225         man:                    ${enable_manpages}
226 ])