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