do not (mis-)use the config file generator for non-autobuild stuff
[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
31 required_private_libs=""
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_ENABLE([tools],
39         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
40         [], enable_tools=yes)
41 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
42
43 AC_ARG_ENABLE([logging],
44         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
45         [], enable_logging=yes)
46 AS_IF([test "x$enable_logging" = "xyes"], [
47         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
48 ])
49
50 AC_ARG_ENABLE([zlib],
51         AS_HELP_STRING([--enable-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
52         [], enable_zlib=no)
53 if test "x$enable_zlib" != "xno"; then
54         AC_CHECK_LIB([z], [gzopen],
55                 [
56                         zlib_libs="-lz"
57                         required_private_libs="${required_private_libs} ${zlib_libs}"
58                 ],
59                 [AC_MSG_ERROR([zlib is not present])])
60 else
61         AC_MSG_NOTICE([zlib support not requested])
62         zlib_libs=""
63 fi
64 if test "x$zlib_libs" != "x"; then
65         AC_DEFINE(ENABLE_ZLIB, [1], [Enable zlib for modules.])
66 fi
67 AC_SUBST(zlib_libs)
68
69 AC_ARG_ENABLE([debug],
70         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
71         [], [enable_debug=no])
72 AS_IF([test "x$enable_debug" = "xyes"], [
73         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
74 ])
75
76 CC_CHECK_CFLAGS_APPEND([ \
77                         -pipe \
78                         -Wall \
79                         -W \
80                         -Wextra \
81                         -Wno-inline \
82                         -Wvla \
83                         -Wundef \
84                         -Wformat=2 \
85                         -Wlogical-op \
86                         -Wsign-compare \
87                         -Wformat-security \
88                         -Wmissing-include-dirs \
89                         -Wformat-nonliteral \
90                         -Wold-style-definition \
91                         -Wpointer-arith \
92                         -Winit-self \
93                         -Wdeclaration-after-statement \
94                         -Wfloat-equal \
95                         -Wmissing-prototypes \
96                         -Wstrict-prototypes \
97                         -Wredundant-decls \
98                         -Wmissing-declarations \
99                         -Wmissing-noreturn \
100                         -Wshadow \
101                         -Wendif-labels \
102                         -Wcast-align \
103                         -Wstrict-aliasing=2 \
104                         -Wwrite-strings \
105                         -Wno-long-long \
106                         -Wno-overlength-strings \
107                         -Wno-unused-parameter \
108                         -Wno-missing-field-initializers \
109                         -Wno-unused-result \
110                         -Wnested-externs \
111                         -Wchar-subscripts \
112                         -Wtype-limits \
113                         -Wuninitialized \
114                         -fno-common \
115                         -fdiagnostics-show-option \
116                         -fvisibility=hidden \
117                         -ffunction-sections \
118                         -fdata-sections \
119                         -Wl,--as-needed \
120                         -Wl,--gc-sections])
121
122
123 AC_SUBST(required_private_libs)
124
125 AC_CONFIG_HEADERS(config.h)
126 AC_CONFIG_FILES([
127         Makefile
128 ])
129
130 AC_OUTPUT
131 AC_MSG_RESULT([
132         $PACKAGE $VERSION
133         ========
134
135         prefix:                 ${prefix}
136         rootprefix:             ${rootprefix}
137         sysconfdir:             ${sysconfdir}
138         libdir:                 ${libdir}
139         includedir:             ${includedir}
140         bindir:                 ${bindir}
141
142         compiler:               ${CC}
143         cflags:                 ${CFLAGS}
144         ldflags:                ${LDFLAGS}
145
146         tools:                  ${enable_tools}
147         logging:                ${enable_logging}
148         zlib:                   ${enable_zlib}
149         debug:                  ${enable_debug}
150 ])