1dnl #
2dnl # Linux 5.15 gets rid of -isystem and external <stdarg.h> inclusion
3dnl # and ships its own <linux/stdarg.h>. Check if this header file does
4dnl # exist and provide all necessary definitions for variable argument
5dnl # functions. Adjust the inclusion of <stdarg.h> according to the
6dnl # results.
7dnl #
8AC_DEFUN([ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG], [
9	ZFS_LINUX_TEST_SRC([has_standalone_linux_stdarg], [
10		#include <linux/stdarg.h>
11
12		#if !defined(va_start) || !defined(va_end) || \
13		    !defined(va_arg) || !defined(va_copy)
14		#error "<linux/stdarg.h> is invalid"
15		#endif
16	],[])
17])
18
19AC_DEFUN([ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG], [
20	dnl #
21	dnl # Linux 5.15 ships its own stdarg.h and doesn't allow to
22	dnl # include compiler headers.
23	dnl #
24	AC_MSG_CHECKING([whether standalone <linux/stdarg.h> exists])
25	ZFS_LINUX_TEST_RESULT([has_standalone_linux_stdarg], [
26		AC_MSG_RESULT([yes])
27		AC_DEFINE(HAVE_STANDALONE_LINUX_STDARG, 1,
28			[standalone <linux/stdarg.h> exists])
29	],[
30		AC_MSG_RESULT([no])
31	])
32])
33