summaryrefslogtreecommitdiff
path: root/m4/package_libcdev.m4
blob: a0d50f4d9b68e47e8acb6adedf6159fe177e6d9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
#
# Check if we have a copy_file_range system call (Linux)
#
AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
  [ AC_MSG_CHECKING([for copy_file_range])
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <sys/syscall.h>
#include <unistd.h>
    ]], [[
         syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
    ]])],[have_copy_file_range=yes
       AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
    AC_SUBST(have_copy_file_range)
  ])

# Check if we have SEEK_DATA
AC_DEFUN([AC_HAVE_SEEK_DATA],
  [ AC_MSG_CHECKING([for SEEK_DATA])
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <sys/types.h>
#include <unistd.h>
    ]], [[
         lseek(-1, 0, SEEK_DATA);
    ]])],[have_seek_data=yes
       AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
    AC_SUBST(have_seek_data)
  ])

# Check if we have nftw
AC_DEFUN([AC_HAVE_NFTW],
  [ AC_MSG_CHECKING([for nftw])
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <stddef.h>
#include <ftw.h>
    ]], [[
         nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, FTW_ACTIONRETVAL);
    ]])],[have_nftw=yes
       AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
    AC_SUBST(have_nftw)
  ])

# Check if we have RLIMIT_NOFILE
AC_DEFUN([AC_HAVE_RLIMIT_NOFILE],
  [ AC_MSG_CHECKING([for RLIMIT_NOFILE])
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <sys/time.h>
#include <sys/resource.h>
    ]], [[
         struct rlimit rlimit;

         rlimit.rlim_cur = 0;
         getrlimit(RLIMIT_NOFILE, &rlimit);
    ]])],[have_rlimit_nofile=yes
       AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
    AC_SUBST(have_rlimit_nofile)
  ])

# Check if we have FICLONE
AC_DEFUN([AC_HAVE_FICLONE],
  [ AC_MSG_CHECKING([for FICLONE])
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/ioctl.h>
#include <linux/fs.h>
    ]], [[
	 ioctl(-1, FICLONE, -1);
    ]])],[have_ficlone=yes
       AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
    AC_SUBST(have_ficlone)
  ])