]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-fpu.m4
Allow mounting snapshots in .zfs/snapshot as a regular user
[mirror_zfs.git] / config / kernel-fpu.m4
CommitLineData
8e94ac0e 1dnl #
0c593296 2dnl # Handle differences in kernel FPU code.
fc0c72b1 3dnl #
0c593296 4dnl # Kernel
4c652620
BB
5dnl # 5.19: The asm/fpu/internal.h header was removed, it has been
6dnl # effectively empty since the 5.16 kernel.
7dnl #
4d14a285
AF
8dnl # 5.11: kernel_fpu_begin() is an inlined function now, so don't check
9dnl # for it inside the kernel symbols.
10dnl #
10fa2545 11dnl # 5.0: Wrappers have been introduced to save/restore the FPU state.
e5db3134 12dnl # This change was made to the 4.19.38 and 4.14.120 LTS kernels.
10fa2545 13dnl # HAVE_KERNEL_FPU_INTERNAL
0c593296
TH
14dnl #
15dnl # 4.2: Use __kernel_fpu_{begin,end}()
16dnl # HAVE_UNDERSCORE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
17dnl #
18dnl # Pre-4.2: Use kernel_fpu_{begin,end}()
19dnl # HAVE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
fc0c72b1 20dnl #
608f8749
BB
21dnl # N.B. The header check is performed before all other checks since it
22dnl # depends on HAVE_KERNEL_FPU_API_HEADER being set in confdefs.h.
23dnl #
24AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [
25 AC_MSG_CHECKING([whether fpu headers are available])
fc0c72b1 26 ZFS_LINUX_TRY_COMPILE([
becdcec7
TH
27 #include <linux/module.h>
28 #include <asm/fpu/api.h>
29 ],[
30 ],[
8062b768
BB
31 AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1,
32 [kernel has asm/fpu/api.h])
4c652620
BB
33
34 ZFS_LINUX_TRY_COMPILE([
35 #include <linux/module.h>
36 #include <asm/fpu/internal.h>
37 ],[
38 ],[
39 AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL_HEADER, 1,
40 [kernel has asm/fpu/internal.h])
41 AC_MSG_RESULT([asm/fpu/api.h asm/fpu/internal.h])
42 ],[
43 AC_MSG_RESULT([asm/fpu/api.h])
44 ])
becdcec7 45 ],[
4c652620 46 AC_MSG_RESULT([i387.h])
becdcec7 47 ])
4c652620 48
608f8749 49])
becdcec7 50
608f8749
BB
51AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
52 ZFS_LINUX_TEST_SRC([kernel_fpu], [
10fa2545 53 #include <linux/types.h>
becdcec7
TH
54 #ifdef HAVE_KERNEL_FPU_API_HEADER
55 #include <asm/fpu/api.h>
4c652620 56 #ifdef HAVE_KERNEL_FPU_INTERNAL_HEADER
ce7a5dbf 57 #include <asm/fpu/internal.h>
4c652620 58 #endif
becdcec7 59 #else
0c593296 60 #include <asm/i387.h>
becdcec7 61 #endif
608f8749 62 ], [
0c593296
TH
63 kernel_fpu_begin();
64 kernel_fpu_end();
c347fac5 65 ], [], [ZFS_META_LICENSE])
608f8749
BB
66
67 ZFS_LINUX_TEST_SRC([__kernel_fpu], [
10fa2545 68 #include <linux/types.h>
608f8749
BB
69 #ifdef HAVE_KERNEL_FPU_API_HEADER
70 #include <asm/fpu/api.h>
4c652620 71 #ifdef HAVE_KERNEL_FPU_INTERNAL_HEADER
ce7a5dbf 72 #include <asm/fpu/internal.h>
4c652620 73 #endif
608f8749
BB
74 #else
75 #include <asm/i387.h>
608f8749
BB
76 #endif
77 ], [
78 __kernel_fpu_begin();
79 __kernel_fpu_end();
c347fac5 80 ], [], [ZFS_META_LICENSE])
608f8749 81
608f8749
BB
82])
83
84AC_DEFUN([ZFS_AC_KERNEL_FPU], [
85 dnl #
86 dnl # Legacy kernel
87 dnl #
88 AC_MSG_CHECKING([whether kernel fpu is available])
4d14a285 89 ZFS_LINUX_TEST_RESULT([kernel_fpu_license], [
0c593296 90 AC_MSG_RESULT(kernel_fpu_*)
8062b768
BB
91 AC_DEFINE(HAVE_KERNEL_FPU, 1,
92 [kernel has kernel_fpu_* functions])
93 AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
94 [kernel exports FPU functions])
fc0c72b1 95 ],[
608f8749
BB
96 dnl #
97 dnl # Linux 4.2 kernel
98 dnl #
99 ZFS_LINUX_TEST_RESULT_SYMBOL([__kernel_fpu_license],
100 [__kernel_fpu_begin],
101 [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
0c593296 102 AC_MSG_RESULT(__kernel_fpu_*)
e5db3134
BB
103 AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1,
104 [kernel has __kernel_fpu_* functions])
105 AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
106 [kernel exports FPU functions])
0c593296 107 ],[
ce7a5dbf
AF
108 AC_MSG_RESULT(internal)
109 AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
110 [kernel fpu internal])
0c593296 111 ])
fc0c72b1
GN
112 ])
113])