Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 1 | AC_PREREQ(2.60) |
Lucas De Marchi | cb48c9b | 2011-12-12 16:41:38 -0200 | [diff] [blame] | 2 | AC_INIT([kmod], |
Lucas De Marchi | 36c4bb9 | 2013-12-22 19:45:19 -0200 | [diff] [blame] | 3 | [16], |
Lucas De Marchi | e17cc3a | 2011-12-16 04:11:25 -0200 | [diff] [blame] | 4 | [linux-modules@vger.kernel.org], |
Lucas De Marchi | cb48c9b | 2011-12-12 16:41:38 -0200 | [diff] [blame] | 5 | [kmod], |
Lucas De Marchi | bb05bc8 | 2012-02-24 01:58:20 -0200 | [diff] [blame] | 6 | [http://git.kernel.org/?p=utils/kernel/kmod/kmod.git]) |
Lucas De Marchi | 586fc30 | 2011-11-21 14:35:35 -0200 | [diff] [blame] | 7 | |
| 8 | AC_CONFIG_SRCDIR([libkmod/libkmod.c]) |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 9 | AC_CONFIG_AUX_DIR([build-aux]) |
Jan Engelhardt | a597c8b | 2011-12-20 16:28:27 +0100 | [diff] [blame] | 10 | AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules |
Lucas De Marchi | 8edd5bb | 2013-04-09 11:59:33 -0300 | [diff] [blame] | 11 | tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests]) |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 12 | AC_PROG_CC_STDC |
| 13 | AC_USE_SYSTEM_EXTENSIONS |
| 14 | AC_SYS_LARGEFILE |
| 15 | AC_CONFIG_MACRO_DIR([m4]) |
Luis Felipe Strano Moraes | fe8bf3b | 2011-12-14 15:56:10 -0200 | [diff] [blame] | 16 | m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 17 | AM_SILENT_RULES([yes]) |
| 18 | LT_INIT([disable-static pic-only]) |
| 19 | AC_PREFIX_DEFAULT([/usr]) |
Anders Olofsson | f5cc26c | 2013-11-10 23:41:25 -0200 | [diff] [blame] | 20 | AM_MAINTAINER_MODE([enable]) |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 21 | |
Lucas De Marchi | b701615 | 2013-06-06 11:43:19 -0300 | [diff] [blame] | 22 | AS_IF([test "x$enable_static" = "xyes"], |
| 23 | [AC_MSG_ERROR([--enable-static is not supported by kmod])]) |
| 24 | |
| 25 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 26 | ##################################################################### |
| 27 | # Program checks and configurations |
| 28 | ##################################################################### |
| 29 | |
Lucas De Marchi | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 30 | AC_PROG_CC |
| 31 | AC_PROG_CC_C99 |
Lucas De Marchi | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 32 | AM_PROG_CC_C_O |
| 33 | AC_PROG_GCC_TRADITIONAL |
Gustavo Sverzut Barbieri | 708624a | 2011-12-18 01:25:06 -0200 | [diff] [blame] | 34 | AC_C_BIGENDIAN |
Lucas De Marchi | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 35 | |
Kay Sievers | 9faa7b3 | 2011-12-21 11:48:07 -0200 | [diff] [blame] | 36 | AC_PROG_SED |
| 37 | AC_PROG_MKDIR_P |
Jan Engelhardt | 7b3a74f | 2011-12-24 04:45:22 +0100 | [diff] [blame] | 38 | PKG_PROG_PKG_CONFIG |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 39 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 40 | |
| 41 | ##################################################################### |
| 42 | # Function and structure checks |
| 43 | ##################################################################### |
| 44 | |
Lucas De Marchi | d005aeb | 2012-02-08 20:29:52 -0200 | [diff] [blame] | 45 | AC_CHECK_FUNCS_ONCE(__xstat) |
Cristian RodrÃguez | 41a51c2 | 2013-02-11 15:07:52 -0300 | [diff] [blame] | 46 | AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv]) |
Lucas De Marchi | 55112d1 | 2013-04-09 04:16:57 -0300 | [diff] [blame] | 47 | AC_CHECK_FUNCS_ONCE([finit_module]) |
Lucas De Marchi | d005aeb | 2012-02-08 20:29:52 -0200 | [diff] [blame] | 48 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 49 | # dietlibc doesn't have st.st_mtim struct member |
| 50 | AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>]) |
| 51 | |
Kees Cook | 144d182 | 2013-02-18 12:02:32 -0800 | [diff] [blame] | 52 | # Check kernel headers |
| 53 | AC_CHECK_HEADERS_ONCE([linux/module.h]) |
| 54 | |
Thomas Petazzoni | dc8ed09 | 2013-09-06 15:27:04 +0200 | [diff] [blame] | 55 | AC_MSG_CHECKING([whether _Static_assert() is supported]) |
| 56 | AC_COMPILE_IFELSE( |
| 57 | [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])], |
| 58 | [AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available]) |
| 59 | AC_MSG_RESULT([yes])], |
| 60 | [AC_MSG_RESULT([no])]) |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 61 | |
| 62 | ##################################################################### |
| 63 | # --with- |
| 64 | ##################################################################### |
| 65 | |
Kay Sievers | e79bf83 | 2011-12-22 15:40:24 +0100 | [diff] [blame] | 66 | AC_ARG_WITH([rootlibdir], |
| 67 | AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), |
| 68 | [], [with_rootlibdir=$libdir]) |
| 69 | AC_SUBST([rootlibdir], [$with_rootlibdir]) |
| 70 | |
Jan Engelhardt | b182f8f | 2011-12-24 14:58:30 +0100 | [diff] [blame] | 71 | AC_ARG_WITH([xz], |
| 72 | AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]), |
| 73 | [], [with_xz=no]) |
| 74 | AS_IF([test "x$with_xz" != "xno"], [ |
| 75 | PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99]) |
| 76 | AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.]) |
| 77 | ], [ |
| 78 | AC_MSG_NOTICE([Xz support not requested]) |
| 79 | ]) |
| 80 | |
Jan Engelhardt | 5a51a35 | 2011-12-24 04:45:42 +0100 | [diff] [blame] | 81 | AC_ARG_WITH([zlib], |
| 82 | AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]), |
| 83 | [], [with_zlib=no]) |
| 84 | AS_IF([test "x$with_zlib" != "xno"], [ |
Jan Engelhardt | 7b3a74f | 2011-12-24 04:45:22 +0100 | [diff] [blame] | 85 | PKG_CHECK_MODULES([zlib], [zlib]) |
| 86 | AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.]) |
Lucas De Marchi | cfb908b | 2011-12-23 12:03:19 -0200 | [diff] [blame] | 87 | ], [ |
| 88 | AC_MSG_NOTICE([zlib support not requested]) |
Lucas De Marchi | cfb908b | 2011-12-23 12:03:19 -0200 | [diff] [blame] | 89 | ]) |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 90 | |
Lucas De Marchi | 80cf2c8 | 2013-07-30 03:47:19 -0300 | [diff] [blame] | 91 | AC_ARG_WITH([bashcompletiondir], |
| 92 | AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), |
| 93 | [], |
| 94 | [AS_IF([$($PKG_CONFIG --exists bash-completion)], [ |
| 95 | with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion) |
| 96 | ] , [ |
| 97 | with_bashcompletiondir=${datadir}/bash-completion/completions |
| 98 | ])]) |
| 99 | AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 100 | |
| 101 | ##################################################################### |
| 102 | # --enable- |
| 103 | ##################################################################### |
| 104 | |
| 105 | AC_ARG_ENABLE([tools], |
| 106 | AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]), |
| 107 | [], enable_tools=yes) |
| 108 | AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"]) |
| 109 | |
Colin Walters | 8631552 | 2012-07-30 12:27:10 -0400 | [diff] [blame] | 110 | AC_ARG_ENABLE([manpages], |
| 111 | AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]), |
| 112 | [], enable_manpages=yes) |
| 113 | AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"]) |
Sami Kerola | 5c61b14 | 2012-10-22 18:40:02 +0100 | [diff] [blame] | 114 | AC_PATH_PROG([XSLTPROC], [xsltproc], [no]) |
Lucas De Marchi | caaf438 | 2012-10-23 10:45:10 -0200 | [diff] [blame] | 115 | AS_IF([test "x$XSLTPROC" = "xno" && test "x$enable_manpages" = "xyes"], [ |
Sami Kerola | 5c61b14 | 2012-10-22 18:40:02 +0100 | [diff] [blame] | 116 | AC_MSG_ERROR([xsltproc command not found, try ./configure --disable-manpages]) |
Lucas De Marchi | caaf438 | 2012-10-23 10:45:10 -0200 | [diff] [blame] | 117 | ]) |
Colin Walters | 8631552 | 2012-07-30 12:27:10 -0400 | [diff] [blame] | 118 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 119 | AC_ARG_ENABLE([logging], |
| 120 | AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), |
| 121 | [], enable_logging=yes) |
| 122 | AS_IF([test "x$enable_logging" = "xyes"], [ |
| 123 | AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) |
| 124 | ]) |
| 125 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 126 | AC_ARG_ENABLE([debug], |
| 127 | AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), |
| 128 | [], [enable_debug=no]) |
| 129 | AS_IF([test "x$enable_debug" = "xyes"], [ |
| 130 | AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) |
| 131 | ]) |
| 132 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 133 | m4_ifdef([GTK_DOC_CHECK], [ |
| 134 | GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat]) |
| 135 | ], [ |
| 136 | AM_CONDITIONAL([ENABLE_GTK_DOC], false)]) |
| 137 | |
| 138 | |
| 139 | ##################################################################### |
| 140 | # Default CFLAGS and LDFLAGS |
| 141 | ##################################################################### |
Lucas De Marchi | 6068aaa | 2012-01-17 12:10:42 -0200 | [diff] [blame] | 142 | |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 143 | CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\ |
| 144 | -pipe \ |
| 145 | -DANOTHER_BRICK_IN_THE \ |
| 146 | -Wall \ |
| 147 | -W \ |
| 148 | -Wextra \ |
| 149 | -Wno-inline \ |
| 150 | -Wvla \ |
| 151 | -Wundef \ |
| 152 | -Wformat=2 \ |
| 153 | -Wlogical-op \ |
| 154 | -Wsign-compare \ |
| 155 | -Wformat-security \ |
| 156 | -Wmissing-include-dirs \ |
| 157 | -Wformat-nonliteral \ |
| 158 | -Wold-style-definition \ |
| 159 | -Wpointer-arith \ |
| 160 | -Winit-self \ |
| 161 | -Wdeclaration-after-statement \ |
| 162 | -Wfloat-equal \ |
| 163 | -Wmissing-prototypes \ |
| 164 | -Wstrict-prototypes \ |
| 165 | -Wredundant-decls \ |
| 166 | -Wmissing-declarations \ |
| 167 | -Wmissing-noreturn \ |
| 168 | -Wshadow \ |
| 169 | -Wendif-labels \ |
| 170 | -Wstrict-aliasing=2 \ |
| 171 | -Wwrite-strings \ |
| 172 | -Wno-long-long \ |
| 173 | -Wno-overlength-strings \ |
| 174 | -Wno-unused-parameter \ |
| 175 | -Wno-missing-field-initializers \ |
| 176 | -Wno-unused-result \ |
| 177 | -Wnested-externs \ |
| 178 | -Wchar-subscripts \ |
| 179 | -Wtype-limits \ |
| 180 | -Wuninitialized \ |
| 181 | -fno-common \ |
| 182 | -fdiagnostics-show-option \ |
Lucas De Marchi | b3e0a07 | 2013-10-26 02:51:05 -0200 | [diff] [blame] | 183 | -fdiagnostics-color=auto \ |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 184 | -fvisibility=hidden \ |
| 185 | -ffunction-sections \ |
| 186 | -fdata-sections]) |
| 187 | AC_SUBST([WARNINGFLAGS], $with_cflags) |
Randy Witt | 1701b1b | 2012-03-16 01:01:18 -0400 | [diff] [blame] | 188 | |
Gustavo Sverzut Barbieri | 822ce23 | 2011-12-10 22:26:40 -0200 | [diff] [blame] | 189 | |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 190 | CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \ |
| 191 | -Wl,--as-needed \ |
| 192 | -Wl,--gc-sections]) |
| 193 | AC_SUBST([GCLDFLAGS], $with_ldflags) |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 194 | |
| 195 | ##################################################################### |
| 196 | # Generate files from *.in |
| 197 | ##################################################################### |
| 198 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 199 | AC_CONFIG_HEADERS(config.h) |
| 200 | AC_CONFIG_FILES([ |
| 201 | Makefile |
Lucas De Marchi | 904b57d | 2012-01-12 11:48:21 -0200 | [diff] [blame] | 202 | man/Makefile |
Lucas De Marchi | 646b83b | 2012-01-09 04:20:55 -0200 | [diff] [blame] | 203 | libkmod/docs/Makefile |
| 204 | libkmod/docs/version.xml |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 205 | ]) |
| 206 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 207 | |
| 208 | ##################################################################### |
Lucas De Marchi | 646b83b | 2012-01-09 04:20:55 -0200 | [diff] [blame] | 209 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 210 | AC_OUTPUT |
| 211 | AC_MSG_RESULT([ |
| 212 | $PACKAGE $VERSION |
Lucas De Marchi | 80cf2c8 | 2013-07-30 03:47:19 -0300 | [diff] [blame] | 213 | ======= |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 214 | |
| 215 | prefix: ${prefix} |
| 216 | sysconfdir: ${sysconfdir} |
| 217 | libdir: ${libdir} |
Kay Sievers | e79bf83 | 2011-12-22 15:40:24 +0100 | [diff] [blame] | 218 | rootlibdir: ${rootlibdir} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 219 | includedir: ${includedir} |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 220 | bindir: ${bindir} |
Lucas De Marchi | 80cf2c8 | 2013-07-30 03:47:19 -0300 | [diff] [blame] | 221 | Bash completions dir: ${with_bashcompletiondir} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 222 | |
| 223 | compiler: ${CC} |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 224 | cflags: ${with_cflags} ${CFLAGS} |
| 225 | ldflags: ${with_ldflags} ${LDFLAGS} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 226 | |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 227 | tools: ${enable_tools} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 228 | logging: ${enable_logging} |
Jan Engelhardt | b182f8f | 2011-12-24 14:58:30 +0100 | [diff] [blame] | 229 | compression: xz=${with_xz} zlib=${with_zlib} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 230 | debug: ${enable_debug} |
Lucas De Marchi | 646b83b | 2012-01-09 04:20:55 -0200 | [diff] [blame] | 231 | doc: ${enable_gtk_doc} |
Lucas De Marchi | 382de85 | 2012-07-31 09:51:48 -0300 | [diff] [blame] | 232 | man: ${enable_manpages} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 233 | ]) |