xref: /freebsd/sys/contrib/openzfs/config/kernel-cpu_has_feature.m4 (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1dnl #
2dnl # cpu_has_feature() may referencing GPL-only cpu_feature_keys on powerpc
3dnl #
4
5dnl #
6dnl # Checking if cpu_has_feature is exported GPL-only
7dnl #
8AC_DEFUN([ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE], [
9	ZFS_LINUX_TEST_SRC([cpu_has_feature], [
10		#include <linux/version.h>
11		#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
12		#include <asm/cpu_has_feature.h>
13		#else
14		#include <asm/cputable.h>
15		#endif
16	], [
17		return cpu_has_feature(CPU_FTR_ALTIVEC) ? 0 : 1;
18	], [], [ZFS_META_LICENSE])
19])
20AC_DEFUN([ZFS_AC_KERNEL_CPU_HAS_FEATURE], [
21	AC_MSG_CHECKING([whether cpu_has_feature() is GPL-only])
22	ZFS_LINUX_TEST_RESULT([cpu_has_feature_license], [
23		AC_MSG_RESULT(no)
24	], [
25		AC_MSG_RESULT(yes)
26		AC_DEFINE(HAVE_CPU_HAS_FEATURE_GPL_ONLY, 1,
27		    [cpu_has_feature() is GPL-only])
28	])
29])
30