introduce --with-rootlibdir=DIR
[platform/upstream/kmod.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT([kmod],
3         [2],
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 AC_PROG_SED
29 AC_PROG_MKDIR_P
30
31 required_private_libs=""
32
33 AC_ARG_WITH([rootprefix],
34         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
35         [], [with_rootprefix=""])
36 AC_SUBST([rootprefix], [$with_rootprefix])
37
38 AC_ARG_WITH([rootlibdir],
39         AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
40         [], [with_rootlibdir=$libdir])
41 AC_SUBST([rootlibdir], [$with_rootlibdir])
42
43 AC_ARG_ENABLE([tools],
44         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
45         [], enable_tools=yes)
46 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
47
48 AC_ARG_ENABLE([logging],
49         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
50         [], enable_logging=yes)
51 AS_IF([test "x$enable_logging" = "xyes"], [
52         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
53 ])
54
55 AC_ARG_ENABLE([zlib],
56         AS_HELP_STRING([--enable-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
57         [], enable_zlib=no)
58 if test "x$enable_zlib" != "xno"; then
59         AC_CHECK_LIB([z], [gzopen],
60                 [
61                         zlib_libs="-lz"
62                         required_private_libs="${required_private_libs} ${zlib_libs}"
63                 ],
64                 [AC_MSG_ERROR([zlib is not present])])
65 else
66         AC_MSG_NOTICE([zlib support not requested])
67         zlib_libs=""
68 fi
69 if test "x$zlib_libs" != "x"; then
70         AC_DEFINE(ENABLE_ZLIB, [1], [Enable zlib for modules.])
71 fi
72 AC_SUBST(zlib_libs)
73
74 AC_ARG_ENABLE([debug],
75         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
76         [], [enable_debug=no])
77 AS_IF([test "x$enable_debug" = "xyes"], [
78         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
79 ])
80
81 CC_CHECK_CFLAGS_APPEND([ \
82                         -pipe \
83                         -Wall \
84                         -W \
85                         -Wextra \
86                         -Wno-inline \
87                         -Wvla \
88                         -Wundef \
89                         -Wformat=2 \
90                         -Wlogical-op \
91                         -Wsign-compare \
92                         -Wformat-security \
93                         -Wmissing-include-dirs \
94                         -Wformat-nonliteral \
95                         -Wold-style-definition \
96                         -Wpointer-arith \
97                         -Winit-self \
98                         -Wdeclaration-after-statement \
99                         -Wfloat-equal \
100                         -Wmissing-prototypes \
101                         -Wstrict-prototypes \
102                         -Wredundant-decls \
103                         -Wmissing-declarations \
104                         -Wmissing-noreturn \
105                         -Wshadow \
106                         -Wendif-labels \
107                         -Wstrict-aliasing=2 \
108                         -Wwrite-strings \
109                         -Wno-long-long \
110                         -Wno-overlength-strings \
111                         -Wno-unused-parameter \
112                         -Wno-missing-field-initializers \
113                         -Wno-unused-result \
114                         -Wnested-externs \
115                         -Wchar-subscripts \
116                         -Wtype-limits \
117                         -Wuninitialized \
118                         -fno-common \
119                         -fdiagnostics-show-option \
120                         -fvisibility=hidden \
121                         -ffunction-sections \
122                         -fdata-sections \
123                         -Wl,--as-needed \
124                         -Wl,--gc-sections])
125
126
127 AC_SUBST(required_private_libs)
128
129 AC_CONFIG_HEADERS(config.h)
130 AC_CONFIG_FILES([
131         Makefile
132 ])
133
134 AC_OUTPUT
135 AC_MSG_RESULT([
136         $PACKAGE $VERSION
137         ========
138
139         prefix:                 ${prefix}
140         rootprefix:             ${rootprefix}
141         sysconfdir:             ${sysconfdir}
142         libdir:                 ${libdir}
143         rootlibdir:             ${rootlibdir}
144         includedir:             ${includedir}
145         bindir:                 ${bindir}
146
147         compiler:               ${CC}
148         cflags:                 ${CFLAGS}
149         ldflags:                ${LDFLAGS}
150
151         tools:                  ${enable_tools}
152         logging:                ${enable_logging}
153         zlib:                   ${enable_zlib}
154         debug:                  ${enable_debug}
155 ])