46b535ddcd755497158d5e28353c706236ac74be
[platform/upstream/kmod.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT([kmod],
3         [2],
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])
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 PKG_PROG_PKG_CONFIG
31
32 AC_ARG_WITH([rootprefix],
33         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
34         [], [with_rootprefix=""])
35 AC_SUBST([rootprefix], [$with_rootprefix])
36
37 AC_ARG_WITH([rootlibdir],
38         AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
39         [], [with_rootlibdir=$libdir])
40 AC_SUBST([rootlibdir], [$with_rootlibdir])
41
42 AC_ARG_ENABLE([tools],
43         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
44         [], enable_tools=yes)
45 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
46
47 AC_ARG_ENABLE([logging],
48         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
49         [], enable_logging=yes)
50 AS_IF([test "x$enable_logging" = "xyes"], [
51         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
52 ])
53
54 AC_ARG_WITH([zlib],
55         AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
56         [], [with_zlib=no])
57 AS_IF([test "x$with_zlib" != "xno"], [
58         PKG_CHECK_MODULES([zlib], [zlib])
59         AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
60 ], [
61         AC_MSG_NOTICE([zlib support not requested])
62 ])
63
64 AC_ARG_ENABLE([debug],
65         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
66         [], [enable_debug=no])
67 AS_IF([test "x$enable_debug" = "xyes"], [
68         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
69 ])
70
71 CC_CHECK_CFLAGS_APPEND([ \
72                         -pipe \
73                         -DANOTHER_BRICK_IN_THE \
74                         -Wall \
75                         -W \
76                         -Wextra \
77                         -Wno-inline \
78                         -Wvla \
79                         -Wundef \
80                         -Wformat=2 \
81                         -Wlogical-op \
82                         -Wsign-compare \
83                         -Wformat-security \
84                         -Wmissing-include-dirs \
85                         -Wformat-nonliteral \
86                         -Wold-style-definition \
87                         -Wpointer-arith \
88                         -Winit-self \
89                         -Wdeclaration-after-statement \
90                         -Wfloat-equal \
91                         -Wmissing-prototypes \
92                         -Wstrict-prototypes \
93                         -Wredundant-decls \
94                         -Wmissing-declarations \
95                         -Wmissing-noreturn \
96                         -Wshadow \
97                         -Wendif-labels \
98                         -Wstrict-aliasing=2 \
99                         -Wwrite-strings \
100                         -Wno-long-long \
101                         -Wno-overlength-strings \
102                         -Wno-unused-parameter \
103                         -Wno-missing-field-initializers \
104                         -Wno-unused-result \
105                         -Wnested-externs \
106                         -Wchar-subscripts \
107                         -Wtype-limits \
108                         -Wuninitialized \
109                         -fno-common \
110                         -fdiagnostics-show-option \
111                         -fvisibility=hidden \
112                         -ffunction-sections \
113                         -fdata-sections \
114                         -Wl,--as-needed \
115                         -Wl,--gc-sections])
116
117
118 AC_CONFIG_HEADERS(config.h)
119 AC_CONFIG_FILES([
120         Makefile
121 ])
122
123 AC_OUTPUT
124 AC_MSG_RESULT([
125         $PACKAGE $VERSION
126         ========
127
128         prefix:                 ${prefix}
129         rootprefix:             ${rootprefix}
130         sysconfdir:             ${sysconfdir}
131         libdir:                 ${libdir}
132         rootlibdir:             ${rootlibdir}
133         includedir:             ${includedir}
134         bindir:                 ${bindir}
135
136         compiler:               ${CC}
137         cflags:                 ${CFLAGS}
138         ldflags:                ${LDFLAGS}
139
140         tools:                  ${enable_tools}
141         logging:                ${enable_logging}
142         zlib:                   ${with_zlib}
143         debug:                  ${enable_debug}
144 ])