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], |
| 3 | [1], |
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], |
| 6 | [http://git.profusion.mobi/cgit.cgi/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 |
| 11 | tar-pax no-dist-gzip dist-xz subdir-objects]) |
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 | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 21 | AC_PROG_CC |
| 22 | AC_PROG_CC_C99 |
| 23 | AC_C_TYPEOF |
| 24 | AM_PROG_CC_C_O |
| 25 | AC_PROG_GCC_TRADITIONAL |
Gustavo Sverzut Barbieri | 708624a | 2011-12-18 01:25:06 -0200 | [diff] [blame] | 26 | AC_C_BIGENDIAN |
Lucas De Marchi | 648a842 | 2011-11-22 17:46:19 -0200 | [diff] [blame] | 27 | |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 28 | required_private_libs="" |
| 29 | |
Kay Sievers | a308abe | 2011-12-20 17:58:05 +0100 | [diff] [blame^] | 30 | AC_ARG_WITH([rootprefix], |
| 31 | AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), |
| 32 | [], [with_rootprefix=$prefix]) |
| 33 | AC_SUBST([rootprefix], [$with_rootprefix]) |
| 34 | |
Gustavo Sverzut Barbieri | 72c51a9 | 2011-12-10 22:19:41 -0200 | [diff] [blame] | 35 | AC_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) |
| 38 | AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"]) |
| 39 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 40 | AC_ARG_ENABLE([logging], |
| 41 | AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), |
| 42 | [], enable_logging=yes) |
| 43 | AS_IF([test "x$enable_logging" = "xyes"], [ |
| 44 | AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) |
| 45 | ]) |
| 46 | |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 47 | AC_ARG_ENABLE([zlib], |
| 48 | AS_HELP_STRING([--enable-zlib], [handle gzipped modules (options: static or dynamic) @<:@default=disabled@:>@]), |
| 49 | [], enable_zlib=no) |
| 50 | if 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 |
| 68 | elif 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])]) |
| 75 | else |
| 76 | AC_MSG_NOTICE([zlib support not requested]) |
| 77 | zlib_libs="" |
| 78 | fi |
| 79 | if test "x$zlib_libs" != "x"; then |
| 80 | AC_DEFINE(ENABLE_ZLIB, [1], [Enable zlib for modules.]) |
| 81 | fi |
| 82 | AC_SUBST(zlib_libs) |
| 83 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 84 | AC_ARG_ENABLE([debug], |
| 85 | AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), |
| 86 | [], [enable_debug=no]) |
| 87 | AS_IF([test "x$enable_debug" = "xyes"], [ |
| 88 | AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) |
| 89 | ]) |
| 90 | |
Gustavo Sverzut Barbieri | 822ce23 | 2011-12-10 22:26:40 -0200 | [diff] [blame] | 91 | CC_CHECK_CFLAGS_APPEND([ \ |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 92 | -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 Barbieri | 822ce23 | 2011-12-10 22:26:40 -0200 | [diff] [blame] | 139 | |
| 140 | |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 141 | AC_SUBST(required_private_libs) |
| 142 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 143 | AC_CONFIG_HEADERS(config.h) |
| 144 | AC_CONFIG_FILES([ |
| 145 | Makefile |
Lucas De Marchi | 586fc30 | 2011-11-21 14:35:35 -0200 | [diff] [blame] | 146 | libkmod/libkmod.pc |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 147 | ]) |
| 148 | |
| 149 | AC_OUTPUT |
| 150 | AC_MSG_RESULT([ |
| 151 | $PACKAGE $VERSION |
| 152 | ======== |
| 153 | |
| 154 | prefix: ${prefix} |
Kay Sievers | a308abe | 2011-12-20 17:58:05 +0100 | [diff] [blame^] | 155 | rootprefix: ${rootprefix} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 156 | sysconfdir: ${sysconfdir} |
| 157 | libdir: ${libdir} |
| 158 | includedir: ${includedir} |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 159 | bindir: ${bindir} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 160 | |
| 161 | compiler: ${CC} |
| 162 | cflags: ${CFLAGS} |
| 163 | ldflags: ${LDFLAGS} |
| 164 | |
Lucas De Marchi | 7c41c2d | 2011-12-12 13:39:07 -0200 | [diff] [blame] | 165 | tools: ${enable_tools} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 166 | logging: ${enable_logging} |
Gustavo Sverzut Barbieri | 3d8226e | 2011-12-16 16:08:53 -0200 | [diff] [blame] | 167 | zlib: ${enable_zlib} |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 168 | debug: ${enable_debug} |
| 169 | ]) |