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