xref: /freebsd/sys/contrib/openzfs/config/kernel-types.m4 (revision aca928a50a42f00f344df934005b09dbcb4e2f77)
1dnl #
2dnl # check if kernel provides definitions for given types
3dnl #
4
5dnl _ZFS_AC_KERNEL_SRC_TYPE(type)
6AC_DEFUN([_ZFS_AC_KERNEL_SRC_TYPE], [
7	ZFS_LINUX_TEST_SRC([type_$1], [
8		#include <linux/types.h>
9	],[
10		const $1 __attribute__((unused)) x = ($1) 0;
11	])
12])
13
14dnl _ZFS_AC_KERNEL_TYPE(type)
15AC_DEFUN([_ZFS_AC_KERNEL_TYPE], [
16	AC_MSG_CHECKING([whether kernel defines $1])
17	ZFS_LINUX_TEST_RESULT([type_$1], [
18		AC_MSG_RESULT([yes])
19		AC_DEFINE([HAVE_KERNEL_]m4_quote(m4_translit([$1], [a-z], [A-Z])),
20		    1, [kernel defines $1])
21	], [
22		AC_MSG_RESULT([no])
23	])
24])
25
26dnl ZFS_AC_KERNEL_TYPES([types...])
27AC_DEFUN([ZFS_AC_KERNEL_TYPES], [
28	AC_DEFUN([ZFS_AC_KERNEL_SRC_TYPES], [
29		m4_foreach_w([type], [$1], [
30			_ZFS_AC_KERNEL_SRC_TYPE(type)
31		])
32	])
33	AC_DEFUN([ZFS_AC_KERNEL_TYPES], [
34		m4_foreach_w([type], [$1], [
35			_ZFS_AC_KERNEL_TYPE(type)
36		])
37	])
38])
39
40ZFS_AC_KERNEL_TYPES([intptr_t])
41