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