]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - m4/package_libcdev.m4
build: Add fls check into autoconf
[thirdparty/xfsprogs-dev.git] / m4 / package_libcdev.m4
CommitLineData
0bba1a49
NS
1#
2# Check if we have a working fadvise system call
3#
4AC_DEFUN([AC_HAVE_FADVISE],
5 [ AC_MSG_CHECKING([for fadvise ])
6 AC_TRY_COMPILE([
7#define _GNU_SOURCE
8#define _FILE_OFFSET_BITS 64
9#include <fcntl.h>
10 ], [
38c187fe 11 posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
0bba1a49
NS
12 ], have_fadvise=yes
13 AC_MSG_RESULT(yes),
14 AC_MSG_RESULT(no))
15 AC_SUBST(have_fadvise)
16 ])
17
18#
19# Check if we have a working madvise system call
20#
21AC_DEFUN([AC_HAVE_MADVISE],
22 [ AC_MSG_CHECKING([for madvise ])
23 AC_TRY_COMPILE([
24#define _GNU_SOURCE
25#define _FILE_OFFSET_BITS 64
26#include <sys/mman.h>
27 ], [
28 posix_madvise(0, 0, MADV_NORMAL);
29 ], have_madvise=yes
30 AC_MSG_RESULT(yes),
31 AC_MSG_RESULT(no))
32 AC_SUBST(have_madvise)
33 ])
34
35#
36# Check if we have a working mincore system call
37#
38AC_DEFUN([AC_HAVE_MINCORE],
39 [ AC_MSG_CHECKING([for mincore ])
40 AC_TRY_COMPILE([
41#define _GNU_SOURCE
42#define _FILE_OFFSET_BITS 64
43#include <sys/mman.h>
44 ], [
45 mincore(0, 0, 0);
46 ], have_mincore=yes
47 AC_MSG_RESULT(yes),
48 AC_MSG_RESULT(no))
49 AC_SUBST(have_mincore)
50 ])
51
52#
53# Check if we have a working sendfile system call
54#
55AC_DEFUN([AC_HAVE_SENDFILE],
56 [ AC_MSG_CHECKING([for sendfile ])
57 AC_TRY_COMPILE([
58#define _GNU_SOURCE
59#define _FILE_OFFSET_BITS 64
60#include <sys/sendfile.h>
61 ], [
62 sendfile(0, 0, 0, 0);
63 ], have_sendfile=yes
64 AC_MSG_RESULT(yes),
65 AC_MSG_RESULT(no))
66 AC_SUBST(have_sendfile)
67 ])
cfe6e3f0
NS
68
69#
70# Check if we have a getmntent libc call (IRIX, Linux)
71#
72AC_DEFUN([AC_HAVE_GETMNTENT],
73 [ AC_MSG_CHECKING([for getmntent ])
74 AC_TRY_COMPILE([
75#include <stdio.h>
76#include <mntent.h>
77 ], [
78 getmntent(0);
79 ], have_getmntent=yes
80 AC_MSG_RESULT(yes),
81 AC_MSG_RESULT(no))
82 AC_SUBST(have_getmntent)
83 ])
84
85#
86# Check if we have a getmntinfo libc call (FreeBSD, Mac OS X)
87#
88AC_DEFUN([AC_HAVE_GETMNTINFO],
89 [ AC_MSG_CHECKING([for getmntinfo ])
90 AC_TRY_COMPILE([
91#include <sys/param.h>
92#include <sys/ucred.h>
93#include <sys/mount.h>
94 ], [
95 getmntinfo(0, 0);
96 ], have_getmntinfo=yes
97 AC_MSG_RESULT(yes),
98 AC_MSG_RESULT(no))
99 AC_SUBST(have_getmntinfo)
100 ])
c0b5232a
ES
101
102#
103# Check if we have a fallocate libc call (Linux)
104#
105AC_DEFUN([AC_HAVE_FALLOCATE],
106 [ AC_MSG_CHECKING([for fallocate])
107 AC_TRY_LINK([
c17c73e2
ES
108#define _GNU_SOURCE
109#define _FILE_OFFSET_BITS 64
110#include <fcntl.h>
c0b5232a
ES
111#include <linux/falloc.h>
112 ], [
113 fallocate(0, 0, 0, 0);
114 ], have_fallocate=yes
115 AC_MSG_RESULT(yes),
116 AC_MSG_RESULT(no))
117 AC_SUBST(have_fallocate)
118 ])
8f0e0912
CH
119
120#
121# Check if we have the fiemap ioctl (Linux)
122#
123AC_DEFUN([AC_HAVE_FIEMAP],
2912da5d
NS
124 [ AC_MSG_CHECKING([for fiemap])
125 AC_TRY_LINK([
126#define _GNU_SOURCE
127#define _FILE_OFFSET_BITS 64
128#include <linux/fs.h>
129#include <linux/fiemap.h>
130 ], [
131 struct fiemap *fiemap;
132 ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
133 ], have_fiemap=yes
134 AC_MSG_RESULT(yes),
135 AC_MSG_RESULT(no))
8f0e0912
CH
136 AC_SUBST(have_fiemap)
137 ])
197d5828
ES
138
139#
140# Check if we have a preadv libc call (Linux)
141#
142AC_DEFUN([AC_HAVE_PREADV],
143 [ AC_MSG_CHECKING([for preadv])
144 AC_TRY_LINK([
145#define _FILE_OFFSET_BITS 64
146#define _BSD_SOURCE
147#include <sys/uio.h>
148 ], [
149 preadv(0, 0, 0, 0);
150 ], have_preadv=yes
151 AC_MSG_RESULT(yes),
152 AC_MSG_RESULT(no))
153 AC_SUBST(have_preadv)
154 ])
155
156#
157# Check if we have a sync_file_range libc call (Linux)
158#
159AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
160 [ AC_MSG_CHECKING([for sync_file_range])
161 AC_TRY_LINK([
162#define _GNU_SOURCE
163#define _FILE_OFFSET_BITS 64
164#include <fcntl.h>
165 ], [
166 sync_file_range(0, 0, 0, 0);
167 ], have_sync_file_range=yes
168 AC_MSG_RESULT(yes),
169 AC_MSG_RESULT(no))
170 AC_SUBST(have_sync_file_range)
171 ])
172
c7dd81c7
ES
173#
174# Check if we have a syncfs libc call (Linux)
175#
176AC_DEFUN([AC_HAVE_SYNCFS],
177 [ AC_MSG_CHECKING([for syncfs])
178 AC_TRY_LINK([
179#define _GNU_SOURCE
180#define _FILE_OFFSET_BITS 64
181#include <unistd.h>
182 ], [
183 syncfs(0);
184 ], have_sync_fs=yes
185 AC_MSG_RESULT(yes),
186 AC_MSG_RESULT(no))
187 AC_SUBST(have_syncfs)
188 ])
189
3bc05641
BF
190#
191# Check if we have a readdir libc call
192#
193AC_DEFUN([AC_HAVE_READDIR],
194 [ AC_MSG_CHECKING([for readdir])
195 AC_TRY_LINK([
196#include <dirent.h>
197 ], [
198 readdir(0);
199 ], have_readdir=yes
200 AC_MSG_RESULT(yes),
201 AC_MSG_RESULT(no))
202 AC_SUBST(have_readdir)
203 ])
204
5121281b
JT
205#
206# Check if we have a flc call (Mac OS X)
207#
208AC_DEFUN([AC_HAVE_FLS],
209 [ AC_CHECK_DECL([fls],
210 have_fls=yes,
211 [],
212 [#include <string.h>]
213 )
214 AC_SUBST(have_fls)
215 ])
216
5ae294ea
JT
217#
218# Check if there is mntent.h
219#
220AC_DEFUN([AC_HAVE_MNTENT],
221 [ AC_CHECK_HEADERS(mntent.h,
222 have_mntent=yes)
223 AC_SUBST(have_mntent)
224 ])