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