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