1dnl #
2dnl # 6.8.x replaced strlcpy with strscpy. Check for both so we can provide
3dnl # appropriate fallbacks.
4dnl #
5AC_DEFUN([ZFS_AC_KERNEL_SRC_STRLCPY], [
6	ZFS_LINUX_TEST_SRC([kernel_has_strlcpy], [
7		#include <linux/string.h>
8	], [
9		const char *src = "goodbye";
10		char dst[32];
11		size_t len;
12		len = strlcpy(dst, src, sizeof (dst));
13	])
14])
15
16AC_DEFUN([ZFS_AC_KERNEL_SRC_STRSCPY], [
17	ZFS_LINUX_TEST_SRC([kernel_has_strscpy], [
18		#include <linux/string.h>
19	], [
20		const char *src = "goodbye";
21		char dst[32];
22		ssize_t len;
23		len = strscpy(dst, src, sizeof (dst));
24	])
25])
26
27AC_DEFUN([ZFS_AC_KERNEL_STRLCPY], [
28	AC_MSG_CHECKING([whether strlcpy() exists])
29	ZFS_LINUX_TEST_RESULT([kernel_has_strlcpy], [
30		AC_MSG_RESULT([yes])
31		AC_DEFINE(HAVE_KERNEL_STRLCPY, 1,
32			[strlcpy() exists])
33	], [
34		AC_MSG_RESULT([no])
35	])
36])
37
38AC_DEFUN([ZFS_AC_KERNEL_STRSCPY], [
39	AC_MSG_CHECKING([whether strscpy() exists])
40	ZFS_LINUX_TEST_RESULT([kernel_has_strscpy], [
41		AC_MSG_RESULT([yes])
42		AC_DEFINE(HAVE_KERNEL_STRSCPY, 1,
43			[strscpy() exists])
44	], [
45		AC_MSG_RESULT([no])
46	])
47])
48