build-sys: move remaining warning flags to configure
[platform/upstream/kmod.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT([libkmod],
3         [0.1],
4         [],
5         [libkmod],
6         [http://git.profusion.mobi/cgit.cgi/lucas/libkmod/])
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 tar-pax dist-bzip2 subdir-objects])
11 AC_PROG_CC_STDC
12 AC_USE_SYSTEM_EXTENSIONS
13 AC_SYS_LARGEFILE
14 AC_CONFIG_MACRO_DIR([m4])
15 AM_SILENT_RULES([yes])
16 LT_INIT([disable-static pic-only])
17 AC_PREFIX_DEFAULT([/usr])
18
19 AC_PROG_CC
20 AC_PROG_CC_C99
21 AC_C_TYPEOF
22 AM_PROG_CC_C_O
23 AC_PROG_GCC_TRADITIONAL
24
25 AC_ARG_ENABLE([tools],
26         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
27         [], enable_tools=yes)
28 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
29
30 AC_ARG_ENABLE([logging],
31         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
32         [], enable_logging=yes)
33 AS_IF([test "x$enable_logging" = "xyes"], [
34         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
35 ])
36
37 AC_ARG_ENABLE([debug],
38         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
39         [], [enable_debug=no])
40 AS_IF([test "x$enable_debug" = "xyes"], [
41         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
42 ])
43
44 CC_CHECK_CFLAGS_APPEND([ \
45         -pipe \
46         -Wall \
47         -W \
48         -Wextra \
49         -Wno-inline \
50         -Wvla \
51         -Wundef \
52         -Wformat=2 \
53         -Wlogical-op \
54         -Wsign-compare \
55         -Wformat-security \
56         -Wmissing-include-dirs \
57         -Wformat-nonliteral \
58         -Wold-style-definition \
59         -Wpointer-arith \
60         -Winit-self \
61         -Wdeclaration-after-statement \
62         -Wfloat-equal \
63         -Wmissing-prototypes \
64         -Wstrict-prototypes \
65         -Wredundant-decls \
66         -Wmissing-declarations \
67         -Wmissing-noreturn \
68         -Wshadow \
69         -Wendif-labels \
70         -Wcast-align \
71         -Wstrict-aliasing=2 \
72         -Wwrite-strings \
73         -Wno-long-long \
74         -Wno-overlength-strings \
75         -Wno-unused-parameter \
76         -Wno-missing-field-initializers \
77         -Wno-unused-result \
78         -Wnested-externs \
79         -Wchar-subscripts \
80         -Wtype-limits \
81         -Wuninitialized \
82         -Wp,-D_FORTIFY_SOURCE=2 \
83         -ffast-math \
84         -fno-common \
85         -fdiagnostics-show-option \
86         -fno-strict-aliasing \
87         -fvisibility=hidden \
88         -ffunction-sections \
89         -fdata-sections \
90         -Wl,--as-needed \
91         -Wl,--gc-sections])
92
93
94 AC_CONFIG_HEADERS(config.h)
95 AC_CONFIG_FILES([
96         Makefile
97         libkmod/libkmod.pc
98 ])
99
100 AC_OUTPUT
101 AC_MSG_RESULT([
102         $PACKAGE $VERSION
103         ========
104
105         prefix:                 ${prefix}
106         sysconfdir:             ${sysconfdir}
107         libdir:                 ${libdir}
108         includedir:             ${includedir}
109         bindir:                 ${bindir}
110
111         compiler:               ${CC}
112         cflags:                 ${CFLAGS}
113         ldflags:                ${LDFLAGS}
114
115         tools:                  ${enable_tools}
116         logging:                ${enable_logging}
117         debug:                  ${enable_debug}
118 ])