Fix dependency install on Debian 11 (#16683)
[zfs.git] / config / kernel-assign_str.m4
blobcf4b00e7cbf2a8639a0083bae49a225ab4efdbf7
1 dnl #
2 dnl # 6.10 kernel, check number of args of __assign_str() for trace:
3 dnl
4 dnl # 6.10+:           one arg
5 dnl # 6.9 and older:   two args
6 dnl #
7 dnl # More specifically, this will test to see if __assign_str() takes one
8 dnl # arg.  If __assign_str() takes two args, or is not defined, then
9 dnl # HAVE_1ARG_ASSIGN_STR will not be set.
10 dnl #
11 AC_DEFUN([ZFS_AC_KERNEL_1ARG_ASSIGN_STR], [
12        AC_MSG_CHECKING([whether __assign_str() has one arg])
13        ZFS_LINUX_TRY_COMPILE_HEADER([
14                #include <linux/module.h>
15                MODULE_LICENSE("$ZFS_META_LICENSE");
17                #define CREATE_TRACE_POINTS
18                #include "conftest.h"
19        ],[
20                trace_zfs_autoconf_event_one("1");
21                trace_zfs_autoconf_event_two("2");
22        ],[
23                AC_MSG_RESULT(yes)
24                AC_DEFINE(HAVE_1ARG_ASSIGN_STR, 1,
25                    [__assign_str() has one arg])
26        ],[
27                AC_MSG_RESULT(no)
28        ],[
29                #if !defined(_CONFTEST_H) || defined(TRACE_HEADER_MULTI_READ)
30                #define _CONFTEST_H
32                #undef  TRACE_SYSTEM
33                #define TRACE_SYSTEM zfs
34                #include <linux/tracepoint.h>
36                DECLARE_EVENT_CLASS(zfs_autoconf_event_class,
37                        TP_PROTO(char *string),
38                        TP_ARGS(string),
39                        TP_STRUCT__entry(
40                                __string(str, string)
41                        ),
42                        TP_fast_assign(
43                                __assign_str(str);
44                        ),
45                        TP_printk("str = %s", __get_str(str))
46                );
48                #define DEFINE_AUTOCONF_EVENT(name) \
49                DEFINE_EVENT(zfs_autoconf_event_class, name, \
50                        TP_PROTO(char * str), \
51                        TP_ARGS(str))
52                DEFINE_AUTOCONF_EVENT(zfs_autoconf_event_one);
53                DEFINE_AUTOCONF_EVENT(zfs_autoconf_event_two);
55                #endif /* _CONFTEST_H */
57                #undef  TRACE_INCLUDE_PATH
58                #define TRACE_INCLUDE_PATH .
59                #define TRACE_INCLUDE_FILE conftest
60                #include <trace/define_trace.h>
61        ])