blob: a0ed6c2f5ceeb08c8150963afddb51c58bd64cdf [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 Marchiacc18b12011-12-20 23:48:46 -02003 [2],
Lucas De Marchie17cc3a2011-12-16 04:11:25 -02004 [linux-modules@vger.kernel.org],
Lucas De Marchicb48c9b2011-12-12 16:41:38 -02005 [kmod],
6 [http://git.profusion.mobi/cgit.cgi/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
11 tar-pax no-dist-gzip dist-xz subdir-objects])
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 Marchi648a8422011-11-22 17:46:19 -020021AC_PROG_CC
22AC_PROG_CC_C99
23AC_C_TYPEOF
24AM_PROG_CC_C_O
25AC_PROG_GCC_TRADITIONAL
Gustavo Sverzut Barbieri708624a2011-12-18 01:25:06 -020026AC_C_BIGENDIAN
Lucas De Marchi648a8422011-11-22 17:46:19 -020027
Kay Sievers9faa7b32011-12-21 11:48:07 -020028AC_PROG_SED
29AC_PROG_MKDIR_P
30
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020031required_private_libs=""
32
Kay Sieversa308abe2011-12-20 17:58:05 +010033AC_ARG_WITH([rootprefix],
34 AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
Lucas De Marchi0c5fad92011-12-20 16:52:21 -020035 [], [with_rootprefix=""])
Kay Sieversa308abe2011-12-20 17:58:05 +010036AC_SUBST([rootprefix], [$with_rootprefix])
37
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -020038AC_ARG_ENABLE([tools],
39 AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
40 [], enable_tools=yes)
41AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
42
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020043AC_ARG_ENABLE([logging],
44 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
45 [], enable_logging=yes)
46AS_IF([test "x$enable_logging" = "xyes"], [
47 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
48])
49
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020050AC_ARG_ENABLE([zlib],
Gustavo Sverzut Barbieri1e482782011-12-20 16:30:01 -020051 AS_HELP_STRING([--enable-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020052 [], enable_zlib=no)
Gustavo Sverzut Barbieri1e482782011-12-20 16:30:01 -020053if test "x$enable_zlib" != "xno"; then
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020054 AC_CHECK_LIB([z], [gzopen],
55 [
56 zlib_libs="-lz"
57 required_private_libs="${required_private_libs} ${zlib_libs}"
58 ],
Gustavo Sverzut Barbieri1e482782011-12-20 16:30:01 -020059 [AC_MSG_ERROR([zlib is not present])])
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020060else
61 AC_MSG_NOTICE([zlib support not requested])
62 zlib_libs=""
63fi
64if test "x$zlib_libs" != "x"; then
65 AC_DEFINE(ENABLE_ZLIB, [1], [Enable zlib for modules.])
66fi
67AC_SUBST(zlib_libs)
68
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020069AC_ARG_ENABLE([debug],
70 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
71 [], [enable_debug=no])
72AS_IF([test "x$enable_debug" = "xyes"], [
73 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
74])
75
Gustavo Sverzut Barbieri822ce232011-12-10 22:26:40 -020076CC_CHECK_CFLAGS_APPEND([ \
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -020077 -pipe \
78 -Wall \
79 -W \
80 -Wextra \
81 -Wno-inline \
82 -Wvla \
83 -Wundef \
84 -Wformat=2 \
85 -Wlogical-op \
86 -Wsign-compare \
87 -Wformat-security \
88 -Wmissing-include-dirs \
89 -Wformat-nonliteral \
90 -Wold-style-definition \
91 -Wpointer-arith \
92 -Winit-self \
93 -Wdeclaration-after-statement \
94 -Wfloat-equal \
95 -Wmissing-prototypes \
96 -Wstrict-prototypes \
97 -Wredundant-decls \
98 -Wmissing-declarations \
99 -Wmissing-noreturn \
100 -Wshadow \
101 -Wendif-labels \
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200102 -Wstrict-aliasing=2 \
103 -Wwrite-strings \
104 -Wno-long-long \
105 -Wno-overlength-strings \
106 -Wno-unused-parameter \
107 -Wno-missing-field-initializers \
108 -Wno-unused-result \
109 -Wnested-externs \
110 -Wchar-subscripts \
111 -Wtype-limits \
112 -Wuninitialized \
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200113 -fno-common \
114 -fdiagnostics-show-option \
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200115 -fvisibility=hidden \
116 -ffunction-sections \
117 -fdata-sections \
118 -Wl,--as-needed \
119 -Wl,--gc-sections])
Gustavo Sverzut Barbieri822ce232011-12-10 22:26:40 -0200120
121
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -0200122AC_SUBST(required_private_libs)
123
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200124AC_CONFIG_HEADERS(config.h)
125AC_CONFIG_FILES([
126 Makefile
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200127])
128
129AC_OUTPUT
130AC_MSG_RESULT([
131 $PACKAGE $VERSION
132 ========
133
134 prefix: ${prefix}
Kay Sieversa308abe2011-12-20 17:58:05 +0100135 rootprefix: ${rootprefix}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200136 sysconfdir: ${sysconfdir}
137 libdir: ${libdir}
138 includedir: ${includedir}
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200139 bindir: ${bindir}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200140
141 compiler: ${CC}
142 cflags: ${CFLAGS}
143 ldflags: ${LDFLAGS}
144
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200145 tools: ${enable_tools}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200146 logging: ${enable_logging}
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -0200147 zlib: ${enable_zlib}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200148 debug: ${enable_debug}
149])