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