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 | 46684bc | 2012-04-19 11:21:00 -0300 | [diff] [blame] | 3 | [8], |
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 | 80f9e02 | 2012-01-24 20:59:54 -0200 | [diff] [blame] | 11 | tar-pax no-dist-gzip dist-xz subdir-objects color-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]) |
| 20 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 21 | ##################################################################### |
| 22 | # Program checks and configurations |
| 23 | ##################################################################### |
| 24 | |
Lucas De Marchi | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 25 | AC_PROG_CC |
| 26 | AC_PROG_CC_C99 |
| 27 | AC_C_TYPEOF |
| 28 | AM_PROG_CC_C_O |
| 29 | AC_PROG_GCC_TRADITIONAL |
Gustavo Sverzut Barbieri | 708624a | 2011-12-18 01:25:06 -0200 | [diff] [blame] | 30 | AC_C_BIGENDIAN |
Lucas De Marchi | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 31 | |
Kay Sievers | 9faa7b3 | 2011-12-21 11:48:07 -0200 | [diff] [blame] | 32 | AC_PROG_SED |
| 33 | AC_PROG_MKDIR_P |
Lucas De Marchi | 904b57d | 2012-01-12 11:48:21 -0200 | [diff] [blame] | 34 | AC_PATH_PROG([XSLTPROC], [xsltproc]) |
Jan Engelhardt | 7b3a74f | 2011-12-24 04:45:22 +0100 | [diff] [blame] | 35 | PKG_PROG_PKG_CONFIG |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 36 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 37 | |
| 38 | ##################################################################### |
| 39 | # Function and structure checks |
| 40 | ##################################################################### |
| 41 | |
Lucas De Marchi | d005aeb | 2012-02-08 20:29:52 -0200 | [diff] [blame] | 42 | AC_CHECK_FUNCS_ONCE(__xstat) |
| 43 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 44 | # dietlibc doesn't have st.st_mtim struct member |
| 45 | AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>]) |
| 46 | |
| 47 | |
| 48 | ##################################################################### |
| 49 | # --with- |
| 50 | ##################################################################### |
| 51 | |
Kay Sievers | a308abe | 2011-12-20 17:58:05 +0100 | [diff] [blame] | 52 | AC_ARG_WITH([rootprefix], |
| 53 | AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), |
Lucas De Marchi | 0c5fad9 | 2011-12-20 16:52:21 -0200 | [diff] [blame] | 54 | [], [with_rootprefix=""]) |
Kay Sievers | a308abe | 2011-12-20 17:58:05 +0100 | [diff] [blame] | 55 | AC_SUBST([rootprefix], [$with_rootprefix]) |
| 56 | |
Kay Sievers | e79bf83 | 2011-12-22 15:40:24 +0100 | [diff] [blame] | 57 | AC_ARG_WITH([rootlibdir], |
| 58 | AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), |
| 59 | [], [with_rootlibdir=$libdir]) |
| 60 | AC_SUBST([rootlibdir], [$with_rootlibdir]) |
| 61 | |
Jan Engelhardt | b182f8f | 2011-12-24 14:58:30 +0100 | [diff] [blame] | 62 | AC_ARG_WITH([xz], |
| 63 | AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]), |
| 64 | [], [with_xz=no]) |
| 65 | AS_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 Engelhardt | 5a51a35 | 2011-12-24 04:45:42 +0100 | [diff] [blame] | 72 | AC_ARG_WITH([zlib], |
| 73 | AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]), |
| 74 | [], [with_zlib=no]) |
| 75 | AS_IF([test "x$with_zlib" != "xno"], [ |
Jan Engelhardt | 7b3a74f | 2011-12-24 04:45:22 +0100 | [diff] [blame] | 76 | PKG_CHECK_MODULES([zlib], [zlib]) |
| 77 | AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.]) |
Lucas De Marchi | cfb908b | 2011-12-23 12:03:19 -0200 | [diff] [blame] | 78 | ], [ |
| 79 | AC_MSG_NOTICE([zlib support not requested]) |
Lucas De Marchi | cfb908b | 2011-12-23 12:03:19 -0200 | [diff] [blame] | 80 | ]) |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 81 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 82 | |
| 83 | ##################################################################### |
| 84 | # --enable- |
| 85 | ##################################################################### |
| 86 | |
| 87 | AC_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) |
| 90 | AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"]) |
| 91 | |
| 92 | AC_ARG_ENABLE([logging], |
| 93 | AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), |
| 94 | [], enable_logging=yes) |
| 95 | AS_IF([test "x$enable_logging" = "xyes"], [ |
| 96 | AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) |
| 97 | ]) |
| 98 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 99 | AC_ARG_ENABLE([debug], |
| 100 | AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), |
| 101 | [], [enable_debug=no]) |
| 102 | AS_IF([test "x$enable_debug" = "xyes"], [ |
| 103 | AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) |
| 104 | ]) |
| 105 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 106 | m4_ifdef([GTK_DOC_CHECK], [ |
| 107 | GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat]) |
| 108 | ], [ |
| 109 | AM_CONDITIONAL([ENABLE_GTK_DOC], false)]) |
| 110 | |
| 111 | |
| 112 | ##################################################################### |
| 113 | # Default CFLAGS and LDFLAGS |
| 114 | ##################################################################### |
Lucas De Marchi | 6068aaa | 2012-01-17 12:10:42 -0200 | [diff] [blame] | 115 | |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 116 | CC_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]) |
| 159 | AC_SUBST([WARNINGFLAGS], $with_cflags) |
Randy Witt | 1701b1b | 2012-03-16 01:01:18 -0400 | [diff] [blame] | 160 | |
Gustavo Sverzut Barbieri | 822ce23 | 2011-12-10 22:26:40 -0200 | [diff] [blame] | 161 | |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 162 | CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \ |
| 163 | -Wl,--as-needed \ |
| 164 | -Wl,--gc-sections]) |
| 165 | AC_SUBST([GCLDFLAGS], $with_ldflags) |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 166 | |
| 167 | ##################################################################### |
| 168 | # Generate files from *.in |
| 169 | ##################################################################### |
| 170 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 171 | AC_CONFIG_HEADERS(config.h) |
| 172 | AC_CONFIG_FILES([ |
| 173 | Makefile |
Lucas De Marchi | 904b57d | 2012-01-12 11:48:21 -0200 | [diff] [blame] | 174 | man/Makefile |
Lucas De Marchi | 646b83b | 2012-01-09 04:20:55 -0200 | [diff] [blame] | 175 | libkmod/docs/Makefile |
| 176 | libkmod/docs/version.xml |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 177 | ]) |
| 178 | |
Lucas De Marchi | 3ef7208 | 2012-03-17 10:26:32 -0300 | [diff] [blame] | 179 | |
| 180 | ##################################################################### |
Lucas De Marchi | 646b83b | 2012-01-09 04:20:55 -0200 | [diff] [blame] | 181 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 182 | AC_OUTPUT |
| 183 | AC_MSG_RESULT([ |
| 184 | $PACKAGE $VERSION |
Lucas De Marchi | 63dc832 | 2012-01-09 13:00:28 -0200 | [diff] [blame] | 185 | ====== |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 186 | |
| 187 | prefix: ${prefix} |
Kay Sievers | a308abe | 2011-12-20 17:58:05 +0100 | [diff] [blame] | 188 | rootprefix: ${rootprefix} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 189 | sysconfdir: ${sysconfdir} |
| 190 | libdir: ${libdir} |
Kay Sievers | e79bf83 | 2011-12-22 15:40:24 +0100 | [diff] [blame] | 191 | rootlibdir: ${rootlibdir} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 192 | includedir: ${includedir} |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 193 | bindir: ${bindir} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 194 | |
| 195 | compiler: ${CC} |
Lucas De Marchi | e48f376 | 2012-03-17 15:12:44 -0300 | [diff] [blame] | 196 | cflags: ${with_cflags} ${CFLAGS} |
| 197 | ldflags: ${with_ldflags} ${LDFLAGS} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 198 | |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 199 | tools: ${enable_tools} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 200 | logging: ${enable_logging} |
Jan Engelhardt | b182f8f | 2011-12-24 14:58:30 +0100 | [diff] [blame] | 201 | compression: xz=${with_xz} zlib=${with_zlib} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 202 | debug: ${enable_debug} |
Lucas De Marchi | 646b83b | 2012-01-09 04:20:55 -0200 | [diff] [blame] | 203 | doc: ${enable_gtk_doc} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 204 | ]) |