1dnl # 2dnl # Certain kernel build options are not supported. These must be 3dnl # detected at configure time and cause a build failure. Otherwise 4dnl # modules may be successfully built that behave incorrectly. 5dnl # 6AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [ 7 AS_IF([test "x$cross_compiling" != xyes], [ 8 AC_RUN_IFELSE([ 9 AC_LANG_PROGRAM([ 10 #include "$LINUX/include/linux/license.h" 11 ], [ 12 return !license_is_gpl_compatible( 13 "$ZFS_META_LICENSE"); 14 ]) 15 ], [ 16 AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1], 17 [Define to 1 if GPL-only symbols can be used]) 18 ], [ 19 ]) 20 ]) 21 22 ZFS_AC_KERNEL_SRC_CONFIG_MODULES 23 ZFS_AC_KERNEL_SRC_CONFIG_BLOCK 24 ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC 25 ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS 26 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE 27 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE 28 29 AC_MSG_CHECKING([for kernel config option compatibility]) 30 ZFS_LINUX_TEST_COMPILE_ALL([config]) 31 AC_MSG_RESULT([done]) 32 33 ZFS_AC_KERNEL_CONFIG_MODULES 34 ZFS_AC_KERNEL_CONFIG_BLOCK 35 ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC 36 ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS 37 ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE 38 ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE 39]) 40 41dnl # 42dnl # Check CONFIG_BLOCK 43dnl # 44dnl # Verify the kernel has CONFIG_BLOCK support enabled. 45dnl # 46AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_BLOCK], [ 47 ZFS_LINUX_TEST_SRC([config_block], [ 48 #if !defined(CONFIG_BLOCK) 49 #error CONFIG_BLOCK not defined 50 #endif 51 ],[]) 52]) 53 54AC_DEFUN([ZFS_AC_KERNEL_CONFIG_BLOCK], [ 55 AC_MSG_CHECKING([whether CONFIG_BLOCK is defined]) 56 ZFS_LINUX_TEST_RESULT([config_block], [ 57 AC_MSG_RESULT([yes]) 58 ],[ 59 AC_MSG_RESULT([no]) 60 AC_MSG_ERROR([ 61 *** This kernel does not include the required block device support. 62 *** Rebuild the kernel with CONFIG_BLOCK=y set.]) 63 ]) 64]) 65 66dnl # 67dnl # Check CONFIG_DEBUG_LOCK_ALLOC 68dnl # 69dnl # This is typically only set for debug kernels because it comes with 70dnl # a performance penalty. However, when it is set it maps the non-GPL 71dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol. 72dnl # This will cause a failure at link time which we'd rather know about 73dnl # at compile time. 74dnl # 75dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol 76dnl # with the upstream community we add a check to detect this case. 77dnl # 78AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [ 79 ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [ 80 #include <linux/mutex.h> 81 ],[ 82 struct mutex lock; 83 84 mutex_init(&lock); 85 mutex_lock(&lock); 86 mutex_unlock(&lock); 87 ], [], [ZFS_META_LICENSE]) 88]) 89 90AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [ 91 AC_MSG_CHECKING([whether mutex_lock() is GPL-only]) 92 ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc_license], [ 93 AC_MSG_RESULT(no) 94 ],[ 95 AC_MSG_RESULT(yes) 96 AC_MSG_ERROR([ 97 *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible 98 *** with the CDDL license and will prevent the module linking stage 99 *** from succeeding. You must rebuild your kernel without this 100 *** option enabled.]) 101 ]) 102]) 103 104dnl # 105dnl # Check CONFIG_MODULES 106dnl # 107dnl # Verify the kernel has CONFIG_MODULES support enabled. 108dnl # 109AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_MODULES], [ 110 ZFS_LINUX_TEST_SRC([config_modules], [ 111 #if !defined(CONFIG_MODULES) 112 #error CONFIG_MODULES not defined 113 #endif 114 ],[]) 115]) 116 117AC_DEFUN([ZFS_AC_KERNEL_CONFIG_MODULES], [ 118 AC_MSG_CHECKING([whether CONFIG_MODULES is defined]) 119 AS_IF([test "x$enable_linux_builtin" != xyes], [ 120 ZFS_LINUX_TEST_RESULT([config_modules], [ 121 AC_MSG_RESULT([yes]) 122 ],[ 123 AC_MSG_RESULT([no]) 124 AC_MSG_ERROR([ 125 *** This kernel does not include the required loadable module 126 *** support! 127 *** 128 *** To build OpenZFS as a loadable Linux kernel module 129 *** enable loadable module support by setting 130 *** `CONFIG_MODULES=y` in the kernel configuration and run 131 *** `make modules_prepare` in the Linux source tree. 132 *** 133 *** If you don't intend to enable loadable kernel module 134 *** support, please compile OpenZFS as a Linux kernel built-in. 135 *** 136 *** Prepare the Linux source tree by running `make prepare`, 137 *** use the OpenZFS `--enable-linux-builtin` configure option, 138 *** copy the OpenZFS sources into the Linux source tree using 139 *** `./copy-builtin <linux source directory>`, 140 *** set `CONFIG_ZFS=y` in the kernel configuration and compile 141 *** kernel as usual. 142 ]) 143 ]) 144 ], [ 145 ZFS_LINUX_TRY_COMPILE([], [], [ 146 AC_MSG_RESULT([not needed]) 147 ],[ 148 AC_MSG_RESULT([error]) 149 AC_MSG_ERROR([ 150 *** This kernel is unable to compile object files. 151 *** 152 *** Please make sure you prepared the Linux source tree 153 *** by running `make prepare` there. 154 ]) 155 ]) 156 ]) 157]) 158 159dnl # 160dnl # Check CONFIG_TRIM_UNUSED_KSYMS 161dnl # 162dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled. 163dnl # 164AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [ 165 ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [ 166 #if defined(CONFIG_TRIM_UNUSED_KSYMS) 167 #error CONFIG_TRIM_UNUSED_KSYMS not defined 168 #endif 169 ],[]) 170]) 171 172AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [ 173 AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled]) 174 ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [ 175 AC_MSG_RESULT([yes]) 176 ],[ 177 AC_MSG_RESULT([no]) 178 AS_IF([test "x$enable_linux_builtin" != xyes], [ 179 AC_MSG_ERROR([ 180 *** This kernel has unused symbols trimming enabled, please disable. 181 *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.]) 182 ]) 183 ]) 184]) 185 186dnl # 187dnl # Check CONFIG_ZLIB_INFLATE 188dnl # 189dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled. 190dnl # 191AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [ 192 ZFS_LINUX_TEST_SRC([config_zlib_inflate], [ 193 #if !defined(CONFIG_ZLIB_INFLATE) && \ 194 !defined(CONFIG_ZLIB_INFLATE_MODULE) 195 #error CONFIG_ZLIB_INFLATE not defined 196 #endif 197 ],[]) 198]) 199 200AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [ 201 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined]) 202 ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [ 203 AC_MSG_RESULT([yes]) 204 ],[ 205 AC_MSG_RESULT([no]) 206 AC_MSG_ERROR([ 207 *** This kernel does not include the required zlib inflate support. 208 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.]) 209 ]) 210]) 211 212dnl # 213dnl # Check CONFIG_ZLIB_DEFLATE 214dnl # 215dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled. 216dnl # 217AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [ 218 ZFS_LINUX_TEST_SRC([config_zlib_deflate], [ 219 #if !defined(CONFIG_ZLIB_DEFLATE) && \ 220 !defined(CONFIG_ZLIB_DEFLATE_MODULE) 221 #error CONFIG_ZLIB_DEFLATE not defined 222 #endif 223 ],[]) 224]) 225 226AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [ 227 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined]) 228 ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [ 229 AC_MSG_RESULT([yes]) 230 ],[ 231 AC_MSG_RESULT([no]) 232 AC_MSG_ERROR([ 233 *** This kernel does not include the required zlib deflate support. 234 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.]) 235 ]) 236]) 237