generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / m4 / package_libcdev.m4
1 #
2 #
3 # Check if we have a copy_file_range system call (Linux)
4 #
5 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
6   [ AC_MSG_CHECKING([for copy_file_range])
7     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
8 #define _GNU_SOURCE
9 #include <sys/syscall.h>
10 #include <unistd.h>
11     ]], [[
12          syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
13     ]])],[have_copy_file_range=yes
14        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
15     AC_SUBST(have_copy_file_range)
16   ])
17
18 # Check if we have SEEK_DATA
19 AC_DEFUN([AC_HAVE_SEEK_DATA],
20   [ AC_MSG_CHECKING([for SEEK_DATA])
21     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
22 #define _GNU_SOURCE
23 #include <sys/types.h>
24 #include <unistd.h>
25     ]], [[
26          lseek(-1, 0, SEEK_DATA);
27     ]])],[have_seek_data=yes
28        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
29     AC_SUBST(have_seek_data)
30   ])
31
32 # Check if we have nftw
33 AC_DEFUN([AC_HAVE_NFTW],
34   [ AC_MSG_CHECKING([for nftw])
35     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
36 #define _GNU_SOURCE
37 #include <stddef.h>
38 #include <ftw.h>
39     ]], [[
40          nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, FTW_ACTIONRETVAL);
41     ]])],[have_nftw=yes
42        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
43     AC_SUBST(have_nftw)
44   ])
45
46 # Check if we have RLIMIT_NOFILE
47 AC_DEFUN([AC_HAVE_RLIMIT_NOFILE],
48   [ AC_MSG_CHECKING([for RLIMIT_NOFILE])
49     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
50 #define _GNU_SOURCE
51 #include <sys/time.h>
52 #include <sys/resource.h>
53     ]], [[
54          struct rlimit rlimit;
55
56          rlimit.rlim_cur = 0;
57          getrlimit(RLIMIT_NOFILE, &rlimit);
58     ]])],[have_rlimit_nofile=yes
59        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
60     AC_SUBST(have_rlimit_nofile)
61   ])
62
63 # Check if we have FICLONE
64 AC_DEFUN([AC_HAVE_FICLONE],
65   [ AC_MSG_CHECKING([for FICLONE])
66     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
67 #include <sys/ioctl.h>
68 #include <linux/fs.h>
69     ]], [[
70          ioctl(-1, FICLONE, -1);
71     ]])],[have_ficlone=yes
72        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
73     AC_SUBST(have_ficlone)
74   ])