blob: e9eb08d6668bba8c05e72ec60c991048e92a150a [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],
3 [1],
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
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020028required_private_libs=""
29
Kay Sieversa308abe2011-12-20 17:58:05 +010030AC_ARG_WITH([rootprefix],
31 AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
32 [], [with_rootprefix=$prefix])
33AC_SUBST([rootprefix], [$with_rootprefix])
34
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -020035AC_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)
38AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
39
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020040AC_ARG_ENABLE([logging],
41 AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
42 [], enable_logging=yes)
43AS_IF([test "x$enable_logging" = "xyes"], [
44 AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
45])
46
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020047AC_ARG_ENABLE([zlib],
48 AS_HELP_STRING([--enable-zlib], [handle gzipped modules (options: static or dynamic) @<:@default=disabled@:>@]),
49 [], enable_zlib=no)
50if 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
68elif 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])])
75else
76 AC_MSG_NOTICE([zlib support not requested])
77 zlib_libs=""
78fi
79if test "x$zlib_libs" != "x"; then
80 AC_DEFINE(ENABLE_ZLIB, [1], [Enable zlib for modules.])
81fi
82AC_SUBST(zlib_libs)
83
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020084AC_ARG_ENABLE([debug],
85 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
86 [], [enable_debug=no])
87AS_IF([test "x$enable_debug" = "xyes"], [
88 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
89])
90
Gustavo Sverzut Barbieri822ce232011-12-10 22:26:40 -020091CC_CHECK_CFLAGS_APPEND([ \
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -020092 -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])
Gustavo Sverzut Barbieri822ce232011-12-10 22:26:40 -0200139
140
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -0200141AC_SUBST(required_private_libs)
142
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200143AC_CONFIG_HEADERS(config.h)
144AC_CONFIG_FILES([
145 Makefile
Lucas De Marchi586fc302011-11-21 14:35:35 -0200146 libkmod/libkmod.pc
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200147])
148
149AC_OUTPUT
150AC_MSG_RESULT([
151 $PACKAGE $VERSION
152 ========
153
154 prefix: ${prefix}
Kay Sieversa308abe2011-12-20 17:58:05 +0100155 rootprefix: ${rootprefix}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200156 sysconfdir: ${sysconfdir}
157 libdir: ${libdir}
158 includedir: ${includedir}
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200159 bindir: ${bindir}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200160
161 compiler: ${CC}
162 cflags: ${CFLAGS}
163 ldflags: ${LDFLAGS}
164
Lucas De Marchi7c41c2d2011-12-12 13:39:07 -0200165 tools: ${enable_tools}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200166 logging: ${enable_logging}
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -0200167 zlib: ${enable_zlib}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200168 debug: ${enable_debug}
169])