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