Check if libc has __xstat
[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_CHECK_FUNCS_ONCE(__xstat)
34
35 AC_ARG_WITH([rootprefix],
36         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
37         [], [with_rootprefix=""])
38 AC_SUBST([rootprefix], [$with_rootprefix])
39
40 AC_ARG_WITH([rootlibdir],
41         AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
42         [], [with_rootlibdir=$libdir])
43 AC_SUBST([rootlibdir], [$with_rootlibdir])
44
45 AC_ARG_ENABLE([tools],
46         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
47         [], enable_tools=yes)
48 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
49
50 AC_ARG_ENABLE([logging],
51         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
52         [], enable_logging=yes)
53 AS_IF([test "x$enable_logging" = "xyes"], [
54         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
55 ])
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 AC_ARG_ENABLE([debug],
78         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
79         [], [enable_debug=no])
80 AS_IF([test "x$enable_debug" = "xyes"], [
81         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
82 ])
83
84 # dietlibc doesn't have st.st_mtim struct member
85 AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
86
87 CC_CHECK_CFLAGS_APPEND([ \
88                         -pipe \
89                         -DANOTHER_BRICK_IN_THE \
90                         -Wall \
91                         -W \
92                         -Wextra \
93                         -Wno-inline \
94                         -Wvla \
95                         -Wundef \
96                         -Wformat=2 \
97                         -Wlogical-op \
98                         -Wsign-compare \
99                         -Wformat-security \
100                         -Wmissing-include-dirs \
101                         -Wformat-nonliteral \
102                         -Wold-style-definition \
103                         -Wpointer-arith \
104                         -Winit-self \
105                         -Wdeclaration-after-statement \
106                         -Wfloat-equal \
107                         -Wmissing-prototypes \
108                         -Wstrict-prototypes \
109                         -Wredundant-decls \
110                         -Wmissing-declarations \
111                         -Wmissing-noreturn \
112                         -Wshadow \
113                         -Wendif-labels \
114                         -Wstrict-aliasing=2 \
115                         -Wwrite-strings \
116                         -Wno-long-long \
117                         -Wno-overlength-strings \
118                         -Wno-unused-parameter \
119                         -Wno-missing-field-initializers \
120                         -Wno-unused-result \
121                         -Wnested-externs \
122                         -Wchar-subscripts \
123                         -Wtype-limits \
124                         -Wuninitialized \
125                         -fno-common \
126                         -fdiagnostics-show-option \
127                         -fvisibility=hidden \
128                         -ffunction-sections \
129                         -fdata-sections \
130                         -Wl,--as-needed \
131                         -Wl,--gc-sections])
132
133 AC_CONFIG_HEADERS(config.h)
134 AC_CONFIG_FILES([
135         Makefile
136         man/Makefile
137         libkmod/docs/Makefile
138         libkmod/docs/version.xml
139 ])
140
141 m4_ifdef([GTK_DOC_CHECK], [
142 GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
143 ], [
144 AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
145
146 AC_OUTPUT
147 AC_MSG_RESULT([
148         $PACKAGE $VERSION
149         ======
150
151         prefix:                 ${prefix}
152         rootprefix:             ${rootprefix}
153         sysconfdir:             ${sysconfdir}
154         libdir:                 ${libdir}
155         rootlibdir:             ${rootlibdir}
156         includedir:             ${includedir}
157         bindir:                 ${bindir}
158
159         compiler:               ${CC}
160         cflags:                 ${CFLAGS}
161         ldflags:                ${LDFLAGS}
162
163         tools:                  ${enable_tools}
164         logging:                ${enable_logging}
165         compression:            xz=${with_xz}  zlib=${with_zlib}
166         debug:                  ${enable_debug}
167         doc:                    ${enable_gtk_doc}
168 ])