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_THREAD_SIZE 23 ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC 24 ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS 25 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE 26 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE 27 28 AC_MSG_CHECKING([for kernel config option compatibility]) 29 ZFS_LINUX_TEST_COMPILE_ALL([config]) 30 AC_MSG_RESULT([done]) 31 32 ZFS_AC_KERNEL_CONFIG_THREAD_SIZE 33 ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC 34 ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS 35 ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE 36 ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE 37]) 38 39dnl # 40dnl # Check configured THREAD_SIZE 41dnl # 42dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64 43dnl # the default thread stack size was increased to 16K from 8K. Therefore, 44dnl # on newer kernels and some architectures stack usage optimizations can be 45dnl # conditionally applied to improve performance without negatively impacting 46dnl # stability. 47dnl # 48AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE], [ 49 ZFS_LINUX_TEST_SRC([config_thread_size], [ 50 #include <linux/module.h> 51 ],[ 52 #if (THREAD_SIZE < 16384) 53 #error "THREAD_SIZE is less than 16K" 54 #endif 55 ]) 56]) 57 58AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [ 59 AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks]) 60 ZFS_LINUX_TEST_RESULT([config_thread_size], [ 61 AC_MSG_RESULT([yes]) 62 AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks]) 63 ],[ 64 AC_MSG_RESULT([no]) 65 ]) 66]) 67 68dnl # 69dnl # Check CONFIG_DEBUG_LOCK_ALLOC 70dnl # 71dnl # This is typically only set for debug kernels because it comes with 72dnl # a performance penalty. However, when it is set it maps the non-GPL 73dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol. 74dnl # This will cause a failure at link time which we'd rather know about 75dnl # at compile time. 76dnl # 77dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol 78dnl # with the upstream community we add a check to detect this case. 79dnl # 80AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [ 81 ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [ 82 #include <linux/mutex.h> 83 ],[ 84 struct mutex lock; 85 86 mutex_init(&lock); 87 mutex_lock(&lock); 88 mutex_unlock(&lock); 89 ], [], [ZFS_META_LICENSE]) 90]) 91 92AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [ 93 AC_MSG_CHECKING([whether mutex_lock() is GPL-only]) 94 ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc_license], [ 95 AC_MSG_RESULT(no) 96 ],[ 97 AC_MSG_RESULT(yes) 98 AC_MSG_ERROR([ 99 *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible 100 *** with the CDDL license and will prevent the module linking stage 101 *** from succeeding. You must rebuild your kernel without this 102 *** option enabled.]) 103 ]) 104]) 105 106dnl # 107dnl # Check CONFIG_TRIM_UNUSED_KSYMS 108dnl # 109dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled. 110dnl # 111AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [ 112 ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [ 113 #if defined(CONFIG_TRIM_UNUSED_KSYMS) 114 #error CONFIG_TRIM_UNUSED_KSYMS not defined 115 #endif 116 ],[]) 117]) 118 119AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [ 120 AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled]) 121 ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [ 122 AC_MSG_RESULT([yes]) 123 ],[ 124 AC_MSG_RESULT([no]) 125 AS_IF([test "x$enable_linux_builtin" != xyes], [ 126 AC_MSG_ERROR([ 127 *** This kernel has unused symbols trimming enabled, please disable. 128 *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.]) 129 ]) 130 ]) 131]) 132 133dnl # 134dnl # Check CONFIG_ZLIB_INFLATE 135dnl # 136dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled. 137dnl # 138AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [ 139 ZFS_LINUX_TEST_SRC([config_zlib_inflate], [ 140 #if !defined(CONFIG_ZLIB_INFLATE) && \ 141 !defined(CONFIG_ZLIB_INFLATE_MODULE) 142 #error CONFIG_ZLIB_INFLATE not defined 143 #endif 144 ],[]) 145]) 146 147AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [ 148 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined]) 149 ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [ 150 AC_MSG_RESULT([yes]) 151 ],[ 152 AC_MSG_RESULT([no]) 153 AC_MSG_ERROR([ 154 *** This kernel does not include the required zlib inflate support. 155 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.]) 156 ]) 157]) 158 159dnl # 160dnl # Check CONFIG_ZLIB_DEFLATE 161dnl # 162dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled. 163dnl # 164AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [ 165 ZFS_LINUX_TEST_SRC([config_zlib_deflate], [ 166 #if !defined(CONFIG_ZLIB_DEFLATE) && \ 167 !defined(CONFIG_ZLIB_DEFLATE_MODULE) 168 #error CONFIG_ZLIB_DEFLATE not defined 169 #endif 170 ],[]) 171]) 172 173AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [ 174 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined]) 175 ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [ 176 AC_MSG_RESULT([yes]) 177 ],[ 178 AC_MSG_RESULT([no]) 179 AC_MSG_ERROR([ 180 *** This kernel does not include the required zlib deflate support. 181 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.]) 182 ]) 183]) 184