blob: 5826f7ce07ff37604f9d0f1bde1bbaefe6dbc6c3 [file] [log] [blame]
Lucas De Marchiecd40ee2011-11-21 12:35:15 -02001AC_PREREQ(2.60)
Lucas De Marchicb48c9b2011-12-12 16:41:38 -02002AC_INIT([kmod],
Lucas De Marchi46684bc2012-04-19 11:21:00 -03003 [8],
Lucas De Marchie17cc3a2011-12-16 04:11:25 -02004 [linux-modules@vger.kernel.org],
Lucas De Marchicb48c9b2011-12-12 16:41:38 -02005 [kmod],
Lucas De Marchibb05bc82012-02-24 01:58:20 -02006 [http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
Lucas De Marchi586fc302011-11-21 14:35:35 -02007
8AC_CONFIG_SRCDIR([libkmod/libkmod.c])
Lucas De Marchiecd40ee2011-11-21 12:35:15 -02009AC_CONFIG_AUX_DIR([build-aux])
Jan Engelhardta597c8b2011-12-20 16:28:27 +010010AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules
Lucas De Marchi80f9e022012-01-24 20:59:54 -020011 tar-pax no-dist-gzip dist-xz subdir-objects color-tests])
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020012AC_PROG_CC_STDC
13AC_USE_SYSTEM_EXTENSIONS
14AC_SYS_LARGEFILE
15AC_CONFIG_MACRO_DIR([m4])
Luis Felipe Strano Moraesfe8bf3b2011-12-14 15:56:10 -020016m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020017AM_SILENT_RULES([yes])
18LT_INIT([disable-static pic-only])
19AC_PREFIX_DEFAULT([/usr])
20
Lucas De Marchi3ef72082012-03-17 10:26:32 -030021#####################################################################
22# Program checks and configurations
23#####################################################################
24
Lucas De Marchi648a8422011-11-22 17:46:19 -020025AC_PROG_CC
26AC_PROG_CC_C99
27AC_C_TYPEOF
28AM_PROG_CC_C_O
29AC_PROG_GCC_TRADITIONAL
Gustavo Sverzut Barbieri708624a2011-12-18 01:25:06 -020030AC_C_BIGENDIAN
Lucas De Marchi648a8422011-11-22 17:46:19 -020031
Kay Sievers9faa7b32011-12-21 11:48:07 -020032AC_PROG_SED
33AC_PROG_MKDIR_P
Lucas De Marchi904b57d2012-01-12 11:48:21 -020034AC_PATH_PROG([XSLTPROC], [xsltproc])
Jan Engelhardt7b3a74f2011-12-24 04:45:22 +010035PKG_PROG_PKG_CONFIG
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020036
Lucas De Marchi3ef72082012-03-17 10:26:32 -030037
38#####################################################################
39# Function and structure checks
40#####################################################################
41
Lucas De Marchid005aeb2012-02-08 20:29:52 -020042AC_CHECK_FUNCS_ONCE(__xstat)
43
Lucas De Marchi3ef72082012-03-17 10:26:32 -030044# dietlibc doesn't have st.st_mtim struct member
45AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
46
47
48#####################################################################
49# --with-
50#####################################################################
51
Kay Sieversa308abe2011-12-20 17:58:05 +010052AC_ARG_WITH([rootprefix],
53 AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
Lucas De Marchi0c5fad92011-12-20 16:52:21 -020054 [], [with_rootprefix=""])
Kay Sieversa308abe2011-12-20 17:58:05 +010055AC_SUBST([rootprefix], [$with_rootprefix])
56
Kay Sieverse79bf832011-12-22 15:40:24 +010057AC_ARG_WITH([rootlibdir],
58 AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
59 [], [with_rootlibdir=$libdir])
60AC_SUBST([rootlibdir], [$with_rootlibdir])
61
Jan Engelhardtb182f8f2011-12-24 14:58:30 +010062AC_ARG_WITH([xz],
63 AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
64 [], [with_xz=no])
65AS_IF([test "x$with_xz" != "xno"], [
66 PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99])
67 AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
68], [
69 AC_MSG_NOTICE([Xz support not requested])
70])
71
Jan Engelhardt5a51a352011-12-24 04:45:42 +010072AC_ARG_WITH([zlib],
73 AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
74 [], [with_zlib=no])
75AS_IF([test "x$with_zlib" != "xno"], [
Jan Engelhardt7b3a74f2011-12-24 04:45:22 +010076 PKG_CHECK_MODULES([zlib], [zlib])
77 AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
Lucas De Marchicfb908b2011-12-23 12:03:19 -020078], [
79 AC_MSG_NOTICE([zlib support not requested])
Lucas De Marchicfb908b2011-12-23 12:03:19 -020080])
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020081
Lucas De Marchi3ef72082012-03-17 10:26:32 -030082
83#####################################################################
84# --enable-
85#####################################################################
86
87AC_ARG_ENABLE([tools],
88 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
89 [], enable_tools=yes)
90AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
91
92AC_ARG_ENABLE([logging],
93 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
94 [], enable_logging=yes)
95AS_IF([test "x$enable_logging" = "xyes"], [
96 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
97])
98
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020099AC_ARG_ENABLE([debug],
100 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
101 [], [enable_debug=no])
102AS_IF([test "x$enable_debug" = "xyes"], [
103 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
104])
105
Lucas De Marchi3ef72082012-03-17 10:26:32 -0300106m4_ifdef([GTK_DOC_CHECK], [
107GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
108], [
109AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
110
111
112#####################################################################
113# Default CFLAGS and LDFLAGS
114#####################################################################
Lucas De Marchi6068aaa2012-01-17 12:10:42 -0200115
Lucas De Marchie48f3762012-03-17 15:12:44 -0300116CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
117 -pipe \
118 -DANOTHER_BRICK_IN_THE \
119 -Wall \
120 -W \
121 -Wextra \
122 -Wno-inline \
123 -Wvla \
124 -Wundef \
125 -Wformat=2 \
126 -Wlogical-op \
127 -Wsign-compare \
128 -Wformat-security \
129 -Wmissing-include-dirs \
130 -Wformat-nonliteral \
131 -Wold-style-definition \
132 -Wpointer-arith \
133 -Winit-self \
134 -Wdeclaration-after-statement \
135 -Wfloat-equal \
136 -Wmissing-prototypes \
137 -Wstrict-prototypes \
138 -Wredundant-decls \
139 -Wmissing-declarations \
140 -Wmissing-noreturn \
141 -Wshadow \
142 -Wendif-labels \
143 -Wstrict-aliasing=2 \
144 -Wwrite-strings \
145 -Wno-long-long \
146 -Wno-overlength-strings \
147 -Wno-unused-parameter \
148 -Wno-missing-field-initializers \
149 -Wno-unused-result \
150 -Wnested-externs \
151 -Wchar-subscripts \
152 -Wtype-limits \
153 -Wuninitialized \
154 -fno-common \
155 -fdiagnostics-show-option \
156 -fvisibility=hidden \
157 -ffunction-sections \
158 -fdata-sections])
159AC_SUBST([WARNINGFLAGS], $with_cflags)
Randy Witt1701b1b2012-03-16 01:01:18 -0400160
Gustavo Sverzut Barbieri822ce232011-12-10 22:26:40 -0200161
Lucas De Marchie48f3762012-03-17 15:12:44 -0300162CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
163 -Wl,--as-needed \
164 -Wl,--gc-sections])
165AC_SUBST([GCLDFLAGS], $with_ldflags)
Lucas De Marchi3ef72082012-03-17 10:26:32 -0300166
167#####################################################################
168# Generate files from *.in
169#####################################################################
170
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200171AC_CONFIG_HEADERS(config.h)
172AC_CONFIG_FILES([
173 Makefile
Lucas De Marchi904b57d2012-01-12 11:48:21 -0200174 man/Makefile
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200175 libkmod/docs/Makefile
176 libkmod/docs/version.xml
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200177])
178
Lucas De Marchi3ef72082012-03-17 10:26:32 -0300179
180#####################################################################
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200181
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200182AC_OUTPUT
183AC_MSG_RESULT([
184 $PACKAGE $VERSION
Lucas De Marchi63dc8322012-01-09 13:00:28 -0200185 ======
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200186
187 prefix: ${prefix}
Kay Sieversa308abe2011-12-20 17:58:05 +0100188 rootprefix: ${rootprefix}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200189 sysconfdir: ${sysconfdir}
190 libdir: ${libdir}
Kay Sieverse79bf832011-12-22 15:40:24 +0100191 rootlibdir: ${rootlibdir}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200192 includedir: ${includedir}
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200193 bindir: ${bindir}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200194
195 compiler: ${CC}
Lucas De Marchie48f3762012-03-17 15:12:44 -0300196 cflags: ${with_cflags} ${CFLAGS}
197 ldflags: ${with_ldflags} ${LDFLAGS}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200198
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200199 tools: ${enable_tools}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200200 logging: ${enable_logging}
Jan Engelhardtb182f8f2011-12-24 14:58:30 +0100201 compression: xz=${with_xz} zlib=${with_zlib}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200202 debug: ${enable_debug}
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200203 doc: ${enable_gtk_doc}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200204])